You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
NewEduCoderBuild/9221.8410f8f4.async.js

5255 lines
3.0 MiB

This file contains invisible Unicode characters!

This file contains invisible Unicode characters that may be processed differently from what appears below. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to reveal hidden characters.

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

!(function(){var X$=Object.defineProperty,j$=Object.defineProperties;var Y$=Object.getOwnPropertyDescriptors;var CP=Object.getOwnPropertySymbols,q$=Object.getPrototypeOf,J$=Object.prototype.hasOwnProperty,eX=Object.prototype.propertyIsEnumerable,tX=Reflect.get;var Bp=Math.pow,IE=(Be,Me,b)=>Me in Be?X$(Be,Me,{enumerable:!0,configurable:!0,writable:!0,value:b}):Be[Me]=b,rl=(Be,Me)=>{for(var b in Me||(Me={}))J$.call(Me,b)&&IE(Be,b,Me[b]);if(CP)for(var b of CP(Me))eX.call(Me,b)&&IE(Be,b,Me[b]);return Be},fd=(Be,Me)=>j$(Be,Y$(Me));var _c=(Be,Me,b)=>IE(Be,typeof Me!="symbol"?Me+"":Me,b);var TP=(Be,Me,b)=>tX(q$(Be),b,Me);var Pa=(Be,Me,b)=>new Promise((m,Z)=>{var V=F=>{try{E(b.next(F))}catch(C){Z(C)}},N=F=>{try{E(b.throw(F))}catch(C){Z(C)}},E=F=>F.done?m(F.value):Promise.resolve(F.value).then(V,N);E((b=b.apply(Be,Me)).next())});(self.webpackChunk=self.webpackChunk||[]).push([[9221],{61485:function(Be,Me,b){"use strict";b.d(Me,{Z:function(){return P}});var m=b(54476),Z=b(59301),V={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z"}},{tag:"path",attrs:{d:"M623.6 316.7C593.6 290.4 554 276 512 276s-81.6 14.5-111.6 40.7C369.2 344 352 380.7 352 420v7.6c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V420c0-44.1 43.1-80 96-80s96 35.9 96 80c0 31.1-22 59.6-56.1 72.7-21.2 8.1-39.2 22.3-52.1 40.9-13.1 19-19.9 41.8-19.9 64.9V620c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8v-22.7a48.3 48.3 0 0130.9-44.8c59-22.7 97.1-74.7 97.1-132.5.1-39.3-17.1-76-48.3-103.3zM472 732a40 40 0 1080 0 40 40 0 10-80 0z"}}]},name:"question-circle",theme:"outlined"},N=V,E=b(85221),F=function(D,X){return Z.createElement(E.Z,(0,m.Z)({},D,{ref:X,icon:N}))},C=Z.forwardRef(F),P=C},55532:function(Be,Me,b){"use strict";b.d(Me,{ni:function(){return Uh},EF:function(){return yh}});var m=function(me,ce){var Ze=me.nodes,le=me.edges,Nt=[],Dt={};if(!Ze)throw new Error("invalid nodes data!");return Ze&&Ze.forEach(function(pn,Dn){Dt[pn.id]=Dn;var hr=[];Nt.push(hr)}),le&&le.forEach(function(pn){var Dn=pn.source,hr=pn.target,br=Dt[Dn],yr=Dt[hr];!br&&br!==0||!yr&&yr!==0||(Nt[br][yr]=1,ce||(Nt[yr][br]=1))}),Nt},Z=m,V=function(me,ce){return me===ce},N=function(){function He(me,ce){ce===void 0&&(ce=null),this.value=me,this.next=ce}return He.prototype.toString=function(me){return me?me(this.value):"".concat(this.value)},He}(),E=function(){function He(me){me===void 0&&(me=V),this.head=null,this.tail=null,this.compare=me}return He.prototype.prepend=function(me){var ce=new N(me,this.head);return this.head=ce,this.tail||(this.tail=ce),this},He.prototype.append=function(me){var ce=new N(me);return this.head?(this.tail.next=ce,this.tail=ce,this):(this.head=ce,this.tail=ce,this)},He.prototype.delete=function(me){if(!this.head)return null;for(var ce=null;this.head&&this.compare(this.head.value,me);)ce=this.head,this.head=this.head.next;var Ze=this.head;if(Ze!==null)for(;Ze.next;)this.compare(Ze.next.value,me)?(ce=Ze.next,Ze.next=Ze.next.next):Ze=Ze.next;return this.compare(this.tail.value,me)&&(this.tail=Ze),ce},He.prototype.find=function(me){var ce=me.value,Ze=ce===void 0?void 0:ce,le=me.callback,Nt=le===void 0?void 0:le;if(!this.head)return null;for(var Dt=this.head;Dt;){if(Nt&&Nt(Dt.value)||Ze!==void 0&&this.compare(Dt.value,Ze))return Dt;Dt=Dt.next}return null},He.prototype.deleteTail=function(){var me=this.tail;if(this.head===this.tail)return this.head=null,this.tail=null,me;for(var ce=this.head;ce.next;)ce.next.next?ce=ce.next:ce.next=null;return this.tail=ce,me},He.prototype.deleteHead=function(){if(!this.head)return null;var me=this.head;return this.head.next?this.head=this.head.next:(this.head=null,this.tail=null),me},He.prototype.fromArray=function(me){var ce=this;return me.forEach(function(Ze){return ce.append(Ze)}),this},He.prototype.toArray=function(){for(var me=[],ce=this.head;ce;)me.push(ce),ce=ce.next;return me},He.prototype.reverse=function(){for(var me=this.head,ce=null,Ze=null;me;)Ze=me.next,me.next=ce,ce=me,me=Ze;this.tail=this.head,this.head=ce},He.prototype.toString=function(me){return me===void 0&&(me=void 0),this.toArray().map(function(ce){return ce.toString(me)}).toString()},He}(),F=E,C=function(){function He(){this.linkedList=new F}return He.prototype.isEmpty=function(){return!this.linkedList.head},He.prototype.peek=function(){return this.linkedList.head?this.linkedList.head.value:null},He.prototype.enqueue=function(me){this.linkedList.append(me)},He.prototype.dequeue=function(){var me=this.linkedList.deleteHead();return me?me.value:null},He.prototype.toString=function(me){return this.linkedList.toString(me)},He}(),P=C,H=function(me,ce,Ze){ce===void 0&&(ce=[]);var le=ce.filter(function(Dn){return Dn.source===me||Dn.target===me});if(Ze==="target"){var Nt=function(hr){return hr.source===me};return le.filter(Nt).map(function(Dn){return Dn.target})}if(Ze==="source"){var Dt=function(hr){return hr.target===me};return le.filter(Dt).map(function(Dn){return Dn.source})}var pn=function(hr){return hr.source===me?hr.target:hr.source};return le.map(pn)},D=function(me,ce){return ce.filter(function(Ze){return Ze.source===me})},X=function(me,ce){return ce.filter(function(Ze){return Ze.source===me||Ze.target===me})},j=function(me){me===void 0&&(me=0);var ce="".concat(Math.random()).split(".")[1].substr(0,5),Ze="".concat(Math.random()).split(".")[1].substr(0,5);return"".concat(me,"-").concat(ce).concat(Ze)};function de(He){He===void 0&&(He={});var me=He,ce=function(){},Ze=function(){var le={};return function(Nt){var Dt=Nt.next,pn=Dt;return le[pn]?!1:(le[pn]=!0,!0)}}();return me.allowTraversal=He.allowTraversal||Ze,me.enter=He.enter||ce,me.leave=He.leave||ce,me}var he=function(me,ce,Ze,le){le===void 0&&(le=!0);var Nt=de(Ze),Dt=new P,pn=me.edges,Dn=pn===void 0?[]:pn;Dt.enqueue(ce);for(var hr="",br=function(){var xr=Dt.dequeue();Nt.enter({current:xr,previous:hr}),H(xr,Dn,le?"target":void 0).forEach(function(Fr){Nt.allowTraversal({previous:hr,current:xr,next:Fr})&&Dt.enqueue(Fr)}),Nt.leave({current:xr,previous:hr}),hr=xr};!Dt.isEmpty();)br()},we=he,ve=function(me){for(var ce=me.nodes,Ze=ce===void 0?[]:ce,le=me.edges,Nt=le===void 0?[]:le,Dt=[],pn={},Dn=[],hr=function Fr(ri){Dn.push(ri),pn[ri.id]=!0;for(var ai=H(ri.id,Nt),wi=function(as){var Bs=ai[as];if(!pn[Bs]){var Ls=Ze.filter(function(zi){return zi.id===Bs});Ls.length>0&&Fr(Ls[0])}},Vi=0;Vi<ai.length;++Vi)wi(Vi)},br=0;br<Ze.length;br++){var yr=Ze[br];if(!pn[yr.id]){hr(yr);for(var xr=[];Dn.length>0;)xr.push(Dn.pop());Dt.push(xr)}}return Dt},Ee=function(me){for(var ce=me.nodes,Ze=ce===void 0?[]:ce,le=me.edges,Nt=le===void 0?[]:le,Dt=[],pn={},Dn={},hr={},br=[],yr=0,xr=function wi(Vi){Dn[Vi.id]=yr,hr[Vi.id]=yr,yr+=1,Dt.push(Vi),pn[Vi.id]=!0;for(var rs=H(Vi.id,Nt,"target").filter(function(Ni){return Ze.map(function(Ns){return Ns.id}).indexOf(Ni)>-1}),as=function(Ns){var Os=rs[Ns];if(!Dn[Os]&&Dn[Os]!==0){var _a=Ze.filter(function(Sa){return Sa.id===Os});_a.length>0&&wi(_a[0]),hr[Vi.id]=Math.min(hr[Vi.id],hr[Os])}else pn[Os]&&(hr[Vi.id]=Math.min(hr[Vi.id],Dn[Os]))},Bs=0;Bs<rs.length;Bs++)as(Bs);if(hr[Vi.id]===Dn[Vi.id]){for(var Ls=[];Dt.length>0;){var zi=Dt.pop();if(pn[zi.id]=!1,Ls.push(zi),zi===Vi)break}Ls.length>0&&br.push(Ls)}},Fr=0,ri=Ze;Fr<ri.length;Fr++){var ai=ri[Fr];!Dn[ai.id]&&Dn[ai.id]!==0&&xr(ai)}return br};function $e(He,me){return me?Ee(He):ve(He)}var Fe=function(me){var ce={},Ze=me.nodes,le=Ze===void 0?[]:Ze,Nt=me.edges,Dt=Nt===void 0?[]:Nt;return le.forEach(function(pn){ce[pn.id]={degree:0,inDegree:0,outDegree:0}}),Dt.forEach(function(pn){ce[pn.source].degree++,ce[pn.source].outDegree++,ce[pn.target].degree++,ce[pn.target].inDegree++}),ce},ct=Fe,vt=function(me,ce){var Ze=Fe(me);return Ze[ce]?Fe(me)[ce].inDegree:0},at=function(me,ce){var Ze=Fe(me);return Ze[ce]?Fe(me)[ce].outDegree:0};function kt(He){He===void 0&&(He={});var me=He,ce=function(){},Ze=function(){var le={};return function(Nt){var Dt=Nt.next;return le[Dt]?!1:(le[Dt]=!0,!0)}}();return me.allowTraversal=He.allowTraversal||Ze,me.enter=He.enter||ce,me.leave=He.leave||ce,me}function It(He,me,ce,Ze,le){le===void 0&&(le=!0),Ze.enter({current:me,previous:ce});var Nt=He.edges,Dt=Nt===void 0?[]:Nt;H(me,Dt,le?"target":void 0).forEach(function(pn){Ze.allowTraversal({previous:ce,current:me,next:pn})&&It(He,pn,me,Ze,le)}),Ze.leave({current:me,previous:ce})}function Bn(He,me,ce,Ze){Ze===void 0&&(Ze=!0),It(He,me,"",kt(ce),Ze)}var Lt=function(me){var ce=null,Ze=me.nodes,le=Ze===void 0?[]:Ze,Nt={},Dt={},pn={},Dn={};le.forEach(function(yr){Dt[yr.id]=yr});for(var hr={enter:function(xr){var Fr=xr.current,ri=xr.previous;if(pn[Fr]){ce={};for(var ai=Fr,wi=ri;wi!==Fr;)ce[ai]=wi,ai=wi,wi=Nt[wi];ce[ai]=wi}else pn[Fr]=Fr,delete Dt[Fr],Nt[Fr]=ri},leave:function(xr){var Fr=xr.current;Dn[Fr]=Fr,delete pn[Fr]},allowTraversal:function(xr){var Fr=xr.next;return ce?!1:!Dn[Fr]}};Object.keys(Dt).length;){var br=Object.keys(Dt)[0];Bn(me,br,hr)}return ce},Wn=function(me,ce,Ze){var le,Nt;Ze===void 0&&(Ze=!0);for(var Dt=[],pn=$e(me,!1),Dn=0,hr=pn;Dn<hr.length;Dn++){var br=hr[Dn];if(br.length)for(var yr=br[0],xr=yr.id,Fr=[yr],ri=(le={},le[xr]=yr,le),ai=(Nt={},Nt[xr]=new Set,Nt);Fr.length>0;)for(var wi=Fr.pop(),Vi=wi.id,rs=H(Vi,me.edges),as=function(zi){var Ni,Ns=rs[zi],Os=me.nodes.find(function(J){return J.id===Ns});if(Ns===Vi)Dt.push((Ni={},Ni[Ns]=wi,Ni));else if(!(Ns in ai))ri[Ns]=wi,Fr.push(Os),ai[Ns]=new Set([wi]);else if(!ai[Vi].has(Os)){for(var _a=!0,Sa=[Os,wi],oe=ri[Vi];ai[Ns].size&&!ai[Ns].has(oe)&&(Sa.push(oe),oe!==ri[oe.id]);)oe=ri[oe.id];if(Sa.push(oe),ce&&Ze?(_a=!1,Sa.findIndex(function(J){return ce.indexOf(J.id)>-1})>-1&&(_a=!0)):ce&&!Ze&&Sa.findIndex(function(J){return ce.indexOf(J.id)>-1})>-1&&(_a=!1),_a){for(var re={},Y=1;Y<Sa.length;Y+=1)re[Sa[Y-1].id]=Sa[Y];Sa.length&&(re[Sa[Sa.length-1].id]=Sa[0]),Dt.push(re)}ai[Ns].add(wi)}},Bs=0;Bs<rs.length;Bs+=1)as(Bs)}return Dt},Xn=function(me,ce,Ze){Ze===void 0&&(Ze=!0);for(var le=[],Nt=new Set,Dt=[],pn=[],Dn={},hr={},br=function(oe){for(var re=[oe];re.length>0;){var Y=re.pop();Nt.has(Y)&&(Nt.delete(Y),Dt[Y.id].forEach(function(J){re.push(J)}),Dt[Y.id].clear())}},yr=function Sa(oe,re,Y){var J=!1;if(ce&&Ze===!1&&ce.indexOf(oe.id)>-1)return J;le.push(oe),Nt.add(oe);for(var fe=Y[oe.id],Te=0;Te<fe.length;Te+=1){var De=Dn[fe[Te]];if(De===re){for(var Le={},Xe=1;Xe<le.length;Xe+=1)Le[le[Xe-1].id]=le[Xe];le.length&&(Le[le[le.length-1].id]=le[0]),pn.push(Le),J=!0}else Nt.has(De)||Sa(De,re,Y)&&(J=!0)}if(J)br(oe);else for(var Te=0;Te<fe.length;Te+=1){var De=Dn[fe[Te]];Dt[De.id].has(oe)||Dt[De.id].add(oe)}return le.pop(),J},xr=me.nodes,Fr=xr===void 0?[]:xr,ri=0;ri<Fr.length;ri+=1){var ai=Fr[ri],wi=ai.id;hr[wi]=ri,Dn[ri]=ai}if(ce&&Ze)for(var Vi=function(oe){var re=ce[oe];hr[Fr[oe].id]=hr[re],hr[re]=0,Dn[0]=Fr.find(function(Y){return Y.id===re}),Dn[hr[Fr[oe].id]]=Fr[oe]},ri=0;ri<ce.length;ri++)Vi(ri);for(var rs=function(oe){for(var re,Y,J=1/0,fe=0;fe<oe.length;fe+=1)for(var Te=oe[fe],De=0;De<Te.length;De++){var Le=hr[Te[De].id];Le<J&&(J=Le,Y=fe)}for(var Xe=oe[Y],mt=[],fe=0;fe<Xe.length;fe+=1){var Kt=Xe[fe];mt[Kt.id]=[];for(var nn=0,gn=H(Kt.id,me.edges,"target").filter(function(Er){return Xe.map(function(mr){return mr.id}).indexOf(Er)>-1});nn<gn.length;nn++){var Nn=gn[nn];Nn===Kt.id&&!(Ze===!1&&ce.indexOf(Kt.id)>-1)?pn.push((re={},re[Kt.id]=Kt,re)):mt[Kt.id].push(hr[Nn])}}return{component:Xe,adjList:mt,minIdx:J}},as=0;as<Fr.length;){var Bs=Fr.filter(function(Sa){return hr[Sa.id]>=as}),Ls=Ee({nodes:Bs,edges:me.edges}).filter(function(Sa){return Sa.length>1});if(Ls.length===0)break;var zi=rs(Ls),Ni=zi.minIdx,Ns=zi.adjList,Os=zi.component;if(Os.length>1){Os.forEach(function(Sa){Dt[Sa.id]=new Set});var _a=Dn[Ni];if(ce&&Ze&&ce.indexOf(_a.id)===-1)return pn;yr(_a,_a,Ns),as=Ni+1}else break}return pn},In=function(me,ce,Ze,le){return le===void 0&&(le=!0),ce?Xn(me,Ze,le):Wn(me,Ze,le)},zn=Lt,dr=b(80813),vn={}.toString,_r=function(He,me){return vn.call(He)==="[object "+me+"]"},Ge=_r,Tt=function(He){return Ge(He,"Function")},On=function(He){return Array.isArray?Array.isArray(He):Ge(He,"Array")},Vr=function(He){var me=typeof He;return He!==null&&me==="object"||me==="function"};function en(He,me){if(He){var ce;if(On(He))for(var Ze=0,le=He.length;Ze<le&&(ce=me(He[Ze],Ze),ce!==!1);Ze++);else if(Vr(He)){for(var Nt in He)if(He.hasOwnProperty(Nt)&&(ce=me(He[Nt],Nt),ce===!1))break}}}var ln=en,Cn=Object.keys?function(He){return Object.keys(He)}:function(He){var me=[];return ln(He,function(ce,Ze){Tt(He)&&Ze==="prototype"||me.push(Ze)}),me},Mt=null;function Et(He,me){var ce=keys(me),Ze=ce.length;if(isNil(He))return!Ze;for(var le=0;le<Ze;le+=1){var Nt=ce[le];if(me[Nt]!==He[Nt]||!(Nt in He))return!1}return!0}var pe=null,Ae=function(He){if(!isObjectLike(He)||!isType(He,"Object"))return!1;if(Object.getPrototypeOf(He)===null)return!0;for(var me=He;Object.getPrototypeOf(me)!==null;)me=Object.getPrototypeOf(me);return Object.getPrototypeOf(He)===me},Pe=null;function Ut(He,me){if(!isArray(He))return null;var ce;if(isFunction(me)&&(ce=me),isPlainObject(me)&&(ce=function(le){return isMatch(le,me)}),ce){for(var Ze=0;Ze<He.length;Ze+=1)if(ce(He[Ze]))return He[Ze]}return null}var jt=null,ft=function(He,me){for(var ce=null,Ze=0;Ze<He.length;Ze++){var le=He[Ze],Nt=le[me];if(!isNil(Nt)){isArray(Nt)?ce=Nt[0]:ce=Nt;break}}return ce},on=null,hn=function(He){if(!isArray(He))return[];for(var me=[],ce=0;ce<He.length;ce++)me=me.concat(He[ce]);return me},lt=null,Ct=function(He,me){if(me===void 0&&(me=[]),!isArray(He))me.push(He);else for(var ce=0;ce<He.length;ce+=1)Ct(He[ce],me);return me},sn=null,W=function(He){if(isArray(He))return He.reduce(function(me,ce){return Math.max(me,ce)},He[0])},Se=function(He){if(isArray(He))return He.reduce(function(me,ce){return Math.min(me,ce)},He[0])},Ht=function(He){var me=He.filter(function(Dt){return!isNaN(Dt)});if(!me.length)return{min:0,max:0};if(isArray(He[0])){for(var ce=[],Ze=0;Ze<He.length;Ze++)ce=ce.concat(He[Ze]);me=ce}var le=getMax(me),Nt=getMin(me);return{min:Nt,max:le}},zt=null,Fn=Array.prototype,Tn=Fn.splice,lr=Fn.indexOf,je=function(He){for(var me=[],ce=1;ce<arguments.length;ce++)me[ce-1]=arguments[ce];for(var Ze=0;Ze<me.length;Ze++)for(var le=me[Ze],Nt=-1;(Nt=lr.call(He,le))>-1;)Tn.call(He,Nt,1);return He},be=null,it=Array.prototype.splice,wt=function(me,ce){if(!isArrayLike(me))return[];for(var Ze=me?ce.length:0,le=Ze-1;Ze--;){var Nt=void 0,Dt=ce[Ze];(Ze===le||Dt!==Nt)&&(Nt=Dt,it.call(me,Dt,1))}return me},ot=null,ut=function(He,me,ce){if(!isArray(He)&&!isPlainObject(He))return He;var Ze=ce;return each(He,function(le,Nt){Ze=me(Ze,le,Nt)}),Ze},_t=null,$t=function(He,me){var ce=[];if(!isArrayLike(He))return ce;for(var Ze=-1,le=[],Nt=He.length;++Ze<Nt;){var Dt=He[Ze];me(Dt,Ze,He)&&(ce.push(Dt),le.push(Ze))}return pullAt(He,le),ce},Vt=null,Qt=function(He){return Ge(He,"String")};function cn(He,me){var ce;if(isFunction(me))ce=function(le,Nt){return me(le)-me(Nt)};else{var Ze=[];isString(me)?Ze.push(me):isArray(me)&&(Ze=me),ce=function(le,Nt){for(var Dt=0;Dt<Ze.length;Dt+=1){var pn=Ze[Dt];if(le[pn]>Nt[pn])return 1;if(le[pn]<Nt[pn])return-1}return 0}}return He.sort(ce),He}var Yn=null;function qn(He,me){me===void 0&&(me=new Map);var ce=[];if(Array.isArray(He))for(var Ze=0,le=He.length;Ze<le;Ze++){var Nt=He[Ze];me.has(Nt)||(ce.push(Nt),me.set(Nt,!0))}return ce}var Sr=function(He,me){for(var ce=[],Ze={},le=0;le<He.length;le++){var Nt=He[le],Dt=Nt[me];if(!isNil(Dt)){isArray(Dt)||(Dt=[Dt]);for(var pn=0;pn<Dt.length;pn++){var Dn=Dt[pn];Ze[Dn]||(ce.push(Dn),Ze[Dn]=!0)}}}return ce};function Jr(He,me){return isArray(He)||isString(He)?He[0]===me:!1}var vr=null;function Ki(He,me){return isArray(He)||isString(He)?He[He.length-1]===me:!1}var Mi=null,yi=Object.prototype.hasOwnProperty;function qr(He,me){if(!me||!isArray(He))return{};for(var ce={},Ze=isFunction(me)?me:function(pn){return pn[me]},le,Nt=0;Nt<He.length;Nt++){var Dt=He[Nt];le=Ze(Dt),yi.call(ce,le)?ce[le].push(Dt):ce[le]=[Dt]}return ce}var es=null;function Ci(He,me){if(!me)return{0:He};if(!isFunction(me)){var ce=isArray(me)?me:me.replace(/\s+/g,"").split("*");me=function(Ze){for(var le="_",Nt=0,Dt=ce.length;Nt<Dt;Nt++)le+=Ze[ce[Nt]]&&Ze[ce[Nt]].toString();return le}}return groupBy(He,me)}var En=function(He,me){if(!me)return[He];var ce=groupToMap(He,me),Ze=[];for(var le in ce)Ze.push(ce[le]);return Ze},rn={};function Xt(He){var me=rn[He];if(!me){for(var ce=He.toString(16),Ze=ce.length;Ze<6;Ze++)ce="0"+ce;me="#"+ce,rn[He]=me}return me}var st=null;function dt(He){var me=0,ce=0,Ze=0,le=0;return isArray(He)?He.length===1?me=ce=Ze=le=He[0]:He.length===2?(me=Ze=He[0],ce=le=He[1]):He.length===3?(me=He[0],ce=le=He[1],Ze=He[2]):(me=He[0],ce=He[1],Ze=He[2],le=He[3]):me=ce=Ze=le=He,{r1:me,r2:ce,r3:Ze,r4:le}}var Wt=null,bn=function(He){return Ge(He,"Number")},Jt=bn,ar=function(He){return isNumber(He)&&He%1!==0},rr=null,Kr=function(He){return isNumber(He)&&He%2===0},si=null,Ie=Number.isInteger?Number.isInteger:function(He){return Jt(He)&&He%1===0},L=null,Q=function(He){return isNumber(He)&&He<0},w=null,z=function(He){return isNumber(He)&&He%2!==0},ie=null,ze=function(He){return isNumber(He)&&He>0},Je=null,At=function(He,me){if(isArray(He)){for(var ce,Ze=-1/0,le=0;le<He.length;le++){var Nt=He[le],Dt=isFunction(me)?me(Nt):Nt[me];Dt>Ze&&(ce=Nt,Ze=Dt)}return ce}},xt=function(He,me){if(isArray(He)){for(var ce,Ze=1/0,le=0;le<He.length;le++){var Nt=He[le],Dt=isFunction(me)?me(Nt):Nt[me];Dt<Ze&&(ce=Nt,Ze=Dt)}return ce}},Sn=180/Math.PI,Oe=function(He){return Sn*He},Qe=null,Re=Math.PI/180,Ke=function(He){return Re*He},gt=null,tn=null,yt=Object.values?function(He){return Object.values(He)}:function(He){var me=[];return ln(He,function(ce,Ze){Tt(He)&&Ze==="prototype"||me.push(ce)}),me},Yt=yt,Rn=function(He,me){return contains(values(He),me)},er={}.toString,Jn=function(He){return er.call(He).replace(/^\[object /,"").replace(/]$/,"")},kr=null,fr=function(He){return isType(He,"Arguments")},wr=null,ei=function(He){return isType(He,"Boolean")},_n=null,jn=function(He){return isType(He,"Date")},Hr=null,Pr=function(He){return isType(He,"Error")},$i=null;function Zi(He){return isNumber(He)&&isFinite(He)}var Xi=Object.prototype,Ei=function(He){var me=He&&He.constructor,ce=typeof me=="function"&&me.prototype||Xi;return He===ce},ms=null,_i=function(He){return isType(He,"RegExp")},Es=null,ua=function(){for(var He=[],me=0;me<arguments.length;me++)He[me]=arguments[me];for(var ce=He[0],Ze=1;Ze<He.length;Ze++){var le=He[Ze];isFunction(le)&&(le=le.prototype),mix(ce.prototype,le)}},Hn=null,Pt=function(He){if(typeof He!="object"||He===null)return He;var me;if(On(He)){me=[];for(var ce=0,Ze=He.length;ce<Ze;ce++)typeof He[ce]=="object"&&He[ce]!=null?me[ce]=Pt(He[ce]):me[ce]=He[ce]}else{me={};for(var le in He)typeof He[le]=="object"&&He[le]!=null?me[le]=Pt(He[le]):me[le]=He[le]}return me},Gt=Pt,Bt=function(He,me){if(!Tt(He))throw new TypeError("Expected a function");var ce=function(){for(var Ze=[],le=0;le<arguments.length;le++)Ze[le]=arguments[le];var Nt=me?me.apply(this,Ze):Ze[0],Dt=ce.cache;if(Dt.has(Nt))return Dt.get(Nt);var pn=He.apply(this,Ze);return Dt.set(Nt,pn),pn};return ce.cache=new Map,ce},yn=5;function Ln(He,me,ce,Ze){ce=ce||0,Ze=Ze||yn;for(var le in me)if(me.hasOwnProperty(le)){var Nt=me[le];Nt!==null&&isPlainObject(Nt)?(isPlainObject(He[le])||(He[le]={}),ce<Ze?Ln(He[le],Nt,ce+1,Ze):He[le]=me[le]):isArray(Nt)?(He[le]=[],He[le]=He[le].concat(Nt)):Nt!==void 0&&(He[le]=Nt)}}var gr=function(He){for(var me=[],ce=1;ce<arguments.length;ce++)me[ce-1]=arguments[ce];for(var Ze=0;Ze<me.length;Ze+=1)Ln(He,me[Ze]);return He},Rr=null,$r=function(He,me,ce,Ze){isFunction(me)||(ce=me,me=He,He=function(){});var le=Object.create?function(Dt,pn){return Object.create(Dt,{constructor:{value:pn}})}:function(Dt,pn){function Dn(){}Dn.prototype=Dt;var hr=new Dn;return hr.constructor=pn,hr},Nt=le(me.prototype,He);return He.prototype=mix(Nt,He.prototype),He.superclass=le(me.prototype,me),mix(Nt,ce),mix(He,Ze),He},Ii=null,Di=Object.prototype.hasOwnProperty;function ss(He){if(isNil(He))return!0;if(isArrayLike(He))return!He.length;var me=getType(He);if(me==="Map"||me==="Set")return!He.size;if(isPrototype(He))return!Object.keys(He).length;for(var ce in He)if(Di.call(He,ce))return!1;return!0}var vs=null,Cs=function(He){return typeof He=="object"&&He!==null},Aa=Cs,sa=function(He){return He!==null&&typeof He!="function"&&isFinite(He.length)},ca=sa,Ai=function(He,me){if(He===me)return!0;if(!He||!me||Qt(He)||Qt(me))return!1;if(ca(He)||ca(me)){if(He.length!==me.length)return!1;for(var ce=!0,Ze=0;Ze<He.length&&(ce=Ai(He[Ze],me[Ze]),!!ce);Ze++);return ce}if(Aa(He)||Aa(me)){var le=Object.keys(He),Nt=Object.keys(me);if(le.length!==Nt.length)return!1;for(var ce=!0,Ze=0;Ze<le.length&&(ce=Ai(He[le[Ze]],me[le[Ze]]),!!ce);Ze++);return ce}return!1},$a=Ai,Zo=function(He,me,ce){return isFunction(ce)?!!ce(He,me):isEqual(He,me)},Ko=function(He,me,ce){for(var Ze=0,le=isString(me)?me.split("."):me;He&&Ze<le.length;)He=He[le[Ze++]];return He===void 0||Ze<le.length?ce:He},$o=function(He,me,ce){var Ze=He,le=isString(me)?me.split("."):me;return le.forEach(function(Nt,Dt){Dt<le.length-1?(isObject(Ze[Nt])||(Ze[Nt]=isNumber(le[Dt+1])?[]:{}),Ze=Ze[Nt]):Ze[Nt]=ce}),He},bo=Object.prototype.hasOwnProperty,Pl=function(He,me){if(He===null||!isPlainObject(He))return{};var ce={};return each(me,function(Ze){bo.call(He,Ze)&&(ce[Ze]=He[Ze])}),ce},il=function(He,me){return reduce(He,function(ce,Ze,le){return me.includes(le)||(ce[le]=Ze),ce},{})},go={},Ll=function(He){return He=He||"g",go[He]?go[He]+=1:go[He]=1,He+go[He]},Lu,ao=Bt(function(He,me){me===void 0&&(me={});var ce=me.fontSize,Ze=me.fontFamily,le=me.fontWeight,Nt=me.fontStyle,Dt=me.fontVariant;return Lu||(Lu=document.createElement("canvas").getContext("2d")),Lu.font=[Nt,Dt,le,ce+"px",Ze].join(" "),Lu.measureText(Qt(He)?He:"").width},function(He,me){return me===void 0&&(me={}),(0,dr.pr)([He],Yt(me)).join("")}),sl=function(He,me,ce,Ze){Ze===void 0&&(Ze="...");var le=16,Nt=measureTextWidth(Ze,ce),Dt=isString(He)?He:toString(He),pn=me,Dn=[],hr,br;if(measureTextWidth(He,ce)<=me)return He;for(;hr=Dt.substr(0,le),br=measureTextWidth(hr,ce),!(br+Nt>pn&&br>pn);)if(Dn.push(hr),pn-=br,Dt=Dt.substr(le),!Dt)return Dn.join("");for(;hr=Dt.substr(0,1),br=measureTextWidth(hr,ce),!(br+Nt>pn);)if(Dn.push(hr),pn-=br,Dt=Dt.substr(1),!Dt)return Dn.join("");return""+Dn.join("")+Ze},No=function(){function He(){this.map={}}return He.prototype.has=function(me){return this.map[me]!==void 0},He.prototype.get=function(me,ce){var Ze=this.map[me];return Ze===void 0?ce:Ze},He.prototype.set=function(me,ce){this.map[me]=ce},He.prototype.clear=function(){this.map={}},He.prototype.delete=function(me){delete this.map[me]},He.prototype.size=function(){return Object.keys(this.map).length},He}(),Uu=null,ws=function(me,ce,Ze){for(var le=1/0,Nt,Dt=0;Dt<ce.length;Dt++){var pn=ce[Dt].id;!Ze[pn]&&me[pn]<=le&&(le=me[pn],Nt=ce[Dt])}return Nt},Kh=function(me,ce,Ze,le){var Nt=me.nodes,Dt=Nt===void 0?[]:Nt,pn=me.edges,Dn=pn===void 0?[]:pn,hr=[],br={},yr={},xr={};Dt.forEach(function(as,Bs){var Ls=as.id;hr.push(Ls),yr[Ls]=1/0,Ls===ce&&(yr[Ls]=0)});for(var Fr=Dt.length,ri=function(Bs){var Ls=ws(yr,Dt,br),zi=Ls.id;if(br[zi]=!0,yr[zi]===1/0)return"continue";var Ni=[];Ze?Ni=D(zi,Dn):Ni=X(zi,Dn),Ni.forEach(function(Ns){var Os=Ns.target,_a=Ns.source,Sa=Os===zi?_a:Os,oe=le&&Ns[le]?Ns[le]:1;yr[Sa]>yr[Ls.id]+oe?(yr[Sa]=yr[Ls.id]+oe,xr[Sa]=[Ls.id]):yr[Sa]===yr[Ls.id]+oe&&xr[Sa].push(Ls.id)})},ai=0;ai<Fr;ai++)ri(ai);xr[ce]=[ce];var wi={};for(var Vi in yr)yr[Vi]!==1/0&&$h(ce,Vi,xr,wi);var rs={};for(var Vi in wi)rs[Vi]=wi[Vi][0];return{length:yr,path:rs,allPath:wi}},dh=Kh;function $h(He,me,ce,Ze){if(He===me)return[He];if(Ze[me])return Ze[me];for(var le=[],Nt=0,Dt=ce[me];Nt<Dt.length;Nt++){var pn=Dt[Nt],Dn=$h(He,pn,ce,Ze);if(!Dn)return;for(var hr=0,br=Dn;hr<br.length;hr++){var yr=br[hr];On(yr)?le.push((0,dr.ev)((0,dr.ev)([],yr,!0),[me],!1)):le.push([yr,me])}}return Ze[me]=le,Ze[me]}var Uh=function(me,ce,Ze,le,Nt){var Dt=dh(me,ce,le,Nt),pn=Dt.length,Dn=Dt.path,hr=Dt.allPath;return{length:pn[Ze],path:Dn[Ze],allPath:hr[Ze]}},Ku=function(me,ce,Ze,le){var Nt;if(ce===Ze)return[[ce]];var Dt=me.edges,pn=Dt===void 0?[]:Dt,Dn=[ce],hr=(Nt={},Nt[ce]=!0,Nt),br=[],yr=[],xr=le?H(ce,pn,"target"):H(ce,pn);for(br.push(xr);Dn.length>0&&br.length>0;){var Fr=br[br.length-1];if(Fr.length){var ri=Fr.shift();ri&&(Dn.push(ri),hr[ri]=!0,xr=le?H(ri,pn,"target"):H(ri,pn),br.push(xr.filter(function(Vi){return!hr[Vi]})))}else{var ai=Dn.pop();hr[ai]=!1,br.pop();continue}if(Dn[Dn.length-1]===Ze){var wi=Dn.map(function(rs){return rs});yr.push(wi);var ai=Dn.pop();hr[ai]=!1,br.pop()}}return yr},sc=function(me,ce){for(var Ze=Z(me,ce),le=[],Nt=Ze.length,Dt=0;Dt<Nt;Dt+=1){le[Dt]=[];for(var pn=0;pn<Nt;pn+=1)Dt===pn?le[Dt][pn]=0:Ze[Dt][pn]===0||!Ze[Dt][pn]?le[Dt][pn]=1/0:le[Dt][pn]=Ze[Dt][pn]}for(var Dn=0;Dn<Nt;Dn+=1)for(var Dt=0;Dt<Nt;Dt+=1)for(var pn=0;pn<Nt;pn+=1)le[Dt][pn]>le[Dt][Dn]+le[Dn][pn]&&(le[Dt][pn]=le[Dt][Dn]+le[Dn][pn]);return le},pu=sc,ou=function(me,ce,Ze,le){ce===void 0&&(ce=!1),Ze===void 0&&(Ze="weight"),le===void 0&&(le=1e3);var Nt=me.nodes,Dt=Nt===void 0?[]:Nt,pn=me.edges,Dn=pn===void 0?[]:pn,hr={},br={};Dt.forEach(function(Bs,Ls){var zi=j();Bs.clusterId=zi,hr[zi]={id:zi,nodes:[Bs]},br[Bs.id]={node:Bs,idx:Ls}});var yr=Z(me,ce),xr=[],Fr={};yr.forEach(function(Bs,Ls){var zi=0,Ni=Dt[Ls].id;Fr[Ni]={},Bs.forEach(function(Ns,Os){if(Ns){zi+=Ns;var _a=Dt[Os].id;Fr[Ni][_a]=Ns}}),xr.push(zi)});for(var ri=0,ai=function(){var Ls=!1;if(Dt.forEach(function(zi){var Ni={};Object.keys(Fr[zi.id]).forEach(function(J){var fe=Fr[zi.id][J],Te=br[J].node,De=Te.clusterId;Ni[De]||(Ni[De]=0),Ni[De]+=fe});var Ns=-1/0,Os=[];if(Object.keys(Ni).forEach(function(J){Ns<Ni[J]?(Ns=Ni[J],Os=[J]):Ns===Ni[J]&&Os.push(J)}),!(Os.length===1&&Os[0]===zi.clusterId)){var _a=Os.indexOf(zi.clusterId);if(_a>=0&&Os.splice(_a,1),Os&&Os.length){Ls=!0;var Sa=hr[zi.clusterId],oe=Sa.nodes.indexOf(zi);Sa.nodes.splice(oe,1);var re=Math.floor(Math.random()*Os.length),Y=hr[Os[re]];Y.nodes.push(zi),zi.clusterId=Y.id}}}),!Ls)return"break";ri++};ri<le;){var wi=ai();if(wi==="break")break}Object.keys(hr).forEach(function(Bs){var Ls=hr[Bs];(!Ls.nodes||!Ls.nodes.length)&&delete hr[Bs]});var Vi=[],rs={};Dn.forEach(function(Bs){var Ls=Bs.source,zi=Bs.target,Ni=Bs[Ze]||1,Ns=br[Ls].node.clusterId,Os=br[zi].node.clusterId,_a="".concat(Ns,"---").concat(Os);if(rs[_a])rs[_a].weight+=Ni,rs[_a].count++;else{var Sa={source:Ns,target:Os,weight:Ni,count:1};rs[_a]=Sa,Vi.push(Sa)}});var as=[];return Object.keys(hr).forEach(function(Bs){as.push(hr[Bs])}),{clusters:as,clusterEdges:Vi}},Ad=ou,hf=function(){function He(me){this.arr=me}return He.prototype.getArr=function(){return this.arr||[]},He.prototype.add=function(me){var ce,Ze=me.arr;if(!(!((ce=this.arr)===null||ce===void 0)&&ce.length))return new He(Ze);if(!(Ze!=null&&Ze.length))return new He(this.arr);if(this.arr.length===Ze.length){var le=[];for(var Nt in this.arr)le[Nt]=this.arr[Nt]+Ze[Nt];return new He(le)}},He.prototype.subtract=function(me){var ce,Ze=me.arr;if(!(!((ce=this.arr)===null||ce===void 0)&&ce.length))return new He(Ze);if(!(Ze!=null&&Ze.length))return new He(this.arr);if(this.arr.length===Ze.length){var le=[];for(var Nt in this.arr)le[Nt]=this.arr[Nt]-Ze[Nt];return new He(le)}},He.prototype.avg=function(me){var ce=[];if(me!==0)for(var Ze in this.arr)ce[Ze]=this.arr[Ze]/me;return new He(ce)},He.prototype.negate=function(){var me=[];for(var ce in this.arr)me[ce]=-this.arr[ce];return new He(me)},He.prototype.squareEuclideanDistance=function(me){var ce,Ze=me.arr;if(!(!((ce=this.arr)===null||ce===void 0)&&ce.length)||!(Ze!=null&&Ze.length))return 0;if(this.arr.length===Ze.length){var le=0;for(var Nt in this.arr)le+=Math.pow(this.arr[Nt]-me.arr[Nt],2);return le}},He.prototype.euclideanDistance=function(me){var ce,Ze=me.arr;if(!(!((ce=this.arr)===null||ce===void 0)&&ce.length)||!(Ze!=null&&Ze.length))return 0;if(this.arr.length===Ze.length){var le=0;for(var Nt in this.arr)le+=Math.pow(this.arr[Nt]-me.arr[Nt],2);return Math.sqrt(le)}else console.error("The two vectors are unequal in length.")},He.prototype.normalize=function(){var me=[],ce=Gt(this.arr);ce.sort(function(Dt,pn){return Dt-pn});var Ze=ce[ce.length-1],le=ce[0];for(var Nt in this.arr)me[Nt]=(this.arr[Nt]-le)/(Ze-le);return new He(me)},He.prototype.norm2=function(){var me;if(!(!((me=this.arr)===null||me===void 0)&&me.length))return 0;var ce=0;for(var Ze in this.arr)ce+=Math.pow(this.arr[Ze],2);return Math.sqrt(ce)},He.prototype.dot=function(me){var ce,Ze=me.arr;if(!(!((ce=this.arr)===null||ce===void 0)&&ce.length)||!(Ze!=null&&Ze.length))return 0;if(this.arr.length===Ze.length){var le=0;for(var Nt in this.arr)le+=this.arr[Nt]*me.arr[Nt];return le}else console.error("The two vectors are unequal in length.")},He.prototype.equal=function(me){var ce,Ze=me.arr;if(((ce=this.arr)===null||ce===void 0?void 0:ce.length)!==(Ze==null?void 0:Ze.length))return!1;for(var le in this.arr)if(this.arr[le]!==Ze[le])return!1;return!0},He}(),Xo=hf,fh=/^(\d{1,4})(-|\/)(\d{1,2})\2(\d{1,2})$/,Qf=/^(\d{1,4})(-|\/)(\d{1,2})\2(\d{1,2}) (\d{1,2}):(\d{1,2}):(\d{1,2})$/,pd=function(me,ce){me===void 0&&(me=[]),ce===void 0&&(ce=100);var Ze={};me.forEach(function(Nt){Nt.properties&&Object.keys(Nt.properties).forEach(function(Dt){if(Dt==="id"||!"".concat(Nt.properties[Dt]).match(fh)&&!"".concat(Nt.properties[Dt]).match(Qf)&&isNaN(Number(Nt.properties[Dt]))){Ze.hasOwnProperty(Dt)&&delete Ze[Dt];return}Ze.hasOwnProperty(Dt)?Ze[Dt]+=1:Ze[Dt]=1})});var le=Object.keys(Ze).sort(function(Nt,Dt){return Ze[Dt]-Ze[Nt]});return le.length<ce?le:le.slice(0,ce)},Ah=function(me,ce){return ce.map(function(Ze){return me.hasOwnProperty(Ze)?me[Ze]:0})},Vc=function(me){for(var ce=pd(me),Ze=[],le=0;le<me.length;le++)Ze[le]=Ah(me[le].properties,ce);return Ze},jo=function(me,ce){ce===void 0&&(ce=void 0);var Ze=[];return me.forEach(function(le){ce===void 0&&Ze.push(le),le[ce]!==void 0&&Ze.push(le[ce])}),Ze},gd={getAllSortProperties:pd,getPropertyWeight:Vc,getAllProperties:jo},lu;(function(He){He.EuclideanDistance="euclideanDistance"})(lu||(lu={}));var gu=function(me,ce,Ze){var le=[];ce!=null&&ce.length?le=ce:(me.forEach(function(Dt){le=le.concat(Object.keys(Dt))}),le=qn(le));var Nt={};return le.forEach(function(Dt){var pn=[];me.forEach(function(Dn){Dn[Dt]!==void 0&&Dn[Dt]!==""&&pn.push(Dn[Dt])}),pn.length&&!(Ze!=null&&Ze.includes(Dt))&&(Nt[Dt]=qn(pn))}),Nt},oo=function(me,ce,Ze){var le=gu(me,ce,Ze),Nt=[];if(!Object.keys(le).length)return Nt;var Dt=Object.values(le),pn=Dt.every(function(Dn){return Dn.every(function(hr){return typeof hr=="number"})});return me.forEach(function(Dn,hr){var br=[];Object.keys(le).forEach(function(yr){var xr=Dn[yr],Fr=le[yr],ri=Fr.findIndex(function(Vi){return xr===Vi}),ai=[];if(pn)ai.push(xr);else for(var wi=0;wi<Fr.length;wi++)wi===ri?ai.push(1):ai.push(0);br=br.concat(ai)}),Nt[hr]=br}),Nt},Ic=function(me,ce,Ze,le){Ze===void 0&&(Ze=lu.EuclideanDistance);var Nt=0;switch(Ze){case lu.EuclideanDistance:Nt=new Xo(me).euclideanDistance(new Xo(ce));break;default:break}return Nt},jc={getAllKeyValueMap:gu,oneHot:oo,getDistance:Ic},ph=function(me,ce,Ze,le){for(var Nt=ce.length,Dt=2*le,pn=0,Dn=0;Dn<Nt;Dn++)for(var hr=me[Dn].clusterId,br=0;br<Nt;br++){var yr=me[br].clusterId;if(hr===yr){var xr=ce[Dn][br]||0,Fr=Ze[Dn]||0,ri=Ze[br]||0;pn+=xr-Fr*ri/Dt}}return pn*=1/Dt,pn},Lo=function(me,ce){me===void 0&&(me=[]);for(var Ze=me.length,le=new Xo([]),Nt=0;Nt<Ze;Nt++)le=le.add(new Xo(ce[Nt]));var Dt=le.avg(Ze);Dt.normalize();for(var pn=0,Nt=0;Nt<Ze;Nt++){var Dn=new Xo(ce[Nt]),hr=Dn.squareEuclideanDistance(Dt);pn+=hr}var br=[];me.forEach(function(){br.push([])});for(var Nt=0;Nt<Ze;Nt++){var Dn=new Xo(ce[Nt]);me[Nt].clusterInertial=0;for(var yr=0;yr<Ze;yr++){if(Nt===yr){br[Nt][yr]=0;continue}var xr=new Xo(ce[yr]);br[Nt][yr]=Dn.squareEuclideanDistance(xr),me[Nt].clusterInertial+=br[Nt][yr]}}for(var Fr=0,ri=2*Ze*pn,Nt=0;Nt<Ze;Nt++)for(var ai=me[Nt].clusterId,yr=0;yr<Ze;yr++){var wi=me[yr].clusterId;if(!(Nt===yr||ai!==wi)){var Vi=me[Nt].clusterInertial*me[yr].clusterInertial/Math.pow(ri,2)-br[Nt][yr]/ri;Fr+=Vi}}return Number(Fr.toFixed(4))},Ji=function(me,ce,Ze,le,Nt,Dt,pn,Dn,hr){ce===void 0&&(ce=!1),Ze===void 0&&(Ze="weight"),le===void 0&&(le=1e-4),Nt===void 0&&(Nt=!1),Dt===void 0&&(Dt=void 0),pn===void 0&&(pn=[]),Dn===void 0&&(Dn=["id"]),hr===void 0&&(hr=1);var br=me.nodes,yr=br===void 0?[]:br,xr=me.edges,Fr=xr===void 0?[]:xr,ri=[];if(Nt){yr.forEach(function(Le,Xe){Le.properties=Le.properties||{},Le.originIndex=Xe});var ai=[];yr.every(function(Le){return Le.hasOwnProperty("nodeType")})&&(ai=Array.from(new Set(yr.map(function(Le){return Le.nodeType}))),yr.forEach(function(Le){Le.properties.nodeType=ai.findIndex(function(Xe){return Xe===Le.nodeType})}));var wi=jo(yr,Dt);ri=oo(wi,pn,Dn)}var Vi=1,rs={},as={};yr.forEach(function(Le,Xe){var mt=String(Vi++);Le.clusterId=mt,rs[mt]={id:mt,nodes:[Le]},as[Le.id]={node:Le,idx:Xe}});var Bs=Z(me,ce),Ls=[],zi={},Ni=0;Bs.forEach(function(Le,Xe){var mt=0,Kt=yr[Xe].id;zi[Kt]={},Le.forEach(function(nn,gn){if(nn){mt+=nn;var Nn=yr[gn].id;zi[Kt][Nn]=nn,Ni+=nn}}),Ls.push(mt)}),Ni/=2;for(var Ns=1/0,Os=1/0,_a=0,Sa=[],oe={};;){Nt&&yr.every(function(Le){return Le.hasOwnProperty("properties")})?Ns=ph(yr,Bs,Ls,Ni)+Lo(yr,ri)*hr:Ns=ph(yr,Bs,Ls,Ni),_a===0&&(Os=Ns,Sa=yr,oe=rs);var re=Ns>0&&Ns>Os&&Ns-Os<le;if(Ns>Os&&(Sa=yr.map(function(Le){return{node:Le,clusterId:Le.clusterId}}),oe=Gt(rs),Os=Ns),re||_a>100)break;_a++,Object.keys(rs).forEach(function(Le){var Xe=0;Fr.forEach(function(mt){var Kt=mt.source,nn=mt.target,gn=as[Kt].node.clusterId,Nn=as[nn].node.clusterId;(gn===Le&&Nn!==Le||Nn===Le&&gn!==Le)&&(Xe=Xe+(mt[Ze]||1))}),rs[Le].sumTot=Xe}),yr.forEach(function(Le,Xe){var mt=rs[Le.clusterId],Kt=0,nn,gn=Ls[Xe]/(2*Ni),Nn=0,$n=mt.nodes;$n.forEach(function(Ds){var Ba=as[Ds.id].idx;Nn+=Bs[Xe][Ba]||0});var Er=Nn-mt.sumTot*gn,mr=$n.filter(function(Ds){return Ds.id!==Le.id}),ti=[];mr.forEach(function(Ds,Ba){ti[Ba]=ri[Ds.originIndex]});var jr=Lo(mr,ri)*hr,ui=zi[Le.id];if(Object.keys(ui).forEach(function(Ds){var Ba=as[Ds].node,Ka=Ba.clusterId;if(Ka!==Le.clusterId){var xo=rs[Ka],aa=xo.nodes;if(!(!aa||!aa.length)){var di=0;aa.forEach(function(Ya){var pa=as[Ya.id].idx;di+=Bs[Xe][pa]||0});var Ma=di-xo.sumTot*gn,Rs=aa.concat([Le]),lo=[];Rs.forEach(function(Ya,pa){lo[pa]=ri[Ya.originIndex]});var Jo=Lo(Rs,ri)*hr,zs=Ma-Er;Nt&&(zs=Ma+Jo-(Er+jr)),zs>Kt&&(Kt=zs,nn=xo)}}}),Kt>0){nn.nodes.push(Le);var gi=Le.clusterId;Le.clusterId=nn.id;var oi=mt.nodes.indexOf(Le);mt.nodes.splice(oi,1);var ts=0,fs=0;Fr.forEach(function(Ds){var Ba=Ds.source,Ka=Ds.target,xo=as[Ba].node.clusterId,aa=as[Ka].node.clusterId;(xo===nn.id&&aa!==nn.id||aa===nn.id&&xo!==nn.id)&&(ts=ts+(Ds[Ze]||1)),(xo===gi&&aa!==gi||aa===gi&&xo!==gi)&&(fs=fs+(Ds[Ze]||1))}),nn.sumTot=ts,mt.sumTot=fs}})}var Y={},J=0;Object.keys(oe).forEach(function(Le){var Xe=oe[Le];if(!Xe.nodes||!Xe.nodes.length){delete oe[Le];return}var mt=String(J+1);mt!==Le&&(Xe.id=mt,Xe.nodes=Xe.nodes.map(function(Kt){return{id:Kt.id,clusterId:mt}}),oe[mt]=Xe,Y[Le]=mt,delete oe[Le],J++)}),Sa.forEach(function(Le){var Xe=Le.node,mt=Le.clusterId;Xe&&(Xe.clusterId=mt,Xe.clusterId&&Y[Xe.clusterId]&&(Xe.clusterId=Y[Xe.clusterId]))});var fe=[],Te={};Fr.forEach(function(Le){var Xe=Le.source,mt=Le.target,Kt=Le[Ze]||1,nn=as[Xe].node.clusterId,gn=as[mt].node.clusterId;if(!(!nn||!gn)){var Nn="".concat(nn,"---").concat(gn);if(Te[Nn])Te[Nn].weight+=Kt,Te[Nn].count++;else{var $n={source:nn,target:gn,weight:Kt,count:1};Te[Nn]=$n,fe.push($n)}}});var De=[];return Object.keys(oe).forEach(function(Le){De.push(oe[Le])}),{clusters:De,clusterEdges:fe}},$u=Ji,gh=function(me,ce,Ze,le,Nt,Dt,pn,Dn){return ce===void 0&&(ce=!1),Ze===void 0&&(Ze="weight"),le===void 0&&(le=1e-4),Nt===void 0&&(Nt=void 0),Dt===void 0&&(Dt=[]),pn===void 0&&(pn=["id"]),Dn===void 0&&(Dn=1),$u(me,ce,Ze,le,!0,Nt,Dt,pn,Dn)},mh=gh,np=function(me,ce){var Ze;ce===void 0&&(ce=1);for(var le=Gt(me),Nt=le.nodes,Dt=Nt===void 0?[]:Nt,pn=le.edges,Dn=pn===void 0?[]:pn,hr=function(){var xr=ct({nodes:Dt,edges:Dn}),Fr=Object.keys(xr);Fr.sort(function(wi,Vi){var rs,as;return((rs=xr[wi])===null||rs===void 0?void 0:rs.degree)-((as=xr[Vi])===null||as===void 0?void 0:as.degree)});var ri=Fr[0];if(!Dt.length||((Ze=xr[ri])===null||Ze===void 0?void 0:Ze.degree)>=ce)return"break";var ai=Dt.findIndex(function(wi){return wi.id===ri});Dt.splice(ai,1),Dn=Dn.filter(function(wi){return!(wi.source===ri||wi.target===ri)})};;){var br=hr();if(br==="break")break}return{nodes:Dt,edges:Dn}},vh=np,Cu=function(me,ce,Ze){var le=[];switch(me){case lu.EuclideanDistance:le=ce[Ze];break;default:le=[];break}return le},zc=function(me,ce,Ze,le,Nt,Dt){ce===void 0&&(ce=3),Ze===void 0&&(Ze=void 0),le===void 0&&(le=[]),Nt===void 0&&(Nt=["id"]),Dt===void 0&&(Dt=lu.EuclideanDistance);var pn=me.nodes,Dn=pn===void 0?[]:pn,hr=me.edges,br=hr===void 0?[]:hr,yr={clusters:[{id:"0",nodes:Dn}],clusterEdges:[]};if(Dt===lu.EuclideanDistance&&!Dn.every(function(mt){return mt.hasOwnProperty(Ze)}))return yr;var xr=[],Fr=[];if(Dt===lu.EuclideanDistance&&(xr=jo(Dn,Ze),Fr=oo(xr,le,Nt)),!Fr.length)return yr;for(var ri=qn(Fr.map(function(mt){return mt.join("")})),ai=Math.min(ce,Dn.length,ri.length),wi=0;wi<Dn.length;wi++)Dn[wi].originIndex=wi;for(var Vi=[],rs=[],as=[],wi=0;wi<ai;wi++)if(wi===0){var Bs=Math.floor(Math.random()*Dn.length);switch(Dt){case lu.EuclideanDistance:Vi[wi]=Fr[Bs];break;default:Vi[wi]=[];break}rs.push(Bs),as[wi]=[Dn[Bs]],Dn[Bs].clusterId=String(wi)}else{for(var Ls=-1/0,zi=0,Ni=function(nn){if(!rs.includes(nn)){for(var gn=0,Nn=0;Nn<Vi.length;Nn++){var $n=0;switch(Dt){case lu.EuclideanDistance:$n=Ic(Fr[Dn[nn].originIndex],Vi[Nn],Dt);break;default:break}gn+=$n}var Er=gn/Vi.length;Er>Ls&&!Vi.find(function(mr){return $a(mr,Cu(Dt,Fr,Dn[nn].originIndex))})&&(Ls=Er,zi=nn)}},Ns=0;Ns<Dn.length;Ns++)Ni(Ns);Vi[wi]=Cu(Dt,Fr,zi),rs.push(zi),as[wi]=[Dn[zi]],Dn[zi].clusterId=String(wi)}for(var Os=0;;){for(var wi=0;wi<Dn.length;wi++){var _a=0,Sa=1/0;if(!(Os===0&&rs.includes(wi))){for(var oe=0;oe<Vi.length;oe++){var re=0;switch(Dt){case lu.EuclideanDistance:re=Ic(Fr[wi],Vi[oe],Dt);break;default:break}re<Sa&&(Sa=re,_a=oe)}if(Dn[wi].clusterId!==void 0)for(var Y=as[Number(Dn[wi].clusterId)].length-1;Y>=0;Y--)as[Number(Dn[wi].clusterId)][Y].id===Dn[wi].id&&as[Number(Dn[wi].clusterId)].splice(Y,1);Dn[wi].clusterId=String(_a),as[_a].push(Dn[wi])}}for(var J=!1,wi=0;wi<as.length;wi++){for(var fe=as[wi],Te=new Xo([]),oe=0;oe<fe.length;oe++)Te=Te.add(new Xo(Fr[fe[oe].originIndex]));var De=Te.avg(fe.length);De.equal(new Xo(Vi[wi]))||(J=!0,Vi[wi]=De.getArr())}if(Os++,Dn.every(function(mt){return mt.clusterId!==void 0})&&J||Os>=1e3)break}var Le=[],Xe={};return br.forEach(function(mt){var Kt,nn,gn=mt.source,Nn=mt.target,$n=(Kt=Dn.find(function(jr){return jr.id===gn}))===null||Kt===void 0?void 0:Kt.clusterId,Er=(nn=Dn.find(function(jr){return jr.id===Nn}))===null||nn===void 0?void 0:nn.clusterId,mr="".concat($n,"---").concat(Er);if(Xe[mr])Xe[mr].count++;else{var ti={source:$n,target:Er,count:1};Xe[mr]=ti,Le.push(ti)}}),{clusters:as,clusterEdges:Le}},Ul=zc,Xl=function(me,ce){var Ze=new Xo(ce),le=Ze.norm2(),Nt=new Xo(me),Dt=Nt.norm2(),pn=Ze.dot(Nt),Dn=le*Dt,hr=Dn?pn/Dn:0;return hr},Uo=Xl,Ld=function(me,ce,Ze,le,Nt){me===void 0&&(me=[]),Ze===void 0&&(Ze=void 0),le===void 0&&(le=[]),Nt===void 0&&(Nt=[]);var Dt=Gt(me.filter(function(xr){return xr.id!==ce.id})),pn=me.findIndex(function(xr){return xr.id===ce.id}),Dn=jo(me,Ze),hr=oo(Dn,le,Nt),br=hr[pn],yr=[];return Dt.forEach(function(xr,Fr){if(xr.id!==ce.id){var ri=hr[Fr],ai=Uo(ri,br);yr.push(ai),xr.cosineSimilarity=ai}}),Dt.sort(function(xr,Fr){return Fr.cosineSimilarity-xr.cosineSimilarity}),{allCosineSimilarity:yr,similarNodes:Dt}},Yc=Ld,gl=function(){function He(me){this.count=me.length,this.parent={};for(var ce=0,Ze=me;ce<Ze.length;ce++){var le=Ze[ce];this.parent[le]=le}}return He.prototype.find=function(me){for(;this.parent[me]!==me;)me=this.parent[me];return me},He.prototype.union=function(me,ce){var Ze=this.find(me),le=this.find(ce);Ze!==le&&(Ze<le?(this.parent[ce]!==ce&&this.union(this.parent[ce],me),this.parent[ce]=this.parent[me]):(this.parent[me]!==me&&this.union(this.parent[me],ce),this.parent[me]=this.parent[ce]))},He.prototype.connected=function(me,ce){return this.find(me)===this.find(ce)},He}(),To=gl,ml=function(me,ce){return me-ce},Xu=function(){function He(me){me===void 0&&(me=ml),this.compareFn=me,this.list=[]}return He.prototype.getLeft=function(me){return 2*me+1},He.prototype.getRight=function(me){return 2*me+2},He.prototype.getParent=function(me){return me===0?null:Math.floor((me-1)/2)},He.prototype.isEmpty=function(){return this.list.length<=0},He.prototype.top=function(){return this.isEmpty()?void 0:this.list[0]},He.prototype.delMin=function(){var me=this.top(),ce=this.list.pop();return this.list.length>0&&(this.list[0]=ce,this.moveDown(0)),me},He.prototype.insert=function(me){if(me!==null){this.list.push(me);var ce=this.list.length-1;return this.moveUp(ce),!0}return!1},He.prototype.moveUp=function(me){for(var ce=this.getParent(me);me&&me>0&&this.compareFn(this.list[ce],this.list[me])>0;){var Ze=this.list[ce];this.list[ce]=this.list[me],this.list[me]=Ze,me=ce,ce=this.getParent(me)}},He.prototype.moveDown=function(me){var ce,Ze=me,le=this.getLeft(me),Nt=this.getRight(me),Dt=this.list.length;le!==null&&le<Dt&&this.compareFn(this.list[Ze],this.list[le])>0?Ze=le:Nt!==null&&Nt<Dt&&this.compareFn(this.list[Ze],this.list[Nt])>0&&(Ze=Nt),me!==Ze&&(ce=[this.list[Ze],this.list[me]],this.list[me]=ce[0],this.list[Ze]=ce[1],this.moveDown(Ze))},He}(),mu=Xu,Oo=function(me,ce){var Ze=[],le=me.nodes,Nt=le===void 0?[]:le,Dt=me.edges,pn=Dt===void 0?[]:Dt;if(Nt.length===0)return Ze;var Dn=Nt[0],hr=new Set;hr.add(Dn);var br=function(wi,Vi){return ce?wi.weight-Vi.weight:0},yr=new mu(br);for(X(Dn.id,pn).forEach(function(ai){yr.insert(ai)});!yr.isEmpty();){var xr=yr.delMin(),Fr=xr.source,ri=xr.target;hr.has(Fr)&&hr.has(ri)||(Ze.push(xr),hr.has(Fr)||(hr.add(Fr),X(Fr,pn).forEach(function(ai){yr.insert(ai)})),hr.has(ri)||(hr.add(ri),X(ri,pn).forEach(function(ai){yr.insert(ai)})))}return Ze},Bo=function(me,ce){var Ze=[],le=me.nodes,Nt=le===void 0?[]:le,Dt=me.edges,pn=Dt===void 0?[]:Dt;if(Nt.length===0)return Ze;var Dn=pn.map(function(Fr){return Fr});ce&&Dn.sort(function(Fr,ri){return Fr.weight-ri.weight});for(var hr=new To(Nt.map(function(Fr){return Fr.id}));Dn.length>0;){var br=Dn.shift(),yr=br.source,xr=br.target;hr.connected(yr,xr)||(Ze.push(br),hr.union(yr,xr))}return Ze},_o=function(me,ce,Ze){var le={prim:Oo,kruskal:Bo};return Ze?le[Ze](me,ce):Bo(me,ce)},na=_o,Wa=function(me,ce,Ze){typeof ce!="number"&&(ce=1e-6),typeof Ze!="number"&&(Ze=.85);for(var le=1,Nt=0,Dt=1e3,pn=me.nodes,Dn=pn===void 0?[]:pn,hr=me.edges,br=hr===void 0?[]:hr,yr=Dn.length,xr,Fr={},ri={},ai=0;ai<yr;++ai){var wi=Dn[ai],Vi=wi.id;Fr[Vi]=1/yr,ri[Vi]=1/yr}for(var rs=ct(me);Dt>0&&le>ce;){Nt=0;for(var ai=0;ai<yr;++ai){var wi=Dn[ai],Vi=wi.id;if(xr=0,rs[wi.id].inDegree===0)Fr[Vi]=0;else{for(var as=H(Vi,br,"source"),Bs=0;Bs<as.length;++Bs){var Ls=as[Bs],zi=rs[Ls].outDegree;zi>0&&(xr+=ri[Ls]/zi)}Fr[Vi]=Ze*xr,Nt+=Fr[Vi]}}Nt=(1-Nt)/yr,le=0;for(var ai=0;ai<yr;++ai){var wi=Dn[ai],Vi=wi.id;xr=Fr[Vi]+Nt,le+=Math.abs(xr-ri[Vi]),ri[Vi]=xr}Dt-=1}return ri},yh=Wa,Yo=-1,Tu=-1,uu="-1",wc="-1",ac=-1,Lr="-1",Gr=function(){function He(me,ce,Ze,le){me===void 0&&(me=Yo),ce===void 0&&(ce=Tu),Ze===void 0&&(Ze=Tu),le===void 0&&(le=uu),this.id=me,this.from=ce,this.to=Ze,this.label=le}return He}(),ki=function(){function He(me,ce){me===void 0&&(me=Tu),ce===void 0&&(ce=wc),this.id=me,this.label=ce,this.edges=[],this.edgeMap={}}return He.prototype.addEdge=function(me){this.edges.push(me),this.edgeMap[me.id]=me},He}(),ju=function(){function He(me,ce,Ze){me===void 0&&(me=Tu),ce===void 0&&(ce=!0),Ze===void 0&&(Ze=!1),this.id=me,this.edgeIdAutoIncrease=ce,this.edges=[],this.nodes=[],this.nodeMap={},this.edgeMap={},this.nodeLabelMap={},this.edgeLabelMap={},this.counter=0,this.directed=Ze}return He.prototype.getNodeNum=function(){return this.nodes.length},He.prototype.addNode=function(me,ce){if(!this.nodeMap[me]){var Ze=new ki(me,ce);this.nodes.push(Ze),this.nodeMap[me]=Ze,this.nodeLabelMap[ce]||(this.nodeLabelMap[ce]=[]),this.nodeLabelMap[ce].push(me)}},He.prototype.addEdge=function(me,ce,Ze,le){if((this.edgeIdAutoIncrease||me===void 0)&&(me=this.counter++),!(this.nodeMap[ce]&&this.nodeMap[Ze]&&this.nodeMap[Ze].edgeMap[me])){var Nt=new Gr(me,ce,Ze,le);if(this.edges.push(Nt),this.edgeMap[me]=Nt,this.nodeMap[ce].addEdge(Nt),this.edgeLabelMap[le]||(this.edgeLabelMap[le]=[]),this.edgeLabelMap[le].push(Nt),!this.directed){var Dt=new Gr(me,Ze,ce,le);this.nodeMap[Ze].addEdge(Dt),this.edgeLabelMap[le].push(Dt)}}},He}(),bl=function(){function He(me,ce,Ze,le,Nt){this.fromNode=me,this.toNode=ce,this.nodeEdgeNodeLabel={nodeLabel1:Ze||wc,edgeLabel:le||uu,nodeLabel2:Nt||wc}}return He.prototype.equalTo=function(me){return this.fromNode===me.formNode&&this.toNode===me.toNode&&this.nodeEdgeNodeLabel===me.nodeEdgeNodeLabel},He.prototype.notEqualTo=function(me){return!this.equalTo(me)},He}(),qo=function(){function He(){this.rmpath=[],this.dfsEdgeList=[]}return He.prototype.equalTo=function(me){var ce=this.dfsEdgeList.length,Ze=me.length;if(ce!==Ze)return!1;for(var le=0;le<ce;le++)if(this.dfsEdgeList[le]!==me[le])return!1;return!0},He.prototype.notEqualTo=function(me){return!this.equalTo(me)},He.prototype.pushBack=function(me,ce,Ze,le,Nt){return this.dfsEdgeList.push(new bl(me,ce,Ze,le,Nt)),this.dfsEdgeList},He.prototype.toGraph=function(me,ce){me===void 0&&(me=ac),ce===void 0&&(ce=!1);var Ze=new ju(me,!0,ce);return this.dfsEdgeList.forEach(function(le){var Nt=le.fromNode,Dt=le.toNode,pn=le.nodeEdgeNodeLabel,Dn=pn.nodeLabel1,hr=pn.edgeLabel,br=pn.nodeLabel2;Dn!==wc&&Ze.addNode(Nt,Dn),br!==wc&&Ze.addNode(Dt,br),Dn!==wc&&br!==Dn&&Ze.addEdge(void 0,Nt,Dt,hr)}),Ze},He.prototype.buildRmpath=function(){this.rmpath=[];for(var me=void 0,ce=this.dfsEdgeList.length,Ze=ce-1;Ze>=0;Ze--){var le=this.dfsEdgeList[Ze],Nt=le.fromNode,Dt=le.toNode;Nt<Dt&&(me===void 0||Dt===me)&&(this.rmpath.push(Ze),me=Nt)}return this.rmpath},He.prototype.getNodeNum=function(){var me={};return this.dfsEdgeList.forEach(function(ce){me[ce.fromNode]||(me[ce.fromNode]=!0),me[ce.toNode]||(me[ce.toNode]=!0)}),Object.keys(me).length},He}(),Go=function(){function He(me){if(this.his={},this.nodesUsed={},this.edgesUsed={},this.edges=[],!!me){for(;me;){var ce=me.edge;this.edges.push(ce),this.nodesUsed[ce.from]=1,this.nodesUsed[ce.to]=1,this.edgesUsed[ce.id]=1,me=me.preNode}this.edges=this.edges.reverse()}}return He.prototype.hasNode=function(me){return this.nodesUsed[me.id]===1},He.prototype.hasEdge=function(me){return this.edgesUsed[me.id]===1},He}(),Ou=function(){function He(me){var ce=me.graphs,Ze=me.minSupport,le=Ze===void 0?2:Ze,Nt=me.minNodeNum,Dt=Nt===void 0?1:Nt,pn=me.maxNodeNum,Dn=pn===void 0?4:pn,hr=me.top,br=hr===void 0?10:hr,yr=me.directed,xr=yr===void 0?!1:yr,Fr=me.verbose,ri=Fr===void 0?!1:Fr;this.graphs=ce,this.dfsCode=new qo,this.support=0,this.frequentSize1Subgraphs=[],this.frequentSubgraphs=[],this.minSupport=le,this.top=br,this.directed=xr,this.counter=0,this.maxNodeNum=Dn,this.minNodeNum=Dt,this.verbose=ri,this.maxNodeNum<this.minNodeNum&&(this.maxNodeNum=this.minNodeNum),this.reportDF=[]}return He.prototype.findForwardRootEdges=function(me,ce){var Ze=this,le=[],Nt=me.nodeMap;return ce.edges.forEach(function(Dt){(Ze.directed||ce.label<=Nt[Dt.to].label)&&le.push(Dt)}),le},He.prototype.findBackwardEdge=function(me,ce,Ze,le){if(!this.directed&&ce===Ze)return null;for(var Nt=me.nodeMap,Dt=Nt[Ze.to],pn=Dt.edges,Dn=pn.length,hr=0;hr<Dn;hr++){var br=pn[hr];if(!(le.hasEdge(br)||br.to!==ce.from)){if(this.directed){if(Nt[ce.from].label<Nt[Ze.to].label||Nt[ce.from].label===Nt[Ze.to].label&&ce.label<=br.label)return br}else if(ce.label<br.label||ce.label===br.label&&Nt[ce.to].label<=Nt[Ze.to].label)return br}}return null},He.prototype.findForwardPureEdges=function(me,ce,Ze,le){for(var Nt=[],Dt=ce.to,pn=me.nodeMap[Dt].edges,Dn=pn.length,hr=0;hr<Dn;hr++){var br=pn[hr],yr=me.nodeMap[br.to];Ze<=yr.label&&!le.hasNode(yr)&&Nt.push(br)}return Nt},He.prototype.findForwardRmpathEdges=function(me,ce,Ze,le){for(var Nt=[],Dt=me.nodeMap,pn=Dt[ce.to].label,Dn=Dt[ce.from],hr=Dn.edges,br=hr.length,yr=0;yr<br;yr++){var xr=hr[yr],Fr=Dt[xr.to].label;ce.to===xr.to||Ze>Fr||le.hasNode(Dt[xr.to])||(ce.label<xr.label||ce.label===xr.label&&pn<=Fr)&&Nt.push(xr)}return Nt},He.prototype.getSupport=function(me){var ce={};return me.forEach(function(Ze){ce[Ze.graphId]||(ce[Ze.graphId]=!0)}),Object.keys(ce).length},He.prototype.findMinLabel=function(me){var ce=void 0;return Object.keys(me).forEach(function(Ze){var le=me[Ze],Nt=le.nodeLabel1,Dt=le.edgeLabel,pn=le.nodeLabel2;if(!ce){ce={nodeLabel1:Nt,edgeLabel:Dt,nodeLabel2:pn};return}(Nt<ce.nodeLabel1||Nt===ce.nodeLabel1&&Dt<ce.edgeLabel||Nt===ce.nodeLabel1&&Dt===ce.edgeLabel&&pn<ce.nodeLabel2)&&(ce={nodeLabel1:Nt,edgeLabel:Dt,nodeLabel2:pn})}),ce},He.prototype.isMin=function(){var me=this,ce=this.dfsCode;if(this.verbose&&console.log("isMin checking",ce),ce.dfsEdgeList.length===1)return!0;var Ze=this.directed,le=ce.toGraph(ac,Ze),Nt=le.nodeMap,Dt=new qo,pn={};le.nodes.forEach(function(yr){var xr=me.findForwardRootEdges(le,yr);xr.forEach(function(Fr){var ri=Nt[Fr.to],ai="".concat(yr.label,"-").concat(Fr.label,"-").concat(ri.label);pn[ai]||(pn[ai]={projected:[],nodeLabel1:yr.label,edgeLabel:Fr.label,nodeLabel2:ri.label});var wi={graphId:le.id,edge:Fr,preNode:null};pn[ai].projected.push(wi)})});var Dn=this.findMinLabel(pn);if(Dn){Dt.dfsEdgeList.push(new bl(0,1,Dn.nodeLabel1,Dn.edgeLabel,Dn.nodeLabel2));var hr=function yr(xr){for(var Fr=Dt.buildRmpath(),ri=Dt.dfsEdgeList[0].nodeEdgeNodeLabel.nodeLabel1,ai=Dt.dfsEdgeList[Fr[0]].toNode,wi={},Vi=!1,rs=0,as=Ze?-1:0,Bs=function(Te){if(Vi)return"break";xr.forEach(function(De){var Le=new Go(De),Xe=me.findBackwardEdge(le,Le.edges[Fr[Te]],Le.edges[Fr[0]],Le);Xe&&(wi[Xe.label]||(wi[Xe.label]={projected:[],edgeLabel:Xe.label}),wi[Xe.label].projected.push({graphId:le.id,edge:wi,preNode:De}),rs=Dt.dfsEdgeList[Fr[Te]].fromNode,Vi=!0)})},Ls=Fr.length-1;Ls>as;Ls--){var zi=Bs(Ls);if(zi==="break")break}if(Vi){var Ni=me.findMinLabel(wi);Dt.dfsEdgeList.push(new bl(ai,rs,wc,Ni.edgeLabel,wc));var Ns=Dt.dfsEdgeList.length-1;return me.dfsCode.dfsEdgeList[Ns]!==Dt.dfsEdgeList[Ns]?!1:yr(wi[Ni.edgeLabel].projected)}var Os={};Vi=!1;var _a=0;xr.forEach(function(fe){var Te=new Go(fe),De=me.findForwardPureEdges(le,Te.edges[Fr[0]],ri,Te);De.length>0&&(Vi=!0,_a=ai,De.forEach(function(Le){var Xe="".concat(Le.label,"-").concat(Nt[Le.to].label);Os[Xe]||(Os[Xe]={projected:[],edgeLabel:Le.label,nodeLabel2:Nt[Le.to].label}),Os[Xe].projected.push({graphId:le.id,edge:Le,preNode:fe})}))});for(var Sa=Fr.length,oe=function(Te){if(Vi)return"break";var De=Fr[Te];xr.forEach(function(Le){var Xe=new Go(Le),mt=me.findForwardRmpathEdges(le,Xe.edges[De],ri,Xe);mt.length>0&&(Vi=!0,_a=Dt.dfsEdgeList[De].fromNode,mt.forEach(function(Kt){var nn="".concat(Kt.label,"-").concat(Nt[Kt.to].label);Os[nn]||(Os[nn]={projected:[],edgeLabel:Kt.label,nodeLabel2:Nt[Kt.to].label}),Os[nn].projected.push({graphId:le.id,edge:Kt,preNode:Le})}))})},Ls=0;Ls<Sa;Ls++){var re=oe(Ls);if(re==="break")break}if(!Vi)return!0;var Y=me.findMinLabel(Os);Dt.dfsEdgeList.push(new bl(_a,ai+1,wc,Y.edgeLabel,Y.nodeLabel2));var J=Dt.dfsEdgeList.length-1;return ce.dfsEdgeList[J]!==Dt.dfsEdgeList[J]?!1:yr(Os["".concat(Y.edgeLabel,"-").concat(Y.nodeLabel2)].projected)},br="".concat(Dn.nodeLabel1,"-").concat(Dn.edgeLabel,"-").concat(Dn.nodeLabel2);return hr(pn[br].projected)}},He.prototype.report=function(){if(!(this.dfsCode.getNodeNum()<this.minNodeNum)){this.counter++;var me=this.dfsCode.toGraph(this.counter,this.directed);this.frequentSubgraphs.push(Gt(me))}},He.prototype.subGraphMining=function(me){var ce=this,Ze=this.getSupport(me);if(!(Ze<this.minSupport)&&this.isMin()){this.report();var le=this.dfsCode.getNodeNum(),Nt=this.dfsCode.buildRmpath(),Dt=this.dfsCode.dfsEdgeList[Nt[0]].toNode,pn=this.dfsCode.dfsEdgeList[0].nodeEdgeNodeLabel.nodeLabel1,Dn={},hr={};me.forEach(function(br){for(var yr=ce.graphs[br.graphId],xr=yr.nodeMap,Fr=new Go(br),ri=Nt.length-1;ri>=0;ri--){var ai=ce.findBackwardEdge(yr,Fr.edges[Nt[ri]],Fr.edges[Nt[0]],Fr);if(ai){var wi="".concat(ce.dfsCode.dfsEdgeList[Nt[ri]].fromNode,"-").concat(ai.label);hr[wi]||(hr[wi]={projected:[],toNodeId:ce.dfsCode.dfsEdgeList[Nt[ri]].fromNode,edgeLabel:ai.label}),hr[wi].projected.push({graphId:br.graphId,edge:ai,preNode:br})}}if(!(le>=ce.maxNodeNum)){var Vi=ce.findForwardPureEdges(yr,Fr.edges[Nt[0]],pn,Fr);Vi.forEach(function(as){var Bs="".concat(Dt,"-").concat(as.label,"-").concat(xr[as.to].label);Dn[Bs]||(Dn[Bs]={projected:[],fromNodeId:Dt,edgeLabel:as.label,nodeLabel2:xr[as.to].label}),Dn[Bs].projected.push({graphId:br.graphId,edge:as,preNode:br})});for(var rs=function(Bs){var Ls=ce.findForwardRmpathEdges(yr,Fr.edges[Nt[Bs]],pn,Fr);Ls.forEach(function(zi){var Ni="".concat(ce.dfsCode.dfsEdgeList[Nt[Bs]].fromNode,"-").concat(zi.label,"-").concat(xr[zi.to].label);Dn[Ni]||(Dn[Ni]={projected:[],fromNodeId:ce.dfsCode.dfsEdgeList[Nt[Bs]].fromNode,edgeLabel:zi.label,nodeLabel2:xr[zi.to].label}),Dn[Ni].projected.push({graphId:br.graphId,edge:zi,preNode:br})})},ri=0;ri<Nt.length;ri++)rs(ri)}}),Object.keys(hr).forEach(function(br){var yr=hr[br],xr=yr.toNodeId,Fr=yr.edgeLabel;ce.dfsCode.dfsEdgeList.push(new bl(Dt,xr,"-1",Fr,"-1")),ce.subGraphMining(hr[br].projected),ce.dfsCode.dfsEdgeList.pop()}),Object.keys(Dn).forEach(function(br){var yr=Dn[br],xr=yr.fromNodeId,Fr=yr.edgeLabel,ri=yr.nodeLabel2;ce.dfsCode.dfsEdgeList.push(new bl(xr,Dt+1,wc,Fr,ri)),ce.subGraphMining(Dn[br].projected),ce.dfsCode.dfsEdgeList.pop()})}},He.prototype.generate1EdgeFrequentSubGraphs=function(){var me=this.graphs,ce=this.directed,Ze=this.minSupport,le=this.frequentSize1Subgraphs,Nt={},Dt={},pn={},Dn={};return Object.keys(me).forEach(function(hr){var br=me[hr],yr=br.nodeMap;br.nodes.forEach(function(xr,Fr){var ri=xr.label,ai="".concat(hr,"-").concat(ri);if(!pn[ai]){var wi=Nt[ri]||0;wi++,Nt[ri]=wi}pn[ai]={graphKey:hr,label:ri},xr.edges.forEach(function(Vi){var rs=ri,as=yr[Vi.to].label;if(!ce&&rs>as){var Bs=as;as=rs,rs=Bs}var Ls=Vi.label,zi="".concat(hr,"-").concat(rs,"-").concat(Ls,"-").concat(as),Ni="".concat(rs,"-").concat(Ls,"-").concat(as);if(!Dt[Ni]){var Ns=Dt[Ni]||0;Ns++,Dt[Ni]=Ns}Dn[zi]={graphId:hr,nodeLabel1:rs,edgeLabel:Ls,nodeLabel2:as}})})}),Object.keys(Nt).forEach(function(hr){var br=Nt[hr];if(!(br<Ze)){var yr={nodes:[],edges:[]};yr.nodes.push({id:"0",label:hr}),le.push(yr)}}),le},He.prototype.run=function(){var me=this;if(this.frequentSize1Subgraphs=this.generate1EdgeFrequentSubGraphs(),!(this.maxNodeNum<2)){var ce=this.graphs,Ze=this.directed,le={};Object.keys(ce).forEach(function(Nt){var Dt=ce[Nt],pn=Dt.nodeMap;Dt.nodes.forEach(function(Dn){var hr=me.findForwardRootEdges(Dt,Dn);hr.forEach(function(br){var yr=pn[br.to],xr="".concat(Dn.label,"-").concat(br.label,"-").concat(yr.label);le[xr]||(le[xr]={projected:[],nodeLabel1:Dn.label,edgeLabel:br.label,nodeLabel2:yr.label});var Fr={graphId:Nt,edge:br,preNode:null};le[xr].projected.push(Fr)})})}),Object.keys(le).forEach(function(Nt){var Dt=le[Nt],pn=Dt.projected,Dn=Dt.nodeLabel1,hr=Dt.edgeLabel,br=Dt.nodeLabel2;me.dfsCode.dfsEdgeList.push(new bl(0,1,Dn,hr,br)),me.subGraphMining(pn),me.dfsCode.dfsEdgeList.pop()})}},He}(),Oh=function(me,ce,Ze,le){var Nt={};return Object.keys(me).forEach(function(Dt,pn){var Dn=me[Dt],hr=new ju(pn,!0,ce),br={};Dn.nodes.forEach(function(yr,xr){hr.addNode(xr,yr[Ze]),br[yr.id]=xr}),Dn.edges.forEach(function(yr,xr){var Fr=br[yr.source],ri=br[yr.target];hr.addEdge(-1,Fr,ri,yr[le])}),hr&&hr.getNodeNum()&&(Nt[hr.id]=hr)}),Nt},oc=function(me,ce,Ze){var le=[];return me.forEach(function(Nt){var Dt={nodes:[],edges:[]};Nt.nodes.forEach(function(pn){var Dn;Dt.nodes.push((Dn={id:"".concat(pn.id)},Dn[ce]=pn.label,Dn))}),Nt.edges.forEach(function(pn){var Dn;Dt.edges.push((Dn={source:"".concat(pn.from),target:"".concat(pn.to)},Dn[Ze]=pn.label,Dn))}),le.push(Dt)}),le},Ca="cluster",Ud=function(me){var ce=me.graphs,Ze=me.directed,le=Ze===void 0?!1:Ze,Nt=me.nodeLabelProp,Dt=Nt===void 0?Ca:Nt,pn=me.edgeLabelProp,Dn=pn===void 0?Ca:pn,hr=Oh(ce,le,Dt,Dn),br=me.minSupport,yr=me.maxNodeNum,xr=me.minNodeNum,Fr=me.verbose,ri=me.top,ai={graphs:hr,minSupport:br,maxNodeNum:yr,minNodeNum:xr,top:ri,verbose:Fr,directed:le},wi=new Ou(ai);wi.run();var Vi=oc(wi.frequentSubgraphs,Dt,Dn);return Vi},rp=Ud,Xh=function(me,ce,Ze,le){Ze===void 0&&(Ze="cluster"),le===void 0&&(le=2);var Nt=[],Dt=me.nodes;return ce.forEach(function(pn,Dn){Nt.push(lc(Dt,pn,Dn,Ze,le))}),Nt},lc=function(me,ce,Ze,le,Nt){var Dt=[Ze],pn=[],Dn={};return ce.forEach(function(hr,br){if(hr<=Nt&&Ze!==br){Dt.push(br),pn.push(me[br]);var yr=me[br][le];Dn[yr]?(Dn[yr].count++,Dn[yr].dists.push(hr)):Dn[yr]={count:1,dists:[hr]}}}),Object.keys(Dn).forEach(function(hr){Dn[hr].dists=Dn[hr].dists.sort(function(br,yr){return br-yr})}),{nodeIdx:Ze,nodeId:me[Ze].id,nodeIdxs:Dt,neighbors:pn,neighborNum:Dt.length-1,nodeLabelCountMap:Dn}},wA=function(me,ce,Ze,le,Nt){var Dt=Math.ceil(Ze/ce),pn={},Dn=0;return le.forEach(function(hr,br){for(var yr=0,xr=0,Fr=hr.nodeIdxs,ri=hr.neighborNum-1;yr<Dt;){for(var ai=Fr[1+Math.floor(Math.random()*ri)],wi=0;(pn["".concat(br,"-").concat(ai)]||pn["".concat(ai,"-").concat(br)])&&(ai=Math.floor(Math.random()*ce),wi++,!(wi>2*ce)););if(wi<2*ce&&(pn["".concat(br,"-").concat(ai)]={start:br,end:ai,distance:Nt[br][ai]},yr++,Dn++,Dn>=Ze))return pn;if(xr++,xr>2*ce)break}if(yr<Dt){var Vi=Dt-yr;Dt=(Dt+Vi)/(ce-br-1)}}),pn},Od=function(me,ce,Ze,le){var Nt=Ze.nodes;return le||(le={}),Object.keys(me).forEach(function(Dt){var pn,Dn;if(!(le&&le[Dt])){le[Dt]={nodes:[],edges:[]};var hr=me[Dt],br=(pn=ce[hr.start])===null||pn===void 0?void 0:pn.nodeIdxs,yr=(Dn=ce[hr.end])===null||Dn===void 0?void 0:Dn.nodeIdxs;if(!(!br||!yr)){var xr=new Set(yr),Fr=br.filter(function(rs){return xr.has(rs)});if(!(!Fr||!Fr.length)){for(var ri={},ai=Fr.length,wi=0;wi<ai;wi++){var Vi=Nt[Fr[wi]];le[Dt].nodes.push(Vi),ri[Vi.id]=!0}Ze.edges.forEach(function(rs){ri[rs.source]&&ri[rs.target]&&le[Dt].edges.push(rs)})}}}}),le},jh=function(me,ce,Ze,le){var Nt,Dt,pn={};me.nodes.forEach(function(hr){pn[hr.id]=hr});var Dn=0;return!(!((Nt=ce==null?void 0:ce.edges)===null||Nt===void 0)&&Nt.length)||((Dt=ce==null?void 0:ce.nodes)===null||Dt===void 0?void 0:Dt.length)<2?0:(me.edges.forEach(function(hr){var br=pn[hr.source][Ze],yr=pn[hr.target][Ze],xr=ce==null?void 0:ce.nodes[0][Ze],Fr=ce==null?void 0:ce.nodes[1][Ze],ri=ce==null?void 0:ce.edges[0][le];hr[le]===ri&&(br===xr&&yr===Fr||br===Fr&&yr===xr)&&Dn++}),Dn)},SA=function(me,ce,Ze){for(var le=1/0,Nt=0,Dt=function(hr){var br=me[hr],yr=Object.keys(br).sort(function(rs,as){return br[rs]-br[as]}),xr=10,Fr=[];yr.forEach(function(rs,as){Fr[as%xr]||(Fr[as%xr]={graphs:[],totalCount:0,aveCount:0}),Fr[as%xr].graphs.push(rs),Fr[as%xr].totalCount+=br[rs]});var ri=0,ai=[];Fr.forEach(function(rs){var as=rs.totalCount/rs.graphs.length;rs.aveCount=as,ai.push(as);var Bs=0,Ls=rs.length;rs.graphs.forEach(function(zi,Ni){var Ns=br[zi];rs.graphs.forEach(function(Os,_a){Ni!==_a&&(Bs+=Math.abs(Ns-br[Os]))})}),Bs/=Ls*(Ls-1)/2,ri+=Bs}),ri/=Fr.length;var wi=0;ai.forEach(function(rs,as){ai.forEach(function(Bs,Ls){as!==Ls&&(wi+=Math.abs(rs-Bs))}),wi/=ai.length*(ai.length-1)/2});var Vi=wi-ri;le<Vi&&(le=Vi,Nt=hr)},pn=0;pn<ce;pn++)Dt(pn);return{structure:Ze[Nt],structureCountMap:me[Nt]}},md=function(me,ce){var Ze={},le={};return me.forEach(function(Nt,Dt){Ze[Nt.id]={idx:Dt,node:Nt,degree:0,inDegree:0,outDegree:0};var pn=Nt[ce];le[pn]||(le[pn]=[]),le[pn].push(Nt)}),{nodeMap:Ze,nodeLabelMap:le}},vd=function(me,ce,Ze){var le={},Nt={};return me.forEach(function(Dt,pn){le["".concat(j)]={idx:pn,edge:Dt};var Dn=Dt[ce];Nt[Dn]||(Nt[Dn]=[]),Nt[Dn].push(Dt);var hr=Ze[Dt.source];hr&&(hr.degree++,hr.outDegree++);var br=Ze[Dt.target];br&&(br.degree++,br.inDegree++)}),{edgeMap:le,edgeLabelMap:Nt}},mo=function(me,ce,Ze){var le=ce.length,Nt={};return ce.forEach(function(Dt,pn){for(var Dn=Ze?0:pn+1,hr=me[pn].id,br=Dn;br<le;br++)if(pn!==br){var yr=me[br].id,xr=Dt[br];Nt["".concat(hr,"-").concat(yr)]=xr,Ze||(Nt["".concat(yr,"-").concat(hr)]=xr)}}),Nt},wa=function(me,ce,Ze,le,Nt,Dt,pn,Dn,hr,br,yr){var xr,Fr="".concat(ce.id,"-").concat(Ze.id);if(br&&br[Fr])return br[Fr];var ri=yr?yr[Fr]:void 0;if(!ri){var ai=(xr={},xr[Fr]={start:le[ce.id].idx,end:le[Ze.id].idx,distance:Nt},xr);yr=Od(ai,Dt,me,yr),ri=yr[Fr]}return jh(ri,pn,Dn,hr)},Dd=function(me,ce,Ze,le){var Nt,Dt,pn,Dn=(Nt=me[ce])===null||Nt===void 0?void 0:Nt.degree,hr=(Dt=me[ce])===null||Dt===void 0?void 0:Dt.inDegree,br=(pn=me[ce])===null||pn===void 0?void 0:pn.outDegree;return me[ce]===void 0&&(Dn=1/0,hr=1/0,br=1/0,le[ce].forEach(function(yr){var xr=Ze[yr.id].degree;Dn>xr&&(Dn=xr);var Fr=Ze[yr.id].inDegree;hr>Fr&&(hr=Fr);var ri=Ze[yr.id].outDegree;br>ri&&(br=ri)}),me[ce]={degree:Dn,inDegree:hr,outDegree:br}),{minPatternNodeLabelDegree:Dn,minPatternNodeLabelInDegree:hr,minPatternNodeLabelOutDegree:br}},qi=function(me,ce,Ze,le,Nt,Dt,pn){var Dn;if(Ze===void 0&&(Ze=!1),Dt===void 0&&(Dt="cluster"),pn===void 0&&(pn="cluster"),!(!me||!me.nodes)){var hr=me.nodes.length;if(hr){var br=pu(me,Ze),yr=pu(ce,Ze),xr=mo(me.nodes,br,Ze),Fr=mo(ce.nodes,yr,Ze),ri=md(me.nodes,Dt),ai=ri.nodeMap,wi=ri.nodeLabelMap,Vi=md(ce.nodes,Dt),rs=Vi.nodeMap,as=Vi.nodeLabelMap;vd(me.edges,pn,ai);var Bs=vd(ce.edges,pn,rs).edgeLabelMap,Ls=[];yr==null||yr.forEach(function(di){Ls=Ls.concat(di)}),Nt||(Nt=Math.max.apply(Math,(0,dr.ev)((0,dr.ev)([],Ls,!1),[2],!1))),le||(le=Nt);var zi=Xh(me,br,Dt,le),Ni=Xh(ce,yr,Dt,le),Ns=Math.min(100,hr*(hr-1)/2),Os=wA(le,hr,Ns,zi,br),_a=Od(Os,zi,me),Sa=10,oe=1,re=1,Y=4,J={graphs:_a,nodeLabelProp:Dt,edgeLabelProp:pn,minSupport:oe,minNodeNum:re,maxNodeNum:Y,directed:Ze},fe=rp(J).slice(0,Sa),Te=fe.length,De=[];fe.forEach(function(di,Ma){De[Ma]={},Object.keys(_a).forEach(function(Rs){var lo=_a[Rs],Jo=jh(lo,di,Dt,pn);De[Ma][Rs]=Jo})});var Le=SA(De,Te,fe),Xe=Le.structure,mt=Le.structureCountMap,Kt=ce.nodes[0],nn=[],gn=(Dn=ce.nodes[0])===null||Dn===void 0?void 0:Dn[Dt],Nn=-1/0;ce.nodes.forEach(function(di){var Ma=di[Dt],Rs=wi[Ma];(Rs==null?void 0:Rs.length)>Nn&&(Nn=Rs.length,nn=Rs,gn=Ma,Kt=di)});var $n={},Er={},mr={},ti={},jr={},ui={};Object.keys(as).forEach(function(di,Ma){jr[di]=[],Ze&&(ui[di]=[]);var Rs=-1/0,lo=as[di],Jo={};lo.forEach(function(qa){var Ua=Fr["".concat(Kt.id,"-").concat(qa.id)];if(Ua&&jr[di].push(Ua),Rs<Ua&&(Rs=Ua),Jo["".concat(Kt.id,"-").concat(qa.id)]={start:0,end:rs[qa.id].idx,distance:Ua},Ze){var dl=Fr["".concat(qa.id,"-").concat(Kt.id)];dl&&ui[di].push(dl)}}),jr[di]=jr[di].sort(function(qa,Ua){return qa-Ua}),Ze&&(ui[di]=ui[di].sort(function(qa,Ua){return qa-Ua})),Er=Od(Jo,Ni,ce,Er);var zs=[];if(Object.keys(Jo).forEach(function(qa){if(mr[qa]){zs.push(mr[qa]);return}var Ua=Er[qa];mr[qa]=jh(Ua,Xe,Dt,pn),zs.push(mr[qa])}),zs=zs.sort(function(qa,Ua){return Ua-qa}),ti["".concat(Kt.id,"-").concat(di)]=zs,di!==gn)for(var Ya=(nn==null?void 0:nn.length)||0,pa=function(Ua){var dl=nn[Ua],Sc=zi[ai[dl.id].idx],zl=Sc.nodeLabelCountMap[di],Gc=as[di].length;if(!zl||zl.count<Gc)return nn.splice(Ua,1),"continue";for(var uc=!1,Bu=0;Bu<Gc;Bu++)if(zl.dists[Bu]>jr[di][Bu]){uc=!0;break}if(uc)return nn.splice(Ua,1),"continue";var cu={};Sc.neighbors.forEach(function(Ho){var jl=xr["".concat(dl.id,"-").concat(Ho.id)];cu["".concat(dl.id,"-").concat(Ho.id)]={start:ai[dl.id].idx,end:ai[Ho.id].idx,distance:jl}}),_a=Od(cu,zi,me,_a);var qc=[];Object.keys(cu).forEach(function(Ho){if(mt[Ho]){qc.push(mt[Ho]);return}var jl=_a[Ho];mt[Ho]=jh(jl,Xe,Dt,pn),qc.push(mt[Ho])}),qc=qc.sort(function(Ho,jl){return jl-Ho});for(var _l=!1,Bu=0;Bu<Gc;Bu++)if(qc[Bu]<zs[Bu]){_l=!0;break}if(_l)return nn.splice(Ua,1),"continue"},al=Ya-1;al>=0;al--)pa(al)});var gi=[];nn==null||nn.forEach(function(di){for(var Ma=ai[di.id].idx,Rs=lc(me.nodes,br[Ma],Ma,Dt,Nt),lo=Rs.neighbors,Jo=lo.length,zs=!1,Ya=Jo-1;Ya>=0;Ya--){if(lo.length+1<ce.nodes.length){zs=!0;return}var pa=lo[Ya],al=pa[Dt];if(!as[al]||!as[al].length){lo.splice(Ya,1);continue}if(!jr[al]||!jr[al].length){lo.splice(Ya,1);continue}var qa="".concat(di.id,"-").concat(pa.id),Ua=xr[qa],dl=jr[al].length-1,Sc=jr[al][dl];if(Ua>Sc){lo.splice(Ya,1);continue}if(Ze){var zl="".concat(pa.id,"-").concat(di.id),Gc=xr[zl];dl=ui[al].length-1;var uc=ui[al][dl];if(Gc>uc){lo.splice(Ya,1);continue}}var Bu=mt[qa]?mt[qa]:wa(me,di,pa,ai,Ua,zi,Xe,Dt,pn,mt,_a),cu="".concat(Kt.id,"-").concat(al),qc=ti[cu][ti[cu].length-1];if(Bu<qc){lo.splice(Ya,1);continue}var _l=Dd($n,al,rs,as),Ho=_l.minPatternNodeLabelDegree,jl=_l.minPatternNodeLabelInDegree,Jc=_l.minPatternNodeLabelOutDegree;if(ai[pa.id].degree<Ho){lo.splice(Ya,1);continue}}zs||gi.push({nodes:[di].concat(lo)})});var oi=dh(ce,Kt.id,!1).length,ts={};Ze?(Object.keys(oi).forEach(function(di){var Ma=rs[di].node[Dt];ts[Ma]?ts[Ma].push(oi[di]):ts[Ma]=[oi[di]]}),Object.keys(ts).forEach(function(di){ts[di].sort(function(Ma,Rs){return Ma-Rs})})):ts=jr;for(var fs=gi.length,Ds=function(Ma){var Rs=gi[Ma],lo=Rs.nodes[0],Jo={},zs={};Rs.nodes.forEach(function(Co,vu){zs[Co.id]={idx:vu,node:Co,degree:0,inDegree:0,outDegree:0};var Gl=Co[Dt];Jo[Gl]?Jo[Gl]++:Jo[Gl]=1});var Ya=[],pa={};me.edges.forEach(function(Co){zs[Co.source]&&zs[Co.target]&&(Ya.push(Co),pa[Co[pn]]?pa[Co[pn]]++:pa[Co[pn]]=1,zs[Co.source].degree++,zs[Co.target].degree++,zs[Co.source].outDegree++,zs[Co.target].inDegree++)});for(var al=Object.keys(Bs).length,qa=!1,Ua=0;Ua<al;Ua++){var dl=Object.keys(Bs)[Ua];if(!pa[dl]||pa[dl]<Bs[dl].length){qa=!0;break}}if(qa)return gi.splice(Ma,1),"continue";var Sc=Ya.length;if(Sc<ce.edges.length)return gi.splice(Ma,1),"break";for(var zl=!1,Gc=function(vu){var Gl=Ya[vu],Ea=Gl[pn],Rl=Bs[Ea];if(!Rl||!Rl.length)return pa[Ea]--,Rl&&pa[Ea]<Rl.length?(zl=!0,"break"):(Ya.splice(vu,1),zs[Gl.source].degree--,zs[Gl.target].degree--,zs[Gl.source].outDegree--,zs[Gl.target].inDegree--,"continue");var Zf=zs[Gl.source].node[Dt],ku=zs[Gl.target].node[Dt],Dh=!1;if(Rl.forEach(function(Vu){var EA=rs[Vu.source].node,zu=rs[Vu.target].node;EA[Dt]===Zf&&zu[Dt]===ku&&(Dh=!0),!Ze&&EA[Dt]===ku&&zu[Dt]===Zf&&(Dh=!0)}),!Dh)return pa[Ea]--,Rl&&pa[Ea]<Rl.length?(zl=!0,"break"):(Ya.splice(vu,1),zs[Gl.source].degree--,zs[Gl.target].degree--,zs[Gl.source].outDegree--,zs[Gl.target].inDegree--,"continue")},Ua=Sc-1;Ua>=0;Ua--){var uc=Gc(Ua);if(uc==="break")break}if(zl)return gi.splice(Ma,1),"continue";Rs.edges=Ya;var Bu=dh(Rs,Rs.nodes[0].id,!1).length;if(Object.keys(Bu).reverse().forEach(function(Co){if(!(Co===Rs.nodes[0].id||zl)){if(Bu[Co]===1/0){var vu=zs[Co].node[Dt];if(Jo[vu]--,Jo[vu]<as[vu].length){zl=!0;return}var Gl=Rs.nodes.indexOf(zs[Co].node);Rs.nodes.splice(Gl,1),zs[Co]=void 0;return}var Ea=ai[Co].node[Dt];if(!ts[Ea]||!ts[Ea].length||Bu[Co]>ts[Ea][ts[Ea].length-1]){var vu=zs[Co].node[Dt];if(Jo[vu]--,Jo[vu]<as[vu].length){zl=!0;return}var Gl=Rs.nodes.indexOf(zs[Co].node);Rs.nodes.splice(Gl,1),zs[Co]=void 0}}}),zl)return gi.splice(Ma,1),"continue";for(var cu=!0,qc=0;cu&&!zl;){cu=!1;var _l=Ze?zs[lo.id].degree<rs[Kt.id].degree||zs[lo.id].inDegree<rs[Kt.id].inDegree||zs[lo.id].outDegree<rs[Kt.id].outDegree:zs[lo.id].degree<rs[Kt.id].degree;if(_l){zl=!0;break}if(Jo[lo[Dt]]<as[lo[Dt]].length){zl=!0;break}for(var Ho=Rs.nodes.length,jl=Ho-1;jl>=0;jl--){var Jc=Rs.nodes[jl],eh=zs[Jc.id].degree,df=zs[Jc.id].inDegree,xh=zs[Jc.id].outDegree,MA=Jc[Dt],yl=Dd($n,MA,rs,as),Nc=yl.minPatternNodeLabelDegree,bh=yl.minPatternNodeLabelInDegree,Wf=yl.minPatternNodeLabelOutDegree,_h=Ze?eh<Nc||df<bh||xh<Wf:eh<Nc;if(_h){if(Jo[Jc[Dt]]--,Jo[Jc[Dt]]<as[Jc[Dt]].length){zl=!0;break}Rs.nodes.splice(jl,1),zs[Jc.id]=void 0,cu=!0}}if(zl||!cu&&qc!==0)break;Sc=Ya.length;for(var ol=Sc-1;ol>=0;ol--){var Bl=Ya[ol];if(!zs[Bl.source]||!zs[Bl.target]){Ya.splice(ol,1);var yd=Bl[pn];if(pa[yd]--,zs[Bl.source]&&(zs[Bl.source].degree--,zs[Bl.source].outDegree--),zs[Bl.target]&&(zs[Bl.target].degree--,zs[Bl.target].inDegree--),Bs[yd]&&pa[yd]<Bs[yd].length){zl=!0;break}cu=!0}}qc++}if(zl||zl||Rs.nodes.length<ce.nodes.length||Ya.length<ce.edges.length)return gi.splice(Ma,1),"continue"},Ba=fs-1;Ba>=0;Ba--){var Ka=Ds(Ba);if(Ka==="break")break}for(var xo=gi.length,aa=function(Ma){var Rs=gi[Ma],lo={};Rs.edges.forEach(function(Ya){var pa="".concat(Ya.source,"-").concat(Ya.target,"-").concat(Ya.label);lo[pa]?lo[pa]++:lo[pa]=1});for(var Jo=function(pa){var al=gi[pa],qa={};al.edges.forEach(function(dl){var Sc="".concat(dl.source,"-").concat(dl.target,"-").concat(dl.label);qa[Sc]?qa[Sc]++:qa[Sc]=1});var Ua=!0;Object.keys(qa).length!==Object.keys(lo).length?Ua=!1:Object.keys(lo).forEach(function(dl){qa[dl]!==lo[dl]&&(Ua=!1)}),Ua&&gi.splice(pa,1)},zs=xo-1;zs>Ma;zs--)Jo(zs);xo=gi.length},Ba=0;Ba<=xo-1;Ba++)aa(Ba);return gi}}},Du=qi,kn=function(){function He(me){me===void 0&&(me=10),this.linkedList=new F,this.maxStep=me}return Object.defineProperty(He.prototype,"length",{get:function(){return this.linkedList.toArray().length},enumerable:!1,configurable:!0}),He.prototype.isEmpty=function(){return!this.linkedList.head},He.prototype.isMaxStack=function(){return this.toArray().length>=this.maxStep},He.prototype.peek=function(){return this.isEmpty()?null:this.linkedList.head.value},He.prototype.push=function(me){this.linkedList.prepend(me),this.length>this.maxStep&&this.linkedList.deleteTail()},He.prototype.pop=function(){var me=this.linkedList.deleteHead();return me?me.value:null},He.prototype.toArray=function(){return this.linkedList.toArray().map(function(me){return me.value})},He.prototype.clear=function(){for(;!this.isEmpty();)this.pop()},He}(),kd=kn,Yh=zn,vl={getAdjMatrix:Z,breadthFirstSearch:we,connectedComponent:$e,getDegree:ct,getInDegree:vt,getOutDegree:at,detectCycle:zn,detectDirectedCycle:Yh,detectAllCycles:In,detectAllDirectedCycle:Xn,detectAllUndirectedCycle:Wn,depthFirstSearch:Bn,dijkstra:dh,findAllPath:Ku,findShortestPath:Uh,floydWarshall:pu,labelPropagation:Ad,louvain:$u,iLouvain:mh,kCore:vh,kMeans:Ul,cosineSimilarity:Uo,nodesCosineSimilarity:Yc,minimumSpanningTree:na,pageRank:yh,getNeighbors:H,Stack:kd,GADDI:Du}},86314:function(Be,Me,b){"use strict";b.d(Me,{MG:function(){return E},V7:function(){return C},Yq:function(){return F},eR:function(){return j},jt:function(){return H},tT:function(){return X}});var m=b(80813),Z=b(76075),V=b(69014);function N(de){return typeof de=="boolean"?!1:"enter"in de&&"update"in de&&"exit"in de}function E(de){if(!de)return{enter:!1,update:!1,exit:!1};var he=["enter","update","exit"],we=Object.fromEntries(Object.entries(de).filter(function(ve){var Ee=(0,m.CR)(ve,1),$e=Ee[0];return!he.includes($e)}));return Object.fromEntries(he.map(function(ve){return N(de)?de[ve]===!1?[ve,!1]:[ve,(0,m.pi)((0,m.pi)({},de[ve]),we)]:[ve,we]}))}function F(de,he){de?de.finished.then(he):he()}function C(de,he){de.length===0?he():Promise.all(de.map(function(we){return we==null?void 0:we.finished})).then(he)}function P(de,he){"update"in de?de.update(he):de.attr(he)}function H(de,he,we){if(he.length===0)return null;if(!we){var ve=he.slice(-1)[0];return P(de,{style:ve}),null}return de.animate(he,we)}function D(de,he){return!(de.nodeName!=="text"||he.nodeName!=="text"||de.attributes.text!==he.attributes.text)}function X(de,he,we,ve){if(ve===void 0&&(ve="destroy"),D(de,he))return de.remove(),[null];var Ee=function(){ve==="destroy"?de.destroy():ve==="hide"&&(0,V.Cp)(de),he.isVisible()&&(0,V.$Z)(he)};if(!we)return Ee(),[null];var $e=we.duration,Fe=$e===void 0?0:$e,ct=we.delay,vt=ct===void 0?0:ct,at=Math.ceil(+Fe/2),kt=+Fe/4,It=(0,m.CR)(de.getGeometryBounds().center,2),Bn=It[0],Lt=It[1],Wn=(0,m.CR)(he.getGeometryBounds().center,2),Xn=Wn[0],In=Wn[1],zn=(0,m.CR)([(Bn+Xn)/2-Bn,(Lt+In)/2-Lt],2),dr=zn[0],vn=zn[1],_r=de.style.opacity,Ge=_r===void 0?1:_r,Tt=he.style.opacity,On=Tt===void 0?1:Tt,Vr=de.style.transform||"",en=he.style.transform||"",ln=de.animate([{opacity:Ge,transform:"translate(0, 0) ".concat(Vr)},{opacity:0,transform:"translate(".concat(dr,", ").concat(vn,") ").concat(Vr)}],(0,m.pi)((0,m.pi)({fill:"both"},we),{duration:vt+at+kt})),Cn=he.animate([{opacity:0,transform:"translate(".concat(-dr,", ").concat(-vn,") ").concat(en),offset:.01},{opacity:On,transform:"translate(0, 0) ".concat(en)}],(0,m.pi)((0,m.pi)({fill:"both"},we),{duration:at+kt,delay:vt+at-kt}));return F(Cn,Ee),[ln,Cn]}function j(de,he,we){var ve={},Ee={};return Object.entries(he).forEach(function($e){var Fe=(0,m.CR)($e,2),ct=Fe[0],vt=Fe[1];if(!(0,Z.Z)(vt)){var at=de.style[ct]||de.parsedStyle[ct]||0;at!==vt&&(ve[ct]=at,Ee[ct]=vt)}}),we?H(de,[ve,Ee],(0,m.pi)({fill:"both"},we)):(P(de,Ee),null)}},97304:function(Be,Me,b){"use strict";b.d(Me,{w:function(){return C}});var m=b(80813),Z=b(66623),V=b(69014),N=b(99247),E=b(16915);function F(){(0,V.WD)(this,this.attributes.visibility!=="hidden")}var C=function(P){(0,m.ZT)(H,P);function H(D,X){X===void 0&&(X={});var j=P.call(this,(0,N.n)({},{style:X},D))||this;return j.initialized=!1,j._defaultOptions=X,j}return Object.defineProperty(H.prototype,"offscreenGroup",{get:function(){return this._offscreen||(this._offscreen=(0,E.g)(this)),this._offscreen},enumerable:!1,configurable:!0}),Object.defineProperty(H.prototype,"defaultOptions",{get:function(){return this._defaultOptions},enumerable:!1,configurable:!0}),H.prototype.connectedCallback=function(){this.render(this.attributes,this),this.bindEvents(this.attributes,this),this.initialized=!0},H.prototype.disconnectedCallback=function(){var D;(D=this._offscreen)===null||D===void 0||D.destroy()},H.prototype.attributeChangedCallback=function(D){D==="visibility"&&F.call(this)},H.prototype.update=function(D,X){var j;return this.attr((0,N.n)({},this.attributes,D||{})),(j=this.render)===null||j===void 0?void 0:j.call(this,this.attributes,this,X)},H.prototype.clear=function(){this.removeChildren()},H.prototype.bindEvents=function(D,X){},H.prototype.getSubShapeStyle=function(D){var X=D.x,j=D.y,de=D.transform,he=D.transformOrigin,we=D.class,ve=D.className,Ee=D.zIndex,$e=(0,m._T)(D,["x","y","transform","transformOrigin","class","className","zIndex"]);return $e},H}(Z.b_)},42777:function(Be,Me,b){"use strict";b.d(Me,{x:function(){return N}});var m=b(80813),Z=b(66623),V=b(16915),N=function(E){(0,m.ZT)(F,E);function F(C){C===void 0&&(C={});var P=C.style,H=(0,m._T)(C,["style"]);return E.call(this,(0,m.pi)({style:(0,m.pi)({text:"",fill:"black",fontFamily:"sans-serif",fontSize:16,fontStyle:"normal",fontVariant:"normal",fontWeight:"normal",lineWidth:1,textAlign:"start",textBaseline:"middle"},P)},H))||this}return Object.defineProperty(F.prototype,"offscreenGroup",{get:function(){return this._offscreen||(this._offscreen=(0,V.g)(this)),this._offscreen},enumerable:!1,configurable:!0}),F.prototype.disconnectedCallback=function(){var C;(C=this._offscreen)===null||C===void 0||C.destroy()},F}(Z.xv)},65244:function(Be,Me,b){"use strict";b.d(Me,{W:function(){return Sn}});var m=b(80813),Z=b(97304),V=b(66623),N=b(88839),E=b(38974),F=b(17911),C=b(58688),P=b(33253),H=b(98294),D=b(67756);function X(Oe,Qe,Re){return Re?"".concat(Oe," ").concat(Re,"legend-").concat(Qe):Oe}function j(Oe,Qe,Re){var Ke=Oe.classNamePrefix,gt=Ke===void 0?"":Ke;return X(Qe.name,Re,gt)}var de={title:"title",item:"item",marker:"marker",label:"label",value:"value",focusIcon:"focus-icon",background:"background",ribbon:"ribbon",track:"track",selection:"selection",handle:"handle",handleMarker:"handle-marker",handleLabel:"handle-label",indicator:"indicator",prevBtn:"prev-btn",nextBtn:"next-btn",pageInfo:"page-info"},he=(0,C.A)({text:"text"},"title");function we(Oe,Qe){var Re=Oe.attributes,Ke=Re.position,gt=Re.spacing,tn=Re.inset,yt=Re.text,Yt=Oe.getBBox(),Rn=Qe.getBBox(),er=(0,P.l)(Ke),Jn=(0,m.CR)((0,H.j)(yt?gt:0),4),kr=Jn[0],fr=Jn[1],wr=Jn[2],ei=Jn[3],_n=(0,m.CR)((0,H.j)(tn),4),jn=_n[0],Hr=_n[1],Pr=_n[2],$i=_n[3],Zi=(0,m.CR)([ei+fr,kr+wr],2),Xi=Zi[0],Ei=Zi[1],ms=(0,m.CR)([$i+Hr,jn+Pr],2),_i=ms[0],Es=ms[1];if(er[0]==="l")return new F.b(Yt.x,Yt.y,Rn.width+Yt.width+Xi+_i,Math.max(Rn.height+Es,Yt.height));if(er[0]==="t")return new F.b(Yt.x,Yt.y,Math.max(Rn.width+_i,Yt.width),Rn.height+Yt.height+Ei+Es);var ua=(0,m.CR)([Qe.attributes.width||Rn.width,Qe.attributes.height||Rn.height],2),Hn=ua[0],Pt=ua[1];return new F.b(Rn.x,Rn.y,Hn+Yt.width+Xi+_i,Pt+Yt.height+Ei+Es)}function ve(Oe,Qe){var Re=Object.entries(Qe).reduce(function(Ke,gt){var tn=(0,m.CR)(gt,2),yt=tn[0],Yt=tn[1],Rn=Oe.node().attr(yt);return Rn||(Ke[yt]=Yt),Ke},{});Oe.styles(Re)}function Ee(Oe){var Qe,Re,Ke,gt,tn=Oe,yt=tn.width,Yt=tn.height,Rn=tn.position,er=(0,m.CR)([+yt/2,+Yt/2],2),Jn=er[0],kr=er[1],fr=(0,m.CR)([+Jn,+kr,"center","middle"],4),wr=fr[0],ei=fr[1],_n=fr[2],jn=fr[3],Hr=(0,P.l)(Rn);return Hr.includes("l")&&(Qe=(0,m.CR)([0,"start"],2),wr=Qe[0],_n=Qe[1]),Hr.includes("r")&&(Re=(0,m.CR)([+yt,"end"],2),wr=Re[0],_n=Re[1]),Hr.includes("t")&&(Ke=(0,m.CR)([0,"top"],2),ei=Ke[0],jn=Ke[1]),Hr.includes("b")&&(gt=(0,m.CR)([+Yt,"bottom"],2),ei=gt[0],jn=gt[1]),{x:wr,y:ei,textAlign:_n,textBaseline:jn}}var $e=function(Oe){(0,m.ZT)(Qe,Oe);function Qe(Re){return Oe.call(this,Re,{text:"",width:0,height:0,fill:"#4a505a",fontWeight:"bold",fontSize:12,fontFamily:"sans-serif",inset:0,spacing:0,position:"top-left"})||this}return Qe.prototype.getAvailableSpace=function(){var Re=this,Ke=this.attributes,gt=Ke.width,tn=Ke.height,yt=Ke.position,Yt=Ke.spacing,Rn=Ke.inset,er=Re.querySelector(he.text.class);if(!er)return new F.b(0,0,+gt,+tn);var Jn=er.getBBox(),kr=Jn.width,fr=Jn.height,wr=(0,m.CR)((0,H.j)(Yt),4),ei=wr[0],_n=wr[1],jn=wr[2],Hr=wr[3],Pr=(0,m.CR)([0,0,+gt,+tn],4),$i=Pr[0],Zi=Pr[1],Xi=Pr[2],Ei=Pr[3],ms=(0,P.l)(yt);if(ms.includes("i"))return new F.b($i,Zi,Xi,Ei);ms.forEach(function(Ln,gr){var Rr,$r,Ii,Di;Ln==="t"&&(Rr=(0,m.CR)(gr===0?[fr+jn,+tn-fr-jn]:[0,+tn],2),Zi=Rr[0],Ei=Rr[1]),Ln==="r"&&($r=(0,m.CR)([+gt-kr-Hr],1),Xi=$r[0]),Ln==="b"&&(Ii=(0,m.CR)([+tn-fr-ei],1),Ei=Ii[0]),Ln==="l"&&(Di=(0,m.CR)(gr===0?[kr+_n,+gt-kr-_n]:[0,+gt],2),$i=Di[0],Xi=Di[1])});var _i=(0,m.CR)((0,H.j)(Rn),4),Es=_i[0],ua=_i[1],Hn=_i[2],Pt=_i[3],Gt=(0,m.CR)([Pt+ua,Es+Hn],2),Bt=Gt[0],yn=Gt[1];return new F.b($i+Pt,Zi+Es,Xi-Bt,Ei-yn)},Qe.prototype.getBBox=function(){return this.title?this.title.getBBox():new F.b(0,0,0,0)},Qe.prototype.render=function(Re,Ke){var gt=this,tn=Re.width,yt=Re.height,Yt=Re.position,Rn=Re.spacing,er=Re.classNamePrefix,Jn=(0,m._T)(Re,["width","height","position","spacing","classNamePrefix"]),kr=(0,m.CR)((0,N.Hm)(Jn),1),fr=kr[0],wr=Ee(Re),ei=wr.x,_n=wr.y,jn=wr.textAlign,Hr=wr.textBaseline;(0,D.z)(!!Jn.text,(0,E.Ys)(Ke),function(Pr){var $i=X(he.text.name,de.title,er);gt.title=Pr.maybeAppendByClassName(he.text,"text").attr("className",$i).styles(fr).call(ve,{x:ei,y:_n,textAlign:jn,textBaseline:Hr}).node()})},Qe}(Z.w),Fe=function(){},ct=b(37004),vt=b(38242);function at(Oe,Qe){return Oe.reduce(function(Re,Ke){return(Re[Ke[Qe]]=Re[Ke[Qe]]||[]).push(Ke),Re},{})}var kt=b(99247),It=b(70208),Bn=b(78431),Lt=b(86314);function Wn(Oe){var Qe;return((Qe=Oe[0])===null||Qe===void 0?void 0:Qe.map(function(Re,Ke){return Oe.map(function(gt){return gt[Ke]})}))||[]}var Xn=b(69014),In=b(99769),zn=function(Oe,Qe,Re){return[["M",Oe-Re,Qe],["A",Re,Re,0,1,0,Oe+Re,Qe],["A",Re,Re,0,1,0,Oe-Re,Qe],["Z"]]},dr=zn,vn=function(Oe,Qe,Re){return[["M",Oe-Re,Qe-Re],["L",Oe+Re,Qe-Re],["L",Oe+Re,Qe+Re],["L",Oe-Re,Qe+Re],["Z"]]},_r=function(Oe,Qe,Re){return[["M",Oe-Re,Qe],["L",Oe,Qe-Re],["L",Oe+Re,Qe],["L",Oe,Qe+Re],["Z"]]},Ge=function(Oe,Qe,Re){var Ke=Re*Math.sin(.3333333333333333*Math.PI);return[["M",Oe-Re,Qe+Ke],["L",Oe,Qe-Ke],["L",Oe+Re,Qe+Ke],["Z"]]},Tt=function(Oe,Qe,Re){var Ke=Re*Math.sin(.3333333333333333*Math.PI);return[["M",Oe-Re,Qe-Ke],["L",Oe+Re,Qe-Ke],["L",Oe,Qe+Ke],["Z"]]},On=function(Oe,Qe,Re){var Ke=Re/2*Math.sqrt(3);return[["M",Oe,Qe-Re],["L",Oe+Ke,Qe-Re/2],["L",Oe+Ke,Qe+Re/2],["L",Oe,Qe+Re],["L",Oe-Ke,Qe+Re/2],["L",Oe-Ke,Qe-Re/2],["Z"]]},Vr=function(Oe,Qe,Re){var Ke=Re-1.5;return[["M",Oe-Re,Qe-Ke],["L",Oe+Re,Qe+Ke],["L",Oe+Re,Qe-Ke],["L",Oe-Re,Qe+Ke],["Z"]]},en=function(Oe,Qe,Re){return[["M",Oe,Qe+Re],["L",Oe,Qe-Re]]},ln=function(Oe,Qe,Re){return[["M",Oe-Re,Qe-Re],["L",Oe+Re,Qe+Re],["M",Oe+Re,Qe-Re],["L",Oe-Re,Qe+Re]]},Cn=function(Oe,Qe,Re){return[["M",Oe-Re/2,Qe-Re],["L",Oe+Re/2,Qe-Re],["M",Oe,Qe-Re],["L",Oe,Qe+Re],["M",Oe-Re/2,Qe+Re],["L",Oe+Re/2,Qe+Re]]},Mt=function(Oe,Qe,Re){return[["M",Oe-Re,Qe],["L",Oe+Re,Qe],["M",Oe,Qe-Re],["L",Oe,Qe+Re]]},Et=function(Oe,Qe,Re){return[["M",Oe-Re,Qe],["L",Oe+Re,Qe]]},pe=function(Oe,Qe,Re){return[["M",Oe-Re,Qe],["L",Oe+Re,Qe]]},Ae=pe,Pe=function(Oe,Qe,Re){return[["M",Oe-Re,Qe],["A",Re/2,Re/2,0,1,1,Oe,Qe],["A",Re/2,Re/2,0,1,0,Oe+Re,Qe]]},Ut=function(Oe,Qe,Re){return[["M",Oe-Re-1,Qe-2.5],["L",Oe,Qe-2.5],["L",Oe,Qe+2.5],["L",Oe+Re+1,Qe+2.5]]},jt=function(Oe,Qe,Re){return[["M",Oe-Re-1,Qe+2.5],["L",Oe,Qe+2.5],["L",Oe,Qe-2.5],["L",Oe+Re+1,Qe-2.5]]},ft=function(Oe,Qe,Re){return[["M",Oe-(Re+1),Qe+2.5],["L",Oe-Re/2,Qe+2.5],["L",Oe-Re/2,Qe-2.5],["L",Oe+Re/2,Qe-2.5],["L",Oe+Re/2,Qe+2.5],["L",Oe+Re+1,Qe+2.5]]};function on(Oe,Qe){return[["M",Oe-5,Qe+2.5],["L",Oe-5,Qe],["L",Oe,Qe],["L",Oe,Qe-3],["L",Oe,Qe+3],["L",Oe+6.5,Qe+3]]}var hn=function(Oe,Qe,Re){return[["M",Oe-Re,Qe-Re],["L",Oe+Re,Qe],["L",Oe-Re,Qe+Re],["Z"]]},lt=function(Oe,Qe,Re){var Ke=Re,gt=Re*.2,tn=Re*.7;return[["M",Oe-Ke,Qe],["A",Ke,Ke,0,1,0,Oe+Ke,Qe],["A",Ke,Ke,0,1,0,Oe-Ke,Qe],["Z"],["M",Oe-tn,Qe],["L",Oe-gt,Qe],["M",Oe+gt,Qe],["L",Oe+tn,Qe],["M",Oe,Qe-tn],["L",Oe,Qe-gt],["M",Oe,Qe+gt],["L",Oe,Qe+tn]]},Ct=(0,C.A)({prevBtnGroup:"prev-btn-group",prevBtn:"prev-btn",nextBtnGroup:"next-btn-group",nextBtn:"next-btn",pageInfoGroup:"page-info-group",pageInfo:"page-info",playWindow:"play-window",contentGroup:"content-group",controller:"controller",clipPath:"clip-path"},"navigator"),sn=function(Oe){(0,m.ZT)(Qe,Oe);function Qe(Re){var Ke=Oe.call(this,Re,{x:0,y:0,animate:{easing:"linear",duration:200,fill:"both"},buttonCursor:"pointer",buttonFill:"black",buttonD:hn(0,0,6),buttonSize:12,controllerPadding:5,controllerSpacing:5,formatter:function(gt,tn){return"".concat(gt,"/").concat(tn)},defaultPage:0,loop:!1,orientation:"horizontal",pageNumFill:"black",pageNumFontSize:12,pageNumTextAlign:"start",pageNumTextBaseline:"middle"})||this;return Ke.playState="idle",Ke.contentGroup=Ke.appendChild(new V.ZA({class:Ct.contentGroup.name})),Ke.playWindow=Ke.contentGroup.appendChild(new V.ZA({class:Ct.playWindow.name})),Ke.innerCurrPage=Ke.defaultPage,Ke}return Object.defineProperty(Qe.prototype,"defaultPage",{get:function(){var Re=this.attributes.defaultPage;return(0,It.Z)(Re,0,Math.max(this.pageViews.length-1,0))},enumerable:!1,configurable:!0}),Object.defineProperty(Qe.prototype,"pageViews",{get:function(){return this.playWindow.children},enumerable:!1,configurable:!0}),Object.defineProperty(Qe.prototype,"controllerShape",{get:function(){return this.totalPages>1?{width:55,height:0}:{width:0,height:0}},enumerable:!1,configurable:!0}),Object.defineProperty(Qe.prototype,"pageShape",{get:function(){var Re=this.pageViews,Ke=(0,m.CR)(Wn(Re.map(function(kr){var fr=kr.getBBox(),wr=fr.width,ei=fr.height;return[wr,ei]})).map(function(kr){return Math.max.apply(Math,(0,m.ev)([],(0,m.CR)(kr),!1))}),2),gt=Ke[0],tn=Ke[1],yt=this.attributes,Yt=yt.pageWidth,Rn=Yt===void 0?gt:Yt,er=yt.pageHeight,Jn=er===void 0?tn:er;return{pageWidth:Rn,pageHeight:Jn}},enumerable:!1,configurable:!0}),Qe.prototype.getContainer=function(){return this.playWindow},Object.defineProperty(Qe.prototype,"totalPages",{get:function(){return this.pageViews.length},enumerable:!1,configurable:!0}),Object.defineProperty(Qe.prototype,"currPage",{get:function(){return this.innerCurrPage},enumerable:!1,configurable:!0}),Qe.prototype.getBBox=function(){var Re=Oe.prototype.getBBox.call(this),Ke=Re.x,gt=Re.y,tn=this.controllerShape,yt=this.pageShape,Yt=yt.pageWidth,Rn=yt.pageHeight;return new F.b(Ke,gt,Yt+tn.width,Rn)},Qe.prototype.goTo=function(Re){var Ke=this,gt=this.attributes.animate,tn=this,yt=tn.currPage,Yt=tn.playState,Rn=tn.playWindow,er=tn.pageViews;if(Yt!=="idle"||Re<0||er.length<=0||Re>=er.length)return null;er[yt].setLocalPosition(0,0),this.prepareFollowingPage(Re);var Jn=(0,m.CR)(this.getFollowingPageDiff(Re),2),kr=Jn[0],fr=Jn[1];this.playState="running";var wr=(0,Lt.jt)(Rn,[{transform:"translate(0, 0)"},{transform:"translate(".concat(-kr,", ").concat(-fr,")")}],gt);return(0,Lt.Yq)(wr,function(){Ke.innerCurrPage=Re,Ke.playState="idle",Ke.setVisiblePages([Re]),Ke.updatePageInfo()}),wr},Qe.prototype.prev=function(){var Re=this.attributes.loop,Ke=this.pageViews.length,gt=this.currPage;if(!Re&&gt<=0)return null;var tn=Re?(gt-1+Ke)%Ke:(0,It.Z)(gt-1,0,Ke);return this.goTo(tn)},Qe.prototype.next=function(){var Re=this.attributes.loop,Ke=this.pageViews.length,gt=this.currPage;if(!Re&&gt>=Ke-1)return null;var tn=Re?(gt+1)%Ke:(0,It.Z)(gt+1,0,Ke);return this.goTo(tn)},Qe.prototype.renderClipPath=function(Re){var Ke=this.pageShape,gt=Ke.pageWidth,tn=Ke.pageHeight;if(!gt||!tn){this.contentGroup.style.clipPath=void 0;return}this.clipPath=Re.maybeAppendByClassName(Ct.clipPath,"rect").styles({width:gt,height:tn}),this.contentGroup.attr("clipPath",this.clipPath.node())},Qe.prototype.setVisiblePages=function(Re){this.playWindow.children.forEach(function(Ke,gt){Re.includes(gt)?(0,Xn.$Z)(Ke):(0,Xn.Cp)(Ke)})},Qe.prototype.adjustControllerLayout=function(){var Re=this,Ke=Re.prevBtnGroup,gt=Re.nextBtnGroup,tn=Re.pageInfoGroup,yt=this.attributes,Yt=yt.orientation,Rn=yt.controllerPadding,er=tn.getBBox(),Jn=er.width,kr=er.height,fr=(0,m.CR)(Yt==="horizontal"?[-180,0]:[-90,90],2),wr=fr[0],ei=fr[1];Ke.setLocalEulerAngles(wr),gt.setLocalEulerAngles(ei);var _n=Ke.getBBox(),jn=_n.width,Hr=_n.height,Pr=gt.getBBox(),$i=Pr.width,Zi=Pr.height,Xi=Math.max(jn,Jn,$i),Ei=Yt==="horizontal"?{offset:[[0,0],[jn/2+Rn,0],[jn+Jn+Rn*2,0]],textAlign:"start"}:{offset:[[Xi/2,-Hr-Rn],[Xi/2,0],[Xi/2,Zi+Rn]],textAlign:"center"},ms=(0,m.CR)(Ei.offset,3),_i=(0,m.CR)(ms[0],2),Es=_i[0],ua=_i[1],Hn=(0,m.CR)(ms[1],2),Pt=Hn[0],Gt=Hn[1],Bt=(0,m.CR)(ms[2],2),yn=Bt[0],Ln=Bt[1],gr=Ei.textAlign,Rr=tn.querySelector("text");Rr&&(Rr.style.textAlign=gr),Ke.setLocalPosition(Es,ua),tn.setLocalPosition(Pt,Gt),gt.setLocalPosition(yn,Ln)},Qe.prototype.updatePageInfo=function(){var Re,Ke=this,gt=Ke.currPage,tn=Ke.pageViews,yt=Ke.attributes.formatter;tn.length<2||((Re=this.pageInfoGroup.querySelector(Ct.pageInfo.class))===null||Re===void 0||Re.attr("text",yt(gt+1,tn.length)),this.adjustControllerLayout())},Qe.prototype.getFollowingPageDiff=function(Re){var Ke=this.currPage;if(Ke===Re)return[0,0];var gt=this.attributes.orientation,tn=this.pageShape,yt=tn.pageWidth,Yt=tn.pageHeight,Rn=Re<Ke?-1:1;return gt==="horizontal"?[Rn*yt,0]:[0,Rn*Yt]},Qe.prototype.prepareFollowingPage=function(Re){var Ke=this,gt=Ke.currPage,tn=Ke.pageViews;if(this.setVisiblePages([Re,gt]),Re!==gt){var yt=(0,m.CR)(this.getFollowingPageDiff(Re),2),Yt=yt[0],Rn=yt[1];tn[Re].setLocalPosition(Yt,Rn)}},Qe.prototype.renderController=function(Re){var Ke=this,gt=this.attributes,tn=gt.controllerSpacing,yt=gt.classNamePrefix,Yt=yt===void 0?"":yt,Rn=this.pageShape,er=Rn.pageWidth,Jn=Rn.pageHeight,kr=this.pageViews.length>=2,fr=Re.maybeAppendByClassName(Ct.controller,"g");if((0,Xn.WD)(fr.node(),kr),!!kr){var wr=(0,N.zs)(this.attributes,"button"),ei=(0,N.zs)(this.attributes,"pageNum"),_n=(0,m.CR)((0,N.Hm)(wr),2),jn=_n[0],Hr=_n[1],Pr=jn.size,$i=(0,m._T)(jn,["size"]),Zi=!fr.select(Ct.prevBtnGroup.class).node(),Xi=fr.maybeAppendByClassName(Ct.prevBtnGroup,"g").styles(Hr);this.prevBtnGroup=Xi.node();var Ei=Xi.maybeAppendByClassName(Ct.prevBtn,"path");if(Yt){var ms=X(Ct.prevBtn.name,de.prevBtn,Yt);Ei.node().setAttribute("class",ms)}var _i=fr.maybeAppendByClassName(Ct.nextBtnGroup,"g").styles(Hr);this.nextBtnGroup=_i.node();var Es=_i.maybeAppendByClassName(Ct.nextBtn,"path");if(Yt){var ua=X(Ct.nextBtn.name,de.nextBtn,Yt);Es.node().setAttribute("class",ua)}[Ei,Es].forEach(function(Bt){Bt.styles((0,m.pi)((0,m.pi)({},$i),{transformOrigin:"center"})),(0,In.b)(Bt.node(),Pr,!0)});var Hn=fr.maybeAppendByClassName(Ct.pageInfoGroup,"g");this.pageInfoGroup=Hn.node();var Pt=Hn.maybeAppendByClassName(Ct.pageInfo,"text");if(Pt.styles(ei),Yt){var Gt=X(Ct.pageInfo.name,de.pageInfo,Yt);Pt.node().setAttribute("class",Gt)}this.updatePageInfo(),fr.node().setLocalPosition(er+tn,Jn/2),Zi&&(this.prevBtnGroup.addEventListener("click",function(){Ke.prev()}),this.nextBtnGroup.addEventListener("click",function(){Ke.next()}))}},Qe.prototype.render=function(Re,Ke){var gt=Re.x,tn=gt===void 0?0:gt,yt=Re.y,Yt=yt===void 0?0:yt;this.attr("transform","translate(".concat(tn,", ").concat(Yt,")"));var Rn=(0,E.Ys)(Ke);this.renderClipPath(Rn),this.renderController(Rn),this.setVisiblePages([this.defaultPage]),this.goTo(this.defaultPage)},Qe.prototype.bindEvents=function(){var Re=this,Ke=(0,Bn.Z)(function(){return Re.render(Re.attributes,Re)},50);this.playWindow.addEventListener(V.Dk.INSERTED,Ke),this.playWindow.addEventListener(V.Dk.REMOVED,Ke)},Qe}(Z.w),W=b(71018),Se=b(93785),Ht=b(71879);function zt(Oe){var Qe="default";if((0,Se.Z)(Oe)&&Oe instanceof Image)Qe="image";else if((0,W.Z)(Oe))Qe="symbol";else if((0,Ht.Z)(Oe)){var Re=new RegExp("data:(image|text)");Oe.match(Re)?Qe="base64":/^(https?:\/\/(([a-zA-Z0-9]+-?)+[a-zA-Z0-9]+\.)+[a-zA-Z]+)(:\d+)?(\/.*)?(\?.*)?(#.*)?$/.test(Oe)?Qe="url":Qe="symbol"}return Qe}function Fn(Oe){var Qe=zt(Oe);return["base64","url","image"].includes(Qe)?"image":Oe&&Qe==="symbol"?"path":null}var Tn=function(Oe){(0,m.ZT)(Qe,Oe);function Qe(){return Oe!==null&&Oe.apply(this,arguments)||this}return Qe.prototype.render=function(Re,Ke){var gt=Re.x,tn=gt===void 0?0:gt,yt=Re.y,Yt=yt===void 0?0:yt,Rn=this.getSubShapeStyle(Re),er=Rn.symbol,Jn=Rn.size,kr=Jn===void 0?16:Jn,fr=(0,m._T)(Rn,["symbol","size"]),wr=Fn(er);(0,D.z)(!!wr,(0,E.Ys)(Ke),function(ei){ei.maybeAppendByClassName("marker",wr).attr("className","marker ".concat(wr,"-marker")).call(function(_n){if(wr==="image"){var jn=kr*2;_n.styles({img:er,width:jn,height:jn,x:tn-kr,y:Yt-kr})}else{var jn=kr/2,Hr=(0,W.Z)(er)?er:Qe.getSymbol(er);_n.styles((0,m.pi)({d:Hr==null?void 0:Hr(tn,Yt,jn)},fr))}})})},Qe.MARKER_SYMBOL_MAP=new Map,Qe.registerSymbol=function(Re,Ke){Qe.MARKER_SYMBOL_MAP.set(Re,Ke)},Qe.getSymbol=function(Re){return Qe.MARKER_SYMBOL_MAP.get(Re)},Qe.getSymbols=function(){return Array.from(Qe.MARKER_SYMBOL_MAP.keys())},Qe}(Z.w);Tn.registerSymbol("cross",ln),Tn.registerSymbol("hyphen",Et),Tn.registerSymbol("line",en),Tn.registerSymbol("plus",Mt),Tn.registerSymbol("tick",Cn),Tn.registerSymbol("circle",zn),Tn.registerSymbol("point",dr),Tn.registerSymbol("bowtie",Vr),Tn.registerSymbol("hexagon",On),Tn.registerSymbol("square",vn),Tn.registerSymbol("diamond",_r),Tn.registerSymbol("triangle",Ge),Tn.registerSymbol("triangle-down",Tt),Tn.registerSymbol("line",en),Tn.registerSymbol("dot",pe),Tn.registerSymbol("dash",Ae),Tn.registerSymbol("smooth",Pe),Tn.registerSymbol("hv",Ut),Tn.registerSymbol("vh",jt),Tn.registerSymbol("hvh",ft),Tn.registerSymbol("vhv",on),Tn.registerSymbol("focus",lt);function lr(Oe,Qe,Re){var Ke=Math.round((Oe-Re)/Qe);return Re+Ke*Qe}function je(Oe,Qe,Re){var Ke=1.4,gt=Ke*Re;return[["M",Oe-Re,Qe-gt],["L",Oe+Re,Qe-gt],["L",Oe+Re,Qe+gt],["L",Oe-Re,Qe+gt],["Z"]]}var be=1.4,it=.4;function wt(Oe,Qe,Re){var Ke=Re,gt=Ke*be,tn=Ke/2,yt=Ke/6,Yt=Oe+gt*it;return[["M",Oe,Qe],["L",Yt,Qe+tn],["L",Oe+gt,Qe+tn],["L",Oe+gt,Qe-tn],["L",Yt,Qe-tn],["Z"],["M",Yt,Qe+yt],["L",Oe+gt-2,Qe+yt],["M",Yt,Qe-yt],["L",Oe+gt-2,Qe-yt]]}function ot(Oe,Qe,Re){var Ke=Re,gt=Ke*be,tn=Ke/2,yt=Ke/6,Yt=Qe+gt*it;return[["M",Oe,Qe],["L",Oe-tn,Yt],["L",Oe-tn,Qe+gt],["L",Oe+tn,Qe+gt],["L",Oe+tn,Yt],["Z"],["M",Oe-yt,Yt],["L",Oe-yt,Qe+gt-2],["M",Oe+yt,Yt],["L",Oe+yt,Qe+gt-2]]}Tn.registerSymbol("hiddenHandle",je),Tn.registerSymbol("verticalHandle",wt),Tn.registerSymbol("horizontalHandle",ot);var ut=function(Oe,Qe,Re){return Oe===void 0&&(Oe="horizontal"),Oe==="horizontal"?Qe:Re};function _t(Oe,Qe,Re,Ke){var gt;Ke===void 0&&(Ke=4);var tn=__read(Oe,2),yt=tn[0],Yt=tn[1],Rn=__read(Qe,2),er=Rn[0],Jn=Rn[1],kr=__read(Re,2),fr=kr[0],wr=kr[1],ei=__read([er,Jn],2),_n=ei[0],jn=ei[1],Hr=jn-_n;return _n>jn&&(gt=__read([jn,_n],2),_n=gt[0],jn=gt[1]),Hr>Yt-yt?[yt,Yt]:_n<yt?fr===yt&&wr===jn?[yt,jn]:[yt,Hr+yt]:jn>Yt?wr===Yt&&fr===_n?[_n,Yt]:[Yt-Hr,Yt]:[_n,jn]}function $t(Oe,Qe,Re){return Oe===void 0&&(Oe="horizontal"),Oe==="horizontal"?Qe:Re}var Vt=b(49527),Qt=b(2080),cn=b(88170),Yn=b(53160),qn=b(23343);function Sr(Oe,Qe){for(var Re in Qe)Qe.hasOwnProperty(Re)&&Re!=="constructor"&&Qe[Re]!==void 0&&(Oe[Re]=Qe[Re])}function Jr(Oe,Qe,Re,Ke){return Qe&&Sr(Oe,Qe),Re&&Sr(Oe,Re),Ke&&Sr(Oe,Ke),Oe}var vr=b(5759);function Ki(Oe){return Oe instanceof Element||Oe instanceof Document}var Mi,yi="component-poptip",qr={CONTAINER:"component-poptip",ARROW:"component-poptip-arrow",TEXT:"component-poptip-text"},es=(Mi={},Mi[".".concat(qr.CONTAINER)]={visibility:"visible",position:"absolute","background-color":"rgba(0, 0, 0)","box-shadow":"0px 0px 10px #aeaeae","border-radius":"3px",color:"#fff",opacity:.8,"font-size":"12px",padding:"4px 6px",display:"flex","justify-content":"center","align-items":"center","z-index":8,transition:"visibility 50ms"},Mi[".".concat(qr.TEXT)]={"text-align":"center"},Mi[".".concat(qr.CONTAINER,"[data-position='top']")]={transform:"translate(-50%, -100%)"},Mi[".".concat(qr.CONTAINER,"[data-position='left']")]={transform:"translate(-100%, -50%)"},Mi[".".concat(qr.CONTAINER,"[data-position='right']")]={transform:"translate(0, -50%)"},Mi[".".concat(qr.CONTAINER,"[data-position='bottom']")]={transform:"translate(-50%, 0)"},Mi[".".concat(qr.CONTAINER,"[data-position='top-left']")]={transform:"translate(0,-100%)"},Mi[".".concat(qr.CONTAINER,"[data-position='top-right']")]={transform:"translate(-100%,-100%)"},Mi[".".concat(qr.CONTAINER,"[data-position='left-top']")]={transform:"translate(-100%, 0)"},Mi[".".concat(qr.CONTAINER,"[data-position='left-bottom']")]={transform:"translate(-100%, -100%)"},Mi[".".concat(qr.CONTAINER,"[data-position='right-top']")]={transform:"translate(0, 0)"},Mi[".".concat(qr.CONTAINER,"[data-position='right-bottom']")]={transform:"translate(0, -100%)"},Mi[".".concat(qr.CONTAINER,"[data-position='bottom-left']")]={transform:"translate(0, 0)"},Mi[".".concat(qr.CONTAINER,"[data-position='bottom-right']")]={transform:"translate(-100%, 0)"},Mi[".".concat(qr.ARROW)]={width:"4px",height:"4px",transform:"rotate(45deg)","background-color":"rgba(0, 0, 0)",position:"absolute","z-index":-1},Mi[".".concat(qr.CONTAINER,"[data-position='top']")]={transform:"translate(-50%, calc(-100% - 5px))"},Mi["[data-position='top'] .".concat(qr.ARROW)]={bottom:"-2px"},Mi[".".concat(qr.CONTAINER,"[data-position='left']")]={transform:"translate(calc(-100% - 5px), -50%)"},Mi["[data-position='left'] .".concat(qr.ARROW)]={right:"-2px"},Mi[".".concat(qr.CONTAINER,"[data-position='right']")]={transform:"translate(5px, -50%)"},Mi["[data-position='right'] .".concat(qr.ARROW)]={left:"-2px"},Mi[".".concat(qr.CONTAINER,"[data-position='bottom']")]={transform:"translate(-50%, 5px)"},Mi["[data-position='bottom'] .".concat(qr.ARROW)]={top:"-2px"},Mi[".".concat(qr.CONTAINER,"[data-position='top-left']")]={transform:"translate(0, calc(-100% - 5px))"},Mi["[data-position='top-left'] .".concat(qr.ARROW)]={left:"10px",bottom:"-2px"},Mi[".".concat(qr.CONTAINER,"[data-position='top-right']")]={transform:"translate(-100%, calc(-100% - 5px))"},Mi["[data-position='top-right'] .".concat(qr.ARROW)]={right:"10px",bottom:"-2px"},Mi[".".concat(qr.CONTAINER,"[data-position='left-top']")]={transform:"translate(calc(-100% - 5px), 0)"},Mi["[data-position='left-top'] .".concat(qr.ARROW)]={right:"-2px",top:"8px"},Mi[".".concat(qr.CONTAINER,"[data-position='left-bottom']")]={transform:"translate(calc(-100% - 5px), -100%)"},Mi["[data-position='left-bottom'] .".concat(qr.ARROW)]={right:"-2px",bottom:"8px"},Mi[".".concat(qr.CONTAINER,"[data-position='right-top']")]={transform:"translate(5px, 0)"},Mi["[data-position='right-top'] .".concat(qr.ARROW)]={left:"-2px",top:"8px"},Mi[".".concat(qr.CONTAINER,"[data-position='right-bottom']")]={transform:"translate(5px, -100%)"},Mi["[data-position='right-bottom'] .".concat(qr.ARROW)]={left:"-2px",bottom:"8px"},Mi[".".concat(qr.CONTAINER,"[data-position='bottom-left']")]={transform:"translate(0, 5px)"},Mi["[data-position='bottom-left'] .".concat(qr.ARROW)]={top:"-2px",left:"8px"},Mi[".".concat(qr.CONTAINER,"[data-position='bottom-right']")]={transform:"translate(-100%, 5px)"},Mi["[data-position='bottom-right'] .".concat(qr.ARROW)]={top:"-2px",right:"8px"},Mi),Ci=void 0;function En(Oe,Qe,Re,Ke,gt,tn){if(gt===void 0&&(gt=!1),tn===void 0&&(tn=!1),tn)return[Oe,Qe];var yt=Re.getBoundingClientRect(),Yt=yt.x,Rn=yt.y,er=yt.width,Jn=yt.height;switch(Ke){case"top":return gt?[Yt+er/2,Rn]:[Oe,Rn];case"left":return gt?[Yt,Rn+Jn/2]:[Yt,Qe];case"bottom":return gt?[Yt+er/2,Rn+Jn]:[Oe,Rn+Jn];case"right":return gt?[Yt+er,Rn+Jn/2]:[Yt+er,Qe];case"top-right":case"right-top":return[Yt+er,Rn];case"left-bottom":case"bottom-left":return[Yt,Rn+Jn];case"right-bottom":case"bottom-right":return[Yt+er,Rn+Jn];case"top-left":case"left-top":default:return[Yt,Rn]}}var rn=function(Oe){var Qe;return function(){for(var Re=[],Ke=0;Ke<arguments.length;Ke++)Re[Ke]=arguments[Ke];return Qe||(Qe=Oe.apply(Ci,Re)),Qe}};function Xt(Oe){var Qe=Oe&&document.getElementById(Oe);return Qe||(Qe=document.createElement("div"),Qe.setAttribute("id",Oe),document.body.appendChild(Qe)),Qe}function st(Oe){var Qe=rn(Xt)(Oe);return Qe}var dt=function(Oe){(0,m.ZT)(Qe,Oe);function Qe(Re){var Ke=Oe.call(this,(0,qn.Z)({style:{id:yi}},Qe.defaultOptions,Re))||this;return Ke.visibility="visible",Ke.map=new Map,Ke.domStyles="",Ke.initShape(),Ke.render(Ke.attributes,Ke),Ke}return Object.defineProperty(Qe.prototype,"visible",{get:function(){return this.visibility==="visible"},enumerable:!1,configurable:!0}),Qe.prototype.render=function(Re,Ke){this.visibility=this.style.visibility,this.updatePoptipElement()},Qe.prototype.update=function(Re){this.attr((0,qn.Z)({},this.style,Re)),this.render(this.attributes,this)},Qe.prototype.bind=function(Re,Ke){var gt=this;if(Re){var tn=this.style.text,yt=function(Rn){var er=Re,Jn=gt.style,kr=tn;if(Ke){var fr=typeof Ke=="function"?Ke.call(null,Rn):Ke,wr=fr.html,ei=fr.target,_n=(0,m._T)(fr,["html","target"]);Jn=Jr({},gt.style,_n),(ei||ei===!1)&&(er=ei),typeof wr=="string"&&(kr=wr)}var jn=Jn.position,Hr=Jn.arrowPointAtCenter,Pr=Jn.follow,$i=Jn.offset;if(er){var Zi=Rn,Xi=Zi.clientX,Ei=Zi.clientY,ms=(0,m.CR)(En(Xi,Ei,er,jn,Hr,Pr),2),_i=ms[0],Es=ms[1];gt.showTip(_i,Es,{text:kr,position:jn,offset:$i})}else gt.hideTip()},Yt=function(){gt.hideTip()};Re.addEventListener("mousemove",yt),Re.addEventListener("mouseleave",Yt),this.map.set(Re,[yt,Yt])}},Qe.prototype.unbind=function(Re){if(this.map.has(Re)){var Ke=(0,m.CR)(this.map.get(Re)||[],2),gt=Ke[0],tn=Ke[1];gt&&Re.removeEventListener("mousemove",gt),tn&&Re.removeEventListener("mouseleave",tn),this.map.delete(Re)}},Qe.prototype.clear=function(){this.container.innerHTML=""},Qe.prototype.destroy=function(){var Re=this,Ke;(0,m.ev)([],(0,m.CR)(this.map.keys()),!1).forEach(function(gt){return Re.unbind(gt)}),(Ke=this.container)===null||Ke===void 0||Ke.remove(),Oe.prototype.destroy.call(this)},Qe.prototype.showTip=function(Re,Ke,gt){var tn=(0,vr.Z)(gt,"text");if(!(tn&&typeof tn!="string")&&(this.applyStyles(),Re&&Ke&&gt)){var yt=gt.offset,Yt=gt.position;if(Yt&&this.container.setAttribute("data-position",Yt),this.setOffsetPosition(Re,Ke,yt),typeof tn=="string"){var Rn=this.container.querySelector(".".concat(qr.TEXT));Rn&&(Rn.innerHTML=tn)}this.visibility="visible",this.container.style.visibility="visible"}},Qe.prototype.hideTip=function(){this.visibility="hidden",this.container.style.visibility="hidden"},Qe.prototype.getContainer=function(){return this.container},Qe.prototype.getClassName=function(){var Re=this.style.containerClassName;return"".concat(qr.CONTAINER).concat(Re?" ".concat(Re):"")},Qe.prototype.initShape=function(){var Re=this,Ke=this.style.id;this.container=st(Ke),this.container.className=this.getClassName(),this.container.addEventListener("mousemove",function(){return Re.showTip()}),this.container.addEventListener("mouseleave",function(){return Re.hideTip()})},Qe.prototype.updatePoptipElement=function(){var Re=this.container;this.clear();var Ke=this.style,gt=Ke.id,tn=Ke.template,yt=Ke.text;this.container.setAttribute("id",gt),this.container.className=this.getClassName();var Yt='<span class="'.concat(qr.ARROW,'"></span>');Re.innerHTML=Yt,(0,Ht.Z)(tn)?Re.innerHTML+=tn:tn&&Ki(tn)&&Re.appendChild(tn),yt&&(Re.getElementsByClassName(qr.TEXT)[0].textContent=yt),this.applyStyles(),this.container.style.visibility=this.visibility},Qe.prototype.applyStyles=function(){var Re=(0,kt.n)({},es,this.style.domStyles),Ke=Object.entries(Re).reduce(function(tn,yt){var Yt=(0,m.CR)(yt,2),Rn=Yt[0],er=Yt[1],Jn=Object.entries(er).reduce(function(kr,fr){var wr=(0,m.CR)(fr,2),ei=wr[0],_n=wr[1];return"".concat(kr).concat(ei,": ").concat(_n,";")},"");return"".concat(tn).concat(Rn,"{").concat(Jn,"}")},"");if(this.domStyles!==Ke){this.domStyles=Ke;var gt=this.container.querySelector("style");gt&&this.container.removeChild(gt),gt=document.createElement("style"),gt.innerHTML=Ke,this.container.appendChild(gt)}},Qe.prototype.setOffsetPosition=function(Re,Ke,gt){gt===void 0&&(gt=this.style.offset);var tn=(0,m.CR)(gt,2),yt=tn[0],Yt=yt===void 0?0:yt,Rn=tn[1],er=Rn===void 0?0:Rn;this.container.style.left="".concat(Re+Yt,"px"),this.container.style.top="".concat(Ke+er,"px")},Qe.tag="poptip",Qe.defaultOptions={style:{x:0,y:0,width:0,height:0,target:null,visibility:"hidden",text:"",position:"top",follow:!1,offset:[0,0],domStyles:es,template:'<div class="'.concat(qr.TEXT,'"></div>')}},Qe}(Z.w),Wt=(0,C.A)({layout:"flex",markerGroup:"marker-group",marker:"marker",labelGroup:"label-group",label:"label",valueGroup:"value-group",focusGroup:"focus-group",focus:"focus",value:"value",backgroundGroup:"background-group",background:"background"},"legend-category-item"),bn={offset:[0,20],domStyles:{".component-poptip":{opacity:"1",padding:"8px 12px",background:"#fff",boxShadow:"0 2px 8px rgba(0, 0, 0, 0.15)"},".component-poptip-arrow":{display:"none"},".component-poptip-text":{color:"#000",lineHeight:"20px"}}};function Jt(Oe){var Qe=Oe.querySelector(Wt.marker.class);return Qe?Qe.style:{}}var ar=function(Oe){(0,m.ZT)(Qe,Oe);function Qe(Re,Ke){var gt=Oe.call(this,Re,{span:[1,1],marker:function(){return new V.Cd({style:{r:6}})},markerSize:10,labelFill:"#646464",valueFill:"#646464",labelFontSize:12,valueFontSize:12,labelTextBaseline:"middle",valueTextBaseline:"middle"})||this;return gt.keyFields={},gt.keyFields=Ke||{},gt}return Object.defineProperty(Qe.prototype,"showValue",{get:function(){var Re=this.attributes.valueText;return Re?typeof Re=="string"||typeof Re=="number"?Re!=="":typeof Re=="function"?!0:Re.attr("text")!=="":!1},enumerable:!1,configurable:!0}),Object.defineProperty(Qe.prototype,"actualSpace",{get:function(){var Re=this.labelGroup,Ke=this.valueGroup,gt=this.attributes,tn=gt.markerSize,yt=gt.focus,Yt=gt.focusMarkerSize,Rn=Re.node().getBBox(),er=Rn.width,Jn=Rn.height,kr=Ke.node().getBBox(),fr=kr.width,wr=kr.height,ei=yt?Yt!=null?Yt:12:0;return{markerWidth:tn,labelWidth:er,valueWidth:fr,focusWidth:ei,height:Math.max(tn,Jn,wr)}},enumerable:!1,configurable:!0}),Object.defineProperty(Qe.prototype,"span",{get:function(){var Re=this.attributes.span;if(!Re)return[1,1];var Ke=(0,m.CR)((0,H.j)(Re),2),gt=Ke[0],tn=Ke[1],yt=this.showValue?tn:0,Yt=gt+yt;return[gt/Yt,yt/Yt]},enumerable:!1,configurable:!0}),Qe.prototype.setAttribute=function(Re,Ke){Oe.prototype.setAttribute.call(this,Re,Ke)},Object.defineProperty(Qe.prototype,"shape",{get:function(){var Re,Ke=this.attributes,gt=Ke.markerSize,tn=Ke.width,yt=this.actualSpace,Yt=yt.markerWidth,Rn=yt.focusWidth,er=yt.height,Jn=this.actualSpace,kr=Jn.labelWidth,fr=Jn.valueWidth,wr=(0,m.CR)(this.spacing,3),ei=wr[0],_n=wr[1],jn=wr[2];if(tn){var Hr=tn-gt-ei-_n-Rn-jn,Pr=(0,m.CR)(this.span,2),$i=Pr[0],Zi=Pr[1];Re=(0,m.CR)([$i*Hr,Zi*Hr],2),kr=Re[0],fr=Re[1]}var Xi=Yt+kr+fr+ei+_n+Rn+jn;return{width:Xi,height:er,markerWidth:Yt,labelWidth:kr,valueWidth:fr,focusWidth:Rn}},enumerable:!1,configurable:!0}),Object.defineProperty(Qe.prototype,"spacing",{get:function(){var Re=this.attributes,Ke=Re.spacing,gt=Re.focus;if(!Ke)return[0,0,0];var tn=(0,m.CR)((0,H.j)(Ke),3),yt=tn[0],Yt=tn[1],Rn=tn[2];return[yt,this.showValue?Yt:0,gt?Rn:0]},enumerable:!1,configurable:!0}),Object.defineProperty(Qe.prototype,"layout",{get:function(){var Re=this.shape,Ke=Re.markerWidth,gt=Re.labelWidth,tn=Re.valueWidth,yt=Re.focusWidth,Yt=Re.width,Rn=Re.height,er=(0,m.CR)(this.spacing,3),Jn=er[0],kr=er[1],fr=er[2];return{height:Rn,width:Yt,markerWidth:Ke,labelWidth:gt,valueWidth:tn,focusWidth:yt,position:[Ke/2,Ke+Jn,Ke+gt+Jn+kr,Ke+gt+tn+Jn+kr+fr+yt/2]}},enumerable:!1,configurable:!0}),Object.defineProperty(Qe.prototype,"scaleSize",{get:function(){var Re=Jt(this.markerGroup.node()),Ke=this.attributes,gt=Ke.markerSize,tn=Ke.markerStrokeWidth,yt=tn===void 0?Re.strokeWidth:tn,Yt=Ke.markerLineWidth,Rn=Yt===void 0?Re.lineWidth:Yt,er=Ke.markerStroke,Jn=er===void 0?Re.stroke:er,kr=+(yt||Rn||(Jn?1:0))*Math.sqrt(2),fr=this.markerGroup.node().getBBox(),wr=fr.width,ei=fr.height;return(1-kr/Math.max(wr,ei))*gt},enumerable:!1,configurable:!0}),Qe.prototype.renderMarker=function(Re){var Ke=this,gt=this.attributes,tn=gt.marker,yt=gt.classNamePrefix,Yt=(0,N.zs)(this.attributes,"marker");this.markerGroup=Re.maybeAppendByClassName(Wt.markerGroup,"g").style("zIndex",0),(0,D.z)(!!tn,this.markerGroup,function(){var Rn,er=Ke.markerGroup.node(),Jn=(Rn=er.childNodes)===null||Rn===void 0?void 0:Rn[0],kr=X(Wt.marker.name,de.marker,yt),fr=typeof tn=="string"?new Tn({style:{symbol:tn},className:kr}):tn();if(Jn)if(fr.nodeName===Jn.nodeName)Jn instanceof Tn?Jn.update((0,m.pi)((0,m.pi)({},Yt),{symbol:tn})):((0,Qt.DM)(Jn,fr),(0,E.Ys)(Jn).styles(Yt));else{if(Jn.remove(),!(fr instanceof Tn)){var ei=X(Wt.marker.name,de.marker,yt);fr.className=ei}(0,E.Ys)(fr).styles(Yt),er.appendChild(fr)}else{if(!(fr instanceof Tn)){var wr=X(Wt.marker.name,de.marker,yt);fr.className=wr,(0,E.Ys)(fr).styles(Yt)}er.appendChild(fr)}Ke.markerGroup.node().scale(1/Ke.markerGroup.node().getScale()[0]);var _n=(0,In.b)(Ke.markerGroup.node(),Ke.scaleSize,!0);Ke.markerGroup.node().style._transform="scale(".concat(_n,")")})},Qe.prototype.renderLabel=function(Re){var Ke=(0,N.zs)(this.attributes,"label"),gt=Ke.text,tn=(0,m._T)(Ke,["text"]),yt=this.attributes.classNamePrefix;this.labelGroup=Re.maybeAppendByClassName(Wt.labelGroup,"g").style("zIndex",0);var Yt=X(Wt.label.name,de.label,yt),Rn=this.labelGroup.maybeAppendByClassName(Wt.label,function(){return(0,cn.S)(gt)});Rn.node().setAttribute("class",Yt),Rn.styles(tn)},Qe.prototype.renderValue=function(Re){var Ke=this,gt=(0,N.zs)(this.attributes,"value"),tn=gt.text,yt=(0,m._T)(gt,["text"]),Yt=this.attributes.classNamePrefix;this.valueGroup=Re.maybeAppendByClassName(Wt.valueGroup,"g").style("zIndex",0),(0,D.z)(this.showValue,this.valueGroup,function(){var Rn=X(Wt.value.name,de.value,Yt),er=Ke.valueGroup.maybeAppendByClassName(Wt.value,function(){return(0,cn.S)(tn)});er.node().setAttribute("class",Rn),er.styles(yt)})},Qe.prototype.createPoptip=function(){var Re=this.attributes.poptip,Ke=Re||{},gt=Ke.render,tn=(0,m._T)(Ke,["render"]),yt=new dt({style:(0,kt.n)(bn,tn)});return this.poptipGroup=yt,yt},Qe.prototype.bindPoptip=function(Re){var Ke=this,gt=this.attributes.poptip;if(gt){var tn=this.poptipGroup||this.createPoptip();tn.bind(Re,function(){var yt=Ke.attributes,Yt=yt.labelText,Rn=yt.valueText,er=yt.markerFill,Jn=typeof Yt=="string"?Yt:Yt==null?void 0:Yt.attr("text"),kr=typeof Rn=="string"?Rn:Rn==null?void 0:Rn.attr("text");if(typeof gt.render=="function")return{html:gt.render((0,m.pi)((0,m.pi)({},Ke.keyFields),{label:Jn,value:kr,color:er}))};var fr="";return(typeof Jn=="string"||typeof Jn=="number")&&(fr+='<div class="component-poptip-label">'.concat(Jn,"</div>")),(typeof kr=="string"||typeof kr=="number")&&(fr+='<div class="component-poptip-value">'.concat(kr,"</div>")),{html:fr}})}},Qe.prototype.renderFocus=function(Re){var Ke=this,gt=this.attributes,tn=gt.focus,yt=gt.focusMarkerSize,Yt=gt.classNamePrefix,Rn={x:0,y:0,size:yt,opacity:.6,symbol:"focus",stroke:"#aaaaaa",lineWidth:1};(0,Vt.Z)(tn)||(this.focusGroup=Re.maybeAppendByClassName(Wt.focusGroup,"g").style("zIndex",0),(0,D.z)(tn,this.focusGroup,function(){var er=X(Wt.focus.name,de.focusIcon,Yt),Jn=new Tn({style:(0,m.pi)((0,m.pi)({},Rn),{symbol:"focus"}),className:er}),kr=new V.Cd({style:{r:Rn.size/2,fill:"transparent"}}),fr=Ke.focusGroup.node();fr.appendChild(kr),fr.appendChild(Jn),Jn.update({opacity:0}),Re.node().addEventListener("pointerenter",function(){Jn.update({opacity:1})}),Re.node().addEventListener("pointerleave",function(){Jn.update({opacity:0})})}))},Qe.prototype.renderPoptip=function(Re){var Ke=this,gt=this.attributes.poptip;if(gt){var tn=Re.maybeAppendByClassName(Wt.value,"g").node(),yt=Re.maybeAppendByClassName(Wt.label,"g").node();[tn,yt].forEach(function(Yt){Yt&&Ke.bindPoptip(Yt)})}},Qe.prototype.renderBackground=function(Re){var Ke=this.shape,gt=Ke.width,tn=Ke.height,yt=(0,N.zs)(this.attributes,"background");this.background=Re.maybeAppendByClassName(Wt.backgroundGroup,"g").style("zIndex",-1);var Yt=this.background.maybeAppendByClassName(Wt.background,"rect");Yt.styles((0,m.pi)({width:gt,height:tn},yt));var Rn=this.attributes.classNamePrefix,er=Rn===void 0?"":Rn;if(er){var Jn=X(Wt.background.name,de.background,er);Yt.node().setAttribute("class",Jn)}},Qe.prototype.adjustLayout=function(){var Re=this.layout,Ke=Re.labelWidth,gt=Re.valueWidth,tn=Re.height,yt=(0,m.CR)(Re.position,4),Yt=yt[0],Rn=yt[1],er=yt[2],Jn=yt[3],kr=tn/2;this.markerGroup.styles({transform:"translate(".concat(Yt,", ").concat(kr,")").concat(this.markerGroup.node().style._transform)}),this.labelGroup.styles({transform:"translate(".concat(Rn,", ").concat(kr,")")}),this.focusGroup&&this.focusGroup.styles({transform:"translate(".concat(Jn,", ").concat(kr,")")}),(0,Yn.O)(this.labelGroup.select(Wt.label.class).node(),Math.ceil(Ke)),this.showValue&&(this.valueGroup.styles({transform:"translate(".concat(er,", ").concat(kr,")")}),(0,Yn.O)(this.valueGroup.select(Wt.value.class).node(),Math.ceil(gt)))},Qe.prototype.render=function(Re,Ke){var gt=(0,E.Ys)(Ke),tn=Re.x,yt=tn===void 0?0:tn,Yt=Re.y,Rn=Yt===void 0?0:Yt;gt.styles({transform:"translate(".concat(yt,", ").concat(Rn,")")}),this.renderMarker(gt),this.renderLabel(gt),this.renderValue(gt),this.renderBackground(gt),this.renderPoptip(gt),this.renderFocus(gt),this.adjustLayout()},Qe}(Z.w),rr=(0,C.A)({page:"item-page",navigator:"navigator",item:"item"},"items"),Kr=function(Oe,Qe,Re){return Re===void 0&&(Re=!0),Oe?Qe(Oe):Re},si=function(Oe){(0,m.ZT)(Qe,Oe);function Qe(Re){var Ke=Oe.call(this,Re,{data:[],gridRow:1/0,gridCol:void 0,padding:0,width:1e3,height:100,rowPadding:0,colPadding:0,layout:"flex",orientation:"horizontal",click:Fe,mouseenter:Fe,mouseleave:Fe})||this;return Ke.navigatorShape=[0,0],Ke}return Object.defineProperty(Qe.prototype,"pageViews",{get:function(){return this.navigator.getContainer()},enumerable:!1,configurable:!0}),Object.defineProperty(Qe.prototype,"grid",{get:function(){var Re=this.attributes,Ke=Re.gridRow,gt=Re.gridCol,tn=Re.data;if(!Ke&&!gt)throw new Error("gridRow and gridCol can not be set null at the same time");return Ke&&gt?[Ke,gt]:Ke?[Ke,tn.length]:[tn.length,gt]},enumerable:!1,configurable:!0}),Object.defineProperty(Qe.prototype,"renderData",{get:function(){var Re=this.attributes,Ke=Re.data,gt=Re.layout,tn=Re.poptip,yt=Re.focus,Yt=Re.focusMarkerSize,Rn=Re.classNamePrefix,er=(0,N.zs)(this.attributes,"item"),Jn=Ke.map(function(kr,fr){var wr=kr.id,ei=wr===void 0?fr:wr,_n=kr.label,jn=kr.value;return{id:"".concat(ei),index:fr,style:(0,m.pi)({layout:gt,labelText:_n,valueText:jn,poptip:tn,focus:yt,focusMarkerSize:Yt,classNamePrefix:Rn},Object.fromEntries(Object.entries(er).map(function(Hr){var Pr=(0,m.CR)(Hr,2),$i=Pr[0],Zi=Pr[1];return[$i,(0,vt.S)(Zi,[kr,fr,Ke])]})))}});return Jn},enumerable:!1,configurable:!0}),Qe.prototype.getGridLayout=function(){var Re=this,Ke=this.attributes,gt=Ke.orientation,tn=Ke.width,yt=Ke.rowPadding,Yt=Ke.colPadding,Rn=(0,m.CR)(this.navigatorShape,1),er=Rn[0],Jn=(0,m.CR)(this.grid,2),kr=Jn[0],fr=Jn[1],wr=fr*kr,ei=0;return this.pageViews.children.map(function(_n,jn){var Hr,Pr,$i=Math.floor(jn/wr),Zi=jn%wr,Xi=Re.ifHorizontal(fr,kr),Ei=[Math.floor(Zi/Xi),Zi%Xi];gt==="vertical"&&Ei.reverse();var ms=(0,m.CR)(Ei,2),_i=ms[0],Es=ms[1],ua=(tn-er-(fr-1)*Yt)/fr,Hn=_n.getBBox().height,Pt=(0,m.CR)([0,0],2),Gt=Pt[0],Bt=Pt[1];return gt==="horizontal"?(Hr=(0,m.CR)([ei,_i*(Hn+yt)],2),Gt=Hr[0],Bt=Hr[1],ei=Es===fr-1?0:ei+ua+Yt):(Pr=(0,m.CR)([Es*(ua+Yt),ei],2),Gt=Pr[0],Bt=Pr[1],ei=_i===kr-1?0:ei+Hn+yt),{page:$i,index:jn,row:_i,col:Es,pageIndex:Zi,width:ua,height:Hn,x:Gt,y:Bt}})},Qe.prototype.getFlexLayout=function(){var Re=this.attributes,Ke=Re.width,gt=Re.height,tn=Re.rowPadding,yt=Re.colPadding,Yt=(0,m.CR)(this.navigatorShape,1),Rn=Yt[0],er=(0,m.CR)(this.grid,2),Jn=er[0],kr=er[1],fr=(0,m.CR)([Ke-Rn,gt],2),wr=fr[0],ei=fr[1],_n=(0,m.CR)([0,0,0,0,0,0,0,0],8),jn=_n[0],Hr=_n[1],Pr=_n[2],$i=_n[3],Zi=_n[4],Xi=_n[5],Ei=_n[6],ms=_n[7];return this.pageViews.children.map(function(_i,Es){var ua,Hn,Pt,Gt,Bt=_i.getBBox(),yn=Bt.width,Ln=Bt.height,gr=Ei===0?0:yt,Rr=Ei+gr+yn;if(Rr<=wr&&Kr(Zi,function(Ii){return Ii<kr}))return ua=(0,m.CR)([Ei+gr,ms,Rr],3),jn=ua[0],Hr=ua[1],Ei=ua[2],{width:yn,height:Ln,x:jn,y:Hr,page:Pr,index:Es,pageIndex:$i++,row:Xi,col:Zi++};Hn=(0,m.CR)([Xi+1,0,0,ms+Ln+tn],4),Xi=Hn[0],Zi=Hn[1],Ei=Hn[2],ms=Hn[3];var $r=ms+Ln;return $r<=ei&&Kr(Xi,function(Ii){return Ii<Jn})?(Pt=(0,m.CR)([Ei,ms,yn],3),jn=Pt[0],Hr=Pt[1],Ei=Pt[2],{width:yn,height:Ln,x:jn,y:Hr,page:Pr,index:Es,pageIndex:$i++,row:Xi,col:Zi++}):(Gt=(0,m.CR)([0,0,yn,0,Pr+1,0,0,0],8),jn=Gt[0],Hr=Gt[1],Ei=Gt[2],ms=Gt[3],Pr=Gt[4],$i=Gt[5],Xi=Gt[6],Zi=Gt[7],{width:yn,height:Ln,x:jn,y:Hr,page:Pr,index:Es,pageIndex:$i++,row:Xi,col:Zi++})})},Object.defineProperty(Qe.prototype,"itemsLayout",{get:function(){this.navigatorShape=[0,0];var Re=this.attributes.layout==="grid"?this.getGridLayout:this.getFlexLayout,Ke=Re.call(this);return Ke.slice(-1)[0].page>0?(this.navigatorShape=[55,0],Re.call(this)):Ke},enumerable:!1,configurable:!0}),Qe.prototype.ifHorizontal=function(Re,Ke){var gt=this.attributes.orientation;return $t(gt,Re,Ke)},Qe.prototype.flattenPage=function(Re){Re.querySelectorAll(rr.item.class).forEach(function(Ke){Re.appendChild(Ke)}),Re.querySelectorAll(rr.page.class).forEach(function(Ke){var gt=Re.removeChild(Ke);gt.destroy()})},Qe.prototype.renderItems=function(Re){var Ke=this.attributes,gt=Ke.click,tn=Ke.mouseenter,yt=Ke.mouseleave,Yt=Ke.classNamePrefix;this.flattenPage(Re);var Rn=this.dispatchCustomEvent.bind(this),er=X(rr.item.name,de.item,Yt);(0,E.Ys)(Re).selectAll(rr.item.class).data(this.renderData,function(Jn){return Jn.id}).join(function(Jn){return Jn.append(function(kr){var fr=kr.style,wr=(0,m._T)(kr,["style"]);return new ar({style:fr},wr)}).attr("className",er).on("click",function(){gt==null||gt(this),Rn("itemClick",{item:this})}).on("pointerenter",function(){tn==null||tn(this),Rn("itemMouseenter",{item:this})}).on("pointerleave",function(){yt==null||yt(this),Rn("itemMouseleave",{item:this})})},function(Jn){return Jn.each(function(kr){var fr=kr.style;this.update(fr)})},function(Jn){return Jn.remove()})},Qe.prototype.relayoutNavigator=function(){var Re,Ke=this.attributes,gt=Ke.layout,tn=Ke.width,yt=((Re=this.pageViews.children[0])===null||Re===void 0?void 0:Re.getBBox().height)||0,Yt=(0,m.CR)(this.navigatorShape,2),Rn=Yt[0],er=Yt[1];this.navigator.update(gt==="grid"?{pageWidth:tn-Rn,pageHeight:yt-er}:{})},Qe.prototype.adjustLayout=function(){var Re=this,Ke=Object.entries(at(this.itemsLayout,"page")).map(function(tn){var yt=(0,m.CR)(tn,2),Yt=yt[0],Rn=yt[1];return{page:Yt,layouts:Rn}}),gt=(0,m.ev)([],(0,m.CR)(this.navigator.getContainer().children),!1);Ke.forEach(function(tn){var yt=tn.layouts,Yt=Re.pageViews.appendChild(new V.ZA({className:rr.page.name}));yt.forEach(function(Rn){var er=Rn.x,Jn=Rn.y,kr=Rn.index,fr=Rn.width,wr=Rn.height,ei=gt[kr];Yt.appendChild(ei),(0,ct.Z)(ei,"__layout__",Rn),ei.update({x:er,y:Jn,width:fr,height:wr})})}),this.relayoutNavigator()},Qe.prototype.renderNavigator=function(Re){var Ke=this.attributes,gt=Ke.orientation,tn=Ke.classNamePrefix,yt=(0,N.zs)(this.attributes,"nav"),Yt=(0,kt.n)({orientation:gt,classNamePrefix:tn},yt),Rn=this;return Re.selectAll(rr.navigator.class).data(["nav"]).join(function(er){return er.append(function(){return new sn({style:Yt})}).attr("className",rr.navigator.name).each(function(){Rn.navigator=this})},function(er){return er.each(function(){this.update(Yt)})},function(er){return er.remove()}),this.navigator},Qe.prototype.getBBox=function(){return this.navigator.getBBox()},Qe.prototype.render=function(Re,Ke){var gt=this.attributes.data;if(!(!gt||gt.length===0)){var tn=this.renderNavigator((0,E.Ys)(Ke));this.renderItems(tn.getContainer()),this.adjustLayout()}},Qe.prototype.dispatchCustomEvent=function(Re,Ke){var gt=new V.Aw(Re,{detail:Ke});this.dispatchEvent(gt)},Qe}(Z.w),Ie=(0,C.A)({markerGroup:"marker-group",marker:"marker",labelGroup:"label-group",label:"label"},"handle"),L={showLabel:!0,formatter:function(Oe){return Oe.toString()},markerSize:25,markerStroke:"#c5c5c5",markerFill:"#fff",markerLineWidth:1,labelFontSize:12,labelFill:"#c5c5c5",labelText:"",orientation:"vertical",spacing:0},Q=function(Oe){(0,m.ZT)(Qe,Oe);function Qe(Re){return Oe.call(this,Re,L)||this}return Qe.prototype.render=function(Re,Ke){var gt=(0,E.Ys)(Ke).maybeAppendByClassName(Ie.markerGroup,"g");this.renderMarker(gt);var tn=(0,E.Ys)(Ke).maybeAppendByClassName(Ie.labelGroup,"g");this.renderLabel(tn)},Qe.prototype.renderMarker=function(Re){var Ke=this,gt=this.attributes,tn=gt.orientation,yt=gt.classNamePrefix,Yt=gt.markerSymbol,Rn=Yt===void 0?$t(tn,"horizontalHandle","verticalHandle"):Yt;(0,D.z)(!!Rn,Re,function(er){var Jn=(0,N.zs)(Ke.attributes,"marker"),kr=(0,m.pi)({symbol:Rn},Jn),fr=X(Ie.marker.name,de.handleMarker,yt);if(Ke.marker=er.maybeAppendByClassName(Ie.marker,function(){return new Tn({style:kr,className:fr})}).update(kr),yt){var wr=Ke.marker.node().querySelector(".marker");if(wr){var ei=wr.getAttribute("class")||"",_n=ei.split(" ")[0],jn=X(_n,de.handleMarker,yt);wr.setAttribute("class",jn)}}})},Qe.prototype.renderLabel=function(Re){var Ke=this,gt=this.attributes,tn=gt.showLabel,yt=gt.orientation,Yt=gt.spacing,Rn=Yt===void 0?0:Yt,er=gt.formatter,Jn=gt.classNamePrefix;(0,D.z)(tn,Re,function(kr){var fr,wr=(0,N.zs)(Ke.attributes,"label"),ei=wr.text,_n=(0,m._T)(wr,["text"]),jn=((fr=kr.select(Ie.marker.class))===null||fr===void 0?void 0:fr.node().getBBox())||{},Hr=jn.width,Pr=Hr===void 0?0:Hr,$i=jn.height,Zi=$i===void 0?0:$i,Xi=(0,m.CR)($t(yt,[0,Zi+Rn,"center","top"],[Pr+Rn,0,"start","middle"]),4),Ei=Xi[0],ms=Xi[1],_i=Xi[2],Es=Xi[3],ua=X(Ie.label.name,de.handleLabel,Jn);kr.maybeAppendByClassName(Ie.label,"text").attr("className",ua).styles((0,m.pi)((0,m.pi)({},_n),{x:Ei,y:ms,text:er(ei).toString(),textAlign:_i,textBaseline:Es}))})},Qe}(Z.w),w={showTitle:!0,padding:0,orientation:"horizontal",backgroundFill:"transparent",titleText:"",titleSpacing:4,titlePosition:"top-left",titleFill:"#2C3542",titleFontWeight:"bold",titleFontFamily:"sans-serif",titleFontSize:12},z=(0,kt.n)({},w,{}),ie=(0,kt.n)({},w,(0,N.dq)(L,"handle"),{color:["#d0e3fa","#acc7f6","#8daaf2","#6d8eea","#4d73cd","#325bb1","#5a3e75","#8c3c79","#e23455","#e7655b"],indicatorBackgroundFill:"#262626",indicatorLabelFill:"white",indicatorLabelFontSize:12,indicatorVisibility:"hidden",labelAlign:"value",labelDirection:"positive",labelSpacing:5,showHandle:!0,showIndicator:!0,showLabel:!0,slidable:!0,titleText:"",type:"continuous"}),ze=.01,Je=.5,At=(0,C.A)({title:"title",html:"html",titleGroup:"title-group",items:"items",itemsGroup:"items-group",contentGroup:"content-group",ribbonGroup:"ribbon-group",ribbon:"ribbon",handlesGroup:"handles-group",handle:"handle",startHandle:"start-handle",endHandle:"end-handle",labelGroup:"label-group",label:"label",indicator:"indicator"},"legend"),xt=function(Oe){(0,m.ZT)(Qe,Oe);function Qe(){return Oe!==null&&Oe.apply(this,arguments)||this}return Qe.prototype.update=function(Re){this.attr(Re)},Qe}(V.k9),Sn=function(Oe){(0,m.ZT)(Qe,Oe);function Qe(Re){return Oe.call(this,Re,z)||this}return Qe.prototype.renderTitle=function(Re,Ke,gt){var tn=this.attributes,yt=tn.showTitle,Yt=tn.titleText,Rn=tn.classNamePrefix,er=(0,N.zs)(this.attributes,"title"),Jn=(0,m.CR)((0,N.Hm)(er),2),kr=Jn[0],fr=Jn[1];this.titleGroup=Re.maybeAppendByClassName(At.titleGroup,"g").styles(fr);var wr=(0,m.pi)((0,m.pi)({width:Ke,height:gt},kr),{text:yt?Yt:"",classNamePrefix:Rn});this.title=this.titleGroup.maybeAppendByClassName(At.title,function(){return new $e({style:wr})}).update(wr)},Qe.prototype.renderCustom=function(Re){var Ke=this.attributes.data,gt={innerHTML:this.attributes.render(Ke),pointerEvents:"auto"};Re.maybeAppendByClassName(At.html,function(){return new xt({className:At.html.name,style:gt})}).update(gt)},Qe.prototype.renderItems=function(Re,Ke){var gt=Ke.x,tn=Ke.y,yt=Ke.width,Yt=Ke.height,Rn=(0,N.zs)(this.attributes,"title",!0),er=(0,m.CR)((0,N.Hm)(Rn),2),Jn=er[0],kr=er[1],fr=(0,m.pi)((0,m.pi)({},Jn),{width:yt,height:Yt,x:0,y:0});this.itemsGroup=Re.maybeAppendByClassName(At.itemsGroup,"g").styles((0,m.pi)((0,m.pi)({},kr),{transform:"translate(".concat(gt,", ").concat(tn,")")}));var wr=this;this.itemsGroup.selectAll(At.items.class).data(["items"]).join(function(ei){return ei.append(function(){return new si({style:fr})}).attr("className",At.items.name).each(function(){wr.items=(0,E.Ys)(this)})},function(ei){return ei.update(fr)},function(ei){return ei.remove()})},Qe.prototype.adjustLayout=function(){var Re=this.attributes.showTitle;if(Re){var Ke=this.title.node().getAvailableSpace(),gt=Ke.x,tn=Ke.y;this.itemsGroup.node().style.transform="translate(".concat(gt,", ").concat(tn,")")}},Object.defineProperty(Qe.prototype,"availableSpace",{get:function(){var Re=this.attributes,Ke=Re.showTitle,gt=Re.width,tn=Re.height;return Ke?this.title.node().getAvailableSpace():new F.b(0,0,gt,tn)},enumerable:!1,configurable:!0}),Qe.prototype.getBBox=function(){var Re,Ke,gt=(Re=this.title)===null||Re===void 0?void 0:Re.node(),tn=(Ke=this.items)===null||Ke===void 0?void 0:Ke.node();return!gt||!tn?Oe.prototype.getBBox.call(this):we(gt,tn)},Qe.prototype.render=function(Re,Ke){var gt=this.attributes,tn=gt.width,yt=gt.height,Yt=gt.x,Rn=Yt===void 0?0:Yt,er=gt.y,Jn=er===void 0?0:er,kr=gt.classNamePrefix,fr=gt.render,wr=(0,E.Ys)(Ke),ei=Ke.className||"legend-category";kr?Ke.attr("className","".concat(ei," ").concat(kr,"legend")):Ke.className||Ke.attr("className","legend-category"),Ke.style.transform="translate(".concat(Rn,", ").concat(Jn,")"),fr?this.renderCustom(wr):(this.renderTitle(wr,tn,yt),this.renderItems(wr,this.availableSpace),this.adjustLayout())},Qe}(Z.w)},91498:function(Be,Me,b){"use strict";b.d(Me,{s:function(){return Sa}});var m=b(80813),Z=b(70208),V=b(97304),N=b(66623),E=b(99247),F=b(17911),C=b(88839),P=null,H=null;function D(oe){return oe instanceof Date?oe:new Date(oe)}function X(oe){for(var re=__read(oe,2),Y=re[0],J=re[1],fe=P.indexOf(Y),Te=P.indexOf(J),De="",Le=fe;Le<=Te;Le+=1)if(De+=H[Le],Le<Te){var Xe="-";Le===2?Xe=" ":Le>2&&(Xe=":"),De+=Xe}return De}function j(oe,re){var Y={YYYY:oe.getFullYear(),MM:oe.getMonth()+1,DD:oe.getDate(),HH:oe.getHours(),mm:oe.getMinutes(),ss:oe.getSeconds()},J=re;return Object.keys(Y).forEach(function(fe){var Te=Y[fe];J=J.replace(fe,fe==="YYYY"?"".concat(Te):"".concat(Te).padStart(2,"0"))}),J}function de(oe,re){return D(oe).getTime()-D(re).getTime()}function he(oe,re){var Y=__read([D(oe),D(re)],2),J=Y[0],fe=Y[1];return J.getFullYear()!==fe.getFullYear()?"year":J.getMonth()!==fe.getMonth()?"month":J.getDay()!==fe.getDay()?"day":J.getHours()!==fe.getHours()?"hour":J.getMinutes()!==fe.getMinutes()?"minute":"second"}function we(oe,re){var Y=new Date(oe),J={year:function(fe){fe.setMonth(0),fe.setHours(0,0,0,0)},month:function(fe){fe.setDate(1),fe.setHours(0,0,0,0)},day:function(fe){return fe.setHours(0,0,0,0)},hour:function(fe){return fe.setMinutes(0,0,0)},minute:function(fe){return fe.setSeconds(0,0)},second:function(fe){return fe.setMilliseconds(0)}};return J[re](Y),j(Y,X(["year",re]))}var ve=b(86314),Ee=b(67756);function $e(oe,re){if(oe.length<=re)return oe;for(var Y=Math.floor(oe.length/re),J=[],fe=0;fe<oe.length;fe+=Y)J.push(oe[fe]);return J}var Fe=b(38974),ct=b(23343),vt=b(58688),at={gridGroup:"grid-group",mainGroup:"main-group",lineGroup:"line-group",tickGroup:"tick-group",labelGroup:"label-group",titleGroup:"title-group",grid:"grid",line:"line",lineFirst:"line-first",lineSecond:"line-second",tick:"tick",tickItem:"tick-item",label:"label",labelItem:"label-item",title:"title"},kt={data:[],animate:{enter:!1,update:{duration:100,easing:"ease-in-out-sine",fill:"both"},exit:{duration:100,fill:"both"}},showArrow:!0,showGrid:!0,showLabel:!0,showLine:!0,showTick:!0,showTitle:!0,showTrunc:!1,dataThreshold:100,lineLineWidth:1,lineStroke:"black",crossPadding:10,titleFill:"black",titleFontSize:12,titlePosition:"lb",titleSpacing:0,titleTextAlign:"center",titleTextBaseline:"middle",lineArrow:function(){return new N.y$({style:{d:[["M",10,10],["L",-10,0],["L",10,-10],["L",0,0],["L",10,10],["Z"]],fill:"black",transformOrigin:"center"}})},labelAlign:"parallel",labelDirection:"positive",labelFontSize:12,labelSpacing:0,gridConnect:"line",gridControlAngles:[],gridDirection:"positive",gridLength:0,gridType:"segment",lineArrowOffset:15,lineArrowSize:10,tickDirection:"positive",tickLength:5,tickLineWidth:1,tickStroke:"black",labelOverlap:[]},It=(0,ct.Z)({},kt,{style:{type:"arc"}}),Bn=(0,ct.Z)({},kt,{style:{}}),Lt=(0,vt.A)({mainGroup:at.mainGroup,gridGroup:at.gridGroup,grid:at.grid,lineGroup:at.lineGroup,line:at.line,tickGroup:at.tickGroup,tick:at.tick,tickItem:at.tickItem,labelGroup:at.labelGroup,label:at.label,labelItem:at.labelItem,titleGroup:at.titleGroup,title:at.title,lineFirst:at.lineFirst,lineSecond:at.lineSecond},"axis"),Wn=b(71018);function Xn(oe,re){return[oe[0]*re,oe[1]*re]}function In(oe,re){return[oe[0]+re[0],oe[1]+re[1]]}function zn(oe,re){return[oe[0]-re[0],oe[1]-re[1]]}function dr(oe,re){return[Math.min(oe[0],re[0]),Math.min(oe[1],re[1])]}function vn(oe,re){return[Math.max(oe[0],re[0]),Math.max(oe[1],re[1])]}function _r(oe,re){return Math.sqrt(Math.pow(oe[0]-re[0],2)+Math.pow(oe[1]-re[1],2))}function Ge(oe){if(oe[0]===0&&oe[1]===0)return[0,0];var re=Math.sqrt(Math.pow(oe[0],2)+Math.pow(oe[1],2));return[oe[0]/re,oe[1]/re]}function Tt(oe,re,Y){var J=__read(oe,2),fe=J[0],Te=J[1],De=__read(re,2),Le=De[0],Xe=De[1],mt=fe-Le,Kt=Te-Xe,nn=Math.sin(Y),gn=Math.cos(Y);return[mt*gn-Kt*nn+Le,mt*nn+Kt*gn+Xe]}function On(oe,re){return re?[oe[1],-oe[0]]:[-oe[1],oe[0]]}function Vr(oe){return oe*Math.PI/180}function en(oe){return Number((oe*180/Math.PI).toPrecision(5))}var ln=b(38242);function Cn(oe,re){return oe.style.opacity||(oe.style.opacity=1),(0,ve.eR)(oe,{opacity:0},re)}var Mt=["$el","cx","cy","d","dx","dy","fill","fillOpacity","filter","fontFamily","fontSize","fontStyle","fontVariant","fontWeight","height","img","increasedLineWidthForHitTesting","innerHTML","isBillboard","billboardRotation","isSizeAttenuation","isClosed","isOverflowing","leading","letterSpacing","lineDash","lineHeight","lineWidth","markerEnd","markerEndOffset","markerMid","markerStart","markerStartOffset","maxLines","metrics","miterLimit","offsetX","offsetY","opacity","path","points","r","radius","rx","ry","shadowColor","src","stroke","strokeOpacity","text","textAlign","textBaseline","textDecorationColor","textDecorationLine","textDecorationStyle","textOverflow","textPath","textPathSide","textPathStartOffset","transform","transformOrigin","visibility","width","wordWrap","wordWrapWidth","x","x1","x2","y","y1","y2","z1","z2","zIndex"];function Et(oe){return Mt.includes(oe)}function pe(oe){var re={};for(var Y in oe)Et(Y)&&(re[Y]=oe[Y]);return re}var Ae=(0,vt.A)({lineGroup:"line-group",line:"line",regionGroup:"region-group",region:"region"},"grid");function Pe(oe){return oe.reduce(function(re,Y,J){return re.push((0,m.ev)([J===0?"M":"L"],(0,m.CR)(Y),!1)),re},[])}function Ut(oe,re,Y){var J=re.connect,fe=J===void 0?"line":J,Te=re.center;if(fe==="line")return Pe(oe);if(!Te)return[];var De=_r(oe[0],Te),Le=Y?0:1;return oe.reduce(function(Xe,mt,Kt){return Kt===0?Xe.push((0,m.ev)(["M"],(0,m.CR)(mt),!1)):Xe.push((0,m.ev)(["A",De,De,0,0,Le],(0,m.CR)(mt),!1)),Xe},[])}function jt(oe,re,Y){return re.type==="surround"?Ut(oe,re,Y):Pe(oe)}function ft(oe,re,Y){var J=Y.type,fe=Y.connect,Te=Y.center,De=Y.closed,Le=De?[["Z"]]:[],Xe=(0,m.CR)([jt(oe,Y),jt(re.slice().reverse(),Y,!0)],2),mt=Xe[0],Kt=Xe[1],nn=(0,m.CR)([oe[0],re.slice(-1)[0]],2),gn=nn[0],Nn=nn[1],$n=function(jr,ui){return[mt,jr,Kt,ui,Le].flat()};if(fe==="line"||J==="surround")return $n([(0,m.ev)(["L"],(0,m.CR)(Nn),!1)],[(0,m.ev)(["L"],(0,m.CR)(gn),!1)]);if(!Te)throw new Error("Arc grid need to specified center");var Er=(0,m.CR)([_r(Nn,Te),_r(gn,Te)],2),mr=Er[0],ti=Er[1];return $n([(0,m.ev)(["A",mr,mr,0,0,1],(0,m.CR)(Nn),!1),(0,m.ev)(["L"],(0,m.CR)(Nn),!1)],[(0,m.ev)(["A",ti,ti,0,0,0],(0,m.CR)(gn),!1),(0,m.ev)(["L"],(0,m.CR)(gn),!1)])}function on(oe,re,Y,J){var fe=Y.animate,Te=Y.isBillboard,De=re.map(function(Le,Xe){return{id:Le.id||"grid-line-".concat(Xe),d:jt(Le.points,Y)}});return oe.selectAll(Ae.line.class).data(De,function(Le){return Le.id}).join(function(Le){return Le.append("path").each(function(Xe,mt){var Kt=(0,ln.S)(pe((0,m.pi)({d:Xe.d},J)),[Xe,mt,De]);this.attr((0,m.pi)({class:Ae.line.name,stroke:"#D9D9D9",lineWidth:1,lineDash:[4,4],isBillboard:Te},Kt))})},function(Le){return Le.transition(function(Xe,mt){var Kt=(0,ln.S)(pe((0,m.pi)({d:Xe.d},J)),[Xe,mt,De]);return(0,ve.eR)(this,Kt,fe.update)})},function(Le){return Le.transition(function(){var Xe=this,mt=Cn(this,fe.exit);return(0,ve.Yq)(mt,function(){return Xe.remove()}),mt})}).transitions()}function hn(oe,re,Y){var J=Y.animate,fe=Y.connect,Te=Y.areaFill;if(re.length<2||!Te||!fe)return[];for(var De=Array.isArray(Te)?Te:[Te,"transparent"],Le=function($n){return De[$n%De.length]},Xe=[],mt=0;mt<re.length-1;mt++){var Kt=(0,m.CR)([re[mt].points,re[mt+1].points],2),nn=Kt[0],gn=Kt[1],Nn=ft(nn,gn,Y);Xe.push({d:Nn,fill:Le(mt)})}return oe.selectAll(Ae.region.class).data(Xe,function($n,Er){return Er}).join(function($n){return $n.append("path").each(function(Er,mr){var ti=(0,ln.S)(Er,[Er,mr,Xe]);this.attr(ti)}).attr("className",Ae.region.name)},function($n){return $n.transition(function(Er,mr){var ti=(0,ln.S)(Er,[Er,mr,Xe]);return(0,ve.eR)(this,ti,J.update)})},function($n){return $n.transition(function(){var Er=this,mr=Cn(this,J.exit);return(0,ve.Yq)(mr,function(){return Er.remove()}),mr})}).transitions()}function lt(oe){var re=oe.data,Y=re===void 0?[]:re,J=oe.closed;return J?Y.map(function(fe){var Te=fe.points,De=(0,m.CR)(Te,1),Le=De[0];return(0,m.pi)((0,m.pi)({},fe),{points:(0,m.ev)((0,m.ev)([],(0,m.CR)(Te),!1),[Le],!1)})}):Y}var Ct=function(oe){(0,m.ZT)(re,oe);function re(){return oe!==null&&oe.apply(this,arguments)||this}return re.prototype.render=function(Y,J){var fe=Y.type,Te=Y.center,De=Y.areaFill,Le=Y.closed,Xe=(0,m._T)(Y,["type","center","areaFill","closed"]),mt=lt(Y),Kt=(0,Fe.Ys)(J).maybeAppendByClassName(Ae.lineGroup,"g"),nn=(0,Fe.Ys)(J).maybeAppendByClassName(Ae.regionGroup,"g"),gn=on(Kt,mt,Y,Xe),Nn=hn(nn,mt,Y);return(0,m.ev)((0,m.ev)([],(0,m.CR)(gn),!1),(0,m.CR)(Nn),!1)},re}(V.w),sn=b(5759),W=function(oe,re){return function(Y){return oe*(1-Y)+re*Y}};function Se(oe,re){var Y=re?re.length:0,J=oe?Math.min(Y,oe.length):0;return function(fe){var Te=new Array(J),De=new Array(Y),Le=0;for(Le=0;Le<J;++Le)Te[Le]=zt(oe[Le],re[Le]);for(;Le<Y;++Le)De[Le]=re[Le];for(Le=0;Le<J;++Le)De[Le]=Te[Le](fe);return De}}function Ht(oe,re){oe===void 0&&(oe={}),re===void 0&&(re={});var Y={},J={};return Object.entries(re).forEach(function(fe){var Te=(0,m.CR)(fe,2),De=Te[0],Le=Te[1];De in oe?Y[De]=zt(oe[De],Le):J[De]=Le}),function(fe){return Object.entries(Y).forEach(function(Te){var De=(0,m.CR)(Te,2),Le=De[0],Xe=De[1];return J[Le]=Xe(fe)}),J}}function zt(oe,re){return typeof oe=="number"&&typeof re=="number"?W(oe,re):Array.isArray(oe)&&Array.isArray(re)?Se(oe,re):typeof oe=="object"&&typeof re=="object"?Ht(oe,re):function(Y){return oe}}function Fn(oe,re,Y,J){if(!J)return oe.attr("__keyframe_data__",Y),null;var fe=J.duration,Te=fe===void 0?0:fe,De=zt(re,Y),Le=Math.ceil(+Te/16),Xe=new Array(Le).fill(0).map(function(mt,Kt,nn){return{__keyframe_data__:De(Kt/(nn.length-1))}});return oe.animate(Xe,(0,m.pi)({fill:"both"},J))}var Tn=b(88170),lr=b(99769);function je(oe,re){var Y={},J=Array.isArray(re)?re:[re];for(var fe in oe)J.includes(fe)||(Y[fe]=oe[fe]);return Y}function be(oe,re){return Object.fromEntries(Object.entries(oe).map(function(Y){var J=(0,m.CR)(Y,2),fe=J[0],Te=J[1];return[fe,(0,ln.S)(Te,re)]}))}function it(oe){if(oe.type==="linear"){var re=oe.startPos,Y=oe.endPos;return __spreadArray(__spreadArray([],__read(re),!1),__read(Y),!1)}var J=oe.startAngle,fe=oe.endAngle,Te=oe.center,De=oe.radius;return __spreadArray(__spreadArray([J,fe],__read(Te),!1),[De],!1)}function wt(oe,re){return re&&(0,Wn.Z)(re)?oe.filter(re):oe}function ot(oe,re){var Y=re.startAngle,J=re.endAngle;return(J-Y)*oe+Y}function ut(oe,re){if(re.type==="linear"){var Y=(0,m.CR)(re.startPos,2),J=Y[0],fe=Y[1],Te=(0,m.CR)(re.endPos,2),De=Te[0],Le=Te[1],Xe=(0,m.CR)([De-J,Le-fe],2),mt=Xe[0],Kt=Xe[1];return Ge([mt,Kt])}var nn=Vr(ot(oe,re));return[-Math.sin(nn),Math.cos(nn)]}function _t(oe,re,Y){var J=ut(oe,Y);return On(J,re!=="positive")}function $t(oe,re){return _t(oe,re.labelDirection,re)}function Vt(oe,re,Y){return Y?"".concat(oe," ").concat(Y,"axis-").concat(re):oe}function Qt(oe,re,Y){var J=oe.classNamePrefix,fe=J===void 0?"":J;return Vt(re.name,Y,fe)}function cn(oe,re,Y,J){return J&&oe.attr("className",Vt(re.name,Y,J)),oe}function Yn(oe,re){var Y=(0,m.CR)(re.startPos,2),J=Y[0],fe=Y[1],Te=(0,m.CR)(re.endPos,2),De=Te[0],Le=Te[1],Xe=(0,m.CR)([De-J,Le-fe],2),mt=Xe[0],Kt=Xe[1];return[J+mt*oe,fe+Kt*oe]}function qn(oe,re){var Y=re.radius,J=(0,m.CR)(re.center,2),fe=J[0],Te=J[1],De=Vr(ot(oe,re));return[fe+Y*Math.cos(De),Te+Y*Math.sin(De)]}function Sr(oe,re){return re.type==="linear"?Yn(oe,re):qn(oe,re)}function Jr(oe){return ut(0,oe)[1]===0}function vr(oe){return ut(0,oe)[0]===0}function Ki(oe,re){return re-oe===360}function Mi(oe,re,Y,J,fe){var Te=re-oe,De=(0,m.CR)([fe,fe],2),Le=De[0],Xe=De[1],mt=(0,m.CR)([Vr(oe),Vr(re)],2),Kt=mt[0],nn=mt[1],gn=function(Ka){return[Y+fe*Math.cos(Ka),J+fe*Math.sin(Ka)]},Nn=(0,m.CR)(gn(Kt),2),$n=Nn[0],Er=Nn[1],mr=(0,m.CR)(gn(nn),2),ti=mr[0],jr=mr[1];if(Ki(oe,re)){var ui=(nn+Kt)/2,gi=(0,m.CR)(gn(ui),2),oi=gi[0],ts=gi[1];return[["M",$n,Er],["A",Le,Xe,0,1,0,oi,ts],["A",Le,Xe,0,1,0,ti,jr]]}var fs=Te>180?1:0,Ds=oe>re?0:1,Ba=!1;return Ba?"M".concat(Y,",").concat(J,",L").concat($n,",").concat(Er,",A").concat(Le,",").concat(Xe,",0,").concat(fs,",").concat(Ds,",").concat(ti,",").concat(jr,",L").concat(Y,",").concat(J):"M".concat($n,",").concat(Er,",A").concat(Le,",").concat(Xe,",0,").concat(fs,",").concat(Ds,",").concat(ti,",").concat(jr)}function yi(oe){var re=oe.attributes,Y=re.startAngle,J=re.endAngle,fe=re.center,Te=re.radius;return(0,m.ev)((0,m.ev)([Y,J],(0,m.CR)(fe),!1),[Te],!1)}function qr(oe,re,Y,J){var fe=re.startAngle,Te=re.endAngle,De=re.center,Le=re.radius,Xe=re.classNamePrefix;return oe.selectAll(Lt.line.class).data([{d:Mi.apply(void 0,(0,m.ev)((0,m.ev)([fe,Te],(0,m.CR)(De),!1),[Le],!1))}],function(mt,Kt){return Kt}).join(function(mt){var Kt=mt.append("path").attr("className",Lt.line.name).styles(re).styles({d:function(nn){return nn.d}});return cn(Kt,Lt.line,at.line,Xe),Kt},function(mt){return mt.transition(function(){var Kt=this,nn=Fn(this,yi(this),(0,m.ev)((0,m.ev)([fe,Te],(0,m.CR)(De),!1),[Le],!1),J.update);if(nn){var gn=function(){var Nn=(0,sn.Z)(Kt.attributes,"__keyframe_data__");Kt.style.d=Mi.apply(void 0,(0,m.ev)([],(0,m.CR)(Nn),!1))};nn.onframe=gn,nn.onfinish=gn}return nn}).styles(re)},function(mt){return mt.remove()}).styles(Y).transitions()}function es(oe,re){var Y=re.truncRange,J=re.truncShape,fe=re.lineExtension}function Ci(oe,re,Y){Y===void 0&&(Y=[0,0]);var J=(0,m.CR)([oe,re,Y],3),fe=(0,m.CR)(J[0],2),Te=fe[0],De=fe[1],Le=(0,m.CR)(J[1],2),Xe=Le[0],mt=Le[1],Kt=(0,m.CR)(J[2],2),nn=Kt[0],gn=Kt[1],Nn=(0,m.CR)([Xe-Te,mt-De],2),$n=Nn[0],Er=Nn[1],mr=Math.sqrt(Math.pow($n,2)+Math.pow(Er,2)),ti=(0,m.CR)([-nn/mr,gn/mr],2),jr=ti[0],ui=ti[1];return[jr*$n,jr*Er,ui*$n,ui*Er]}function En(oe){var re=(0,m.CR)(oe,2),Y=(0,m.CR)(re[0],2),J=Y[0],fe=Y[1],Te=(0,m.CR)(re[1],2),De=Te[0],Le=Te[1];return{x1:J,y1:fe,x2:De,y2:Le}}function rn(oe,re,Y,J){var fe=re.showTrunc,Te=re.startPos,De=re.endPos,Le=re.truncRange,Xe=re.lineExtension,mt=re.classNamePrefix,Kt=(0,m.CR)([Te,De],2),nn=(0,m.CR)(Kt[0],2),gn=nn[0],Nn=nn[1],$n=(0,m.CR)(Kt[1],2),Er=$n[0],mr=$n[1],ti=(0,m.CR)(Xe?Ci(Te,De,Xe):new Array(4).fill(0),4),jr=ti[0],ui=ti[1],gi=ti[2],oi=ti[3],ts=function(Ya){return oe.selectAll(Lt.line.class).data(Ya,function(pa,al){return al}).join(function(pa){var al=pa.append("line").styles(Y).transition(function(qa){return(0,ve.eR)(this,En(qa.line),!1)});return al.attr("className",function(qa){if(!mt)return"".concat(Lt.line.name," ").concat(qa.className);var Ua=Vt(Lt.line.name,at.line,mt);if(qa.className===Lt.lineFirst.name){var dl=Vt(Lt.lineFirst.name,at.lineFirst,mt);return"".concat(Ua," ").concat(dl)}if(qa.className===Lt.lineSecond.name){var dl=Vt(Lt.lineSecond.name,at.lineSecond,mt);return"".concat(Ua," ").concat(dl)}return Ua}),al},function(pa){return pa.styles(Y).transition(function(al){var qa=al.line;return(0,ve.eR)(this,En(qa),J.update)})},function(pa){return pa.remove()}).transitions()};if(!fe||!Le)return ts([{line:[[gn+jr,Nn+ui],[Er+gi,mr+oi]],className:Lt.line.name}]);var fs=(0,m.CR)(Le,2),Ds=fs[0],Ba=fs[1],Ka=Er-gn,xo=mr-Nn,aa=(0,m.CR)([gn+Ka*Ds,Nn+xo*Ds],2),di=aa[0],Ma=aa[1],Rs=(0,m.CR)([gn+Ka*Ba,Nn+xo*Ba],2),lo=Rs[0],Jo=Rs[1],zs=ts([{line:[[gn+jr,Nn+ui],[di,Ma]],className:Lt.lineFirst.name},{line:[[lo,Jo],[Er+gi,mr+oi]],className:Lt.lineSecond.name}]);return es(oe,re),zs}function Xt(oe,re,Y,J){var fe=Y.showArrow,Te=Y.showTrunc,De=Y.lineArrow,Le=Y.lineArrowOffset,Xe=Y.lineArrowSize,mt;if(re==="arc"?mt=oe.select(Lt.line.class):Te?mt=oe.select(Lt.lineSecond.class):mt=oe.select(Lt.line.class),!fe||!De||Y.type==="arc"&&Ki(Y.startAngle,Y.endAngle)){var Kt=mt.node();Kt&&(Kt.style.markerEnd=void 0);return}var nn=(0,Tn.S)(De);nn.attr(J),(0,lr.b)(nn,Xe,!0),mt.style("markerEnd",nn).style("markerEndOffset",-Le)}function st(oe,re,Y){var J=re.type,fe,Te=(0,C.zs)(re,"line");return J==="linear"?fe=rn(oe,re,je(Te,"arrow"),Y):fe=qr(oe,re,je(Te,"arrow"),Y),Xt(oe,J,re,Te),fe}function dt(oe,re){return _t(oe,re.gridDirection,re)}function Wt(oe){var re=oe.type,Y=oe.gridCenter;return re==="linear"?Y:Y||oe.center}function bn(oe,re){var Y=re.gridLength;return oe.map(function(J,fe){var Te=J.value,De=(0,m.CR)(Sr(Te,re),2),Le=De[0],Xe=De[1],mt=(0,m.CR)(Xn(dt(Te,re),Y),2),Kt=mt[0],nn=mt[1];return{id:fe,points:[[Le,Xe],[Le+Kt,Xe+nn]]}})}function Jt(oe,re){var Y=re.gridControlAngles,J=Wt(re);if(!J)throw new Error("grid center is not provide");if(oe.length<2)throw new Error("Invalid grid data");if(!Y||Y.length===0)throw new Error("Invalid gridControlAngles");var fe=(0,m.CR)(J,2),Te=fe[0],De=fe[1];return oe.map(function(Le,Xe){var mt=Le.value,Kt=(0,m.CR)(Sr(mt,re),2),nn=Kt[0],gn=Kt[1],Nn=(0,m.CR)([nn-Te,gn-De],2),$n=Nn[0],Er=Nn[1],mr=[];return Y.forEach(function(ti){var jr=Vr(ti),ui=(0,m.CR)([Math.cos(jr),Math.sin(jr)],2),gi=ui[0],oi=ui[1],ts=$n*gi-Er*oi+Te,fs=$n*oi+Er*gi+De;mr.push([ts,fs])}),{points:mr,id:Xe}})}function ar(oe,re,Y,J){var fe=Y.classNamePrefix,Te=(0,C.zs)(Y,"grid"),De=Te.type,Le=Te.areaFill,Xe=Wt(Y),mt=wt(re,Y.gridFilter),Kt=De==="segment"?bn(mt,Y):Jt(mt,Y),nn=(0,m.pi)((0,m.pi)({},Te),{center:Xe,areaFill:(0,Wn.Z)(Le)?mt.map(function(gn,Nn){return(0,ln.S)(Le,[gn,Nn,mt])}):Le,animate:J,data:Kt});return oe.selectAll(Lt.grid.class).data([1]).join(function(gn){var Nn=gn.append(function(){return new Ct({style:nn})}).attr("className",Lt.grid.name);return cn(Nn,Lt.grid,at.grid,fe),Nn},function(gn){return gn.transition(function(){return this.update(nn)})},function(gn){return gn.remove()}).transitions()}function rr(oe,re,Y,J,fe){return J===void 0&&(J=!0),fe===void 0&&(fe=!1),J&&oe===re||fe&&oe===Y?!0:oe>re&&oe<Y}var Kr=function(oe){var re=new DOMParser,Y=re.parseFromString(oe,"text/html"),J=Y.body.firstElementChild;if(console.log(J==null?void 0:J.getClientRects(),11),!J)return 0;var fe=J.getAttribute("style")||"",Te=Object.fromEntries(fe.split(";").map(function(mr){return mr.trim()}).filter(function(mr){return mr.includes(":")}).map(function(mr){var ti=(0,m.CR)(mr.split(":").map(function(gi){return gi.trim()}),2),jr=ti[0],ui=ti[1];return[jr.toLowerCase(),ui]})),De=function(mr){if(!mr)return 0;var ti=mr.match(/([\d.]+)px/);return ti?parseFloat(ti[1]):0};if(Te.height)return De(Te.height);var Le=De(Te["font-size"])||16,Xe=Te["line-height"],mt;!Xe||Xe==="normal"?mt=1.2*Le:Xe.endsWith("px")?mt=De(Xe):/^[\d.]+$/.test(Xe)?mt=parseFloat(Xe)*Le:mt=Le;var Kt=De(Te["padding-top"]),nn=De(Te["padding-bottom"]);if(Te.padding){var gn=Te.padding.split(/\s+/).map(De);gn.length===1||gn.length===2?(Kt=gn[0],nn=gn[0]):(gn.length===3||gn.length===4)&&(Kt=gn[0],nn=gn[2])}var Nn=De(Te["border-top-width"]),$n=De(Te["border-bottom-width"]);if(Te.border){var Er=Te.border.match(/([\d.]+)px/);Er&&(Nn=parseFloat(Er[1]),$n=parseFloat(Er[1]))}if(Te["border-width"]){var gn=Te["border-width"].split(/\s+/).map(De);gn.length===1||gn.length===2?(Nn=gn[0],$n=gn[0]):(gn.length===3||gn.length===4)&&(Nn=gn[0],$n=gn[2])}return mt+Kt+nn+Nn+$n},si=b(69014),Ie=b(53160),L=b(58533);function Q(oe,re,Y,J){Y===void 0&&(Y=2),J===void 0&&(J="top"),(0,L.Rm)(oe,{wordWrap:!0,wordWrapWidth:re,maxLines:Y,textBaseline:J})}function w(oe,re,Y){var J=oe.getBBox(),fe=J.width,Te=J.height,De=(0,m.CR)([re,Y].map(function(mt,Kt){var nn;return mt.includes("%")?parseFloat(((nn=mt.match(/[+-]?([0-9]*[.])?[0-9]+/))===null||nn===void 0?void 0:nn[0])||"0")/100*(Kt===0?fe:Te):mt}),2),Le=De[0],Xe=De[1];return[Le,Xe]}function z(oe,re){if(re)try{var Y=/translate\(([+-]*[\d]+[%]*),[ ]*([+-]*[\d]+[%]*)\)/g,J=re.replace(Y,function(fe,Te,De){return"translate(".concat(w(oe,Te,De),")")});oe.attr("transform",J)}catch(fe){}}var ie=b(16915),ze=b(76075),Je=b(98294),At=function(){function oe(re,Y,J,fe){this.set(re,Y,J,fe)}return Object.defineProperty(oe.prototype,"left",{get:function(){return this.x1},enumerable:!1,configurable:!0}),Object.defineProperty(oe.prototype,"top",{get:function(){return this.y1},enumerable:!1,configurable:!0}),Object.defineProperty(oe.prototype,"right",{get:function(){return this.x2},enumerable:!1,configurable:!0}),Object.defineProperty(oe.prototype,"bottom",{get:function(){return this.y2},enumerable:!1,configurable:!0}),Object.defineProperty(oe.prototype,"width",{get:function(){return this.defined("x2")&&this.defined("x1")?this.x2-this.x1:void 0},enumerable:!1,configurable:!0}),Object.defineProperty(oe.prototype,"height",{get:function(){return this.defined("y2")&&this.defined("y1")?this.y2-this.y1:void 0},enumerable:!1,configurable:!0}),oe.prototype.rotatedPoints=function(re,Y,J){var fe=this,Te=fe.x1,De=fe.y1,Le=fe.x2,Xe=fe.y2,mt=Math.cos(re),Kt=Math.sin(re),nn=Y-Y*mt+J*Kt,gn=J-Y*Kt-J*mt,Nn=[[mt*Te-Kt*Xe+nn,Kt*Te+mt*Xe+gn],[mt*Le-Kt*Xe+nn,Kt*Le+mt*Xe+gn],[mt*Te-Kt*De+nn,Kt*Te+mt*De+gn],[mt*Le-Kt*De+nn,Kt*Le+mt*De+gn]];return Nn},oe.prototype.set=function(re,Y,J,fe){return J<re?(this.x2=re,this.x1=J):(this.x1=re,this.x2=J),fe<Y?(this.y2=Y,this.y1=fe):(this.y1=Y,this.y2=fe),this},oe.prototype.defined=function(re){return this[re]!==Number.MAX_VALUE&&this[re]!==-Number.MAX_VALUE},oe}();function xt(oe,re){var Y=oe.getEulerAngles()||0;oe.setEulerAngles(0);var J=oe.getBounds(),fe=(0,m.CR)(J.min,2),Te=fe[0],De=fe[1],Le=(0,m.CR)(J.max,2),Xe=Le[0],mt=Le[1],Kt=oe.getBBox(),nn=Kt.width,gn=Kt.height,Nn=gn,$n=0,Er=0,mr=Te,ti=De,jr=(0,L.U4)(oe);if(jr){Nn-=1.5;var ui=jr.style.textAlign,gi=jr.style.textBaseline;ui==="center"?mr=(Te+Xe)/2:(ui==="right"||ui==="end")&&(mr=Xe),gi==="middle"?ti=(De+mt)/2:gi==="bottom"&&(ti=mt)}var oi=(0,m.CR)((0,Je.j)(re),4),ts=oi[0],fs=ts===void 0?0:ts,Ds=oi[1],Ba=Ds===void 0?0:Ds,Ka=oi[2],xo=Ka===void 0?fs:Ka,aa=oi[3],di=aa===void 0?Ba:aa,Ma=new At(($n+=Te)-di,(Er+=De)-fs,$n+nn+Ba,Er+Nn+xo);return oe.setEulerAngles(Y),Ma.rotatedPoints(Vr(Y),mr,ti)}function Sn(oe,re){return re[0]<=Math.max(oe[0][0],oe[1][0])&&re[0]<=Math.min(oe[0][0],oe[1][0])&&re[1]<=Math.max(oe[0][1],oe[1][1])&&re[1]<=Math.min(oe[0][1],oe[1][1])}function Oe(oe,re,Y){var J=(re[1]-oe[1])*(Y[0]-re[0])-(re[0]-oe[0])*(Y[1]-re[1]);return J===0?0:J<0?2:1}function Qe(oe,re){var Y=Oe(oe[0],oe[1],re[0]),J=Oe(oe[0],oe[1],re[1]),fe=Oe(re[0],re[1],oe[0]),Te=Oe(re[0],re[1],oe[1]);return!!(Y!==J&&fe!==Te||Y===0&&Sn(oe,re[0])||J===0&&Sn(oe,re[1])||fe===0&&Sn(re,oe[0])||Te===0&&Sn(re,oe[1]))}function Re(oe,re){var Y=oe.length;if(Y<3)return!1;var J=[re,[9999,re[1]]],fe=0,Te=0;do{var De=[oe[Te],oe[(Te+1)%Y]];if(Qe(De,J)){if(Oe(De[0],re,De[1])===0)return Sn(De,re);fe++}Te=(Te+1)%Y}while(Te!==0);return!!(fe&1)}function Ke(oe,re){return re.every(function(Y){return Re(oe,Y)})}function gt(oe,re,Y){var J=oe.x1,fe=oe.x2,Te=oe.y1,De=oe.y2,Le=[[J,Te],[fe,Te],[fe,De],[J,De]],Xe=xt(re,Y);return Ke(Le,Xe)}function tn(oe,re){var Y=(0,m.CR)(oe,4),J=Y[0],fe=Y[1],Te=Y[2],De=Y[3],Le=(0,m.CR)(re,4),Xe=Le[0],mt=Le[1],Kt=Le[2],nn=Le[3],gn=Te-J,Nn=De-fe,$n=Kt-Xe,Er=nn-mt,mr=gn*Er-$n*Nn;if(mr===0)return!1;var ti=mr>0,jr=J-Xe,ui=fe-mt,gi=gn*ui-Nn*jr;if(gi<0===ti)return!1;var oi=$n*ui-Er*jr;return!(oi<0===ti||gi>mr===ti||oi>mr===ti)}function yt(oe,re){var Y=[[oe[0],oe[1],oe[2],oe[3]],[oe[2],oe[3],oe[4],oe[5]],[oe[4],oe[5],oe[6],oe[7]],[oe[6],oe[7],oe[0],oe[1]]];return Y.some(function(J){return tn(re,J)})}var Yt={lineToLine:tn,intersectBoxLine:yt,getBounds:xt};function Rn(oe,re,Y){var J,fe,Te=xt(oe,Y).flat(1),De=xt(re,Y).flat(1),Le=[[Te[0],Te[1],Te[2],Te[3]],[Te[0],Te[1],Te[4],Te[5]],[Te[4],Te[5],Te[6],Te[7]],[Te[2],Te[3],Te[6],Te[7]]];try{for(var Xe=(0,m.XA)(Le),mt=Xe.next();!mt.done;mt=Xe.next()){var Kt=mt.value;if(yt(De,Kt))return!0}}catch(nn){J={error:nn}}finally{try{mt&&!mt.done&&(fe=Xe.return)&&fe.call(Xe)}finally{if(J)throw J.error}}return!1}function er(oe,re){var Y=oe.type,J=oe.labelDirection,fe=oe.crossSize;if(!fe)return!1;if(Y==="arc"){var Te=oe.center,De=oe.radius,Le=(0,m.CR)(Te,2),Xe=Le[0],mt=Le[1],Kt=J==="negative"?0:fe,nn=-De-Kt,gn=De+Kt,Nn=(0,m.CR)((0,Je.j)(re),4),$n=Nn[0],Er=Nn[1],mr=Nn[2],ti=Nn[3];return new At(Xe+nn-ti,mt+nn-$n,Xe+gn+Er,mt+gn+mr)}var jr=(0,m.CR)(oe.startPos,2),ui=jr[0],gi=jr[1],oi=(0,m.CR)(oe.endPos,2),ts=oi[0],fs=oi[1],Ds=(0,m.CR)(vr(oe)?[-re,0,re,0]:[0,re,0,-re],4),Ba=Ds[0],Ka=Ds[1],xo=Ds[2],aa=Ds[3],di=$t(0,oe),Ma=Xn(di,fe),Rs=new At(ui,gi,ts,fs);return Rs.x1+=aa,Rs.y1+=Ba,Rs.x2+=Ka+Ma[0],Rs.y2+=xo+Ma[1],Rs}function Jn(oe,re,Y){var J,fe,Te=re.crossPadding,De=new Set,Le=null,Xe=er(re,Te),mt=function($n){return Xe?gt(Xe,$n):!0},Kt=function($n,Er){return!$n||!$n.firstChild?!0:!Rn($n.firstChild,Er.firstChild,(0,Je.j)(Y))};try{for(var nn=(0,m.XA)(oe),gn=nn.next();!gn.done;gn=nn.next()){var Nn=gn.value;mt(Nn)?!Le||Kt(Le,Nn)?Le=Nn:(De.add(Le),De.add(Nn)):De.add(Nn)}}catch($n){J={error:$n}}finally{try{gn&&!gn.done&&(fe=nn.return)&&fe.call(nn)}finally{if(J)throw J.error}}return Array.from(De)}function kr(oe,re){return re===void 0&&(re={}),(0,ze.Z)(oe)?0:typeof oe=="number"?oe:Math.floor((0,L.Ux)(oe,re))}function fr(oe,re,Y,J){if(!(oe.length<=0)){var fe=re.suffix,Te=fe===void 0?"...":fe,De=re.minLength,Le=re.maxLength,Xe=Le===void 0?1/0:Le,mt=re.step,Kt=mt===void 0?" ":mt,nn=re.margin,gn=nn===void 0?[0,0,0,0]:nn,Nn=(0,L.qT)(J.getTextShape(oe[0])),$n=kr(Kt,Nn),Er=De?kr(De,Nn):$n,mr=kr(Xe,Nn);((0,ze.Z)(mr)||mr===1/0)&&(mr=Math.max.apply(null,oe.map(function(Ma){return Ma.getBBox().width})));for(var ti=oe.slice(),jr=(0,m.CR)(gn,4),ui=jr[0],gi=ui===void 0?0:ui,oi=jr[1],ts=oi===void 0?0:oi,fs=jr[2],Ds=fs===void 0?gi:fs,Ba=jr[3],Ka=Ba===void 0?ts:Ba,xo=function(Ma){if(ti.forEach(function(Rs){J.ellipsis(J.getTextShape(Rs),Ma,Te)}),ti=Jn(oe,Y,gn),ti.length<1)return{value:void 0}},aa=mr;aa>Er+$n;aa-=$n){var di=xo(aa);if(typeof di=="object")return di.value}}}var wr=function(oe){return oe!==void 0&&oe!=null&&!Number.isNaN(oe)},ei=b(2080),_n={parity:function(oe,re){var Y=re.seq,J=Y===void 0?2:Y;return oe.filter(function(fe,Te){return Te%J?((0,si.Cp)(fe),!1):!0})}},jn=function(oe){return oe.filter(wr)};function Hr(oe,re,Y,J){var fe=oe.length,Te=re.keepHeader,De=re.keepTail;if(!(fe<=1||fe===2&&Te&&De)){var Le=_n.parity,Xe=function(ui){return ui.forEach(J.show),ui},mt=2,Kt=oe.slice(),nn=oe.slice(),gn=Math.min.apply(Math,(0,m.ev)([1],(0,m.CR)(oe.map(function(ui){return ui.getBBox().width})),!1));if(Y.type==="linear"&&(Jr(Y)||vr(Y))){var Nn=(0,ei._v)(oe[0]).left,$n=(0,ei._v)(oe[fe-1]).right,Er=Math.abs($n-Nn)||1;mt=Math.max(Math.floor(fe*gn/Er),mt)}var mr,ti;for(Te&&(mr=Kt.splice(0,1)[0]),De&&(ti=Kt.splice(-1,1)[0],Kt.reverse()),Xe(Kt);mt<oe.length&&Jn(jn(ti?(0,m.ev)((0,m.ev)([ti],(0,m.CR)(nn),!1),[mr],!1):(0,m.ev)([mr],(0,m.CR)(nn),!1)),Y,re==null?void 0:re.margin).length;){if(ti&&!mr&&mt%2===0){var jr=Kt.splice(0,1);jr.forEach(J.hide)}else if(ti&&mr){var jr=Kt.splice(0,1);jr.forEach(J.hide)}nn=Le(Xe(Kt),{seq:mt}),mt++}}}function Pr(oe,re,Y,J){var fe,Te,De=re.optionalAngles,Le=De===void 0?[0,45,90]:De,Xe=re.margin,mt=re.recoverWhenFailed,Kt=mt===void 0?!0:mt,nn=oe.map(function(ti){return ti.getLocalEulerAngles()}),gn=function(){return Jn(oe,Y,Xe).length<1},Nn=function(ti){return oe.forEach(function(jr,ui){var gi=Array.isArray(ti)?ti[ui]:ti;J.rotate(jr,+gi)})};try{for(var $n=(0,m.XA)(Le),Er=$n.next();!Er.done;Er=$n.next()){var mr=Er.value;if(Nn(mr),gn())return}}catch(ti){fe={error:ti}}finally{try{Er&&!Er.done&&(Te=$n.return)&&Te.call($n)}finally{if(fe)throw fe.error}}Kt&&Nn(nn)}function $i(oe){var re=oe.type,Y=oe.labelDirection;return re==="linear"&&Jr(oe)?Y==="negative"?"bottom":"top":"middle"}function Zi(oe,re,Y,J,fe){var Te,De=re.maxLines,Le=De===void 0?3:De,Xe=re.recoverWhenFailed,mt=Xe===void 0?!0:Xe,Kt=re.margin,nn=Kt===void 0?[0,0,0,0]:Kt,gn=(0,ln.S)((Te=re.wordWrapWidth)!==null&&Te!==void 0?Te:50,[fe]),Nn=oe.map(function(ui){return ui.attr("maxLines")||1}),$n=Math.min.apply(Math,(0,m.ev)([],(0,m.CR)(Nn),!1)),Er=function(){return Jn(oe,Y,nn).length<1},mr=$i(Y),ti=function(ui){return oe.forEach(function(gi,oi){var ts=Array.isArray(ui)?ui[oi]:ui;J.wrap(gi,gn,ts,mr)})};if(!($n>Le)){if(Y.type==="linear"&&Jr(Y)){if(ti(Le),Er())return}else for(var jr=$n;jr<=Le;jr++)if(ti(jr),Er())return;mt&&ti(Nn)}}var Xi=new Map([["hide",Hr],["rotate",Pr],["ellipsis",fr],["wrap",Zi]]);function Ei(oe,re,Y){return re.labelOverlap.length<1?!1:Y==="hide"?!(0,ie.X)(oe[0]):Y==="rotate"?!oe.some(function(J){var fe;return!!(!((fe=J.attr("transform"))===null||fe===void 0)&&fe.includes("rotate"))}):Y==="ellipsis"||Y==="wrap"?oe.filter(function(J){return J.querySelector("text")}).length>=1:!0}function ms(oe,re,Y,J){var fe=re.labelOverlap,Te=fe===void 0?[]:fe;Te.length&&Te.forEach(function(De){var Le=De.type,Xe=Xi.get(Le);Ei(oe,re,Le)&&(Xe==null||Xe(oe,De,re,J,Y))})}function _i(){for(var oe=[],re=0;re<arguments.length;re++)oe[re]=arguments[re];var Y=function(J){return J==="positive"?-1:1};return oe.reduce(function(J,fe){return J*Y(fe)},1)}function Es(oe){for(var re=oe;re<0;)re+=360;return Math.round(re%360)}function ua(oe,re){var Y=(0,m.CR)(oe,2),J=Y[0],fe=Y[1],Te=(0,m.CR)(re,2),De=Te[0],Le=Te[1],Xe=(0,m.CR)([J*De+fe*Le,J*Le-fe*De],2),mt=Xe[0],Kt=Xe[1];return Math.atan2(Kt,mt)}function Hn(oe){var re=(oe+360)%180;return rr(re,-90,90)||(re+=180),re}function Pt(oe,re,Y){var J,fe=Y.labelAlign,Te=(J=re.style.transform)===null||J===void 0?void 0:J.includes("rotate");if(Te)return re.getLocalEulerAngles();var De=0,Le=$t(oe.value,Y),Xe=ut(oe.value,Y);return fe==="horizontal"?0:(fe==="perpendicular"?De=ua([1,0],Le):De=ua([Xe[0]<0?-1:1,0],Xe),Hn(en(De)))}function Gt(oe,re,Y){var J=Y.type,fe=Y.labelAlign,Te=$t(oe,Y),De=Es(re),Le=Es(en(ua([1,0],Te))),Xe="center",mt="middle";return J==="linear"?[90,270].includes(Le)&&De===0?(Xe="center",mt=Te[1]===1?"top":"bottom"):!(Le%180)&&[90,270].includes(De)?Xe="center":Le===0?(rr(De,0,90,!1,!0)||rr(De,0,90)||rr(De,270,360))&&(Xe="start"):Le===90?rr(De,0,90,!1,!0)?Xe="start":(rr(De,90,180)||rr(De,270,360))&&(Xe="end"):Le===270?rr(De,0,90,!1,!0)?Xe="end":(rr(De,90,180)||rr(De,270,360))&&(Xe="start"):Le===180&&(De===90?Xe="start":(rr(De,0,90)||rr(De,270,360))&&(Xe="end")):fe==="parallel"?rr(Le,0,180,!0)?mt="top":mt="bottom":fe==="horizontal"?rr(Le,90,270,!1)?Xe="end":(rr(Le,270,360,!1)||rr(Le,0,90))&&(Xe="start"):fe==="perpendicular"&&(rr(Le,90,270)?Xe="end":Xe="start"),{textAlign:Xe,textBaseline:mt}}function Bt(oe,re,Y){re.setLocalEulerAngles(oe);var J=re.__data__.value,fe=Gt(J,oe,Y),Te=re.querySelector(Lt.labelItem.class);Te&&$r(Te,fe)}function yn(oe,re,Y){var J=Y.showTick,fe=Y.tickLength,Te=Y.tickDirection,De=Y.labelDirection,Le=Y.labelSpacing,Xe=re.indexOf(oe),mt=(0,ln.S)(Le,[oe,Xe,re]),Kt=(0,m.CR)([$t(oe.value,Y),_i(De,Te)],2),nn=Kt[0],gn=Kt[1],Nn=gn===1?(0,ln.S)(J?fe:0,[oe,Xe,re]):0,$n=(0,m.CR)(In(Xn(nn,mt+Nn),Sr(oe.value,Y)),2),Er=$n[0],mr=$n[1];return{x:Er,y:mr}}function Ln(oe,re,Y,J){var fe=J.labelFormatter,Te=(0,Wn.Z)(fe)?function(){return(0,Tn.S)((0,ln.S)(fe,[oe,re,Y,$t(oe.value,J)]))}:function(){return(0,Tn.S)(oe.label||"")};return Te}function gr(oe,re,Y,J){var fe=J.labelRender,Te=((0,sn.Z)(J,"endPos.0",400)-(0,sn.Z)(J,"startPos.0",0))/Y.length,De=(0,Wn.Z)(fe)?(0,ln.S)(fe,[oe,re,Y,$t(oe.value,J)]):oe.label||"",Le=Kr(De)||30;return function(){return(0,Tn.$)(De,{width:Te,height:Le})}}var Rr={html:["fill"],text:[]};function $r(oe,re){["text","html"].includes(oe.nodeName)&&oe.attr(je(re,Rr[oe.nodeName]))}function Ii(oe,re){ms(this.node().childNodes,oe,re,{hide:si.Cp,show:si.$Z,rotate:function(Y,J){Bt(+J,Y,oe)},ellipsis:function(Y,J,fe){Y&&(0,Ie.O)(Y,J||1/0,fe)},wrap:function(Y,J,fe){Y&&Q(Y,J,fe)},getTextShape:function(Y){return Y.querySelector(Lt.labelItem.class)}})}function Di(oe,re,Y,J,fe){var Te=Y.indexOf(re),De=fe.labelRender,Le=fe.classNamePrefix,Xe=(0,Fe.Ys)(oe).append(De?gr(re,Te,Y,fe):Ln(re,Te,Y,fe)).attr("className",Lt.labelItem.name).node();cn((0,Fe.Ys)(Xe),Lt.labelItem,at.labelItem,Le);var mt=(0,m.CR)((0,C.Hm)(be(J,[re,Te,Y])),2),Kt=mt[0],nn=mt[1],gn=nn.transform,Nn=(0,m._T)(nn,["transform"]);z(Xe,gn);var $n=Pt(re,Xe,fe);if(Xe.getLocalEulerAngles()||Xe.setLocalEulerAngles($n),$r(Xe,(0,m.pi)((0,m.pi)({},Gt(re.value,$n,fe)),Kt)),Xe.nodeName==="html"){var Er=Xe.getBBox(),mr=Xe.style.x||0;Xe.attr("x",mr-Er.width/2)}return oe.attr(Nn),Xe}function ss(oe,re,Y,J,fe){var Te=Y.classNamePrefix,De=wt(re,Y.labelFilter),Le=(0,C.zs)(Y,"label"),Xe,mt=oe.selectAll(Lt.label.class).data(De,function(Kt,nn){return nn}).join(function(Kt){var nn=Kt.append("g").attr("className",Lt.label.name).transition(function(gn){Di(this,gn,re,Le,Y);var Nn=yn(gn,re,Y),$n=Nn.x,Er=Nn.y;return this.style.transform="translate(".concat($n,", ").concat(Er,")"),null});return cn(nn,Lt.label,at.label,Te),nn},function(Kt){return Kt.transition(function(nn){var gn=this.querySelector(Lt.labelItem.class),Nn=Di(this,nn,re,Le,Y),$n=(0,ve.tT)(gn,Nn,J.update),Er=yn(nn,re,Y),mr=Er.x,ti=Er.y,jr=(0,ve.eR)(this,{transform:"translate(".concat(mr,", ").concat(ti,")")},J.update);return(0,m.ev)((0,m.ev)([],(0,m.CR)($n),!1),[jr],!1)})},function(Kt){return Xe=Kt,Kt.transition(function(){var nn=this,gn=Cn(this.childNodes[0],J.exit);return(0,ve.Yq)(gn,function(){return(0,Fe.Ys)(nn).remove()}),gn}),Xe}).transitions();return(0,ve.V7)(mt,function(){Ii.call(oe,Y,fe)}),mt}function vs(oe,re){return _t(oe,re.tickDirection,re)}function Cs(oe,re){var Y=(0,m.CR)(oe,2),J=Y[0],fe=Y[1];return[[0,0],[J*re,fe*re]]}function Aa(oe,re,Y,J,fe){var Te=fe.tickLength,De=(0,m.CR)(Cs(J,(0,ln.S)(Te,[oe,re,Y])),2),Le=(0,m.CR)(De[0],2),Xe=Le[0],mt=Le[1],Kt=(0,m.CR)(De[1],2),nn=Kt[0],gn=Kt[1];return{x1:Xe,x2:nn,y1:mt,y2:gn}}function sa(oe,re,Y,J,fe){var Te=fe.tickFormatter,De=fe.classNamePrefix,Le=vs(re.value,fe),Xe="line";(0,Wn.Z)(Te)&&(Xe=function(){return(0,ln.S)(Te,[re,Y,J,Le])});var mt=oe.append(Xe).attr("className",Lt.tickItem.name);return cn(mt,Lt.tickItem,at.tickItem,De),mt}function ca(oe,re,Y,J,fe,Te,De){var Le=vs(oe.value,Te),Xe=Aa(oe,re,Y,Le,Te),mt=Xe.x1,Kt=Xe.x2,nn=Xe.y1,gn=Xe.y2,Nn=(0,m.CR)((0,C.Hm)(be(De,[oe,re,Y,Le])),2),$n=Nn[0],Er=Nn[1];J.node().nodeName==="line"&&J.styles((0,m.pi)({x1:mt,x2:Kt,y1:nn,y2:gn},$n)),fe.attr(Er),J.styles($n)}function Ai(oe,re,Y,J,fe,Te){var De=sa((0,Fe.Ys)(this),oe,re,Y,J);ca(oe,re,Y,De,this,J,fe);var Le=(0,m.CR)(Sr(oe.value,J),2),Xe=Le[0],mt=Le[1];return(0,ve.eR)(this,{transform:"translate(".concat(Xe,", ").concat(mt,")")},Te)}function $a(oe,re,Y,J){var fe=Y.classNamePrefix,Te=wt(re,Y.tickFilter),De=(0,C.zs)(Y,"tick");return oe.selectAll(Lt.tick.class).data(Te,function(Le){return Le.id||Le.label}).join(function(Le){var Xe=Le.append("g").attr("className",Lt.tick.name).transition(function(mt,Kt){return Ai.call(this,mt,Kt,Te,Y,De,!1)});return cn(Xe,Lt.tick,at.tick,fe),Xe},function(Le){return Le.transition(function(Xe,mt){return this.removeChildren(),Ai.call(this,Xe,mt,Te,Y,De,J.update)})},function(Le){return Le.transition(function(){var Xe=this,mt=Cn(this.childNodes[0],J.exit);return(0,ve.Yq)(mt,function(){return Xe.remove()}),mt})}).transitions()}var Zo=b(33253);function Ko(oe,re,Y){var J=Y.titlePosition,fe=J===void 0?"lb":J,Te=Y.titleSpacing,De=(0,Zo.l)(fe),Le=oe.node().getLocalBounds(),Xe=(0,m.CR)(Le.min,2),mt=Xe[0],Kt=Xe[1],nn=(0,m.CR)(Le.halfExtents,2),gn=nn[0],Nn=nn[1],$n=(0,m.CR)(re.node().getLocalBounds().halfExtents,2),Er=$n[0],mr=$n[1],ti=(0,m.CR)([mt+gn,Kt+Nn],2),jr=ti[0],ui=ti[1],gi=(0,m.CR)((0,Je.j)(Te),4),oi=gi[0],ts=gi[1],fs=gi[2],Ds=gi[3];if(["start","end"].includes(fe)&&Y.type==="linear"){var Ba=Y.startPos,Ka=Y.endPos,xo=(0,m.CR)(fe==="start"?[Ba,Ka]:[Ka,Ba],2),aa=xo[0],di=xo[1],Ma=Ge([-di[0]+aa[0],-di[1]+aa[1]]),Rs=(0,m.CR)(Xn(Ma,oi),2),lo=Rs[0],Jo=Rs[1];return{x:aa[0]+lo,y:aa[1]+Jo}}return De.includes("t")&&(ui-=Nn+mr+oi),De.includes("r")&&(jr+=gn+Er+ts),De.includes("l")&&(jr-=gn+Er+Ds),De.includes("b")&&(ui+=Nn+mr+fs),{x:jr,y:ui}}function $o(oe,re,Y){var J=oe.getGeometryBounds().halfExtents,fe=J[1]*2;if(re==="vertical"){if(Y==="left")return"rotate(-90) translate(0, ".concat(fe/2,")");if(Y==="right")return"rotate(-90) translate(0, -".concat(fe/2,")")}return""}function bo(oe,re,Y,J,fe){var Te=(0,C.zs)(J,"title"),De=(0,m.CR)((0,C.Hm)(Te),2),Le=De[0],Xe=De[1],mt=Xe.transform,Kt=Xe.transformOrigin,nn=(0,m._T)(Xe,["transform","transformOrigin"]);re.styles(nn);var gn=mt||$o(oe.node(),Le.direction,Le.position);oe.styles((0,m.pi)((0,m.pi)({},Le),{transformOrigin:Kt})),z(oe.node(),gn);var Nn=Ko((0,Fe.Ys)(Y._offscreen||Y.querySelector(Lt.mainGroup.class)),re,J),$n=Nn.x,Er=Nn.y,mr=(0,ve.eR)(re.node(),{transform:"translate(".concat($n,", ").concat(Er,")")},fe);return mr}function Pl(oe,re,Y,J){var fe=Y.titleText,Te=Y.classNamePrefix;return oe.selectAll(Lt.title.class).data([{title:fe}].filter(function(De){return!!De.title}),function(De,Le){return De.title}).join(function(De){var Le=De.append(function(){return(0,Tn.S)(fe)}).attr("className",Lt.title.name).transition(function(){return bo((0,Fe.Ys)(this),oe,re,Y,J.enter)});return cn(Le,Lt.title,at.title,Te),Le},function(De){return De.transition(function(){return bo((0,Fe.Ys)(this),oe,re,Y,J.update)})},function(De){return De.remove()}).transitions()}function il(oe,re,Y,J){var fe=oe.showLine,Te=oe.showTick,De=oe.showLabel,Le=oe.classNamePrefix,Xe=re.maybeAppendByClassName(Lt.lineGroup,"g");cn(Xe,Lt.lineGroup,at.lineGroup,Le);var mt=(0,Ee.z)(fe,Xe,function($n){return st($n,oe,J)})||[],Kt=re.maybeAppendByClassName(Lt.tickGroup,"g");cn(Kt,Lt.tickGroup,at.tickGroup,Le);var nn=(0,Ee.z)(Te,Kt,function($n){return $a($n,Y,oe,J)})||[],gn=re.maybeAppendByClassName(Lt.labelGroup,"g");cn(gn,Lt.labelGroup,at.labelGroup,Le);var Nn=(0,Ee.z)(De,gn,function($n){return ss($n,Y,oe,J,re.node())})||[];return(0,m.ev)((0,m.ev)((0,m.ev)([],(0,m.CR)(mt),!1),(0,m.CR)(nn),!1),(0,m.CR)(Nn),!1).filter(function($n){return!!$n})}var go=function(oe){(0,m.ZT)(re,oe);function re(Y){return oe.call(this,Y,kt)||this}return re.prototype.render=function(Y,J,fe){var Te=this,De=Y.titleText,Le=Y.data,Xe=Y.animate,mt=Y.showTitle,Kt=Y.showGrid,nn=Y.dataThreshold,gn=Y.truncRange,Nn=Y.classNamePrefix,$n=J.className||"axis";Nn?J.attr("className","".concat($n," ").concat(Nn,"axis")):J.className||J.attr("className","axis");var Er=$e(Le,nn).filter(function(fs){var Ds=fs.value;return!(gn&&Ds>gn[0]&&Ds<gn[1])}),mr=(0,ve.MG)(fe===void 0?Xe:fe),ti=(0,Fe.Ys)(J).maybeAppendByClassName(Lt.gridGroup,"g");cn(ti,Lt.gridGroup,at.gridGroup,Nn);var jr=(0,Ee.z)(Kt,ti,function(fs){return ar(fs,Er,Y,mr)})||[],ui=(0,Fe.Ys)(J).maybeAppendByClassName(Lt.mainGroup,"g");cn(ui,Lt.mainGroup,at.mainGroup,Nn),De&&(!this.initialized&&mr.enter||this.initialized&&mr.update)&&il(Y,(0,Fe.Ys)(this.offscreenGroup),Er,(0,ve.MG)(!1));var gi=il(Y,(0,Fe.Ys)(ui.node()),Er,mr),oi=(0,Fe.Ys)(J).maybeAppendByClassName(Lt.titleGroup,"g");cn(oi,Lt.titleGroup,at.titleGroup,Nn);var ts=(0,Ee.z)(mt,oi,function(fs){return Pl(fs,Te,Y,mr)})||[];return(0,m.ev)((0,m.ev)((0,m.ev)([],(0,m.CR)(jr),!1),(0,m.CR)(gi),!1),(0,m.CR)(ts),!1).flat().filter(function(fs){return!!fs})},re}(V.w),Ll=b(42777);function Lu(oe){var re=oe.canvas,Y=oe.touches,J=oe.offsetX,fe=oe.offsetY;if(re){var Te=re.x,De=re.y;return[Te,De]}if(Y){var Le=Y[0],Xe=Le.clientX,mt=Le.clientY;return[Xe,mt]}return J&&fe?[J,fe]:[0,0]}function ao(oe){var re=oe.nativeEvent,Y=oe.touches,J=oe.clientX,fe=oe.clientY;if(re)return[re.clientX,re.clientY];if(Y){var Te=Y[0],De=Te.clientX,Le=Te.clientY;return[De,Le]}return typeof J=="number"&&typeof fe=="number"?[J,fe]:[0,0]}function sl(oe,re){return+oe.toPrecision(re)}function No(oe){return oe.toLocaleString()}function Uu(oe){return oe.toExponential()}function ws(oe,re){return re===void 0&&(re=0),Math.abs(oe)<1e3?String(oe):"".concat(sl(oe/1e3,re).toLocaleString(),"K")}var Kh=function(oe,re,Y){return oe<0&&Number.isFinite(oe)?re:Y},dh=function(oe,re,Y){return oe>0&&Number.isFinite(oe)?re:Y},$h=function(oe,re){return oe*re},Uh=function(oe,re){return oe/2+(re||0)/2},Ku=function(oe){return oe};class sc{constructor(re){this.options=(0,ct.Z)({},this.getDefaultOptions()),this.update(re)}getOptions(){return this.options}update(re={}){this.options=(0,ct.Z)({},this.options,re),this.rescale(re)}rescale(re){}}function pu(oe,re){return re-oe?Y=>(Y-oe)/(re-oe):Y=>.5}function ou(oe,...re){return re.reduce((Y,J)=>fe=>Y(J(fe)),oe)}function Ad(oe,re,Y,J,fe){let Te=Y||0,De=J||oe.length;const Le=fe||(Xe=>Xe);for(;Te<De;){const Xe=Math.floor((Te+De)/2);Le(oe[Xe])>re?De=Xe:Te=Xe+1}return Te}var hf=b(75196),Xo=b.n(hf);function fh(oe,re,Y){let J=Y;return J<0&&(J+=1),J>1&&(J-=1),J<1/6?oe+(re-oe)*6*J:J<1/2?re:J<2/3?oe+(re-oe)*(2/3-J)*6:oe}function Qf(oe){const re=oe[0]/360,Y=oe[1]/100,J=oe[2]/100,fe=oe[3];if(Y===0)return[J*255,J*255,J*255,fe];const Te=J<.5?J*(1+Y):J+Y-J*Y,De=2*J-Te,Le=fh(De,Te,re+1/3),Xe=fh(De,Te,re),mt=fh(De,Te,re-1/3);return[Le*255,Xe*255,mt*255,fe]}function pd(oe){const re=Xo().get(oe);if(!re)return null;const{model:Y,value:J}=re;return Y==="rgb"?J:Y==="hsl"?Qf(J):null}const Ah=(oe,re)=>Y=>oe*(1-Y)+re*Y,Vc=(oe,re)=>{const Y=pd(oe),J=pd(re);return Y===null||J===null?Y?()=>oe:()=>re:fe=>{const Te=new Array(4);for(let Kt=0;Kt<4;Kt+=1){const nn=Y[Kt],gn=J[Kt];Te[Kt]=nn*(1-fe)+gn*fe}const[De,Le,Xe,mt]=Te;return`rgba(${Math.round(De)}, ${Math.round(Le)}, ${Math.round(Xe)}, ${mt})`}},jo=(oe,re)=>typeof oe=="number"&&typeof re=="number"?Ah(oe,re):typeof oe=="string"&&typeof re=="string"?Vc(oe,re):()=>oe,gd=(oe,re)=>{const Y=Ah(oe,re);return J=>Math.round(Y(J))};var lu=b(49527);function gu(oe){return oe===null}function oo(oe){return!(0,lu.Z)(oe)&&!gu(oe)&&!Number.isNaN(oe)}const Ic=Math.sqrt(50),jc=Math.sqrt(10),ph=Math.sqrt(2);function Lo(oe,re,Y){const J=(re-oe)/Math.max(0,Y),fe=Math.floor(Math.log(J)/Math.LN10),Te=J/Bp(10,fe);return fe>=0?(Te>=Ic?10:Te>=jc?5:Te>=ph?2:1)*Bp(10,fe):-Bp(10,-fe)/(Te>=Ic?10:Te>=jc?5:Te>=ph?2:1)}function Ji(oe,re,Y){const J=Math.abs(re-oe)/Math.max(0,Y);let fe=Bp(10,Math.floor(Math.log(J)/Math.LN10));const Te=J/fe;return Te>=Ic?fe*=10:Te>=jc?fe*=5:Te>=ph&&(fe*=2),re<oe?-fe:fe}const $u=(oe,re,Y=5)=>{const J=[oe,re];let fe=0,Te=J.length-1,De=J[fe],Le=J[Te],Xe;return Le<De&&([De,Le]=[Le,De],[fe,Te]=[Te,fe]),Xe=Lo(De,Le,Y),Xe>0?(De=Math.floor(De/Xe)*Xe,Le=Math.ceil(Le/Xe)*Xe,Xe=Lo(De,Le,Y)):Xe<0&&(De=Math.ceil(De*Xe)/Xe,Le=Math.floor(Le*Xe)/Xe,Xe=Lo(De,Le,Y)),Xe>0?(J[fe]=Math.floor(De/Xe)*Xe,J[Te]=Math.ceil(Le/Xe)*Xe):Xe<0&&(J[fe]=Math.ceil(De*Xe)/Xe,J[Te]=Math.floor(Le*Xe)/Xe),J};function gh(oe,re){const Y=re<oe?re:oe,J=oe>re?oe:re;return fe=>Math.min(Math.max(Y,fe),J)}const mh=(oe,re,Y)=>{const[J,fe]=oe,[Te,De]=re;let Le,Xe;return J<fe?(Le=pu(J,fe),Xe=Y(Te,De)):(Le=pu(fe,J),Xe=Y(De,Te)),ou(Xe,Le)},np=(oe,re,Y)=>{const J=Math.min(oe.length,re.length)-1,fe=new Array(J),Te=new Array(J),De=oe[0]>oe[J],Le=De?[...oe].reverse():oe,Xe=De?[...re].reverse():re;for(let mt=0;mt<J;mt+=1)fe[mt]=pu(Le[mt],Le[mt+1]),Te[mt]=Y(Xe[mt],Xe[mt+1]);return mt=>{const Kt=Ad(oe,mt,1,J)-1,nn=fe[Kt],gn=Te[Kt];return ou(gn,nn)(mt)}},vh=(oe,re,Y,J)=>(Math.min(oe.length,re.length)>2?np:mh)(oe,re,J?gd:Y);class Cu extends sc{getDefaultOptions(){return{domain:[0,1],range:[0,1],nice:!1,clamp:!1,round:!1,interpolate:Ah,tickCount:5}}map(re){return oo(re)?this.output(re):this.options.unknown}invert(re){return oo(re)?this.input(re):this.options.unknown}nice(){if(!this.options.nice)return;const[re,Y,J,...fe]=this.getTickMethodOptions();this.options.domain=this.chooseNice()(re,Y,J,...fe)}getTicks(){const{tickMethod:re}=this.options,[Y,J,fe,...Te]=this.getTickMethodOptions();return re(Y,J,fe,...Te)}getTickMethodOptions(){const{domain:re,tickCount:Y}=this.options,J=re[0],fe=re[re.length-1];return[J,fe,Y]}chooseNice(){return $u}rescale(){this.nice();const[re,Y]=this.chooseTransforms();this.composeOutput(re,this.chooseClamp(re)),this.composeInput(re,Y,this.chooseClamp(Y))}chooseClamp(re){const{clamp:Y,range:J}=this.options,fe=this.options.domain.map(re),Te=Math.min(fe.length,J.length);return Y?gh(fe[0],fe[Te-1]):Ku}composeOutput(re,Y){const{domain:J,range:fe,round:Te,interpolate:De}=this.options,Le=vh(J.map(re),fe,De,Te);this.output=ou(Le,Y,re)}composeInput(re,Y,J){const{domain:fe,range:Te}=this.options,De=vh(Te,fe.map(re),Ah);this.input=ou(Y,J,De)}}const zc=(oe,re,Y)=>{let J,fe,Te=oe,De=re;if(Te===De&&Y>0)return[Te];let Le=Lo(Te,De,Y);if(Le===0||!Number.isFinite(Le))return[];if(Le>0){Te=Math.ceil(Te/Le),De=Math.floor(De/Le),fe=new Array(J=Math.ceil(De-Te+1));for(let Xe=0;Xe<J;Xe+=1)fe[Xe]=(Te+Xe)*Le}else{Le=-Le,Te=Math.ceil(Te*Le),De=Math.floor(De*Le),fe=new Array(J=Math.ceil(De-Te+1));for(let Xe=0;Xe<J;Xe+=1)fe[Xe]=(Te+Xe)/Le}return fe};class Ul extends Cu{getDefaultOptions(){return{domain:[0,1],range:[0,1],unknown:void 0,nice:!1,clamp:!1,round:!1,interpolate:jo,tickMethod:zc,tickCount:5}}chooseTransforms(){return[Ku,Ku]}clone(){return new Ul(this.options)}}function Xl({map:oe,initKey:re},Y){const J=re(Y);return oe.has(J)?oe.get(J):Y}function Uo({map:oe,initKey:re},Y){const J=re(Y);return oe.has(J)?oe.get(J):(oe.set(J,Y),Y)}function Ld({map:oe,initKey:re},Y){const J=re(Y);return oe.has(J)&&(Y=oe.get(J),oe.delete(J)),Y}function Yc(oe){return typeof oe=="object"?oe.valueOf():oe}class gl extends Map{constructor(re){if(super(),this.map=new Map,this.initKey=Yc,re!==null)for(const[Y,J]of re)this.set(Y,J)}get(re){return super.get(Xl({map:this.map,initKey:this.initKey},re))}has(re){return super.has(Xl({map:this.map,initKey:this.initKey},re))}set(re,Y){return super.set(Uo({map:this.map,initKey:this.initKey},re),Y)}delete(re){return super.delete(Ld({map:this.map,initKey:this.initKey},re))}}const To=Symbol("defaultUnknown");function ml(oe,re,Y){for(let J=0;J<re.length;J+=1)oe.has(re[J])||oe.set(Y(re[J]),J)}function Xu(oe){const{value:re,from:Y,to:J,mapper:fe,notFoundReturn:Te}=oe;let De=fe.get(re);if(De===void 0){if(Te!==To)return Te;De=Y.push(re)-1,fe.set(re,De)}return J[De%J.length]}function mu(oe){return oe instanceof Date?re=>`${re}`:typeof oe=="object"?re=>JSON.stringify(re):re=>re}class Oo extends sc{getDefaultOptions(){return{domain:[],range:[],unknown:To}}constructor(re){super(re)}map(re){return this.domainIndexMap.size===0&&ml(this.domainIndexMap,this.getDomain(),this.domainKey),Xu({value:this.domainKey(re),mapper:this.domainIndexMap,from:this.getDomain(),to:this.getRange(),notFoundReturn:this.options.unknown})}invert(re){return this.rangeIndexMap.size===0&&ml(this.rangeIndexMap,this.getRange(),this.rangeKey),Xu({value:this.rangeKey(re),mapper:this.rangeIndexMap,from:this.getRange(),to:this.getDomain(),notFoundReturn:this.options.unknown})}rescale(re){const[Y]=this.options.domain,[J]=this.options.range;if(this.domainKey=mu(Y),this.rangeKey=mu(J),!this.rangeIndexMap){this.rangeIndexMap=new Map,this.domainIndexMap=new Map;return}(!re||re.range)&&this.rangeIndexMap.clear(),(!re||re.domain||re.compare)&&(this.domainIndexMap.clear(),this.sortedDomain=void 0)}clone(){return new Oo(this.options)}getRange(){return this.options.range}getDomain(){if(this.sortedDomain)return this.sortedDomain;const{domain:re,compare:Y}=this.options;return this.sortedDomain=Y?[...re].sort(Y):re,this.sortedDomain}}function Bo(oe){const re=Math.min(...oe);return oe.map(Y=>Y/re)}function _o(oe,re){const Y=oe.length,J=re-Y;return J>0?[...oe,...new Array(J).fill(1)]:J<0?oe.slice(0,re):oe}function na(oe){return Math.round(oe*1e12)/1e12}function Wa(oe){const{domain:re,range:Y,paddingOuter:J,paddingInner:fe,flex:Te,round:De,align:Le}=oe,Xe=re.length,mt=_o(Te,Xe),[Kt,nn]=Y,gn=nn-Kt,Nn=2/Xe*J+1-1/Xe*fe,$n=gn/Nn,Er=$n*fe/Xe,mr=$n-Xe*Er,ti=Bo(mt),jr=ti.reduce((aa,di)=>aa+di),ui=mr/jr,gi=new gl(re.map((aa,di)=>{const Ma=ti[di]*ui;return[aa,De?Math.floor(Ma):Ma]})),oi=new gl(re.map((aa,di)=>{const Rs=ti[di]*ui+Er;return[aa,De?Math.floor(Rs):Rs]})),ts=Array.from(oi.values()).reduce((aa,di)=>aa+di),Ds=(gn-(ts-ts/Xe*fe))*Le,Ba=Kt+Ds;let Ka=De?Math.round(Ba):Ba;const xo=new Array(Xe);for(let aa=0;aa<Xe;aa+=1){xo[aa]=na(Ka);const di=re[aa];Ka+=oi.get(di)}return{valueBandWidth:gi,valueStep:oi,adjustedRange:xo}}function yh(oe){var re;const{domain:Y}=oe,J=Y.length;if(J===0)return{valueBandWidth:void 0,valueStep:void 0,adjustedRange:[]};if(!!(!((re=oe.flex)===null||re===void 0)&&re.length))return Wa(oe);const{range:Te,paddingOuter:De,paddingInner:Le,round:Xe,align:mt}=oe;let Kt,nn,gn=Te[0];const $n=Te[1]-gn,Er=De*2,mr=J-Le;Kt=$n/Math.max(1,Er+mr),Xe&&(Kt=Math.floor(Kt)),gn+=($n-Kt*(J-Le))*mt,nn=Kt*(1-Le),Xe&&(gn=Math.round(gn),nn=Math.round(nn));const ti=new Array(J).fill(0).map((jr,ui)=>gn+ui*Kt);return{valueStep:Kt,valueBandWidth:nn,adjustedRange:ti}}class Yo extends Oo{getDefaultOptions(){return{domain:[],range:[0,1],align:.5,round:!1,paddingInner:0,paddingOuter:0,padding:0,unknown:To,flex:[]}}constructor(re){super(re)}clone(){return new Yo(this.options)}getStep(re){return this.valueStep===void 0?1:typeof this.valueStep=="number"?this.valueStep:re===void 0?Array.from(this.valueStep.values())[0]:this.valueStep.get(re)}getBandWidth(re){return this.valueBandWidth===void 0?1:typeof this.valueBandWidth=="number"?this.valueBandWidth:re===void 0?Array.from(this.valueBandWidth.values())[0]:this.valueBandWidth.get(re)}getRange(){return this.adjustedRange}getPaddingInner(){const{padding:re,paddingInner:Y}=this.options;return re>0?re:Y}getPaddingOuter(){const{padding:re,paddingOuter:Y}=this.options;return re>0?re:Y}rescale(){super.rescale();const{align:re,domain:Y,range:J,round:fe,flex:Te}=this.options,{adjustedRange:De,valueBandWidth:Le,valueStep:Xe}=yh({align:re,range:J,round:fe,flex:Te,paddingInner:this.getPaddingInner(),paddingOuter:this.getPaddingOuter(),domain:Y});this.valueStep=Xe,this.valueBandWidth=Le,this.adjustedRange=De}}var Tu=b(37547),uu=b(1933),wc=b(39934),ac=function(oe){(0,m.ZT)(re,oe);function re(Y){var J=this,fe=Y.style,Te=(0,m._T)(Y,["style"]);return J=oe.call(this,(0,ct.Z)({},{type:"column"},(0,m.pi)({style:fe},Te)))||this,J.columnsGroup=new N.ZA({name:"columns"}),J.appendChild(J.columnsGroup),J.render(),J}return re.prototype.render=function(){var Y=this.attributes,J=Y.columns,fe=Y.x,Te=Y.y;this.columnsGroup.style.transform="translate(".concat(fe,", ").concat(Te,")"),(0,Fe.Ys)(this.columnsGroup).selectAll(".column").data(J.flat()).join(function(De){return De.append("rect").attr("className","column").each(function(Le){this.attr(Le)})},function(De){return De.each(function(Le){this.attr(Le)})},function(De){return De.remove()})},re.prototype.update=function(Y){this.attr((0,E.n)({},this.attributes,Y)),this.render()},re.prototype.clear=function(){this.removeChildren()},re}(N.s$),Lr=function(oe){(0,m.ZT)(re,oe);function re(Y){var J=this,fe=Y.style,Te=(0,m._T)(Y,["style"]);return J=oe.call(this,(0,ct.Z)({},{type:"lines"},(0,m.pi)({style:fe},Te)))||this,J.linesGroup=J.appendChild(new N.ZA),J.areasGroup=J.appendChild(new N.ZA),J.render(),J}return re.prototype.render=function(){var Y=this.attributes,J=Y.lines,fe=Y.areas,Te=Y.x,De=Y.y;this.style.transform="translate(".concat(Te,", ").concat(De,")"),J&&this.renderLines(J),fe&&this.renderAreas(fe)},re.prototype.clear=function(){this.linesGroup.removeChildren(),this.areasGroup.removeChildren()},re.prototype.update=function(Y){this.attr((0,E.n)({},this.attributes,Y)),this.render()},re.prototype.renderLines=function(Y){(0,Fe.Ys)(this.linesGroup).selectAll(".line").data(Y).join(function(J){return J.append("path").attr("className","line").each(function(fe){this.attr(fe)})},function(J){return J.each(function(fe){this.attr(fe)})},function(J){return J.remove()})},re.prototype.renderAreas=function(Y){(0,Fe.Ys)(this.linesGroup).selectAll(".area").data(Y).join(function(J){return J.append("path").attr("className","area").each(function(fe){this.attr(fe)})},function(J){return J.each(function(fe){this.style(fe)})},function(J){return J.remove()})},re}(N.s$),Gr=b(62099);function ki(oe,re,Y,J){var fe,Te=[],De=!!J,Le,Xe,mt=[1/0,1/0],Kt=[-1/0,-1/0],nn,gn,Nn;if(De){fe=(0,m.CR)(J,2),mt=fe[0],Kt=fe[1];for(var $n=0,Er=oe.length;$n<Er;$n+=1){var mr=oe[$n];mt=dr(mt,mr),Kt=vn(Kt,mr)}}for(var $n=0,ti=oe.length;$n<ti;$n+=1){var mr=oe[$n];if($n===0&&!Y)Nn=mr;else if($n===ti-1&&!Y)gn=mr,Te.push(Nn),Te.push(gn);else{var jr=[$n?$n-1:ti-1,$n-1][Y?0:1];Le=oe[jr],Xe=oe[Y?($n+1)%ti:$n+1];var ui=[0,0];ui=zn(Xe,Le),ui=Xn(ui,re);var gi=_r(mr,Le),oi=_r(mr,Xe),ts=gi+oi;ts!==0&&(gi/=ts,oi/=ts);var fs=Xn(ui,-gi),Ds=Xn(ui,oi);gn=In(mr,fs),nn=In(mr,Ds),nn=dr(nn,vn(Xe,mr)),nn=vn(nn,dr(Xe,mr)),fs=zn(nn,mr),fs=Xn(fs,-gi/oi),gn=In(mr,fs),gn=dr(gn,vn(Le,mr)),gn=vn(gn,dr(Le,mr)),Ds=zn(mr,gn),Ds=Xn(Ds,oi/gi),nn=In(mr,Ds),De&&(gn=vn(gn,mt),gn=dr(gn,Kt),nn=vn(nn,mt),nn=dr(nn,Kt)),Te.push(Nn),Te.push(gn),Nn=nn}}return Y&&Te.push(Te.shift()),Te}function ju(oe,re,Y){var J;re===void 0&&(re=!1),Y===void 0&&(Y=[[0,0],[1,1]]);for(var fe=!!re,Te=[],De=0,Le=oe.length;De<Le;De+=2)Te.push([oe[De],oe[De+1]]);for(var Xe=ki(Te,.4,fe,Y),mt=Te.length,Kt=[],nn,gn,Nn,De=0;De<mt-1;De+=1)nn=Xe[De*2],gn=Xe[De*2+1],Nn=Te[De+1],Kt.push(["C",nn[0],nn[1],gn[0],gn[1],Nn[0],Nn[1]]);return fe&&(nn=Xe[mt],gn=Xe[mt+1],J=(0,m.CR)(Te,1),Nn=J[0],Kt.push(["C",nn[0],nn[1],gn[0],gn[1],Nn[0],Nn[1]])),Kt}function bl(oe,re){var Y,J=re.x,fe=re.y,Te=(0,m.CR)(fe.getOptions().range||[0,0],2),De=Te[0],Le=Te[1];return Le>De&&(Y=(0,m.CR)([De,Le],2),Le=Y[0],De=Y[1]),oe.map(function(Xe){var mt=Xe.map(function(Kt,nn){return[J.map(nn),(0,Z.Z)(fe.map(Kt),Le,De)]});return mt})}function qo(oe,re){re===void 0&&(re=!1);var Y=re?oe.length-1:0,J=oe.map(function(fe,Te){return(0,m.ev)([Te===Y?"M":"L"],(0,m.CR)(fe),!1)});return re?J.reverse():J}function Go(oe,re){if(re===void 0&&(re=!1),oe.length<=2)return qo(oe);for(var Y=[],J=oe.length,fe=0;fe<J;fe+=1){var Te=re?oe[J-fe-1]:oe[fe];(0,Gr.Z)(Te,Y.slice(-2))||Y.push.apply(Y,(0,m.ev)([],(0,m.CR)(Te),!1))}var De=ju(Y,!1);return re?De.unshift((0,m.ev)(["M"],(0,m.CR)(oe[J-1]),!1)):De.unshift((0,m.ev)(["M"],(0,m.CR)(oe[0]),!1)),De}function Ou(oe,re,Y){var J=(0,Tu.Z)(oe);return J.push(["L",re,Y],["L",0,Y],["Z"]),J}function Oh(oe,re,Y,J){return oe.map(function(fe){return Ou(re?Go(fe):qo(fe),Y,J)})}function oc(oe,re,Y){for(var J=[],fe=oe.length-1;fe>=0;fe-=1){var Te=oe[fe],De=qo(Te),Le=void 0;if(fe===0)Le=Ou(De,re,Y);else{var Xe=oe[fe-1],mt=qo(Xe,!0);mt[0][0]="L",Le=(0,m.ev)((0,m.ev)((0,m.ev)([],(0,m.CR)(De),!1),(0,m.CR)(mt),!1),[["Z"]],!1)}J.push(Le)}return J}function Ca(oe,re,Y){for(var J=[],fe=oe.length-1;fe>=0;fe-=1){var Te=oe[fe],De=Go(Te),Le=void 0;if(fe===0)Le=Ou(De,re,Y);else{var Xe=oe[fe-1],mt=Go(Xe,!0),Kt=Te[0];mt[0][0]="L",Le=(0,m.ev)((0,m.ev)((0,m.ev)([],(0,m.CR)(De),!1),(0,m.CR)(mt),!1),[(0,m.ev)(["M"],(0,m.CR)(Kt),!1),["Z"]],!1)}J.push(Le)}return J}var Ud=b(2078),rp=function(oe,re){if((0,wc.Z)(oe)){for(var Y,J=1/0,fe=0;fe<oe.length;fe++){var Te=oe[fe],De=(0,Wn.Z)(re)?re(Te):Te[re];De<J&&(Y=Te,J=De)}return Y}},Xh=b(82639),lc=function(oe,re){if((0,wc.Z)(oe)){for(var Y,J=-1/0,fe=0;fe<oe.length;fe++){var Te=oe[fe],De=(0,Wn.Z)(re)?re(Te):Te[re];De>J&&(Y=Te,J=De)}return Y}};function wA(oe){return oe.length===0?[0,0]:[(0,Ud.Z)(rp(oe,function(re){return(0,Ud.Z)(re)||0})),(0,Xh.Z)(lc(oe,function(re){return(0,Xh.Z)(re)||0}))]}function Od(oe){for(var re=(0,Tu.Z)(oe),Y=re[0].length,J=(0,m.CR)([Array(Y).fill(0),Array(Y).fill(0)],2),fe=J[0],Te=J[1],De=0;De<re.length;De+=1)for(var Le=re[De],Xe=0;Xe<Y;Xe+=1)Le[Xe]>=0?(Le[Xe]+=fe[Xe],fe[Xe]=Le[Xe]):(Le[Xe]+=Te[Xe],Te[Xe]=Le[Xe]);return re}var jh=function(oe){(0,m.ZT)(re,oe);function re(Y){return oe.call(this,Y,{type:"line",x:0,y:0,width:200,height:20,isStack:!1,color:["#83daad","#edbf45","#d2cef9","#e290b3","#6f63f4"],smooth:!0,lineLineWidth:1,areaOpacity:0,isGroup:!1,columnLineWidth:1,columnStroke:"#fff",scale:1,spacing:0})||this}return Object.defineProperty(re.prototype,"rawData",{get:function(){var Y=this.attributes.data;if(!Y||(Y==null?void 0:Y.length)===0)return[[]];var J=(0,Tu.Z)(Y);return(0,uu.Z)(J[0])?[J]:J},enumerable:!1,configurable:!0}),Object.defineProperty(re.prototype,"data",{get:function(){return this.attributes.isStack?Od(this.rawData):this.rawData},enumerable:!1,configurable:!0}),Object.defineProperty(re.prototype,"scales",{get:function(){return this.createScales(this.data)},enumerable:!1,configurable:!0}),Object.defineProperty(re.prototype,"baseline",{get:function(){var Y=this.scales.y,J=(0,m.CR)(Y.getOptions().domain||[0,0],2),fe=J[0],Te=J[1];return Te<0?Y.map(Te):Y.map(fe<0?0:fe)},enumerable:!1,configurable:!0}),Object.defineProperty(re.prototype,"containerShape",{get:function(){var Y=this.attributes,J=Y.width,fe=Y.height;return{width:J,height:fe}},enumerable:!1,configurable:!0}),Object.defineProperty(re.prototype,"linesStyle",{get:function(){var Y=this,J=this.attributes,fe=J.type,Te=J.isStack,De=J.smooth;if(fe!=="line")throw new Error("linesStyle can only be used in line type");var Le=(0,C.zs)(this.attributes,"area"),Xe=(0,C.zs)(this.attributes,"line"),mt=this.containerShape.width,Kt=this.data;if(Kt[0].length===0)return{lines:[],areas:[]};var nn=this.scales,gn=nn.x,Nn=nn.y,$n=bl(Kt,{type:"line",x:gn,y:Nn}),Er=[];if(Le){var mr=this.baseline;Te?Er=De?Ca($n,mt,mr):oc($n,mt,mr):Er=Oh($n,De,mt,mr)}return{lines:$n.map(function(ti,jr){return(0,m.pi)({stroke:Y.getColor(jr),d:De?Go(ti):qo(ti)},Xe)}),areas:Er.map(function(ti,jr){return(0,m.pi)({d:ti,fill:Y.getColor(jr)},Le)})}},enumerable:!1,configurable:!0}),Object.defineProperty(re.prototype,"columnsStyle",{get:function(){var Y=this,J=(0,C.zs)(this.attributes,"column"),fe=this.attributes,Te=fe.isStack,De=fe.type,Le=fe.scale;if(De!=="column")throw new Error("columnsStyle can only be used in column type");var Xe=this.containerShape.height,mt=this.rawData;if(!mt)return{columns:[]};Te&&(mt=Od(mt));var Kt=this.createScales(mt),nn=Kt.x,gn=Kt.y,Nn=(0,m.CR)(wA(mt),2),$n=Nn[0],Er=Nn[1],mr=new Ul({domain:[0,Er-($n>0?0:$n)],range:[0,Xe*Le]}),ti=nn.getBandWidth(),jr=this.rawData;return{columns:mt.map(function(ui,gi){return ui.map(function(oi,ts){var fs=ti/mt.length,Ds=function(){return{x:nn.map(ts)+fs*gi,y:oi>=0?gn.map(oi):gn.map(0),width:fs,height:mr.map(Math.abs(oi))}},Ba=function(){return{x:nn.map(ts),y:gn.map(oi),width:ti,height:mr.map(jr[gi][ts])}};return(0,m.pi)((0,m.pi)({fill:Y.getColor(gi)},J),Te?Ba():Ds())})})}},enumerable:!1,configurable:!0}),re.prototype.render=function(Y,J){(0,Fe.OV)(J,".container","rect").attr("className","container").node();var fe=Y.type,Te=Y.x,De=Y.y,Le="spark".concat(fe),Xe=(0,m.pi)({x:Te,y:De},fe==="line"?this.linesStyle:this.columnsStyle);(0,Fe.Ys)(J).selectAll(".spark").data([fe]).join(function(mt){return mt.append(function(Kt){return Kt==="line"?new Lr({className:Le,style:Xe}):new ac({className:Le,style:Xe})}).attr("className","spark ".concat(Le))},function(mt){return mt.update(Xe)},function(mt){return mt.remove()})},re.prototype.getColor=function(Y){var J=this.attributes.color;return(0,wc.Z)(J)?J[Y%J.length]:(0,Wn.Z)(J)?J.call(null,Y):J},re.prototype.createScales=function(Y){var J,fe,Te=this.attributes,De=Te.type,Le=Te.scale,Xe=Te.range,mt=Xe===void 0?[]:Xe,Kt=Te.spacing,nn=this.containerShape,gn=nn.width,Nn=nn.height,$n=(0,m.CR)(wA(Y),2),Er=$n[0],mr=$n[1],ti=new Ul({domain:[(J=mt[0])!==null&&J!==void 0?J:Er,(fe=mt[1])!==null&&fe!==void 0?fe:mr],range:[Nn,Nn*(1-Le)]});return De==="line"?{type:De,x:new Ul({domain:[0,Y[0].length-1],range:[0,gn]}),y:ti}:{type:De,x:new Yo({domain:Y[0].map(function(jr,ui){return ui}),range:[0,gn],paddingInner:Kt,paddingOuter:Kt/2,align:.5}),y:ti}},re.tag="sparkline",re}(V.w),SA={fill:"#fff",lineWidth:1,radius:2,size:10,stroke:"#bfbfbf",strokeOpacity:1,zIndex:0},md={fill:"#000",fillOpacity:.45,fontSize:12,textAlign:"center",textBaseline:"middle",zIndex:1},vd={x:0,y:0,orientation:"horizontal",showLabel:!0,type:"start"},mo=(0,vt.A)({foreground:"foreground",handle:"handle",selection:"selection",sparkline:"sparkline",sparklineGroup:"sparkline-group",track:"track",brushArea:"brush-area"},"slider"),wa=(0,vt.A)({labelGroup:"label-group",label:"label",iconGroup:"icon-group",icon:"icon",iconRect:"icon-rect",iconLine:"icon-line"},"handle"),Dd=function(oe){(0,m.ZT)(re,oe);function re(){return oe!==null&&oe.apply(this,arguments)||this}return re.prototype.render=function(Y,J){var fe=Y.x,Te=Y.y,De=Y.size,Le=De===void 0?10:De,Xe=Y.radius,mt=Xe===void 0?Le/4:Xe,Kt=Y.orientation,nn=Y.classNamePrefix,gn=(0,m._T)(Y,["x","y","size","radius","orientation","classNamePrefix"]),Nn=Le,$n=Nn*2.4,Er=nn?"".concat(wa.iconRect.name," ").concat(nn,"handle-icon-rect"):wa.iconRect.name,mr=function(ts){return nn?"".concat(wa.iconLine,"-").concat(ts," ").concat(nn,"handle-icon-line"):"".concat(wa.iconLine,"-").concat(ts)},ti=(0,Fe.Ys)(J).maybeAppendByClassName(wa.iconRect,"rect").attr("className",Er).styles((0,m.pi)((0,m.pi)({},gn),{width:Nn,height:$n,radius:mt,x:fe-Nn/2,y:Te-$n/2,transformOrigin:"center"})),jr=fe+1/3*Nn-Nn/2,ui=fe+2/3*Nn-Nn/2,gi=Te+1/4*$n-$n/2,oi=Te+3/4*$n-$n/2;ti.maybeAppendByClassName("".concat(wa.iconLine,"-1"),"line").attr("className",mr(1)).styles((0,m.pi)({x1:jr,x2:jr,y1:gi,y2:oi},gn)),ti.maybeAppendByClassName("".concat(wa.iconLine,"-2"),"line").attr("className",mr(2)).styles((0,m.pi)({x1:ui,x2:ui,y1:gi,y2:oi},gn)),Kt==="vertical"&&(ti.node().style.transform="rotate(90)")},re}(V.w),qi=function(oe){(0,m.ZT)(re,oe);function re(Y){return oe.call(this,Y,vd)||this}return re.prototype.renderLabel=function(Y){var J=this,fe=this.attributes,Te=fe.x,De=fe.y,Le=fe.showLabel,Xe=(0,C.zs)(this.attributes,"label"),mt=Xe.x,Kt=mt===void 0?0:mt,nn=Xe.y,gn=nn===void 0?0:nn,Nn=Xe.transform,$n=Xe.transformOrigin,Er=(0,m._T)(Xe,["x","y","transform","transformOrigin"]),mr=(0,m.CR)((0,C.Hm)(Er,[]),2),ti=mr[0],jr=mr[1],ui=(0,Fe.Ys)(Y).maybeAppendByClassName(wa.labelGroup,"g").styles(jr),gi=(0,m.pi)((0,m.pi)({},md),ti),oi=gi.text,ts=(0,m._T)(gi,["text"]);(0,Ee.z)(!!Le,ui,function(fs){J.label=fs.maybeAppendByClassName(wa.label,"text").styles((0,m.pi)((0,m.pi)({},ts),{x:Te+Kt,y:De+gn,transform:Nn,transformOrigin:$n,text:"".concat(oi)})),J.label.on("mousedown",function(Ds){Ds.stopPropagation()}),J.label.on("touchstart",function(Ds){Ds.stopPropagation()})})},re.prototype.renderIcon=function(Y){var J=this.attributes,fe=J.x,Te=J.y,De=J.orientation,Le=J.type,Xe=J.classNamePrefix,mt=(0,m.pi)((0,m.pi)({x:fe,y:Te,orientation:De,classNamePrefix:Xe},SA),(0,C.zs)(this.attributes,"icon")),Kt=this.attributes.iconShape,nn=Kt===void 0?function(){return new Dd({style:mt})}:Kt,gn=(0,Fe.Ys)(Y).maybeAppendByClassName(wa.iconGroup,"g");gn.selectAll(wa.icon.class).data([nn]).join(function(Nn){return Nn.append(typeof nn=="string"?nn:function(){return nn(Le)}).attr("className",wa.icon.name)},function(Nn){return Nn.update(mt)},function(Nn){return Nn.remove()})},re.prototype.render=function(Y,J){this.renderIcon(J),this.renderLabel(J)},re}(V.w),Du=function(oe){(0,m.ZT)(re,oe);function re(Y){var J=oe.call(this,Y,(0,m.pi)((0,m.pi)((0,m.pi)({x:0,y:0,animate:{duration:100,fill:"both"},brushable:!0,formatter:function(fe){return fe.toString()},handleSpacing:2,orientation:"horizontal",padding:0,autoFitLabel:!0,scrollable:!0,selectionFill:"#5B8FF9",selectionFillOpacity:.45,selectionZIndex:2,showHandle:!0,showLabel:!0,slidable:!0,trackFill:"#416180",trackLength:200,trackOpacity:.05,trackSize:20,trackZIndex:-1,values:[0,1],type:"range",selectionType:"select",handleIconOffset:0},(0,C.dq)(vd,"handle")),(0,C.dq)(SA,"handleIcon")),(0,C.dq)(md,"handleLabel")))||this;return J.range=[0,1],J.onDragStart=function(fe){return function(Te){Te.stopPropagation(),J.target=fe,J.prevPos=J.getOrientVal(ao(Te));var De=J.availableSpace,Le=De.x,Xe=De.y,mt=J.getBBox(),Kt=mt.x,nn=mt.y;J.selectionStartPos=J.getRatio(J.prevPos-J.getOrientVal([Le,Xe])-J.getOrientVal([+Kt,+nn])),J.selectionWidth=0,document.addEventListener("pointermove",J.onDragging),document.addEventListener("pointerup",J.onDragEnd)}},J.onDragging=function(fe){var Te=J.attributes,De=Te.slidable,Le=Te.brushable,Xe=Te.type;fe.stopPropagation();var mt=J.getOrientVal(ao(fe)),Kt=mt-J.prevPos;if(Kt){var nn=J.getRatio(Kt);switch(J.target){case"start":De&&J.setValuesOffset(nn);break;case"end":De&&J.setValuesOffset(0,nn);break;case"selection":De&&J.setValuesOffset(nn,nn);break;case"track":if(!Le)return;J.selectionWidth+=nn,Xe==="range"?J.innerSetValues([J.selectionStartPos,J.selectionStartPos+J.selectionWidth].sort(),!0):J.innerSetValues([0,J.selectionStartPos+J.selectionWidth],!0);break;default:break}J.prevPos=mt}},J.onDragEnd=function(){document.removeEventListener("pointermove",J.onDragging),document.removeEventListener("pointermove",J.onDragging),document.removeEventListener("pointerup",J.onDragEnd),J.target="",J.updateHandlesPosition(!1)},J.onValueChange=function(fe){var Te=J.attributes,De=Te.onChange,Le=Te.type,Xe=Le==="range"?fe:fe[1],mt=Le==="range"?J.getValues():J.getValues()[1],Kt=new N.Aw("valuechange",{detail:{oldValue:Xe,value:mt}});J.dispatchEvent(Kt),De==null||De(mt)},J.selectionStartPos=0,J.selectionWidth=0,J.prevPos=0,J.target="",J}return Object.defineProperty(re.prototype,"values",{get:function(){return this.attributes.values},set:function(Y){this.attributes.values=this.clampValues(Y)},enumerable:!1,configurable:!0}),Object.defineProperty(re.prototype,"sparklineStyle",{get:function(){var Y=this.attributes.orientation;if(Y!=="horizontal")return null;var J=(0,C.zs)(this.attributes,"sparkline");return(0,m.pi)((0,m.pi)({zIndex:0},this.availableSpace),J)},enumerable:!1,configurable:!0}),Object.defineProperty(re.prototype,"shape",{get:function(){var Y=this.attributes,J=Y.trackLength,fe=Y.trackSize,Te=(0,m.CR)(this.getOrientVal([[J,fe],[fe,J]]),2),De=Te[0],Le=Te[1];return{width:De,height:Le}},enumerable:!1,configurable:!0}),Object.defineProperty(re.prototype,"availableSpace",{get:function(){var Y=this.attributes,J=Y.x,fe=Y.y,Te=Y.padding,De=(0,m.CR)((0,Je.j)(Te),4),Le=De[0],Xe=De[1],mt=De[2],Kt=De[3],nn=this.shape,gn=nn.width,Nn=nn.height;return{x:Kt,y:Le,width:gn-(Kt+Xe),height:Nn-(Le+mt)}},enumerable:!1,configurable:!0}),re.prototype.getValues=function(){return this.values},re.prototype.setValues=function(Y,J){Y===void 0&&(Y=[0,0]),J===void 0&&(J=!1),this.attributes.values=Y;var fe=J===!1?!1:this.attributes.animate;this.updateSelectionArea(fe),this.updateHandlesPosition(fe)},re.prototype.updateSelectionArea=function(Y){var J=this.calcSelectionArea();this.foregroundGroup.selectAll(mo.selection.class).each(function(fe,Te){(0,ve.eR)(this,J[Te],Y)})},re.prototype.updateHandlesPosition=function(Y){this.attributes.showHandle&&(this.startHandle&&(0,ve.eR)(this.startHandle,this.getHandleStyle("start"),Y),this.endHandle&&(0,ve.eR)(this.endHandle,this.getHandleStyle("end"),Y))},re.prototype.innerSetValues=function(Y,J){Y===void 0&&(Y=[0,0]),J===void 0&&(J=!1);var fe=this.values,Te=this.clampValues(Y);this.attributes.values=Te,this.setValues(Te),J&&this.onValueChange(fe)},re.prototype.renderTrack=function(Y){var J=this.attributes,fe=J.x,Te=J.y,De=(0,C.zs)(this.attributes,"track");this.trackShape=(0,Fe.Ys)(Y).maybeAppendByClassName(mo.track,"rect").styles((0,m.pi)((0,m.pi)({x:fe,y:Te},this.shape),De))},re.prototype.renderBrushArea=function(Y){var J=this.attributes,fe=J.x,Te=J.y,De=J.brushable;this.brushArea=(0,Fe.Ys)(Y).maybeAppendByClassName(mo.brushArea,"rect").styles((0,m.pi)({x:fe,y:Te,fill:"transparent",cursor:De?"crosshair":"default"},this.shape))},re.prototype.renderSparkline=function(Y){var J=this,fe=this.attributes,Te=fe.x,De=fe.y,Le=fe.orientation,Xe=(0,Fe.Ys)(Y).maybeAppendByClassName(mo.sparklineGroup,"g");(0,Ee.z)(Le==="horizontal",Xe,function(mt){var Kt=(0,m.pi)((0,m.pi)({},J.sparklineStyle),{x:Te,y:De});mt.maybeAppendByClassName(mo.sparkline,function(){return new jh({style:Kt})}).update(Kt)})},re.prototype.renderHandles=function(){var Y=this,J,fe=this.attributes,Te=fe.showHandle,De=fe.type,Le=De==="range"?["start","end"]:["end"],Xe=Te?Le:[],mt=this;(J=this.foregroundGroup)===null||J===void 0||J.selectAll(mo.handle.class).data(Xe.map(function(Kt){return{type:Kt}}),function(Kt){return Kt.type}).join(function(Kt){return Kt.append(function(nn){var gn=nn.type;return new qi({style:Y.getHandleStyle(gn)})}).each(function(nn){var gn=nn.type;this.attr("class","".concat(mo.handle.name," ").concat(gn,"-handle"));var Nn="".concat(gn,"Handle");mt[Nn]=this,this.addEventListener("pointerdown",mt.onDragStart(gn))})},function(Kt){return Kt.each(function(nn){var gn=nn.type;this.update(mt.getHandleStyle(gn))})},function(Kt){return Kt.each(function(nn){var gn=nn.type,Nn="".concat(gn,"Handle");mt[Nn]=void 0}).remove()})},re.prototype.renderSelection=function(Y){var J=this.attributes,fe=J.x,Te=J.y,De=J.type,Le=J.selectionType;this.foregroundGroup=(0,Fe.Ys)(Y).maybeAppendByClassName(mo.foreground,"g");var Xe=(0,C.zs)(this.attributes,"selection"),mt=function(nn){return nn.style("visibility",function(gn){return gn.show?"visible":"hidden"}).style("cursor",function(gn){return Le==="select"?"grab":Le==="invert"?"crosshair":"default"}).styles((0,m.pi)((0,m.pi)({},Xe),{transform:"translate(".concat(fe,", ").concat(Te,")")}))},Kt=this;this.foregroundGroup.selectAll(mo.selection.class).data(De==="value"?[]:this.calcSelectionArea().map(function(nn,gn){return{style:(0,m.pi)({},nn),index:gn,show:Le==="select"?gn===1:gn!==1}}),function(nn){return nn.index}).join(function(nn){return nn.append("rect").attr("className",mo.selection.name).call(mt).each(function(gn,Nn){var $n=this;Nn===1?(Kt.selectionShape=(0,Fe.Ys)(this),this.on("pointerdown",function(Er){$n.attr("cursor","grabbing"),Kt.onDragStart("selection")(Er)}),Kt.dispatchCustomEvent(this,"pointerenter","selectionMouseenter"),Kt.dispatchCustomEvent(this,"pointerleave","selectionMouseleave"),Kt.dispatchCustomEvent(this,"click","selectionClick"),this.addEventListener("pointerdown",function(){$n.attr("cursor","grabbing")}),this.addEventListener("pointerup",function(){$n.attr("cursor","pointer")}),this.addEventListener("pointerover",function(){$n.attr("cursor","pointer")})):this.on("pointerdown",Kt.onDragStart("track"))})},function(nn){return nn.call(mt)},function(nn){return nn.remove()}),this.updateSelectionArea(!1),this.renderHandles()},re.prototype.render=function(Y,J){this.renderTrack(J),this.renderSparkline(J),this.renderBrushArea(J),this.renderSelection(J)},re.prototype.clampValues=function(Y,J){var fe;J===void 0&&(J=4);var Te=(0,m.CR)(this.range,2),De=Te[0],Le=Te[1],Xe=(0,m.CR)(this.getValues().map(function(mr){return sl(mr,J)}),2),mt=Xe[0],Kt=Xe[1],nn=Array.isArray(Y)?Y:[mt,Y!=null?Y:Kt],gn=(0,m.CR)((nn||[mt,Kt]).map(function(mr){return sl(mr,J)}),2),Nn=gn[0],$n=gn[1];if(this.attributes.type==="value")return[0,(0,Z.Z)($n,De,Le)];Nn>$n&&(fe=(0,m.CR)([$n,Nn],2),Nn=fe[0],$n=fe[1]);var Er=$n-Nn;return Er>Le-De?[De,Le]:Nn<De?mt===De&&Kt===$n?[De,$n]:[De,Er+De]:$n>Le?Kt===Le&&mt===Nn?[Nn,Le]:[Le-Er,Le]:[Nn,$n]},re.prototype.calcSelectionArea=function(Y){var J=(0,m.CR)(this.clampValues(Y),2),fe=J[0],Te=J[1],De=this.availableSpace,Le=De.x,Xe=De.y,mt=De.width,Kt=De.height;return this.getOrientVal([[{y:Xe,height:Kt,x:Le,width:fe*mt},{y:Xe,height:Kt,x:fe*mt+Le,width:(Te-fe)*mt},{y:Xe,height:Kt,x:Te*mt,width:(1-Te)*mt}],[{x:Le,width:mt,y:Xe,height:fe*Kt},{x:Le,width:mt,y:fe*Kt+Xe,height:(Te-fe)*Kt},{x:Le,width:mt,y:Te*Kt,height:(1-Te)*Kt}]])},re.prototype.calcHandlePosition=function(Y){var J=this.attributes.handleIconOffset,fe=this.availableSpace,Te=fe.x,De=fe.y,Le=fe.width,Xe=fe.height,mt=(0,m.CR)(this.clampValues(),2),Kt=mt[0],nn=mt[1],gn=Y==="start"?-J:J,Nn=(Y==="start"?Kt:nn)*this.getOrientVal([Le,Xe])+gn;return{x:Te+this.getOrientVal([Nn,Le/2]),y:De+this.getOrientVal([Xe/2,Nn])}},re.prototype.inferTextStyle=function(Y){var J=this.attributes.orientation;return J==="horizontal"?{}:Y==="start"?{transformOrigin:"left center",transform:"rotate(90)",textAlign:"start"}:Y==="end"?{transformOrigin:"right center",transform:"rotate(90)",textAlign:"end"}:{}},re.prototype.calcHandleText=function(Y){var J,fe=this.attributes,Te=fe.type,De=fe.orientation,Le=fe.formatter,Xe=fe.autoFitLabel,mt=(0,C.zs)(this.attributes,"handle"),Kt=(0,C.zs)(mt,"label"),nn=mt.spacing,gn=this.getHandleSize(),Nn=this.clampValues(),$n=Y==="start"?Nn[0]:Nn[1],Er=Le($n),mr=new Ll.x({style:(0,m.pi)((0,m.pi)((0,m.pi)({},Kt),this.inferTextStyle(Y)),{text:Er})}),ti=mr.getBBox(),jr=ti.width,ui=ti.height;if(mr.destroy(),!Xe){if(Te==="value")return{text:Er,x:0,y:-ui-nn};var gi=nn+gn+(De==="horizontal"?jr/2:0);return J={text:Er},J[De==="horizontal"?"x":"y"]=Y==="start"?-gi:gi,J}var oi=0,ts=0,fs=this.availableSpace,Ds=fs.width,Ba=fs.height,Ka=this.calcSelectionArea()[1],xo=Ka.x,aa=Ka.y,di=Ka.width,Ma=Ka.height,Rs=nn+gn;if(De==="horizontal"){var lo=Rs+jr/2;if(Y==="start"){var Jo=xo-Rs-jr;oi=Jo>0?-lo:lo}else{var zs=Ds-xo-di-Rs>jr;oi=zs?lo:-lo}}else{var Ya=Rs,pa=ui+Rs;Y==="start"?ts=aa-gn>ui?-pa:Ya:ts=Ba-(aa+Ma)-gn>ui?pa:-Ya}return{x:oi,y:ts,text:Er}},re.prototype.getHandleLabelStyle=function(Y){var J=(0,C.zs)(this.attributes,"handleLabel");return(0,m.pi)((0,m.pi)((0,m.pi)({},J),this.calcHandleText(Y)),this.inferTextStyle(Y))},re.prototype.getHandleIconStyle=function(){var Y=this.attributes.handleIconShape,J=(0,C.zs)(this.attributes,"handleIcon"),fe=this.getOrientVal(["ew-resize","ns-resize"]),Te=this.getHandleSize();return(0,m.pi)({cursor:fe,shape:Y,size:Te},J)},re.prototype.getHandleStyle=function(Y){var J=this.attributes,fe=J.x,Te=J.y,De=J.showLabel,Le=J.showLabelOnInteraction,Xe=J.orientation,mt=this.calcHandlePosition(Y),Kt=mt.x,nn=mt.y,gn=this.calcHandleText(Y),Nn=De;return!De&&Le&&(this.target?Nn=!0:Nn=!1),(0,m.pi)((0,m.pi)((0,m.pi)({},(0,C.dq)(this.getHandleIconStyle(),"icon")),(0,C.dq)((0,m.pi)((0,m.pi)({},this.getHandleLabelStyle(Y)),gn),"label")),{transform:"translate(".concat(Kt+fe,", ").concat(nn+Te,")"),orientation:Xe,showLabel:Nn,type:Y,zIndex:3})},re.prototype.getHandleSize=function(){var Y=this.attributes,J=Y.handleIconSize,fe=Y.width,Te=Y.height;return J||Math.floor((this.getOrientVal([+Te,+fe])+4)/2.4)},re.prototype.getOrientVal=function(Y){var J=(0,m.CR)(Y,2),fe=J[0],Te=J[1],De=this.attributes.orientation;return De==="horizontal"?fe:Te},re.prototype.setValuesOffset=function(Y,J){J===void 0&&(J=0);var fe=this.attributes.type,Te=(0,m.CR)(this.getValues(),2),De=Te[0],Le=Te[1],Xe=fe==="range"?Y:0,mt=[De+Xe,Le+J].sort();this.innerSetValues(mt,!0)},re.prototype.getRatio=function(Y){var J=this.availableSpace,fe=J.width,Te=J.height;return Y/this.getOrientVal([fe,Te])},re.prototype.dispatchCustomEvent=function(Y,J,fe){var Te=this;Y.on(J,function(De){De.stopPropagation(),Te.dispatchEvent(new N.Aw(fe,{detail:De}))})},re.prototype.bindEvents=function(){this.addEventListener("wheel",this.onScroll);var Y=this.brushArea;this.dispatchCustomEvent(Y,"click","trackClick"),this.dispatchCustomEvent(Y,"pointerenter","trackMouseenter"),this.dispatchCustomEvent(Y,"pointerleave","trackMouseleave"),Y.on("pointerdown",this.onDragStart("track"))},re.prototype.onScroll=function(Y){var J=this.attributes.scrollable;if(J){var fe=Y.deltaX,Te=Y.deltaY,De=Te||fe,Le=this.getRatio(De);this.setValuesOffset(Le,Le)}},re.tag="slider",re}(V.w),kn=b(92387),kd={backgroundFill:"#262626",backgroundLineCap:"round",backgroundLineWidth:1,backgroundStroke:"#333",backgroundZIndex:-1,formatter:function(oe){return oe.toString()},labelFill:"#fff",labelFontSize:12,labelTextBaseline:"middle",padding:[2,4],position:"right",radius:0,zIndex:999},Yh=(0,vt.A)({background:"background",labelGroup:"label-group",label:"label"},"indicator"),vl=function(oe){(0,m.ZT)(re,oe);function re(Y){var J=oe.call(this,Y,kd)||this;return J.point=[0,0],J.group=J.appendChild(new N.ZA({})),J.isMutationObserved=!0,J}return re.prototype.renderBackground=function(){if(this.label){var Y=this.attributes,J=Y.position,fe=Y.padding,Te=(0,m.CR)((0,Je.j)(fe),4),De=Te[0],Le=Te[1],Xe=Te[2],mt=Te[3],Kt=this.label.node().getLocalBounds(),nn=Kt.min,gn=Kt.max,Nn=new F.b(nn[0]-mt,nn[1]-De,gn[0]+Le-nn[0]+mt,gn[1]+Xe-nn[1]+De),$n=this.getPath(J,Nn),Er=(0,C.zs)(this.attributes,"background");this.background=(0,Fe.Ys)(this.group).maybeAppendByClassName(Yh.background,"path").styles((0,m.pi)((0,m.pi)({},Er),{d:$n})),this.group.appendChild(this.label.node())}},re.prototype.renderLabel=function(){var Y=this.attributes,J=Y.formatter,fe=Y.labelText,Te=(0,C.zs)(this.attributes,"label"),De=(0,m.CR)((0,C.Hm)(Te),2),Le=De[0],Xe=De[1],mt=Le.text,Kt=(0,m._T)(Le,["text"]);if(this.label=(0,Fe.Ys)(this.group).maybeAppendByClassName(Yh.labelGroup,"g").styles(Xe),!!fe){var nn=this.label.maybeAppendByClassName(Yh.label,function(){return(0,Tn.S)(J(fe))}).style("text",J(fe).toString());nn.selectAll("text").styles(Kt)}},re.prototype.adjustLayout=function(){var Y=(0,m.CR)(this.point,2),J=Y[0],fe=Y[1],Te=this.attributes,De=Te.x,Le=Te.y;this.group.attr("transform","translate(".concat(De-J,", ").concat(Le-fe,")"))},re.prototype.getPath=function(Y,J){var fe=this.attributes.radius,Te=J.x,De=J.y,Le=J.width,Xe=J.height,mt=[["M",Te+fe,De],["L",Te+Le-fe,De],["A",fe,fe,0,0,1,Te+Le,De+fe],["L",Te+Le,De+Xe-fe],["A",fe,fe,0,0,1,Te+Le-fe,De+Xe],["L",Te+fe,De+Xe],["A",fe,fe,0,0,1,Te,De+Xe-fe],["L",Te,De+fe],["A",fe,fe,0,0,1,Te+fe,De],["Z"]],Kt={top:4,right:6,bottom:0,left:2},nn=Kt[Y],gn=this.createCorner([mt[nn].slice(-2),mt[nn+1].slice(-2)]);return mt.splice.apply(mt,(0,m.ev)([nn+1,1],(0,m.CR)(gn),!1)),mt[0][0]="M",mt},re.prototype.createCorner=function(Y,J){J===void 0&&(J=10);var fe=.8,Te=ei.wE.apply(void 0,(0,m.ev)([],(0,m.CR)(Y),!1)),De=(0,m.CR)(Y,2),Le=(0,m.CR)(De[0],2),Xe=Le[0],mt=Le[1],Kt=(0,m.CR)(De[1],2),nn=Kt[0],gn=Kt[1],Nn=(0,m.CR)(Te?[nn-Xe,[Xe,nn]]:[gn-mt,[mt,gn]],2),$n=Nn[0],Er=(0,m.CR)(Nn[1],2),mr=Er[0],ti=Er[1],jr=$n/2,ui=$n/Math.abs($n),gi=J*ui,oi=gi/2,ts=gi*Math.sqrt(3)/2*fe,fs=(0,m.CR)([mr,mr+jr-oi,mr+jr,mr+jr+oi,ti],5),Ds=fs[0],Ba=fs[1],Ka=fs[2],xo=fs[3],aa=fs[4];return Te?(this.point=[Ka,mt-ts],[["L",Ds,mt],["L",Ba,mt],["L",Ka,mt-ts],["L",xo,mt],["L",aa,mt]]):(this.point=[Xe+ts,Ka],[["L",Xe,Ds],["L",Xe,Ba],["L",Xe+ts,Ka],["L",Xe,xo],["L",Xe,aa]])},re.prototype.applyVisibility=function(){var Y=this.attributes.visibility;Y==="hidden"?(0,si.Cp)(this):(0,si.$Z)(this)},re.prototype.bindEvents=function(){this.label.on(N.Dk.BOUNDS_CHANGED,this.renderBackground)},re.prototype.render=function(){this.renderLabel(),this.renderBackground(),this.adjustLayout(),this.applyVisibility()},re}(V.w),He=function(oe){(0,m.ZT)(re,oe);function re(Y){var J=oe.call(this,(0,E.n)({},re.defaultOptions,Y))||this;return J.hoverColor="#f5f5f5",J.selectedColor="#e6f7ff",J.background=J.appendChild(new N.UL({})),J.label=J.background.appendChild(new N.ZA({})),J}return Object.defineProperty(re.prototype,"padding",{get:function(){return(0,Je.j)(this.style.padding)},enumerable:!1,configurable:!0}),re.prototype.renderLabel=function(){var Y=this.style,J=Y.label,fe=Y.value,Te=(0,C.zs)(this.attributes,"label");(0,Fe.Ys)(this.label).maybeAppend(".label",function(){return(0,Tn.S)(J)}).attr("className","label").styles(Te),this.label.attr("__data__",fe)},re.prototype.renderBackground=function(){var Y=this.label.getBBox(),J=(0,m.CR)(this.padding,4),fe=J[0],Te=J[1],De=J[2],Le=J[3],Xe=Y.width,mt=Y.height,Kt=Xe+Le+Te,nn=mt+fe+De,gn=(0,C.zs)(this.attributes,"background"),Nn=this.style,$n=Nn.width,Er=$n===void 0?0:$n,mr=Nn.height,ti=mr===void 0?0:mr,jr=Nn.selected;this.background.attr((0,m.pi)((0,m.pi)({},gn),{width:Math.max(Kt,Er),height:Math.max(nn,ti),fill:jr?this.selectedColor:"#fff"})),this.label.attr({transform:"translate(".concat(Le,", ").concat((nn-mt)/2,")")})},re.prototype.render=function(){this.renderLabel(),this.renderBackground()},re.prototype.bindEvents=function(){var Y=this;this.addEventListener("pointerenter",function(){Y.style.selected||Y.background.attr("fill",Y.hoverColor)}),this.addEventListener("pointerleave",function(){Y.style.selected||Y.background.attr("fill",Y.style.backgroundFill)});var J=this;this.addEventListener("click",function(){var fe=Y.style,Te=fe.label,De=fe.value,Le=fe.onClick;Le==null||Le(De,{label:Te,value:De},J)})},re.defaultOptions={style:{value:"",label:"",cursor:"pointer"}},re}(V.w),me=function(oe){(0,m.ZT)(re,oe);function re(Y){var J,fe,Te=oe.call(this,(0,E.n)({},re.defaultOptions,Y))||this;Te.currentValue=(J=re.defaultOptions.style)===null||J===void 0?void 0:J.defaultValue,Te.isPointerInSelect=!1,Te.select=Te.appendChild(new N.UL({className:"select",style:{cursor:"pointer",width:0,height:0}})),Te.dropdown=Te.appendChild(new N.UL({className:"dropdown"}));var De=Te.style.defaultValue;return De&&(!((fe=Te.style.options)===null||fe===void 0)&&fe.some(function(Le){return Le.value===De}))&&(Te.currentValue=De),Te}return re.prototype.setValue=function(Y){this.currentValue=Y,this.render()},re.prototype.getValue=function(){return this.currentValue},Object.defineProperty(re.prototype,"dropdownPadding",{get:function(){return(0,Je.j)(this.style.dropdownPadding)},enumerable:!1,configurable:!0}),re.prototype.renderSelect=function(){var Y=this,J,fe=this.style,Te=fe.x,De=fe.y,Le=fe.width,Xe=fe.height,mt=fe.bordered,Kt=fe.showDropdownIcon,nn=(0,C.zs)(this.attributes,"select"),gn=(0,C.zs)(this.attributes,"placeholder");this.select.attr((0,m.pi)((0,m.pi)({x:Te,y:De,width:Le,height:Xe},nn),{fill:"#fff",strokeWidth:mt?1:0}));var Nn=this.dropdownPadding,$n=10;Kt&&(0,Fe.Ys)(this.select).maybeAppend(".dropdown-icon","path").style("d","M-5,-3.5 L0,3.5 L5,-3.5").style("transform","translate(".concat(Te+Le-$n-Nn[1]-Nn[3],", ").concat(De+Xe/2,")")).style("lineWidth",1).style("stroke",this.select.style.stroke);var Er=(J=this.style.options)===null||J===void 0?void 0:J.find(function(ui){return ui.value===Y.currentValue}),mr=(0,m.pi)({x:Te+Nn[3]},gn);(0,Fe.Ys)(this.select).selectAll(".placeholder").data(Er?[]:[1]).join(function(ui){return ui.append("text").attr("className","placeholder").styles(mr).style("y",function(){var gi=this.getBBox();return De+(Xe-gi.height)/2})},function(ui){return ui.styles(mr)},function(ui){return ui.remove()});var ti=(0,C.zs)(this.attributes,"optionLabel"),jr=(0,m.pi)({x:Te+Nn[3]},ti);(0,Fe.Ys)(this.select).selectAll(".value").data(Er?[Er]:[]).join(function(ui){return ui.append(function(gi){return(0,Tn.S)(gi.label)}).attr("className","value").styles(jr).style("y",function(){var gi=this.getBBox();return De+(Xe-gi.height)/2})},function(ui){return ui.styles(jr)},function(ui){return ui.remove()})},re.prototype.renderDropdown=function(){var Y=this,J,fe,Te=this.style,De=Te.x,Le=Te.y,Xe=Te.width,mt=Te.height,Kt=Te.options,nn=Te.onSelect,gn=Te.open,Nn=(0,C.zs)(this.attributes,"dropdown"),$n=(0,C.zs)(this.attributes,"option"),Er=this.dropdownPadding;(0,Fe.Ys)(this.dropdown).maybeAppend(".dropdown-container","g").attr("className","dropdown-container").selectAll(".dropdown-item").data(Kt,function(jr){return jr.value}).join(function(jr){return jr.append(function(ui){return new He({className:"dropdown-item",style:(0,m.pi)((0,m.pi)((0,m.pi)({},ui),$n),{width:Xe-Er[1]-Er[3],selected:ui.value===Y.currentValue,onClick:function(gi,oi,ts){Y.setValue(gi),nn==null||nn(gi,oi,ts),Y.dispatchEvent(new N.Aw("change",{detail:{value:gi,option:oi,item:ts}})),(0,si.Cp)(Y.dropdown)}})})}).each(function(ui,gi){var oi,ts=(oi=this.parentNode)===null||oi===void 0?void 0:oi.children,fs=ts.reduce(function(Ds,Ba,Ka){return Ka<gi&&(Ds+=Ba.getBBox().height),Ds},0);this.attr("transform","translate(".concat(Er[3],", ").concat(Er[0]+fs,")"))})},function(jr){return jr.update(function(ui){return{selected:ui.value===Y.currentValue}})},function(jr){return jr.remove()});var mr=(fe=(J=this.dropdown.getElementsByClassName("dropdown-container"))===null||J===void 0?void 0:J[0])===null||fe===void 0?void 0:fe.getBBox(),ti=Nn.spacing;this.dropdown.attr((0,m.pi)({transform:"translate(".concat(De,", ").concat(Le+mt+ti,")"),width:mr.width+Er[1]+Er[3],height:mr.height+Er[0]+Er[2]},Nn)),!gn&&(0,si.Cp)(this.dropdown)},re.prototype.render=function(){this.renderSelect(),this.renderDropdown()},re.prototype.bindEvents=function(){var Y=this;this.addEventListener("click",function(J){J.stopPropagation()}),this.select.addEventListener("click",function(){Y.dropdown.style.visibility==="visible"?(0,si.Cp)(Y.dropdown):(0,si.$Z)(Y.dropdown)}),this.addEventListener("pointerenter",function(){Y.isPointerInSelect=!0}),this.addEventListener("pointerleave",function(){Y.isPointerInSelect=!1}),document==null||document.addEventListener("click",function(){Y.isPointerInSelect||(0,si.Cp)(Y.dropdown)})},re.defaultOptions={style:{x:0,y:0,width:140,height:32,options:[],bordered:!0,defaultValue:"",selectRadius:8,selectStroke:"#d9d9d9",showDropdownIcon:!0,placeholderText:"\u8BF7\u9009\u62E9",placeholderFontSize:12,placeholderTextBaseline:"top",placeholderFill:"#c2c2c2",dropdownFill:"#fff",dropdownStroke:"#d9d9d9",dropdownRadius:8,dropdownShadowBlur:4,dropdownShadowColor:"rgba(0, 0, 0, 0.08)",dropdownPadding:8,dropdownSpacing:10,optionPadding:[8,12],optionFontSize:12,optionTextBaseline:"top",optionBackgroundFill:"#fff",optionBackgroundRadius:4,optionLabelFontSize:12,optionLabelTextBaseline:"top"}},re}(V.w),ce=function(oe){(0,m.ZT)(re,oe);function re(Y){var J=oe.call(this,(0,E.n)({},{style:{backgroundOpacity:re.backgroundOpacities.default}},re.defaultOptions,Y))||this;return J.showBackground=!0,J.background=J.appendChild(new N.UL({})),J.icon=J.appendChild(new N.ZA({})),J}return Object.defineProperty(re.prototype,"label",{get:function(){return"BaseIcon"},enumerable:!1,configurable:!0}),Object.defineProperty(re.prototype,"lineWidth",{get:function(){return Math.log10(this.attributes.size)},enumerable:!1,configurable:!0}),Object.defineProperty(re.prototype,"padding",{get:function(){return(0,Je.j)(this.attributes.size/5)},enumerable:!1,configurable:!0}),Object.defineProperty(re.prototype,"iconSize",{get:function(){var Y=this.attributes.size,J=(0,m.CR)(this.padding,4),fe=J[0],Te=J[1],De=J[2],Le=J[3];return Math.max(Y-Math.max(Le+Te,fe+De),this.lineWidth*2+1)},enumerable:!1,configurable:!0}),re.prototype.renderBackground=function(){var Y=this.attributes,J=Y.x,fe=Y.y,Te=Y.size,De=Te/2,Le=(0,C.zs)(this.attributes,"background");this.background.attr((0,m.pi)({x:J-De,y:fe-De,width:Te,height:Te},Le))},re.prototype.showIndicator=function(){if(this.label){var Y=this.attributes.size,J=this.background.getBBox(),fe=J.x,Te=J.y;this.indicator.update({x:fe+Y/2,y:Te-5,labelText:this.label,visibility:"visible"})}},re.prototype.hideIndicator=function(){this.indicator.update({visibility:"hidden"})},re.prototype.connectedCallback=function(){var Y;oe.prototype.connectedCallback.call(this);var J=this.attributes.size,fe=this.background.getBBox(),Te=fe.x,De=fe.y,Le=(Y=this.ownerDocument)===null||Y===void 0?void 0:Y.defaultView;Le&&(this.indicator=Le.appendChild(new vl({style:{x:Te+J/2,y:De-J/2,visibility:"hidden",position:"top",radius:3,zIndex:100}})))},re.prototype.disconnectedCallback=function(){this.indicator.destroy()},re.prototype.render=function(){this.renderIcon(),this.showBackground&&this.renderBackground()},re.prototype.bindEvents=function(){var Y=this,J=this.attributes.onClick;if(this.addEventListener("click",function(){J==null||J(Y)}),this.showBackground){var fe=function(){return Y.background.attr({opacity:re.backgroundOpacities.default})},Te=function(){return Y.background.attr({opacity:re.backgroundOpacities.hover})},De=function(){return Y.background.attr({opacity:re.backgroundOpacities.active})};this.addEventListener("pointerenter",function(){Te(),Y.showIndicator()}),this.addEventListener("pointerleave",function(){fe(),Y.hideIndicator()}),this.addEventListener("pointerdown",function(){De()}),this.addEventListener("pointerup",function(){fe()})}},re.tag="IconBase",re.defaultOptions={style:{x:0,y:0,size:10,color:"#565758",backgroundRadius:4,backgroundFill:"#e2e2e2"}},re.backgroundOpacities={default:0,hover:.8,active:1},re}(V.w),Ze=function(oe,re){return re===void 0&&(re="#565758"),new N.y$({style:{fill:re,d:"M ".concat(oe,",").concat(oe," L -").concat(oe,",0 L ").concat(oe,",-").concat(oe," Z"),transformOrigin:"center"}})},le=function(oe){(0,m.ZT)(re,oe);function re(){return oe!==null&&oe.apply(this,arguments)||this}return re.prototype.arcPath=function(Y,J,fe){var Te=(0,m.CR)([fe,fe],2),De=Te[0],Le=Te[1],Xe=function(Er){return[Y+fe*Math.cos(Er),J+fe*Math.sin(Er)]},mt=(0,m.CR)(Xe(-5/4*Math.PI),2),Kt=mt[0],nn=mt[1],gn=(0,m.CR)(Xe(1/4*Math.PI),2),Nn=gn[0],$n=gn[1];return"M".concat(Kt,",").concat(nn,",A").concat(De,",").concat(Le,",0,1,1,").concat(Nn,",").concat($n)},Object.defineProperty(re.prototype,"label",{get:function(){return"\u91CD\u7F6E"},enumerable:!1,configurable:!0}),re.prototype.renderIcon=function(){var Y=this.attributes,J=Y.x,fe=Y.y,Te=Y.color,De=this.iconSize,Le=this.lineWidth,Xe=Le+.5;(0,Fe.Ys)(this.icon).maybeAppend(".reset","path").styles({stroke:Te,lineWidth:Le,d:this.arcPath(J,fe,De/2-Le),markerStart:Ze(Xe,Te)})},re}(ce),Nt=function(oe){(0,m.ZT)(re,oe);function re(){return oe!==null&&oe.apply(this,arguments)||this}return Object.defineProperty(re.prototype,"label",{get:function(){return"\u5FEB\u9000"},enumerable:!1,configurable:!0}),re.prototype.renderIcon=function(){var Y=this.attributes,J=Y.x,fe=Y.y,Te=Y.color,De=this.iconSize,Le=De/2,Xe=De/2/Math.pow(3,.5),mt=[[J,fe],[J,fe-Xe],[J-Le,fe],[J,fe+Xe],[J,fe],[J+Le,fe-Xe],[J+Le,fe+Xe],[J,fe]];(0,Fe.Ys)(this.icon).maybeAppend(".backward","polygon").styles({points:mt,fill:Te})},re}(ce),Dt=function(oe){(0,m.ZT)(re,oe);function re(){return oe!==null&&oe.apply(this,arguments)||this}return Object.defineProperty(re.prototype,"label",{get:function(){return"\u5FEB\u8FDB"},enumerable:!1,configurable:!0}),re.prototype.renderIcon=function(){var Y=this.attributes,J=Y.x,fe=Y.y,Te=Y.color,De=this.iconSize,Le=De/2,Xe=De/2/Math.pow(3,.5),mt=[[J,fe],[J,fe-Xe],[J+Le,fe],[J,fe+Xe],[J,fe],[J-Le,fe-Xe],[J-Le,fe+Xe],[J,fe]];(0,Fe.Ys)(this.icon).maybeAppend(".forward","polygon").styles({points:mt,fill:Te})},re}(ce),pn=function(oe){(0,m.ZT)(re,oe);function re(){return oe!==null&&oe.apply(this,arguments)||this}return Object.defineProperty(re.prototype,"label",{get:function(){return"\u64AD\u653E"},enumerable:!1,configurable:!0}),re.prototype.renderIcon=function(){var Y=this.attributes,J=Y.x,fe=Y.y,Te=Y.color,De=this.iconSize,Le=De/3*Math.pow(3,.5)*.8,Xe=[[J+Le,fe],[J-Le/2,fe-De/2*.8],[J-Le/2,fe+De/2*.8],[J+Le,fe]];(0,Fe.Ys)(this.icon).maybeAppend(".play","polygon").styles({points:Xe,fill:Te})},re}(ce),Dn=function(oe){(0,m.ZT)(re,oe);function re(){return oe!==null&&oe.apply(this,arguments)||this}return Object.defineProperty(re.prototype,"label",{get:function(){return"\u6682\u505C"},enumerable:!1,configurable:!0}),re.prototype.renderIcon=function(){var Y=this.attributes,J=Y.x,fe=Y.y,Te=Y.color,De=this.iconSize,Le=De/3,Xe=[[J-Le,fe-De/2],[J-Le,fe+De/2],[J-Le/2,fe+De/2],[J-Le/2,fe-De/2],[J-Le,fe-De/2],[J+Le/2,fe-De/2],[J+Le/2,fe+De/2],[J+Le,fe+De/2],[J+Le,fe-De/2]];(0,Fe.Ys)(this.icon).maybeAppend(".pause","polygon").styles({points:Xe,fill:Te})},re}(ce),hr=function(oe){(0,m.ZT)(re,oe);function re(){return oe!==null&&oe.apply(this,arguments)||this}return Object.defineProperty(re.prototype,"label",{get:function(){return"\u8303\u56F4\u65F6\u95F4"},enumerable:!1,configurable:!0}),re.prototype.renderIcon=function(){var Y=this.attributes,J=Y.x,fe=Y.y,Te=Y.color,De=this,Le=De.iconSize,Xe=De.lineWidth,mt=Xe;(0,Fe.Ys)(this.icon).maybeAppend(".left-line","line").styles({x1:J-Le/2,y1:fe-Le/2,x2:J-Le/2,y2:fe+Le/2,stroke:Te,lineWidth:Xe}),(0,Fe.Ys)(this.icon).maybeAppend(".right-line","line").styles({x1:J+Le/2,y1:fe-Le/2,x2:J+Le/2,y2:fe+Le/2,stroke:Te,lineWidth:Xe}),(0,Fe.Ys)(this.icon).maybeAppend(".left-arrow","line").styles({x1:J,y1:fe,x2:J-Le/2+mt*2,y2:fe,stroke:Te,lineWidth:Xe,markerEnd:Ze(Xe*2,Te)}),(0,Fe.Ys)(this.icon).maybeAppend(".right-arrow","line").styles({x1:J,y1:fe,x2:J+Le/2-mt*2,y2:fe,stroke:Te,lineWidth:Xe,markerEnd:Ze(Xe*2,Te)})},re}(ce),br=function(oe){(0,m.ZT)(re,oe);function re(){return oe!==null&&oe.apply(this,arguments)||this}return Object.defineProperty(re.prototype,"label",{get:function(){return"\u5355\u4E00\u65F6\u95F4"},enumerable:!1,configurable:!0}),re.prototype.renderIcon=function(){var Y=this.attributes,J=Y.x,fe=Y.y,Te=Y.color,De=this,Le=De.iconSize,Xe=De.lineWidth;(0,Fe.Ys)(this.icon).maybeAppend(".line","line").styles({x1:J,y1:fe-Le/2,x2:J,y2:fe+Le/2,stroke:Te,lineWidth:Xe});var mt=Xe;(0,Fe.Ys)(this.icon).maybeAppend(".left-arrow","line").styles({x1:J-Le/2-mt*2,y1:fe,x2:J-mt*2,y2:fe,stroke:Te,lineWidth:Xe,markerEnd:Ze(Xe*2,Te)}),(0,Fe.Ys)(this.icon).maybeAppend(".right-arrow","line").styles({x1:J+Le/2+mt*2,y1:fe,x2:J+mt*2,y2:fe,stroke:Te,lineWidth:Xe,markerEnd:Ze(Xe*2,Te)})},re}(ce),yr=function(oe){return[[-oe/2,-oe/2],[-oe/2,oe/2],[oe/2,oe/2]]},xr=function(oe){(0,m.ZT)(re,oe);function re(){return oe!==null&&oe.apply(this,arguments)||this}return Object.defineProperty(re.prototype,"label",{get:function(){return"\u6298\u7EBF\u56FE"},enumerable:!1,configurable:!0}),re.prototype.renderIcon=function(){var Y=this.attributes,J=Y.x,fe=Y.y,Te=Y.color,De=this,Le=De.iconSize,Xe=De.lineWidth,mt=Xe,Kt=(Le-mt*2-Xe)/4,nn=(Le-mt*2-Xe)/2,gn=(0,m.CR)([J-Le/2+mt,fe+Le/2-mt*2],2),Nn=gn[0],$n=gn[1];(0,Fe.Ys)(this.icon).maybeAppend(".coordinate","polyline").styles({points:yr(Le).map(function(Er){var mr=(0,m.CR)(Er,2),ti=mr[0],jr=mr[1];return[ti+J,jr+fe]}),stroke:Te,lineWidth:Xe}),(0,Fe.Ys)(this.icon).maybeAppend(".line","polyline").styles({points:[[Nn,$n],[Nn+Kt,$n-nn],[Nn+Kt*2,$n],[Nn+Kt*4,$n-nn*2]],stroke:Te,lineWidth:Xe})},re}(ce),Fr=function(oe){(0,m.ZT)(re,oe);function re(){return oe!==null&&oe.apply(this,arguments)||this}return Object.defineProperty(re.prototype,"label",{get:function(){return"\u6761\u5F62\u56FE"},enumerable:!1,configurable:!0}),Object.defineProperty(re.prototype,"data",{get:function(){return[1,4,2,4,3]},enumerable:!1,configurable:!0}),re.prototype.renderIcon=function(){var Y=this.data,J=this.attributes,fe=J.x,Te=J.y,De=J.color,Le=this,Xe=Le.iconSize,mt=Le.lineWidth,Kt=mt,nn=(Xe-Kt)/Y.length,gn=(Xe-Kt*2)/4,Nn=(0,m.CR)([fe-Xe/2+Kt*2,Te+Xe/2-Kt],2),$n=Nn[0],Er=Nn[1];(0,Fe.Ys)(this.icon).maybeAppend(".coordinate","polyline").styles({points:yr(Xe).map(function(mr){var ti=(0,m.CR)(mr,2),jr=ti[0],ui=ti[1];return[jr+fe,ui+Te]}),stroke:De,lineWidth:mt}),(0,Fe.Ys)(this.icon).maybeAppend(".bars","g").selectAll(".column").data(this.data.map(function(mr,ti){return{value:mr,index:ti}})).join(function(mr){return mr.append("line").attr("className","column").style("x1",function(ti){var jr=ti.index;return $n+nn*jr}).style("y1",Er).style("x2",function(ti){var jr=ti.index;return $n+nn*jr}).style("y2",function(ti){var jr=ti.value;return Er-gn*jr}).styles({y1:Er,stroke:De,lineWidth:mt})})},re}(ce),ri=function(oe){(0,m.ZT)(re,oe);function re(Y){var J=oe.call(this,(0,E.n)({},{style:{color:"#d8d9d9"}},Y))||this;return J.showBackground=!1,J}return re.prototype.renderIcon=function(){var Y=this.attributes,J=Y.x,fe=Y.y,Te=Y.color,De=this,Le=De.iconSize,Xe=De.lineWidth;(0,Fe.Ys)(this.icon).maybeAppend(".split","line").styles({x1:J,y1:fe-Le/2,x2:J,y2:fe+Le/2,stroke:Te,lineWidth:Xe})},re}(ce),ai=function(oe){(0,m.ZT)(re,oe);function re(){var Y=oe.apply(this,(0,m.ev)([],(0,m.CR)(arguments),!1))||this;return Y.showBackground=!1,Y}return Object.defineProperty(re.prototype,"padding",{get:function(){return(0,Je.j)(0)},enumerable:!1,configurable:!0}),re.prototype.renderIcon=function(){var Y=this.iconSize,J=this.attributes,fe=J.x,Te=J.y,De=J.speed,Le=De===void 0?1:De,Xe=(0,kn.Z)(this.attributes,["x","y","transform","transformOrigin","width","height","size","color","speed"]),mt=(0,Z.Z)(Y,20,1/0),Kt=20,nn=(0,m.pi)((0,m.pi)({},Xe),{x:fe-mt/2,y:Te-Kt/2,width:mt,height:Kt,defaultValue:Le,bordered:!1,showDropdownIcon:!1,selectRadius:2,dropdownPadding:this.padding,dropdownRadius:2,dropdownSpacing:Y/5,placeholderFontSize:Y/2,optionPadding:0,optionLabelFontSize:Y/2,optionBackgroundRadius:1,options:[{label:"1x",value:1},{label:"1.5x",value:1.5},{label:"2x",value:2}]});(0,Fe.Ys)(this.icon).maybeAppend(".speed",function(){return new me({style:nn})}).attr("className","speed").each(function(){this.update(nn)})},re.tag="SpeedSelect",re}(ce),wi=function(oe){(0,m.ZT)(re,oe);function re(Y){var J=oe.call(this,Y)||this;return J.icon=J.appendChild(new N.ZA({})),J.currentType=J.attributes.type,J}return re.prototype.getType=function(){return this.currentType},re.prototype.render=function(){var Y=this,J=this.attributes,fe=J.onChange,Te=(0,m._T)(J,["onChange"]);(0,Fe.Ys)(this.icon).selectAll(".icon").data([this.currentType]).join(function(De){return De.append(function(Le){var Xe,mt=(Xe=Y.toggles.find(function(Kt){var nn=(0,m.CR)(Kt,1),gn=nn[0];return gn===Le}))===null||Xe===void 0?void 0:Xe[1];if(!mt)throw new Error("Invalid type: ".concat(Le));return new mt({})}).attr("className","icon").styles(Te,!1).update({})},function(De){return De.styles({restStyles:Te}).update({})},function(De){return De.remove()})},re.prototype.bindEvents=function(){var Y=this,J=this.attributes.onChange;this.addEventListener("click",function(fe){fe.preventDefault(),fe.stopPropagation();var Te=(Y.toggles.findIndex(function(Le){var Xe=(0,m.CR)(Le,1),mt=Xe[0];return mt===Y.currentType})+1)%Y.toggles.length,De=Y.toggles[Te][0];J==null||J(Y.currentType),Y.currentType=De,Y.render()})},re.tag="ToggleIcon",re}(V.w),Vi=function(oe){(0,m.ZT)(re,oe);function re(Y){var J=oe.call(this,(0,E.n)({},{style:{type:"play"}},Y))||this;return J.toggles=[["play",pn],["pause",Dn]],J}return re}(wi),rs=function(oe){(0,m.ZT)(re,oe);function re(Y){var J=oe.call(this,(0,E.n)({},{style:{type:"range"}},Y))||this;return J.toggles=[["range",hr],["value",br]],J}return re}(wi),as=function(oe){(0,m.ZT)(re,oe);function re(Y){var J=oe.call(this,(0,E.n)({},{style:{type:"column"}},Y))||this;return J.toggles=[["line",xr],["column",Fr]],J}return re}(wi),Bs={reset:le,speed:ai,backward:Nt,playPause:Vi,forward:Dt,selectionType:rs,chartType:as,split:ri},Ls=function(oe){(0,m.ZT)(re,oe);function re(Y){var J=oe.call(this,(0,E.n)({},re.defaultOptions,Y))||this;return J.background=J.appendChild(new N.UL({})),J.functions=J.appendChild(new N.ZA({})),J}return Object.defineProperty(re.prototype,"padding",{get:function(){return(0,Je.j)(this.attributes.padding)},enumerable:!1,configurable:!0}),re.prototype.renderBackground=function(){var Y=this.style,J=Y.x,fe=Y.y,Te=Y.width,De=Y.height,Le=(0,C.zs)(this.attributes,"background");this.background.attr((0,m.pi)({x:J,y:fe,width:Te,height:De},Le))},re.prototype.renderFunctions=function(){var Y=this,J,fe=this.attributes,Te=fe.functions,De=fe.iconSize,Le=fe.iconSpacing,Xe=fe.x,mt=fe.y,Kt=fe.width,nn=fe.height,gn=fe.align,Nn=(0,m.CR)(this.padding,4),$n=Nn[1],Er=Nn[3],mr=Te.reduce(function(ui,gi){return ui.length&&gi.length?ui.concat.apply(ui,(0,m.ev)(["split"],(0,m.CR)(gi),!1)):ui.concat.apply(ui,(0,m.ev)([],(0,m.CR)(gi),!1))},[]),ti=mr.length*(De+Le)-Le,jr={left:Er+De/2,center:(Kt-ti)/2+De/2,right:Kt-ti-Er-$n+De/2}[gn]||0;(J=this.speedSelect)===null||J===void 0||J.destroy(),this.functions.removeChildren(),mr.forEach(function(ui,gi){var oi,ts=Bs[ui],fs={x:Xe+gi*(De+Le)+jr,y:mt+nn/2,size:De};if(ts===ai?(fs.speed=Y.attributes.speed,fs.onSelect=function(Ba){return Y.handleFunctionChange(ui,{value:Ba})}):[Vi,rs,as].includes(ts)?(fs.onChange=function(Ba){return Y.handleFunctionChange(ui,{value:Ba})},ts===Vi&&(fs.type=Y.attributes.state==="play"?"pause":"play"),ts===rs&&(fs.type=Y.attributes.selectionType==="range"?"value":"range"),ts===as&&(fs.type=Y.attributes.chartType==="line"?"column":"line")):fs.onClick=function(){return Y.handleFunctionChange(ui,{value:ui})},ts===ai){var Ds=(oi=Y.ownerDocument)===null||oi===void 0?void 0:oi.defaultView;Ds&&(Y.speedSelect=new ts({style:(0,m.pi)((0,m.pi)({},fs),{zIndex:100})}),Ds.appendChild(Y.speedSelect))}else Y.functions.appendChild(new ts({style:fs}))})},re.prototype.disconnectedCallback=function(){var Y;oe.prototype.disconnectedCallback.call(this),(Y=this.speedSelect)===null||Y===void 0||Y.destroy()},re.prototype.render=function(){this.renderBackground(),this.renderFunctions()},re.prototype.handleFunctionChange=function(Y,J){var fe=this.attributes.onChange;fe==null||fe(Y,J)},re.defaultOptions={style:{x:0,y:0,width:300,height:40,padding:0,align:"center",iconSize:25,iconSpacing:0,speed:1,state:"pause",chartType:"line",selectionType:"range",backgroundFill:"#fbfdff",backgroundStroke:"#ebedf0",functions:[["reset","speed"],["backward","playPause","forward"],["selectionType","chartType"]]}},re}(V.w),zi=function(oe){(0,m.ZT)(re,oe);function re(Y){var J=oe.call(this,(0,E.n)({},re.defaultOptions,Y))||this;return J.bindEvents(),J}return re.prototype.bindEvents=function(){var Y=this;this.addEventListener("mouseenter",function(){Y.attr("lineWidth",Math.ceil(+(Y.style.r||0)/2))}),this.addEventListener("mouseleave",function(){Y.attr("lineWidth",0)})},re.defaultOptions={style:{r:5,fill:"#3f7cf7",lineWidth:0,stroke:"#3f7cf7",strokeOpacity:.5,cursor:"pointer"}},re}(N.Cd),Ni=function(oe){(0,m.ZT)(re,oe);function re(Y){return oe.call(this,(0,E.n)({},re.defaultOptions,Y))||this}return re.prototype.renderBackground=function(){var Y=this.attributes,J=Y.x,fe=Y.y,Te=Y.width,De=Y.height,Le=(0,C.zs)(this.attributes,"background");(0,Fe.Ys)(this).maybeAppend("background","rect").attr("className","background").styles((0,m.pi)({x:J-Te/2,y:fe-De/2,width:Te,height:De},Le))},re.prototype.renderIcon=function(){var Y=this.attributes,J=Y.x,fe=Y.y,Te=Y.iconSize,De=(0,C.zs)(this.attributes,"icon"),Le=1,Xe=Te/2;(0,Fe.Ys)(this).maybeAppend("icon-left-line","line").attr("className","icon-left-line").styles((0,m.pi)({x1:J-Le,y1:fe-Xe,x2:J-Le,y2:fe+Xe},De)),(0,Fe.Ys)(this).maybeAppend("icon-right-line","line").attr("className","icon-right-line").styles((0,m.pi)({x1:J+Le,y1:fe-Xe,x2:J+Le,y2:fe+Xe},De))},re.prototype.renderBorder=function(){var Y=this.attributes,J=Y.x,fe=Y.y,Te=Y.width,De=Y.height,Le=Y.type,Xe=(0,C.zs)(this.attributes,"border"),mt=Le==="start"?+Te/2:-Te/2;(0,Fe.Ys)(this).maybeAppend("border","line").attr("className","border").styles((0,m.pi)({x1:mt+J,y1:fe-De/2,x2:mt+J,y2:fe+De/2},Xe))},re.prototype.render=function(){this.renderBackground(),this.renderIcon(),this.renderBorder()},re.defaultOptions={style:{x:0,y:0,width:10,height:50,iconSize:10,type:"start",backgroundFill:"#fff",backgroundFillOpacity:.5,iconStroke:"#9a9a9a",iconLineWidth:1,borderStroke:"#e8e8e8",borderLineWidth:1}},re}(V.w);function Ns(oe,re){return typeof oe=="number"?_a(oe):Os(oe,re)}function Os(oe,re){var Y=new Date(oe);switch(re){case"half-hour":case"hour":case"four-hour":return[0,6,12,18].includes(Y.getHours())&&Y.getMinutes()===0?j(Y,`HH:mm
YYYY-MM-DD`):j(Y,"HH:mm");case"half-day":return Y.getHours()<12?`AM
`.concat(j(Y,"YYYY-MM-DD")):"PM";case"day":return[1,10,20].includes(Y.getDate())?j(Y,`DD
YYYY-MM`):j(Y,"DD");case"week":return Y.getDate()<=7?j(Y,`DD
YYYY-MM`):j(Y,"DD");case"month":return[0,6].includes(Y.getMonth())?j(Y,`MM\u6708
YYYY`):j(Y,"MM\u6708");case"season":return[0].includes(Y.getMonth())?j(Y,`MM\u6708
YYYY`):j(Y,"MM\u6708");case"year":return j(Y,"YYYY");default:return j(Y,"YYYY-MM-DD HH:mm")}}function _a(oe){var re=String(Math.floor(oe/3600)).padStart(2,"0"),Y=String(Math.floor(oe%3600/60)).padStart(2,"0"),J=String(Math.floor(oe%60)).padStart(2,"0");return oe<3600?"".concat(Y,":").concat(J):"".concat(re,":").concat(Y,":").concat(J)}var Sa=function(oe){(0,m.ZT)(re,oe);function re(Y){var J=oe.call(this,(0,E.n)({},re.defaultOptions,Y))||this;J.axis=J.appendChild(new go({style:{type:"linear",startPos:[0,0],endPos:[0,0],data:[],showArrow:!1,animate:!1}})),J.timeline=J.appendChild(new Du({style:{onChange:function(nn){J.handleSliderChange(nn)}}})),J.controller=J.appendChild(new Ls({})),J.states={},J.handleSliderChange=function(nn){var gn=function(){var Nn=J.states.values;return Array.isArray(Nn)?(0,m.ev)([],(0,m.CR)(Nn),!1):Nn}();J.setBySliderValues(nn),J.dispatchOnChange(gn)};var fe=J.attributes,Te=fe.selectionType,De=fe.chartType,Le=fe.speed,Xe=fe.state,mt=fe.playMode,Kt=fe.values;return J.states={chartType:De,playMode:mt,selectionType:Te,speed:Le,state:Xe},J.setByTimebarValues(Kt),J}return Object.defineProperty(re.prototype,"data",{get:function(){var Y=this.attributes.data,J=function(fe,Te){return fe.time<Te.time?-1:fe.time>Te.time?1:0};return Y.sort(J)},enumerable:!1,configurable:!0}),Object.defineProperty(re.prototype,"space",{get:function(){var Y=this.attributes,J=Y.x,fe=Y.y,Te=Y.width,De=Y.height,Le=Y.type,Xe=Y.controllerHeight,mt=(0,Z.Z)(+De-Xe,0,+De),Kt=new F.b(J,fe+ +De-Xe,+Te,Xe),nn,gn=0;Le==="chart"?(gn=35,nn=new F.b(J,fe+mt-gn,+Te,gn)):nn=new F.b;var Nn=Le==="time"?10:mt,$n=new F.b(J,fe+(Le==="time"?mt:mt-Nn),+Te,Nn-gn);return{axisBBox:nn,controllerBBox:Kt,timelineBBox:$n}},enumerable:!1,configurable:!0}),re.prototype.setBySliderValues=function(Y){var J,fe,Te=this.data,De=(0,m.CR)(Array.isArray(Y)?Y:[0,Y],2),Le=De[0],Xe=De[1],mt=Te.length,Kt=Te[Math.floor(Le*mt)],nn=Te[Math.ceil(Xe*mt)-(Array.isArray(Y)?0:1)];this.states.values=[(J=Kt==null?void 0:Kt.time)!==null&&J!==void 0?J:Te[0].time,(fe=nn==null?void 0:nn.time)!==null&&fe!==void 0?fe:1/0]},re.prototype.setByTimebarValues=function(Y){var J,fe,Te,De=this.data,Le=(0,m.CR)(Array.isArray(Y)?Y:[void 0,Y],2),Xe=Le[0],mt=Le[1],Kt=De.find(function(gn){var Nn=gn.time;return Nn===Xe}),nn=De.find(function(gn){var Nn=gn.time;return Nn===mt});this.states.values=[(J=Kt==null?void 0:Kt.time)!==null&&J!==void 0?J:(fe=De[0])===null||fe===void 0?void 0:fe.time,(Te=nn==null?void 0:nn.time)!==null&&Te!==void 0?Te:1/0]},re.prototype.setByIndex=function(Y){var J,fe,Te,De,Le=this.data,Xe=(0,m.CR)(Y,2),mt=Xe[0],Kt=Xe[1];this.states.values=[(fe=(J=Le[mt])===null||J===void 0?void 0:J.time)!==null&&fe!==void 0?fe:Le[0].time,(De=(Te=this.data[Kt])===null||Te===void 0?void 0:Te.time)!==null&&De!==void 0?De:1/0]},Object.defineProperty(re.prototype,"sliderValues",{get:function(){var Y=this.states,J=Y.values,fe=Y.selectionType,Te=(0,m.CR)(Array.isArray(J)?J:[void 0,J],2),De=Te[0],Le=Te[1],Xe=this.data,mt=Xe.length,Kt=fe==="value",nn=function(){var Nn=Xe.findIndex(function($n){var Er=$n.time;return Er===De});return Kt?0:Nn>-1?Nn/mt:0},gn=function(){if(Le===1/0)return 1;var Nn=Xe.findIndex(function($n){var Er=$n.time;return Er===Le});return Nn>-1?Nn/mt:Kt?.5:1};return[nn(),gn()]},enumerable:!1,configurable:!0}),Object.defineProperty(re.prototype,"values",{get:function(){var Y=this.states,J=Y.values,fe=Y.selectionType,Te=(0,m.CR)(Array.isArray(J)?J:[this.data[0].time,J],2),De=Te[0],Le=Te[1];return fe==="value"?Le:[De,Le]},enumerable:!1,configurable:!0}),re.prototype.getDatumByRatio=function(Y){var J=this.data,fe=J.length,Te=Math.floor(Y*(fe-1));return J[Te]},Object.defineProperty(re.prototype,"chartHandleIconShape",{get:function(){var Y=this.states.selectionType,J=this.space.timelineBBox.height;return Y==="range"?function(fe){return new Ni({style:{type:fe,height:J,iconSize:J/6}})}:function(){return new N.x1({style:{x1:0,y1:-J/2,x2:0,y2:J/2,lineWidth:2,stroke:"#c8c8c8"}})}},enumerable:!1,configurable:!0}),re.prototype.getChartStyle=function(Y){var J=this,fe=Y.x,Te=Y.y,De=Y.width,Le=Y.height,Xe=this.states,mt=Xe.selectionType,Kt=Xe.chartType,nn=this.data,gn=this.attributes,Nn=gn.type,$n=gn.labelFormatter,Er=(0,C.zs)(this.attributes,"chart"),mr=Er.type,ti=(0,m._T)(Er,["type"]),jr=mt==="range";if(Nn==="time")return(0,m.pi)({handleIconShape:function(){return new zi({})},selectionFill:"#2e7ff8",selectionFillOpacity:1,showLabelOnInteraction:!0,handleLabelDy:jr?-15:0,autoFitLabel:jr,handleSpacing:jr?-15:0,trackFill:"#edeeef",trackLength:De,trackOpacity:.5,trackRadius:Le/2,trackSize:Le/2,type:mt,values:this.sliderValues,formatter:function(oi){if($n)return $n(oi);var ts=J.getDatumByRatio(oi).time;return typeof ts=="number"?_a(ts):j(ts,"YYYY-MM-DD HH:mm:ss")},transform:"translate(".concat(fe,", ").concat(Te,")"),zIndex:1},ti);var ui=mt==="range"?5:0,gi=nn.map(function(oi){var ts=oi.value;return ts});return(0,m.pi)({handleIconOffset:ui,handleIconShape:this.chartHandleIconShape,selectionFill:"#fff",selectionFillOpacity:.5,selectionType:"invert",sparklineSpacing:.1,sparklineColumnLineWidth:0,sparklineColor:"#d4e5fd",sparklineAreaOpacity:1,sparklineAreaLineWidth:0,sparklineData:gi,sparklineType:Kt,sparklineScale:.8,trackLength:De,trackSize:Le,type:mt,values:this.sliderValues,transform:"translate(".concat(fe,", ").concat(Te,")"),zIndex:1},ti)},re.prototype.renderChart=function(Y){Y===void 0&&(Y=this.space.timelineBBox),this.timeline.update(this.getChartStyle(Y))},re.prototype.updateSelection=function(){this.timeline.setValues(this.sliderValues,!0),this.handleSliderChange(this.sliderValues)},re.prototype.getAxisStyle=function(Y){var J=this.data,fe=this.attributes,Te=fe.interval,De=fe.labelFormatter,Le=(0,C.zs)(this.attributes,"axis"),Xe=Y.x,mt=Y.y,Kt=Y.width,nn=(0,m.ev)((0,m.ev)([],(0,m.CR)(J),!1),[{time:0}],!1).map(function(Nn,$n,Er){var mr=Nn.time;return{label:"".concat(mr),value:$n/(Er.length-1),time:mr}}),gn=(0,m.pi)({startPos:[Xe,mt],endPos:[Xe+Kt,mt],data:nn,labelFilter:function(Nn,$n){return $n<nn.length-1},labelFormatter:function(Nn){var $n=Nn.time;return De?De($n):Ns($n,Te)}},Le);return gn},re.prototype.renderAxis=function(Y){Y===void 0&&(Y=this.space.axisBBox);var J=this.attributes.type;J==="chart"&&this.axis.update(this.getAxisStyle(Y))},re.prototype.renderController=function(Y){Y===void 0&&(Y=this.space.controllerBBox);var J=this.attributes.type,fe=this.states,Te=fe.state,De=fe.speed,Le=fe.selectionType,Xe=fe.chartType,mt=(0,C.zs)(this.attributes,"controller"),Kt=this,nn=(0,m.pi)((0,m.pi)((0,m.pi)({},Y),{iconSize:20,speed:De,state:Te,selectionType:Le,chartType:Xe,onChange:function(gn,Nn){var $n=Nn.value;switch(gn){case"reset":Kt.internalReset();break;case"speed":Kt.handleSpeedChange($n);break;case"backward":Kt.internalBackward();break;case"playPause":$n==="play"?Kt.internalPlay():Kt.internalPause();break;case"forward":Kt.internalForward();break;case"selectionType":Kt.handleSelectionTypeChange($n);break;case"chartType":Kt.handleChartTypeChange($n);break;default:break}}}),mt);J==="time"&&(nn.functions=[["reset","speed"],["backward","playPause","forward"],["selectionType"]]),this.controller.update(nn)},re.prototype.dispatchOnChange=function(Y){var J=this.data,fe=this.attributes.onChange,Te=this.states,De=Te.values,Le=Te.selectionType,Xe=(0,m.CR)(De,2),mt=Xe[0],Kt=Xe[1],nn=Kt===1/0?J.at(-1).time:Kt,gn=Le==="range"?[mt,nn]:nn,Nn=function($n,Er){return Array.isArray($n)?Array.isArray(Er)?$n[0]===Er[0]&&($n[1]===Er[1]||$n[1]===1/0||Er[1]===1/0):!1:Array.isArray(Er)?!1:$n===Er};(!Y||!Nn(Y,gn))&&(fe==null||fe(Le==="range"?[mt,nn]:nn))},re.prototype.internalReset=function(Y){var J,fe,Te=this.states.selectionType;this.internalPause(),this.setBySliderValues(Te==="range"?[0,1]:[0,0]),this.renderController(),this.updateSelection(),Y||((fe=(J=this.attributes)===null||J===void 0?void 0:J.onReset)===null||fe===void 0||fe.call(J),this.dispatchOnChange())},re.prototype.reset=function(){this.internalReset()},re.prototype.moveSelection=function(Y,J){var fe=this.data,Te=fe.length,De=this.states,Le=De.values,Xe=De.selectionType,mt=De.playMode,Kt=(0,m.CR)(Le,2),nn=Kt[0],gn=Kt[1],Nn=fe.findIndex(function(ui){var gi=ui.time;return gi===nn}),$n=fe.findIndex(function(ui){var gi=ui.time;return gi===gn});$n===-1&&($n=Te);var Er=Y==="backward"?-1:1,mr;Xe==="range"?mt==="acc"?(mr=[Nn,$n+Er],Er===-1&&Nn===$n&&(mr=[Nn,Te])):mr=[Nn+Er,$n+Er]:mr=[Nn,$n+Er];var ti=function(ui){var gi=(0,m.CR)(ui.sort(function(Ds,Ba){return Ds-Ba}),2),oi=gi[0],ts=gi[1],fs=function(Ds){return(0,Z.Z)(Ds,0,Te)};return ts>Te?Xe==="value"?[0,0]:mt==="acc"?[fs(oi),fs(oi)]:[0,fs(ts-oi)]:oi<0?mt==="acc"?[0,fs(ts)]:[fs(oi+Te-ts),Te]:[fs(oi),fs(ts)]},jr=ti(mr);return this.setByIndex(jr),this.updateSelection(),jr},re.prototype.internalBackward=function(Y){var J,fe,Te=this.moveSelection("backward",Y);return Y||((fe=(J=this.attributes)===null||J===void 0?void 0:J.onBackward)===null||fe===void 0||fe.call(J),this.dispatchOnChange()),Te},re.prototype.backward=function(){this.internalBackward()},re.prototype.internalPlay=function(Y){var J=this,fe,Te,De=this.data,Le=this.attributes.loop,Xe=this.states.speed,mt=Xe===void 0?1:Xe;this.playInterval=window.setInterval(function(){var Kt=J.internalForward();Kt[1]===De.length&&!Le&&(J.internalPause(),J.renderController())},1e3/mt),this.states.state="play",!Y&&((Te=(fe=this.attributes)===null||fe===void 0?void 0:fe.onPlay)===null||Te===void 0||Te.call(fe))},re.prototype.play=function(){this.internalPlay()},re.prototype.internalPause=function(Y){var J,fe;clearInterval(this.playInterval),this.states.state="pause",!Y&&((fe=(J=this.attributes)===null||J===void 0?void 0:J.onPause)===null||fe===void 0||fe.call(J))},re.prototype.pause=function(){this.internalPause()},re.prototype.internalForward=function(Y){var J,fe,Te=this.moveSelection("forward",Y);return Y||((fe=(J=this.attributes)===null||J===void 0?void 0:J.onForward)===null||fe===void 0||fe.call(J),this.dispatchOnChange()),Te},re.prototype.forward=function(){this.internalForward()},re.prototype.handleSpeedChange=function(Y){var J,fe;this.states.speed=Y;var Te=this.states.state;Te==="play"&&(this.internalPause(!0),this.internalPlay(!0)),(fe=(J=this.attributes)===null||J===void 0?void 0:J.onSpeedChange)===null||fe===void 0||fe.call(J,Y)},re.prototype.handleSelectionTypeChange=function(Y){var J,fe;this.states.selectionType=Y,this.renderChart(),(fe=(J=this.attributes)===null||J===void 0?void 0:J.onSelectionTypeChange)===null||fe===void 0||fe.call(J,Y)},re.prototype.handleChartTypeChange=function(Y){var J,fe;this.states.chartType=Y,this.renderChart(),(fe=(J=this.attributes)===null||J===void 0?void 0:J.onChartTypeChange)===null||fe===void 0||fe.call(J,Y)},re.prototype.render=function(){var Y=this.space,J=Y.axisBBox,fe=Y.controllerBBox,Te=Y.timelineBBox;this.renderController(fe),this.renderAxis(J),this.renderChart(Te),this.states.state==="play"&&this.internalPlay()},re.prototype.destroy=function(){oe.prototype.destroy.call(this),this.internalPause(!0)},re.defaultOptions={style:{x:0,y:0,axisLabelFill:"#6e6e6e",axisLabelTextAlign:"left",axisLabelTextBaseline:"top",axisLabelTransform:"translate(5, -12)",axisLineLineWidth:1,axisLineStroke:"#cacdd1",axisTickLength:15,axisTickLineWidth:1,axisTickStroke:"#cacdd1",chartShowLabel:!1,chartType:"line",controllerAlign:"center",controllerHeight:40,data:[],interval:"day",loop:!1,playMode:"acc",selectionType:"range",type:"time"}},re}(V.w)},75242:function(Be,Me,b){"use strict";b.d(Me,{u:function(){return j}});var m=b(80813),Z=b(85580);function V(de,he){return!de||!he?de:de.replace(/\\?\{([^{}]+)\}/g,function(we,ve){return we.charAt(0)==="\\"?we.slice(1):he[ve]===void 0?"":he[ve]})}var N=V,E=b(97304),F=function(de,he){if(he==null){de.innerHTML="";return}de.replaceChildren?Array.isArray(he)?de.replaceChildren.apply(de,(0,m.ev)([],(0,m.CR)(he),!1)):de.replaceChildren(he):(de.innerHTML="",Array.isArray(he)?he.forEach(function(we){return de.appendChild(we)}):de.appendChild(he))},C=b(88839),P=b(17911);function H(de){return de===void 0&&(de=""),{CONTAINER:"".concat(de,"tooltip"),TITLE:"".concat(de,"tooltip-title"),LIST:"".concat(de,"tooltip-list"),LIST_ITEM:"".concat(de,"tooltip-list-item"),NAME:"".concat(de,"tooltip-list-item-name"),MARKER:"".concat(de,"tooltip-list-item-marker"),NAME_LABEL:"".concat(de,"tooltip-list-item-name-label"),VALUE:"".concat(de,"tooltip-list-item-value"),CROSSHAIR_X:"".concat(de,"tooltip-crosshair-x"),CROSSHAIR_Y:"".concat(de,"tooltip-crosshair-y")}}var D={overflow:"hidden","white-space":"nowrap","text-overflow":"ellipsis"};function X(de){var he;de===void 0&&(de="");var we=H(de);return he={},he[".".concat(we.CONTAINER)]={position:"absolute",visibility:"visible","z-index":8,transition:"visibility 0.2s cubic-bezier(0.23, 1, 0.32, 1), left 0.4s cubic-bezier(0.23, 1, 0.32, 1), top 0.4s cubic-bezier(0.23, 1, 0.32, 1)","background-color":"rgba(255, 255, 255, 0.96)","box-shadow":"0 6px 12px 0 rgba(0, 0, 0, 0.12)","border-radius":"4px",color:"rgba(0, 0, 0, 0.65)","font-size":"12px","line-height":"20px",padding:"12px","min-width":"120px","max-width":"360px","font-family":"Roboto-Regular"},he[".".concat(we.TITLE)]={color:"rgba(0, 0, 0, 0.45)"},he[".".concat(we.LIST)]={margin:"0px","list-style-type":"none",padding:"0px"},he[".".concat(we.LIST_ITEM)]={"list-style-type":"none",display:"flex","line-height":"2em","align-items":"center","justify-content":"space-between","white-space":"nowrap"},he[".".concat(we.MARKER)]={width:"8px",height:"8px","border-radius":"50%",display:"inline-block","margin-right":"4px"},he[".".concat(we.NAME)]={display:"flex","align-items":"center","max-width":"216px"},he[".".concat(we.NAME_LABEL)]=(0,m.pi)({flex:1},D),he[".".concat(we.VALUE)]=(0,m.pi)({display:"inline-block",float:"right",flex:1,"text-align":"right","min-width":"28px","margin-left":"30px",color:"rgba(0, 0, 0, 0.85)"},D),he[".".concat(we.CROSSHAIR_X)]={position:"absolute",width:"1px","background-color":"rgba(0, 0, 0, 0.25)"},he[".".concat(we.CROSSHAIR_Y)]={position:"absolute",height:"1px","background-color":"rgba(0, 0, 0, 0.25)"},he}var j=function(de){(0,m.ZT)(he,de);function he(we){var ve=this,Ee,$e,Fe=($e=(Ee=we.style)===null||Ee===void 0?void 0:Ee.template)===null||$e===void 0?void 0:$e.prefixCls,ct=H(Fe);return ve=de.call(this,we,{data:[],x:0,y:0,visibility:"visible",title:"",position:"bottom-right",offset:[5,5],enterable:!1,container:{x:0,y:0},bounding:null,template:{prefixCls:"",container:'<div class="'.concat(ct.CONTAINER,'"></div>'),title:'<div class="'.concat(ct.TITLE,'"></div>'),item:'<li class="'.concat(ct.LIST_ITEM,`" data-index={index}>
<span class="`).concat(ct.NAME,`">
<span class="`).concat(ct.MARKER,`" style="background:{color}"></span>
<span class="`).concat(ct.NAME_LABEL,`" title="{name}">{name}</span>
</span>
<span class="`).concat(ct.VALUE,`" title="{value}">{value}</span>
</li>`)},style:X(Fe)})||this,ve.timestamp=-1,ve.prevCustomContentKey=ve.attributes.contentKey,ve.initShape(),ve.render(ve.attributes,ve),ve}return Object.defineProperty(he.prototype,"HTMLTooltipElement",{get:function(){return this.element},enumerable:!1,configurable:!0}),he.prototype.getContainer=function(){return this.element},Object.defineProperty(he.prototype,"elementSize",{get:function(){var we=this.element.offsetWidth,ve=this.element.offsetHeight;return{width:we,height:ve}},enumerable:!1,configurable:!0}),Object.defineProperty(he.prototype,"HTMLTooltipItemsElements",{get:function(){var we=this.attributes,ve=we.data,Ee=we.template;return ve.map(function($e,Fe){var ct=$e.name,vt=ct===void 0?"":ct,at=$e.color,kt=at===void 0?"black":at,It=$e.index,Bn=(0,m._T)($e,["name","color","index"]),Lt=(0,m.pi)({name:vt,color:kt,index:It!=null?It:Fe},Bn);return(0,Z.L)(N(Ee.item,Lt))})},enumerable:!1,configurable:!0}),he.prototype.render=function(we,ve){this.renderHTMLTooltipElement(),this.updatePosition()},he.prototype.destroy=function(){var we;(we=this.element)===null||we===void 0||we.remove(),de.prototype.destroy.call(this)},he.prototype.show=function(we,ve){var Ee=this;if(we!==void 0&&ve!==void 0){var $e=this.element.style.visibility==="hidden",Fe=function(){Ee.attributes.x=we!=null?we:Ee.attributes.x,Ee.attributes.y=ve!=null?ve:Ee.attributes.y,Ee.updatePosition()};$e?this.closeTransition(Fe):Fe()}this.element.style.visibility="visible"},he.prototype.hide=function(we,ve){we===void 0&&(we=0),ve===void 0&&(ve=0);var Ee=this.attributes.enterable;Ee&&this.isCursorEntered(we,ve)||(this.element.style.visibility="hidden")},he.prototype.initShape=function(){var we=this.attributes.template;this.element=(0,Z.L)(we.container),this.id&&this.element.setAttribute("id",this.id)},he.prototype.renderCustomContent=function(){if(!(this.prevCustomContentKey!==void 0&&this.prevCustomContentKey===this.attributes.contentKey)){this.prevCustomContentKey=this.attributes.contentKey;var we=this.attributes.content;we&&(typeof we=="string"?this.element.innerHTML=we:F(this.element,we))}},he.prototype.renderHTMLTooltipElement=function(){var we,ve,Ee=this.attributes,$e=Ee.template,Fe=Ee.title,ct=Ee.enterable,vt=Ee.style,at=Ee.content,kt=H($e.prefixCls),It=this.element;if(this.element.style.pointerEvents=ct?"auto":"none",at)this.renderCustomContent();else{Fe?(It.innerHTML=$e.title,It.getElementsByClassName(kt.TITLE)[0].innerHTML=Fe):(ve=(we=It.getElementsByClassName(kt.TITLE))===null||we===void 0?void 0:we[0])===null||ve===void 0||ve.remove();var Bn=this.HTMLTooltipItemsElements,Lt=document.createElement("ul");Lt.className=kt.LIST,F(Lt,Bn);var Wn=this.element.querySelector(".".concat(kt.LIST));Wn?Wn.replaceWith(Lt):It.appendChild(Lt)}(0,C.MC)(It,vt)},he.prototype.getRelativeOffsetFromCursor=function(we){var ve=this.attributes,Ee=ve.position,$e=ve.offset,Fe=we||Ee,ct=Fe.split("-"),vt={left:[-1,0],right:[1,0],top:[0,-1],bottom:[0,1]},at=this.elementSize,kt=at.width,It=at.height,Bn=[-kt/2,-It/2];return ct.forEach(function(Lt){var Wn=(0,m.CR)(Bn,2),Xn=Wn[0],In=Wn[1],zn=(0,m.CR)(vt[Lt],2),dr=zn[0],vn=zn[1];Bn=[Xn+(kt/2+$e[0])*dr,In+(It/2+$e[1])*vn]}),Bn},he.prototype.setOffsetPosition=function(we){var ve=(0,m.CR)(we,2),Ee=ve[0],$e=ve[1],Fe=this.attributes,ct=Fe.x,vt=ct===void 0?0:ct,at=Fe.y,kt=at===void 0?0:at,It=Fe.container,Bn=It.x,Lt=It.y;this.element.style.left="".concat(+vt+Bn+Ee,"px"),this.element.style.top="".concat(+kt+Lt+$e,"px")},he.prototype.updatePosition=function(){var we=this.attributes.showDelay,ve=we===void 0?60:we,Ee=Date.now();this.timestamp>0&&Ee-this.timestamp<ve||(this.timestamp=Ee,this.setOffsetPosition(this.autoPosition(this.getRelativeOffsetFromCursor())))},he.prototype.autoPosition=function(we){var ve=(0,m.CR)(we,2),Ee=ve[0],$e=ve[1],Fe=this.attributes,ct=Fe.x,vt=Fe.y,at=Fe.bounding,kt=Fe.position;if(!at)return[Ee,$e];var It=this.element,Bn=It.offsetWidth,Lt=It.offsetHeight,Wn=(0,m.CR)([+ct+Ee,+vt+$e],2),Xn=Wn[0],In=Wn[1],zn={left:"right",right:"left",top:"bottom",bottom:"top"},dr=at.x,vn=at.y,_r=at.width,Ge=at.height,Tt={left:Xn<dr,right:Xn+Bn>dr+_r,top:In<vn,bottom:In+Lt>vn+Ge},On=[];kt.split("-").forEach(function(en){Tt[en]?On.push(zn[en]):On.push(en)});var Vr=On.join("-");return this.getRelativeOffsetFromCursor(Vr)},he.prototype.isCursorEntered=function(we,ve){if(this.element){var Ee=this.element.getBoundingClientRect(),$e=Ee.x,Fe=Ee.y,ct=Ee.width,vt=Ee.height;return new P.b($e,Fe,ct,vt).isPointIn(we,ve)}return!1},he.prototype.closeTransition=function(we){var ve=this,Ee=this.element.style.transition;this.element.style.transition="none",we(),setTimeout(function(){ve.element.style.transition=Ee},10)},he.tag="tooltip",he}(E.w)},17911:function(Be,Me,b){"use strict";b.d(Me,{b:function(){return m}});var m=function(){function V(N,E,F,C){N===void 0&&(N=0),E===void 0&&(E=0),F===void 0&&(F=0),C===void 0&&(C=0),this.x=0,this.y=0,this.width=0,this.height=0,this.x=N,this.y=E,this.width=F,this.height=C}return Object.defineProperty(V.prototype,"bottom",{get:function(){return this.y+this.height},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"left",{get:function(){return this.x},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"right",{get:function(){return this.x+this.width},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"top",{get:function(){return this.y},enumerable:!1,configurable:!0}),V.fromRect=function(N){return new V(N.x,N.y,N.width,N.height)},V.prototype.toJSON=function(){return{x:this.x,y:this.y,width:this.width,height:this.height,top:this.top,right:this.right,bottom:this.bottom,left:this.left}},V.prototype.isPointIn=function(N,E){return N>=this.left&&N<=this.right&&E>=this.top&&E<=this.bottom},V}();function Z(V){var N=V.getRenderBounds(),E=__read(N.min,2),F=E[0],C=E[1],P=__read(N.max,2),H=P[0],D=P[1],X=H-F,j=D-C;return new m(F,C,X,j)}},38242:function(Be,Me,b){"use strict";b.d(Me,{S:function(){return V}});var m=b(80813),Z=b(71018);function V(N,E){return(0,Z.Z)(N)?N.apply(void 0,(0,m.ev)([],(0,m.CR)(E),!1)):N}},58688:function(Be,Me,b){"use strict";b.d(Me,{A:function(){return Z}});var m=b(80813),Z=function(V,N){var E=function(C){return"".concat(N,"-").concat(C)},F=Object.fromEntries(Object.entries(V).map(function(C){var P=(0,m.CR)(C,2),H=P[0],D=P[1],X=E(D);return[H,{name:X,class:".".concat(X),id:"#".concat(X),toString:function(){return X}}]}));return Object.assign(F,{prefix:E}),F}},99247:function(Be,Me,b){"use strict";b.d(Me,{n:function(){return F}});var m=b(80813),Z=b(63467),V=b(39934),N=5,E=function(C,P,H,D){H===void 0&&(H=0),D===void 0&&(D=N),Object.entries(P).forEach(function(X){var j=(0,m.CR)(X,2),de=j[0],he=j[1],we=C;Object.prototype.hasOwnProperty.call(P,de)&&(he?(0,Z.Z)(he)?((0,Z.Z)(C[de])||(we[de]={}),H<D?E(C[de],he,H+1,D):we[de]=P[de]):(0,V.Z)(he)?(we[de]=[],we[de]=we[de].concat(he)):we[de]=he:we[de]=he)})},F=function(C){for(var P=[],H=1;H<arguments.length;H++)P[H-1]=arguments[H];for(var D=0;D<P.length;D+=1)E(C,P[D]);return C}},53160:function(Be,Me,b){"use strict";b.d(Me,{O:function(){return Z}});var m=b(58533);function Z(V,N,E){E===void 0&&(E="..."),(0,m.Rm)(V,{wordWrap:!0,wordWrapWidth:N,maxLines:1,textOverflow:E})}},88170:function(Be,Me,b){"use strict";b.d(Me,{$:function(){return C},S:function(){return F}});var m=b(80813),Z=b(71879),V=b(1933),N=b(42777),E=b(66623);function F(P){return typeof P=="function"?P():(0,Z.Z)(P)||(0,V.Z)(P)?new N.x({style:{text:String(P)}}):P}function C(P,H){return typeof P=="function"?P():(0,Z.Z)(P)||(0,V.Z)(P)?new E.k9({style:(0,m.pi)((0,m.pi)({pointerEvents:"auto"},H),{innerHTML:P})}):P}},67756:function(Be,Me,b){"use strict";b.d(Me,{z:function(){return m}});function m(Z,V,N,E,F){return E===void 0&&(E=!0),F===void 0&&(F=function(C){C.node().removeChildren()}),Z?N(V):(E&&F(V),null)}},16915:function(Be,Me,b){"use strict";b.d(Me,{X:function(){return F},g:function(){return E}});var m=b(80813),Z=b(66623),V=b(69014),N=function(C){(0,m.ZT)(P,C);function P(){for(var H=[],D=0;D<arguments.length;D++)H[D]=arguments[D];var X=C.apply(this,(0,m.ev)([],(0,m.CR)(H),!1))||this;return X.isMutationObserved=!0,X.addEventListener(Z.Dk.INSERTED,function(){(0,V.Cp)(X)}),X}return P}(Z.ZA);function E(C){var P=C.appendChild(new N({class:"offscreen"}));return(0,V.Cp)(P),P}function F(C){for(var P=C;P;){if(P.className==="offscreen")return!0;P=P.parent}return!1}},33253:function(Be,Me,b){"use strict";b.d(Me,{l:function(){return m}});function m(Z){return/\S+-\S+/g.test(Z)?Z.split("-").map(function(V){return V[0]}):Z.length>2?[Z[0]]:Z.split("")}},99769:function(Be,Me,b){"use strict";b.d(Me,{b:function(){return m}});function m(Z,V,N){N===void 0&&(N=!1);var E=Z.getBBox(),F=E.width,C=E.height,P=V/Math.max(F,C);return N&&(Z.style.transform="scale(".concat(P,")")),P}},38974:function(Be,Me,b){"use strict";b.d(Me,{OV:function(){return X},Ys:function(){return D}});var m=b(80813),Z=b(39934),V=function(j){if(!(0,Z.Z)(j))return[];for(var de=[],he=0;he<j.length;he++)de=de.concat(j[he]);return de},N=V,E=b(66623),F=b(42777);function C(j,de){var he=new Map;return j.forEach(function(we){var ve=de(we);he.has(ve)||he.set(ve,[]),he.get(ve).push(we)}),he}function P(j){throw new Error(j)}var H=function(){function j(ve,Ee,$e,Fe,ct,vt,at){ve===void 0&&(ve=null),Ee===void 0&&(Ee=null),$e===void 0&&($e=null),Fe===void 0&&(Fe=null),ct===void 0&&(ct=[null,null,null,null,null]),vt===void 0&&(vt=[]),at===void 0&&(at=[]),de.add(this),this._elements=Array.from(ve),this._data=Ee,this._parent=$e,this._document=Fe,this._enter=ct[0],this._update=ct[1],this._exit=ct[2],this._merge=ct[3],this._split=ct[4],this._transitions=vt,this._facetElements=at}j.prototype.selectAll=function(ve){var Ee=typeof ve=="string"?this._parent.querySelectorAll(ve):ve;return new he(Ee,null,this._elements[0],this._document)},j.prototype.selectFacetAll=function(ve){var Ee=typeof ve=="string"?this._parent.querySelectorAll(ve):ve;return new he(this._elements,null,this._parent,this._document,void 0,void 0,Ee)},j.prototype.select=function(ve){var Ee=typeof ve=="string"?this._parent.querySelectorAll(ve)[0]||null:ve;return new he([Ee],null,Ee,this._document)},j.prototype.append=function(ve){var Ee=this,$e=typeof ve=="function"?ve:function(){return Ee.createElement(ve)},Fe=[];if(this._data!==null){for(var ct=0;ct<this._data.length;ct++){var vt=this._data[ct],at=(0,m.CR)(Array.isArray(vt)?vt:[vt,null],2),kt=at[0],It=at[1],Bn=$e(kt,ct);Bn.__data__=kt,It!==null&&(Bn.__fromElements__=It),this._parent.appendChild(Bn),Fe.push(Bn)}return new he(Fe,null,this._parent,this._document)}for(var ct=0;ct<this._elements.length;ct++){var Lt=this._elements[ct],kt=Lt.__data__,Bn=$e(kt,ct);Lt.appendChild(Bn),Fe.push(Bn)}return new he(Fe,null,Fe[0],this._document)},j.prototype.maybeAppend=function(ve,Ee){var $e=(0,m.Q_)(this,de,"m",we).call(this,ve[0]==="#"?ve:"#".concat(ve),Ee);return $e.attr("id",ve),$e},j.prototype.maybeAppendByClassName=function(ve,Ee){var $e=ve.toString(),Fe=(0,m.Q_)(this,de,"m",we).call(this,$e[0]==="."?$e:".".concat($e),Ee);return Fe.attr("className",$e),Fe},j.prototype.maybeAppendByName=function(ve,Ee){var $e=(0,m.Q_)(this,de,"m",we).call(this,'[name="'.concat(ve,'"]'),Ee);return $e.attr("name",ve),$e},j.prototype.data=function(ve,Ee,$e){var Fe,ct;Ee===void 0&&(Ee=function(en){return en}),$e===void 0&&($e=function(){return null});for(var vt=[],at=[],kt=new Set(this._elements),It=[],Bn=new Set,Lt=new Map(this._elements.map(function(en,ln){return[Ee(en.__data__,ln),en]})),Wn=new Map(this._facetElements.map(function(en,ln){return[Ee(en.__data__,ln),en]})),Xn=C(this._elements,function(en){return $e(en.__data__)}),In=0;In<ve.length;In++){var zn=ve[In],dr=Ee(zn,In),vn=$e(zn,In);if(Lt.has(dr)){var _r=Lt.get(dr);_r.__data__=zn,_r.__facet__=!1,at.push(_r),kt.delete(_r),Lt.delete(dr)}else if(Wn.has(dr)){var _r=Wn.get(dr);_r.__data__=zn,_r.__facet__=!0,at.push(_r),Wn.delete(dr)}else if(Xn.has(dr)){var Ge=Xn.get(dr);It.push([zn,Ge]);try{for(var Tt=(Fe=void 0,(0,m.XA)(Ge)),On=Tt.next();!On.done;On=Tt.next()){var _r=On.value;kt.delete(_r)}}catch(en){Fe={error:en}}finally{try{On&&!On.done&&(ct=Tt.return)&&ct.call(Tt)}finally{if(Fe)throw Fe.error}}Xn.delete(dr)}else if(Lt.has(vn)){var _r=Lt.get(vn);_r.__toData__?_r.__toData__.push(zn):_r.__toData__=[zn],Bn.add(_r),kt.delete(_r)}else vt.push(zn)}var Vr=[new he([],vt,this._parent,this._document),new he(at,null,this._parent,this._document),new he(kt,null,this._parent,this._document),new he([],It,this._parent,this._document),new he(Bn,null,this._parent,this._document)];return new he(this._elements,null,this._parent,this._document,Vr)},j.prototype.merge=function(ve){var Ee=(0,m.ev)((0,m.ev)([],(0,m.CR)(this._elements),!1),(0,m.CR)(ve._elements),!1),$e=(0,m.ev)((0,m.ev)([],(0,m.CR)(this._transitions),!1),(0,m.CR)(ve._transitions),!1);return new he(Ee,null,this._parent,this._document,void 0,$e)},j.prototype.createElement=function(ve){if(this._document)return this._document.createElement(ve,{});var Ee=he.registry[ve];return Ee?new Ee:P("Unknown node type: ".concat(ve))},j.prototype.join=function(ve,Ee,$e,Fe,ct){ve===void 0&&(ve=function(Lt){return Lt}),Ee===void 0&&(Ee=function(Lt){return Lt}),$e===void 0&&($e=function(Lt){return Lt.remove()}),Fe===void 0&&(Fe=function(Lt){return Lt}),ct===void 0&&(ct=function(Lt){return Lt.remove()});var vt=ve(this._enter),at=Ee(this._update),kt=$e(this._exit),It=Fe(this._merge),Bn=ct(this._split);return at.merge(vt).merge(kt).merge(It).merge(Bn)},j.prototype.remove=function(){for(var ve=function(Fe){var ct=Ee._elements[Fe],vt=Ee._transitions[Fe];vt?vt.then(function(){return ct.remove()}):ct.remove()},Ee=this,$e=0;$e<this._elements.length;$e++)ve($e);return new he([],null,this._parent,this._document,void 0,this._transitions)},j.prototype.each=function(ve){for(var Ee=0;Ee<this._elements.length;Ee++){var $e=this._elements[Ee],Fe=$e.__data__;ve.call($e,Fe,Ee)}return this},j.prototype.attr=function(ve,Ee){var $e=typeof Ee!="function"?function(){return Ee}:Ee;return this.each(function(Fe,ct){Ee!==void 0&&(this[ve]=$e.call(this,Fe,ct))})},j.prototype.style=function(ve,Ee,$e){$e===void 0&&($e=!0);var Fe=typeof Ee!="function"||!$e?function(){return Ee}:Ee;return this.each(function(ct,vt){Ee!==void 0&&(this.style[ve]=Fe.call(this,ct,vt))})},j.prototype.styles=function(ve,Ee){return ve===void 0&&(ve={}),Ee===void 0&&(Ee=!0),this.each(function($e,Fe){var ct=this;Object.entries(ve).forEach(function(vt){var at=(0,m.CR)(vt,2),kt=at[0],It=at[1],Bn=typeof It!="function"||!Ee?function(){return It}:It;It!==void 0&&ct.attr(kt,Bn.call(ct,$e,Fe))})})},j.prototype.update=function(ve,Ee){Ee===void 0&&(Ee=!0);var $e=typeof ve!="function"||!Ee?function(){return ve}:ve;return this.each(function(Fe,ct){ve&&this.update&&this.update($e.call(this,Fe,ct))})},j.prototype.maybeUpdate=function(ve,Ee){Ee===void 0&&(Ee=!0);var $e=typeof ve!="function"||!Ee?function(){return ve}:ve;return this.each(function(Fe,ct){ve&&this.update&&this.update($e.call(this,Fe,ct))})},j.prototype.transition=function(ve){var Ee=this._transitions,$e=new Array(this._elements.length);return this.each(function(Fe,ct){$e[ct]=ve.call(this,Fe,ct)}),this._transitions=N($e),this},j.prototype.on=function(ve,Ee){return this.each(function(){this.addEventListener(ve,Ee)}),this},j.prototype.call=function(ve){for(var Ee=[],$e=1;$e<arguments.length;$e++)Ee[$e-1]=arguments[$e];return ve.call.apply(ve,(0,m.ev)([this._parent,this],(0,m.CR)(Ee),!1)),this},j.prototype.node=function(){return this._elements[0]},j.prototype.nodes=function(){return this._elements},j.prototype.transitions=function(){return this._transitions.filter(function(ve){return!!ve})},j.prototype.parent=function(){return this._parent};var de,he,we;return he=j,de=new WeakSet,we=function(Ee,$e){var Fe=this._elements[0],ct=Fe.querySelector(Ee);if(ct)return new he([ct],null,this._parent,this._document);var vt=typeof $e=="string"?this.createElement($e):$e();return Fe.appendChild(vt),new he([vt],null,this._parent,this._document)},j.registry={g:E.ZA,rect:E.UL,circle:E.Cd,path:E.y$,text:F.x,ellipse:E.Pj,image:E.Ee,line:E.x1,polygon:E.mg,polyline:E.aH,html:E.k9},j}();function D(j){return new H([j],null,j,j.ownerDocument)}function X(j,de,he){return j.querySelector(de)?D(j).select(de):D(j).append(he)}},98294:function(Be,Me,b){"use strict";b.d(Me,{j:function(){return V}});var m=b(1933),Z=b(39934);function V(N){if((0,m.Z)(N))return[N,N,N,N];if((0,Z.Z)(N)){var E=N.length;if(E===1)return[N[0],N[0],N[0],N[0]];if(E===2)return[N[0],N[1],N[0],N[1]];if(E===3)return[N[0],N[1],N[2],N[1]];if(E===4)return N}return[0,0,0,0]}},2080:function(Be,Me,b){"use strict";b.d(Me,{DM:function(){return C},_v:function(){return V},wE:function(){return E}});var m=b(80813);function Z(P){var H=P&&P.getRenderBounds();if(!H)return{width:0,height:0};var D=H.getMax(),X=H.getMin();return{width:D[0]-X[0],height:D[1]-X[1]}}function V(P){var H=P.getLocalBounds(),D=H.min,X=H.max,j=(0,m.CR)([D,X],2),de=(0,m.CR)(j[0],2),he=de[0],we=de[1],ve=(0,m.CR)(j[1],2),Ee=ve[0],$e=ve[1];return{x:he,y:we,width:Ee-he,height:$e-we,left:he,bottom:$e,top:we,right:Ee}}function N(P,H){var D=select(P).append("text").node();return D.attr(__assign(__assign({},H),{visibility:"hidden"})),D}function E(P,H){var D=(0,m.CR)(P,2),X=D[0],j=D[1],de=(0,m.CR)(H,2),he=de[0],we=de[1];return X!==he&&j===we}function F(P,H){var D=__read(P,2),X=D[0],j=D[1],de=__read(H,2),he=de[0],we=de[1];return X===he&&j!==we}function C(P,H){var D,X,j=H.attributes;try{for(var de=(0,m.XA)(Object.entries(j)),he=de.next();!he.done;he=de.next()){var we=(0,m.CR)(he.value,2),ve=we[0],Ee=we[1];ve!=="id"&&ve!=="className"&&P.attr(ve,Ee)}}catch($e){D={error:$e}}finally{try{he&&!he.done&&(X=de.return)&&X.call(de)}finally{if(D)throw D.error}}}},88839:function(Be,Me,b){"use strict";b.d(Me,{MC:function(){return F},Hm:function(){return D},zs:function(){return P},dq:function(){return H}});var m=b(80813);function Z(X){return X.toString().charAt(0).toUpperCase()+X.toString().slice(1)}function V(X){return X.toString().charAt(0).toLowerCase()+X.toString().slice(1)}function N(X,j){return"".concat(j).concat(Z(X))}function E(X,j,de){var he;de===void 0&&(de=!0);var we=j||((he=X.match(/^([a-z][a-z0-9]+)/))===null||he===void 0?void 0:he[0])||"",ve=X.replace(new RegExp("^(".concat(we,")")),"");return de?V(ve):ve}function F(X,j){Object.entries(j).forEach(function(de){var he=(0,m.CR)(de,2),we=he[0],ve=he[1];(0,m.ev)([X],(0,m.CR)(X.querySelectorAll(we)),!1).filter(function(Ee){return Ee.matches(we)}).forEach(function(Ee){if(Ee){var $e=Ee;$e.style.cssText+=Object.entries(ve).reduce(function(Fe,ct){return"".concat(Fe).concat(ct.join(":"),";")},"")}})})}var C=function(X,j){if(!(X!=null&&X.startsWith(j)))return!1;var de=X[j.length];return de>="A"&&de<="Z"};function P(X,j,de){de===void 0&&(de=!1);var he={};return Object.entries(X).forEach(function(we){var ve=(0,m.CR)(we,2),Ee=ve[0],$e=ve[1];if(!(Ee==="className"||Ee==="class")){if(C(Ee,"show")&&C(E(Ee,"show"),j)!==de)Ee===N(j,"show")?he[Ee]=$e:he[Ee.replace(new RegExp(Z(j)),"")]=$e;else if(!C(Ee,"show")&&C(Ee,j)!==de){var Fe=E(Ee,j);Fe==="filter"&&typeof $e=="function"||(he[Fe]=$e)}}}),he}function H(X,j){return Object.entries(X).reduce(function(de,he){var we=(0,m.CR)(he,2),ve=we[0],Ee=we[1];return ve.startsWith("show")?de["show".concat(j).concat(ve.slice(4))]=Ee:de["".concat(j).concat(Z(ve))]=Ee,de},{})}function D(X,j){j===void 0&&(j=["x","y","class","className"]);var de=["transform","transformOrigin","anchor","visibility","pointerEvents","zIndex","cursor","clipPath","clipPathTargets","offsetPath","offsetPathTargets","offsetDistance","draggable","droppable"],he={},we={};return Object.entries(X).forEach(function(ve){var Ee=(0,m.CR)(ve,2),$e=Ee[0],Fe=Ee[1];j.includes($e)||(de.indexOf($e)!==-1?we[$e]=Fe:he[$e]=Fe)}),[he,we]}},58533:function(Be,Me,b){"use strict";b.d(Me,{Rm:function(){return H},U4:function(){return P},Ux:function(){return F},qT:function(){return C}});var m=b(66623),Z=b(40455),V,N;function E(D){N=D}var F=(0,Z.Z)(function(D,X){var j=X.fontSize,de=X.fontFamily,he=X.fontWeight,we=X.fontStyle,ve=X.fontVariant;return N?N(D,j):(V||(V=m.GZ.offscreenCanvasCreator.getOrCreateContext(void 0)),V.font=[we,ve,he,"".concat(j,"px"),de].join(" "),V.measureText(D).width)},function(D,X){return[D,Object.values(X||C(D)).join()].join("")},4096),C=function(D){var X=D.style.fontFamily||"sans-serif",j=D.style.fontWeight||"normal",de=D.style.fontStyle||"normal",he=D.style.fontVariant,we=D.style.fontSize;return we=typeof we=="object"?we.value:we,{fontSize:we,fontFamily:X,fontWeight:j,fontStyle:de,fontVariant:he}};function P(D){return D.nodeName==="text"?D:D.nodeName==="g"&&D.children.length===1&&D.children[0].nodeName==="text"?D.children[0]:null}function H(D,X){var j=P(D);j&&j.attr(X)}},69014:function(Be,Me,b){"use strict";b.d(Me,{Cp:function(){return V},$Z:function(){return Z},WD:function(){return N}});function m(E,F){F(E),E.children&&E.children.forEach(function(C){C&&m(C,F)})}function Z(E){N(E,!0)}function V(E){N(E,!1)}function N(E,F){var C=F?"visible":"hidden";m(E,function(P){P.attr("visibility",C)})}},49336:function(Be,Me){"use strict";var b="*",m=function(){function Z(){this._events={}}return Z.prototype.on=function(V,N,E){return this._events[V]||(this._events[V]=[]),this._events[V].push({callback:N,once:!!E}),this},Z.prototype.once=function(V,N){return this.on(V,N,!0)},Z.prototype.emit=function(V){for(var N=this,E=[],F=1;F<arguments.length;F++)E[F-1]=arguments[F];var C=this._events[V]||[],P=this._events[b]||[],H=function(D){for(var X=D.length,j=0;j<X;j++)if(D[j]){var de=D[j],he=de.callback,we=de.once;we&&(D.splice(j,1),D.length===0&&delete N._events[V],X--,j--),he.apply(N,E)}};H(C),H(P)},Z.prototype.off=function(V,N){if(!V)this._events={};else if(!N)delete this._events[V];else{for(var E=this._events[V]||[],F=E.length,C=0;C<F;C++)E[C].callback===N&&(E.splice(C,1),F--,C--);E.length===0&&delete this._events[V]}return this},Z.prototype.getEvents=function(){return this._events},Z}();Me.Z=m},7316:function(Be,Me,b){"use strict";b.d(Me,{Th:function(){return Ci}});var m=b(83652),Z=b(67732),V=b(22214),N=b(42403),E=b(72818),F=b(20068),C=b(33885),P=b(42978);function H(En,rn){if(!{}.hasOwnProperty.call(En,rn))throw new TypeError("attempted to use private field on non-instance");return En}var D=0;function X(En){return"__private_"+D+++"_"+En}var j=b(60187),de=b(92421),he=b(76075),we=b(66045),ve=b(70208),Ee=b(71879),$e=b(19251),Fe=b(75044),ct=b(3202),vt=b(19606);var at=X("renderState"),kt=function(){function En(rn){(0,Z.Z)(this,En),this.renderQueue=[],Object.defineProperty(this,at,{writable:!0,value:{restoreStack:[],prevObject:null,currentContext:new Map}}),this.clearFullScreenLastFrame=!1,this.clearFullScreen=!1,this.vpMatrix=j.create(),this.dprMatrix=j.create(),this.tmpMat4=j.create(),this.vec3a=de.Ue(),this.vec3b=de.Ue(),this.vec3c=de.Ue(),this.vec3d=de.Ue(),this.canvasRendererPluginOptions=rn}return(0,m.Z)(En,[{key:"apply",value:function(Xt,st){var dt=this;this.context=Xt;var Wt=this.context,bn=Wt.config,Jt=Wt.camera,ar=Wt.renderingService,rr=Wt.renderingContext,Kr=Wt.pathGeneratorFactory,si=bn.renderer.getConfig().enableRenderingOptimization;bn.renderer.getConfig().enableDirtyCheck=!1,bn.renderer.getConfig().enableDirtyRectangleRendering=!1,this.pathGeneratorFactory=Kr;var Ie=Xt.contextService,L=rr.root.ownerDocument.defaultView;ar.hooks.init.tap(En.tag,function(){var z=Ie.getDPR(),ie=bn.width,ze=bn.height,Je=Ie.getContext();dt.clearRect(Je,0,0,ie*z,ze*z,bn.background)}),ar.hooks.destroy.tap(En.tag,function(){dt.renderQueue=[],H(dt,at)[at]={restoreStack:[],prevObject:null,currentContext:null}});var Q=function(){var ie,ze=Ie.getContext(),Je=Ie.getDPR(),At=bn.width,xt=bn.height,Sn=dt.canvasRendererPluginOptions,Oe=Sn.dirtyObjectNumThreshold,Qe=Sn.dirtyObjectRatioThreshold,Re=ar.getStats(),Ke=Re.total,gt=Re.rendered,tn=gt/Ke;dt.clearFullScreen=dt.clearFullScreenLastFrame||!((ie=L.context.renderingPlugins[1])!==null&&ie!==void 0&&ie.isFirstTimeRenderingFinished)||ar.disableDirtyRectangleRendering()||gt>Oe&&tn>Qe,ze&&(typeof ze.resetTransform=="function"?ze.resetTransform():ze.setTransform(1,0,0,1,0,0),dt.clearFullScreen&&dt.clearRect(ze,0,0,At*Je,xt*Je,bn.background))},w=function(ie,ze){for(var Je=[ie];Je.length>0;){var At,xt=Je.pop();xt.isVisible()&&!xt.isCulled()&&(si?dt.renderDisplayObjectOptimized(xt,ze,dt.context,H(dt,at)[at],st):dt.renderDisplayObject(xt,ze,dt.context,H(dt,at)[at],st));for(var Sn=((At=xt.sortable)===null||At===void 0||(At=At.sorted)===null||At===void 0?void 0:At.length)>0?xt.sortable.sorted:xt.childNodes,Oe=Sn.length-1;Oe>=0;Oe--)Je.push(Sn[Oe])}};ar.hooks.endFrame.tap(En.tag,function(){if(Q(),rr.root.childNodes.length===0){dt.clearFullScreenLastFrame=!0;return}si=bn.renderer.getConfig().enableRenderingOptimization,H(dt,at)[at]={restoreStack:[],prevObject:null,currentContext:H(dt,at)[at].currentContext},H(dt,at)[at].currentContext.clear(),dt.clearFullScreenLastFrame=!1;var z=Ie.getContext(),ie=Ie.getDPR();if(j.fromScaling(dt.dprMatrix,[ie,ie,1]),j.multiply(dt.vpMatrix,dt.dprMatrix,Jt.getOrthoMatrix()),dt.clearFullScreen)si?(z.save(),w(rr.root,z),z.restore()):w(rr.root,z);else{var ze=dt.safeMergeAABB(dt.mergeDirtyAABBs(dt.renderQueue));if(E.mN.isEmpty(ze)){dt.renderQueue=[];return}var Je=dt.convertAABB2Rect(ze),At=Je.x,xt=Je.y,Sn=Je.width,Oe=Je.height,Qe=de.fF(dt.vec3a,[At,xt,0],dt.vpMatrix),Re=de.fF(dt.vec3b,[At+Sn,xt,0],dt.vpMatrix),Ke=de.fF(dt.vec3c,[At,xt+Oe,0],dt.vpMatrix),gt=de.fF(dt.vec3d,[At+Sn,xt+Oe,0],dt.vpMatrix),tn=Math.min(Qe[0],Re[0],gt[0],Ke[0]),yt=Math.min(Qe[1],Re[1],gt[1],Ke[1]),Yt=Math.max(Qe[0],Re[0],gt[0],Ke[0]),Rn=Math.max(Qe[1],Re[1],gt[1],Ke[1]),er=Math.floor(tn),Jn=Math.floor(yt),kr=Math.ceil(Yt-tn),fr=Math.ceil(Rn-yt);z.save(),dt.clearRect(z,er,Jn,kr,fr,bn.background),z.beginPath(),z.rect(er,Jn,kr,fr),z.clip(),z.setTransform(dt.vpMatrix[0],dt.vpMatrix[1],dt.vpMatrix[4],dt.vpMatrix[5],dt.vpMatrix[12],dt.vpMatrix[13]);var wr=bn.renderer.getConfig(),ei=wr.enableDirtyRectangleRenderingDebug;ei&&L.dispatchEvent(new E.Aw(E.$6.DIRTY_RECTANGLE,{dirtyRect:{x:er,y:Jn,width:kr,height:fr}}));var _n=ze.getMin(),jn=(0,P.Z)(_n,2),Hr=jn[0],Pr=jn[1],$i=ze.getMax(),Zi=(0,P.Z)($i,2),Xi=Zi[0],Ei=Zi[1],ms=rr.root.ownerDocument.elementsFromBBox(Hr,Pr,Xi,Ei);ms.sort(function(_i,Es){return _i.sortable.renderOrder-Es.sortable.renderOrder}).forEach(function(_i){_i&&_i.isVisible()&&!_i.isCulled()&&dt.renderDisplayObject(_i,z,dt.context,H(dt,at)[at],st)}),z.restore(),dt.renderQueue.forEach(function(_i){dt.saveDirtyAABB(_i)}),dt.renderQueue=[]}H(dt,at)[at].restoreStack.forEach(function(){z.restore()}),H(dt,at)[at].restoreStack=[]}),ar.hooks.render.tap(En.tag,function(z){dt.clearFullScreen||dt.renderQueue.push(z)})}},{key:"clearRect",value:function(Xt,st,dt,Wt,bn,Jt){Xt.clearRect(st,dt,Wt,bn),Jt&&(Xt.fillStyle=Jt,Xt.fillRect(st,dt,Wt,bn))}},{key:"renderDisplayObjectOptimized",value:function(Xt,st,dt,Wt,bn){var Jt=Xt.nodeName,ar=!1,rr=!1,Kr=this.context.styleRendererFactory[Jt],si=this.pathGeneratorFactory[Jt],Ie=Xt.parsedStyle.clipPath;if(Ie){ar=!Wt.prevObject||!j.exactEquals(Ie.getWorldTransform(),Wt.prevObject.getWorldTransform()),ar&&(this.applyWorldTransform(st,Ie),Wt.prevObject=null);var L=this.pathGeneratorFactory[Ie.nodeName];L&&(st.save(),rr=!0,st.beginPath(),L(st,Ie.parsedStyle),st.closePath(),st.clip())}if(Kr){ar=!Wt.prevObject||!j.exactEquals(Xt.getWorldTransform(),Wt.prevObject.getWorldTransform()),ar&&this.applyWorldTransform(st,Xt);var Q=!Wt.prevObject;if(!Q){var w=Wt.prevObject.nodeName;Jt===E.bn.TEXT?Q=w!==E.bn.TEXT:Jt===E.bn.IMAGE?Q=w!==E.bn.IMAGE:Q=w===E.bn.TEXT||w===E.bn.IMAGE}Kr.applyStyleToContext(st,Xt,Q,Wt),Wt.prevObject=Xt}si&&(st.beginPath(),si(st,Xt.parsedStyle),Jt!==E.bn.LINE&&Jt!==E.bn.PATH&&Jt!==E.bn.POLYLINE&&st.closePath()),Kr&&Kr.drawToContext(st,Xt,H(this,at)[at],this,bn),rr&&st.restore(),Xt.dirty(!1)}},{key:"renderDisplayObject",value:function(Xt,st,dt,Wt,bn){var Jt=Xt.nodeName,ar=Wt.restoreStack[Wt.restoreStack.length-1];ar&&!(Xt.compareDocumentPosition(ar)&E.NB.DOCUMENT_POSITION_CONTAINS)&&(st.restore(),Wt.restoreStack.pop());var rr=this.context.styleRendererFactory[Jt],Kr=this.pathGeneratorFactory[Jt],si=Xt.parsedStyle.clipPath;if(si){this.applyWorldTransform(st,si);var Ie=this.pathGeneratorFactory[si.nodeName];Ie&&(st.save(),Wt.restoreStack.push(Xt),st.beginPath(),Ie(st,si.parsedStyle),st.closePath(),st.clip())}rr&&(this.applyWorldTransform(st,Xt),st.save(),this.applyAttributesToContext(st,Xt)),Kr&&(st.beginPath(),Kr(st,Xt.parsedStyle),Jt!==E.bn.LINE&&Jt!==E.bn.PATH&&Jt!==E.bn.POLYLINE&&st.closePath()),rr&&(rr.render(st,Xt.parsedStyle,Xt,dt,this,bn),st.restore()),Xt.dirty(!1)}},{key:"applyAttributesToContext",value:function(Xt,st){var dt=st.parsedStyle,Wt=dt.stroke,bn=dt.fill,Jt=dt.opacity,ar=dt.lineDash,rr=dt.lineDashOffset;ar&&Xt.setLineDash(ar),(0,he.Z)(rr)||(Xt.lineDashOffset=rr),(0,he.Z)(Jt)||(Xt.globalAlpha*=Jt),!(0,he.Z)(Wt)&&!Array.isArray(Wt)&&!Wt.isNone&&(Xt.strokeStyle=st.attributes.stroke),!(0,he.Z)(bn)&&!Array.isArray(bn)&&!bn.isNone&&(Xt.fillStyle=st.attributes.fill)}},{key:"convertAABB2Rect",value:function(Xt){var st=Xt.getMin(),dt=Xt.getMax(),Wt=Math.floor(st[0]),bn=Math.floor(st[1]),Jt=Math.ceil(dt[0]),ar=Math.ceil(dt[1]),rr=Jt-Wt,Kr=ar-bn;return{x:Wt,y:bn,width:rr,height:Kr}}},{key:"mergeDirtyAABBs",value:function(Xt){var st=new E.mN;return Xt.forEach(function(dt){var Wt=dt.getRenderBounds();st.add(Wt);var bn=dt.renderable.dirtyRenderBounds;bn&&st.add(bn)}),st}},{key:"saveDirtyAABB",value:function(Xt){var st=Xt.renderable;st.dirtyRenderBounds||(st.dirtyRenderBounds=new E.mN);var dt=Xt.getRenderBounds();dt&&st.dirtyRenderBounds.update(dt.center,dt.halfExtents)}},{key:"applyWorldTransform",value:function(Xt,st,dt){dt?(j.copy(this.tmpMat4,st.getLocalTransform()),j.multiply(this.tmpMat4,dt,this.tmpMat4),j.multiply(this.tmpMat4,this.vpMatrix,this.tmpMat4)):(j.copy(this.tmpMat4,st.getWorldTransform()),j.multiply(this.tmpMat4,this.vpMatrix,this.tmpMat4)),Xt.setTransform(this.tmpMat4[0],this.tmpMat4[1],this.tmpMat4[4],this.tmpMat4[5],this.tmpMat4[12],this.tmpMat4[13])}},{key:"safeMergeAABB",value:function(){for(var Xt=new E.mN,st=arguments.length,dt=new Array(st),Wt=0;Wt<st;Wt++)dt[Wt]=arguments[Wt];return dt.forEach(function(bn){Xt.add(bn)}),Xt}}])}();kt.tag="CanvasRenderer";function It(En,rn,Xt,st,dt,Wt,bn){var Jt,ar;if(En.image.nodeName==="rect"){var rr=En.image.parsedStyle,Kr=rr.width,si=rr.height;ar=st.contextService.getDPR();var Ie=st.config.offscreenCanvas;Jt=Wt.offscreenCanvasCreator.getOrCreateCanvas(Ie),Jt.width=Kr*ar,Jt.height=si*ar;var L=Wt.offscreenCanvasCreator.getOrCreateContext(Ie),Q={restoreStack:[],prevObject:null,currentContext:new Map};En.image.forEach(function(z){dt.renderDisplayObject(z,L,st,Q,Wt)}),Q.restoreStack.forEach(function(){L.restore()})}var w=bn.getOrCreatePatternSync(rn,En,Xt,Jt,ar,rn.getGeometryBounds().min,function(){rn.dirty(),st.renderingService.dirty()});return w}function Bn(En,rn,Xt,st){var dt;if(En.type===E.GL.LinearGradient||En.type===E.GL.RadialGradient){var Wt=rn.getGeometryBounds(),bn=Wt&&Wt.halfExtents[0]*2||1,Jt=Wt&&Wt.halfExtents[1]*2||1,ar=Wt&&Wt.min||[0,0];dt=st.getOrCreateGradient((0,C.Z)((0,C.Z)({type:En.type},En.value),{},{min:ar,width:bn,height:Jt}),Xt)}return dt}var Lt=["shadowBlur","shadowOffsetX","shadowOffsetY"],Wn=["lineCap","lineJoin","miterLimit"],Xn={globalAlpha:1,shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,shadowColor:"#000",filter:"none",globalCompositeOperation:"source-over",strokeStyle:"#000",strokeOpacity:1,lineWidth:1,lineDash:[],lineDashOffset:0,lineCap:"butt",lineJoin:"miter",miterLimit:10,fillStyle:"#000",fillOpacity:1},In={};function zn(En,rn,Xt,st){var dt=st.has(rn)?st.get(rn):Xn[rn];return dt!==Xt&&(rn==="lineDash"?En.setLineDash(Xt):En[rn]=Xt,st.set(rn,Xt)),dt}var dr=function(){function En(rn){(0,Z.Z)(this,En),this.imagePool=rn}return(0,m.Z)(En,[{key:"applyAttributesToContext",value:function(Xt,st){}},{key:"render",value:function(Xt,st,dt,Wt,bn,Jt){}},{key:"applyCommonStyleToContext",value:function(Xt,st,dt,Wt){var bn=dt?In:Wt.prevObject.parsedStyle,Jt=st.parsedStyle;(dt||Jt.opacity!==bn.opacity)&&zn(Xt,"globalAlpha",(0,he.Z)(Jt.opacity)?Xn.globalAlpha:Jt.opacity,Wt.currentContext),(dt||Jt.blend!==bn.blend)&&zn(Xt,"globalCompositeOperation",(0,he.Z)(Jt.blend)?Xn.globalCompositeOperation:Jt.blend,Wt.currentContext)}},{key:"applyStrokeFillStyleToContext",value:function(Xt,st,dt,Wt){var bn=dt?In:Wt.prevObject.parsedStyle,Jt=st.parsedStyle,ar=Jt.lineWidth,rr=ar===void 0?Xn.lineWidth:ar,Kr=Jt.fill&&!Jt.fill.isNone,si=Jt.stroke&&!Jt.stroke.isNone&&rr>0;if(si){if(dt||st.attributes.stroke!==Wt.prevObject.attributes.stroke){var Ie=!(0,he.Z)(Jt.stroke)&&!Array.isArray(Jt.stroke)&&!Jt.stroke.isNone?st.attributes.stroke:Xn.strokeStyle;zn(Xt,"strokeStyle",Ie,Wt.currentContext)}(dt||Jt.lineWidth!==bn.lineWidth)&&zn(Xt,"lineWidth",(0,he.Z)(Jt.lineWidth)?Xn.lineWidth:Jt.lineWidth,Wt.currentContext),(dt||Jt.lineDash!==bn.lineDash)&&zn(Xt,"lineDash",Jt.lineDash||Xn.lineDash,Wt.currentContext),(dt||Jt.lineDashOffset!==bn.lineDashOffset)&&zn(Xt,"lineDashOffset",(0,he.Z)(Jt.lineDashOffset)?Xn.lineDashOffset:Jt.lineDashOffset,Wt.currentContext);for(var L=0;L<Wn.length;L++){var Q=Wn[L];(dt||Jt[Q]!==bn[Q])&&zn(Xt,Q,(0,he.Z)(Jt[Q])?Xn[Q]:Jt[Q],Wt.currentContext)}}if(Kr&&(dt||st.attributes.fill!==Wt.prevObject.attributes.fill)){var w=!(0,he.Z)(Jt.fill)&&!Array.isArray(Jt.fill)&&!Jt.fill.isNone?st.attributes.fill:Xn.fillStyle;zn(Xt,"fillStyle",w,Wt.currentContext)}}},{key:"applyStyleToContext",value:function(Xt,st,dt,Wt){var bn=st.nodeName;this.applyCommonStyleToContext(Xt,st,dt,Wt),bn===E.bn.IMAGE||this.applyStrokeFillStyleToContext(Xt,st,dt,Wt)}},{key:"applyShadowAndFilterStyleToContext",value:function(Xt,st,dt,Wt){var bn=st.parsedStyle;if(dt){zn(Xt,"shadowColor",bn.shadowColor.toString(),Wt.currentContext);for(var Jt=0;Jt<Lt.length;Jt++){var ar=Lt[Jt];zn(Xt,ar,bn[ar]||Xn[ar],Wt.currentContext)}}bn.filter&&bn.filter.length&&zn(Xt,"filter",st.attributes.filter,Wt.currentContext)}},{key:"clearShadowAndFilterStyleForContext",value:function(Xt,st,dt,Wt){var bn=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!1;if(st){zn(Xt,"shadowColor",Xn.shadowColor,Wt.currentContext);for(var Jt=0;Jt<Lt.length;Jt++){var ar=Lt[Jt];zn(Xt,ar,Xn[ar],Wt.currentContext)}}if(dt)if(st&&bn){var rr=Xt.filter;!(0,he.Z)(rr)&&rr.indexOf("drop-shadow")>-1&&zn(Xt,"filter",rr.replace(/drop-shadow\([^)]*\)/,"").trim()||Xn.filter,Wt.currentContext)}else zn(Xt,"filter",Xn.filter,Wt.currentContext)}},{key:"fillToContext",value:function(Xt,st,dt,Wt,bn){var Jt=this,ar=st.parsedStyle,rr=ar.fill,Kr=ar.fillRule,si=null;if(Array.isArray(rr)&&rr.length>0)rr.forEach(function(L){var Q=zn(Xt,"fillStyle",Bn(L,st,Xt,Jt.imagePool),dt.currentContext);si=si!=null?si:Q,Kr?Xt.fill(Kr):Xt.fill()});else{if((0,E.R)(rr)){var Ie=It(rr,st,Xt,st.ownerDocument.defaultView.context,Wt,bn,this.imagePool);Ie&&(Xt.fillStyle=Ie,si=!0)}Kr?Xt.fill(Kr):Xt.fill()}si!==null&&zn(Xt,"fillStyle",si,dt.currentContext)}},{key:"strokeToContext",value:function(Xt,st,dt,Wt,bn){var Jt=this,ar=st.parsedStyle.stroke,rr=null;if(Array.isArray(ar)&&ar.length>0)ar.forEach(function(Ie){var L=zn(Xt,"strokeStyle",Bn(Ie,st,Xt,Jt.imagePool),dt.currentContext);rr=rr!=null?rr:L,Xt.stroke()});else{if((0,E.R)(ar)){var Kr=It(ar,st,Xt,st.ownerDocument.defaultView.context,Wt,bn,this.imagePool);if(Kr){var si=zn(Xt,"strokeStyle",Kr,dt.currentContext);rr=rr!=null?rr:si}}Xt.stroke()}rr!==null&&zn(Xt,"strokeStyle",rr,dt.currentContext)}},{key:"drawToContext",value:function(Xt,st,dt,Wt,bn){var Jt,ar=st.nodeName,rr=st.parsedStyle,Kr=rr.opacity,si=Kr===void 0?Xn.globalAlpha:Kr,Ie=rr.fillOpacity,L=Ie===void 0?Xn.fillOpacity:Ie,Q=rr.strokeOpacity,w=Q===void 0?Xn.strokeOpacity:Q,z=rr.lineWidth,ie=z===void 0?Xn.lineWidth:z,ze=rr.fill&&!rr.fill.isNone,Je=rr.stroke&&!rr.stroke.isNone&&ie>0;if(!(!ze&&!Je)){var At=!(0,he.Z)(rr.shadowColor)&&rr.shadowBlur>0,xt=rr.shadowType==="inner",Sn=((Jt=rr.fill)===null||Jt===void 0?void 0:Jt.alpha)===0,Oe=!!(rr.filter&&rr.filter.length),Qe=At&&Je&&(ar===E.bn.PATH||ar===E.bn.LINE||ar===E.bn.POLYLINE||Sn||xt),Re=null;if(ze){Qe||this.applyShadowAndFilterStyleToContext(Xt,st,At,dt);var Ke=si*L;Re=zn(Xt,"globalAlpha",Ke,dt.currentContext),this.fillToContext(Xt,st,dt,Wt,bn),Qe||this.clearShadowAndFilterStyleForContext(Xt,At,Oe,dt)}if(Je){var gt=!1,tn=si*w,yt=zn(Xt,"globalAlpha",tn,dt.currentContext);if(Re=ze?Re:yt,Qe&&(this.applyShadowAndFilterStyleToContext(Xt,st,At,dt),gt=!0,xt)){var Yt=Xt.globalCompositeOperation;Xt.globalCompositeOperation="source-atop",this.strokeToContext(Xt,st,dt,Wt,bn),Xt.globalCompositeOperation=Yt,this.clearShadowAndFilterStyleForContext(Xt,At,Oe,dt,!0)}this.strokeToContext(Xt,st,dt,Wt,bn),gt&&this.clearShadowAndFilterStyleForContext(Xt,At,Oe,dt)}Re!==null&&zn(Xt,"globalAlpha",Re,dt.currentContext)}}}])}(),vn=function(En){function rn(){return(0,Z.Z)(this,rn),(0,V.Z)(this,rn,arguments)}return(0,N.Z)(rn,En),(0,m.Z)(rn,[{key:"render",value:function(st,dt,Wt,bn,Jt,ar){var rr=dt.fill,Kr=dt.fillRule,si=dt.opacity,Ie=si===void 0?1:si,L=dt.fillOpacity,Q=L===void 0?1:L,w=dt.stroke,z=dt.strokeOpacity,ie=z===void 0?1:z,ze=dt.lineWidth,Je=ze===void 0?1:ze,At=dt.lineCap,xt=dt.lineJoin,Sn=dt.shadowType,Oe=dt.shadowColor,Qe=dt.shadowBlur,Re=dt.filter,Ke=dt.miterLimit,gt=rr&&!rr.isNone,tn=w&&!w.isNone&&Je>0,yt=(rr==null?void 0:rr.alpha)===0,Yt=!!(Re&&Re.length),Rn=!(0,he.Z)(Oe)&&Qe>0,er=Wt.nodeName,Jn=Sn==="inner",kr=tn&&Rn&&(er===E.bn.PATH||er===E.bn.LINE||er===E.bn.POLYLINE||yt||Jn);gt&&(st.globalAlpha=Ie*Q,kr||_r(Wt,st,Rn),Ge(st,Wt,rr,Kr,bn,Jt,ar,this.imagePool),kr||this.clearShadowAndFilter(st,Yt,Rn)),tn&&(st.globalAlpha=Ie*ie,st.lineWidth=Je,(0,he.Z)(Ke)||(st.miterLimit=Ke),(0,he.Z)(At)||(st.lineCap=At),(0,he.Z)(xt)||(st.lineJoin=xt),kr&&(Jn&&(st.globalCompositeOperation="source-atop"),_r(Wt,st,!0),Jn&&(Tt(st,Wt,w,bn,Jt,ar,this.imagePool),st.globalCompositeOperation=Xn.globalCompositeOperation,this.clearShadowAndFilter(st,Yt,!0))),Tt(st,Wt,w,bn,Jt,ar,this.imagePool))}},{key:"clearShadowAndFilter",value:function(st,dt,Wt){if(Wt&&(st.shadowColor="transparent",st.shadowBlur=0),dt){var bn=st.filter;!(0,he.Z)(bn)&&bn.indexOf("drop-shadow")>-1&&(st.filter=bn.replace(/drop-shadow\([^)]*\)/,"").trim()||"none")}}}])}(dr);function _r(En,rn,Xt){var st=En.parsedStyle,dt=st.filter,Wt=st.shadowColor,bn=st.shadowBlur,Jt=st.shadowOffsetX,ar=st.shadowOffsetY;dt&&dt.length&&(rn.filter=En.style.filter),Xt&&(rn.shadowColor=Wt.toString(),rn.shadowBlur=bn||0,rn.shadowOffsetX=Jt||0,rn.shadowOffsetY=ar||0)}function Ge(En,rn,Xt,st,dt,Wt,bn,Jt){var ar=arguments.length>8&&arguments[8]!==void 0?arguments[8]:!1;Array.isArray(Xt)?Xt.forEach(function(rr){En.fillStyle=Bn(rr,rn,En,Jt),ar||(st?En.fill(st):En.fill())}):((0,E.R)(Xt)&&(En.fillStyle=It(Xt,rn,En,dt,Wt,bn,Jt)),ar||(st?En.fill(st):En.fill()))}function Tt(En,rn,Xt,st,dt,Wt,bn){var Jt=arguments.length>7&&arguments[7]!==void 0?arguments[7]:!1;Array.isArray(Xt)?Xt.forEach(function(ar){En.strokeStyle=Bn(ar,rn,En,bn),Jt||En.stroke()}):((0,E.R)(Xt)&&(En.strokeStyle=It(Xt,rn,En,st,dt,Wt,bn)),Jt||En.stroke())}function On(En,rn){var Xt=(0,P.Z)(En,4),st=Xt[0],dt=Xt[1],Wt=Xt[2],bn=Xt[3],Jt=(0,P.Z)(rn,4),ar=Jt[0],rr=Jt[1],Kr=Jt[2],si=Jt[3],Ie=Math.max(st,ar),L=Math.max(dt,rr),Q=Math.min(st+Wt,ar+Kr),w=Math.min(dt+bn,rr+si);return Q<=Ie||w<=L?null:[Ie,L,Q-Ie,w-L]}function Vr(En,rn){var Xt=de.fF(de.Ue(),[En[0],En[1],0],rn),st=de.fF(de.Ue(),[En[0]+En[2],En[1],0],rn),dt=de.fF(de.Ue(),[En[0],En[1]+En[3],0],rn),Wt=de.fF(de.Ue(),[En[0]+En[2],En[1]+En[3],0],rn);return[Math.min(Xt[0],st[0],dt[0],Wt[0]),Math.min(Xt[1],st[1],dt[1],Wt[1]),Math.max(Xt[0],st[0],dt[0],Wt[0])-Math.min(Xt[0],st[0],dt[0],Wt[0]),Math.max(Xt[1],st[1],dt[1],Wt[1])-Math.min(Xt[1],st[1],dt[1],Wt[1])]}var en=function(En){function rn(){return(0,Z.Z)(this,rn),(0,V.Z)(this,rn,arguments)}return(0,N.Z)(rn,En),(0,m.Z)(rn,[{key:"renderDownSampled",value:function(st,dt,Wt,bn){var Jt=bn.src,ar=bn.imageCache;if(!ar.downSampled){this.imagePool.createDownSampledImage(Jt,Wt).then(function(){Wt.ownerDocument&&(Wt.dirty(),Wt.ownerDocument.defaultView.context.renderingService.dirty())}).catch(function(rr){console.error(rr)});return}st.drawImage(ar.downSampled,Math.floor(bn.drawRect[0]),Math.floor(bn.drawRect[1]),Math.ceil(bn.drawRect[2]),Math.ceil(bn.drawRect[3]))}},{key:"renderTile",value:function(st,dt,Wt,bn){var Jt=bn.src,ar=bn.imageCache,rr=bn.imageRect,Kr=bn.drawRect,si=ar.size,Ie=st.getTransform(),L=Ie.a,Q=Ie.b,w=Ie.c,z=Ie.d,ie=Ie.e,ze=Ie.f;if(st.resetTransform(),!(ar!=null&&ar.gridSize)){this.imagePool.createImageTiles(Jt,[],function(){Wt.ownerDocument&&(Wt.dirty(),Wt.ownerDocument.defaultView.context.renderingService.dirty())},Wt).catch(function(Rn){console.error(Rn)});return}for(var Je=[si[0]/rr[2],si[1]/rr[3]],At=[ar.tileSize[0]/Je[0],ar.tileSize[1]/Je[1]],xt=[Math.floor((Kr[0]-rr[0])/At[0]),Math.ceil((Kr[0]+Kr[2]-rr[0])/At[0])],Sn=xt[0],Oe=xt[1],Qe=[Math.floor((Kr[1]-rr[1])/At[1]),Math.ceil((Kr[1]+Kr[3]-rr[1])/At[1])],Re=Qe[0],Ke=Qe[1],gt=Re;gt<=Ke;gt++)for(var tn=Sn;tn<=Oe;tn++){var yt=ar.tiles[gt][tn];if(yt){var Yt=[Math.floor(rr[0]+yt.tileX*At[0]),Math.floor(rr[1]+yt.tileY*At[1]),Math.ceil(At[0]),Math.ceil(At[1])];st.drawImage(yt.data,Yt[0],Yt[1],Yt[2],Yt[3])}}st.setTransform(L,Q,w,z,ie,ze)}},{key:"render",value:function(st,dt,Wt){var bn=dt.x,Jt=bn===void 0?0:bn,ar=dt.y,rr=ar===void 0?0:ar,Kr=dt.width,si=dt.height,Ie=dt.src,L=dt.shadowColor,Q=dt.shadowBlur,w=this.imagePool.getImageSync(Ie,Wt),z=w==null?void 0:w.img,ie=Kr,ze=si;if(z){ie||(ie=z.width),ze||(ze=z.height);var Je=!(0,he.Z)(L)&&Q>0;_r(Wt,st,Je);try{var At=Wt.ownerDocument.defaultView.getContextService().getDomElement(),xt=At.width,Sn=At.height,Oe=st.getTransform(),Qe=Oe.a,Re=Oe.b,Ke=Oe.c,gt=Oe.d,tn=Oe.e,yt=Oe.f,Yt=j.fromValues(Qe,Ke,0,0,Re,gt,0,0,0,0,1,0,tn,yt,0,1),Rn=Vr([Jt,rr,ie,ze],Yt),er=On([0,0,xt,Sn],Rn);if(!er)return;if(!Wt.ownerDocument.defaultView.getConfig().enableLargeImageOptimization){rn.renderFull(st,dt,Wt,{image:z,drawRect:[Jt,rr,ie,ze]});return}var Jn=Rn[2]/w.size[0];if(Jn<(w.downSamplingRate||.5)){this.renderDownSampled(st,dt,Wt,{src:Ie,imageCache:w,drawRect:[Jt,rr,ie,ze]});return}if(!ImagePool.isSupportTile){rn.renderFull(st,dt,Wt,{image:z,drawRect:[Jt,rr,ie,ze]});return}this.renderTile(st,dt,Wt,{src:Ie,imageCache:w,imageRect:Rn,drawRect:er})}catch(kr){}}}},{key:"drawToContext",value:function(st,dt,Wt,bn,Jt){this.render(st,dt.parsedStyle,dt)}}],[{key:"renderFull",value:function(st,dt,Wt,bn){st.drawImage(bn.image,Math.floor(bn.drawRect[0]),Math.floor(bn.drawRect[1]),Math.ceil(bn.drawRect[2]),Math.ceil(bn.drawRect[3]))}}])}(vn),ln=function(En){function rn(){return(0,Z.Z)(this,rn),(0,V.Z)(this,rn,arguments)}return(0,N.Z)(rn,En),(0,m.Z)(rn,[{key:"render",value:function(st,dt,Wt,bn,Jt,ar){Wt.getBounds();var rr=dt.lineWidth,Kr=rr===void 0?1:rr,si=dt.textAlign,Ie=si===void 0?"start":si,L=dt.textBaseline,Q=L===void 0?"alphabetic":L,w=dt.lineJoin,z=w===void 0?"miter":w,ie=dt.miterLimit,ze=ie===void 0?10:ie,Je=dt.letterSpacing,At=Je===void 0?0:Je,xt=dt.stroke,Sn=dt.fill,Oe=dt.fillRule,Qe=dt.fillOpacity,Re=Qe===void 0?1:Qe,Ke=dt.strokeOpacity,gt=Ke===void 0?1:Ke,tn=dt.opacity,yt=tn===void 0?1:tn,Yt=dt.metrics,Rn=dt.x,er=Rn===void 0?0:Rn,Jn=dt.y,kr=Jn===void 0?0:Jn,fr=dt.dx,wr=dt.dy,ei=dt.shadowColor,_n=dt.shadowBlur,jn=dt.textDecorationLine,Hr=Yt.font,Pr=Yt.lines,$i=Yt.height,Zi=Yt.lineHeight,Xi=Yt.lineMetrics;st.font=Hr,st.lineWidth=Kr,st.textAlign=Ie==="middle"?"center":Ie;var Ei=Q;Ei==="alphabetic"&&(Ei="bottom"),st.lineJoin=z,(0,he.Z)(ze)||(st.miterLimit=ze);var ms=kr;Q==="middle"?ms+=-$i/2-Zi/2:Q==="bottom"||Q==="alphabetic"||Q==="ideographic"?ms+=-$i:(Q==="top"||Q==="hanging")&&(ms+=-Zi);var _i=er+(fr||0);ms+=wr||0,Pr.length===1&&(Ei==="bottom"?(Ei="middle",ms-=.5*$i):Ei==="top"&&(Ei="middle",ms+=.5*$i)),st.textBaseline=Ei;var Es=!(0,he.Z)(ei)&&_n>0;_r(Wt,st,Es);for(var ua=0;ua<Pr.length;ua++){var Hn=Kr/2+_i;ms+=Zi,!(0,he.Z)(xt)&&!xt.isNone&&Kr&&this.drawLetterSpacing(st,Wt,Pr[ua],Xi[ua],Ie,Hn,ms,At,Sn,Oe,Re,xt,gt,yt,!0,bn,Jt,ar),(0,he.Z)(Sn)||this.drawLetterSpacing(st,Wt,Pr[ua],Xi[ua],Ie,Hn,ms,At,Sn,Oe,Re,xt,gt,yt,!1,bn,Jt,ar)}jn&&jn!=="none"&&this.drawTextDecorations(st,dt,Wt,Pr,Zi,_i,kr+(wr||0),bn,Jt,ar)}},{key:"drawLetterSpacing",value:function(st,dt,Wt,bn,Jt,ar,rr,Kr,si,Ie,L,Q,w,z,ie,ze,Je,At){if(Kr===0){ie?this.strokeText(st,dt,Wt,ar,rr,Q,w,ze,Je,At):this.fillText(st,dt,Wt,ar,rr,si,Ie,L,z,ze,Je,At);return}var xt=st.textAlign;st.textAlign="left";var Sn=ar;Jt==="center"||Jt==="middle"?Sn=ar-bn.width/2:(Jt==="right"||Jt==="end")&&(Sn=ar-bn.width);for(var Oe=Array.from(Wt),Qe=st.measureText(Wt).width,Re=0,Ke=0;Ke<Oe.length;++Ke){var gt=Oe[Ke];ie?this.strokeText(st,dt,gt,Sn,rr,Q,w,ze,Je,At):this.fillText(st,dt,gt,Sn,rr,si,Ie,L,z,ze,Je,At),Re=st.measureText(Wt.substring(Ke+1)).width,Sn+=Qe-Re+Kr,Qe=Re}st.textAlign=xt}},{key:"fillText",value:function(st,dt,Wt,bn,Jt,ar,rr,Kr,si,Ie,L,Q){Ge(st,dt,ar,rr,Ie,L,Q,this.imagePool,!0);var w,z=!(0,he.Z)(Kr)&&Kr!==1;z&&(w=st.globalAlpha,st.globalAlpha=Kr*si),st.fillText(Wt,bn,Jt),z&&(st.globalAlpha=w)}},{key:"strokeText",value:function(st,dt,Wt,bn,Jt,ar,rr,Kr,si,Ie){Tt(st,dt,ar,Kr,si,Ie,this.imagePool,!0);var L,Q=!(0,he.Z)(rr)&&rr!==1;Q&&(L=st.globalAlpha,st.globalAlpha=rr),st.strokeText(Wt,bn,Jt),Q&&(st.globalAlpha=L)}},{key:"drawTextDecorations",value:function(st,dt,Wt,bn,Jt,ar,rr,Kr,si,Ie){var L=dt.textDecorationLine,Q=dt.textDecorationColor,w=dt.textDecorationStyle,z=dt.textDecorationThickness,ie=z===void 0?1:z,ze=dt.textAlign,Je=ze===void 0?"start":ze,At=dt.lineWidth,xt=At===void 0?1:At,Sn=dt.metrics;if(!(!L||L==="none")){var Oe=Sn.lineMetrics,Qe=L.split(" ");switch(st.lineWidth=ie,Q&&(st.strokeStyle="rgba(".concat(Q.r,", ").concat(Q.g,", ").concat(Q.b,", ").concat(Q.alpha,")")),w){case"dashed":st.setLineDash([5,5]);break;case"dotted":st.setLineDash([2,2]);break;case"wavy":st.setLineDash([]);break;default:st.setLineDash([]);break}var Re=rr,Ke=dt.textBaseline,gt=Ke===void 0?"alphabetic":Ke;gt==="middle"?Re+=-Sn.height/2-Jt/2:gt==="bottom"||gt==="alphabetic"||gt==="ideographic"?Re+=-Sn.height:(gt==="top"||gt==="hanging")&&(Re+=-Jt);for(var tn=0;tn<bn.length;tn++){Re+=Jt;var yt=Oe[tn];if(yt){var Yt=xt/2,Rn=ar,er=ar+yt.width;Je==="center"||Je==="middle"?(Rn=ar-yt.width/2,er=ar+yt.width/2):(Je==="right"||Je==="end")&&(Rn=ar-yt.width,er=ar),Rn+=Yt,er+=Yt;var Jn=(0,$e.Z)(Qe),kr;try{for(Jn.s();!(kr=Jn.n()).done;){var fr=kr.value,wr=Re;switch(fr){case"underline":wr+=2;break;case"overline":wr-=Jt-2;break;case"line-through":wr-=Jt/2;break;default:continue}w==="wavy"?this.drawWavyLine(st,Rn,er,wr):(st.beginPath(),st.moveTo(Rn,wr),st.lineTo(er,wr),st.stroke())}}catch(ei){Jn.e(ei)}finally{Jn.f()}}}st.setLineDash([])}}},{key:"drawWavyLine",value:function(st,dt,Wt,bn){var Jt=2,ar=10,rr=Math.floor((Wt-dt)/ar);st.beginPath(),st.moveTo(dt,bn);for(var Kr=0;Kr<rr;Kr++){var si=dt+Kr*ar+ar/4,Ie=bn+Jt,L=dt+Kr*ar+ar/2,Q=bn;st.quadraticCurveTo(si,Ie,L,Q);var w=dt+Kr*ar+ar*3/4,z=bn-Jt,ie=dt+(Kr+1)*ar,ze=bn;st.quadraticCurveTo(w,z,ie,ze)}st.stroke()}},{key:"drawToContext",value:function(st,dt,Wt,bn,Jt){this.render(st,dt.parsedStyle,dt,dt.ownerDocument.defaultView.context,bn,Jt)}}])}(vn),Cn=function(En){function rn(){var Xt,st=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return(0,Z.Z)(this,rn),Xt=(0,V.Z)(this,rn),Xt.name="canvas-renderer",Xt.options=st,Xt}return(0,N.Z)(rn,En),(0,m.Z)(rn,[{key:"init",value:function(){var st,dt=(0,C.Z)({dirtyObjectNumThreshold:500,dirtyObjectRatioThreshold:.8},this.options),Wt=this.context.imagePool,bn=new vn(Wt),Jt=(st={},(0,F.Z)((0,F.Z)((0,F.Z)((0,F.Z)((0,F.Z)((0,F.Z)((0,F.Z)((0,F.Z)((0,F.Z)((0,F.Z)(st,E.bn.CIRCLE,bn),E.bn.ELLIPSE,bn),E.bn.RECT,bn),E.bn.IMAGE,new en(Wt)),E.bn.TEXT,new ln(Wt)),E.bn.LINE,bn),E.bn.POLYLINE,bn),E.bn.POLYGON,bn),E.bn.PATH,bn),E.bn.GROUP,void 0),(0,F.Z)((0,F.Z)((0,F.Z)(st,E.bn.HTML,void 0),E.bn.MESH,void 0),E.bn.FRAGMENT,void 0));this.context.defaultStyleRendererFactory=Jt,this.context.styleRendererFactory=Jt,this.addRenderingPlugin(new kt(dt))}},{key:"destroy",value:function(){this.removeAllRenderingPlugins(),delete this.context.defaultStyleRendererFactory,delete this.context.styleRendererFactory}}])}(E.F6),Mt=Object.freeze({__proto__:null,CircleRenderer:vn,DefaultRenderer:vn,EllipseRenderer:vn,ImageRenderer:en,LineRenderer:vn,PathRenderer:vn,Plugin:Cn,PolygonRenderer:vn,PolylineRenderer:vn,RectRenderer:vn,TextRenderer:ln}),Et=de.Ue(),pe=de.Ue(),Ae=de.Ue(),Pe=j.create(),Ut=function(){function En(){var rn=this;(0,Z.Z)(this,En),this.isHit=function(Xt,st,dt,Wt){var bn=rn.context.pointInPathPickerFactory[Xt.nodeName];if(bn){var Jt=j.invert(Pe,dt),ar=de.fF(pe,de.t8(Ae,st[0],st[1],0),Jt);if(bn(Xt,new E.E9(ar[0],ar[1]),Wt,rn.isPointInPath,rn.context,rn.runtime))return!0}return!1},this.isPointInPath=function(Xt,st){var dt=rn.runtime.offscreenCanvasCreator.getOrCreateContext(rn.context.config.offscreenCanvas),Wt=rn.context.pathGeneratorFactory[Xt.nodeName];return Wt&&(dt.beginPath(),Wt(dt,Xt.parsedStyle),dt.closePath()),dt.isPointInPath(st.x,st.y)}}return(0,m.Z)(En,[{key:"apply",value:function(Xt,st){var dt,Wt=this,bn=Xt.renderingService,Jt=Xt.renderingContext;this.context=Xt,this.runtime=st;var ar=(dt=Jt.root)===null||dt===void 0?void 0:dt.ownerDocument;bn.hooks.pick.tapPromise(En.tag,function(){var rr=(0,ct.Z)((0,Fe.Z)().mark(function Kr(si){return(0,Fe.Z)().wrap(function(Ie){for(;;)switch(Ie.prev=Ie.next){case 0:return Ie.abrupt("return",Wt.pick(ar,si));case 1:case"end":return Ie.stop()}},Kr)}));return function(Kr){return rr.apply(this,arguments)}}()),bn.hooks.pickSync.tap(En.tag,function(rr){return Wt.pick(ar,rr)})}},{key:"pick",value:function(Xt,st){var dt=st.topmost,Wt=st.position,bn=Wt.x,Jt=Wt.y,ar=de.t8(Et,bn,Jt,0),rr=Xt.elementsFromBBox(ar[0],ar[1],ar[0],ar[1]),Kr=[],si=(0,$e.Z)(rr),Ie;try{for(si.s();!(Ie=si.n()).done;){var L=Ie.value,Q=L.getWorldTransform(),w=this.isHit(L,ar,Q,!1);if(w){var z=(0,E.Oi)(L);if(z){var ie=z.parsedStyle.clipPath,ze=this.isHit(ie,ar,ie.getWorldTransform(),!0);if(ze){if(dt)return st.picked=[L],st;Kr.push(L)}}else{if(dt)return st.picked=[L],st;Kr.push(L)}}}}catch(Je){si.e(Je)}finally{si.f()}return st.picked=Kr,st}}])}();Ut.tag="CanvasPicker";function jt(En,rn,Xt){var st=En.parsedStyle,dt=st.cx,Wt=dt===void 0?0:dt,bn=st.cy,Jt=bn===void 0?0:bn,ar=st.r,rr=st.fill,Kr=st.stroke,si=st.lineWidth,Ie=si===void 0?1:si,L=st.increasedLineWidthForHitTesting,Q=L===void 0?0:L,w=st.pointerEvents,z=w===void 0?"auto":w,ie=(Ie+Q)/2,ze=(0,vt.TE)(Wt,Jt,rn.x,rn.y),Je=(0,E.L1)(z,rr,Kr),At=(0,P.Z)(Je,2),xt=At[0],Sn=At[1];return xt&&Sn||Xt?ze<=ar+ie:xt?ze<=ar:Sn?ze>=ar-ie&&ze<=ar+ie:!1}function ft(En,rn,Xt,st){return En/(Xt*Xt)+rn/(st*st)}function on(En,rn,Xt){var st=En.parsedStyle,dt=st.cx,Wt=dt===void 0?0:dt,bn=st.cy,Jt=bn===void 0?0:bn,ar=st.rx,rr=st.ry,Kr=st.fill,si=st.stroke,Ie=st.lineWidth,L=Ie===void 0?1:Ie,Q=st.increasedLineWidthForHitTesting,w=Q===void 0?0:Q,z=st.pointerEvents,ie=z===void 0?"auto":z,ze=rn.x,Je=rn.y,At=(0,E.L1)(ie,Kr,si),xt=(0,P.Z)(At,2),Sn=xt[0],Oe=xt[1],Qe=(L+w)/2,Re=(ze-Wt)*(ze-Wt),Ke=(Je-Jt)*(Je-Jt);return Sn&&Oe||Xt?ft(Re,Ke,ar+Qe,rr+Qe)<=1:Sn?ft(Re,Ke,ar,rr)<=1:Oe?ft(Re,Ke,ar-Qe,rr-Qe)>=1&&ft(Re,Ke,ar+Qe,rr+Qe)<=1:!1}function hn(En,rn,Xt,st,dt,Wt){return dt>=En&&dt<=En+Xt&&Wt>=rn&&Wt<=rn+st}function lt(En,rn,Xt,st,dt,Wt,bn){var Jt=dt/2;return hn(En-Jt,rn-Jt,Xt,dt,Wt,bn)||hn(En+Xt-Jt,rn-Jt,dt,st,Wt,bn)||hn(En+Jt,rn+st-Jt,Xt,dt,Wt,bn)||hn(En-Jt,rn+Jt,dt,st,Wt,bn)}function Ct(En,rn,Xt,st,dt,Wt,bn,Jt){var ar=(Math.atan2(Jt-rn,bn-En)+Math.PI*2)%(Math.PI*2),rr={x:En+Xt*Math.cos(ar),y:rn+Xt*Math.sin(ar)};return(0,vt.TE)(rr.x,rr.y,bn,Jt)<=Wt/2}function sn(En,rn,Xt,st,dt,Wt,bn){var Jt=Math.min(En,Xt),ar=Math.max(En,Xt),rr=Math.min(rn,st),Kr=Math.max(rn,st),si=dt/2;return Wt>=Jt-si&&Wt<=ar+si&&bn>=rr-si&&bn<=Kr+si?(0,vt._x)(En,rn,Xt,st,Wt,bn)<=dt/2:!1}function W(En,rn,Xt,st,dt){var Wt=En.length;if(Wt<2)return!1;for(var bn=0;bn<Wt-1;bn++){var Jt=En[bn][0],ar=En[bn][1],rr=En[bn+1][0],Kr=En[bn+1][1];if(sn(Jt,ar,rr,Kr,rn,Xt,st))return!0}if(dt){var si=En[0],Ie=En[Wt-1];if(sn(si[0],si[1],Ie[0],Ie[1],rn,Xt,st))return!0}return!1}var Se=1e-6;function Ht(En){return Math.abs(En)<Se?0:En<0?-1:1}function zt(En,rn,Xt){return(Xt[0]-En[0])*(rn[1]-En[1])===(rn[0]-En[0])*(Xt[1]-En[1])&&Math.min(En[0],rn[0])<=Xt[0]&&Xt[0]<=Math.max(En[0],rn[0])&&Math.min(En[1],rn[1])<=Xt[1]&&Xt[1]<=Math.max(En[1],rn[1])}function Fn(En,rn,Xt){var st=!1,dt=En.length;if(dt<=2)return!1;for(var Wt=0;Wt<dt;Wt++){var bn=En[Wt],Jt=En[(Wt+1)%dt];if(zt(bn,Jt,[rn,Xt]))return!0;Ht(bn[1]-Xt)>0!=Ht(Jt[1]-Xt)>0&&Ht(rn-(Xt-bn[1])*(bn[0]-Jt[0])/(bn[1]-Jt[1])-bn[0])<0&&(st=!st)}return st}function Tn(En,rn,Xt){for(var st=!1,dt=0;dt<En.length;dt++){var Wt=En[dt];if(st=Fn(Wt,rn,Xt),st)break}return st}function lr(En,rn,Xt){var st=En.parsedStyle,dt=st.x1,Wt=st.y1,bn=st.x2,Jt=st.y2,ar=st.lineWidth,rr=ar===void 0?1:ar,Kr=st.increasedLineWidthForHitTesting,si=Kr===void 0?0:Kr,Ie=st.pointerEvents,L=Ie===void 0?"auto":Ie,Q=st.fill,w=st.stroke,z=(0,E.L1)(L,Q,w),ie=(0,P.Z)(z,2),ze=ie[1];return!ze&&!Xt||!rr?!1:sn(dt,Wt,bn,Jt,rr+si,rn.x,rn.y)}function je(En,rn,Xt,st,dt){for(var Wt=!1,bn=rn/2,Jt=0;Jt<En.length;Jt++){var ar=En[Jt],rr=ar.currentPoint,Kr=ar.params,si=ar.prePoint,Ie=ar.box;if(!(Ie&&!hn(Ie.x-bn,Ie.y-bn,Ie.width+rn,Ie.height+rn,Xt,st)))switch(ar.command){case"L":case"Z":if(Wt=sn(si[0],si[1],rr[0],rr[1],rn,Xt,st),Wt)return!0;break;case"Q":var L=(0,vt.Y1)(si[0],si[1],Kr[1],Kr[2],Kr[3],Kr[4],Xt,st);if(Wt=L<=rn/2,Wt)return!0;break;case"C":var Q=(0,vt.ph)(si[0],si[1],Kr[1],Kr[2],Kr[3],Kr[4],Kr[5],Kr[6],Xt,st,dt);if(Wt=Q<=rn/2,Wt)return!0;break;case"A":ar.cubicParams||(ar.cubicParams=(0,we.W)(si[0],si[1],Kr[1],Kr[2],Kr[3],Kr[4],Kr[5],Kr[6],Kr[7],void 0));for(var w=ar.cubicParams,z=si,ie=0;ie<w.length;ie+=6){var ze=(0,vt.ph)(z[0],z[1],w[ie],w[ie+1],w[ie+2],w[ie+3],w[ie+4],w[ie+5],Xt,st,dt);if(z=[w[ie+4],w[ie+5]],Wt=ze<=rn/2,Wt)return!0}break}}return Wt}function be(En,rn,Xt,st,dt,Wt){var bn=En.parsedStyle,Jt=bn.lineWidth,ar=Jt===void 0?1:Jt,rr=bn.increasedLineWidthForHitTesting,Kr=rr===void 0?0:rr,si=bn.stroke,Ie=bn.fill,L=bn.d,Q=bn.pointerEvents,w=Q===void 0?"auto":Q,z=L.segments,ie=L.hasArc,ze=L.polylines,Je=L.polygons,At=(0,E.L1)(w,(Je==null?void 0:Je.length)&&Ie,si),xt=(0,P.Z)(At,2),Sn=xt[0],Oe=xt[1],Qe=(0,E.gz)(En),Re=!1;return Sn||Xt?(ie?Re=st(En,rn):Re=Tn(Je,rn.x,rn.y)||Tn(ze,rn.x,rn.y),Re):((Oe||Xt)&&(Re=je(z,ar+Kr,rn.x,rn.y,Qe)),Re)}function it(En,rn,Xt){var st=En.parsedStyle,dt=st.stroke,Wt=st.fill,bn=st.lineWidth,Jt=bn===void 0?1:bn,ar=st.increasedLineWidthForHitTesting,rr=ar===void 0?0:ar,Kr=st.points,si=st.pointerEvents,Ie=si===void 0?"auto":si,L=(0,E.L1)(Ie,Wt,dt),Q=(0,P.Z)(L,2),w=Q[0],z=Q[1],ie=!1;return(z||Xt)&&(ie=W(Kr.points,Jt+rr,rn.x,rn.y,!0)),!ie&&(w||Xt)&&(ie=Fn(Kr.points,rn.x,rn.y)),ie}function wt(En,rn,Xt){var st=En.parsedStyle,dt=st.lineWidth,Wt=dt===void 0?1:dt,bn=st.increasedLineWidthForHitTesting,Jt=bn===void 0?0:bn,ar=st.points,rr=st.pointerEvents,Kr=rr===void 0?"auto":rr,si=st.fill,Ie=st.stroke,L=(0,E.L1)(Kr,si,Ie),Q=(0,P.Z)(L,2),w=Q[1];return!w&&!Xt||!Wt?!1:W(ar.points,Wt+Jt,rn.x,rn.y,!1)}function ot(En,rn,Xt,st,dt){var Wt=En.parsedStyle,bn=Wt.radius,Jt=Wt.fill,ar=Wt.stroke,rr=Wt.lineWidth,Kr=rr===void 0?1:rr,si=Wt.increasedLineWidthForHitTesting,Ie=si===void 0?0:si,L=Wt.x,Q=L===void 0?0:L,w=Wt.y,z=w===void 0?0:w,ie=Wt.width,ze=Wt.height,Je=Wt.pointerEvents,At=Je===void 0?"auto":Je,xt=(0,E.L1)(At,Jt,ar),Sn=(0,P.Z)(xt,2),Oe=Sn[0],Qe=Sn[1],Re=bn&&bn.some(function(yt){return yt!==0}),Ke=Kr+Ie;if(Re){var tn=!1;return(Qe||Xt)&&(tn=ut(Q,z,ie,ze,bn.map(function(yt){return(0,ve.Z)(yt,0,Math.min(Math.abs(ie)/2,Math.abs(ze)/2))}),Ke,rn.x,rn.y)),!tn&&(Oe||Xt)&&(tn=st(En,rn)),tn}else{var gt=Ke/2;if(Oe&&Qe||Xt)return hn(Q-gt,z-gt,ie+gt,ze+gt,rn.x,rn.y);if(Oe)return hn(Q,z,ie,ze,rn.x,rn.y);if(Qe)return lt(Q,z,ie,ze,Ke,rn.x,rn.y)}return!1}function ut(En,rn,Xt,st,dt,Wt,bn,Jt){var ar=(0,P.Z)(dt,4),rr=ar[0],Kr=ar[1],si=ar[2],Ie=ar[3];return sn(En+rr,rn,En+Xt-Kr,rn,Wt,bn,Jt)||sn(En+Xt,rn+Kr,En+Xt,rn+st-si,Wt,bn,Jt)||sn(En+Xt-si,rn+st,En+Ie,rn+st,Wt,bn,Jt)||sn(En,rn+st-Ie,En,rn+rr,Wt,bn,Jt)||Ct(En+Xt-Kr,rn+Kr,Kr,1.5*Math.PI,2*Math.PI,Wt,bn,Jt)||Ct(En+Xt-si,rn+st-si,si,0,.5*Math.PI,Wt,bn,Jt)||Ct(En+Ie,rn+st-Ie,Ie,.5*Math.PI,Math.PI,Wt,bn,Jt)||Ct(En+rr,rn+rr,rr,Math.PI,1.5*Math.PI,Wt,bn,Jt)}function _t(En,rn,Xt,st,dt,Wt){var bn=En.parsedStyle,Jt=bn.pointerEvents,ar=Jt===void 0?"auto":Jt,rr=bn.x,Kr=rr===void 0?0:rr,si=bn.y,Ie=si===void 0?0:si,L=bn.width,Q=bn.height;if(ar==="non-transparent-pixel"){var w=dt.config.offscreenCanvas,z=Wt.offscreenCanvasCreator.getOrCreateCanvas(w),ie=Wt.offscreenCanvasCreator.getOrCreateContext(w,{willReadFrequently:!0});z.width=L,z.height=Q,dt.defaultStyleRendererFactory[E.bn.IMAGE].render(ie,(0,C.Z)((0,C.Z)({},En.parsedStyle),{},{x:0,y:0}),En,void 0,void 0,void 0);var ze=ie.getImageData(rn.x-Kr,rn.y-Ie,1,1).data;return ze.every(function(Je){return Je!==0})}return!0}function $t(En,rn,Xt,st){var dt=En.getGeometryBounds();return rn.x>=dt.min[0]&&rn.y>=dt.min[1]&&rn.x<=dt.max[0]&&rn.y<=dt.max[1]}var Vt=function(En){function rn(){var Xt;(0,Z.Z)(this,rn);for(var st=arguments.length,dt=new Array(st),Wt=0;Wt<st;Wt++)dt[Wt]=arguments[Wt];return Xt=(0,V.Z)(this,rn,[].concat(dt)),Xt.name="canvas-picker",Xt}return(0,N.Z)(rn,En),(0,m.Z)(rn,[{key:"init",value:function(){var st,dt=(st={},(0,F.Z)((0,F.Z)((0,F.Z)((0,F.Z)((0,F.Z)((0,F.Z)((0,F.Z)((0,F.Z)((0,F.Z)((0,F.Z)(st,E.bn.CIRCLE,jt),E.bn.ELLIPSE,on),E.bn.RECT,ot),E.bn.LINE,lr),E.bn.POLYLINE,wt),E.bn.POLYGON,it),E.bn.PATH,be),E.bn.TEXT,$t),E.bn.GROUP,null),E.bn.IMAGE,_t),(0,F.Z)((0,F.Z)(st,E.bn.HTML,null),E.bn.MESH,null));this.context.pointInPathPickerFactory=dt,this.addRenderingPlugin(new Ut)}},{key:"destroy",value:function(){delete this.context.pointInPathPickerFactory,this.removeAllRenderingPlugins()}}])}(E.F6),Qt=Object.freeze({__proto__:null,Plugin:Vt});function cn(En,rn){var Xt=rn.cx,st=Xt===void 0?0:Xt,dt=rn.cy,Wt=dt===void 0?0:dt,bn=rn.r;En.arc(st,Wt,bn,0,Math.PI*2,!1)}function Yn(En,rn){var Xt=rn.cx,st=Xt===void 0?0:Xt,dt=rn.cy,Wt=dt===void 0?0:dt,bn=rn.rx,Jt=rn.ry;if(En.ellipse)En.ellipse(st,Wt,bn,Jt,0,0,Math.PI*2,!1);else{var ar=bn>Jt?bn:Jt,rr=bn>Jt?1:bn/Jt,Kr=bn>Jt?Jt/bn:1;En.save(),En.scale(rr,Kr),En.arc(st,Wt,ar,0,Math.PI*2)}}function qn(En,rn){var Xt=rn.x1,st=rn.y1,dt=rn.x2,Wt=rn.y2,bn=rn.markerStart,Jt=rn.markerEnd,ar=rn.markerStartOffset,rr=rn.markerEndOffset,Kr=0,si=0,Ie=0,L=0,Q=0,w,z;bn&&(0,E.RV)(bn)&&ar&&(w=dt-Xt,z=Wt-st,Q=Math.atan2(z,w),Kr=Math.cos(Q)*(ar||0),si=Math.sin(Q)*(ar||0)),Jt&&(0,E.RV)(Jt)&&rr&&(w=Xt-dt,z=st-Wt,Q=Math.atan2(z,w),Ie=Math.cos(Q)*(rr||0),L=Math.sin(Q)*(rr||0)),En.moveTo(Xt+Kr,st+si),En.lineTo(dt+Ie,Wt+L)}function Sr(En,rn){var Xt=rn.markerStart,st=rn.markerEnd,dt=rn.markerStartOffset,Wt=rn.markerEndOffset,bn=rn.d,Jt=bn.absolutePath,ar=bn.segments,rr=0,Kr=0,si=0,Ie=0,L=0,Q,w;if(Xt&&(0,E.RV)(Xt)&&dt){var z=Xt.parentNode.getStartTangent(),ie=(0,P.Z)(z,2),ze=ie[0],Je=ie[1];Q=ze[0]-Je[0],w=ze[1]-Je[1],L=Math.atan2(w,Q),rr=Math.cos(L)*(dt||0),Kr=Math.sin(L)*(dt||0)}if(st&&(0,E.RV)(st)&&Wt){var At=st.parentNode.getEndTangent(),xt=(0,P.Z)(At,2),Sn=xt[0],Oe=xt[1];Q=Sn[0]-Oe[0],w=Sn[1]-Oe[1],L=Math.atan2(w,Q),si=Math.cos(L)*(Wt||0),Ie=Math.sin(L)*(Wt||0)}for(var Qe=0;Qe<Jt.length;Qe++){var Re=Jt[Qe],Ke=Re[0],gt=Jt[Qe+1],tn=Qe===0&&(rr!==0||Kr!==0),yt=(Qe===Jt.length-1||gt&&(gt[0]==="M"||gt[0]==="Z"))&&si!==0&&Ie!==0,Yt=tn?[rr,Kr]:[0,0],Rn=(0,P.Z)(Yt,2),er=Rn[0],Jn=Rn[1],kr=yt?[si,Ie]:[0,0],fr=(0,P.Z)(kr,2),wr=fr[0],ei=fr[1];switch(Ke){case"M":En.moveTo(Re[1]+er,Re[2]+Jn);break;case"L":En.lineTo(Re[1]+wr,Re[2]+ei);break;case"Q":En.quadraticCurveTo(Re[1],Re[2],Re[3]+wr,Re[4]+ei);break;case"C":En.bezierCurveTo(Re[1],Re[2],Re[3],Re[4],Re[5]+wr,Re[6]+ei);break;case"A":{var _n=ar[Qe].arcParams,jn=_n.cx,Hr=_n.cy,Pr=_n.rx,$i=_n.ry,Zi=_n.startAngle,Xi=_n.endAngle,Ei=_n.xRotation,ms=_n.sweepFlag;if(En.ellipse)En.ellipse(jn,Hr,Pr,$i,Ei,Zi,Xi,!!(1-ms));else{var _i=Pr>$i?Pr:$i,Es=Pr>$i?1:Pr/$i,ua=Pr>$i?$i/Pr:1;En.translate(jn,Hr),En.rotate(Ei),En.scale(Es,ua),En.arc(0,0,_i,Zi,Xi,!!(1-ms)),En.scale(1/Es,1/ua),En.rotate(-Ei),En.translate(-jn,-Hr)}yt&&En.lineTo(Re[6]+si,Re[7]+Ie);break}case"Z":En.closePath();break}}}function Jr(En,rn){var Xt=rn.markerStart,st=rn.markerEnd,dt=rn.markerStartOffset,Wt=rn.markerEndOffset,bn=rn.points.points,Jt=bn.length,ar=bn[0][0],rr=bn[0][1],Kr=bn[Jt-1][0],si=bn[Jt-1][1],Ie=0,L=0,Q=0,w=0,z=0,ie,ze;Xt&&(0,E.RV)(Xt)&&dt&&(ie=bn[1][0]-bn[0][0],ze=bn[1][1]-bn[0][1],z=Math.atan2(ze,ie),Ie=Math.cos(z)*(dt||0),L=Math.sin(z)*(dt||0)),st&&(0,E.RV)(st)&&Wt&&(ie=bn[Jt-1][0]-bn[0][0],ze=bn[Jt-1][1]-bn[0][1],z=Math.atan2(ze,ie),Q=Math.cos(z)*(Wt||0),w=Math.sin(z)*(Wt||0)),En.moveTo(ar+(Ie||Q),rr+(L||w));for(var Je=1;Je<Jt-1;Je++){var At=bn[Je];En.lineTo(At[0],At[1])}En.lineTo(Kr,si)}function vr(En,rn){var Xt=rn.markerStart,st=rn.markerEnd,dt=rn.markerStartOffset,Wt=rn.markerEndOffset,bn=rn.points.points,Jt=bn.length,ar=bn[0][0],rr=bn[0][1],Kr=bn[Jt-1][0],si=bn[Jt-1][1],Ie=0,L=0,Q=0,w=0,z=0,ie,ze;Xt&&(0,E.RV)(Xt)&&dt&&(ie=bn[1][0]-bn[0][0],ze=bn[1][1]-bn[0][1],z=Math.atan2(ze,ie),Ie=Math.cos(z)*(dt||0),L=Math.sin(z)*(dt||0)),st&&(0,E.RV)(st)&&Wt&&(ie=bn[Jt-2][0]-bn[Jt-1][0],ze=bn[Jt-2][1]-bn[Jt-1][1],z=Math.atan2(ze,ie),Q=Math.cos(z)*(Wt||0),w=Math.sin(z)*(Wt||0)),En.moveTo(ar+Ie,rr+L);for(var Je=1;Je<Jt-1;Je++){var At=bn[Je];En.lineTo(At[0],At[1])}En.lineTo(Kr+Q,si+w)}function Ki(En,rn){var Xt=rn.x,st=Xt===void 0?0:Xt,dt=rn.y,Wt=dt===void 0?0:dt,bn=rn.radius,Jt=rn.width,ar=rn.height,rr=Jt,Kr=ar,si=bn&&bn.some(function(xt){return xt!==0});if(!si)En.rect(st,Wt,rr,Kr);else{var Ie=Jt>0?1:-1,L=ar>0?1:-1,Q=Ie+L===0,w=bn.map(function(xt){return(0,ve.Z)(xt,0,Math.min(Math.abs(rr)/2,Math.abs(Kr)/2))}),z=(0,P.Z)(w,4),ie=z[0],ze=z[1],Je=z[2],At=z[3];En.moveTo(Ie*ie+st,Wt),En.lineTo(rr-Ie*ze+st,Wt),ze!==0&&En.arc(rr-Ie*ze+st,L*ze+Wt,ze,-L*Math.PI/2,Ie>0?0:Math.PI,Q),En.lineTo(rr+st,Kr-L*Je+Wt),Je!==0&&En.arc(rr-Ie*Je+st,Kr-L*Je+Wt,Je,Ie>0?0:Math.PI,L>0?Math.PI/2:1.5*Math.PI,Q),En.lineTo(Ie*At+st,Kr+Wt),At!==0&&En.arc(Ie*At+st,Kr-L*At+Wt,At,L>0?Math.PI/2:-Math.PI/2,Ie>0?Math.PI:0,Q),En.lineTo(st,L*ie+Wt),ie!==0&&En.arc(Ie*ie+st,L*ie+Wt,ie,Ie>0?Math.PI:0,L>0?Math.PI*1.5:Math.PI/2,Q)}}var Mi=function(En){function rn(){var Xt;(0,Z.Z)(this,rn);for(var st=arguments.length,dt=new Array(st),Wt=0;Wt<st;Wt++)dt[Wt]=arguments[Wt];return Xt=(0,V.Z)(this,rn,[].concat(dt)),Xt.name="canvas-path-generator",Xt}return(0,N.Z)(rn,En),(0,m.Z)(rn,[{key:"init",value:function(){var st,dt=(st={},(0,F.Z)((0,F.Z)((0,F.Z)((0,F.Z)((0,F.Z)((0,F.Z)((0,F.Z)((0,F.Z)((0,F.Z)((0,F.Z)(st,E.bn.CIRCLE,cn),E.bn.ELLIPSE,Yn),E.bn.RECT,Ki),E.bn.LINE,qn),E.bn.POLYLINE,vr),E.bn.POLYGON,Jr),E.bn.PATH,Sr),E.bn.TEXT,void 0),E.bn.GROUP,void 0),E.bn.IMAGE,void 0),(0,F.Z)((0,F.Z)((0,F.Z)(st,E.bn.HTML,void 0),E.bn.MESH,void 0),E.bn.FRAGMENT,void 0));this.context.pathGeneratorFactory=dt}},{key:"destroy",value:function(){delete this.context.pathGeneratorFactory}}])}(E.F6),yi=Object.freeze({__proto__:null,Plugin:Mi}),qr=function(){function En(rn){(0,Z.Z)(this,En),this.renderingContext=rn.renderingContext,this.canvasConfig=rn.config}return(0,m.Z)(En,[{key:"init",value:function(){var Xt=this.canvasConfig,st=Xt.container,dt=Xt.canvas;if(dt)this.$canvas=dt,st&&dt.parentElement!==st&&st.appendChild(dt),this.$container=dt.parentElement,this.canvasConfig.container=this.$container;else if(st&&(this.$container=(0,Ee.Z)(st)?document.getElementById(st):st,this.$container)){var Wt=document.createElement("canvas");this.$container.appendChild(Wt),this.$container.style.position||(this.$container.style.position="relative"),this.$canvas=Wt}this.context=this.$canvas.getContext("2d"),this.resize(this.canvasConfig.width,this.canvasConfig.height)}},{key:"getContext",value:function(){return this.context}},{key:"getDomElement",value:function(){return this.$canvas}},{key:"getDPR",value:function(){return this.dpr}},{key:"getBoundingClientRect",value:function(){if(this.$canvas.getBoundingClientRect)return this.$canvas.getBoundingClientRect()}},{key:"destroy",value:function(){this.$container&&this.$canvas&&this.$canvas.parentNode&&this.$container.removeChild(this.$canvas)}},{key:"resize",value:function(Xt,st){var dt=this.canvasConfig.devicePixelRatio;this.dpr=dt,this.$canvas&&(this.$canvas.width=this.dpr*Xt,this.$canvas.height=this.dpr*st,(0,E.$p)(this.$canvas,Xt,st)),this.renderingContext.renderReasons.add(E.Rr.CAMERA_CHANGED)}},{key:"applyCursorStyle",value:function(Xt){this.$container&&this.$container.style&&(this.$container.style.cursor=Xt)}},{key:"toDataURL",value:function(){var rn=(0,ct.Z)((0,Fe.Z)().mark(function st(){var dt,Wt,bn,Jt=arguments;return(0,Fe.Z)().wrap(function(ar){for(;;)switch(ar.prev=ar.next){case 0:return dt=Jt.length>0&&Jt[0]!==void 0?Jt[0]:{},Wt=dt.type,bn=dt.encoderOptions,ar.abrupt("return",this.context.canvas.toDataURL(Wt,bn));case 1:case"end":return ar.stop()}},st,this)}));function Xt(){return rn.apply(this,arguments)}return Xt}()}])}(),es=function(En){function rn(){var Xt;(0,Z.Z)(this,rn);for(var st=arguments.length,dt=new Array(st),Wt=0;Wt<st;Wt++)dt[Wt]=arguments[Wt];return Xt=(0,V.Z)(this,rn,[].concat(dt)),Xt.name="canvas-context-register",Xt}return(0,N.Z)(rn,En),(0,m.Z)(rn,[{key:"init",value:function(){this.context.ContextService=qr}},{key:"destroy",value:function(){delete this.context.ContextService}}])}(E.F6),Ci=function(En){function rn(Xt){var st;return(0,Z.Z)(this,rn),st=(0,V.Z)(this,rn,[Xt]),st.registerPlugin(new es),st.registerPlugin(new E.S3.Plugin),st.registerPlugin(new Mi),st.registerPlugin(new Cn),st.registerPlugin(new E.sC.Plugin),st.registerPlugin(new Vt),st.registerPlugin(new E.MD.Plugin),st}return(0,N.Z)(rn,En),(0,m.Z)(rn)}(E.I8)},72818:function(Be,Me,b){"use strict";b.d(Me,{mN:function(){return ie},I8:function(){return Kr},F6:function(){return rr},ux:function(){return Wc},V1:function(){return $r},iM:function(){return Bt},Xz:function(){return rA},$6:function(){return fl},Cd:function(){return Ch},b_:function(){return Ec},Aw:function(){return xu},s$:function(){return wo},BB:function(){return PA},sC:function(){return vm},jf:function(){return Oe},Dk:function(){return Ra},Pj:function(){return zh},xA:function(){return Jh},nR:function(){return Qd},GL:function(){return To},ZA:function(){return Xd},k9:function(){return Th},MD:function(){return mm},Ee:function(){return oh},S3:function(){return aA},x1:function(){return Sf},NB:function(){return vo},y$:function(){return Mf},E9:function(){return xt},mg:function(){return eu},aH:function(){return Dl},h0:function(){return Ai},UL:function(){return Bh},Rr:function(){return rh},bn:function(){return Jt},xv:function(){return tu},O4:function(){return tn},Vl:function(){return Yt},Oi:function(){return Zf},_O:function(){return Ke},gz:function(){return ri},RV:function(){return Do},L1:function(){return Yl},R:function(){return md},N1:function(){return Sc},BV:function(){return er},GZ:function(){return Oi},$p:function(){return Dh}});var m=b(33885),Z=b(67732),V=b(83652),N=b(94480),E=b(22214),F=b(42403),C=b(42978),P=b(37271),H=P,D=b(92421),X=b(97082),j=b(60187),de=b(79111),he=b(94569),we=b(45545),ve=b(1933),Ee=b(68901),$e=b(76075),Fe=b(71879),ct=b(70208),vt=b(80813),at={a:7,c:6,h:1,l:2,m:2,r:4,q:4,s:4,t:2,v:1,z:0};function kt(x){return Array.isArray(x)&&x.every(function(S){var f=S[0].toLowerCase();return at[f]===S.length-1&&"achlmqstvz".includes(f)})}function It(x){return kt(x)&&x.every(function(S){var f=S[0];return f===f.toUpperCase()})}function Bn(x){return It(x)&&x.every(function(S){var f=S[0];return"ACLMQZ".includes(f)})}var Lt={x1:0,y1:0,x2:0,y2:0,x:0,y:0,qx:null,qy:null};function Wn(x){for(var S=x.pathValue[x.segmentStart],f=S.toLowerCase(),A=x.data;A.length>=at[f]&&(f==="m"&&A.length>2?(x.segments.push([S].concat(A.splice(0,2))),f="l",S=S==="m"?"l":"L"):x.segments.push([S].concat(A.splice(0,at[f]))),!!at[f]););}function Xn(x){var S=x.index,f=x.pathValue,A=f.charCodeAt(S);if(A===48){x.param=0,x.index+=1;return}if(A===49){x.param=1,x.index+=1;return}x.err='[path-util]: invalid Arc flag "'.concat(f[S],'", expecting 0 or 1 at index ').concat(S)}function In(x){return x>=48&&x<=57||x===43||x===45||x===46}function zn(x){return x>=48&&x<=57}function dr(x){var S=x.max,f=x.pathValue,A=x.index,_=A,k=!1,G=!1,ae=!1,ge=!1,Ue;if(_>=S){x.err="[path-util]: Invalid path value at index ".concat(_,', "pathValue" is missing param');return}if(Ue=f.charCodeAt(_),(Ue===43||Ue===45)&&(_+=1,Ue=f.charCodeAt(_)),!zn(Ue)&&Ue!==46){x.err="[path-util]: Invalid path value at index ".concat(_,', "').concat(f[_],'" is not a number');return}if(Ue!==46){if(k=Ue===48,_+=1,Ue=f.charCodeAt(_),k&&_<S&&Ue&&zn(Ue)){x.err="[path-util]: Invalid path value at index ".concat(A,', "').concat(f[A],'" illegal number');return}for(;_<S&&zn(f.charCodeAt(_));)_+=1,G=!0;Ue=f.charCodeAt(_)}if(Ue===46){for(ge=!0,_+=1;zn(f.charCodeAt(_));)_+=1,ae=!0;Ue=f.charCodeAt(_)}if(Ue===101||Ue===69){if(ge&&!G&&!ae){x.err="[path-util]: Invalid path value at index ".concat(_,', "').concat(f[_],'" invalid float exponent');return}if(_+=1,Ue=f.charCodeAt(_),(Ue===43||Ue===45)&&(_+=1),_<S&&zn(f.charCodeAt(_)))for(;_<S&&zn(f.charCodeAt(_));)_+=1;else{x.err="[path-util]: Invalid path value at index ".concat(_,', "').concat(f[_],'" invalid integer exponent');return}}x.index=_,x.param=+x.pathValue.slice(A,_)}function vn(x){var S=[5760,6158,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288,65279];return x===10||x===13||x===8232||x===8233||x===32||x===9||x===11||x===12||x===160||x>=5760&&S.includes(x)}function _r(x){for(var S=x.pathValue,f=x.max;x.index<f&&vn(S.charCodeAt(x.index));)x.index+=1}function Ge(x){switch(x|32){case 109:case 122:case 108:case 104:case 118:case 99:case 115:case 113:case 116:case 97:return!0;default:return!1}}function Tt(x){return(x|32)===97}function On(x){var S=x.max,f=x.pathValue,A=x.index,_=f.charCodeAt(A),k=at[f[A].toLowerCase()];if(x.segmentStart=A,!Ge(_)){x.err='[path-util]: Invalid path value "'.concat(f[A],'" is not a path command');return}if(x.index+=1,_r(x),x.data=[],!k){Wn(x);return}for(;;){for(var G=k;G>0;G-=1){if(Tt(_)&&(G===3||G===4)?Xn(x):dr(x),x.err.length)return;x.data.push(x.param),_r(x),x.index<S&&f.charCodeAt(x.index)===44&&(x.index+=1,_r(x))}if(x.index>=x.max||!In(f.charCodeAt(x.index)))break}Wn(x)}var Vr=function(){function x(S){this.pathValue=S,this.segments=[],this.max=S.length,this.index=0,this.param=0,this.segmentStart=0,this.data=[],this.err=""}return x}();function en(x){if(kt(x))return[].concat(x);var S=new Vr(x);for(_r(S);S.index<S.max&&!S.err.length;)On(S);return S.err?S.err:S.segments}function ln(x){if(It(x))return[].concat(x);var S=en(x),f=0,A=0,_=0,k=0;return S.map(function(G){var ae=G.slice(1).map(Number),ge=G[0],Ue=ge.toUpperCase();if(ge==="M")return f=ae[0],A=ae[1],_=f,k=A,["M",f,A];var rt;if(ge!==Ue)switch(Ue){case"A":rt=[Ue,ae[0],ae[1],ae[2],ae[3],ae[4],ae[5]+f,ae[6]+A];break;case"V":rt=[Ue,ae[0]+A];break;case"H":rt=[Ue,ae[0]+f];break;default:{var bt=ae.map(function(wn,mn){return wn+(mn%2?A:f)});rt=[Ue].concat(bt)}}else rt=[Ue].concat(ae);var Zt=rt.length;switch(Ue){case"Z":f=_,A=k;break;case"H":f=rt[1];break;case"V":A=rt[1];break;default:f=rt[Zt-2],A=rt[Zt-1],Ue==="M"&&(_=f,k=A)}return rt})}function Cn(x,S){var f=x[0],A=S.x1,_=S.y1,k=S.x2,G=S.y2,ae=x.slice(1).map(Number),ge=x;if("TQ".includes(f)||(S.qx=null,S.qy=null),f==="H")ge=["L",x[1],_];else if(f==="V")ge=["L",A,x[1]];else if(f==="S"){var Ue=A*2-k,rt=_*2-G;S.x1=Ue,S.y1=rt,ge=["C",Ue,rt].concat(ae)}else if(f==="T"){var bt=A*2-S.qx,Zt=_*2-S.qy;S.qx=bt,S.qy=Zt,ge=["Q",bt,Zt].concat(ae)}else if(f==="Q"){var wn=ae[0],mn=ae[1];S.qx=wn,S.qy=mn}return ge}function Mt(x){if(Bn(x))return[].concat(x);for(var S=ln(x),f=(0,vt.pi)({},Lt),A=0;A<S.length;A+=1){S[A]=Cn(S[A],f);var _=S[A],k=_.length;f.x1=+_[k-2],f.y1=+_[k-1],f.x2=+_[k-4]||f.x1,f.y2=+_[k-3]||f.y1}return S}function Et(x,S,f){var A=x[0],_=x[1],k=S[0],G=S[1];return[A+(k-A)*f,_+(G-_)*f]}function pe(x,S,f,A,_){var k=(0,Ee.y)([x,S],[f,A]),G={x:0,y:0};if(typeof _=="number")if(_<=0)G={x,y:S};else if(_>=k)G={x:f,y:A};else{var ae=Et([x,S],[f,A],_/k),ge=ae[0],Ue=ae[1];G={x:ge,y:Ue}}return{length:k,point:G,min:{x:Math.min(x,f),y:Math.min(S,A)},max:{x:Math.max(x,f),y:Math.max(S,A)}}}function Ae(x,S){var f=x.x,A=x.y,_=S.x,k=S.y,G=f*_+A*k,ae=Math.sqrt((Math.pow(f,2)+Math.pow(A,2))*(Math.pow(_,2)+Math.pow(k,2))),ge=f*k-A*_<0?-1:1,Ue=ge*Math.acos(G/ae);return Ue}function Pe(x,S,f,A,_,k,G,ae,ge,Ue){var rt=Math.abs,bt=Math.sin,Zt=Math.cos,wn=Math.sqrt,mn=Math.PI,Gn=rt(f),ir=rt(A),tr=(_%360+360)%360,Zn=tr*(mn/180);if(x===ae&&S===ge)return{x,y:S};if(Gn===0||ir===0)return pe(x,S,ae,ge,Ue).point;var Tr=(x-ae)/2,ni=(S-ge)/2,ns={x:Zt(Zn)*Tr+bt(Zn)*ni,y:-bt(Zn)*Tr+Zt(Zn)*ni},is=Math.pow(ns.x,2)/Math.pow(Gn,2)+Math.pow(ns.y,2)/Math.pow(ir,2);is>1&&(Gn*=wn(is),ir*=wn(is));var bi=Math.pow(Gn,2)*Math.pow(ir,2)-Math.pow(Gn,2)*Math.pow(ns.y,2)-Math.pow(ir,2)*Math.pow(ns.x,2),Ri=Math.pow(Gn,2)*Math.pow(ns.y,2)+Math.pow(ir,2)*Math.pow(ns.x,2),Gs=bi/Ri;Gs=Gs<0?0:Gs;var _s=(k!==G?1:-1)*wn(Gs),Hs={x:_s*(Gn*ns.y/ir),y:_s*(-(ir*ns.x)/Gn)},Zs={x:Zt(Zn)*Hs.x-bt(Zn)*Hs.y+(x+ae)/2,y:bt(Zn)*Hs.x+Zt(Zn)*Hs.y+(S+ge)/2},Ia={x:(ns.x-Hs.x)/Gn,y:(ns.y-Hs.y)/ir},Po=Ae({x:1,y:0},Ia),Ml={x:(-ns.x-Hs.x)/Gn,y:(-ns.y-Hs.y)/ir},El=Ae(Ia,Ml);!G&&El>0?El-=2*mn:G&&El<0&&(El+=2*mn),El%=2*mn;var Ys=Po+El*Ue,U=Gn*Zt(Ys),R=ir*bt(Ys),$={x:Zt(Zn)*U-bt(Zn)*R+Zs.x,y:bt(Zn)*U+Zt(Zn)*R+Zs.y};return $}function Ut(x,S,f,A,_,k,G,ae,ge,Ue,rt){var bt,Zt=rt.bbox,wn=Zt===void 0?!0:Zt,mn=rt.length,Gn=mn===void 0?!0:mn,ir=rt.sampleSize,tr=ir===void 0?30:ir,Zn=typeof Ue=="number",Tr=x,ni=S,ns=0,is=[Tr,ni,ns],bi=[Tr,ni],Ri=0,Gs={x:0,y:0},_s=[{x:Tr,y:ni}];Zn&&Ue<=0&&(Gs={x:Tr,y:ni});for(var Hs=0;Hs<=tr;Hs+=1){if(Ri=Hs/tr,bt=Pe(x,S,f,A,_,k,G,ae,ge,Ri),Tr=bt.x,ni=bt.y,wn&&_s.push({x:Tr,y:ni}),Gn&&(ns+=(0,Ee.y)(bi,[Tr,ni])),bi=[Tr,ni],Zn&&ns>=Ue&&Ue>is[2]){var Zs=(ns-Ue)/(ns-is[2]);Gs={x:bi[0]*(1-Zs)+is[0]*Zs,y:bi[1]*(1-Zs)+is[1]*Zs}}is=[Tr,ni,ns]}return Zn&&Ue>=ns&&(Gs={x:ae,y:ge}),{length:ns,point:Gs,min:{x:Math.min.apply(null,_s.map(function(Ia){return Ia.x})),y:Math.min.apply(null,_s.map(function(Ia){return Ia.y}))},max:{x:Math.max.apply(null,_s.map(function(Ia){return Ia.x})),y:Math.max.apply(null,_s.map(function(Ia){return Ia.y}))}}}function jt(x,S,f,A,_,k,G,ae,ge){var Ue=1-ge;return{x:Math.pow(Ue,3)*x+3*Math.pow(Ue,2)*ge*f+3*Ue*Math.pow(ge,2)*_+Math.pow(ge,3)*G,y:Math.pow(Ue,3)*S+3*Math.pow(Ue,2)*ge*A+3*Ue*Math.pow(ge,2)*k+Math.pow(ge,3)*ae}}function ft(x,S,f,A,_,k,G,ae,ge,Ue){var rt,bt=Ue.bbox,Zt=bt===void 0?!0:bt,wn=Ue.length,mn=wn===void 0?!0:wn,Gn=Ue.sampleSize,ir=Gn===void 0?10:Gn,tr=typeof ge=="number",Zn=x,Tr=S,ni=0,ns=[Zn,Tr,ni],is=[Zn,Tr],bi=0,Ri={x:0,y:0},Gs=[{x:Zn,y:Tr}];tr&&ge<=0&&(Ri={x:Zn,y:Tr});for(var _s=0;_s<=ir;_s+=1){if(bi=_s/ir,rt=jt(x,S,f,A,_,k,G,ae,bi),Zn=rt.x,Tr=rt.y,Zt&&Gs.push({x:Zn,y:Tr}),mn&&(ni+=(0,Ee.y)(is,[Zn,Tr])),is=[Zn,Tr],tr&&ni>=ge&&ge>ns[2]){var Hs=(ni-ge)/(ni-ns[2]);Ri={x:is[0]*(1-Hs)+ns[0]*Hs,y:is[1]*(1-Hs)+ns[1]*Hs}}ns=[Zn,Tr,ni]}return tr&&ge>=ni&&(Ri={x:G,y:ae}),{length:ni,point:Ri,min:{x:Math.min.apply(null,Gs.map(function(Zs){return Zs.x})),y:Math.min.apply(null,Gs.map(function(Zs){return Zs.y}))},max:{x:Math.max.apply(null,Gs.map(function(Zs){return Zs.x})),y:Math.max.apply(null,Gs.map(function(Zs){return Zs.y}))}}}function on(x,S,f,A,_,k,G){var ae=1-G;return{x:Math.pow(ae,2)*x+2*ae*G*f+Math.pow(G,2)*_,y:Math.pow(ae,2)*S+2*ae*G*A+Math.pow(G,2)*k}}function hn(x,S,f,A,_,k,G,ae){var ge,Ue=ae.bbox,rt=Ue===void 0?!0:Ue,bt=ae.length,Zt=bt===void 0?!0:bt,wn=ae.sampleSize,mn=wn===void 0?10:wn,Gn=typeof G=="number",ir=x,tr=S,Zn=0,Tr=[ir,tr,Zn],ni=[ir,tr],ns=0,is={x:0,y:0},bi=[{x:ir,y:tr}];Gn&&G<=0&&(is={x:ir,y:tr});for(var Ri=0;Ri<=mn;Ri+=1){if(ns=Ri/mn,ge=on(x,S,f,A,_,k,ns),ir=ge.x,tr=ge.y,rt&&bi.push({x:ir,y:tr}),Zt&&(Zn+=(0,Ee.y)(ni,[ir,tr])),ni=[ir,tr],Gn&&Zn>=G&&G>Tr[2]){var Gs=(Zn-G)/(Zn-Tr[2]);is={x:ni[0]*(1-Gs)+Tr[0]*Gs,y:ni[1]*(1-Gs)+Tr[1]*Gs}}Tr=[ir,tr,Zn]}return Gn&&G>=Zn&&(is={x:_,y:k}),{length:Zn,point:is,min:{x:Math.min.apply(null,bi.map(function(_s){return _s.x})),y:Math.min.apply(null,bi.map(function(_s){return _s.y}))},max:{x:Math.max.apply(null,bi.map(function(_s){return _s.x})),y:Math.max.apply(null,bi.map(function(_s){return _s.y}))}}}function lt(x,S,f){for(var A,_,k,G,ae,ge,Ue=Mt(x),rt=typeof S=="number",bt,Zt=[],wn,mn=0,Gn=0,ir=0,tr=0,Zn,Tr=[],ni=[],ns=0,is={x:0,y:0},bi=is,Ri=is,Gs=is,_s=0,Hs=0,Zs=Ue.length;Hs<Zs;Hs+=1)Zn=Ue[Hs],wn=Zn[0],bt=wn==="M",Zt=bt?Zt:[mn,Gn].concat(Zn.slice(1)),bt?(ir=Zn[1],tr=Zn[2],is={x:ir,y:tr},bi=is,ns=0,rt&&S<.001&&(Gs=is)):wn==="L"?(A=pe(Zt[0],Zt[1],Zt[2],Zt[3],(S||0)-_s),ns=A.length,is=A.min,bi=A.max,Ri=A.point):wn==="A"?(_=Ut(Zt[0],Zt[1],Zt[2],Zt[3],Zt[4],Zt[5],Zt[6],Zt[7],Zt[8],(S||0)-_s,f||{}),ns=_.length,is=_.min,bi=_.max,Ri=_.point):wn==="C"?(k=ft(Zt[0],Zt[1],Zt[2],Zt[3],Zt[4],Zt[5],Zt[6],Zt[7],(S||0)-_s,f||{}),ns=k.length,is=k.min,bi=k.max,Ri=k.point):wn==="Q"?(G=hn(Zt[0],Zt[1],Zt[2],Zt[3],Zt[4],Zt[5],(S||0)-_s,f||{}),ns=G.length,is=G.min,bi=G.max,Ri=G.point):wn==="Z"&&(Zt=[mn,Gn,ir,tr],ae=pe(Zt[0],Zt[1],Zt[2],Zt[3],(S||0)-_s),ns=ae.length,is=ae.min,bi=ae.max,Ri=ae.point),rt&&_s<S&&_s+ns>=S&&(Gs=Ri),ni.push(bi),Tr.push(is),_s+=ns,ge=wn!=="Z"?Zn.slice(-2):[ir,tr],mn=ge[0],Gn=ge[1];return rt&&S>=_s&&(Gs={x:mn,y:Gn}),{length:_s,point:Gs,min:{x:Math.min.apply(null,Tr.map(function(Ia){return Ia.x})),y:Math.min.apply(null,Tr.map(function(Ia){return Ia.y}))},max:{x:Math.max.apply(null,ni.map(function(Ia){return Ia.x})),y:Math.max.apply(null,ni.map(function(Ia){return Ia.y}))}}}function Ct(x,S){return lt(x,void 0,(0,vt.pi)((0,vt.pi)({},S),{bbox:!1,length:!0})).length}var sn=b(2078),W=b(82639),Se=b(5131),Ht=function(x,S){return(x%S+S)%S},zt=Ht;function Fn(x,S,f){if(x[f].length>7){x[f].shift();for(var A=x[f],_=f;A.length;)S[f]="A",x.splice(_+=1,0,["C"].concat(A.splice(0,6)));x.splice(f,1)}}function Tn(x){return Bn(x)&&x.every(function(S){var f=S[0];return"MC".includes(f)})}var lr=b(66045);function je(x,S,f,A,_,k){var G=.3333333333333333,ae=2/3;return[G*x+ae*f,G*S+ae*A,G*_+ae*f,G*k+ae*A,_,k]}var be=function(x,S,f,A){var _=.5,k=Et([x,S],[f,A],_);return(0,vt.ev)((0,vt.ev)([],k,!0),[f,A,f,A],!1)};function it(x,S){var f=x[0],A=x.slice(1).map(Number),_=A[0],k=A[1],G,ae=S.x1,ge=S.y1,Ue=S.x,rt=S.y;switch("TQ".includes(f)||(S.qx=null,S.qy=null),f){case"M":return S.x=_,S.y=k,x;case"A":return G=[ae,ge].concat(A),["C"].concat((0,lr.W)(G[0],G[1],G[2],G[3],G[4],G[5],G[6],G[7],G[8],G[9]));case"Q":return S.qx=_,S.qy=k,G=[ae,ge].concat(A),["C"].concat(je(G[0],G[1],G[2],G[3],G[4],G[5]));case"L":return["C"].concat(be(ae,ge,_,k));case"Z":return ae===Ue&&ge===rt?["C",ae,ge,Ue,rt,Ue,rt]:["C"].concat(be(ae,ge,Ue,rt));default:}return x}function wt(x,S){if(S===void 0&&(S=!1),Tn(x)){var f=[].concat(x);return S?[f,[]]:f}for(var A=Mt(x),_=(0,vt.pi)({},Lt),k=[],G="",ae=A.length,ge,Ue,rt=[],bt=0;bt<ae;bt+=1){A[bt]&&(G=A[bt][0]),k[bt]=G;var Zt=it(A[bt],_);A[bt]=Zt,Fn(A,k,bt),ae=A.length,G==="Z"&&rt.push(bt),ge=A[bt],Ue=ge.length,_.x1=+ge[Ue-2],_.y1=+ge[Ue-1],_.x2=+ge[Ue-4]||_.x1,_.y2=+ge[Ue-3]||_.y1}return S?[A,rt]:A}var ot=50;function ut(x,S){S===void 0&&(S=.5);var f=x.slice(0,2),A=x.slice(2,4),_=x.slice(4,6),k=x.slice(6,8),G=Et(f,A,S),ae=Et(A,_,S),ge=Et(_,k,S),Ue=Et(G,ae,S),rt=Et(ae,ge,S),bt=Et(Ue,rt,S);return[["C"].concat(G,Ue,bt),["C"].concat(rt,ge,k)]}function _t(x){return x.map(function(S,f,A){var _=f&&A[f-1].slice(-2).concat(S.slice(1)),k=f?ft(_[0],_[1],_[2],_[3],_[4],_[5],_[6],_[7],_[8],{bbox:!1}).length:0,G;return f?G=k?ut(_):[S,S]:G=[S],{s:S,ss:G,l:k}})}function $t(x,S,f,A){if(A===void 0&&(A=0),A>ot)return console.warn("Maximum recursion depth reached in equalizeSegments"),[x,S];var _=_t(x),k=_t(S),G=_.length,ae=k.length,ge=_.filter(function(tr){return tr.l}).length,Ue=k.filter(function(tr){return tr.l}).length,rt=_.filter(function(tr){return tr.l}).reduce(function(tr,Zn){var Tr=Zn.l;return tr+Tr},0)/ge||0,bt=k.filter(function(tr){return tr.l}).reduce(function(tr,Zn){var Tr=Zn.l;return tr+Tr},0)/Ue||0,Zt=f||Math.max(G,ae),wn=[rt,bt],mn=[Zt-G,Zt-ae],Gn=0,ir=[_,k].map(function(tr,Zn){return tr.l===Zt?tr.map(function(Tr){return Tr.s}):tr.map(function(Tr,ni){return Gn=ni&&mn[Zn]&&Tr.l>=wn[Zn],mn[Zn]-=Gn?1:0,Gn?Tr.ss:[Tr.s]}).flat()});return ir[0].length===ir[1].length?ir:$t(ir[0],ir[1],Zt,A+1)}function Vt(x,S,f,A,_,k,G,ae){return 3*((ae-S)*(f+_)-(G-x)*(A+k)+A*(x-_)-f*(S-k)+ae*(_+x/3)-G*(k+S/3))/20}function Qt(x){var S=0,f=0,A=0;return wt(x).map(function(_){var k;switch(_[0]){case"M":return S=_[1],f=_[2],0;default:var G=_.slice(1),ae=G[0],ge=G[1],Ue=G[2],rt=G[3],bt=G[4],Zt=G[5];return A=Vt(S,f,ae,ge,Ue,rt,bt,Zt),k=_.slice(-2),S=k[0],f=k[1],A}}).reduce(function(_,k){return _+k},0)}function cn(x){return Qt(x)>=0}function Yn(x){var S=x.slice(1).map(function(f,A,_){return A?_[A-1].slice(-2).concat(f.slice(1)):x[0].slice(1).concat(f.slice(1))}).map(function(f){return f.map(function(A,_){return f[f.length-_-2*(1-_%2)]})}).reverse();return[["M"].concat(S[0].slice(0,2))].concat(S.map(function(f){return["C"].concat(f.slice(2))}))}function qn(x){return x.map(function(S){return Array.isArray(S)?[].concat(S):S})}function Sr(x){var S=x.length,f=S-1;return x.map(function(A,_){return x.map(function(k,G){var ae=_+G,ge;return G===0||x[ae]&&x[ae][0]==="M"?(ge=x[ae],["M"].concat(ge.slice(-2))):(ae>=S&&(ae-=f),x[ae])})})}function Jr(x,S){var f=x.length-1,A=[],_=0,k=0,G=Sr(x);return G.forEach(function(ae,ge){x.slice(1).forEach(function(Ue,rt){k+=(0,Ee.y)(x[(ge+rt)%f].slice(-2),S[rt%f].slice(-2))}),A[ge]=k,k=0}),_=A.indexOf(Math.min.apply(null,A)),G[_]}var vr=b(49527),Ki=b(39934),Mi=b(50264),yi=b(71018),qr=b(93785);function es(x,S,f){return lt(x,S,(0,vt.pi)((0,vt.pi)({},f),{bbox:!1,length:!0})).point}var Ci=b(20068),En=b(34907),rn=b(97047),Xt=b(19606),st=b(75044),dt=b(3202),Wt=b(19251),bn=b(75931);var Jt=function(x){return x.GROUP="g",x.FRAGMENT="fragment",x.CIRCLE="circle",x.ELLIPSE="ellipse",x.IMAGE="image",x.RECT="rect",x.LINE="line",x.POLYLINE="polyline",x.POLYGON="polygon",x.TEXT="text",x.PATH="path",x.HTML="html",x.MESH="mesh",x}({}),ar=function(x){return x[x.ZERO=0]="ZERO",x[x.NEGATIVE_ONE=1]="NEGATIVE_ONE",x}({}),rr=function(){function x(){(0,Z.Z)(this,x),this.plugins=[]}return(0,V.Z)(x,[{key:"addRenderingPlugin",value:function(f){this.plugins.push(f),this.context.renderingPlugins.push(f)}},{key:"removeAllRenderingPlugins",value:function(){var f=this;this.plugins.forEach(function(A){var _=f.context.renderingPlugins.indexOf(A);_>=0&&f.context.renderingPlugins.splice(_,1)})}}])}(),Kr=function(){function x(S){(0,Z.Z)(this,x),this.clipSpaceNearZ=ar.NEGATIVE_ONE,this.plugins=[],this.config=(0,m.Z)({enableDirtyCheck:!0,enableCulling:!1,enableAutoRendering:!0,enableDirtyRectangleRendering:!0,enableDirtyRectangleRenderingDebug:!1,enableSizeAttenuation:!0,enableRenderingOptimization:!1},S)}return(0,V.Z)(x,[{key:"registerPlugin",value:function(f){var A=this.plugins.findIndex(function(_){return _===f});A===-1&&this.plugins.push(f)}},{key:"unregisterPlugin",value:function(f){var A=this.plugins.findIndex(function(_){return _===f});A>-1&&this.plugins.splice(A,1)}},{key:"getPlugins",value:function(){return this.plugins}},{key:"getPlugin",value:function(f){return this.plugins.find(function(A){return A.name===f})}},{key:"getConfig",value:function(){return this.config}},{key:"setConfig",value:function(f){Object.assign(this.config,f)}}])}(),si=D.IH,Ie=D.JG,L=D.Fp,Q=D.VV,w=D.bA,z=D.lu,ie=function(){function x(){(0,Z.Z)(this,x),this.center=[0,0,0],this.halfExtents=[0,0,0],this.min=[0,0,0],this.max=[0,0,0]}return(0,V.Z)(x,[{key:"update",value:function(f,A){Ie(this.center,f),Ie(this.halfExtents,A),z(this.min,this.center,this.halfExtents),si(this.max,this.center,this.halfExtents)}},{key:"setMinMax",value:function(f,A){si(this.center,A,f),w(this.center,this.center,.5),z(this.halfExtents,A,f),w(this.halfExtents,this.halfExtents,.5),Ie(this.min,f),Ie(this.max,A)}},{key:"getMin",value:function(){return this.min}},{key:"getMax",value:function(){return this.max}},{key:"add",value:function(f){if(!x.isEmpty(f)){if(x.isEmpty(this)){this.setMinMax(f.getMin(),f.getMax());return}var A=this.center,_=A[0],k=A[1],G=A[2],ae=this.halfExtents,ge=ae[0],Ue=ae[1],rt=ae[2],bt=_-ge,Zt=_+ge,wn=k-Ue,mn=k+Ue,Gn=G-rt,ir=G+rt,tr=f.center,Zn=tr[0],Tr=tr[1],ni=tr[2],ns=f.halfExtents,is=ns[0],bi=ns[1],Ri=ns[2],Gs=Zn-is,_s=Zn+is,Hs=Tr-bi,Zs=Tr+bi,Ia=ni-Ri,Po=ni+Ri;Gs<bt&&(bt=Gs),_s>Zt&&(Zt=_s),Hs<wn&&(wn=Hs),Zs>mn&&(mn=Zs),Ia<Gn&&(Gn=Ia),Po>ir&&(ir=Po),A[0]=(bt+Zt)*.5,A[1]=(wn+mn)*.5,A[2]=(Gn+ir)*.5,ae[0]=(Zt-bt)*.5,ae[1]=(mn-wn)*.5,ae[2]=(ir-Gn)*.5,this.min[0]=bt,this.min[1]=wn,this.min[2]=Gn,this.max[0]=Zt,this.max[1]=mn,this.max[2]=ir}}},{key:"setFromTransformedAABB",value:function(f,A){var _=this.center,k=this.halfExtents,G=f.center,ae=f.halfExtents,ge=A[0],Ue=A[4],rt=A[8],bt=A[1],Zt=A[5],wn=A[9],mn=A[2],Gn=A[6],ir=A[10],tr=Math.abs(ge),Zn=Math.abs(Ue),Tr=Math.abs(rt),ni=Math.abs(bt),ns=Math.abs(Zt),is=Math.abs(wn),bi=Math.abs(mn),Ri=Math.abs(Gn),Gs=Math.abs(ir);_[0]=A[12]+ge*G[0]+Ue*G[1]+rt*G[2],_[1]=A[13]+bt*G[0]+Zt*G[1]+wn*G[2],_[2]=A[14]+mn*G[0]+Gn*G[1]+ir*G[2],k[0]=tr*ae[0]+Zn*ae[1]+Tr*ae[2],k[1]=ni*ae[0]+ns*ae[1]+is*ae[2],k[2]=bi*ae[0]+Ri*ae[1]+Gs*ae[2],z(this.min,_,k),si(this.max,_,k)}},{key:"intersects",value:function(f){var A=this.getMax(),_=this.getMin(),k=f.getMax(),G=f.getMin();return _[0]<=k[0]&&A[0]>=G[0]&&_[1]<=k[1]&&A[1]>=G[1]&&_[2]<=k[2]&&A[2]>=G[2]}},{key:"intersection",value:function(f){if(!this.intersects(f))return null;var A=new x,_=L([0,0,0],this.getMin(),f.getMin()),k=Q([0,0,0],this.getMax(),f.getMax());return A.setMinMax(_,k),A}},{key:"getNegativeFarPoint",value:function(f){return f.pnVertexFlag===273?Ie([0,0,0],this.min):f.pnVertexFlag===272?[this.min[0],this.min[1],this.max[2]]:f.pnVertexFlag===257?[this.min[0],this.max[1],this.min[2]]:f.pnVertexFlag===256?[this.min[0],this.max[1],this.max[2]]:f.pnVertexFlag===17?[this.max[0],this.min[1],this.min[2]]:f.pnVertexFlag===16?[this.max[0],this.min[1],this.max[2]]:f.pnVertexFlag===1?[this.max[0],this.max[1],this.min[2]]:[this.max[0],this.max[1],this.max[2]]}},{key:"getPositiveFarPoint",value:function(f){return f.pnVertexFlag===273?Ie([0,0,0],this.max):f.pnVertexFlag===272?[this.max[0],this.max[1],this.min[2]]:f.pnVertexFlag===257?[this.max[0],this.min[1],this.max[2]]:f.pnVertexFlag===256?[this.max[0],this.min[1],this.min[2]]:f.pnVertexFlag===17?[this.min[0],this.max[1],this.max[2]]:f.pnVertexFlag===16?[this.min[0],this.max[1],this.min[2]]:f.pnVertexFlag===1?[this.min[0],this.min[1],this.max[2]]:[this.min[0],this.min[1],this.min[2]]}}],[{key:"isEmpty",value:function(f){return!f||f.halfExtents[0]===0&&f.halfExtents[1]===0&&f.halfExtents[2]===0}}])}(),ze=function(){function x(S,f){(0,Z.Z)(this,x),this.distance=S||0,this.normal=f||D.al(0,1,0),this.updatePNVertexFlag()}return(0,V.Z)(x,[{key:"updatePNVertexFlag",value:function(){this.pnVertexFlag=(+(this.normal[0]>=0)<<8)+(+(this.normal[1]>=0)<<4)+ +(this.normal[2]>=0)}},{key:"distanceToPoint",value:function(f){return D.AK(f,this.normal)-this.distance}},{key:"normalize",value:function(){var f=1/D.Zh(this.normal);D.bA(this.normal,this.normal,f),this.distance*=f}},{key:"intersectsLine",value:function(f,A,_){var k=this.distanceToPoint(f),G=this.distanceToPoint(A),ae=k/(k-G),ge=ae>=0&&ae<=1;return ge&&_&&D.t7(_,f,A,ae),ge}}])}(),Je=function(x){return x[x.OUTSIDE=4294967295]="OUTSIDE",x[x.INSIDE=0]="INSIDE",x[x.INDETERMINATE=2147483647]="INDETERMINATE",x}({}),At=function(){function x(S){if((0,Z.Z)(this,x),this.planes=[],S)this.planes=S;else for(var f=0;f<6;f++)this.planes.push(new ze)}return(0,V.Z)(x,[{key:"extractFromVPMatrix",value:function(f){var A=(0,C.Z)(f,16),_=A[0],k=A[1],G=A[2],ae=A[3],ge=A[4],Ue=A[5],rt=A[6],bt=A[7],Zt=A[8],wn=A[9],mn=A[10],Gn=A[11],ir=A[12],tr=A[13],Zn=A[14],Tr=A[15];D.t8(this.planes[0].normal,ae-_,bt-ge,Gn-Zt),this.planes[0].distance=Tr-ir,D.t8(this.planes[1].normal,ae+_,bt+ge,Gn+Zt),this.planes[1].distance=Tr+ir,D.t8(this.planes[2].normal,ae+k,bt+Ue,Gn+wn),this.planes[2].distance=Tr+tr,D.t8(this.planes[3].normal,ae-k,bt-Ue,Gn-wn),this.planes[3].distance=Tr-tr,D.t8(this.planes[4].normal,ae-G,bt-rt,Gn-mn),this.planes[4].distance=Tr-Zn,D.t8(this.planes[5].normal,ae+G,bt+rt,Gn+mn),this.planes[5].distance=Tr+Zn,this.planes.forEach(function(ni){ni.normalize(),ni.updatePNVertexFlag()})}}])}(),xt=function(){function x(){var S=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,f=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;(0,Z.Z)(this,x),this.x=0,this.y=0,this.x=S,this.y=f}return(0,V.Z)(x,[{key:"clone",value:function(){return new x(this.x,this.y)}},{key:"copyFrom",value:function(f){this.x=f.x,this.y=f.y}}])}(),Sn=function(){function x(S,f,A,_){(0,Z.Z)(this,x),this.x=S,this.y=f,this.width=A,this.height=_,this.left=S,this.right=S+A,this.top=f,this.bottom=f+_}return(0,V.Z)(x,[{key:"toJSON",value:function(){}}],[{key:"fromRect",value:function(f){return new x(f.x,f.y,f.width,f.height)}},{key:"applyTransform",value:function(f,A){var _=X.al(f.x,f.y,0,1),k=X.al(f.x+f.width,f.y,0,1),G=X.al(f.x,f.y+f.height,0,1),ae=X.al(f.x+f.width,f.y+f.height,0,1),ge=X.Ue(),Ue=X.Ue(),rt=X.Ue(),bt=X.Ue();X.fF(ge,_,A),X.fF(Ue,k,A),X.fF(rt,G,A),X.fF(bt,ae,A);var Zt=Math.min(ge[0],Ue[0],rt[0],bt[0]),wn=Math.min(ge[1],Ue[1],rt[1],bt[1]),mn=Math.max(ge[0],Ue[0],rt[0],bt[0]),Gn=Math.max(ge[1],Ue[1],rt[1],bt[1]);return x.fromRect({x:Zt,y:wn,width:mn-Zt,height:Gn-wn})}}])}(),Oe="Method not implemented.",Qe="Use document.documentElement instead.",Re="Cannot append a destroyed element.";function Ke(x){return x===void 0?0:x>360||x<-360?x%360:x}var gt=D.Ue();function tn(x){var S=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,f=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,A=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0;return Array.isArray(x)&&x.length===3?A?D.d9(x):D.JG(gt,x):(0,ve.Z)(x)?A?D.al(x,S,f):D.t8(gt,x,S,f):A?D.al(x[0],x[1]||S,x[2]||f):D.t8(gt,x[0],x[1]||S,x[2]||f)}var yt=Math.PI/180;function Yt(x){return x*yt}var Rn=180/Math.PI;function er(x){return x*Rn}var Jn=.9;function kr(x){return x%=400,x<0&&(x+=400),x*Jn}function fr(x){return x/360}function wr(x){return 360*x}var ei=Math.PI/2;function _n(x,S){var f=S[0],A=S[1],_=S[2],k=S[3],G=f*f,ae=A*A,ge=_*_,Ue=k*k,rt=G+ae+ge+Ue,bt=f*k-A*_;return bt>.499995*rt?(x[0]=ei,x[1]=2*Math.atan2(A,f),x[2]=0):bt<-.499995*rt?(x[0]=-ei,x[1]=2*Math.atan2(A,f),x[2]=0):(x[0]=Math.asin(2*(f*_-k*A)),x[1]=Math.atan2(2*(f*k+A*_),1-2*(ge+Ue)),x[2]=Math.atan2(2*(f*A+_*k),1-2*(ae+ge))),x}function jn(x,S){var f,A,_=j.getScaling(D.Ue(),S),k=(0,C.Z)(_,3),G=k[0],ae=k[1],ge=k[2],Ue=Math.asin(-S[2]/G);return Ue<ei?Ue>-ei?(f=Math.atan2(S[6]/ae,S[10]/ge),A=Math.atan2(S[1]/G,S[0]/G)):(A=0,f=-Math.atan2(S[4]/ae,S[5]/ae)):(A=0,f=Math.atan2(S[4]/ae,S[5]/ae)),x[0]=f,x[1]=Ue,x[2]=A,x}function Hr(x,S){return S.length===16?jn(x,S):_n(x,S)}function Pr(x,S,f,A,_){var k=Math.cos(x),G=Math.sin(x);return de.al(A*k,_*G,0,-A*G,_*k,0,S,f,1)}function $i(x,S,f,A,_,k,G){var ae=arguments.length>7&&arguments[7]!==void 0?arguments[7]:!1,ge=2*k,Ue=f-S,rt=A-_,bt=ge/Ue,Zt=ge/rt,wn=(f+S)/Ue,mn=(A+_)/rt,Gn,ir,tr=G-k,Zn=G*k;return ae?(Gn=-G/tr,ir=-Zn/tr):(Gn=-(G+k)/tr,ir=-2*Zn/tr),x[0]=bt,x[1]=0,x[2]=0,x[3]=0,x[4]=0,x[5]=Zt,x[6]=0,x[7]=0,x[8]=wn,x[9]=mn,x[10]=Gn,x[11]=-1,x[12]=0,x[13]=0,x[14]=ir,x[15]=0,x}function Zi(x){var S=x[0],f=x[1],A=x[3],_=x[4],k=Math.sqrt(S*S+f*f),G=Math.sqrt(A*A+_*_),ae=S*_-f*A;if(ae<0&&(S<_?k=-k:G=-G),k){var ge=1/k;S*=ge,f*=ge}if(G){var Ue=1/G;A*=Ue,_*=Ue}var rt=Math.atan2(f,S),bt=er(rt);return[x[6],x[7],k,G,bt]}var Xi=j.create(),Ei=j.create(),ms=X.Ue(),_i=[D.Ue(),D.Ue(),D.Ue()],Es=D.Ue();function ua(x,S,f,A,_,k){if(!Hn(Xi,x)||(j.copy(Ei,Xi),Ei[3]=0,Ei[7]=0,Ei[11]=0,Ei[15]=1,Math.abs(j.determinant(Ei))<1e-8))return!1;var G=Xi[3],ae=Xi[7],ge=Xi[11],Ue=Xi[12],rt=Xi[13],bt=Xi[14],Zt=Xi[15];if(G!==0||ae!==0||ge!==0){ms[0]=G,ms[1]=ae,ms[2]=ge,ms[3]=Zt;var wn=j.invert(Ei,Ei);if(!wn)return!1;j.transpose(Ei,Ei),X.fF(_,ms,Ei)}else _[0]=_[1]=_[2]=0,_[3]=1;if(S[0]=Ue,S[1]=rt,S[2]=bt,Pt(_i,Xi),f[0]=D.kE(_i[0]),D.Fv(_i[0],_i[0]),A[0]=D.AK(_i[0],_i[1]),Gt(_i[1],_i[1],_i[0],1,-A[0]),f[1]=D.kE(_i[1]),D.Fv(_i[1],_i[1]),A[0]/=f[1],A[1]=D.AK(_i[0],_i[2]),Gt(_i[2],_i[2],_i[0],1,-A[1]),A[2]=D.AK(_i[1],_i[2]),Gt(_i[2],_i[2],_i[1],1,-A[2]),f[2]=D.kE(_i[2]),D.Fv(_i[2],_i[2]),A[1]/=f[2],A[2]/=f[2],D.kC(Es,_i[1],_i[2]),D.AK(_i[0],Es)<0)for(var mn=0;mn<3;mn++)f[mn]*=-1,_i[mn][0]*=-1,_i[mn][1]*=-1,_i[mn][2]*=-1;return k[0]=.5*Math.sqrt(Math.max(1+_i[0][0]-_i[1][1]-_i[2][2],0)),k[1]=.5*Math.sqrt(Math.max(1-_i[0][0]+_i[1][1]-_i[2][2],0)),k[2]=.5*Math.sqrt(Math.max(1-_i[0][0]-_i[1][1]+_i[2][2],0)),k[3]=.5*Math.sqrt(Math.max(1+_i[0][0]+_i[1][1]+_i[2][2],0)),_i[2][1]>_i[1][2]&&(k[0]=-k[0]),_i[0][2]>_i[2][0]&&(k[1]=-k[1]),_i[1][0]>_i[0][1]&&(k[2]=-k[2]),!0}function Hn(x,S){var f=S[15];if(f===0)return!1;for(var A=1/f,_=0;_<16;_++)x[_]=S[_]*A;return!0}function Pt(x,S){x[0][0]=S[0],x[0][1]=S[1],x[0][2]=S[2],x[1][0]=S[4],x[1][1]=S[5],x[1][2]=S[6],x[2][0]=S[8],x[2][1]=S[9],x[2][2]=S[10]}function Gt(x,S,f,A,_){x[0]=S[0]*A+f[0]*_,x[1]=S[1]*A+f[1]*_,x[2]=S[2]*A+f[2]*_}var Bt=function(x){return x[x.ORBITING=0]="ORBITING",x[x.EXPLORING=1]="EXPLORING",x[x.TRACKING=2]="TRACKING",x}({}),yn=function(x){return x[x.DEFAULT=0]="DEFAULT",x[x.ROTATIONAL=1]="ROTATIONAL",x[x.TRANSLATIONAL=2]="TRANSLATIONAL",x[x.CINEMATIC=3]="CINEMATIC",x}({}),Ln=function(x){return x[x.ORTHOGRAPHIC=0]="ORTHOGRAPHIC",x[x.PERSPECTIVE=1]="PERSPECTIVE",x}({}),gr={UPDATED:"updated"},Rr=2e-4,$r=function(){function x(){(0,Z.Z)(this,x),this.clipSpaceNearZ=ar.NEGATIVE_ONE,this.eventEmitter=new H,this.matrix=j.create(),this.right=D.al(1,0,0),this.up=D.al(0,1,0),this.forward=D.al(0,0,1),this.position=D.al(0,0,1),this.focalPoint=D.al(0,0,0),this.distanceVector=D.al(0,0,-1),this.distance=1,this.azimuth=0,this.elevation=0,this.roll=0,this.relAzimuth=0,this.relElevation=0,this.relRoll=0,this.dollyingStep=0,this.maxDistance=1/0,this.minDistance=-1/0,this.zoom=1,this.rotateWorld=!1,this.fov=30,this.near=.1,this.far=1e3,this.aspect=1,this.projectionMatrix=j.create(),this.projectionMatrixInverse=j.create(),this.jitteredProjectionMatrix=void 0,this.enableUpdate=!0,this.type=Bt.EXPLORING,this.trackingMode=yn.DEFAULT,this.projectionMode=Ln.PERSPECTIVE,this.frustum=new At,this.orthoMatrix=j.create()}return(0,V.Z)(x,[{key:"isOrtho",value:function(){return this.projectionMode===Ln.ORTHOGRAPHIC}},{key:"getProjectionMode",value:function(){return this.projectionMode}},{key:"getPerspective",value:function(){return this.jitteredProjectionMatrix||this.projectionMatrix}},{key:"getPerspectiveInverse",value:function(){return this.projectionMatrixInverse}},{key:"getFrustum",value:function(){return this.frustum}},{key:"getPosition",value:function(){return this.position}},{key:"getFocalPoint",value:function(){return this.focalPoint}},{key:"getDollyingStep",value:function(){return this.dollyingStep}},{key:"getNear",value:function(){return this.near}},{key:"getFar",value:function(){return this.far}},{key:"getZoom",value:function(){return this.zoom}},{key:"getOrthoMatrix",value:function(){return this.orthoMatrix}},{key:"getView",value:function(){return this.view}},{key:"setEnableUpdate",value:function(f){this.enableUpdate=f}},{key:"setType",value:function(f,A){return this.type=f,this.type===Bt.EXPLORING?this.setWorldRotation(!0):this.setWorldRotation(!1),this._getAngles(),this.type===Bt.TRACKING&&A!==void 0&&this.setTrackingMode(A),this}},{key:"setProjectionMode",value:function(f){return this.projectionMode=f,this}},{key:"setTrackingMode",value:function(f){if(this.type!==Bt.TRACKING)throw new Error("Impossible to set a tracking mode if the camera is not of tracking type");return this.trackingMode=f,this}},{key:"setWorldRotation",value:function(f){return this.rotateWorld=f,this._getAngles(),this}},{key:"getViewTransform",value:function(){return j.invert(j.create(),this.matrix)}},{key:"getWorldTransform",value:function(){return this.matrix}},{key:"jitterProjectionMatrix",value:function(f,A){var _=j.fromTranslation(j.create(),[f,A,0]);this.jitteredProjectionMatrix=j.multiply(j.create(),_,this.projectionMatrix)}},{key:"clearJitterProjectionMatrix",value:function(){this.jitteredProjectionMatrix=void 0}},{key:"setMatrix",value:function(f){return this.matrix=f,this._update(),this}},{key:"setProjectionMatrix",value:function(f){this.projectionMatrix=f}},{key:"setFov",value:function(f){return this.setPerspective(this.near,this.far,f,this.aspect),this}},{key:"setAspect",value:function(f){return this.setPerspective(this.near,this.far,this.fov,f),this}},{key:"setNear",value:function(f){return this.projectionMode===Ln.PERSPECTIVE?this.setPerspective(f,this.far,this.fov,this.aspect):this.setOrthographic(this.left,this.rright,this.top,this.bottom,f,this.far),this}},{key:"setFar",value:function(f){return this.projectionMode===Ln.PERSPECTIVE?this.setPerspective(this.near,f,this.fov,this.aspect):this.setOrthographic(this.left,this.rright,this.top,this.bottom,this.near,f),this}},{key:"setViewOffset",value:function(f,A,_,k,G,ae){return this.aspect=f/A,this.view===void 0&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=f,this.view.fullHeight=A,this.view.offsetX=_,this.view.offsetY=k,this.view.width=G,this.view.height=ae,this.projectionMode===Ln.PERSPECTIVE?this.setPerspective(this.near,this.far,this.fov,this.aspect):this.setOrthographic(this.left,this.rright,this.top,this.bottom,this.near,this.far),this}},{key:"clearViewOffset",value:function(){return this.view!==void 0&&(this.view.enabled=!1),this.projectionMode===Ln.PERSPECTIVE?this.setPerspective(this.near,this.far,this.fov,this.aspect):this.setOrthographic(this.left,this.rright,this.top,this.bottom,this.near,this.far),this}},{key:"setZoom",value:function(f){return this.zoom=f,this.projectionMode===Ln.ORTHOGRAPHIC?this.setOrthographic(this.left,this.rright,this.top,this.bottom,this.near,this.far):this.projectionMode===Ln.PERSPECTIVE&&this.setPerspective(this.near,this.far,this.fov,this.aspect),this}},{key:"setZoomByViewportPoint",value:function(f,A){var _=this.canvas.viewport2Canvas({x:A[0],y:A[1]}),k=_.x,G=_.y,ae=this.roll;this.rotate(0,0,-ae),this.setPosition(k,G),this.setFocalPoint(k,G),this.setZoom(f),this.rotate(0,0,ae);var ge=this.canvas.viewport2Canvas({x:A[0],y:A[1]}),Ue=ge.x,rt=ge.y,bt=D.al(Ue-k,rt-G,0),Zt=D.AK(bt,this.right)/D.kE(this.right),wn=D.AK(bt,this.up)/D.kE(this.up),mn=this.getPosition(),Gn=(0,C.Z)(mn,2),ir=Gn[0],tr=Gn[1],Zn=this.getFocalPoint(),Tr=(0,C.Z)(Zn,2),ni=Tr[0],ns=Tr[1];return this.setPosition(ir-Zt,tr-wn),this.setFocalPoint(ni-Zt,ns-wn),this}},{key:"setPerspective",value:function(f,A,_,k){var G;this.projectionMode=Ln.PERSPECTIVE,this.fov=_,this.near=f,this.far=A,this.aspect=k;var ae=this.near*Math.tan(Yt(.5*this.fov))/this.zoom,ge=2*ae,Ue=this.aspect*ge,rt=-.5*Ue;if((G=this.view)!==null&&G!==void 0&&G.enabled){var bt=this.view.fullWidth,Zt=this.view.fullHeight;rt+=this.view.offsetX*Ue/bt,ae-=this.view.offsetY*ge/Zt,Ue*=this.view.width/bt,ge*=this.view.height/Zt}return $i(this.projectionMatrix,rt,rt+Ue,ae-ge,ae,f,this.far,this.clipSpaceNearZ===ar.ZERO),j.invert(this.projectionMatrixInverse,this.projectionMatrix),this.triggerUpdate(),this}},{key:"setOrthographic",value:function(f,A,_,k,G,ae){var ge;this.projectionMode=Ln.ORTHOGRAPHIC,this.rright=A,this.left=f,this.top=_,this.bottom=k,this.near=G,this.far=ae;var Ue=(this.rright-this.left)/(2*this.zoom),rt=(this.top-this.bottom)/(2*this.zoom),bt=(this.rright+this.left)/2,Zt=(this.top+this.bottom)/2,wn=bt-Ue,mn=bt+Ue,Gn=Zt+rt,ir=Zt-rt;if((ge=this.view)!==null&&ge!==void 0&&ge.enabled){var tr=(this.rright-this.left)/this.view.fullWidth/this.zoom,Zn=(this.top-this.bottom)/this.view.fullHeight/this.zoom;wn+=tr*this.view.offsetX,mn=wn+tr*this.view.width,Gn-=Zn*this.view.offsetY,ir=Gn-Zn*this.view.height}return this.clipSpaceNearZ===ar.NEGATIVE_ONE?j.ortho(this.projectionMatrix,wn,mn,Gn,ir,G,ae):j.orthoZO(this.projectionMatrix,wn,mn,Gn,ir,G,ae),j.invert(this.projectionMatrixInverse,this.projectionMatrix),this._getOrthoMatrix(),this.triggerUpdate(),this}},{key:"setPosition",value:function(f){var A=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.position[1],_=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.position[2],k=tn(f,A,_);return this._setPosition(k),this.setFocalPoint(this.focalPoint),this.triggerUpdate(),this}},{key:"setFocalPoint",value:function(f){var A=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.focalPoint[1],_=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.focalPoint[2],k=D.al(0,1,0);if(this.focalPoint=tn(f,A,_),this.trackingMode===yn.CINEMATIC){var G=D.$X(D.Ue(),this.focalPoint,this.position);f=G[0],A=G[1],_=G[2];var ae=D.kE(G),ge=er(Math.asin(A/ae)),Ue=90+er(Math.atan2(_,f)),rt=j.create();j.rotateY(rt,rt,Yt(Ue)),j.rotateX(rt,rt,Yt(ge)),k=D.fF(D.Ue(),[0,1,0],rt)}return j.invert(this.matrix,j.lookAt(j.create(),this.position,this.focalPoint,k)),this._getAxes(),this._getDistance(),this._getAngles(),this.triggerUpdate(),this}},{key:"getDistance",value:function(){return this.distance}},{key:"getDistanceVector",value:function(){return this.distanceVector}},{key:"setDistance",value:function(f){if(this.distance===f||f<0)return this;this.distance=f,this.distance<Rr&&(this.distance=Rr),this.dollyingStep=this.distance/100;var A=D.Ue();f=this.distance;var _=this.forward,k=this.focalPoint;return A[0]=f*_[0]+k[0],A[1]=f*_[1]+k[1],A[2]=f*_[2]+k[2],this._setPosition(A),this.triggerUpdate(),this}},{key:"setMaxDistance",value:function(f){return this.maxDistance=f,this}},{key:"setMinDistance",value:function(f){return this.minDistance=f,this}},{key:"setAzimuth",value:function(f){return this.azimuth=Ke(f),this.computeMatrix(),this._getAxes(),this.type===Bt.ORBITING||this.type===Bt.EXPLORING?this._getPosition():this.type===Bt.TRACKING&&this._getFocalPoint(),this.triggerUpdate(),this}},{key:"getAzimuth",value:function(){return this.azimuth}},{key:"setElevation",value:function(f){return this.elevation=Ke(f),this.computeMatrix(),this._getAxes(),this.type===Bt.ORBITING||this.type===Bt.EXPLORING?this._getPosition():this.type===Bt.TRACKING&&this._getFocalPoint(),this.triggerUpdate(),this}},{key:"getElevation",value:function(){return this.elevation}},{key:"setRoll",value:function(f){return this.roll=Ke(f),this.computeMatrix(),this._getAxes(),this.type===Bt.ORBITING||this.type===Bt.EXPLORING?this._getPosition():this.type===Bt.TRACKING&&this._getFocalPoint(),this.triggerUpdate(),this}},{key:"getRoll",value:function(){return this.roll}},{key:"_update",value:function(){this._getAxes(),this._getPosition(),this._getDistance(),this._getAngles(),this._getOrthoMatrix(),this.triggerUpdate()}},{key:"computeMatrix",value:function(){var f=he.yY(he.Ue(),[0,0,1],Yt(this.roll));j.identity(this.matrix);var A=he.yY(he.Ue(),[1,0,0],Yt((this.rotateWorld&&this.type!==Bt.TRACKING||this.type===Bt.TRACKING?1:-1)*this.elevation)),_=he.yY(he.Ue(),[0,1,0],Yt((this.rotateWorld&&this.type!==Bt.TRACKING||this.type===Bt.TRACKING?1:-1)*this.azimuth)),k=he.Jp(he.Ue(),_,A);k=he.Jp(he.Ue(),k,f);var G=j.fromQuat(j.create(),k);this.type===Bt.ORBITING||this.type===Bt.EXPLORING?(j.translate(this.matrix,this.matrix,this.focalPoint),j.multiply(this.matrix,this.matrix,G),j.translate(this.matrix,this.matrix,[0,0,this.distance])):this.type===Bt.TRACKING&&(j.translate(this.matrix,this.matrix,this.position),j.multiply(this.matrix,this.matrix,G))}},{key:"_setPosition",value:function(f,A,_){this.position=tn(f,A,_);var k=this.matrix;k[12]=this.position[0],k[13]=this.position[1],k[14]=this.position[2],k[15]=1,this._getOrthoMatrix()}},{key:"_getAxes",value:function(){D.JG(this.right,tn(X.fF(X.Ue(),[1,0,0,0],this.matrix))),D.JG(this.up,tn(X.fF(X.Ue(),[0,1,0,0],this.matrix))),D.JG(this.forward,tn(X.fF(X.Ue(),[0,0,1,0],this.matrix))),D.Fv(this.right,this.right),D.Fv(this.up,this.up),D.Fv(this.forward,this.forward)}},{key:"_getAngles",value:function(){var f=this.distanceVector[0],A=this.distanceVector[1],_=this.distanceVector[2],k=D.kE(this.distanceVector);if(k===0){this.elevation=0,this.azimuth=0;return}this.type===Bt.TRACKING?(this.elevation=er(Math.asin(A/k)),this.azimuth=er(Math.atan2(-f,-_))):this.rotateWorld?(this.elevation=er(Math.asin(A/k)),this.azimuth=er(Math.atan2(-f,-_))):(this.elevation=-er(Math.asin(A/k)),this.azimuth=-er(Math.atan2(-f,-_)))}},{key:"_getPosition",value:function(){D.JG(this.position,tn(X.fF(X.Ue(),[0,0,0,1],this.matrix))),this._getDistance()}},{key:"_getFocalPoint",value:function(){D.kK(this.distanceVector,[0,0,-this.distance],de.xO(de.Ue(),this.matrix)),D.IH(this.focalPoint,this.position,this.distanceVector),this._getDistance()}},{key:"_getDistance",value:function(){this.distanceVector=D.$X(D.Ue(),this.focalPoint,this.position),this.distance=D.kE(this.distanceVector),this.dollyingStep=this.distance/100}},{key:"_getOrthoMatrix",value:function(){if(this.projectionMode===Ln.ORTHOGRAPHIC){var f=this.position,A=he.yY(he.Ue(),[0,0,1],-this.roll*Math.PI/180);j.fromRotationTranslationScaleOrigin(this.orthoMatrix,A,D.al((this.rright-this.left)/2-f[0],(this.top-this.bottom)/2-f[1],0),D.al(this.zoom,this.zoom,1),f)}}},{key:"triggerUpdate",value:function(){if(this.enableUpdate){var f=this.getViewTransform(),A=j.multiply(j.create(),this.getPerspective(),f);this.getFrustum().extractFromVPMatrix(A),this.eventEmitter.emit(gr.UPDATED)}}},{key:"rotate",value:function(f,A,_){throw new Error(Oe)}},{key:"pan",value:function(f,A){throw new Error(Oe)}},{key:"dolly",value:function(f){throw new Error(Oe)}},{key:"createLandmark",value:function(f,A){throw new Error(Oe)}},{key:"gotoLandmark",value:function(f,A){throw new Error(Oe)}},{key:"cancelLandmarkAnimation",value:function(){throw new Error(Oe)}}])}(),Ii=function(x){return x[x.Standard=0]="Standard",x}({}),Di=function(x){return x[x.ADDED=0]="ADDED",x[x.REMOVED=1]="REMOVED",x[x.Z_INDEX_CHANGED=2]="Z_INDEX_CHANGED",x}({}),ss=D.Ue(),vs=j.create(),Cs=he.Ue();function Aa(x){if(x.localDirtyFlag){var S=x.localSkew[0]!==0||x.localSkew[1]!==0;if(S){j.fromRotationTranslationScaleOrigin(x.localTransform,x.localRotation,x.localPosition,D.al(1,1,1),x.origin),(x.localSkew[0]!==0||x.localSkew[1]!==0)&&(j.identity(vs),vs[4]=Math.tan(x.localSkew[0]),vs[1]=Math.tan(x.localSkew[1]),j.multiply(x.localTransform,x.localTransform,vs));var f=j.fromRotationTranslationScaleOrigin(vs,he.t8(Cs,0,0,0,1),D.t8(ss,1,1,1),x.localScale,x.origin);j.multiply(x.localTransform,x.localTransform,f)}else{var A=x.localTransform,_=x.localPosition,k=x.localRotation,G=x.localScale,ae=x.origin,ge=_[0]!==0||_[1]!==0||_[2]!==0,Ue=k[3]!==1||k[0]!==0||k[1]!==0||k[2]!==0,rt=G[0]!==1||G[1]!==1||G[2]!==1,bt=ae[0]!==0||ae[1]!==0||ae[2]!==0;!Ue&&!rt&&!bt?ge?j.fromTranslation(A,_):j.identity(A):j.fromRotationTranslationScaleOrigin(A,k,_,G,ae)}x.localDirtyFlag=!1}}function sa(x,S){x.dirtyFlag&&(S?j.multiply(x.worldTransform,S.worldTransform,x.localTransform):j.copy(x.worldTransform,x.localTransform),x.dirtyFlag=!1)}var ca={absolutePath:[],hasArc:!1,segments:[],polygons:[],polylines:[],curve:null,totalLength:0,rect:new Sn(0,0,0,0)},Ai=function(x){return x.COORDINATE="<coordinate>",x.COLOR="<color>",x.PAINT="<paint>",x.NUMBER="<number>",x.ANGLE="<angle>",x.OPACITY_VALUE="<opacity-value>",x.SHADOW_BLUR="<shadow-blur>",x.LENGTH="<length>",x.PERCENTAGE="<percentage>",x.LENGTH_PERCENTAGE="<length> | <percentage>",x.LENGTH_PERCENTAGE_12="[<length> | <percentage>]{1,2}",x.LENGTH_PERCENTAGE_14="[<length> | <percentage>]{1,4}",x.LIST_OF_POINTS="<list-of-points>",x.PATH="<path>",x.FILTER="<filter>",x.Z_INDEX="<z-index>",x.OFFSET_DISTANCE="<offset-distance>",x.DEFINED_PATH="<defined-path>",x.MARKER="<marker>",x.TRANSFORM="<transform>",x.TRANSFORM_ORIGIN="<transform-origin>",x.TEXT="<text>",x.TEXT_TRANSFORM="<text-transform>",x}({});function $a(x,S,f){x.prototype=S.prototype=f,f.constructor=x}function Zo(x,S){var f=Object.create(x.prototype);for(var A in S)f[A]=S[A];return f}function Ko(){}var $o=.7,bo=1/$o,Pl="\\s*([+-]?\\d+)\\s*",il="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",go="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Ll=/^#([0-9a-f]{3,8})$/,Lu=new RegExp(`^rgb\\(${Pl},${Pl},${Pl}\\)$`),ao=new RegExp(`^rgb\\(${go},${go},${go}\\)$`),sl=new RegExp(`^rgba\\(${Pl},${Pl},${Pl},${il}\\)$`),No=new RegExp(`^rgba\\(${go},${go},${go},${il}\\)$`),Uu=new RegExp(`^hsl\\(${il},${go},${go}\\)$`),ws=new RegExp(`^hsla\\(${il},${go},${go},${il}\\)$`),Kh={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};$a(Ko,sc,{copy(x){return Object.assign(new this.constructor,this,x)},displayable(){return this.rgb().displayable()},hex:dh,formatHex:dh,formatHex8:$h,formatHsl:Uh,formatRgb:Ku,toString:Ku});function dh(){return this.rgb().formatHex()}function $h(){return this.rgb().formatHex8()}function Uh(){return lu(this).formatHsl()}function Ku(){return this.rgb().formatRgb()}function sc(x){var S,f;return x=(x+"").trim().toLowerCase(),(S=Ll.exec(x))?(f=S[1].length,S=parseInt(S[1],16),f===6?pu(S):f===3?new Xo(S>>8&15|S>>4&240,S>>4&15|S&240,(S&15)<<4|S&15,1):f===8?ou(S>>24&255,S>>16&255,S>>8&255,(S&255)/255):f===4?ou(S>>12&15|S>>8&240,S>>8&15|S>>4&240,S>>4&15|S&240,((S&15)<<4|S&15)/255):null):(S=Lu.exec(x))?new Xo(S[1],S[2],S[3],1):(S=ao.exec(x))?new Xo(S[1]*255/100,S[2]*255/100,S[3]*255/100,1):(S=sl.exec(x))?ou(S[1],S[2],S[3],S[4]):(S=No.exec(x))?ou(S[1]*255/100,S[2]*255/100,S[3]*255/100,S[4]):(S=Uu.exec(x))?gd(S[1],S[2]/100,S[3]/100,1):(S=ws.exec(x))?gd(S[1],S[2]/100,S[3]/100,S[4]):Kh.hasOwnProperty(x)?pu(Kh[x]):x==="transparent"?new Xo(NaN,NaN,NaN,0):null}function pu(x){return new Xo(x>>16&255,x>>8&255,x&255,1)}function ou(x,S,f,A){return A<=0&&(x=S=f=NaN),new Xo(x,S,f,A)}function Ad(x){return x instanceof Ko||(x=sc(x)),x?(x=x.rgb(),new Xo(x.r,x.g,x.b,x.opacity)):new Xo}function hf(x,S,f,A){return arguments.length===1?Ad(x):new Xo(x,S,f,A==null?1:A)}function Xo(x,S,f,A){this.r=+x,this.g=+S,this.b=+f,this.opacity=+A}$a(Xo,hf,Zo(Ko,{brighter(x){return x=x==null?bo:Math.pow(bo,x),new Xo(this.r*x,this.g*x,this.b*x,this.opacity)},darker(x){return x=x==null?$o:Math.pow($o,x),new Xo(this.r*x,this.g*x,this.b*x,this.opacity)},rgb(){return this},clamp(){return new Xo(Vc(this.r),Vc(this.g),Vc(this.b),Ah(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:fh,formatHex:fh,formatHex8:Qf,formatRgb:pd,toString:pd}));function fh(){return`#${jo(this.r)}${jo(this.g)}${jo(this.b)}`}function Qf(){return`#${jo(this.r)}${jo(this.g)}${jo(this.b)}${jo((isNaN(this.opacity)?1:this.opacity)*255)}`}function pd(){const x=Ah(this.opacity);return`${x===1?"rgb(":"rgba("}${Vc(this.r)}, ${Vc(this.g)}, ${Vc(this.b)}${x===1?")":`, ${x})`}`}function Ah(x){return isNaN(x)?1:Math.max(0,Math.min(1,x))}function Vc(x){return Math.max(0,Math.min(255,Math.round(x)||0))}function jo(x){return x=Vc(x),(x<16?"0":"")+x.toString(16)}function gd(x,S,f,A){return A<=0?x=S=f=NaN:f<=0||f>=1?x=S=NaN:S<=0&&(x=NaN),new oo(x,S,f,A)}function lu(x){if(x instanceof oo)return new oo(x.h,x.s,x.l,x.opacity);if(x instanceof Ko||(x=sc(x)),!x)return new oo;if(x instanceof oo)return x;x=x.rgb();var S=x.r/255,f=x.g/255,A=x.b/255,_=Math.min(S,f,A),k=Math.max(S,f,A),G=NaN,ae=k-_,ge=(k+_)/2;return ae?(S===k?G=(f-A)/ae+(f<A)*6:f===k?G=(A-S)/ae+2:G=(S-f)/ae+4,ae/=ge<.5?k+_:2-k-_,G*=60):ae=ge>0&&ge<1?0:G,new oo(G,ae,ge,x.opacity)}function gu(x,S,f,A){return arguments.length===1?lu(x):new oo(x,S,f,A==null?1:A)}function oo(x,S,f,A){this.h=+x,this.s=+S,this.l=+f,this.opacity=+A}$a(oo,gu,Zo(Ko,{brighter(x){return x=x==null?bo:Math.pow(bo,x),new oo(this.h,this.s,this.l*x,this.opacity)},darker(x){return x=x==null?$o:Math.pow($o,x),new oo(this.h,this.s,this.l*x,this.opacity)},rgb(){var x=this.h%360+(this.h<0)*360,S=isNaN(x)||isNaN(this.s)?0:this.s,f=this.l,A=f+(f<.5?f:1-f)*S,_=2*f-A;return new Xo(ph(x>=240?x-240:x+120,_,A),ph(x,_,A),ph(x<120?x+240:x-120,_,A),this.opacity)},clamp(){return new oo(Ic(this.h),jc(this.s),jc(this.l),Ah(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 x=Ah(this.opacity);return`${x===1?"hsl(":"hsla("}${Ic(this.h)}, ${jc(this.s)*100}%, ${jc(this.l)*100}%${x===1?")":`, ${x})`}`}}));function Ic(x){return x=(x||0)%360,x<0?x+360:x}function jc(x){return Math.max(0,Math.min(1,x||0))}function ph(x,S,f){return(x<60?S+(f-S)*x/60:x<180?f:x<240?S+(f-S)*(240-x)/60:S)*255}function Lo(x,S){if(typeof x!="function"||S!=null&&typeof S!="function")throw new TypeError("Expected a function");var f=function(){for(var _=arguments.length,k=new Array(_),G=0;G<_;G++)k[G]=arguments[G];var ae=S?S.apply(this,k):k[0],ge=f.cache;if(ge.has(ae))return ge.get(ae);var Ue=x.apply(this,k);return f.cache=ge.set(ae,Ue)||ge,Ue};return f.cache=new(Lo.Cache||Map),Lo.cacheList.push(f.cache),f}Lo.Cache=Map,Lo.cacheList=[],Lo.clearCache=function(){Lo.cacheList.forEach(function(x){return x.clear()})};var Ji=function(x){return x[x.kUnknown=0]="kUnknown",x[x.kNumber=1]="kNumber",x[x.kPercentage=2]="kPercentage",x[x.kEms=3]="kEms",x[x.kPixels=4]="kPixels",x[x.kRems=5]="kRems",x[x.kDegrees=6]="kDegrees",x[x.kRadians=7]="kRadians",x[x.kGradians=8]="kGradians",x[x.kTurns=9]="kTurns",x[x.kMilliseconds=10]="kMilliseconds",x[x.kSeconds=11]="kSeconds",x[x.kInteger=12]="kInteger",x}({}),$u=function(x){return x[x.kUNumber=0]="kUNumber",x[x.kUPercent=1]="kUPercent",x[x.kULength=2]="kULength",x[x.kUAngle=3]="kUAngle",x[x.kUTime=4]="kUTime",x[x.kUOther=5]="kUOther",x}({}),gh=function(x){return x[x.kYes=0]="kYes",x[x.kNo=1]="kNo",x}({}),mh=function(x){return x[x.kYes=0]="kYes",x[x.kNo=1]="kNo",x}({}),np=[{name:"em",unit_type:Ji.kEms},{name:"px",unit_type:Ji.kPixels},{name:"deg",unit_type:Ji.kDegrees},{name:"rad",unit_type:Ji.kRadians},{name:"grad",unit_type:Ji.kGradians},{name:"ms",unit_type:Ji.kMilliseconds},{name:"s",unit_type:Ji.kSeconds},{name:"rem",unit_type:Ji.kRems},{name:"turn",unit_type:Ji.kTurns}],vh=function(x){return x[x.kUnknownType=0]="kUnknownType",x[x.kUnparsedType=1]="kUnparsedType",x[x.kKeywordType=2]="kKeywordType",x[x.kUnitType=3]="kUnitType",x[x.kSumType=4]="kSumType",x[x.kProductType=5]="kProductType",x[x.kNegateType=6]="kNegateType",x[x.kInvertType=7]="kInvertType",x[x.kMinType=8]="kMinType",x[x.kMaxType=9]="kMaxType",x[x.kClampType=10]="kClampType",x[x.kTransformType=11]="kTransformType",x[x.kPositionType=12]="kPositionType",x[x.kURLImageType=13]="kURLImageType",x[x.kColorType=14]="kColorType",x[x.kUnsupportedColorType=15]="kUnsupportedColorType",x}({}),Cu=function(S){return np.find(function(f){return f.name===S}).unit_type},zc=function(S){return S?S==="number"?Ji.kNumber:S==="percent"||S==="%"?Ji.kPercentage:Cu(S):Ji.kUnknown},Ul=function(S){switch(S){case Ji.kNumber:case Ji.kInteger:return $u.kUNumber;case Ji.kPercentage:return $u.kUPercent;case Ji.kPixels:return $u.kULength;case Ji.kMilliseconds:case Ji.kSeconds:return $u.kUTime;case Ji.kDegrees:case Ji.kRadians:case Ji.kGradians:case Ji.kTurns:return $u.kUAngle;default:return $u.kUOther}},Xl=function(S){switch(S){case $u.kUNumber:return Ji.kNumber;case $u.kULength:return Ji.kPixels;case $u.kUPercent:return Ji.kPercentage;case $u.kUTime:return Ji.kSeconds;case $u.kUAngle:return Ji.kDegrees;default:return Ji.kUnknown}},Uo=function(S){var f=1;switch(S){case Ji.kPixels:case Ji.kDegrees:case Ji.kSeconds:break;case Ji.kMilliseconds:f=.001;break;case Ji.kRadians:f=180/Math.PI;break;case Ji.kGradians:f=.9;break;case Ji.kTurns:f=360;break}return f},Ld=function(S){switch(S){case Ji.kNumber:case Ji.kInteger:return"";case Ji.kPercentage:return"%";case Ji.kEms:return"em";case Ji.kRems:return"rem";case Ji.kPixels:return"px";case Ji.kDegrees:return"deg";case Ji.kRadians:return"rad";case Ji.kGradians:return"grad";case Ji.kMilliseconds:return"ms";case Ji.kSeconds:return"s";case Ji.kTurns:return"turn"}return""},Yc=function(){function x(){(0,Z.Z)(this,x)}return(0,V.Z)(x,[{key:"toString",value:function(){return this.buildCSSText(gh.kNo,mh.kNo,"")}},{key:"isNumericValue",value:function(){return this.getType()>=vh.kUnitType&&this.getType()<=vh.kClampType}}],[{key:"isAngle",value:function(f){return f===Ji.kDegrees||f===Ji.kRadians||f===Ji.kGradians||f===Ji.kTurns}},{key:"isLength",value:function(f){return f>=Ji.kEms&&f<Ji.kDegrees}},{key:"isRelativeUnit",value:function(f){return f===Ji.kPercentage||f===Ji.kEms||f===Ji.kRems}},{key:"isTime",value:function(f){return f===Ji.kSeconds||f===Ji.kMilliseconds}}])}(),gl=function(x){function S(f){var A;return(0,Z.Z)(this,S),A=(0,E.Z)(this,S),A.colorSpace=f,A}return(0,F.Z)(S,x),(0,V.Z)(S,[{key:"getType",value:function(){return vh.kColorType}},{key:"to",value:function(A){return this}}])}(Yc),To=function(x){return x[x.Constant=0]="Constant",x[x.LinearGradient=1]="LinearGradient",x[x.RadialGradient=2]="RadialGradient",x}({}),ml=function(x){function S(f,A){var _;return(0,Z.Z)(this,S),_=(0,E.Z)(this,S),_.type=f,_.value=A,_}return(0,F.Z)(S,x),(0,V.Z)(S,[{key:"clone",value:function(){return new S(this.type,this.value)}},{key:"buildCSSText",value:function(A,_,k){return k}},{key:"getType",value:function(){return vh.kColorType}}])}(Yc),Xu=function(x){function S(f){var A;return(0,Z.Z)(this,S),A=(0,E.Z)(this,S),A.value=f,A}return(0,F.Z)(S,x),(0,V.Z)(S,[{key:"clone",value:function(){return new S(this.value)}},{key:"getType",value:function(){return vh.kKeywordType}},{key:"buildCSSText",value:function(A,_,k){return k+this.value}}])}(Yc),mu=function(S){var f=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",A="";return Number.isFinite(S)?A="NaN":S>0?A="infinity":A="-infinity",A+=f},Oo=function(S){return Xl(Ul(S))},Bo=function(x){function S(f){var A,_=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Ji.kNumber;(0,Z.Z)(this,S),A=(0,E.Z)(this,S);var k;return typeof _=="string"?k=zc(_):k=_,A.unit=k,A.value=f,A}return(0,F.Z)(S,x),(0,V.Z)(S,[{key:"clone",value:function(){return new S(this.value,this.unit)}},{key:"equals",value:function(A){var _=A;return this.value===_.value&&this.unit===_.unit}},{key:"getType",value:function(){return vh.kUnitType}},{key:"convertTo",value:function(A){if(this.unit===A)return new S(this.value,this.unit);var _=Oo(this.unit);if(_!==Oo(A)||_===Ji.kUnknown)return null;var k=Uo(this.unit)/Uo(A);return new S(this.value*k,A)}},{key:"buildCSSText",value:function(A,_,k){var G;switch(this.unit){case Ji.kUnknown:break;case Ji.kInteger:G=Number(this.value).toFixed(0);break;case Ji.kNumber:case Ji.kPercentage:case Ji.kEms:case Ji.kRems:case Ji.kPixels:case Ji.kDegrees:case Ji.kRadians:case Ji.kGradians:case Ji.kMilliseconds:case Ji.kSeconds:case Ji.kTurns:{var ae=-999999,ge=999999,Ue=this.value,rt=Ld(this.unit);if(Ue<ae||Ue>ge){var bt=Ld(this.unit);!Number.isFinite(Ue)||Number.isNaN(Ue)?G=mu(Ue,bt):G=Ue+(bt||"")}else G="".concat(Ue).concat(rt)}}return k+=G,k}}])}(Yc),_o=new Bo(0,"px");new Bo(1,"px");var na=new Bo(0,"deg"),Wa=function(x){function S(f,A,_){var k,G=arguments.length>3&&arguments[3]!==void 0?arguments[3]:1,ae=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!1;return(0,Z.Z)(this,S),k=(0,E.Z)(this,S,["rgb"]),k.r=f,k.g=A,k.b=_,k.alpha=G,k.isNone=ae,k}return(0,F.Z)(S,x),(0,V.Z)(S,[{key:"clone",value:function(){return new S(this.r,this.g,this.b,this.alpha)}},{key:"buildCSSText",value:function(A,_,k){return"".concat(k,"rgba(").concat(this.r,",").concat(this.g,",").concat(this.b,",").concat(this.alpha,")")}}])}(gl),yh=new Xu("unset"),Yo=new Xu("initial"),Tu=new Xu("inherit"),uu={"":yh,unset:yh,initial:Yo,inherit:Tu},wc=function(S){return uu[S]||(uu[S]=new Xu(S)),uu[S]},ac=new Wa(0,0,0,0,!0),Lr=new Wa(0,0,0,0),Gr=Lo(function(x,S,f,A){return new Wa(x,S,f,A)},function(x,S,f,A){return"rgba(".concat(x,",").concat(S,",").concat(f,",").concat(A,")")}),ki=function(S){var f=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Ji.kNumber;return new Bo(S,f)};new Bo(50,"%");function ju(x){var S=x.type,f=x.value;return S==="hex"?"#".concat(f):S==="literal"?f:S==="rgb"?"rgb(".concat(f.join(","),")"):"rgba(".concat(f.join(","),")")}var bl=function(){var x={linearGradient:/^(linear\-gradient)/i,repeatingLinearGradient:/^(repeating\-linear\-gradient)/i,radialGradient:/^(radial\-gradient)/i,repeatingRadialGradient:/^(repeating\-radial\-gradient)/i,conicGradient:/^(conic\-gradient)/i,sideOrCorner:/^to (left (top|bottom)|right (top|bottom)|top (left|right)|bottom (left|right)|left|right|top|bottom)/i,extentKeywords:/^(closest\-side|closest\-corner|farthest\-side|farthest\-corner|contain|cover)/,positionKeywords:/^(left|center|right|top|bottom)/i,pixelValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))px/,percentageValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))\%/,emValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))em/,angleValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))deg/,startCall:/^\(/,endCall:/^\)/,comma:/^,/,hexColor:/^\#([0-9a-fA-F]+)/,literalColor:/^([a-zA-Z]+)/,rgbColor:/^rgb/i,rgbaColor:/^rgba/i,number:/^(([0-9]*\.[0-9]+)|([0-9]+\.?))/},S="";function f(Ys){throw new Error("".concat(S,": ").concat(Ys))}function A(){var Ys=_();return S.length>0&&f("Invalid input not EOF"),Ys}function _(){return Tr(k)}function k(){return G("linear-gradient",x.linearGradient,ge)||G("repeating-linear-gradient",x.repeatingLinearGradient,ge)||G("radial-gradient",x.radialGradient,bt)||G("repeating-radial-gradient",x.repeatingRadialGradient,bt)||G("conic-gradient",x.conicGradient,bt)}function G(Ys,U,R){return ae(U,function($){var K=R();return K&&(Ml(x.comma)||f("Missing comma before color stops")),{type:Ys,orientation:K,colorStops:Tr(ni)}})}function ae(Ys,U){var R=Ml(Ys);if(R){Ml(x.startCall)||f("Missing (");var $=U(R);return Ml(x.endCall)||f("Missing )"),$}}function ge(){return Ue()||rt()}function Ue(){return Po("directional",x.sideOrCorner,1)}function rt(){return Po("angular",x.angleValue,1)}function bt(){var Ys,U=Zt(),R;return U&&(Ys=[],Ys.push(U),R=S,Ml(x.comma)&&(U=Zt(),U?Ys.push(U):S=R)),Ys}function Zt(){var Ys=wn()||mn();if(Ys)Ys.at=ir();else{var U=Gn();if(U){Ys=U;var R=ir();R&&(Ys.at=R)}else{var $=tr();$&&(Ys={type:"default-radial",at:$})}}return Ys}function wn(){var Ys=Po("shape",/^(circle)/i,0);return Ys&&(Ys.style=Ia()||Gn()),Ys}function mn(){var Ys=Po("shape",/^(ellipse)/i,0);return Ys&&(Ys.style=Hs()||Gn()),Ys}function Gn(){return Po("extent-keyword",x.extentKeywords,1)}function ir(){if(Po("position",/^at/,0)){var Ys=tr();return Ys||f("Missing positioning value"),Ys}}function tr(){var Ys=Zn();if(Ys.x||Ys.y)return{type:"position",value:Ys}}function Zn(){return{x:Hs(),y:Hs()}}function Tr(Ys){var U=Ys(),R=[];if(U)for(R.push(U);Ml(x.comma);)U=Ys(),U?R.push(U):f("One extra comma");return R}function ni(){var Ys=ns();return Ys||f("Expected color definition"),Ys.length=Hs(),Ys}function ns(){return bi()||Gs()||Ri()||is()}function is(){return Po("literal",x.literalColor,0)}function bi(){return Po("hex",x.hexColor,1)}function Ri(){return ae(x.rgbColor,function(){return{type:"rgb",value:Tr(_s)}})}function Gs(){return ae(x.rgbaColor,function(){return{type:"rgba",value:Tr(_s)}})}function _s(){return Ml(x.number)[1]}function Hs(){return Po("%",x.percentageValue,1)||Zs()||Ia()}function Zs(){return Po("position-keyword",x.positionKeywords,1)}function Ia(){return Po("px",x.pixelValue,1)||Po("em",x.emValue,1)}function Po(Ys,U,R){var $=Ml(U);if($)return{type:Ys,value:$[R]}}function Ml(Ys){var U=/^[\n\r\t\s]+/.exec(S);U&&El(U[0].length);var R=Ys.exec(S);return R&&El(R[0].length),R}function El(Ys){S=S.substring(Ys)}return function(Ys){return S=Ys,A()}}();function qo(x,S,f,A){var _=Yt(A.value),k=0,G=0,ae=k+S/2,ge=G+f/2,Ue=Math.abs(S*Math.cos(_))+Math.abs(f*Math.sin(_)),rt=x[0]+ae-Math.cos(_)*Ue/2,bt=x[1]+ge-Math.sin(_)*Ue/2,Zt=x[0]+ae+Math.cos(_)*Ue/2,wn=x[1]+ge+Math.sin(_)*Ue/2;return{x1:rt,y1:bt,x2:Zt,y2:wn}}function Go(x,S,f,A,_,k){var G=A.value,ae=_.value;A.unit===Ji.kPercentage&&(G=A.value/100*S),_.unit===Ji.kPercentage&&(ae=_.value/100*f);var ge=Math.max((0,Ee.y)([0,0],[G,ae]),(0,Ee.y)([0,f],[G,ae]),(0,Ee.y)([S,f],[G,ae]),(0,Ee.y)([S,0],[G,ae]));return k&&(k instanceof Bo?ge=k.value:k instanceof Xu&&(k.value==="closest-side"?ge=Math.min(G,S-G,ae,f-ae):k.value==="farthest-side"?ge=Math.max(G,S-G,ae,f-ae):k.value==="closest-corner"&&(ge=Math.min((0,Ee.y)([0,0],[G,ae]),(0,Ee.y)([0,f],[G,ae]),(0,Ee.y)([S,f],[G,ae]),(0,Ee.y)([S,0],[G,ae]))))),{x:G+x[0],y:ae+x[1],r:ge}}var Ou=/^l\s*\(\s*([\d.]+)\s*\)\s*(.*)/i,Oh=/^r\s*\(\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)\s*\)\s*(.*)/i,oc=/^p\s*\(\s*([axyn])\s*\)\s*(.*)/i,Ca=/[\d.]+:(#[^\s]+|[^\)]+\))/gi;function Ud(x){var S,f=x.length;if(x[f-1].length=(S=x[f-1].length)!==null&&S!==void 0?S:{type:"%",value:"100"},f>1){var A;x[0].length=(A=x[0].length)!==null&&A!==void 0?A:{type:"%",value:"0"}}for(var _=0,k=Number(x[0].length.value),G=1;G<f;G++){var ae,ge=(ae=x[G].length)===null||ae===void 0?void 0:ae.value;if(!(0,$e.Z)(ge)&&!(0,$e.Z)(k)){for(var Ue=1;Ue<G-_;Ue++)x[_+Ue].length={type:"%",value:"".concat(k+(Number(ge)-k)*Ue/(G-_))};_=G,k=Number(ge)}}}var rp={left:180,top:-90,bottom:90,right:0,"left top":225,"top left":225,"left bottom":135,"bottom left":135,"right top":-45,"top right":-45,"right bottom":45,"bottom right":45},Xh=Lo(function(x){var S;return x.type==="angular"?S=Number(x.value):S=rp[x.value]||0,ki(S,"deg")}),lc=Lo(function(x){var S=50,f=50,A="%",_="%";if((x==null?void 0:x.type)==="position"){var k=x.value,G=k.x,ae=k.y;(G==null?void 0:G.type)==="position-keyword"&&(G.value==="left"?S=0:G.value==="center"?S=50:G.value==="right"?S=100:G.value==="top"?f=0:G.value==="bottom"&&(f=100)),(ae==null?void 0:ae.type)==="position-keyword"&&(ae.value==="left"?S=0:ae.value==="center"?f=50:ae.value==="right"?S=100:ae.value==="top"?f=0:ae.value==="bottom"&&(f=100)),((G==null?void 0:G.type)==="px"||(G==null?void 0:G.type)==="%"||(G==null?void 0:G.type)==="em")&&(A=G==null?void 0:G.type,S=Number(G.value)),((ae==null?void 0:ae.type)==="px"||(ae==null?void 0:ae.type)==="%"||(ae==null?void 0:ae.type)==="em")&&(_=ae==null?void 0:ae.type,f=Number(ae.value))}return{cx:ki(S,A),cy:ki(f,_)}}),wA=Lo(function(x){if(x.indexOf("linear")>-1||x.indexOf("radial")>-1){var S=bl(x);return S.map(function(ae){var ge=ae.type,Ue=ae.orientation,rt=ae.colorStops;Ud(rt);var bt=rt.map(function(Tr){return{offset:ki(Number(Tr.length.value),"%"),color:ju(Tr)}});if(ge==="linear-gradient")return new ml(To.LinearGradient,{angle:Ue?Xh(Ue):na,steps:bt});if(ge==="radial-gradient"&&(Ue||(Ue=[{type:"shape",value:"circle"}]),Ue[0].type==="shape"&&Ue[0].value==="circle")){var Zt=lc(Ue[0].at),wn=Zt.cx,mn=Zt.cy,Gn;if(Ue[0].style){var ir=Ue[0].style,tr=ir.type,Zn=ir.value;tr==="extent-keyword"?Gn=wc(Zn):Gn=ki(Zn,tr)}return new ml(To.RadialGradient,{cx:wn,cy:mn,size:Gn,steps:bt})}})}var f=x[0];if(x[1]==="("||x[2]==="("){if(f==="l"){var A=Ou.exec(x);if(A){var _,k=((_=A[2].match(Ca))===null||_===void 0?void 0:_.map(function(ae){return ae.split(":")}))||[];return[new ml(To.LinearGradient,{angle:ki(parseFloat(A[1]),"deg"),steps:k.map(function(ae){var ge=(0,C.Z)(ae,2),Ue=ge[0],rt=ge[1];return{offset:ki(Number(Ue)*100,"%"),color:rt}})})]}}else if(f==="r"){var G=Od(x);if(G)if((0,Fe.Z)(G))x=G;else return[new ml(To.RadialGradient,G)]}else if(f==="p")return jh(x)}});function Od(x){var S=Oh.exec(x);if(S){var f,A=((f=S[4].match(Ca))===null||f===void 0?void 0:f.map(function(_){return _.split(":")}))||[];return{cx:ki(50,"%"),cy:ki(50,"%"),steps:A.map(function(_){var k=(0,C.Z)(_,2),G=k[0],ae=k[1];return{offset:ki(Number(G)*100,"%"),color:ae}})}}return null}function jh(x){var S=oc.exec(x);if(S){var f=S[1],A=S[2];switch(f){case"a":f="repeat";break;case"x":f="repeat-x";break;case"y":f="repeat-y";break;case"n":f="no-repeat";break;default:f="no-repeat"}return{image:A,repetition:f}}return null}function SA(x){return!!x.type&&!!x.value}function md(x){return x&&!!x.image}function vd(x){return x&&!(0,$e.Z)(x.r)&&!(0,$e.Z)(x.g)&&!(0,$e.Z)(x.b)}var mo=Lo(function(x){if(md(x))return(0,m.Z)({repetition:"repeat"},x);if((0,$e.Z)(x)&&(x=""),x==="transparent")return Lr;if(x==="currentColor")x="black";else if(x==="none")return ac;var S=wA(x);if(S)return S;var f=sc(x),A=[0,0,0,0];return f!==null&&(A[0]=f.r||0,A[1]=f.g||0,A[2]=f.b||0,A[3]=f.opacity),Gr.apply(void 0,A)});function wa(x,S){if(!(!vd(x)||!vd(S)))return[[Number(x.r),Number(x.g),Number(x.b),Number(x.alpha)],[Number(S.r),Number(S.g),Number(S.b),Number(S.alpha)],function(f){var A=f.slice();if(A[3])for(var _=0;_<3;_++)A[_]=Math.round((0,ct.Z)(A[_],0,255));return A[3]=(0,ct.Z)(A[3],0,1),"rgba(".concat(A.join(","),")")}]}function Dd(x,S){if((0,$e.Z)(S))return ki(0,"px");if(S="".concat(S).trim().toLowerCase(),isFinite(Number(S))){if("px".search(x)>=0)return ki(Number(S),"px");if("deg".search(x)>=0)return ki(Number(S),"deg")}var f=[];S=S.replace(x,function(_){return f.push(_),"U".concat(_)});var A="U(".concat(x.source,")");return f.map(function(_){return ki(Number(S.replace(new RegExp("U".concat(_),"g"),"").replace(new RegExp(A,"g"),"*0")),_)})[0]}var qi=function(S){return Dd(new RegExp("px","g"),S)},Du=Lo(qi),kn=function(S){return Dd(new RegExp("%","g"),S)};Lo(kn);var kd=function(S){return(0,ve.Z)(S)||isFinite(Number(S))?ki(Number(S)||0,"px"):Dd(new RegExp("px|%|em|rem","g"),S)},Yh=Lo(kd),vl=function(S){return Dd(new RegExp("deg|rad|grad|turn","g"),S)},He=Lo(vl);function me(x,S,f,A){var _=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0,k="",G=x.value||0,ae=S.value||0,ge=Oo(x.unit),Ue=x.convertTo(ge),rt=S.convertTo(ge);return Ue&&rt?(G=Ue.value,ae=rt.value,k=Ld(x.unit)):(Bo.isLength(x.unit)||Bo.isLength(S.unit))&&(G=le(x,_,f),ae=le(S,_,f),k="px"),[G,ae,function(bt){return A&&(bt=Math.max(bt,0)),bt+k}]}function ce(x){var S=0;return x.unit===Ji.kDegrees?S=x.value:x.unit===Ji.kRadians?S=er(Number(x.value)):x.unit===Ji.kTurns?S=wr(Number(x.value)):x.value&&(S=x.value),S}function Ze(x,S){var f;return Array.isArray(x)?f=x.map(function(A){return Number(A)}):(0,Fe.Z)(x)?f=x.split(" ").map(function(A){return Number(A)}):(0,ve.Z)(x)&&(f=[x]),S===2?f.length===1?[f[0],f[0]]:[f[0],f[1]]:S===4?f.length===1?[f[0],f[0],f[0],f[0]]:f.length===2?[f[0],f[1],f[0],f[1]]:f.length===3?[f[0],f[1],f[2],f[1]]:[f[0],f[1],f[2],f[3]]:S==="even"&&f.length%2===1?[].concat((0,N.Z)(f),(0,N.Z)(f)):f}function le(x,S,f){var A=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(x.unit===Ji.kPixels)return Number(x.value);if(x.unit===Ji.kPercentage&&f){var _=f.nodeName===Jt.GROUP?f.getLocalBounds():f.getGeometryBounds();return(A?_.min[S]:0)+x.value/100*_.halfExtents[S]*2}return 0}var Nt=function(S){return Dd(/deg|rad|grad|turn|px|%/g,S)},Dt=["blur","brightness","drop-shadow","contrast","grayscale","sepia","saturate","hue-rotate","invert"];function pn(){var x=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"";if(x=x.toLowerCase().trim(),x==="none")return[];for(var S=/\s*([\w-]+)\(([^)]*)\)/g,f=[],A,_=0;A=S.exec(x);){if(A.index!==_)return[];if(_=A.index+A[0].length,Dt.indexOf(A[1])>-1&&f.push({name:A[1],params:A[2].split(" ").map(function(k){return Nt(k)||mo(k)})}),S.lastIndex===x.length)return f}return[]}function Dn(x){return x.toString()}var hr=function(S){return typeof S=="number"?ki(S):/^\s*[-+]?(\d*\.)?\d+\s*$/.test(S)?ki(Number(S)):ki(0)},br=Lo(hr);Lo(function(x){return(0,Fe.Z)(x)?x.split(" ").map(br):x.map(br)});function yr(x,S){return[x,S,Dn]}function xr(x,S){return function(f,A){return[f,A,function(_){return Dn((0,ct.Z)(_,x,S))}]}}function Fr(x,S){if(x.length===S.length)return[x,S,function(f){return f}]}function ri(x){return x.parsedStyle.d.totalLength===0&&(x.parsedStyle.d.totalLength=Ct(x.parsedStyle.d.absolutePath)),x.parsedStyle.d.totalLength}function ai(x){return x.parsedStyle.points.totalLength===0&&(x.parsedStyle.points.totalLength=(0,Xt.hE)(x.parsedStyle.points.points)),x.parsedStyle.points.totalLength}function wi(x){for(var S=0;S<x.length;S++){var f=x[S-1],A=x[S],_=A[0];if(_==="M"&&f){var k=f[0],G=[A[1],A[2]],ae=void 0;k==="L"||k==="M"?ae=[f[1],f[2]]:(k==="C"||k==="A"||k==="Q")&&(ae=[f[f.length-2],f[f.length-1]]),ae&&as(G,ae)&&(x.splice(S,1),S--)}}}function Vi(x){for(var S=!1,f=x.length,A=0;A<f;A++){var _=x[A],k=_[0];if(k==="C"||k==="A"||k==="Q"){S=!0;break}}return S}function rs(x){for(var S=[],f=[],A=[],_=0;_<x.length;_++){var k=x[_],G=k[0];G==="M"?(A.length&&(f.push(A),A=[]),A.push([k[1],k[2]])):G==="Z"?A.length&&(S.push(A),A=[]):A.push([k[1],k[2]])}return A.length>0&&f.push(A),{polygons:S,polylines:f}}function as(x,S){return x[0]===S[0]&&x[1]===S[1]}function Bs(x,S){for(var f=[],A=[],_=[],k=0;k<x.length;k++){var G=x[k],ae=G.currentPoint,ge=G.params,Ue=G.prePoint,rt=void 0;switch(G.command){case"Q":rt=(0,Xt.x4)(Ue[0],Ue[1],ge[1],ge[2],ge[3],ge[4]);break;case"C":rt=(0,Xt.l5)(Ue[0],Ue[1],ge[1],ge[2],ge[3],ge[4],ge[5],ge[6]);break;case"A":var bt=G.arcParams;rt=(0,Xt.vp)(bt.cx,bt.cy,bt.rx,bt.ry,bt.xRotation,bt.startAngle,bt.endAngle);break;default:f.push(ae[0]),A.push(ae[1]);break}rt&&(G.box=rt,f.push(rt.x,rt.x+rt.width),A.push(rt.y,rt.y+rt.height)),S&&(G.command==="L"||G.command==="M")&&G.prePoint&&G.nextPoint&&_.push(G)}f=f.filter(function(ni){return!Number.isNaN(ni)&&ni!==1/0&&ni!==-1/0}),A=A.filter(function(ni){return!Number.isNaN(ni)&&ni!==1/0&&ni!==-1/0});var Zt=(0,sn.Z)(f),wn=(0,sn.Z)(A),mn=(0,W.Z)(f),Gn=(0,W.Z)(A);if(_.length===0)return{x:Zt,y:wn,width:mn-Zt,height:Gn-wn};for(var ir=0;ir<_.length;ir++){var tr=_[ir],Zn=tr.currentPoint,Tr=void 0;Zn[0]===Zt?(Tr=Ls(tr,S),Zt-=Tr.xExtra):Zn[0]===mn&&(Tr=Ls(tr,S),mn+=Tr.xExtra),Zn[1]===wn?(Tr=Ls(tr,S),wn-=Tr.yExtra):Zn[1]===Gn&&(Tr=Ls(tr,S),Gn+=Tr.yExtra)}return{x:Zt,y:wn,width:mn-Zt,height:Gn-wn}}function Ls(x,S){var f=x.prePoint,A=x.currentPoint,_=x.nextPoint,k=Math.pow(A[0]-f[0],2)+Math.pow(A[1]-f[1],2),G=Math.pow(A[0]-_[0],2)+Math.pow(A[1]-_[1],2),ae=Math.pow(f[0]-_[0],2)+Math.pow(f[1]-_[1],2),ge=Math.acos((k+G-ae)/(2*Math.sqrt(k)*Math.sqrt(G)));if(!ge||Math.sin(ge)===0||(0,Se.Z)(ge,0))return{xExtra:0,yExtra:0};var Ue=Math.abs(Math.atan2(_[1]-A[1],_[0]-A[0])),rt=Math.abs(Math.atan2(_[0]-A[0],_[1]-A[1]));Ue=Ue>Math.PI/2?Math.PI-Ue:Ue,rt=rt>Math.PI/2?Math.PI-rt:rt;var bt={xExtra:Math.cos(ge/2-Ue)*(S/2*(1/Math.sin(ge/2)))-S/2||0,yExtra:Math.cos(rt-ge/2)*(S/2*(1/Math.sin(ge/2)))-S/2||0};return bt}function zi(x,S){return[S[0]+(S[0]-x[0]),S[1]+(S[1]-x[1])]}var Ni=function(S,f){var A=S.x*f.x+S.y*f.y,_=Math.sqrt((Math.pow(S.x,2)+Math.pow(S.y,2))*(Math.pow(f.x,2)+Math.pow(f.y,2))),k=S.x*f.y-S.y*f.x<0?-1:1,G=k*Math.acos(A/_);return G},Ns=function(S,f,A,_,k,G,ae,ge){f=Math.abs(f),A=Math.abs(A),_=zt(_,360);var Ue=Yt(_);if(S.x===ae.x&&S.y===ae.y)return{x:S.x,y:S.y,ellipticalArcAngle:0};if(f===0||A===0)return{x:0,y:0,ellipticalArcAngle:0};var rt=(S.x-ae.x)/2,bt=(S.y-ae.y)/2,Zt={x:Math.cos(Ue)*rt+Math.sin(Ue)*bt,y:-Math.sin(Ue)*rt+Math.cos(Ue)*bt},wn=Math.pow(Zt.x,2)/Math.pow(f,2)+Math.pow(Zt.y,2)/Math.pow(A,2);wn>1&&(f*=Math.sqrt(wn),A*=Math.sqrt(wn));var mn=Math.pow(f,2)*Math.pow(A,2)-Math.pow(f,2)*Math.pow(Zt.y,2)-Math.pow(A,2)*Math.pow(Zt.x,2),Gn=Math.pow(f,2)*Math.pow(Zt.y,2)+Math.pow(A,2)*Math.pow(Zt.x,2),ir=mn/Gn;ir=ir<0?0:ir;var tr=(k!==G?1:-1)*Math.sqrt(ir),Zn={x:tr*(f*Zt.y/A),y:tr*(-(A*Zt.x)/f)},Tr={x:Math.cos(Ue)*Zn.x-Math.sin(Ue)*Zn.y+(S.x+ae.x)/2,y:Math.sin(Ue)*Zn.x+Math.cos(Ue)*Zn.y+(S.y+ae.y)/2},ni={x:(Zt.x-Zn.x)/f,y:(Zt.y-Zn.y)/A},ns=Ni({x:1,y:0},ni),is={x:(-Zt.x-Zn.x)/f,y:(-Zt.y-Zn.y)/A},bi=Ni(ni,is);!G&&bi>0?bi-=2*Math.PI:G&&bi<0&&(bi+=2*Math.PI),bi%=2*Math.PI;var Ri=ns+bi*ge,Gs=f*Math.cos(Ri),_s=A*Math.sin(Ri),Hs={x:Math.cos(Ue)*Gs-Math.sin(Ue)*_s+Tr.x,y:Math.sin(Ue)*Gs+Math.cos(Ue)*_s+Tr.y,ellipticalArcStartAngle:ns,ellipticalArcEndAngle:ns+bi,ellipticalArcAngle:Ri,ellipticalArcCenter:Tr,resultantRx:f,resultantRy:A};return Hs};function Os(x){for(var S=[],f=null,A=null,_=null,k=0,G=x.length,ae=0;ae<G;ae++){var ge=x[ae];A=x[ae+1];var Ue=ge[0],rt={command:Ue,prePoint:f,params:ge,startTangent:null,endTangent:null,currentPoint:null,nextPoint:null,arcParams:null,box:null,cubicParams:null};switch(Ue){case"M":_=[ge[1],ge[2]],k=ae;break;case"A":var bt=Y(f,ge);rt.arcParams=bt;break}if(Ue==="Z")f=_,A=x[k+1];else{var Zt=ge.length;f=[ge[Zt-2],ge[Zt-1]]}A&&A[0]==="Z"&&(A=x[k],S[k]&&(S[k].prePoint=f)),rt.currentPoint=f,S[k]&&as(f,S[k].currentPoint)&&(S[k].prePoint=rt.prePoint);var wn=A?[A[A.length-2],A[A.length-1]]:null;rt.nextPoint=wn;var mn=rt.prePoint;if(["L","H","V"].includes(Ue))rt.startTangent=[mn[0]-f[0],mn[1]-f[1]],rt.endTangent=[f[0]-mn[0],f[1]-mn[1]];else if(Ue==="Q"){var Gn=[ge[1],ge[2]];rt.startTangent=[mn[0]-Gn[0],mn[1]-Gn[1]],rt.endTangent=[f[0]-Gn[0],f[1]-Gn[1]]}else if(Ue==="T"){var ir=S[ae-1],tr=zi(ir.currentPoint,mn);ir.command==="Q"?(rt.command="Q",rt.startTangent=[mn[0]-tr[0],mn[1]-tr[1]],rt.endTangent=[f[0]-tr[0],f[1]-tr[1]]):(rt.command="TL",rt.startTangent=[mn[0]-f[0],mn[1]-f[1]],rt.endTangent=[f[0]-mn[0],f[1]-mn[1]])}else if(Ue==="C"){var Zn=[ge[1],ge[2]],Tr=[ge[3],ge[4]];rt.startTangent=[mn[0]-Zn[0],mn[1]-Zn[1]],rt.endTangent=[f[0]-Tr[0],f[1]-Tr[1]],rt.startTangent[0]===0&&rt.startTangent[1]===0&&(rt.startTangent=[Zn[0]-Tr[0],Zn[1]-Tr[1]]),rt.endTangent[0]===0&&rt.endTangent[1]===0&&(rt.endTangent=[Tr[0]-Zn[0],Tr[1]-Zn[1]])}else if(Ue==="S"){var ni=S[ae-1],ns=zi(ni.currentPoint,mn),is=[ge[1],ge[2]];ni.command==="C"?(rt.command="C",rt.startTangent=[mn[0]-ns[0],mn[1]-ns[1]],rt.endTangent=[f[0]-is[0],f[1]-is[1]]):(rt.command="SQ",rt.startTangent=[mn[0]-is[0],mn[1]-is[1]],rt.endTangent=[f[0]-is[0],f[1]-is[1]])}else if(Ue==="A"){var bi=_a(rt,0),Ri=bi.x,Gs=bi.y,_s=_a(rt,1,!1),Hs=_s.x,Zs=_s.y;rt.startTangent=[Ri,Gs],rt.endTangent=[Hs,Zs]}S.push(rt)}return S}function _a(x,S){var f=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,A=x.arcParams,_=A.rx,k=_===void 0?0:_,G=A.ry,ae=G===void 0?0:G,ge=A.xRotation,Ue=A.arcFlag,rt=A.sweepFlag,bt=Ns({x:x.prePoint[0],y:x.prePoint[1]},k,ae,ge,!!Ue,!!rt,{x:x.currentPoint[0],y:x.currentPoint[1]},S),Zt=Ns({x:x.prePoint[0],y:x.prePoint[1]},k,ae,ge,!!Ue,!!rt,{x:x.currentPoint[0],y:x.currentPoint[1]},f?S+.005:S-.005),wn=Zt.x-bt.x,mn=Zt.y-bt.y,Gn=Math.sqrt(wn*wn+mn*mn);return{x:-wn/Gn,y:-mn/Gn}}function Sa(x){return Math.sqrt(x[0]*x[0]+x[1]*x[1])}function oe(x,S){return Sa(x)*Sa(S)?(x[0]*S[0]+x[1]*S[1])/(Sa(x)*Sa(S)):1}function re(x,S){return(x[0]*S[1]<x[1]*S[0]?-1:1)*Math.acos(oe(x,S))}function Y(x,S){var f=S[1],A=S[2],_=zt(Yt(S[3]),Math.PI*2),k=S[4],G=S[5],ae=x[0],ge=x[1],Ue=S[6],rt=S[7],bt=Math.cos(_)*(ae-Ue)/2+Math.sin(_)*(ge-rt)/2,Zt=-1*Math.sin(_)*(ae-Ue)/2+Math.cos(_)*(ge-rt)/2,wn=bt*bt/(f*f)+Zt*Zt/(A*A);wn>1&&(f*=Math.sqrt(wn),A*=Math.sqrt(wn));var mn=f*f*(Zt*Zt)+A*A*(bt*bt),Gn=mn?Math.sqrt((f*f*(A*A)-mn)/mn):1;k===G&&(Gn*=-1),isNaN(Gn)&&(Gn=0);var ir=A?Gn*f*Zt/A:0,tr=f?Gn*-A*bt/f:0,Zn=(ae+Ue)/2+Math.cos(_)*ir-Math.sin(_)*tr,Tr=(ge+rt)/2+Math.sin(_)*ir+Math.cos(_)*tr,ni=[(bt-ir)/f,(Zt-tr)/A],ns=[(-1*bt-ir)/f,(-1*Zt-tr)/A],is=re([1,0],ni),bi=re(ni,ns);return oe(ni,ns)<=-1&&(bi=Math.PI),oe(ni,ns)>=1&&(bi=0),G===0&&bi>0&&(bi-=2*Math.PI),G===1&&bi<0&&(bi+=2*Math.PI),{cx:Zn,cy:Tr,rx:as(x,[Ue,rt])?0:f,ry:as(x,[Ue,rt])?0:A,startAngle:is,endAngle:is+bi,xRotation:_,arcFlag:k,sweepFlag:G}}function J(x,S,f){return x.reduce(function(A,_){var k="";if(_[0]==="M"||_[0]==="L"){var G=vec3.fromValues(_[1],_[2],0);f&&vec3.transformMat4(G,G,f),k="".concat(_[0]).concat(G[0],",").concat(G[1])}else if(_[0]==="Z")k=_[0];else if(_[0]==="C"){var ae=vec3.fromValues(_[1],_[2],0),ge=vec3.fromValues(_[3],_[4],0),Ue=vec3.fromValues(_[5],_[6],0);f&&(vec3.transformMat4(ae,ae,f),vec3.transformMat4(ge,ge,f),vec3.transformMat4(Ue,Ue,f)),k="".concat(_[0]).concat(ae[0],",").concat(ae[1],",").concat(ge[0],",").concat(ge[1],",").concat(Ue[0],",").concat(Ue[1])}else if(_[0]==="A"){var rt=vec3.fromValues(_[6],_[7],0);f&&vec3.transformMat4(rt,rt,f),k="".concat(_[0]).concat(_[1],",").concat(_[2],",").concat(_[3],",").concat(_[4],",").concat(_[5],",").concat(rt[0],",").concat(rt[1])}else if(_[0]==="Q"){var bt=vec3.fromValues(_[1],_[2],0),Zt=vec3.fromValues(_[3],_[4],0);f&&(vec3.transformMat4(bt,bt,f),vec3.transformMat4(Zt,Zt,f)),k="".concat(_[0]).concat(_[1],",").concat(_[2],",").concat(_[3],",").concat(_[4],"}")}return A+=k},"")}function fe(x,S,f,A){return[["M",x,S],["L",f,A]]}function Te(x,S,f,A){var _=(-1+Math.sqrt(2))/3*4,k=x*_,G=S*_,ae=f-x,ge=f+x,Ue=A-S,rt=A+S;return[["M",ae,A],["C",ae,A-G,f-k,Ue,f,Ue],["C",f+k,Ue,ge,A-G,ge,A],["C",ge,A+G,f+k,rt,f,rt],["C",f-k,rt,ae,A+G,ae,A],["Z"]]}function De(x,S){var f=x.map(function(A,_){return[_===0?"M":"L",A[0],A[1]]});return S&&f.push(["Z"]),f}function Le(x,S,f,A,_){if(_){var k=_slicedToArray(_,4),G=k[0],ae=k[1],ge=k[2],Ue=k[3],rt=x>0?1:-1,bt=S>0?1:-1,Zt=rt+bt!==0?1:0;return[["M",rt*G+f,A],["L",x-rt*ae+f,A],ae?["A",ae,ae,0,0,Zt,x+f,bt*ae+A]:null,["L",x+f,S-bt*ge+A],ge?["A",ge,ge,0,0,Zt,x+f-rt*ge,S+A]:null,["L",f+rt*Ue,S+A],Ue?["A",Ue,Ue,0,0,Zt,f,S+A-bt*Ue]:null,["L",f,bt*G+A],G?["A",G,G,0,0,Zt,rt*G+f,A]:null,["Z"]].filter(function(wn){return wn})}return[["M",f,A],["L",f+x,A],["L",f+x,A+S],["L",f,A+S],["Z"]]}function Xe(x){var S=arguments.length>1&&arguments[1]!==void 0?arguments[1]:x.getLocalTransform(),f=[];switch(x.nodeName){case Jt.LINE:var A=x.parsedStyle,_=A.x1,k=_===void 0?0:_,G=A.y1,ae=G===void 0?0:G,ge=A.x2,Ue=ge===void 0?0:ge,rt=A.y2,bt=rt===void 0?0:rt;f=fe(k,ae,Ue,bt);break;case Jt.CIRCLE:{var Zt=x.parsedStyle,wn=Zt.r,mn=wn===void 0?0:wn,Gn=Zt.cx,ir=Gn===void 0?0:Gn,tr=Zt.cy,Zn=tr===void 0?0:tr;f=Te(mn,mn,ir,Zn);break}case Jt.ELLIPSE:{var Tr=x.parsedStyle,ni=Tr.rx,ns=ni===void 0?0:ni,is=Tr.ry,bi=is===void 0?0:is,Ri=Tr.cx,Gs=Ri===void 0?0:Ri,_s=Tr.cy,Hs=_s===void 0?0:_s;f=Te(ns,bi,Gs,Hs);break}case Jt.POLYLINE:case Jt.POLYGON:var Zs=x.parsedStyle.points;f=De(Zs.points,x.nodeName===Jt.POLYGON);break;case Jt.RECT:var Ia=x.parsedStyle,Po=Ia.width,Ml=Po===void 0?0:Po,El=Ia.height,Ys=El===void 0?0:El,U=Ia.x,R=U===void 0?0:U,$=Ia.y,K=$===void 0?0:$,_e=Ia.radius,et=_e&&_e.some(function(dn){return dn!==0});f=Le(Ml,Ys,R,K,et&&_e.map(function(dn){return clamp(dn,0,Math.min(Math.abs(Ml)/2,Math.abs(Ys)/2))}));break;case Jt.PATH:var Ft=x.parsedStyle.d.absolutePath;f=_toConsumableArray(Ft);break}if(f.length)return J(f,x,S)}function mt(x){var S=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,f=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,A=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,_=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0,k=x.map(function(G,ae){var ge=G[0],Ue=x[ae+1],rt=ae===0&&(S!==0||f!==0),bt=(ae===x.length-1||Ue&&(Ue[0]==="M"||Ue[0]==="Z"))&&A!==0&&_!==0,Zt=rt?[S,f]:[0,0],wn=_slicedToArray(Zt,2),mn=wn[0],Gn=wn[1],ir=bt?[A,_]:[0,0],tr=_slicedToArray(ir,2),Zn=tr[0],Tr=tr[1];switch(ge){case"M":return"M ".concat(G[1]+mn,",").concat(G[2]+Gn);case"L":return"L ".concat(G[1]+Zn,",").concat(G[2]+Tr);case"Q":return"Q ".concat(G[1]," ").concat(G[2],",").concat(G[3]+Zn," ").concat(G[4]+Tr);case"C":return"C ".concat(G[1]," ").concat(G[2],",").concat(G[3]," ").concat(G[4],",").concat(G[5]+Zn," ").concat(G[6]+Tr);case"A":return"A ".concat(G[1]," ").concat(G[2]," ").concat(G[3]," ").concat(G[4]," ").concat(G[5]," ").concat(G[6]," ").concat(G[7]).concat(bt?" L ".concat(G[6]+A,",").concat(G[7]+_):"");case"Z":return"Z";default:return null}}).filter(function(G){return G!==null}).join(" ");return~k.indexOf("NaN")?"":k}var Kt=function(S){if(S===""||Array.isArray(S)&&S.length===0)return{absolutePath:[],hasArc:!1,segments:[],polygons:[],polylines:[],curve:null,totalLength:0,rect:{x:0,y:0,width:0,height:0}};var f;try{f=Mt(S)}catch(wn){f=Mt(""),console.error("[g]: Invalid SVG Path definition: ".concat(S))}wi(f);var A=Vi(f),_=rs(f),k=_.polygons,G=_.polylines,ae=Os(f),ge=Bs(ae,0),Ue=ge.x,rt=ge.y,bt=ge.width,Zt=ge.height;return{absolutePath:f,hasArc:A,segments:ae,polygons:k,polylines:G,totalLength:0,rect:{x:Number.isFinite(Ue)?Ue:0,y:Number.isFinite(rt)?rt:0,width:Number.isFinite(bt)?bt:0,height:Number.isFinite(Zt)?Zt:0}}},nn=Lo(Kt);function gn(x){return(0,Fe.Z)(x)?nn(x):Kt(x)}function Nn(x,S,f){var A=x.curve,_=S.curve;(!A||A.length===0)&&(A=wt(x.absolutePath,!1),x.curve=A),(!_||_.length===0)&&(_=wt(S.absolutePath,!1),S.curve=_);var k=[A,_];A.length!==_.length&&(k=$t(A,_));var G=cn(k[0])!==cn(k[1])?Yn(k[0]):qn(k[0]);return[G,Jr(k[1],G),function(ae){return ae}]}function $n(x,S){var f;return(0,Fe.Z)(x)?f=x.split(" ").map(function(A){var _=A.split(","),k=(0,C.Z)(_,2),G=k[0],ae=k[1];return[Number(G),Number(ae)]}):f=x,{points:f,totalLength:0,segments:[]}}function Er(x,S){return[x.points,S.points,function(f){return f}]}var mr=null,ti=/\s*(\w+)\(([^)]*)\)/g;function jr(x){return function(S){var f=0;return x.map(function(A){return A===mr?S[f++]:A})}}function ui(x){return x}var gi={matrix:["NNNNNN",[mr,mr,0,0,mr,mr,0,0,0,0,1,0,mr,mr,0,1],ui],matrix3d:["NNNNNNNNNNNNNNNN",ui],rotate:["A"],rotateX:["A"],rotateY:["A"],rotateZ:["A"],rotate3d:["NNNA"],perspective:["L"],scale:["Nn",jr([mr,mr,new Bo(1)]),ui],scaleX:["N",jr([mr,new Bo(1),new Bo(1)]),jr([mr,new Bo(1)])],scaleY:["N",jr([new Bo(1),mr,new Bo(1)]),jr([new Bo(1),mr])],scaleZ:["N",jr([new Bo(1),new Bo(1),mr])],scale3d:["NNN",ui],skew:["Aa",null,ui],skewX:["A",null,jr([mr,na])],skewY:["A",null,jr([na,mr])],translate:["Tt",jr([mr,mr,_o]),ui],translateX:["T",jr([mr,_o,_o]),jr([mr,_o])],translateY:["T",jr([_o,mr,_o]),jr([_o,mr])],translateZ:["L",jr([_o,_o,mr])],translate3d:["TTL",ui]};function oi(x){for(var S=[],f=x.length,A=0;A<f;A++){var _=x[A],k=_[0],G=_.slice(1);k==="translate"||k==="skew"?G.length===1&&G.push(0):k==="scale"&&G.length===1&&G.push(G[0]);var ae=gi[k];if(!ae)return[];var ge=G.map(function(Ue){return ki(Ue)});S.push({t:k,d:ge})}return S}function ts(x){if(Array.isArray(x))return oi(x);if(x=(x||"none").trim(),x==="none")return[];var S=[],f,A=0;for(ti.lastIndex=0;f=ti.exec(x);){if(f.index!==A)return[];A=f.index+f[0].length;var _=f[1],k=gi[_];if(!k)return[];var G=f[2].split(","),ae=k[0];if(ae.length<G.length)return[];for(var ge=[],Ue=0;Ue<ae.length;Ue++){var rt=G[Ue],bt=ae[Ue],Zt=void 0;if(rt?Zt={A:function(mn){return mn.trim()==="0"?na:He(mn)},N:br,T:Yh,L:Du}[bt.toUpperCase()](rt):Zt={a:na,n:ge[0],t:_o}[bt],Zt===void 0)return[];ge.push(Zt)}if(S.push({t:_,d:ge}),ti.lastIndex===x.length)return S}return[]}function fs(x){if(Array.isArray(x))return oi(x);if(x=(x||"none").trim(),x==="none")return[];var S=[],f,A=0;for(ti.lastIndex=0;f=ti.exec(x);){if(f.index!==A)return[];A=f.index+f[0].length;var _=f[1],k=gi[_];if(!k)return[];var G=f[2].split(","),ae=k[0];if(ae.length<G.length)return[];for(var ge=[],Ue=0;Ue<ae.length;Ue++){var rt=G[Ue],bt=ae[Ue],Zt=void 0;if(rt?Zt={A:function(mn){return mn.trim()==="0"?na:vl(mn)},N:hr,T:kd,L:qi}[bt.toUpperCase()](rt):Zt={a:na,n:ge[0],t:_o}[bt],Zt===void 0)return[];ge.push(Zt)}if(S.push({t:_,d:ge}),ti.lastIndex===x.length)return S}return[]}function Ds(x){var S,f,A,_;switch(x.t){case"rotateX":return _=Yt(ce(x.d[0])),[1,0,0,0,0,Math.cos(_),Math.sin(_),0,0,-Math.sin(_),Math.cos(_),0,0,0,0,1];case"rotateY":return _=Yt(ce(x.d[0])),[Math.cos(_),0,-Math.sin(_),0,0,1,0,0,Math.sin(_),0,Math.cos(_),0,0,0,0,1];case"rotate":case"rotateZ":return _=Yt(ce(x.d[0])),[Math.cos(_),Math.sin(_),0,0,-Math.sin(_),Math.cos(_),0,0,0,0,1,0,0,0,0,1];case"rotate3d":S=x.d[0].value,f=x.d[1].value,A=x.d[2].value,_=Yt(ce(x.d[3]));var k=S*S+f*f+A*A;if(k===0)S=1,f=0,A=0;else if(k!==1){var G=Math.sqrt(k);S/=G,f/=G,A/=G}var ae=Math.sin(_/2),ge=ae*Math.cos(_/2),Ue=ae*ae;return[1-2*(f*f+A*A)*Ue,2*(S*f*Ue+A*ge),2*(S*A*Ue-f*ge),0,2*(S*f*Ue-A*ge),1-2*(S*S+A*A)*Ue,2*(f*A*Ue+S*ge),0,2*(S*A*Ue+f*ge),2*(f*A*Ue-S*ge),1-2*(S*S+f*f)*Ue,0,0,0,0,1];case"scale":return[x.d[0].value,0,0,0,0,x.d[1].value,0,0,0,0,1,0,0,0,0,1];case"scaleX":return[x.d[0].value,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];case"scaleY":return[1,0,0,0,0,x.d[0].value,0,0,0,0,1,0,0,0,0,1];case"scaleZ":return[1,0,0,0,0,1,0,0,0,0,x.d[0].value,0,0,0,0,1];case"scale3d":return[x.d[0].value,0,0,0,0,x.d[1].value,0,0,0,0,x.d[2].value,0,0,0,0,1];case"skew":var rt=Yt(ce(x.d[0])),bt=Yt(ce(x.d[1]));return[1,Math.tan(bt),0,0,Math.tan(rt),1,0,0,0,0,1,0,0,0,0,1];case"skewX":return _=Yt(ce(x.d[0])),[1,0,0,0,Math.tan(_),1,0,0,0,0,1,0,0,0,0,1];case"skewY":return _=Yt(ce(x.d[0])),[1,Math.tan(_),0,0,0,1,0,0,0,0,1,0,0,0,0,1];case"translate":return S=le(x.d[0],0,null)||0,f=le(x.d[1],0,null)||0,[1,0,0,0,0,1,0,0,0,0,1,0,S,f,0,1];case"translateX":return S=le(x.d[0],0,null)||0,[1,0,0,0,0,1,0,0,0,0,1,0,S,0,0,1];case"translateY":return f=le(x.d[0],0,null)||0,[1,0,0,0,0,1,0,0,0,0,1,0,0,f,0,1];case"translateZ":return A=le(x.d[0],0,null)||0,[1,0,0,0,0,1,0,0,0,0,1,0,0,0,A,1];case"translate3d":return S=le(x.d[0],0,null)||0,f=le(x.d[1],0,null)||0,A=le(x.d[2],0,null)||0,[1,0,0,0,0,1,0,0,0,0,1,0,S,f,A,1];case"perspective":var Zt=le(x.d[0],0,null)||0,wn=Zt?-1/Zt:0;return[1,0,0,0,0,1,0,0,0,0,1,wn,0,0,0,1];case"matrix":return[x.d[0].value,x.d[1].value,0,0,x.d[2].value,x.d[3].value,0,0,0,0,1,0,x.d[4].value,x.d[5].value,0,1];case"matrix3d":return x.d.map(function(mn){return mn.value})}}function Ba(x,S){return[x[0]*S[0]+x[4]*S[1]+x[8]*S[2]+x[12]*S[3],x[1]*S[0]+x[5]*S[1]+x[9]*S[2]+x[13]*S[3],x[2]*S[0]+x[6]*S[1]+x[10]*S[2]+x[14]*S[3],x[3]*S[0]+x[7]*S[1]+x[11]*S[2]+x[15]*S[3],x[0]*S[4]+x[4]*S[5]+x[8]*S[6]+x[12]*S[7],x[1]*S[4]+x[5]*S[5]+x[9]*S[6]+x[13]*S[7],x[2]*S[4]+x[6]*S[5]+x[10]*S[6]+x[14]*S[7],x[3]*S[4]+x[7]*S[5]+x[11]*S[6]+x[15]*S[7],x[0]*S[8]+x[4]*S[9]+x[8]*S[10]+x[12]*S[11],x[1]*S[8]+x[5]*S[9]+x[9]*S[10]+x[13]*S[11],x[2]*S[8]+x[6]*S[9]+x[10]*S[10]+x[14]*S[11],x[3]*S[8]+x[7]*S[9]+x[11]*S[10]+x[15]*S[11],x[0]*S[12]+x[4]*S[13]+x[8]*S[14]+x[12]*S[15],x[1]*S[12]+x[5]*S[13]+x[9]*S[14]+x[13]*S[15],x[2]*S[12]+x[6]*S[13]+x[10]*S[14]+x[14]*S[15],x[3]*S[12]+x[7]*S[13]+x[11]*S[14]+x[15]*S[15]]}function Ka(x){return x.length===0?[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]:x.map(Ds).reduce(Ba)}function xo(x){var S=[0,0,0],f=[1,1,1],A=[0,0,0],_=[0,0,0,1],k=[0,0,0,1];return ua(Ka(x),S,f,A,_,k),[[S,f,A,k,_]]}var aa=function(){function x(A,_){for(var k=[[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0]],G=0;G<4;G++)for(var ae=0;ae<4;ae++)for(var ge=0;ge<4;ge++)k[G][ae]+=_[G][ge]*A[ge][ae];return k}function S(A){return A[0][2]===0&&A[0][3]===0&&A[1][2]===0&&A[1][3]===0&&A[2][0]===0&&A[2][1]===0&&A[2][2]===1&&A[2][3]===0&&A[3][2]===0&&A[3][3]===1}function f(A,_,k,G,ae){for(var ge=[[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]],Ue=0;Ue<4;Ue++)ge[Ue][3]=ae[Ue];for(var rt=0;rt<3;rt++)for(var bt=0;bt<3;bt++)ge[3][rt]+=A[bt]*ge[bt][rt];var Zt=G[0],wn=G[1],mn=G[2],Gn=G[3],ir=[[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]];ir[0][0]=1-2*(wn*wn+mn*mn),ir[0][1]=2*(Zt*wn-mn*Gn),ir[0][2]=2*(Zt*mn+wn*Gn),ir[1][0]=2*(Zt*wn+mn*Gn),ir[1][1]=1-2*(Zt*Zt+mn*mn),ir[1][2]=2*(wn*mn-Zt*Gn),ir[2][0]=2*(Zt*mn-wn*Gn),ir[2][1]=2*(wn*mn+Zt*Gn),ir[2][2]=1-2*(Zt*Zt+wn*wn),ge=x(ge,ir);var tr=[[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]];k[2]&&(tr[2][1]=k[2],ge=x(ge,tr)),k[1]&&(tr[2][1]=0,tr[2][0]=k[0],ge=x(ge,tr)),k[0]&&(tr[2][0]=0,tr[1][0]=k[0],ge=x(ge,tr));for(var Zn=0;Zn<3;Zn++)for(var Tr=0;Tr<3;Tr++)ge[Zn][Tr]*=_[Zn];return S(ge)?[ge[0][0],ge[0][1],ge[1][0],ge[1][1],ge[3][0],ge[3][1]]:ge[0].concat(ge[1],ge[2],ge[3])}return f}();function di(x){return x.toFixed(6).replace(".000000","")}function Ma(x,S){var f,A;return x.decompositionPair!==S&&(x.decompositionPair=S,f=xo(x)),S.decompositionPair!==x&&(S.decompositionPair=x,A=xo(S)),f[0]===null||A[0]===null?[[!1],[!0],function(_){return _?S[0].d:x[0].d}]:(f[0].push(0),A[0].push(1),[f,A,function(_){var k=lo(f[0][3],A[0][3],_[5]),G=aa(_[0],_[1],_[2],k,_[4]),ae=G.map(di).join(",");return ae}])}function Rs(x,S){for(var f=0,A=0;A<x.length;A++)f+=x[A]*S[A];return f}function lo(x,S,f){var A=Rs(x,S);A=(0,ct.Z)(A,-1,1);var _=[];if(A===1)_=x;else for(var k=Math.acos(A),G=Math.sin(f*k)*1/Math.sqrt(1-A*A),ae=0;ae<4;ae++)_.push(x[ae]*(Math.cos(f*k)-A*G)+S[ae]*G);return _}function Jo(x){return x.replace(/[XY]/,"")}function zs(x){return x.replace(/(X|Y|Z|3d)?$/,"3d")}var Ya=function(S,f){return S==="perspective"&&f==="perspective"||(S==="matrix"||S==="matrix3d")&&(f==="matrix"||f==="matrix3d")};function pa(x,S,f){var A=!1;if(!x.length||!S.length){x.length||(A=!0,x=S,S=[]);for(var _=function(){var Hs=x[k],Zs=Hs.t,Ia=Hs.d,Po=Zs.substring(0,5)==="scale"?1:0;S.push({t:Zs,d:Ia.map(function(Ml){return typeof Ml=="number"?ki(Po):ki(Po,Ml.unit)})})},k=0;k<x.length;k++)_()}var G=[],ae=[],ge=[];if(x.length!==S.length){var Ue=Ma(x,S);G=[Ue[0]],ae=[Ue[1]],ge=[["matrix",[Ue[2]]]]}else for(var rt=0;rt<x.length;rt++){var bt=x[rt].t,Zt=S[rt].t,wn=x[rt].d,mn=S[rt].d,Gn=gi[bt],ir=gi[Zt],tr=void 0;if(Ya(bt,Zt)){var Zn=Ma([x[rt]],[S[rt]]);G.push(Zn[0]),ae.push(Zn[1]),ge.push(["matrix",[Zn[2]]]);continue}else if(bt===Zt)tr=bt;else if(Gn[2]&&ir[2]&&Jo(bt)===Jo(Zt))tr=Jo(bt),wn=Gn[2](wn),mn=ir[2](mn);else if(Gn[1]&&ir[1]&&zs(bt)===zs(Zt))tr=zs(bt),wn=Gn[1](wn),mn=ir[1](mn);else{var Tr=Ma(x,S);G=[Tr[0]],ae=[Tr[1]],ge=[["matrix",[Tr[2]]]];break}for(var ni=[],ns=[],is=[],bi=0;bi<wn.length;bi++){var Ri=me(wn[bi],mn[bi],f,!1,bi);ni[bi]=Ri[0],ns[bi]=Ri[1],is.push(Ri[2])}G.push(ni),ae.push(ns),ge.push([tr,is])}if(A){var Gs=G;G=ae,ae=Gs}return[G,ae,function(_s){return _s.map(function(Hs,Zs){var Ia=Hs.map(function(Po,Ml){return ge[Zs][1][Ml](Po)}).join(",");return ge[Zs][0]==="matrix"&&Ia.split(",").length===16&&(ge[Zs][0]="matrix3d"),ge[Zs][0]==="matrix3d"&&Ia.split(",").length===6&&(ge[Zs][0]="matrix"),"".concat(ge[Zs][0],"(").concat(Ia,")")}).join(" ")}]}var al=Lo(function(x){if((0,Fe.Z)(x)){if(x==="text-anchor")return[ki(0,"px"),ki(0,"px")];var S=x.split(" ");return S.length===1&&(S[0]==="top"||S[0]==="bottom"?(S[1]=S[0],S[0]="center"):S[1]="center"),S.length!==2?null:[Yh(qa(S[0])),Yh(qa(S[1]))]}return[ki(x[0]||0,"px"),ki(x[1]||0,"px")]});function qa(x){return x==="center"?"50%":x==="left"||x==="top"?"0%":x==="right"||x==="bottom"?"100%":x}var Ua=[{n:"display",k:["none"]},{n:"opacity",int:!0,inh:!0,d:"1",syntax:Ai.OPACITY_VALUE},{n:"fillOpacity",int:!0,inh:!0,d:"1",syntax:Ai.OPACITY_VALUE},{n:"strokeOpacity",int:!0,inh:!0,d:"1",syntax:Ai.OPACITY_VALUE},{n:"fill",int:!0,k:["none"],d:"none",syntax:Ai.PAINT},{n:"fillRule",k:["nonzero","evenodd"],d:"nonzero"},{n:"stroke",int:!0,k:["none"],d:"none",syntax:Ai.PAINT,l:!0},{n:"shadowType",k:["inner","outer","both"],d:"outer",l:!0},{n:"shadowColor",int:!0,syntax:Ai.COLOR},{n:"shadowOffsetX",int:!0,l:!0,d:"0",syntax:Ai.LENGTH_PERCENTAGE},{n:"shadowOffsetY",int:!0,l:!0,d:"0",syntax:Ai.LENGTH_PERCENTAGE},{n:"shadowBlur",int:!0,l:!0,d:"0",syntax:Ai.SHADOW_BLUR},{n:"lineWidth",int:!0,inh:!0,d:"1",l:!0,a:["strokeWidth"],syntax:Ai.LENGTH_PERCENTAGE},{n:"increasedLineWidthForHitTesting",inh:!0,d:"0",l:!0,syntax:Ai.LENGTH_PERCENTAGE},{n:"lineJoin",inh:!0,l:!0,a:["strokeLinejoin"],k:["miter","bevel","round"],d:"miter"},{n:"lineCap",inh:!0,l:!0,a:["strokeLinecap"],k:["butt","round","square"],d:"butt"},{n:"lineDash",int:!0,inh:!0,k:["none"],a:["strokeDasharray"],syntax:Ai.LENGTH_PERCENTAGE_12},{n:"lineDashOffset",int:!0,inh:!0,d:"0",a:["strokeDashoffset"],syntax:Ai.LENGTH_PERCENTAGE},{n:"offsetPath",syntax:Ai.DEFINED_PATH},{n:"offsetDistance",int:!0,syntax:Ai.OFFSET_DISTANCE},{n:"dx",int:!0,l:!0,d:"0",syntax:Ai.LENGTH_PERCENTAGE},{n:"dy",int:!0,l:!0,d:"0",syntax:Ai.LENGTH_PERCENTAGE},{n:"zIndex",ind:!0,int:!0,d:"0",k:["auto"],syntax:Ai.Z_INDEX},{n:"visibility",k:["visible","hidden"],ind:!0,inh:!0,int:!0,d:"visible"},{n:"pointerEvents",inh:!0,k:["none","auto","stroke","fill","painted","visible","visiblestroke","visiblefill","visiblepainted","all"],d:"auto"},{n:"filter",ind:!0,l:!0,k:["none"],d:"none",syntax:Ai.FILTER},{n:"clipPath",syntax:Ai.DEFINED_PATH},{n:"textPath",syntax:Ai.DEFINED_PATH},{n:"textPathSide",k:["left","right"],d:"left"},{n:"textPathStartOffset",l:!0,d:"0",syntax:Ai.LENGTH_PERCENTAGE},{n:"transform",p:100,int:!0,k:["none"],d:"none",syntax:Ai.TRANSFORM},{n:"transformOrigin",p:100,d:"0 0",l:!0,syntax:Ai.TRANSFORM_ORIGIN},{n:"cx",int:!0,l:!0,d:"0",syntax:Ai.COORDINATE},{n:"cy",int:!0,l:!0,d:"0",syntax:Ai.COORDINATE},{n:"cz",int:!0,l:!0,d:"0",syntax:Ai.COORDINATE},{n:"r",int:!0,l:!0,d:"0",syntax:Ai.LENGTH_PERCENTAGE},{n:"rx",int:!0,l:!0,d:"0",syntax:Ai.LENGTH_PERCENTAGE},{n:"ry",int:!0,l:!0,d:"0",syntax:Ai.LENGTH_PERCENTAGE},{n:"x",int:!0,l:!0,d:"0",syntax:Ai.COORDINATE},{n:"y",int:!0,l:!0,d:"0",syntax:Ai.COORDINATE},{n:"z",int:!0,l:!0,d:"0",syntax:Ai.COORDINATE},{n:"width",int:!0,l:!0,k:["auto","fit-content","min-content","max-content"],d:"0",syntax:Ai.LENGTH_PERCENTAGE},{n:"height",int:!0,l:!0,k:["auto","fit-content","min-content","max-content"],d:"0",syntax:Ai.LENGTH_PERCENTAGE},{n:"radius",int:!0,l:!0,d:"0",syntax:Ai.LENGTH_PERCENTAGE_14},{n:"x1",int:!0,l:!0,syntax:Ai.COORDINATE},{n:"y1",int:!0,l:!0,syntax:Ai.COORDINATE},{n:"z1",int:!0,l:!0,syntax:Ai.COORDINATE},{n:"x2",int:!0,l:!0,syntax:Ai.COORDINATE},{n:"y2",int:!0,l:!0,syntax:Ai.COORDINATE},{n:"z2",int:!0,l:!0,syntax:Ai.COORDINATE},{n:"d",int:!0,l:!0,d:"",syntax:Ai.PATH,p:50},{n:"points",int:!0,l:!0,syntax:Ai.LIST_OF_POINTS,p:50},{n:"text",l:!0,d:"",syntax:Ai.TEXT,p:50},{n:"textTransform",l:!0,inh:!0,k:["capitalize","uppercase","lowercase","none"],d:"none",syntax:Ai.TEXT_TRANSFORM,p:51},{n:"font",l:!0},{n:"fontSize",int:!0,inh:!0,d:"16px",l:!0,syntax:Ai.LENGTH_PERCENTAGE},{n:"fontFamily",l:!0,inh:!0,d:"sans-serif"},{n:"fontStyle",l:!0,inh:!0,k:["normal","italic","oblique"],d:"normal"},{n:"fontWeight",l:!0,inh:!0,k:["normal","bold","bolder","lighter"],d:"normal"},{n:"fontVariant",l:!0,inh:!0,k:["normal","small-caps"],d:"normal"},{n:"lineHeight",l:!0,syntax:Ai.LENGTH,int:!0,d:"0"},{n:"letterSpacing",l:!0,syntax:Ai.LENGTH,int:!0,d:"0"},{n:"miterLimit",l:!0,syntax:Ai.NUMBER,d:function(S){return S===Jt.PATH||S===Jt.POLYGON||S===Jt.POLYLINE?"4":"10"}},{n:"wordWrap",l:!0},{n:"wordWrapWidth",l:!0},{n:"maxLines",l:!0},{n:"textOverflow",l:!0,d:"clip"},{n:"leading",l:!0},{n:"textBaseline",l:!0,inh:!0,k:["top","hanging","middle","alphabetic","ideographic","bottom"],d:"alphabetic"},{n:"textAlign",l:!0,inh:!0,k:["start","center","middle","end","left","right"],d:"start"},{n:"markerStart",syntax:Ai.MARKER},{n:"markerEnd",syntax:Ai.MARKER},{n:"markerMid",syntax:Ai.MARKER},{n:"markerStartOffset",syntax:Ai.LENGTH,l:!0,int:!0,d:"0"},{n:"markerEndOffset",syntax:Ai.LENGTH,l:!0,int:!0,d:"0"}],dl=new Set(Ua.filter(function(x){return!!x.l}).map(function(x){return x.n})),Sc={},zl=function(){function x(S){var f=this;(0,Z.Z)(this,x),this.runtime=S,Ua.forEach(function(A){f.registerMetadata(A)})}return(0,V.Z)(x,[{key:"registerMetadata",value:function(f){[f.n].concat((0,N.Z)(f.a||[])).forEach(function(A){Sc[A]=f})}},{key:"getPropertySyntax",value:function(f){return this.runtime.CSSPropertySyntaxFactory[f]}},{key:"processProperties",value:function(f,A){var _=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{skipUpdateAttribute:!1,skipParse:!1,forceUpdateGeometry:!1,usedAttributes:[],memoize:!0};Object.assign(f.attributes,A);var k=f.parsedStyle.clipPath,G=f.parsedStyle.offsetPath;Gc(f,A);var ae=!!_.forceUpdateGeometry;if(!ae){for(var ge in A)if(dl.has(ge)){ae=!0;break}}var Ue=uc(f);Ue.has("fill")&&A.fill&&(f.parsedStyle.fill=mo(A.fill)),Ue.has("stroke")&&A.stroke&&(f.parsedStyle.stroke=mo(A.stroke)),Ue.has("shadowColor")&&A.shadowColor&&(f.parsedStyle.shadowColor=mo(A.shadowColor)),Ue.has("filter")&&A.filter&&(f.parsedStyle.filter=pn(A.filter)),Ue.has("radius")&&!(0,$e.Z)(A.radius)&&(f.parsedStyle.radius=Ze(A.radius,4)),Ue.has("lineDash")&&!(0,$e.Z)(A.lineDash)&&(f.parsedStyle.lineDash=Ze(A.lineDash,"even")),Ue.has("points")&&A.points&&(f.parsedStyle.points=$n(A.points)),Ue.has("d")&&A.d===""&&(f.parsedStyle.d=(0,m.Z)({},ca)),Ue.has("d")&&A.d&&(f.parsedStyle.d=gn(A.d)),Ue.has("textTransform")&&A.textTransform&&this.runtime.CSSPropertySyntaxFactory[Ai.TEXT_TRANSFORM].calculator(null,null,{value:A.textTransform},f,null),Ue.has("clipPath")&&!(0,vr.Z)(A.clipPath)&&this.runtime.CSSPropertySyntaxFactory[Ai.DEFINED_PATH].calculator("clipPath",k,A.clipPath,f,this.runtime),Ue.has("offsetPath")&&A.offsetPath&&this.runtime.CSSPropertySyntaxFactory[Ai.DEFINED_PATH].calculator("offsetPath",G,A.offsetPath,f,this.runtime),Ue.has("transform")&&A.transform&&(f.parsedStyle.transform=ts(A.transform)),Ue.has("transformOrigin")&&A.transformOrigin&&(f.parsedStyle.transformOrigin=al(A.transformOrigin)),Ue.has("markerStart")&&A.markerStart&&(f.parsedStyle.markerStart=this.runtime.CSSPropertySyntaxFactory[Ai.MARKER].calculator(null,A.markerStart,A.markerStart,null,null)),Ue.has("markerEnd")&&A.markerEnd&&(f.parsedStyle.markerEnd=this.runtime.CSSPropertySyntaxFactory[Ai.MARKER].calculator(null,A.markerEnd,A.markerEnd,null,null)),Ue.has("markerMid")&&A.markerMid&&(f.parsedStyle.markerMid=this.runtime.CSSPropertySyntaxFactory[Ai.MARKER].calculator("",A.markerMid,A.markerMid,null,null)),Ue.has("zIndex")&&!(0,$e.Z)(A.zIndex)&&this.runtime.CSSPropertySyntaxFactory[Ai.Z_INDEX].postProcessor(f),Ue.has("offsetDistance")&&!(0,$e.Z)(A.offsetDistance)&&this.runtime.CSSPropertySyntaxFactory[Ai.OFFSET_DISTANCE].postProcessor(f),Ue.has("transform")&&A.transform&&this.runtime.CSSPropertySyntaxFactory[Ai.TRANSFORM].postProcessor(f),Ue.has("transformOrigin")&&A.transformOrigin&&this.runtime.CSSPropertySyntaxFactory[Ai.TRANSFORM_ORIGIN].postProcessor(f),ae&&(f.dirty(!0,!0),_.forceUpdateGeometry||this.runtime.sceneGraphService.dirtyToRoot(f))}},{key:"updateGeometry",value:function(f){var A=f.nodeName,_=this.runtime.geometryUpdaterFactory[A];if(_){var k=f.geometry;k.contentBounds||(k.contentBounds=new ie),k.renderBounds||(k.renderBounds=new ie);var G=f.parsedStyle,ae=_.update(G,f),ge=ae.cx,Ue=ge===void 0?0:ge,rt=ae.cy,bt=rt===void 0?0:rt,Zt=ae.cz,wn=Zt===void 0?0:Zt,mn=ae.hwidth,Gn=mn===void 0?0:mn,ir=ae.hheight,tr=ir===void 0?0:ir,Zn=ae.hdepth,Tr=Zn===void 0?0:Zn,ni=[Math.abs(Gn),Math.abs(tr),Tr],ns=G.stroke,is=G.lineWidth,bi=is===void 0?1:is,Ri=G.increasedLineWidthForHitTesting,Gs=Ri===void 0?0:Ri,_s=G.shadowType,Hs=_s===void 0?"outer":_s,Zs=G.shadowColor,Ia=G.filter,Po=Ia===void 0?[]:Ia,Ml=G.transformOrigin,El=[Ue,bt,wn];k.contentBounds.update(El,ni);var Ys=A===Jt.POLYLINE||A===Jt.POLYGON||A===Jt.PATH?Math.SQRT2:.5,U=ns&&!ns.isNone;if(U){var R=((bi||0)+(Gs||0))*Ys;ni[0]+=R,ni[1]+=R}if(k.renderBounds.update(El,ni),Zs&&Hs&&Hs!=="inner"){var $=k.renderBounds,K=$.min,_e=$.max,et=G.shadowBlur,Ft=G.shadowOffsetX,dn=G.shadowOffsetY,fn=et||0,Ar=Ft||0,ur=dn||0,Ir=K[0]-fn+Ar,fi=_e[0]+fn+Ar,Qs=K[1]-fn+ur,us=_e[1]+fn+ur;K[0]=Math.min(K[0],Ir),_e[0]=Math.max(_e[0],fi),K[1]=Math.min(K[1],Qs),_e[1]=Math.max(_e[1],us),k.renderBounds.setMinMax(K,_e)}Po.forEach(function(ko){var uo=ko.name,Oa=ko.params;if(uo==="blur"){var ks=Oa[0].value;k.renderBounds.update(k.renderBounds.center,D.IH(k.renderBounds.halfExtents,k.renderBounds.halfExtents,[ks,ks,0]))}else if(uo==="drop-shadow"){var So=Oa[0].value,eo=Oa[1].value,za=Oa[2].value,nu=k.renderBounds,wu=nu.min,hu=nu.max,pl=wu[0]-za+So,Nu=hu[0]+za+So,Qh=wu[1]-za+eo,Ju=hu[1]+za+eo;wu[0]=Math.min(wu[0],pl),hu[0]=Math.max(hu[0],Nu),wu[1]=Math.min(wu[1],Qh),hu[1]=Math.max(hu[1],Ju),k.renderBounds.setMinMax(wu,hu)}}),f.geometry.dirty=!1;var bs=Gn<0,Ja=tr<0,fa=(bs?-1:1)*(Ml?le(Ml[0],0,f,!0):0),ea=(Ja?-1:1)*(Ml?le(Ml[1],1,f,!0):0);(fa||ea)&&f.setOrigin(fa,ea)}}},{key:"updateSizeAttenuation",value:function(f,A){f.style.isSizeAttenuation?(f.style.rawLineWidth||(f.style.rawLineWidth=f.style.lineWidth),f.style.lineWidth=(f.style.rawLineWidth||1)/A,f.nodeName===Jt.CIRCLE&&(f.style.rawR||(f.style.rawR=f.style.r),f.style.r=(f.style.rawR||1)/A)):(f.style.rawLineWidth&&(f.style.lineWidth=f.style.rawLineWidth,delete f.style.rawLineWidth),f.nodeName===Jt.CIRCLE&&f.style.rawR&&(f.style.r=f.style.rawR,delete f.style.rawR))}}])}();function Gc(x,S){var f=uc(x);for(var A in S)f.has(A)&&(x.parsedStyle[A]=S[A])}function uc(x){return x.constructor.PARSED_STYLE_LIST}var Bu=function(){function x(){(0,Z.Z)(this,x),this.mixer=yr}return(0,V.Z)(x,[{key:"calculator",value:function(f,A,_,k){return ce(_)}}])}(),cu=function(){function x(){(0,Z.Z)(this,x)}return(0,V.Z)(x,[{key:"calculator",value:function(f,A,_,k,G){return _ instanceof Xu&&(_=null),G.sceneGraphService.updateDisplayObjectDependency(f,A,_,k),f==="clipPath"&&k.forEach(function(ae){ae.childNodes.length===0&&G.sceneGraphService.dirtyToRoot(ae)}),_}}])}(),qc=function(){function x(){(0,Z.Z)(this,x),this.parser=mo,this.mixer=wa}return(0,V.Z)(x,[{key:"calculator",value:function(f,A,_,k){return _ instanceof Xu?_.value==="none"?ac:Lr:_}}])}(),_l=function(){function x(){(0,Z.Z)(this,x)}return(0,V.Z)(x,[{key:"calculator",value:function(f,A,_){return _ instanceof Xu?[]:_}}])}();function Ho(x){var S=x.parsedStyle,f=S.fontSize;return(0,$e.Z)(f)?null:f}var jl=function(){function x(){(0,Z.Z)(this,x),this.mixer=yr}return(0,V.Z)(x,[{key:"calculator",value:function(f,A,_,k,G){if((0,ve.Z)(_))return _;if(Bo.isRelativeUnit(_.unit)){if(_.unit===Ji.kPercentage)return 0;if(_.unit===Ji.kEms){if(k.parentNode){var ae=Ho(k.parentNode);if(ae)return ae*=_.value,ae}return 0}if(_.unit===Ji.kRems){var ge;if(k!=null&&(ge=k.ownerDocument)!==null&&ge!==void 0&&ge.documentElement){var Ue=Ho(k.ownerDocument.documentElement);if(Ue)return Ue*=_.value,Ue}return 0}}else return _.value}}])}(),Jc=function(){function x(){(0,Z.Z)(this,x),this.mixer=Fr}return(0,V.Z)(x,[{key:"calculator",value:function(f,A,_){return _.map(function(k){return k.value})}}])}(),eh=function(){function x(){(0,Z.Z)(this,x),this.mixer=Fr}return(0,V.Z)(x,[{key:"calculator",value:function(f,A,_){return _.map(function(k){return k.value})}}])}(),df=function(){function x(){(0,Z.Z)(this,x)}return(0,V.Z)(x,[{key:"calculator",value:function(f,A,_,k){var G;_ instanceof Xu&&(_=null);var ae=(G=_)===null||G===void 0?void 0:G.cloneNode(!0);return ae&&(ae.style.isMarker=!0),ae}}])}(),xh=function(){function x(){(0,Z.Z)(this,x),this.mixer=yr}return(0,V.Z)(x,[{key:"calculator",value:function(f,A,_){return _.value}}])}(),MA=function(){function x(){(0,Z.Z)(this,x),this.mixer=xr(0,1)}return(0,V.Z)(x,[{key:"calculator",value:function(f,A,_){return _.value}},{key:"postProcessor",value:function(f){var A=f.parsedStyle,_=A.offsetPath,k=A.offsetDistance;if(_){var G=_.nodeName;if(G===Jt.LINE||G===Jt.PATH||G===Jt.POLYLINE){var ae=_.getPoint(k);ae&&f.setLocalPosition(ae.x,ae.y)}}}}])}(),yl=function(){function x(){(0,Z.Z)(this,x),this.mixer=xr(0,1)}return(0,V.Z)(x,[{key:"calculator",value:function(f,A,_){return _.value}}])}(),Nc=function(){function x(){(0,Z.Z)(this,x),this.parser=gn,this.mixer=Nn}return(0,V.Z)(x,[{key:"calculator",value:function(f,A,_){return _ instanceof Xu&&_.value==="unset"?{absolutePath:[],hasArc:!1,segments:[],polygons:[],polylines:[],curve:null,totalLength:0,rect:new Sn(0,0,0,0)}:_}}])}(),bh=(0,V.Z)(function x(){(0,Z.Z)(this,x),this.mixer=Er}),Wf=function(x){function S(){var f;(0,Z.Z)(this,S);for(var A=arguments.length,_=new Array(A),k=0;k<A;k++)_[k]=arguments[k];return f=(0,E.Z)(this,S,[].concat(_)),f.mixer=xr(0,1/0),f}return(0,F.Z)(S,x),(0,V.Z)(S)}(jl),_h=function(){function x(){(0,Z.Z)(this,x)}return(0,V.Z)(x,[{key:"calculator",value:function(f,A,_,k){return _ instanceof Xu?_.value==="unset"?"":_.value:"".concat(_)}},{key:"postProcessor",value:function(f){f.nodeValue="".concat(f.parsedStyle.text)||""}}])}(),ol=function(){function x(){(0,Z.Z)(this,x)}return(0,V.Z)(x,[{key:"calculator",value:function(f,A,_,k){var G=k.getAttribute("text");if(G){var ae=G;_.value==="capitalize"?ae=G.charAt(0).toUpperCase()+G.slice(1):_.value==="lowercase"?ae=G.toLowerCase():_.value==="uppercase"&&(ae=G.toUpperCase()),k.parsedStyle.text=ae}return _.value}}])}(),Bl=function(S){return Object.fromEntries(Object.entries(S).filter(function(f){var A=_slicedToArray(f,2),_=A[1];return _!==void 0}))},yd=new WeakMap;function Co(x,S,f){if(x){var A=typeof x=="string"?document.getElementById(x):x;yd.has(A)&&yd.get(A).destroy(f),yd.set(A,S)}}var vu=typeof window!="undefined"&&typeof window.document!="undefined";function Gl(x){return!!x.getAttribute}function Ea(x,S){for(var f=0,A=x.length;f<A;){var _=f+A>>>1;Rl(x[_],S)<0?f=_+1:A=_}return f}function Rl(x,S){var f=Number(x.parsedStyle.zIndex||0),A=Number(S.parsedStyle.zIndex||0);if(f===A){var _=x.parentNode;if(_){var k=_.childNodes||[];return k.indexOf(x)-k.indexOf(S)}}return f-A}function Zf(x){var S=x;do{var f,A=(f=S.parsedStyle)===null||f===void 0?void 0:f.clipPath;if(A)return S;S=S.parentElement}while(S!==null);return null}var ku="px";function Dh(x,S,f){vu&&x.style&&(x.style.width=S+ku,x.style.height=f+ku)}function Vu(x,S){if(vu)return document.defaultView.getComputedStyle(x,null).getPropertyValue(S)}function EA(x){var S=Vu(x,"width");return S==="auto"?x.offsetWidth:parseFloat(S)}function zu(x){var S=Vu(x,"height");return S==="auto"?x.offsetHeight:parseFloat(S)}var Wr=1,Hc={touchstart:"pointerdown",touchend:"pointerup",touchendoutside:"pointerupoutside",touchmove:"pointermove",touchcancel:"pointercancel"},yu=typeof performance=="object"&&performance.now?performance:Date;function Hl(x){return x.nodeName===Jt.FRAGMENT?!0:x.getRootNode().nodeName===Jt.FRAGMENT}function Yl(){var x=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"auto",S=arguments.length>1?arguments[1]:void 0,f=arguments.length>2?arguments[2]:void 0,A=!1,_=!1,k=!!S&&!S.isNone,G=!!f&&!f.isNone;return x==="visiblepainted"||x==="painted"||x==="auto"?(A=k,_=G):x==="visiblefill"||x==="fill"?A=!0:x==="visiblestroke"||x==="stroke"?_=!0:(x==="visible"||x==="all")&&(A=!0,_=!0),[A,_]}var Ql=1,Km=function(){return Ql++},Ol=typeof self=="object"&&self.self===self?self:typeof b.g=="object"&&b.g.global===b.g?b.g:{},Kf=Date.now(),Zv=function(){return Ol.performance&&typeof Ol.performance.now=="function"?Ol.performance.now():Date.now()-Kf},ql={},Rp=Date.now(),$f=function(S){if(typeof S!="function")throw new TypeError("".concat(S," is not a function"));var f=Date.now(),A=f-Rp,_=A>16?0:16-A,k=Km();return ql[k]=S,Object.keys(ql).length>1||setTimeout(function(){Rp=f;var G=ql;ql={},Object.keys(G).forEach(function(ae){return G[ae](Zv())})},_),k},wl=function(S){delete ql[S]},ha=["","webkit","moz","ms","o"],$m=function(S){return typeof S!="string"?$f:S===""?Ol.requestAnimationFrame:Ol["".concat(S,"RequestAnimationFrame")]},kh=function(S){return typeof S!="string"?wl:S===""?Ol.cancelAnimationFrame:Ol["".concat(S,"CancelAnimationFrame")]||Ol["".concat(S,"CancelRequestAnimationFrame")]},lm=function(S,f){for(var A=0;S[A]!==void 0;){if(f(S[A]))return S[A];A+=1}},qh=lm(ha,function(x){return!!$m(x)}),th=$m(qh),ff=kh(qh);Ol.requestAnimationFrame=th,Ol.cancelAnimationFrame=ff;var Yu=function(){function x(){(0,Z.Z)(this,x),this.callbacks=[]}return(0,V.Z)(x,[{key:"getCallbacksNum",value:function(){return this.callbacks.length}},{key:"tapPromise",value:function(f,A){this.callbacks.push(A)}},{key:"promise",value:function(){for(var f=arguments.length,A=new Array(f),_=0;_<f;_++)A[_]=arguments[_];return Promise.all(this.callbacks.map(function(k){return k.apply(void 0,A)}))}}])}(),Ui=function(){function x(){(0,Z.Z)(this,x),this.callbacks=[]}return(0,V.Z)(x,[{key:"tapPromise",value:function(f,A){this.callbacks.push(A)}},{key:"promise",value:function(){var S=(0,dt.Z)((0,st.Z)().mark(function A(){var _,k,G,ae,ge=arguments;return(0,st.Z)().wrap(function(Ue){for(;;)switch(Ue.prev=Ue.next){case 0:if(!this.callbacks.length){Ue.next=6;break}return Ue.next=1,(_=this.callbacks)[0].apply(_,ge);case 1:k=Ue.sent,G=1;case 2:if(!(G<this.callbacks.length)){Ue.next=5;break}return ae=this.callbacks[G],Ue.next=3,ae(k);case 3:k=Ue.sent;case 4:G++,Ue.next=2;break;case 5:return Ue.abrupt("return",k);case 6:return Ue.abrupt("return",null);case 7:case"end":return Ue.stop()}},A,this)}));function f(){return S.apply(this,arguments)}return f}()}])}(),Fc=function(){function x(){(0,Z.Z)(this,x),this.callbacks=[]}return(0,V.Z)(x,[{key:"tap",value:function(f,A){this.callbacks.push(A)}},{key:"call",value:function(){for(var f=arguments.length,A=new Array(f),_=0;_<f;_++)A[_]=arguments[_];var k=arguments;this.callbacks.forEach(function(G){G.apply(void 0,k)})}}])}(),Gu=function(){function x(){(0,Z.Z)(this,x),this.callbacks=[]}return(0,V.Z)(x,[{key:"tap",value:function(f,A){this.callbacks.push(A)}},{key:"call",value:function(){for(var f=arguments.length,A=new Array(f),_=0;_<f;_++)A[_]=arguments[_];if(this.callbacks.length){for(var k=arguments,G=this.callbacks[0].apply(void 0,k),ae=1;ae<this.callbacks.length;ae++){var ge=this.callbacks[ae];G=ge(G)}return G}return null}}])}(),CA=["serif","sans-serif","monospace","cursive","fantasy","system-ui"],Xf=/([\"\'])[^\'\"]+\1/;function cc(x){var S=x.fontSize,f=S===void 0?16:S,A=x.fontFamily,_=A===void 0?"sans-serif":A,k=x.fontStyle,G=k===void 0?"normal":k,ae=x.fontVariant,ge=ae===void 0?"normal":ae,Ue=x.fontWeight,rt=Ue===void 0?"normal":Ue;return{fontSize:f,fontFamily:_,fontStyle:G,fontVariant:ge,fontWeight:rt}}var Vd=Lo(function(S){for(var f=cc(S),A=f.fontSize,_=f.fontFamily,k=f.fontStyle,G=f.fontVariant,ae=f.fontWeight,ge=(0,ve.Z)(A)&&"".concat(A,"px")||"16px",Ue=_.split(","),rt=Ue.length-1;rt>=0;rt--){var bt=Ue[rt].trim();!Xf.test(bt)&&CA.indexOf(bt)<0&&(bt='"'.concat(bt,'"')),Ue[rt]=bt}return"".concat(k," ").concat(G," ").concat(ae," ").concat(ge," ").concat(Ue.join(","))},function(x){var S=cc(x),f=S.fontSize,A=S.fontFamily,_=S.fontStyle,k=S.fontVariant,G=S.fontWeight;return"".concat(_,"_").concat(k,"_").concat(G,"_").concat(f,"_").concat(A)}),Ru=1e-6,ka=function(S){return Math.max(S,Ru)};function Af(x,S,f){return j.identity(x),x[4]=Math.tan(S),x[1]=Math.tan(f),x}var Sl=j.create(),xd=j.create(),zd={scale:function(S){j.fromScaling(Sl,[S[0].value,S[1].value,1].map(function(f){return ka(f)}))},scaleX:function(S){j.fromScaling(Sl,[S[0].value,1,1].map(function(f){return ka(f)}))},scaleY:function(S){j.fromScaling(Sl,[1,S[0].value,1].map(function(f){return ka(f)}))},scaleZ:function(S){j.fromScaling(Sl,[1,1,S[0].value].map(function(f){return ka(f)}))},scale3d:function(S){j.fromScaling(Sl,[S[0].value,S[1].value,S[2].value].map(function(f){return ka(f)}))},translate:function(S){j.fromTranslation(Sl,[S[0].value,S[1].value,0])},translateX:function(S){j.fromTranslation(Sl,[S[0].value,0,0])},translateY:function(S){j.fromTranslation(Sl,[0,S[0].value,0])},translateZ:function(S){j.fromTranslation(Sl,[0,0,S[0].value])},translate3d:function(S){j.fromTranslation(Sl,[S[0].value,S[1].value,S[2].value])},rotate:function(S){j.fromZRotation(Sl,Yt(ce(S[0])))},rotateX:function(S){j.fromXRotation(Sl,Yt(ce(S[0])))},rotateY:function(S){j.fromYRotation(Sl,Yt(ce(S[0])))},rotateZ:function(S){j.fromZRotation(Sl,Yt(ce(S[0])))},rotate3d:function(S){j.fromRotation(Sl,Yt(ce(S[3])),[S[0].value,S[1].value,S[2].value])},skew:function(S){Af(Sl,Yt(S[0].value),Yt(S[1].value))},skewX:function(S){Af(Sl,Yt(S[0].value),0)},skewY:function(S){Af(Sl,0,Yt(S[0].value))},matrix:function(S){j.set(Sl,S[0].value,S[1].value,0,0,S[2].value,S[3].value,0,0,0,0,1,0,S[4].value,S[5].value,0,1)},matrix3d:function(S){j.set.apply(j,[Sl].concat((0,N.Z)(S.map(function(f){return f.value}))))}},TA=D.al(1,1,1),Gd=D.Ue(),Hd={translate:function(S,f){Oi.sceneGraphService.setLocalScale(S,TA,!1),Oi.sceneGraphService.setLocalEulerAngles(S,Gd,void 0,void 0,!1),Oi.sceneGraphService.setLocalPosition(S,[f[0].value,f[1].value,0],!1),Oi.sceneGraphService.dirtyLocalTransform(S,S.transformable)}};function pf(x,S){if(x.length){if(x.length===1&&Hd[x[0].t]){Hd[x[0].t](S,x[0].d);return}for(var f=j.identity(xd),A=0;A<x.length;A++){var _=x[A],k=_.t,G=_.d,ae=zd[k];ae&&(ae(G),j.mul(f,f,Sl))}S.setLocalTransform(f)}else S.resetLocalTransform();return S.getLocalTransform()}var Ip=function(){function x(){(0,Z.Z)(this,x),this.parser=fs,this.mixer=pa}return(0,V.Z)(x,[{key:"calculator",value:function(f,A,_,k){return _ instanceof Xu?[]:_}},{key:"postProcessor",value:function(f){pf(f.parsedStyle.transform,f)}}])}(),_g=function(){function x(){(0,Z.Z)(this,x)}return(0,V.Z)(x,[{key:"postProcessor",value:function(f){var A=f.parsedStyle.transformOrigin;A[0].unit===Ji.kPixels&&A[1].unit===Ji.kPixels?f.setOrigin(A[0].value,A[1].value):f.getGeometryBounds()}}])}(),ip=function(){function x(){(0,Z.Z)(this,x)}return(0,V.Z)(x,[{key:"calculator",value:function(f,A,_,k){return _.value}},{key:"postProcessor",value:function(f){if(f.parentNode){var A=f.parentNode,_=A.renderable,k=A.sortable;_&&A.dirty(),k&&(k.dirty=!0,k.dirtyReason=Di.Z_INDEX_CHANGED)}}}])}(),Il=function(){function x(){(0,Z.Z)(this,x)}return(0,V.Z)(x,[{key:"update",value:function(f,A){var _=f.cx,k=_===void 0?0:_,G=f.cy,ae=G===void 0?0:G,ge=f.r,Ue=ge===void 0?0:ge;return{cx:k,cy:ae,hwidth:Ue,hheight:Ue}}}])}(),um=function(){function x(){(0,Z.Z)(this,x)}return(0,V.Z)(x,[{key:"update",value:function(f,A){var _=f.cx,k=_===void 0?0:_,G=f.cy,ae=G===void 0?0:G,ge=f.rx,Ue=ge===void 0?0:ge,rt=f.ry,bt=rt===void 0?0:rt;return{cx:k,cy:ae,hwidth:Ue,hheight:bt}}}])}(),sp=function(){function x(){(0,Z.Z)(this,x)}return(0,V.Z)(x,[{key:"update",value:function(f){var A=f.x1,_=f.y1,k=f.x2,G=f.y2,ae=Math.min(A,k),ge=Math.max(A,k),Ue=Math.min(_,G),rt=Math.max(_,G),bt=ge-ae,Zt=rt-Ue,wn=bt/2,mn=Zt/2;return{cx:ae+wn,cy:Ue+mn,hwidth:wn,hheight:mn}}}])}(),bd=function(){function x(){(0,Z.Z)(this,x)}return(0,V.Z)(x,[{key:"update",value:function(f){var A=f.d,_=A.rect,k=_.x,G=_.y,ae=_.width,ge=_.height,Ue=ae/2,rt=ge/2;return{cx:k+Ue,cy:G+rt,hwidth:Ue,hheight:rt}}}])}(),jf=function(){function x(){(0,Z.Z)(this,x)}return(0,V.Z)(x,[{key:"update",value:function(f){if(f.points&&(0,Ki.Z)(f.points.points)){var A=f.points.points,_=Math.min.apply(Math,(0,N.Z)(A.map(function(Zt){return Zt[0]}))),k=Math.max.apply(Math,(0,N.Z)(A.map(function(Zt){return Zt[0]}))),G=Math.min.apply(Math,(0,N.Z)(A.map(function(Zt){return Zt[1]}))),ae=Math.max.apply(Math,(0,N.Z)(A.map(function(Zt){return Zt[1]}))),ge=k-_,Ue=ae-G,rt=ge/2,bt=Ue/2;return{cx:_+rt,cy:G+bt,hwidth:rt,hheight:bt}}return{cx:0,cy:0,hwidth:0,hheight:0}}}])}(),Jl=function(){function x(){(0,Z.Z)(this,x)}return(0,V.Z)(x,[{key:"update",value:function(f,A){var _=f.x,k=_===void 0?0:_,G=f.y,ae=G===void 0?0:G,ge=f.src,Ue=f.width,rt=Ue===void 0?0:Ue,bt=f.height,Zt=bt===void 0?0:bt,wn=rt,mn=Zt;return ge&&!(0,Fe.Z)(ge)&&(wn||(wn=ge.width,f.width=wn),mn||(mn=ge.height,f.height=mn)),{cx:k+wn/2,cy:ae+mn/2,hwidth:wn/2,hheight:mn/2}}}])}(),cm=function(){function x(S){(0,Z.Z)(this,x),this.globalRuntime=S}return(0,V.Z)(x,[{key:"isReadyToMeasure",value:function(f,A){var _=f.text;return _}},{key:"update",value:function(f,A){var _,k=f.text,G=f.textAlign,ae=G===void 0?"start":G,ge=f.lineWidth,Ue=ge===void 0?1:ge,rt=f.textBaseline,bt=rt===void 0?"alphabetic":rt,Zt=f.dx,wn=Zt===void 0?0:Zt,mn=f.dy,Gn=mn===void 0?0:mn,ir=f.x,tr=ir===void 0?0:ir,Zn=f.y,Tr=Zn===void 0?0:Zn;if(!this.isReadyToMeasure(f,A))return f.metrics={font:"",width:0,height:0,lines:[],lineWidths:[],lineHeight:0,maxLineWidth:0,fontProperties:{ascent:0,descent:0,fontSize:0},lineMetrics:[]},{hwidth:0,hheight:0,cx:0,cy:0};var ni=(A==null||(_=A.ownerDocument)===null||_===void 0||(_=_.defaultView)===null||_===void 0?void 0:_.getConfig())||{},ns=ni.offscreenCanvas,is=this.globalRuntime.textService.measureText(k,f,ns);f.metrics=is;var bi=is.width,Ri=is.height,Gs=bi/2,_s=Ri/2,Hs=tr+Gs;ae==="center"||ae==="middle"?Hs+=Ue/2-Gs:(ae==="right"||ae==="end")&&(Hs+=Ue-Gs*2);var Zs=Tr-_s;return bt==="middle"?Zs+=_s:bt==="top"||bt==="hanging"?Zs+=_s*2:bt==="alphabetic"||(bt==="bottom"||bt==="ideographic")&&(Zs+=0),wn&&(Hs+=wn),Gn&&(Zs+=Gn),{cx:Hs,cy:Zs,hwidth:Gs,hheight:_s}}}])}(),wg=function(){function x(){(0,Z.Z)(this,x)}return(0,V.Z)(x,[{key:"update",value:function(f,A){return{cx:0,cy:0,hwidth:0,hheight:0}}}])}(),Vh=function(){function x(){(0,Z.Z)(this,x)}return(0,V.Z)(x,[{key:"update",value:function(f,A){var _=f.x,k=_===void 0?0:_,G=f.y,ae=G===void 0?0:G,ge=f.width,Ue=ge===void 0?0:ge,rt=f.height,bt=rt===void 0?0:rt;return{cx:k+Ue/2,cy:ae+bt/2,hwidth:Ue/2,hheight:bt/2}}}])}();function Pc(x){return!!x.type}var Jh=function(){function x(S){(0,Z.Z)(this,x),this.eventPhase=x.prototype.NONE,this.bubbles=!0,this.cancelBubble=!0,this.cancelable=!1,this.defaultPrevented=!1,this.propagationStopped=!1,this.propagationImmediatelyStopped=!1,this.layer=new xt,this.page=new xt,this.canvas=new xt,this.viewport=new xt,this.composed=!1,this.NONE=0,this.CAPTURING_PHASE=1,this.AT_TARGET=2,this.BUBBLING_PHASE=3,this.manager=S}return(0,V.Z)(x,[{key:"name",get:function(){return this.type}},{key:"layerX",get:function(){return this.layer.x}},{key:"layerY",get:function(){return this.layer.y}},{key:"pageX",get:function(){return this.page.x}},{key:"pageY",get:function(){return this.page.y}},{key:"x",get:function(){return this.canvas.x}},{key:"y",get:function(){return this.canvas.y}},{key:"canvasX",get:function(){return this.canvas.x}},{key:"canvasY",get:function(){return this.canvas.y}},{key:"viewportX",get:function(){return this.viewport.x}},{key:"viewportY",get:function(){return this.viewport.y}},{key:"composedPath",value:function(){return this.manager&&(!this.path||this.path[0]!==this.target)&&(this.path=this.target?this.manager.propagationPath(this.target):[]),this.path}},{key:"propagationPath",get:function(){return this.composedPath()}},{key:"preventDefault",value:function(){this.nativeEvent instanceof Event&&this.nativeEvent.cancelable&&this.nativeEvent.preventDefault(),this.defaultPrevented=!0}},{key:"stopImmediatePropagation",value:function(){this.propagationImmediatelyStopped=!0}},{key:"stopPropagation",value:function(){this.propagationStopped=!0}},{key:"initEvent",value:function(){}},{key:"initUIEvent",value:function(){}},{key:"clone",value:function(){throw new Error(Oe)}}])}(),nh=function(x){function S(){var f;(0,Z.Z)(this,S);for(var A=arguments.length,_=new Array(A),k=0;k<A;k++)_[k]=arguments[k];return f=(0,E.Z)(this,S,[].concat(_)),f.client=new xt,f.movement=new xt,f.offset=new xt,f.global=new xt,f.screen=new xt,f}return(0,F.Z)(S,x),(0,V.Z)(S,[{key:"clientX",get:function(){return this.client.x}},{key:"clientY",get:function(){return this.client.y}},{key:"movementX",get:function(){return this.movement.x}},{key:"movementY",get:function(){return this.movement.y}},{key:"offsetX",get:function(){return this.offset.x}},{key:"offsetY",get:function(){return this.offset.y}},{key:"globalX",get:function(){return this.global.x}},{key:"globalY",get:function(){return this.global.y}},{key:"screenX",get:function(){return this.screen.x}},{key:"screenY",get:function(){return this.screen.y}},{key:"getModifierState",value:function(A){return"getModifierState"in this.nativeEvent&&this.nativeEvent.getModifierState(A)}},{key:"initMouseEvent",value:function(){throw new Error(Oe)}}])}(Jh),Qd=function(x){function S(){var f;(0,Z.Z)(this,S);for(var A=arguments.length,_=new Array(A),k=0;k<A;k++)_[k]=arguments[k];return f=(0,E.Z)(this,S,[].concat(_)),f.width=0,f.height=0,f.isPrimary=!1,f}return(0,F.Z)(S,x),(0,V.Z)(S,[{key:"getCoalescedEvents",value:function(){return this.type==="pointermove"||this.type==="mousemove"||this.type==="touchmove"?[this]:[]}},{key:"getPredictedEvents",value:function(){throw new Error("getPredictedEvents is not supported!")}},{key:"clone",value:function(){return this.manager.clonePointerEvent(this)}}])}(nh),Wd=function(x){function S(){return(0,Z.Z)(this,S),(0,E.Z)(this,S,arguments)}return(0,F.Z)(S,x),(0,V.Z)(S,[{key:"clone",value:function(){return this.manager.cloneWheelEvent(this)}}])}(nh),xu=function(x){function S(f,A){var _;return(0,Z.Z)(this,S),_=(0,E.Z)(this,S,[null]),_.type=f,_.detail=A==null?void 0:A.detail,A&&!("detail"in A)&&(_.detail=A),Object.assign(_,A),_}return(0,F.Z)(S,x),(0,V.Z)(S)}(Jh),Sg=function(){function x(){(0,Z.Z)(this,x),this.emitter=new H}return(0,V.Z)(x,[{key:"on",value:function(f,A,_){return this.addEventListener(f,A,_),this}},{key:"addEventListener",value:function(f,A,_){var k=!1,G=!1;if((0,Mi.Z)(_))k=_;else if(_){var ae=_.capture;k=ae===void 0?!1:ae;var ge=_.once;G=ge===void 0?!1:ge}k&&(f+="capture"),A=(0,yi.Z)(A)?A:A.handleEvent;var Ue=(0,yi.Z)(A)?void 0:A;return G?this.emitter.once(f,A,Ue):this.emitter.on(f,A,Ue),this}},{key:"off",value:function(f,A,_){return f?this.removeEventListener(f,A,_):this.removeAllEventListeners(),this}},{key:"removeAllEventListeners",value:function(){var f;(f=this.emitter)===null||f===void 0||f.removeAllListeners()}},{key:"removeEventListener",value:function(f,A,_){var k;if(!this.emitter)return this;var G=(0,Mi.Z)(_)?_:_==null?void 0:_.capture;G&&(f+="capture"),A=(0,yi.Z)(A)?A:(k=A)===null||k===void 0?void 0:k.handleEvent;var ae=(0,yi.Z)(A)?void 0:A;return this.emitter.off(f,A,ae),this}},{key:"emit",value:function(f,A){this.dispatchEvent(new xu(f,A))}},{key:"dispatchEventToSelf",value:function(f){f.target||(f.target=this),f.currentTarget=this,this.emitter.emit(f.type,f)}},{key:"dispatchEvent",value:function(f){var A=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,_=arguments.length>2?arguments[2]:void 0;if(_)return this.dispatchEventToSelf(f),!0;var k;if(this.document)k=this;else if(this.defaultView)k=this.defaultView;else{var G;k=(G=this.ownerDocument)===null||G===void 0?void 0:G.defaultView}if(k){if(f.manager=k.getEventService(),!f.manager)return!1;f.defaultPrevented=!1,f.path?f.path.length=0:f.page=[],A||(f.target=this),f.manager.dispatchEvent(f,f.type,A)}else this.dispatchEventToSelf(f);return!f.defaultPrevented}}])}(),vo=function(x){function S(){var f;(0,Z.Z)(this,S);for(var A=arguments.length,_=new Array(A),k=0;k<A;k++)_[k]=arguments[k];return f=(0,E.Z)(this,S,[].concat(_)),f.shadow=!1,f.ownerDocument=null,f.isConnected=!1,f.baseURI="",f.childNodes=[],f.nodeType=0,f.nodeName="",f.nodeValue=null,f.mutations=void 0,f.parentNode=null,f.destroyed=!1,f}return(0,F.Z)(S,x),(0,V.Z)(S,[{key:"textContent",get:function(){var A="";this.nodeName===Jt.TEXT&&(A+=this.style.text);var _=(0,Wt.Z)(this.childNodes),k;try{for(_.s();!(k=_.n()).done;){var G=k.value;G.nodeName===Jt.TEXT?A+=G.nodeValue:A+=G.textContent}}catch(ae){_.e(ae)}finally{_.f()}return A},set:function(A){var _=this;this.childNodes.slice().forEach(function(k){_.removeChild(k)}),this.nodeName===Jt.TEXT&&(this.style.text="".concat(A))}},{key:"getRootNode",value:function(){var A=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return this.parentNode?this.parentNode.getRootNode(A):A.composed&&this.host?this.host.getRootNode(A):this}},{key:"hasChildNodes",value:function(){return this.childNodes.length>0}},{key:"isDefaultNamespace",value:function(A){throw new Error(Oe)}},{key:"lookupNamespaceURI",value:function(A){throw new Error(Oe)}},{key:"lookupPrefix",value:function(A){throw new Error(Oe)}},{key:"normalize",value:function(){throw new Error(Oe)}},{key:"isEqualNode",value:function(A){return this===A}},{key:"isSameNode",value:function(A){return this.isEqualNode(A)}},{key:"parent",get:function(){return this.parentNode}},{key:"parentElement",get:function(){return null}},{key:"nextSibling",get:function(){return null}},{key:"previousSibling",get:function(){return null}},{key:"firstChild",get:function(){return this.childNodes.length>0?this.childNodes[0]:null}},{key:"lastChild",get:function(){return this.childNodes.length>0?this.childNodes[this.childNodes.length-1]:null}},{key:"compareDocumentPosition",value:function(A){if(A===this)return 0;for(var _=A,k=this,G=[_],ae=[k];(ge=_.parentNode)!==null&&ge!==void 0?ge:k.parentNode;){var ge;_=_.parentNode?(G.push(_.parentNode),_.parentNode):_,k=k.parentNode?(ae.push(k.parentNode),k.parentNode):k}if(_!==k)return S.DOCUMENT_POSITION_DISCONNECTED|S.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC|S.DOCUMENT_POSITION_PRECEDING;var Ue=G.length>ae.length?G:ae,rt=Ue===G?ae:G;if(Ue[Ue.length-rt.length]===rt[0])return Ue===G?S.DOCUMENT_POSITION_CONTAINED_BY|S.DOCUMENT_POSITION_FOLLOWING:S.DOCUMENT_POSITION_CONTAINS|S.DOCUMENT_POSITION_PRECEDING;for(var bt=Ue.length-rt.length,Zt=rt.length-1;Zt>=0;Zt--){var wn=rt[Zt],mn=Ue[bt+Zt];if(mn!==wn){var Gn=wn.parentNode.childNodes;return Gn.indexOf(wn)<Gn.indexOf(mn)?rt===G?S.DOCUMENT_POSITION_PRECEDING:S.DOCUMENT_POSITION_FOLLOWING:Ue===G?S.DOCUMENT_POSITION_PRECEDING:S.DOCUMENT_POSITION_FOLLOWING}}return S.DOCUMENT_POSITION_FOLLOWING}},{key:"contain",value:function(A){return this.contains(A)}},{key:"contains",value:function(A){for(var _=A;_&&this!==_;)_=_.parentNode;return!!_}},{key:"getAncestor",value:function(A){for(var _=this;A>0&&_;)_=_.parentNode,A--;return _}},{key:"forEach",value:function(A){for(var _=[this];_.length>0;){var k=_.pop(),G=A(k);if(G===!1)break;for(var ae=k.childNodes.length-1;ae>=0;ae--)_.push(k.childNodes[ae])}}}],[{key:"isNode",value:function(A){return!!A.childNodes}}])}(Sg);vo.DOCUMENT_POSITION_DISCONNECTED=1,vo.DOCUMENT_POSITION_PRECEDING=2,vo.DOCUMENT_POSITION_FOLLOWING=4,vo.DOCUMENT_POSITION_CONTAINS=8,vo.DOCUMENT_POSITION_CONTAINED_BY=16,vo.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC=32;var gf=2048,mf=function(){function x(S,f){var A=this;(0,Z.Z)(this,x),this.nativeHTMLMap=new WeakMap,this.cursor="default",this.mappingTable={},this.mappingState={trackingData:{}},this.eventPool=new Map,this.tmpMatrix=j.create(),this.tmpVec3=D.Ue(),this.onPointerDown=function(_){var k=A.createPointerEvent(_);if(A.dispatchEvent(k,"pointerdown"),k.pointerType==="touch")A.dispatchEvent(k,"touchstart");else if(k.pointerType==="mouse"||k.pointerType==="pen"){var G=k.button===2;A.dispatchEvent(k,G?"rightdown":"mousedown")}var ae=A.trackingData(_.pointerId);ae.pressTargetsByButton[_.button]=k.composedPath(),A.freeEvent(k)},this.onPointerUp=function(_){var k=yu.now(),G=A.createPointerEvent(_,void 0,void 0,A.context.config.alwaysTriggerPointerEventOnCanvas?A.rootTarget:void 0);if(A.dispatchEvent(G,"pointerup"),G.pointerType==="touch")A.dispatchEvent(G,"touchend");else if(G.pointerType==="mouse"||G.pointerType==="pen"){var ae=G.button===2;A.dispatchEvent(G,ae?"rightup":"mouseup")}var ge=A.trackingData(_.pointerId),Ue=A.findMountedTarget(ge.pressTargetsByButton[_.button]),rt=Ue;if(Ue&&!G.composedPath().includes(Ue)){for(var bt=Ue;bt&&!G.composedPath().includes(bt);){if(G.currentTarget=bt,A.notifyTarget(G,"pointerupoutside"),G.pointerType==="touch")A.notifyTarget(G,"touchendoutside");else if(G.pointerType==="mouse"||G.pointerType==="pen"){var Zt=G.button===2;A.notifyTarget(G,Zt?"rightupoutside":"mouseupoutside")}vo.isNode(bt)&&(bt=bt.parentNode)}delete ge.pressTargetsByButton[_.button],rt=bt}if(rt){var wn,mn=A.clonePointerEvent(G,"click");mn.target=rt,mn.path=[],ge.clicksByButton[_.button]||(ge.clicksByButton[_.button]={clickCount:0,target:mn.target,timeStamp:k});var Gn=A.context.renderingContext.root.ownerDocument.defaultView,ir=ge.clicksByButton[_.button];ir.target===mn.target&&k-ir.timeStamp<Gn.getConfig().dblClickSpeed?++ir.clickCount:ir.clickCount=1,ir.target=mn.target,ir.timeStamp=k,mn.detail=ir.clickCount,(wn=G.detail)!==null&&wn!==void 0&&wn.preventClick||(!A.context.config.useNativeClickEvent&&(mn.pointerType==="mouse"||mn.pointerType==="touch")&&A.dispatchEvent(mn,"click"),A.dispatchEvent(mn,"pointertap")),A.freeEvent(mn)}A.freeEvent(G)},this.onPointerMove=function(_){var k=A.createPointerEvent(_,void 0,void 0,A.context.config.alwaysTriggerPointerEventOnCanvas?A.rootTarget:void 0),G=k.pointerType==="mouse"||k.pointerType==="pen",ae=A.trackingData(_.pointerId),ge=A.findMountedTarget(ae.overTargets);if(ae.overTargets&&ge!==k.target){var Ue=_.type==="mousemove"?"mouseout":"pointerout",rt=A.createPointerEvent(_,Ue,ge||void 0);if(A.dispatchEvent(rt,"pointerout"),G&&A.dispatchEvent(rt,"mouseout"),!k.composedPath().includes(ge)){var bt=A.createPointerEvent(_,"pointerleave",ge||void 0);for(bt.eventPhase=bt.AT_TARGET;bt.target&&!k.composedPath().includes(bt.target);)bt.currentTarget=bt.target,A.notifyTarget(bt),G&&A.notifyTarget(bt,"mouseleave"),vo.isNode(bt.target)&&(bt.target=bt.target.parentNode);A.freeEvent(bt)}A.freeEvent(rt)}if(ge!==k.target){var Zt=_.type==="mousemove"?"mouseover":"pointerover",wn=A.clonePointerEvent(k,Zt);A.dispatchEvent(wn,"pointerover"),G&&A.dispatchEvent(wn,"mouseover");for(var mn=ge&&vo.isNode(ge)&&ge.parentNode;mn&&mn!==(vo.isNode(A.rootTarget)&&A.rootTarget.parentNode)&&mn!==k.target;)mn=mn.parentNode;var Gn=!mn||mn===(vo.isNode(A.rootTarget)&&A.rootTarget.parentNode);if(Gn){var ir=A.clonePointerEvent(k,"pointerenter");for(ir.eventPhase=ir.AT_TARGET;ir.target&&ir.target!==ge&&ir.target!==(vo.isNode(A.rootTarget)&&A.rootTarget.parentNode);)ir.currentTarget=ir.target,A.notifyTarget(ir),G&&A.notifyTarget(ir,"mouseenter"),vo.isNode(ir.target)&&(ir.target=ir.target.parentNode);A.freeEvent(ir)}A.freeEvent(wn)}A.dispatchEvent(k,"pointermove"),k.pointerType==="touch"&&A.dispatchEvent(k,"touchmove"),G&&(A.dispatchEvent(k,"mousemove"),A.cursor=A.getCursor(k.target)),ae.overTargets=k.composedPath(),A.freeEvent(k)},this.onPointerOut=function(_){var k=A.trackingData(_.pointerId);if(k.overTargets){var G=_.pointerType==="mouse"||_.pointerType==="pen",ae=A.findMountedTarget(k.overTargets),ge=A.createPointerEvent(_,"pointerout",ae||void 0);A.dispatchEvent(ge),G&&A.dispatchEvent(ge,"mouseout");var Ue=A.createPointerEvent(_,"pointerleave",ae||void 0);for(Ue.eventPhase=Ue.AT_TARGET;Ue.target&&Ue.target!==(vo.isNode(A.rootTarget)&&A.rootTarget.parentNode);)Ue.currentTarget=Ue.target,A.notifyTarget(Ue),G&&A.notifyTarget(Ue,"mouseleave"),vo.isNode(Ue.target)&&(Ue.target=Ue.target.parentNode);k.overTargets=null,A.freeEvent(ge),A.freeEvent(Ue)}A.cursor=null},this.onPointerOver=function(_){var k=A.trackingData(_.pointerId),G=A.createPointerEvent(_),ae=G.pointerType==="mouse"||G.pointerType==="pen";A.dispatchEvent(G,"pointerover"),ae&&A.dispatchEvent(G,"mouseover"),G.pointerType==="mouse"&&(A.cursor=A.getCursor(G.target));var ge=A.clonePointerEvent(G,"pointerenter");for(ge.eventPhase=ge.AT_TARGET;ge.target&&ge.target!==(vo.isNode(A.rootTarget)&&A.rootTarget.parentNode);)ge.currentTarget=ge.target,A.notifyTarget(ge),ae&&A.notifyTarget(ge,"mouseenter"),vo.isNode(ge.target)&&(ge.target=ge.target.parentNode);k.overTargets=G.composedPath(),A.freeEvent(G),A.freeEvent(ge)},this.onPointerUpOutside=function(_){var k=A.trackingData(_.pointerId),G=A.findMountedTarget(k.pressTargetsByButton[_.button]),ae=A.createPointerEvent(_);if(G){for(var ge=G;ge;)ae.currentTarget=ge,A.notifyTarget(ae,"pointerupoutside"),ae.pointerType==="touch"||(ae.pointerType==="mouse"||ae.pointerType==="pen")&&A.notifyTarget(ae,ae.button===2?"rightupoutside":"mouseupoutside"),vo.isNode(ge)&&(ge=ge.parentNode);delete k.pressTargetsByButton[_.button]}A.freeEvent(ae)},this.onWheel=function(_){var k=A.createWheelEvent(_);A.dispatchEvent(k),A.freeEvent(k)},this.onClick=function(_){if(A.context.config.useNativeClickEvent){var k=A.createPointerEvent(_);A.dispatchEvent(k),A.freeEvent(k)}},this.onPointerCancel=function(_){var k=A.createPointerEvent(_,void 0,void 0,A.context.config.alwaysTriggerPointerEventOnCanvas?A.rootTarget:void 0);A.dispatchEvent(k),A.freeEvent(k)},this.globalRuntime=S,this.context=f}return(0,V.Z)(x,[{key:"init",value:function(){this.rootTarget=this.context.renderingContext.root.parentNode,this.addEventMapping("pointerdown",this.onPointerDown),this.addEventMapping("pointerup",this.onPointerUp),this.addEventMapping("pointermove",this.onPointerMove),this.addEventMapping("pointerout",this.onPointerOut),this.addEventMapping("pointerleave",this.onPointerOut),this.addEventMapping("pointercancel",this.onPointerCancel),this.addEventMapping("pointerover",this.onPointerOver),this.addEventMapping("pointerupoutside",this.onPointerUpOutside),this.addEventMapping("wheel",this.onWheel),this.addEventMapping("click",this.onClick)}},{key:"destroy",value:function(){this.mappingTable={},this.mappingState={},this.eventPool.clear()}},{key:"getScale",value:function(){var f=this.context.contextService.getBoundingClientRect(),A=1,_=1,k=this.context.contextService.getDomElement();if(k&&f){var G=k.offsetWidth,ae=k.offsetHeight;G&&ae&&(A=f.width/G,_=f.height/ae)}return{scaleX:A,scaleY:_,bbox:f}}},{key:"client2Viewport",value:function(f){var A=this.getScale(),_=A.scaleX,k=A.scaleY,G=A.bbox;return new xt((f.x-((G==null?void 0:G.left)||0))/_,(f.y-((G==null?void 0:G.top)||0))/k)}},{key:"viewport2Client",value:function(f){var A=this.getScale(),_=A.scaleX,k=A.scaleY,G=A.bbox;return new xt((f.x+((G==null?void 0:G.left)||0))*_,(f.y+((G==null?void 0:G.top)||0))*k)}},{key:"viewport2Canvas",value:function(f){var A=f.x,_=f.y,k=this.rootTarget.defaultView,G=k.getCamera(),ae=this.context.config,ge=ae.width,Ue=ae.height,rt=G.getPerspectiveInverse(),bt=G.getWorldTransform(),Zt=j.multiply(this.tmpMatrix,bt,rt),wn=D.t8(this.tmpVec3,A/ge*2-1,(1-_/Ue)*2-1,0);return D.fF(wn,wn,Zt),new xt(wn[0],wn[1])}},{key:"canvas2Viewport",value:function(f){var A=this.rootTarget.defaultView,_=A.getCamera(),k=_.getPerspective(),G=_.getViewTransform(),ae=j.multiply(this.tmpMatrix,k,G),ge=D.t8(this.tmpVec3,f.x,f.y,0);D.fF(this.tmpVec3,this.tmpVec3,ae);var Ue=this.context.config,rt=Ue.width,bt=Ue.height;return new xt((ge[0]+1)/2*rt,(1-(ge[1]+1)/2)*bt)}},{key:"setPickHandler",value:function(f){this.pickHandler=f}},{key:"addEventMapping",value:function(f,A){this.mappingTable[f]||(this.mappingTable[f]=[]),this.mappingTable[f].push({fn:A,priority:0}),this.mappingTable[f].sort(function(_,k){return _.priority-k.priority})}},{key:"mapEvent",value:function(f){if(this.rootTarget){var A=this.mappingTable[f.type];if(A)for(var _=0,k=A.length;_<k;_++)A[_].fn(f);else console.warn("[EventService]: Event mapping not defined for ".concat(f.type))}}},{key:"dispatchEvent",value:function(f,A,_){if(!_)f.propagationStopped=!1,f.propagationImmediatelyStopped=!1,this.propagate(f,A);else{f.eventPhase=f.AT_TARGET;var k=this.rootTarget.defaultView||null;f.currentTarget=k,this.notifyListeners(f,A)}}},{key:"propagate",value:function(f,A){if(f.target){var _=f.composedPath();f.eventPhase=f.CAPTURING_PHASE;for(var k=_.length-1;k>=1;k--)if(f.currentTarget=_[k],this.notifyTarget(f,A),f.propagationStopped||f.propagationImmediatelyStopped)return;if(f.eventPhase=f.AT_TARGET,f.currentTarget=f.target,this.notifyTarget(f,A),!(f.propagationStopped||f.propagationImmediatelyStopped)){var G=_.indexOf(f.currentTarget);f.eventPhase=f.BUBBLING_PHASE;for(var ae=G+1;ae<_.length;ae++)if(f.currentTarget=_[ae],this.notifyTarget(f,A),f.propagationStopped||f.propagationImmediatelyStopped)return}}}},{key:"propagationPath",value:function(f){var A=[f],_=this.rootTarget.defaultView||null;if(_&&_===f)return A.unshift(_.document),A;for(var k=0;k<gf&&f!==this.rootTarget;k++)vo.isNode(f)&&f.parentNode&&(A.push(f.parentNode),f=f.parentNode);return _&&A.push(_),A}},{key:"hitTest",value:function(f){var A=f.viewportX,_=f.viewportY,k=this.context.config,G=k.width,ae=k.height,ge=k.disableHitTesting;return A<0||_<0||A>G||_>ae?null:!ge&&this.pickHandler(f)||this.rootTarget||null}},{key:"isNativeEventFromCanvas",value:function(f,A){var _,k=A==null?void 0:A.target;if((_=k)!==null&&_!==void 0&&_.shadowRoot&&(k=A.composedPath()[0]),k){if(k===f)return!0;if(f&&f.contains)return f.contains(k)}return A!=null&&A.composedPath?A.composedPath().indexOf(f)>-1:!1}},{key:"getExistedHTML",value:function(f){if(f.nativeEvent.composedPath)for(var A=0,_=f.nativeEvent.composedPath();A<_.length;A++){var k=_[A],G=this.nativeHTMLMap.get(k);if(G)return G}return null}},{key:"pickTarget",value:function(f){return this.hitTest({clientX:f.clientX,clientY:f.clientY,viewportX:f.viewportX,viewportY:f.viewportY,x:f.canvasX,y:f.canvasY})}},{key:"createPointerEvent",value:function(f,A,_,k){var G=this.allocateEvent(Qd);this.copyPointerData(f,G),this.copyMouseData(f,G),this.copyData(f,G),G.nativeEvent=f.nativeEvent,G.originalEvent=f;var ae=this.getExistedHTML(G),ge=this.context.contextService.getDomElement();return G.target=_!=null?_:ae||this.isNativeEventFromCanvas(ge,G.nativeEvent)&&this.pickTarget(G)||k,typeof A=="string"&&(G.type=A),G}},{key:"createWheelEvent",value:function(f){var A=this.allocateEvent(Wd);this.copyWheelData(f,A),this.copyMouseData(f,A),this.copyData(f,A),A.nativeEvent=f.nativeEvent,A.originalEvent=f;var _=this.getExistedHTML(A),k=this.context.contextService.getDomElement();return A.target=_||this.isNativeEventFromCanvas(k,A.nativeEvent)&&this.pickTarget(A),A}},{key:"trackingData",value:function(f){return this.mappingState.trackingData[f]||(this.mappingState.trackingData[f]={pressTargetsByButton:{},clicksByButton:{},overTarget:null}),this.mappingState.trackingData[f]}},{key:"cloneWheelEvent",value:function(f){var A=this.allocateEvent(Wd);return A.nativeEvent=f.nativeEvent,A.originalEvent=f.originalEvent,this.copyWheelData(f,A),this.copyMouseData(f,A),this.copyData(f,A),A.target=f.target,A.path=f.composedPath().slice(),A.type=f.type,A}},{key:"clonePointerEvent",value:function(f,A){var _=this.allocateEvent(Qd);return _.nativeEvent=f.nativeEvent,_.originalEvent=f.originalEvent,this.copyPointerData(f,_),this.copyMouseData(f,_),this.copyData(f,_),_.target=f.target,_.path=f.composedPath().slice(),_.type=A!=null?A:_.type,_}},{key:"copyPointerData",value:function(f,A){A.pointerId=f.pointerId,A.width=f.width,A.height=f.height,A.isPrimary=f.isPrimary,A.pointerType=f.pointerType,A.pressure=f.pressure,A.tangentialPressure=f.tangentialPressure,A.tiltX=f.tiltX,A.tiltY=f.tiltY,A.twist=f.twist}},{key:"copyMouseData",value:function(f,A){A.altKey=f.altKey,A.button=f.button,A.buttons=f.buttons,A.ctrlKey=f.ctrlKey,A.metaKey=f.metaKey,A.shiftKey=f.shiftKey,A.client.copyFrom(f.client),A.movement.copyFrom(f.movement),A.canvas.copyFrom(f.canvas),A.screen.copyFrom(f.screen),A.global.copyFrom(f.global),A.offset.copyFrom(f.offset)}},{key:"copyWheelData",value:function(f,A){A.deltaMode=f.deltaMode,A.deltaX=f.deltaX,A.deltaY=f.deltaY,A.deltaZ=f.deltaZ}},{key:"copyData",value:function(f,A){A.isTrusted=f.isTrusted,A.timeStamp=yu.now(),A.type=f.type,A.detail=f.detail,A.view=f.view,A.page.copyFrom(f.page),A.viewport.copyFrom(f.viewport)}},{key:"allocateEvent",value:function(f){this.eventPool.has(f)||this.eventPool.set(f,[]);var A=this.eventPool.get(f).pop()||new f(this);return A.eventPhase=A.NONE,A.currentTarget=null,A.path=[],A.target=null,A}},{key:"freeEvent",value:function(f){if(f.manager!==this)throw new Error("It is illegal to free an event not managed by this EventBoundary!");var A=f.constructor;this.eventPool.has(A)||this.eventPool.set(A,[]),this.eventPool.get(A).push(f)}},{key:"notifyTarget",value:function(f,A){A=A!=null?A:f.type;var _=f.eventPhase===f.CAPTURING_PHASE||f.eventPhase===f.AT_TARGET?"".concat(A,"capture"):A;this.notifyListeners(f,_),f.eventPhase===f.AT_TARGET&&this.notifyListeners(f,A)}},{key:"notifyListeners",value:function(f,A){var _=f.currentTarget.emitter,k=_._events[A];if(k)if("fn"in k)k.once&&_.removeListener(A,k.fn,void 0,!0),k.fn.call(f.currentTarget||k.context,f);else for(var G=0;G<k.length&&!f.propagationImmediatelyStopped;G++)k[G].once&&_.removeListener(A,k[G].fn,void 0,!0),k[G].fn.call(f.currentTarget||k[G].context,f)}},{key:"findMountedTarget",value:function(f){if(!f)return null;for(var A=f[f.length-1],_=f.length-2;_>=0;_--){var k=f[_];if(k===this.rootTarget||vo.isNode(k)&&k.parentNode===A)A=f[_];else break}return A}},{key:"getCursor",value:function(f){for(var A=f;A;){var _=Gl(A)&&A.getAttribute("cursor");if(_)return _;A=vo.isNode(A)&&A.parentNode}}}])}(),Np=function(){function x(){(0,Z.Z)(this,x)}return(0,V.Z)(x,[{key:"getOrCreateCanvas",value:function(f,A){if(this.canvas)return this.canvas;if(f||Oi.offscreenCanvas)this.canvas=f||Oi.offscreenCanvas,this.context=this.canvas.getContext("2d",(0,m.Z)({willReadFrequently:!0},A));else try{this.canvas=new window.OffscreenCanvas(0,0),this.context=this.canvas.getContext("2d",(0,m.Z)({willReadFrequently:!0},A)),(!this.context||!this.context.measureText)&&(this.canvas=document.createElement("canvas"),this.context=this.canvas.getContext("2d"))}catch(_){this.canvas=document.createElement("canvas"),this.context=this.canvas.getContext("2d",(0,m.Z)({willReadFrequently:!0},A))}return this.canvas.width=10,this.canvas.height=10,this.canvas}},{key:"getOrCreateContext",value:function(f,A){return this.context?this.context:(this.getOrCreateCanvas(f,A),this.context)}}],[{key:"createCanvas",value:function(){try{return new window.OffscreenCanvas(0,0)}catch(f){}try{return document.createElement("canvas")}catch(f){}return null}}])}(),rh=function(x){return x[x.CAMERA_CHANGED=0]="CAMERA_CHANGED",x[x.DISPLAY_OBJECT_CHANGED=1]="DISPLAY_OBJECT_CHANGED",x[x.NONE=2]="NONE",x}({}),Mc=function(){function x(S,f){(0,Z.Z)(this,x),this.inited=!1,this.stats={total:0,rendered:0},this.zIndexCounter=0,this.hooks={init:new Fc,initAsync:new Yu,dirtycheck:new Gu,cull:new Gu,beginFrame:new Fc,beforeRender:new Fc,render:new Fc,afterRender:new Fc,endFrame:new Fc,destroy:new Fc,pick:new Ui,pickSync:new Gu,pointerDown:new Fc,pointerUp:new Fc,pointerMove:new Fc,pointerOut:new Fc,pointerOver:new Fc,pointerWheel:new Fc,pointerCancel:new Fc,click:new Fc},this.globalRuntime=S,this.context=f}return(0,V.Z)(x,[{key:"init",value:function(f){var A=this,_=(0,m.Z)((0,m.Z)({},this.globalRuntime),this.context);this.context.renderingPlugins.forEach(function(k){k.apply(_,A.globalRuntime)}),this.hooks.init.call(),this.hooks.initAsync.getCallbacksNum()===0?(this.inited=!0,f()):this.hooks.initAsync.promise().then(function(){A.inited=!0,f()}).catch(function(k){})}},{key:"getStats",value:function(){return this.stats}},{key:"disableDirtyRectangleRendering",value:function(){var f=this.context.config.renderer,A=f.getConfig(),_=A.enableDirtyRectangleRendering;return!_||this.context.renderingContext.renderReasons.has(rh.CAMERA_CHANGED)}},{key:"render",value:function(f,A,_){var k=this,G=f.getConfig(),ae=this.context.renderingContext;if(this.stats.total=0,this.stats.rendered=0,this.zIndexCounter=0,this.globalRuntime.sceneGraphService.syncHierarchy(ae.root),this.globalRuntime.sceneGraphService.notifyMutationObservers(f),ae.renderReasons.size&&this.inited){ae.dirtyRectangleRenderingDisabled=this.disableDirtyRectangleRendering();var ge=ae.renderReasons.size===1&&ae.renderReasons.has(rh.CAMERA_CHANGED),Ue=!G.disableRenderHooks||!ge;Ue&&this.renderDisplayObject(ae.root,G,ae),this.hooks.beginFrame.call(A),Ue&&ae.renderListCurrentFrame.forEach(function(rt){k.hooks.beforeRender.call(rt),k.hooks.render.call(rt),k.hooks.afterRender.call(rt)}),this.hooks.endFrame.call(A),ae.renderListCurrentFrame=[],ae.renderReasons.clear(),_()}}},{key:"renderDisplayObject",value:function(f,A,_){var k=this,G=A.renderer.getConfig(),ae=G.enableDirtyCheck,ge=G.enableCulling;function Ue(Gn){var ir=Gn.renderable,tr=Gn.sortable,Zn=ae?ir.dirty||_.dirtyRectangleRenderingDisabled?Gn:null:Gn,Tr=null;Zn&&(Tr=ge?k.hooks.cull.call(Zn,k.context.camera):Zn,Tr&&(k.stats.rendered+=1,_.renderListCurrentFrame.push(Tr))),Gn.dirty(!1),tr.renderOrder=k.zIndexCounter,k.zIndexCounter+=1,k.stats.total+=1,tr.dirty&&(k.sort(Gn,tr),tr.dirty=!1,tr.dirtyChildren=[],tr.dirtyReason=void 0)}for(var rt=[f];rt.length>0;){var bt,Zt=rt.pop();Ue(Zt);for(var wn=((bt=Zt.sortable)===null||bt===void 0||(bt=bt.sorted)===null||bt===void 0?void 0:bt.length)>0?Zt.sortable.sorted:Zt.childNodes,mn=wn.length-1;mn>=0;mn--)rt.push(wn[mn])}}},{key:"sort",value:function(f,A){var _,k;(A==null||(_=A.sorted)===null||_===void 0?void 0:_.length)>0&&A.dirtyReason!==Di.Z_INDEX_CHANGED?A.dirtyChildren.forEach(function(G){var ae=A.sorted.indexOf(G);ae>-1&&A.sorted.splice(ae,1);var ge=f.childNodes.indexOf(G);if(ge>-1)if(A.sorted.length===0)A.sorted.push(G);else{var Ue=Ea(A.sorted,G);A.sorted.splice(Ue,0,G)}}):A.sorted=f.childNodes.slice().sort(Rl),((k=A.sorted)===null||k===void 0?void 0:k.length)>0&&f.childNodes.filter(function(G){return G.parsedStyle.zIndex}).length===0&&(A.sorted=[])}},{key:"destroy",value:function(){this.inited=!1,this.hooks.destroy.call()}},{key:"dirty",value:function(){this.context.renderingContext.renderReasons.add(rh.DISPLAY_OBJECT_CHANGED)}}])}(),ih=/\[\s*(.*)=(.*)\s*\]/,Fp=function(){function x(){(0,Z.Z)(this,x)}return(0,V.Z)(x,[{key:"selectOne",value:function(f,A){var _=this;if(f.startsWith("."))return A.find(function(ge){return((ge==null?void 0:ge.classList)||[]).indexOf(_.getIdOrClassname(f))>-1});if(f.startsWith("#"))return A.find(function(ge){return ge.id===_.getIdOrClassname(f)});if(f.startsWith("[")){var k=this.getAttribute(f),G=k.name,ae=k.value;return G?A.find(function(ge){return A!==ge&&(G==="name"?ge.name===ae:_.attributeToString(ge,G)===ae)}):null}return A.find(function(ge){return A!==ge&&ge.nodeName===f})}},{key:"selectAll",value:function(f,A){var _=this;if(f.startsWith("."))return A.findAll(function(ge){return A!==ge&&((ge==null?void 0:ge.classList)||[]).indexOf(_.getIdOrClassname(f))>-1});if(f.startsWith("#"))return A.findAll(function(ge){return A!==ge&&ge.id===_.getIdOrClassname(f)});if(f.startsWith("[")){var k=this.getAttribute(f),G=k.name,ae=k.value;return G?A.findAll(function(ge){return A!==ge&&(G==="name"?ge.name===ae:_.attributeToString(ge,G)===ae)}):[]}return A.findAll(function(ge){return A!==ge&&ge.nodeName===f})}},{key:"is",value:function(f,A){if(f.startsWith("."))return A.className===this.getIdOrClassname(f);if(f.startsWith("#"))return A.id===this.getIdOrClassname(f);if(f.startsWith("[")){var _=this.getAttribute(f),k=_.name,G=_.value;return k==="name"?A.name===G:this.attributeToString(A,k)===G}return A.nodeName===f}},{key:"getIdOrClassname",value:function(f){return f.substring(1)}},{key:"getAttribute",value:function(f){var A=f.match(ih),_="",k="";return A&&A.length>2&&(_=A[1].replace(/"/g,""),k=A[2].replace(/"/g,"")),{name:_,value:k}}},{key:"attributeToString",value:function(f,A){if(!f.getAttribute)return"";var _=f.getAttribute(A);return(0,$e.Z)(_)?"":_.toString?_.toString():""}}])}(),Ra=function(x){return x.ATTR_MODIFIED="DOMAttrModified",x.INSERTED="DOMNodeInserted",x.MOUNTED="DOMNodeInsertedIntoDocument",x.REMOVED="removed",x.UNMOUNTED="DOMNodeRemovedFromDocument",x.REPARENT="reparent",x.DESTROY="destroy",x.BOUNDS_CHANGED="bounds-changed",x.CULLED="culled",x}({}),Hu=function(x){function S(f,A,_,k,G,ae,ge,Ue){var rt;return(0,Z.Z)(this,S),rt=(0,E.Z)(this,S,[null]),rt.relatedNode=A,rt.prevValue=_,rt.newValue=k,rt.attrName=G,rt.attrChange=ae,rt.prevParsedValue=ge,rt.newParsedValue=Ue,rt.type=f,rt}return(0,F.Z)(S,x),(0,V.Z)(S)}(Jh);Hu.ADDITION=2,Hu.MODIFICATION=1,Hu.REMOVAL=3;var vf=new Hu(Ra.REPARENT,null,"","","",0,"",""),_d=we.Ue(),wh=D.Ue(),Iu=D.al(1,1,1),yf=j.create(),BA=we.Ue(),Lc=D.Ue(),xf=j.create(),Sh=he.Ue(),bf=D.Ue(),Yf=he.Ue(),RA=D.Ue(),wd=D.Ue(),sh=D.Ue(),Sd=j.create(),IA=he.Ue(),NA=he.Ue(),qf=he.Ue(),Mg=function(){function x(S){(0,Z.Z)(this,x),this.displayObjectDependencyMap=new WeakMap,this.runtime=S}return(0,V.Z)(x,[{key:"matches",value:function(f,A){return this.runtime.sceneGraphSelector.is(f,A)}},{key:"querySelector",value:function(f,A){return this.runtime.sceneGraphSelector.selectOne(f,A)}},{key:"querySelectorAll",value:function(f,A){return this.runtime.sceneGraphSelector.selectAll(f,A)}},{key:"attach",value:function(f,A,_){var k,G=!1;f.parentNode&&(G=f.parentNode!==A,this.detach(f));var ae=f.nodeName===Jt.FRAGMENT,ge=Hl(A);f.parentNode=A;var Ue=ae?f.childNodes:[f];(0,ve.Z)(_)?Ue.forEach(function(Gn){A.childNodes.splice(_,0,Gn),Gn.parentNode=A}):Ue.forEach(function(Gn){A.childNodes.push(Gn),Gn.parentNode=A});var rt=A,bt=rt.sortable;if((bt!=null&&(k=bt.sorted)!==null&&k!==void 0&&k.length||bt.dirty||f.parsedStyle.zIndex)&&(bt.dirtyChildren.indexOf(f)===-1&&bt.dirtyChildren.push(f),bt.dirty=!0,bt.dirtyReason=Di.ADDED),!ge){if(ae)this.dirtyFragment(f);else{var Zt=f.transformable;Zt&&this.dirtyWorldTransform(f,Zt)}if(G){var wn,mn=((wn=A.ownerDocument)===null||wn===void 0||(wn=wn.defaultView)===null||wn===void 0||(wn=wn.getConfig())===null||wn===void 0||(wn=wn.future)===null||wn===void 0?void 0:wn.experimentalCancelEventPropagation)===!0;f.dispatchEvent(vf,mn,mn)}}}},{key:"detach",value:function(f){var A,_;if(f.parentNode){var k=f.transformable,G=f.parentNode,ae=G.sortable;(ae!=null&&(A=ae.sorted)!==null&&A!==void 0&&A.length||(_=f.style)!==null&&_!==void 0&&_.zIndex)&&(ae.dirtyChildren.indexOf(f)===-1&&ae.dirtyChildren.push(f),ae.dirty=!0,ae.dirtyReason=Di.REMOVED);var ge=f.parentNode.childNodes.indexOf(f);ge>-1&&f.parentNode.childNodes.splice(ge,1),k&&this.dirtyWorldTransform(f,k),f.parentNode=null}}},{key:"getLocalPosition",value:function(f){return f.transformable.localPosition}},{key:"getLocalRotation",value:function(f){return f.transformable.localRotation}},{key:"getLocalScale",value:function(f){return f.transformable.localScale}},{key:"getLocalSkew",value:function(f){return f.transformable.localSkew}},{key:"getLocalTransform",value:function(f){var A=f.transformable;return Aa(A),A.localTransform}},{key:"setLocalPosition",value:function(f,A){var _,k=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,G=f.transformable;wd[0]=A[0],wd[1]=A[1],wd[2]=(_=A[2])!==null&&_!==void 0?_:0,!D.fS(G.localPosition,wd)&&(D.JG(G.localPosition,wd),k&&this.dirtyLocalTransform(f,G))}},{key:"translateLocal",value:function(f,A){var _=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,k=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0;typeof A=="number"&&(A=D.al(A,_,k));var G=f.transformable;D.fS(A,wh)||(D.VC(A,A,G.localRotation),D.IH(G.localPosition,G.localPosition,A),this.dirtyLocalTransform(f,G))}},{key:"setLocalRotation",value:function(f,A,_,k,G){var ae=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0;typeof A=="number"&&(A=he.t8(Sh,A,_,k,G));var ge=f.transformable;he.JG(ge.localRotation,A),ae&&this.dirtyLocalTransform(f,ge)}},{key:"rotateLocal",value:function(f,A){var _=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,k=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0;typeof A=="number"&&(A=D.al(A,_,k));var G=f.transformable;he.Su(NA,A[0],A[1],A[2]),he.dC(G.localRotation,G.localRotation,NA),this.dirtyLocalTransform(f,G)}},{key:"setLocalScale",value:function(f,A){var _,k=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,G=f.transformable;D.t8(Lc,A[0],A[1],(_=A[2])!==null&&_!==void 0?_:G.localScale[2]),!D.fS(Lc,G.localScale)&&(D.JG(G.localScale,Lc),k&&this.dirtyLocalTransform(f,G))}},{key:"scaleLocal",value:function(f,A){var _,k=f.transformable;D.Jp(k.localScale,k.localScale,D.t8(Lc,A[0],A[1],(_=A[2])!==null&&_!==void 0?_:1)),this.dirtyLocalTransform(f,k)}},{key:"setLocalSkew",value:function(f,A,_){var k=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0;typeof A=="number"&&(A=we.t8(BA,A,_));var G=f.transformable;we.JG(G.localSkew,A),k&&this.dirtyLocalTransform(f,G)}},{key:"setLocalEulerAngles",value:function(f,A){var _=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,k=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,G=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0;typeof A=="number"&&(A=D.al(A,_,k));var ae=f.transformable;he.Su(ae.localRotation,A[0],A[1],A[2]),G&&this.dirtyLocalTransform(f,ae)}},{key:"setLocalTransform",value:function(f,A){var _=j.getTranslation(bf,A),k=j.getRotation(Yf,A),G=j.getScaling(RA,A);this.setLocalScale(f,G,!1),this.setLocalPosition(f,_,!1),this.setLocalRotation(f,k,void 0,void 0,void 0,!1),this.dirtyLocalTransform(f,f.transformable)}},{key:"resetLocalTransform",value:function(f){this.setLocalScale(f,Iu,!1),this.setLocalPosition(f,wh,!1),this.setLocalEulerAngles(f,wh,void 0,void 0,!1),this.setLocalSkew(f,_d,void 0,!1),this.dirtyLocalTransform(f,f.transformable)}},{key:"getPosition",value:function(f){var A=f.transformable;return j.getTranslation(A.position,this.getWorldTransform(f,A))}},{key:"getRotation",value:function(f){var A=f.transformable;return j.getRotation(A.rotation,this.getWorldTransform(f,A))}},{key:"getScale",value:function(f){var A=f.transformable;return j.getScaling(A.scaling,this.getWorldTransform(f,A))}},{key:"getOrigin",value:function(f){return f.getGeometryBounds(),f.transformable.origin}},{key:"getWorldTransform",value:function(f){var A=arguments.length>1&&arguments[1]!==void 0?arguments[1]:f.transformable;return!A.localDirtyFlag&&!A.dirtyFlag||(f.parentNode&&f.parentNode.transformable&&this.getWorldTransform(f.parentNode),this.internalUpdateTransform(f)),A.worldTransform}},{key:"setPosition",value:function(f,A){var _,k=f.transformable;if(sh[0]=A[0],sh[1]=A[1],sh[2]=(_=A[2])!==null&&_!==void 0?_:0,!D.fS(this.getPosition(f),sh)){if(D.JG(k.position,sh),f.parentNode===null||!f.parentNode.transformable)D.JG(k.localPosition,sh);else{var G=f.parentNode.transformable;j.copy(Sd,G.worldTransform),j.invert(Sd,Sd),D.fF(k.localPosition,sh,Sd)}this.dirtyLocalTransform(f,k)}}},{key:"translate",value:function(f,A){var _=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,k=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0;typeof A=="number"&&(A=D.t8(Lc,A,_,k)),!D.fS(A,wh)&&(D.IH(Lc,this.getPosition(f),A),this.setPosition(f,Lc))}},{key:"setRotation",value:function(f,A,_,k,G){var ae=f.transformable;if(typeof A=="number"&&(A=he.al(A,_,k,G)),f.parentNode===null||!f.parentNode.transformable)this.setLocalRotation(f,A);else{var ge=this.getRotation(f.parentNode);he.JG(Sh,ge),he.U_(Sh,Sh),he.Jp(ae.localRotation,Sh,A),he.Fv(ae.localRotation,ae.localRotation),this.dirtyLocalTransform(f,ae)}}},{key:"rotate",value:function(f,A){var _=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,k=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0;typeof A=="number"&&(A=D.al(A,_,k));var G=f.transformable;if(f.parentNode===null||!f.parentNode.transformable)this.rotateLocal(f,A);else{var ae=Sh;he.Su(ae,A[0],A[1],A[2]);var ge=this.getRotation(f),Ue=this.getRotation(f.parentNode);he.JG(qf,Ue),he.U_(qf,qf),he.Jp(ae,qf,ae),he.Jp(G.localRotation,ae,ge),he.Fv(G.localRotation,G.localRotation),this.dirtyLocalTransform(f,G)}}},{key:"setOrigin",value:function(f,A){var _=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,k=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0;typeof A=="number"&&(A=[A,_,k]);var G=f.transformable;if(!(A[0]===G.origin[0]&&A[1]===G.origin[1]&&A[2]===G.origin[2])){var ae=G.origin;ae[0]=A[0],ae[1]=A[1],ae[2]=A[2]||0,this.dirtyLocalTransform(f,G)}}},{key:"setEulerAngles",value:function(f,A){var _=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,k=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0;typeof A=="number"&&(A=D.al(A,_,k));var G=f.transformable;if(f.parentNode===null||!f.parentNode.transformable)this.setLocalEulerAngles(f,A);else{he.Su(G.localRotation,A[0],A[1],A[2]);var ae=this.getRotation(f.parentNode);he.JG(IA,he.U_(Sh,ae)),he.dC(G.localRotation,G.localRotation,IA),this.dirtyLocalTransform(f,G)}}},{key:"getGeometryBounds",value:function(f){var A=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,_=f,k=_.geometry;k.dirty&&Oi.styleValueRegistry.updateGeometry(f);var G=A?k.renderBounds:k.contentBounds||null;return G||new ie}},{key:"getTransformedGeometryBounds",value:function(f){var A=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,_=arguments.length>2?arguments[2]:void 0,k=this.getGeometryBounds(f,A);if(!ie.isEmpty(k)){var G=_||new ie;return G.setFromTransformedAABB(k,this.getWorldTransform(f)),G}return null}},{key:"getBounds",value:function(f){var A=this,_=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,k=f,G=k.renderable;if(!G.boundsDirty&&!_&&G.bounds)return G.bounds;if(!G.renderBoundsDirty&&_&&G.renderBounds)return G.renderBounds;var ae=_?G.renderBounds:G.bounds,ge=this.getTransformedGeometryBounds(f,_,ae),Ue=f.childNodes;if(Ue.forEach(function(Zt){var wn=A.getBounds(Zt,_);wn&&(ge?ge.add(wn):(ge=ae||new ie,ge.update(wn.center,wn.halfExtents)))}),ge||(ge=new ie),_){var rt=Zf(f);if(rt){var bt=rt.parsedStyle.clipPath.getBounds(_);ge?bt&&(ge=bt.intersection(ge)):ge.update(bt.center,bt.halfExtents)}}return _?(G.renderBounds=ge,G.renderBoundsDirty=!1):(G.bounds=ge,G.boundsDirty=!1),ge}},{key:"getLocalBounds",value:function(f){if(f.parentNode){var A=yf;f.parentNode.transformable&&(A=j.invert(xf,this.getWorldTransform(f.parentNode)));var _=this.getBounds(f);if(!ie.isEmpty(_)){var k=new ie;return k.setFromTransformedAABB(_,A),k}}return this.getBounds(f)}},{key:"getBoundingClientRect",value:function(f){var A,_,k=this.getGeometryBounds(f);ie.isEmpty(k)||(_=new ie,_.setFromTransformedAABB(k,this.getWorldTransform(f)));var G=(A=f.ownerDocument)===null||A===void 0||(A=A.defaultView)===null||A===void 0?void 0:A.getContextService().getBoundingClientRect();if(_){var ae=_.getMin(),ge=(0,C.Z)(ae,2),Ue=ge[0],rt=ge[1],bt=_.getMax(),Zt=(0,C.Z)(bt,2),wn=Zt[0],mn=Zt[1];return new Sn(Ue+((G==null?void 0:G.left)||0),rt+((G==null?void 0:G.top)||0),wn-Ue,mn-rt)}return new Sn((G==null?void 0:G.left)||0,(G==null?void 0:G.top)||0,0,0)}},{key:"internalUpdateTransform",value:function(f){var A,_=(A=f.parentNode)===null||A===void 0?void 0:A.transformable;Aa(f.transformable),sa(f.transformable,_)}},{key:"internalUpdateElement",value:function(f,A){var _,k,G,ae,ge=((_=f.ownerDocument)===null||_===void 0||(_=_.defaultView)===null||_===void 0||(_=_.getConfig())===null||_===void 0||(_=_.future)===null||_===void 0?void 0:_.experimentalAttributeUpdateOptimization)===!0,Ue=A[A.length-1],rt=(Ue==null?void 0:Ue.transformDirty)||((k=f.transformable)===null||k===void 0?void 0:k.localDirtyFlag);if(f.transformable){var bt;(bt=f.transformable).dirtyFlag||(bt.dirtyFlag=rt)}if(this.internalUpdateTransform(f),rt){var Zt;(Zt=f.dirty)===null||Zt===void 0||Zt.call(f,!0,!0)}var wn=((G=f.renderable)===null||G===void 0?void 0:G.boundsDirty)||((ae=f.renderable)===null||ae===void 0?void 0:ae.renderBoundsDirty);if((rt||wn)&&(Ue==null?void 0:Ue.shapeUpdated)===!1&&ge)for(var mn=A.length-1;mn>=0;){var Gn,ir,tr=A[mn];if(tr.shapeUpdated)break;(Gn=(ir=tr.node).dirty)===null||Gn===void 0||Gn.call(ir,!0,!0),tr.shapeUpdated=!0,mn-=1}return rt}},{key:"syncHierarchy",value:function(f){for(var A,_,k=[f],G=f.parentNode?[{node:f.parentNode,transformDirty:((A=f.parentNode.transformable)===null||A===void 0?void 0:A.localDirtyFlag)||((_=f.parentNode.transformable)===null||_===void 0?void 0:_.dirtyFlag),shapeUpdated:!1}]:[];k.length>0;){for(var ae=k.pop(),ge=G[G.length-1];G.length>0&&ae.parentNode!==ge.node;)ge=G.pop();var Ue=this.internalUpdateElement(ae,G);if(ae.childNodes.length>0){for(var rt=ae.childNodes.length-1;rt>=0;rt--)k.push(ae.childNodes[rt]);G.push({node:ae,transformDirty:Ue,shapeUpdated:!1})}}}},{key:"dirtyLocalTransform",value:function(f,A){Hl(f)||A.localDirtyFlag||(A.localDirtyFlag=!0,A.dirtyFlag||this.dirtyWorldTransform(f,A))}},{key:"dirtyWorldTransform",value:function(f,A){this.dirtyWorldInternal(f,A),this.dirtyToRoot(f,!0)}},{key:"dirtyWorldInternal",value:function(f,A){var _,k=this,G=((_=f.ownerDocument)===null||_===void 0||(_=_.defaultView)===null||_===void 0||(_=_.getConfig())===null||_===void 0||(_=_.future)===null||_===void 0?void 0:_.experimentalAttributeUpdateOptimization)===!0;A.dirtyFlag||(A.dirtyFlag=!0,f.dirty(!0,!0),G||f.childNodes.forEach(function(ae){var ge=ae.transformable;k.dirtyWorldInternal(ae,ge)}))}},{key:"dirtyToRoot",value:function(f){for(var A,_=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,k=f,G=((A=f.ownerDocument)===null||A===void 0||(A=A.defaultView)===null||A===void 0||(A=A.getConfig())===null||A===void 0||(A=A.future)===null||A===void 0?void 0:A.experimentalAttributeUpdateOptimization)===!0;k;){var ae,ge;if((ae=(ge=k).dirty)===null||ae===void 0||ae.call(ge,!0,!0),G)break;k=k.parentNode}_&&f.forEach(function(bt){var Zt;(Zt=bt.dirty)===null||Zt===void 0||Zt.call(bt,!0,!0)}),this.informDependentDisplayObjects(f);var Ue=f.mutations||[],rt=Ue.find(function(bt){return bt.type==="attributes"&&bt._boundsChangeData});rt?rt._boundsChangeData={affectChildren:rt._boundsChangeData.affectChildren||_}:(rt={type:"attributes",target:f,_boundsChangeData:{affectChildren:_}},Ue.push(rt)),f.mutations=Ue}},{key:"dirtyFragment",value:function(f){var A,_,k=f.transformable;k&&(k.dirtyFlag=!0,k.localDirtyFlag=!0),(A=(_=f).dirty)===null||A===void 0||A.call(_,!0,!0);for(var G=f.childNodes.length,ae=0;ae<G;ae++)this.dirtyFragment(f.childNodes[ae])}},{key:"notifyMutationObservers",value:function(f){var A=new Set;if(f.getRoot().forEach(function(k){(k.mutations||[]).forEach(function(G){G.type==="attributes"&&G._boundsChangeData&&(G._boundsChangeData.affectChildren?k.forEach(function(ae){var ge=(0,m.Z)({},G);ge.target=ae,A.add(ge)}):A.add(G))}),k.mutations=void 0}),A.size>0){var _=new xu(Ra.BOUNDS_CHANGED,{detail:Array.from(A)});f.dispatchEvent(_,!0,!0)}}},{key:"updateDisplayObjectDependency",value:function(f,A,_,k){if(A&&A!==_){var G=this.displayObjectDependencyMap.get(A);if(G&&G[f]){var ae=G[f].indexOf(k);G[f].splice(ae,1)}}if(_){var ge=this.displayObjectDependencyMap.get(_);ge||(this.displayObjectDependencyMap.set(_,{}),ge=this.displayObjectDependencyMap.get(_)),ge[f]||(ge[f]=[]),ge[f].push(k)}}},{key:"informDependentDisplayObjects",value:function(f){var A,_=this,k=this.displayObjectDependencyMap.get(f);if(k){var G=(A=f.ownerDocument)===null||A===void 0||(A=A.defaultView)===null||A===void 0||(A=A.getConfig())===null||A===void 0||(A=A.future)===null||A===void 0?void 0:A.experimentalCancelEventPropagation;Object.keys(k).forEach(function(ae){k[ae].forEach(function(ge){_.dirtyToRoot(ge,!0),ge.dispatchEvent(new Hu(Ra.ATTR_MODIFIED,ge,_,_,ae,Hu.MODIFICATION,_,_),G,G),ge.isCustomElement&&ge.isConnected&&ge.attributeChangedCallback&&ge.attributeChangedCallback(ae,_,_)})})}}}])}(),hm=function(){function x(S){if((0,Z.Z)(this,x),S<=0)throw new Error("LRU capacity must be a positive number.");this.capacity=S,this.cache=new Map}return(0,V.Z)(x,[{key:"get",value:function(f){if(this.cache.has(f)){var A=this.cache.get(f);return this.cache.delete(f),this.cache.set(f,A),A}}},{key:"put",value:function(f,A){if(this.cache.has(f)&&this.cache.delete(f),this.cache.set(f,A),this.cache.size>this.capacity){var _=this.cache.keys().next().value;this.cache.delete(_)}}},{key:"len",value:function(){return this.cache.size}},{key:"clear",value:function(){this.cache.clear()}}])}(),ed={MetricsString:"|\xC9q\xC5",BaselineSymbol:"M",BaselineMultiplier:1.4,HeightMultiplier:2,Newlines:[10,13],BreakingSpaces:[9,32,8192,8193,8194,8195,8196,8197,8198,8200,8201,8202,8287,12288]},td=/[a-zA-Z0-9\u00C0-\u00D6\u00D8-\u00f6\u00f8-\u00ff!"#$%&'()*+,-./:;]/,Jf=/[!%),.:;?\]}¢°·'""†‡›℃∶、。〃〆〕〗〞﹚﹜!"%'),.:;?!]}~]/,dm=/[$(£¥·'"〈《「『【〔〖〝﹙﹛$(.[{£¥]/,ap=/[!),.:;?\]}¢·–—'"•"、。〆〞〕〉》」︰︱︲︳﹐﹑﹒﹓﹔﹕﹖﹘﹚﹜!),.:;?︶︸︺︼︾﹀﹂﹗]|}、]/,Pp=/[([{£¥'"‵〈《「『〔〝︴﹙﹛({︵︷︹︻︽︿﹁﹃﹏]/,Lp=/[)\]}〕〉》」』】〙〗〟'"⦆»ヽヾーァィゥェォッャュョヮヵヶぁぃぅぇぉっゃゅょゎゕゖㇰㇱㇲㇳㇴㇵㇶㇷㇸㇹㇺㇻㇼㇽㇾㇿ々〻‐゠–〜?!‼⁇⁈⁉・、:;,。.]/,Md=/[([{〔〈《「『【〘〖〝'"⦅«—...‥〳〴〵]/,Up=/[!%),.:;?\]}¢°'"†‡℃〆〈《「『〕!%),.:;?]}]/,Op=/[$([{£¥'"々〇〉》」〔$([{⦆¥₩#]/,_f=new RegExp("".concat(Jf.source,"|").concat(ap.source,"|").concat(Lp.source,"|").concat(Up.source)),eA=new RegExp("".concat(dm.source,"|").concat(Pp.source,"|").concat(Md.source,"|").concat(Op.source)),Zd=function(){function x(S){var f=this;(0,Z.Z)(this,x),this.fontMetricsCache={},this.shouldBreakByKinsokuShorui=function(A,_){return f.isBreakingSpace(_)?!1:!!(A&&(eA.exec(_)||_f.exec(A)))},this.trimByKinsokuShorui=function(A){var _=(0,N.Z)(A),k=_[_.length-2];if(!k)return A;var G=k[k.length-1];return _[_.length-2]=k.slice(0,-1),_[_.length-1]=G+_[_.length-1],_},this.runtime=S,this.charWidthCache=new hm(100)}return(0,V.Z)(x,[{key:"measureFont",value:function(f,A){if(this.fontMetricsCache[f])return this.fontMetricsCache[f];var _={ascent:0,descent:0,fontSize:0},k=this.runtime.offscreenCanvasCreator.getOrCreateCanvas(A),G=this.runtime.offscreenCanvasCreator.getOrCreateContext(A,{willReadFrequently:!0});G.font=f;var ae=ed.MetricsString+ed.BaselineSymbol,ge=Math.ceil(G.measureText(ae).width),Ue=Math.ceil(G.measureText(ed.BaselineSymbol).width),rt=ed.HeightMultiplier*Ue;Ue=Ue*ed.BaselineMultiplier|0,k.width=ge,k.height=rt,G.fillStyle="#f00",G.fillRect(0,0,ge,rt),G.font=f,G.textBaseline="alphabetic",G.fillStyle="#000",G.fillText(ae,0,Ue);var bt=G.getImageData(0,0,ge||1,rt||1).data,Zt=bt.length,wn=ge*4,mn=0,Gn=0,ir=!1;for(mn=0;mn<Ue;++mn){for(var tr=0;tr<wn;tr+=4)if(bt[Gn+tr]!==255){ir=!0;break}if(!ir)Gn+=wn;else break}for(_.ascent=Ue-mn,Gn=Zt-wn,ir=!1,mn=rt;mn>Ue;--mn){for(var Zn=0;Zn<wn;Zn+=4)if(bt[Gn+Zn]!==255){ir=!0;break}if(!ir)Gn-=wn;else break}return _.descent=mn-Ue,_.fontSize=_.ascent+_.descent,this.fontMetricsCache[f]=_,_}},{key:"measureText",value:function(f,A,_){var k=A.fontSize,G=k===void 0?16:k,ae=A.wordWrap,ge=ae===void 0?!1:ae,Ue=A.lineHeight,rt=A.lineWidth,bt=rt===void 0?1:rt,Zt=A.textBaseline,wn=Zt===void 0?"alphabetic":Zt,mn=A.textAlign,Gn=mn===void 0?"start":mn,ir=A.letterSpacing,tr=ir===void 0?0:ir,Zn=A.textPath;A.textPathSide,A.textPathStartOffset;var Tr=A.leading,ni=Tr===void 0?0:Tr,ns=Vd(A),is=this.measureFont(ns,_);is.fontSize===0&&(is.fontSize=G,is.ascent=G);var bi=this.runtime.offscreenCanvasCreator.getOrCreateContext(_);bi.font=ns,A.isOverflowing=!1;var Ri=ge?this.wordWrap(f,A,_):f,Gs=Ri.split(/(?:\r\n|\r|\n)/),_s=new Array(Gs.length),Hs=0;if(Zn){Zn.getTotalLength();for(var Zs=0;Zs<Gs.length;Zs++)bi.measureText(Gs[Zs]).width+(Gs[Zs].length-1)*tr}else{for(var Ia=0;Ia<Gs.length;Ia++){var Po=bi.measureText(Gs[Ia]).width+(Gs[Ia].length-1)*tr;_s[Ia]=Po,Hs=Math.max(Hs,Po)}var Ml=Hs+bt,El=Ue||is.fontSize+bt,Ys=Math.max(El,is.fontSize+bt)+(Gs.length-1)*(El+ni);El+=ni;var U=0;return wn==="middle"?U=-Ys/2:wn==="bottom"||wn==="alphabetic"||wn==="ideographic"?U=-Ys:(wn==="top"||wn==="hanging")&&(U=0),{font:ns,width:Ml,height:Ys,lines:Gs,lineWidths:_s,lineHeight:El,maxLineWidth:Hs,fontProperties:is,lineMetrics:_s.map(function(R,$){var K=0;return Gn==="center"||Gn==="middle"?K-=R/2:(Gn==="right"||Gn==="end")&&(K-=R),new Sn(K-bt/2,U+$*El,R+bt,El)})}}}},{key:"wordWrap",value:function(f,A,_){var k=this,G=Array.from(f);if(G.length===0)return"";var ae=this,ge=A.wordWrapWidth,Ue=ge===void 0?0:ge,rt=A.letterSpacing,bt=rt===void 0?0:rt,Zt=A.maxLines,wn=Zt===void 0?1/0:Zt,mn=A.textOverflow,Gn=this.runtime.offscreenCanvasCreator.getOrCreateContext(_),ir=Ue+bt,tr="";mn==="ellipsis"?tr="...":mn&&mn!=="clip"&&(tr=mn);var Zn=[""],Tr=0,ni=0,ns=-1,is=Vd(A),bi=this.charWidthCache.get(is);bi||(bi=new hm(500),this.charWidthCache.put(is,bi));var Ri=function(R){return k.getFromCache(R,bt,bi,Gn)},Gs=Ri(tr);function _s(U,R,$,K){for(;Ri(U)<K&&R<G.length-1&&!ae.isNewline(G[R+1]);)R+=1,U+=G[R];for(;Ri(U)>K&&R>=$;)R-=1,U=U.slice(0,-1);return{lineTxt:U,txtLastCharIndex:R}}function Hs(U,R){if(!(Gs<=0||Gs>ir)){if(!Zn[U]){Zn[U]=tr;return}var $=_s(Zn[U],R,ns+1,ir-Gs);Zn[U]=$.lineTxt+tr}}for(var Zs=0;Zs<G.length;Zs++){var Ia=G[Zs],Po=G[Zs-1],Ml=G[Zs+1],El=Ri(Ia);if(this.isNewline(Ia)){if(Tr+1>=wn){Zs<G.length-1&&Hs(Tr,Zs-1),A.isOverflowing=!0;break}ns=Zs-1,Tr+=1,ni=0,Zn[Tr]="";continue}if(El>ir){Hs(Tr,Zs-1),A.isOverflowing=!0;break}if(ni>0&&ni+El>ir){var Ys=_s(Zn[Tr],Zs-1,ns+1,ir);if(Ys.txtLastCharIndex!==Zs-1){if(Zn[Tr]=Ys.lineTxt,Ys.txtLastCharIndex===G.length-1)break;Zs=Ys.txtLastCharIndex+1,Ia=G[Zs],Po=G[Zs-1],Ml=G[Zs+1],El=Ri(Ia)}if(Tr+1>=wn){Hs(Tr,Zs-1),A.isOverflowing=!0;break}if(ns=Zs-1,Tr+=1,ni=0,Zn[Tr]="",this.isBreakingSpace(Ia))continue;this.canBreakInLastChar(Ia)||(Zn=this.trimToBreakable(Zn),ni=this.sumTextWidthByCache(Zn[Tr]||"",Ri)),this.shouldBreakByKinsokuShorui(Ia,Ml)&&(Zn=this.trimByKinsokuShorui(Zn),ni+=Ri(Po||""))}ni+=El,Zn[Tr]+=Ia}return Zn.join(`
`)}},{key:"isBreakingSpace",value:function(f){return typeof f!="string"?!1:ed.BreakingSpaces.indexOf(f.charCodeAt(0))>=0}},{key:"isNewline",value:function(f){return typeof f!="string"?!1:ed.Newlines.indexOf(f.charCodeAt(0))>=0}},{key:"trimToBreakable",value:function(f){var A=(0,N.Z)(f),_=A[A.length-2],k=this.findBreakableIndex(_);if(k===-1||!_)return A;var G=_.slice(k,k+1),ae=this.isBreakingSpace(G),ge=k+1,Ue=k+(ae?0:1);return A[A.length-1]+=_.slice(ge,_.length),A[A.length-2]=_.slice(0,Ue),A}},{key:"canBreakInLastChar",value:function(f){return!(f&&td.test(f))}},{key:"sumTextWidthByCache",value:function(f,A){return f.split("").reduce(function(_,k){return _+A(k)},0)}},{key:"findBreakableIndex",value:function(f){for(var A=f.length-1;A>=0;A--)if(!td.test(f[A]))return A;return-1}},{key:"getFromCache",value:function(f,A,_,k){var G=_.get(f);if(typeof G!="number"){var ae=f.length*A,ge=k.measureText(f);G=ge.width+ae,_.put(f,G)}return G}},{key:"clearCache",value:function(){this.fontMetricsCache={},this.charWidthCache.clear()}}])}(),Oi={},op=function(x){var S=new Jl,f=new jf;return x={},(0,Ci.Z)((0,Ci.Z)((0,Ci.Z)((0,Ci.Z)((0,Ci.Z)((0,Ci.Z)((0,Ci.Z)((0,Ci.Z)((0,Ci.Z)((0,Ci.Z)(x,Jt.FRAGMENT,null),Jt.CIRCLE,new Il),Jt.ELLIPSE,new um),Jt.RECT,S),Jt.IMAGE,S),Jt.GROUP,new wg),Jt.LINE,new sp),Jt.TEXT,new cm(Oi)),Jt.POLYLINE,f),Jt.POLYGON,f),(0,Ci.Z)((0,Ci.Z)((0,Ci.Z)(x,Jt.PATH,new bd),Jt.HTML,new Vh),Jt.MESH,null)}(),ah=function(x){var S=new qc,f=new jl;return x={},(0,Ci.Z)((0,Ci.Z)((0,Ci.Z)((0,Ci.Z)((0,Ci.Z)((0,Ci.Z)((0,Ci.Z)((0,Ci.Z)((0,Ci.Z)((0,Ci.Z)(x,Ai.PERCENTAGE,null),Ai.NUMBER,new xh),Ai.ANGLE,new Bu),Ai.DEFINED_PATH,new cu),Ai.PAINT,S),Ai.COLOR,S),Ai.FILTER,new _l),Ai.LENGTH,f),Ai.LENGTH_PERCENTAGE,f),Ai.LENGTH_PERCENTAGE_12,new Jc),(0,Ci.Z)((0,Ci.Z)((0,Ci.Z)((0,Ci.Z)((0,Ci.Z)((0,Ci.Z)((0,Ci.Z)((0,Ci.Z)((0,Ci.Z)((0,Ci.Z)(x,Ai.LENGTH_PERCENTAGE_14,new eh),Ai.COORDINATE,new jl),Ai.OFFSET_DISTANCE,new MA),Ai.OPACITY_VALUE,new yl),Ai.PATH,new Nc),Ai.LIST_OF_POINTS,new bh),Ai.SHADOW_BLUR,new Wf),Ai.TEXT,new _h),Ai.TEXT_TRANSFORM,new ol),Ai.TRANSFORM,new Ip),(0,Ci.Z)((0,Ci.Z)((0,Ci.Z)(x,Ai.TRANSFORM_ORIGIN,new _g),Ai.Z_INDEX,new ip),Ai.MARKER,new df)}(),tA=function(){return typeof globalThis!="undefined"?globalThis:typeof self!="undefined"?self:typeof window!="undefined"?window:typeof b.g!="undefined"?b.g:{}};Oi.CameraContribution=$r,Oi.AnimationTimeline=null,Oi.EasingFunction=null,Oi.offscreenCanvasCreator=new Np,Oi.sceneGraphSelector=new Fp,Oi.sceneGraphService=new Mg(Oi),Oi.textService=new Zd(Oi),Oi.geometryUpdaterFactory=op,Oi.CSSPropertySyntaxFactory=ah,Oi.styleValueRegistry=new zl(Oi),Oi.layoutRegistry=null,Oi.globalThis=tA(),Oi.enableStyleSyntax=!0,Oi.enableSizeAttenuation=!1;var wf=0;function Kd(){wf=0}var Mh=new Hu(Ra.INSERTED,null,"","","",0,"",""),Ed=new Hu(Ra.REMOVED,null,"","","",0,"",""),Eg=new xu(Ra.DESTROY),Dp=function(x){function S(){var f;(0,Z.Z)(this,S);for(var A=arguments.length,_=new Array(A),k=0;k<A;k++)_[k]=arguments[k];return f=(0,E.Z)(this,S,[].concat(_)),f.entity=wf++,f.transformable={dirtyFlag:!1,localDirtyFlag:!1,localPosition:[0,0,0],localRotation:[0,0,0,1],localScale:[1,1,1],localTransform:[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],localSkew:[0,0],position:[0,0,0],rotation:[0,0,0,1],scaling:[1,1,1],worldTransform:[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],origin:[0,0,0]},f.renderable={bounds:void 0,boundsDirty:!0,renderBounds:void 0,renderBoundsDirty:!0,dirtyRenderBounds:void 0,dirty:!1},f.geometry={contentBounds:void 0,renderBounds:void 0,dirty:!0},f.cullable={strategy:Ii.Standard,visibilityPlaneMask:-1,visible:!0,enable:!0},f.sortable={dirty:!1,sorted:void 0,renderOrder:0,dirtyChildren:[],dirtyReason:void 0},f.namespaceURI="g",f.scrollLeft=0,f.scrollTop=0,f.clientTop=0,f.clientLeft=0,f.style={},f.computedStyle={},f.parsedStyle={},f.attributes={},f}return(0,F.Z)(S,x),(0,V.Z)(S,[{key:"dirty",value:function(){var A=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0,_=arguments.length>1?arguments[1]:void 0;this.renderable.dirty=A,_!==void 0&&(this.renderable.boundsDirty=_,this.renderable.renderBoundsDirty=_,this.geometry.dirty=_)}},{key:"className",get:function(){return this.getAttribute("class")||""},set:function(A){this.setAttribute("class",A)}},{key:"classList",get:function(){return this.className.split(" ").filter(function(A){return A!==""})}},{key:"tagName",get:function(){return this.nodeName}},{key:"children",get:function(){return this.childNodes}},{key:"childElementCount",get:function(){return this.childNodes.length}},{key:"firstElementChild",get:function(){return this.firstChild}},{key:"lastElementChild",get:function(){return this.lastChild}},{key:"parentElement",get:function(){return this.parentNode}},{key:"nextSibling",get:function(){if(this.parentNode){var A=this.parentNode.childNodes.indexOf(this);return this.parentNode.childNodes[A+1]||null}return null}},{key:"previousSibling",get:function(){if(this.parentNode){var A=this.parentNode.childNodes.indexOf(this);return this.parentNode.childNodes[A-1]||null}return null}},{key:"cloneNode",value:function(A){throw new Error(Oe)}},{key:"appendChild",value:function(A,_){var k;if(A.destroyed)throw new Error(Re);return Oi.sceneGraphService.attach(A,this,_),(k=this.ownerDocument)!==null&&k!==void 0&&k.defaultView&&(!Hl(this)&&A.nodeName===Jt.FRAGMENT?this.ownerDocument.defaultView.mountFragment(A):this.ownerDocument.defaultView.mountChildren(A)),this.isMutationObserved&&(Mh.relatedNode=this,A.dispatchEvent(Mh)),A}},{key:"insertBefore",value:function(A,_){if(!_)this.appendChild(A);else{A.parentElement&&A.parentElement.removeChild(A);var k=this.childNodes.indexOf(_);k===-1?this.appendChild(A):this.appendChild(A,k)}return A}},{key:"replaceChild",value:function(A,_){var k=this.childNodes.indexOf(_);return this.removeChild(_),this.appendChild(A,k),_}},{key:"removeChild",value:function(A){var _,k,G=((_=this.ownerDocument)===null||_===void 0||(_=_.defaultView)===null||_===void 0||(_=_.getConfig().future)===null||_===void 0?void 0:_.experimentalCancelEventPropagation)===!0;return Ed.relatedNode=this,A.dispatchEvent(Ed,G,G),(k=A.ownerDocument)!==null&&k!==void 0&&k.defaultView&&A.ownerDocument.defaultView.unmountChildren(A),Oi.sceneGraphService.detach(A),A}},{key:"removeChildren",value:function(){for(var A=this.childNodes.length-1;A>=0;A--){var _=this.childNodes[A];this.removeChild(_)}}},{key:"destroyChildren",value:function(){for(var A=this.childNodes.length-1;A>=0;A--){var _=this.childNodes[A];_.childNodes.length>0&&_.destroyChildren(),_.destroy()}}},{key:"matches",value:function(A){return Oi.sceneGraphService.matches(A,this)}},{key:"getElementById",value:function(A){return Oi.sceneGraphService.querySelector("#".concat(A),this)}},{key:"getElementsByName",value:function(A){return Oi.sceneGraphService.querySelectorAll('[name="'.concat(A,'"]'),this)}},{key:"getElementsByClassName",value:function(A){return Oi.sceneGraphService.querySelectorAll(".".concat(A),this)}},{key:"getElementsByTagName",value:function(A){return Oi.sceneGraphService.querySelectorAll(A,this)}},{key:"querySelector",value:function(A){return Oi.sceneGraphService.querySelector(A,this)}},{key:"querySelectorAll",value:function(A){return Oi.sceneGraphService.querySelectorAll(A,this)}},{key:"closest",value:function(A){var _=this;do{if(Oi.sceneGraphService.matches(A,_))return _;_=_.parentElement}while(_!==null);return null}},{key:"find",value:function(A){var _=this,k=null;return this.forEach(function(G){return G!==_&&A(G)?(k=G,!1):!0}),k}},{key:"findAll",value:function(A){var _=this,k=[];return this.forEach(function(G){G!==_&&A(G)&&k.push(G)}),k}},{key:"after",value:function(){var A=this;if(this.parentNode){for(var _=this.parentNode.childNodes.indexOf(this),k=arguments.length,G=new Array(k),ae=0;ae<k;ae++)G[ae]=arguments[ae];G.forEach(function(ge,Ue){var rt;return(rt=A.parentNode)===null||rt===void 0?void 0:rt.appendChild(ge,_+Ue+1)})}}},{key:"before",value:function(){if(this.parentNode){for(var A,_=this.parentNode.childNodes.indexOf(this),k=arguments.length,G=new Array(k),ae=0;ae<k;ae++)G[ae]=arguments[ae];var ge=G[0],Ue=(0,rn.Z)(G).slice(1);this.parentNode.appendChild(ge,_),(A=ge).after.apply(A,(0,N.Z)(Ue))}}},{key:"replaceWith",value:function(){this.after.apply(this,arguments),this.remove()}},{key:"append",value:function(){for(var A=this,_=arguments.length,k=new Array(_),G=0;G<_;G++)k[G]=arguments[G];k.forEach(function(ae){return A.appendChild(ae)})}},{key:"prepend",value:function(){for(var A=this,_=arguments.length,k=new Array(_),G=0;G<_;G++)k[G]=arguments[G];k.forEach(function(ae,ge){return A.appendChild(ae,ge)})}},{key:"replaceChildren",value:function(){for(;this.childNodes.length&&this.firstChild;)this.removeChild(this.firstChild);this.append.apply(this,arguments)}},{key:"remove",value:function(){return this.parentNode?this.parentNode.removeChild(this):this}},{key:"destroy",value:function(){var A,_=((A=this.ownerDocument)===null||A===void 0||(A=A.defaultView)===null||A===void 0||(A=A.getConfig().future)===null||A===void 0?void 0:A.experimentalCancelEventPropagation)===!0;this.destroyChildren(),this.dispatchEvent(Eg,_,_),this.remove(),this.emitter.removeAllListeners(),this.destroyed=!0}},{key:"getGeometryBounds",value:function(){var A=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;return Oi.sceneGraphService.getGeometryBounds(this,A)}},{key:"getTransformedGeometryBounds",value:function(){var A=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;return Oi.sceneGraphService.getTransformedGeometryBounds(this,A)}},{key:"getBounds",value:function(){return Oi.sceneGraphService.getBounds(this)}},{key:"getRenderBounds",value:function(){return Oi.sceneGraphService.getBounds(this,!0)}},{key:"getLocalBounds",value:function(){return Oi.sceneGraphService.getLocalBounds(this)}},{key:"getBoundingClientRect",value:function(){return Oi.sceneGraphService.getBoundingClientRect(this)}},{key:"getClientRects",value:function(){return[this.getBoundingClientRect()]}},{key:"computedStyleMap",value:function(){return new Map(Object.entries(this.computedStyle))}},{key:"getAttributeNames",value:function(){return Object.keys(this.attributes)}},{key:"getAttribute",value:function(A){if(typeof A!="symbol"){var _=this.attributes[A];return _}}},{key:"hasAttribute",value:function(A){return this.getAttributeNames().includes(A)}},{key:"hasAttributes",value:function(){return!!this.getAttributeNames().length}},{key:"removeAttribute",value:function(A){this.setAttribute(A,null),delete this.attributes[A]}},{key:"setAttribute",value:function(A,_){this.attributes[A]=_}},{key:"getAttributeNS",value:function(A,_){throw new Error(Oe)}},{key:"getAttributeNode",value:function(A){throw new Error(Oe)}},{key:"getAttributeNodeNS",value:function(A,_){throw new Error(Oe)}},{key:"hasAttributeNS",value:function(A,_){throw new Error(Oe)}},{key:"removeAttributeNS",value:function(A,_){throw new Error(Oe)}},{key:"removeAttributeNode",value:function(A){throw new Error(Oe)}},{key:"setAttributeNS",value:function(A,_,k){throw new Error(Oe)}},{key:"setAttributeNode",value:function(A){throw new Error(Oe)}},{key:"setAttributeNodeNS",value:function(A){throw new Error(Oe)}},{key:"toggleAttribute",value:function(A,_){throw new Error(Oe)}}])}(vo);function Do(x){return!!(x!=null&&x.nodeName)}var $d=Oi.globalThis.Proxy?Oi.globalThis.Proxy:function(){},Qc=new Hu(Ra.ATTR_MODIFIED,null,null,null,null,Hu.MODIFICATION,null,null),Eh=D.Ue(),lp=he.Ue(),wo=function(x){function S(f){var A;return(0,Z.Z)(this,S),A=(0,E.Z)(this,S),A.isCustomElement=!1,A.isMutationObserved=!1,A.activeAnimations=[],A.config=f,A.id=f.id||"",A.name=f.name||"",(f.className||f.class)&&(A.className=f.className||f.class),A.nodeName=f.type||Jt.GROUP,f.initialParsedStyle&&Object.assign(A.parsedStyle,f.initialParsedStyle),A.initAttributes(f.style),Oi.enableStyleSyntax&&(A.style=new $d({setProperty:function(k,G){A.setAttribute(k,G)},getPropertyValue:function(k){return A.getAttribute(k)},removeProperty:function(k){A.removeAttribute(k)},item:function(){return""}},{get:function(k,G){return k[G]!==void 0?k[G]:A.getAttribute(G)},set:function(k,G,ae){return A.setAttribute(G,ae),!0}})),A}return(0,F.Z)(S,x),(0,V.Z)(S,[{key:"destroy",value:function(){(0,En.Z)(S,"destroy",this,3)([]),this.getAnimations().forEach(function(A){A.cancel()})}},{key:"cloneNode",value:function(A,_){var k=(0,m.Z)({},this.attributes);for(var G in k){var ae=k[G];Do(ae)&&G!=="clipPath"&&G!=="offsetPath"&&G!=="textPath"&&(k[G]=ae.cloneNode(A)),_&&(k[G]=_(G,ae))}var ge=new this.constructor((0,m.Z)((0,m.Z)({},this.config),{},{style:k}));return ge.setLocalTransform(this.getLocalTransform()),A&&this.children.forEach(function(Ue){if(!Ue.style.isMarker){var rt=Ue.cloneNode(A);ge.appendChild(rt)}}),ge}},{key:"initAttributes",value:function(){var A=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},_={forceUpdateGeometry:!0};Oi.styleValueRegistry.processProperties(this,A,_),this.dirty()}},{key:"setAttribute",value:function(A,_){var k=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,G=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0;(0,vr.Z)(_)||(k||_!==this.attributes[A])&&(this.internalSetAttribute(A,_,{memoize:G}),(0,En.Z)(S,"setAttribute",this,3)([A,_]))}},{key:"setAttributes",value:function(A){var _=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},k=_.skipDispatchAttrModifiedEvent,G=k===void 0?!1:k,ae,ge;if(G||(ae=(0,m.Z)({},this.attributes),ge=(0,m.Z)({},this.parsedStyle)),Oi.styleValueRegistry.processProperties(this,A,_),this.dirty(),!G)for(var Ue in A)this.dispatchAttrModifiedEvent(Ue,ae[Ue],A[Ue],ge[Ue])}},{key:"internalSetAttribute",value:function(A,_){var k=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},G=this.attributes[A],ae=this.parsedStyle[A];Oi.styleValueRegistry.processProperties(this,(0,Ci.Z)({},A,_),k),this.dirty(),this.dispatchAttrModifiedEvent(A,G,_,ae)}},{key:"dispatchAttrModifiedEvent",value:function(A,_,k,G){var ae=this.parsedStyle[A];if(this.isConnected)if(Qc.relatedNode=this,Qc.prevValue=_,Qc.newValue=k,Qc.attrName=A,Qc.prevParsedValue=G,Qc.newParsedValue=ae,this.isMutationObserved)this.dispatchEvent(Qc);else{var ge,Ue=((ge=this.ownerDocument.defaultView.getConfig().future)===null||ge===void 0?void 0:ge.experimentalCancelEventPropagation)===!0;Qc.target=this,this.ownerDocument.defaultView.dispatchEvent(Qc,!0,Ue)}if(this.isCustomElement&&this.isConnected||!this.isCustomElement){var rt,bt;(rt=(bt=this).attributeChangedCallback)===null||rt===void 0||rt.call(bt,A,_,k,G,ae)}}},{key:"getBBox",value:function(){var A=this.getBounds(),_=A.getMin(),k=(0,C.Z)(_,2),G=k[0],ae=k[1],ge=A.getMax(),Ue=(0,C.Z)(ge,2),rt=Ue[0],bt=Ue[1];return new Sn(G,ae,rt-G,bt-ae)}},{key:"setOrigin",value:function(A){var _=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,k=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0;return Oi.sceneGraphService.setOrigin(this,tn(A,_,k,!1)),this}},{key:"getOrigin",value:function(){return Oi.sceneGraphService.getOrigin(this)}},{key:"setPosition",value:function(A){var _=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,k=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0;return Oi.sceneGraphService.setPosition(this,tn(A,_,k,!1)),this}},{key:"setLocalPosition",value:function(A){var _=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,k=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0;return Oi.sceneGraphService.setLocalPosition(this,tn(A,_,k,!1)),this}},{key:"translate",value:function(A){var _=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,k=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0;return Oi.sceneGraphService.translate(this,tn(A,_,k,!1)),this}},{key:"translateLocal",value:function(A){var _=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,k=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0;return Oi.sceneGraphService.translateLocal(this,tn(A,_,k,!1)),this}},{key:"getPosition",value:function(){return Oi.sceneGraphService.getPosition(this)}},{key:"getLocalPosition",value:function(){return Oi.sceneGraphService.getLocalPosition(this)}},{key:"scale",value:function(A,_,k){return this.scaleLocal(A,_,k)}},{key:"scaleLocal",value:function(A,_,k){return typeof A=="number"&&(_=_||A,k=k||A,A=tn(A,_,k,!1)),Oi.sceneGraphService.scaleLocal(this,A),this}},{key:"setLocalScale",value:function(A,_,k){return typeof A=="number"&&(_=_||A,k=k||A,A=tn(A,_,k,!1)),Oi.sceneGraphService.setLocalScale(this,A),this}},{key:"getLocalScale",value:function(){return Oi.sceneGraphService.getLocalScale(this)}},{key:"getScale",value:function(){return Oi.sceneGraphService.getScale(this)}},{key:"getEulerAngles",value:function(){var A=Hr(Eh,Oi.sceneGraphService.getWorldTransform(this)),_=(0,C.Z)(A,3),k=_[2];return er(k)}},{key:"getLocalEulerAngles",value:function(){var A=Hr(Eh,Oi.sceneGraphService.getLocalRotation(this)),_=(0,C.Z)(A,3),k=_[2];return er(k)}},{key:"setEulerAngles",value:function(A){return Oi.sceneGraphService.setEulerAngles(this,0,0,A),this}},{key:"setLocalEulerAngles",value:function(A){return Oi.sceneGraphService.setLocalEulerAngles(this,0,0,A),this}},{key:"rotateLocal",value:function(A,_,k){return(0,$e.Z)(_)&&(0,$e.Z)(k)?Oi.sceneGraphService.rotateLocal(this,0,0,A):Oi.sceneGraphService.rotateLocal(this,A,_,k),this}},{key:"rotate",value:function(A,_,k){return(0,$e.Z)(_)&&(0,$e.Z)(k)?Oi.sceneGraphService.rotate(this,0,0,A):Oi.sceneGraphService.rotate(this,A,_,k),this}},{key:"setRotation",value:function(A,_,k,G){return Oi.sceneGraphService.setRotation(this,A,_,k,G),this}},{key:"setLocalRotation",value:function(A,_,k,G){return Oi.sceneGraphService.setLocalRotation(this,A,_,k,G),this}},{key:"setLocalSkew",value:function(A,_){return Oi.sceneGraphService.setLocalSkew(this,A,_),this}},{key:"getRotation",value:function(){return Oi.sceneGraphService.getRotation(this)}},{key:"getLocalRotation",value:function(){return Oi.sceneGraphService.getLocalRotation(this)}},{key:"getLocalSkew",value:function(){return Oi.sceneGraphService.getLocalSkew(this)}},{key:"getLocalTransform",value:function(){return Oi.sceneGraphService.getLocalTransform(this)}},{key:"getWorldTransform",value:function(){return Oi.sceneGraphService.getWorldTransform(this)}},{key:"setLocalTransform",value:function(A){return Oi.sceneGraphService.setLocalTransform(this,A),this}},{key:"resetLocalTransform",value:function(){Oi.sceneGraphService.resetLocalTransform(this)}},{key:"getAnimations",value:function(){return this.activeAnimations}},{key:"animate",value:function(A,_){var k,G=(k=this.ownerDocument)===null||k===void 0?void 0:k.timeline;return G?G.play(this,A,_):null}},{key:"isVisible",value:function(){var A;return((A=this.parsedStyle)===null||A===void 0?void 0:A.visibility)!=="hidden"}},{key:"interactive",get:function(){return this.isInteractive()},set:function(A){this.style.pointerEvents=A?"auto":"none"}},{key:"isInteractive",value:function(){var A;return((A=this.parsedStyle)===null||A===void 0?void 0:A.pointerEvents)!=="none"}},{key:"isCulled",value:function(){return!!(this.cullable&&this.cullable.enable&&!this.cullable.visible)}},{key:"toFront",value:function(){return this.parentNode&&(this.style.zIndex=Math.max.apply(Math,(0,N.Z)(this.parentNode.children.map(function(A){return Number(A.style.zIndex)})))+1),this}},{key:"toBack",value:function(){return this.parentNode&&(this.style.zIndex=Math.min.apply(Math,(0,N.Z)(this.parentNode.children.map(function(A){return Number(A.style.zIndex)})))-1),this}},{key:"getConfig",value:function(){return this.config}},{key:"attr",value:function(){for(var A=this,_=arguments.length,k=new Array(_),G=0;G<_;G++)k[G]=arguments[G];var ae=k[0],ge=k[1];return ae?(0,qr.Z)(ae)?(Object.keys(ae).forEach(function(Ue){A.setAttribute(Ue,ae[Ue])}),this):k.length===2?(this.setAttribute(ae,ge),this):this.attributes[ae]:this.attributes}},{key:"getMatrix",value:function(A){var _=A||this.getWorldTransform(),k=j.getTranslation(Eh,_),G=(0,C.Z)(k,2),ae=G[0],ge=G[1],Ue=j.getScaling(Eh,_),rt=(0,C.Z)(Ue,2),bt=rt[0],Zt=rt[1],wn=j.getRotation(lp,_),mn=Hr(Eh,wn),Gn=(0,C.Z)(mn,3),ir=Gn[0],tr=Gn[2];return Pr(ir||tr,ae,ge,bt,Zt)}},{key:"getLocalMatrix",value:function(){return this.getMatrix(this.getLocalTransform())}},{key:"setMatrix",value:function(A){var _=Zi(A),k=(0,C.Z)(_,5),G=k[0],ae=k[1],ge=k[2],Ue=k[3],rt=k[4];this.setEulerAngles(rt).setPosition(G,ae).setLocalScale(ge,Ue)}},{key:"setLocalMatrix",value:function(A){var _=Zi(A),k=(0,C.Z)(_,5),G=k[0],ae=k[1],ge=k[2],Ue=k[3],rt=k[4];this.setLocalEulerAngles(rt).setLocalPosition(G,ae).setLocalScale(ge,Ue)}},{key:"show",value:function(){this.forEach(function(A){A.style.visibility="visible"})}},{key:"hide",value:function(){this.forEach(function(A){A.style.visibility="hidden"})}},{key:"getCount",value:function(){return this.childElementCount}},{key:"getParent",value:function(){return this.parentElement}},{key:"getChildren",value:function(){return this.children}},{key:"getFirst",value:function(){return this.firstElementChild}},{key:"getLast",value:function(){return this.lastElementChild}},{key:"getChildByIndex",value:function(A){return this.children[A]||null}},{key:"add",value:function(A,_){return this.appendChild(A,_)}},{key:"set",value:function(A,_){this.config[A]=_}},{key:"get",value:function(A){return this.config[A]}},{key:"moveTo",value:function(A){var _=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,k=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0;return this.setPosition(A,_,k),this}},{key:"move",value:function(A){var _=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,k=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0;return this.setPosition(A,_,k),this}},{key:"setZIndex",value:function(A){return this.style.zIndex=A,this}}])}(Dp);wo.PARSED_STYLE_LIST=new Set(["class","className","clipPath","cursor","display","draggable","droppable","fill","fillOpacity","fillRule","filter","increasedLineWidthForHitTesting","lineCap","lineDash","lineDashOffset","lineJoin","lineWidth","miterLimit","hitArea","offsetDistance","offsetPath","offsetX","offsetY","opacity","pointerEvents","shadowColor","shadowType","shadowBlur","shadowOffsetX","shadowOffsetY","stroke","strokeOpacity","strokeWidth","strokeLinecap","strokeLineJoin","strokeDasharray","strokeDashoffset","transform","transformOrigin","textTransform","visibility","zIndex"]);var Ch=function(x){function S(){var f=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return(0,Z.Z)(this,S),(0,E.Z)(this,S,[(0,m.Z)({type:Jt.CIRCLE},f)])}return(0,F.Z)(S,x),(0,V.Z)(S)}(wo);Ch.PARSED_STYLE_LIST=new Set([].concat((0,N.Z)(wo.PARSED_STYLE_LIST),["cx","cy","cz","r","isBillboard","isSizeAttenuation"]));var Cg=["style"],Ec=function(x){function S(){var f,A=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},_=A.style,k=(0,bn.Z)(A,Cg);return(0,Z.Z)(this,S),f=(0,E.Z)(this,S,[(0,m.Z)({style:_},k)]),f.isCustomElement=!0,f}return(0,F.Z)(S,x),(0,V.Z)(S)}(wo);Ec.PARSED_STYLE_LIST=new Set(["class","className","clipPath","cursor","draggable","droppable","opacity","pointerEvents","transform","transformOrigin","zIndex","visibility"]);var zh=function(x){function S(){var f=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return(0,Z.Z)(this,S),(0,E.Z)(this,S,[(0,m.Z)({type:Jt.ELLIPSE},f)])}return(0,F.Z)(S,x),(0,V.Z)(S)}(wo);zh.PARSED_STYLE_LIST=new Set([].concat((0,N.Z)(wo.PARSED_STYLE_LIST),["cx","cy","cz","rx","ry","isBillboard","isSizeAttenuation"]));var fm=function(x){function S(){return(0,Z.Z)(this,S),(0,E.Z)(this,S,[{type:Jt.FRAGMENT}])}return(0,F.Z)(S,x),(0,V.Z)(S)}(wo);fm.PARSED_STYLE_LIST=new Set(["class","className"]);var Xd=function(x){function S(){var f=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return(0,Z.Z)(this,S),(0,E.Z)(this,S,[(0,m.Z)({type:Jt.GROUP},f)])}return(0,F.Z)(S,x),(0,V.Z)(S)}(wo);Xd.PARSED_STYLE_LIST=new Set(["class","className","clipPath","cursor","draggable","droppable","opacity","pointerEvents","transform","transformOrigin","zIndex","visibility"]);var qu=["style"],Th=function(x){function S(){var f,A=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},_=A.style,k=(0,bn.Z)(A,qu);return(0,Z.Z)(this,S),f=(0,E.Z)(this,S,[(0,m.Z)({type:Jt.HTML,style:_},k)]),f.cullable.enable=!1,f}return(0,F.Z)(S,x),(0,V.Z)(S,[{key:"getDomElement",value:function(){return this.parsedStyle.$el}},{key:"getClientRects",value:function(){return[this.getBoundingClientRect()]}},{key:"getLocalBounds",value:function(){if(this.parentNode){var A=j.invert(j.create(),this.parentNode.getWorldTransform()),_=this.getBounds();if(!ie.isEmpty(_)){var k=new ie;return k.setFromTransformedAABB(_,A),k}}return this.getBounds()}}])}(wo);Th.PARSED_STYLE_LIST=new Set([].concat((0,N.Z)(wo.PARSED_STYLE_LIST),["x","y","$el","innerHTML","width","height"]));var oh=function(x){function S(){var f=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return(0,Z.Z)(this,S),(0,E.Z)(this,S,[(0,m.Z)({type:Jt.IMAGE},f)])}return(0,F.Z)(S,x),(0,V.Z)(S)}(wo);oh.PARSED_STYLE_LIST=new Set([].concat((0,N.Z)(wo.PARSED_STYLE_LIST),["x","y","z","src","width","height","isBillboard","billboardRotation","isSizeAttenuation","keepAspectRatio"]));var kp=["style"],Sf=function(x){function S(){var f,A=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},_=A.style,k=(0,bn.Z)(A,kp);(0,Z.Z)(this,S),f=(0,E.Z)(this,S,[(0,m.Z)({type:Jt.LINE,style:(0,m.Z)({x1:0,y1:0,x2:0,y2:0,z1:0,z2:0},_)},k)]),f.markerStartAngle=0,f.markerEndAngle=0;var G=f.parsedStyle,ae=G.markerStart,ge=G.markerEnd;return ae&&Do(ae)&&(f.markerStartAngle=ae.getLocalEulerAngles(),f.appendChild(ae)),ge&&Do(ge)&&(f.markerEndAngle=ge.getLocalEulerAngles(),f.appendChild(ge)),f.transformMarker(!0),f.transformMarker(!1),f}return(0,F.Z)(S,x),(0,V.Z)(S,[{key:"attributeChangedCallback",value:function(A,_,k,G,ae){A==="x1"||A==="y1"||A==="x2"||A==="y2"||A==="markerStartOffset"||A==="markerEndOffset"?(this.transformMarker(!0),this.transformMarker(!1)):A==="markerStart"?(G&&Do(G)&&(this.markerStartAngle=0,G.remove()),ae&&Do(ae)&&(this.markerStartAngle=ae.getLocalEulerAngles(),this.appendChild(ae),this.transformMarker(!0))):A==="markerEnd"&&(G&&Do(G)&&(this.markerEndAngle=0,G.remove()),ae&&Do(ae)&&(this.markerEndAngle=ae.getLocalEulerAngles(),this.appendChild(ae),this.transformMarker(!1)))}},{key:"transformMarker",value:function(A){var _=this.parsedStyle,k=_.markerStart,G=_.markerEnd,ae=_.markerStartOffset,ge=_.markerEndOffset,Ue=_.x1,rt=_.x2,bt=_.y1,Zt=_.y2,wn=A?k:G;if(!(!wn||!Do(wn))){var mn=0,Gn,ir,tr,Zn,Tr,ni;A?(tr=Ue,Zn=bt,Gn=rt-Ue,ir=Zt-bt,Tr=ae||0,ni=this.markerStartAngle):(tr=rt,Zn=Zt,Gn=Ue-rt,ir=bt-Zt,Tr=ge||0,ni=this.markerEndAngle),mn=Math.atan2(ir,Gn),wn.setLocalEulerAngles(mn*180/Math.PI+ni),wn.setLocalPosition(tr+Math.cos(mn)*Tr,Zn+Math.sin(mn)*Tr)}}},{key:"getPoint",value:function(A){var _=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,k=this.parsedStyle,G=k.x1,ae=k.y1,ge=k.x2,Ue=k.y2,rt=(0,Xt.U4)(G,ae,ge,Ue,A),bt=rt.x,Zt=rt.y,wn=D.fF(D.Ue(),D.al(bt,Zt,0),_?this.getWorldTransform():this.getLocalTransform());return new xt(wn[0],wn[1])}},{key:"getPointAtLength",value:function(A){var _=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return this.getPoint(A/this.getTotalLength(),_)}},{key:"getTotalLength",value:function(){var A=this.parsedStyle,_=A.x1,k=A.y1,G=A.x2,ae=A.y2;return(0,Xt.Xk)(_,k,G,ae)}}])}(wo);Sf.PARSED_STYLE_LIST=new Set([].concat((0,N.Z)(wo.PARSED_STYLE_LIST),["x1","y1","x2","y2","z1","z2","isBillboard","isSizeAttenuation","markerStart","markerEnd","markerStartOffset","markerEndOffset"]));var Gh=["style"],Mf=function(x){function S(){var f,A=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},_=A.style,k=(0,bn.Z)(A,Gh);(0,Z.Z)(this,S),f=(0,E.Z)(this,S,[(0,m.Z)({type:Jt.PATH,style:_,initialParsedStyle:{miterLimit:4,d:(0,m.Z)({},ca)}},k)]),f.markerStartAngle=0,f.markerEndAngle=0,f.markerMidList=[];var G=f.parsedStyle,ae=G.markerStart,ge=G.markerEnd,Ue=G.markerMid;return ae&&Do(ae)&&(f.markerStartAngle=ae.getLocalEulerAngles(),f.appendChild(ae)),Ue&&Do(Ue)&&f.placeMarkerMid(Ue),ge&&Do(ge)&&(f.markerEndAngle=ge.getLocalEulerAngles(),f.appendChild(ge)),f.transformMarker(!0),f.transformMarker(!1),f}return(0,F.Z)(S,x),(0,V.Z)(S,[{key:"attributeChangedCallback",value:function(A,_,k,G,ae){A==="d"?(this.transformMarker(!0),this.transformMarker(!1),this.placeMarkerMid(this.parsedStyle.markerMid)):A==="markerStartOffset"||A==="markerEndOffset"?(this.transformMarker(!0),this.transformMarker(!1)):A==="markerStart"?(G&&Do(G)&&(this.markerStartAngle=0,G.remove()),ae&&Do(ae)&&(this.markerStartAngle=ae.getLocalEulerAngles(),this.appendChild(ae),this.transformMarker(!0))):A==="markerEnd"?(G&&Do(G)&&(this.markerEndAngle=0,G.remove()),ae&&Do(ae)&&(this.markerEndAngle=ae.getLocalEulerAngles(),this.appendChild(ae),this.transformMarker(!1))):A==="markerMid"&&this.placeMarkerMid(ae)}},{key:"transformMarker",value:function(A){var _=this.parsedStyle,k=_.markerStart,G=_.markerEnd,ae=_.markerStartOffset,ge=_.markerEndOffset,Ue=A?k:G;if(!(!Ue||!Do(Ue))){var rt=0,bt,Zt,wn,mn,Gn,ir;if(A){var tr=this.getStartTangent(),Zn=(0,C.Z)(tr,2),Tr=Zn[0],ni=Zn[1];wn=ni[0],mn=ni[1],bt=Tr[0]-ni[0],Zt=Tr[1]-ni[1],Gn=ae||0,ir=this.markerStartAngle}else{var ns=this.getEndTangent(),is=(0,C.Z)(ns,2),bi=is[0],Ri=is[1];wn=Ri[0],mn=Ri[1],bt=bi[0]-Ri[0],Zt=bi[1]-Ri[1],Gn=ge||0,ir=this.markerEndAngle}rt=Math.atan2(Zt,bt),Ue.setLocalEulerAngles(rt*180/Math.PI+ir),Ue.setLocalPosition(wn+Math.cos(rt)*Gn,mn+Math.sin(rt)*Gn)}}},{key:"placeMarkerMid",value:function(A){var _=this.parsedStyle.d.segments;if(this.markerMidList.forEach(function(rt){rt.remove()}),A&&Do(A))for(var k=1;k<_.length-1;k++){var G=(0,C.Z)(_[k].currentPoint,2),ae=G[0],ge=G[1],Ue=k===1?A:A.cloneNode(!0);this.markerMidList.push(Ue),this.appendChild(Ue),Ue.setLocalPosition(ae,ge)}}},{key:"getTotalLength",value:function(){return ri(this)}},{key:"getPointAtLength",value:function(A){var _=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,k=this.parsedStyle.d.absolutePath,G=es(k,A),ae=G.x,ge=G.y,Ue=D.fF(D.Ue(),D.al(ae,ge,0),_?this.getWorldTransform():this.getLocalTransform());return new xt(Ue[0],Ue[1])}},{key:"getPoint",value:function(A){var _=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return this.getPointAtLength(A*ri(this),_)}},{key:"getStartTangent",value:function(){var A=this.parsedStyle.d.segments,_=[];if(A.length>1){var k=A[0].currentPoint,G=A[1].currentPoint,ae=A[1].startTangent;_=[],ae?(_.push([k[0]-ae[0],k[1]-ae[1]]),_.push([k[0],k[1]])):(_.push([G[0],G[1]]),_.push([k[0],k[1]]))}return _}},{key:"getEndTangent",value:function(){var A=this.parsedStyle.d.segments,_=A.length,k=[];if(_>1){var G=A[_-2].currentPoint,ae=A[_-1].currentPoint,ge=A[_-1].endTangent;k=[],ge?(k.push([ae[0]-ge[0],ae[1]-ge[1]]),k.push([ae[0],ae[1]])):(k.push([G[0],G[1]]),k.push([ae[0],ae[1]]))}return k}}])}(wo);Mf.PARSED_STYLE_LIST=new Set([].concat((0,N.Z)(wo.PARSED_STYLE_LIST),["d","markerStart","markerMid","markerEnd","markerStartOffset","markerEndOffset","isBillboard","isSizeAttenuation"]));var bu=["style"],eu=function(x){function S(){var f,A=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},_=A.style,k=(0,bn.Z)(A,bu);(0,Z.Z)(this,S),f=(0,E.Z)(this,S,[(0,m.Z)({type:Jt.POLYGON,style:_,initialParsedStyle:{points:{points:[],totalLength:0,segments:[]},miterLimit:4,isClosed:!0}},k)]),f.markerStartAngle=0,f.markerEndAngle=0,f.markerMidList=[];var G=f.parsedStyle,ae=G.markerStart,ge=G.markerEnd,Ue=G.markerMid;return ae&&Do(ae)&&(f.markerStartAngle=ae.getLocalEulerAngles(),f.appendChild(ae)),Ue&&Do(Ue)&&f.placeMarkerMid(Ue),ge&&Do(ge)&&(f.markerEndAngle=ge.getLocalEulerAngles(),f.appendChild(ge)),f.transformMarker(!0),f.transformMarker(!1),f}return(0,F.Z)(S,x),(0,V.Z)(S,[{key:"attributeChangedCallback",value:function(A,_,k,G,ae){A==="points"?(this.transformMarker(!0),this.transformMarker(!1),this.placeMarkerMid(this.parsedStyle.markerMid)):A==="markerStartOffset"||A==="markerEndOffset"?(this.transformMarker(!0),this.transformMarker(!1)):A==="markerStart"?(G&&Do(G)&&(this.markerStartAngle=0,G.remove()),ae&&Do(ae)&&(this.markerStartAngle=ae.getLocalEulerAngles(),this.appendChild(ae),this.transformMarker(!0))):A==="markerEnd"?(G&&Do(G)&&(this.markerEndAngle=0,G.remove()),ae&&Do(ae)&&(this.markerEndAngle=ae.getLocalEulerAngles(),this.appendChild(ae),this.transformMarker(!1))):A==="markerMid"&&this.placeMarkerMid(ae)}},{key:"transformMarker",value:function(A){var _=this.parsedStyle,k=_.markerStart,G=_.markerEnd,ae=_.markerStartOffset,ge=_.markerEndOffset,Ue=_.points,rt=Ue||{},bt=rt.points,Zt=A?k:G;if(!(!Zt||!Do(Zt)||!bt)){var wn=0,mn,Gn,ir,tr,Zn,Tr;if(ir=bt[0][0],tr=bt[0][1],A)mn=bt[1][0]-bt[0][0],Gn=bt[1][1]-bt[0][1],Zn=ae||0,Tr=this.markerStartAngle;else{var ni=bt.length;this.parsedStyle.isClosed?(mn=bt[ni-1][0]-bt[0][0],Gn=bt[ni-1][1]-bt[0][1]):(ir=bt[ni-1][0],tr=bt[ni-1][1],mn=bt[ni-2][0]-bt[ni-1][0],Gn=bt[ni-2][1]-bt[ni-1][1]),Zn=ge||0,Tr=this.markerEndAngle}wn=Math.atan2(Gn,mn),Zt.setLocalEulerAngles(wn*180/Math.PI+Tr),Zt.setLocalPosition(ir+Math.cos(wn)*Zn,tr+Math.sin(wn)*Zn)}}},{key:"placeMarkerMid",value:function(A){var _=this.parsedStyle.points,k=_||{},G=k.points;if(this.markerMidList.forEach(function(bt){bt.remove()}),this.markerMidList=[],A&&Do(A)&&G)for(var ae=1;ae<(this.parsedStyle.isClosed?G.length:G.length-1);ae++){var ge=G[ae][0],Ue=G[ae][1],rt=ae===1?A:A.cloneNode(!0);this.markerMidList.push(rt),this.appendChild(rt),rt.setLocalPosition(ge,Ue)}}}])}(wo);eu.PARSED_STYLE_LIST=new Set([].concat((0,N.Z)(wo.PARSED_STYLE_LIST),["points","markerStart","markerMid","markerEnd","markerStartOffset","markerEndOffset","isClosed","isBillboard","isSizeAttenuation"]));var Ef=["style"],Dl=function(x){function S(){var f=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},A=f.style,_=(0,bn.Z)(f,Ef);return(0,Z.Z)(this,S),(0,E.Z)(this,S,[(0,m.Z)({type:Jt.POLYLINE,style:A,initialParsedStyle:{points:{points:[],totalLength:0,segments:[]},miterLimit:4,isClosed:!1}},_)])}return(0,F.Z)(S,x),(0,V.Z)(S,[{key:"getTotalLength",value:function(){return ai(this)}},{key:"getPointAtLength",value:function(A){var _=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return this.getPoint(A/this.getTotalLength(),_)}},{key:"getPoint",value:function(A){var _=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,k=this.parsedStyle.points.points;if(this.parsedStyle.points.segments.length===0){var G=[],ae=0,ge,Ue,rt=this.getTotalLength();k.forEach(function(tr,Zn){k[Zn+1]&&(ge=[0,0],ge[0]=ae/rt,Ue=(0,Xt.Xk)(tr[0],tr[1],k[Zn+1][0],k[Zn+1][1]),ae+=Ue,ge[1]=ae/rt,G.push(ge))}),this.parsedStyle.points.segments=G}var bt=0,Zt=0;this.parsedStyle.points.segments.forEach(function(tr,Zn){A>=tr[0]&&A<=tr[1]&&(bt=(A-tr[0])/(tr[1]-tr[0]),Zt=Zn)});var wn=(0,Xt.U4)(k[Zt][0],k[Zt][1],k[Zt+1][0],k[Zt+1][1],bt),mn=wn.x,Gn=wn.y,ir=D.fF(D.Ue(),D.al(mn,Gn,0),_?this.getWorldTransform():this.getLocalTransform());return new xt(ir[0],ir[1])}},{key:"getStartTangent",value:function(){var A=this.parsedStyle.points.points,_=[];return _.push([A[1][0],A[1][1]]),_.push([A[0][0],A[0][1]]),_}},{key:"getEndTangent",value:function(){var A=this.parsedStyle.points.points,_=A.length-1,k=[];return k.push([A[_-1][0],A[_-1][1]]),k.push([A[_][0],A[_][1]]),k}}])}(eu);Dl.PARSED_STYLE_LIST=new Set([].concat((0,N.Z)(eu.PARSED_STYLE_LIST),["points","markerStart","markerMid","markerEnd","markerStartOffset","markerEndOffset","isBillboard"]));var Bh=function(x){function S(){var f=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return(0,Z.Z)(this,S),(0,E.Z)(this,S,[(0,m.Z)({type:Jt.RECT},f)])}return(0,F.Z)(S,x),(0,V.Z)(S)}(wo);Bh.PARSED_STYLE_LIST=new Set([].concat((0,N.Z)(wo.PARSED_STYLE_LIST),["x","y","z","width","height","isBillboard","isSizeAttenuation","radius"]));var Cf=["style"],tu=function(x){function S(){var f=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},A=f.style,_=(0,bn.Z)(f,Cf);return(0,Z.Z)(this,S),(0,E.Z)(this,S,[(0,m.Z)({type:Jt.TEXT,style:(0,m.Z)({fill:"black"},A)},_)])}return(0,F.Z)(S,x),(0,V.Z)(S,[{key:"getComputedTextLength",value:function(){var A;return this.getGeometryBounds(),((A=this.parsedStyle.metrics)===null||A===void 0?void 0:A.maxLineWidth)||0}},{key:"getLineBoundingRects",value:function(){var A;return this.getGeometryBounds(),((A=this.parsedStyle.metrics)===null||A===void 0?void 0:A.lineMetrics)||[]}},{key:"isOverflowing",value:function(){return this.getGeometryBounds(),!!this.parsedStyle.isOverflowing}}])}(wo);tu.PARSED_STYLE_LIST=new Set([].concat((0,N.Z)(wo.PARSED_STYLE_LIST),["x","y","z","isBillboard","billboardRotation","isSizeAttenuation","text","textAlign","textBaseline","fontStyle","fontSize","fontFamily","fontWeight","fontVariant","lineHeight","letterSpacing","leading","wordWrap","wordWrapWidth","maxLines","textOverflow","isOverflowing","textPath","textDecorationLine","textDecorationColor","textDecorationStyle","textDecorationThickness","textPathSide","textPathStartOffset","metrics","dx","dy"]));var FA=function(){function x(){(0,Z.Z)(this,x),this.registry={},this.define(Jt.CIRCLE,Ch),this.define(Jt.ELLIPSE,zh),this.define(Jt.RECT,Bh),this.define(Jt.IMAGE,oh),this.define(Jt.LINE,Sf),this.define(Jt.GROUP,Xd),this.define(Jt.PATH,Mf),this.define(Jt.POLYGON,eu),this.define(Jt.POLYLINE,Dl),this.define(Jt.TEXT,tu),this.define(Jt.HTML,Th)}return(0,V.Z)(x,[{key:"define",value:function(f,A){this.registry[f]=A}},{key:"get",value:function(f){return this.registry[f]}}])}(),Wc={number:function(S){return new Bo(S)},percent:function(S){return new Bo(S,"%")},px:function(S){return new Bo(S,"px")},em:function(S){return new Bo(S,"em")},rem:function(S){return new Bo(S,"rem")},deg:function(S){return new Bo(S,"deg")},grad:function(S){return new Bo(S,"grad")},rad:function(S){return new Bo(S,"rad")},turn:function(S){return new Bo(S,"turn")},s:function(S){return new Bo(S,"s")},ms:function(S){return new Bo(S,"ms")},registerProperty:function(S){var f=S.name,A=S.inherits,_=S.interpolable,k=S.initialValue,G=S.syntax;Oi.styleValueRegistry.registerMetadata({n:f,inh:A,int:_,d:k,syntax:G})},registerLayout:function(S,f){Oi.layoutRegistry.registerLayout(S,f)}},PA=function(x){function S(){var f;(0,Z.Z)(this,S),f=(0,E.Z)(this,S),f.defaultView=null,f.ownerDocument=null,f.nodeName="document";try{f.timeline=new Oi.AnimationTimeline(f)}catch(_){}var A={};return Ua.forEach(function(_){var k=_.n,G=_.inh,ae=_.d;G&&ae&&(A[k]=(0,yi.Z)(ae)?ae(Jt.GROUP):ae)}),f.documentElement=new Xd({id:"g-root",style:A}),f.documentElement.ownerDocument=f,f.documentElement.parentNode=f,f.childNodes=[f.documentElement],f}return(0,F.Z)(S,x),(0,V.Z)(S,[{key:"children",get:function(){return this.childNodes}},{key:"childElementCount",get:function(){return this.childNodes.length}},{key:"firstElementChild",get:function(){return this.firstChild}},{key:"lastElementChild",get:function(){return this.lastChild}},{key:"createElement",value:function(A,_){if(A==="svg")return this.documentElement;var k=this.defaultView.customElements.get(A);k||(console.warn("Unsupported tagName: ",A),k=A==="tspan"?tu:Xd);var G=new k(_);return G.ownerDocument=this,G}},{key:"createElementNS",value:function(A,_,k){return this.createElement(_,k)}},{key:"cloneNode",value:function(A){throw new Error(Oe)}},{key:"destroy",value:function(){try{this.documentElement.destroyChildren(),this.timeline.destroy()}catch(A){}}},{key:"elementsFromBBox",value:function(A,_,k,G){var ae=[],ge=function(rt){if(!(!rt.isInteractive()||rt.isCulled())){var bt=rt.parsedStyle.pointerEvents,Zt=bt===void 0?"auto":bt,wn=["auto","visiblepainted","visiblefill","visiblestroke","visible"].includes(Zt);if(!wn||rt.isVisible()){var mn=rt.getTransformedGeometryBounds(!0);mn&&!ie.isEmpty(mn)&&mn.max[0]>=A&&mn.min[0]<=k&&mn.max[1]>=_&&mn.min[1]<=G&&ae.push(rt)}rt.childNodes&&rt.childNodes.forEach(function(Gn){Gn instanceof wo&&ge(Gn)})}};return ge(this.documentElement),ae.sort(function(Ue,rt){return rt.sortable.renderOrder-Ue.sortable.renderOrder}),ae}},{key:"elementFromPointSync",value:function(A,_){var k=this.defaultView.canvas2Viewport({x:A,y:_}),G=k.x,ae=k.y,ge=this.defaultView.getConfig(),Ue=ge.width,rt=ge.height;if(G<0||ae<0||G>Ue||ae>rt)return null;var bt=this.defaultView.viewport2Client({x:G,y:ae}),Zt=bt.x,wn=bt.y,mn=this.defaultView.getRenderingService().hooks.pickSync.call({topmost:!0,position:{x:A,y:_,viewportX:G,viewportY:ae,clientX:Zt,clientY:wn},picked:[]}),Gn=mn.picked;return Gn&&Gn[0]||this.documentElement}},{key:"elementFromPoint",value:function(){var f=(0,dt.Z)((0,st.Z)().mark(function _(k,G){var ae,ge,Ue,rt,bt,Zt,wn,mn,Gn,ir,tr;return(0,st.Z)().wrap(function(Zn){for(;;)switch(Zn.prev=Zn.next){case 0:if(ae=this.defaultView.canvas2Viewport({x:k,y:G}),ge=ae.x,Ue=ae.y,rt=this.defaultView.getConfig(),bt=rt.width,Zt=rt.height,!(ge<0||Ue<0||ge>bt||Ue>Zt)){Zn.next=1;break}return Zn.abrupt("return",null);case 1:return wn=this.defaultView.viewport2Client({x:ge,y:Ue}),mn=wn.x,Gn=wn.y,Zn.next=2,this.defaultView.getRenderingService().hooks.pick.promise({topmost:!0,position:{x:k,y:G,viewportX:ge,viewportY:Ue,clientX:mn,clientY:Gn},picked:[]});case 2:return ir=Zn.sent,tr=ir.picked,Zn.abrupt("return",tr&&tr[0]||this.documentElement);case 3:case"end":return Zn.stop()}},_,this)}));function A(_,k){return f.apply(this,arguments)}return A}()},{key:"elementsFromPointSync",value:function(A,_){var k=this.defaultView.canvas2Viewport({x:A,y:_}),G=k.x,ae=k.y,ge=this.defaultView.getConfig(),Ue=ge.width,rt=ge.height;if(G<0||ae<0||G>Ue||ae>rt)return[];var bt=this.defaultView.viewport2Client({x:G,y:ae}),Zt=bt.x,wn=bt.y,mn=this.defaultView.getRenderingService().hooks.pickSync.call({topmost:!1,position:{x:A,y:_,viewportX:G,viewportY:ae,clientX:Zt,clientY:wn},picked:[]}),Gn=mn.picked;return Gn[Gn.length-1]!==this.documentElement&&Gn.push(this.documentElement),Gn}},{key:"elementsFromPoint",value:function(){var f=(0,dt.Z)((0,st.Z)().mark(function _(k,G){var ae,ge,Ue,rt,bt,Zt,wn,mn,Gn,ir,tr;return(0,st.Z)().wrap(function(Zn){for(;;)switch(Zn.prev=Zn.next){case 0:if(ae=this.defaultView.canvas2Viewport({x:k,y:G}),ge=ae.x,Ue=ae.y,rt=this.defaultView.getConfig(),bt=rt.width,Zt=rt.height,!(ge<0||Ue<0||ge>bt||Ue>Zt)){Zn.next=1;break}return Zn.abrupt("return",[]);case 1:return wn=this.defaultView.viewport2Client({x:ge,y:Ue}),mn=wn.x,Gn=wn.y,Zn.next=2,this.defaultView.getRenderingService().hooks.pick.promise({topmost:!1,position:{x:k,y:G,viewportX:ge,viewportY:Ue,clientX:mn,clientY:Gn},picked:[]});case 2:return ir=Zn.sent,tr=ir.picked,tr[tr.length-1]!==this.documentElement&&tr.push(this.documentElement),Zn.abrupt("return",tr);case 3:case"end":return Zn.stop()}},_,this)}));function A(_,k){return f.apply(this,arguments)}return A}()},{key:"appendChild",value:function(A,_){throw new Error(Qe)}},{key:"insertBefore",value:function(A,_){throw new Error(Qe)}},{key:"removeChild",value:function(A,_){throw new Error(Qe)}},{key:"replaceChild",value:function(A,_,k){throw new Error(Qe)}},{key:"append",value:function(){throw new Error(Qe)}},{key:"prepend",value:function(){throw new Error(Qe)}},{key:"getElementById",value:function(A){return this.documentElement.getElementById(A)}},{key:"getElementsByName",value:function(A){return this.documentElement.getElementsByName(A)}},{key:"getElementsByTagName",value:function(A){return this.documentElement.getElementsByTagName(A)}},{key:"getElementsByClassName",value:function(A){return this.documentElement.getElementsByClassName(A)}},{key:"querySelector",value:function(A){return this.documentElement.querySelector(A)}},{key:"querySelectorAll",value:function(A){return this.documentElement.querySelectorAll(A)}},{key:"find",value:function(A){return this.documentElement.find(A)}},{key:"findAll",value:function(A){return this.documentElement.findAll(A)}}])}(vo),jd=function(){function x(S){(0,Z.Z)(this,x),this.strategies=S}return(0,V.Z)(x,[{key:"apply",value:function(f){var A=f.config,_=f.camera,k=f.renderingService,G=f.renderingContext,ae=this.strategies;k.hooks.cull.tap(x.tag,function(ge){if(ge){var Ue,rt=ge.cullable;if(ae.length===0?rt.visible=G.unculledEntities.indexOf(ge.entity)>-1:rt.visible=ae.every(function(Zt){return Zt.isVisible(_,ge)}),!ge.isCulled()&&ge.isVisible())return ge;var bt=((Ue=A.future)===null||Ue===void 0?void 0:Ue.experimentalCancelEventPropagation)===!0;return ge.dispatchEvent(new xu(Ra.CULLED),bt,bt),null}return ge}),k.hooks.afterRender.tap(x.tag,function(ge){ge.cullable.visibilityPlaneMask=-1})}}])}();jd.tag="Culling";var _u=function(){function x(){var S=this;(0,Z.Z)(this,x),this.autoPreventDefault=!1,this.rootPointerEvent=new Qd(null),this.rootWheelEvent=new Wd(null),this.onPointerMove=function(f){var A,_=(A=S.context.renderingContext.root)===null||A===void 0||(A=A.ownerDocument)===null||A===void 0?void 0:A.defaultView;if(!(_.supportsTouchEvents&&f.pointerType==="touch")){var k=S.normalizeToPointerEvent(f,_),G=(0,Wt.Z)(k),ae;try{for(G.s();!(ae=G.n()).done;){var ge=ae.value,Ue=S.bootstrapEvent(S.rootPointerEvent,ge,_,f);S.context.eventService.mapEvent(Ue)}}catch(rt){G.e(rt)}finally{G.f()}S.setCursor(S.context.eventService.cursor)}},this.onClick=function(f){var A,_=(A=S.context.renderingContext.root)===null||A===void 0||(A=A.ownerDocument)===null||A===void 0?void 0:A.defaultView,k=S.normalizeToPointerEvent(f,_),G=(0,Wt.Z)(k),ae;try{for(G.s();!(ae=G.n()).done;){var ge=ae.value,Ue=S.bootstrapEvent(S.rootPointerEvent,ge,_,f);S.context.eventService.mapEvent(Ue)}}catch(rt){G.e(rt)}finally{G.f()}S.setCursor(S.context.eventService.cursor)}}return(0,V.Z)(x,[{key:"apply",value:function(f){var A=this;this.context=f;var _=f.renderingService,k=this.context.renderingContext.root.ownerDocument.defaultView;this.context.eventService.setPickHandler(function(G){var ae=A.context.renderingService.hooks.pickSync.call({position:G,picked:[],topmost:!0}),ge=ae.picked;return ge[0]||null}),_.hooks.pointerWheel.tap(x.tag,function(G){var ae=A.normalizeWheelEvent(G);A.context.eventService.mapEvent(ae)}),_.hooks.pointerDown.tap(x.tag,function(G){if(!(k.supportsTouchEvents&&G.pointerType==="touch")){var ae=A.normalizeToPointerEvent(G,k);if(A.autoPreventDefault&&ae[0].isNormalized){var ge=G.cancelable||!("cancelable"in G);ge&&G.preventDefault()}var Ue=(0,Wt.Z)(ae),rt;try{for(Ue.s();!(rt=Ue.n()).done;){var bt=rt.value,Zt=A.bootstrapEvent(A.rootPointerEvent,bt,k,G);A.context.eventService.mapEvent(Zt)}}catch(wn){Ue.e(wn)}finally{Ue.f()}A.setCursor(A.context.eventService.cursor)}}),_.hooks.pointerUp.tap(x.tag,function(G){if(!(k.supportsTouchEvents&&G.pointerType==="touch")){var ae=A.context.contextService.getDomElement(),ge=A.context.eventService.isNativeEventFromCanvas(ae,G),Ue=ge?"":"outside",rt=A.normalizeToPointerEvent(G,k),bt=(0,Wt.Z)(rt),Zt;try{for(bt.s();!(Zt=bt.n()).done;){var wn=Zt.value,mn=A.bootstrapEvent(A.rootPointerEvent,wn,k,G);mn.type+=Ue,A.context.eventService.mapEvent(mn)}}catch(Gn){bt.e(Gn)}finally{bt.f()}A.setCursor(A.context.eventService.cursor)}}),_.hooks.pointerMove.tap(x.tag,this.onPointerMove),_.hooks.pointerOver.tap(x.tag,this.onPointerMove),_.hooks.pointerOut.tap(x.tag,this.onPointerMove),_.hooks.click.tap(x.tag,this.onClick),_.hooks.pointerCancel.tap(x.tag,function(G){var ae=A.normalizeToPointerEvent(G,k),ge=(0,Wt.Z)(ae),Ue;try{for(ge.s();!(Ue=ge.n()).done;){var rt=Ue.value,bt=A.bootstrapEvent(A.rootPointerEvent,rt,k,G);A.context.eventService.mapEvent(bt)}}catch(Zt){ge.e(Zt)}finally{ge.f()}A.setCursor(A.context.eventService.cursor)})}},{key:"bootstrapEvent",value:function(f,A,_,k){f.view=_,f.originalEvent=null,f.nativeEvent=k,f.pointerId=A.pointerId,f.width=A.width,f.height=A.height,f.isPrimary=A.isPrimary,f.pointerType=A.pointerType,f.pressure=A.pressure,f.tangentialPressure=A.tangentialPressure,f.tiltX=A.tiltX,f.tiltY=A.tiltY,f.twist=A.twist,this.transferMouseData(f,A);var G=this.context.eventService.client2Viewport({x:A.clientX,y:A.clientY}),ae=G.x,ge=G.y;f.viewport.x=ae,f.viewport.y=ge;var Ue=this.context.eventService.viewport2Canvas(f.viewport),rt=Ue.x,bt=Ue.y;return f.canvas.x=rt,f.canvas.y=bt,f.global.copyFrom(f.canvas),f.offset.copyFrom(f.canvas),f.isTrusted=k.isTrusted,f.type==="pointerleave"&&(f.type="pointerout"),f.type.startsWith("mouse")&&(f.type=f.type.replace("mouse","pointer")),f.type.startsWith("touch")&&(f.type=Hc[f.type]||f.type),f}},{key:"normalizeWheelEvent",value:function(f){var A=this.rootWheelEvent;this.transferMouseData(A,f),A.deltaMode=f.deltaMode,A.deltaX=f.deltaX,A.deltaY=f.deltaY,A.deltaZ=f.deltaZ;var _=this.context.eventService.client2Viewport({x:f.clientX,y:f.clientY}),k=_.x,G=_.y;A.viewport.x=k,A.viewport.y=G;var ae=this.context.eventService.viewport2Canvas(A.viewport),ge=ae.x,Ue=ae.y;return A.canvas.x=ge,A.canvas.y=Ue,A.global.copyFrom(A.canvas),A.offset.copyFrom(A.canvas),A.nativeEvent=f,A.type=f.type,A}},{key:"transferMouseData",value:function(f,A){f.isTrusted=A.isTrusted,f.srcElement=A.srcElement,f.timeStamp=yu.now(),f.type=A.type,f.altKey=A.altKey,f.metaKey=A.metaKey,f.shiftKey=A.shiftKey,f.ctrlKey=A.ctrlKey,f.button=A.button,f.buttons=A.buttons,f.client.x=A.clientX,f.client.y=A.clientY,f.movement.x=A.movementX,f.movement.y=A.movementY,f.page.x=A.pageX,f.page.y=A.pageY,f.screen.x=A.screenX,f.screen.y=A.screenY,f.relatedTarget=null}},{key:"setCursor",value:function(f){this.context.contextService.applyCursorStyle(f||this.context.config.cursor||"default")}},{key:"normalizeToPointerEvent",value:function(f,A){var _=[];if(A.isTouchEvent(f))for(var k=0;k<f.changedTouches.length;k++){var G=f.changedTouches[k];(0,vr.Z)(G.button)&&(G.button=0),(0,vr.Z)(G.buttons)&&(G.buttons=1),(0,vr.Z)(G.isPrimary)&&(G.isPrimary=f.touches.length===1&&f.type==="touchstart"),(0,vr.Z)(G.width)&&(G.width=G.radiusX||1),(0,vr.Z)(G.height)&&(G.height=G.radiusY||1),(0,vr.Z)(G.tiltX)&&(G.tiltX=0),(0,vr.Z)(G.tiltY)&&(G.tiltY=0),(0,vr.Z)(G.pointerType)&&(G.pointerType="touch"),(0,vr.Z)(G.pointerId)&&(G.pointerId=G.identifier||0),(0,vr.Z)(G.pressure)&&(G.pressure=G.force||.5),(0,vr.Z)(G.twist)&&(G.twist=0),(0,vr.Z)(G.tangentialPressure)&&(G.tangentialPressure=0),G.isNormalized=!0,G.type=f.type,_.push(G)}else if(A.isMouseEvent(f)){var ae=f;(0,vr.Z)(ae.isPrimary)&&(ae.isPrimary=!0),(0,vr.Z)(ae.width)&&(ae.width=1),(0,vr.Z)(ae.height)&&(ae.height=1),(0,vr.Z)(ae.tiltX)&&(ae.tiltX=0),(0,vr.Z)(ae.tiltY)&&(ae.tiltY=0),(0,vr.Z)(ae.pointerType)&&(ae.pointerType="mouse"),(0,vr.Z)(ae.pointerId)&&(ae.pointerId=Wr),(0,vr.Z)(ae.pressure)&&(ae.pressure=.5),(0,vr.Z)(ae.twist)&&(ae.twist=0),(0,vr.Z)(ae.tangentialPressure)&&(ae.tangentialPressure=0),ae.isNormalized=!0,_.push(ae)}else _.push(f);return _}}])}();_u.tag="Event";var Yd=[Jt.CIRCLE,Jt.ELLIPSE,Jt.IMAGE,Jt.RECT,Jt.LINE,Jt.POLYLINE,Jt.POLYGON,Jt.TEXT,Jt.PATH,Jt.HTML],up=function(){function x(){(0,Z.Z)(this,x)}return(0,V.Z)(x,[{key:"isVisible",value:function(f,A){var _,k=A.cullable;if(!k.enable)return!0;var G=A.getRenderBounds();if(ie.isEmpty(G))return!1;var ae=f.getFrustum(),ge=(_=A.parentNode)===null||_===void 0||(_=_.cullable)===null||_===void 0?void 0:_.visibilityPlaneMask;return k.visibilityPlaneMask=this.computeVisibilityWithPlaneMask(A,G,ge||Je.INDETERMINATE,ae.planes),k.visible=k.visibilityPlaneMask!==Je.OUTSIDE,k.visible}},{key:"computeVisibilityWithPlaneMask",value:function(f,A,_,k){if(_===Je.OUTSIDE||_===Je.INSIDE)return _;for(var G=Je.INSIDE,ae=Yd.indexOf(f.nodeName)>-1,ge=0,Ue=k.length;ge<Ue;++ge){var rt=1<<ge;if(_&rt&&!(ae&&(ge===4||ge===5))){var bt=k[ge],Zt=bt.normal,wn=bt.distance;if(D.AK(Zt,A.getPositiveFarPoint(k[ge]))+wn<0)return Je.OUTSIDE;D.AK(Zt,A.getNegativeFarPoint(k[ge]))+wn<0&&(G|=rt)}}return G}}])}(),lh=function(){function x(){(0,Z.Z)(this,x),this.mutationRecords=[],this.isFirstTimeRendering=!0,this.isFirstTimeRenderingFinished=!1}return(0,V.Z)(x,[{key:"apply",value:function(f){var A=this,_,k=f.renderingService,G=f.renderingContext,ae=G.root.ownerDocument.defaultView,ge=function(mn){k.dirty()},Ue=function(mn){var Gn,ir=mn.detail;(Gn=A.mutationRecords).push.apply(Gn,(0,N.Z)(ir)),k.dirty()},rt=function(mn){var Gn=mn.target;Oi.enableSizeAttenuation&&Oi.styleValueRegistry.updateSizeAttenuation(Gn,ae.getCamera().getZoom())},bt=function(mn){var Gn=mn.target;Oi.sceneGraphService.dirtyToRoot(Gn),k.dirty()};k.hooks.init.tap(x.tag,function(){ae.addEventListener(Ra.MOUNTED,rt),ae.addEventListener(Ra.UNMOUNTED,bt),ae.addEventListener(Ra.ATTR_MODIFIED,ge),ae.addEventListener(Ra.BOUNDS_CHANGED,Ue)}),k.hooks.destroy.tap(x.tag,function(){ae.removeEventListener(Ra.MOUNTED,rt),ae.removeEventListener(Ra.UNMOUNTED,bt),ae.removeEventListener(Ra.ATTR_MODIFIED,ge),ae.removeEventListener(Ra.BOUNDS_CHANGED,Ue),A.mutationRecords=[]});var Zt=(_=Oi.globalThis.requestIdleCallback)!==null&&_!==void 0?_:th.bind(Oi.globalThis);k.hooks.endFrame.tap(x.tag,function(){A.isFirstTimeRendering&&(A.isFirstTimeRendering=!1,Zt(function(){A.isFirstTimeRenderingFinished=!0})),A.mutationRecords=[]})}}])}();lh.tag="Prepare";function Xm(x){return!!x.document}var fl=function(x){return x.READY="ready",x.BEFORE_RENDER="beforerender",x.RERENDER="rerender",x.AFTER_RENDER="afterrender",x.BEFORE_DESTROY="beforedestroy",x.AFTER_DESTROY="afterdestroy",x.RESIZE="resize",x.DIRTY_RECTANGLE="dirtyrectangle",x.RENDERER_CHANGED="rendererchanged",x}({}),Tf=500,cp=.1,Tg=1e3,nd=new xu(Ra.MOUNTED),nA=new xu(Ra.UNMOUNTED),LA=new xu(fl.BEFORE_RENDER),Vp=new xu(fl.RERENDER),qd=new xu(fl.AFTER_RENDER),rA=function(x){function S(f){var A;(0,Z.Z)(this,S),A=(0,E.Z)(this,S),A.Element=wo,A.inited=!1,A.context={};var _=f.container,k=f.canvas,G=f.renderer,ae=f.width,ge=f.height,Ue=f.background,rt=f.cursor,bt=f.supportsMutipleCanvasesInOneContainer,Zt=f.cleanUpOnDestroy,wn=Zt===void 0?!0:Zt,mn=f.offscreenCanvas,Gn=f.devicePixelRatio,ir=f.requestAnimationFrame,tr=f.cancelAnimationFrame,Zn=f.createImage,Tr=f.supportsTouchEvents,ni=f.supportsPointerEvents,ns=f.isTouchEvent,is=f.isMouseEvent,bi=f.dblClickSpeed,Ri=ae,Gs=ge,_s=Gn||vu&&window.devicePixelRatio||1;return _s=_s>=1?Math.ceil(_s):1,k&&(Ri=ae||EA(k)||k.width/_s,Gs=ge||zu(k)||k.height/_s),A.customElements=new FA,A.devicePixelRatio=_s,A.requestAnimationFrame=ir!=null?ir:th.bind(Oi.globalThis),A.cancelAnimationFrame=tr!=null?tr:ff.bind(Oi.globalThis),A.createImage=Zn!=null?Zn:function(){return new window.Image},A.supportsTouchEvents=Tr!=null?Tr:"ontouchstart"in Oi.globalThis,A.supportsPointerEvents=ni!=null?ni:!!Oi.globalThis.PointerEvent,A.isTouchEvent=ns!=null?ns:function(Hs){return A.supportsTouchEvents&&Hs instanceof Oi.globalThis.TouchEvent},A.isMouseEvent=is!=null?is:function(Hs){return!Oi.globalThis.MouseEvent||Hs instanceof Oi.globalThis.MouseEvent&&(!A.supportsPointerEvents||!(Hs instanceof Oi.globalThis.PointerEvent))},mn&&(Oi.offscreenCanvas=mn),A.document=new PA,A.document.defaultView=A,bt||Co(_,A,wn),A.initRenderingContext((0,m.Z)((0,m.Z)({},f),{},{width:Ri,height:Gs,background:Ue!=null?Ue:"transparent",cursor:rt!=null?rt:"default",cleanUpOnDestroy:wn,devicePixelRatio:_s,requestAnimationFrame:A.requestAnimationFrame,cancelAnimationFrame:A.cancelAnimationFrame,createImage:A.createImage,supportsTouchEvents:A.supportsTouchEvents,supportsPointerEvents:A.supportsPointerEvents,isTouchEvent:A.isTouchEvent,isMouseEvent:A.isMouseEvent,dblClickSpeed:bi!=null?bi:200})),A.initDefaultCamera(Ri,Gs,G.clipSpaceNearZ),A.initRenderer(G,!0),A}return(0,F.Z)(S,x),(0,V.Z)(S,[{key:"initRenderingContext",value:function(A){this.context.config=A,this.context.renderingContext={root:this.document.documentElement,unculledEntities:[],renderListCurrentFrame:[],renderReasons:new Set,force:!1,dirty:!1}}},{key:"initDefaultCamera",value:function(A,_,k){var G=this,ae=new Oi.CameraContribution;ae.clipSpaceNearZ=k,ae.setType(Bt.EXPLORING,yn.DEFAULT).setPosition(A/2,_/2,Tf).setFocalPoint(A/2,_/2,0).setOrthographic(A/-2,A/2,_/2,_/-2,cp,Tg),ae.canvas=this,ae.eventEmitter.on(gr.UPDATED,function(){G.context.renderingContext.renderReasons.add(rh.CAMERA_CHANGED),Oi.enableSizeAttenuation&&G.getConfig().renderer.getConfig().enableSizeAttenuation&&G.updateSizeAttenuation()}),this.context.camera=ae}},{key:"updateSizeAttenuation",value:function(){var A=this.getCamera().getZoom();this.document.documentElement.forEach(function(_){Oi.styleValueRegistry.updateSizeAttenuation(_,A)})}},{key:"getConfig",value:function(){return this.context.config}},{key:"getRoot",value:function(){return this.document.documentElement}},{key:"getCamera",value:function(){return this.context.camera}},{key:"getContextService",value:function(){return this.context.contextService}},{key:"getEventService",value:function(){return this.context.eventService}},{key:"getRenderingService",value:function(){return this.context.renderingService}},{key:"getRenderingContext",value:function(){return this.context.renderingContext}},{key:"getStats",value:function(){return this.getRenderingService().getStats()}},{key:"ready",get:function(){var A=this;return this.readyPromise||(this.readyPromise=new Promise(function(_){A.resolveReadyPromise=function(){_(A)}}),this.inited&&this.resolveReadyPromise()),this.readyPromise}},{key:"destroy",value:function(){var A,_=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0,k=arguments.length>1?arguments[1]:void 0;Lo.clearCache();var G=((A=this.getConfig().future)===null||A===void 0?void 0:A.experimentalCancelEventPropagation)===!0;k||this.dispatchEvent(new xu(fl.BEFORE_DESTROY),G,G),this.frameId&&this.cancelAnimationFrame(this.frameId);var ae=this.getRoot();_&&(this.unmountChildren(ae),this.document.destroy(),this.getEventService().destroy()),this.getRenderingService().destroy(),this.getContextService().destroy(),k||this.dispatchEvent(new xu(fl.AFTER_DESTROY),G,G);var ge=function(rt){rt.currentTarget=null,rt.manager=null,rt.target=null,rt.relatedNode=null};ge(nd),ge(nA),ge(LA),ge(Vp),ge(qd),ge(Qc),ge(Mh),ge(Ed),ge(Eg),Oi.textService.clearCache()}},{key:"changeSize",value:function(A,_){this.resize(A,_)}},{key:"resize",value:function(A,_){var k,G=this.context.config;G.width=A,G.height=_,this.getContextService().resize(A,_);var ae=this.context.camera,ge=ae.getProjectionMode();ae.setPosition(A/2,_/2,Tf).setFocalPoint(A/2,_/2,0),ge===Ln.ORTHOGRAPHIC?ae.setOrthographic(A/-2,A/2,_/2,_/-2,ae.getNear(),ae.getFar()):ae.setAspect(A/_);var Ue=((k=G.future)===null||k===void 0?void 0:k.experimentalCancelEventPropagation)===!0;this.dispatchEvent(new xu(fl.RESIZE,{width:A,height:_}),Ue,Ue)}},{key:"appendChild",value:function(A,_){return this.document.documentElement.appendChild(A,_)}},{key:"insertBefore",value:function(A,_){return this.document.documentElement.insertBefore(A,_)}},{key:"removeChild",value:function(A){return this.document.documentElement.removeChild(A)}},{key:"removeChildren",value:function(){this.document.documentElement.removeChildren()}},{key:"destroyChildren",value:function(){this.document.documentElement.destroyChildren()}},{key:"render",value:function(A){var _,k=this;A&&(LA.detail=A,qd.detail=A);var G=((_=this.getConfig().future)===null||_===void 0?void 0:_.experimentalCancelEventPropagation)===!0;this.dispatchEvent(LA,G,G);var ae=this.getRenderingService();ae.render(this,A,function(){k.dispatchEvent(Vp,G,G)}),this.dispatchEvent(qd,G,G)}},{key:"run",value:function(){var A=this,_=function(G,ae){A.render(ae),A.frameId=A.requestAnimationFrame(_)};_()}},{key:"initRenderer",value:function(A){var _=this,k=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;if(!A)throw new Error("Renderer is required.");this.inited=!1,this.readyPromise=void 0,this.context.renderingPlugins=[],this.context.renderingPlugins.push(new _u,new lh,new jd([new up])),this.loadRendererContainerModule(A),this.context.contextService=new this.context.ContextService((0,m.Z)((0,m.Z)({},Oi),this.context)),this.context.renderingService=new Mc(Oi,this.context),this.context.eventService=new mf(Oi,this.context),this.context.eventService.init(),this.context.contextService.init?(this.context.contextService.init(),this.initRenderingService(A,k,!0)):this.context.contextService.initAsync().then(function(){_.initRenderingService(A,k)}).catch(function(G){console.error(G)})}},{key:"initRenderingService",value:function(A){var _=this,k=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,G=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;this.context.renderingService.init(function(){var ae;_.inited=!0;var ge=((ae=_.getConfig().future)===null||ae===void 0?void 0:ae.experimentalCancelEventPropagation)===!0;k?G?_.requestAnimationFrame(function(){_.dispatchEvent(new xu(fl.READY),ge,ge)}):_.dispatchEvent(new xu(fl.READY),ge,ge):_.dispatchEvent(new xu(fl.RENDERER_CHANGED),ge,ge),_.readyPromise&&_.resolveReadyPromise(),k||_.getRoot().forEach(function(Ue){var rt,bt;(rt=(bt=Ue).dirty)===null||rt===void 0||rt.call(bt,!0,!0)}),_.mountChildren(_.getRoot()),A.getConfig().enableAutoRendering&&_.run()})}},{key:"loadRendererContainerModule",value:function(A){var _=this,k=A.getPlugins();k.forEach(function(G){G.context=_.context,G.init(Oi)})}},{key:"setRenderer",value:function(A){var _=this.getConfig();if(_.renderer!==A){var k=_.renderer;_.renderer=A,this.destroy(!1,!0),(0,N.Z)((k==null?void 0:k.getPlugins())||[]).reverse().forEach(function(G){G.destroy(Oi)}),this.initRenderer(A)}}},{key:"setCursor",value:function(A){var _=this.getConfig();_.cursor=A,this.getContextService().applyCursorStyle(A)}},{key:"unmountChildren",value:function(A){var _=this;if(A.childNodes.forEach(function(ae){_.unmountChildren(ae)}),this.inited){if(A.isMutationObserved)A.dispatchEvent(nA);else{var k,G=((k=this.getConfig().future)===null||k===void 0?void 0:k.experimentalCancelEventPropagation)===!0;nA.target=A,this.dispatchEvent(nA,!0,G)}A!==this.document.documentElement&&(A.ownerDocument=null),A.isConnected=!1}A.isCustomElement&&A.disconnectedCallback&&A.disconnectedCallback()}},{key:"mountChildren",value:function(A){var _=this,k=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Hl(A);if(this.inited){if(!A.isConnected&&(A.ownerDocument=this.document,A.isConnected=!0,!k))if(A.isMutationObserved)A.dispatchEvent(nd);else{var G,ae=((G=this.getConfig().future)===null||G===void 0?void 0:G.experimentalCancelEventPropagation)===!0;nd.target=A,this.dispatchEvent(nd,!0,ae)}}else console.warn("[g]: You are trying to call `canvas.appendChild` before canvas' initialization finished. You can either await `canvas.ready` or listen to `CanvasEvent.READY` manually.","appended child: ",A.nodeName);A.childNodes.forEach(function(ge){_.mountChildren(ge,k)}),A.isCustomElement&&A.connectedCallback&&A.connectedCallback()}},{key:"mountFragment",value:function(A){this.mountChildren(A,!1)}},{key:"client2Viewport",value:function(A){return this.getEventService().client2Viewport(A)}},{key:"viewport2Client",value:function(A){return this.getEventService().viewport2Client(A)}},{key:"viewport2Canvas",value:function(A){return this.getEventService().viewport2Canvas(A)}},{key:"canvas2Viewport",value:function(A){return this.getEventService().canvas2Viewport(A)}},{key:"getPointByClient",value:function(A,_){return this.client2Viewport({x:A,y:_})}},{key:"getClientByPoint",value:function(A,_){return this.viewport2Client({x:A,y:_})}}])}(Sg),UA=0,hp=new WeakMap,dp=null,Kv=null,jm=null,fp,rd;function Am(x,S){return fp=new dp(x,S)}function pm(x){return rd||(rd=dp.copy(fp),rd.oldValue=x,rd)}function D0(){fp=rd=void 0}function Ym(x){return x===rd||x===fp}function k0(x,S){return x===S?x:rd&&Ym(x)?rd:null}function gm(x){x.nodes.forEach(function(S){var f=hp.get(S);f&&f.forEach(function(A){A.observer===x&&A.removeTransientObservers()})})}function OA(x,S){for(var f=x;f;f=f.parentNode){var A=hp.get(f);if(A)for(var _=0;_<A.length;_++){var k=A[_],G=k.options;if(!(f!==x&&!G.subtree)){var ae=S(G);ae&&k.enqueue(ae)}}}}var DA=!1,Us=null;function Cd(x){Us.push(x),DA||(DA=!0,typeof Oi.globalThis!="undefined"?Oi.globalThis.setTimeout(iA):iA())}function iA(){DA=!1;var x=Us;Us=[],x.sort(function(f,A){return f.uid-A.uid});var S=!1;x.forEach(function(f){var A=f.takeRecords();gm(f),A.length&&(f.callback(A,f),S=!0)}),S&&iA()}var Al=function(){function x(){(0,Z.Z)(this,x),this.cacheStore=new Map}return(0,V.Z)(x,[{key:"onRefAdded",value:function(f){}},{key:"has",value:function(f){return this.cacheStore.has(f)}},{key:"put",value:function(f,A,_){return this.cacheStore.has(f)?!1:(this.cacheStore.set(f,{value:A,counter:new Set([_.entity])}),this.onRefAdded(_),!0)}},{key:"get",value:function(f,A){var _=this.cacheStore.get(f);return _?(_.counter.has(A.entity)||(_.counter.add(A.entity),this.onRefAdded(A)),_.value):null}},{key:"update",value:function(f,A,_){var k=this.cacheStore.get(f);return k?(k.value=(0,m.Z)((0,m.Z)({},k.value),A),k.counter.has(_.entity)||(k.counter.add(_.entity),this.onRefAdded(_)),!0):!1}},{key:"release",value:function(f,A){var _=this.cacheStore.get(f);return _?(_.counter.delete(A.entity),_.counter.size<=0&&this.cacheStore.delete(f),!0):!1}},{key:"releaseRef",value:function(f){var A=this;Array.from(this.cacheStore.keys()).forEach(function(_){A.release(_,f)})}},{key:"getSize",value:function(){return this.cacheStore.size}},{key:"clear",value:function(){this.cacheStore.clear()}}])}(),sA=[],Fo=[],ll=function(){function x(){(0,Z.Z)(this,x)}return(0,V.Z)(x,null,[{key:"stop",value:function(){var f=arguments.length>0&&arguments[0]!==void 0?arguments[0]:x.api;x.rafId&&(f.cancelAnimationFrame(x.rafId),x.rafId=null)}},{key:"executeTask",value:function(){var f=arguments.length>0&&arguments[0]!==void 0?arguments[0]:x.api;sA.length<=0&&Fo.length<=0||(Fo.forEach(function(A){return A()}),Fo=sA.splice(0,x.TASK_NUM_PER_FRAME),x.rafId=f.requestAnimationFrame(function(){x.executeTask(f)}))}},{key:"sliceImage",value:function(f,A,_,k){for(var G=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0,ae=arguments.length>5&&arguments[5]!==void 0?arguments[5]:x.api,ge=f.naturalWidth||f.width,Ue=f.naturalHeight||f.height,rt=A-G,bt=_-G,Zt=Math.ceil(ge/rt),wn=Math.ceil(Ue/bt),mn={tileSize:[A,_],gridSize:[wn,Zt],tiles:Array(wn).fill(null).map(function(){return Array(Zt).fill(null)})},Gn=function(Zn){for(var Tr=function(is){sA.push(function(){var bi=is*rt,Ri=Zn*bt,Gs=[Math.min(A,ge-bi),Math.min(_,Ue-Ri)],_s=Gs[0],Hs=Gs[1],Zs=ae.createCanvas();Zs.width=A,Zs.height=_;var Ia=Zs.getContext("2d");Ia.drawImage(f,bi,Ri,_s,Hs,0,0,_s,Hs),mn.tiles[Zn][is]={x:bi,y:Ri,tileX:is,tileY:Zn,data:Zs},k()})},ni=0;ni<Zt;ni++)Tr(ni)},ir=0;ir<wn;ir++)Gn(ir);return x.stop(),x.executeTask(),mn}}])}();ll.TASK_NUM_PER_FRAME=10;var hc=new Al;hc.onRefAdded=function(S){var f=this;S.addEventListener(Ra.DESTROY,function(){f.releaseRef(S)},{once:!0})};var Cc=function(){function x(S,f){(0,Z.Z)(this,x),this.gradientCache={},this.patternCache={},this.context=S,this.runtime=f}return(0,V.Z)(x,[{key:"getImageSync",value:function(f,A,_){var k=(0,Fe.Z)(f)?f:f.src;if(hc.has(k)){var G=hc.get(k,A);if(G.img.complete)return _==null||_(G),G}return this.getOrCreateImage(f,A).then(function(ae){_==null||_(ae)}).catch(function(ae){console.error(ae)}),null}},{key:"getOrCreateImage",value:function(f,A){var _=this,k=(0,Fe.Z)(f)?f:f.src;if(!(0,Fe.Z)(f)&&!hc.has(k)){var G={img:f,size:[f.naturalWidth||f.width,f.naturalHeight||f.height],tileSize:Rh(f)};hc.put(k,G,A)}if(hc.has(k)){var ae=hc.get(k,A);return ae.img.complete?Promise.resolve(ae):new Promise(function(ge,Ue){ae.img.addEventListener("load",function(){ae.size=[ae.img.naturalWidth||ae.img.width,ae.img.naturalHeight||ae.img.height],ae.tileSize=Rh(ae.img),ge(ae)}),ae.img.addEventListener("error",function(rt){Ue(rt)})})}return new Promise(function(ge,Ue){var rt=_.context.config.createImage();if(rt){var bt={img:rt,size:[0,0],tileSize:Rh(rt)};hc.put(k,bt,A),rt.onload=function(){bt.size=[rt.naturalWidth||rt.width,rt.naturalHeight||rt.height],bt.tileSize=Rh(bt.img),ge(bt)},rt.onerror=function(Zt){Ue(Zt)},rt.crossOrigin="Anonymous",rt.src=k}})}},{key:"createDownSampledImage",value:function(){var S=(0,dt.Z)((0,st.Z)().mark(function A(_,k){var G,ae,ge,Ue,rt,bt,Zt,wn,mn,Gn,ir,tr,Zn,Tr;return(0,st.Z)().wrap(function(ni){for(;;)switch(ni.prev=ni.next){case 0:return ni.next=1,this.getOrCreateImage(_,k);case 1:if(G=ni.sent,typeof G.downSamplingRate=="undefined"){ni.next=2;break}return ni.abrupt("return",G);case 2:if(ae=this.context.config.enableLargeImageOptimization,ge=typeof ae=="boolean"?{}:ae,Ue=ge.maxDownSampledImageSize,rt=Ue===void 0?2048:Ue,bt=ge.downSamplingRateThreshold,Zt=bt===void 0?.5:bt,wn=this.runtime.globalThis.createImageBitmap,mn=(0,C.Z)(G.size,2),Gn=mn[0],ir=mn[1],tr=G.img,Zn=Math.min((rt+rt)/(Gn+ir),Math.max(.01,Math.min(Zt,.5))),Tr=(0,m.Z)((0,m.Z)({},G),{},{downSamplingRate:Zn}),hc.update(G.img.src,Tr,k),!wn){ni.next=7;break}return ni.prev=3,ni.next=4,wn(G.img,{resizeWidth:Gn*Zn,resizeHeight:ir*Zn});case 4:tr=ni.sent,ni.next=6;break;case 5:ni.prev=5,ni.catch(3),Zn=1;case 6:ni.next=8;break;case 7:Zn=1;case 8:return Tr=(0,m.Z)((0,m.Z)({},this.getImageSync(_,k)),{},{downSampled:tr,downSamplingRate:Zn}),hc.update(G.img.src,Tr,k),ni.abrupt("return",Tr);case 9:case"end":return ni.stop()}},A,this,[[3,5]])}));function f(A,_){return S.apply(this,arguments)}return f}()},{key:"createImageTiles",value:function(){var S=(0,dt.Z)((0,st.Z)().mark(function A(_,k,G,ae){var ge,Ue,rt,bt,Zt;return(0,st.Z)().wrap(function(wn){for(;;)switch(wn.prev=wn.next){case 0:return wn.next=1,this.getOrCreateImage(_,ae);case 1:return ge=wn.sent,Ue=ae.ownerDocument.defaultView,rt=Ue.requestAnimationFrame,bt=Ue.cancelAnimationFrame,ll.api={requestAnimationFrame:rt,cancelAnimationFrame:bt,createCanvas:function(){return Np.createCanvas()}},Zt=(0,m.Z)((0,m.Z)({},ge),ll.sliceImage(ge.img,ge.tileSize[0],ge.tileSize[0],G)),hc.update(ge.img.src,Zt,ae),wn.abrupt("return",Zt);case 2:case"end":return wn.stop()}},A,this)}));function f(A,_,k,G){return S.apply(this,arguments)}return f}()},{key:"releaseImage",value:function(f,A){hc.release((0,Fe.Z)(f)?f:f.src,A)}},{key:"releaseImageRef",value:function(f){hc.releaseRef(f)}},{key:"getOrCreatePatternSync",value:function(f,A,_,k,G,ae,ge){var Ue=this.generatePatternKey(A);if(Ue&&this.patternCache[Ue])return this.patternCache[Ue];var rt=A.image,bt=A.repetition,Zt=A.transform,wn,mn=!1;if((0,Fe.Z)(rt)){var Gn=this.getImageSync(rt,f,ge);wn=Gn==null?void 0:Gn.img}else k?(wn=k,mn=!0):wn=rt;var ir=wn&&_.createPattern(wn,bt);if(ir){var tr;Zt?tr=pf(ts(Zt),new wo({})):tr=j.identity(j.create()),mn&&j.scale(tr,tr,[1/G,1/G,1]),ir.setTransform({a:tr[0],b:tr[1],c:tr[4],d:tr[5],e:tr[12]+ae[0],f:tr[13]+ae[1]})}return Ue&&ir&&(this.patternCache[Ue]=ir),ir}},{key:"getOrCreateGradient",value:function(f,A){var _=this.generateGradientKey(f),k=f.type,G=f.steps,ae=f.min,ge=f.width,Ue=f.height,rt=f.angle,bt=f.cx,Zt=f.cy,wn=f.size;if(this.gradientCache[_])return this.gradientCache[_];var mn=null;if(k===To.LinearGradient){var Gn=qo(ae,ge,Ue,rt),ir=Gn.x1,tr=Gn.y1,Zn=Gn.x2,Tr=Gn.y2;mn=A.createLinearGradient(ir,tr,Zn,Tr)}else if(k===To.RadialGradient){var ni=Go(ae,ge,Ue,bt,Zt,wn),ns=ni.x,is=ni.y,bi=ni.r;mn=A.createRadialGradient(ns,is,0,ns,is,bi)}return mn&&(G.forEach(function(Ri){var Gs=Ri.offset,_s=Ri.color;if(Gs.unit===Ji.kPercentage){var Hs;(Hs=mn)===null||Hs===void 0||Hs.addColorStop(Gs.value/100,_s.toString())}}),this.gradientCache[_]=mn),this.gradientCache[_]}},{key:"generateGradientKey",value:function(f){var A=f.type,_=f.min,k=f.width,G=f.height,ae=f.steps,ge=f.angle,Ue=f.cx,rt=f.cy,bt=f.size;return"gradient-".concat(A,"-").concat((ge==null?void 0:ge.toString())||0,"-").concat((Ue==null?void 0:Ue.toString())||0,"-").concat((rt==null?void 0:rt.toString())||0,"-").concat((bt==null?void 0:bt.toString())||0,"-").concat(_[0],"-").concat(_[1],"-").concat(k,"-").concat(G,"-").concat(ae.map(function(Zt){var wn=Zt.offset,mn=Zt.color;return"".concat(wn).concat(mn)}).join("-"))}},{key:"generatePatternKey",value:function(f){var A=f.image,_=f.repetition;if((0,Fe.Z)(A))return"pattern-".concat(A,"-").concat(_);if(A.nodeName==="rect")return"pattern-".concat(A.entity,"-").concat(_)}}])}();Cc.isSupportTile=!!Np.createCanvas();function Rh(x){if(!x.complete)return[0,0];var S=x.naturalWidth||x.width,f=x.naturalHeight||x.height,A=256;return[256,512].forEach(function(_){var k=Math.ceil(f/_),G=Math.ceil(S/_);k*G<1e3&&(A=_)}),[A,A]}var Bf=function(){function x(){(0,Z.Z)(this,x)}return(0,V.Z)(x,[{key:"apply",value:function(f){var A=f.renderingService,_=f.renderingContext,k=f.imagePool,G=_.root.ownerDocument.defaultView,ae=function(bt,Zt,wn){var mn=bt.parsedStyle,Gn=mn.width,ir=mn.height;Gn&&!ir?bt.setAttribute("height",wn/Zt*Gn):!Gn&&ir&&bt.setAttribute("width",Zt/wn*ir)},ge=function(bt){var Zt=bt.target,wn=Zt.nodeName,mn=Zt.attributes;if(wn===Jt.IMAGE){var Gn=mn.src,ir=mn.keepAspectRatio;k.getImageSync(Gn,Zt,function(tr){var Zn=tr.img,Tr=Zn.width,ni=Zn.height;ir&&ae(Zt,Tr,ni),Zt.dirty(),A.dirty()})}},Ue=function(bt){var Zt=bt.target,wn=bt.attrName,mn=bt.prevValue,Gn=bt.newValue;Zt.nodeName!==Jt.IMAGE||wn!=="src"||(mn!==Gn&&k.releaseImage(mn,Zt),(0,Fe.Z)(Gn)&&k.getOrCreateImage(Gn,Zt).then(function(ir){var tr=ir.img,Zn=tr.width,Tr=tr.height;Zt.attributes.keepAspectRatio&&ae(Zt,Zn,Tr),Zt.dirty(),A.dirty()}).catch(function(){}))};A.hooks.init.tap(x.tag,function(){G.addEventListener(Ra.MOUNTED,ge),G.addEventListener(Ra.ATTR_MODIFIED,Ue)}),A.hooks.destroy.tap(x.tag,function(){G.removeEventListener(Ra.MOUNTED,ge),G.removeEventListener(Ra.ATTR_MODIFIED,Ue)})}}])}();Bf.tag="LoadImage";var Rf=function(x){function S(){var f;(0,Z.Z)(this,S);for(var A=arguments.length,_=new Array(A),k=0;k<A;k++)_[k]=arguments[k];return f=(0,E.Z)(this,S,[].concat(_)),f.name="image-loader",f}return(0,F.Z)(S,x),(0,V.Z)(S,[{key:"init",value:function(A){this.context.imagePool=new Cc(this.context,A),this.addRenderingPlugin(new Bf)}},{key:"destroy",value:function(){this.removeAllRenderingPlugins()}}])}(rr),aA=Object.freeze({__proto__:null,ImagePool:Cc,Plugin:Rf}),kA="g-canvas-camera",oA=function(){function x(){(0,Z.Z)(this,x),this.displayObjectHTMLElementMap=new WeakMap}return(0,V.Z)(x,[{key:"joinTransformMatrix",value:function(f){var A=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[0,0,0];return"matrix(".concat([f[0],f[1],f[4],f[5],f[12]+A[0],f[13]+A[1]].join(","),")")}},{key:"apply",value:function(f,A){var _=this,k=f.camera,G=f.renderingContext,ae=f.renderingService;this.context=f;var ge=G.root.ownerDocument.defaultView,Ue=ge.context.eventService.nativeHTMLMap,rt=function(tr,Zn){Zn.style.transform=_.joinTransformMatrix(tr.getWorldTransform(),tr.getOrigin())},bt=function(tr){var Zn=tr.target;if(Zn.nodeName===Jt.HTML){_.$camera||(_.$camera=_.createCamera(k));var Tr=_.getOrCreateEl(Zn);_.$camera.appendChild(Tr),Object.keys(Zn.attributes).forEach(function(ni){_.updateAttribute(ni,Zn)}),rt(Zn,Tr),Ue.set(Tr,Zn)}},Zt=function(tr){var Zn=tr.target;if(Zn.nodeName===Jt.HTML&&_.$camera){var Tr=_.getOrCreateEl(Zn);Tr&&(Tr.remove(),Ue.delete(Tr))}},wn=function(tr){var Zn=tr.target;if(Zn.nodeName===Jt.HTML){var Tr=tr.attrName;_.updateAttribute(Tr,Zn)}},mn=function(tr){for(var Zn=tr.detail,Tr=0;Tr<Zn.length;Tr++){var ni=Zn[Tr],ns=ni.target,is=ns.nodeName===Jt.FRAGMENT?ns.childNodes:[ns];is.forEach(function(bi){if(bi.nodeName===Jt.HTML){var Ri=_.getOrCreateEl(bi);rt(bi,Ri)}})}},Gn=function(){if(_.$camera){var tr=_.context.config,Zn=tr.width,Tr=tr.height;_.$camera.parentElement.style.width="".concat(Zn||0,"px"),_.$camera.parentElement.style.height="".concat(Tr||0,"px")}};ae.hooks.init.tap(x.tag,function(){ge.addEventListener(fl.RESIZE,Gn),ge.addEventListener(Ra.MOUNTED,bt),ge.addEventListener(Ra.UNMOUNTED,Zt),ge.addEventListener(Ra.ATTR_MODIFIED,wn),ge.addEventListener(Ra.BOUNDS_CHANGED,mn)}),ae.hooks.endFrame.tap(x.tag,function(){_.$camera&&G.renderReasons.has(rh.CAMERA_CHANGED)&&(_.$camera.style.transform=_.joinTransformMatrix(k.getOrthoMatrix()))}),ae.hooks.destroy.tap(x.tag,function(){_.$camera&&_.$camera.remove(),ge.removeEventListener(fl.RESIZE,Gn),ge.removeEventListener(Ra.MOUNTED,bt),ge.removeEventListener(Ra.UNMOUNTED,Zt),ge.removeEventListener(Ra.ATTR_MODIFIED,wn),ge.removeEventListener(Ra.BOUNDS_CHANGED,mn)})}},{key:"createCamera",value:function(f){var A=this.context.config,_=A.document,k=A.width,G=A.height,ae=this.context.contextService.getDomElement(),ge=ae.parentNode;if(ge){var Ue=kA,rt=ge.querySelector("#".concat(Ue));if(!rt){var bt=(_||document).createElement("div");bt.style.overflow="hidden",bt.style.pointerEvents="none",bt.style.position="absolute",bt.style.left="0px",bt.style.top="0px",bt.style.width="".concat(k||0,"px"),bt.style.height="".concat(G||0,"px");var Zt=(_||document).createElement("div");rt=Zt,Zt.id=Ue,Zt.style.position="absolute",Zt.style.left="".concat(ae.offsetLeft||0,"px"),Zt.style.top="".concat(ae.offsetTop||0,"px"),Zt.style.transformOrigin="left top",Zt.style.transform=this.joinTransformMatrix(f.getOrthoMatrix()),Zt.style.pointerEvents="none",Zt.style.width="100%",Zt.style.height="100%",bt.appendChild(Zt),ge.appendChild(bt)}return rt}return null}},{key:"getOrCreateEl",value:function(f){var A=this.context.config.document,_=this.displayObjectHTMLElementMap.get(f);return _||(_=(A||document).createElement("div"),f.parsedStyle.$el=_,this.displayObjectHTMLElementMap.set(f,_),f.id&&(_.id=f.id),f.name&&_.setAttribute("name",f.name),f.className&&(_.className=f.className),_.style.position="absolute",_.style["will-change"]="transform",_.style.transform=this.joinTransformMatrix(f.getWorldTransform(),f.getOrigin())),_}},{key:"updateAttribute",value:function(f,A){var _=this.getOrCreateEl(A);switch(f){case"innerHTML":var k=A.parsedStyle.innerHTML;(0,Fe.Z)(k)?_.innerHTML=k:(_.innerHTML="",_.appendChild(k));break;case"x":_.style.left="".concat(A.parsedStyle.x,"px");break;case"y":_.style.top="".concat(A.parsedStyle.y,"px");break;case"transformOrigin":var G=A.parsedStyle.transformOrigin;_.style["transform-origin"]="".concat(G[0].buildCSSText(null,null,"")," ").concat(G[1].buildCSSText(null,null,""));break;case"width":var ae=A.parsedStyle.width;_.style.width=(0,ve.Z)(ae)?"".concat(ae,"px"):ae.toString();break;case"height":var ge=A.parsedStyle.height;_.style.height=(0,ve.Z)(ge)?"".concat(ge,"px"):ge.toString();break;case"zIndex":var Ue=A.parsedStyle.zIndex;_.style["z-index"]="".concat(Ue);break;case"visibility":var rt=A.parsedStyle.visibility;_.style.visibility=rt;break;case"pointerEvents":var bt=A.parsedStyle.pointerEvents,Zt=bt===void 0?"auto":bt;_.style.pointerEvents=Zt;break;case"opacity":var wn=A.parsedStyle.opacity;_.style.opacity="".concat(wn);break;case"fill":var mn=A.parsedStyle.fill,Gn="";vd(mn)?mn.isNone?Gn="transparent":Gn=A.getAttribute("fill"):Array.isArray(mn)?Gn=A.getAttribute("fill"):md(mn),_.style.background=Gn;break;case"stroke":var ir=A.parsedStyle.stroke,tr="";vd(ir)?ir.isNone?tr="transparent":tr=A.getAttribute("stroke"):Array.isArray(ir)?tr=A.getAttribute("stroke"):md(ir),_.style["border-color"]=tr,_.style["border-style"]="solid";break;case"lineWidth":var Zn=A.parsedStyle.lineWidth;_.style["border-width"]="".concat(Zn||0,"px");break;case"lineDash":_.style["border-style"]="dashed";break;case"filter":var Tr=A.style.filter;_.style.filter=Tr;break;default:!(0,$e.Z)(A.style[f])&&A.style[f]!==""&&(_.style[f]=A.style[f])}}}])}();oA.tag="HTMLRendering";var VA=function(x){function S(){var f;(0,Z.Z)(this,S);for(var A=arguments.length,_=new Array(A),k=0;k<A;k++)_[k]=arguments[k];return f=(0,E.Z)(this,S,[].concat(_)),f.name="html-renderer",f}return(0,F.Z)(S,x),(0,V.Z)(S,[{key:"init",value:function(){this.addRenderingPlugin(new oA)}},{key:"destroy",value:function(){this.removeAllRenderingPlugins()}}])}(rr),mm=Object.freeze({__proto__:null,Plugin:VA}),Hh=function(){function x(){(0,Z.Z)(this,x)}return(0,V.Z)(x,[{key:"apply",value:function(f,A){var _=this,k=f.renderingService,G=f.renderingContext,ae=f.config;this.context=f;var ge=G.root.ownerDocument.defaultView,Ue=function(Ri){k.hooks.pointerMove.call(Ri)},rt=function(Ri){k.hooks.pointerUp.call(Ri)},bt=function(Ri){k.hooks.pointerDown.call(Ri)},Zt=function(Ri){k.hooks.pointerOver.call(Ri)},wn=function(Ri){k.hooks.pointerOut.call(Ri)},mn=function(Ri){k.hooks.pointerCancel.call(Ri)},Gn=function(Ri){k.hooks.pointerWheel.call(Ri)},ir=function(Ri){k.hooks.click.call(Ri)},tr=function(Ri){A.globalThis.document.addEventListener("pointermove",Ue,!0),Ri.addEventListener("pointerdown",bt,!0),Ri.addEventListener("pointerleave",wn,!0),Ri.addEventListener("pointerover",Zt,!0),A.globalThis.addEventListener("pointerup",rt,!0),A.globalThis.addEventListener("pointercancel",mn,!0)},Zn=function(Ri){Ri.addEventListener("touchstart",bt,!0),Ri.addEventListener("touchend",rt,!0),Ri.addEventListener("touchmove",Ue,!0),Ri.addEventListener("touchcancel",mn,!0)},Tr=function(Ri){A.globalThis.document.addEventListener("mousemove",Ue,!0),Ri.addEventListener("mousedown",bt,!0),Ri.addEventListener("mouseout",wn,!0),Ri.addEventListener("mouseover",Zt,!0),A.globalThis.addEventListener("mouseup",rt,!0)},ni=function(Ri){A.globalThis.document.removeEventListener("pointermove",Ue,!0),Ri.removeEventListener("pointerdown",bt,!0),Ri.removeEventListener("pointerleave",wn,!0),Ri.removeEventListener("pointerover",Zt,!0),A.globalThis.removeEventListener("pointerup",rt,!0),A.globalThis.removeEventListener("pointercancel",mn,!0)},ns=function(Ri){Ri.removeEventListener("touchstart",bt,!0),Ri.removeEventListener("touchend",rt,!0),Ri.removeEventListener("touchmove",Ue,!0),Ri.removeEventListener("touchcancel",mn,!0)},is=function(Ri){A.globalThis.document.removeEventListener("mousemove",Ue,!0),Ri.removeEventListener("mousedown",bt,!0),Ri.removeEventListener("mouseout",wn,!0),Ri.removeEventListener("mouseover",Zt,!0),A.globalThis.removeEventListener("mouseup",rt,!0)};k.hooks.init.tap(x.tag,function(){var bi=_.context.contextService.getDomElement();A.globalThis.navigator.msPointerEnabled?(bi.style.msContentZooming="none",bi.style.msTouchAction="none"):ge.supportsPointerEvents&&(bi.style.touchAction="none"),ge.supportsPointerEvents?tr(bi):Tr(bi),ge.supportsTouchEvents&&Zn(bi),ae.useNativeClickEvent&&bi.addEventListener("click",ir,!0),bi.addEventListener("wheel",Gn,{passive:!0,capture:!0})}),k.hooks.destroy.tap(x.tag,function(){var bi=_.context.contextService.getDomElement();A.globalThis.navigator.msPointerEnabled?(bi.style.msContentZooming="",bi.style.msTouchAction=""):ge.supportsPointerEvents&&(bi.style.touchAction=""),ge.supportsPointerEvents?ni(bi):is(bi),ge.supportsTouchEvents&&ns(bi),ae.useNativeClickEvent&&bi.removeEventListener("click",ir,!0),bi.removeEventListener("wheel",Gn,!0)})}}])}();Hh.tag="DOMInteraction";var zp=function(x){function S(){var f;(0,Z.Z)(this,S);for(var A=arguments.length,_=new Array(A),k=0;k<A;k++)_[k]=arguments[k];return f=(0,E.Z)(this,S,[].concat(_)),f.name="dom-interaction",f}return(0,F.Z)(S,x),(0,V.Z)(S,[{key:"init",value:function(){this.addRenderingPlugin(new Hh)}},{key:"destroy",value:function(){this.removeAllRenderingPlugins()}}])}(rr),vm=Object.freeze({__proto__:null,Plugin:zp}),zA=function(){function x(){(0,Z.Z)(this,x)}return(0,V.Z)(x,[{key:"apply",value:function(f){var A=f.renderingService,_=f.contextService,k=f.config,G=_.getDomElement(),ae=function(Gn){A.hooks.pointerDown.call(Gn)},ge=function(Gn){A.hooks.pointerUp.call(Gn)},Ue=function(Gn){A.hooks.pointerMove.call(Gn)},rt=function(Gn){A.hooks.pointerOver.call(Gn)},bt=function(Gn){A.hooks.pointerOut.call(Gn)},Zt=function(Gn){A.hooks.click.call(Gn)},wn=function(Gn){A.hooks.pointerCancel.call(Gn)};A.hooks.init.tap(x.tag,function(){G.addEventListener("touchstart",ae,!0),G.addEventListener("touchend",ge,!0),G.addEventListener("touchmove",Ue,!0),G.addEventListener("touchcancel",wn,!0),G.addEventListener("mouseout",bt,!0),G.addEventListener("mouseover",rt,!0),k.useNativeClickEvent&&G.addEventListener("click",Zt,!0)}),A.hooks.destroy.tap(x.tag,function(){G.removeEventListener("touchstart",ae,!0),G.removeEventListener("touchend",ge,!0),G.removeEventListener("touchmove",Ue,!0),G.removeEventListener("touchcancel",wn,!0),G.removeEventListener("mouseout",bt,!0),G.removeEventListener("mouseover",rt,!0),k.useNativeClickEvent&&G.removeEventListener("click",Zt,!0)})}}])}();zA.tag="MobileInteraction";var Jd=function(x){function S(){var f;(0,Z.Z)(this,S);for(var A=arguments.length,_=new Array(A),k=0;k<A;k++)_[k]=arguments[k];return f=(0,E.Z)(this,S,[].concat(_)),f.name="mobile-interaction",f}return(0,F.Z)(S,x),(0,V.Z)(S,[{key:"init",value:function(){this.addRenderingPlugin(new zA)}},{key:"destroy",value:function(){this.removeAllRenderingPlugins()}}])}(rr),ym=Object.freeze({__proto__:null,Plugin:Jd})},19606:function(Be,Me,b){"use strict";b.d(Me,{TE:function(){return N},U4:function(){return Lt},Xk:function(){return Bn},Y1:function(){return wt},_x:function(){return Xn},hE:function(){return jt},l5:function(){return Tt},ph:function(){return en},vp:function(){return $e},x4:function(){return je}});var m=b(94480),Z=b(5131),V=b(45545);function N(ot,ut,_t,$t){var Vt=ot-_t,Qt=ut-$t;return Math.sqrt(Vt*Vt+Qt*Qt)}function E(ot,ut){var _t=Math.min.apply(Math,(0,m.Z)(ot)),$t=Math.min.apply(Math,(0,m.Z)(ut)),Vt=Math.max.apply(Math,(0,m.Z)(ot)),Qt=Math.max.apply(Math,(0,m.Z)(ut));return{x:_t,y:$t,width:Vt-_t,height:Qt-$t}}function F(ot){return(ot+Math.PI*2)%(Math.PI*2)}function C(ot,ut){var _t=Math.abs(ot);return ut>0?_t:_t*-1}function P(ot,ut,_t,$t,Vt,Qt){var cn=_t,Yn=$t;if(cn===0||Yn===0)return{x:ot,y:ut};for(var qn=Vt-ot,Sr=Qt-ut,Jr=Math.abs(qn),vr=Math.abs(Sr),Ki=cn*cn,Mi=Yn*Yn,yi=Math.PI/4,qr=0,es=0,Ci=0;Ci<4;Ci++){qr=cn*Math.cos(yi),es=Yn*Math.sin(yi);var En=(Ki-Mi)*Math.pow(Math.cos(yi),3)/cn,rn=(Mi-Ki)*Math.pow(Math.sin(yi),3)/Yn,Xt=qr-En,st=es-rn,dt=Jr-En,Wt=vr-rn,bn=Math.hypot(st,Xt),Jt=Math.hypot(Wt,dt),ar=bn*Math.asin((Xt*Wt-st*dt)/(bn*Jt)),rr=ar/Math.sqrt(Ki+Mi-qr*qr-es*es);yi+=rr,yi=Math.min(Math.PI/2,Math.max(0,yi))}return{x:ot+C(qr,qn),y:ut+C(es,Sr)}}function H(ot,ut,_t,$t,Vt,Qt,cn,Yn){return-1*_t*Math.cos(Vt)*Math.sin(Yn)-$t*Math.sin(Vt)*Math.cos(Yn)}function D(ot,ut,_t,$t,Vt,Qt,cn,Yn){return-1*_t*Math.sin(Vt)*Math.sin(Yn)+$t*Math.cos(Vt)*Math.cos(Yn)}function X(ot,ut,_t){return Math.atan(-ut/ot*Math.tan(_t))}function j(ot,ut,_t){return Math.atan(ut/(ot*Math.tan(_t)))}function de(ot,ut,_t,$t,Vt,Qt){return _t*Math.cos(Vt)*Math.cos(Qt)-$t*Math.sin(Vt)*Math.sin(Qt)+ot}function he(ot,ut,_t,$t,Vt,Qt){return _t*Math.sin(Vt)*Math.cos(Qt)+$t*Math.cos(Vt)*Math.sin(Qt)+ut}function we(ot,ut,_t,$t){var Vt=Math.atan2($t*ot,_t*ut);return(Vt+Math.PI*2)%(Math.PI*2)}function ve(ot,ut,_t){return{x:ot*Math.cos(_t),y:ut*Math.sin(_t)}}function Ee(ot,ut,_t){var $t=Math.cos(_t),Vt=Math.sin(_t);return[ot*$t-ut*Vt,ot*Vt+ut*$t]}function $e(ot,ut,_t,$t,Vt,Qt,cn){for(var Yn=X(_t,$t,Vt),qn=1/0,Sr=-1/0,Jr=[Qt,cn],vr=-Math.PI*2;vr<=Math.PI*2;vr+=Math.PI){var Ki=Yn+vr;Qt<cn?Qt<Ki&&Ki<cn&&Jr.push(Ki):cn<Ki&&Ki<Qt&&Jr.push(Ki)}for(var Mi=0;Mi<Jr.length;Mi++){var yi=de(ot,ut,_t,$t,Vt,Jr[Mi]);yi<qn&&(qn=yi),yi>Sr&&(Sr=yi)}for(var qr=j(_t,$t,Vt),es=1/0,Ci=-1/0,En=[Qt,cn],rn=-Math.PI*2;rn<=Math.PI*2;rn+=Math.PI){var Xt=qr+rn;Qt<cn?Qt<Xt&&Xt<cn&&En.push(Xt):cn<Xt&&Xt<Qt&&En.push(Xt)}for(var st=0;st<En.length;st++){var dt=he(ot,ut,_t,$t,Vt,En[st]);dt<es&&(es=dt),dt>Ci&&(Ci=dt)}return{x:qn,y:es,width:Sr-qn,height:Ci-es}}function Fe(ot,ut,_t,$t,Vt,Qt,cn,Yn,qn){var Sr=Ee(Yn-ot,qn-ut,-Vt),Jr=_slicedToArray(Sr,2),vr=Jr[0],Ki=Jr[1],Mi=P(0,0,_t,$t,vr,Ki),yi=we(_t,$t,Mi.x,Mi.y);yi<Qt?Mi=ve(_t,$t,Qt):yi>cn&&(Mi=ve(_t,$t,cn));var qr=Ee(Mi.x,Mi.y,Vt);return{x:qr[0]+ot,y:qr[1]+ut}}function ct(ot,ut,_t,$t,Vt,Qt,cn,Yn){var qn=(cn-Qt)*Yn+Qt,Sr=H(ot,ut,_t,$t,Vt,Qt,cn,qn),Jr=D(ot,ut,_t,$t,Vt,Qt,cn,qn);return F(Math.atan2(Jr,Sr))}var vt=1e-4;function at(ot,ut,_t,$t,Vt,Qt){var cn=-1,Yn=1/0,qn=[_t,$t],Sr=20;Qt&&Qt>200&&(Sr=Qt/10);for(var Jr=1/Sr,vr=Jr/10,Ki=0;Ki<=Sr;Ki++){var Mi=Ki*Jr,yi=[Vt.apply(void 0,(0,m.Z)(ot.concat([Mi]))),Vt.apply(void 0,(0,m.Z)(ut.concat([Mi])))],qr=N(qn[0],qn[1],yi[0],yi[1]);qr<Yn&&(cn=Mi,Yn=qr)}if(cn===0)return{x:ot[0],y:ut[0]};if(cn===1){var es=ot.length;return{x:ot[es-1],y:ut[es-1]}}Yn=1/0;for(var Ci=0;Ci<32&&!(vr<vt);Ci++){var En=cn-vr,rn=cn+vr,Xt=[Vt.apply(void 0,(0,m.Z)(ot.concat([En]))),Vt.apply(void 0,(0,m.Z)(ut.concat([En])))],st=N(qn[0],qn[1],Xt[0],Xt[1]);if(En>=0&&st<Yn)cn=En,Yn=st;else{var dt=[Vt.apply(void 0,(0,m.Z)(ot.concat([rn]))),Vt.apply(void 0,(0,m.Z)(ut.concat([rn])))],Wt=N(qn[0],qn[1],dt[0],dt[1]);rn<=1&&Wt<Yn?(cn=rn,Yn=Wt):vr*=.5}}return{x:Vt.apply(void 0,(0,m.Z)(ot.concat([cn]))),y:Vt.apply(void 0,(0,m.Z)(ut.concat([cn])))}}function kt(ot,ut){for(var _t=0,$t=ot.length,Vt=0;Vt<$t;Vt++){var Qt=ot[Vt],cn=ut[Vt],Yn=ot[(Vt+1)%$t],qn=ut[(Vt+1)%$t];_t+=N(Qt,cn,Yn,qn)}return _t/2}function It(ot,ut,_t,$t){return E([ot,_t],[ut,$t])}function Bn(ot,ut,_t,$t){return N(ot,ut,_t,$t)}function Lt(ot,ut,_t,$t,Vt){return{x:(1-Vt)*ot+Vt*_t,y:(1-Vt)*ut+Vt*$t}}function Wn(ot,ut,_t,$t,Vt,Qt){var cn=(_t-ot)*(Vt-ot)+($t-ut)*(Qt-ut);if(cn<0)return N(ot,ut,Vt,Qt);var Yn=(_t-ot)*(_t-ot)+($t-ut)*($t-ut);return cn>Yn?N(_t,$t,Vt,Qt):Xn(ot,ut,_t,$t,Vt,Qt)}function Xn(ot,ut,_t,$t,Vt,Qt){var cn=[_t-ot,$t-ut];if(V.I6(cn,[0,0]))return Math.sqrt((Vt-ot)*(Vt-ot)+(Qt-ut)*(Qt-ut));var Yn=[-cn[1],cn[0]];V.Fv(Yn,Yn);var qn=[Vt-ot,Qt-ut];return Math.abs(V.AK(qn,Yn))}function In(ot,ut,_t,$t){return Math.atan2($t-ut,_t-ot)}function zn(ot,ut,_t,$t,Vt){var Qt=1-Vt;return Qt*Qt*Qt*ot+3*ut*Vt*Qt*Qt+3*_t*Vt*Vt*Qt+$t*Vt*Vt*Vt}function dr(ot,ut,_t,$t,Vt){var Qt=1-Vt;return 3*(Qt*Qt*(ut-ot)+2*Qt*Vt*(_t-ut)+Vt*Vt*($t-_t))}function vn(ot,ut,_t,$t){var Vt=-3*ot+9*ut-9*_t+3*$t,Qt=6*ot-12*ut+6*_t,cn=3*ut-3*ot,Yn=[],qn,Sr,Jr;if((0,Z.Z)(Vt,0))(0,Z.Z)(Qt,0)||(qn=-cn/Qt,qn>=0&&qn<=1&&Yn.push(qn));else{var vr=Qt*Qt-4*Vt*cn;(0,Z.Z)(vr,0)?Yn.push(-Qt/(2*Vt)):vr>0&&(Jr=Math.sqrt(vr),qn=(-Qt+Jr)/(2*Vt),Sr=(-Qt-Jr)/(2*Vt),qn>=0&&qn<=1&&Yn.push(qn),Sr>=0&&Sr<=1&&Yn.push(Sr))}return Yn}function _r(ot,ut,_t,$t,Vt,Qt,cn,Yn,qn){var Sr=zn(ot,_t,Vt,cn,qn),Jr=zn(ut,$t,Qt,Yn,qn),vr=Lt(ot,ut,_t,$t,qn),Ki=Lt(_t,$t,Vt,Qt,qn),Mi=Lt(Vt,Qt,cn,Yn,qn),yi=Lt(vr.x,vr.y,Ki.x,Ki.y,qn),qr=Lt(Ki.x,Ki.y,Mi.x,Mi.y,qn);return[[ot,ut,vr.x,vr.y,yi.x,yi.y,Sr,Jr],[Sr,Jr,qr.x,qr.y,Mi.x,Mi.y,cn,Yn]]}function Ge(ot,ut,_t,$t,Vt,Qt,cn,Yn,qn){if(qn===0)return kt([ot,_t,Vt,cn],[ut,$t,Qt,Yn]);var Sr=_r(ot,ut,_t,$t,Vt,Qt,cn,Yn,.5),Jr=[].concat(_toConsumableArray(Sr[0]),[qn-1]),vr=[].concat(_toConsumableArray(Sr[1]),[qn-1]);return Ge.apply(void 0,_toConsumableArray(Jr))+Ge.apply(void 0,_toConsumableArray(vr))}function Tt(ot,ut,_t,$t,Vt,Qt,cn,Yn){for(var qn=[ot,cn],Sr=[ut,Yn],Jr=vn(ot,_t,Vt,cn),vr=vn(ut,$t,Qt,Yn),Ki=0;Ki<Jr.length;Ki++)qn.push(zn(ot,_t,Vt,cn,Jr[Ki]));for(var Mi=0;Mi<vr.length;Mi++)Sr.push(zn(ut,$t,Qt,Yn,vr[Mi]));return E(qn,Sr)}function On(ot,ut,_t,$t,Vt,Qt,cn,Yn){return Ge(ot,ut,_t,$t,Vt,Qt,cn,Yn,3)}function Vr(ot,ut,_t,$t,Vt,Qt,cn,Yn,qn,Sr,Jr){return at([ot,_t,Vt,cn],[ut,$t,Qt,Yn],qn,Sr,zn,Jr)}function en(ot,ut,_t,$t,Vt,Qt,cn,Yn,qn,Sr,Jr){var vr=Vr(ot,ut,_t,$t,Vt,Qt,cn,Yn,qn,Sr,Jr);return N(vr.x,vr.y,qn,Sr)}function ln(ot,ut,_t,$t,Vt,Qt,cn,Yn,qn){return{x:zn(ot,_t,Vt,cn,qn),y:zn(ut,$t,Qt,Yn,qn)}}function Cn(ot,ut,_t,$t,Vt,Qt,cn,Yn,qn){var Sr=dr(ot,_t,Vt,cn,qn),Jr=dr(ut,$t,Qt,Yn,qn);return F(Math.atan2(Jr,Sr))}function Mt(ot){for(var ut=0,_t=[],$t=0;$t<ot.length-1;$t++){var Vt=ot[$t],Qt=ot[$t+1],cn=N(Vt[0],Vt[1],Qt[0],Qt[1]),Yn={from:Vt,to:Qt,length:cn};_t.push(Yn),ut+=cn}return{segments:_t,totalLength:ut}}function Et(ot){if(ot.length<2)return 0;for(var ut=0,_t=0;_t<ot.length-1;_t++){var $t=ot[_t],Vt=ot[_t+1];ut+=N($t[0],$t[1],Vt[0],Vt[1])}return ut}function pe(ot,ut){if(ut>1||ut<0||ot.length<2)return null;var _t=Mt(ot),$t=_t.segments,Vt=_t.totalLength;if(Vt===0)return{x:ot[0][0],y:ot[0][1]};for(var Qt=0,cn=null,Yn=0;Yn<$t.length;Yn++){var qn=$t[Yn],Sr=qn.from,Jr=qn.to,vr=qn.length/Vt;if(ut>=Qt&&ut<=Qt+vr){var Ki=(ut-Qt)/vr;cn=Lt(Sr[0],Sr[1],Jr[0],Jr[1],Ki);break}Qt+=vr}return cn}function Ae(ot,ut){if(ut>1||ut<0||ot.length<2)return 0;for(var _t=Mt(ot),$t=_t.segments,Vt=_t.totalLength,Qt=0,cn=0,Yn=0;Yn<$t.length;Yn++){var qn=$t[Yn],Sr=qn.from,Jr=qn.to,vr=qn.length/Vt;if(ut>=Qt&&ut<=Qt+vr){cn=Math.atan2(Jr[1]-Sr[1],Jr[0]-Sr[0]);break}Qt+=vr}return cn}function Pe(ot,ut,_t){for(var $t=1/0,Vt=0;Vt<ot.length-1;Vt++){var Qt=ot[Vt],cn=ot[Vt+1],Yn=Wn(Qt[0],Qt[1],cn[0],cn[1],ut,_t);Yn<$t&&($t=Yn)}return $t}function Ut(ot){for(var ut=[],_t=[],$t=0;$t<ot.length;$t++){var Vt=ot[$t];ut.push(Vt[0]),_t.push(Vt[1])}return E(ut,_t)}function jt(ot){return Et(ot)}function ft(ot,ut){return pe(ot,ut)}function on(ot,ut,_t){return Pe(ot,ut,_t)}function hn(ot,ut){return Ae(ot,ut)}function lt(ot){var ut=ot.slice(0);return ot.length&&ut.push(ot[0]),ut}function Ct(ot){return Ut(ot)}function sn(ot){return Et(lt(ot))}function W(ot,ut){return pe(lt(ot),ut)}function Se(ot,ut,_t){return Pe(lt(ot),ut,_t)}function Ht(ot,ut){return Ae(lt(ot),ut)}function zt(ot,ut,_t,$t){var Vt=1-$t;return Vt*Vt*ot+2*$t*Vt*ut+$t*$t*_t}function Fn(ot,ut,_t){var $t=ot+_t-2*ut;if((0,Z.Z)($t,0))return[.5];var Vt=(ot-ut)/$t;return Vt<=1&&Vt>=0?[Vt]:[]}function Tn(ot,ut,_t,$t,Vt,Qt,cn){var Yn=zt(ot,_t,Vt,cn),qn=zt(ut,$t,Qt,cn),Sr=Lt(ot,ut,_t,$t,cn),Jr=Lt(_t,$t,Vt,Qt,cn);return[[ot,ut,Sr.x,Sr.y,Yn,qn],[Yn,qn,Jr.x,Jr.y,Vt,Qt]]}function lr(ot,ut,_t,$t,Vt,Qt,cn){if(cn===0)return(N(ot,ut,_t,$t)+N(_t,$t,Vt,Qt)+N(ot,ut,Vt,Qt))/2;var Yn=Tn(ot,ut,_t,$t,Vt,Qt,.5),qn=Yn[0],Sr=Yn[1];return qn.push(cn-1),Sr.push(cn-1),lr.apply(void 0,_toConsumableArray(qn))+lr.apply(void 0,_toConsumableArray(Sr))}function je(ot,ut,_t,$t,Vt,Qt){var cn=Fn(ot,_t,Vt)[0],Yn=Fn(ut,$t,Qt)[0],qn=[ot,Vt],Sr=[ut,Qt];return cn!==void 0&&qn.push(zt(ot,_t,Vt,cn)),Yn!==void 0&&Sr.push(zt(ut,$t,Qt,Yn)),E(qn,Sr)}function be(ot,ut,_t,$t,Vt,Qt){return lr(ot,ut,_t,$t,Vt,Qt,3)}function it(ot,ut,_t,$t,Vt,Qt,cn,Yn){return at([ot,_t,Vt],[ut,$t,Qt],cn,Yn,zt)}function wt(ot,ut,_t,$t,Vt,Qt,cn,Yn){var qn=it(ot,ut,_t,$t,Vt,Qt,cn,Yn);return N(qn.x,qn.y,cn,Yn)}},59293:function(Be,Me,b){"use strict";b.d(Me,{S:function(){return X}});var m=b(33885),Z=b(67732),V=b(83652),N=b(22214),E=b(42403),F=b(72818),C=b(75044),P=b(3202),H=b(68901);var D=function(){function j(de){(0,Z.Z)(this,j),this.dragndropPluginOptions=de}return(0,V.Z)(j,[{key:"apply",value:function(he){var we=this,ve=he.renderingService,Ee=he.renderingContext,$e=Ee.root.ownerDocument,Fe=$e.defaultView,ct=function(at){var kt=at.target,It=kt===$e,Bn=It&&we.dragndropPluginOptions.isDocumentDraggable?$e:kt.closest&&kt.closest("[draggable=true]");if(Bn){var Lt=!1,Wn=at.timeStamp,Xn=[at.clientX,at.clientY],In=null,zn=[at.clientX,at.clientY],dr=function(){var _r=(0,P.Z)((0,C.Z)().mark(function Ge(Tt){var On,Vr,en,ln,Cn,Mt;return(0,C.Z)().wrap(function(Et){for(;;)switch(Et.prev=Et.next){case 0:if(Lt){Et.next=2;break}if(On=Tt.timeStamp-Wn,Vr=(0,H.y)([Tt.clientX,Tt.clientY],Xn),!(On<=we.dragndropPluginOptions.dragstartTimeThreshold||Vr<=we.dragndropPluginOptions.dragstartDistanceThreshold)){Et.next=1;break}return Et.abrupt("return");case 1:Tt.type="dragstart",Bn.dispatchEvent(Tt),Lt=!0;case 2:if(Tt.type="drag",Tt.dx=Tt.clientX-zn[0],Tt.dy=Tt.clientY-zn[1],Bn.dispatchEvent(Tt),zn=[Tt.clientX,Tt.clientY],It){Et.next=4;break}return en=we.dragndropPluginOptions.overlap==="pointer"?[Tt.canvasX,Tt.canvasY]:kt.getBounds().center,Et.next=3,$e.elementsFromPoint(en[0],en[1]);case 3:ln=Et.sent,Cn=ln[ln.indexOf(kt)+1],Mt=(Cn==null?void 0:Cn.closest("[droppable=true]"))||(we.dragndropPluginOptions.isDocumentDroppable?$e:null),In!==Mt&&(In&&(Tt.type="dragleave",Tt.target=In,In.dispatchEvent(Tt)),Mt&&(Tt.type="dragenter",Tt.target=Mt,Mt.dispatchEvent(Tt)),In=Mt,In&&(Tt.type="dragover",Tt.target=In,In.dispatchEvent(Tt)));case 4:case"end":return Et.stop()}},Ge)}));return function(Tt){return _r.apply(this,arguments)}}();Fe.addEventListener("pointermove",dr);var vn=function(Ge){if(Lt){Ge.detail={preventClick:!0};var Tt=Ge.clone();In&&(Tt.type="drop",Tt.target=In,In.dispatchEvent(Tt)),Tt.type="dragend",Bn.dispatchEvent(Tt),Lt=!1}Fe.removeEventListener("pointermove",dr)};kt.addEventListener("pointerup",vn,{once:!0}),kt.addEventListener("pointerupoutside",vn,{once:!0})}};ve.hooks.init.tap(j.tag,function(){Fe.addEventListener("pointerdown",ct)}),ve.hooks.destroy.tap(j.tag,function(){Fe.removeEventListener("pointerdown",ct)})}}])}();D.tag="Dragndrop";var X=function(j){function de(){var he,we=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return(0,Z.Z)(this,de),he=(0,N.Z)(this,de),he.name="dragndrop",he.options=we,he}return(0,E.Z)(de,j),(0,V.Z)(de,[{key:"init",value:function(){this.addRenderingPlugin(new D((0,m.Z)({overlap:"pointer",isDocumentDraggable:!1,isDocumentDroppable:!1,dragstartDistanceThreshold:0,dragstartTimeThreshold:0},this.options)))}},{key:"destroy",value:function(){this.removeAllRenderingPlugins()}},{key:"setOptions",value:function(we){Object.assign(this.plugins[0].dragndropPluginOptions,we)}}])}(F.F6)},66623:function(Be,Me,b){"use strict";b.d(Me,{$6:function(){return m.$6},Aw:function(){return m.Aw},BB:function(){return m.BB},BV:function(){return m.BV},Cd:function(){return m.Cd},Dk:function(){return m.Dk},Ee:function(){return m.Ee},GZ:function(){return m.GZ},Pj:function(){return m.Pj},UL:function(){return m.UL},Xz:function(){return m.Xz},ZA:function(){return m.ZA},aH:function(){return m.aH},b_:function(){return m.b_},k9:function(){return m.k9},mN:function(){return m.mN},mg:function(){return m.mg},nR:function(){return m.nR},s$:function(){return m.s$},x1:function(){return m.x1},xv:function(){return m.xv},y$:function(){return m.y$}});var m=b(72818),Z=b(67732),V=b(83652),N=b(22214),E=b(42403),F=b(94480),C=b(42978),P=b(70208),H=b(1933),D=b(76075),X=b(71879),j=b(5131),de=b(94569),he=b(60187),we=b(92421),ve=b(75931),Ee=b(64270),$e=b.n(Ee),Fe=b(33885),ct=b(20068),vt=b(34907);var at=function(Hn){function Pt(Gt,Bt,yn,Ln){var gr;return(0,Z.Z)(this,Pt),gr=(0,N.Z)(this,Pt,[Gt]),gr.currentTime=yn,gr.timelineTime=Ln,gr.target=Bt,gr.type="finish",gr.bubbles=!1,gr.currentTarget=Bt,gr.defaultPrevented=!1,gr.eventPhase=gr.AT_TARGET,gr.timeStamp=Date.now(),gr.currentTime=yn,gr.timelineTime=Ln,gr}return(0,E.Z)(Pt,Hn),(0,V.Z)(Pt)}(m.xA),kt=0,It=function(){function Hn(Pt,Gt){var Bt;(0,Z.Z)(this,Hn),this.currentTimePending=!1,this._idle=!0,this._paused=!1,this._finishedFlag=!0,this._currentTime=0,this._playbackRate=1,this._inTimeline=!0,this.effect=Pt,Pt.animation=this,this.timeline=Gt,this.id="".concat(kt++),this._inEffect=!!this.effect.update(0),this._totalDuration=Number((Bt=this.effect)===null||Bt===void 0?void 0:Bt.getComputedTiming().endTime),this._holdTime=0,this._paused=!1,this.oldPlayState="idle",this.updatePromises()}return(0,V.Z)(Hn,[{key:"pending",get:function(){return this._startTime===null&&!this._paused&&this.playbackRate!==0||this.currentTimePending}},{key:"playState",get:function(){return this._idle?"idle":this._isFinished?"finished":this._paused?"paused":"running"}},{key:"ready",get:function(){var Gt=this;return this.readyPromise||(this.timeline.animationsWithPromises.indexOf(this)===-1&&this.timeline.animationsWithPromises.push(this),this.readyPromise=new Promise(function(Bt,yn){Gt.resolveReadyPromise=function(){Bt(Gt)},Gt.rejectReadyPromise=function(){yn(new Error)}}),this.pending||this.resolveReadyPromise()),this.readyPromise}},{key:"finished",get:function(){var Gt=this;return this.finishedPromise||(this.timeline.animationsWithPromises.indexOf(this)===-1&&this.timeline.animationsWithPromises.push(this),this.finishedPromise=new Promise(function(Bt,yn){Gt.resolveFinishedPromise=function(){Bt(Gt)},Gt.rejectFinishedPromise=function(){yn(new Error)}}),this.playState==="finished"&&this.resolveFinishedPromise()),this.finishedPromise}},{key:"currentTime",get:function(){return this.updatePromises(),this._idle||this.currentTimePending?null:this._currentTime},set:function(Gt){if(Gt=Number(Gt),!isNaN(Gt)){if(this.timeline.restart(),!this._paused&&this._startTime!==null){var Bt;this._startTime=Number((Bt=this.timeline)===null||Bt===void 0?void 0:Bt.currentTime)-Gt/this.playbackRate}this.currentTimePending=!1,this._currentTime!==Gt&&(this._idle&&(this._idle=!1,this._paused=!0),this.tickCurrentTime(Gt,!0),this.timeline.applyDirtiedAnimation(this))}}},{key:"startTime",get:function(){return this._startTime},set:function(Gt){if(Gt!==null){if(this.updatePromises(),Gt=Number(Gt),isNaN(Gt)||this._paused||this._idle)return;this._startTime=Gt,this.tickCurrentTime((Number(this.timeline.currentTime)-this._startTime)*this.playbackRate),this.timeline.applyDirtiedAnimation(this),this.updatePromises()}}},{key:"playbackRate",get:function(){return this._playbackRate},set:function(Gt){if(Gt!==this._playbackRate){this.updatePromises();var Bt=this.currentTime;this._playbackRate=Gt,this.startTime=null,this.playState!=="paused"&&this.playState!=="idle"&&(this._finishedFlag=!1,this._idle=!1,this.ensureAlive(),this.timeline.applyDirtiedAnimation(this)),Bt!==null&&(this.currentTime=Bt),this.updatePromises()}}},{key:"_isFinished",get:function(){return!this._idle&&(this._playbackRate>0&&Number(this._currentTime)>=this._totalDuration||this._playbackRate<0&&Number(this._currentTime)<=0)}},{key:"totalDuration",get:function(){return this._totalDuration}},{key:"_needsTick",get:function(){return this.pending||this.playState==="running"||!this._finishedFlag}},{key:"updatePromises",value:function(){var Gt;if((Gt=this.effect.target)!==null&&Gt!==void 0&&Gt.destroyed)return this.readyPromise=void 0,this.finishedPromise=void 0,!1;var Bt=this.oldPlayState,yn=this.pending?"pending":this.playState;return this.readyPromise&&yn!==Bt&&(yn==="idle"?(this.rejectReadyPromise(),this.readyPromise=void 0):Bt==="pending"?this.resolveReadyPromise():yn==="pending"&&(this.readyPromise=void 0)),this.finishedPromise&&yn!==Bt&&(yn==="idle"?(this.rejectFinishedPromise(),this.finishedPromise=void 0):yn==="finished"?this.resolveFinishedPromise():Bt==="finished"&&(this.finishedPromise=void 0)),this.oldPlayState=yn,this.readyPromise||this.finishedPromise}},{key:"play",value:function(){this.updatePromises(),this._paused=!1,(this._isFinished||this._idle)&&(this.rewind(),this._startTime=null),this._finishedFlag=!1,this._idle=!1,this.ensureAlive(),this.timeline.applyDirtiedAnimation(this),this.timeline.animations.indexOf(this)===-1&&this.timeline.animations.push(this),this.updatePromises()}},{key:"pause",value:function(){this.updatePromises(),this.currentTime&&(this._holdTime=this.currentTime),!this._isFinished&&!this._paused&&!this._idle?this.currentTimePending=!0:this._idle&&(this.rewind(),this._idle=!1),this._startTime=null,this._paused=!0,this.updatePromises()}},{key:"finish",value:function(){this.updatePromises(),!this._idle&&(this.currentTime=this._playbackRate>0?this._totalDuration:0,this._startTime=this._totalDuration-this.currentTime,this.currentTimePending=!1,this.timeline.applyDirtiedAnimation(this),this.updatePromises())}},{key:"cancel",value:function(){var Gt=this;if(this.updatePromises(),!!this._inEffect&&(this._inEffect=!1,this._idle=!0,this._paused=!1,this._finishedFlag=!0,this._currentTime=null,this._startTime=null,this.effect.update(null),this.timeline.applyDirtiedAnimation(this),this.updatePromises(),this.oncancel)){var Bt=new at(null,this,this.currentTime,null);setTimeout(function(){Gt.oncancel(Bt)})}}},{key:"reverse",value:function(){this.updatePromises();var Gt=this.currentTime;this.playbackRate*=-1,this.play(),Gt!==null&&(this.currentTime=Gt),this.updatePromises()}},{key:"updatePlaybackRate",value:function(Gt){this.playbackRate=Gt}},{key:"targetAnimations",value:function(){var Gt,Bt=(Gt=this.effect)===null||Gt===void 0?void 0:Gt.target;return Bt.getAnimations()}},{key:"markTarget",value:function(){var Gt=this.targetAnimations();Gt.indexOf(this)===-1&&Gt.push(this)}},{key:"unmarkTarget",value:function(){var Gt=this.targetAnimations(),Bt=Gt.indexOf(this);Bt!==-1&&Gt.splice(Bt,1)}},{key:"tick",value:function(Gt,Bt){!this._idle&&!this._paused&&(this._startTime===null?Bt&&(this.startTime=Gt-this._currentTime/this.playbackRate):this._isFinished||this.tickCurrentTime((Gt-this._startTime)*this.playbackRate)),Bt&&(this.currentTimePending=!1,this.fireEvents(Gt))}},{key:"rewind",value:function(){if(this.playbackRate>=0)this.currentTime=0;else if(this._totalDuration<1/0)this.currentTime=this._totalDuration;else throw new Error("Unable to rewind negative playback rate animation with infinite duration")}},{key:"persist",value:function(){throw new Error(m.jf)}},{key:"addEventListener",value:function(Gt,Bt,yn){throw new Error(m.jf)}},{key:"removeEventListener",value:function(Gt,Bt,yn){throw new Error(m.jf)}},{key:"dispatchEvent",value:function(Gt){throw new Error(m.jf)}},{key:"commitStyles",value:function(){throw new Error(m.jf)}},{key:"ensureAlive",value:function(){if(this.playbackRate<0&&this.currentTime===0){var Gt;this._inEffect=!!((Gt=this.effect)!==null&&Gt!==void 0&&Gt.update(-1))}else{var Bt;this._inEffect=!!((Bt=this.effect)!==null&&Bt!==void 0&&Bt.update(this.currentTime))}!this._inTimeline&&(this._inEffect||!this._finishedFlag)&&(this._inTimeline=!0,this.timeline.animations.push(this))}},{key:"tickCurrentTime",value:function(Gt,Bt){Gt!==this._currentTime&&(this._currentTime=Gt,this._isFinished&&!Bt&&(this._currentTime=this._playbackRate>0?this._totalDuration:0),this.ensureAlive())}},{key:"fireEvents",value:function(Gt){var Bt=this;if(this._isFinished){if(!this._finishedFlag){if(this.onfinish){var yn=new at(null,this,this.currentTime,Gt);setTimeout(function(){Bt.onfinish&&Bt.onfinish(yn)})}this._finishedFlag=!0}}else{if(this.onframe&&this.playState==="running"){var Ln=new at(null,this,this.currentTime,Gt);this.onframe(Ln)}this._finishedFlag=!1}}}])}(),Bn=4,Lt=.001,Wn=1e-7,Xn=10,In=11,zn=1/(In-1),dr=typeof Float32Array=="function",vn=function(Pt,Gt){return 1-3*Gt+3*Pt},_r=function(Pt,Gt){return 3*Gt-6*Pt},Ge=function(Pt){return 3*Pt},Tt=function(Pt,Gt,Bt){return((vn(Gt,Bt)*Pt+_r(Gt,Bt))*Pt+Ge(Gt))*Pt},On=function(Pt,Gt,Bt){return 3*vn(Gt,Bt)*Pt*Pt+2*_r(Gt,Bt)*Pt+Ge(Gt)},Vr=function(Pt,Gt,Bt,yn,Ln){var gr,Rr,$r=0;do Rr=Gt+(Bt-Gt)/2,gr=Tt(Rr,yn,Ln)-Pt,gr>0?Bt=Rr:Gt=Rr;while(Math.abs(gr)>Wn&&++$r<Xn);return Rr},en=function(Pt,Gt,Bt,yn){for(var Ln=0;Ln<Bn;++Ln){var gr=On(Gt,Bt,yn);if(gr===0)return Gt;var Rr=Tt(Gt,Bt,yn)-Pt;Gt-=Rr/gr}return Gt},ln=function(Pt,Gt,Bt,yn){if(!(Pt>=0&&Pt<=1&&Bt>=0&&Bt<=1))throw new Error("bezier x values must be in [0, 1] range");if(Pt===Gt&&Bt===yn)return function($r){return $r};for(var Ln=dr?new Float32Array(In):new Array(In),gr=0;gr<In;++gr)Ln[gr]=Tt(gr*zn,Pt,Bt);var Rr=function(Ii){for(var Di=0,ss=1,vs=In-1;ss!==vs&&Ln[ss]<=Ii;++ss)Di+=zn;--ss;var Cs=(Ii-Ln[ss])/(Ln[ss+1]-Ln[ss]),Aa=Di+Cs*zn,sa=On(Aa,Pt,Bt);return sa>=Lt?en(Ii,Aa,Pt,Bt):sa===0?Aa:Vr(Ii,Di,Di+zn,Pt,Bt)};return function($r){return $r===0||$r===1?$r:Tt(Rr($r),Gt,yn)}},Cn=function(Pt){return Pt=Pt.replace(/([A-Z])/g,function(Gt){return"-".concat(Gt.toLowerCase())}),Pt.charAt(0)==="-"?Pt.substring(1):Pt},Mt=function(Pt){return Math.pow(Pt,2)},Et=function(Pt){return Math.pow(Pt,3)},pe=function(Pt){return Math.pow(Pt,4)},Ae=function(Pt){return Math.pow(Pt,5)},Pe=function(Pt){return Math.pow(Pt,6)},Ut=function(Pt){return 1-Math.cos(Pt*Math.PI/2)},jt=function(Pt){return 1-Math.sqrt(1-Pt*Pt)},ft=function(Pt){return Pt*Pt*(3*Pt-2)},on=function(Pt){for(var Gt,Bt=4;Pt<((Gt=Math.pow(2,--Bt))-1)/11;);return 1/Math.pow(4,3-Bt)-7.5625*Math.pow((Gt*3-2)/22-Pt,2)},hn=function(Pt){var Gt=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],Bt=(0,C.Z)(Gt,2),yn=Bt[0],Ln=yn===void 0?1:yn,gr=Bt[1],Rr=gr===void 0?.5:gr,$r=(0,P.Z)(Number(Ln),1,10),Ii=(0,P.Z)(Number(Rr),.1,2);return Pt===0||Pt===1?Pt:-$r*Math.pow(2,10*(Pt-1))*Math.sin((Pt-1-Ii/(Math.PI*2)*Math.asin(1/$r))*(Math.PI*2)/Ii)},lt=function(Pt){var Gt=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],Bt=arguments.length>2?arguments[2]:void 0,yn=(0,C.Z)(Gt,4),Ln=yn[0],gr=Ln===void 0?1:Ln,Rr=yn[1],$r=Rr===void 0?100:Rr,Ii=yn[2],Di=Ii===void 0?10:Ii,ss=yn[3],vs=ss===void 0?0:ss;gr=(0,P.Z)(gr,.1,1e3),$r=(0,P.Z)($r,.1,1e3),Di=(0,P.Z)(Di,.1,1e3),vs=(0,P.Z)(vs,.1,1e3);var Cs=Math.sqrt($r/gr),Aa=Di/(2*Math.sqrt($r*gr)),sa=Aa<1?Cs*Math.sqrt(1-Aa*Aa):0,ca=1,Ai=Aa<1?(Aa*Cs+-vs)/sa:-vs+Cs,$a=Bt?Bt*Pt/1e3:Pt;return Aa<1?$a=Math.exp(-$a*Aa*Cs)*(ca*Math.cos(sa*$a)+Ai*Math.sin(sa*$a)):$a=(ca+Ai*$a)*Math.exp(-$a*Cs),Pt===0||Pt===1?Pt:1-$a},Ct=function(Pt){var Gt=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],Bt=Gt,yn=(0,C.Z)(Bt,2),Ln=yn[0],gr=Ln===void 0?10:Ln,Rr=yn[1],$r=Rr==="start"?Math.ceil:Math.floor;return $r((0,P.Z)(Pt,0,1)*gr)/gr},sn=function(Pt){var Gt=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],Bt=(0,C.Z)(Gt,4),yn=Bt[0],Ln=Bt[1],gr=Bt[2],Rr=Bt[3];return ln(yn,Ln,gr,Rr)(Pt)},W=ln(.42,0,1,1),Se=function(Pt){return function(Gt){var Bt=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],yn=arguments.length>2?arguments[2]:void 0;return 1-Pt(1-Gt,Bt,yn)}},Ht=function(Pt){return function(Gt){var Bt=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],yn=arguments.length>2?arguments[2]:void 0;return Gt<.5?Pt(Gt*2,Bt,yn)/2:1-Pt(Gt*-2+2,Bt,yn)/2}},zt=function(Pt){return function(Gt){var Bt=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],yn=arguments.length>2?arguments[2]:void 0;return Gt<.5?(1-Pt(1-Gt*2,Bt,yn))/2:(Pt(Gt*2-1,Bt,yn)+1)/2}},Fn={steps:Ct,"step-start":function(Pt){return Ct(Pt,[1,"start"])},"step-end":function(Pt){return Ct(Pt,[1,"end"])},linear:function(Pt){return Pt},"cubic-bezier":sn,ease:function(Pt){return sn(Pt,[.25,.1,.25,1])},in:W,out:Se(W),"in-out":Ht(W),"out-in":zt(W),"in-quad":Mt,"out-quad":Se(Mt),"in-out-quad":Ht(Mt),"out-in-quad":zt(Mt),"in-cubic":Et,"out-cubic":Se(Et),"in-out-cubic":Ht(Et),"out-in-cubic":zt(Et),"in-quart":pe,"out-quart":Se(pe),"in-out-quart":Ht(pe),"out-in-quart":zt(pe),"in-quint":Ae,"out-quint":Se(Ae),"in-out-quint":Ht(Ae),"out-in-quint":zt(Ae),"in-expo":Pe,"out-expo":Se(Pe),"in-out-expo":Ht(Pe),"out-in-expo":zt(Pe),"in-sine":Ut,"out-sine":Se(Ut),"in-out-sine":Ht(Ut),"out-in-sine":zt(Ut),"in-circ":jt,"out-circ":Se(jt),"in-out-circ":Ht(jt),"out-in-circ":zt(jt),"in-back":ft,"out-back":Se(ft),"in-out-back":Ht(ft),"out-in-back":zt(ft),"in-bounce":on,"out-bounce":Se(on),"in-out-bounce":Ht(on),"out-in-bounce":zt(on),"in-elastic":hn,"out-elastic":Se(hn),"in-out-elastic":Ht(hn),"out-in-elastic":zt(hn),spring:lt,"spring-in":lt,"spring-out":Se(lt),"spring-in-out":Ht(lt),"spring-out-in":zt(lt)},Tn=function(Pt){return Cn(Pt).replace(/^ease-/,"").replace(/(\(|\s).+/,"").toLowerCase().trim()},lr=function(Pt){return Fn[Tn(Pt)]||Fn.linear},je=function(Pt){return Pt},be=1,it=.5,wt=0;function ot(Hn,Pt){return function(Gt){if(Gt>=1)return 1;var Bt=1/Hn;return Gt+=Pt*Bt,Gt-Gt%Bt}}var ut="\\s*(-?\\d+\\.?\\d*|-?\\.\\d+)\\s*",_t=new RegExp("cubic-bezier\\(".concat(ut,",").concat(ut,",").concat(ut,",").concat(ut,"\\)")),$t=/steps\(\s*(\d+)\s*\)/,Vt=/steps\(\s*(\d+)\s*,\s*(start|middle|end)\s*\)/;function Qt(Hn){var Pt=_t.exec(Hn);if(Pt)return ln.apply(void 0,(0,F.Z)(Pt.slice(1).map(Number)));var Gt=$t.exec(Hn);if(Gt)return ot(Number(Gt[1]),wt);var Bt=Vt.exec(Hn);return Bt?ot(Number(Bt[1]),{start:be,middle:it,end:wt}[Bt[2]]):lr(Hn)}function cn(Hn){return Math.abs(Yn(Hn)/(Hn.playbackRate||1))}function Yn(Hn){var Pt;return Hn.duration===0||Hn.iterations===0?0:(Hn.duration==="auto"?0:Number(Hn.duration))*((Pt=Hn.iterations)!==null&&Pt!==void 0?Pt:1)}var qn=0,Sr=1,Jr=2,vr=3;function Ki(Hn,Pt,Gt){if(Pt===null)return qn;var Bt=Gt.endTime;return Pt<Math.min(Gt.delay,Bt)?Sr:Pt>=Math.min(Gt.delay+Hn+Gt.endDelay,Bt)?Jr:vr}function Mi(Hn,Pt,Gt,Bt,yn){switch(Bt){case Sr:return Pt==="backwards"||Pt==="both"?0:null;case vr:return Gt-yn;case Jr:return Pt==="forwards"||Pt==="both"?Hn:null;case qn:return null}}function yi(Hn,Pt,Gt,Bt,yn){var Ln=yn;return Hn===0?Pt!==Sr&&(Ln+=Gt):Ln+=Bt/Hn,Ln}function qr(Hn,Pt,Gt,Bt,yn,Ln){var gr=Hn===1/0?Pt%1:Hn%1;return gr===0&&Gt===Jr&&Bt!==0&&(yn!==0||Ln===0)&&(gr=1),gr}function es(Hn,Pt,Gt,Bt){return Hn===Jr&&Pt===1/0?1/0:Gt===1?Math.floor(Bt)-1:Math.floor(Bt)}function Ci(Hn,Pt,Gt){var Bt=Hn;if(Hn!=="normal"&&Hn!=="reverse"){var yn=Pt;Hn==="alternate-reverse"&&(yn+=1),Bt="normal",yn!==1/0&&yn%2!==0&&(Bt="reverse")}return Bt==="normal"?Gt:1-Gt}function En(Hn,Pt,Gt){var Bt=Ki(Hn,Pt,Gt),yn=Mi(Hn,Gt.fill,Pt,Bt,Gt.delay);if(yn===null)return null;var Ln=Gt.duration==="auto"?0:Gt.duration,gr=yi(Ln,Bt,Gt.iterations,yn,Gt.iterationStart),Rr=qr(gr,Gt.iterationStart,Bt,Gt.iterations,yn,Ln),$r=es(Bt,Gt.iterations,Rr,gr),Ii=Ci(Gt.direction,$r,Rr);return Gt.currentIteration=$r,Gt.progress=Ii,Gt.easingFunction(Ii)}function rn(Hn,Pt,Gt){var Bt=st(Hn,Pt),yn=dt(Bt,Gt);return function(Ln,gr){if(gr!==null)yn.filter(function($r){return gr>=$r.applyFrom&&gr<$r.applyTo}).forEach(function($r){var Ii=gr-$r.startOffset,Di=$r.endOffset-$r.startOffset,ss=Di===0?0:Ii/Di;Ln.setAttribute($r.property,$r.interpolation(ss),!1,!1)});else for(var Rr in Bt)Xt(Rr)&&Ln.setAttribute(Rr,null)}}function Xt(Hn){return Hn!=="offset"&&Hn!=="easing"&&Hn!=="composite"&&Hn!=="computedOffset"}function st(Hn,Pt){for(var Gt={},Bt=0;Bt<Hn.length;Bt++)for(var yn in Hn[Bt])if(Xt(yn)){var Ln={offset:Hn[Bt].offset,computedOffset:Hn[Bt].computedOffset,easing:Hn[Bt].easing,easingFunction:Qt(Hn[Bt].easing)||Pt.easingFunction,value:Hn[Bt][yn]};Gt[yn]=Gt[yn]||[],Gt[yn].push(Ln)}return Gt}function dt(Hn,Pt){var Gt=[];for(var Bt in Hn)for(var yn=Hn[Bt],Ln=0;Ln<yn.length-1;Ln++){var gr=Ln,Rr=Ln+1,$r=yn[gr].computedOffset,Ii=yn[Rr].computedOffset,Di=$r,ss=Ii;Ln===0&&(Di=-1/0,Ii===0&&(Rr=gr)),Ln===yn.length-2&&(ss=1/0,$r===1&&(gr=Rr)),Gt.push({applyFrom:Di,applyTo:ss,startOffset:yn[gr].computedOffset,endOffset:yn[Rr].computedOffset,easingFunction:yn[gr].easingFunction,property:Bt,interpolation:bn(Bt,yn[gr].value,yn[Rr].value,Pt)})}return Gt.sort(function(vs,Cs){return vs.startOffset-Cs.startOffset}),Gt}var Wt=function(Pt,Gt,Bt){return function(yn){var Ln=Jt(Pt,Gt,yn);return(0,H.Z)(Ln)?Ln:Bt(Ln)}};function bn(Hn,Pt,Gt,Bt){var yn=m.N1[Hn];if(yn&&yn.syntax&&yn.int){var Ln=m.GZ.styleValueRegistry.getPropertySyntax(yn.syntax);if(Ln){var gr=Ln.parser,Rr=gr?gr(Pt,Bt):Pt,$r=gr?gr(Gt,Bt):Gt,Ii=Ln.mixer(Rr,$r,Bt);if(Ii){var Di=Wt.apply(void 0,(0,F.Z)(Ii));return function(ss){return ss===0?Pt:ss===1?Gt:Di(ss)}}}}return Wt(!1,!0,function(ss){return ss?Gt:Pt})}function Jt(Hn,Pt,Gt){if(typeof Hn=="number"&&typeof Pt=="number")return Hn*(1-Gt)+Pt*Gt;if(typeof Hn=="boolean"&&typeof Pt=="boolean"||typeof Hn=="string"&&typeof Pt=="string")return Gt<.5?Hn:Pt;if(Array.isArray(Hn)&&Array.isArray(Pt)){for(var Bt=Hn.length,yn=Pt.length,Ln=Math.max(Bt,yn),gr=[],Rr=0;Rr<Ln;Rr++)gr.push(Jt(Hn[Rr<Bt?Rr:Bt-1],Pt[Rr<yn?Rr:yn-1],Gt));return gr}throw new Error("Mismatched interpolation arguments ".concat(Hn,":").concat(Pt))}var ar=function(){function Hn(){(0,Z.Z)(this,Hn),this.delay=0,this.direction="normal",this.duration="auto",this._easing="linear",this.easingFunction=je,this.endDelay=0,this.fill="auto",this.iterationStart=0,this.iterations=1,this.currentIteration=null,this.progress=null}return(0,V.Z)(Hn,[{key:"easing",get:function(){return this._easing},set:function(Gt){this.easingFunction=Qt(Gt),this._easing=Gt}}])}();function rr(Hn){var Pt=[];for(var Gt in Hn)if(!(Gt in["easing","offset","composite"])){var Bt=Hn[Gt];Array.isArray(Bt)||(Bt=[Bt]);for(var yn=Bt.length,Ln=0;Ln<yn;Ln++){if(!Pt[Ln]){var gr={};"offset"in Hn&&(gr.offset=Number(Hn.offset)),"easing"in Hn&&(gr.easing=Hn.easing),"composite"in Hn&&(gr.composite=Hn.composite),Pt[Ln]=gr}Bt[Ln]!==void 0&&Bt[Ln]!==null&&(Pt[Ln][Gt]=Bt[Ln])}}return Pt.sort(function(Rr,$r){return(Rr.computedOffset||0)-($r.computedOffset||0)}),Pt}function Kr(Hn,Pt){if(Hn===null)return[];Array.isArray(Hn)||(Hn=rr(Hn));for(var Gt=Hn.map(function($r){var Ii={};Pt!=null&&Pt.composite&&(Ii.composite="auto");for(var Di in $r){var ss=$r[Di];if(Di==="offset"){if(ss!==null){if(ss=Number(ss),!isFinite(ss))throw new Error("Keyframe offsets must be numbers.");if(ss<0||ss>1)throw new Error("Keyframe offsets must be between 0 and 1.");Ii.computedOffset=ss}}else if(Di==="composite"&&["replace","add","accumulate","auto"].indexOf(ss)===-1)throw new Error("".concat(ss," compositing is not supported"));Ii[Di]=ss}return Ii.offset===void 0&&(Ii.offset=null),Ii.easing===void 0&&(Ii.easing=(Pt==null?void 0:Pt.easing)||"linear"),Ii.composite===void 0&&(Ii.composite="auto"),Ii}),Bt=!0,yn=-1/0,Ln=0;Ln<Gt.length;Ln++){var gr=Gt[Ln].offset;if((0,D.Z)(gr))Bt=!1;else{if(gr<yn)throw new TypeError("Keyframes are not loosely sorted by offset. Sort or specify offsets.");yn=gr}}Gt=Gt.filter(function($r){return Number($r.offset)>=0&&Number($r.offset)<=1});function Rr(){var $r,Ii=Gt,Di=Ii.length;if(Gt[Di-1].computedOffset=Number(($r=Gt[Di-1].offset)!==null&&$r!==void 0?$r:1),Di>1){var ss;Gt[0].computedOffset=Number((ss=Gt[0].offset)!==null&&ss!==void 0?ss:0)}for(var vs=0,Cs=Number(Gt[0].computedOffset),Aa=1;Aa<Di;Aa++){var sa=Gt[Aa].computedOffset;if(!(0,D.Z)(sa)&&!(0,D.Z)(Cs)){for(var ca=1;ca<Aa-vs;ca++)Gt[vs+ca].computedOffset=Cs+(Number(sa)-Cs)*ca/(Aa-vs);vs=Aa,Cs=Number(sa)}}}return Bt||Rr(),Gt}var si="backwards|forwards|both|none".split("|"),Ie="reverse|alternate|alternate-reverse".split("|");function L(Hn,Pt){var Gt=new ar;return Pt&&(Gt.fill="both",Gt.duration="auto"),typeof Hn=="number"&&!isNaN(Hn)?Gt.duration=Hn:Hn!==void 0&&Object.keys(Hn).forEach(function(Bt){if(Hn[Bt]!==void 0&&Hn[Bt]!==null&&Hn[Bt]!=="auto"){if((typeof Gt[Bt]=="number"||Bt==="duration")&&(typeof Hn[Bt]!="number"||isNaN(Hn[Bt]))||Bt==="fill"&&si.indexOf(Hn[Bt])===-1||Bt==="direction"&&Ie.indexOf(Hn[Bt])===-1)return;Gt[Bt]=Hn[Bt]}}),Gt}function Q(Hn,Pt){return Hn=w(Hn!=null?Hn:{duration:"auto"}),L(Hn,Pt)}function w(Hn){return typeof Hn=="number"&&(isNaN(Hn)?Hn={duration:"auto"}:Hn={duration:Hn}),Hn}var z=function(){function Hn(Pt,Gt,Bt){var yn=this;(0,Z.Z)(this,Hn),this.composite="replace",this.iterationComposite="replace",this.target=Pt,this.timing=Q(Bt,!1),this.timing.effect=this,this.timing.activeDuration=cn(this.timing),this.timing.endTime=Math.max(0,this.timing.delay+this.timing.activeDuration+this.timing.endDelay),this.normalizedKeyframes=Kr(Gt,this.timing),this.interpolations=rn(this.normalizedKeyframes,this.timing,this.target);var Ln=m.GZ.globalThis.Proxy;this.computedTiming=Ln?new Ln(this.timing,{get:function(Rr,$r){return $r==="duration"?Rr.duration==="auto"?0:Rr.duration:$r==="fill"?Rr.fill==="auto"?"none":Rr.fill:$r==="localTime"?yn.animation&&yn.animation.currentTime||null:$r==="currentIteration"?!yn.animation||yn.animation.playState!=="running"?null:Rr.currentIteration||0:$r==="progress"?!yn.animation||yn.animation.playState!=="running"?null:Rr.progress||0:Rr[$r]},set:function(){return!0}}):this.timing}return(0,V.Z)(Hn,[{key:"applyInterpolations",value:function(){this.interpolations(this.target,Number(this.timeFraction))}},{key:"update",value:function(Gt){return Gt===null?!1:(this.timeFraction=En(this.timing.activeDuration,Gt,this.timing),this.timeFraction!==null)}},{key:"getKeyframes",value:function(){return this.normalizedKeyframes}},{key:"setKeyframes",value:function(Gt){this.normalizedKeyframes=Kr(Gt)}},{key:"getComputedTiming",value:function(){return this.computedTiming}},{key:"getTiming",value:function(){return this.timing}},{key:"updateTiming",value:function(Gt){var Bt=this;Object.keys(Gt||{}).forEach(function(yn){Bt.timing[yn]=Gt[yn]})}}])}();function ie(Hn,Pt){return Number(Hn.id)-Number(Pt.id)}var ze=function(){function Hn(Pt){var Gt=this;(0,Z.Z)(this,Hn),this.animations=[],this.ticking=!1,this.timelineTicking=!1,this.hasRestartedThisFrame=!1,this.animationsWithPromises=[],this.inTick=!1,this.pendingEffects=[],this.currentTime=null,this.rafId=0,this.rafCallbacks=[],this.webAnimationsNextTick=function(Bt){Gt.currentTime=Bt,Gt.discardAnimations(),Gt.animations.length===0?Gt.timelineTicking=!1:Gt.requestAnimationFrame(Gt.webAnimationsNextTick)},this.processRafCallbacks=function(Bt){var yn=Gt.rafCallbacks;Gt.rafCallbacks=[],Bt<Number(Gt.currentTime)&&(Bt=Number(Gt.currentTime)),Gt.animations.sort(ie),Gt.animations=Gt.tick(Bt,!0,Gt.animations)[0],yn.forEach(function(Ln){Ln[1](Bt)}),Gt.applyPendingEffects()},this.document=Pt}return(0,V.Z)(Hn,[{key:"getAnimations",value:function(){return this.discardAnimations(),this.animations.slice()}},{key:"isTicking",value:function(){return this.inTick}},{key:"play",value:function(Gt,Bt,yn){var Ln=new z(Gt,Bt,yn),gr=new It(Ln,this);return this.animations.push(gr),this.restartWebAnimationsNextTick(),gr.updatePromises(),gr.play(),gr.updatePromises(),gr}},{key:"applyDirtiedAnimation",value:function(Gt){var Bt=this;if(!this.inTick){Gt.markTarget();var yn=Gt.targetAnimations();yn.sort(ie);var Ln=this.tick(Number(this.currentTime),!1,yn.slice())[1];Ln.forEach(function(gr){var Rr=Bt.animations.indexOf(gr);Rr!==-1&&Bt.animations.splice(Rr,1)}),this.applyPendingEffects()}}},{key:"restart",value:function(){return this.ticking||(this.ticking=!0,this.requestAnimationFrame(function(){}),this.hasRestartedThisFrame=!0),this.hasRestartedThisFrame}},{key:"destroy",value:function(){this.document.defaultView.cancelAnimationFrame(this.frameId)}},{key:"applyPendingEffects",value:function(){this.pendingEffects.forEach(function(Gt){Gt==null||Gt.applyInterpolations()}),this.pendingEffects=[]}},{key:"updateAnimationsPromises",value:function(){this.animationsWithPromises=this.animationsWithPromises.filter(function(Gt){return Gt.updatePromises()})}},{key:"discardAnimations",value:function(){this.updateAnimationsPromises(),this.animations=this.animations.filter(function(Gt){return Gt.playState!=="finished"&&Gt.playState!=="idle"})}},{key:"restartWebAnimationsNextTick",value:function(){this.timelineTicking||(this.timelineTicking=!0,this.requestAnimationFrame(this.webAnimationsNextTick))}},{key:"rAF",value:function(Gt){var Bt=this.rafId++;return this.rafCallbacks.length===0&&(this.frameId=this.document.defaultView.requestAnimationFrame(this.processRafCallbacks)),this.rafCallbacks.push([Bt,Gt]),Bt}},{key:"requestAnimationFrame",value:function(Gt){var Bt=this;return this.rAF(function(yn){Bt.updateAnimationsPromises(),Gt(yn),Bt.updateAnimationsPromises()})}},{key:"tick",value:function(Gt,Bt,yn){var Ln=this,gr,Rr;this.inTick=!0,this.hasRestartedThisFrame=!1,this.currentTime=Gt,this.ticking=!1;var $r=[],Ii=[],Di=[],ss=[];return yn.forEach(function(vs){vs.tick(Gt,Bt),vs._inEffect?(Ii.push(vs.effect),vs.markTarget()):($r.push(vs.effect),vs.unmarkTarget()),vs._needsTick&&(Ln.ticking=!0);var Cs=vs._inEffect||vs._needsTick;vs._inTimeline=Cs,Cs?Di.push(vs):ss.push(vs)}),(gr=this.pendingEffects).push.apply(gr,$r),(Rr=this.pendingEffects).push.apply(Rr,Ii),this.ticking&&this.requestAnimationFrame(function(){}),this.inTick=!1,[Di,ss]}}])}();m.GZ.EasingFunction=Qt,m.GZ.AnimationTimeline=ze;var Je=function(Hn){function Pt(){var Gt;(0,Z.Z)(this,Pt);for(var Bt=arguments.length,yn=new Array(Bt),Ln=0;Ln<Bt;Ln++)yn[Ln]=arguments[Ln];return Gt=(0,N.Z)(this,Pt,[].concat(yn)),Gt.landmarks=[],Gt}return(0,E.Z)(Pt,Hn),(0,V.Z)(Pt,[{key:"rotate",value:function(Bt,yn,Ln){if(this.relElevation=(0,m._O)(yn),this.relAzimuth=(0,m._O)(Bt),this.relRoll=(0,m._O)(Ln),this.elevation+=this.relElevation,this.azimuth+=this.relAzimuth,this.roll+=this.relRoll,this.type===m.iM.EXPLORING){var gr=de.yY(de.Ue(),[1,0,0],(0,m.Vl)((this.rotateWorld?1:-1)*this.relElevation)),Rr=de.yY(de.Ue(),[0,1,0],(0,m.Vl)((this.rotateWorld?1:-1)*this.relAzimuth)),$r=de.yY(de.Ue(),[0,0,1],(0,m.Vl)(this.relRoll)),Ii=de.Jp(de.Ue(),Rr,gr);Ii=de.Jp(de.Ue(),Ii,$r);var Di=he.fromQuat(he.create(),Ii);he.translate(this.matrix,this.matrix,[0,0,-this.distance]),he.multiply(this.matrix,this.matrix,Di),he.translate(this.matrix,this.matrix,[0,0,this.distance])}else{if(Math.abs(this.elevation)>90)return this;this.computeMatrix()}return this._getAxes(),this.type===m.iM.ORBITING||this.type===m.iM.EXPLORING?this._getPosition():this.type===m.iM.TRACKING&&this._getFocalPoint(),this._update(),this}},{key:"pan",value:function(Bt,yn){var Ln=(0,m.O4)(Bt,yn,0),gr=we.d9(this.position);return we.IH(gr,gr,we.bA(we.Ue(),this.right,Ln[0])),we.IH(gr,gr,we.bA(we.Ue(),this.up,Ln[1])),this._setPosition(gr),this.triggerUpdate(),this}},{key:"dolly",value:function(Bt){var yn=this.forward,Ln=we.d9(this.position),gr=Bt*this.dollyingStep,Rr=this.distance+Bt*this.dollyingStep;return gr=Math.max(Math.min(Rr,this.maxDistance),this.minDistance)-this.distance,Ln[0]+=gr*yn[0],Ln[1]+=gr*yn[1],Ln[2]+=gr*yn[2],this._setPosition(Ln),this.type===m.iM.ORBITING||this.type===m.iM.EXPLORING?this._getDistance():this.type===m.iM.TRACKING&&we.IH(this.focalPoint,Ln,this.distanceVector),this.triggerUpdate(),this}},{key:"cancelLandmarkAnimation",value:function(){this.landmarkAnimationID!==void 0&&this.canvas.cancelAnimationFrame(this.landmarkAnimationID)}},{key:"createLandmark",value:function(Bt){var yn,Ln,gr,Rr,$r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},Ii=$r.position,Di=Ii===void 0?this.position:Ii,ss=$r.focalPoint,vs=ss===void 0?this.focalPoint:ss,Cs=$r.roll,Aa=$r.zoom,sa=new m.GZ.CameraContribution;sa.setType(this.type,void 0),sa.setPosition(Di[0],(yn=Di[1])!==null&&yn!==void 0?yn:this.position[1],(Ln=Di[2])!==null&&Ln!==void 0?Ln:this.position[2]),sa.setFocalPoint(vs[0],(gr=vs[1])!==null&&gr!==void 0?gr:this.focalPoint[1],(Rr=vs[2])!==null&&Rr!==void 0?Rr:this.focalPoint[2]),sa.setRoll(Cs!=null?Cs:this.roll),sa.setZoom(Aa!=null?Aa:this.zoom);var ca={name:Bt,matrix:he.clone(sa.getWorldTransform()),right:we.d9(sa.right),up:we.d9(sa.up),forward:we.d9(sa.forward),position:we.d9(sa.getPosition()),focalPoint:we.d9(sa.getFocalPoint()),distanceVector:we.d9(sa.getDistanceVector()),distance:sa.getDistance(),dollyingStep:sa.getDollyingStep(),azimuth:sa.getAzimuth(),elevation:sa.getElevation(),roll:sa.getRoll(),relAzimuth:sa.relAzimuth,relElevation:sa.relElevation,relRoll:sa.relRoll,zoom:sa.getZoom()};return this.landmarks.push(ca),ca}},{key:"gotoLandmark",value:function(Bt){var yn=this,Ln=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},gr=(0,X.Z)(Bt)?this.landmarks.find(function(Lu){return Lu.name===Bt}):Bt;if(gr){var Rr=(0,H.Z)(Ln)?{duration:Ln}:Ln,$r=Rr.easing,Ii=$r===void 0?"linear":$r,Di=Rr.duration,ss=Di===void 0?100:Di,vs=Rr.easingFunction,Cs=vs===void 0?void 0:vs,Aa=Rr.onfinish,sa=Aa===void 0?void 0:Aa,ca=Rr.onframe,Ai=ca===void 0?void 0:ca,$a=.01;this.cancelLandmarkAnimation();var Zo=gr.position,Ko=gr.focalPoint,$o=gr.zoom,bo=gr.roll,Pl=Cs||m.GZ.EasingFunction(Ii),il,go=function(){yn.setFocalPoint(Ko),yn.setPosition(Zo),yn.setRoll(bo),yn.setZoom($o),yn.computeMatrix(),yn.triggerUpdate(),sa==null||sa()};if(ss===0)return go();var Ll=function(ao){il===void 0&&(il=ao);var sl=ao-il;if(sl>=ss){go();return}var No=Pl(sl/ss),Uu=we.Ue(),ws=we.Ue(),Kh=1,dh=0;we.t7(Uu,yn.focalPoint,Ko,No),we.t7(ws,yn.position,Zo,No),dh=yn.roll*(1-No)+bo*No,Kh=yn.zoom*(1-No)+$o*No,yn.setFocalPoint(Uu),yn.setPosition(ws),yn.setRoll(dh),yn.setZoom(Kh);var $h=we.TK(Uu,Ko)+we.TK(ws,Zo);if($h<=$a&&$o===void 0&&bo===void 0)return go();yn.computeMatrix(),yn.triggerUpdate(),sl<ss&&(Ai==null||Ai(No),yn.landmarkAnimationID=yn.canvas.requestAnimationFrame(Ll))};this.canvas.requestAnimationFrame(Ll)}}}])}(m.V1);m.GZ.CameraContribution=Je;var At=null,xt=null;function Sn(Hn,Pt,Gt){var Bt=Hn+Pt;return Gt?Bt*2:Bt}function Oe(Hn,Pt){var Gt=Pt?[[Hn*.25,Hn*.25],[Hn*.75,Hn*.75]]:[[Hn*.5,Hn*.5]];return Gt}var Qe={size:6,padding:2,backgroundColor:"transparent",opacity:1,fill:"#fff",fillOpacity:1,stroke:"transparent",strokeOpacity:1,lineWidth:0,isStagger:!0};function Re(Hn){var Pt=_objectSpread(_objectSpread({},Qe),Hn),Gt=Pt.size,Bt=Pt.padding,yn=Pt.isStagger,Ln=Pt.backgroundColor,gr=Pt.backgroundOpacity,Rr=Pt.opacity,$r=Pt.fill,Ii=Pt.fillOpacity,Di=Pt.lineWidth,ss=Pt.stroke,vs=Pt.strokeOpacity,Cs=Sn(Gt,Bt,yn),Aa=Oe(Cs,yn),sa=new Rect({style:{width:Cs,height:Cs,fill:Ln,opacity:1,fillOpacity:gr}}),ca=_createForOfIteratorHelper(Aa),Ai;try{for(ca.s();!(Ai=ca.n()).done;){var $a=_slicedToArray(Ai.value,2),Zo=$a[0],Ko=$a[1],$o=new Circle({style:{opacity:Rr,fill:$r,fillOpacity:Ii,cx:Zo,cy:Ko,r:Gt/2,lineWidth:Di,stroke:ss,strokeOpacity:vs}});sa.appendChild($o)}}catch(bo){ca.e(bo)}finally{ca.f()}return sa}var Ke={spacing:5,opacity:1,backgroundColor:"transparent",backgroundOpacity:1,strokeOpacity:1,stroke:"#fff",lineWidth:2};function gt(Hn){var Pt=_objectSpread(_objectSpread({},Ke),Hn),Gt=Pt.spacing,Bt=Pt.lineWidth,yn=Pt.backgroundColor,Ln=Pt.backgroundOpacity,gr=Pt.opacity,Rr=Pt.stroke,$r=Pt.strokeOpacity,Ii=Gt+Bt||1,Di=Gt+Bt||1,ss=`
M 0 0 L `.concat(Ii,` 0
M 0 `).concat(Di," L ").concat(Ii," ").concat(Di,`
`),vs=new Rect({style:{width:Ii,height:Di,fill:yn,opacity:1,fillOpacity:Ln}}),Cs=new Path({style:{d:ss,opacity:gr,stroke:Rr,strokeOpacity:$r,fillOpacity:1,lineWidth:Bt}});return vs.appendChild(Cs),vs}var tn={size:6,padding:1,isStagger:!0,backgroundColor:"transparent",opacity:1,fill:"#fff",fillOpacity:1,stroke:"transparent",lineWidth:0};function yt(Hn){var Pt=_objectSpread(_objectSpread({},tn),Hn),Gt=Pt.size,Bt=Pt.padding,yn=Pt.isStagger,Ln=Pt.backgroundColor,gr=Pt.backgroundOpacity,Rr=Pt.opacity,$r=Pt.fill,Ii=Pt.fillOpacity,Di=Pt.stroke,ss=Pt.strokeOpacity,vs=Pt.lineWidth,Cs=Sn(Gt,Bt,yn),Aa=Oe(Cs,yn),sa=new Rect({style:{width:Cs,height:Cs,fill:Ln,opacity:1,fillOpacity:gr}}),ca=_createForOfIteratorHelper(Aa),Ai;try{for(ca.s();!(Ai=ca.n()).done;){var $a=_slicedToArray(Ai.value,2),Zo=$a[0],Ko=$a[1],$o=new Rect({style:{opacity:Rr,fill:$r,fillOpacity:Ii,x:Zo-Gt/2,y:Ko-Gt/2,width:Gt,height:Gt,lineWidth:vs,stroke:Di,strokeOpacity:ss}});sa.appendChild($o)}}catch(bo){ca.e(bo)}finally{ca.f()}return sa}var Yt=["body","startHead","endHead","startHeadOffset","endHeadOffset"],Rn=["body","startHead","endHead","startHeadOffset","endHeadOffset"],er=["body","startHead","endHead","startHeadOffset","endHeadOffset"],Jn=function(Hn){function Pt(Gt){var Bt;(0,Z.Z)(this,Pt),Bt=(0,N.Z)(this,Pt,[(0,Fe.Z)((0,Fe.Z)({},Gt),{},{type:Pt.tag})]);var yn=Bt.attributes,Ln=yn.body,gr=yn.startHead,Rr=yn.endHead;yn.startHeadOffset,yn.endHeadOffset;var $r=(0,ve.Z)(yn,Yt);if(!Ln)throw new Error("Arrow's body is required");return Bt.body=Ln,Bt.appendChild(Bt.body),Bt.handleBodyAttributeChanged(Bt.body),gr&&Bt.appendArrowHead(Bt.getArrowHeadType(gr),!0),Rr&&Bt.appendArrowHead(Bt.getArrowHeadType(Rr),!1),Bt.applyArrowStyle($r,[Bt.body,Bt.startHead,Bt.endHead]),Bt}return(0,E.Z)(Pt,Hn),(0,V.Z)(Pt,[{key:"handleBodyAttributeChanged",value:function(Bt){var yn=this;Bt.addEventListener(m.Dk.ATTR_MODIFIED,function(Ln){var gr=Ln.attrName;gr==="x1"||gr==="y1"?yn.startHead&&yn.transformArrowHead(yn.startHead,!0):(gr==="x2"||gr==="y2")&&yn.endHead&&yn.transformArrowHead(yn.endHead,!1)})}},{key:"getBody",value:function(){return this.body}},{key:"getStartHead",value:function(){return this.startHead}},{key:"getEndHead",value:function(){return this.endHead}},{key:"attributeChangedCallback",value:function(Bt,yn,Ln){if(Bt==="opacity"||Bt==="strokeOpacity"||Bt==="stroke"||Bt==="lineWidth"||Bt==="increasedLineWidthForHitTesting")this.applyArrowStyle((0,ct.Z)({},Bt,Ln),[this.body,this.startHead,this.endHead]);else if(Bt==="startHead"||Bt==="endHead"){var gr=Bt==="startHead";if(this.destroyArrowHead(gr),Ln){var Rr=this.attributes;Rr.body,Rr.startHead,Rr.endHead,Rr.startHeadOffset,Rr.endHeadOffset;var $r=(0,ve.Z)(Rr,Rn);this.appendArrowHead(this.getArrowHeadType(Ln),gr),this.applyArrowStyle($r,[gr?this.startHead:this.endHead])}}else if(Bt==="body"){var Ii=this.attributes;Ii.body,Ii.startHead,Ii.endHead,Ii.startHeadOffset,Ii.endHeadOffset;var Di=(0,ve.Z)(Ii,er);this.body.destroy(),this.body=Ln,this.appendChild(this.body),this.applyArrowStyle(Di,[this.body])}else Bt==="startHeadOffset"?this.moveArrowHeadAlongTangent(Ln,!0):Bt==="endHeadOffset"&&this.moveArrowHeadAlongTangent(Ln,!1)}},{key:"getArrowHeadType",value:function(Bt){return typeof Bt=="boolean"?"default":"custom"}},{key:"appendArrowHead",value:function(Bt,yn){var Ln;Bt==="default"?Ln=this.createDefaultArrowHead():Ln=yn?this.attributes.startHead:this.attributes.endHead,this.transformArrowHead(Ln,yn),Ln.setAttribute("zIndex",1),yn?this.startHead=Ln:this.endHead=Ln,this.appendChild(Ln);var gr=yn?this.attributes.startHeadOffset:this.attributes.endHeadOffset;gr&&this.moveArrowHeadAlongTangent(gr,yn)}},{key:"transformArrowHead",value:function(Bt,yn){var Ln=we.Ue(),gr=0,Rr=0,$r=0,Ii=0,Di=0,ss=this.body&&this.body.nodeName;if(ss===m.bn.LINE){var vs=this.body.attributes,Cs=vs.x1,Aa=vs.x2,sa=vs.y1,ca=vs.y2;Rr=yn?Aa:Cs,$r=yn?Cs:Aa,Ii=yn?ca:sa,Di=yn?sa:ca}else if(ss===m.bn.POLYLINE){var Ai=this.body.attributes.points,$a=Ai.length;Rr=yn?Ai[1][0]:Ai[$a-2][0],Ii=yn?Ai[1][1]:Ai[$a-2][1],$r=yn?Ai[0][0]:Ai[$a-1][0],Di=yn?Ai[0][1]:Ai[$a-1][1]}else if(ss===m.bn.PATH){var Zo=this.getTangent(this.body,yn),Ko=(0,C.Z)(Zo,2),$o=Ko[0],bo=Ko[1];Rr=$o[0],Ii=$o[1],$r=bo[0],Di=bo[1]}var Pl=Rr-$r,il=Ii-Di;gr=Math.atan2(il,Pl),Ln=we.al($r,Di,0),yn?(this.startHeadPosition=Ln,this.startHeadRad=gr):(this.endHeadPosition=Ln,this.endHeadRad=gr),Bt.setLocalPosition(Ln),Bt.setLocalEulerAngles(gr*180/Math.PI+Bt.getLocalEulerAngles())}},{key:"moveArrowHeadAlongTangent",value:function(Bt,yn){var Ln=yn?this.startHead:this.endHead;Ln&&Ln.setLocalPosition(we.lu(we.Ue(),yn?this.startHeadPosition:this.endHeadPosition,we.al(Math.cos(yn?this.startHeadRad:this.endHeadRad)*Bt,Math.sin(yn?this.startHeadRad:this.endHeadRad)*Bt,0))),this.body}},{key:"destroyArrowHead",value:function(Bt){Bt&&this.startHead&&(this.startHead.destroy(),this.startHead=void 0),!Bt&&this.endHead&&(this.endHead.destroy(),this.endHead=void 0)}},{key:"getTangent",value:function(Bt,yn){return yn?Bt.getStartTangent():Bt.getEndTangent()}},{key:"createDefaultArrowHead",value:function(){var Bt=this.attributes,yn=Bt.stroke,Ln=Bt.lineWidth,gr=Math.sin,Rr=Math.cos,$r=Math.PI,Ii=10*Rr($r/6);return new m.y$({style:{d:"M".concat(Ii/2,",").concat(10*gr($r/6)," L-").concat(Ii/2,",0 L").concat(Ii/2,",-").concat(10*gr($r/6)),stroke:yn,lineWidth:Ln,transformOrigin:"center"}})}},{key:"applyArrowStyle",value:function(Bt,yn){var Ln=Bt.opacity,gr=Bt.stroke,Rr=Bt.strokeOpacity,$r=Bt.lineWidth,Ii=Bt.increasedLineWidthForHitTesting;yn.forEach(function(Di){Di&&((0,D.Z)(Ln)||(Di.style.opacity=Ln),(0,D.Z)(gr)||(Di.style.stroke=gr),(0,D.Z)(Rr)||(Di.style.strokeOpacity=Rr),(0,D.Z)($r)||(Di.style.lineWidth=$r),(0,D.Z)(Ii)||(Di.style.increasedLineWidthForHitTesting=Ii))})}}])}(m.b_);Jn.tag="arrow",Jn.PARSED_STYLE_LIST=new Set([].concat((0,F.Z)(m.b_.PARSED_STYLE_LIST),["body","startHead","endHead","startHeadOffset","endHeadOffset","stroke","lineWidth","opacity","strokeOpacity"]));var kr=Math.PI,fr=kr*2,wr=Math.sin,ei=Math.cos,_n=Math.acos,jn=Math.atan2,Hr=Math.sqrt,Pr=Math.max,$i=Math.min,Zi=1e-4,Xi=[{name:"sr",inherits:!1,interpolable:!0,syntax:m.h0.LENGTH_PERCENTAGE},{name:"sr0",inherits:!1,interpolable:!0,syntax:m.h0.LENGTH_PERCENTAGE},{name:"startAngle",inherits:!1,interpolable:!0,syntax:m.h0.ANGLE},{name:"endAngle",inherits:!1,interpolable:!0,syntax:m.h0.ANGLE}];Xi.forEach(function(Hn){m.ux.registerProperty(Hn)});var Ei=function(Pt,Gt,Bt,yn){return{x:Pt+Bt*Math.cos(yn),y:Gt+Bt*Math.sin(yn)}};function ms(Hn,Pt,Gt,Bt,yn,Ln,gr,Rr){var $r=Gt-Hn,Ii=Bt-Pt,Di=gr-yn,ss=Rr-Ln,vs=ss*$r-Di*Ii;if(!(vs*vs<Zi))return vs=(Di*(Pt-Ln)-ss*(Hn-yn))/vs,[Hn+vs*$r,Pt+vs*Ii]}function _i(Hn,Pt,Gt,Bt,yn,Ln,gr){var Rr=Hn-Gt,$r=Pt-Bt,Ii=(gr?Ln:-Ln)/Hr(Rr*Rr+$r*$r),Di=Ii*$r,ss=-Ii*Rr,vs=Hn+Di,Cs=Pt+ss,Aa=Gt+Di,sa=Bt+ss,ca=(vs+Aa)/2,Ai=(Cs+sa)/2,$a=Aa-vs,Zo=sa-Cs,Ko=$a*$a+Zo*Zo,$o=yn-Ln,bo=vs*sa-Aa*Cs,Pl=(Zo<0?-1:1)*Hr(Pr(0,$o*$o*Ko-bo*bo)),il=(bo*Zo-$a*Pl)/Ko,go=(-bo*$a-Zo*Pl)/Ko,Ll=(bo*Zo+$a*Pl)/Ko,Lu=(-bo*$a+Zo*Pl)/Ko,ao=il-ca,sl=go-Ai,No=Ll-ca,Uu=Lu-Ai;return ao*ao+sl*sl>No*No+Uu*Uu&&(il=Ll,go=Lu),{cx:il,cy:go,x0:-Di,y0:-ss,x1:il*(yn/$o-1),y1:go*(yn/$o-1)}}function Es(Hn,Pt){return Pt=Pt<0&&Hn>=0?Pt+fr:Pt,Pt-Hn<=kr?0:1}var ua=function(Hn){function Pt(Gt){var Bt;return(0,Z.Z)(this,Pt),Bt=(0,N.Z)(this,Pt,[Gt]),Bt.updatePath(),Bt}return(0,E.Z)(Pt,Hn),(0,V.Z)(Pt,[{key:"setAttribute",value:function(Bt,yn,Ln){(0,vt.Z)(Pt,"setAttribute",this,3)([Bt,yn,Ln]),["startAngle","endAngle","sr","sr0","radius"].indexOf(Bt)>-1&&this.updatePath()}},{key:"updatePath",value:function(){var Bt=this.parsedStyle,yn=Bt.x,Ln=Bt.y,gr=Bt.startAngle,Rr=Bt.endAngle,$r=Bt.sr,Ii=Bt.sr0,Di=Bt.radius,ss=this.createPath(yn,Ln,gr?(0,m.Vl)(gr):0,Rr?(0,m.Vl)(Rr):Math.PI*2,$r||0,Ii||0,Di||[0,0,0,0]);(0,vt.Z)(Pt,"setAttribute",this,3)(["d",ss])}},{key:"createPath",value:function(Bt,yn,Ln,gr,Rr,$r,Ii){if(!(Rr<=0)){var Di=Ei(Bt,yn,Rr,Ln),ss=Ei(Bt,yn,Rr,gr),vs=Ei(Bt,yn,$r,Ln),Cs=Ei(Bt,yn,$r,gr);if((0,j.Z)(gr-Ln,Math.PI*2)){var Aa=Ei(Bt,yn,Rr,Ln+Math.PI),sa=Ei(Bt,yn,$r,Ln+Math.PI),ca=[["M",Di.x,Di.y],["A",Rr,Rr,0,1,1,Aa.x,Aa.y],["A",Rr,Rr,0,1,1,ss.x,ss.y],["M",vs.x,vs.y]];return $r&&(ca.push(["A",$r,$r,0,1,0,sa.x,sa.y]),ca.push(["A",$r,$r,0,1,0,Cs.x,Cs.y])),ca.push(["M",Di.x,Di.y]),ca.push(["Z"]),ca}var Ai=gr-Ln,$a=Rr*ei(Ln),Zo=Rr*wr(Ln),Ko=$r*ei(gr),$o=$r*wr(gr),bo=Rr*ei(gr),Pl=Rr*wr(gr),il=$r*ei(Ln),go=$r*wr(Ln),Ll=(0,C.Z)(Ii,4),Lu=Ll[0],ao=Ll[1],sl=Ll[2],No=Ll[3],Uu=(Rr-$r)/2,ws=$i(Uu,Lu),Kh=$i(Uu,ao),dh=$i(Uu,sl),$h=$i(Uu,No),Uh=Pr(ws,Kh),Ku=Pr(dh,$h),sc=Uh,pu=Ku;if((Uh>Zi||Ku>Zi)&&Ai<kr){var ou=ms($a,Zo,il,go,bo,Pl,Ko,$o);if(ou){var Ad=$a-ou[0],hf=Zo-ou[1],Xo=bo-ou[0],fh=Pl-ou[1],Qf=1/wr(_n((Ad*Xo+hf*fh)/(Hr(Ad*Ad+hf*hf)*Hr(Xo*Xo+fh*fh)))/2),pd=Hr(ou[0]*ou[0]+ou[1]*ou[1]);sc=$i(Uh,(Rr-pd)/(Qf+1)),pu=$i(Ku,($r-pd)/(Qf-1))}}var Ah=Es(Ln,gr),Vc=!0,jo=[];if(sc>Zi){var gd=$i(Lu,sc),lu=$i(ao,sc),gu=_i(il,go,$a,Zo,Rr,gd,Vc),oo=_i(bo,Pl,Ko,$o,Rr,lu,Vc);if(jo.push(["M",Bt+gu.cx+gu.x0,yn+gu.cy+gu.y0]),sc<Uh&&gd===lu){var Ic=jn(gu.y0,gu.x0),jc=jn(oo.y0,oo.x0);jo.push(["A",sc,sc,0,Es(Ic,jc),1,Bt+oo.cx+oo.x0,yn+oo.cy+oo.y0])}else{if(gd>0){var ph=jn(gu.y0,gu.x0),Lo=jn(gu.y1,gu.x1),Ji=Ei(Bt,yn,Rr,Lo);jo.push(["A",gd,gd,0,Es(ph,Lo),1,Ji.x,Ji.y])}var $u=jn(gu.cy+gu.y1,gu.cx+gu.x1),gh=jn(oo.cy+oo.y1,oo.cx+oo.x1),mh=Ei(Bt,yn,Rr,gh);if(jo.push(["A",Rr,Rr,0,Es($u,gh),1,mh.x,mh.y]),lu>0){var np=jn(oo.y1,oo.x1),vh=jn(oo.y0,oo.x0);jo.push(["A",lu,lu,0,Es(np,vh),1,Bt+oo.cx+oo.x0,yn+oo.cy+oo.y0])}}}else jo.push(["M",Di.x,Di.y]),jo.push(["A",Rr,Rr,0,Ah,1,ss.x,ss.y]);if($r<Zi)jo.push(["L",Cs.x,Cs.y]);else if(pu>Zi){var Cu=$i(No,pu),zc=$i(sl,pu),Ul=_i(Ko,$o,0,0,$r-Rr,zc,Vc),Xl=_i(0,0,il,go,$r-Rr,Cu,Vc);if(jo.push(["L",Bt+Ul.cx+Ul.x0,yn+Ul.cy+Ul.y0]),pu<Ku&&Cu===zc){var Uo=jn(Ul.y0,Ul.x0),Ld=jn(Xl.y0,Xl.x0),Yc=Ei(Bt,yn,$r,Ld);jo.push(["A",sc,sc,0,Es(Uo,Ld),1,Yc.x,Yc.y])}else{if(zc>0){var gl=jn(Ul.y0,Ul.x0),To=jn(Ul.y1,Ul.x1),ml=Ei(Bt,yn,$r-Rr,To);jo.push(["A",zc,zc,0,Es(gl,To),1,ml.x,ml.y])}var Xu=jn(Ul.cy+Ul.y1,Ul.cx+Ul.x1),mu=jn(Xl.cy+Xl.y1,Xl.cx+Xl.x1),Oo=Ei(Bt,yn,$r,mu);if(jo.push(["A",$r,$r,0,Es(mu,Xu),0,Oo.x,Oo.y]),jo.push(["L",Oo.x,Oo.y]),Cu>0){var Bo=jn(Xl.y1,Xl.x1),_o=jn(Xl.y0,Xl.x0);jo.push(["A",Cu,Cu,0,Es(Bo,_o),1,Bt+Xl.cx+Xl.x0,yn+Xl.cy+Xl.y0])}}}else jo.push(["L",Cs.x,Cs.y]),jo.push(["A",$r,$r,0,Ah,0,vs.x,vs.y]);return jo.push(["Z"]),jo}}}])}(m.y$);ua.PARSED_STYLE_LIST=new Set([].concat((0,F.Z)(m.y$.PARSED_STYLE_LIST),["x","y","sr","sr0","radius","startAngle","endAngle"]))},67469:function(Be,Me,b){"use strict";b.d(Me,{k:function(){return N}});var m=b(49336),Z=b(54648),V=b(7663);class N extends m.Z{constructor(C){super();_c(this,"nodeMap",new Map);_c(this,"edgeMap",new Map);_c(this,"inEdgesMap",new Map);_c(this,"outEdgesMap",new Map);_c(this,"bothEdgesMap",new Map);_c(this,"treeIndices",new Map);_c(this,"changes",[]);_c(this,"batchCount",0);_c(this,"onChanged",()=>{});_c(this,"batch",C=>{this.batchCount+=1,C(),this.batchCount-=1,this.batchCount||this.commit()});C&&(C.nodes&&this.addNodes(C.nodes),C.edges&&this.addEdges(C.edges),C.tree&&this.addTree(C.tree),C.onChanged&&(this.onChanged=C.onChanged))}commit(){const C=this.changes;this.changes=[];const P={graph:this,changes:C};this.emit("changed",P),this.onChanged(P)}reduceChanges(C){let P=[];return C.forEach(H=>{switch(H.type){case"NodeRemoved":{let D=!1;P=P.filter(X=>{if(X.type==="NodeAdded"){const j=X.value.id===H.value.id;return j&&(D=!0),!j}else{if(X.type==="NodeDataUpdated")return X.id!==H.value.id;if(X.type==="TreeStructureChanged")return X.nodeId!==H.value.id}return!0}),D||P.push(H);break}case"EdgeRemoved":{let D=!1;P=P.filter(X=>{if(X.type==="EdgeAdded"){const j=X.value.id===H.value.id;return j&&(D=!0),!j}else if(X.type==="EdgeDataUpdated"||X.type==="EdgeUpdated")return X.id!==H.value.id;return!0}),D||P.push(H);break}case"NodeDataUpdated":case"EdgeDataUpdated":case"EdgeUpdated":{const D=P.findIndex(j=>j.type===H.type&&j.id===H.id&&(H.propertyName===void 0||j.propertyName===H.propertyName)),X=P[D];X?H.propertyName!==void 0?X.newValue=H.newValue:(P.splice(D,1),P.push(H)):P.push(H);break}case"TreeStructureDetached":{P=P.filter(D=>D.type==="TreeStructureAttached"||D.type==="TreeStructureChanged"?D.treeKey!==H.treeKey:!0),P.push(H);break}case"TreeStructureChanged":{const D=P.find(X=>X.type==="TreeStructureChanged"&&X.treeKey===H.treeKey&&X.nodeId===H.nodeId);D?D.newParentId=H.newParentId:P.push(H);break}default:P.push(H);break}}),P}checkNodeExistence(C){this.getNode(C)}hasNode(C){return this.nodeMap.has(C)}areNeighbors(C,P){return this.getNeighbors(P).some(H=>H.id===C)}getNode(C){const P=this.nodeMap.get(C);if(!P)throw new Error("Node not found for id: "+C);return P}getRelatedEdges(C,P){if(this.checkNodeExistence(C),P==="in"){const H=this.inEdgesMap.get(C);return Array.from(H)}else if(P==="out"){const H=this.outEdgesMap.get(C);return Array.from(H)}else{const H=this.bothEdgesMap.get(C);return Array.from(H)}}getDegree(C,P){return this.getRelatedEdges(C,P).length}getSuccessors(C){const H=this.getRelatedEdges(C,"out").map(D=>this.getNode(D.target));return Array.from(new Set(H))}getPredecessors(C){const H=this.getRelatedEdges(C,"in").map(D=>this.getNode(D.source));return Array.from(new Set(H))}getNeighbors(C){const P=this.getPredecessors(C),H=this.getSuccessors(C);return Array.from(new Set([...P,...H]))}doAddNode(C){if(this.hasNode(C.id))throw new Error("Node already exists: "+C.id);this.nodeMap.set(C.id,C),this.inEdgesMap.set(C.id,new Set),this.outEdgesMap.set(C.id,new Set),this.bothEdgesMap.set(C.id,new Set),this.treeIndices.forEach(P=>{P.childrenMap.set(C.id,new Set)}),this.changes.push({type:"NodeAdded",value:C})}addNodes(C){this.batch(()=>{for(const P of C)this.doAddNode(P)})}addNode(C){this.addNodes([C])}doRemoveNode(C){const P=this.getNode(C),H=this.bothEdgesMap.get(C);H==null||H.forEach(D=>this.doRemoveEdge(D.id)),this.nodeMap.delete(C),this.treeIndices.forEach(D=>{var j,de;(j=D.childrenMap.get(C))==null||j.forEach(he=>{D.parentMap.delete(he.id)});const X=D.parentMap.get(C);X&&((de=D.childrenMap.get(X.id))==null||de.delete(P)),D.parentMap.delete(C),D.childrenMap.delete(C)}),this.bothEdgesMap.delete(C),this.inEdgesMap.delete(C),this.outEdgesMap.delete(C),this.changes.push({type:"NodeRemoved",value:P})}removeNodes(C){this.batch(()=>{C.forEach(P=>this.doRemoveNode(P))})}removeNode(C){this.removeNodes([C])}updateNodeDataProperty(C,P,H){const D=this.getNode(C);this.batch(()=>{const X=D.data[P],j=H;D.data[P]=j,this.changes.push({type:"NodeDataUpdated",id:C,propertyName:P,oldValue:X,newValue:j})})}mergeNodeData(C,P){this.batch(()=>{Object.entries(P).forEach(([H,D])=>{this.updateNodeDataProperty(C,H,D)})})}updateNodeData(...C){const P=C[0],H=this.getNode(P);if(typeof C[1]=="string"){this.updateNodeDataProperty(P,C[1],C[2]);return}let D;if(typeof C[1]=="function"){const X=C[1];D=X(H.data)}else typeof C[1]=="object"&&(D=C[1]);this.batch(()=>{const X=H.data,j=D;H.data=D,this.changes.push({type:"NodeDataUpdated",id:P,oldValue:X,newValue:j})})}checkEdgeExistence(C){if(!this.hasEdge(C))throw new Error("Edge not found for id: "+C)}hasEdge(C){return this.edgeMap.has(C)}getEdge(C){return this.checkEdgeExistence(C),this.edgeMap.get(C)}getEdgeDetail(C){const P=this.getEdge(C);return{edge:P,source:this.getNode(P.source),target:this.getNode(P.target)}}doAddEdge(C){if(this.hasEdge(C.id))throw new Error("Edge already exists: "+C.id);this.checkNodeExistence(C.source),this.checkNodeExistence(C.target),this.edgeMap.set(C.id,C);const P=this.inEdgesMap.get(C.target),H=this.outEdgesMap.get(C.source),D=this.bothEdgesMap.get(C.source),X=this.bothEdgesMap.get(C.target);P.add(C),H.add(C),D.add(C),X.add(C),this.changes.push({type:"EdgeAdded",value:C})}addEdges(C){this.batch(()=>{for(const P of C)this.doAddEdge(P)})}addEdge(C){this.addEdges([C])}doRemoveEdge(C){const P=this.getEdge(C),H=this.outEdgesMap.get(P.source),D=this.inEdgesMap.get(P.target),X=this.bothEdgesMap.get(P.source),j=this.bothEdgesMap.get(P.target);H.delete(P),D.delete(P),X.delete(P),j.delete(P),this.edgeMap.delete(C),this.changes.push({type:"EdgeRemoved",value:P})}removeEdges(C){this.batch(()=>{C.forEach(P=>this.doRemoveEdge(P))})}removeEdge(C){this.removeEdges([C])}updateEdgeSource(C,P){const H=this.getEdge(C);this.checkNodeExistence(P);const D=H.source,X=P;this.outEdgesMap.get(D).delete(H),this.bothEdgesMap.get(D).delete(H),this.outEdgesMap.get(X).add(H),this.bothEdgesMap.get(X).add(H),H.source=P,this.batch(()=>{this.changes.push({type:"EdgeUpdated",id:C,propertyName:"source",oldValue:D,newValue:X})})}updateEdgeTarget(C,P){const H=this.getEdge(C);this.checkNodeExistence(P);const D=H.target,X=P;this.inEdgesMap.get(D).delete(H),this.bothEdgesMap.get(D).delete(H),this.inEdgesMap.get(X).add(H),this.bothEdgesMap.get(X).add(H),H.target=P,this.batch(()=>{this.changes.push({type:"EdgeUpdated",id:C,propertyName:"target",oldValue:D,newValue:X})})}updateEdgeDataProperty(C,P,H){const D=this.getEdge(C);this.batch(()=>{const X=D.data[P],j=H;D.data[P]=j,this.changes.push({type:"EdgeDataUpdated",id:C,propertyName:P,oldValue:X,newValue:j})})}updateEdgeData(...C){const P=C[0],H=this.getEdge(P);if(typeof C[1]=="string"){this.updateEdgeDataProperty(P,C[1],C[2]);return}let D;if(typeof C[1]=="function"){const X=C[1];D=X(H.data)}else typeof C[1]=="object"&&(D=C[1]);this.batch(()=>{const X=H.data,j=D;H.data=D,this.changes.push({type:"EdgeDataUpdated",id:P,oldValue:X,newValue:j})})}mergeEdgeData(C,P){this.batch(()=>{Object.entries(P).forEach(([H,D])=>{this.updateEdgeDataProperty(C,H,D)})})}checkTreeExistence(C){if(!this.hasTreeStructure(C))throw new Error("Tree structure not found for treeKey: "+C)}hasTreeStructure(C){return this.treeIndices.has(C)}attachTreeStructure(C){this.treeIndices.has(C)||(this.treeIndices.set(C,{parentMap:new Map,childrenMap:new Map}),this.batch(()=>{this.changes.push({type:"TreeStructureAttached",treeKey:C})}))}detachTreeStructure(C){this.checkTreeExistence(C),this.treeIndices.delete(C),this.batch(()=>{this.changes.push({type:"TreeStructureDetached",treeKey:C})})}addTree(C,P){this.batch(()=>{this.attachTreeStructure(P);const H=[],D=Array.isArray(C)?C:[C];for(;D.length;){const X=D.shift();H.push(X),X.children&&D.push(...X.children)}this.addNodes(H),H.forEach(X=>{var j;(j=X.children)==null||j.forEach(de=>{this.setParent(de.id,X.id,P)})})})}getRoots(C){return this.checkTreeExistence(C),this.getAllNodes().filter(P=>!this.getParent(P.id,C))}getChildren(C,P){this.checkNodeExistence(C),this.checkTreeExistence(P);const D=this.treeIndices.get(P).childrenMap.get(C);return Array.from(D||[])}getParent(C,P){return this.checkNodeExistence(C),this.checkTreeExistence(P),this.treeIndices.get(P).parentMap.get(C)||null}getAncestors(C,P){const H=[];let D=this.getNode(C),X;for(;X=this.getParent(D.id,P);)H.push(X),D=X;return H}setParent(C,P,H){var we,ve;this.checkTreeExistence(H);const D=this.treeIndices.get(H);if(!D)return;const X=this.getNode(C),j=D.parentMap.get(C);if((j==null?void 0:j.id)===P)return;if(P==null){j&&((we=D.childrenMap.get(j.id))==null||we.delete(X)),D.parentMap.delete(C);return}const de=this.getNode(P);D.parentMap.set(C,de),j&&((ve=D.childrenMap.get(j.id))==null||ve.delete(X));let he=D.childrenMap.get(de.id);he||(he=new Set,D.childrenMap.set(de.id,he)),he.add(X),this.batch(()=>{this.changes.push({type:"TreeStructureChanged",treeKey:H,nodeId:C,oldParentId:j==null?void 0:j.id,newParentId:de.id})})}dfsTree(C,P,H){const D=X=>this.getChildren(X,H);return(0,V.I)(this.getNode(C),new Set,P,D)}bfsTree(C,P,H){const D=X=>this.getChildren(X,H);return(0,V.O)([this.getNode(C)],new Set,P,D)}getAllNodes(){return Array.from(this.nodeMap.values())}getAllEdges(){return Array.from(this.edgeMap.values())}bfs(C,P,H="out"){const D={in:this.getPredecessors.bind(this),out:this.getSuccessors.bind(this),both:this.getNeighbors.bind(this)}[H];return(0,V.O)([this.getNode(C)],new Set,P,D)}dfs(C,P,H="out"){const D={in:this.getPredecessors.bind(this),out:this.getSuccessors.bind(this),both:this.getNeighbors.bind(this)}[H];return(0,V.I)(this.getNode(C),new Set,P,D)}clone(){const C=this.getAllNodes().map(D=>fd(rl({},D),{data:rl({},D.data)})),P=this.getAllEdges().map(D=>fd(rl({},D),{data:rl({},D.data)})),H=new N({nodes:C,edges:P});return this.treeIndices.forEach(({parentMap:D,childrenMap:X},j)=>{const de=new Map;D.forEach((we,ve)=>{de.set(ve,H.getNode(we.id))});const he=new Map;X.forEach((we,ve)=>{he.set(ve,new Set(Array.from(we).map(Ee=>H.getNode(Ee.id))))}),H.treeIndices.set(j,{parentMap:de,childrenMap:he})}),H}toJSON(){return JSON.stringify({nodes:this.getAllNodes(),edges:this.getAllEdges()})}createView(C){return new Z.t(rl({graph:this},C))}}},54648:function(Be,Me,b){"use strict";b.d(Me,{t:function(){return V}});var m=b(7663);const Z=()=>!0;class V{constructor(E){_c(this,"graph");_c(this,"nodeFilter");_c(this,"edgeFilter");_c(this,"cacheEnabled");_c(this,"inEdgesMap",new Map);_c(this,"outEdgesMap",new Map);_c(this,"bothEdgesMap",new Map);_c(this,"allNodesMap",new Map);_c(this,"allEdgesMap",new Map);_c(this,"clearCache",()=>{this.inEdgesMap.clear(),this.outEdgesMap.clear(),this.bothEdgesMap.clear(),this.allNodesMap.clear(),this.allEdgesMap.clear()});_c(this,"refreshCache",()=>{this.clearCache(),this.updateCache(this.graph.getAllNodes().map(E=>E.id))});_c(this,"updateCache",E=>{const F=new Set;E.forEach(C=>{const P=this.bothEdgesMap.get(C);if(P&&P.forEach(H=>F.add(H.id)),!this.hasNode(C))this.inEdgesMap.delete(C),this.outEdgesMap.delete(C),this.bothEdgesMap.delete(C),this.allNodesMap.delete(C);else{const H=this.graph.getRelatedEdges(C,"in").filter(this.edgeFilter),D=this.graph.getRelatedEdges(C,"out").filter(this.edgeFilter),X=Array.from(new Set([...H,...D]));X.forEach(j=>F.add(j.id)),this.inEdgesMap.set(C,H),this.outEdgesMap.set(C,D),this.bothEdgesMap.set(C,X),this.allNodesMap.set(C,this.graph.getNode(C))}}),F.forEach(C=>{this.hasEdge(C)?this.allEdgesMap.set(C,this.graph.getEdge(C)):this.allEdgesMap.delete(C)})});_c(this,"handleGraphChanged",E=>{const F=new Set;E.changes.forEach(C=>{switch(C.type){case"NodeAdded":F.add(C.value.id);break;case"NodeDataUpdated":F.add(C.id);break;case"EdgeAdded":F.add(C.value.source),F.add(C.value.target);break;case"EdgeUpdated":(C.propertyName==="source"||C.propertyName==="target")&&(F.add(C.oldValue),F.add(C.newValue));break;case"EdgeDataUpdated":if(E.graph.hasEdge(C.id)){const P=E.graph.getEdge(C.id);F.add(P.source),F.add(P.target)}break;case"EdgeRemoved":F.add(C.value.source),F.add(C.value.target);break;case"NodeRemoved":F.add(C.value.id);break;default:break}}),this.updateCache(F)});this.graph=E.graph;const F=E.nodeFilter||Z,C=E.edgeFilter||Z;this.nodeFilter=F,this.edgeFilter=P=>{const{source:H,target:D}=this.graph.getEdgeDetail(P.id);return!F(H)||!F(D)?!1:C(P,H,D)},E.cache==="auto"?(this.cacheEnabled=!0,this.startAutoCache()):E.cache==="manual"?this.cacheEnabled=!0:this.cacheEnabled=!1}startAutoCache(){this.refreshCache(),this.graph.on("changed",this.handleGraphChanged)}stopAutoCache(){this.graph.off("changed",this.handleGraphChanged)}checkNodeExistence(E){this.getNode(E)}hasNode(E){if(!this.graph.hasNode(E))return!1;const F=this.graph.getNode(E);return this.nodeFilter(F)}areNeighbors(E,F){return this.checkNodeExistence(E),this.getNeighbors(F).some(C=>C.id===E)}getNode(E){const F=this.graph.getNode(E);if(!this.nodeFilter(F))throw new Error("Node not found for id: "+E);return F}getRelatedEdges(E,F){return this.checkNodeExistence(E),this.cacheEnabled?F==="in"?this.inEdgesMap.get(E):F==="out"?this.outEdgesMap.get(E):this.bothEdgesMap.get(E):this.graph.getRelatedEdges(E,F).filter(this.edgeFilter)}getDegree(E,F){return this.getRelatedEdges(E,F).length}getSuccessors(E){const C=this.getRelatedEdges(E,"out").map(P=>this.getNode(P.target));return Array.from(new Set(C))}getPredecessors(E){const C=this.getRelatedEdges(E,"in").map(P=>this.getNode(P.source));return Array.from(new Set(C))}getNeighbors(E){const F=this.getPredecessors(E),C=this.getSuccessors(E);return Array.from(new Set([...F,...C]))}hasEdge(E){if(!this.graph.hasEdge(E))return!1;const F=this.graph.getEdge(E);return this.edgeFilter(F)}getEdge(E){const F=this.graph.getEdge(E);if(!this.edgeFilter(F))throw new Error("Edge not found for id: "+E);return F}getEdgeDetail(E){const F=this.getEdge(E);return{edge:F,source:this.getNode(F.source),target:this.getNode(F.target)}}hasTreeStructure(E){return this.graph.hasTreeStructure(E)}getRoots(E){return this.graph.getRoots(E).filter(this.nodeFilter)}getChildren(E,F){return this.checkNodeExistence(E),this.graph.getChildren(E,F).filter(this.nodeFilter)}getParent(E,F){this.checkNodeExistence(E);const C=this.graph.getParent(E,F);return!C||!this.nodeFilter(C)?null:C}getAllNodes(){return this.cacheEnabled?Array.from(this.allNodesMap.values()):this.graph.getAllNodes().filter(this.nodeFilter)}getAllEdges(){return this.cacheEnabled?Array.from(this.allEdgesMap.values()):this.graph.getAllEdges().filter(this.edgeFilter)}bfs(E,F,C="out"){const P={in:this.getPredecessors.bind(this),out:this.getSuccessors.bind(this),both:this.getNeighbors.bind(this)}[C];(0,m.O)([this.getNode(E)],new Set,F,P)}dfs(E,F,C="out"){const P={in:this.getPredecessors.bind(this),out:this.getSuccessors.bind(this),both:this.getNeighbors.bind(this)}[C];(0,m.I)(this.getNode(E),new Set,F,P)}}},7663:function(Be,Me,b){"use strict";b.d(Me,{I:function(){return Z},O:function(){return m}});function m(V,N,E,F){for(;V.length;){const C=V.shift();if(E(C))return!0;N.add(C.id),F(C.id).forEach(H=>{N.has(H.id)||(N.add(H.id),V.push(H))})}return!1}function Z(V,N,E,F){if(E(V))return!0;N.add(V.id);for(const P of F(V.id))if(!N.has(P.id)&&Z(P,N,E,F))return!0;return!1}},85580:function(Be,Me,b){"use strict";b.d(Me,{L:function(){return m}});function m(Z){var V=document.createElement("div");V.innerHTML=Z;var N=V.childNodes[0];return N&&V.contains(N)&&V.removeChild(N),N}},70208:function(Be,Me){"use strict";var b=function(m,Z,V){return m<Z?Z:m>V?V:m};Me.Z=b},37547:function(Be,Me,b){"use strict";var m=b(39934),Z=function(V){if(typeof V!="object"||V===null)return V;var N;if((0,m.Z)(V)){N=[];for(var E=0,F=V.length;E<F;E++)typeof V[E]=="object"&&V[E]!=null?N[E]=Z(V[E]):N[E]=V[E]}else{N={};for(var C in V)typeof V[C]=="object"&&V[C]!=null?N[C]=Z(V[C]):N[C]=V[C]}return N};Me.Z=Z},78431:function(Be,Me){"use strict";function b(m,Z,V){var N;return function(){var E=this,F=arguments,C=function(){N=null,V||m.apply(E,F)},P=V&&!N;clearTimeout(N),N=setTimeout(C,Z),P&&m.apply(E,F)}}Me.Z=b},23343:function(Be,Me,b){"use strict";var m=b(39934),Z=b(63467),V=5;function N(C,P){if(Object.hasOwn)return Object.hasOwn(C,P);if(C==null)throw new TypeError("Cannot convert undefined or null to object");return Object.prototype.hasOwnProperty.call(Object(C),P)}function E(C,P,H,D){H=H||0,D=D||V;for(var X in P)if(N(P,X)){var j=P[X];j!==null&&(0,Z.Z)(j)?((0,Z.Z)(C[X])||(C[X]={}),H<D?E(C[X],j,H+1,D):C[X]=P[X]):(0,m.Z)(j)?(C[X]=[],C[X]=C[X].concat(j)):j!==void 0&&(C[X]=j)}}var F=function(C){for(var P=[],H=1;H<arguments.length;H++)P[H-1]=arguments[H];for(var D=0;D<P.length;D+=1)E(C,P[D]);return C};Me.Z=F},47182:function(Be,Me,b){"use strict";b.d(Me,{Z:function(){return C}});var m=b(68599),Z=function(P,H){if(!(0,m.Z)(P))return P;for(var D=[],X=0;X<P.length;X++){var j=P[X];H(j,X)&&D.push(j)}return D},V=Z,N=function(P,H){return(0,m.Z)(P)?P.indexOf(H)>-1:!1},E=N,F=function(P,H){return H===void 0&&(H=[]),V(P,function(D){return!E(H,D)})},C=F},56039:function(Be,Me,b){"use strict";var m=b(39934),Z=b(93785);function V(N,E){if(N){var F;if((0,m.Z)(N))for(var C=0,P=N.length;C<P&&(F=E(N[C],C),F!==!1);C++);else if((0,Z.Z)(N)){for(var H in N)if(N.hasOwnProperty(H)&&(F=E(N[H],H),F===!1))break}}}Me.Z=V},5759:function(Be,Me,b){"use strict";var m=b(71879);Me.Z=function(Z,V,N){for(var E=0,F=(0,m.Z)(V)?V.split("."):V;Z&&E<F.length;)Z=Z[F[E++]];return Z===void 0||E<F.length?N:Z}},15610:function(Be,Me,b){"use strict";var m=b(39934),Z=b(71018),V=Object.prototype.hasOwnProperty;function N(E,F){if(!F||!(0,m.Z)(E))return{};for(var C={},P=(0,Z.Z)(F)?F:function(j){return j[F]},H,D=0;D<E.length;D++){var X=E[D];H=P(X),V.call(C,H)?C[H].push(X):C[H]=[X]}return C}Me.Z=N},68599:function(Be,Me){"use strict";var b=function(m){return m!==null&&typeof m!="function"&&isFinite(m.length)};Me.Z=b},39934:function(Be,Me,b){"use strict";b.d(Me,{Z:function(){return m}});function m(Z){return Array.isArray(Z)}},50264:function(Be,Me,b){"use strict";var m=b(97868),Z=function(V){return(0,m.Z)(V,"Boolean")};Me.Z=Z},21790:function(Be,Me,b){"use strict";b.d(Me,{Z:function(){return m}});function m(Z){return Z instanceof Date}},42791:function(Be,Me,b){"use strict";b.d(Me,{Z:function(){return X}});var m=b(76075),Z=b(68599),V={}.toString,N=function(j){return V.call(j).replace(/^\[object /,"").replace(/]$/,"")},E=N,F=Object.prototype,C=function(j){var de=j&&j.constructor,he=typeof de=="function"&&de.prototype||F;return j===he},P=C,H=Object.prototype.hasOwnProperty;function D(j){if((0,m.Z)(j))return!0;if((0,Z.Z)(j))return!j.length;var de=E(j);if(de==="Map"||de==="Set")return!j.size;if(P(j))return!Object.keys(j).length;for(var he in j)if(H.call(j,he))return!1;return!0}var X=D},62099:function(Be,Me,b){"use strict";var m=b(60574),Z=b(68599),V=b(71879),N=function(E,F){if(E===F)return!0;if(!E||!F||(0,V.Z)(E)||(0,V.Z)(F))return!1;if((0,Z.Z)(E)||(0,Z.Z)(F)){if(E.length!==F.length)return!1;for(var C=!0,P=0;P<E.length&&(C=N(E[P],F[P]),!!C);P++);return C}if((0,m.Z)(E)||(0,m.Z)(F)){var H=Object.keys(E),D=Object.keys(F);if(H.length!==D.length)return!1;for(var C=!0,P=0;P<H.length&&(C=N(E[H[P]],F[H[P]]),!!C);P++);return C}return!1};Me.Z=N},71018:function(Be,Me,b){"use strict";b.d(Me,{Z:function(){return m}});function m(Z){return typeof Z=="function"}},76075:function(Be,Me,b){"use strict";b.d(Me,{Z:function(){return m}});function m(Z){return Z==null}},5131:function(Be,Me,b){"use strict";b.d(Me,{Z:function(){return Z}});var m=1e-5;function Z(V,N,E){return E===void 0&&(E=m),V===N||Math.abs(V-N)<E}},1933:function(Be,Me,b){"use strict";b.d(Me,{Z:function(){return m}});function m(Z){return typeof Z=="number"}},60574:function(Be,Me){"use strict";var b=function(m){return typeof m=="object"&&m!==null};Me.Z=b},93785:function(Be,Me){"use strict";Me.Z=function(b){var m=typeof b;return b!==null&&m==="object"||m==="function"}},63467:function(Be,Me,b){"use strict";var m=b(60574),Z=b(97868),V=function(N){if(!(0,m.Z)(N)||!(0,Z.Z)(N,"Object"))return!1;if(Object.getPrototypeOf(N)===null)return!0;for(var E=N;Object.getPrototypeOf(E)!==null;)E=Object.getPrototypeOf(E);return Object.getPrototypeOf(N)===E};Me.Z=V},71879:function(Be,Me,b){"use strict";b.d(Me,{Z:function(){return m}});function m(Z){return typeof Z=="string"}},97868:function(Be,Me){"use strict";var b={}.toString,m=function(Z,V){return b.call(Z)==="[object "+V+"]"};Me.Z=m},49527:function(Be,Me){"use strict";var b=function(m){return m===void 0};Me.Z=b},45642:function(Be,Me,b){"use strict";var m=b(96862),Z=function(V){var N=(0,m.Z)(V);return N.charAt(0).toLowerCase()+N.substring(1)};Me.Z=Z},82639:function(Be,Me,b){"use strict";b.d(Me,{Z:function(){return m}});function m(Z){if(!Array.isArray(Z))return-1/0;var V=Z.length;if(!V)return-1/0;for(var N=Z[0],E=1;E<V;E++)N=Math.max(N,Z[E]);return N}},40455:function(Be,Me,b){"use strict";b.d(Me,{Z:function(){return V}});function m(N){var E,F,C,P=N||1;function H(X,j){++E>P&&(C=F,D(1),++E),F[X]=j}function D(X){E=0,F=Object.create(null),X||(C=Object.create(null))}return D(),{clear:D,has:function(X){return F[X]!==void 0||C[X]!==void 0},get:function(X){var j=F[X];if(j!==void 0)return j;if((j=C[X])!==void 0)return H(X,j),j},set:function(X,j){F[X]!==void 0?F[X]=j:H(X,j)}}}var Z=new Map;function V(N,E,F){F===void 0&&(F=128);var C=function(){for(var P=[],H=0;H<arguments.length;H++)P[H]=arguments[H];var D=E?E.apply(this,P):P[0];Z.has(N)||Z.set(N,m(F));var X=Z.get(N);if(X.has(D))return X.get(D);var j=N.apply(this,P);return X.set(D,j),j};return C}},2078:function(Be,Me,b){"use strict";var m=b(39934);Me.Z=function(Z){if((0,m.Z)(Z))return Z.reduce(function(V,N){return Math.min(V,N)},Z[0])}},92387:function(Be,Me,b){"use strict";b.d(Me,{Z:function(){return F}});var m=b(56039),Z=b(39934),V=b(63467),N=function(C,P,H){if(!(0,Z.Z)(C)&&!(0,V.Z)(C))return C;var D=H;return(0,m.Z)(C,function(X,j){D=P(D,X,j)}),D},E=N,F=function(C,P){return E(C,function(H,D,X){return P.includes(X)||(H[X]=D),H},{})}},84502:function(Be,Me,b){"use strict";var m=b(56039),Z=b(63467),V=Object.prototype.hasOwnProperty;Me.Z=function(N,E){if(N===null||!(0,Z.Z)(N))return{};var F={};return(0,m.Z)(E,function(C){V.call(N,C)&&(F[C]=N[C])}),F}},37004:function(Be,Me,b){"use strict";var m=b(93785),Z=b(71879),V=b(1933);Me.Z=function(N,E,F){var C=N,P=(0,Z.Z)(E)?E.split("."):E;return P.forEach(function(H,D){D<P.length-1?((0,m.Z)(C[H])||(C[H]=(0,V.Z)(P[D+1])?[]:{}),C=C[H]):C[H]=F}),N}},62199:function(Be,Me){"use strict";Me.Z=function(b,m,Z){var V,N,E,F,C=0;Z||(Z={});var P=function(){C=Z.leading===!1?0:Date.now(),V=null,F=b.apply(N,E),V||(N=E=null)},H=function(){var D=Date.now();!C&&Z.leading===!1&&(C=D);var X=m-(D-C);return N=this,E=arguments,X<=0||X>m?(V&&(clearTimeout(V),V=null),C=D,F=b.apply(N,E),V||(N=E=null)):!V&&Z.trailing!==!1&&(V=setTimeout(P,X)),F};return H.cancel=function(){clearTimeout(V),C=0,V=N=E=null},H}},96862:function(Be,Me,b){"use strict";var m=b(76075);Me.Z=function(Z){return(0,m.Z)(Z)?"":Z.toString()}},35300:function(Be,Me,b){"use strict";b.d(Me,{Z:function(){return m}});function m(Z,V){V===void 0&&(V=new Map);var N=[];if(Array.isArray(Z))for(var E=0,F=Z.length;E<F;E++){var C=Z[E];V.has(C)||(N.push(C),V.set(C,!0))}return N}},63178:function(Be,Me){"use strict";var b={};Me.Z=function(m){return m=m||"g",b[m]?b[m]+=1:b[m]=1,m+b[m]}},18178:function(Be,Me,b){"use strict";var m=b(96862),Z=function(V){var N=(0,m.Z)(V);return N.charAt(0).toUpperCase()+N.substring(1)};Me.Z=Z},66045:function(Be,Me,b){"use strict";b.d(Me,{W:function(){return Z}});function m(V,N,E){var F=V*Math.cos(E)-N*Math.sin(E),C=V*Math.sin(E)+N*Math.cos(E);return{x:F,y:C}}function Z(V,N,E,F,C,P,H,D,X,j){var de=V,he=N,we=E,ve=F,Ee=D,$e=X,Fe=Math.PI*120/180,ct=Math.PI/180*(+C||0),vt=[],at,kt,It,Bn,Lt;if(j)kt=j[0],It=j[1],Bn=j[2],Lt=j[3];else{at=m(de,he,-ct),de=at.x,he=at.y,at=m(Ee,$e,-ct),Ee=at.x,$e=at.y;var Wn=(de-Ee)/2,Xn=(he-$e)/2,In=Wn*Wn/(we*we)+Xn*Xn/(ve*ve);In>1&&(In=Math.sqrt(In),we*=In,ve*=In);var zn=we*we,dr=ve*ve,vn=(P===H?-1:1)*Math.sqrt(Math.abs((zn*dr-zn*Xn*Xn-dr*Wn*Wn)/(zn*Xn*Xn+dr*Wn*Wn)));Bn=vn*we*Xn/ve+(de+Ee)/2,Lt=vn*-ve*Wn/we+(he+$e)/2,kt=Math.asin(((he-Lt)/ve*Math.pow(10,9)>>0)/Math.pow(10,9)),It=Math.asin((($e-Lt)/ve*Math.pow(10,9)>>0)/Math.pow(10,9)),kt=de<Bn?Math.PI-kt:kt,It=Ee<Bn?Math.PI-It:It,kt<0&&(kt=Math.PI*2+kt),It<0&&(It=Math.PI*2+It),H&&kt>It&&(kt-=Math.PI*2),!H&&It>kt&&(It-=Math.PI*2)}var _r=It-kt;if(Math.abs(_r)>Fe){var Ge=It,Tt=Ee,On=$e;It=kt+Fe*(H&&It>kt?1:-1),Ee=Bn+we*Math.cos(It),$e=Lt+ve*Math.sin(It),vt=Z(Ee,$e,we,ve,C,0,H,Tt,On,[It,Ge,Bn,Lt])}_r=It-kt;var Vr=Math.cos(kt),en=Math.sin(kt),ln=Math.cos(It),Cn=Math.sin(It),Mt=Math.tan(_r/4),Et=4/3*we*Mt,pe=4/3*ve*Mt,Ae=[de,he],Pe=[de+Et*en,he-pe*Vr],Ut=[Ee+Et*Cn,$e-pe*ln],jt=[Ee,$e];if(Pe[0]=2*Ae[0]-Pe[0],Pe[1]=2*Ae[1]-Pe[1],j)return Pe.concat(Ut,jt,vt);vt=Pe.concat(Ut,jt,vt);for(var ft=[],on=0,hn=vt.length;on<hn;on+=1)ft[on]=on%2?m(vt[on-1],vt[on],ct).y:m(vt[on],vt[on+1],ct).x;return ft}},68901:function(Be,Me,b){"use strict";b.d(Me,{y:function(){return m}});function m(Z,V){return Math.sqrt((Z[0]-V[0])*(Z[0]-V[0])+(Z[1]-V[1])*(Z[1]-V[1]))}},63648:function(Be,Me,b){"use strict";var m,Z=Object.defineProperty,V=Ie=>{throw TypeError(Ie)},N=Math.pow,E=(Ie,L,Q)=>L in Ie?Z(Ie,L,{enumerable:!0,configurable:!0,writable:!0,value:Q}):Ie[L]=Q,F=(Ie,L,Q)=>E(Ie,typeof L!="symbol"?L+"":L,Q),C=(Ie,L,Q)=>L.has(Ie)||V("Cannot "+Q),P=(Ie,L,Q)=>(C(Ie,L,"read from private field"),Q?Q.call(Ie):L.get(Ie)),H=(Ie,L,Q)=>L.has(Ie)?V("Cannot add the same private member more than once"):L instanceof WeakSet?L.add(Ie):L.set(Ie,Q),D=(Ie,L,Q,w)=>(C(Ie,L,"write to private field"),w?w.call(Ie,Q):L.set(Ie,Q),Q),X=(Ie,L,Q)=>(C(Ie,L,"access private method"),Q),j,de,he;m={value:!0};var we=b(34634),ve=b(34402);const Ee=" ".repeat(2),$e=" ".repeat(4);function Fe(){return ct(this)}function ct(Ie,L={}){const{maxRows:Q=15,maxColumns:w=10,maxNumSize:z=8,padMinus:ie="auto"}=L;return`${Ie.constructor.name} {
${Ee}[
${$e}${vt(Ie,Q,w,z,ie)}
${Ee}]
${Ee}rows: ${Ie.rows}
${Ee}columns: ${Ie.columns}
}`}function vt(Ie,L,Q,w,z){const{rows:ie,columns:ze}=Ie,Je=Math.min(ie,L),At=Math.min(ze,Q),xt=[];if(z==="auto"){z=!1;e:for(let Sn=0;Sn<Je;Sn++)for(let Oe=0;Oe<At;Oe++)if(Ie.get(Sn,Oe)<0){z=!0;break e}}for(let Sn=0;Sn<Je;Sn++){let Oe=[];for(let Qe=0;Qe<At;Qe++)Oe.push(at(Ie.get(Sn,Qe),w,z));xt.push(`${Oe.join(" ")}`)}return At!==ze&&(xt[xt.length-1]+=` ... ${ze-Q} more columns`),Je!==ie&&xt.push(`... ${ie-L} more rows`),xt.join(`
${$e}`)}function at(Ie,L,Q){return(Ie>=0&&Q?` ${kt(Ie,L-1)}`:kt(Ie,L)).padEnd(L)}function kt(Ie,L){let Q=Ie.toString();if(Q.length<=L)return Q;let w=Ie.toFixed(L);if(w.length>L&&(w=Ie.toFixed(Math.max(0,L-(w.length-L)))),w.length<=L&&!w.startsWith("0.000")&&!w.startsWith("-0.000"))return w;let z=Ie.toExponential(L);return z.length>L&&(z=Ie.toExponential(Math.max(0,L-(z.length-L)))),z.slice(0)}function It(Ie,L){Ie.prototype.add=function(w){return typeof w=="number"?this.addS(w):this.addM(w)},Ie.prototype.addS=function(w){for(let z=0;z<this.rows;z++)for(let ie=0;ie<this.columns;ie++)this.set(z,ie,this.get(z,ie)+w);return this},Ie.prototype.addM=function(w){if(w=L.checkMatrix(w),this.rows!==w.rows||this.columns!==w.columns)throw new RangeError("Matrices dimensions must be equal");for(let z=0;z<this.rows;z++)for(let ie=0;ie<this.columns;ie++)this.set(z,ie,this.get(z,ie)+w.get(z,ie));return this},Ie.add=function(w,z){return new L(w).add(z)},Ie.prototype.sub=function(w){return typeof w=="number"?this.subS(w):this.subM(w)},Ie.prototype.subS=function(w){for(let z=0;z<this.rows;z++)for(let ie=0;ie<this.columns;ie++)this.set(z,ie,this.get(z,ie)-w);return this},Ie.prototype.subM=function(w){if(w=L.checkMatrix(w),this.rows!==w.rows||this.columns!==w.columns)throw new RangeError("Matrices dimensions must be equal");for(let z=0;z<this.rows;z++)for(let ie=0;ie<this.columns;ie++)this.set(z,ie,this.get(z,ie)-w.get(z,ie));return this},Ie.sub=function(w,z){return new L(w).sub(z)},Ie.prototype.subtract=Ie.prototype.sub,Ie.prototype.subtractS=Ie.prototype.subS,Ie.prototype.subtractM=Ie.prototype.subM,Ie.subtract=Ie.sub,Ie.prototype.mul=function(w){return typeof w=="number"?this.mulS(w):this.mulM(w)},Ie.prototype.mulS=function(w){for(let z=0;z<this.rows;z++)for(let ie=0;ie<this.columns;ie++)this.set(z,ie,this.get(z,ie)*w);return this},Ie.prototype.mulM=function(w){if(w=L.checkMatrix(w),this.rows!==w.rows||this.columns!==w.columns)throw new RangeError("Matrices dimensions must be equal");for(let z=0;z<this.rows;z++)for(let ie=0;ie<this.columns;ie++)this.set(z,ie,this.get(z,ie)*w.get(z,ie));return this},Ie.mul=function(w,z){return new L(w).mul(z)},Ie.prototype.multiply=Ie.prototype.mul,Ie.prototype.multiplyS=Ie.prototype.mulS,Ie.prototype.multiplyM=Ie.prototype.mulM,Ie.multiply=Ie.mul,Ie.prototype.div=function(w){return typeof w=="number"?this.divS(w):this.divM(w)},Ie.prototype.divS=function(w){for(let z=0;z<this.rows;z++)for(let ie=0;ie<this.columns;ie++)this.set(z,ie,this.get(z,ie)/w);return this},Ie.prototype.divM=function(w){if(w=L.checkMatrix(w),this.rows!==w.rows||this.columns!==w.columns)throw new RangeError("Matrices dimensions must be equal");for(let z=0;z<this.rows;z++)for(let ie=0;ie<this.columns;ie++)this.set(z,ie,this.get(z,ie)/w.get(z,ie));return this},Ie.div=function(w,z){return new L(w).div(z)},Ie.prototype.divide=Ie.prototype.div,Ie.prototype.divideS=Ie.prototype.divS,Ie.prototype.divideM=Ie.prototype.divM,Ie.divide=Ie.div,Ie.prototype.mod=function(w){return typeof w=="number"?this.modS(w):this.modM(w)},Ie.prototype.modS=function(w){for(let z=0;z<this.rows;z++)for(let ie=0;ie<this.columns;ie++)this.set(z,ie,this.get(z,ie)%w);return this},Ie.prototype.modM=function(w){if(w=L.checkMatrix(w),this.rows!==w.rows||this.columns!==w.columns)throw new RangeError("Matrices dimensions must be equal");for(let z=0;z<this.rows;z++)for(let ie=0;ie<this.columns;ie++)this.set(z,ie,this.get(z,ie)%w.get(z,ie));return this},Ie.mod=function(w,z){return new L(w).mod(z)},Ie.prototype.modulus=Ie.prototype.mod,Ie.prototype.modulusS=Ie.prototype.modS,Ie.prototype.modulusM=Ie.prototype.modM,Ie.modulus=Ie.mod,Ie.prototype.and=function(w){return typeof w=="number"?this.andS(w):this.andM(w)},Ie.prototype.andS=function(w){for(let z=0;z<this.rows;z++)for(let ie=0;ie<this.columns;ie++)this.set(z,ie,this.get(z,ie)&w);return this},Ie.prototype.andM=function(w){if(w=L.checkMatrix(w),this.rows!==w.rows||this.columns!==w.columns)throw new RangeError("Matrices dimensions must be equal");for(let z=0;z<this.rows;z++)for(let ie=0;ie<this.columns;ie++)this.set(z,ie,this.get(z,ie)&w.get(z,ie));return this},Ie.and=function(w,z){return new L(w).and(z)},Ie.prototype.or=function(w){return typeof w=="number"?this.orS(w):this.orM(w)},Ie.prototype.orS=function(w){for(let z=0;z<this.rows;z++)for(let ie=0;ie<this.columns;ie++)this.set(z,ie,this.get(z,ie)|w);return this},Ie.prototype.orM=function(w){if(w=L.checkMatrix(w),this.rows!==w.rows||this.columns!==w.columns)throw new RangeError("Matrices dimensions must be equal");for(let z=0;z<this.rows;z++)for(let ie=0;ie<this.columns;ie++)this.set(z,ie,this.get(z,ie)|w.get(z,ie));return this},Ie.or=function(w,z){return new L(w).or(z)},Ie.prototype.xor=function(w){return typeof w=="number"?this.xorS(w):this.xorM(w)},Ie.prototype.xorS=function(w){for(let z=0;z<this.rows;z++)for(let ie=0;ie<this.columns;ie++)this.set(z,ie,this.get(z,ie)^w);return this},Ie.prototype.xorM=function(w){if(w=L.checkMatrix(w),this.rows!==w.rows||this.columns!==w.columns)throw new RangeError("Matrices dimensions must be equal");for(let z=0;z<this.rows;z++)for(let ie=0;ie<this.columns;ie++)this.set(z,ie,this.get(z,ie)^w.get(z,ie));return this},Ie.xor=function(w,z){return new L(w).xor(z)},Ie.prototype.leftShift=function(w){return typeof w=="number"?this.leftShiftS(w):this.leftShiftM(w)},Ie.prototype.leftShiftS=function(w){for(let z=0;z<this.rows;z++)for(let ie=0;ie<this.columns;ie++)this.set(z,ie,this.get(z,ie)<<w);return this},Ie.prototype.leftShiftM=function(w){if(w=L.checkMatrix(w),this.rows!==w.rows||this.columns!==w.columns)throw new RangeError("Matrices dimensions must be equal");for(let z=0;z<this.rows;z++)for(let ie=0;ie<this.columns;ie++)this.set(z,ie,this.get(z,ie)<<w.get(z,ie));return this},Ie.leftShift=function(w,z){return new L(w).leftShift(z)},Ie.prototype.signPropagatingRightShift=function(w){return typeof w=="number"?this.signPropagatingRightShiftS(w):this.signPropagatingRightShiftM(w)},Ie.prototype.signPropagatingRightShiftS=function(w){for(let z=0;z<this.rows;z++)for(let ie=0;ie<this.columns;ie++)this.set(z,ie,this.get(z,ie)>>w);return this},Ie.prototype.signPropagatingRightShiftM=function(w){if(w=L.checkMatrix(w),this.rows!==w.rows||this.columns!==w.columns)throw new RangeError("Matrices dimensions must be equal");for(let z=0;z<this.rows;z++)for(let ie=0;ie<this.columns;ie++)this.set(z,ie,this.get(z,ie)>>w.get(z,ie));return this},Ie.signPropagatingRightShift=function(w,z){return new L(w).signPropagatingRightShift(z)},Ie.prototype.rightShift=function(w){return typeof w=="number"?this.rightShiftS(w):this.rightShiftM(w)},Ie.prototype.rightShiftS=function(w){for(let z=0;z<this.rows;z++)for(let ie=0;ie<this.columns;ie++)this.set(z,ie,this.get(z,ie)>>>w);return this},Ie.prototype.rightShiftM=function(w){if(w=L.checkMatrix(w),this.rows!==w.rows||this.columns!==w.columns)throw new RangeError("Matrices dimensions must be equal");for(let z=0;z<this.rows;z++)for(let ie=0;ie<this.columns;ie++)this.set(z,ie,this.get(z,ie)>>>w.get(z,ie));return this},Ie.rightShift=function(w,z){return new L(w).rightShift(z)},Ie.prototype.zeroFillRightShift=Ie.prototype.rightShift,Ie.prototype.zeroFillRightShiftS=Ie.prototype.rightShiftS,Ie.prototype.zeroFillRightShiftM=Ie.prototype.rightShiftM,Ie.zeroFillRightShift=Ie.rightShift,Ie.prototype.not=function(){for(let w=0;w<this.rows;w++)for(let z=0;z<this.columns;z++)this.set(w,z,~this.get(w,z));return this},Ie.not=function(w){return new L(w).not()},Ie.prototype.abs=function(){for(let w=0;w<this.rows;w++)for(let z=0;z<this.columns;z++)this.set(w,z,Math.abs(this.get(w,z)));return this},Ie.abs=function(w){return new L(w).abs()},Ie.prototype.acos=function(){for(let w=0;w<this.rows;w++)for(let z=0;z<this.columns;z++)this.set(w,z,Math.acos(this.get(w,z)));return this},Ie.acos=function(w){return new L(w).acos()},Ie.prototype.acosh=function(){for(let w=0;w<this.rows;w++)for(let z=0;z<this.columns;z++)this.set(w,z,Math.acosh(this.get(w,z)));return this},Ie.acosh=function(w){return new L(w).acosh()},Ie.prototype.asin=function(){for(let w=0;w<this.rows;w++)for(let z=0;z<this.columns;z++)this.set(w,z,Math.asin(this.get(w,z)));return this},Ie.asin=function(w){return new L(w).asin()},Ie.prototype.asinh=function(){for(let w=0;w<this.rows;w++)for(let z=0;z<this.columns;z++)this.set(w,z,Math.asinh(this.get(w,z)));return this},Ie.asinh=function(w){return new L(w).asinh()},Ie.prototype.atan=function(){for(let w=0;w<this.rows;w++)for(let z=0;z<this.columns;z++)this.set(w,z,Math.atan(this.get(w,z)));return this},Ie.atan=function(w){return new L(w).atan()},Ie.prototype.atanh=function(){for(let w=0;w<this.rows;w++)for(let z=0;z<this.columns;z++)this.set(w,z,Math.atanh(this.get(w,z)));return this},Ie.atanh=function(w){return new L(w).atanh()},Ie.prototype.cbrt=function(){for(let w=0;w<this.rows;w++)for(let z=0;z<this.columns;z++)this.set(w,z,Math.cbrt(this.get(w,z)));return this},Ie.cbrt=function(w){return new L(w).cbrt()},Ie.prototype.ceil=function(){for(let w=0;w<this.rows;w++)for(let z=0;z<this.columns;z++)this.set(w,z,Math.ceil(this.get(w,z)));return this},Ie.ceil=function(w){return new L(w).ceil()},Ie.prototype.clz32=function(){for(let w=0;w<this.rows;w++)for(let z=0;z<this.columns;z++)this.set(w,z,Math.clz32(this.get(w,z)));return this},Ie.clz32=function(w){return new L(w).clz32()},Ie.prototype.cos=function(){for(let w=0;w<this.rows;w++)for(let z=0;z<this.columns;z++)this.set(w,z,Math.cos(this.get(w,z)));return this},Ie.cos=function(w){return new L(w).cos()},Ie.prototype.cosh=function(){for(let w=0;w<this.rows;w++)for(let z=0;z<this.columns;z++)this.set(w,z,Math.cosh(this.get(w,z)));return this},Ie.cosh=function(w){return new L(w).cosh()},Ie.prototype.exp=function(){for(let w=0;w<this.rows;w++)for(let z=0;z<this.columns;z++)this.set(w,z,Math.exp(this.get(w,z)));return this},Ie.exp=function(w){return new L(w).exp()},Ie.prototype.expm1=function(){for(let w=0;w<this.rows;w++)for(let z=0;z<this.columns;z++)this.set(w,z,Math.expm1(this.get(w,z)));return this},Ie.expm1=function(w){return new L(w).expm1()},Ie.prototype.floor=function(){for(let w=0;w<this.rows;w++)for(let z=0;z<this.columns;z++)this.set(w,z,Math.floor(this.get(w,z)));return this},Ie.floor=function(w){return new L(w).floor()},Ie.prototype.fround=function(){for(let w=0;w<this.rows;w++)for(let z=0;z<this.columns;z++)this.set(w,z,Math.fround(this.get(w,z)));return this},Ie.fround=function(w){return new L(w).fround()},Ie.prototype.log=function(){for(let w=0;w<this.rows;w++)for(let z=0;z<this.columns;z++)this.set(w,z,Math.log(this.get(w,z)));return this},Ie.log=function(w){return new L(w).log()},Ie.prototype.log1p=function(){for(let w=0;w<this.rows;w++)for(let z=0;z<this.columns;z++)this.set(w,z,Math.log1p(this.get(w,z)));return this},Ie.log1p=function(w){return new L(w).log1p()},Ie.prototype.log10=function(){for(let w=0;w<this.rows;w++)for(let z=0;z<this.columns;z++)this.set(w,z,Math.log10(this.get(w,z)));return this},Ie.log10=function(w){return new L(w).log10()},Ie.prototype.log2=function(){for(let w=0;w<this.rows;w++)for(let z=0;z<this.columns;z++)this.set(w,z,Math.log2(this.get(w,z)));return this},Ie.log2=function(w){return new L(w).log2()},Ie.prototype.round=function(){for(let w=0;w<this.rows;w++)for(let z=0;z<this.columns;z++)this.set(w,z,Math.round(this.get(w,z)));return this},Ie.round=function(w){return new L(w).round()},Ie.prototype.sign=function(){for(let w=0;w<this.rows;w++)for(let z=0;z<this.columns;z++)this.set(w,z,Math.sign(this.get(w,z)));return this},Ie.sign=function(w){return new L(w).sign()},Ie.prototype.sin=function(){for(let w=0;w<this.rows;w++)for(let z=0;z<this.columns;z++)this.set(w,z,Math.sin(this.get(w,z)));return this},Ie.sin=function(w){return new L(w).sin()},Ie.prototype.sinh=function(){for(let w=0;w<this.rows;w++)for(let z=0;z<this.columns;z++)this.set(w,z,Math.sinh(this.get(w,z)));return this},Ie.sinh=function(w){return new L(w).sinh()},Ie.prototype.sqrt=function(){for(let w=0;w<this.rows;w++)for(let z=0;z<this.columns;z++)this.set(w,z,Math.sqrt(this.get(w,z)));return this},Ie.sqrt=function(w){return new L(w).sqrt()},Ie.prototype.tan=function(){for(let w=0;w<this.rows;w++)for(let z=0;z<this.columns;z++)this.set(w,z,Math.tan(this.get(w,z)));return this},Ie.tan=function(w){return new L(w).tan()},Ie.prototype.tanh=function(){for(let w=0;w<this.rows;w++)for(let z=0;z<this.columns;z++)this.set(w,z,Math.tanh(this.get(w,z)));return this},Ie.tanh=function(w){return new L(w).tanh()},Ie.prototype.trunc=function(){for(let w=0;w<this.rows;w++)for(let z=0;z<this.columns;z++)this.set(w,z,Math.trunc(this.get(w,z)));return this},Ie.trunc=function(w){return new L(w).trunc()},Ie.pow=function(w,z){return new L(w).pow(z)},Ie.prototype.pow=function(w){return typeof w=="number"?this.powS(w):this.powM(w)},Ie.prototype.powS=function(w){for(let z=0;z<this.rows;z++)for(let ie=0;ie<this.columns;ie++)this.set(z,ie,N(this.get(z,ie),w));return this},Ie.prototype.powM=function(w){if(w=L.checkMatrix(w),this.rows!==w.rows||this.columns!==w.columns)throw new RangeError("Matrices dimensions must be equal");for(let z=0;z<this.rows;z++)for(let ie=0;ie<this.columns;ie++)this.set(z,ie,N(this.get(z,ie),w.get(z,ie)));return this}}function Bn(Ie,L,Q){let w=Q?Ie.rows:Ie.rows-1;if(L<0||L>w)throw new RangeError("Row index out of range")}function Lt(Ie,L,Q){let w=Q?Ie.columns:Ie.columns-1;if(L<0||L>w)throw new RangeError("Column index out of range")}function Wn(Ie,L){if(L.to1DArray&&(L=L.to1DArray()),L.length!==Ie.columns)throw new RangeError("vector size must be the same as the number of columns");return L}function Xn(Ie,L){if(L.to1DArray&&(L=L.to1DArray()),L.length!==Ie.rows)throw new RangeError("vector size must be the same as the number of rows");return L}function In(Ie,L){if(!we.isAnyArray(L))throw new TypeError("row indices must be an array");for(let Q=0;Q<L.length;Q++)if(L[Q]<0||L[Q]>=Ie.rows)throw new RangeError("row indices are out of range")}function zn(Ie,L){if(!we.isAnyArray(L))throw new TypeError("column indices must be an array");for(let Q=0;Q<L.length;Q++)if(L[Q]<0||L[Q]>=Ie.columns)throw new RangeError("column indices are out of range")}function dr(Ie,L,Q,w,z){if(arguments.length!==5)throw new RangeError("expected 4 arguments");if(_r("startRow",L),_r("endRow",Q),_r("startColumn",w),_r("endColumn",z),L>Q||w>z||L<0||L>=Ie.rows||Q<0||Q>=Ie.rows||w<0||w>=Ie.columns||z<0||z>=Ie.columns)throw new RangeError("Submatrix indices are out of range")}function vn(Ie,L=0){let Q=[];for(let w=0;w<Ie;w++)Q.push(L);return Q}function _r(Ie,L){if(typeof L!="number")throw new TypeError(`${Ie} must be a number`)}function Ge(Ie){if(Ie.isEmpty())throw new Error("Empty matrix has no elements to index")}function Tt(Ie){let L=vn(Ie.rows);for(let Q=0;Q<Ie.rows;++Q)for(let w=0;w<Ie.columns;++w)L[Q]+=Ie.get(Q,w);return L}function On(Ie){let L=vn(Ie.columns);for(let Q=0;Q<Ie.rows;++Q)for(let w=0;w<Ie.columns;++w)L[w]+=Ie.get(Q,w);return L}function Vr(Ie){let L=0;for(let Q=0;Q<Ie.rows;Q++)for(let w=0;w<Ie.columns;w++)L+=Ie.get(Q,w);return L}function en(Ie){let L=vn(Ie.rows,1);for(let Q=0;Q<Ie.rows;++Q)for(let w=0;w<Ie.columns;++w)L[Q]*=Ie.get(Q,w);return L}function ln(Ie){let L=vn(Ie.columns,1);for(let Q=0;Q<Ie.rows;++Q)for(let w=0;w<Ie.columns;++w)L[w]*=Ie.get(Q,w);return L}function Cn(Ie){let L=1;for(let Q=0;Q<Ie.rows;Q++)for(let w=0;w<Ie.columns;w++)L*=Ie.get(Q,w);return L}function Mt(Ie,L,Q){const w=Ie.rows,z=Ie.columns,ie=[];for(let ze=0;ze<w;ze++){let Je=0,At=0,xt=0;for(let Sn=0;Sn<z;Sn++)xt=Ie.get(ze,Sn)-Q[ze],Je+=xt,At+=xt*xt;L?ie.push((At-Je*Je/z)/(z-1)):ie.push((At-Je*Je/z)/z)}return ie}function Et(Ie,L,Q){const w=Ie.rows,z=Ie.columns,ie=[];for(let ze=0;ze<z;ze++){let Je=0,At=0,xt=0;for(let Sn=0;Sn<w;Sn++)xt=Ie.get(Sn,ze)-Q[ze],Je+=xt,At+=xt*xt;L?ie.push((At-Je*Je/w)/(w-1)):ie.push((At-Je*Je/w)/w)}return ie}function pe(Ie,L,Q){const w=Ie.rows,z=Ie.columns,ie=w*z;let ze=0,Je=0,At=0;for(let xt=0;xt<w;xt++)for(let Sn=0;Sn<z;Sn++)At=Ie.get(xt,Sn)-Q,ze+=At,Je+=At*At;return L?(Je-ze*ze/ie)/(ie-1):(Je-ze*ze/ie)/ie}function Ae(Ie,L){for(let Q=0;Q<Ie.rows;Q++)for(let w=0;w<Ie.columns;w++)Ie.set(Q,w,Ie.get(Q,w)-L[Q])}function Pe(Ie,L){for(let Q=0;Q<Ie.rows;Q++)for(let w=0;w<Ie.columns;w++)Ie.set(Q,w,Ie.get(Q,w)-L[w])}function Ut(Ie,L){for(let Q=0;Q<Ie.rows;Q++)for(let w=0;w<Ie.columns;w++)Ie.set(Q,w,Ie.get(Q,w)-L)}function jt(Ie){const L=[];for(let Q=0;Q<Ie.rows;Q++){let w=0;for(let z=0;z<Ie.columns;z++)w+=N(Ie.get(Q,z),2)/(Ie.columns-1);L.push(Math.sqrt(w))}return L}function ft(Ie,L){for(let Q=0;Q<Ie.rows;Q++)for(let w=0;w<Ie.columns;w++)Ie.set(Q,w,Ie.get(Q,w)/L[Q])}function on(Ie){const L=[];for(let Q=0;Q<Ie.columns;Q++){let w=0;for(let z=0;z<Ie.rows;z++)w+=N(Ie.get(z,Q),2)/(Ie.rows-1);L.push(Math.sqrt(w))}return L}function hn(Ie,L){for(let Q=0;Q<Ie.rows;Q++)for(let w=0;w<Ie.columns;w++)Ie.set(Q,w,Ie.get(Q,w)/L[w])}function lt(Ie){const L=Ie.size-1;let Q=0;for(let w=0;w<Ie.columns;w++)for(let z=0;z<Ie.rows;z++)Q+=N(Ie.get(z,w),2)/L;return Math.sqrt(Q)}function Ct(Ie,L){for(let Q=0;Q<Ie.rows;Q++)for(let w=0;w<Ie.columns;w++)Ie.set(Q,w,Ie.get(Q,w)/L)}class sn{static from1DArray(L,Q,w){if(L*Q!==w.length)throw new RangeError("data length does not match given dimensions");let ie=new zt(L,Q);for(let ze=0;ze<L;ze++)for(let Je=0;Je<Q;Je++)ie.set(ze,Je,w[ze*Q+Je]);return ie}static rowVector(L){let Q=new zt(1,L.length);for(let w=0;w<L.length;w++)Q.set(0,w,L[w]);return Q}static columnVector(L){let Q=new zt(L.length,1);for(let w=0;w<L.length;w++)Q.set(w,0,L[w]);return Q}static zeros(L,Q){return new zt(L,Q)}static ones(L,Q){return new zt(L,Q).fill(1)}static rand(L,Q,w={}){if(typeof w!="object")throw new TypeError("options must be an object");const{random:z=Math.random}=w;let ie=new zt(L,Q);for(let ze=0;ze<L;ze++)for(let Je=0;Je<Q;Je++)ie.set(ze,Je,z());return ie}static randInt(L,Q,w={}){if(typeof w!="object")throw new TypeError("options must be an object");const{min:z=0,max:ie=1e3,random:ze=Math.random}=w;if(!Number.isInteger(z))throw new TypeError("min must be an integer");if(!Number.isInteger(ie))throw new TypeError("max must be an integer");if(z>=ie)throw new RangeError("min must be smaller than max");let Je=ie-z,At=new zt(L,Q);for(let xt=0;xt<L;xt++)for(let Sn=0;Sn<Q;Sn++){let Oe=z+Math.round(ze()*Je);At.set(xt,Sn,Oe)}return At}static eye(L,Q,w){Q===void 0&&(Q=L),w===void 0&&(w=1);let z=Math.min(L,Q),ie=this.zeros(L,Q);for(let ze=0;ze<z;ze++)ie.set(ze,ze,w);return ie}static diag(L,Q,w){let z=L.length;Q===void 0&&(Q=z),w===void 0&&(w=Q);let ie=Math.min(z,Q,w),ze=this.zeros(Q,w);for(let Je=0;Je<ie;Je++)ze.set(Je,Je,L[Je]);return ze}static min(L,Q){L=this.checkMatrix(L),Q=this.checkMatrix(Q);let w=L.rows,z=L.columns,ie=new zt(w,z);for(let ze=0;ze<w;ze++)for(let Je=0;Je<z;Je++)ie.set(ze,Je,Math.min(L.get(ze,Je),Q.get(ze,Je)));return ie}static max(L,Q){L=this.checkMatrix(L),Q=this.checkMatrix(Q);let w=L.rows,z=L.columns,ie=new this(w,z);for(let ze=0;ze<w;ze++)for(let Je=0;Je<z;Je++)ie.set(ze,Je,Math.max(L.get(ze,Je),Q.get(ze,Je)));return ie}static checkMatrix(L){return sn.isMatrix(L)?L:new zt(L)}static isMatrix(L){return L!=null&&L.klass==="Matrix"}get size(){return this.rows*this.columns}apply(L){if(typeof L!="function")throw new TypeError("callback must be a function");for(let Q=0;Q<this.rows;Q++)for(let w=0;w<this.columns;w++)L.call(this,Q,w);return this}to1DArray(){let L=[];for(let Q=0;Q<this.rows;Q++)for(let w=0;w<this.columns;w++)L.push(this.get(Q,w));return L}to2DArray(){let L=[];for(let Q=0;Q<this.rows;Q++){L.push([]);for(let w=0;w<this.columns;w++)L[Q].push(this.get(Q,w))}return L}toJSON(){return this.to2DArray()}isRowVector(){return this.rows===1}isColumnVector(){return this.columns===1}isVector(){return this.rows===1||this.columns===1}isSquare(){return this.rows===this.columns}isEmpty(){return this.rows===0||this.columns===0}isSymmetric(){if(this.isSquare()){for(let L=0;L<this.rows;L++)for(let Q=0;Q<=L;Q++)if(this.get(L,Q)!==this.get(Q,L))return!1;return!0}return!1}isDistance(){if(!this.isSymmetric())return!1;for(let L=0;L<this.rows;L++)if(this.get(L,L)!==0)return!1;return!0}isEchelonForm(){let L=0,Q=0,w=-1,z=!0,ie=!1;for(;L<this.rows&&z;){for(Q=0,ie=!1;Q<this.columns&&ie===!1;)this.get(L,Q)===0?Q++:this.get(L,Q)===1&&Q>w?(ie=!0,w=Q):(z=!1,ie=!0);L++}return z}isReducedEchelonForm(){let L=0,Q=0,w=-1,z=!0,ie=!1;for(;L<this.rows&&z;){for(Q=0,ie=!1;Q<this.columns&&ie===!1;)this.get(L,Q)===0?Q++:this.get(L,Q)===1&&Q>w?(ie=!0,w=Q):(z=!1,ie=!0);for(let ze=Q+1;ze<this.rows;ze++)this.get(L,ze)!==0&&(z=!1);L++}return z}echelonForm(){let L=this.clone(),Q=0,w=0;for(;Q<L.rows&&w<L.columns;){let z=Q;for(let ie=Q;ie<L.rows;ie++)L.get(ie,w)>L.get(z,w)&&(z=ie);if(L.get(z,w)===0)w++;else{L.swapRows(Q,z);let ie=L.get(Q,w);for(let ze=w;ze<L.columns;ze++)L.set(Q,ze,L.get(Q,ze)/ie);for(let ze=Q+1;ze<L.rows;ze++){let Je=L.get(ze,w)/L.get(Q,w);L.set(ze,w,0);for(let At=w+1;At<L.columns;At++)L.set(ze,At,L.get(ze,At)-L.get(Q,At)*Je)}Q++,w++}}return L}reducedEchelonForm(){let L=this.echelonForm(),Q=L.columns,w=L.rows,z=w-1;for(;z>=0;)if(L.maxRow(z)===0)z--;else{let ie=0,ze=!1;for(;ie<w&&ze===!1;)L.get(z,ie)===1?ze=!0:ie++;for(let Je=0;Je<z;Je++){let At=L.get(Je,ie);for(let xt=ie;xt<Q;xt++){let Sn=L.get(Je,xt)-At*L.get(z,xt);L.set(Je,xt,Sn)}}z--}return L}set(){throw new Error("set method is unimplemented")}get(){throw new Error("get method is unimplemented")}repeat(L={}){if(typeof L!="object")throw new TypeError("options must be an object");const{rows:Q=1,columns:w=1}=L;if(!Number.isInteger(Q)||Q<=0)throw new TypeError("rows must be a positive integer");if(!Number.isInteger(w)||w<=0)throw new TypeError("columns must be a positive integer");let z=new zt(this.rows*Q,this.columns*w);for(let ie=0;ie<Q;ie++)for(let ze=0;ze<w;ze++)z.setSubMatrix(this,this.rows*ie,this.columns*ze);return z}fill(L){for(let Q=0;Q<this.rows;Q++)for(let w=0;w<this.columns;w++)this.set(Q,w,L);return this}neg(){return this.mulS(-1)}getRow(L){Bn(this,L);let Q=[];for(let w=0;w<this.columns;w++)Q.push(this.get(L,w));return Q}getRowVector(L){return zt.rowVector(this.getRow(L))}setRow(L,Q){Bn(this,L),Q=Wn(this,Q);for(let w=0;w<this.columns;w++)this.set(L,w,Q[w]);return this}swapRows(L,Q){Bn(this,L),Bn(this,Q);for(let w=0;w<this.columns;w++){let z=this.get(L,w);this.set(L,w,this.get(Q,w)),this.set(Q,w,z)}return this}getColumn(L){Lt(this,L);let Q=[];for(let w=0;w<this.rows;w++)Q.push(this.get(w,L));return Q}getColumnVector(L){return zt.columnVector(this.getColumn(L))}setColumn(L,Q){Lt(this,L),Q=Xn(this,Q);for(let w=0;w<this.rows;w++)this.set(w,L,Q[w]);return this}swapColumns(L,Q){Lt(this,L),Lt(this,Q);for(let w=0;w<this.rows;w++){let z=this.get(w,L);this.set(w,L,this.get(w,Q)),this.set(w,Q,z)}return this}addRowVector(L){L=Wn(this,L);for(let Q=0;Q<this.rows;Q++)for(let w=0;w<this.columns;w++)this.set(Q,w,this.get(Q,w)+L[w]);return this}subRowVector(L){L=Wn(this,L);for(let Q=0;Q<this.rows;Q++)for(let w=0;w<this.columns;w++)this.set(Q,w,this.get(Q,w)-L[w]);return this}mulRowVector(L){L=Wn(this,L);for(let Q=0;Q<this.rows;Q++)for(let w=0;w<this.columns;w++)this.set(Q,w,this.get(Q,w)*L[w]);return this}divRowVector(L){L=Wn(this,L);for(let Q=0;Q<this.rows;Q++)for(let w=0;w<this.columns;w++)this.set(Q,w,this.get(Q,w)/L[w]);return this}addColumnVector(L){L=Xn(this,L);for(let Q=0;Q<this.rows;Q++)for(let w=0;w<this.columns;w++)this.set(Q,w,this.get(Q,w)+L[Q]);return this}subColumnVector(L){L=Xn(this,L);for(let Q=0;Q<this.rows;Q++)for(let w=0;w<this.columns;w++)this.set(Q,w,this.get(Q,w)-L[Q]);return this}mulColumnVector(L){L=Xn(this,L);for(let Q=0;Q<this.rows;Q++)for(let w=0;w<this.columns;w++)this.set(Q,w,this.get(Q,w)*L[Q]);return this}divColumnVector(L){L=Xn(this,L);for(let Q=0;Q<this.rows;Q++)for(let w=0;w<this.columns;w++)this.set(Q,w,this.get(Q,w)/L[Q]);return this}mulRow(L,Q){Bn(this,L);for(let w=0;w<this.columns;w++)this.set(L,w,this.get(L,w)*Q);return this}mulColumn(L,Q){Lt(this,L);for(let w=0;w<this.rows;w++)this.set(w,L,this.get(w,L)*Q);return this}max(L){if(this.isEmpty())return NaN;switch(L){case"row":{const Q=new Array(this.rows).fill(Number.NEGATIVE_INFINITY);for(let w=0;w<this.rows;w++)for(let z=0;z<this.columns;z++)this.get(w,z)>Q[w]&&(Q[w]=this.get(w,z));return Q}case"column":{const Q=new Array(this.columns).fill(Number.NEGATIVE_INFINITY);for(let w=0;w<this.rows;w++)for(let z=0;z<this.columns;z++)this.get(w,z)>Q[z]&&(Q[z]=this.get(w,z));return Q}case void 0:{let Q=this.get(0,0);for(let w=0;w<this.rows;w++)for(let z=0;z<this.columns;z++)this.get(w,z)>Q&&(Q=this.get(w,z));return Q}default:throw new Error(`invalid option: ${L}`)}}maxIndex(){Ge(this);let L=this.get(0,0),Q=[0,0];for(let w=0;w<this.rows;w++)for(let z=0;z<this.columns;z++)this.get(w,z)>L&&(L=this.get(w,z),Q[0]=w,Q[1]=z);return Q}min(L){if(this.isEmpty())return NaN;switch(L){case"row":{const Q=new Array(this.rows).fill(Number.POSITIVE_INFINITY);for(let w=0;w<this.rows;w++)for(let z=0;z<this.columns;z++)this.get(w,z)<Q[w]&&(Q[w]=this.get(w,z));return Q}case"column":{const Q=new Array(this.columns).fill(Number.POSITIVE_INFINITY);for(let w=0;w<this.rows;w++)for(let z=0;z<this.columns;z++)this.get(w,z)<Q[z]&&(Q[z]=this.get(w,z));return Q}case void 0:{let Q=this.get(0,0);for(let w=0;w<this.rows;w++)for(let z=0;z<this.columns;z++)this.get(w,z)<Q&&(Q=this.get(w,z));return Q}default:throw new Error(`invalid option: ${L}`)}}minIndex(){Ge(this);let L=this.get(0,0),Q=[0,0];for(let w=0;w<this.rows;w++)for(let z=0;z<this.columns;z++)this.get(w,z)<L&&(L=this.get(w,z),Q[0]=w,Q[1]=z);return Q}maxRow(L){if(Bn(this,L),this.isEmpty())return NaN;let Q=this.get(L,0);for(let w=1;w<this.columns;w++)this.get(L,w)>Q&&(Q=this.get(L,w));return Q}maxRowIndex(L){Bn(this,L),Ge(this);let Q=this.get(L,0),w=[L,0];for(let z=1;z<this.columns;z++)this.get(L,z)>Q&&(Q=this.get(L,z),w[1]=z);return w}minRow(L){if(Bn(this,L),this.isEmpty())return NaN;let Q=this.get(L,0);for(let w=1;w<this.columns;w++)this.get(L,w)<Q&&(Q=this.get(L,w));return Q}minRowIndex(L){Bn(this,L),Ge(this);let Q=this.get(L,0),w=[L,0];for(let z=1;z<this.columns;z++)this.get(L,z)<Q&&(Q=this.get(L,z),w[1]=z);return w}maxColumn(L){if(Lt(this,L),this.isEmpty())return NaN;let Q=this.get(0,L);for(let w=1;w<this.rows;w++)this.get(w,L)>Q&&(Q=this.get(w,L));return Q}maxColumnIndex(L){Lt(this,L),Ge(this);let Q=this.get(0,L),w=[0,L];for(let z=1;z<this.rows;z++)this.get(z,L)>Q&&(Q=this.get(z,L),w[0]=z);return w}minColumn(L){if(Lt(this,L),this.isEmpty())return NaN;let Q=this.get(0,L);for(let w=1;w<this.rows;w++)this.get(w,L)<Q&&(Q=this.get(w,L));return Q}minColumnIndex(L){Lt(this,L),Ge(this);let Q=this.get(0,L),w=[0,L];for(let z=1;z<this.rows;z++)this.get(z,L)<Q&&(Q=this.get(z,L),w[0]=z);return w}diag(){let L=Math.min(this.rows,this.columns),Q=[];for(let w=0;w<L;w++)Q.push(this.get(w,w));return Q}norm(L="frobenius"){switch(L){case"max":return this.max();case"frobenius":return Math.sqrt(this.dot(this));default:throw new RangeError(`unknown norm type: ${L}`)}}cumulativeSum(){let L=0;for(let Q=0;Q<this.rows;Q++)for(let w=0;w<this.columns;w++)L+=this.get(Q,w),this.set(Q,w,L);return this}dot(L){sn.isMatrix(L)&&(L=L.to1DArray());let Q=this.to1DArray();if(Q.length!==L.length)throw new RangeError("vectors do not have the same size");let w=0;for(let z=0;z<Q.length;z++)w+=Q[z]*L[z];return w}mmul(L){L=zt.checkMatrix(L);let Q=this.rows,w=this.columns,z=L.columns,ie=new zt(Q,z),ze=new Float64Array(w);for(let Je=0;Je<z;Je++){for(let At=0;At<w;At++)ze[At]=L.get(At,Je);for(let At=0;At<Q;At++){let xt=0;for(let Sn=0;Sn<w;Sn++)xt+=this.get(At,Sn)*ze[Sn];ie.set(At,Je,xt)}}return ie}mpow(L){if(!this.isSquare())throw new RangeError("Matrix must be square");if(!Number.isInteger(L)||L<0)throw new RangeError("Exponent must be a non-negative integer");let Q=zt.eye(this.rows),w=this;for(let z=L;z>=1;z/=2)z&1&&(Q=Q.mmul(w)),w=w.mmul(w);return Q}strassen2x2(L){L=zt.checkMatrix(L);let Q=new zt(2,2);const w=this.get(0,0),z=L.get(0,0),ie=this.get(0,1),ze=L.get(0,1),Je=this.get(1,0),At=L.get(1,0),xt=this.get(1,1),Sn=L.get(1,1),Oe=(w+xt)*(z+Sn),Qe=(Je+xt)*z,Re=w*(ze-Sn),Ke=xt*(At-z),gt=(w+ie)*Sn,tn=(Je-w)*(z+ze),yt=(ie-xt)*(At+Sn),Yt=Oe+Ke-gt+yt,Rn=Re+gt,er=Qe+Ke,Jn=Oe-Qe+Re+tn;return Q.set(0,0,Yt),Q.set(0,1,Rn),Q.set(1,0,er),Q.set(1,1,Jn),Q}strassen3x3(L){L=zt.checkMatrix(L);let Q=new zt(3,3);const w=this.get(0,0),z=this.get(0,1),ie=this.get(0,2),ze=this.get(1,0),Je=this.get(1,1),At=this.get(1,2),xt=this.get(2,0),Sn=this.get(2,1),Oe=this.get(2,2),Qe=L.get(0,0),Re=L.get(0,1),Ke=L.get(0,2),gt=L.get(1,0),tn=L.get(1,1),yt=L.get(1,2),Yt=L.get(2,0),Rn=L.get(2,1),er=L.get(2,2),Jn=(w+z+ie-ze-Je-Sn-Oe)*tn,kr=(w-ze)*(-Re+tn),fr=Je*(-Qe+Re+gt-tn-yt-Yt+er),wr=(-w+ze+Je)*(Qe-Re+tn),ei=(ze+Je)*(-Qe+Re),_n=w*Qe,jn=(-w+xt+Sn)*(Qe-Ke+yt),Hr=(-w+xt)*(Ke-yt),Pr=(xt+Sn)*(-Qe+Ke),$i=(w+z+ie-Je-At-xt-Sn)*yt,Zi=Sn*(-Qe+Ke+gt-tn-yt-Yt+Rn),Xi=(-ie+Sn+Oe)*(tn+Yt-Rn),Ei=(ie-Oe)*(tn-Rn),ms=ie*Yt,_i=(Sn+Oe)*(-Yt+Rn),Es=(-ie+Je+At)*(yt+Yt-er),ua=(ie-At)*(yt-er),Hn=(Je+At)*(-Yt+er),Pt=z*gt,Gt=At*Rn,Bt=ze*Ke,yn=xt*Re,Ln=Oe*er,gr=_n+ms+Pt,Rr=Jn+wr+ei+_n+Xi+ms+_i,$r=_n+jn+Pr+$i+ms+Es+Hn,Ii=kr+fr+wr+_n+ms+Es+ua,Di=kr+wr+ei+_n+Gt,ss=ms+Es+ua+Hn+Bt,vs=_n+jn+Hr+Zi+Xi+Ei+ms,Cs=Xi+Ei+ms+_i+yn,Aa=_n+jn+Hr+Pr+Ln;return Q.set(0,0,gr),Q.set(0,1,Rr),Q.set(0,2,$r),Q.set(1,0,Ii),Q.set(1,1,Di),Q.set(1,2,ss),Q.set(2,0,vs),Q.set(2,1,Cs),Q.set(2,2,Aa),Q}mmulStrassen(L){L=zt.checkMatrix(L);let Q=this.clone(),w=Q.rows,z=Q.columns,ie=L.rows,ze=L.columns;z!==ie&&console.warn(`Multiplying ${w} x ${z} and ${ie} x ${ze} matrix: dimensions do not match.`);function Je(Oe,Qe,Re){let Ke=Oe.rows,gt=Oe.columns;if(Ke===Qe&&gt===Re)return Oe;{let tn=sn.zeros(Qe,Re);return tn=tn.setSubMatrix(Oe,0,0),tn}}let At=Math.max(w,ie),xt=Math.max(z,ze);Q=Je(Q,At,xt),L=Je(L,At,xt);function Sn(Oe,Qe,Re,Ke){if(Re<=512||Ke<=512)return Oe.mmul(Qe);Re%2===1&&Ke%2===1?(Oe=Je(Oe,Re+1,Ke+1),Qe=Je(Qe,Re+1,Ke+1)):Re%2===1?(Oe=Je(Oe,Re+1,Ke),Qe=Je(Qe,Re+1,Ke)):Ke%2===1&&(Oe=Je(Oe,Re,Ke+1),Qe=Je(Qe,Re,Ke+1));let gt=parseInt(Oe.rows/2,10),tn=parseInt(Oe.columns/2,10),yt=Oe.subMatrix(0,gt-1,0,tn-1),Yt=Qe.subMatrix(0,gt-1,0,tn-1),Rn=Oe.subMatrix(0,gt-1,tn,Oe.columns-1),er=Qe.subMatrix(0,gt-1,tn,Qe.columns-1),Jn=Oe.subMatrix(gt,Oe.rows-1,0,tn-1),kr=Qe.subMatrix(gt,Qe.rows-1,0,tn-1),fr=Oe.subMatrix(gt,Oe.rows-1,tn,Oe.columns-1),wr=Qe.subMatrix(gt,Qe.rows-1,tn,Qe.columns-1),ei=Sn(sn.add(yt,fr),sn.add(Yt,wr),gt,tn),_n=Sn(sn.add(Jn,fr),Yt,gt,tn),jn=Sn(yt,sn.sub(er,wr),gt,tn),Hr=Sn(fr,sn.sub(kr,Yt),gt,tn),Pr=Sn(sn.add(yt,Rn),wr,gt,tn),$i=Sn(sn.sub(Jn,yt),sn.add(Yt,er),gt,tn),Zi=Sn(sn.sub(Rn,fr),sn.add(kr,wr),gt,tn),Xi=sn.add(ei,Hr);Xi.sub(Pr),Xi.add(Zi);let Ei=sn.add(jn,Pr),ms=sn.add(_n,Hr),_i=sn.sub(ei,_n);_i.add(jn),_i.add($i);let Es=sn.zeros(2*Xi.rows,2*Xi.columns);return Es=Es.setSubMatrix(Xi,0,0),Es=Es.setSubMatrix(Ei,Xi.rows,0),Es=Es.setSubMatrix(ms,0,Xi.columns),Es=Es.setSubMatrix(_i,Xi.rows,Xi.columns),Es.subMatrix(0,Re-1,0,Ke-1)}return Sn(Q,L,At,xt)}scaleRows(L={}){if(typeof L!="object")throw new TypeError("options must be an object");const{min:Q=0,max:w=1}=L;if(!Number.isFinite(Q))throw new TypeError("min must be a number");if(!Number.isFinite(w))throw new TypeError("max must be a number");if(Q>=w)throw new RangeError("min must be smaller than max");let z=new zt(this.rows,this.columns);for(let ie=0;ie<this.rows;ie++){const ze=this.getRow(ie);ze.length>0&&ve(ze,{min:Q,max:w,output:ze}),z.setRow(ie,ze)}return z}scaleColumns(L={}){if(typeof L!="object")throw new TypeError("options must be an object");const{min:Q=0,max:w=1}=L;if(!Number.isFinite(Q))throw new TypeError("min must be a number");if(!Number.isFinite(w))throw new TypeError("max must be a number");if(Q>=w)throw new RangeError("min must be smaller than max");let z=new zt(this.rows,this.columns);for(let ie=0;ie<this.columns;ie++){const ze=this.getColumn(ie);ze.length&&ve(ze,{min:Q,max:w,output:ze}),z.setColumn(ie,ze)}return z}flipRows(){const L=Math.ceil(this.columns/2);for(let Q=0;Q<this.rows;Q++)for(let w=0;w<L;w++){let z=this.get(Q,w),ie=this.get(Q,this.columns-1-w);this.set(Q,w,ie),this.set(Q,this.columns-1-w,z)}return this}flipColumns(){const L=Math.ceil(this.rows/2);for(let Q=0;Q<this.columns;Q++)for(let w=0;w<L;w++){let z=this.get(w,Q),ie=this.get(this.rows-1-w,Q);this.set(w,Q,ie),this.set(this.rows-1-w,Q,z)}return this}kroneckerProduct(L){L=zt.checkMatrix(L);let Q=this.rows,w=this.columns,z=L.rows,ie=L.columns,ze=new zt(Q*z,w*ie);for(let Je=0;Je<Q;Je++)for(let At=0;At<w;At++)for(let xt=0;xt<z;xt++)for(let Sn=0;Sn<ie;Sn++)ze.set(z*Je+xt,ie*At+Sn,this.get(Je,At)*L.get(xt,Sn));return ze}kroneckerSum(L){if(L=zt.checkMatrix(L),!this.isSquare()||!L.isSquare())throw new Error("Kronecker Sum needs two Square Matrices");let Q=this.rows,w=L.rows,z=this.kroneckerProduct(zt.eye(w,w)),ie=zt.eye(Q,Q).kroneckerProduct(L);return z.add(ie)}transpose(){let L=new zt(this.columns,this.rows);for(let Q=0;Q<this.rows;Q++)for(let w=0;w<this.columns;w++)L.set(w,Q,this.get(Q,w));return L}sortRows(L=W){for(let Q=0;Q<this.rows;Q++)this.setRow(Q,this.getRow(Q).sort(L));return this}sortColumns(L=W){for(let Q=0;Q<this.columns;Q++)this.setColumn(Q,this.getColumn(Q).sort(L));return this}subMatrix(L,Q,w,z){dr(this,L,Q,w,z);let ie=new zt(Q-L+1,z-w+1);for(let ze=L;ze<=Q;ze++)for(let Je=w;Je<=z;Je++)ie.set(ze-L,Je-w,this.get(ze,Je));return ie}subMatrixRow(L,Q,w){if(Q===void 0&&(Q=0),w===void 0&&(w=this.columns-1),Q>w||Q<0||Q>=this.columns||w<0||w>=this.columns)throw new RangeError("Argument out of range");let z=new zt(L.length,w-Q+1);for(let ie=0;ie<L.length;ie++)for(let ze=Q;ze<=w;ze++){if(L[ie]<0||L[ie]>=this.rows)throw new RangeError(`Row index out of range: ${L[ie]}`);z.set(ie,ze-Q,this.get(L[ie],ze))}return z}subMatrixColumn(L,Q,w){if(Q===void 0&&(Q=0),w===void 0&&(w=this.rows-1),Q>w||Q<0||Q>=this.rows||w<0||w>=this.rows)throw new RangeError("Argument out of range");let z=new zt(w-Q+1,L.length);for(let ie=0;ie<L.length;ie++)for(let ze=Q;ze<=w;ze++){if(L[ie]<0||L[ie]>=this.columns)throw new RangeError(`Column index out of range: ${L[ie]}`);z.set(ze-Q,ie,this.get(ze,L[ie]))}return z}setSubMatrix(L,Q,w){if(L=zt.checkMatrix(L),L.isEmpty())return this;let z=Q+L.rows-1,ie=w+L.columns-1;dr(this,Q,z,w,ie);for(let ze=0;ze<L.rows;ze++)for(let Je=0;Je<L.columns;Je++)this.set(Q+ze,w+Je,L.get(ze,Je));return this}selection(L,Q){In(this,L),zn(this,Q);let w=new zt(L.length,Q.length);for(let z=0;z<L.length;z++){let ie=L[z];for(let ze=0;ze<Q.length;ze++){let Je=Q[ze];w.set(z,ze,this.get(ie,Je))}}return w}trace(){let L=Math.min(this.rows,this.columns),Q=0;for(let w=0;w<L;w++)Q+=this.get(w,w);return Q}clone(){return this.constructor.copy(this,new zt(this.rows,this.columns))}static copy(L,Q){for(const[w,z,ie]of L.entries())Q.set(w,z,ie);return Q}sum(L){switch(L){case"row":return Tt(this);case"column":return On(this);case void 0:return Vr(this);default:throw new Error(`invalid option: ${L}`)}}product(L){switch(L){case"row":return en(this);case"column":return ln(this);case void 0:return Cn(this);default:throw new Error(`invalid option: ${L}`)}}mean(L){const Q=this.sum(L);switch(L){case"row":{for(let w=0;w<this.rows;w++)Q[w]/=this.columns;return Q}case"column":{for(let w=0;w<this.columns;w++)Q[w]/=this.rows;return Q}case void 0:return Q/this.size;default:throw new Error(`invalid option: ${L}`)}}variance(L,Q={}){if(typeof L=="object"&&(Q=L,L=void 0),typeof Q!="object")throw new TypeError("options must be an object");const{unbiased:w=!0,mean:z=this.mean(L)}=Q;if(typeof w!="boolean")throw new TypeError("unbiased must be a boolean");switch(L){case"row":{if(!we.isAnyArray(z))throw new TypeError("mean must be an array");return Mt(this,w,z)}case"column":{if(!we.isAnyArray(z))throw new TypeError("mean must be an array");return Et(this,w,z)}case void 0:{if(typeof z!="number")throw new TypeError("mean must be a number");return pe(this,w,z)}default:throw new Error(`invalid option: ${L}`)}}standardDeviation(L,Q){typeof L=="object"&&(Q=L,L=void 0);const w=this.variance(L,Q);if(L===void 0)return Math.sqrt(w);for(let z=0;z<w.length;z++)w[z]=Math.sqrt(w[z]);return w}center(L,Q={}){if(typeof L=="object"&&(Q=L,L=void 0),typeof Q!="object")throw new TypeError("options must be an object");const{center:w=this.mean(L)}=Q;switch(L){case"row":{if(!we.isAnyArray(w))throw new TypeError("center must be an array");return Ae(this,w),this}case"column":{if(!we.isAnyArray(w))throw new TypeError("center must be an array");return Pe(this,w),this}case void 0:{if(typeof w!="number")throw new TypeError("center must be a number");return Ut(this,w),this}default:throw new Error(`invalid option: ${L}`)}}scale(L,Q={}){if(typeof L=="object"&&(Q=L,L=void 0),typeof Q!="object")throw new TypeError("options must be an object");let w=Q.scale;switch(L){case"row":{if(w===void 0)w=jt(this);else if(!we.isAnyArray(w))throw new TypeError("scale must be an array");return ft(this,w),this}case"column":{if(w===void 0)w=on(this);else if(!we.isAnyArray(w))throw new TypeError("scale must be an array");return hn(this,w),this}case void 0:{if(w===void 0)w=lt(this);else if(typeof w!="number")throw new TypeError("scale must be a number");return Ct(this,w),this}default:throw new Error(`invalid option: ${L}`)}}toString(L){return ct(this,L)}[Symbol.iterator](){return this.entries()}*entries(){for(let L=0;L<this.rows;L++)for(let Q=0;Q<this.columns;Q++)yield[L,Q,this.get(L,Q)]}*values(){for(let L=0;L<this.rows;L++)for(let Q=0;Q<this.columns;Q++)yield this.get(L,Q)}}sn.prototype.klass="Matrix",typeof Symbol!="undefined"&&(sn.prototype[Symbol.for("nodejs.util.inspect.custom")]=Fe);function W(Ie,L){return Ie-L}function Se(Ie){return Ie.every(L=>typeof L=="number")}sn.random=sn.rand,sn.randomInt=sn.randInt,sn.diagonal=sn.diag,sn.prototype.diagonal=sn.prototype.diag,sn.identity=sn.eye,sn.prototype.negate=sn.prototype.neg,sn.prototype.tensorProduct=sn.prototype.kroneckerProduct;const Ht=class NE extends sn{constructor(L,Q){if(super(),H(this,j),F(this,"data"),NE.isMatrix(L))X(this,j,de).call(this,L.rows,L.columns),NE.copy(L,this);else if(Number.isInteger(L)&&L>=0)X(this,j,de).call(this,L,Q);else if(we.isAnyArray(L)){const w=L;if(L=w.length,Q=L?w[0].length:0,typeof Q!="number")throw new TypeError("Data must be a 2D array with at least one element");this.data=[];for(let z=0;z<L;z++){if(w[z].length!==Q)throw new RangeError("Inconsistent array dimensions");if(!Se(w[z]))throw new TypeError("Input data contains non-numeric values");this.data.push(Float64Array.from(w[z]))}this.rows=L,this.columns=Q}else throw new TypeError("First argument must be a positive number or an array")}set(L,Q,w){return this.data[L][Q]=w,this}get(L,Q){return this.data[L][Q]}removeRow(L){return Bn(this,L),this.data.splice(L,1),this.rows-=1,this}addRow(L,Q){return Q===void 0&&(Q=L,L=this.rows),Bn(this,L,!0),Q=Float64Array.from(Wn(this,Q)),this.data.splice(L,0,Q),this.rows+=1,this}removeColumn(L){Lt(this,L);for(let Q=0;Q<this.rows;Q++){const w=new Float64Array(this.columns-1);for(let z=0;z<L;z++)w[z]=this.data[Q][z];for(let z=L+1;z<this.columns;z++)w[z-1]=this.data[Q][z];this.data[Q]=w}return this.columns-=1,this}addColumn(L,Q){typeof Q=="undefined"&&(Q=L,L=this.columns),Lt(this,L,!0),Q=Xn(this,Q);for(let w=0;w<this.rows;w++){const z=new Float64Array(this.columns+1);let ie=0;for(;ie<L;ie++)z[ie]=this.data[w][ie];for(z[ie++]=Q[w];ie<this.columns+1;ie++)z[ie]=this.data[w][ie-1];this.data[w]=z}return this.columns+=1,this}};j=new WeakSet,de=function(Ie,L){if(this.data=[],Number.isInteger(L)&&L>=0)for(let Q=0;Q<Ie;Q++)this.data.push(new Float64Array(L));else throw new TypeError("nColumns must be a positive integer");this.rows=Ie,this.columns=L};let zt=Ht;It(sn,zt);const Fn=class FE extends sn{constructor(L){if(super(),H(this,he),zt.isMatrix(L)){if(!L.isSymmetric())throw new TypeError("not symmetric data");D(this,he,zt.copy(L,new zt(L.rows,L.rows)))}else if(Number.isInteger(L)&&L>=0)D(this,he,new zt(L,L));else if(D(this,he,new zt(L)),!this.isSymmetric())throw new TypeError("not symmetric data")}get size(){return P(this,he).size}get rows(){return P(this,he).rows}get columns(){return P(this,he).columns}get diagonalSize(){return this.rows}static isSymmetricMatrix(L){return zt.isMatrix(L)&&L.klassType==="SymmetricMatrix"}static zeros(L){return new this(L)}static ones(L){return new this(L).fill(1)}clone(){const L=new FE(this.diagonalSize);for(const[Q,w,z]of this.upperRightEntries())L.set(Q,w,z);return L}toMatrix(){return new zt(this)}get(L,Q){return P(this,he).get(L,Q)}set(L,Q,w){return P(this,he).set(L,Q,w),P(this,he).set(Q,L,w),this}removeCross(L){return P(this,he).removeRow(L),P(this,he).removeColumn(L),this}addCross(L,Q){Q===void 0&&(Q=L,L=this.diagonalSize);const w=Q.slice();return w.splice(L,1),P(this,he).addRow(L,w),P(this,he).addColumn(L,Q),this}applyMask(L){if(L.length!==this.diagonalSize)throw new RangeError("Mask size do not match with matrix size");const Q=[];for(const[w,z]of L.entries())z||Q.push(w);Q.reverse();for(const w of Q)this.removeCross(w);return this}toCompact(){const{diagonalSize:L}=this,Q=new Array(L*(L+1)/2);for(let w=0,z=0,ie=0;ie<Q.length;ie++)Q[ie]=this.get(z,w),++w>=L&&(w=++z);return Q}static fromCompact(L){const Q=L.length,w=(Math.sqrt(8*Q+1)-1)/2;if(!Number.isInteger(w))throw new TypeError(`This array is not a compact representation of a Symmetric Matrix, ${JSON.stringify(L)}`);const z=new FE(w);for(let ie=0,ze=0,Je=0;Je<Q;Je++)z.set(ie,ze,L[Je]),++ie>=w&&(ie=++ze);return z}*upperRightEntries(){for(let L=0,Q=0;L<this.diagonalSize;void 0){const w=this.get(L,Q);yield[L,Q,w],++Q>=this.diagonalSize&&(Q=++L)}}*upperRightValues(){for(let L=0,Q=0;L<this.diagonalSize;void 0)yield this.get(L,Q),++Q>=this.diagonalSize&&(Q=++L)}};he=new WeakMap;let Tn=Fn;Tn.prototype.klassType="SymmetricMatrix";class lr extends Tn{static isDistanceMatrix(L){return Tn.isSymmetricMatrix(L)&&L.klassSubType==="DistanceMatrix"}constructor(L){if(super(L),!this.isDistance())throw new TypeError("Provided arguments do no produce a distance matrix")}set(L,Q,w){return L===Q&&(w=0),super.set(L,Q,w)}addCross(L,Q){return Q===void 0&&(Q=L,L=this.diagonalSize),Q=Q.slice(),Q[L]=0,super.addCross(L,Q)}toSymmetricMatrix(){return new Tn(this)}clone(){const L=new lr(this.diagonalSize);for(const[Q,w,z]of this.upperRightEntries())Q!==w&&L.set(Q,w,z);return L}toCompact(){const{diagonalSize:L}=this,Q=(L-1)*L/2,w=new Array(Q);for(let z=1,ie=0,ze=0;ze<w.length;ze++)w[ze]=this.get(ie,z),++z>=L&&(z=++ie+1);return w}static fromCompact(L){const Q=L.length;if(Q===0)return new this(0);const w=(Math.sqrt(8*Q+1)+1)/2;if(!Number.isInteger(w))throw new TypeError(`This array is not a compact representation of a DistanceMatrix, ${JSON.stringify(L)}`);const z=new this(w);for(let ie=1,ze=0,Je=0;Je<Q;Je++)z.set(ie,ze,L[Je]),++ie>=w&&(ie=++ze+1);return z}}lr.prototype.klassSubType="DistanceMatrix";class je extends sn{constructor(L,Q,w){super(),this.matrix=L,this.rows=Q,this.columns=w}}class be extends je{constructor(L,Q){Lt(L,Q),super(L,L.rows,1),this.column=Q}set(L,Q,w){return this.matrix.set(L,this.column,w),this}get(L){return this.matrix.get(L,this.column)}}class it extends je{constructor(L,Q){zn(L,Q),super(L,L.rows,Q.length),this.columnIndices=Q}set(L,Q,w){return this.matrix.set(L,this.columnIndices[Q],w),this}get(L,Q){return this.matrix.get(L,this.columnIndices[Q])}}class wt extends je{constructor(L){super(L,L.rows,L.columns)}set(L,Q,w){return this.matrix.set(L,this.columns-Q-1,w),this}get(L,Q){return this.matrix.get(L,this.columns-Q-1)}}class ot extends je{constructor(L){super(L,L.rows,L.columns)}set(L,Q,w){return this.matrix.set(this.rows-L-1,Q,w),this}get(L,Q){return this.matrix.get(this.rows-L-1,Q)}}class ut extends je{constructor(L,Q){Bn(L,Q),super(L,1,L.columns),this.row=Q}set(L,Q,w){return this.matrix.set(this.row,Q,w),this}get(L,Q){return this.matrix.get(this.row,Q)}}class _t extends je{constructor(L,Q){In(L,Q),super(L,Q.length,L.columns),this.rowIndices=Q}set(L,Q,w){return this.matrix.set(this.rowIndices[L],Q,w),this}get(L,Q){return this.matrix.get(this.rowIndices[L],Q)}}class $t extends je{constructor(L,Q,w){In(L,Q),zn(L,w),super(L,Q.length,w.length),this.rowIndices=Q,this.columnIndices=w}set(L,Q,w){return this.matrix.set(this.rowIndices[L],this.columnIndices[Q],w),this}get(L,Q){return this.matrix.get(this.rowIndices[L],this.columnIndices[Q])}}class Vt extends je{constructor(L,Q,w,z,ie){dr(L,Q,w,z,ie),super(L,w-Q+1,ie-z+1),this.startRow=Q,this.startColumn=z}set(L,Q,w){return this.matrix.set(this.startRow+L,this.startColumn+Q,w),this}get(L,Q){return this.matrix.get(this.startRow+L,this.startColumn+Q)}}class Qt extends je{constructor(L){super(L,L.columns,L.rows)}set(L,Q,w){return this.matrix.set(Q,L,w),this}get(L,Q){return this.matrix.get(Q,L)}}class cn extends sn{constructor(L,Q={}){const{rows:w=1}=Q;if(L.length%w!==0)throw new Error("the data length is not divisible by the number of rows");super(),this.rows=w,this.columns=L.length/w,this.data=L}set(L,Q,w){let z=this._calculateIndex(L,Q);return this.data[z]=w,this}get(L,Q){let w=this._calculateIndex(L,Q);return this.data[w]}_calculateIndex(L,Q){return L*this.columns+Q}}class Yn extends sn{constructor(L){super(),this.data=L,this.rows=L.length,this.columns=L[0].length}set(L,Q,w){return this.data[L][Q]=w,this}get(L,Q){return this.data[L][Q]}}function qn(Ie,L){if(we.isAnyArray(Ie))return Ie[0]&&we.isAnyArray(Ie[0])?new Yn(Ie):new cn(Ie,L);throw new Error("the argument is not an array")}class Sr{constructor(L){L=Yn.checkMatrix(L);let Q=L.clone(),w=Q.rows,z=Q.columns,ie=new Float64Array(w),ze=1,Je,At,xt,Sn,Oe,Qe,Re,Ke,gt;for(Je=0;Je<w;Je++)ie[Je]=Je;for(Ke=new Float64Array(w),At=0;At<z;At++){for(Je=0;Je<w;Je++)Ke[Je]=Q.get(Je,At);for(Je=0;Je<w;Je++){for(gt=Math.min(Je,At),Oe=0,xt=0;xt<gt;xt++)Oe+=Q.get(Je,xt)*Ke[xt];Ke[Je]-=Oe,Q.set(Je,At,Ke[Je])}for(Sn=At,Je=At+1;Je<w;Je++)Math.abs(Ke[Je])>Math.abs(Ke[Sn])&&(Sn=Je);if(Sn!==At){for(xt=0;xt<z;xt++)Qe=Q.get(Sn,xt),Q.set(Sn,xt,Q.get(At,xt)),Q.set(At,xt,Qe);Re=ie[Sn],ie[Sn]=ie[At],ie[At]=Re,ze=-ze}if(At<w&&Q.get(At,At)!==0)for(Je=At+1;Je<w;Je++)Q.set(Je,At,Q.get(Je,At)/Q.get(At,At))}this.LU=Q,this.pivotVector=ie,this.pivotSign=ze}isSingular(){let L=this.LU,Q=L.columns;for(let w=0;w<Q;w++)if(L.get(w,w)===0)return!0;return!1}solve(L){L=zt.checkMatrix(L);let Q=this.LU;if(Q.rows!==L.rows)throw new Error("Invalid matrix dimensions");if(this.isSingular())throw new Error("LU matrix is singular");let z=L.columns,ie=L.subMatrixRow(this.pivotVector,0,z-1),ze=Q.columns,Je,At,xt;for(xt=0;xt<ze;xt++)for(Je=xt+1;Je<ze;Je++)for(At=0;At<z;At++)ie.set(Je,At,ie.get(Je,At)-ie.get(xt,At)*Q.get(Je,xt));for(xt=ze-1;xt>=0;xt--){for(At=0;At<z;At++)ie.set(xt,At,ie.get(xt,At)/Q.get(xt,xt));for(Je=0;Je<xt;Je++)for(At=0;At<z;At++)ie.set(Je,At,ie.get(Je,At)-ie.get(xt,At)*Q.get(Je,xt))}return ie}get determinant(){let L=this.LU;if(!L.isSquare())throw new Error("Matrix must be square");let Q=this.pivotSign,w=L.columns;for(let z=0;z<w;z++)Q*=L.get(z,z);return Q}get lowerTriangularMatrix(){let L=this.LU,Q=L.rows,w=L.columns,z=new zt(Q,w);for(let ie=0;ie<Q;ie++)for(let ze=0;ze<w;ze++)ie>ze?z.set(ie,ze,L.get(ie,ze)):ie===ze?z.set(ie,ze,1):z.set(ie,ze,0);return z}get upperTriangularMatrix(){let L=this.LU,Q=L.rows,w=L.columns,z=new zt(Q,w);for(let ie=0;ie<Q;ie++)for(let ze=0;ze<w;ze++)ie<=ze?z.set(ie,ze,L.get(ie,ze)):z.set(ie,ze,0);return z}get pivotPermutationVector(){return Array.from(this.pivotVector)}}function Jr(Ie,L){let Q=0;return Math.abs(Ie)>Math.abs(L)?(Q=L/Ie,Math.abs(Ie)*Math.sqrt(1+Q*Q)):L!==0?(Q=Ie/L,Math.abs(L)*Math.sqrt(1+Q*Q)):0}class vr{constructor(L){L=Yn.checkMatrix(L);let Q=L.clone(),w=L.rows,z=L.columns,ie=new Float64Array(z),ze,Je,At,xt;for(At=0;At<z;At++){let Sn=0;for(ze=At;ze<w;ze++)Sn=Jr(Sn,Q.get(ze,At));if(Sn!==0){for(Q.get(At,At)<0&&(Sn=-Sn),ze=At;ze<w;ze++)Q.set(ze,At,Q.get(ze,At)/Sn);for(Q.set(At,At,Q.get(At,At)+1),Je=At+1;Je<z;Je++){for(xt=0,ze=At;ze<w;ze++)xt+=Q.get(ze,At)*Q.get(ze,Je);for(xt=-xt/Q.get(At,At),ze=At;ze<w;ze++)Q.set(ze,Je,Q.get(ze,Je)+xt*Q.get(ze,At))}}ie[At]=-Sn}this.QR=Q,this.Rdiag=ie}solve(L){L=zt.checkMatrix(L);let Q=this.QR,w=Q.rows;if(L.rows!==w)throw new Error("Matrix row dimensions must agree");if(!this.isFullRank())throw new Error("Matrix is rank deficient");let z=L.columns,ie=L.clone(),ze=Q.columns,Je,At,xt,Sn;for(xt=0;xt<ze;xt++)for(At=0;At<z;At++){for(Sn=0,Je=xt;Je<w;Je++)Sn+=Q.get(Je,xt)*ie.get(Je,At);for(Sn=-Sn/Q.get(xt,xt),Je=xt;Je<w;Je++)ie.set(Je,At,ie.get(Je,At)+Sn*Q.get(Je,xt))}for(xt=ze-1;xt>=0;xt--){for(At=0;At<z;At++)ie.set(xt,At,ie.get(xt,At)/this.Rdiag[xt]);for(Je=0;Je<xt;Je++)for(At=0;At<z;At++)ie.set(Je,At,ie.get(Je,At)-ie.get(xt,At)*Q.get(Je,xt))}return ie.subMatrix(0,ze-1,0,z-1)}isFullRank(){let L=this.QR.columns;for(let Q=0;Q<L;Q++)if(this.Rdiag[Q]===0)return!1;return!0}get upperTriangularMatrix(){let L=this.QR,Q=L.columns,w=new zt(Q,Q),z,ie;for(z=0;z<Q;z++)for(ie=0;ie<Q;ie++)z<ie?w.set(z,ie,L.get(z,ie)):z===ie?w.set(z,ie,this.Rdiag[z]):w.set(z,ie,0);return w}get orthogonalMatrix(){let L=this.QR,Q=L.rows,w=L.columns,z=new zt(Q,w),ie,ze,Je,At;for(Je=w-1;Je>=0;Je--){for(ie=0;ie<Q;ie++)z.set(ie,Je,0);for(z.set(Je,Je,1),ze=Je;ze<w;ze++)if(L.get(Je,Je)!==0){for(At=0,ie=Je;ie<Q;ie++)At+=L.get(ie,Je)*z.get(ie,ze);for(At=-At/L.get(Je,Je),ie=Je;ie<Q;ie++)z.set(ie,ze,z.get(ie,ze)+At*L.get(ie,Je))}}return z}}class Ki{constructor(L,Q={}){if(L=Yn.checkMatrix(L),L.isEmpty())throw new Error("Matrix must be non-empty");let w=L.rows,z=L.columns;const{computeLeftSingularVectors:ie=!0,computeRightSingularVectors:ze=!0,autoTranspose:Je=!1}=Q;let At=!!ie,xt=!!ze,Sn=!1,Oe;if(w<z)if(!Je)Oe=L.clone(),console.warn("Computing SVD on a matrix with more columns than rows. Consider enabling autoTranspose");else{Oe=L.transpose(),w=Oe.rows,z=Oe.columns,Sn=!0;let _n=At;At=xt,xt=_n}else Oe=L.clone();let Qe=Math.min(w,z),Re=Math.min(w+1,z),Ke=new Float64Array(Re),gt=new zt(w,Qe),tn=new zt(z,z),yt=new Float64Array(z),Yt=new Float64Array(w),Rn=new Float64Array(Re);for(let _n=0;_n<Re;_n++)Rn[_n]=_n;let er=Math.min(w-1,z),Jn=Math.max(0,Math.min(z-2,w)),kr=Math.max(er,Jn);for(let _n=0;_n<kr;_n++){if(_n<er){Ke[_n]=0;for(let jn=_n;jn<w;jn++)Ke[_n]=Jr(Ke[_n],Oe.get(jn,_n));if(Ke[_n]!==0){Oe.get(_n,_n)<0&&(Ke[_n]=-Ke[_n]);for(let jn=_n;jn<w;jn++)Oe.set(jn,_n,Oe.get(jn,_n)/Ke[_n]);Oe.set(_n,_n,Oe.get(_n,_n)+1)}Ke[_n]=-Ke[_n]}for(let jn=_n+1;jn<z;jn++){if(_n<er&&Ke[_n]!==0){let Hr=0;for(let Pr=_n;Pr<w;Pr++)Hr+=Oe.get(Pr,_n)*Oe.get(Pr,jn);Hr=-Hr/Oe.get(_n,_n);for(let Pr=_n;Pr<w;Pr++)Oe.set(Pr,jn,Oe.get(Pr,jn)+Hr*Oe.get(Pr,_n))}yt[jn]=Oe.get(_n,jn)}if(At&&_n<er)for(let jn=_n;jn<w;jn++)gt.set(jn,_n,Oe.get(jn,_n));if(_n<Jn){yt[_n]=0;for(let jn=_n+1;jn<z;jn++)yt[_n]=Jr(yt[_n],yt[jn]);if(yt[_n]!==0){yt[_n+1]<0&&(yt[_n]=0-yt[_n]);for(let jn=_n+1;jn<z;jn++)yt[jn]/=yt[_n];yt[_n+1]+=1}if(yt[_n]=-yt[_n],_n+1<w&&yt[_n]!==0){for(let jn=_n+1;jn<w;jn++)Yt[jn]=0;for(let jn=_n+1;jn<w;jn++)for(let Hr=_n+1;Hr<z;Hr++)Yt[jn]+=yt[Hr]*Oe.get(jn,Hr);for(let jn=_n+1;jn<z;jn++){let Hr=-yt[jn]/yt[_n+1];for(let Pr=_n+1;Pr<w;Pr++)Oe.set(Pr,jn,Oe.get(Pr,jn)+Hr*Yt[Pr])}}if(xt)for(let jn=_n+1;jn<z;jn++)tn.set(jn,_n,yt[jn])}}let fr=Math.min(z,w+1);if(er<z&&(Ke[er]=Oe.get(er,er)),w<fr&&(Ke[fr-1]=0),Jn+1<fr&&(yt[Jn]=Oe.get(Jn,fr-1)),yt[fr-1]=0,At){for(let _n=er;_n<Qe;_n++){for(let jn=0;jn<w;jn++)gt.set(jn,_n,0);gt.set(_n,_n,1)}for(let _n=er-1;_n>=0;_n--)if(Ke[_n]!==0){for(let jn=_n+1;jn<Qe;jn++){let Hr=0;for(let Pr=_n;Pr<w;Pr++)Hr+=gt.get(Pr,_n)*gt.get(Pr,jn);Hr=-Hr/gt.get(_n,_n);for(let Pr=_n;Pr<w;Pr++)gt.set(Pr,jn,gt.get(Pr,jn)+Hr*gt.get(Pr,_n))}for(let jn=_n;jn<w;jn++)gt.set(jn,_n,-gt.get(jn,_n));gt.set(_n,_n,1+gt.get(_n,_n));for(let jn=0;jn<_n-1;jn++)gt.set(jn,_n,0)}else{for(let jn=0;jn<w;jn++)gt.set(jn,_n,0);gt.set(_n,_n,1)}}if(xt)for(let _n=z-1;_n>=0;_n--){if(_n<Jn&&yt[_n]!==0)for(let jn=_n+1;jn<z;jn++){let Hr=0;for(let Pr=_n+1;Pr<z;Pr++)Hr+=tn.get(Pr,_n)*tn.get(Pr,jn);Hr=-Hr/tn.get(_n+1,_n);for(let Pr=_n+1;Pr<z;Pr++)tn.set(Pr,jn,tn.get(Pr,jn)+Hr*tn.get(Pr,_n))}for(let jn=0;jn<z;jn++)tn.set(jn,_n,0);tn.set(_n,_n,1)}let wr=fr-1,ei=Number.EPSILON;for(;fr>0;){let _n,jn;for(_n=fr-2;_n>=-1&&_n!==-1;_n--){const Hr=Number.MIN_VALUE+ei*Math.abs(Ke[_n]+Math.abs(Ke[_n+1]));if(Math.abs(yt[_n])<=Hr||Number.isNaN(yt[_n])){yt[_n]=0;break}}if(_n===fr-2)jn=4;else{let Hr;for(Hr=fr-1;Hr>=_n&&Hr!==_n;Hr--){let Pr=(Hr!==fr?Math.abs(yt[Hr]):0)+(Hr!==_n+1?Math.abs(yt[Hr-1]):0);if(Math.abs(Ke[Hr])<=ei*Pr){Ke[Hr]=0;break}}Hr===_n?jn=3:Hr===fr-1?jn=1:(jn=2,_n=Hr)}switch(_n++,jn){case 1:{let Hr=yt[fr-2];yt[fr-2]=0;for(let Pr=fr-2;Pr>=_n;Pr--){let $i=Jr(Ke[Pr],Hr),Zi=Ke[Pr]/$i,Xi=Hr/$i;if(Ke[Pr]=$i,Pr!==_n&&(Hr=-Xi*yt[Pr-1],yt[Pr-1]=Zi*yt[Pr-1]),xt)for(let Ei=0;Ei<z;Ei++)$i=Zi*tn.get(Ei,Pr)+Xi*tn.get(Ei,fr-1),tn.set(Ei,fr-1,-Xi*tn.get(Ei,Pr)+Zi*tn.get(Ei,fr-1)),tn.set(Ei,Pr,$i)}break}case 2:{let Hr=yt[_n-1];yt[_n-1]=0;for(let Pr=_n;Pr<fr;Pr++){let $i=Jr(Ke[Pr],Hr),Zi=Ke[Pr]/$i,Xi=Hr/$i;if(Ke[Pr]=$i,Hr=-Xi*yt[Pr],yt[Pr]=Zi*yt[Pr],At)for(let Ei=0;Ei<w;Ei++)$i=Zi*gt.get(Ei,Pr)+Xi*gt.get(Ei,_n-1),gt.set(Ei,_n-1,-Xi*gt.get(Ei,Pr)+Zi*gt.get(Ei,_n-1)),gt.set(Ei,Pr,$i)}break}case 3:{const Hr=Math.max(Math.abs(Ke[fr-1]),Math.abs(Ke[fr-2]),Math.abs(yt[fr-2]),Math.abs(Ke[_n]),Math.abs(yt[_n])),Pr=Ke[fr-1]/Hr,$i=Ke[fr-2]/Hr,Zi=yt[fr-2]/Hr,Xi=Ke[_n]/Hr,Ei=yt[_n]/Hr,ms=(($i+Pr)*($i-Pr)+Zi*Zi)/2,_i=Pr*Zi*(Pr*Zi);let Es=0;(ms!==0||_i!==0)&&(ms<0?Es=0-Math.sqrt(ms*ms+_i):Es=Math.sqrt(ms*ms+_i),Es=_i/(ms+Es));let ua=(Xi+Pr)*(Xi-Pr)+Es,Hn=Xi*Ei;for(let Pt=_n;Pt<fr-1;Pt++){let Gt=Jr(ua,Hn);Gt===0&&(Gt=Number.MIN_VALUE);let Bt=ua/Gt,yn=Hn/Gt;if(Pt!==_n&&(yt[Pt-1]=Gt),ua=Bt*Ke[Pt]+yn*yt[Pt],yt[Pt]=Bt*yt[Pt]-yn*Ke[Pt],Hn=yn*Ke[Pt+1],Ke[Pt+1]=Bt*Ke[Pt+1],xt)for(let Ln=0;Ln<z;Ln++)Gt=Bt*tn.get(Ln,Pt)+yn*tn.get(Ln,Pt+1),tn.set(Ln,Pt+1,-yn*tn.get(Ln,Pt)+Bt*tn.get(Ln,Pt+1)),tn.set(Ln,Pt,Gt);if(Gt=Jr(ua,Hn),Gt===0&&(Gt=Number.MIN_VALUE),Bt=ua/Gt,yn=Hn/Gt,Ke[Pt]=Gt,ua=Bt*yt[Pt]+yn*Ke[Pt+1],Ke[Pt+1]=-yn*yt[Pt]+Bt*Ke[Pt+1],Hn=yn*yt[Pt+1],yt[Pt+1]=Bt*yt[Pt+1],At&&Pt<w-1)for(let Ln=0;Ln<w;Ln++)Gt=Bt*gt.get(Ln,Pt)+yn*gt.get(Ln,Pt+1),gt.set(Ln,Pt+1,-yn*gt.get(Ln,Pt)+Bt*gt.get(Ln,Pt+1)),gt.set(Ln,Pt,Gt)}yt[fr-2]=ua;break}case 4:{if(Ke[_n]<=0&&(Ke[_n]=Ke[_n]<0?-Ke[_n]:0,xt))for(let Hr=0;Hr<=wr;Hr++)tn.set(Hr,_n,-tn.get(Hr,_n));for(;_n<wr&&!(Ke[_n]>=Ke[_n+1]);){let Hr=Ke[_n];if(Ke[_n]=Ke[_n+1],Ke[_n+1]=Hr,xt&&_n<z-1)for(let Pr=0;Pr<z;Pr++)Hr=tn.get(Pr,_n+1),tn.set(Pr,_n+1,tn.get(Pr,_n)),tn.set(Pr,_n,Hr);if(At&&_n<w-1)for(let Pr=0;Pr<w;Pr++)Hr=gt.get(Pr,_n+1),gt.set(Pr,_n+1,gt.get(Pr,_n)),gt.set(Pr,_n,Hr);_n++}fr--;break}}}if(Sn){let _n=tn;tn=gt,gt=_n}this.m=w,this.n=z,this.s=Ke,this.U=gt,this.V=tn}solve(L){let Q=L,w=this.threshold,z=this.s.length,ie=zt.zeros(z,z);for(let Qe=0;Qe<z;Qe++)Math.abs(this.s[Qe])<=w?ie.set(Qe,Qe,0):ie.set(Qe,Qe,1/this.s[Qe]);let ze=this.U,Je=this.rightSingularVectors,At=Je.mmul(ie),xt=Je.rows,Sn=ze.rows,Oe=zt.zeros(xt,Sn);for(let Qe=0;Qe<xt;Qe++)for(let Re=0;Re<Sn;Re++){let Ke=0;for(let gt=0;gt<z;gt++)Ke+=At.get(Qe,gt)*ze.get(Re,gt);Oe.set(Qe,Re,Ke)}return Oe.mmul(Q)}solveForDiagonal(L){return this.solve(zt.diag(L))}inverse(){let L=this.V,Q=this.threshold,w=L.rows,z=L.columns,ie=new zt(w,this.s.length);for(let Sn=0;Sn<w;Sn++)for(let Oe=0;Oe<z;Oe++)Math.abs(this.s[Oe])>Q&&ie.set(Sn,Oe,L.get(Sn,Oe)/this.s[Oe]);let ze=this.U,Je=ze.rows,At=ze.columns,xt=new zt(w,Je);for(let Sn=0;Sn<w;Sn++)for(let Oe=0;Oe<Je;Oe++){let Qe=0;for(let Re=0;Re<At;Re++)Qe+=ie.get(Sn,Re)*ze.get(Oe,Re);xt.set(Sn,Oe,Qe)}return xt}get condition(){return this.s[0]/this.s[Math.min(this.m,this.n)-1]}get norm2(){return this.s[0]}get rank(){let L=Math.max(this.m,this.n)*this.s[0]*Number.EPSILON,Q=0,w=this.s;for(let z=0,ie=w.length;z<ie;z++)w[z]>L&&Q++;return Q}get diagonal(){return Array.from(this.s)}get threshold(){return Number.EPSILON/2*Math.max(this.m,this.n)*this.s[0]}get leftSingularVectors(){return this.U}get rightSingularVectors(){return this.V}get diagonalMatrix(){return zt.diag(this.s)}}function Mi(Ie,L=!1){return Ie=Yn.checkMatrix(Ie),L?new Ki(Ie).inverse():yi(Ie,zt.eye(Ie.rows))}function yi(Ie,L,Q=!1){return Ie=Yn.checkMatrix(Ie),L=Yn.checkMatrix(L),Q?new Ki(Ie).solve(L):Ie.isSquare()?new Sr(Ie).solve(L):new vr(Ie).solve(L)}function qr(Ie){if(Ie=zt.checkMatrix(Ie),Ie.isSquare()){if(Ie.columns===0)return 1;let L,Q,w,z;if(Ie.columns===2)return L=Ie.get(0,0),Q=Ie.get(0,1),w=Ie.get(1,0),z=Ie.get(1,1),L*z-Q*w;if(Ie.columns===3){let ie,ze,Je;return ie=new $t(Ie,[1,2],[1,2]),ze=new $t(Ie,[1,2],[0,2]),Je=new $t(Ie,[1,2],[0,1]),L=Ie.get(0,0),Q=Ie.get(0,1),w=Ie.get(0,2),L*qr(ie)-Q*qr(ze)+w*qr(Je)}else return new Sr(Ie).determinant}else throw Error("determinant can only be calculated for a square matrix")}function es(Ie,L){let Q=[];for(let w=0;w<Ie;w++)w!==L&&Q.push(w);return Q}function Ci(Ie,L,Q,w=1e-9,z=1e-9){if(Ie>z)return new Array(L.rows+1).fill(0);{let ie=L.addRow(Q,[0]);for(let ze=0;ze<ie.rows;ze++)Math.abs(ie.get(ze,0))<w&&ie.set(ze,0,0);return ie.to1DArray()}}function En(Ie,L={}){const{thresholdValue:Q=1e-9,thresholdError:w=1e-9}=L;Ie=zt.checkMatrix(Ie);let z=Ie.rows,ie=new zt(z,z);for(let ze=0;ze<z;ze++){let Je=zt.columnVector(Ie.getRow(ze)),At=Ie.subMatrixRow(es(z,ze)).transpose(),Sn=new Ki(At).solve(Je),Oe=zt.sub(Je,At.mmul(Sn)).abs().max();ie.setRow(ze,Ci(Oe,Sn,ze,Q,w))}return ie}function rn(Ie,L=Number.EPSILON){if(Ie=zt.checkMatrix(Ie),Ie.isEmpty())return Ie.transpose();let Q=new Ki(Ie,{autoTranspose:!0}),w=Q.leftSingularVectors,z=Q.rightSingularVectors,ie=Q.diagonal;for(let ze=0;ze<ie.length;ze++)Math.abs(ie[ze])>L?ie[ze]=1/ie[ze]:ie[ze]=0;return z.mmul(zt.diag(ie).mmul(w.transpose()))}function Xt(Ie,L=Ie,Q={}){Ie=new zt(Ie);let w=!1;if(typeof L=="object"&&!zt.isMatrix(L)&&!we.isAnyArray(L)?(Q=L,L=Ie,w=!0):L=new zt(L),Ie.rows!==L.rows)throw new TypeError("Both matrices must have the same number of rows");const{center:z=!0}=Q;z&&(Ie=Ie.center("column"),w||(L=L.center("column")));const ie=Ie.transpose().mmul(L);for(let ze=0;ze<ie.rows;ze++)for(let Je=0;Je<ie.columns;Je++)ie.set(ze,Je,ie.get(ze,Je)*(1/(Ie.rows-1)));return ie}function st(Ie,L=Ie,Q={}){Ie=new zt(Ie);let w=!1;if(typeof L=="object"&&!zt.isMatrix(L)&&!we.isAnyArray(L)?(Q=L,L=Ie,w=!0):L=new zt(L),Ie.rows!==L.rows)throw new TypeError("Both matrices must have the same number of rows");const{center:z=!0,scale:ie=!0}=Q;z&&(Ie.center("column"),w||L.center("column")),ie&&(Ie.scale("column"),w||L.scale("column"));const ze=Ie.standardDeviation("column",{unbiased:!0}),Je=w?ze:L.standardDeviation("column",{unbiased:!0}),At=Ie.transpose().mmul(L);for(let xt=0;xt<At.rows;xt++)for(let Sn=0;Sn<At.columns;Sn++)At.set(xt,Sn,At.get(xt,Sn)*(1/(ze[xt]*Je[Sn]))*(1/(Ie.rows-1)));return At}class dt{constructor(L,Q={}){const{assumeSymmetric:w=!1}=Q;if(L=Yn.checkMatrix(L),!L.isSquare())throw new Error("Matrix is not a square matrix");if(L.isEmpty())throw new Error("Matrix must be non-empty");let z=L.columns,ie=new zt(z,z),ze=new Float64Array(z),Je=new Float64Array(z),At=L,xt,Sn,Oe=!1;if(w?Oe=!0:Oe=L.isSymmetric(),Oe){for(xt=0;xt<z;xt++)for(Sn=0;Sn<z;Sn++)ie.set(xt,Sn,At.get(xt,Sn));Wt(z,Je,ze,ie),bn(z,Je,ze,ie)}else{let Qe=new zt(z,z),Re=new Float64Array(z);for(Sn=0;Sn<z;Sn++)for(xt=0;xt<z;xt++)Qe.set(xt,Sn,At.get(xt,Sn));Jt(z,Qe,Re,ie),ar(z,Je,ze,ie,Qe)}this.n=z,this.e=Je,this.d=ze,this.V=ie}get realEigenvalues(){return Array.from(this.d)}get imaginaryEigenvalues(){return Array.from(this.e)}get eigenvectorMatrix(){return this.V}get diagonalMatrix(){let L=this.n,Q=this.e,w=this.d,z=new zt(L,L),ie,ze;for(ie=0;ie<L;ie++){for(ze=0;ze<L;ze++)z.set(ie,ze,0);z.set(ie,ie,w[ie]),Q[ie]>0?z.set(ie,ie+1,Q[ie]):Q[ie]<0&&z.set(ie,ie-1,Q[ie])}return z}}function Wt(Ie,L,Q,w){let z,ie,ze,Je,At,xt,Sn,Oe;for(At=0;At<Ie;At++)Q[At]=w.get(Ie-1,At);for(Je=Ie-1;Je>0;Je--){for(Oe=0,ze=0,xt=0;xt<Je;xt++)Oe=Oe+Math.abs(Q[xt]);if(Oe===0)for(L[Je]=Q[Je-1],At=0;At<Je;At++)Q[At]=w.get(Je-1,At),w.set(Je,At,0),w.set(At,Je,0);else{for(xt=0;xt<Je;xt++)Q[xt]/=Oe,ze+=Q[xt]*Q[xt];for(z=Q[Je-1],ie=Math.sqrt(ze),z>0&&(ie=-ie),L[Je]=Oe*ie,ze=ze-z*ie,Q[Je-1]=z-ie,At=0;At<Je;At++)L[At]=0;for(At=0;At<Je;At++){for(z=Q[At],w.set(At,Je,z),ie=L[At]+w.get(At,At)*z,xt=At+1;xt<=Je-1;xt++)ie+=w.get(xt,At)*Q[xt],L[xt]+=w.get(xt,At)*z;L[At]=ie}for(z=0,At=0;At<Je;At++)L[At]/=ze,z+=L[At]*Q[At];for(Sn=z/(ze+ze),At=0;At<Je;At++)L[At]-=Sn*Q[At];for(At=0;At<Je;At++){for(z=Q[At],ie=L[At],xt=At;xt<=Je-1;xt++)w.set(xt,At,w.get(xt,At)-(z*L[xt]+ie*Q[xt]));Q[At]=w.get(Je-1,At),w.set(Je,At,0)}}Q[Je]=ze}for(Je=0;Je<Ie-1;Je++){if(w.set(Ie-1,Je,w.get(Je,Je)),w.set(Je,Je,1),ze=Q[Je+1],ze!==0){for(xt=0;xt<=Je;xt++)Q[xt]=w.get(xt,Je+1)/ze;for(At=0;At<=Je;At++){for(ie=0,xt=0;xt<=Je;xt++)ie+=w.get(xt,Je+1)*w.get(xt,At);for(xt=0;xt<=Je;xt++)w.set(xt,At,w.get(xt,At)-ie*Q[xt])}}for(xt=0;xt<=Je;xt++)w.set(xt,Je+1,0)}for(At=0;At<Ie;At++)Q[At]=w.get(Ie-1,At),w.set(Ie-1,At,0);w.set(Ie-1,Ie-1,1),L[0]=0}function bn(Ie,L,Q,w){let z,ie,ze,Je,At,xt,Sn,Oe,Qe,Re,Ke,gt,tn,yt,Yt,Rn;for(ze=1;ze<Ie;ze++)L[ze-1]=L[ze];L[Ie-1]=0;let er=0,Jn=0,kr=Number.EPSILON;for(xt=0;xt<Ie;xt++){for(Jn=Math.max(Jn,Math.abs(Q[xt])+Math.abs(L[xt])),Sn=xt;Sn<Ie&&!(Math.abs(L[Sn])<=kr*Jn);)Sn++;if(Sn>xt)do{for(z=Q[xt],Oe=(Q[xt+1]-z)/(2*L[xt]),Qe=Jr(Oe,1),Oe<0&&(Qe=-Qe),Q[xt]=L[xt]/(Oe+Qe),Q[xt+1]=L[xt]*(Oe+Qe),Re=Q[xt+1],ie=z-Q[xt],ze=xt+2;ze<Ie;ze++)Q[ze]-=ie;for(er=er+ie,Oe=Q[Sn],Ke=1,gt=Ke,tn=Ke,yt=L[xt+1],Yt=0,Rn=0,ze=Sn-1;ze>=xt;ze--)for(tn=gt,gt=Ke,Rn=Yt,z=Ke*L[ze],ie=Ke*Oe,Qe=Jr(Oe,L[ze]),L[ze+1]=Yt*Qe,Yt=L[ze]/Qe,Ke=Oe/Qe,Oe=Ke*Q[ze]-Yt*z,Q[ze+1]=ie+Yt*(Ke*z+Yt*Q[ze]),At=0;At<Ie;At++)ie=w.get(At,ze+1),w.set(At,ze+1,Yt*w.get(At,ze)+Ke*ie),w.set(At,ze,Ke*w.get(At,ze)-Yt*ie);Oe=-Yt*Rn*tn*yt*L[xt]/Re,L[xt]=Yt*Oe,Q[xt]=Ke*Oe}while(Math.abs(L[xt])>kr*Jn);Q[xt]=Q[xt]+er,L[xt]=0}for(ze=0;ze<Ie-1;ze++){for(At=ze,Oe=Q[ze],Je=ze+1;Je<Ie;Je++)Q[Je]<Oe&&(At=Je,Oe=Q[Je]);if(At!==ze)for(Q[At]=Q[ze],Q[ze]=Oe,Je=0;Je<Ie;Je++)Oe=w.get(Je,ze),w.set(Je,ze,w.get(Je,At)),w.set(Je,At,Oe)}}function Jt(Ie,L,Q,w){let z=0,ie=Ie-1,ze,Je,At,xt,Sn,Oe,Qe;for(Oe=z+1;Oe<=ie-1;Oe++){for(Qe=0,xt=Oe;xt<=ie;xt++)Qe=Qe+Math.abs(L.get(xt,Oe-1));if(Qe!==0){for(At=0,xt=ie;xt>=Oe;xt--)Q[xt]=L.get(xt,Oe-1)/Qe,At+=Q[xt]*Q[xt];for(Je=Math.sqrt(At),Q[Oe]>0&&(Je=-Je),At=At-Q[Oe]*Je,Q[Oe]=Q[Oe]-Je,Sn=Oe;Sn<Ie;Sn++){for(ze=0,xt=ie;xt>=Oe;xt--)ze+=Q[xt]*L.get(xt,Sn);for(ze=ze/At,xt=Oe;xt<=ie;xt++)L.set(xt,Sn,L.get(xt,Sn)-ze*Q[xt])}for(xt=0;xt<=ie;xt++){for(ze=0,Sn=ie;Sn>=Oe;Sn--)ze+=Q[Sn]*L.get(xt,Sn);for(ze=ze/At,Sn=Oe;Sn<=ie;Sn++)L.set(xt,Sn,L.get(xt,Sn)-ze*Q[Sn])}Q[Oe]=Qe*Q[Oe],L.set(Oe,Oe-1,Qe*Je)}}for(xt=0;xt<Ie;xt++)for(Sn=0;Sn<Ie;Sn++)w.set(xt,Sn,xt===Sn?1:0);for(Oe=ie-1;Oe>=z+1;Oe--)if(L.get(Oe,Oe-1)!==0){for(xt=Oe+1;xt<=ie;xt++)Q[xt]=L.get(xt,Oe-1);for(Sn=Oe;Sn<=ie;Sn++){for(Je=0,xt=Oe;xt<=ie;xt++)Je+=Q[xt]*w.get(xt,Sn);for(Je=Je/Q[Oe]/L.get(Oe,Oe-1),xt=Oe;xt<=ie;xt++)w.set(xt,Sn,w.get(xt,Sn)+Je*Q[xt])}}}function ar(Ie,L,Q,w,z){let ie=Ie-1,ze=0,Je=Ie-1,At=Number.EPSILON,xt=0,Sn=0,Oe=0,Qe=0,Re=0,Ke=0,gt=0,tn=0,yt,Yt,Rn,er,Jn,kr,fr,wr,ei,_n,jn,Hr,Pr,$i,Zi;for(yt=0;yt<Ie;yt++)for((yt<ze||yt>Je)&&(Q[yt]=z.get(yt,yt),L[yt]=0),Yt=Math.max(yt-1,0);Yt<Ie;Yt++)Sn=Sn+Math.abs(z.get(yt,Yt));for(;ie>=ze;){for(er=ie;er>ze&&(Ke=Math.abs(z.get(er-1,er-1))+Math.abs(z.get(er,er)),Ke===0&&(Ke=Sn),!(Math.abs(z.get(er,er-1))<At*Ke));)er--;if(er===ie)z.set(ie,ie,z.get(ie,ie)+xt),Q[ie]=z.get(ie,ie),L[ie]=0,ie--,tn=0;else if(er===ie-1){if(fr=z.get(ie,ie-1)*z.get(ie-1,ie),Oe=(z.get(ie-1,ie-1)-z.get(ie,ie))/2,Qe=Oe*Oe+fr,gt=Math.sqrt(Math.abs(Qe)),z.set(ie,ie,z.get(ie,ie)+xt),z.set(ie-1,ie-1,z.get(ie-1,ie-1)+xt),wr=z.get(ie,ie),Qe>=0){for(gt=Oe>=0?Oe+gt:Oe-gt,Q[ie-1]=wr+gt,Q[ie]=Q[ie-1],gt!==0&&(Q[ie]=wr-fr/gt),L[ie-1]=0,L[ie]=0,wr=z.get(ie,ie-1),Ke=Math.abs(wr)+Math.abs(gt),Oe=wr/Ke,Qe=gt/Ke,Re=Math.sqrt(Oe*Oe+Qe*Qe),Oe=Oe/Re,Qe=Qe/Re,Yt=ie-1;Yt<Ie;Yt++)gt=z.get(ie-1,Yt),z.set(ie-1,Yt,Qe*gt+Oe*z.get(ie,Yt)),z.set(ie,Yt,Qe*z.get(ie,Yt)-Oe*gt);for(yt=0;yt<=ie;yt++)gt=z.get(yt,ie-1),z.set(yt,ie-1,Qe*gt+Oe*z.get(yt,ie)),z.set(yt,ie,Qe*z.get(yt,ie)-Oe*gt);for(yt=ze;yt<=Je;yt++)gt=w.get(yt,ie-1),w.set(yt,ie-1,Qe*gt+Oe*w.get(yt,ie)),w.set(yt,ie,Qe*w.get(yt,ie)-Oe*gt)}else Q[ie-1]=wr+Oe,Q[ie]=wr+Oe,L[ie-1]=gt,L[ie]=-gt;ie=ie-2,tn=0}else{if(wr=z.get(ie,ie),ei=0,fr=0,er<ie&&(ei=z.get(ie-1,ie-1),fr=z.get(ie,ie-1)*z.get(ie-1,ie)),tn===10){for(xt+=wr,yt=ze;yt<=ie;yt++)z.set(yt,yt,z.get(yt,yt)-wr);Ke=Math.abs(z.get(ie,ie-1))+Math.abs(z.get(ie-1,ie-2)),wr=ei=.75*Ke,fr=-.4375*Ke*Ke}if(tn===30&&(Ke=(ei-wr)/2,Ke=Ke*Ke+fr,Ke>0)){for(Ke=Math.sqrt(Ke),ei<wr&&(Ke=-Ke),Ke=wr-fr/((ei-wr)/2+Ke),yt=ze;yt<=ie;yt++)z.set(yt,yt,z.get(yt,yt)-Ke);xt+=Ke,wr=ei=fr=.964}for(tn=tn+1,Jn=ie-2;Jn>=er&&(gt=z.get(Jn,Jn),Re=wr-gt,Ke=ei-gt,Oe=(Re*Ke-fr)/z.get(Jn+1,Jn)+z.get(Jn,Jn+1),Qe=z.get(Jn+1,Jn+1)-gt-Re-Ke,Re=z.get(Jn+2,Jn+1),Ke=Math.abs(Oe)+Math.abs(Qe)+Math.abs(Re),Oe=Oe/Ke,Qe=Qe/Ke,Re=Re/Ke,!(Jn===er||Math.abs(z.get(Jn,Jn-1))*(Math.abs(Qe)+Math.abs(Re))<At*(Math.abs(Oe)*(Math.abs(z.get(Jn-1,Jn-1))+Math.abs(gt)+Math.abs(z.get(Jn+1,Jn+1))))));)Jn--;for(yt=Jn+2;yt<=ie;yt++)z.set(yt,yt-2,0),yt>Jn+2&&z.set(yt,yt-3,0);for(Rn=Jn;Rn<=ie-1&&($i=Rn!==ie-1,Rn!==Jn&&(Oe=z.get(Rn,Rn-1),Qe=z.get(Rn+1,Rn-1),Re=$i?z.get(Rn+2,Rn-1):0,wr=Math.abs(Oe)+Math.abs(Qe)+Math.abs(Re),wr!==0&&(Oe=Oe/wr,Qe=Qe/wr,Re=Re/wr)),wr!==0);Rn++)if(Ke=Math.sqrt(Oe*Oe+Qe*Qe+Re*Re),Oe<0&&(Ke=-Ke),Ke!==0){for(Rn!==Jn?z.set(Rn,Rn-1,-Ke*wr):er!==Jn&&z.set(Rn,Rn-1,-z.get(Rn,Rn-1)),Oe=Oe+Ke,wr=Oe/Ke,ei=Qe/Ke,gt=Re/Ke,Qe=Qe/Oe,Re=Re/Oe,Yt=Rn;Yt<Ie;Yt++)Oe=z.get(Rn,Yt)+Qe*z.get(Rn+1,Yt),$i&&(Oe=Oe+Re*z.get(Rn+2,Yt),z.set(Rn+2,Yt,z.get(Rn+2,Yt)-Oe*gt)),z.set(Rn,Yt,z.get(Rn,Yt)-Oe*wr),z.set(Rn+1,Yt,z.get(Rn+1,Yt)-Oe*ei);for(yt=0;yt<=Math.min(ie,Rn+3);yt++)Oe=wr*z.get(yt,Rn)+ei*z.get(yt,Rn+1),$i&&(Oe=Oe+gt*z.get(yt,Rn+2),z.set(yt,Rn+2,z.get(yt,Rn+2)-Oe*Re)),z.set(yt,Rn,z.get(yt,Rn)-Oe),z.set(yt,Rn+1,z.get(yt,Rn+1)-Oe*Qe);for(yt=ze;yt<=Je;yt++)Oe=wr*w.get(yt,Rn)+ei*w.get(yt,Rn+1),$i&&(Oe=Oe+gt*w.get(yt,Rn+2),w.set(yt,Rn+2,w.get(yt,Rn+2)-Oe*Re)),w.set(yt,Rn,w.get(yt,Rn)-Oe),w.set(yt,Rn+1,w.get(yt,Rn+1)-Oe*Qe)}}}if(Sn!==0){for(ie=Ie-1;ie>=0;ie--)if(Oe=Q[ie],Qe=L[ie],Qe===0)for(er=ie,z.set(ie,ie,1),yt=ie-1;yt>=0;yt--){for(fr=z.get(yt,yt)-Oe,Re=0,Yt=er;Yt<=ie;Yt++)Re=Re+z.get(yt,Yt)*z.get(Yt,ie);if(L[yt]<0)gt=fr,Ke=Re;else if(er=yt,L[yt]===0?z.set(yt,ie,fr!==0?-Re/fr:-Re/(At*Sn)):(wr=z.get(yt,yt+1),ei=z.get(yt+1,yt),Qe=(Q[yt]-Oe)*(Q[yt]-Oe)+L[yt]*L[yt],kr=(wr*Ke-gt*Re)/Qe,z.set(yt,ie,kr),z.set(yt+1,ie,Math.abs(wr)>Math.abs(gt)?(-Re-fr*kr)/wr:(-Ke-ei*kr)/gt)),kr=Math.abs(z.get(yt,ie)),At*kr*kr>1)for(Yt=yt;Yt<=ie;Yt++)z.set(Yt,ie,z.get(Yt,ie)/kr)}else if(Qe<0)for(er=ie-1,Math.abs(z.get(ie,ie-1))>Math.abs(z.get(ie-1,ie))?(z.set(ie-1,ie-1,Qe/z.get(ie,ie-1)),z.set(ie-1,ie,-(z.get(ie,ie)-Oe)/z.get(ie,ie-1))):(Zi=rr(0,-z.get(ie-1,ie),z.get(ie-1,ie-1)-Oe,Qe),z.set(ie-1,ie-1,Zi[0]),z.set(ie-1,ie,Zi[1])),z.set(ie,ie-1,0),z.set(ie,ie,1),yt=ie-2;yt>=0;yt--){for(_n=0,jn=0,Yt=er;Yt<=ie;Yt++)_n=_n+z.get(yt,Yt)*z.get(Yt,ie-1),jn=jn+z.get(yt,Yt)*z.get(Yt,ie);if(fr=z.get(yt,yt)-Oe,L[yt]<0)gt=fr,Re=_n,Ke=jn;else if(er=yt,L[yt]===0?(Zi=rr(-_n,-jn,fr,Qe),z.set(yt,ie-1,Zi[0]),z.set(yt,ie,Zi[1])):(wr=z.get(yt,yt+1),ei=z.get(yt+1,yt),Hr=(Q[yt]-Oe)*(Q[yt]-Oe)+L[yt]*L[yt]-Qe*Qe,Pr=(Q[yt]-Oe)*2*Qe,Hr===0&&Pr===0&&(Hr=At*Sn*(Math.abs(fr)+Math.abs(Qe)+Math.abs(wr)+Math.abs(ei)+Math.abs(gt))),Zi=rr(wr*Re-gt*_n+Qe*jn,wr*Ke-gt*jn-Qe*_n,Hr,Pr),z.set(yt,ie-1,Zi[0]),z.set(yt,ie,Zi[1]),Math.abs(wr)>Math.abs(gt)+Math.abs(Qe)?(z.set(yt+1,ie-1,(-_n-fr*z.get(yt,ie-1)+Qe*z.get(yt,ie))/wr),z.set(yt+1,ie,(-jn-fr*z.get(yt,ie)-Qe*z.get(yt,ie-1))/wr)):(Zi=rr(-Re-ei*z.get(yt,ie-1),-Ke-ei*z.get(yt,ie),gt,Qe),z.set(yt+1,ie-1,Zi[0]),z.set(yt+1,ie,Zi[1]))),kr=Math.max(Math.abs(z.get(yt,ie-1)),Math.abs(z.get(yt,ie))),At*kr*kr>1)for(Yt=yt;Yt<=ie;Yt++)z.set(Yt,ie-1,z.get(Yt,ie-1)/kr),z.set(Yt,ie,z.get(Yt,ie)/kr)}for(yt=0;yt<Ie;yt++)if(yt<ze||yt>Je)for(Yt=yt;Yt<Ie;Yt++)w.set(yt,Yt,z.get(yt,Yt));for(Yt=Ie-1;Yt>=ze;Yt--)for(yt=ze;yt<=Je;yt++){for(gt=0,Rn=ze;Rn<=Math.min(Yt,Je);Rn++)gt=gt+w.get(yt,Rn)*z.get(Rn,Yt);w.set(yt,Yt,gt)}}}function rr(Ie,L,Q,w){let z,ie;return Math.abs(Q)>Math.abs(w)?(z=w/Q,ie=Q+z*w,[(Ie+z*L)/ie,(L-z*Ie)/ie]):(z=Q/w,ie=w+z*Q,[(z*Ie+L)/ie,(z*L-Ie)/ie])}class Kr{constructor(L){if(L=Yn.checkMatrix(L),!L.isSymmetric())throw new Error("Matrix is not symmetric");let Q=L,w=Q.rows,z=new zt(w,w),ie=!0,ze,Je,At;for(Je=0;Je<w;Je++){let xt=0;for(At=0;At<Je;At++){let Sn=0;for(ze=0;ze<At;ze++)Sn+=z.get(At,ze)*z.get(Je,ze);Sn=(Q.get(Je,At)-Sn)/z.get(At,At),z.set(Je,At,Sn),xt=xt+Sn*Sn}for(xt=Q.get(Je,Je)-xt,ie&&(ie=xt>0),z.set(Je,Je,Math.sqrt(Math.max(xt,0))),At=Je+1;At<w;At++)z.set(Je,At,0)}this.L=z,this.positiveDefinite=ie}isPositiveDefinite(){return this.positiveDefinite}solve(L){L=Yn.checkMatrix(L);let Q=this.L,w=Q.rows;if(L.rows!==w)throw new Error("Matrix dimensions do not match");if(this.isPositiveDefinite()===!1)throw new Error("Matrix is not positive definite");let z=L.columns,ie=L.clone(),ze,Je,At;for(At=0;At<w;At++)for(Je=0;Je<z;Je++){for(ze=0;ze<At;ze++)ie.set(At,Je,ie.get(At,Je)-ie.get(ze,Je)*Q.get(At,ze));ie.set(At,Je,ie.get(At,Je)/Q.get(At,At))}for(At=w-1;At>=0;At--)for(Je=0;Je<z;Je++){for(ze=At+1;ze<w;ze++)ie.set(At,Je,ie.get(At,Je)-ie.get(ze,Je)*Q.get(ze,At));ie.set(At,Je,ie.get(At,Je)/Q.get(At,At))}return ie}get lowerTriangularMatrix(){return this.L}}class si{constructor(L,Q={}){L=Yn.checkMatrix(L);let{Y:w}=Q;const{scaleScores:z=!1,maxIterations:ie=1e3,terminationCriteria:ze=1e-10}=Q;let Je;if(w){if(we.isAnyArray(w)&&typeof w[0]=="number"?w=zt.columnVector(w):w=Yn.checkMatrix(w),w.rows!==L.rows)throw new Error("Y should have the same number of rows as X");Je=w.getColumnVector(0)}else Je=L.getColumnVector(0);let At=1,xt,Sn,Oe,Qe;for(let Re=0;Re<ie&&At>ze;Re++)Oe=L.transpose().mmul(Je).div(Je.transpose().mmul(Je).get(0,0)),Oe=Oe.div(Oe.norm()),xt=L.mmul(Oe).div(Oe.transpose().mmul(Oe).get(0,0)),Re>0&&(At=xt.clone().sub(Qe).pow(2).sum()),Qe=xt.clone(),w?(Sn=w.transpose().mmul(xt).div(xt.transpose().mmul(xt).get(0,0)),Sn=Sn.div(Sn.norm()),Je=w.mmul(Sn).div(Sn.transpose().mmul(Sn).get(0,0))):Je=xt;if(w){let Re=L.transpose().mmul(xt).div(xt.transpose().mmul(xt).get(0,0));Re=Re.div(Re.norm());let Ke=L.clone().sub(xt.clone().mmul(Re.transpose())),gt=Je.transpose().mmul(xt).div(xt.transpose().mmul(xt).get(0,0)),tn=w.clone().sub(xt.clone().mulS(gt.get(0,0)).mmul(Sn.transpose()));this.t=xt,this.p=Re.transpose(),this.w=Oe.transpose(),this.q=Sn,this.u=Je,this.s=xt.transpose().mmul(xt),this.xResidual=Ke,this.yResidual=tn,this.betas=gt}else this.w=Oe.transpose(),this.s=xt.transpose().mmul(xt).sqrt(),z?this.t=xt.clone().div(this.s.get(0,0)):this.t=xt,this.xResidual=L.sub(xt.mmul(Oe.transpose()))}}Me.XA=sn,Me.a_=Kr,Me.yQ=Kr,Me.Hs=lr,Me.Ec=dt,Me.dx=dt,Me.LU=Sr,Me.Rm=Sr,Me.y3=zt,Me.qK=it,Me.pb=be,Me.j=wt,Me.sO=ot,Me.BZ=_t,Me.EK=ut,Me.Db=$t,Me.Fx=Vt,Me.tU=Qt,Me.Ym=si,Me.rs=si,Me.QR=vr,Me.TB=vr,Me.oH=Ki,Me.Sc=Ki,Me.BN=Tn,Me.it=cn,Me.$r=Yn,Me.QM=st,Me.AV=Xt,m=zt,Me.GH=qr,Me.SO=Mi,Me.uZ=En,Me.yU=rn,Me.F1=yi,Me.re=qn},78241:function(Be,Me,b){"use strict";b.d(Me,{default:function(){return Q}});var m=b(94480),Z=b(92310),V=b.n(Z),N=b(77900),E=b(59301),F=b(62892),C=b(32441);function P(w){const[z,ie]=E.useState(w);return E.useEffect(()=>{const ze=setTimeout(()=>{ie(w)},w.length?0:10);return()=>{clearTimeout(ze)}},[w]),z}var H=b(17313),D=b(29878),X=b(8378),j=b(37613),de=b(83116),we=w=>{const{componentCls:z}=w,ie=`${z}-show-help`,ze=`${z}-show-help-item`;return{[ie]:{transition:`opacity ${w.motionDurationSlow} ${w.motionEaseInOut}`,"&-appear, &-enter":{opacity:0,"&-active":{opacity:1}},"&-leave":{opacity:1,"&-active":{opacity:0}},[ze]:{overflow:"hidden",transition:`height ${w.motionDurationSlow} ${w.motionEaseInOut},
opacity ${w.motionDurationSlow} ${w.motionEaseInOut},
transform ${w.motionDurationSlow} ${w.motionEaseInOut} !important`,[`&${ze}-appear, &${ze}-enter`]:{transform:"translateY(-5px)",opacity:0,"&-active":{transform:"translateY(0)",opacity:1}},[`&${ze}-leave-active`]:{transform:"translateY(-5px)"}}}}};const ve=w=>({legend:{display:"block",width:"100%",marginBottom:w.marginLG,padding:0,color:w.colorTextDescription,fontSize:w.fontSizeLG,lineHeight:"inherit",border:0,borderBottom:`${w.lineWidth}px ${w.lineType} ${w.colorBorder}`},label:{fontSize:w.fontSize},'input[type="search"]':{boxSizing:"border-box"},'input[type="radio"], input[type="checkbox"]':{lineHeight:"normal"},'input[type="file"]':{display:"block"},'input[type="range"]':{display:"block",width:"100%"},"select[multiple], select[size]":{height:"auto"},"input[type='file']:focus,\n input[type='radio']:focus,\n input[type='checkbox']:focus":{outline:0,boxShadow:`0 0 0 ${w.controlOutlineWidth}px ${w.controlOutline}`},output:{display:"block",paddingTop:15,color:w.colorText,fontSize:w.fontSize,lineHeight:w.lineHeight}}),Ee=(w,z)=>{const{formItemCls:ie}=w;return{[ie]:{[`${ie}-label > label`]:{height:z},[`${ie}-control-input`]:{minHeight:z}}}},$e=w=>{const{componentCls:z}=w;return{[w.componentCls]:Object.assign(Object.assign(Object.assign({},(0,H.Wf)(w)),ve(w)),{[`${z}-text`]:{display:"inline-block",paddingInlineEnd:w.paddingSM},"&-small":Object.assign({},Ee(w,w.controlHeightSM)),"&-large":Object.assign({},Ee(w,w.controlHeightLG))})}},Fe=w=>{const{formItemCls:z,iconCls:ie,componentCls:ze,rootPrefixCls:Je,labelRequiredMarkColor:At,labelColor:xt,labelFontSize:Sn,labelHeight:Oe,labelColonMarginInlineStart:Qe,labelColonMarginInlineEnd:Re,itemMarginBottom:Ke}=w;return{[z]:Object.assign(Object.assign({},(0,H.Wf)(w)),{marginBottom:Ke,verticalAlign:"top","&-with-help":{transition:"none"},[`&-hidden,
&-hidden.${Je}-row`]:{display:"none"},"&-has-warning":{[`${z}-split`]:{color:w.colorError}},"&-has-error":{[`${z}-split`]:{color:w.colorWarning}},[`${z}-label`]:{flexGrow:0,overflow:"hidden",whiteSpace:"nowrap",textAlign:"end",verticalAlign:"middle","&-left":{textAlign:"start"},"&-wrap":{overflow:"unset",lineHeight:`${w.lineHeight} - 0.25em`,whiteSpace:"unset"},"> label":{position:"relative",display:"inline-flex",alignItems:"center",maxWidth:"100%",height:Oe,color:xt,fontSize:Sn,[`> ${ie}`]:{fontSize:w.fontSize,verticalAlign:"top"},[`&${z}-required:not(${z}-required-mark-optional)::before`]:{display:"inline-block",marginInlineEnd:w.marginXXS,color:At,fontSize:w.fontSize,fontFamily:"SimSun, sans-serif",lineHeight:1,content:'"*"',[`${ze}-hide-required-mark &`]:{display:"none"}},[`${z}-optional`]:{display:"inline-block",marginInlineStart:w.marginXXS,color:w.colorTextDescription,[`${ze}-hide-required-mark &`]:{display:"none"}},[`${z}-tooltip`]:{color:w.colorTextDescription,cursor:"help",writingMode:"horizontal-tb",marginInlineStart:w.marginXXS},"&::after":{content:'":"',position:"relative",marginBlock:0,marginInlineStart:Qe,marginInlineEnd:Re},[`&${z}-no-colon::after`]:{content:'"\\a0"'}}},[`${z}-control`]:{"--ant-display":"flex",flexDirection:"column",flexGrow:1,[`&:first-child:not([class^="'${Je}-col-'"]):not([class*="' ${Je}-col-'"])`]:{width:"100%"},"&-input":{position:"relative",display:"flex",alignItems:"center",minHeight:w.controlHeight,"&-content":{flex:"auto",maxWidth:"100%"}}},[z]:{"&-explain, &-extra":{clear:"both",color:w.colorTextDescription,fontSize:w.fontSize,lineHeight:w.lineHeight},"&-explain-connected":{width:"100%"},"&-extra":{minHeight:w.controlHeightSM,transition:`color ${w.motionDurationMid} ${w.motionEaseOut}`},"&-explain":{"&-error":{color:w.colorError},"&-warning":{color:w.colorWarning}}},[`&-with-help ${z}-explain`]:{height:"auto",opacity:1},[`${z}-feedback-icon`]:{fontSize:w.fontSize,textAlign:"center",visibility:"visible",animationName:D.kr,animationDuration:w.motionDurationMid,animationTimingFunction:w.motionEaseOutBack,pointerEvents:"none","&-success":{color:w.colorSuccess},"&-error":{color:w.colorError},"&-warning":{color:w.colorWarning},"&-validating":{color:w.colorPrimary}}})}},ct=w=>{const{componentCls:z,formItemCls:ie}=w;return{[`${z}-horizontal`]:{[`${ie}-label`]:{flexGrow:0},[`${ie}-control`]:{flex:"1 1 0",minWidth:0},[`${ie}-label[class$='-24'], ${ie}-label[class*='-24 ']`]:{[`& + ${ie}-control`]:{minWidth:"unset"}}}}},vt=w=>{const{componentCls:z,formItemCls:ie}=w;return{[`${z}-inline`]:{display:"flex",flexWrap:"wrap",[ie]:{flex:"none",marginInlineEnd:w.margin,marginBottom:0,"&-row":{flexWrap:"nowrap"},[`> ${ie}-label,
> ${ie}-control`]:{display:"inline-block",verticalAlign:"top"},[`> ${ie}-label`]:{flex:"none"},[`${z}-text`]:{display:"inline-block"},[`${ie}-has-feedback`]:{display:"inline-block"}}}}},at=w=>({padding:w.verticalLabelPadding,margin:w.verticalLabelMargin,whiteSpace:"initial",textAlign:"start","> label":{margin:0,"&::after":{visibility:"hidden"}}}),kt=w=>{const{componentCls:z,formItemCls:ie,rootPrefixCls:ze}=w;return{[`${ie} ${ie}-label`]:at(w),[z]:{[ie]:{flexWrap:"wrap",[`${ie}-label, ${ie}-control`]:{[`&:not([class*=" ${ze}-col-xs"])`]:{flex:"0 0 100%",maxWidth:"100%"}}}}}},It=w=>{const{componentCls:z,formItemCls:ie,rootPrefixCls:ze}=w;return{[`${z}-vertical`]:{[ie]:{"&-row":{flexDirection:"column"},"&-label > label":{height:"auto"},[`${z}-item-control`]:{width:"100%"}}},[`${z}-vertical ${ie}-label,
.${ze}-col-24${ie}-label,
.${ze}-col-xl-24${ie}-label`]:at(w),[`@media (max-width: ${w.screenXSMax}px)`]:[kt(w),{[z]:{[`.${ze}-col-xs-24${ie}-label`]:at(w)}}],[`@media (max-width: ${w.screenSMMax}px)`]:{[z]:{[`.${ze}-col-sm-24${ie}-label`]:at(w)}},[`@media (max-width: ${w.screenMDMax}px)`]:{[z]:{[`.${ze}-col-md-24${ie}-label`]:at(w)}},[`@media (max-width: ${w.screenLGMax}px)`]:{[z]:{[`.${ze}-col-lg-24${ie}-label`]:at(w)}}}},Bn=(w,z)=>(0,j.TS)(w,{formItemCls:`${w.componentCls}-item`,rootPrefixCls:z});var Lt=(0,de.Z)("Form",(w,z)=>{let{rootPrefixCls:ie}=z;const ze=Bn(w,ie);return[$e(ze),Fe(ze),we(ze),ct(ze),vt(ze),It(ze),(0,X.Z)(ze),D.kr]},w=>({labelRequiredMarkColor:w.colorError,labelColor:w.colorTextHeading,labelFontSize:w.fontSize,labelHeight:w.controlHeight,labelColonMarginInlineStart:w.marginXXS/2,labelColonMarginInlineEnd:w.marginXS,itemMarginBottom:w.marginLG,verticalLabelPadding:`0 0 ${w.paddingXS}px`,verticalLabelMargin:0}),{order:-1e3});const Wn=[];function Xn(w,z,ie){let ze=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0;return{key:typeof w=="string"?w:`${z}-${ze}`,error:w,errorStatus:ie}}var zn=w=>{let{help:z,helpStatus:ie,errors:ze=Wn,warnings:Je=Wn,className:At,fieldId:xt,onVisibleChanged:Sn}=w;const{prefixCls:Oe}=E.useContext(C.Rk),Qe=`${Oe}-item-explain`,[,Re]=Lt(Oe),Ke=(0,E.useMemo)(()=>(0,F.Z)(Oe),[Oe]),gt=P(ze),tn=P(Je),yt=E.useMemo(()=>z!=null?[Xn(z,"help",ie)]:[].concat((0,m.Z)(gt.map((Rn,er)=>Xn(Rn,"error","error",er))),(0,m.Z)(tn.map((Rn,er)=>Xn(Rn,"warning","warning",er)))),[z,ie,gt,tn]),Yt={};return xt&&(Yt.id=`${xt}_help`),E.createElement(N.default,{motionDeadline:Ke.motionDeadline,motionName:`${Oe}-show-help`,visible:!!yt.length,onVisibleChanged:Sn},Rn=>{const{className:er,style:Jn}=Rn;return E.createElement("div",Object.assign({},Yt,{className:V()(Qe,er,At,Re),style:Jn,role:"alert"}),E.createElement(N.CSSMotionList,Object.assign({keys:yt},(0,F.Z)(Oe),{motionName:`${Oe}-show-help-item`,component:!1}),kr=>{const{key:fr,error:wr,errorStatus:ei,className:_n,style:jn}=kr;return E.createElement("div",{key:fr,className:V()(_n,{[`${Qe}-${ei}`]:ei}),style:jn},wr)}))})},dr=b(95013),vn=b(36355),_r=b(1684),Ge=b(52946),Tt=b(19716),On=b(16722);const Vr=["parentNode"],en="form_item";function ln(w){return w===void 0||w===!1?[]:Array.isArray(w)?w:[w]}function Cn(w,z){if(!w.length)return;const ie=w.join("_");return z?`${z}_${ie}`:Vr.includes(ie)?`${en}_${ie}`:ie}function Mt(w,z,ie,ze,Je,At){let xt=ze;return At!==void 0?xt=At:ie.validating?xt="validating":w.length?xt="error":z.length?xt="warning":(ie.touched||Je&&ie.validated)&&(xt="success"),xt}function Et(w){return ln(w).join("_")}function pe(w){const[z]=(0,dr.useForm)(),ie=E.useRef({}),ze=E.useMemo(()=>w!=null?w:Object.assign(Object.assign({},z),{__INTERNAL__:{itemRef:Je=>At=>{const xt=Et(Je);At?ie.current[xt]=At:delete ie.current[xt]}},scrollToField:function(Je){let At=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const xt=ln(Je),Sn=Cn(xt,ze.__INTERNAL__.name),Oe=Sn?document.getElementById(Sn):null;Oe&&(0,On.Z)(Oe,Object.assign({scrollMode:"if-needed",block:"nearest"},At))},getFieldInstance:Je=>{const At=Et(Je);return ie.current[At]}}),[w,z]);return[ze]}var Ae=b(28726),Pe=function(w,z){var ie={};for(var ze in w)Object.prototype.hasOwnProperty.call(w,ze)&&z.indexOf(ze)<0&&(ie[ze]=w[ze]);if(w!=null&&typeof Object.getOwnPropertySymbols=="function")for(var Je=0,ze=Object.getOwnPropertySymbols(w);Je<ze.length;Je++)z.indexOf(ze[Je])<0&&Object.prototype.propertyIsEnumerable.call(w,ze[Je])&&(ie[ze[Je]]=w[ze[Je]]);return ie};const Ut=(w,z)=>{const ie=E.useContext(_r.Z),{getPrefixCls:ze,direction:Je,form:At}=E.useContext(vn.E_),{prefixCls:xt,className:Sn,rootClassName:Oe,size:Qe,disabled:Re=ie,form:Ke,colon:gt,labelAlign:tn,labelWrap:yt,labelCol:Yt,wrapperCol:Rn,hideRequiredMark:er,layout:Jn="horizontal",scrollToFirstError:kr,requiredMark:fr,onFinishFailed:wr,name:ei,style:_n,feedbackIcons:jn}=w,Hr=Pe(w,["prefixCls","className","rootClassName","size","disabled","form","colon","labelAlign","labelWrap","labelCol","wrapperCol","hideRequiredMark","layout","scrollToFirstError","requiredMark","onFinishFailed","name","style","feedbackIcons"]),Pr=(0,Tt.Z)(Qe),$i=E.useContext(Ae.Z),Zi=(0,E.useMemo)(()=>fr!==void 0?fr:At&&At.requiredMark!==void 0?At.requiredMark:!er,[er,fr,At]),Xi=gt!=null?gt:At==null?void 0:At.colon,Ei=ze("form",xt),[ms,_i]=Lt(Ei),Es=V()(Ei,`${Ei}-${Jn}`,{[`${Ei}-hide-required-mark`]:Zi===!1,[`${Ei}-rtl`]:Je==="rtl",[`${Ei}-${Pr}`]:Pr},_i,At==null?void 0:At.className,Sn,Oe),[ua]=pe(Ke),{__INTERNAL__:Hn}=ua;Hn.name=ei;const Pt=(0,E.useMemo)(()=>({name:ei,labelAlign:tn,labelCol:Yt,labelWrap:yt,wrapperCol:Rn,vertical:Jn==="vertical",colon:Xi,requiredMark:Zi,itemRef:Hn.itemRef,form:ua,feedbackIcons:jn}),[ei,tn,Yt,Rn,Jn,Xi,Zi,ua,jn]);E.useImperativeHandle(z,()=>ua);const Gt=(yn,Ln)=>{if(yn){let gr={block:"nearest"};typeof yn=="object"&&(gr=yn),ua.scrollToField(Ln,gr)}},Bt=yn=>{if(wr==null||wr(yn),yn.errorFields.length){const Ln=yn.errorFields[0].name;if(kr!==void 0){Gt(kr,Ln);return}At&&At.scrollToFirstError!==void 0&&Gt(At.scrollToFirstError,Ln)}};return ms(E.createElement(_r.n,{disabled:Re},E.createElement(Ge.q,{size:Pr},E.createElement(C.RV,Object.assign({},{validateMessages:$i}),E.createElement(C.q3.Provider,{value:Pt},E.createElement(dr.default,Object.assign({id:ei},Hr,{name:ei,onFinishFailed:Bt,form:ua,style:Object.assign(Object.assign({},At==null?void 0:At.style),_n),className:Es})))))))};var ft=E.forwardRef(Ut),on=b(41799),hn=b(8654),lt=b(92343),Ct=b(11592);function sn(w){if(typeof w=="function")return w;const z=(0,Ct.Z)(w);return z.length<=1?z[0]:z}const W=()=>{const{status:w,errors:z=[],warnings:ie=[]}=(0,E.useContext)(C.aM);return{status:w,errors:z,warnings:ie}};W.Context=C.aM;var Se=W,Ht=b(16089);function zt(w){const[z,ie]=E.useState(w),ze=(0,E.useRef)(null),Je=(0,E.useRef)([]),At=(0,E.useRef)(!1);E.useEffect(()=>(At.current=!1,()=>{At.current=!0,Ht.Z.cancel(ze.current),ze.current=null}),[]);function xt(Sn){At.current||(ze.current===null&&(Je.current=[],ze.current=(0,Ht.Z)(()=>{ze.current=null,ie(Oe=>{let Qe=Oe;return Je.current.forEach(Re=>{Qe=Re(Qe)}),Qe})})),Je.current.push(Sn))}return[z,xt]}function Fn(){const{itemRef:w}=E.useContext(C.q3),z=E.useRef({});function ie(ze,Je){const At=Je&&typeof Je=="object"&&Je.ref,xt=ze.join("_");return(z.current.name!==xt||z.current.originRef!==At)&&(z.current.name=xt,z.current.originRef=At,z.current.ref=(0,hn.sQ)(w(ze),At)),z.current.ref}return ie}var Tn=b(29194),lr=b(34280),je=b(2738),be=b(27382),it=b(37028);const wt=w=>{const{formItemCls:z}=w;return{"@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none)":{[`${z}-control`]:{display:"flex"}}}};var ot=(0,de.b)(["Form","item-item"],(w,z)=>{let{rootPrefixCls:ie}=z;const ze=Bn(w,ie);return[wt(ze)]}),_t=w=>{const{prefixCls:z,status:ie,wrapperCol:ze,children:Je,errors:At,warnings:xt,_internalItemRender:Sn,extra:Oe,help:Qe,fieldId:Re,marginBottom:Ke,onErrorVisibleChanged:gt}=w,tn=`${z}-item`,yt=E.useContext(C.q3),Yt=ze||yt.wrapperCol||{},Rn=V()(`${tn}-control`,Yt.className),er=E.useMemo(()=>Object.assign({},yt),[yt]);delete er.labelCol,delete er.wrapperCol;const Jn=E.createElement("div",{className:`${tn}-control-input`},E.createElement("div",{className:`${tn}-control-input-content`},Je)),kr=E.useMemo(()=>({prefixCls:z,status:ie}),[z,ie]),fr=Ke!==null||At.length||xt.length?E.createElement("div",{style:{display:"flex",flexWrap:"nowrap"}},E.createElement(C.Rk.Provider,{value:kr},E.createElement(zn,{fieldId:Re,errors:At,warnings:xt,help:Qe,helpStatus:ie,className:`${tn}-explain-connected`,onVisibleChanged:gt})),!!Ke&&E.createElement("div",{style:{width:0,height:Ke}})):null,wr={};Re&&(wr.id=`${Re}_extra`);const ei=Oe?E.createElement("div",Object.assign({},wr,{className:`${tn}-extra`}),Oe):null,_n=Sn&&Sn.mark==="pro_table_render"&&Sn.render?Sn.render(w,{input:Jn,errorList:fr,extra:ei}):E.createElement(E.Fragment,null,Jn,fr,ei);return E.createElement(C.q3.Provider,{value:er},E.createElement(it.Z,Object.assign({},Yt,{className:Rn}),_n),E.createElement(ot,{prefixCls:z}))},$t=b(61485),Vt=b(31724),Qt=b(9763),cn=b(6848),Yn=function(w,z){var ie={};for(var ze in w)Object.prototype.hasOwnProperty.call(w,ze)&&z.indexOf(ze)<0&&(ie[ze]=w[ze]);if(w!=null&&typeof Object.getOwnPropertySymbols=="function")for(var Je=0,ze=Object.getOwnPropertySymbols(w);Je<ze.length;Je++)z.indexOf(ze[Je])<0&&Object.prototype.propertyIsEnumerable.call(w,ze[Je])&&(ie[ze[Je]]=w[ze[Je]]);return ie};function qn(w){return w?typeof w=="object"&&!E.isValidElement(w)?w:{title:w}:null}var Jr=w=>{let{prefixCls:z,label:ie,htmlFor:ze,labelCol:Je,labelAlign:At,colon:xt,required:Sn,requiredMark:Oe,tooltip:Qe}=w;var Re;const[Ke]=(0,Qt.Z)("Form"),{vertical:gt,labelAlign:tn,labelCol:yt,labelWrap:Yt,colon:Rn}=E.useContext(C.q3);if(!ie)return null;const er=Je||yt||{},Jn=At||tn,kr=`${z}-item-label`,fr=V()(kr,Jn==="left"&&`${kr}-left`,er.className,{[`${kr}-wrap`]:!!Yt});let wr=ie;const ei=xt===!0||Rn!==!1&&xt!==!1;ei&&!gt&&typeof ie=="string"&&ie.trim()!==""&&(wr=ie.replace(/[:|]\s*$/,""));const jn=qn(Qe);if(jn){const{icon:Zi=E.createElement($t.Z,null)}=jn,Xi=Yn(jn,["icon"]),Ei=E.createElement(cn.Z,Object.assign({},Xi),E.cloneElement(Zi,{className:`${z}-item-tooltip`,title:""}));wr=E.createElement(E.Fragment,null,wr,Ei)}const Hr=Oe==="optional",Pr=typeof Oe=="function";Pr?wr=Oe(wr,{required:!!Sn}):Hr&&!Sn&&(wr=E.createElement(E.Fragment,null,wr,E.createElement("span",{className:`${z}-item-optional`,title:""},(Ke==null?void 0:Ke.optional)||((Re=Vt.Z.Form)===null||Re===void 0?void 0:Re.optional))));const $i=V()({[`${z}-item-required`]:Sn,[`${z}-item-required-mark-optional`]:Hr||Pr,[`${z}-item-no-colon`]:!ei});return E.createElement(it.Z,Object.assign({},er,{className:fr}),E.createElement("label",{htmlFor:ze,className:$i,title:typeof ie=="string"?ie:""},wr))},vr=b(29679),Ki=b(19248),Mi=b(96512),yi=b(58617);const qr={success:vr.Z,warning:Mi.Z,error:Ki.Z,validating:yi.Z};function es(w){let{children:z,errors:ie,warnings:ze,hasFeedback:Je,validateStatus:At,prefixCls:xt,meta:Sn,noStyle:Oe}=w;const Qe=`${xt}-item`,{feedbackIcons:Re}=E.useContext(C.q3),Ke=Mt(ie,ze,Sn,null,!!Je,At),{isFormItemInput:gt,status:tn}=E.useContext(C.aM),yt=E.useMemo(()=>{var Yt;let Rn;if(Je){const kr=Je!==!0&&Je.icons||Re,fr=Ke&&((Yt=kr==null?void 0:kr({status:Ke,errors:ie,warnings:ze}))===null||Yt===void 0?void 0:Yt[Ke]),wr=Ke&&qr[Ke];Rn=fr!==!1&&wr?E.createElement("span",{className:V()(`${Qe}-feedback-icon`,`${Qe}-feedback-icon-${Ke}`)},fr||E.createElement(wr,null)):null}let er=!0,Jn=Ke||"";return Oe&&(er=gt,Jn=(Ke!=null?Ke:tn)||""),{status:Jn,errors:ie,warnings:ze,hasFeedback:!!Je,feedbackIcon:Rn,isFormItemInput:er}},[Ke,Je,Oe,gt,tn]);return E.createElement(C.aM.Provider,{value:yt},z)}var Ci=function(w,z){var ie={};for(var ze in w)Object.prototype.hasOwnProperty.call(w,ze)&&z.indexOf(ze)<0&&(ie[ze]=w[ze]);if(w!=null&&typeof Object.getOwnPropertySymbols=="function")for(var Je=0,ze=Object.getOwnPropertySymbols(w);Je<ze.length;Je++)z.indexOf(ze[Je])<0&&Object.prototype.propertyIsEnumerable.call(w,ze[Je])&&(ie[ze[Je]]=w[ze[Je]]);return ie};function En(w){const{prefixCls:z,className:ie,rootClassName:ze,style:Je,help:At,errors:xt,warnings:Sn,validateStatus:Oe,meta:Qe,hasFeedback:Re,hidden:Ke,children:gt,fieldId:tn,required:yt,isRequired:Yt,onSubItemMetaChange:Rn}=w,er=Ci(w,["prefixCls","className","rootClassName","style","help","errors","warnings","validateStatus","meta","hasFeedback","hidden","children","fieldId","required","isRequired","onSubItemMetaChange"]),Jn=`${z}-item`,{requiredMark:kr}=E.useContext(C.q3),fr=E.useRef(null),wr=P(xt),ei=P(Sn),_n=At!=null,jn=!!(_n||xt.length||Sn.length),Hr=!!fr.current&&(0,Tn.Z)(fr.current),[Pr,$i]=E.useState(null);(0,lr.Z)(()=>{if(jn&&fr.current){const _i=getComputedStyle(fr.current);$i(parseInt(_i.marginBottom,10))}},[jn,Hr]);const Zi=_i=>{_i||$i(null)},Ei=function(){let _i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;const Es=_i?wr:Qe.errors,ua=_i?ei:Qe.warnings;return Mt(Es,ua,Qe,"",!!Re,Oe)}(),ms=V()(Jn,ie,ze,{[`${Jn}-with-help`]:_n||wr.length||ei.length,[`${Jn}-has-feedback`]:Ei&&Re,[`${Jn}-has-success`]:Ei==="success",[`${Jn}-has-warning`]:Ei==="warning",[`${Jn}-has-error`]:Ei==="error",[`${Jn}-is-validating`]:Ei==="validating",[`${Jn}-hidden`]:Ke});return E.createElement("div",{className:ms,style:Je,ref:fr},E.createElement(be.Z,Object.assign({className:`${Jn}-row`},(0,je.Z)(er,["_internalItemRender","colon","dependencies","extra","fieldKey","getValueFromEvent","getValueProps","htmlFor","id","initialValue","isListField","label","labelAlign","labelCol","labelWrap","messageVariables","name","normalize","noStyle","preserve","requiredMark","rules","shouldUpdate","trigger","tooltip","validateFirst","validateTrigger","valuePropName","wrapperCol","validateDebounce"])),E.createElement(Jr,Object.assign({htmlFor:tn},w,{requiredMark:kr,required:yt!=null?yt:Yt,prefixCls:z})),E.createElement(_t,Object.assign({},w,Qe,{errors:wr,warnings:ei,prefixCls:z,status:Ei,help:At,marginBottom:Pr,onErrorVisibleChanged:Zi}),E.createElement(C.qI.Provider,{value:Rn},E.createElement(es,{prefixCls:z,meta:Qe,errors:Qe.errors,warnings:Qe.warnings,hasFeedback:Re,validateStatus:Ei},gt)))),!!Pr&&E.createElement("div",{className:`${Jn}-margin-offset`,style:{marginBottom:-Pr}}))}const rn="__SPLIT__",Xt=null,st=E.memo(w=>{let{children:z}=w;return z},(w,z)=>w.value===z.value&&w.update===z.update&&w.childProps.length===z.childProps.length&&w.childProps.every((ie,ze)=>ie===z.childProps[ze]));function dt(w){return w!=null}function Wt(){return{errors:[],warnings:[],touched:!1,validating:!1,name:[],validated:!1}}function bn(w){const{name:z,noStyle:ie,className:ze,dependencies:Je,prefixCls:At,shouldUpdate:xt,rules:Sn,children:Oe,required:Qe,label:Re,messageVariables:Ke,trigger:gt="onChange",validateTrigger:tn,hidden:yt,help:Yt}=w,{getPrefixCls:Rn}=E.useContext(vn.E_),{name:er}=E.useContext(C.q3),Jn=sn(Oe),kr=typeof Jn=="function",fr=E.useContext(C.qI),{validateTrigger:wr}=E.useContext(dr.FieldContext),ei=tn!==void 0?tn:wr,_n=dt(z),jn=Rn("form",At),[Hr,Pr]=Lt(jn),$i=E.useContext(dr.ListContext),Zi=E.useRef(),[Xi,Ei]=zt({}),[ms,_i]=(0,on.Z)(()=>Wt()),Es=Ln=>{const gr=$i==null?void 0:$i.getKey(Ln.name);if(_i(Ln.destroy?Wt():Ln,!0),ie&&Yt!==!1&&fr){let Rr=Ln.name;if(Ln.destroy)Rr=Zi.current||Rr;else if(gr!==void 0){const[$r,Ii]=gr;Rr=[$r].concat((0,m.Z)(Ii)),Zi.current=Rr}fr(Ln,Rr)}},ua=(Ln,gr)=>{Ei(Rr=>{const $r=Object.assign({},Rr),Di=[].concat((0,m.Z)(Ln.name.slice(0,-1)),(0,m.Z)(gr)).join(rn);return Ln.destroy?delete $r[Di]:$r[Di]=Ln,$r})},[Hn,Pt]=E.useMemo(()=>{const Ln=(0,m.Z)(ms.errors),gr=(0,m.Z)(ms.warnings);return Object.values(Xi).forEach(Rr=>{Ln.push.apply(Ln,(0,m.Z)(Rr.errors||[])),gr.push.apply(gr,(0,m.Z)(Rr.warnings||[]))}),[Ln,gr]},[Xi,ms.errors,ms.warnings]),Gt=Fn();function Bt(Ln,gr,Rr){return ie&&!yt?E.createElement(es,{prefixCls:jn,hasFeedback:w.hasFeedback,validateStatus:w.validateStatus,meta:ms,errors:Hn,warnings:Pt,noStyle:!0},Ln):E.createElement(En,Object.assign({key:"row"},w,{className:V()(ze,Pr),prefixCls:jn,fieldId:gr,isRequired:Rr,errors:Hn,warnings:Pt,meta:ms,onSubItemMetaChange:ua}),Ln)}if(!_n&&!kr&&!Je)return Hr(Bt(Jn));let yn={};return typeof Re=="string"?yn.label=Re:z&&(yn.label=String(z)),Ke&&(yn=Object.assign(Object.assign({},yn),Ke)),Hr(E.createElement(dr.Field,Object.assign({},w,{messageVariables:yn,trigger:gt,validateTrigger:ei,onMetaChange:Es}),(Ln,gr,Rr)=>{const $r=ln(z).length&&gr?gr.name:[],Ii=Cn($r,er),Di=Qe!==void 0?Qe:!!(Sn&&Sn.some(Cs=>{if(Cs&&typeof Cs=="object"&&Cs.required&&!Cs.warningOnly)return!0;if(typeof Cs=="function"){const Aa=Cs(Rr);return Aa&&Aa.required&&!Aa.warningOnly}return!1})),ss=Object.assign({},Ln);let vs=null;if(Array.isArray(Jn)&&_n)vs=Jn;else if(!(kr&&(!(xt||Je)||_n))){if(!(Je&&!kr&&!_n))if((0,lt.l$)(Jn)){const Cs=Object.assign(Object.assign({},Jn.props),ss);if(Cs.id||(Cs.id=Ii),Yt||Hn.length>0||Pt.length>0||w.extra){const ca=[];(Yt||Hn.length>0)&&ca.push(`${Ii}_help`),w.extra&&ca.push(`${Ii}_extra`),Cs["aria-describedby"]=ca.join(" ")}Hn.length>0&&(Cs["aria-invalid"]="true"),Di&&(Cs["aria-required"]="true"),(0,hn.Yr)(Jn)&&(Cs.ref=Gt($r,Jn)),new Set([].concat((0,m.Z)(ln(gt)),(0,m.Z)(ln(ei)))).forEach(ca=>{Cs[ca]=function(){for(var Ai,$a,Zo,Ko,$o,bo=arguments.length,Pl=new Array(bo),il=0;il<bo;il++)Pl[il]=arguments[il];(Zo=ss[ca])===null||Zo===void 0||(Ai=Zo).call.apply(Ai,[ss].concat(Pl)),($o=(Ko=Jn.props)[ca])===null||$o===void 0||($a=$o).call.apply($a,[Ko].concat(Pl))}});const sa=[Cs["aria-required"],Cs["aria-invalid"],Cs["aria-describedby"]];vs=E.createElement(st,{value:ss[w.valuePropName||"value"],update:Jn,childProps:sa},(0,lt.Tm)(Jn,Cs))}else kr&&(xt||Je)&&!_n?vs=Jn(Rr):vs=Jn}return Bt(vs,Ii,Di)}))}const Jt=bn;Jt.useStatus=Se;var ar=Jt,rr=function(w,z){var ie={};for(var ze in w)Object.prototype.hasOwnProperty.call(w,ze)&&z.indexOf(ze)<0&&(ie[ze]=w[ze]);if(w!=null&&typeof Object.getOwnPropertySymbols=="function")for(var Je=0,ze=Object.getOwnPropertySymbols(w);Je<ze.length;Je++)z.indexOf(ze[Je])<0&&Object.prototype.propertyIsEnumerable.call(w,ze[Je])&&(ie[ze[Je]]=w[ze[Je]]);return ie},si=w=>{var{prefixCls:z,children:ie}=w,ze=rr(w,["prefixCls","children"]);const{getPrefixCls:Je}=E.useContext(vn.E_),At=Je("form",z),xt=E.useMemo(()=>({prefixCls:At,status:"error"}),[At]);return E.createElement(dr.List,Object.assign({},ze),(Sn,Oe,Qe)=>E.createElement(C.Rk.Provider,{value:xt},ie(Sn.map(Re=>Object.assign(Object.assign({},Re),{fieldKey:Re.key})),Oe,{errors:Qe.errors,warnings:Qe.warnings})))};function Ie(){const{form:w}=(0,E.useContext)(C.q3);return w}const L=ft;L.Item=ar,L.List=si,L.ErrorList=zn,L.useForm=pe,L.useFormInstance=Ie,L.useWatch=dr.useWatch,L.Provider=C.RV,L.create=()=>{};var Q=L},5112:function(Be,Me,b){"use strict";b.d(Me,{ZP:function(){return Vr}});var m=b(92310),Z=b.n(m),V=b(18929),N=b(26112),E=b(59301),F=b(36355),C=b(19716);const P=E.createContext(null),H=P.Provider;var D=P;const X=E.createContext(null),j=X.Provider;var de=b(5630),he=b(8654),we=b(1684),ve=b(32441),Ee=b(17313),$e=b(83116),Fe=b(37613);const ct=en=>{const{componentCls:ln,antCls:Cn}=en,Mt=`${ln}-group`;return{[Mt]:Object.assign(Object.assign({},(0,Ee.Wf)(en)),{display:"inline-block",fontSize:0,[`&${Mt}-rtl`]:{direction:"rtl"},[`${Cn}-badge ${Cn}-badge-count`]:{zIndex:1},[`> ${Cn}-badge:not(:first-child) > ${Cn}-button-wrapper`]:{borderInlineStart:"none"}})}},vt=en=>{const{componentCls:ln,wrapperMarginInlineEnd:Cn,colorPrimary:Mt,radioSize:Et,motionDurationSlow:pe,motionDurationMid:Ae,motionEaseInOutCirc:Pe,colorBgContainer:Ut,colorBorder:jt,lineWidth:ft,dotSize:on,colorBgContainerDisabled:hn,colorTextDisabled:lt,paddingXS:Ct,dotColorDisabled:sn,lineType:W,radioDotDisabledSize:Se,wireframe:Ht,colorWhite:zt}=en,Fn=`${ln}-inner`;return{[`${ln}-wrapper`]:Object.assign(Object.assign({},(0,Ee.Wf)(en)),{display:"inline-flex",alignItems:"baseline",marginInlineStart:0,marginInlineEnd:Cn,cursor:"pointer",[`&${ln}-wrapper-rtl`]:{direction:"rtl"},"&-disabled":{cursor:"not-allowed",color:en.colorTextDisabled},"&::after":{display:"inline-block",width:0,overflow:"hidden",content:'"\\a0"'},[`${ln}-checked::after`]:{position:"absolute",insetBlockStart:0,insetInlineStart:0,width:"100%",height:"100%",border:`${ft}px ${W} ${Mt}`,borderRadius:"50%",visibility:"hidden",content:'""'},[ln]:Object.assign(Object.assign({},(0,Ee.Wf)(en)),{position:"relative",display:"inline-block",outline:"none",cursor:"pointer",alignSelf:"center",borderRadius:"50%"}),[`${ln}-wrapper:hover &,
&:hover ${Fn}`]:{borderColor:Mt},[`${ln}-input:focus-visible + ${Fn}`]:Object.assign({},(0,Ee.oN)(en)),[`${ln}:hover::after, ${ln}-wrapper:hover &::after`]:{visibility:"visible"},[`${ln}-inner`]:{"&::after":{boxSizing:"border-box",position:"absolute",insetBlockStart:"50%",insetInlineStart:"50%",display:"block",width:Et,height:Et,marginBlockStart:Et/-2,marginInlineStart:Et/-2,backgroundColor:Ht?Mt:zt,borderBlockStart:0,borderInlineStart:0,borderRadius:Et,transform:"scale(0)",opacity:0,transition:`all ${pe} ${Pe}`,content:'""'},boxSizing:"border-box",position:"relative",insetBlockStart:0,insetInlineStart:0,display:"block",width:Et,height:Et,backgroundColor:Ut,borderColor:jt,borderStyle:"solid",borderWidth:ft,borderRadius:"50%",transition:`all ${Ae}`},[`${ln}-input`]:{position:"absolute",inset:0,zIndex:1,cursor:"pointer",opacity:0},[`${ln}-checked`]:{[Fn]:{borderColor:Mt,backgroundColor:Ht?Ut:Mt,"&::after":{transform:`scale(${on/Et})`,opacity:1,transition:`all ${pe} ${Pe}`}}},[`${ln}-disabled`]:{cursor:"not-allowed",[Fn]:{backgroundColor:hn,borderColor:jt,cursor:"not-allowed","&::after":{backgroundColor:sn}},[`${ln}-input`]:{cursor:"not-allowed"},[`${ln}-disabled + span`]:{color:lt,cursor:"not-allowed"},[`&${ln}-checked`]:{[Fn]:{"&::after":{transform:`scale(${Se/Et})`}}}},[`span${ln} + *`]:{paddingInlineStart:Ct,paddingInlineEnd:Ct}})}},at=en=>{const{buttonColor:ln,controlHeight:Cn,componentCls:Mt,lineWidth:Et,lineType:pe,colorBorder:Ae,motionDurationSlow:Pe,motionDurationMid:Ut,buttonPaddingInline:jt,fontSize:ft,buttonBg:on,fontSizeLG:hn,controlHeightLG:lt,controlHeightSM:Ct,paddingXS:sn,borderRadius:W,borderRadiusSM:Se,borderRadiusLG:Ht,buttonCheckedBg:zt,buttonSolidCheckedColor:Fn,colorTextDisabled:Tn,colorBgContainerDisabled:lr,buttonCheckedBgDisabled:je,buttonCheckedColorDisabled:be,colorPrimary:it,colorPrimaryHover:wt,colorPrimaryActive:ot,buttonSolidCheckedBg:ut,buttonSolidCheckedHoverBg:_t,buttonSolidCheckedActiveBg:$t}=en;return{[`${Mt}-button-wrapper`]:{position:"relative",display:"inline-block",height:Cn,margin:0,paddingInline:jt,paddingBlock:0,color:ln,fontSize:ft,lineHeight:`${Cn-Et*2}px`,background:on,border:`${Et}px ${pe} ${Ae}`,borderBlockStartWidth:Et+.02,borderInlineStartWidth:0,borderInlineEndWidth:Et,cursor:"pointer",transition:[`color ${Ut}`,`background ${Ut}`,`box-shadow ${Ut}`].join(","),a:{color:ln},[`> ${Mt}-button`]:{position:"absolute",insetBlockStart:0,insetInlineStart:0,zIndex:-1,width:"100%",height:"100%"},"&:not(:first-child)":{"&::before":{position:"absolute",insetBlockStart:-Et,insetInlineStart:-Et,display:"block",boxSizing:"content-box",width:1,height:"100%",paddingBlock:Et,paddingInline:0,backgroundColor:Ae,transition:`background-color ${Pe}`,content:'""'}},"&:first-child":{borderInlineStart:`${Et}px ${pe} ${Ae}`,borderStartStartRadius:W,borderEndStartRadius:W},"&:last-child":{borderStartEndRadius:W,borderEndEndRadius:W},"&:first-child:last-child":{borderRadius:W},[`${Mt}-group-large &`]:{height:lt,fontSize:hn,lineHeight:`${lt-Et*2}px`,"&:first-child":{borderStartStartRadius:Ht,borderEndStartRadius:Ht},"&:last-child":{borderStartEndRadius:Ht,borderEndEndRadius:Ht}},[`${Mt}-group-small &`]:{height:Ct,paddingInline:sn-Et,paddingBlock:0,lineHeight:`${Ct-Et*2}px`,"&:first-child":{borderStartStartRadius:Se,borderEndStartRadius:Se},"&:last-child":{borderStartEndRadius:Se,borderEndEndRadius:Se}},"&:hover":{position:"relative",color:it},"&:has(:focus-visible)":Object.assign({},(0,Ee.oN)(en)),[`${Mt}-inner, input[type='checkbox'], input[type='radio']`]:{width:0,height:0,opacity:0,pointerEvents:"none"},[`&-checked:not(${Mt}-button-wrapper-disabled)`]:{zIndex:1,color:it,background:zt,borderColor:it,"&::before":{backgroundColor:it},"&:first-child":{borderColor:it},"&:hover":{color:wt,borderColor:wt,"&::before":{backgroundColor:wt}},"&:active":{color:ot,borderColor:ot,"&::before":{backgroundColor:ot}}},[`${Mt}-group-solid &-checked:not(${Mt}-button-wrapper-disabled)`]:{color:Fn,background:ut,borderColor:ut,"&:hover":{color:Fn,background:_t,borderColor:_t},"&:active":{color:Fn,background:$t,borderColor:$t}},"&-disabled":{color:Tn,backgroundColor:lr,borderColor:Ae,cursor:"not-allowed","&:first-child, &:hover":{color:Tn,backgroundColor:lr,borderColor:Ae}},[`&-disabled${Mt}-button-wrapper-checked`]:{color:be,backgroundColor:je,borderColor:Ae,boxShadow:"none"}}}},kt=en=>en-4*2;var It=(0,$e.Z)("Radio",en=>{const{controlOutline:ln,controlOutlineWidth:Cn,radioSize:Mt}=en,Et=`0 0 0 ${Cn}px ${ln}`,pe=Et,Ae=kt(Mt),Pe=(0,Fe.TS)(en,{radioDotDisabledSize:Ae,radioFocusShadow:Et,radioButtonFocusShadow:pe});return[ct(Pe),vt(Pe),at(Pe)]},en=>{const{wireframe:ln,padding:Cn,marginXS:Mt,lineWidth:Et,fontSizeLG:pe,colorText:Ae,colorBgContainer:Pe,colorTextDisabled:Ut,controlItemBgActiveDisabled:jt,colorTextLightSolid:ft,colorPrimary:on,colorPrimaryHover:hn,colorPrimaryActive:lt}=en,Ct=4,sn=pe,W=ln?kt(sn):sn-(Ct+Et)*2;return{radioSize:sn,dotSize:W,dotColorDisabled:Ut,buttonSolidCheckedColor:ft,buttonSolidCheckedBg:on,buttonSolidCheckedHoverBg:hn,buttonSolidCheckedActiveBg:lt,buttonBg:Pe,buttonCheckedBg:Pe,buttonColor:Ae,buttonCheckedBgDisabled:jt,buttonCheckedColorDisabled:Ut,buttonPaddingInline:Cn-Et,wrapperMarginInlineEnd:Mt}}),Bn=b(14088),Lt=b(4572),Wn=function(en,ln){var Cn={};for(var Mt in en)Object.prototype.hasOwnProperty.call(en,Mt)&&ln.indexOf(Mt)<0&&(Cn[Mt]=en[Mt]);if(en!=null&&typeof Object.getOwnPropertySymbols=="function")for(var Et=0,Mt=Object.getOwnPropertySymbols(en);Et<Mt.length;Et++)ln.indexOf(Mt[Et])<0&&Object.prototype.propertyIsEnumerable.call(en,Mt[Et])&&(Cn[Mt[Et]]=en[Mt[Et]]);return Cn};const Xn=(en,ln)=>{var Cn,Mt;const Et=E.useContext(D),pe=E.useContext(X),{getPrefixCls:Ae,direction:Pe,radio:Ut}=E.useContext(F.E_),jt=E.useRef(null),ft=(0,he.sQ)(ln,jt),{isFormItemInput:on}=E.useContext(ve.aM),hn=ot=>{var ut,_t;(ut=en.onChange)===null||ut===void 0||ut.call(en,ot),(_t=Et==null?void 0:Et.onChange)===null||_t===void 0||_t.call(Et,ot)},{prefixCls:lt,className:Ct,rootClassName:sn,children:W,style:Se}=en,Ht=Wn(en,["prefixCls","className","rootClassName","children","style"]),zt=Ae("radio",lt),Fn=((Et==null?void 0:Et.optionType)||pe)==="button",Tn=Fn?`${zt}-button`:zt,[lr,je]=It(zt),be=Object.assign({},Ht),it=E.useContext(we.Z);Et&&(be.name=Et.name,be.onChange=hn,be.checked=en.value===Et.value,be.disabled=(Cn=be.disabled)!==null&&Cn!==void 0?Cn:Et.disabled),be.disabled=(Mt=be.disabled)!==null&&Mt!==void 0?Mt:it;const wt=Z()(`${Tn}-wrapper`,{[`${Tn}-wrapper-checked`]:be.checked,[`${Tn}-wrapper-disabled`]:be.disabled,[`${Tn}-wrapper-rtl`]:Pe==="rtl",[`${Tn}-wrapper-in-form-item`]:on},Ut==null?void 0:Ut.className,Ct,sn,je);return lr(E.createElement(Bn.Z,{component:"Radio",disabled:be.disabled},E.createElement("label",{className:wt,style:Object.assign(Object.assign({},Ut==null?void 0:Ut.style),Se),onMouseEnter:en.onMouseEnter,onMouseLeave:en.onMouseLeave},E.createElement(de.Z,Object.assign({},be,{className:Z()(be.className,!Fn&&Lt.A),type:"radio",prefixCls:Tn,ref:ft})),W!==void 0?E.createElement("span",null,W):null)))};var zn=E.forwardRef(Xn);const dr=E.forwardRef((en,ln)=>{const{getPrefixCls:Cn,direction:Mt}=E.useContext(F.E_),[Et,pe]=(0,V.Z)(en.defaultValue,{value:en.value}),Ae=ut=>{const _t=Et,$t=ut.target.value;"value"in en||pe($t);const{onChange:Vt}=en;Vt&&$t!==_t&&Vt(ut)},{prefixCls:Pe,className:Ut,rootClassName:jt,options:ft,buttonStyle:on="outline",disabled:hn,children:lt,size:Ct,style:sn,id:W,onMouseEnter:Se,onMouseLeave:Ht,onFocus:zt,onBlur:Fn}=en,Tn=Cn("radio",Pe),lr=`${Tn}-group`,[je,be]=It(Tn);let it=lt;ft&&ft.length>0&&(it=ft.map(ut=>typeof ut=="string"||typeof ut=="number"?E.createElement(zn,{key:ut.toString(),prefixCls:Tn,disabled:hn,value:ut,checked:Et===ut},ut):E.createElement(zn,{key:`radio-group-value-options-${ut.value}`,prefixCls:Tn,disabled:ut.disabled||hn,value:ut.value,checked:Et===ut.value,title:ut.title,style:ut.style},ut.label)));const wt=(0,C.Z)(Ct),ot=Z()(lr,`${lr}-${on}`,{[`${lr}-${wt}`]:wt,[`${lr}-rtl`]:Mt==="rtl"},Ut,jt,be);return je(E.createElement("div",Object.assign({},(0,N.Z)(en,{aria:!0,data:!0}),{className:ot,style:sn,onMouseEnter:Se,onMouseLeave:Ht,onFocus:zt,onBlur:Fn,id:W,ref:ln}),E.createElement(H,{value:{onChange:Ae,value:Et,disabled:en.disabled,name:en.name,optionType:en.optionType}},it)))});var vn=E.memo(dr),_r=function(en,ln){var Cn={};for(var Mt in en)Object.prototype.hasOwnProperty.call(en,Mt)&&ln.indexOf(Mt)<0&&(Cn[Mt]=en[Mt]);if(en!=null&&typeof Object.getOwnPropertySymbols=="function")for(var Et=0,Mt=Object.getOwnPropertySymbols(en);Et<Mt.length;Et++)ln.indexOf(Mt[Et])<0&&Object.prototype.propertyIsEnumerable.call(en,Mt[Et])&&(Cn[Mt[Et]]=en[Mt[Et]]);return Cn};const Ge=(en,ln)=>{const{getPrefixCls:Cn}=E.useContext(F.E_),{prefixCls:Mt}=en,Et=_r(en,["prefixCls"]),pe=Cn("radio",Mt);return E.createElement(j,{value:"button"},E.createElement(zn,Object.assign({prefixCls:pe},Et,{type:"radio",ref:ln})))};var Tt=E.forwardRef(Ge);const On=zn;On.Button=Tt,On.Group=vn,On.__ANT_RADIO=!0;var Vr=On},80574:function(Be,Me,b){"use strict";b.d(Me,{Ae:function(){return Ee},CF:function(){return zt},vC:function(){return sn},x1:function(){return F}});function m(je,be,it,wt,ot,ut){const _t=je,$t=be,Vt=it-_t,Qt=wt-$t;let cn=ot-_t,Yn=ut-$t,qn=cn*Vt+Yn*Qt,Sr=0;qn<=0?Sr=0:(cn=Vt-cn,Yn=Qt-Yn,qn=cn*Vt+Yn*Qt,qn<=0?Sr=0:Sr=qn*qn/(Vt*Vt+Qt*Qt));const Jr=cn*cn+Yn*Yn-Sr;return Jr<0?0:Jr}function Z(je,be,it,wt){return(je-it)*(je-it)+(be-wt)*(be-wt)}function V(je,be,it,wt,ot){return Z(je,be,it,wt)<ot*ot}function N(je){if(!Number.isFinite(je))return it=>it;if(je===0)return Math.round;const be=Math.pow(10,je);return it=>Math.round(it*be)/be}function E(je){const be=Math.min(je.x1,je.x2),it=Math.max(je.x1,je.x2),wt=Math.min(je.y1,je.y2),ot=Math.max(je.y1,je.y2);return{x:be,y:wt,x2:it,y2:ot,width:it-be,height:ot-wt}}class F{constructor(be,it,wt,ot){this.x1=be,this.y1=it,this.x2=wt,this.y2=ot}equals(be){return this.x1===be.x1&&this.y1===be.y1&&this.x2===be.x2&&this.y2===be.y2}draw(be){be.moveTo(this.x1,this.y1),be.lineTo(this.x2,this.y2)}toString(){return`Line(from=(${this.x1},${this.y1}),to=(${this.x2},${this.y2}))`}static from(be){return new F(be.x1,be.y1,be.x2,be.y2)}cuts(be,it){if(this.y1===this.y2||it<this.y1&&it<=this.y2||it>this.y1&&it>=this.y2||be>this.x1&&be>=this.x2)return!1;if(be<this.x1&&be<=this.x2)return!0;const wt=this.x1+(it-this.y1)*(this.x2-this.x1)/(this.y2-this.y1);return be<=wt}distSquare(be,it){return m(this.x1,this.y1,this.x2,this.y2,be,it)}ptClose(be,it,wt){if(this.x1<this.x2){if(be<this.x1-wt||be>this.x2+wt)return!1}else if(be<this.x2-wt||be>this.x1+wt)return!1;if(this.y1<this.y2){if(it<this.y1-wt||it>this.y2+wt)return!1}else if(it<this.y2-wt||it>this.y1+wt)return!1;return!0}}var C;(function(je){je[je.POINT=1]="POINT",je[je.PARALLEL=2]="PARALLEL",je[je.COINCIDENT=3]="COINCIDENT",je[je.NONE=4]="NONE"})(C||(C={}));class P{constructor(be,it=0,wt=0){this.state=be,this.x=it,this.y=wt}}function H(je,be){const it=(be.x2-be.x1)*(je.y1-be.y1)-(be.y2-be.y1)*(je.x1-be.x1),wt=(je.x2-je.x1)*(je.y1-be.y1)-(je.y2-je.y1)*(je.x1-be.x1),ot=(be.y2-be.y1)*(je.x2-je.x1)-(be.x2-be.x1)*(je.y2-je.y1);if(ot){const ut=it/ot,_t=wt/ot;return 0<=ut&&ut<=1&&0<=_t&&_t<=1?new P(C.POINT,je.x1+ut*(je.x2-je.x1),je.y1+ut*(je.y2-je.y1)):new P(C.NONE)}return new P(it===0||wt===0?C.COINCIDENT:C.PARALLEL)}function D(je,be){const it=(be.x2-be.x1)*(je.y1-be.y1)-(be.y2-be.y1)*(je.x1-be.x1),wt=(je.x2-je.x1)*(je.y1-be.y1)-(je.y2-je.y1)*(je.x1-be.x1),ot=(be.y2-be.y1)*(je.x2-je.x1)-(be.x2-be.x1)*(je.y2-je.y1);if(ot){const ut=it/ot,_t=wt/ot;if(0<=ut&&ut<=1&&0<=_t&&_t<=1)return ut}return Number.POSITIVE_INFINITY}function X(je,be){function it(ot,ut,_t,$t){let Vt=D(be,new F(ot,ut,_t,$t));return Vt=Math.abs(Vt-.5),Vt>=0&&Vt<=1?1:0}let wt=it(je.x,je.y,je.x2,je.y);return wt+=it(je.x,je.y,je.x,je.y2),wt>1||(wt+=it(je.x,je.y2,je.x2,je.y2),wt>1)?!0:(wt+=it(je.x2,je.y,je.x2,je.y2),wt>0)}var j;(function(je){je[je.LEFT=0]="LEFT",je[je.TOP=1]="TOP",je[je.RIGHT=2]="RIGHT",je[je.BOTTOM=3]="BOTTOM"})(j||(j={}));function de(je,be,it){const wt=new Set;return je.width<=0?(wt.add(j.LEFT),wt.add(j.RIGHT)):be<je.x?wt.add(j.LEFT):be>je.x+je.width&&wt.add(j.RIGHT),je.height<=0?(wt.add(j.TOP),wt.add(j.BOTTOM)):it<je.y?wt.add(j.TOP):it>je.y+je.height&&wt.add(j.BOTTOM),wt}function he(je,be){let it=be.x1,wt=be.y1;const ot=be.x2,ut=be.y2,_t=Array.from(de(je,ot,ut));if(_t.length===0)return!0;let $t=de(je,it,wt);for(;$t.size!==0;){for(const Vt of _t)if($t.has(Vt))return!1;if($t.has(j.RIGHT)||$t.has(j.LEFT)){let Vt=je.x;$t.has(j.RIGHT)&&(Vt+=je.width),wt=wt+(Vt-it)*(ut-wt)/(ot-it),it=Vt}else{let Vt=je.y;$t.has(j.BOTTOM)&&(Vt+=je.height),it=it+(Vt-wt)*(ot-it)/(ut-wt),wt=Vt}$t=de(je,it,wt)}return!0}function we(je,be){let it=Number.POSITIVE_INFINITY,wt=0;function ot(ut,_t,$t,Vt){let Qt=D(be,new F(ut,_t,$t,Vt));Qt=Math.abs(Qt-.5),Qt>=0&&Qt<=1&&(wt++,Qt<it&&(it=Qt))}return ot(je.x,je.y,je.x2,je.y),ot(je.x,je.y,je.x,je.y2),wt>1||(ot(je.x,je.y2,je.x2,je.y2),wt>1)?it:(ot(je.x2,je.y,je.x2,je.y2),wt===0?-1:it)}function ve(je,be){let it=0;const wt=H(je,new F(be.x,be.y,be.x2,be.y));it+=wt.state===C.POINT?1:0;const ot=H(je,new F(be.x,be.y,be.x,be.y2));it+=ot.state===C.POINT?1:0;const ut=H(je,new F(be.x,be.y2,be.x2,be.y2));it+=ut.state===C.POINT?1:0;const _t=H(je,new F(be.x2,be.y,be.x2,be.y2));return it+=_t.state===C.POINT?1:0,{top:wt,left:ot,bottom:ut,right:_t,count:it}}class Ee{constructor(be,it,wt,ot){this.x=be,this.y=it,this.width=wt,this.height=ot}get x2(){return this.x+this.width}get y2(){return this.y+this.height}get cx(){return this.x+this.width/2}get cy(){return this.y+this.height/2}get radius(){return Math.max(this.width,this.height)/2}static from(be){return new Ee(be.x,be.y,be.width,be.height)}equals(be){return this.x===be.x&&this.y===be.y&&this.width===be.width&&this.height===be.height}clone(){return new Ee(this.x,this.y,this.width,this.height)}add(be){const it=Math.min(this.x,be.x),wt=Math.min(this.y,be.y),ot=Math.max(this.x2,be.x+be.width),ut=Math.max(this.y2,be.y+be.height);this.x=it,this.y=wt,this.width=ot-it,this.height=ut-wt}addPoint(be){const it=Math.min(this.x,be.x),wt=Math.min(this.y,be.y),ot=Math.max(this.x2,be.x),ut=Math.max(this.y2,be.y);this.x=it,this.y=wt,this.width=ot-it,this.height=ut-wt}toString(){return`Rectangle[x=${this.x}, y=${this.y}, w=${this.width}, h=${this.height}]`}draw(be){be.rect(this.x,this.y,this.width,this.height)}containsPt(be,it){return be>=this.x&&be<=this.x2&&it>=this.y&&it<=this.y2}get area(){return this.width*this.height}intersects(be){return this.area<=0||be.width<=0||be.height<=0?!1:be.x+be.width>this.x&&be.y+be.height>this.y&&be.x<this.x2&&be.y<this.y2}distSquare(be,it){if(this.containsPt(be,it))return 0;const wt=de(this,be,it);return wt.has(j.TOP)?wt.has(j.LEFT)?Z(be,it,this.x,this.y):wt.has(j.RIGHT)?Z(be,it,this.x2,this.y):(this.y-it)*(this.y-it):wt.has(j.BOTTOM)?wt.has(j.LEFT)?Z(be,it,this.x,this.y2):wt.has(j.RIGHT)?Z(be,it,this.x2,this.y2):(it-this.y2)*(it-this.y2):wt.has(j.LEFT)?(this.x-be)*(this.x-be):wt.has(j.RIGHT)?(be-this.x2)*(be-this.x2):0}}function $e(je){if(je.length===0)return null;const be=je[0],it=new Ee(be.x,be.y,0,0);for(const wt of je)it.addPoint(wt);return it}class Fe{constructor(be,it,wt){this.cx=be,this.cy=it,this.radius=wt}get x(){return this.cx-this.radius}get x2(){return this.cx+this.radius}get width(){return this.radius*2}get y(){return this.cy-this.radius}get y2(){return this.cy+this.radius}get height(){return this.radius*2}static from(be){return new Fe(be.cx,be.cy,be.radius)}containsPt(be,it){return Z(this.cx,this.cy,be,it)<this.radius*this.radius}distSquare(be,it){const wt=Z(this.cx,this.cy,be,it);if(wt<this.radius*this.radius)return 0;const ot=Math.sqrt(wt)-this.radius;return ot*ot}draw(be){be.ellipse(this.cx,this.cy,this.radius,this.radius,0,0,Math.PI*2)}}class ct{constructor(be,it=0,wt=0,ot=0,ut=0,_t=10,$t=10,Vt=new Float32Array(Math.max(0,_t*$t)).fill(0)){this.pixelGroup=be,this.i=it,this.j=wt,this.pixelX=ot,this.pixelY=ut,this.width=_t,this.height=$t,this.area=Vt}createSub(be,it){return new ct(this.pixelGroup,be.x,be.y,it.x,it.y,be.width,be.height)}static fromPixelRegion(be,it){return new ct(it,0,0,be.x,be.y,Math.ceil(be.width/it),Math.ceil(be.height/it))}copy(be,it){return new ct(this.pixelGroup,this.scaleX(it.x),this.scaleY(it.y),it.x,it.y,be.width,be.height,be.area)}boundX(be){return be<this.i?this.i:be>=this.width?this.width-1:be}boundY(be){return be<this.j?this.j:be>=this.height?this.height-1:be}scaleX(be){return this.boundX(Math.floor((be-this.pixelX)/this.pixelGroup))}scaleY(be){return this.boundY(Math.floor((be-this.pixelY)/this.pixelGroup))}scale(be){const it=this.scaleX(be.x),wt=this.scaleY(be.y),ot=this.boundX(Math.ceil((be.x+be.width-this.pixelX)/this.pixelGroup)),ut=this.boundY(Math.ceil((be.y+be.height-this.pixelY)/this.pixelGroup)),_t=ot-it,$t=ut-wt;return new Ee(it,wt,_t,$t)}invertScaleX(be){return Math.round(be*this.pixelGroup+this.pixelX)}invertScaleY(be){return Math.round(be*this.pixelGroup+this.pixelY)}addPadding(be,it){const wt=Math.ceil(it/this.pixelGroup),ot=this.boundX(be.x-wt),ut=this.boundY(be.y-wt),_t=this.boundX(be.x2+wt),$t=this.boundY(be.y2+wt),Vt=_t-ot,Qt=$t-ut;return new Ee(ot,ut,Vt,Qt)}get(be,it){return be<0||it<0||be>=this.width||it>=this.height?Number.NaN:this.area[be+it*this.width]}inc(be,it,wt){be<0||it<0||be>=this.width||it>=this.height||(this.area[be+it*this.width]+=wt)}set(be,it,wt){be<0||it<0||be>=this.width||it>=this.height||(this.area[be+it*this.width]=wt)}incArea(be,it){if(be.width<=0||be.height<=0||it===0)return;const wt=this.width,ot=be.width,ut=Math.max(0,be.i),_t=Math.max(0,be.j),$t=Math.min(be.i+be.width,wt),Vt=Math.min(be.j+be.height,this.height);if(!(Vt<=0||$t<=0||ut>=wt||Vt>=this.height))for(let Qt=_t;Qt<Vt;Qt++){const cn=(Qt-be.j)*ot,Yn=Qt*wt;for(let qn=ut;qn<$t;qn++){const Sr=be.area[qn-be.i+cn];Sr!==0&&(this.area[qn+Yn]+=it*Sr)}}}fill(be){this.area.fill(be)}fillArea(be,it){const wt=be.x+be.y*this.width;for(let ot=0;ot<be.height;ot++){const ut=wt+ot*this.width;this.area.fill(it,ut,ut+be.width)}}fillHorizontalLine(be,it,wt,ot){const ut=be+it*this.width;this.area.fill(ot,ut,ut+wt)}fillVerticalLine(be,it,wt,ot){const ut=be+it*this.width;for(let _t=0;_t<wt;_t++)this.area[ut+_t*this.width]=ot}clear(){this.area.fill(0)}toString(){let be="";for(let it=0;it<this.height;it++){const wt=it*this.width;for(let ot=0;ot<this.width;ot++){const ut=this.area[wt+ot];be+=ut.toFixed(1).padStart(6),be+=" "}be+=`
`}return be}draw(be,it=!0){if(this.width<=0||this.height<=0)return;be.save(),it&&be.translate(this.pixelX,this.pixelY);const wt=this.area.reduce((_t,$t)=>Math.min(_t,$t),Number.POSITIVE_INFINITY),ot=this.area.reduce((_t,$t)=>Math.max(_t,$t),Number.NEGATIVE_INFINITY),ut=_t=>(_t-wt)/(ot-wt);be.scale(this.pixelGroup,this.pixelGroup);for(let _t=0;_t<this.width;_t++)for(let $t=0;$t<this.height;$t++){const Vt=this.area[_t+$t*this.width];be.fillStyle=`rgba(0, 0, 0, ${ut(Vt)})`,be.fillRect(_t,$t,1,1)}be.restore()}drawThreshold(be,it,wt=!0){if(!(this.width<=0||this.height<=0)){be.save(),wt&&be.translate(this.pixelX,this.pixelY),be.scale(this.pixelGroup,this.pixelGroup);for(let ot=0;ot<this.width;ot++)for(let ut=0;ut<this.height;ut++){const _t=this.area[ot+ut*this.width];be.fillStyle=_t>it?"black":"white",be.fillRect(ot,ut,1,1)}be.restore()}}}function vt(je,be){const it=wt=>({x:wt.x-be,y:wt.y-be,width:wt.width+2*be,height:wt.height+2*be});return Array.isArray(je)?je.map(it):it(je)}function at(je,be,it){return kt(Object.assign(E(je),{distSquare:(wt,ot)=>m(je.x1,je.y1,je.x2,je.y2,wt,ot)}),be,it)}function kt(je,be,it){const wt=vt(je,it),ot=be.scale(wt),ut=be.createSub(ot,wt);return It(ut,be,it,(_t,$t)=>je.distSquare(_t,$t)),ut}function It(je,be,it,wt){const ot=it*it;for(let ut=0;ut<je.height;ut++)for(let _t=0;_t<je.width;_t++){const $t=be.invertScaleX(je.i+_t),Vt=be.invertScaleY(je.j+ut),Qt=wt($t,Vt);if(Qt===0){je.set(_t,ut,ot);continue}if(Qt<ot){const cn=it-Math.sqrt(Qt);je.set(_t,ut,cn*cn)}}return je}function Bn(je,be,it){const wt=be.scale(je),ot=be.addPadding(wt,it),ut=be.createSub(ot,{x:je.x-it,y:je.y-it}),_t=wt.x-ot.x,$t=wt.y-ot.y,Vt=ot.x2-wt.x2,Qt=ot.y2-wt.y2,cn=ot.width-_t-Vt,Yn=ot.height-$t-Qt,qn=it*it;ut.fillArea({x:_t,y:$t,width:cn+1,height:Yn+1},qn);const Sr=[0],Jr=Math.max($t,_t,Vt,Qt);{const yi=be.invertScaleX(wt.x+wt.width/2);for(let qr=1;qr<Jr;qr++){const es=be.invertScaleY(wt.y-qr),Ci=je.distSquare(yi,es);if(Ci<qn){const En=it-Math.sqrt(Ci);Sr.push(En*En)}else break}}const vr=[],Ki=Math.max(_t,Vt),Mi=Math.max($t,Vt);for(let yi=1;yi<Ki;yi++){const qr=be.invertScaleX(wt.x-yi),es=[];for(let Ci=1;Ci<Mi;Ci++){const En=be.invertScaleY(wt.y-Ci),rn=je.distSquare(qr,En);if(rn<qn){const Xt=it-Math.sqrt(rn);es.push(Xt*Xt)}else es.push(0)}vr.push(es)}for(let yi=1;yi<Math.min($t,Sr.length);yi++){const qr=Sr[yi];ut.fillHorizontalLine(_t,$t-yi,cn+1,qr)}for(let yi=1;yi<Math.min(Qt,Sr.length);yi++){const qr=Sr[yi];ut.fillHorizontalLine(_t,$t+Yn+yi,cn+1,qr)}for(let yi=1;yi<Math.min(_t,Sr.length);yi++){const qr=Sr[yi];ut.fillVerticalLine(_t-yi,$t,Yn+1,qr)}for(let yi=1;yi<Math.min(Qt,Sr.length);yi++){const qr=Sr[yi];ut.fillVerticalLine(_t+cn+yi,$t,Yn+1,qr)}for(let yi=1;yi<_t;yi++){const qr=vr[yi-1],es=_t-yi;for(let Ci=1;Ci<$t;Ci++)ut.set(es,$t-Ci,qr[Ci-1]);for(let Ci=1;Ci<Qt;Ci++)ut.set(es,$t+Yn+Ci,qr[Ci-1])}for(let yi=1;yi<Vt;yi++){const qr=vr[yi-1],es=_t+cn+yi;for(let Ci=1;Ci<$t;Ci++)ut.set(es,$t-Ci,qr[Ci-1]);for(let Ci=1;Ci<Qt;Ci++)ut.set(es,$t+Yn+Ci,qr[Ci-1])}return ut}function Lt(je,be,it,wt){return{x:je,y:be,width:it,height:wt}}function Wn(je,be,it){return{cx:je,cy:be,radius:it}}function Xn(je,be,it,wt){return{x1:je,y1:be,x2:it,y2:wt}}function In(je,be){return{x:je,y:be}}function zn(je,be,it,wt){if(je.length===0)return[];const ot=Tt(je);return ot.map((ut,_t)=>{const $t=ot.slice(0,_t);return dr(be,ut,$t,it,wt)}).flat()}function dr(je,be,it,wt,ot){const ut=In(be.cx,be.cy),_t=Ge(ut,it,je);if(_t==null)return[];const $t=new F(ut.x,ut.y,_t.cx,_t.cy),Vt=vn($t,je,wt,ot);return _r(Vt,je)}function vn(je,be,it,wt){const ot=[],ut=[];ut.push(je);let _t=!0;for(let $t=0;$t<it&&_t;$t++)for(_t=!1;!_t&&ut.length>0;){const Vt=ut.pop(),Qt=en(be,Vt),cn=Qt?ve(Vt,Qt):null;if(!Qt||!cn||cn.count!==2){_t||ot.push(Vt);continue}let Yn=wt,qn=Cn(Qt,Yn,cn,!0),Sr=Vr(qn,ut)||Vr(qn,ot),Jr=On(qn,be);for(;!Sr&&Jr&&Yn>=1;)Yn/=1.5,qn=Cn(Qt,Yn,cn,!0),Sr=Vr(qn,ut)||Vr(qn,ot),Jr=On(qn,be);if(qn&&!Sr&&!Jr&&(ut.push(new F(Vt.x1,Vt.y1,qn.x,qn.y)),ut.push(new F(qn.x,qn.y,Vt.x2,Vt.y2)),_t=!0),_t)continue;Yn=wt,qn=Cn(Qt,Yn,cn,!1);let vr=Vr(qn,ut)||Vr(qn,ot);for(Jr=On(qn,be);!vr&&Jr&&Yn>=1;)Yn/=1.5,qn=Cn(Qt,Yn,cn,!1),vr=Vr(qn,ut)||Vr(qn,ot),Jr=On(qn,be);qn&&!vr&&(ut.push(new F(Vt.x1,Vt.y1,qn.x,qn.y)),ut.push(new F(qn.x,qn.y,Vt.x2,Vt.y2)),_t=!0),_t||ot.push(Vt)}for(;ut.length>0;)ot.push(ut.pop());return ot}function _r(je,be){const it=[];for(;je.length>0;){const wt=je.pop();if(je.length===0){it.push(wt);break}const ot=je.pop(),ut=new F(wt.x1,wt.y1,ot.x2,ot.y2);en(be,ut)?(it.push(wt),je.push(ot)):je.push(ut)}return it}function Ge(je,be,it){let wt=Number.POSITIVE_INFINITY;return be.reduce((ot,ut)=>{const _t=Z(je.x,je.y,ut.cx,ut.cy);if(_t>wt)return ot;const $t=new F(je.x,je.y,ut.cx,ut.cy),Vt=ln(it,$t);return _t*(Vt+1)*(Vt+1)<wt&&(ot=ut,wt=_t*(Vt+1)*(Vt+1)),ot},null)}function Tt(je){if(je.length<2)return je;let be=0,it=0;return je.forEach(wt=>{be+=wt.cx,it+=wt.cy}),be/=je.length,it/=je.length,je.map(wt=>{const ot=be-wt.cx,ut=it-wt.cy,_t=ot*ot+ut*ut;return[wt,_t]}).sort((wt,ot)=>wt[1]-ot[1]).map(wt=>wt[0])}function On(je,be){return be.some(it=>it.containsPt(je.x,je.y))}function Vr(je,be){return be.some(it=>!!(V(it.x1,it.y1,je.x,je.y,.001)||V(it.x2,it.y2,je.x,je.y,.001)))}function en(je,be){let it=Number.POSITIVE_INFINITY,wt=null;for(const ot of je){if(!he(ot,be))continue;const ut=we(ot,be);ut>=0&&ut<it&&(wt=ot,it=ut)}return wt}function ln(je,be){return je.reduce((it,wt)=>he(wt,be)&&X(wt,be)?it+1:it,0)}function Cn(je,be,it,wt){const ot=it.top,ut=it.left,_t=it.bottom,$t=it.right;if(wt){if(ut.state===C.POINT){if(ot.state===C.POINT)return In(je.x-be,je.y-be);if(_t.state===C.POINT)return In(je.x-be,je.y2+be);const qn=je.width*je.height;return je.width*((ut.y-je.y+($t.y-je.y))*.5)<qn*.5?ut.y>$t.y?In(je.x-be,je.y-be):In(je.x2+be,je.y-be):ut.y<$t.y?In(je.x-be,je.y2+be):In(je.x2+be,je.y2+be)}if($t.state===C.POINT){if(ot.state===C.POINT)return In(je.x2+be,je.y-be);if(_t.state===C.POINT)return In(je.x2+be,je.y2+be)}const cn=je.height*je.width;return je.height*((ot.x-je.x+($t.x-je.x))*.5)<cn*.5?ot.x>_t.x?In(je.x-be,je.y-be):In(je.x-be,je.y2+be):ot.x<_t.x?In(je.x2+be,je.y-be):In(je.x2+be,je.y2+be)}if(ut.state===C.POINT){if(ot.state===C.POINT)return In(je.x2+be,je.y2+be);if(_t.state===C.POINT)return In(je.x2+be,je.y-be);const cn=je.height*je.width;return je.width*((ut.y-je.y+($t.y-je.y))*.5)<cn*.5?ut.y>$t.y?In(je.x2+be,je.y2+be):In(je.x-be,je.y2+be):ut.y<$t.y?In(je.x2+be,je.y-be):In(je.x-be,je.y-be)}if($t.state===C.POINT){if(ot.state===C.POINT)return In(je.x-be,je.y2+be);if(_t.state===C.POINT)return In(je.x-be,je.y-be)}const Vt=je.height*je.width;return je.height*((ot.x-je.x+($t.x-je.x))*.5)<Vt*.5?ot.x>_t.x?In(je.x2+be,je.y2+be):In(je.x2+be,je.y-be):ot.x<_t.x?In(je.x-be,je.y2+be):In(je.x-be,je.y-be)}function Mt(je,be,it,wt){if(!(je.closed?it<je.length:it<je.length-1))return!1;const ut=je.get(be),_t=je.get(it+1);for(let $t=be+1;$t<=it;$t++){const Vt=je.get($t);if(m(ut.x,ut.y,_t.x,_t.y,Vt.x,Vt.y)>wt)return!1}return!0}function Et(je=0){return be=>{if(je<0||be.length<3)return be;const it=[];let wt=0;const ot=je*je;for(;wt<be.length;){let ut=wt+1;for(;Mt(be,wt,ut,ot);)ut++;it.push(be.get(wt)),wt=ut}return new Ut(it)}}function pe(je,be){switch(je){case-2:return(((-be+3)*be-3)*be+1)/6;case-1:return((3*be-6)*be*be+4)/6;case 0:return(((-3*be+3)*be+3)*be+1)/6;case 1:return be*be*be/6;default:throw new Error("unknown error")}}function Ae(je=6){function ut(_t,$t,Vt){let Qt=0,cn=0;for(let Yn=-2;Yn<=1;Yn++){const qn=_t.get($t+Yn),Sr=pe(Yn,Vt);Qt+=Sr*qn.x,cn+=Sr*qn.y}return{x:Qt,y:cn}}return _t=>{if(_t.length<3)return _t;const $t=[],Vt=_t.closed,Qt=_t.length+3-1+(Vt?0:2);$t.push(ut(_t,2-(Vt?0:2),0));for(let cn=2-(Vt?0:2);cn<Qt;cn++)for(let Yn=1;Yn<=je;Yn++)$t.push(ut(_t,cn,Yn/je));return new Ut($t)}}function Pe(je=8){return be=>{let it=je,wt=be.length;if(it>1)for(wt=Math.floor(be.length/it);wt<3&&it>1;)it-=1,wt=Math.floor(be.length/it);const ot=[];for(let ut=0,_t=0;_t<wt;_t++,ut+=it)ot.push(be.get(ut));return new Ut(ot)}}class Ut{constructor(be=[],it=!0){this.points=be,this.closed=it}get(be){const it=be,wt=this.points.length;return be<0?this.closed?this.get(be+wt):this.points[0]:be>=wt?this.closed?this.get(be-wt):this.points[wt-1]:this.points[it]}get length(){return this.points.length}toString(be=1/0){const it=this.points;if(it.length===0)return"";const wt=typeof be=="function"?be:N(be);let ot="M";for(const ut of it)ot+=`${wt(ut.x)},${wt(ut.y)} L`;return ot=ot.slice(0,-1),this.closed&&(ot+=" Z"),ot}draw(be){const it=this.points;if(it.length!==0){be.beginPath(),be.moveTo(it[0].x,it[0].y);for(const wt of it)be.lineTo(wt.x,wt.y);this.closed&&be.closePath()}}sample(be){return Pe(be)(this)}simplify(be){return Et(be)(this)}bSplines(be){return Ae(be)(this)}apply(be){return be(this)}containsElements(be){const it=$e(this.points);return it?be.every(wt=>it.containsPt(wt.cx,wt.cy)&&this.withinArea(wt.cx,wt.cy)):!1}withinArea(be,it){if(this.length===0)return!1;let wt=0;const ot=this.points[0],ut=new F(ot.x,ot.y,ot.x,ot.y);for(let _t=1;_t<this.points.length;_t++){const $t=this.points[_t];ut.x1=ut.x2,ut.y1=ut.y2,ut.x2=$t.x,ut.y2=$t.y,ut.cuts(be,it)&&wt++}return ut.x1=ut.x2,ut.y1=ut.y2,ut.x2=ot.x,ut.y2=ot.y,ut.cuts(be,it)&&wt++,wt%2===1}}class jt{constructor(be=0){this.count=0,this.arr=[],this.set=new Set,this.arr.length=be}add(be){this.set.add(`${be.x}x${be.y}`),this.arr[this.count++]=be}contains(be){return this.set.has(`${be.x}x${be.y}`)}isFirst(be){if(this.count===0)return!1;const it=this.arr[0];return it!=null&&it.x===be.x&&it.y===be.y}path(){return new Ut(this.arr.slice(0,this.count))}clear(){this.set.clear(),this.count=0}get(be){return this.arr[be]}get length(){return this.count}}const ft=0,on=1,hn=2,lt=3;function Ct(je,be){const it=(Math.floor(je.width)+Math.floor(je.height))*2,wt=new jt(it);function ot(Vt,Qt,cn,Yn){const qn=je.get(Vt,Qt);return Number.isNaN(qn)?Number.NaN:qn>be?cn+Yn:cn}function ut(Vt,Qt){let cn=ft;return cn=ot(Vt,Qt,cn,1),cn=ot(Vt+1,Qt,cn,2),cn=ot(Vt,Qt+1,cn,4),cn=ot(Vt+1,Qt+1,cn,8),Number.isNaN(cn)?-1:cn}let _t=on;function $t(Vt,Qt){let cn=Vt,Yn=Qt,qn=je.invertScaleX(cn),Sr=je.invertScaleY(Yn);for(let Jr=0;Jr<je.width*je.height;Jr++){const vr={x:qn,y:Sr};if(wt.contains(vr)){if(wt.isFirst(vr))return!0}else wt.add(vr);const Ki=ut(cn,Yn);switch(Ki){case-1:return!0;case 0:case 3:case 2:case 7:_t=hn;break;case 12:case 14:case 4:_t=lt;break;case 6:_t=_t===ft?lt:hn;break;case 1:case 13:case 5:_t=ft;break;case 9:_t=_t===hn?ft:on;break;case 10:case 8:case 11:_t=on;break;default:return console.warn("Marching squares invalid state: "+Ki),!0}switch(_t){case ft:Yn--,Sr-=je.pixelGroup;break;case on:Yn++,Sr+=je.pixelGroup;break;case lt:cn--,qn-=je.pixelGroup;break;case hn:cn++,qn+=je.pixelGroup;break;default:return console.warn("Marching squares invalid state: "+Ki),!0}}return!0}for(let Vt=0;Vt<je.width;Vt++)for(let Qt=0;Qt<je.height;Qt++){if(je.get(Vt,Qt)<=be)continue;const cn=ut(Vt,Qt);if(!(cn<0||cn===15)&&$t(Vt,Qt))return wt.path()}return null}const sn={maxRoutingIterations:100,maxMarchingIterations:20,pixelGroup:4,edgeR0:10,edgeR1:20,nodeR0:15,nodeR1:50,morphBuffer:10,threshold:1,memberInfluenceFactor:1,edgeInfluenceFactor:1,nonMemberInfluenceFactor:-.8,virtualEdges:!0};function W(je){return je!=null&&typeof je.radius=="number"}function Se(je,be){if(W(je)!==W(be))return!1;if(W(je)){const wt=be;return je.cx===wt.cx&&je.cy===wt.cy&&je.radius===wt.radius}const it=be;return je.x===it.x&&je.y===it.y&&je.width===it.width&&je.height===it.height}var Ht;(function(je){je[je.MEMBERS=0]="MEMBERS",je[je.NON_MEMBERS=1]="NON_MEMBERS",je[je.EDGES=2]="EDGES"})(Ht||(Ht={}));class zt{constructor(be={}){this.dirty=new Set,this.members=[],this.nonMembers=[],this.virtualEdges=[],this.edges=[],this.activeRegion=new Ee(0,0,0,0),this.potentialArea=new ct(1,0,0,0,0,0,0),this.o=Object.assign({},sn,be)}pushMember(...be){if(be.length!==0){this.dirty.add(Ht.MEMBERS);for(const it of be)this.members.push({raw:it,obj:W(it)?Fe.from(it):Ee.from(it),area:null})}}removeMember(be){const it=this.members.findIndex(wt=>Se(wt.raw,be));return it<0?!1:(this.members.splice(it,1),this.dirty.add(Ht.MEMBERS),!0)}removeNonMember(be){const it=this.nonMembers.findIndex(wt=>Se(wt.raw,be));return it<0?!1:(this.nonMembers.splice(it,1),this.dirty.add(Ht.NON_MEMBERS),!0)}removeEdge(be){const it=this.edges.findIndex(wt=>wt.obj.equals(be));return it<0?!1:(this.edges.splice(it,1),this.dirty.add(Ht.NON_MEMBERS),!0)}pushNonMember(...be){if(be.length!==0){this.dirty.add(Ht.NON_MEMBERS);for(const it of be)this.nonMembers.push({raw:it,obj:W(it)?Fe.from(it):Ee.from(it),area:null})}}pushEdge(...be){if(be.length!==0){this.dirty.add(Ht.EDGES);for(const it of be)this.edges.push({raw:it,obj:F.from(it),area:null})}}update(){const be=this.dirty.has(Ht.MEMBERS),it=this.dirty.has(Ht.NON_MEMBERS);let wt=this.dirty.has(Ht.EDGES);this.dirty.clear();const ot=this.members.map(Qt=>Qt.obj);if(this.o.virtualEdges&&(be||it)){const Qt=this.nonMembers.map(qn=>qn.obj),cn=zn(ot,Qt,this.o.maxRoutingIterations,this.o.morphBuffer),Yn=new Map(this.virtualEdges.map(qn=>[qn.obj.toString(),qn.area]));this.virtualEdges=cn.map(qn=>{var Sr;return{raw:qn,obj:qn,area:(Sr=Yn.get(qn.toString()))!==null&&Sr!==void 0?Sr:null}}),wt=!0}let ut=!1;if(be||wt){const Qt=this.virtualEdges.concat(this.edges).map(Sr=>Sr.obj),cn=Tn(ot,Qt),Yn=Math.max(this.o.edgeR1,this.o.nodeR1)+this.o.morphBuffer,qn=Ee.from(vt(cn,Yn));qn.equals(this.activeRegion)||(ut=!0,this.activeRegion=qn)}if(ut){const Qt=Math.ceil(this.activeRegion.width/this.o.pixelGroup),cn=Math.ceil(this.activeRegion.height/this.o.pixelGroup);this.activeRegion.x!==this.potentialArea.pixelX||this.activeRegion.y!==this.potentialArea.pixelY?(this.potentialArea=ct.fromPixelRegion(this.activeRegion,this.o.pixelGroup),this.members.forEach(Yn=>Yn.area=null),this.nonMembers.forEach(Yn=>Yn.area=null),this.edges.forEach(Yn=>Yn.area=null),this.virtualEdges.forEach(Yn=>Yn.area=null)):(Qt!==this.potentialArea.width||cn!==this.potentialArea.height)&&(this.potentialArea=ct.fromPixelRegion(this.activeRegion,this.o.pixelGroup))}const _t=new Map,$t=Qt=>{if(Qt.area){const cn=`${Qt.obj.width}x${Qt.obj.height}x${Qt.obj instanceof Ee?"R":"C"}`;_t.set(cn,Qt.area)}},Vt=Qt=>{if(Qt.area)return;const cn=`${Qt.obj.width}x${Qt.obj.height}x${Qt.obj instanceof Ee?"R":"C"}`;if(_t.has(cn)){const qn=_t.get(cn);Qt.area=this.potentialArea.copy(qn,{x:Qt.obj.x-this.o.nodeR1,y:Qt.obj.y-this.o.nodeR1});return}const Yn=Qt.obj instanceof Ee?Bn(Qt.obj,this.potentialArea,this.o.nodeR1):kt(Qt.obj,this.potentialArea,this.o.nodeR1);Qt.area=Yn,_t.set(cn,Yn)};this.members.forEach($t),this.nonMembers.forEach($t),this.members.forEach(Vt),this.nonMembers.forEach(Qt=>{this.activeRegion.intersects(Qt.obj)?Vt(Qt):Qt.area=null}),this.edges.forEach(Qt=>{Qt.area||(Qt.area=at(Qt.obj,this.potentialArea,this.o.edgeR1))}),this.virtualEdges.forEach(Qt=>{Qt.area||(Qt.area=at(Qt.obj,this.potentialArea,this.o.edgeR1))})}drawMembers(be){for(const it of this.members)it.obj.draw(be)}drawNonMembers(be){for(const it of this.nonMembers)it.obj.draw(be)}drawEdges(be){for(const it of this.edges)it.obj.draw(be)}drawPotentialArea(be,it=!0){this.potentialArea.draw(be,it)}compute(){if(this.members.length===0)return new Ut([]);this.dirty.size>0&&this.update();const{o:be,potentialArea:it}=this,wt=this.members.map($t=>$t.area),ot=this.virtualEdges.concat(this.edges).map($t=>$t.area),ut=this.nonMembers.filter($t=>$t.area!=null).map($t=>$t.area),_t=this.members.map($t=>$t.obj);return Fn(it,wt,ot,ut,$t=>$t.containsElements(_t),be)}}function Fn(je,be,it,wt,ot,ut={}){const _t=Object.assign({},sn,ut);let $t=_t.threshold,Vt=_t.memberInfluenceFactor,Qt=_t.edgeInfluenceFactor,cn=_t.nonMemberInfluenceFactor;const Yn=(_t.nodeR0-_t.nodeR1)*(_t.nodeR0-_t.nodeR1),qn=(_t.edgeR0-_t.edgeR1)*(_t.edgeR0-_t.edgeR1);for(let Sr=0;Sr<_t.maxMarchingIterations;Sr++){if(je.clear(),Vt!==0){const vr=Vt/Yn;for(const Ki of be)je.incArea(Ki,vr)}if(Qt!==0){const vr=Qt/qn;for(const Ki of it)je.incArea(Ki,vr)}if(cn!==0){const vr=cn/Yn;for(const Ki of wt)je.incArea(Ki,vr)}const Jr=Ct(je,$t);if(Jr&&ot(Jr))return Jr;if($t*=.95,Sr<=_t.maxMarchingIterations*.5)Vt*=1.2,Qt*=1.2;else if(cn!==0&&wt.length>0)cn*=.8;else break}return new Ut([])}function Tn(je,be){if(je.length===0)return new Ee(0,0,0,0);const it=Ee.from(je[0]);for(const wt of je)it.add(wt);for(const wt of be)it.add(E(wt));return it}function lr(je,be=[],it=[],wt={}){if(je.length===0)return new Ut([]);const ot=new zt(wt);return ot.pushMember(...je),ot.pushNonMember(...be),ot.pushEdge(...it),ot.compute()}},45411:function(Be){"use strict";Be.exports={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]}},75196:function(Be,Me,b){var m=b(45411),Z=b(81683),V=Object.hasOwnProperty,N=Object.create(null);for(var E in m)V.call(m,E)&&(N[m[E]]=E);var F=Be.exports={to:{},get:{}};F.get=function(H){var D=H.substring(0,3).toLowerCase(),X,j;switch(D){case"hsl":X=F.get.hsl(H),j="hsl";break;case"hwb":X=F.get.hwb(H),j="hwb";break;default:X=F.get.rgb(H),j="rgb";break}return X?{model:j,value:X}:null},F.get.rgb=function(H){if(!H)return null;var D=/^#([a-f0-9]{3,4})$/i,X=/^#([a-f0-9]{6})([a-f0-9]{2})?$/i,j=/^rgba?\(\s*([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/,de=/^rgba?\(\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/,he=/^(\w+)$/,we=[0,0,0,1],ve,Ee,$e;if(ve=H.match(X)){for($e=ve[2],ve=ve[1],Ee=0;Ee<3;Ee++){var Fe=Ee*2;we[Ee]=parseInt(ve.slice(Fe,Fe+2),16)}$e&&(we[3]=parseInt($e,16)/255)}else if(ve=H.match(D)){for(ve=ve[1],$e=ve[3],Ee=0;Ee<3;Ee++)we[Ee]=parseInt(ve[Ee]+ve[Ee],16);$e&&(we[3]=parseInt($e+$e,16)/255)}else if(ve=H.match(j)){for(Ee=0;Ee<3;Ee++)we[Ee]=parseInt(ve[Ee+1],0);ve[4]&&(ve[5]?we[3]=parseFloat(ve[4])*.01:we[3]=parseFloat(ve[4]))}else if(ve=H.match(de)){for(Ee=0;Ee<3;Ee++)we[Ee]=Math.round(parseFloat(ve[Ee+1])*2.55);ve[4]&&(ve[5]?we[3]=parseFloat(ve[4])*.01:we[3]=parseFloat(ve[4]))}else return(ve=H.match(he))?ve[1]==="transparent"?[0,0,0,0]:V.call(m,ve[1])?(we=m[ve[1]],we[3]=1,we):null:null;for(Ee=0;Ee<3;Ee++)we[Ee]=C(we[Ee],0,255);return we[3]=C(we[3],0,1),we},F.get.hsl=function(H){if(!H)return null;var D=/^hsla?\(\s*([+-]?(?:\d{0,3}\.)?\d+)(?:deg)?\s*,?\s*([+-]?[\d\.]+)%\s*,?\s*([+-]?[\d\.]+)%\s*(?:[,|\/]\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/,X=H.match(D);if(X){var j=parseFloat(X[4]),de=(parseFloat(X[1])%360+360)%360,he=C(parseFloat(X[2]),0,100),we=C(parseFloat(X[3]),0,100),ve=C(isNaN(j)?1:j,0,1);return[de,he,we,ve]}return null},F.get.hwb=function(H){if(!H)return null;var D=/^hwb\(\s*([+-]?\d{0,3}(?:\.\d+)?)(?:deg)?\s*,\s*([+-]?[\d\.]+)%\s*,\s*([+-]?[\d\.]+)%\s*(?:,\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/,X=H.match(D);if(X){var j=parseFloat(X[4]),de=(parseFloat(X[1])%360+360)%360,he=C(parseFloat(X[2]),0,100),we=C(parseFloat(X[3]),0,100),ve=C(isNaN(j)?1:j,0,1);return[de,he,we,ve]}return null},F.to.hex=function(){var H=Z(arguments);return"#"+P(H[0])+P(H[1])+P(H[2])+(H[3]<1?P(Math.round(H[3]*255)):"")},F.to.rgb=function(){var H=Z(arguments);return H.length<4||H[3]===1?"rgb("+Math.round(H[0])+", "+Math.round(H[1])+", "+Math.round(H[2])+")":"rgba("+Math.round(H[0])+", "+Math.round(H[1])+", "+Math.round(H[2])+", "+H[3]+")"},F.to.rgb.percent=function(){var H=Z(arguments),D=Math.round(H[0]/255*100),X=Math.round(H[1]/255*100),j=Math.round(H[2]/255*100);return H.length<4||H[3]===1?"rgb("+D+"%, "+X+"%, "+j+"%)":"rgba("+D+"%, "+X+"%, "+j+"%, "+H[3]+")"},F.to.hsl=function(){var H=Z(arguments);return H.length<4||H[3]===1?"hsl("+H[0]+", "+H[1]+"%, "+H[2]+"%)":"hsla("+H[0]+", "+H[1]+"%, "+H[2]+"%, "+H[3]+")"},F.to.hwb=function(){var H=Z(arguments),D="";return H.length>=4&&H[3]!==1&&(D=", "+H[3]),"hwb("+H[0]+", "+H[1]+"%, "+H[2]+"%"+D+")"},F.to.keyword=function(H){return N[H.slice(0,3)]};function C(H,D,X){return Math.min(Math.max(D,H),X)}function P(H){var D=Math.round(H).toString(16).toUpperCase();return D.length<2?"0"+D:D}},92546:function(Be,Me,b){Be.exports={graphlib:b(76626),layout:b(15373),debug:b(11303),util:{time:b(53063).time,notime:b(53063).notime},version:b(11897)}},81255:function(Be,Me,b){"use strict";var m=b(72361),Z=b(39240);Be.exports={run:V,undo:E};function V(F){var C=F.graph().acyclicer==="greedy"?Z(F,P(F)):N(F);m.forEach(C,function(H){var D=F.edge(H);F.removeEdge(H),D.forwardName=H.name,D.reversed=!0,F.setEdge(H.w,H.v,D,m.uniqueId("rev"))});function P(H){return function(D){return H.edge(D).weight}}}function N(F){var C=[],P={},H={};function D(X){m.has(H,X)||(H[X]=!0,P[X]=!0,m.forEach(F.outEdges(X),function(j){m.has(P,j.w)?C.push(j):D(j.w)}),delete P[X])}return m.forEach(F.nodes(),D),C}function E(F){m.forEach(F.edges(),function(C){var P=F.edge(C);if(P.reversed){F.removeEdge(C);var H=P.forwardName;delete P.reversed,delete P.forwardName,F.setEdge(C.w,C.v,P,H)}})}},60765:function(Be,Me,b){var m=b(72361),Z=b(53063);Be.exports=V;function V(E){function F(C){var P=E.children(C),H=E.node(C);if(P.length&&m.forEach(P,F),m.has(H,"minRank")){H.borderLeft=[],H.borderRight=[];for(var D=H.minRank,X=H.maxRank+1;D<X;++D)N(E,"borderLeft","_bl",C,H,D),N(E,"borderRight","_br",C,H,D)}}m.forEach(E.children(),F)}function N(E,F,C,P,H,D){var X={width:0,height:0,rank:D,borderType:F},j=H[F][D-1],de=Z.addDummyNode(E,"border",X,C);H[F][D]=de,E.setParent(de,P),j&&E.setEdge(j,de,{weight:1})}},13257:function(Be,Me,b){"use strict";var m=b(72361);Be.exports={adjust:Z,undo:V};function Z(D){var X=D.graph().rankdir.toLowerCase();(X==="lr"||X==="rl")&&N(D)}function V(D){var X=D.graph().rankdir.toLowerCase();(X==="bt"||X==="rl")&&F(D),(X==="lr"||X==="rl")&&(P(D),N(D))}function N(D){m.forEach(D.nodes(),function(X){E(D.node(X))}),m.forEach(D.edges(),function(X){E(D.edge(X))})}function E(D){var X=D.width;D.width=D.height,D.height=X}function F(D){m.forEach(D.nodes(),function(X){C(D.node(X))}),m.forEach(D.edges(),function(X){var j=D.edge(X);m.forEach(j.points,C),m.has(j,"y")&&C(j)})}function C(D){D.y=-D.y}function P(D){m.forEach(D.nodes(),function(X){H(D.node(X))}),m.forEach(D.edges(),function(X){var j=D.edge(X);m.forEach(j.points,H),m.has(j,"x")&&H(j)})}function H(D){var X=D.x;D.x=D.y,D.y=X}},21135:function(Be){Be.exports=Me;function Me(){var Z={};Z._next=Z._prev=Z,this._sentinel=Z}Me.prototype.dequeue=function(){var Z=this._sentinel,V=Z._prev;if(V!==Z)return b(V),V},Me.prototype.enqueue=function(Z){var V=this._sentinel;Z._prev&&Z._next&&b(Z),Z._next=V._next,V._next._prev=Z,V._next=Z,Z._prev=V},Me.prototype.toString=function(){for(var Z=[],V=this._sentinel,N=V._prev;N!==V;)Z.push(JSON.stringify(N,m)),N=N._prev;return"["+Z.join(", ")+"]"};function b(Z){Z._prev._next=Z._next,Z._next._prev=Z._prev,delete Z._next,delete Z._prev}function m(Z,V){if(Z!=="_next"&&Z!=="_prev")return V}},11303:function(Be,Me,b){var m=b(72361),Z=b(53063),V=b(76626).Graph;Be.exports={debugOrdering:N};function N(E){var F=Z.buildLayerMatrix(E),C=new V({compound:!0,multigraph:!0}).setGraph({});return m.forEach(E.nodes(),function(P){C.setNode(P,{label:P}),C.setParent(P,"layer"+E.node(P).rank)}),m.forEach(E.edges(),function(P){C.setEdge(P.v,P.w,{},P.name)}),m.forEach(F,function(P,H){var D="layer"+H;C.setNode(D,{rank:"same"}),m.reduce(P,function(X,j){return C.setEdge(X,j,{style:"invis"}),j})}),C}},76626:function(Be,Me,b){var m;try{m=b(75172)}catch(Z){}m||(m=window.graphlib),Be.exports=m},39240:function(Be,Me,b){var m=b(72361),Z=b(76626).Graph,V=b(21135);Be.exports=E;var N=m.constant(1);function E(D,X){if(D.nodeCount()<=1)return[];var j=P(D,X||N),de=F(j.graph,j.buckets,j.zeroIdx);return m.flatten(m.map(de,function(he){return D.outEdges(he.v,he.w)}),!0)}function F(D,X,j){for(var de=[],he=X[X.length-1],we=X[0],ve;D.nodeCount();){for(;ve=we.dequeue();)C(D,X,j,ve);for(;ve=he.dequeue();)C(D,X,j,ve);if(D.nodeCount()){for(var Ee=X.length-2;Ee>0;--Ee)if(ve=X[Ee].dequeue(),ve){de=de.concat(C(D,X,j,ve,!0));break}}}return de}function C(D,X,j,de,he){var we=he?[]:void 0;return m.forEach(D.inEdges(de.v),function(ve){var Ee=D.edge(ve),$e=D.node(ve.v);he&&we.push({v:ve.v,w:ve.w}),$e.out-=Ee,H(X,j,$e)}),m.forEach(D.outEdges(de.v),function(ve){var Ee=D.edge(ve),$e=ve.w,Fe=D.node($e);Fe.in-=Ee,H(X,j,Fe)}),D.removeNode(de.v),we}function P(D,X){var j=new Z,de=0,he=0;m.forEach(D.nodes(),function(Ee){j.setNode(Ee,{v:Ee,in:0,out:0})}),m.forEach(D.edges(),function(Ee){var $e=j.edge(Ee.v,Ee.w)||0,Fe=X(Ee),ct=$e+Fe;j.setEdge(Ee.v,Ee.w,ct),he=Math.max(he,j.node(Ee.v).out+=Fe),de=Math.max(de,j.node(Ee.w).in+=Fe)});var we=m.range(he+de+3).map(function(){return new V}),ve=de+1;return m.forEach(j.nodes(),function(Ee){H(we,ve,j.node(Ee))}),{graph:j,buckets:we,zeroIdx:ve}}function H(D,X,j){j.out?j.in?D[j.out-j.in+X].enqueue(j):D[D.length-1].enqueue(j):D[0].enqueue(j)}},15373:function(Be,Me,b){"use strict";var m=b(72361),Z=b(81255),V=b(27163),N=b(64505),E=b(53063).normalizeRanks,F=b(71970),C=b(53063).removeEmptyRanks,P=b(31733),H=b(60765),D=b(13257),X=b(62852),j=b(93021),de=b(53063),he=b(76626).Graph;Be.exports=we;function we(Mt,Et){var pe=Et&&Et.debugTiming?de.time:de.notime;pe("layout",function(){var Ae=pe(" buildLayoutGraph",function(){return Lt(Mt)});pe(" runLayout",function(){ve(Ae,pe)}),pe(" updateInputGraph",function(){Ee(Mt,Ae)})})}function ve(Mt,Et){Et(" makeSpaceForEdgeLabels",function(){Wn(Mt)}),Et(" removeSelfEdges",function(){On(Mt)}),Et(" acyclic",function(){Z.run(Mt)}),Et(" nestingGraph.run",function(){P.run(Mt)}),Et(" rank",function(){N(de.asNonCompoundGraph(Mt))}),Et(" injectEdgeLabelProxies",function(){Xn(Mt)}),Et(" removeEmptyRanks",function(){C(Mt)}),Et(" nestingGraph.cleanup",function(){P.cleanup(Mt)}),Et(" normalizeRanks",function(){E(Mt)}),Et(" assignRankMinMax",function(){In(Mt)}),Et(" removeEdgeLabelProxies",function(){zn(Mt)}),Et(" normalize.run",function(){V.run(Mt)}),Et(" parentDummyChains",function(){F(Mt)}),Et(" addBorderSegments",function(){H(Mt)}),Et(" order",function(){X(Mt)}),Et(" insertSelfEdges",function(){Vr(Mt)}),Et(" adjustCoordinateSystem",function(){D.adjust(Mt)}),Et(" position",function(){j(Mt)}),Et(" positionSelfEdges",function(){en(Mt)}),Et(" removeBorderNodes",function(){Tt(Mt)}),Et(" normalize.undo",function(){V.undo(Mt)}),Et(" fixupEdgeLabelCoords",function(){_r(Mt)}),Et(" undoCoordinateSystem",function(){D.undo(Mt)}),Et(" translateGraph",function(){dr(Mt)}),Et(" assignNodeIntersects",function(){vn(Mt)}),Et(" reversePoints",function(){Ge(Mt)}),Et(" acyclic.undo",function(){Z.undo(Mt)})}function Ee(Mt,Et){m.forEach(Mt.nodes(),function(pe){var Ae=Mt.node(pe),Pe=Et.node(pe);Ae&&(Ae.x=Pe.x,Ae.y=Pe.y,Et.children(pe).length&&(Ae.width=Pe.width,Ae.height=Pe.height))}),m.forEach(Mt.edges(),function(pe){var Ae=Mt.edge(pe),Pe=Et.edge(pe);Ae.points=Pe.points,m.has(Pe,"x")&&(Ae.x=Pe.x,Ae.y=Pe.y)}),Mt.graph().width=Et.graph().width,Mt.graph().height=Et.graph().height}var $e=["nodesep","edgesep","ranksep","marginx","marginy"],Fe={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},ct=["acyclicer","ranker","rankdir","align"],vt=["width","height"],at={width:0,height:0},kt=["minlen","weight","width","height","labeloffset"],It={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},Bn=["labelpos"];function Lt(Mt){var Et=new he({multigraph:!0,compound:!0}),pe=Cn(Mt.graph());return Et.setGraph(m.merge({},Fe,ln(pe,$e),m.pick(pe,ct))),m.forEach(Mt.nodes(),function(Ae){var Pe=Cn(Mt.node(Ae));Et.setNode(Ae,m.defaults(ln(Pe,vt),at)),Et.setParent(Ae,Mt.parent(Ae))}),m.forEach(Mt.edges(),function(Ae){var Pe=Cn(Mt.edge(Ae));Et.setEdge(Ae,m.merge({},It,ln(Pe,kt),m.pick(Pe,Bn)))}),Et}function Wn(Mt){var Et=Mt.graph();Et.ranksep/=2,m.forEach(Mt.edges(),function(pe){var Ae=Mt.edge(pe);Ae.minlen*=2,Ae.labelpos.toLowerCase()!=="c"&&(Et.rankdir==="TB"||Et.rankdir==="BT"?Ae.width+=Ae.labeloffset:Ae.height+=Ae.labeloffset)})}function Xn(Mt){m.forEach(Mt.edges(),function(Et){var pe=Mt.edge(Et);if(pe.width&&pe.height){var Ae=Mt.node(Et.v),Pe=Mt.node(Et.w),Ut={rank:(Pe.rank-Ae.rank)/2+Ae.rank,e:Et};de.addDummyNode(Mt,"edge-proxy",Ut,"_ep")}})}function In(Mt){var Et=0;m.forEach(Mt.nodes(),function(pe){var Ae=Mt.node(pe);Ae.borderTop&&(Ae.minRank=Mt.node(Ae.borderTop).rank,Ae.maxRank=Mt.node(Ae.borderBottom).rank,Et=m.max(Et,Ae.maxRank))}),Mt.graph().maxRank=Et}function zn(Mt){m.forEach(Mt.nodes(),function(Et){var pe=Mt.node(Et);pe.dummy==="edge-proxy"&&(Mt.edge(pe.e).labelRank=pe.rank,Mt.removeNode(Et))})}function dr(Mt){var Et=Number.POSITIVE_INFINITY,pe=0,Ae=Number.POSITIVE_INFINITY,Pe=0,Ut=Mt.graph(),jt=Ut.marginx||0,ft=Ut.marginy||0;function on(hn){var lt=hn.x,Ct=hn.y,sn=hn.width,W=hn.height;Et=Math.min(Et,lt-sn/2),pe=Math.max(pe,lt+sn/2),Ae=Math.min(Ae,Ct-W/2),Pe=Math.max(Pe,Ct+W/2)}m.forEach(Mt.nodes(),function(hn){on(Mt.node(hn))}),m.forEach(Mt.edges(),function(hn){var lt=Mt.edge(hn);m.has(lt,"x")&&on(lt)}),Et-=jt,Ae-=ft,m.forEach(Mt.nodes(),function(hn){var lt=Mt.node(hn);lt.x-=Et,lt.y-=Ae}),m.forEach(Mt.edges(),function(hn){var lt=Mt.edge(hn);m.forEach(lt.points,function(Ct){Ct.x-=Et,Ct.y-=Ae}),m.has(lt,"x")&&(lt.x-=Et),m.has(lt,"y")&&(lt.y-=Ae)}),Ut.width=pe-Et+jt,Ut.height=Pe-Ae+ft}function vn(Mt){m.forEach(Mt.edges(),function(Et){var pe=Mt.edge(Et),Ae=Mt.node(Et.v),Pe=Mt.node(Et.w),Ut,jt;pe.points?(Ut=pe.points[0],jt=pe.points[pe.points.length-1]):(pe.points=[],Ut=Pe,jt=Ae),pe.points.unshift(de.intersectRect(Ae,Ut)),pe.points.push(de.intersectRect(Pe,jt))})}function _r(Mt){m.forEach(Mt.edges(),function(Et){var pe=Mt.edge(Et);if(m.has(pe,"x"))switch((pe.labelpos==="l"||pe.labelpos==="r")&&(pe.width-=pe.labeloffset),pe.labelpos){case"l":pe.x-=pe.width/2+pe.labeloffset;break;case"r":pe.x+=pe.width/2+pe.labeloffset;break}})}function Ge(Mt){m.forEach(Mt.edges(),function(Et){var pe=Mt.edge(Et);pe.reversed&&pe.points.reverse()})}function Tt(Mt){m.forEach(Mt.nodes(),function(Et){if(Mt.children(Et).length){var pe=Mt.node(Et),Ae=Mt.node(pe.borderTop),Pe=Mt.node(pe.borderBottom),Ut=Mt.node(m.last(pe.borderLeft)),jt=Mt.node(m.last(pe.borderRight));pe.width=Math.abs(jt.x-Ut.x),pe.height=Math.abs(Pe.y-Ae.y),pe.x=Ut.x+pe.width/2,pe.y=Ae.y+pe.height/2}}),m.forEach(Mt.nodes(),function(Et){Mt.node(Et).dummy==="border"&&Mt.removeNode(Et)})}function On(Mt){m.forEach(Mt.edges(),function(Et){if(Et.v===Et.w){var pe=Mt.node(Et.v);pe.selfEdges||(pe.selfEdges=[]),pe.selfEdges.push({e:Et,label:Mt.edge(Et)}),Mt.removeEdge(Et)}})}function Vr(Mt){var Et=de.buildLayerMatrix(Mt);m.forEach(Et,function(pe){var Ae=0;m.forEach(pe,function(Pe,Ut){var jt=Mt.node(Pe);jt.order=Ut+Ae,m.forEach(jt.selfEdges,function(ft){de.addDummyNode(Mt,"selfedge",{width:ft.label.width,height:ft.label.height,rank:jt.rank,order:Ut+ ++Ae,e:ft.e,label:ft.label},"_se")}),delete jt.selfEdges})})}function en(Mt){m.forEach(Mt.nodes(),function(Et){var pe=Mt.node(Et);if(pe.dummy==="selfedge"){var Ae=Mt.node(pe.e.v),Pe=Ae.x+Ae.width/2,Ut=Ae.y,jt=pe.x-Pe,ft=Ae.height/2;Mt.setEdge(pe.e,pe.label),Mt.removeNode(Et),pe.label.points=[{x:Pe+2*jt/3,y:Ut-ft},{x:Pe+5*jt/6,y:Ut-ft},{x:Pe+jt,y:Ut},{x:Pe+5*jt/6,y:Ut+ft},{x:Pe+2*jt/3,y:Ut+ft}],pe.label.x=pe.x,pe.label.y=pe.y}})}function ln(Mt,Et){return m.mapValues(m.pick(Mt,Et),Number)}function Cn(Mt){var Et={};return m.forEach(Mt,function(pe,Ae){Et[Ae.toLowerCase()]=pe}),Et}},72361:function(Be,Me,b){var m;try{m={cloneDeep:b(20250),constant:b(13503),defaults:b(28548),each:b(76934),filter:b(64725),find:b(79785),flatten:b(40151),forEach:b(99204),forIn:b(23190),has:b(99946),isUndefined:b(16513),last:b(10611),map:b(9924),mapValues:b(70642),max:b(95987),merge:b(28440),min:b(73376),minBy:b(83296),now:b(5795),pick:b(89409),range:b(60859),reduce:b(16473),sortBy:b(351),uniqueId:b(95708),values:b(81229),zipObject:b(65441)}}catch(Z){}m||(m=window._),Be.exports=m},31733:function(Be,Me,b){var m=b(72361),Z=b(53063);Be.exports={run:V,cleanup:C};function V(P){var H=Z.addDummyNode(P,"root",{},"_root"),D=E(P),X=m.max(m.values(D))-1,j=2*X+1;P.graph().nestingRoot=H,m.forEach(P.edges(),function(he){P.edge(he).minlen*=j});var de=F(P)+1;m.forEach(P.children(),function(he){N(P,H,j,de,X,D,he)}),P.graph().nodeRankFactor=j}function N(P,H,D,X,j,de,he){var we=P.children(he);if(!we.length){he!==H&&P.setEdge(H,he,{weight:0,minlen:D});return}var ve=Z.addBorderNode(P,"_bt"),Ee=Z.addBorderNode(P,"_bb"),$e=P.node(he);P.setParent(ve,he),$e.borderTop=ve,P.setParent(Ee,he),$e.borderBottom=Ee,m.forEach(we,function(Fe){N(P,H,D,X,j,de,Fe);var ct=P.node(Fe),vt=ct.borderTop?ct.borderTop:Fe,at=ct.borderBottom?ct.borderBottom:Fe,kt=ct.borderTop?X:2*X,It=vt!==at?1:j-de[he]+1;P.setEdge(ve,vt,{weight:kt,minlen:It,nestingEdge:!0}),P.setEdge(at,Ee,{weight:kt,minlen:It,nestingEdge:!0})}),P.parent(he)||P.setEdge(H,ve,{weight:0,minlen:j+de[he]})}function E(P){var H={};function D(X,j){var de=P.children(X);de&&de.length&&m.forEach(de,function(he){D(he,j+1)}),H[X]=j}return m.forEach(P.children(),function(X){D(X,1)}),H}function F(P){return m.reduce(P.edges(),function(H,D){return H+P.edge(D).weight},0)}function C(P){var H=P.graph();P.removeNode(H.nestingRoot),delete H.nestingRoot,m.forEach(P.edges(),function(D){var X=P.edge(D);X.nestingEdge&&P.removeEdge(D)})}},27163:function(Be,Me,b){"use strict";var m=b(72361),Z=b(53063);Be.exports={run:V,undo:E};function V(F){F.graph().dummyChains=[],m.forEach(F.edges(),function(C){N(F,C)})}function N(F,C){var P=C.v,H=F.node(P).rank,D=C.w,X=F.node(D).rank,j=C.name,de=F.edge(C),he=de.labelRank;if(X!==H+1){F.removeEdge(C);var we,ve,Ee;for(Ee=0,++H;H<X;++Ee,++H)de.points=[],ve={width:0,height:0,edgeLabel:de,edgeObj:C,rank:H},we=Z.addDummyNode(F,"edge",ve,"_d"),H===he&&(ve.width=de.width,ve.height=de.height,ve.dummy="edge-label",ve.labelpos=de.labelpos),F.setEdge(P,we,{weight:de.weight},j),Ee===0&&F.graph().dummyChains.push(we),P=we;F.setEdge(P,D,{weight:de.weight},j)}}function E(F){m.forEach(F.graph().dummyChains,function(C){var P=F.node(C),H=P.edgeLabel,D;for(F.setEdge(P.edgeObj,H);P.dummy;)D=F.successors(C)[0],F.removeNode(C),H.points.push({x:P.x,y:P.y}),P.dummy==="edge-label"&&(H.x=P.x,H.y=P.y,H.width=P.width,H.height=P.height),C=D,P=F.node(C)})}},52205:function(Be,Me,b){var m=b(72361);Be.exports=Z;function Z(V,N,E){var F={},C;m.forEach(E,function(P){for(var H=V.parent(P),D,X;H;){if(D=V.parent(H),D?(X=F[D],F[D]=H):(X=C,C=H),X&&X!==H){N.setEdge(X,H);return}H=D}})}},99506:function(Be,Me,b){var m=b(72361);Be.exports=Z;function Z(V,N){return m.map(N,function(E){var F=V.inEdges(E);if(F.length){var C=m.reduce(F,function(P,H){var D=V.edge(H),X=V.node(H.v);return{sum:P.sum+D.weight*X.order,weight:P.weight+D.weight}},{sum:0,weight:0});return{v:E,barycenter:C.sum/C.weight,weight:C.weight}}else return{v:E}})}},59105:function(Be,Me,b){var m=b(72361),Z=b(76626).Graph;Be.exports=V;function V(E,F,C){var P=N(E),H=new Z({compound:!0}).setGraph({root:P}).setDefaultNodeLabel(function(D){return E.node(D)});return m.forEach(E.nodes(),function(D){var X=E.node(D),j=E.parent(D);(X.rank===F||X.minRank<=F&&F<=X.maxRank)&&(H.setNode(D),H.setParent(D,j||P),m.forEach(E[C](D),function(de){var he=de.v===D?de.w:de.v,we=H.edge(he,D),ve=m.isUndefined(we)?0:we.weight;H.setEdge(he,D,{weight:E.edge(de).weight+ve})}),m.has(X,"minRank")&&H.setNode(D,{borderLeft:X.borderLeft[F],borderRight:X.borderRight[F]}))}),H}function N(E){for(var F;E.hasNode(F=m.uniqueId("_root")););return F}},45456:function(Be,Me,b){"use strict";var m=b(72361);Be.exports=Z;function Z(N,E){for(var F=0,C=1;C<E.length;++C)F+=V(N,E[C-1],E[C]);return F}function V(N,E,F){for(var C=m.zipObject(F,m.map(F,function(de,he){return he})),P=m.flatten(m.map(E,function(de){return m.sortBy(m.map(N.outEdges(de),function(he){return{pos:C[he.w],weight:N.edge(he).weight}}),"pos")}),!0),H=1;H<F.length;)H<<=1;var D=2*H-1;H-=1;var X=m.map(new Array(D),function(){return 0}),j=0;return m.forEach(P.forEach(function(de){var he=de.pos+H;X[he]+=de.weight;for(var we=0;he>0;)he%2&&(we+=X[he+1]),he=he-1>>1,X[he]+=de.weight;j+=de.weight*we})),j}},62852:function(Be,Me,b){"use strict";var m=b(72361),Z=b(18043),V=b(45456),N=b(86490),E=b(59105),F=b(52205),C=b(76626).Graph,P=b(53063);Be.exports=H;function H(de){var he=P.maxRank(de),we=D(de,m.range(1,he+1),"inEdges"),ve=D(de,m.range(he-1,-1,-1),"outEdges"),Ee=Z(de);j(de,Ee);for(var $e=Number.POSITIVE_INFINITY,Fe,ct=0,vt=0;vt<4;++ct,++vt){X(ct%2?we:ve,ct%4>=2),Ee=P.buildLayerMatrix(de);var at=V(de,Ee);at<$e&&(vt=0,Fe=m.cloneDeep(Ee),$e=at)}j(de,Fe)}function D(de,he,we){return m.map(he,function(ve){return E(de,ve,we)})}function X(de,he){var we=new C;m.forEach(de,function(ve){var Ee=ve.graph().root,$e=N(ve,Ee,we,he);m.forEach($e.vs,function(Fe,ct){ve.node(Fe).order=ct}),F(ve,we,$e.vs)})}function j(de,he){m.forEach(he,function(we){m.forEach(we,function(ve,Ee){de.node(ve).order=Ee})})}},18043:function(Be,Me,b){"use strict";var m=b(72361);Be.exports=Z;function Z(V){var N={},E=m.filter(V.nodes(),function(D){return!V.children(D).length}),F=m.max(m.map(E,function(D){return V.node(D).rank})),C=m.map(m.range(F+1),function(){return[]});function P(D){if(!m.has(N,D)){N[D]=!0;var X=V.node(D);C[X.rank].push(D),m.forEach(V.successors(D),P)}}var H=m.sortBy(E,function(D){return V.node(D).rank});return m.forEach(H,P),C}},45926:function(Be,Me,b){"use strict";var m=b(72361);Be.exports=Z;function Z(E,F){var C={};m.forEach(E,function(H,D){var X=C[H.v]={indegree:0,in:[],out:[],vs:[H.v],i:D};m.isUndefined(H.barycenter)||(X.barycenter=H.barycenter,X.weight=H.weight)}),m.forEach(F.edges(),function(H){var D=C[H.v],X=C[H.w];!m.isUndefined(D)&&!m.isUndefined(X)&&(X.indegree++,D.out.push(C[H.w]))});var P=m.filter(C,function(H){return!H.indegree});return V(P)}function V(E){var F=[];function C(D){return function(X){X.merged||(m.isUndefined(X.barycenter)||m.isUndefined(D.barycenter)||X.barycenter>=D.barycenter)&&N(D,X)}}function P(D){return function(X){X.in.push(D),--X.indegree===0&&E.push(X)}}for(;E.length;){var H=E.pop();F.push(H),m.forEach(H.in.reverse(),C(H)),m.forEach(H.out,P(H))}return m.map(m.filter(F,function(D){return!D.merged}),function(D){return m.pick(D,["vs","i","barycenter","weight"])})}function N(E,F){var C=0,P=0;E.weight&&(C+=E.barycenter*E.weight,P+=E.weight),F.weight&&(C+=F.barycenter*F.weight,P+=F.weight),E.vs=F.vs.concat(E.vs),E.barycenter=C/P,E.weight=P,E.i=Math.min(F.i,E.i),F.merged=!0}},86490:function(Be,Me,b){var m=b(72361),Z=b(99506),V=b(45926),N=b(1349);Be.exports=E;function E(P,H,D,X){var j=P.children(H),de=P.node(H),he=de?de.borderLeft:void 0,we=de?de.borderRight:void 0,ve={};he&&(j=m.filter(j,function(at){return at!==he&&at!==we}));var Ee=Z(P,j);m.forEach(Ee,function(at){if(P.children(at.v).length){var kt=E(P,at.v,D,X);ve[at.v]=kt,m.has(kt,"barycenter")&&C(at,kt)}});var $e=V(Ee,D);F($e,ve);var Fe=N($e,X);if(he&&(Fe.vs=m.flatten([he,Fe.vs,we],!0),P.predecessors(he).length)){var ct=P.node(P.predecessors(he)[0]),vt=P.node(P.predecessors(we)[0]);m.has(Fe,"barycenter")||(Fe.barycenter=0,Fe.weight=0),Fe.barycenter=(Fe.barycenter*Fe.weight+ct.order+vt.order)/(Fe.weight+2),Fe.weight+=2}return Fe}function F(P,H){m.forEach(P,function(D){D.vs=m.flatten(D.vs.map(function(X){return H[X]?H[X].vs:X}),!0)})}function C(P,H){m.isUndefined(P.barycenter)?(P.barycenter=H.barycenter,P.weight=H.weight):(P.barycenter=(P.barycenter*P.weight+H.barycenter*H.weight)/(P.weight+H.weight),P.weight+=H.weight)}},1349:function(Be,Me,b){var m=b(72361),Z=b(53063);Be.exports=V;function V(F,C){var P=Z.partition(F,function(ve){return m.has(ve,"barycenter")}),H=P.lhs,D=m.sortBy(P.rhs,function(ve){return-ve.i}),X=[],j=0,de=0,he=0;H.sort(E(!!C)),he=N(X,D,he),m.forEach(H,function(ve){he+=ve.vs.length,X.push(ve.vs),j+=ve.barycenter*ve.weight,de+=ve.weight,he=N(X,D,he)});var we={vs:m.flatten(X,!0)};return de&&(we.barycenter=j/de,we.weight=de),we}function N(F,C,P){for(var H;C.length&&(H=m.last(C)).i<=P;)C.pop(),F.push(H.vs),P++;return P}function E(F){return function(C,P){return C.barycenter<P.barycenter?-1:C.barycenter>P.barycenter?1:F?P.i-C.i:C.i-P.i}}},71970:function(Be,Me,b){var m=b(72361);Be.exports=Z;function Z(E){var F=N(E);m.forEach(E.graph().dummyChains,function(C){for(var P=E.node(C),H=P.edgeObj,D=V(E,F,H.v,H.w),X=D.path,j=D.lca,de=0,he=X[de],we=!0;C!==H.w;){if(P=E.node(C),we){for(;(he=X[de])!==j&&E.node(he).maxRank<P.rank;)de++;he===j&&(we=!1)}if(!we){for(;de<X.length-1&&E.node(he=X[de+1]).minRank<=P.rank;)de++;he=X[de]}E.setParent(C,he),C=E.successors(C)[0]}})}function V(E,F,C,P){var H=[],D=[],X=Math.min(F[C].low,F[P].low),j=Math.max(F[C].lim,F[P].lim),de,he;de=C;do de=E.parent(de),H.push(de);while(de&&(F[de].low>X||j>F[de].lim));for(he=de,de=P;(de=E.parent(de))!==he;)D.push(de);return{path:H.concat(D.reverse()),lca:he}}function N(E){var F={},C=0;function P(H){var D=C;m.forEach(E.children(H),P),F[H]={low:D,lim:C++}}return m.forEach(E.children(),P),F}},92080:function(Be,Me,b){"use strict";var m=b(72361),Z=b(76626).Graph,V=b(53063);Be.exports={positionX:we,findType1Conflicts:N,findType2Conflicts:E,addConflict:C,hasConflict:P,verticalAlignment:H,horizontalCompaction:D,alignCoordinates:de,findSmallestWidthAlignment:j,balance:he};function N($e,Fe){var ct={};function vt(at,kt){var It=0,Bn=0,Lt=at.length,Wn=m.last(kt);return m.forEach(kt,function(Xn,In){var zn=F($e,Xn),dr=zn?$e.node(zn).order:Lt;(zn||Xn===Wn)&&(m.forEach(kt.slice(Bn,In+1),function(vn){m.forEach($e.predecessors(vn),function(_r){var Ge=$e.node(_r),Tt=Ge.order;(Tt<It||dr<Tt)&&!(Ge.dummy&&$e.node(vn).dummy)&&C(ct,_r,vn)})}),Bn=In+1,It=dr)}),kt}return m.reduce(Fe,vt),ct}function E($e,Fe){var ct={};function vt(kt,It,Bn,Lt,Wn){var Xn;m.forEach(m.range(It,Bn),function(In){Xn=kt[In],$e.node(Xn).dummy&&m.forEach($e.predecessors(Xn),function(zn){var dr=$e.node(zn);dr.dummy&&(dr.order<Lt||dr.order>Wn)&&C(ct,zn,Xn)})})}function at(kt,It){var Bn=-1,Lt,Wn=0;return m.forEach(It,function(Xn,In){if($e.node(Xn).dummy==="border"){var zn=$e.predecessors(Xn);zn.length&&(Lt=$e.node(zn[0]).order,vt(It,Wn,In,Bn,Lt),Wn=In,Bn=Lt)}vt(It,Wn,It.length,Lt,kt.length)}),It}return m.reduce(Fe,at),ct}function F($e,Fe){if($e.node(Fe).dummy)return m.find($e.predecessors(Fe),function(ct){return $e.node(ct).dummy})}function C($e,Fe,ct){if(Fe>ct){var vt=Fe;Fe=ct,ct=vt}var at=$e[Fe];at||($e[Fe]=at={}),at[ct]=!0}function P($e,Fe,ct){if(Fe>ct){var vt=Fe;Fe=ct,ct=vt}return m.has($e[Fe],ct)}function H($e,Fe,ct,vt){var at={},kt={},It={};return m.forEach(Fe,function(Bn){m.forEach(Bn,function(Lt,Wn){at[Lt]=Lt,kt[Lt]=Lt,It[Lt]=Wn})}),m.forEach(Fe,function(Bn){var Lt=-1;m.forEach(Bn,function(Wn){var Xn=vt(Wn);if(Xn.length){Xn=m.sortBy(Xn,function(_r){return It[_r]});for(var In=(Xn.length-1)/2,zn=Math.floor(In),dr=Math.ceil(In);zn<=dr;++zn){var vn=Xn[zn];kt[Wn]===Wn&&Lt<It[vn]&&!P(ct,Wn,vn)&&(kt[vn]=Wn,kt[Wn]=at[Wn]=at[vn],Lt=It[vn])}}})}),{root:at,align:kt}}function D($e,Fe,ct,vt,at){var kt={},It=X($e,Fe,ct,at),Bn=at?"borderLeft":"borderRight";function Lt(In,zn){for(var dr=It.nodes(),vn=dr.pop(),_r={};vn;)_r[vn]?In(vn):(_r[vn]=!0,dr.push(vn),dr=dr.concat(zn(vn))),vn=dr.pop()}function Wn(In){kt[In]=It.inEdges(In).reduce(function(zn,dr){return Math.max(zn,kt[dr.v]+It.edge(dr))},0)}function Xn(In){var zn=It.outEdges(In).reduce(function(vn,_r){return Math.min(vn,kt[_r.w]-It.edge(_r))},Number.POSITIVE_INFINITY),dr=$e.node(In);zn!==Number.POSITIVE_INFINITY&&dr.borderType!==Bn&&(kt[In]=Math.max(kt[In],zn))}return Lt(Wn,It.predecessors.bind(It)),Lt(Xn,It.successors.bind(It)),m.forEach(vt,function(In){kt[In]=kt[ct[In]]}),kt}function X($e,Fe,ct,vt){var at=new Z,kt=$e.graph(),It=ve(kt.nodesep,kt.edgesep,vt);return m.forEach(Fe,function(Bn){var Lt;m.forEach(Bn,function(Wn){var Xn=ct[Wn];if(at.setNode(Xn),Lt){var In=ct[Lt],zn=at.edge(In,Xn);at.setEdge(In,Xn,Math.max(It($e,Wn,Lt),zn||0))}Lt=Wn})}),at}function j($e,Fe){return m.minBy(m.values(Fe),function(ct){var vt=Number.NEGATIVE_INFINITY,at=Number.POSITIVE_INFINITY;return m.forIn(ct,function(kt,It){var Bn=Ee($e,It)/2;vt=Math.max(kt+Bn,vt),at=Math.min(kt-Bn,at)}),vt-at})}function de($e,Fe){var ct=m.values(Fe),vt=m.min(ct),at=m.max(ct);m.forEach(["u","d"],function(kt){m.forEach(["l","r"],function(It){var Bn=kt+It,Lt=$e[Bn],Wn;if(Lt!==Fe){var Xn=m.values(Lt);Wn=It==="l"?vt-m.min(Xn):at-m.max(Xn),Wn&&($e[Bn]=m.mapValues(Lt,function(In){return In+Wn}))}})})}function he($e,Fe){return m.mapValues($e.ul,function(ct,vt){if(Fe)return $e[Fe.toLowerCase()][vt];var at=m.sortBy(m.map($e,vt));return(at[1]+at[2])/2})}function we($e){var Fe=V.buildLayerMatrix($e),ct=m.merge(N($e,Fe),E($e,Fe)),vt={},at;m.forEach(["u","d"],function(It){at=It==="u"?Fe:m.values(Fe).reverse(),m.forEach(["l","r"],function(Bn){Bn==="r"&&(at=m.map(at,function(In){return m.values(In).reverse()}));var Lt=(It==="u"?$e.predecessors:$e.successors).bind($e),Wn=H($e,at,ct,Lt),Xn=D($e,at,Wn.root,Wn.align,Bn==="r");Bn==="r"&&(Xn=m.mapValues(Xn,function(In){return-In})),vt[It+Bn]=Xn})});var kt=j($e,vt);return de(vt,kt),he(vt,$e.graph().align)}function ve($e,Fe,ct){return function(vt,at,kt){var It=vt.node(at),Bn=vt.node(kt),Lt=0,Wn;if(Lt+=It.width/2,m.has(It,"labelpos"))switch(It.labelpos.toLowerCase()){case"l":Wn=-It.width/2;break;case"r":Wn=It.width/2;break}if(Wn&&(Lt+=ct?Wn:-Wn),Wn=0,Lt+=(It.dummy?Fe:$e)/2,Lt+=(Bn.dummy?Fe:$e)/2,Lt+=Bn.width/2,m.has(Bn,"labelpos"))switch(Bn.labelpos.toLowerCase()){case"l":Wn=Bn.width/2;break;case"r":Wn=-Bn.width/2;break}return Wn&&(Lt+=ct?Wn:-Wn),Wn=0,Lt}}function Ee($e,Fe){return $e.node(Fe).width}},93021:function(Be,Me,b){"use strict";var m=b(72361),Z=b(53063),V=b(92080).positionX;Be.exports=N;function N(F){F=Z.asNonCompoundGraph(F),E(F),m.forEach(V(F),function(C,P){F.node(P).x=C})}function E(F){var C=Z.buildLayerMatrix(F),P=F.graph().ranksep,H=0;m.forEach(C,function(D){var X=m.max(m.map(D,function(j){return F.node(j).height}));m.forEach(D,function(j){F.node(j).y=H+X/2}),H+=X+P})}},61031:function(Be,Me,b){"use strict";var m=b(72361),Z=b(76626).Graph,V=b(2416).slack;Be.exports=N;function N(P){var H=new Z({directed:!1}),D=P.nodes()[0],X=P.nodeCount();H.setNode(D,{});for(var j,de;E(H,P)<X;)j=F(H,P),de=H.hasNode(j.v)?V(P,j):-V(P,j),C(H,P,de);return H}function E(P,H){function D(X){m.forEach(H.nodeEdges(X),function(j){var de=j.v,he=X===de?j.w:de;!P.hasNode(he)&&!V(H,j)&&(P.setNode(he,{}),P.setEdge(X,he,{}),D(he))})}return m.forEach(P.nodes(),D),P.nodeCount()}function F(P,H){return m.minBy(H.edges(),function(D){if(P.hasNode(D.v)!==P.hasNode(D.w))return V(H,D)})}function C(P,H,D){m.forEach(P.nodes(),function(X){H.node(X).rank+=D})}},64505:function(Be,Me,b){"use strict";var m=b(2416),Z=m.longestPath,V=b(61031),N=b(77076);Be.exports=E;function E(H){switch(H.graph().ranker){case"network-simplex":P(H);break;case"tight-tree":C(H);break;case"longest-path":F(H);break;default:P(H)}}var F=Z;function C(H){Z(H),V(H)}function P(H){N(H)}},77076:function(Be,Me,b){"use strict";var m=b(72361),Z=b(61031),V=b(2416).slack,N=b(2416).longestPath,E=b(76626).alg.preorder,F=b(76626).alg.postorder,C=b(53063).simplify;Be.exports=P,P.initLowLimValues=j,P.initCutValues=H,P.calcCutValue=X,P.leaveEdge=he,P.enterEdge=we,P.exchangeEdges=ve;function P(ct){ct=C(ct),N(ct);var vt=Z(ct);j(vt),H(vt,ct);for(var at,kt;at=he(vt);)kt=we(vt,ct,at),ve(vt,ct,at,kt)}function H(ct,vt){var at=F(ct,ct.nodes());at=at.slice(0,at.length-1),m.forEach(at,function(kt){D(ct,vt,kt)})}function D(ct,vt,at){var kt=ct.node(at),It=kt.parent;ct.edge(at,It).cutvalue=X(ct,vt,at)}function X(ct,vt,at){var kt=ct.node(at),It=kt.parent,Bn=!0,Lt=vt.edge(at,It),Wn=0;return Lt||(Bn=!1,Lt=vt.edge(It,at)),Wn=Lt.weight,m.forEach(vt.nodeEdges(at),function(Xn){var In=Xn.v===at,zn=In?Xn.w:Xn.v;if(zn!==It){var dr=In===Bn,vn=vt.edge(Xn).weight;if(Wn+=dr?vn:-vn,$e(ct,at,zn)){var _r=ct.edge(at,zn).cutvalue;Wn+=dr?-_r:_r}}}),Wn}function j(ct,vt){arguments.length<2&&(vt=ct.nodes()[0]),de(ct,{},1,vt)}function de(ct,vt,at,kt,It){var Bn=at,Lt=ct.node(kt);return vt[kt]=!0,m.forEach(ct.neighbors(kt),function(Wn){m.has(vt,Wn)||(at=de(ct,vt,at,Wn,kt))}),Lt.low=Bn,Lt.lim=at++,It?Lt.parent=It:delete Lt.parent,at}function he(ct){return m.find(ct.edges(),function(vt){return ct.edge(vt).cutvalue<0})}function we(ct,vt,at){var kt=at.v,It=at.w;vt.hasEdge(kt,It)||(kt=at.w,It=at.v);var Bn=ct.node(kt),Lt=ct.node(It),Wn=Bn,Xn=!1;Bn.lim>Lt.lim&&(Wn=Lt,Xn=!0);var In=m.filter(vt.edges(),function(zn){return Xn===Fe(ct,ct.node(zn.v),Wn)&&Xn!==Fe(ct,ct.node(zn.w),Wn)});return m.minBy(In,function(zn){return V(vt,zn)})}function ve(ct,vt,at,kt){var It=at.v,Bn=at.w;ct.removeEdge(It,Bn),ct.setEdge(kt.v,kt.w,{}),j(ct),H(ct,vt),Ee(ct,vt)}function Ee(ct,vt){var at=m.find(ct.nodes(),function(It){return!vt.node(It).parent}),kt=E(ct,at);kt=kt.slice(1),m.forEach(kt,function(It){var Bn=ct.node(It).parent,Lt=vt.edge(It,Bn),Wn=!1;Lt||(Lt=vt.edge(Bn,It),Wn=!0),vt.node(It).rank=vt.node(Bn).rank+(Wn?Lt.minlen:-Lt.minlen)})}function $e(ct,vt,at){return ct.hasEdge(vt,at)}function Fe(ct,vt,at){return at.low<=vt.lim&&vt.lim<=at.lim}},2416:function(Be,Me,b){"use strict";var m=b(72361);Be.exports={longestPath:Z,slack:V};function Z(N){var E={};function F(C){var P=N.node(C);if(m.has(E,C))return P.rank;E[C]=!0;var H=m.min(m.map(N.outEdges(C),function(D){return F(D.w)-N.edge(D).minlen}));return(H===Number.POSITIVE_INFINITY||H===void 0||H===null)&&(H=0),P.rank=H}m.forEach(N.sources(),F)}function V(N,E){return N.node(E.w).rank-N.node(E.v).rank-N.edge(E).minlen}},53063:function(Be,Me,b){"use strict";var m=b(72361),Z=b(76626).Graph;Be.exports={addDummyNode:V,simplify:N,asNonCompoundGraph:E,successorWeights:F,predecessorWeights:C,intersectRect:P,buildLayerMatrix:H,normalizeRanks:D,removeEmptyRanks:X,addBorderNode:j,maxRank:de,partition:he,time:we,notime:ve};function V(Ee,$e,Fe,ct){var vt;do vt=m.uniqueId(ct);while(Ee.hasNode(vt));return Fe.dummy=$e,Ee.setNode(vt,Fe),vt}function N(Ee){var $e=new Z().setGraph(Ee.graph());return m.forEach(Ee.nodes(),function(Fe){$e.setNode(Fe,Ee.node(Fe))}),m.forEach(Ee.edges(),function(Fe){var ct=$e.edge(Fe.v,Fe.w)||{weight:0,minlen:1},vt=Ee.edge(Fe);$e.setEdge(Fe.v,Fe.w,{weight:ct.weight+vt.weight,minlen:Math.max(ct.minlen,vt.minlen)})}),$e}function E(Ee){var $e=new Z({multigraph:Ee.isMultigraph()}).setGraph(Ee.graph());return m.forEach(Ee.nodes(),function(Fe){Ee.children(Fe).length||$e.setNode(Fe,Ee.node(Fe))}),m.forEach(Ee.edges(),function(Fe){$e.setEdge(Fe,Ee.edge(Fe))}),$e}function F(Ee){var $e=m.map(Ee.nodes(),function(Fe){var ct={};return m.forEach(Ee.outEdges(Fe),function(vt){ct[vt.w]=(ct[vt.w]||0)+Ee.edge(vt).weight}),ct});return m.zipObject(Ee.nodes(),$e)}function C(Ee){var $e=m.map(Ee.nodes(),function(Fe){var ct={};return m.forEach(Ee.inEdges(Fe),function(vt){ct[vt.v]=(ct[vt.v]||0)+Ee.edge(vt).weight}),ct});return m.zipObject(Ee.nodes(),$e)}function P(Ee,$e){var Fe=Ee.x,ct=Ee.y,vt=$e.x-Fe,at=$e.y-ct,kt=Ee.width/2,It=Ee.height/2;if(!vt&&!at)throw new Error("Not possible to find intersection inside of the rectangle");var Bn,Lt;return Math.abs(at)*kt>Math.abs(vt)*It?(at<0&&(It=-It),Bn=It*vt/at,Lt=It):(vt<0&&(kt=-kt),Bn=kt,Lt=kt*at/vt),{x:Fe+Bn,y:ct+Lt}}function H(Ee){var $e=m.map(m.range(de(Ee)+1),function(){return[]});return m.forEach(Ee.nodes(),function(Fe){var ct=Ee.node(Fe),vt=ct.rank;m.isUndefined(vt)||($e[vt][ct.order]=Fe)}),$e}function D(Ee){var $e=m.min(m.map(Ee.nodes(),function(Fe){return Ee.node(Fe).rank}));m.forEach(Ee.nodes(),function(Fe){var ct=Ee.node(Fe);m.has(ct,"rank")&&(ct.rank-=$e)})}function X(Ee){var $e=m.min(m.map(Ee.nodes(),function(at){return Ee.node(at).rank})),Fe=[];m.forEach(Ee.nodes(),function(at){var kt=Ee.node(at).rank-$e;Fe[kt]||(Fe[kt]=[]),Fe[kt].push(at)});var ct=0,vt=Ee.graph().nodeRankFactor;m.forEach(Fe,function(at,kt){m.isUndefined(at)&&kt%vt!==0?--ct:ct&&m.forEach(at,function(It){Ee.node(It).rank+=ct})})}function j(Ee,$e,Fe,ct){var vt={width:0,height:0};return arguments.length>=4&&(vt.rank=Fe,vt.order=ct),V(Ee,"border",vt,$e)}function de(Ee){return m.max(m.map(Ee.nodes(),function($e){var Fe=Ee.node($e).rank;if(!m.isUndefined(Fe))return Fe}))}function he(Ee,$e){var Fe={lhs:[],rhs:[]};return m.forEach(Ee,function(ct){$e(ct)?Fe.lhs.push(ct):Fe.rhs.push(ct)}),Fe}function we(Ee,$e){var Fe=m.now();try{return $e()}finally{console.log(Ee+" time: "+(m.now()-Fe)+"ms")}}function ve(Ee,$e){return $e()}},11897:function(Be){Be.exports="0.8.5"},37271:function(Be){"use strict";var Me=Object.prototype.hasOwnProperty,b="~";function m(){}Object.create&&(m.prototype=Object.create(null),new m().__proto__||(b=!1));function Z(F,C,P){this.fn=F,this.context=C,this.once=P||!1}function V(F,C,P,H,D){if(typeof P!="function")throw new TypeError("The listener must be a function");var X=new Z(P,H||F,D),j=b?b+C:C;return F._events[j]?F._events[j].fn?F._events[j]=[F._events[j],X]:F._events[j].push(X):(F._events[j]=X,F._eventsCount++),F}function N(F,C){--F._eventsCount===0?F._events=new m:delete F._events[C]}function E(){this._events=new m,this._eventsCount=0}E.prototype.eventNames=function(){var C=[],P,H;if(this._eventsCount===0)return C;for(H in P=this._events)Me.call(P,H)&&C.push(b?H.slice(1):H);return Object.getOwnPropertySymbols?C.concat(Object.getOwnPropertySymbols(P)):C},E.prototype.listeners=function(C){var P=b?b+C:C,H=this._events[P];if(!H)return[];if(H.fn)return[H.fn];for(var D=0,X=H.length,j=new Array(X);D<X;D++)j[D]=H[D].fn;return j},E.prototype.listenerCount=function(C){var P=b?b+C:C,H=this._events[P];return H?H.fn?1:H.length:0},E.prototype.emit=function(C,P,H,D,X,j){var de=b?b+C:C;if(!this._events[de])return!1;var he=this._events[de],we=arguments.length,ve,Ee;if(he.fn){switch(he.once&&this.removeListener(C,he.fn,void 0,!0),we){case 1:return he.fn.call(he.context),!0;case 2:return he.fn.call(he.context,P),!0;case 3:return he.fn.call(he.context,P,H),!0;case 4:return he.fn.call(he.context,P,H,D),!0;case 5:return he.fn.call(he.context,P,H,D,X),!0;case 6:return he.fn.call(he.context,P,H,D,X,j),!0}for(Ee=1,ve=new Array(we-1);Ee<we;Ee++)ve[Ee-1]=arguments[Ee];he.fn.apply(he.context,ve)}else{var $e=he.length,Fe;for(Ee=0;Ee<$e;Ee++)switch(he[Ee].once&&this.removeListener(C,he[Ee].fn,void 0,!0),we){case 1:he[Ee].fn.call(he[Ee].context);break;case 2:he[Ee].fn.call(he[Ee].context,P);break;case 3:he[Ee].fn.call(he[Ee].context,P,H);break;case 4:he[Ee].fn.call(he[Ee].context,P,H,D);break;default:if(!ve)for(Fe=1,ve=new Array(we-1);Fe<we;Fe++)ve[Fe-1]=arguments[Fe];he[Ee].fn.apply(he[Ee].context,ve)}}return!0},E.prototype.on=function(C,P,H){return V(this,C,P,H,!1)},E.prototype.once=function(C,P,H){return V(this,C,P,H,!0)},E.prototype.removeListener=function(C,P,H,D){var X=b?b+C:C;if(!this._events[X])return this;if(!P)return N(this,X),this;var j=this._events[X];if(j.fn)j.fn===P&&(!D||j.once)&&(!H||j.context===H)&&N(this,X);else{for(var de=0,he=[],we=j.length;de<we;de++)(j[de].fn!==P||D&&!j[de].once||H&&j[de].context!==H)&&he.push(j[de]);he.length?this._events[X]=he.length===1?he[0]:he:N(this,X)}return this},E.prototype.removeAllListeners=function(C){var P;return C?(P=b?b+C:C,this._events[P]&&N(this,P)):(this._events=new m,this._eventsCount=0),this},E.prototype.off=E.prototype.removeListener,E.prototype.addListener=E.prototype.on,E.prefixed=b,E.EventEmitter=E,Be.exports=E},85551:function(Be,Me,b){"use strict";b.d(Me,{Ib:function(){return m},WT:function(){return Z},yy:function(){return N}});var m=1e-6,Z=typeof Float32Array!="undefined"?Float32Array:Array,V=Math.random,N="zyx";function E(j){return j>=0?Math.round(j):j%.5===0?Math.floor(j):Math.round(j)}function F(j){Z=j}var C=Math.PI/180,P=180/Math.PI;function H(j){return j*C}function D(j){return j*P}function X(j,de){var he=arguments.length>2&&arguments[2]!==void 0?arguments[2]:m;return Math.abs(j-de)<=he*Math.max(1,Math.abs(j),Math.abs(de))}},79111:function(Be,Me,b){"use strict";b.d(Me,{Ue:function(){return Z},al:function(){return F},xO:function(){return V}});var m=b(85551);function Z(){var Ge=new m.WT(9);return m.WT!=Float32Array&&(Ge[1]=0,Ge[2]=0,Ge[3]=0,Ge[5]=0,Ge[6]=0,Ge[7]=0),Ge[0]=1,Ge[4]=1,Ge[8]=1,Ge}function V(Ge,Tt){return Ge[0]=Tt[0],Ge[1]=Tt[1],Ge[2]=Tt[2],Ge[3]=Tt[4],Ge[4]=Tt[5],Ge[5]=Tt[6],Ge[6]=Tt[8],Ge[7]=Tt[9],Ge[8]=Tt[10],Ge}function N(Ge){var Tt=new glMatrix.ARRAY_TYPE(9);return Tt[0]=Ge[0],Tt[1]=Ge[1],Tt[2]=Ge[2],Tt[3]=Ge[3],Tt[4]=Ge[4],Tt[5]=Ge[5],Tt[6]=Ge[6],Tt[7]=Ge[7],Tt[8]=Ge[8],Tt}function E(Ge,Tt){return Ge[0]=Tt[0],Ge[1]=Tt[1],Ge[2]=Tt[2],Ge[3]=Tt[3],Ge[4]=Tt[4],Ge[5]=Tt[5],Ge[6]=Tt[6],Ge[7]=Tt[7],Ge[8]=Tt[8],Ge}function F(Ge,Tt,On,Vr,en,ln,Cn,Mt,Et){var pe=new m.WT(9);return pe[0]=Ge,pe[1]=Tt,pe[2]=On,pe[3]=Vr,pe[4]=en,pe[5]=ln,pe[6]=Cn,pe[7]=Mt,pe[8]=Et,pe}function C(Ge,Tt,On,Vr,en,ln,Cn,Mt,Et,pe){return Ge[0]=Tt,Ge[1]=On,Ge[2]=Vr,Ge[3]=en,Ge[4]=ln,Ge[5]=Cn,Ge[6]=Mt,Ge[7]=Et,Ge[8]=pe,Ge}function P(Ge){return Ge[0]=1,Ge[1]=0,Ge[2]=0,Ge[3]=0,Ge[4]=1,Ge[5]=0,Ge[6]=0,Ge[7]=0,Ge[8]=1,Ge}function H(Ge,Tt){if(Ge===Tt){var On=Tt[1],Vr=Tt[2],en=Tt[5];Ge[1]=Tt[3],Ge[2]=Tt[6],Ge[3]=On,Ge[5]=Tt[7],Ge[6]=Vr,Ge[7]=en}else Ge[0]=Tt[0],Ge[1]=Tt[3],Ge[2]=Tt[6],Ge[3]=Tt[1],Ge[4]=Tt[4],Ge[5]=Tt[7],Ge[6]=Tt[2],Ge[7]=Tt[5],Ge[8]=Tt[8];return Ge}function D(Ge,Tt){var On=Tt[0],Vr=Tt[1],en=Tt[2],ln=Tt[3],Cn=Tt[4],Mt=Tt[5],Et=Tt[6],pe=Tt[7],Ae=Tt[8],Pe=Ae*Cn-Mt*pe,Ut=-Ae*ln+Mt*Et,jt=pe*ln-Cn*Et,ft=On*Pe+Vr*Ut+en*jt;return ft?(ft=1/ft,Ge[0]=Pe*ft,Ge[1]=(-Ae*Vr+en*pe)*ft,Ge[2]=(Mt*Vr-en*Cn)*ft,Ge[3]=Ut*ft,Ge[4]=(Ae*On-en*Et)*ft,Ge[5]=(-Mt*On+en*ln)*ft,Ge[6]=jt*ft,Ge[7]=(-pe*On+Vr*Et)*ft,Ge[8]=(Cn*On-Vr*ln)*ft,Ge):null}function X(Ge,Tt){var On=Tt[0],Vr=Tt[1],en=Tt[2],ln=Tt[3],Cn=Tt[4],Mt=Tt[5],Et=Tt[6],pe=Tt[7],Ae=Tt[8];return Ge[0]=Cn*Ae-Mt*pe,Ge[1]=en*pe-Vr*Ae,Ge[2]=Vr*Mt-en*Cn,Ge[3]=Mt*Et-ln*Ae,Ge[4]=On*Ae-en*Et,Ge[5]=en*ln-On*Mt,Ge[6]=ln*pe-Cn*Et,Ge[7]=Vr*Et-On*pe,Ge[8]=On*Cn-Vr*ln,Ge}function j(Ge){var Tt=Ge[0],On=Ge[1],Vr=Ge[2],en=Ge[3],ln=Ge[4],Cn=Ge[5],Mt=Ge[6],Et=Ge[7],pe=Ge[8];return Tt*(pe*ln-Cn*Et)+On*(-pe*en+Cn*Mt)+Vr*(Et*en-ln*Mt)}function de(Ge,Tt,On){var Vr=Tt[0],en=Tt[1],ln=Tt[2],Cn=Tt[3],Mt=Tt[4],Et=Tt[5],pe=Tt[6],Ae=Tt[7],Pe=Tt[8],Ut=On[0],jt=On[1],ft=On[2],on=On[3],hn=On[4],lt=On[5],Ct=On[6],sn=On[7],W=On[8];return Ge[0]=Ut*Vr+jt*Cn+ft*pe,Ge[1]=Ut*en+jt*Mt+ft*Ae,Ge[2]=Ut*ln+jt*Et+ft*Pe,Ge[3]=on*Vr+hn*Cn+lt*pe,Ge[4]=on*en+hn*Mt+lt*Ae,Ge[5]=on*ln+hn*Et+lt*Pe,Ge[6]=Ct*Vr+sn*Cn+W*pe,Ge[7]=Ct*en+sn*Mt+W*Ae,Ge[8]=Ct*ln+sn*Et+W*Pe,Ge}function he(Ge,Tt,On){var Vr=Tt[0],en=Tt[1],ln=Tt[2],Cn=Tt[3],Mt=Tt[4],Et=Tt[5],pe=Tt[6],Ae=Tt[7],Pe=Tt[8],Ut=On[0],jt=On[1];return Ge[0]=Vr,Ge[1]=en,Ge[2]=ln,Ge[3]=Cn,Ge[4]=Mt,Ge[5]=Et,Ge[6]=Ut*Vr+jt*Cn+pe,Ge[7]=Ut*en+jt*Mt+Ae,Ge[8]=Ut*ln+jt*Et+Pe,Ge}function we(Ge,Tt,On){var Vr=Tt[0],en=Tt[1],ln=Tt[2],Cn=Tt[3],Mt=Tt[4],Et=Tt[5],pe=Tt[6],Ae=Tt[7],Pe=Tt[8],Ut=Math.sin(On),jt=Math.cos(On);return Ge[0]=jt*Vr+Ut*Cn,Ge[1]=jt*en+Ut*Mt,Ge[2]=jt*ln+Ut*Et,Ge[3]=jt*Cn-Ut*Vr,Ge[4]=jt*Mt-Ut*en,Ge[5]=jt*Et-Ut*ln,Ge[6]=pe,Ge[7]=Ae,Ge[8]=Pe,Ge}function ve(Ge,Tt,On){var Vr=On[0],en=On[1];return Ge[0]=Vr*Tt[0],Ge[1]=Vr*Tt[1],Ge[2]=Vr*Tt[2],Ge[3]=en*Tt[3],Ge[4]=en*Tt[4],Ge[5]=en*Tt[5],Ge[6]=Tt[6],Ge[7]=Tt[7],Ge[8]=Tt[8],Ge}function Ee(Ge,Tt){return Ge[0]=1,Ge[1]=0,Ge[2]=0,Ge[3]=0,Ge[4]=1,Ge[5]=0,Ge[6]=Tt[0],Ge[7]=Tt[1],Ge[8]=1,Ge}function $e(Ge,Tt){var On=Math.sin(Tt),Vr=Math.cos(Tt);return Ge[0]=Vr,Ge[1]=On,Ge[2]=0,Ge[3]=-On,Ge[4]=Vr,Ge[5]=0,Ge[6]=0,Ge[7]=0,Ge[8]=1,Ge}function Fe(Ge,Tt){return Ge[0]=Tt[0],Ge[1]=0,Ge[2]=0,Ge[3]=0,Ge[4]=Tt[1],Ge[5]=0,Ge[6]=0,Ge[7]=0,Ge[8]=1,Ge}function ct(Ge,Tt){return Ge[0]=Tt[0],Ge[1]=Tt[1],Ge[2]=0,Ge[3]=Tt[2],Ge[4]=Tt[3],Ge[5]=0,Ge[6]=Tt[4],Ge[7]=Tt[5],Ge[8]=1,Ge}function vt(Ge,Tt){var On=Tt[0],Vr=Tt[1],en=Tt[2],ln=Tt[3],Cn=On+On,Mt=Vr+Vr,Et=en+en,pe=On*Cn,Ae=Vr*Cn,Pe=Vr*Mt,Ut=en*Cn,jt=en*Mt,ft=en*Et,on=ln*Cn,hn=ln*Mt,lt=ln*Et;return Ge[0]=1-Pe-ft,Ge[3]=Ae-lt,Ge[6]=Ut+hn,Ge[1]=Ae+lt,Ge[4]=1-pe-ft,Ge[7]=jt-on,Ge[2]=Ut-hn,Ge[5]=jt+on,Ge[8]=1-pe-Pe,Ge}function at(Ge,Tt){var On=Tt[0],Vr=Tt[1],en=Tt[2],ln=Tt[3],Cn=Tt[4],Mt=Tt[5],Et=Tt[6],pe=Tt[7],Ae=Tt[8],Pe=Tt[9],Ut=Tt[10],jt=Tt[11],ft=Tt[12],on=Tt[13],hn=Tt[14],lt=Tt[15],Ct=On*Mt-Vr*Cn,sn=On*Et-en*Cn,W=On*pe-ln*Cn,Se=Vr*Et-en*Mt,Ht=Vr*pe-ln*Mt,zt=en*pe-ln*Et,Fn=Ae*on-Pe*ft,Tn=Ae*hn-Ut*ft,lr=Ae*lt-jt*ft,je=Pe*hn-Ut*on,be=Pe*lt-jt*on,it=Ut*lt-jt*hn,wt=Ct*it-sn*be+W*je+Se*lr-Ht*Tn+zt*Fn;return wt?(wt=1/wt,Ge[0]=(Mt*it-Et*be+pe*je)*wt,Ge[1]=(Et*lr-Cn*it-pe*Tn)*wt,Ge[2]=(Cn*be-Mt*lr+pe*Fn)*wt,Ge[3]=(en*be-Vr*it-ln*je)*wt,Ge[4]=(On*it-en*lr+ln*Tn)*wt,Ge[5]=(Vr*lr-On*be-ln*Fn)*wt,Ge[6]=(on*zt-hn*Ht+lt*Se)*wt,Ge[7]=(hn*W-ft*zt-lt*sn)*wt,Ge[8]=(ft*Ht-on*W+lt*Ct)*wt,Ge):null}function kt(Ge,Tt,On){return Ge[0]=2/Tt,Ge[1]=0,Ge[2]=0,Ge[3]=0,Ge[4]=-2/On,Ge[5]=0,Ge[6]=-1,Ge[7]=1,Ge[8]=1,Ge}function It(Ge){return"mat3("+Ge[0]+", "+Ge[1]+", "+Ge[2]+", "+Ge[3]+", "+Ge[4]+", "+Ge[5]+", "+Ge[6]+", "+Ge[7]+", "+Ge[8]+")"}function Bn(Ge){return Math.sqrt(Ge[0]*Ge[0]+Ge[1]*Ge[1]+Ge[2]*Ge[2]+Ge[3]*Ge[3]+Ge[4]*Ge[4]+Ge[5]*Ge[5]+Ge[6]*Ge[6]+Ge[7]*Ge[7]+Ge[8]*Ge[8])}function Lt(Ge,Tt,On){return Ge[0]=Tt[0]+On[0],Ge[1]=Tt[1]+On[1],Ge[2]=Tt[2]+On[2],Ge[3]=Tt[3]+On[3],Ge[4]=Tt[4]+On[4],Ge[5]=Tt[5]+On[5],Ge[6]=Tt[6]+On[6],Ge[7]=Tt[7]+On[7],Ge[8]=Tt[8]+On[8],Ge}function Wn(Ge,Tt,On){return Ge[0]=Tt[0]-On[0],Ge[1]=Tt[1]-On[1],Ge[2]=Tt[2]-On[2],Ge[3]=Tt[3]-On[3],Ge[4]=Tt[4]-On[4],Ge[5]=Tt[5]-On[5],Ge[6]=Tt[6]-On[6],Ge[7]=Tt[7]-On[7],Ge[8]=Tt[8]-On[8],Ge}function Xn(Ge,Tt,On){return Ge[0]=Tt[0]*On,Ge[1]=Tt[1]*On,Ge[2]=Tt[2]*On,Ge[3]=Tt[3]*On,Ge[4]=Tt[4]*On,Ge[5]=Tt[5]*On,Ge[6]=Tt[6]*On,Ge[7]=Tt[7]*On,Ge[8]=Tt[8]*On,Ge}function In(Ge,Tt,On,Vr){return Ge[0]=Tt[0]+On[0]*Vr,Ge[1]=Tt[1]+On[1]*Vr,Ge[2]=Tt[2]+On[2]*Vr,Ge[3]=Tt[3]+On[3]*Vr,Ge[4]=Tt[4]+On[4]*Vr,Ge[5]=Tt[5]+On[5]*Vr,Ge[6]=Tt[6]+On[6]*Vr,Ge[7]=Tt[7]+On[7]*Vr,Ge[8]=Tt[8]+On[8]*Vr,Ge}function zn(Ge,Tt){return Ge[0]===Tt[0]&&Ge[1]===Tt[1]&&Ge[2]===Tt[2]&&Ge[3]===Tt[3]&&Ge[4]===Tt[4]&&Ge[5]===Tt[5]&&Ge[6]===Tt[6]&&Ge[7]===Tt[7]&&Ge[8]===Tt[8]}function dr(Ge,Tt){var On=Ge[0],Vr=Ge[1],en=Ge[2],ln=Ge[3],Cn=Ge[4],Mt=Ge[5],Et=Ge[6],pe=Ge[7],Ae=Ge[8],Pe=Tt[0],Ut=Tt[1],jt=Tt[2],ft=Tt[3],on=Tt[4],hn=Tt[5],lt=Tt[6],Ct=Tt[7],sn=Tt[8];return Math.abs(On-Pe)<=glMatrix.EPSILON*Math.max(1,Math.abs(On),Math.abs(Pe))&&Math.abs(Vr-Ut)<=glMatrix.EPSILON*Math.max(1,Math.abs(Vr),Math.abs(Ut))&&Math.abs(en-jt)<=glMatrix.EPSILON*Math.max(1,Math.abs(en),Math.abs(jt))&&Math.abs(ln-ft)<=glMatrix.EPSILON*Math.max(1,Math.abs(ln),Math.abs(ft))&&Math.abs(Cn-on)<=glMatrix.EPSILON*Math.max(1,Math.abs(Cn),Math.abs(on))&&Math.abs(Mt-hn)<=glMatrix.EPSILON*Math.max(1,Math.abs(Mt),Math.abs(hn))&&Math.abs(Et-lt)<=glMatrix.EPSILON*Math.max(1,Math.abs(Et),Math.abs(lt))&&Math.abs(pe-Ct)<=glMatrix.EPSILON*Math.max(1,Math.abs(pe),Math.abs(Ct))&&Math.abs(Ae-sn)<=glMatrix.EPSILON*Math.max(1,Math.abs(Ae),Math.abs(sn))}var vn=null,_r=null},60187:function(Be,Me,b){"use strict";b.r(Me),b.d(Me,{add:function(){return Ut},adjoint:function(){return D},clone:function(){return V},copy:function(){return N},create:function(){return Z},decompose:function(){return zn},determinant:function(){return X},equals:function(){return lt},exactEquals:function(){return hn},frob:function(){return Pe},fromQuat:function(){return _r},fromQuat2:function(){return Lt},fromRotation:function(){return vt},fromRotationTranslation:function(){return Bn},fromRotationTranslationScale:function(){return dr},fromRotationTranslationScaleOrigin:function(){return vn},fromScaling:function(){return ct},fromTranslation:function(){return Fe},fromValues:function(){return E},fromXRotation:function(){return at},fromYRotation:function(){return kt},fromZRotation:function(){return It},frustum:function(){return Ge},getRotation:function(){return In},getScaling:function(){return Xn},getTranslation:function(){return Wn},identity:function(){return C},invert:function(){return H},lookAt:function(){return Et},mul:function(){return Ct},multiply:function(){return j},multiplyScalar:function(){return ft},multiplyScalarAndAdd:function(){return on},ortho:function(){return Cn},orthoNO:function(){return ln},orthoZO:function(){return Mt},perspective:function(){return On},perspectiveFromFieldOfView:function(){return en},perspectiveNO:function(){return Tt},perspectiveZO:function(){return Vr},rotate:function(){return we},rotateX:function(){return ve},rotateY:function(){return Ee},rotateZ:function(){return $e},scale:function(){return he},set:function(){return F},str:function(){return Ae},sub:function(){return sn},subtract:function(){return jt},targetTo:function(){return pe},translate:function(){return de},transpose:function(){return P}});var m=b(85551);function Z(){var W=new m.WT(16);return m.WT!=Float32Array&&(W[1]=0,W[2]=0,W[3]=0,W[4]=0,W[6]=0,W[7]=0,W[8]=0,W[9]=0,W[11]=0,W[12]=0,W[13]=0,W[14]=0),W[0]=1,W[5]=1,W[10]=1,W[15]=1,W}function V(W){var Se=new m.WT(16);return Se[0]=W[0],Se[1]=W[1],Se[2]=W[2],Se[3]=W[3],Se[4]=W[4],Se[5]=W[5],Se[6]=W[6],Se[7]=W[7],Se[8]=W[8],Se[9]=W[9],Se[10]=W[10],Se[11]=W[11],Se[12]=W[12],Se[13]=W[13],Se[14]=W[14],Se[15]=W[15],Se}function N(W,Se){return W[0]=Se[0],W[1]=Se[1],W[2]=Se[2],W[3]=Se[3],W[4]=Se[4],W[5]=Se[5],W[6]=Se[6],W[7]=Se[7],W[8]=Se[8],W[9]=Se[9],W[10]=Se[10],W[11]=Se[11],W[12]=Se[12],W[13]=Se[13],W[14]=Se[14],W[15]=Se[15],W}function E(W,Se,Ht,zt,Fn,Tn,lr,je,be,it,wt,ot,ut,_t,$t,Vt){var Qt=new m.WT(16);return Qt[0]=W,Qt[1]=Se,Qt[2]=Ht,Qt[3]=zt,Qt[4]=Fn,Qt[5]=Tn,Qt[6]=lr,Qt[7]=je,Qt[8]=be,Qt[9]=it,Qt[10]=wt,Qt[11]=ot,Qt[12]=ut,Qt[13]=_t,Qt[14]=$t,Qt[15]=Vt,Qt}function F(W,Se,Ht,zt,Fn,Tn,lr,je,be,it,wt,ot,ut,_t,$t,Vt,Qt){return W[0]=Se,W[1]=Ht,W[2]=zt,W[3]=Fn,W[4]=Tn,W[5]=lr,W[6]=je,W[7]=be,W[8]=it,W[9]=wt,W[10]=ot,W[11]=ut,W[12]=_t,W[13]=$t,W[14]=Vt,W[15]=Qt,W}function C(W){return W[0]=1,W[1]=0,W[2]=0,W[3]=0,W[4]=0,W[5]=1,W[6]=0,W[7]=0,W[8]=0,W[9]=0,W[10]=1,W[11]=0,W[12]=0,W[13]=0,W[14]=0,W[15]=1,W}function P(W,Se){if(W===Se){var Ht=Se[1],zt=Se[2],Fn=Se[3],Tn=Se[6],lr=Se[7],je=Se[11];W[1]=Se[4],W[2]=Se[8],W[3]=Se[12],W[4]=Ht,W[6]=Se[9],W[7]=Se[13],W[8]=zt,W[9]=Tn,W[11]=Se[14],W[12]=Fn,W[13]=lr,W[14]=je}else W[0]=Se[0],W[1]=Se[4],W[2]=Se[8],W[3]=Se[12],W[4]=Se[1],W[5]=Se[5],W[6]=Se[9],W[7]=Se[13],W[8]=Se[2],W[9]=Se[6],W[10]=Se[10],W[11]=Se[14],W[12]=Se[3],W[13]=Se[7],W[14]=Se[11],W[15]=Se[15];return W}function H(W,Se){var Ht=Se[0],zt=Se[1],Fn=Se[2],Tn=Se[3],lr=Se[4],je=Se[5],be=Se[6],it=Se[7],wt=Se[8],ot=Se[9],ut=Se[10],_t=Se[11],$t=Se[12],Vt=Se[13],Qt=Se[14],cn=Se[15],Yn=Ht*je-zt*lr,qn=Ht*be-Fn*lr,Sr=Ht*it-Tn*lr,Jr=zt*be-Fn*je,vr=zt*it-Tn*je,Ki=Fn*it-Tn*be,Mi=wt*Vt-ot*$t,yi=wt*Qt-ut*$t,qr=wt*cn-_t*$t,es=ot*Qt-ut*Vt,Ci=ot*cn-_t*Vt,En=ut*cn-_t*Qt,rn=Yn*En-qn*Ci+Sr*es+Jr*qr-vr*yi+Ki*Mi;return rn?(rn=1/rn,W[0]=(je*En-be*Ci+it*es)*rn,W[1]=(Fn*Ci-zt*En-Tn*es)*rn,W[2]=(Vt*Ki-Qt*vr+cn*Jr)*rn,W[3]=(ut*vr-ot*Ki-_t*Jr)*rn,W[4]=(be*qr-lr*En-it*yi)*rn,W[5]=(Ht*En-Fn*qr+Tn*yi)*rn,W[6]=(Qt*Sr-$t*Ki-cn*qn)*rn,W[7]=(wt*Ki-ut*Sr+_t*qn)*rn,W[8]=(lr*Ci-je*qr+it*Mi)*rn,W[9]=(zt*qr-Ht*Ci-Tn*Mi)*rn,W[10]=($t*vr-Vt*Sr+cn*Yn)*rn,W[11]=(ot*Sr-wt*vr-_t*Yn)*rn,W[12]=(je*yi-lr*es-be*Mi)*rn,W[13]=(Ht*es-zt*yi+Fn*Mi)*rn,W[14]=(Vt*qn-$t*Jr-Qt*Yn)*rn,W[15]=(wt*Jr-ot*qn+ut*Yn)*rn,W):null}function D(W,Se){var Ht=Se[0],zt=Se[1],Fn=Se[2],Tn=Se[3],lr=Se[4],je=Se[5],be=Se[6],it=Se[7],wt=Se[8],ot=Se[9],ut=Se[10],_t=Se[11],$t=Se[12],Vt=Se[13],Qt=Se[14],cn=Se[15],Yn=Ht*je-zt*lr,qn=Ht*be-Fn*lr,Sr=Ht*it-Tn*lr,Jr=zt*be-Fn*je,vr=zt*it-Tn*je,Ki=Fn*it-Tn*be,Mi=wt*Vt-ot*$t,yi=wt*Qt-ut*$t,qr=wt*cn-_t*$t,es=ot*Qt-ut*Vt,Ci=ot*cn-_t*Vt,En=ut*cn-_t*Qt;return W[0]=je*En-be*Ci+it*es,W[1]=Fn*Ci-zt*En-Tn*es,W[2]=Vt*Ki-Qt*vr+cn*Jr,W[3]=ut*vr-ot*Ki-_t*Jr,W[4]=be*qr-lr*En-it*yi,W[5]=Ht*En-Fn*qr+Tn*yi,W[6]=Qt*Sr-$t*Ki-cn*qn,W[7]=wt*Ki-ut*Sr+_t*qn,W[8]=lr*Ci-je*qr+it*Mi,W[9]=zt*qr-Ht*Ci-Tn*Mi,W[10]=$t*vr-Vt*Sr+cn*Yn,W[11]=ot*Sr-wt*vr-_t*Yn,W[12]=je*yi-lr*es-be*Mi,W[13]=Ht*es-zt*yi+Fn*Mi,W[14]=Vt*qn-$t*Jr-Qt*Yn,W[15]=wt*Jr-ot*qn+ut*Yn,W}function X(W){var Se=W[0],Ht=W[1],zt=W[2],Fn=W[3],Tn=W[4],lr=W[5],je=W[6],be=W[7],it=W[8],wt=W[9],ot=W[10],ut=W[11],_t=W[12],$t=W[13],Vt=W[14],Qt=W[15],cn=Se*lr-Ht*Tn,Yn=Se*je-zt*Tn,qn=Ht*je-zt*lr,Sr=it*$t-wt*_t,Jr=it*Vt-ot*_t,vr=wt*Vt-ot*$t,Ki=Se*vr-Ht*Jr+zt*Sr,Mi=Tn*vr-lr*Jr+je*Sr,yi=it*qn-wt*Yn+ot*cn,qr=_t*qn-$t*Yn+Vt*cn;return be*Ki-Fn*Mi+Qt*yi-ut*qr}function j(W,Se,Ht){var zt=Se[0],Fn=Se[1],Tn=Se[2],lr=Se[3],je=Se[4],be=Se[5],it=Se[6],wt=Se[7],ot=Se[8],ut=Se[9],_t=Se[10],$t=Se[11],Vt=Se[12],Qt=Se[13],cn=Se[14],Yn=Se[15],qn=Ht[0],Sr=Ht[1],Jr=Ht[2],vr=Ht[3];return W[0]=qn*zt+Sr*je+Jr*ot+vr*Vt,W[1]=qn*Fn+Sr*be+Jr*ut+vr*Qt,W[2]=qn*Tn+Sr*it+Jr*_t+vr*cn,W[3]=qn*lr+Sr*wt+Jr*$t+vr*Yn,qn=Ht[4],Sr=Ht[5],Jr=Ht[6],vr=Ht[7],W[4]=qn*zt+Sr*je+Jr*ot+vr*Vt,W[5]=qn*Fn+Sr*be+Jr*ut+vr*Qt,W[6]=qn*Tn+Sr*it+Jr*_t+vr*cn,W[7]=qn*lr+Sr*wt+Jr*$t+vr*Yn,qn=Ht[8],Sr=Ht[9],Jr=Ht[10],vr=Ht[11],W[8]=qn*zt+Sr*je+Jr*ot+vr*Vt,W[9]=qn*Fn+Sr*be+Jr*ut+vr*Qt,W[10]=qn*Tn+Sr*it+Jr*_t+vr*cn,W[11]=qn*lr+Sr*wt+Jr*$t+vr*Yn,qn=Ht[12],Sr=Ht[13],Jr=Ht[14],vr=Ht[15],W[12]=qn*zt+Sr*je+Jr*ot+vr*Vt,W[13]=qn*Fn+Sr*be+Jr*ut+vr*Qt,W[14]=qn*Tn+Sr*it+Jr*_t+vr*cn,W[15]=qn*lr+Sr*wt+Jr*$t+vr*Yn,W}function de(W,Se,Ht){var zt=Ht[0],Fn=Ht[1],Tn=Ht[2],lr,je,be,it,wt,ot,ut,_t,$t,Vt,Qt,cn;return Se===W?(W[12]=Se[0]*zt+Se[4]*Fn+Se[8]*Tn+Se[12],W[13]=Se[1]*zt+Se[5]*Fn+Se[9]*Tn+Se[13],W[14]=Se[2]*zt+Se[6]*Fn+Se[10]*Tn+Se[14],W[15]=Se[3]*zt+Se[7]*Fn+Se[11]*Tn+Se[15]):(lr=Se[0],je=Se[1],be=Se[2],it=Se[3],wt=Se[4],ot=Se[5],ut=Se[6],_t=Se[7],$t=Se[8],Vt=Se[9],Qt=Se[10],cn=Se[11],W[0]=lr,W[1]=je,W[2]=be,W[3]=it,W[4]=wt,W[5]=ot,W[6]=ut,W[7]=_t,W[8]=$t,W[9]=Vt,W[10]=Qt,W[11]=cn,W[12]=lr*zt+wt*Fn+$t*Tn+Se[12],W[13]=je*zt+ot*Fn+Vt*Tn+Se[13],W[14]=be*zt+ut*Fn+Qt*Tn+Se[14],W[15]=it*zt+_t*Fn+cn*Tn+Se[15]),W}function he(W,Se,Ht){var zt=Ht[0],Fn=Ht[1],Tn=Ht[2];return W[0]=Se[0]*zt,W[1]=Se[1]*zt,W[2]=Se[2]*zt,W[3]=Se[3]*zt,W[4]=Se[4]*Fn,W[5]=Se[5]*Fn,W[6]=Se[6]*Fn,W[7]=Se[7]*Fn,W[8]=Se[8]*Tn,W[9]=Se[9]*Tn,W[10]=Se[10]*Tn,W[11]=Se[11]*Tn,W[12]=Se[12],W[13]=Se[13],W[14]=Se[14],W[15]=Se[15],W}function we(W,Se,Ht,zt){var Fn=zt[0],Tn=zt[1],lr=zt[2],je=Math.sqrt(Fn*Fn+Tn*Tn+lr*lr),be,it,wt,ot,ut,_t,$t,Vt,Qt,cn,Yn,qn,Sr,Jr,vr,Ki,Mi,yi,qr,es,Ci,En,rn,Xt;return je<m.Ib?null:(je=1/je,Fn*=je,Tn*=je,lr*=je,be=Math.sin(Ht),it=Math.cos(Ht),wt=1-it,ot=Se[0],ut=Se[1],_t=Se[2],$t=Se[3],Vt=Se[4],Qt=Se[5],cn=Se[6],Yn=Se[7],qn=Se[8],Sr=Se[9],Jr=Se[10],vr=Se[11],Ki=Fn*Fn*wt+it,Mi=Tn*Fn*wt+lr*be,yi=lr*Fn*wt-Tn*be,qr=Fn*Tn*wt-lr*be,es=Tn*Tn*wt+it,Ci=lr*Tn*wt+Fn*be,En=Fn*lr*wt+Tn*be,rn=Tn*lr*wt-Fn*be,Xt=lr*lr*wt+it,W[0]=ot*Ki+Vt*Mi+qn*yi,W[1]=ut*Ki+Qt*Mi+Sr*yi,W[2]=_t*Ki+cn*Mi+Jr*yi,W[3]=$t*Ki+Yn*Mi+vr*yi,W[4]=ot*qr+Vt*es+qn*Ci,W[5]=ut*qr+Qt*es+Sr*Ci,W[6]=_t*qr+cn*es+Jr*Ci,W[7]=$t*qr+Yn*es+vr*Ci,W[8]=ot*En+Vt*rn+qn*Xt,W[9]=ut*En+Qt*rn+Sr*Xt,W[10]=_t*En+cn*rn+Jr*Xt,W[11]=$t*En+Yn*rn+vr*Xt,Se!==W&&(W[12]=Se[12],W[13]=Se[13],W[14]=Se[14],W[15]=Se[15]),W)}function ve(W,Se,Ht){var zt=Math.sin(Ht),Fn=Math.cos(Ht),Tn=Se[4],lr=Se[5],je=Se[6],be=Se[7],it=Se[8],wt=Se[9],ot=Se[10],ut=Se[11];return Se!==W&&(W[0]=Se[0],W[1]=Se[1],W[2]=Se[2],W[3]=Se[3],W[12]=Se[12],W[13]=Se[13],W[14]=Se[14],W[15]=Se[15]),W[4]=Tn*Fn+it*zt,W[5]=lr*Fn+wt*zt,W[6]=je*Fn+ot*zt,W[7]=be*Fn+ut*zt,W[8]=it*Fn-Tn*zt,W[9]=wt*Fn-lr*zt,W[10]=ot*Fn-je*zt,W[11]=ut*Fn-be*zt,W}function Ee(W,Se,Ht){var zt=Math.sin(Ht),Fn=Math.cos(Ht),Tn=Se[0],lr=Se[1],je=Se[2],be=Se[3],it=Se[8],wt=Se[9],ot=Se[10],ut=Se[11];return Se!==W&&(W[4]=Se[4],W[5]=Se[5],W[6]=Se[6],W[7]=Se[7],W[12]=Se[12],W[13]=Se[13],W[14]=Se[14],W[15]=Se[15]),W[0]=Tn*Fn-it*zt,W[1]=lr*Fn-wt*zt,W[2]=je*Fn-ot*zt,W[3]=be*Fn-ut*zt,W[8]=Tn*zt+it*Fn,W[9]=lr*zt+wt*Fn,W[10]=je*zt+ot*Fn,W[11]=be*zt+ut*Fn,W}function $e(W,Se,Ht){var zt=Math.sin(Ht),Fn=Math.cos(Ht),Tn=Se[0],lr=Se[1],je=Se[2],be=Se[3],it=Se[4],wt=Se[5],ot=Se[6],ut=Se[7];return Se!==W&&(W[8]=Se[8],W[9]=Se[9],W[10]=Se[10],W[11]=Se[11],W[12]=Se[12],W[13]=Se[13],W[14]=Se[14],W[15]=Se[15]),W[0]=Tn*Fn+it*zt,W[1]=lr*Fn+wt*zt,W[2]=je*Fn+ot*zt,W[3]=be*Fn+ut*zt,W[4]=it*Fn-Tn*zt,W[5]=wt*Fn-lr*zt,W[6]=ot*Fn-je*zt,W[7]=ut*Fn-be*zt,W}function Fe(W,Se){return W[0]=1,W[1]=0,W[2]=0,W[3]=0,W[4]=0,W[5]=1,W[6]=0,W[7]=0,W[8]=0,W[9]=0,W[10]=1,W[11]=0,W[12]=Se[0],W[13]=Se[1],W[14]=Se[2],W[15]=1,W}function ct(W,Se){return W[0]=Se[0],W[1]=0,W[2]=0,W[3]=0,W[4]=0,W[5]=Se[1],W[6]=0,W[7]=0,W[8]=0,W[9]=0,W[10]=Se[2],W[11]=0,W[12]=0,W[13]=0,W[14]=0,W[15]=1,W}function vt(W,Se,Ht){var zt=Ht[0],Fn=Ht[1],Tn=Ht[2],lr=Math.sqrt(zt*zt+Fn*Fn+Tn*Tn),je,be,it;return lr<m.Ib?null:(lr=1/lr,zt*=lr,Fn*=lr,Tn*=lr,je=Math.sin(Se),be=Math.cos(Se),it=1-be,W[0]=zt*zt*it+be,W[1]=Fn*zt*it+Tn*je,W[2]=Tn*zt*it-Fn*je,W[3]=0,W[4]=zt*Fn*it-Tn*je,W[5]=Fn*Fn*it+be,W[6]=Tn*Fn*it+zt*je,W[7]=0,W[8]=zt*Tn*it+Fn*je,W[9]=Fn*Tn*it-zt*je,W[10]=Tn*Tn*it+be,W[11]=0,W[12]=0,W[13]=0,W[14]=0,W[15]=1,W)}function at(W,Se){var Ht=Math.sin(Se),zt=Math.cos(Se);return W[0]=1,W[1]=0,W[2]=0,W[3]=0,W[4]=0,W[5]=zt,W[6]=Ht,W[7]=0,W[8]=0,W[9]=-Ht,W[10]=zt,W[11]=0,W[12]=0,W[13]=0,W[14]=0,W[15]=1,W}function kt(W,Se){var Ht=Math.sin(Se),zt=Math.cos(Se);return W[0]=zt,W[1]=0,W[2]=-Ht,W[3]=0,W[4]=0,W[5]=1,W[6]=0,W[7]=0,W[8]=Ht,W[9]=0,W[10]=zt,W[11]=0,W[12]=0,W[13]=0,W[14]=0,W[15]=1,W}function It(W,Se){var Ht=Math.sin(Se),zt=Math.cos(Se);return W[0]=zt,W[1]=Ht,W[2]=0,W[3]=0,W[4]=-Ht,W[5]=zt,W[6]=0,W[7]=0,W[8]=0,W[9]=0,W[10]=1,W[11]=0,W[12]=0,W[13]=0,W[14]=0,W[15]=1,W}function Bn(W,Se,Ht){var zt=Se[0],Fn=Se[1],Tn=Se[2],lr=Se[3],je=zt+zt,be=Fn+Fn,it=Tn+Tn,wt=zt*je,ot=zt*be,ut=zt*it,_t=Fn*be,$t=Fn*it,Vt=Tn*it,Qt=lr*je,cn=lr*be,Yn=lr*it;return W[0]=1-(_t+Vt),W[1]=ot+Yn,W[2]=ut-cn,W[3]=0,W[4]=ot-Yn,W[5]=1-(wt+Vt),W[6]=$t+Qt,W[7]=0,W[8]=ut+cn,W[9]=$t-Qt,W[10]=1-(wt+_t),W[11]=0,W[12]=Ht[0],W[13]=Ht[1],W[14]=Ht[2],W[15]=1,W}function Lt(W,Se){var Ht=new m.WT(3),zt=-Se[0],Fn=-Se[1],Tn=-Se[2],lr=Se[3],je=Se[4],be=Se[5],it=Se[6],wt=Se[7],ot=zt*zt+Fn*Fn+Tn*Tn+lr*lr;return ot>0?(Ht[0]=(je*lr+wt*zt+be*Tn-it*Fn)*2/ot,Ht[1]=(be*lr+wt*Fn+it*zt-je*Tn)*2/ot,Ht[2]=(it*lr+wt*Tn+je*Fn-be*zt)*2/ot):(Ht[0]=(je*lr+wt*zt+be*Tn-it*Fn)*2,Ht[1]=(be*lr+wt*Fn+it*zt-je*Tn)*2,Ht[2]=(it*lr+wt*Tn+je*Fn-be*zt)*2),Bn(W,Se,Ht),W}function Wn(W,Se){return W[0]=Se[12],W[1]=Se[13],W[2]=Se[14],W}function Xn(W,Se){var Ht=Se[0],zt=Se[1],Fn=Se[2],Tn=Se[4],lr=Se[5],je=Se[6],be=Se[8],it=Se[9],wt=Se[10];return W[0]=Math.sqrt(Ht*Ht+zt*zt+Fn*Fn),W[1]=Math.sqrt(Tn*Tn+lr*lr+je*je),W[2]=Math.sqrt(be*be+it*it+wt*wt),W}function In(W,Se){var Ht=new m.WT(3);Xn(Ht,Se);var zt=1/Ht[0],Fn=1/Ht[1],Tn=1/Ht[2],lr=Se[0]*zt,je=Se[1]*Fn,be=Se[2]*Tn,it=Se[4]*zt,wt=Se[5]*Fn,ot=Se[6]*Tn,ut=Se[8]*zt,_t=Se[9]*Fn,$t=Se[10]*Tn,Vt=lr+wt+$t,Qt=0;return Vt>0?(Qt=Math.sqrt(Vt+1)*2,W[3]=.25*Qt,W[0]=(ot-_t)/Qt,W[1]=(ut-be)/Qt,W[2]=(je-it)/Qt):lr>wt&&lr>$t?(Qt=Math.sqrt(1+lr-wt-$t)*2,W[3]=(ot-_t)/Qt,W[0]=.25*Qt,W[1]=(je+it)/Qt,W[2]=(ut+be)/Qt):wt>$t?(Qt=Math.sqrt(1+wt-lr-$t)*2,W[3]=(ut-be)/Qt,W[0]=(je+it)/Qt,W[1]=.25*Qt,W[2]=(ot+_t)/Qt):(Qt=Math.sqrt(1+$t-lr-wt)*2,W[3]=(je-it)/Qt,W[0]=(ut+be)/Qt,W[1]=(ot+_t)/Qt,W[2]=.25*Qt),W}function zn(W,Se,Ht,zt){Se[0]=zt[12],Se[1]=zt[13],Se[2]=zt[14];var Fn=zt[0],Tn=zt[1],lr=zt[2],je=zt[4],be=zt[5],it=zt[6],wt=zt[8],ot=zt[9],ut=zt[10];Ht[0]=Math.sqrt(Fn*Fn+Tn*Tn+lr*lr),Ht[1]=Math.sqrt(je*je+be*be+it*it),Ht[2]=Math.sqrt(wt*wt+ot*ot+ut*ut);var _t=1/Ht[0],$t=1/Ht[1],Vt=1/Ht[2],Qt=Fn*_t,cn=Tn*$t,Yn=lr*Vt,qn=je*_t,Sr=be*$t,Jr=it*Vt,vr=wt*_t,Ki=ot*$t,Mi=ut*Vt,yi=Qt+Sr+Mi,qr=0;return yi>0?(qr=Math.sqrt(yi+1)*2,W[3]=.25*qr,W[0]=(Jr-Ki)/qr,W[1]=(vr-Yn)/qr,W[2]=(cn-qn)/qr):Qt>Sr&&Qt>Mi?(qr=Math.sqrt(1+Qt-Sr-Mi)*2,W[3]=(Jr-Ki)/qr,W[0]=.25*qr,W[1]=(cn+qn)/qr,W[2]=(vr+Yn)/qr):Sr>Mi?(qr=Math.sqrt(1+Sr-Qt-Mi)*2,W[3]=(vr-Yn)/qr,W[0]=(cn+qn)/qr,W[1]=.25*qr,W[2]=(Jr+Ki)/qr):(qr=Math.sqrt(1+Mi-Qt-Sr)*2,W[3]=(cn-qn)/qr,W[0]=(vr+Yn)/qr,W[1]=(Jr+Ki)/qr,W[2]=.25*qr),W}function dr(W,Se,Ht,zt){var Fn=Se[0],Tn=Se[1],lr=Se[2],je=Se[3],be=Fn+Fn,it=Tn+Tn,wt=lr+lr,ot=Fn*be,ut=Fn*it,_t=Fn*wt,$t=Tn*it,Vt=Tn*wt,Qt=lr*wt,cn=je*be,Yn=je*it,qn=je*wt,Sr=zt[0],Jr=zt[1],vr=zt[2];return W[0]=(1-($t+Qt))*Sr,W[1]=(ut+qn)*Sr,W[2]=(_t-Yn)*Sr,W[3]=0,W[4]=(ut-qn)*Jr,W[5]=(1-(ot+Qt))*Jr,W[6]=(Vt+cn)*Jr,W[7]=0,W[8]=(_t+Yn)*vr,W[9]=(Vt-cn)*vr,W[10]=(1-(ot+$t))*vr,W[11]=0,W[12]=Ht[0],W[13]=Ht[1],W[14]=Ht[2],W[15]=1,W}function vn(W,Se,Ht,zt,Fn){var Tn=Se[0],lr=Se[1],je=Se[2],be=Se[3],it=Tn+Tn,wt=lr+lr,ot=je+je,ut=Tn*it,_t=Tn*wt,$t=Tn*ot,Vt=lr*wt,Qt=lr*ot,cn=je*ot,Yn=be*it,qn=be*wt,Sr=be*ot,Jr=zt[0],vr=zt[1],Ki=zt[2],Mi=Fn[0],yi=Fn[1],qr=Fn[2],es=(1-(Vt+cn))*Jr,Ci=(_t+Sr)*Jr,En=($t-qn)*Jr,rn=(_t-Sr)*vr,Xt=(1-(ut+cn))*vr,st=(Qt+Yn)*vr,dt=($t+qn)*Ki,Wt=(Qt-Yn)*Ki,bn=(1-(ut+Vt))*Ki;return W[0]=es,W[1]=Ci,W[2]=En,W[3]=0,W[4]=rn,W[5]=Xt,W[6]=st,W[7]=0,W[8]=dt,W[9]=Wt,W[10]=bn,W[11]=0,W[12]=Ht[0]+Mi-(es*Mi+rn*yi+dt*qr),W[13]=Ht[1]+yi-(Ci*Mi+Xt*yi+Wt*qr),W[14]=Ht[2]+qr-(En*Mi+st*yi+bn*qr),W[15]=1,W}function _r(W,Se){var Ht=Se[0],zt=Se[1],Fn=Se[2],Tn=Se[3],lr=Ht+Ht,je=zt+zt,be=Fn+Fn,it=Ht*lr,wt=zt*lr,ot=zt*je,ut=Fn*lr,_t=Fn*je,$t=Fn*be,Vt=Tn*lr,Qt=Tn*je,cn=Tn*be;return W[0]=1-ot-$t,W[1]=wt+cn,W[2]=ut-Qt,W[3]=0,W[4]=wt-cn,W[5]=1-it-$t,W[6]=_t+Vt,W[7]=0,W[8]=ut+Qt,W[9]=_t-Vt,W[10]=1-it-ot,W[11]=0,W[12]=0,W[13]=0,W[14]=0,W[15]=1,W}function Ge(W,Se,Ht,zt,Fn,Tn,lr){var je=1/(Ht-Se),be=1/(Fn-zt),it=1/(Tn-lr);return W[0]=Tn*2*je,W[1]=0,W[2]=0,W[3]=0,W[4]=0,W[5]=Tn*2*be,W[6]=0,W[7]=0,W[8]=(Ht+Se)*je,W[9]=(Fn+zt)*be,W[10]=(lr+Tn)*it,W[11]=-1,W[12]=0,W[13]=0,W[14]=lr*Tn*2*it,W[15]=0,W}function Tt(W,Se,Ht,zt,Fn){var Tn=1/Math.tan(Se/2);if(W[0]=Tn/Ht,W[1]=0,W[2]=0,W[3]=0,W[4]=0,W[5]=Tn,W[6]=0,W[7]=0,W[8]=0,W[9]=0,W[11]=-1,W[12]=0,W[13]=0,W[15]=0,Fn!=null&&Fn!==1/0){var lr=1/(zt-Fn);W[10]=(Fn+zt)*lr,W[14]=2*Fn*zt*lr}else W[10]=-1,W[14]=-2*zt;return W}var On=Tt;function Vr(W,Se,Ht,zt,Fn){var Tn=1/Math.tan(Se/2);if(W[0]=Tn/Ht,W[1]=0,W[2]=0,W[3]=0,W[4]=0,W[5]=Tn,W[6]=0,W[7]=0,W[8]=0,W[9]=0,W[11]=-1,W[12]=0,W[13]=0,W[15]=0,Fn!=null&&Fn!==1/0){var lr=1/(zt-Fn);W[10]=Fn*lr,W[14]=Fn*zt*lr}else W[10]=-1,W[14]=-zt;return W}function en(W,Se,Ht,zt){var Fn=Math.tan(Se.upDegrees*Math.PI/180),Tn=Math.tan(Se.downDegrees*Math.PI/180),lr=Math.tan(Se.leftDegrees*Math.PI/180),je=Math.tan(Se.rightDegrees*Math.PI/180),be=2/(lr+je),it=2/(Fn+Tn);return W[0]=be,W[1]=0,W[2]=0,W[3]=0,W[4]=0,W[5]=it,W[6]=0,W[7]=0,W[8]=-((lr-je)*be*.5),W[9]=(Fn-Tn)*it*.5,W[10]=zt/(Ht-zt),W[11]=-1,W[12]=0,W[13]=0,W[14]=zt*Ht/(Ht-zt),W[15]=0,W}function ln(W,Se,Ht,zt,Fn,Tn,lr){var je=1/(Se-Ht),be=1/(zt-Fn),it=1/(Tn-lr);return W[0]=-2*je,W[1]=0,W[2]=0,W[3]=0,W[4]=0,W[5]=-2*be,W[6]=0,W[7]=0,W[8]=0,W[9]=0,W[10]=2*it,W[11]=0,W[12]=(Se+Ht)*je,W[13]=(Fn+zt)*be,W[14]=(lr+Tn)*it,W[15]=1,W}var Cn=ln;function Mt(W,Se,Ht,zt,Fn,Tn,lr){var je=1/(Se-Ht),be=1/(zt-Fn),it=1/(Tn-lr);return W[0]=-2*je,W[1]=0,W[2]=0,W[3]=0,W[4]=0,W[5]=-2*be,W[6]=0,W[7]=0,W[8]=0,W[9]=0,W[10]=it,W[11]=0,W[12]=(Se+Ht)*je,W[13]=(Fn+zt)*be,W[14]=Tn*it,W[15]=1,W}function Et(W,Se,Ht,zt){var Fn,Tn,lr,je,be,it,wt,ot,ut,_t,$t=Se[0],Vt=Se[1],Qt=Se[2],cn=zt[0],Yn=zt[1],qn=zt[2],Sr=Ht[0],Jr=Ht[1],vr=Ht[2];return Math.abs($t-Sr)<m.Ib&&Math.abs(Vt-Jr)<m.Ib&&Math.abs(Qt-vr)<m.Ib?C(W):(wt=$t-Sr,ot=Vt-Jr,ut=Qt-vr,_t=1/Math.sqrt(wt*wt+ot*ot+ut*ut),wt*=_t,ot*=_t,ut*=_t,Fn=Yn*ut-qn*ot,Tn=qn*wt-cn*ut,lr=cn*ot-Yn*wt,_t=Math.sqrt(Fn*Fn+Tn*Tn+lr*lr),_t?(_t=1/_t,Fn*=_t,Tn*=_t,lr*=_t):(Fn=0,Tn=0,lr=0),je=ot*lr-ut*Tn,be=ut*Fn-wt*lr,it=wt*Tn-ot*Fn,_t=Math.sqrt(je*je+be*be+it*it),_t?(_t=1/_t,je*=_t,be*=_t,it*=_t):(je=0,be=0,it=0),W[0]=Fn,W[1]=je,W[2]=wt,W[3]=0,W[4]=Tn,W[5]=be,W[6]=ot,W[7]=0,W[8]=lr,W[9]=it,W[10]=ut,W[11]=0,W[12]=-(Fn*$t+Tn*Vt+lr*Qt),W[13]=-(je*$t+be*Vt+it*Qt),W[14]=-(wt*$t+ot*Vt+ut*Qt),W[15]=1,W)}function pe(W,Se,Ht,zt){var Fn=Se[0],Tn=Se[1],lr=Se[2],je=zt[0],be=zt[1],it=zt[2],wt=Fn-Ht[0],ot=Tn-Ht[1],ut=lr-Ht[2],_t=wt*wt+ot*ot+ut*ut;_t>0&&(_t=1/Math.sqrt(_t),wt*=_t,ot*=_t,ut*=_t);var $t=be*ut-it*ot,Vt=it*wt-je*ut,Qt=je*ot-be*wt;return _t=$t*$t+Vt*Vt+Qt*Qt,_t>0&&(_t=1/Math.sqrt(_t),$t*=_t,Vt*=_t,Qt*=_t),W[0]=$t,W[1]=Vt,W[2]=Qt,W[3]=0,W[4]=ot*Qt-ut*Vt,W[5]=ut*$t-wt*Qt,W[6]=wt*Vt-ot*$t,W[7]=0,W[8]=wt,W[9]=ot,W[10]=ut,W[11]=0,W[12]=Fn,W[13]=Tn,W[14]=lr,W[15]=1,W}function Ae(W){return"mat4("+W[0]+", "+W[1]+", "+W[2]+", "+W[3]+", "+W[4]+", "+W[5]+", "+W[6]+", "+W[7]+", "+W[8]+", "+W[9]+", "+W[10]+", "+W[11]+", "+W[12]+", "+W[13]+", "+W[14]+", "+W[15]+")"}function Pe(W){return Math.sqrt(W[0]*W[0]+W[1]*W[1]+W[2]*W[2]+W[3]*W[3]+W[4]*W[4]+W[5]*W[5]+W[6]*W[6]+W[7]*W[7]+W[8]*W[8]+W[9]*W[9]+W[10]*W[10]+W[11]*W[11]+W[12]*W[12]+W[13]*W[13]+W[14]*W[14]+W[15]*W[15])}function Ut(W,Se,Ht){return W[0]=Se[0]+Ht[0],W[1]=Se[1]+Ht[1],W[2]=Se[2]+Ht[2],W[3]=Se[3]+Ht[3],W[4]=Se[4]+Ht[4],W[5]=Se[5]+Ht[5],W[6]=Se[6]+Ht[6],W[7]=Se[7]+Ht[7],W[8]=Se[8]+Ht[8],W[9]=Se[9]+Ht[9],W[10]=Se[10]+Ht[10],W[11]=Se[11]+Ht[11],W[12]=Se[12]+Ht[12],W[13]=Se[13]+Ht[13],W[14]=Se[14]+Ht[14],W[15]=Se[15]+Ht[15],W}function jt(W,Se,Ht){return W[0]=Se[0]-Ht[0],W[1]=Se[1]-Ht[1],W[2]=Se[2]-Ht[2],W[3]=Se[3]-Ht[3],W[4]=Se[4]-Ht[4],W[5]=Se[5]-Ht[5],W[6]=Se[6]-Ht[6],W[7]=Se[7]-Ht[7],W[8]=Se[8]-Ht[8],W[9]=Se[9]-Ht[9],W[10]=Se[10]-Ht[10],W[11]=Se[11]-Ht[11],W[12]=Se[12]-Ht[12],W[13]=Se[13]-Ht[13],W[14]=Se[14]-Ht[14],W[15]=Se[15]-Ht[15],W}function ft(W,Se,Ht){return W[0]=Se[0]*Ht,W[1]=Se[1]*Ht,W[2]=Se[2]*Ht,W[3]=Se[3]*Ht,W[4]=Se[4]*Ht,W[5]=Se[5]*Ht,W[6]=Se[6]*Ht,W[7]=Se[7]*Ht,W[8]=Se[8]*Ht,W[9]=Se[9]*Ht,W[10]=Se[10]*Ht,W[11]=Se[11]*Ht,W[12]=Se[12]*Ht,W[13]=Se[13]*Ht,W[14]=Se[14]*Ht,W[15]=Se[15]*Ht,W}function on(W,Se,Ht,zt){return W[0]=Se[0]+Ht[0]*zt,W[1]=Se[1]+Ht[1]*zt,W[2]=Se[2]+Ht[2]*zt,W[3]=Se[3]+Ht[3]*zt,W[4]=Se[4]+Ht[4]*zt,W[5]=Se[5]+Ht[5]*zt,W[6]=Se[6]+Ht[6]*zt,W[7]=Se[7]+Ht[7]*zt,W[8]=Se[8]+Ht[8]*zt,W[9]=Se[9]+Ht[9]*zt,W[10]=Se[10]+Ht[10]*zt,W[11]=Se[11]+Ht[11]*zt,W[12]=Se[12]+Ht[12]*zt,W[13]=Se[13]+Ht[13]*zt,W[14]=Se[14]+Ht[14]*zt,W[15]=Se[15]+Ht[15]*zt,W}function hn(W,Se){return W[0]===Se[0]&&W[1]===Se[1]&&W[2]===Se[2]&&W[3]===Se[3]&&W[4]===Se[4]&&W[5]===Se[5]&&W[6]===Se[6]&&W[7]===Se[7]&&W[8]===Se[8]&&W[9]===Se[9]&&W[10]===Se[10]&&W[11]===Se[11]&&W[12]===Se[12]&&W[13]===Se[13]&&W[14]===Se[14]&&W[15]===Se[15]}function lt(W,Se){var Ht=W[0],zt=W[1],Fn=W[2],Tn=W[3],lr=W[4],je=W[5],be=W[6],it=W[7],wt=W[8],ot=W[9],ut=W[10],_t=W[11],$t=W[12],Vt=W[13],Qt=W[14],cn=W[15],Yn=Se[0],qn=Se[1],Sr=Se[2],Jr=Se[3],vr=Se[4],Ki=Se[5],Mi=Se[6],yi=Se[7],qr=Se[8],es=Se[9],Ci=Se[10],En=Se[11],rn=Se[12],Xt=Se[13],st=Se[14],dt=Se[15];return Math.abs(Ht-Yn)<=m.Ib*Math.max(1,Math.abs(Ht),Math.abs(Yn))&&Math.abs(zt-qn)<=m.Ib*Math.max(1,Math.abs(zt),Math.abs(qn))&&Math.abs(Fn-Sr)<=m.Ib*Math.max(1,Math.abs(Fn),Math.abs(Sr))&&Math.abs(Tn-Jr)<=m.Ib*Math.max(1,Math.abs(Tn),Math.abs(Jr))&&Math.abs(lr-vr)<=m.Ib*Math.max(1,Math.abs(lr),Math.abs(vr))&&Math.abs(je-Ki)<=m.Ib*Math.max(1,Math.abs(je),Math.abs(Ki))&&Math.abs(be-Mi)<=m.Ib*Math.max(1,Math.abs(be),Math.abs(Mi))&&Math.abs(it-yi)<=m.Ib*Math.max(1,Math.abs(it),Math.abs(yi))&&Math.abs(wt-qr)<=m.Ib*Math.max(1,Math.abs(wt),Math.abs(qr))&&Math.abs(ot-es)<=m.Ib*Math.max(1,Math.abs(ot),Math.abs(es))&&Math.abs(ut-Ci)<=m.Ib*Math.max(1,Math.abs(ut),Math.abs(Ci))&&Math.abs(_t-En)<=m.Ib*Math.max(1,Math.abs(_t),Math.abs(En))&&Math.abs($t-rn)<=m.Ib*Math.max(1,Math.abs($t),Math.abs(rn))&&Math.abs(Vt-Xt)<=m.Ib*Math.max(1,Math.abs(Vt),Math.abs(Xt))&&Math.abs(Qt-st)<=m.Ib*Math.max(1,Math.abs(Qt),Math.abs(st))&&Math.abs(cn-dt)<=m.Ib*Math.max(1,Math.abs(cn),Math.abs(dt))}var Ct=j,sn=jt},94569:function(Be,Me,b){"use strict";b.d(Me,{Fv:function(){return en},JG:function(){return Wn},Jp:function(){return D},Su:function(){return kt},U_:function(){return ct},Ue:function(){return E},al:function(){return Lt},dC:function(){return zn},t8:function(){return Xn},yY:function(){return C}});var m=b(85551),Z=b(79111),V=b(92421),N=b(97082);function E(){var Ae=new m.WT(4);return m.WT!=Float32Array&&(Ae[0]=0,Ae[1]=0,Ae[2]=0),Ae[3]=1,Ae}function F(Ae){return Ae[0]=0,Ae[1]=0,Ae[2]=0,Ae[3]=1,Ae}function C(Ae,Pe,Ut){Ut=Ut*.5;var jt=Math.sin(Ut);return Ae[0]=jt*Pe[0],Ae[1]=jt*Pe[1],Ae[2]=jt*Pe[2],Ae[3]=Math.cos(Ut),Ae}function P(Ae,Pe){var Ut=Math.acos(Pe[3])*2,jt=Math.sin(Ut/2);return jt>glMatrix.EPSILON?(Ae[0]=Pe[0]/jt,Ae[1]=Pe[1]/jt,Ae[2]=Pe[2]/jt):(Ae[0]=1,Ae[1]=0,Ae[2]=0),Ut}function H(Ae,Pe){var Ut=vn(Ae,Pe);return Math.acos(2*Ut*Ut-1)}function D(Ae,Pe,Ut){var jt=Pe[0],ft=Pe[1],on=Pe[2],hn=Pe[3],lt=Ut[0],Ct=Ut[1],sn=Ut[2],W=Ut[3];return Ae[0]=jt*W+hn*lt+ft*sn-on*Ct,Ae[1]=ft*W+hn*Ct+on*lt-jt*sn,Ae[2]=on*W+hn*sn+jt*Ct-ft*lt,Ae[3]=hn*W-jt*lt-ft*Ct-on*sn,Ae}function X(Ae,Pe,Ut){Ut*=.5;var jt=Pe[0],ft=Pe[1],on=Pe[2],hn=Pe[3],lt=Math.sin(Ut),Ct=Math.cos(Ut);return Ae[0]=jt*Ct+hn*lt,Ae[1]=ft*Ct+on*lt,Ae[2]=on*Ct-ft*lt,Ae[3]=hn*Ct-jt*lt,Ae}function j(Ae,Pe,Ut){Ut*=.5;var jt=Pe[0],ft=Pe[1],on=Pe[2],hn=Pe[3],lt=Math.sin(Ut),Ct=Math.cos(Ut);return Ae[0]=jt*Ct-on*lt,Ae[1]=ft*Ct+hn*lt,Ae[2]=on*Ct+jt*lt,Ae[3]=hn*Ct-ft*lt,Ae}function de(Ae,Pe,Ut){Ut*=.5;var jt=Pe[0],ft=Pe[1],on=Pe[2],hn=Pe[3],lt=Math.sin(Ut),Ct=Math.cos(Ut);return Ae[0]=jt*Ct+ft*lt,Ae[1]=ft*Ct-jt*lt,Ae[2]=on*Ct+hn*lt,Ae[3]=hn*Ct-on*lt,Ae}function he(Ae,Pe){var Ut=Pe[0],jt=Pe[1],ft=Pe[2];return Ae[0]=Ut,Ae[1]=jt,Ae[2]=ft,Ae[3]=Math.sqrt(Math.abs(1-Ut*Ut-jt*jt-ft*ft)),Ae}function we(Ae,Pe){var Ut=Pe[0],jt=Pe[1],ft=Pe[2],on=Pe[3],hn=Math.sqrt(Ut*Ut+jt*jt+ft*ft),lt=Math.exp(on),Ct=hn>0?lt*Math.sin(hn)/hn:0;return Ae[0]=Ut*Ct,Ae[1]=jt*Ct,Ae[2]=ft*Ct,Ae[3]=lt*Math.cos(hn),Ae}function ve(Ae,Pe){var Ut=Pe[0],jt=Pe[1],ft=Pe[2],on=Pe[3],hn=Math.sqrt(Ut*Ut+jt*jt+ft*ft),lt=hn>0?Math.atan2(hn,on)/hn:0;return Ae[0]=Ut*lt,Ae[1]=jt*lt,Ae[2]=ft*lt,Ae[3]=.5*Math.log(Ut*Ut+jt*jt+ft*ft+on*on),Ae}function Ee(Ae,Pe,Ut){return ve(Ae,Pe),dr(Ae,Ae,Ut),we(Ae,Ae),Ae}function $e(Ae,Pe,Ut,jt){var ft=Pe[0],on=Pe[1],hn=Pe[2],lt=Pe[3],Ct=Ut[0],sn=Ut[1],W=Ut[2],Se=Ut[3],Ht,zt,Fn,Tn,lr;return zt=ft*Ct+on*sn+hn*W+lt*Se,zt<0&&(zt=-zt,Ct=-Ct,sn=-sn,W=-W,Se=-Se),1-zt>m.Ib?(Ht=Math.acos(zt),Fn=Math.sin(Ht),Tn=Math.sin((1-jt)*Ht)/Fn,lr=Math.sin(jt*Ht)/Fn):(Tn=1-jt,lr=jt),Ae[0]=Tn*ft+lr*Ct,Ae[1]=Tn*on+lr*sn,Ae[2]=Tn*hn+lr*W,Ae[3]=Tn*lt+lr*Se,Ae}function Fe(Ae){var Pe=glMatrix.RANDOM(),Ut=glMatrix.RANDOM(),jt=glMatrix.RANDOM(),ft=Math.sqrt(1-Pe),on=Math.sqrt(Pe);return Ae[0]=ft*Math.sin(2*Math.PI*Ut),Ae[1]=ft*Math.cos(2*Math.PI*Ut),Ae[2]=on*Math.sin(2*Math.PI*jt),Ae[3]=on*Math.cos(2*Math.PI*jt),Ae}function ct(Ae,Pe){var Ut=Pe[0],jt=Pe[1],ft=Pe[2],on=Pe[3],hn=Ut*Ut+jt*jt+ft*ft+on*on,lt=hn?1/hn:0;return Ae[0]=-Ut*lt,Ae[1]=-jt*lt,Ae[2]=-ft*lt,Ae[3]=on*lt,Ae}function vt(Ae,Pe){return Ae[0]=-Pe[0],Ae[1]=-Pe[1],Ae[2]=-Pe[2],Ae[3]=Pe[3],Ae}function at(Ae,Pe){var Ut=Pe[0]+Pe[4]+Pe[8],jt;if(Ut>0)jt=Math.sqrt(Ut+1),Ae[3]=.5*jt,jt=.5/jt,Ae[0]=(Pe[5]-Pe[7])*jt,Ae[1]=(Pe[6]-Pe[2])*jt,Ae[2]=(Pe[1]-Pe[3])*jt;else{var ft=0;Pe[4]>Pe[0]&&(ft=1),Pe[8]>Pe[ft*3+ft]&&(ft=2);var on=(ft+1)%3,hn=(ft+2)%3;jt=Math.sqrt(Pe[ft*3+ft]-Pe[on*3+on]-Pe[hn*3+hn]+1),Ae[ft]=.5*jt,jt=.5/jt,Ae[3]=(Pe[on*3+hn]-Pe[hn*3+on])*jt,Ae[on]=(Pe[on*3+ft]+Pe[ft*3+on])*jt,Ae[hn]=(Pe[hn*3+ft]+Pe[ft*3+hn])*jt}return Ae}function kt(Ae,Pe,Ut,jt){var ft=arguments.length>4&&arguments[4]!==void 0?arguments[4]:m.yy,on=Math.PI/360;Pe*=on,jt*=on,Ut*=on;var hn=Math.sin(Pe),lt=Math.cos(Pe),Ct=Math.sin(Ut),sn=Math.cos(Ut),W=Math.sin(jt),Se=Math.cos(jt);switch(ft){case"xyz":Ae[0]=hn*sn*Se+lt*Ct*W,Ae[1]=lt*Ct*Se-hn*sn*W,Ae[2]=lt*sn*W+hn*Ct*Se,Ae[3]=lt*sn*Se-hn*Ct*W;break;case"xzy":Ae[0]=hn*sn*Se-lt*Ct*W,Ae[1]=lt*Ct*Se-hn*sn*W,Ae[2]=lt*sn*W+hn*Ct*Se,Ae[3]=lt*sn*Se+hn*Ct*W;break;case"yxz":Ae[0]=hn*sn*Se+lt*Ct*W,Ae[1]=lt*Ct*Se-hn*sn*W,Ae[2]=lt*sn*W-hn*Ct*Se,Ae[3]=lt*sn*Se+hn*Ct*W;break;case"yzx":Ae[0]=hn*sn*Se+lt*Ct*W,Ae[1]=lt*Ct*Se+hn*sn*W,Ae[2]=lt*sn*W-hn*Ct*Se,Ae[3]=lt*sn*Se-hn*Ct*W;break;case"zxy":Ae[0]=hn*sn*Se-lt*Ct*W,Ae[1]=lt*Ct*Se+hn*sn*W,Ae[2]=lt*sn*W+hn*Ct*Se,Ae[3]=lt*sn*Se-hn*Ct*W;break;case"zyx":Ae[0]=hn*sn*Se-lt*Ct*W,Ae[1]=lt*Ct*Se+hn*sn*W,Ae[2]=lt*sn*W-hn*Ct*Se,Ae[3]=lt*sn*Se+hn*Ct*W;break;default:throw new Error("Unknown angle order "+ft)}return Ae}function It(Ae){return"quat("+Ae[0]+", "+Ae[1]+", "+Ae[2]+", "+Ae[3]+")"}var Bn=N.d9,Lt=N.al,Wn=N.JG,Xn=N.t8,In=N.IH,zn=D,dr=N.bA,vn=N.AK,_r=N.t7,Ge=N.kE,Tt=null,On=N.we,Vr=null,en=N.Fv,ln=N.I6;function Cn(Ae,Pe){return Math.abs(vec4.dot(Ae,Pe))>=1-glMatrix.EPSILON}var Mt=function(){var Ae=V.Ue(),Pe=V.al(1,0,0),Ut=V.al(0,1,0);return function(jt,ft,on){var hn=V.AK(ft,on);return hn<-.999999?(V.kC(Ae,Pe,ft),V.Zh(Ae)<1e-6&&V.kC(Ae,Ut,ft),V.Fv(Ae,Ae),C(jt,Ae,Math.PI),jt):hn>.999999?(jt[0]=0,jt[1]=0,jt[2]=0,jt[3]=1,jt):(V.kC(Ae,ft,on),jt[0]=Ae[0],jt[1]=Ae[1],jt[2]=Ae[2],jt[3]=1+hn,en(jt,jt))}}(),Et=function(){var Ae=E(),Pe=E();return function(Ut,jt,ft,on,hn,lt){return $e(Ae,jt,hn,lt),$e(Pe,ft,on,lt),$e(Ut,Ae,Pe,2*lt*(1-lt)),Ut}}(),pe=function(){var Ae=Z.Ue();return function(Pe,Ut,jt,ft){return Ae[0]=jt[0],Ae[3]=jt[1],Ae[6]=jt[2],Ae[1]=ft[0],Ae[4]=ft[1],Ae[7]=ft[2],Ae[2]=-Ut[0],Ae[5]=-Ut[1],Ae[8]=-Ut[2],en(Pe,at(Pe,Ae))}}()},45545:function(Be,Me,b){"use strict";b.d(Me,{AK:function(){return Bn},Fv:function(){return It},I6:function(){return en},JG:function(){return E},Ue:function(){return Z},t8:function(){return F}});var m=b(85551);function Z(){var ft=new m.WT(2);return m.WT!=Float32Array&&(ft[0]=0,ft[1]=0),ft}function V(ft){var on=new glMatrix.ARRAY_TYPE(2);return on[0]=ft[0],on[1]=ft[1],on}function N(ft,on){var hn=new glMatrix.ARRAY_TYPE(2);return hn[0]=ft,hn[1]=on,hn}function E(ft,on){return ft[0]=on[0],ft[1]=on[1],ft}function F(ft,on,hn){return ft[0]=on,ft[1]=hn,ft}function C(ft,on,hn){return ft[0]=on[0]+hn[0],ft[1]=on[1]+hn[1],ft}function P(ft,on,hn){return ft[0]=on[0]-hn[0],ft[1]=on[1]-hn[1],ft}function H(ft,on,hn){return ft[0]=on[0]*hn[0],ft[1]=on[1]*hn[1],ft}function D(ft,on,hn){return ft[0]=on[0]/hn[0],ft[1]=on[1]/hn[1],ft}function X(ft,on){return ft[0]=Math.ceil(on[0]),ft[1]=Math.ceil(on[1]),ft}function j(ft,on){return ft[0]=Math.floor(on[0]),ft[1]=Math.floor(on[1]),ft}function de(ft,on,hn){return ft[0]=Math.min(on[0],hn[0]),ft[1]=Math.min(on[1],hn[1]),ft}function he(ft,on,hn){return ft[0]=Math.max(on[0],hn[0]),ft[1]=Math.max(on[1],hn[1]),ft}function we(ft,on){return ft[0]=glMatrix.round(on[0]),ft[1]=glMatrix.round(on[1]),ft}function ve(ft,on,hn){return ft[0]=on[0]*hn,ft[1]=on[1]*hn,ft}function Ee(ft,on,hn,lt){return ft[0]=on[0]+hn[0]*lt,ft[1]=on[1]+hn[1]*lt,ft}function $e(ft,on){var hn=on[0]-ft[0],lt=on[1]-ft[1];return Math.sqrt(hn*hn+lt*lt)}function Fe(ft,on){var hn=on[0]-ft[0],lt=on[1]-ft[1];return hn*hn+lt*lt}function ct(ft){var on=ft[0],hn=ft[1];return Math.sqrt(on*on+hn*hn)}function vt(ft){var on=ft[0],hn=ft[1];return on*on+hn*hn}function at(ft,on){return ft[0]=-on[0],ft[1]=-on[1],ft}function kt(ft,on){return ft[0]=1/on[0],ft[1]=1/on[1],ft}function It(ft,on){var hn=on[0],lt=on[1],Ct=hn*hn+lt*lt;return Ct>0&&(Ct=1/Math.sqrt(Ct)),ft[0]=on[0]*Ct,ft[1]=on[1]*Ct,ft}function Bn(ft,on){return ft[0]*on[0]+ft[1]*on[1]}function Lt(ft,on,hn){var lt=on[0]*hn[1]-on[1]*hn[0];return ft[0]=ft[1]=0,ft[2]=lt,ft}function Wn(ft,on,hn,lt){var Ct=on[0],sn=on[1];return ft[0]=Ct+lt*(hn[0]-Ct),ft[1]=sn+lt*(hn[1]-sn),ft}function Xn(ft,on){on=on===void 0?1:on;var hn=glMatrix.RANDOM()*2*Math.PI;return ft[0]=Math.cos(hn)*on,ft[1]=Math.sin(hn)*on,ft}function In(ft,on,hn){var lt=on[0],Ct=on[1];return ft[0]=hn[0]*lt+hn[2]*Ct,ft[1]=hn[1]*lt+hn[3]*Ct,ft}function zn(ft,on,hn){var lt=on[0],Ct=on[1];return ft[0]=hn[0]*lt+hn[2]*Ct+hn[4],ft[1]=hn[1]*lt+hn[3]*Ct+hn[5],ft}function dr(ft,on,hn){var lt=on[0],Ct=on[1];return ft[0]=hn[0]*lt+hn[3]*Ct+hn[6],ft[1]=hn[1]*lt+hn[4]*Ct+hn[7],ft}function vn(ft,on,hn){var lt=on[0],Ct=on[1];return ft[0]=hn[0]*lt+hn[4]*Ct+hn[12],ft[1]=hn[1]*lt+hn[5]*Ct+hn[13],ft}function _r(ft,on,hn,lt){var Ct=on[0]-hn[0],sn=on[1]-hn[1],W=Math.sin(lt),Se=Math.cos(lt);return ft[0]=Ct*Se-sn*W+hn[0],ft[1]=Ct*W+sn*Se+hn[1],ft}function Ge(ft,on){var hn=ft[0],lt=ft[1],Ct=on[0],sn=on[1];return Math.abs(Math.atan2(lt*Ct-hn*sn,hn*Ct+lt*sn))}function Tt(ft,on){var hn=ft[0],lt=ft[1],Ct=on[0],sn=on[1];return Math.atan2(hn*sn-lt*Ct,hn*Ct+lt*sn)}function On(ft){return ft[0]=0,ft[1]=0,ft}function Vr(ft){return"vec2("+ft[0]+", "+ft[1]+")"}function en(ft,on){return ft[0]===on[0]&&ft[1]===on[1]}function ln(ft,on){var hn=ft[0],lt=ft[1],Ct=on[0],sn=on[1];return Math.abs(hn-Ct)<=glMatrix.EPSILON*Math.max(1,Math.abs(hn),Math.abs(Ct))&&Math.abs(lt-sn)<=glMatrix.EPSILON*Math.max(1,Math.abs(lt),Math.abs(sn))}var Cn=null,Mt=null,Et=null,pe=null,Ae=null,Pe=null,Ut=null,jt=function(){var ft=Z();return function(on,hn,lt,Ct,sn,W){var Se,Ht;for(hn||(hn=2),lt||(lt=0),Ct?Ht=Math.min(Ct*hn+lt,on.length):Ht=on.length,Se=lt;Se<Ht;Se+=hn)ft[0]=on[Se],ft[1]=on[Se+1],sn(ft,ft,W),on[Se]=ft[0],on[Se+1]=ft[1];return on}}()},92421:function(Be,Me,b){"use strict";b.d(Me,{$X:function(){return H},AK:function(){return Bn},Fp:function(){return we},Fv:function(){return It},IH:function(){return P},JG:function(){return F},Jp:function(){return D},TK:function(){return Ut},Ue:function(){return Z},VC:function(){return Ge},VV:function(){return he},Zh:function(){return ft},al:function(){return E},bA:function(){return Ee},d9:function(){return V},fF:function(){return vn},fS:function(){return Et},kC:function(){return Lt},kE:function(){return N},kK:function(){return _r},lu:function(){return pe},t7:function(){return Wn},t8:function(){return C}});var m=b(85551);function Z(){var lt=new m.WT(3);return m.WT!=Float32Array&&(lt[0]=0,lt[1]=0,lt[2]=0),lt}function V(lt){var Ct=new m.WT(3);return Ct[0]=lt[0],Ct[1]=lt[1],Ct[2]=lt[2],Ct}function N(lt){var Ct=lt[0],sn=lt[1],W=lt[2];return Math.sqrt(Ct*Ct+sn*sn+W*W)}function E(lt,Ct,sn){var W=new m.WT(3);return W[0]=lt,W[1]=Ct,W[2]=sn,W}function F(lt,Ct){return lt[0]=Ct[0],lt[1]=Ct[1],lt[2]=Ct[2],lt}function C(lt,Ct,sn,W){return lt[0]=Ct,lt[1]=sn,lt[2]=W,lt}function P(lt,Ct,sn){return lt[0]=Ct[0]+sn[0],lt[1]=Ct[1]+sn[1],lt[2]=Ct[2]+sn[2],lt}function H(lt,Ct,sn){return lt[0]=Ct[0]-sn[0],lt[1]=Ct[1]-sn[1],lt[2]=Ct[2]-sn[2],lt}function D(lt,Ct,sn){return lt[0]=Ct[0]*sn[0],lt[1]=Ct[1]*sn[1],lt[2]=Ct[2]*sn[2],lt}function X(lt,Ct,sn){return lt[0]=Ct[0]/sn[0],lt[1]=Ct[1]/sn[1],lt[2]=Ct[2]/sn[2],lt}function j(lt,Ct){return lt[0]=Math.ceil(Ct[0]),lt[1]=Math.ceil(Ct[1]),lt[2]=Math.ceil(Ct[2]),lt}function de(lt,Ct){return lt[0]=Math.floor(Ct[0]),lt[1]=Math.floor(Ct[1]),lt[2]=Math.floor(Ct[2]),lt}function he(lt,Ct,sn){return lt[0]=Math.min(Ct[0],sn[0]),lt[1]=Math.min(Ct[1],sn[1]),lt[2]=Math.min(Ct[2],sn[2]),lt}function we(lt,Ct,sn){return lt[0]=Math.max(Ct[0],sn[0]),lt[1]=Math.max(Ct[1],sn[1]),lt[2]=Math.max(Ct[2],sn[2]),lt}function ve(lt,Ct){return lt[0]=glMatrix.round(Ct[0]),lt[1]=glMatrix.round(Ct[1]),lt[2]=glMatrix.round(Ct[2]),lt}function Ee(lt,Ct,sn){return lt[0]=Ct[0]*sn,lt[1]=Ct[1]*sn,lt[2]=Ct[2]*sn,lt}function $e(lt,Ct,sn,W){return lt[0]=Ct[0]+sn[0]*W,lt[1]=Ct[1]+sn[1]*W,lt[2]=Ct[2]+sn[2]*W,lt}function Fe(lt,Ct){var sn=Ct[0]-lt[0],W=Ct[1]-lt[1],Se=Ct[2]-lt[2];return Math.sqrt(sn*sn+W*W+Se*Se)}function ct(lt,Ct){var sn=Ct[0]-lt[0],W=Ct[1]-lt[1],Se=Ct[2]-lt[2];return sn*sn+W*W+Se*Se}function vt(lt){var Ct=lt[0],sn=lt[1],W=lt[2];return Ct*Ct+sn*sn+W*W}function at(lt,Ct){return lt[0]=-Ct[0],lt[1]=-Ct[1],lt[2]=-Ct[2],lt}function kt(lt,Ct){return lt[0]=1/Ct[0],lt[1]=1/Ct[1],lt[2]=1/Ct[2],lt}function It(lt,Ct){var sn=Ct[0],W=Ct[1],Se=Ct[2],Ht=sn*sn+W*W+Se*Se;return Ht>0&&(Ht=1/Math.sqrt(Ht)),lt[0]=Ct[0]*Ht,lt[1]=Ct[1]*Ht,lt[2]=Ct[2]*Ht,lt}function Bn(lt,Ct){return lt[0]*Ct[0]+lt[1]*Ct[1]+lt[2]*Ct[2]}function Lt(lt,Ct,sn){var W=Ct[0],Se=Ct[1],Ht=Ct[2],zt=sn[0],Fn=sn[1],Tn=sn[2];return lt[0]=Se*Tn-Ht*Fn,lt[1]=Ht*zt-W*Tn,lt[2]=W*Fn-Se*zt,lt}function Wn(lt,Ct,sn,W){var Se=Ct[0],Ht=Ct[1],zt=Ct[2];return lt[0]=Se+W*(sn[0]-Se),lt[1]=Ht+W*(sn[1]-Ht),lt[2]=zt+W*(sn[2]-zt),lt}function Xn(lt,Ct,sn,W){var Se=Math.acos(Math.min(Math.max(Bn(Ct,sn),-1),1)),Ht=Math.sin(Se),zt=Math.sin((1-W)*Se)/Ht,Fn=Math.sin(W*Se)/Ht;return lt[0]=zt*Ct[0]+Fn*sn[0],lt[1]=zt*Ct[1]+Fn*sn[1],lt[2]=zt*Ct[2]+Fn*sn[2],lt}function In(lt,Ct,sn,W,Se,Ht){var zt=Ht*Ht,Fn=zt*(2*Ht-3)+1,Tn=zt*(Ht-2)+Ht,lr=zt*(Ht-1),je=zt*(3-2*Ht);return lt[0]=Ct[0]*Fn+sn[0]*Tn+W[0]*lr+Se[0]*je,lt[1]=Ct[1]*Fn+sn[1]*Tn+W[1]*lr+Se[1]*je,lt[2]=Ct[2]*Fn+sn[2]*Tn+W[2]*lr+Se[2]*je,lt}function zn(lt,Ct,sn,W,Se,Ht){var zt=1-Ht,Fn=zt*zt,Tn=Ht*Ht,lr=Fn*zt,je=3*Ht*Fn,be=3*Tn*zt,it=Tn*Ht;return lt[0]=Ct[0]*lr+sn[0]*je+W[0]*be+Se[0]*it,lt[1]=Ct[1]*lr+sn[1]*je+W[1]*be+Se[1]*it,lt[2]=Ct[2]*lr+sn[2]*je+W[2]*be+Se[2]*it,lt}function dr(lt,Ct){Ct=Ct===void 0?1:Ct;var sn=glMatrix.RANDOM()*2*Math.PI,W=glMatrix.RANDOM()*2-1,Se=Math.sqrt(1-W*W)*Ct;return lt[0]=Math.cos(sn)*Se,lt[1]=Math.sin(sn)*Se,lt[2]=W*Ct,lt}function vn(lt,Ct,sn){var W=Ct[0],Se=Ct[1],Ht=Ct[2],zt=sn[3]*W+sn[7]*Se+sn[11]*Ht+sn[15];return zt=zt||1,lt[0]=(sn[0]*W+sn[4]*Se+sn[8]*Ht+sn[12])/zt,lt[1]=(sn[1]*W+sn[5]*Se+sn[9]*Ht+sn[13])/zt,lt[2]=(sn[2]*W+sn[6]*Se+sn[10]*Ht+sn[14])/zt,lt}function _r(lt,Ct,sn){var W=Ct[0],Se=Ct[1],Ht=Ct[2];return lt[0]=W*sn[0]+Se*sn[3]+Ht*sn[6],lt[1]=W*sn[1]+Se*sn[4]+Ht*sn[7],lt[2]=W*sn[2]+Se*sn[5]+Ht*sn[8],lt}function Ge(lt,Ct,sn){var W=sn[0],Se=sn[1],Ht=sn[2],zt=sn[3],Fn=Ct[0],Tn=Ct[1],lr=Ct[2],je=Se*lr-Ht*Tn,be=Ht*Fn-W*lr,it=W*Tn-Se*Fn;return je=je+je,be=be+be,it=it+it,lt[0]=Fn+zt*je+Se*it-Ht*be,lt[1]=Tn+zt*be+Ht*je-W*it,lt[2]=lr+zt*it+W*be-Se*je,lt}function Tt(lt,Ct,sn,W){var Se=[],Ht=[];return Se[0]=Ct[0]-sn[0],Se[1]=Ct[1]-sn[1],Se[2]=Ct[2]-sn[2],Ht[0]=Se[0],Ht[1]=Se[1]*Math.cos(W)-Se[2]*Math.sin(W),Ht[2]=Se[1]*Math.sin(W)+Se[2]*Math.cos(W),lt[0]=Ht[0]+sn[0],lt[1]=Ht[1]+sn[1],lt[2]=Ht[2]+sn[2],lt}function On(lt,Ct,sn,W){var Se=[],Ht=[];return Se[0]=Ct[0]-sn[0],Se[1]=Ct[1]-sn[1],Se[2]=Ct[2]-sn[2],Ht[0]=Se[2]*Math.sin(W)+Se[0]*Math.cos(W),Ht[1]=Se[1],Ht[2]=Se[2]*Math.cos(W)-Se[0]*Math.sin(W),lt[0]=Ht[0]+sn[0],lt[1]=Ht[1]+sn[1],lt[2]=Ht[2]+sn[2],lt}function Vr(lt,Ct,sn,W){var Se=[],Ht=[];return Se[0]=Ct[0]-sn[0],Se[1]=Ct[1]-sn[1],Se[2]=Ct[2]-sn[2],Ht[0]=Se[0]*Math.cos(W)-Se[1]*Math.sin(W),Ht[1]=Se[0]*Math.sin(W)+Se[1]*Math.cos(W),Ht[2]=Se[2],lt[0]=Ht[0]+sn[0],lt[1]=Ht[1]+sn[1],lt[2]=Ht[2]+sn[2],lt}function en(lt,Ct){var sn=lt[0],W=lt[1],Se=lt[2],Ht=Ct[0],zt=Ct[1],Fn=Ct[2],Tn=Math.sqrt((sn*sn+W*W+Se*Se)*(Ht*Ht+zt*zt+Fn*Fn)),lr=Tn&&Bn(lt,Ct)/Tn;return Math.acos(Math.min(Math.max(lr,-1),1))}function ln(lt){return lt[0]=0,lt[1]=0,lt[2]=0,lt}function Cn(lt){return"vec3("+lt[0]+", "+lt[1]+", "+lt[2]+")"}function Mt(lt,Ct){return lt[0]===Ct[0]&&lt[1]===Ct[1]&&lt[2]===Ct[2]}function Et(lt,Ct){var sn=lt[0],W=lt[1],Se=lt[2],Ht=Ct[0],zt=Ct[1],Fn=Ct[2];return Math.abs(sn-Ht)<=m.Ib*Math.max(1,Math.abs(sn),Math.abs(Ht))&&Math.abs(W-zt)<=m.Ib*Math.max(1,Math.abs(W),Math.abs(zt))&&Math.abs(Se-Fn)<=m.Ib*Math.max(1,Math.abs(Se),Math.abs(Fn))}var pe=H,Ae=null,Pe=null,Ut=Fe,jt=null,ft=N,on=null,hn=function(){var lt=Z();return function(Ct,sn,W,Se,Ht,zt){var Fn,Tn;for(sn||(sn=3),W||(W=0),Se?Tn=Math.min(Se*sn+W,Ct.length):Tn=Ct.length,Fn=W;Fn<Tn;Fn+=sn)lt[0]=Ct[Fn],lt[1]=Ct[Fn+1],lt[2]=Ct[Fn+2],Ht(lt,lt,zt),Ct[Fn]=lt[0],Ct[Fn+1]=lt[1],Ct[Fn+2]=lt[2];return Ct}}()},97082:function(Be,Me,b){"use strict";b.d(Me,{AK:function(){return Bn},Fv:function(){return It},I6:function(){return _r},IH:function(){return C},JG:function(){return E},Ue:function(){return Z},al:function(){return N},bA:function(){return ve},d9:function(){return V},fF:function(){return In},kE:function(){return ct},t7:function(){return Wn},t8:function(){return F},we:function(){return vt}});var m=b(85551);function Z(){var pe=new m.WT(4);return m.WT!=Float32Array&&(pe[0]=0,pe[1]=0,pe[2]=0,pe[3]=0),pe}function V(pe){var Ae=new m.WT(4);return Ae[0]=pe[0],Ae[1]=pe[1],Ae[2]=pe[2],Ae[3]=pe[3],Ae}function N(pe,Ae,Pe,Ut){var jt=new m.WT(4);return jt[0]=pe,jt[1]=Ae,jt[2]=Pe,jt[3]=Ut,jt}function E(pe,Ae){return pe[0]=Ae[0],pe[1]=Ae[1],pe[2]=Ae[2],pe[3]=Ae[3],pe}function F(pe,Ae,Pe,Ut,jt){return pe[0]=Ae,pe[1]=Pe,pe[2]=Ut,pe[3]=jt,pe}function C(pe,Ae,Pe){return pe[0]=Ae[0]+Pe[0],pe[1]=Ae[1]+Pe[1],pe[2]=Ae[2]+Pe[2],pe[3]=Ae[3]+Pe[3],pe}function P(pe,Ae,Pe){return pe[0]=Ae[0]-Pe[0],pe[1]=Ae[1]-Pe[1],pe[2]=Ae[2]-Pe[2],pe[3]=Ae[3]-Pe[3],pe}function H(pe,Ae,Pe){return pe[0]=Ae[0]*Pe[0],pe[1]=Ae[1]*Pe[1],pe[2]=Ae[2]*Pe[2],pe[3]=Ae[3]*Pe[3],pe}function D(pe,Ae,Pe){return pe[0]=Ae[0]/Pe[0],pe[1]=Ae[1]/Pe[1],pe[2]=Ae[2]/Pe[2],pe[3]=Ae[3]/Pe[3],pe}function X(pe,Ae){return pe[0]=Math.ceil(Ae[0]),pe[1]=Math.ceil(Ae[1]),pe[2]=Math.ceil(Ae[2]),pe[3]=Math.ceil(Ae[3]),pe}function j(pe,Ae){return pe[0]=Math.floor(Ae[0]),pe[1]=Math.floor(Ae[1]),pe[2]=Math.floor(Ae[2]),pe[3]=Math.floor(Ae[3]),pe}function de(pe,Ae,Pe){return pe[0]=Math.min(Ae[0],Pe[0]),pe[1]=Math.min(Ae[1],Pe[1]),pe[2]=Math.min(Ae[2],Pe[2]),pe[3]=Math.min(Ae[3],Pe[3]),pe}function he(pe,Ae,Pe){return pe[0]=Math.max(Ae[0],Pe[0]),pe[1]=Math.max(Ae[1],Pe[1]),pe[2]=Math.max(Ae[2],Pe[2]),pe[3]=Math.max(Ae[3],Pe[3]),pe}function we(pe,Ae){return pe[0]=glMatrix.round(Ae[0]),pe[1]=glMatrix.round(Ae[1]),pe[2]=glMatrix.round(Ae[2]),pe[3]=glMatrix.round(Ae[3]),pe}function ve(pe,Ae,Pe){return pe[0]=Ae[0]*Pe,pe[1]=Ae[1]*Pe,pe[2]=Ae[2]*Pe,pe[3]=Ae[3]*Pe,pe}function Ee(pe,Ae,Pe,Ut){return pe[0]=Ae[0]+Pe[0]*Ut,pe[1]=Ae[1]+Pe[1]*Ut,pe[2]=Ae[2]+Pe[2]*Ut,pe[3]=Ae[3]+Pe[3]*Ut,pe}function $e(pe,Ae){var Pe=Ae[0]-pe[0],Ut=Ae[1]-pe[1],jt=Ae[2]-pe[2],ft=Ae[3]-pe[3];return Math.sqrt(Pe*Pe+Ut*Ut+jt*jt+ft*ft)}function Fe(pe,Ae){var Pe=Ae[0]-pe[0],Ut=Ae[1]-pe[1],jt=Ae[2]-pe[2],ft=Ae[3]-pe[3];return Pe*Pe+Ut*Ut+jt*jt+ft*ft}function ct(pe){var Ae=pe[0],Pe=pe[1],Ut=pe[2],jt=pe[3];return Math.sqrt(Ae*Ae+Pe*Pe+Ut*Ut+jt*jt)}function vt(pe){var Ae=pe[0],Pe=pe[1],Ut=pe[2],jt=pe[3];return Ae*Ae+Pe*Pe+Ut*Ut+jt*jt}function at(pe,Ae){return pe[0]=-Ae[0],pe[1]=-Ae[1],pe[2]=-Ae[2],pe[3]=-Ae[3],pe}function kt(pe,Ae){return pe[0]=1/Ae[0],pe[1]=1/Ae[1],pe[2]=1/Ae[2],pe[3]=1/Ae[3],pe}function It(pe,Ae){var Pe=Ae[0],Ut=Ae[1],jt=Ae[2],ft=Ae[3],on=Pe*Pe+Ut*Ut+jt*jt+ft*ft;return on>0&&(on=1/Math.sqrt(on)),pe[0]=Pe*on,pe[1]=Ut*on,pe[2]=jt*on,pe[3]=ft*on,pe}function Bn(pe,Ae){return pe[0]*Ae[0]+pe[1]*Ae[1]+pe[2]*Ae[2]+pe[3]*Ae[3]}function Lt(pe,Ae,Pe,Ut){var jt=Pe[0]*Ut[1]-Pe[1]*Ut[0],ft=Pe[0]*Ut[2]-Pe[2]*Ut[0],on=Pe[0]*Ut[3]-Pe[3]*Ut[0],hn=Pe[1]*Ut[2]-Pe[2]*Ut[1],lt=Pe[1]*Ut[3]-Pe[3]*Ut[1],Ct=Pe[2]*Ut[3]-Pe[3]*Ut[2],sn=Ae[0],W=Ae[1],Se=Ae[2],Ht=Ae[3];return pe[0]=W*Ct-Se*lt+Ht*hn,pe[1]=-(sn*Ct)+Se*on-Ht*ft,pe[2]=sn*lt-W*on+Ht*jt,pe[3]=-(sn*hn)+W*ft-Se*jt,pe}function Wn(pe,Ae,Pe,Ut){var jt=Ae[0],ft=Ae[1],on=Ae[2],hn=Ae[3];return pe[0]=jt+Ut*(Pe[0]-jt),pe[1]=ft+Ut*(Pe[1]-ft),pe[2]=on+Ut*(Pe[2]-on),pe[3]=hn+Ut*(Pe[3]-hn),pe}function Xn(pe,Ae){Ae=Ae===void 0?1:Ae;var Pe,Ut,jt,ft,on,hn,lt;lt=glMatrix.RANDOM(),Pe=lt*2-1,Ut=(4*glMatrix.RANDOM()-2)*Math.sqrt(lt*-lt+lt),on=Pe*Pe+Ut*Ut,lt=glMatrix.RANDOM(),jt=lt*2-1,ft=(4*glMatrix.RANDOM()-2)*Math.sqrt(lt*-lt+lt),hn=jt*jt+ft*ft;var Ct=Math.sqrt((1-on)/hn);return pe[0]=Ae*Pe,pe[1]=Ae*Ut,pe[2]=Ae*jt*Ct,pe[3]=Ae*ft*Ct,pe}function In(pe,Ae,Pe){var Ut=Ae[0],jt=Ae[1],ft=Ae[2],on=Ae[3];return pe[0]=Pe[0]*Ut+Pe[4]*jt+Pe[8]*ft+Pe[12]*on,pe[1]=Pe[1]*Ut+Pe[5]*jt+Pe[9]*ft+Pe[13]*on,pe[2]=Pe[2]*Ut+Pe[6]*jt+Pe[10]*ft+Pe[14]*on,pe[3]=Pe[3]*Ut+Pe[7]*jt+Pe[11]*ft+Pe[15]*on,pe}function zn(pe,Ae,Pe){var Ut=Pe[0],jt=Pe[1],ft=Pe[2],on=Pe[3],hn=Ae[0],lt=Ae[1],Ct=Ae[2],sn=jt*Ct-ft*lt,W=ft*hn-Ut*Ct,Se=Ut*lt-jt*hn;return sn=sn+sn,W=W+W,Se=Se+Se,pe[0]=hn+on*sn+jt*Se-ft*W,pe[1]=lt+on*W+ft*sn-Ut*Se,pe[2]=Ct+on*Se+Ut*W-jt*sn,pe[3]=Ae[3],pe}function dr(pe){return pe[0]=0,pe[1]=0,pe[2]=0,pe[3]=0,pe}function vn(pe){return"vec4("+pe[0]+", "+pe[1]+", "+pe[2]+", "+pe[3]+")"}function _r(pe,Ae){return pe[0]===Ae[0]&&pe[1]===Ae[1]&&pe[2]===Ae[2]&&pe[3]===Ae[3]}function Ge(pe,Ae){var Pe=pe[0],Ut=pe[1],jt=pe[2],ft=pe[3],on=Ae[0],hn=Ae[1],lt=Ae[2],Ct=Ae[3];return Math.abs(Pe-on)<=glMatrix.EPSILON*Math.max(1,Math.abs(Pe),Math.abs(on))&&Math.abs(Ut-hn)<=glMatrix.EPSILON*Math.max(1,Math.abs(Ut),Math.abs(hn))&&Math.abs(jt-lt)<=glMatrix.EPSILON*Math.max(1,Math.abs(jt),Math.abs(lt))&&Math.abs(ft-Ct)<=glMatrix.EPSILON*Math.max(1,Math.abs(ft),Math.abs(Ct))}var Tt=null,On=null,Vr=null,en=null,ln=null,Cn=null,Mt=null,Et=function(){var pe=Z();return function(Ae,Pe,Ut,jt,ft,on){var hn,lt;for(Pe||(Pe=4),Ut||(Ut=0),jt?lt=Math.min(jt*Pe+Ut,Ae.length):lt=Ae.length,hn=Ut;hn<lt;hn+=Pe)pe[0]=Ae[hn],pe[1]=Ae[hn+1],pe[2]=Ae[hn+2],pe[3]=Ae[hn+3],ft(pe,pe,on),Ae[hn]=pe[0],Ae[hn+1]=pe[1],Ae[hn+2]=pe[2],Ae[hn+3]=pe[3];return Ae}}()},75172:function(Be,Me,b){var m=b(89224);Be.exports={Graph:m.Graph,json:b(17401),alg:b(54613),version:m.version}},91606:function(Be,Me,b){var m=b(95329);Be.exports=Z;function Z(V){var N={},E=[],F;function C(P){m.has(N,P)||(N[P]=!0,F.push(P),m.each(V.successors(P),C),m.each(V.predecessors(P),C))}return m.each(V.nodes(),function(P){F=[],C(P),F.length&&E.push(F)}),E}},21482:function(Be,Me,b){var m=b(95329);Be.exports=Z;function Z(N,E,F){m.isArray(E)||(E=[E]);var C=(N.isDirected()?N.successors:N.neighbors).bind(N),P=[],H={};return m.each(E,function(D){if(!N.hasNode(D))throw new Error("Graph does not have node: "+D);V(N,D,F==="post",H,C,P)}),P}function V(N,E,F,C,P,H){m.has(C,E)||(C[E]=!0,F||H.push(E),m.each(P(E),function(D){V(N,D,F,C,P,H)}),F&&H.push(E))}},40845:function(Be,Me,b){var m=b(13746),Z=b(95329);Be.exports=V;function V(N,E,F){return Z.transform(N.nodes(),function(C,P){C[P]=m(N,P,E,F)},{})}},13746:function(Be,Me,b){var m=b(95329),Z=b(36614);Be.exports=N;var V=m.constant(1);function N(F,C,P,H){return E(F,String(C),P||V,H||function(D){return F.outEdges(D)})}function E(F,C,P,H){var D={},X=new Z,j,de,he=function(we){var ve=we.v!==j?we.v:we.w,Ee=D[ve],$e=P(we),Fe=de.distance+$e;if($e<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+we+" Weight: "+$e);Fe<Ee.distance&&(Ee.distance=Fe,Ee.predecessor=j,X.decrease(ve,Fe))};for(F.nodes().forEach(function(we){var ve=we===C?0:Number.POSITIVE_INFINITY;D[we]={distance:ve},X.add(we,ve)});X.size()>0&&(j=X.removeMin(),de=D[j],de.distance!==Number.POSITIVE_INFINITY);)H(j).forEach(he);return D}},59324:function(Be,Me,b){var m=b(95329),Z=b(94558);Be.exports=V;function V(N){return m.filter(Z(N),function(E){return E.length>1||E.length===1&&N.hasEdge(E[0],E[0])})}},22893:function(Be,Me,b){var m=b(95329);Be.exports=V;var Z=m.constant(1);function V(E,F,C){return N(E,F||Z,C||function(P){return E.outEdges(P)})}function N(E,F,C){var P={},H=E.nodes();return H.forEach(function(D){P[D]={},P[D][D]={distance:0},H.forEach(function(X){D!==X&&(P[D][X]={distance:Number.POSITIVE_INFINITY})}),C(D).forEach(function(X){var j=X.v===D?X.w:X.v,de=F(X);P[D][j]={distance:de,predecessor:D}})}),H.forEach(function(D){var X=P[D];H.forEach(function(j){var de=P[j];H.forEach(function(he){var we=de[D],ve=X[he],Ee=de[he],$e=we.distance+ve.distance;$e<Ee.distance&&(Ee.distance=$e,Ee.predecessor=ve.predecessor)})})}),P}},54613:function(Be,Me,b){Be.exports={components:b(91606),dijkstra:b(13746),dijkstraAll:b(40845),findCycles:b(59324),floydWarshall:b(22893),isAcyclic:b(588),postorder:b(98049),preorder:b(67158),prim:b(66058),tarjan:b(94558),topsort:b(7793)}},588:function(Be,Me,b){var m=b(7793);Be.exports=Z;function Z(V){try{m(V)}catch(N){if(N instanceof m.CycleException)return!1;throw N}return!0}},98049:function(Be,Me,b){var m=b(21482);Be.exports=Z;function Z(V,N){return m(V,N,"post")}},67158:function(Be,Me,b){var m=b(21482);Be.exports=Z;function Z(V,N){return m(V,N,"pre")}},66058:function(Be,Me,b){var m=b(95329),Z=b(6349),V=b(36614);Be.exports=N;function N(E,F){var C=new Z,P={},H=new V,D;function X(de){var he=de.v===D?de.w:de.v,we=H.priority(he);if(we!==void 0){var ve=F(de);ve<we&&(P[he]=D,H.decrease(he,ve))}}if(E.nodeCount()===0)return C;m.each(E.nodes(),function(de){H.add(de,Number.POSITIVE_INFINITY),C.setNode(de)}),H.decrease(E.nodes()[0],0);for(var j=!1;H.size()>0;){if(D=H.removeMin(),m.has(P,D))C.setEdge(D,P[D]);else{if(j)throw new Error("Input graph is not connected: "+E);j=!0}E.nodeEdges(D).forEach(X)}return C}},94558:function(Be,Me,b){var m=b(95329);Be.exports=Z;function Z(V){var N=0,E=[],F={},C=[];function P(H){var D=F[H]={onStack:!0,lowlink:N,index:N++};if(E.push(H),V.successors(H).forEach(function(de){m.has(F,de)?F[de].onStack&&(D.lowlink=Math.min(D.lowlink,F[de].index)):(P(de),D.lowlink=Math.min(D.lowlink,F[de].lowlink))}),D.lowlink===D.index){var X=[],j;do j=E.pop(),F[j].onStack=!1,X.push(j);while(H!==j);C.push(X)}}return V.nodes().forEach(function(H){m.has(F,H)||P(H)}),C}},7793:function(Be,Me,b){var m=b(95329);Be.exports=Z,Z.CycleException=V;function Z(N){var E={},F={},C=[];function P(H){if(m.has(F,H))throw new V;m.has(E,H)||(F[H]=!0,E[H]=!0,m.each(N.predecessors(H),P),delete F[H],C.push(H))}if(m.each(N.sinks(),P),m.size(E)!==N.nodeCount())throw new V;return C}function V(){}V.prototype=new Error},36614:function(Be,Me,b){var m=b(95329);Be.exports=Z;function Z(){this._arr=[],this._keyIndices={}}Z.prototype.size=function(){return this._arr.length},Z.prototype.keys=function(){return this._arr.map(function(V){return V.key})},Z.prototype.has=function(V){return m.has(this._keyIndices,V)},Z.prototype.priority=function(V){var N=this._keyIndices[V];if(N!==void 0)return this._arr[N].priority},Z.prototype.min=function(){if(this.size()===0)throw new Error("Queue underflow");return this._arr[0].key},Z.prototype.add=function(V,N){var E=this._keyIndices;if(V=String(V),!m.has(E,V)){var F=this._arr,C=F.length;return E[V]=C,F.push({key:V,priority:N}),this._decrease(C),!0}return!1},Z.prototype.removeMin=function(){this._swap(0,this._arr.length-1);var V=this._arr.pop();return delete this._keyIndices[V.key],this._heapify(0),V.key},Z.prototype.decrease=function(V,N){var E=this._keyIndices[V];if(N>this._arr[E].priority)throw new Error("New priority is greater than current priority. Key: "+V+" Old: "+this._arr[E].priority+" New: "+N);this._arr[E].priority=N,this._decrease(E)},Z.prototype._heapify=function(V){var N=this._arr,E=2*V,F=E+1,C=V;E<N.length&&(C=N[E].priority<N[C].priority?E:C,F<N.length&&(C=N[F].priority<N[C].priority?F:C),C!==V&&(this._swap(V,C),this._heapify(C)))},Z.prototype._decrease=function(V){for(var N=this._arr,E=N[V].priority,F;V!==0&&(F=V>>1,!(N[F].priority<E));)this._swap(V,F),V=F},Z.prototype._swap=function(V,N){var E=this._arr,F=this._keyIndices,C=E[V],P=E[N];E[V]=P,E[N]=C,F[P.key]=V,F[C.key]=N}},6349:function(Be,Me,b){"use strict";var m=b(95329);Be.exports=E;var Z="\0",V="\0",N="";function E(X){this._isDirected=m.has(X,"directed")?X.directed:!0,this._isMultigraph=m.has(X,"multigraph")?X.multigraph:!1,this._isCompound=m.has(X,"compound")?X.compound:!1,this._label=void 0,this._defaultNodeLabelFn=m.constant(void 0),this._defaultEdgeLabelFn=m.constant(void 0),this._nodes={},this._isCompound&&(this._parent={},this._children={},this._children[V]={}),this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={}}E.prototype._nodeCount=0,E.prototype._edgeCount=0,E.prototype.isDirected=function(){return this._isDirected},E.prototype.isMultigraph=function(){return this._isMultigraph},E.prototype.isCompound=function(){return this._isCompound},E.prototype.setGraph=function(X){return this._label=X,this},E.prototype.graph=function(){return this._label},E.prototype.setDefaultNodeLabel=function(X){return m.isFunction(X)||(X=m.constant(X)),this._defaultNodeLabelFn=X,this},E.prototype.nodeCount=function(){return this._nodeCount},E.prototype.nodes=function(){return m.keys(this._nodes)},E.prototype.sources=function(){var X=this;return m.filter(this.nodes(),function(j){return m.isEmpty(X._in[j])})},E.prototype.sinks=function(){var X=this;return m.filter(this.nodes(),function(j){return m.isEmpty(X._out[j])})},E.prototype.setNodes=function(X,j){var de=arguments,he=this;return m.each(X,function(we){de.length>1?he.setNode(we,j):he.setNode(we)}),this},E.prototype.setNode=function(X,j){return m.has(this._nodes,X)?(arguments.length>1&&(this._nodes[X]=j),this):(this._nodes[X]=arguments.length>1?j:this._defaultNodeLabelFn(X),this._isCompound&&(this._parent[X]=V,this._children[X]={},this._children[V][X]=!0),this._in[X]={},this._preds[X]={},this._out[X]={},this._sucs[X]={},++this._nodeCount,this)},E.prototype.node=function(X){return this._nodes[X]},E.prototype.hasNode=function(X){return m.has(this._nodes,X)},E.prototype.removeNode=function(X){var j=this;if(m.has(this._nodes,X)){var de=function(he){j.removeEdge(j._edgeObjs[he])};delete this._nodes[X],this._isCompound&&(this._removeFromParentsChildList(X),delete this._parent[X],m.each(this.children(X),function(he){j.setParent(he)}),delete this._children[X]),m.each(m.keys(this._in[X]),de),delete this._in[X],delete this._preds[X],m.each(m.keys(this._out[X]),de),delete this._out[X],delete this._sucs[X],--this._nodeCount}return this},E.prototype.setParent=function(X,j){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(m.isUndefined(j))j=V;else{j+="";for(var de=j;!m.isUndefined(de);de=this.parent(de))if(de===X)throw new Error("Setting "+j+" as parent of "+X+" would create a cycle");this.setNode(j)}return this.setNode(X),this._removeFromParentsChildList(X),this._parent[X]=j,this._children[j][X]=!0,this},E.prototype._removeFromParentsChildList=function(X){delete this._children[this._parent[X]][X]},E.prototype.parent=function(X){if(this._isCompound){var j=this._parent[X];if(j!==V)return j}},E.prototype.children=function(X){if(m.isUndefined(X)&&(X=V),this._isCompound){var j=this._children[X];if(j)return m.keys(j)}else{if(X===V)return this.nodes();if(this.hasNode(X))return[]}},E.prototype.predecessors=function(X){var j=this._preds[X];if(j)return m.keys(j)},E.prototype.successors=function(X){var j=this._sucs[X];if(j)return m.keys(j)},E.prototype.neighbors=function(X){var j=this.predecessors(X);if(j)return m.union(j,this.successors(X))},E.prototype.isLeaf=function(X){var j;return this.isDirected()?j=this.successors(X):j=this.neighbors(X),j.length===0},E.prototype.filterNodes=function(X){var j=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});j.setGraph(this.graph());var de=this;m.each(this._nodes,function(ve,Ee){X(Ee)&&j.setNode(Ee,ve)}),m.each(this._edgeObjs,function(ve){j.hasNode(ve.v)&&j.hasNode(ve.w)&&j.setEdge(ve,de.edge(ve))});var he={};function we(ve){var Ee=de.parent(ve);return Ee===void 0||j.hasNode(Ee)?(he[ve]=Ee,Ee):Ee in he?he[Ee]:we(Ee)}return this._isCompound&&m.each(j.nodes(),function(ve){j.setParent(ve,we(ve))}),j},E.prototype.setDefaultEdgeLabel=function(X){return m.isFunction(X)||(X=m.constant(X)),this._defaultEdgeLabelFn=X,this},E.prototype.edgeCount=function(){return this._edgeCount},E.prototype.edges=function(){return m.values(this._edgeObjs)},E.prototype.setPath=function(X,j){var de=this,he=arguments;return m.reduce(X,function(we,ve){return he.length>1?de.setEdge(we,ve,j):de.setEdge(we,ve),ve}),this},E.prototype.setEdge=function(){var X,j,de,he,we=!1,ve=arguments[0];typeof ve=="object"&&ve!==null&&"v"in ve?(X=ve.v,j=ve.w,de=ve.name,arguments.length===2&&(he=arguments[1],we=!0)):(X=ve,j=arguments[1],de=arguments[3],arguments.length>2&&(he=arguments[2],we=!0)),X=""+X,j=""+j,m.isUndefined(de)||(de=""+de);var Ee=P(this._isDirected,X,j,de);if(m.has(this._edgeLabels,Ee))return we&&(this._edgeLabels[Ee]=he),this;if(!m.isUndefined(de)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(X),this.setNode(j),this._edgeLabels[Ee]=we?he:this._defaultEdgeLabelFn(X,j,de);var $e=H(this._isDirected,X,j,de);return X=$e.v,j=$e.w,Object.freeze($e),this._edgeObjs[Ee]=$e,F(this._preds[j],X),F(this._sucs[X],j),this._in[j][Ee]=$e,this._out[X][Ee]=$e,this._edgeCount++,this},E.prototype.edge=function(X,j,de){var he=arguments.length===1?D(this._isDirected,arguments[0]):P(this._isDirected,X,j,de);return this._edgeLabels[he]},E.prototype.hasEdge=function(X,j,de){var he=arguments.length===1?D(this._isDirected,arguments[0]):P(this._isDirected,X,j,de);return m.has(this._edgeLabels,he)},E.prototype.removeEdge=function(X,j,de){var he=arguments.length===1?D(this._isDirected,arguments[0]):P(this._isDirected,X,j,de),we=this._edgeObjs[he];return we&&(X=we.v,j=we.w,delete this._edgeLabels[he],delete this._edgeObjs[he],C(this._preds[j],X),C(this._sucs[X],j),delete this._in[j][he],delete this._out[X][he],this._edgeCount--),this},E.prototype.inEdges=function(X,j){var de=this._in[X];if(de){var he=m.values(de);return j?m.filter(he,function(we){return we.v===j}):he}},E.prototype.outEdges=function(X,j){var de=this._out[X];if(de){var he=m.values(de);return j?m.filter(he,function(we){return we.w===j}):he}},E.prototype.nodeEdges=function(X,j){var de=this.inEdges(X,j);if(de)return de.concat(this.outEdges(X,j))};function F(X,j){X[j]?X[j]++:X[j]=1}function C(X,j){--X[j]||delete X[j]}function P(X,j,de,he){var we=""+j,ve=""+de;if(!X&&we>ve){var Ee=we;we=ve,ve=Ee}return we+N+ve+N+(m.isUndefined(he)?Z:he)}function H(X,j,de,he){var we=""+j,ve=""+de;if(!X&&we>ve){var Ee=we;we=ve,ve=Ee}var $e={v:we,w:ve};return he&&($e.name=he),$e}function D(X,j){return P(X,j.v,j.w,j.name)}},89224:function(Be,Me,b){Be.exports={Graph:b(6349),version:b(16544)}},17401:function(Be,Me,b){var m=b(95329),Z=b(6349);Be.exports={write:V,read:F};function V(C){var P={options:{directed:C.isDirected(),multigraph:C.isMultigraph(),compound:C.isCompound()},nodes:N(C),edges:E(C)};return m.isUndefined(C.graph())||(P.value=m.clone(C.graph())),P}function N(C){return m.map(C.nodes(),function(P){var H=C.node(P),D=C.parent(P),X={v:P};return m.isUndefined(H)||(X.value=H),m.isUndefined(D)||(X.parent=D),X})}function E(C){return m.map(C.edges(),function(P){var H=C.edge(P),D={v:P.v,w:P.w};return m.isUndefined(P.name)||(D.name=P.name),m.isUndefined(H)||(D.value=H),D})}function F(C){var P=new Z(C.options).setGraph(C.value);return m.each(C.nodes,function(H){P.setNode(H.v,H.value),H.parent&&P.setParent(H.v,H.parent)}),m.each(C.edges,function(H){P.setEdge({v:H.v,w:H.w,name:H.name},H.value)}),P}},95329:function(Be,Me,b){var m;try{m={clone:b(76833),constant:b(13503),each:b(76934),filter:b(64725),has:b(99946),isArray:b(80744),isEmpty:b(61627),isFunction:b(9363),isUndefined:b(16513),keys:b(55451),map:b(9924),reduce:b(16473),size:b(40617),transform:b(91116),union:b(44065),values:b(81229)}}catch(Z){}m||(m=window._),Be.exports=m},16544:function(Be){Be.exports="2.1.8"},64270:function(Be){(function(Me,b){Be.exports=b()})(this,function(){"use strict";var Me=function(U,R){return Me=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function($,K){$.__proto__=K}||function($,K){for(var _e in K)Object.prototype.hasOwnProperty.call(K,_e)&&($[_e]=K[_e])},Me(U,R)};function b(U,R){if(typeof R!="function"&&R!==null)throw new TypeError("Class extends value "+String(R)+" is not a constructor or null");Me(U,R);function $(){this.constructor=U}U.prototype=R===null?Object.create(R):($.prototype=R.prototype,new $)}var m=function(){return m=Object.assign||function(R){for(var $,K=1,_e=arguments.length;K<_e;K++){$=arguments[K];for(var et in $)Object.prototype.hasOwnProperty.call($,et)&&(R[et]=$[et])}return R},m.apply(this,arguments)};function Z(U,R,$,K){function _e(et){return et instanceof $?et:new $(function(Ft){Ft(et)})}return new($||($=Promise))(function(et,Ft){function dn(ur){try{Ar(K.next(ur))}catch(Ir){Ft(Ir)}}function fn(ur){try{Ar(K.throw(ur))}catch(Ir){Ft(Ir)}}function Ar(ur){ur.done?et(ur.value):_e(ur.value).then(dn,fn)}Ar((K=K.apply(U,R||[])).next())})}function V(U,R){var $={label:0,sent:function(){if(et[0]&1)throw et[1];return et[1]},trys:[],ops:[]},K,_e,et,Ft;return Ft={next:dn(0),throw:dn(1),return:dn(2)},typeof Symbol=="function"&&(Ft[Symbol.iterator]=function(){return this}),Ft;function dn(Ar){return function(ur){return fn([Ar,ur])}}function fn(Ar){if(K)throw new TypeError("Generator is already executing.");for(;$;)try{if(K=1,_e&&(et=Ar[0]&2?_e.return:Ar[0]?_e.throw||((et=_e.return)&&et.call(_e),0):_e.next)&&!(et=et.call(_e,Ar[1])).done)return et;switch(_e=0,et&&(Ar=[Ar[0]&2,et.value]),Ar[0]){case 0:case 1:et=Ar;break;case 4:return $.label++,{value:Ar[1],done:!1};case 5:$.label++,_e=Ar[1],Ar=[0];continue;case 7:Ar=$.ops.pop(),$.trys.pop();continue;default:if(et=$.trys,!(et=et.length>0&&et[et.length-1])&&(Ar[0]===6||Ar[0]===2)){$=0;continue}if(Ar[0]===3&&(!et||Ar[1]>et[0]&&Ar[1]<et[3])){$.label=Ar[1];break}if(Ar[0]===6&&$.label<et[1]){$.label=et[1],et=Ar;break}if(et&&$.label<et[2]){$.label=et[2],$.ops.push(Ar);break}et[2]&&$.ops.pop(),$.trys.pop();continue}Ar=R.call(U,$)}catch(ur){Ar=[6,ur],_e=0}finally{K=et=0}if(Ar[0]&5)throw Ar[1];return{value:Ar[0]?Ar[1]:void 0,done:!0}}}function N(U,R,$){if($||arguments.length===2)for(var K=0,_e=R.length,et;K<_e;K++)(et||!(K in R))&&(et||(et=Array.prototype.slice.call(R,0,K)),et[K]=R[K]);return U.concat(et||R)}for(var E=function(){function U(R,$,K,_e){this.left=R,this.top=$,this.width=K,this.height=_e}return U.prototype.add=function(R,$,K,_e){return new U(this.left+R,this.top+$,this.width+K,this.height+_e)},U.fromClientRect=function(R,$){return new U($.left+R.windowBounds.left,$.top+R.windowBounds.top,$.width,$.height)},U.fromDOMRectList=function(R,$){var K=Array.from($).find(function(_e){return _e.width!==0});return K?new U(K.left+R.windowBounds.left,K.top+R.windowBounds.top,K.width,K.height):U.EMPTY},U.EMPTY=new U(0,0,0,0),U}(),F=function(U,R){return E.fromClientRect(U,R.getBoundingClientRect())},C=function(U){var R=U.body,$=U.documentElement;if(!R||!$)throw new Error("Unable to get document size");var K=Math.max(Math.max(R.scrollWidth,$.scrollWidth),Math.max(R.offsetWidth,$.offsetWidth),Math.max(R.clientWidth,$.clientWidth)),_e=Math.max(Math.max(R.scrollHeight,$.scrollHeight),Math.max(R.offsetHeight,$.offsetHeight),Math.max(R.clientHeight,$.clientHeight));return new E(0,0,K,_e)},P=function(U){for(var R=[],$=0,K=U.length;$<K;){var _e=U.charCodeAt($++);if(_e>=55296&&_e<=56319&&$<K){var et=U.charCodeAt($++);(et&64512)===56320?R.push(((_e&1023)<<10)+(et&1023)+65536):(R.push(_e),$--)}else R.push(_e)}return R},H=function(){for(var U=[],R=0;R<arguments.length;R++)U[R]=arguments[R];if(String.fromCodePoint)return String.fromCodePoint.apply(String,U);var $=U.length;if(!$)return"";for(var K=[],_e=-1,et="";++_e<$;){var Ft=U[_e];Ft<=65535?K.push(Ft):(Ft-=65536,K.push((Ft>>10)+55296,Ft%1024+56320)),(_e+1===$||K.length>16384)&&(et+=String.fromCharCode.apply(String,K),K.length=0)}return et},D="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",X=typeof Uint8Array=="undefined"?[]:new Uint8Array(256),j=0;j<D.length;j++)X[D.charCodeAt(j)]=j;for(var de="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",he=typeof Uint8Array=="undefined"?[]:new Uint8Array(256),we=0;we<de.length;we++)he[de.charCodeAt(we)]=we;for(var ve=function(U){var R=U.length*.75,$=U.length,K,_e=0,et,Ft,dn,fn;U[U.length-1]==="="&&(R--,U[U.length-2]==="="&&R--);var Ar=typeof ArrayBuffer!="undefined"&&typeof Uint8Array!="undefined"&&typeof Uint8Array.prototype.slice!="undefined"?new ArrayBuffer(R):new Array(R),ur=Array.isArray(Ar)?Ar:new Uint8Array(Ar);for(K=0;K<$;K+=4)et=he[U.charCodeAt(K)],Ft=he[U.charCodeAt(K+1)],dn=he[U.charCodeAt(K+2)],fn=he[U.charCodeAt(K+3)],ur[_e++]=et<<2|Ft>>4,ur[_e++]=(Ft&15)<<4|dn>>2,ur[_e++]=(dn&3)<<6|fn&63;return Ar},Ee=function(U){for(var R=U.length,$=[],K=0;K<R;K+=2)$.push(U[K+1]<<8|U[K]);return $},$e=function(U){for(var R=U.length,$=[],K=0;K<R;K+=4)$.push(U[K+3]<<24|U[K+2]<<16|U[K+1]<<8|U[K]);return $},Fe=5,ct=11,vt=2,at=ct-Fe,kt=65536>>Fe,It=1<<Fe,Bn=It-1,Lt=1024>>Fe,Wn=kt+Lt,Xn=Wn,In=32,zn=Xn+In,dr=65536>>ct,vn=1<<at,_r=vn-1,Ge=function(U,R,$){return U.slice?U.slice(R,$):new Uint16Array(Array.prototype.slice.call(U,R,$))},Tt=function(U,R,$){return U.slice?U.slice(R,$):new Uint32Array(Array.prototype.slice.call(U,R,$))},On=function(U,R){var $=ve(U),K=Array.isArray($)?$e($):new Uint32Array($),_e=Array.isArray($)?Ee($):new Uint16Array($),et=24,Ft=Ge(_e,et/2,K[4]/2),dn=K[5]===2?Ge(_e,(et+K[4])/2):Tt(K,Math.ceil((et+K[4])/4));return new Vr(K[0],K[1],K[2],K[3],Ft,dn)},Vr=function(){function U(R,$,K,_e,et,Ft){this.initialValue=R,this.errorValue=$,this.highStart=K,this.highValueIndex=_e,this.index=et,this.data=Ft}return U.prototype.get=function(R){var $;if(R>=0){if(R<55296||R>56319&&R<=65535)return $=this.index[R>>Fe],$=($<<vt)+(R&Bn),this.data[$];if(R<=65535)return $=this.index[kt+(R-55296>>Fe)],$=($<<vt)+(R&Bn),this.data[$];if(R<this.highStart)return $=zn-dr+(R>>ct),$=this.index[$],$+=R>>Fe&_r,$=this.index[$],$=($<<vt)+(R&Bn),this.data[$];if(R<=1114111)return this.data[this.highValueIndex]}return this.errorValue},U}(),en="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",ln=typeof Uint8Array=="undefined"?[]:new Uint8Array(256),Cn=0;Cn<en.length;Cn++)ln[en.charCodeAt(Cn)]=Cn;var Mt="KwAAAAAAAAAACA4AUD0AADAgAAACAAAAAAAIABAAGABAAEgAUABYAGAAaABgAGgAYgBqAF8AZwBgAGgAcQB5AHUAfQCFAI0AlQCdAKIAqgCyALoAYABoAGAAaABgAGgAwgDKAGAAaADGAM4A0wDbAOEA6QDxAPkAAQEJAQ8BFwF1AH0AHAEkASwBNAE6AUIBQQFJAVEBWQFhAWgBcAF4ATAAgAGGAY4BlQGXAZ8BpwGvAbUBvQHFAc0B0wHbAeMB6wHxAfkBAQIJAvEBEQIZAiECKQIxAjgCQAJGAk4CVgJeAmQCbAJ0AnwCgQKJApECmQKgAqgCsAK4ArwCxAIwAMwC0wLbAjAA4wLrAvMC+AIAAwcDDwMwABcDHQMlAy0DNQN1AD0DQQNJA0kDSQNRA1EDVwNZA1kDdQB1AGEDdQBpA20DdQN1AHsDdQCBA4kDkQN1AHUAmQOhA3UAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AKYDrgN1AHUAtgO+A8YDzgPWAxcD3gPjA+sD8wN1AHUA+wMDBAkEdQANBBUEHQQlBCoEFwMyBDgEYABABBcDSARQBFgEYARoBDAAcAQzAXgEgASIBJAEdQCXBHUAnwSnBK4EtgS6BMIEyAR1AHUAdQB1AHUAdQCVANAEYABgAGAAYABgAGAAYABgANgEYADcBOQEYADsBPQE/AQEBQwFFAUcBSQFLAU0BWQEPAVEBUsFUwVbBWAAYgVgAGoFcgV6BYIFigWRBWAAmQWfBaYFYABgAGAAYABgAKoFYACxBbAFuQW6BcEFwQXHBcEFwQXPBdMF2wXjBeoF8gX6BQIGCgYSBhoGIgYqBjIGOgZgAD4GRgZMBmAAUwZaBmAAYABgAGAAYABgAGAAYABgAGAAYABgAGIGYABpBnAGYABgAGAAYABgAGAAYABgAGAAYAB4Bn8GhQZgAGAAYAB1AHcDFQSLBmAAYABgAJMGdQA9A3UAmwajBqsGqwaVALMGuwbDBjAAywbSBtIG1QbSBtIG0gbSBtIG0gbdBuMG6wbzBvsGAwcLBxMHAwcbByMHJwcsBywHMQcsB9IGOAdAB0gHTgfSBkgHVgfSBtIG0gbSBtIG0gbSBtIG0gbSBiwHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAdgAGAALAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAdbB2MHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsB2kH0gZwB64EdQB1AHUAdQB1AHUAdQB1AHUHfQdgAIUHjQd1AHUAlQedB2AAYAClB6sHYACzB7YHvgfGB3UAzgfWBzMB3gfmB1EB7gf1B/0HlQENAQUIDQh1ABUIHQglCBcDLQg1CD0IRQhNCEEDUwh1AHUAdQBbCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIcAh3CHoIMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwAIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIgggwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAALAcsBywHLAcsBywHLAcsBywHLAcsB4oILAcsB44I0gaWCJ4Ipgh1AHUAqgiyCHUAdQB1AHUAdQB1AHUAdQB1AHUAtwh8AXUAvwh1AMUIyQjRCNkI4AjoCHUAdQB1AO4I9gj+CAYJDgkTCS0HGwkjCYIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiAAIAAAAFAAYABgAGIAXwBgAHEAdQBFAJUAogCyAKAAYABgAEIA4ABGANMA4QDxAMEBDwE1AFwBLAE6AQEBUQF4QkhCmEKoQrhCgAHIQsAB0MLAAcABwAHAAeDC6ABoAHDCwMMAAcABwAHAAdDDGMMAAcAB6MM4wwjDWMNow3jDaABoAGgAaABoAGgAaABoAGgAaABoAGgAaABoAGgAaABoAGgAaABoAEjDqABWw6bDqABpg6gAaABoAHcDvwOPA+gAaABfA/8DvwO/A78DvwO/A78DvwO/A78DvwO/A78DvwO/A78DvwO/A78DvwO/A78DvwO/A78DvwO/A78DpcPAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcAB9cPKwkyCToJMAB1AHUAdQBCCUoJTQl1AFUJXAljCWcJawkwADAAMAAwAHMJdQB2CX4JdQCECYoJjgmWCXUAngkwAGAAYABxAHUApgn3A64JtAl1ALkJdQDACTAAMAAwADAAdQB1AHUAdQB1AHUAdQB1AHUAowYNBMUIMAAwADAAMADICcsJ0wnZCRUE4QkwAOkJ8An4CTAAMAB1AAAKvwh1AAgKDwoXCh8KdQAwACcKLgp1ADYKqAmICT4KRgowADAAdQB1AE4KMAB1AFYKdQBeCnUAZQowADAAMAAwADAAMAAwADAAMAAVBHUAbQowADAAdQC5CXUKMAAwAHwBxAijBogEMgF9CoQKiASMCpQKmgqIBKIKqgquCogEDQG2Cr4KxgrLCjAAMADTCtsKCgHjCusK8Qr5CgELMAAwADAAMAB1AIsECQsRC3UANAEZCzAAMAAwADAAMAB1ACELKQswAHUANAExCzkLdQBBC0kLMABRC1kLMAAwADAAMAAwADAAdQBhCzAAMAAwAGAAYABpC3ELdwt/CzAAMACHC4sLkwubC58Lpwt1AK4Ltgt1APsDMAAwADAAMAAwADAAMAAwAL4LwwvLC9IL1wvdCzAAMADlC+kL8Qv5C/8LSQswADAAMAAwADAAMAAwADAAMAAHDDAAMAAwADAAMAAODBYMHgx1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1ACYMMAAwADAAdQB1AHUALgx1AHUAdQB1AHUAdQA2DDAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwAHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AD4MdQBGDHUAdQB1AHUAdQB1AEkMdQB1AHUAdQB1AFAMMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwAHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQBYDHUAdQB1AF8MMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUA+wMVBGcMMAAwAHwBbwx1AHcMfwyHDI8MMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAYABgAJcMMAAwADAAdQB1AJ8MlQClDDAAMACtDCwHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsB7UMLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AA0EMAC9DDAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAsBywHLAcsBywHLAcsBywHLQcwAMEMyAwsBywHLAcsBywHLAcsBywHLAcsBywHzAwwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwAHUAdQB1ANQM2QzhDDAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMABgAGAAYABgAGAAYABgAOkMYADxDGAA+AwADQYNYABhCWAAYAAODTAAMAAwADAAFg1gAGAAHg37AzAAMAAwADAAYABgACYNYAAsDTQNPA1gAEMNPg1LDWAAYABgAGAAYABgAGAAYABgAGAAUg1aDYsGVglhDV0NcQBnDW0NdQ15DWAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAlQCBDZUAiA2PDZcNMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAnw2nDTAAMAAwADAAMAAwAHUArw23DTAAMAAwADAAMAAwADAAMAAwADAAMAB1AL8NMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAB1AHUAdQB1AHUAdQDHDTAAYABgAM8NMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAA1w11ANwNMAAwAD0B5A0wADAAMAAwADAAMADsDfQN/A0EDgwOFA4wABsOMAAwADAAMAAwADAAMAAwANIG0gbSBtIG0gbSBtIG0gYjDigOwQUuDsEFMw7SBjoO0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIGQg5KDlIOVg7SBtIGXg5lDm0OdQ7SBtIGfQ6EDooOjQ6UDtIGmg6hDtIG0gaoDqwO0ga0DrwO0gZgAGAAYADEDmAAYAAkBtIGzA5gANIOYADaDokO0gbSBt8O5w7SBu8O0gb1DvwO0gZgAGAAxA7SBtIG0gbSBtIGYABgAGAAYAAED2AAsAUMD9IG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIGFA8sBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAccD9IGLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHJA8sBywHLAcsBywHLAccDywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywPLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAc0D9IG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIGLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAccD9IG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIGFA8sBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHPA/SBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gYUD0QPlQCVAJUAMAAwADAAMACVAJUAlQCVAJUAlQCVAEwPMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAA//8EAAQABAAEAAQABAAEAAQABAANAAMAAQABAAIABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQACgATABcAHgAbABoAHgAXABYAEgAeABsAGAAPABgAHABLAEsASwBLAEsASwBLAEsASwBLABgAGAAeAB4AHgATAB4AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQABYAGwASAB4AHgAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAWAA0AEQAeAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAAQABAAEAAQABAAFAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAJABYAGgAbABsAGwAeAB0AHQAeAE8AFwAeAA0AHgAeABoAGwBPAE8ADgBQAB0AHQAdAE8ATwAXAE8ATwBPABYAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAFAAUABQAFAAUABQAFAAUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAFAAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAeAB4AHgAeAFAATwBAAE8ATwBPAEAATwBQAFAATwBQAB4AHgAeAB4AHgAeAB0AHQAdAB0AHgAdAB4ADgBQAFAAUABQAFAAHgAeAB4AHgAeAB4AHgBQAB4AUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4ABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAJAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAkACQAJAAkACQAJAAkABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAeAB4AHgAeAFAAHgAeAB4AKwArAFAAUABQAFAAGABQACsAKwArACsAHgAeAFAAHgBQAFAAUAArAFAAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4ABAAEAAQABAAEAAQABAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAUAAeAB4AHgAeAB4AHgBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAYAA0AKwArAB4AHgAbACsABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQADQAEAB4ABAAEAB4ABAAEABMABAArACsAKwArACsAKwArACsAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAKwArACsAKwBWAFYAVgBWAB4AHgArACsAKwArACsAKwArACsAKwArACsAHgAeAB4AHgAeAB4AHgAeAB4AGgAaABoAGAAYAB4AHgAEAAQABAAEAAQABAAEAAQABAAEAAQAEwAEACsAEwATAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABABLAEsASwBLAEsASwBLAEsASwBLABoAGQAZAB4AUABQAAQAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQABMAUAAEAAQABAAEAAQABAAEAB4AHgAEAAQABAAEAAQABABQAFAABAAEAB4ABAAEAAQABABQAFAASwBLAEsASwBLAEsASwBLAEsASwBQAFAAUAAeAB4AUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwAeAFAABABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAFAAKwArACsAKwArACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQAUABQAB4AHgAYABMAUAArACsABAAbABsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAFAABAAEAAQABAAEAFAABAAEAAQAUAAEAAQABAAEAAQAKwArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAArACsAHgArAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwArACsAKwArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAB4ABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAUAAEAAQABAAEAAQABAAEAFAAUABQAFAAUABQAFAAUABQAFAABAAEAA0ADQBLAEsASwBLAEsASwBLAEsASwBLAB4AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAArAFAAUABQAFAAUABQAFAAUAArACsAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUAArACsAKwBQAFAAUABQACsAKwAEAFAABAAEAAQABAAEAAQABAArACsABAAEACsAKwAEAAQABABQACsAKwArACsAKwArACsAKwAEACsAKwArACsAUABQACsAUABQAFAABAAEACsAKwBLAEsASwBLAEsASwBLAEsASwBLAFAAUAAaABoAUABQAFAAUABQAEwAHgAbAFAAHgAEACsAKwAEAAQABAArAFAAUABQAFAAUABQACsAKwArACsAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUABQACsAUABQACsAUABQACsAKwAEACsABAAEAAQABAAEACsAKwArACsABAAEACsAKwAEAAQABAArACsAKwAEACsAKwArACsAKwArACsAUABQAFAAUAArAFAAKwArACsAKwArACsAKwBLAEsASwBLAEsASwBLAEsASwBLAAQABABQAFAAUAAEAB4AKwArACsAKwArACsAKwArACsAKwAEAAQABAArAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUABQACsAUABQAFAAUABQACsAKwAEAFAABAAEAAQABAAEAAQABAAEACsABAAEAAQAKwAEAAQABAArACsAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAABAAEACsAKwBLAEsASwBLAEsASwBLAEsASwBLAB4AGwArACsAKwArACsAKwArAFAABAAEAAQABAAEAAQAKwAEAAQABAArAFAAUABQAFAAUABQAFAAUAArACsAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAArACsABAAEACsAKwAEAAQABAArACsAKwArACsAKwArAAQABAAEACsAKwArACsAUABQACsAUABQAFAABAAEACsAKwBLAEsASwBLAEsASwBLAEsASwBLAB4AUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArAAQAUAArAFAAUABQAFAAUABQACsAKwArAFAAUABQACsAUABQAFAAUAArACsAKwBQAFAAKwBQACsAUABQACsAKwArAFAAUAArACsAKwBQAFAAUAArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArAAQABAAEAAQABAArACsAKwAEAAQABAArAAQABAAEAAQAKwArAFAAKwArACsAKwArACsABAArACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAUABQAFAAHgAeAB4AHgAeAB4AGwAeACsAKwArACsAKwAEAAQABAAEAAQAUABQAFAAUABQAFAAUABQACsAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAUAAEAAQABAAEAAQABAAEACsABAAEAAQAKwAEAAQABAAEACsAKwArACsAKwArACsABAAEACsAUABQAFAAKwArACsAKwArAFAAUAAEAAQAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAKwAOAFAAUABQAFAAUABQAFAAHgBQAAQABAAEAA4AUABQAFAAUABQAFAAUABQACsAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAKwArAAQAUAAEAAQABAAEAAQABAAEACsABAAEAAQAKwAEAAQABAAEACsAKwArACsAKwArACsABAAEACsAKwArACsAKwArACsAUAArAFAAUAAEAAQAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwBQAFAAKwArACsAKwArACsAKwArACsAKwArACsAKwAEAAQABAAEAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAFAABAAEAAQABAAEAAQABAArAAQABAAEACsABAAEAAQABABQAB4AKwArACsAKwBQAFAAUAAEAFAAUABQAFAAUABQAFAAUABQAFAABAAEACsAKwBLAEsASwBLAEsASwBLAEsASwBLAFAAUABQAFAAUABQAFAAUABQABoAUABQAFAAUABQAFAAKwAEAAQABAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQACsAUAArACsAUABQAFAAUABQAFAAUAArACsAKwAEACsAKwArACsABAAEAAQABAAEAAQAKwAEACsABAAEAAQABAAEAAQABAAEACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArAAQABAAeACsAKwArACsAKwArACsAKwArACsAKwArAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXAAqAFwAXAAqACoAKgAqACoAKgAqACsAKwArACsAGwBcAFwAXABcAFwAXABcACoAKgAqACoAKgAqACoAKgAeAEsASwBLAEsASwBLAEsASwBLAEsADQANACsAKwArACsAKwBcAFwAKwBcACsAXABcAFwAXABcACsAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcACsAXAArAFwAXABcAFwAXABcAFwAXABcAFwAKgBcAFwAKgAqACoAKgAqACoAKgAqACoAXAArACsAXABcAFwAXABcACsAXAArACoAKgAqACoAKgAqACsAKwBLAEsASwBLAEsASwBLAEsASwBLACsAKwBcAFwAXABcAFAADgAOAA4ADgAeAA4ADgAJAA4ADgANAAkAEwATABMAEwATAAkAHgATAB4AHgAeAAQABAAeAB4AHgAeAB4AHgBLAEsASwBLAEsASwBLAEsASwBLAFAAUABQAFAAUABQAFAAUABQAFAADQAEAB4ABAAeAAQAFgARABYAEQAEAAQAUABQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQADQAEAAQABAAEAAQADQAEAAQAUABQAFAAUABQAAQABAAEAAQABAAEAAQABAAEAAQABAArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAArAA0ADQAeAB4AHgAeAB4AHgAEAB4AHgAeAB4AHgAeACsAHgAeAA4ADgANAA4AHgAeAB4AHgAeAAkACQArACsAKwArACsAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgBcAEsASwBLAEsASwBLAEsASwBLAEsADQANAB4AHgAeAB4AXABcAFwAXABcAFwAKgAqACoAKgBcAFwAXABcACoAKgAqAFwAKgAqACoAXABcACoAKgAqACoAKgAqACoAXABcAFwAKgAqACoAKgBcAFwAXABcAFwAXABcAFwAXABcAFwAXABcACoAKgAqACoAKgAqACoAKgAqACoAKgAqAFwAKgBLAEsASwBLAEsASwBLAEsASwBLACoAKgAqACoAKgAqAFAAUABQAFAAUABQACsAUAArACsAKwArACsAUAArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgBQAFAAUABQAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAUAArACsAUABQAFAAUABQAFAAUAArAFAAKwBQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAKwArAFAAUABQAFAAUABQAFAAKwBQACsAUABQAFAAUAArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsABAAEAAQAHgANAB4AHgAeAB4AHgAeAB4AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUAArACsADQBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAANAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAWABEAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAA0ADQANAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAAQABAAEACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAANAA0AKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUAArAAQABAArACsAKwArACsAKwArACsAKwArACsAKwBcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqAA0ADQAVAFwADQAeAA0AGwBcACoAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwAeAB4AEwATAA0ADQAOAB4AEwATAB4ABAAEAAQACQArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAFAAUABQAFAAUAAEAAQAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQAUAArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAArACsAKwArAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwArACsAHgArACsAKwATABMASwBLAEsASwBLAEsASwBLAEsASwBcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXAArACsAXABcAFwAXABcACsAKwArACsAKwArACsAKwArACsAKwBcAFwAXABcAFwAXABcAFwAXABcAFwAXAArACsAKwArAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAXAArACsAKwAqACoAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAArACsAHgAeAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcACoAKgAqACoAKgAqACoAKgAqACoAKwAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKwArAAQASwBLAEsASwBLAEsASwBLAEsASwArACsAKwArACsAKwBLAEsASwBLAEsASwBLAEsASwBLACsAKwArACsAKwArACoAKgAqACoAKgAqACoAXAAqACoAKgAqACoAKgArACsABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsABAAEAAQABAAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABABQAFAAUABQAFAAUABQACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwANAA0AHgANAA0ADQANAB4AHgAeAB4AHgAeAB4AHgAeAB4ABAAEAAQABAAEAAQABAAEAAQAHgAeAB4AHgAeAB4AHgAeAB4AKwArACsABAAEAAQAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABABQAFAASwBLAEsASwBLAEsASwBLAEsASwBQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwArACsAKwArACsAKwAeAB4AHgAeAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwArAA0ADQANAA0ADQBLAEsASwBLAEsASwBLAEsASwBLACsAKwArAFAAUABQAEsASwBLAEsASwBLAEsASwBLAEsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAA0ADQBQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUAAeAB4AHgAeAB4AHgAeAB4AKwArACsAKwArACsAKwArAAQABAAEAB4ABAAEAAQABAAEAAQABAAEAAQABAAEAAQABABQAFAAUABQAAQAUABQAFAAUABQAFAABABQAFAABAAEAAQAUAArACsAKwArACsABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsABAAEAAQABAAEAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwArAFAAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAKwBQACsAUAArAFAAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACsAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArAB4AHgAeAB4AHgAeAB4AHgBQAB4AHgAeAFAAUABQACsAHgAeAB4AHgAeAB4AHgAeAB4AHgBQAFAAUABQACsAKwAeAB4AHgAeAB4AHgArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwArAFAAUABQACsAHgAeAB4AHgAeAB4AHgAOAB4AKwANAA0ADQANAA0ADQANAAkADQANAA0ACAAEAAsABAAEAA0ACQANAA0ADAAdAB0AHgAXABcAFgAXABcAFwAWABcAHQAdAB4AHgAUABQAFAANAAEAAQAEAAQABAAEAAQACQAaABoAGgAaABoAGgAaABoAHgAXABcAHQAVABUAHgAeAB4AHgAeAB4AGAAWABEAFQAVABUAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4ADQAeAA0ADQANAA0AHgANAA0ADQAHAB4AHgAeAB4AKwAEAAQABAAEAAQABAAEAAQABAAEAFAAUAArACsATwBQAFAAUABQAFAAHgAeAB4AFgARAE8AUABPAE8ATwBPAFAAUABQAFAAUAAeAB4AHgAWABEAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArABsAGwAbABsAGwAbABsAGgAbABsAGwAbABsAGwAbABsAGwAbABsAGwAbABsAGgAbABsAGwAbABoAGwAbABoAGwAbABsAGwAbABsAGwAbABsAGwAbABsAGwAbABsAGwAbAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAHgAeAFAAGgAeAB0AHgBQAB4AGgAeAB4AHgAeAB4AHgAeAB4AHgBPAB4AUAAbAB4AHgBQAFAAUABQAFAAHgAeAB4AHQAdAB4AUAAeAFAAHgBQAB4AUABPAFAAUAAeAB4AHgAeAB4AHgAeAFAAUABQAFAAUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAFAAHgBQAFAAUABQAE8ATwBQAFAAUABQAFAATwBQAFAATwBQAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAFAAUABQAFAATwBPAE8ATwBPAE8ATwBPAE8ATwBQAFAAUABQAFAAUABQAFAAUAAeAB4AUABQAFAAUABPAB4AHgArACsAKwArAB0AHQAdAB0AHQAdAB0AHQAdAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB0AHgAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB4AHQAdAB4AHgAeAB0AHQAeAB4AHQAeAB4AHgAdAB4AHQAbABsAHgAdAB4AHgAeAB4AHQAeAB4AHQAdAB0AHQAeAB4AHQAeAB0AHgAdAB0AHQAdAB0AHQAeAB0AHgAeAB4AHgAeAB0AHQAdAB0AHgAeAB4AHgAdAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB4AHgAeAB0AHgAeAB4AHgAeAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB0AHgAeAB0AHQAdAB0AHgAeAB0AHQAeAB4AHQAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB0AHQAeAB4AHQAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHQAeAB4AHgAdAB4AHgAeAB4AHgAeAB4AHQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AFAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeABYAEQAWABEAHgAeAB4AHgAeAB4AHQAeAB4AHgAeAB4AHgAeACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAWABEAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AJQAlACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAFAAHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHgAeAB4AHgAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAeAB4AHQAdAB0AHQAeAB4AHgAeAB4AHgAeAB4AHgAeAB0AHQAeAB0AHQAdAB0AHQAdAB0AHgAeAB4AHgAeAB4AHgAeAB0AHQAeAB4AHQAdAB4AHgAeAB4AHQAdAB4AHgAeAB4AHQAdAB0AHgAeAB0AHgAeAB0AHQAdAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB0AHQAdAB4AHgAeAB4AHgAeAB4AHgAeAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAlACUAJQAlAB4AHQAdAB4AHgAdAB4AHgAeAB4AHQAdAB4AHgAeAB4AJQAlAB0AHQAlAB4AJQAlACUAIAAlACUAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAlACUAJQAeAB4AHgAeAB0AHgAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB0AHgAdAB0AHQAeAB0AJQAdAB0AHgAdAB0AHgAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACUAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHQAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAlACUAJQAlACUAJQAlACUAJQAlACUAJQAdAB0AHQAdACUAHgAlACUAJQAdACUAJQAdAB0AHQAlACUAHQAdACUAHQAdACUAJQAlAB4AHQAeAB4AHgAeAB0AHQAlAB0AHQAdAB0AHQAdACUAJQAlACUAJQAdACUAJQAgACUAHQAdACUAJQAlACUAJQAlACUAJQAeAB4AHgAlACUAIAAgACAAIAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB0AHgAeAB4AFwAXABcAFwAXABcAHgATABMAJQAeAB4AHgAWABEAFgARABYAEQAWABEAFgARABYAEQAWABEATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeABYAEQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAWABEAFgARABYAEQAWABEAFgARAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AFgARABYAEQAWABEAFgARABYAEQAWABEAFgARABYAEQAWABEAFgARABYAEQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAWABEAFgARAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AFgARAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB0AHQAdAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AUABQAFAAUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAEAAQABAAeAB4AKwArACsAKwArABMADQANAA0AUAATAA0AUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAUAANACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXAA0ADQANAA0ADQANAA0ADQAeAA0AFgANAB4AHgAXABcAHgAeABcAFwAWABEAFgARABYAEQAWABEADQANAA0ADQATAFAADQANAB4ADQANAB4AHgAeAB4AHgAMAAwADQANAA0AHgANAA0AFgANAA0ADQANAA0ADQANAA0AHgANAB4ADQANAB4AHgAeACsAKwArACsAKwArACsAKwArACsAKwArACsAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACsAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAKwArACsAKwArACsAKwArACsAKwArACsAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAlACUAJQAlACUAJQAlACUAJQAlACUAJQArACsAKwArAA0AEQARACUAJQBHAFcAVwAWABEAFgARABYAEQAWABEAFgARACUAJQAWABEAFgARABYAEQAWABEAFQAWABEAEQAlAFcAVwBXAFcAVwBXAFcAVwBXAAQABAAEAAQABAAEACUAVwBXAFcAVwA2ACUAJQBXAFcAVwBHAEcAJQAlACUAKwBRAFcAUQBXAFEAVwBRAFcAUQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFEAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBRAFcAUQBXAFEAVwBXAFcAVwBXAFcAUQBXAFcAVwBXAFcAVwBRAFEAKwArAAQABAAVABUARwBHAFcAFQBRAFcAUQBXAFEAVwBRAFcAUQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFEAVwBRAFcAUQBXAFcAVwBXAFcAVwBRAFcAVwBXAFcAVwBXAFEAUQBXAFcAVwBXABUAUQBHAEcAVwArACsAKwArACsAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAKwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAKwAlACUAVwBXAFcAVwAlACUAJQAlACUAJQAlACUAJQAlACsAKwArACsAKwArACsAKwArACsAKwArAFEAUQBRAFEAUQBRAFEAUQBRAFEAUQBRAFEAUQBRAFEAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQArAFcAVwBXAFcAVwBXAFcAVwBXAFcAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQBPAE8ATwBPAE8ATwBPAE8AJQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACUAJQAlAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAEcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAKwArACsAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAADQATAA0AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABLAEsASwBLAEsASwBLAEsASwBLAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAFAABAAEAAQABAAeAAQABAAEAAQABAAEAAQABAAEAAQAHgBQAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AUABQAAQABABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAeAA0ADQANAA0ADQArACsAKwArACsAKwArACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAFAAUABQAFAAUABQAFAAUABQAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgBQAB4AHgAeAB4AHgAeAFAAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAHgAeAB4AHgAeAB4AHgAeAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAeAB4AUABQAFAAUABQAFAAUABQAFAAUABQAAQAUABQAFAABABQAFAAUABQAAQAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAAeAB4AHgAeAAQAKwArACsAUABQAFAAUABQAFAAHgAeABoAHgArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAADgAOABMAEwArACsAKwArACsAKwArACsABAAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAAEACsAKwArACsAKwArACsAKwANAA0ASwBLAEsASwBLAEsASwBLAEsASwArACsAKwArACsAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABABQAFAAUABQAFAAUAAeAB4AHgBQAA4AUABQAAQAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAA0ADQBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAKwArACsAKwArACsAKwArACsAKwArAB4AWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYACsAKwArAAQAHgAeAB4AHgAeAB4ADQANAA0AHgAeAB4AHgArAFAASwBLAEsASwBLAEsASwBLAEsASwArACsAKwArAB4AHgBcAFwAXABcAFwAKgBcAFwAXABcAFwAXABcAFwAXABcAEsASwBLAEsASwBLAEsASwBLAEsAXABcAFwAXABcACsAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwArACsAKwArACsAKwArAFAAUABQAAQAUABQAFAAUABQAFAAUABQAAQABAArACsASwBLAEsASwBLAEsASwBLAEsASwArACsAHgANAA0ADQBcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAKgAqACoAXAAqACoAKgBcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXAAqAFwAKgAqACoAXABcACoAKgBcAFwAXABcAFwAKgAqAFwAKgBcACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFwAXABcACoAKgBQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAA0ADQBQAFAAUAAEAAQAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUAArACsAUABQAFAAUABQAFAAKwArAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgAeACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQADQAEAAQAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAVABVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBUAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVACsAKwArACsAKwArACsAKwArACsAKwArAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAKwArACsAKwBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAKwArACsAKwAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACUAJQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAJQAlACUAJQAlACUAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAKwArACsAKwArAFYABABWAFYAVgBWAFYAVgBWAFYAVgBWAB4AVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgArAFYAVgBWAFYAVgArAFYAKwBWAFYAKwBWAFYAKwBWAFYAVgBWAFYAVgBWAFYAVgBWAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAEQAWAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUAAaAB4AKwArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAGAARABEAGAAYABMAEwAWABEAFAArACsAKwArACsAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACUAJQAlACUAJQAWABEAFgARABYAEQAWABEAFgARABYAEQAlACUAFgARACUAJQAlACUAJQAlACUAEQAlABEAKwAVABUAEwATACUAFgARABYAEQAWABEAJQAlACUAJQAlACUAJQAlACsAJQAbABoAJQArACsAKwArAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAAcAKwATACUAJQAbABoAJQAlABYAEQAlACUAEQAlABEAJQBXAFcAVwBXAFcAVwBXAFcAVwBXABUAFQAlACUAJQATACUAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXABYAJQARACUAJQAlAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwAWACUAEQAlABYAEQARABYAEQARABUAVwBRAFEAUQBRAFEAUQBRAFEAUQBRAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAEcARwArACsAVwBXAFcAVwBXAFcAKwArAFcAVwBXAFcAVwBXACsAKwBXAFcAVwBXAFcAVwArACsAVwBXAFcAKwArACsAGgAbACUAJQAlABsAGwArAB4AHgAeAB4AHgAeAB4AKwArACsAKwArACsAKwArACsAKwAEAAQABAAQAB0AKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsADQANAA0AKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArAB4AHgAeAB4AHgAeAB4AHgAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgBQAFAAHgAeAB4AKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAAQAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAA0AUABQAFAAUAArACsAKwArAFAAUABQAFAAUABQAFAAUAANAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwAeACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAKwArAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUAArACsAKwBQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwANAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAeAB4AUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUAArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArAA0AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAUABQAFAAUABQAAQABAAEACsABAAEACsAKwArACsAKwAEAAQABAAEAFAAUABQAFAAKwBQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAAQABAAEACsAKwArACsABABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAA0ADQANAA0ADQANAA0ADQAeACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAeAFAAUABQAFAAUABQAFAAUAAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAArACsAKwArAFAAUABQAFAAUAANAA0ADQANAA0ADQAUACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsADQANAA0ADQANAA0ADQBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAB4AHgAeAB4AKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAFAAUABQAFAAUABQAAQABAAEAAQAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUAArAAQABAANACsAKwBQAFAAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAAQABAAEAAQABAAEAAQABAAEAAQABABQAFAAUABQAB4AHgAeAB4AHgArACsAKwArACsAKwAEAAQABAAEAAQABAAEAA0ADQAeAB4AHgAeAB4AKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsABABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAAEAAQABAAEAAQABAAeAB4AHgANAA0ADQANACsAKwArACsAKwArACsAKwArACsAKwAeACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwBLAEsASwBLAEsASwBLAEsASwBLACsAKwArACsAKwArAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsASwBLAEsASwBLAEsASwBLAEsASwANAA0ADQANAFAABAAEAFAAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAeAA4AUAArACsAKwArACsAKwArACsAKwAEAFAAUABQAFAADQANAB4ADQAEAAQABAAEAB4ABAAEAEsASwBLAEsASwBLAEsASwBLAEsAUAAOAFAADQANAA0AKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAANAA0AHgANAA0AHgAEACsAUABQAFAAUABQAFAAUAArAFAAKwBQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAA0AKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsABAAEAAQABAArAFAAUABQAFAAUABQAFAAUAArACsAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUABQACsAUABQAFAAUABQACsABAAEAFAABAAEAAQABAAEAAQABAArACsABAAEACsAKwAEAAQABAArACsAUAArACsAKwArACsAKwAEACsAKwArACsAKwBQAFAAUABQAFAABAAEACsAKwAEAAQABAAEAAQABAAEACsAKwArAAQABAAEAAQABAArACsAKwArACsAKwArACsAKwArACsABAAEAAQABAAEAAQABABQAFAAUABQAA0ADQANAA0AHgBLAEsASwBLAEsASwBLAEsASwBLAA0ADQArAB4ABABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAEAAQABAAEAFAAUAAeAFAAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAArACsABAAEAAQABAAEAAQABAAEAAQADgANAA0AEwATAB4AHgAeAA0ADQANAA0ADQANAA0ADQANAA0ADQANAA0ADQANAFAAUABQAFAABAAEACsAKwAEAA0ADQAeAFAAKwArACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAFAAKwArACsAKwArACsAKwBLAEsASwBLAEsASwBLAEsASwBLACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAKwArACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwBcAFwADQANAA0AKgBQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAeACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwBQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAKwArAFAAKwArAFAAUABQAFAAUABQAFAAUAArAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQAKwAEAAQAKwArAAQABAAEAAQAUAAEAFAABAAEAA0ADQANACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAArACsABAAEAAQABAAEAAQABABQAA4AUAAEACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAABAAEAAQABAAEAAQABAAEAAQABABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAFAABAAEAAQABAAOAB4ADQANAA0ADQAOAB4ABAArACsAKwArACsAKwArACsAUAAEAAQABAAEAAQABAAEAAQABAAEAAQAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAA0ADQANAFAADgAOAA4ADQANACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEACsABAAEAAQABAAEAAQABAAEAFAADQANAA0ADQANACsAKwArACsAKwArACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwAOABMAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQACsAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAArACsAKwAEACsABAAEACsABAAEAAQABAAEAAQABABQAAQAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAKwBQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQAKwAEAAQAKwAEAAQABAAEAAQAUAArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAeAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAB4AHgAeAB4AHgAeAB4AHgAaABoAGgAaAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwArACsAKwArACsAKwArAA0AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsADQANAA0ADQANACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAASABIAEgAQwBDAEMAUABQAFAAUABDAFAAUABQAEgAQwBIAEMAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAASABDAEMAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwAJAAkACQAJAAkACQAJABYAEQArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABIAEMAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwANAA0AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAAQABAAEAAQABAANACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAA0ADQANAB4AHgAeAB4AHgAeAFAAUABQAFAADQAeACsAKwArACsAKwArACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwArAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAANAA0AHgAeACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwAEAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAKwArACsAKwArACsAKwAEAAQABAAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAARwBHABUARwAJACsAKwArACsAKwArACsAKwArACsAKwAEAAQAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACsAKwArACsAKwArACsAKwBXAFcAVwBXAFcAVwBXAFcAVwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUQBRAFEAKwArACsAKwArACsAKwArACsAKwArACsAKwBRAFEAUQBRACsAKwArACsAKwArACsAKwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUAArACsAHgAEAAQADQAEAAQABAAEACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwArACsAKwArAB4AHgAeAB4AHgAeAB4AKwArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAAQABAAEAAQABAAeAB4AHgAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAB4AHgAEAAQABAAEAAQABAAEAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4ABAAEAAQABAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4ABAAEAAQAHgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwArACsAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwBQAFAAKwArAFAAKwArAFAAUAArACsAUABQAFAAUAArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACsAUAArAFAAUABQAFAAUABQAFAAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwBQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAHgAeAFAAUABQAFAAUAArAFAAKwArACsAUABQAFAAUABQAFAAUAArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgBQAFAAUABQAFAAUABQAFAAUABQAFAAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAB4AHgAeAB4AHgAeAB4AHgAeACsAKwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAeAB4AHgAeAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAeAB4AHgAeAB4AHgAeAB4ABAAeAB4AHgAeAB4AHgAeAB4AHgAeAAQAHgAeAA0ADQANAA0AHgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAEAAQABAAEAAQAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAAQABAAEAAQABAAEAAQAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAKwArAAQABAAEAAQABAAEAAQAKwAEAAQAKwAEAAQABAAEAAQAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwAEAAQABAAEAAQABAAEAFAAUABQAFAAUABQAFAAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwBQAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArABsAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEACsAKwArACsAKwArACsAKwArAB4AHgAeAB4ABAAEAAQABAAEAAQABABQACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwArACsAKwArABYAFgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAGgBQAFAAUAAaAFAAUABQAFAAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAKwBQACsAKwBQACsAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAKwBQACsAUAArACsAKwArACsAKwBQACsAKwArACsAUAArAFAAKwBQACsAUABQAFAAKwBQAFAAKwBQACsAKwBQACsAUAArAFAAKwBQACsAUAArAFAAUAArAFAAKwArAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUABQAFAAUAArAFAAUABQAFAAKwBQACsAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAUABQAFAAKwBQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAeAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8AJQAlACUAHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHgAeAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB4AHgAeACUAJQAlAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQApACkAKQApACkAKQApACkAKQApACkAKQApACkAKQApACkAKQApACkAKQApACkAKQApACkAJQAlACUAJQAlACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAeAB4AJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlAB4AHgAlACUAJQAlACUAHgAlACUAJQAlACUAIAAgACAAJQAlACAAJQAlACAAIAAgACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACEAIQAhACEAIQAlACUAIAAgACUAJQAgACAAIAAgACAAIAAgACAAIAAgACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAJQAlACUAIAAlACUAJQAlACAAIAAgACUAIAAgACAAJQAlACUAJQAlACUAJQAgACUAIAAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAHgAlAB4AJQAeACUAJQAlACUAJQAgACUAJQAlACUAHgAlAB4AHgAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlAB4AHgAeAB4AHgAeAB4AJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAeACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACAAIAAlACUAJQAlACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACAAJQAlACUAJQAgACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAHgAeAB4AHgAeAB4AHgAeACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAeAB4AHgAeAB4AHgAlACUAJQAlACUAJQAlACAAIAAgACUAJQAlACAAIAAgACAAIAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeABcAFwAXABUAFQAVAB4AHgAeAB4AJQAlACUAIAAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACAAIAAgACUAJQAlACUAJQAlACUAJQAlACAAJQAlACUAJQAlACUAJQAlACUAJQAlACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AJQAlACUAJQAlACUAJQAlACUAJQAlACUAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AJQAlACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACUAJQAlACUAJQAlACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAeACUAJQAlACUAJQAlAB4AHgAeAB4AHgAeAB4AHgAlACUAJQAlACUAJQAlACUAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAgACUAJQAgACUAJQAlACUAJQAlACUAJQAgACAAIAAgACAAIAAgACAAJQAlACUAJQAlACUAIAAlACUAJQAlACUAJQAlACUAJQAgACAAIAAgACAAIAAgACAAIAAgACUAJQAgACAAIAAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAgACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACAAIAAlACAAIAAlACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAgACAAIAAlACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAJQAlAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAKwArAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACUAJQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwAlACUAJQAlACUAJQAlACUAJQAlACUAVwBXACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAKwAEACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAA==",Et=50,pe=1,Ae=2,Pe=3,Ut=4,jt=5,ft=7,on=8,hn=9,lt=10,Ct=11,sn=12,W=13,Se=14,Ht=15,zt=16,Fn=17,Tn=18,lr=19,je=20,be=21,it=22,wt=23,ot=24,ut=25,_t=26,$t=27,Vt=28,Qt=29,cn=30,Yn=31,qn=32,Sr=33,Jr=34,vr=35,Ki=36,Mi=37,yi=38,qr=39,es=40,Ci=41,En=42,rn=43,Xt=[9001,65288],st="!",dt="\xD7",Wt="\xF7",bn=On(Mt),Jt=[cn,Ki],ar=[pe,Ae,Pe,jt],rr=[lt,on],Kr=[$t,_t],si=ar.concat(rr),Ie=[yi,qr,es,Jr,vr],L=[Ht,W],Q=function(U,R){R===void 0&&(R="strict");var $=[],K=[],_e=[];return U.forEach(function(et,Ft){var dn=bn.get(et);if(dn>Et?(_e.push(!0),dn-=Et):_e.push(!1),["normal","auto","loose"].indexOf(R)!==-1&&[8208,8211,12316,12448].indexOf(et)!==-1)return K.push(Ft),$.push(zt);if(dn===Ut||dn===Ct){if(Ft===0)return K.push(Ft),$.push(cn);var fn=$[Ft-1];return si.indexOf(fn)===-1?(K.push(K[Ft-1]),$.push(fn)):(K.push(Ft),$.push(cn))}if(K.push(Ft),dn===Yn)return $.push(R==="strict"?be:Mi);if(dn===En||dn===Qt)return $.push(cn);if(dn===rn)return et>=131072&&et<=196605||et>=196608&&et<=262141?$.push(Mi):$.push(cn);$.push(dn)}),[K,$,_e]},w=function(U,R,$,K){var _e=K[$];if(Array.isArray(U)?U.indexOf(_e)!==-1:U===_e)for(var et=$;et<=K.length;){et++;var Ft=K[et];if(Ft===R)return!0;if(Ft!==lt)break}if(_e===lt)for(var et=$;et>0;){et--;var dn=K[et];if(Array.isArray(U)?U.indexOf(dn)!==-1:U===dn)for(var fn=$;fn<=K.length;){fn++;var Ft=K[fn];if(Ft===R)return!0;if(Ft!==lt)break}if(dn!==lt)break}return!1},z=function(U,R){for(var $=U;$>=0;){var K=R[$];if(K===lt)$--;else return K}return 0},ie=function(U,R,$,K,_e){if($[K]===0)return dt;var et=K-1;if(Array.isArray(_e)&&_e[et]===!0)return dt;var Ft=et-1,dn=et+1,fn=R[et],Ar=Ft>=0?R[Ft]:0,ur=R[dn];if(fn===Ae&&ur===Pe)return dt;if(ar.indexOf(fn)!==-1)return st;if(ar.indexOf(ur)!==-1||rr.indexOf(ur)!==-1)return dt;if(z(et,R)===on)return Wt;if(bn.get(U[et])===Ct||(fn===qn||fn===Sr)&&bn.get(U[dn])===Ct||fn===ft||ur===ft||fn===hn||[lt,W,Ht].indexOf(fn)===-1&&ur===hn||[Fn,Tn,lr,ot,Vt].indexOf(ur)!==-1||z(et,R)===it||w(wt,it,et,R)||w([Fn,Tn],be,et,R)||w(sn,sn,et,R))return dt;if(fn===lt)return Wt;if(fn===wt||ur===wt)return dt;if(ur===zt||fn===zt)return Wt;if([W,Ht,be].indexOf(ur)!==-1||fn===Se||Ar===Ki&&L.indexOf(fn)!==-1||fn===Vt&&ur===Ki||ur===je||Jt.indexOf(ur)!==-1&&fn===ut||Jt.indexOf(fn)!==-1&&ur===ut||fn===$t&&[Mi,qn,Sr].indexOf(ur)!==-1||[Mi,qn,Sr].indexOf(fn)!==-1&&ur===_t||Jt.indexOf(fn)!==-1&&Kr.indexOf(ur)!==-1||Kr.indexOf(fn)!==-1&&Jt.indexOf(ur)!==-1||[$t,_t].indexOf(fn)!==-1&&(ur===ut||[it,Ht].indexOf(ur)!==-1&&R[dn+1]===ut)||[it,Ht].indexOf(fn)!==-1&&ur===ut||fn===ut&&[ut,Vt,ot].indexOf(ur)!==-1)return dt;if([ut,Vt,ot,Fn,Tn].indexOf(ur)!==-1)for(var Ir=et;Ir>=0;){var fi=R[Ir];if(fi===ut)return dt;if([Vt,ot].indexOf(fi)!==-1)Ir--;else break}if([$t,_t].indexOf(ur)!==-1)for(var Ir=[Fn,Tn].indexOf(fn)!==-1?Ft:et;Ir>=0;){var fi=R[Ir];if(fi===ut)return dt;if([Vt,ot].indexOf(fi)!==-1)Ir--;else break}if(yi===fn&&[yi,qr,Jr,vr].indexOf(ur)!==-1||[qr,Jr].indexOf(fn)!==-1&&[qr,es].indexOf(ur)!==-1||[es,vr].indexOf(fn)!==-1&&ur===es||Ie.indexOf(fn)!==-1&&[je,_t].indexOf(ur)!==-1||Ie.indexOf(ur)!==-1&&fn===$t||Jt.indexOf(fn)!==-1&&Jt.indexOf(ur)!==-1||fn===ot&&Jt.indexOf(ur)!==-1||Jt.concat(ut).indexOf(fn)!==-1&&ur===it&&Xt.indexOf(U[dn])===-1||Jt.concat(ut).indexOf(ur)!==-1&&fn===Tn)return dt;if(fn===Ci&&ur===Ci){for(var Qs=$[et],us=1;Qs>0&&(Qs--,R[Qs]===Ci);)us++;if(us%2!==0)return dt}return fn===qn&&ur===Sr?dt:Wt},ze=function(U,R){R||(R={lineBreak:"normal",wordBreak:"normal"});var $=Q(U,R.lineBreak),K=$[0],_e=$[1],et=$[2];(R.wordBreak==="break-all"||R.wordBreak==="break-word")&&(_e=_e.map(function(dn){return[ut,cn,En].indexOf(dn)!==-1?Mi:dn}));var Ft=R.wordBreak==="keep-all"?et.map(function(dn,fn){return dn&&U[fn]>=19968&&U[fn]<=40959}):void 0;return[K,_e,Ft]},Je=function(){function U(R,$,K,_e){this.codePoints=R,this.required=$===st,this.start=K,this.end=_e}return U.prototype.slice=function(){return H.apply(void 0,this.codePoints.slice(this.start,this.end))},U}(),At=function(U,R){var $=P(U),K=ze($,R),_e=K[0],et=K[1],Ft=K[2],dn=$.length,fn=0,Ar=0;return{next:function(){if(Ar>=dn)return{done:!0,value:null};for(var ur=dt;Ar<dn&&(ur=ie($,et,_e,++Ar,Ft))===dt;);if(ur!==dt||Ar===dn){var Ir=new Je($,ur,fn,Ar);return fn=Ar,{value:Ir,done:!1}}return{done:!0,value:null}}}},xt=1,Sn=2,Oe=4,Qe=8,Re=10,Ke=47,gt=92,tn=9,yt=32,Yt=34,Rn=61,er=35,Jn=36,kr=37,fr=39,wr=40,ei=41,_n=95,jn=45,Hr=33,Pr=60,$i=62,Zi=64,Xi=91,Ei=93,ms=61,_i=123,Es=63,ua=125,Hn=124,Pt=126,Gt=128,Bt=65533,yn=42,Ln=43,gr=44,Rr=58,$r=59,Ii=46,Di=0,ss=8,vs=11,Cs=14,Aa=31,sa=127,ca=-1,Ai=48,$a=97,Zo=101,Ko=102,$o=117,bo=122,Pl=65,il=69,go=70,Ll=85,Lu=90,ao=function(U){return U>=Ai&&U<=57},sl=function(U){return U>=55296&&U<=57343},No=function(U){return ao(U)||U>=Pl&&U<=go||U>=$a&&U<=Ko},Uu=function(U){return U>=$a&&U<=bo},ws=function(U){return U>=Pl&&U<=Lu},Kh=function(U){return Uu(U)||ws(U)},dh=function(U){return U>=Gt},$h=function(U){return U===Re||U===tn||U===yt},Uh=function(U){return Kh(U)||dh(U)||U===_n},Ku=function(U){return Uh(U)||ao(U)||U===jn},sc=function(U){return U>=Di&&U<=ss||U===vs||U>=Cs&&U<=Aa||U===sa},pu=function(U,R){return U!==gt?!1:R!==Re},ou=function(U,R,$){return U===jn?Uh(R)||pu(R,$):Uh(U)?!0:!!(U===gt&&pu(U,R))},Ad=function(U,R,$){return U===Ln||U===jn?ao(R)?!0:R===Ii&&ao($):ao(U===Ii?R:U)},hf=function(U){var R=0,$=1;(U[R]===Ln||U[R]===jn)&&(U[R]===jn&&($=-1),R++);for(var K=[];ao(U[R]);)K.push(U[R++]);var _e=K.length?parseInt(H.apply(void 0,K),10):0;U[R]===Ii&&R++;for(var et=[];ao(U[R]);)et.push(U[R++]);var Ft=et.length,dn=Ft?parseInt(H.apply(void 0,et),10):0;(U[R]===il||U[R]===Zo)&&R++;var fn=1;(U[R]===Ln||U[R]===jn)&&(U[R]===jn&&(fn=-1),R++);for(var Ar=[];ao(U[R]);)Ar.push(U[R++]);var ur=Ar.length?parseInt(H.apply(void 0,Ar),10):0;return $*(_e+dn*Math.pow(10,-Ft))*Math.pow(10,fn*ur)},Xo={type:2},fh={type:3},Qf={type:4},pd={type:13},Ah={type:8},Vc={type:21},jo={type:9},gd={type:10},lu={type:11},gu={type:12},oo={type:14},Ic={type:23},jc={type:1},ph={type:25},Lo={type:24},Ji={type:26},$u={type:27},gh={type:28},mh={type:29},np={type:31},vh={type:32},Cu=function(){function U(){this._value=[]}return U.prototype.write=function(R){this._value=this._value.concat(P(R))},U.prototype.read=function(){for(var R=[],$=this.consumeToken();$!==vh;)R.push($),$=this.consumeToken();return R},U.prototype.consumeToken=function(){var R=this.consumeCodePoint();switch(R){case Yt:return this.consumeStringToken(Yt);case er:var $=this.peekCodePoint(0),K=this.peekCodePoint(1),_e=this.peekCodePoint(2);if(Ku($)||pu(K,_e)){var et=ou($,K,_e)?Sn:xt,Ft=this.consumeName();return{type:5,value:Ft,flags:et}}break;case Jn:if(this.peekCodePoint(0)===Rn)return this.consumeCodePoint(),pd;break;case fr:return this.consumeStringToken(fr);case wr:return Xo;case ei:return fh;case yn:if(this.peekCodePoint(0)===Rn)return this.consumeCodePoint(),oo;break;case Ln:if(Ad(R,this.peekCodePoint(0),this.peekCodePoint(1)))return this.reconsumeCodePoint(R),this.consumeNumericToken();break;case gr:return Qf;case jn:var dn=R,fn=this.peekCodePoint(0),Ar=this.peekCodePoint(1);if(Ad(dn,fn,Ar))return this.reconsumeCodePoint(R),this.consumeNumericToken();if(ou(dn,fn,Ar))return this.reconsumeCodePoint(R),this.consumeIdentLikeToken();if(fn===jn&&Ar===$i)return this.consumeCodePoint(),this.consumeCodePoint(),Lo;break;case Ii:if(Ad(R,this.peekCodePoint(0),this.peekCodePoint(1)))return this.reconsumeCodePoint(R),this.consumeNumericToken();break;case Ke:if(this.peekCodePoint(0)===yn)for(this.consumeCodePoint();;){var ur=this.consumeCodePoint();if(ur===yn&&(ur=this.consumeCodePoint(),ur===Ke))return this.consumeToken();if(ur===ca)return this.consumeToken()}break;case Rr:return Ji;case $r:return $u;case Pr:if(this.peekCodePoint(0)===Hr&&this.peekCodePoint(1)===jn&&this.peekCodePoint(2)===jn)return this.consumeCodePoint(),this.consumeCodePoint(),ph;break;case Zi:var Ir=this.peekCodePoint(0),fi=this.peekCodePoint(1),Qs=this.peekCodePoint(2);if(ou(Ir,fi,Qs)){var Ft=this.consumeName();return{type:7,value:Ft}}break;case Xi:return gh;case gt:if(pu(R,this.peekCodePoint(0)))return this.reconsumeCodePoint(R),this.consumeIdentLikeToken();break;case Ei:return mh;case ms:if(this.peekCodePoint(0)===Rn)return this.consumeCodePoint(),Ah;break;case _i:return lu;case ua:return gu;case $o:case Ll:var us=this.peekCodePoint(0),bs=this.peekCodePoint(1);return us===Ln&&(No(bs)||bs===Es)&&(this.consumeCodePoint(),this.consumeUnicodeRangeToken()),this.reconsumeCodePoint(R),this.consumeIdentLikeToken();case Hn:if(this.peekCodePoint(0)===Rn)return this.consumeCodePoint(),jo;if(this.peekCodePoint(0)===Hn)return this.consumeCodePoint(),Vc;break;case Pt:if(this.peekCodePoint(0)===Rn)return this.consumeCodePoint(),gd;break;case ca:return vh}return $h(R)?(this.consumeWhiteSpace(),np):ao(R)?(this.reconsumeCodePoint(R),this.consumeNumericToken()):Uh(R)?(this.reconsumeCodePoint(R),this.consumeIdentLikeToken()):{type:6,value:H(R)}},U.prototype.consumeCodePoint=function(){var R=this._value.shift();return typeof R=="undefined"?-1:R},U.prototype.reconsumeCodePoint=function(R){this._value.unshift(R)},U.prototype.peekCodePoint=function(R){return R>=this._value.length?-1:this._value[R]},U.prototype.consumeUnicodeRangeToken=function(){for(var R=[],$=this.consumeCodePoint();No($)&&R.length<6;)R.push($),$=this.consumeCodePoint();for(var K=!1;$===Es&&R.length<6;)R.push($),$=this.consumeCodePoint(),K=!0;if(K){var _e=parseInt(H.apply(void 0,R.map(function(fn){return fn===Es?Ai:fn})),16),et=parseInt(H.apply(void 0,R.map(function(fn){return fn===Es?go:fn})),16);return{type:30,start:_e,end:et}}var Ft=parseInt(H.apply(void 0,R),16);if(this.peekCodePoint(0)===jn&&No(this.peekCodePoint(1))){this.consumeCodePoint(),$=this.consumeCodePoint();for(var dn=[];No($)&&dn.length<6;)dn.push($),$=this.consumeCodePoint();var et=parseInt(H.apply(void 0,dn),16);return{type:30,start:Ft,end:et}}else return{type:30,start:Ft,end:Ft}},U.prototype.consumeIdentLikeToken=function(){var R=this.consumeName();return R.toLowerCase()==="url"&&this.peekCodePoint(0)===wr?(this.consumeCodePoint(),this.consumeUrlToken()):this.peekCodePoint(0)===wr?(this.consumeCodePoint(),{type:19,value:R}):{type:20,value:R}},U.prototype.consumeUrlToken=function(){var R=[];if(this.consumeWhiteSpace(),this.peekCodePoint(0)===ca)return{type:22,value:""};var $=this.peekCodePoint(0);if($===fr||$===Yt){var K=this.consumeStringToken(this.consumeCodePoint());return K.type===0&&(this.consumeWhiteSpace(),this.peekCodePoint(0)===ca||this.peekCodePoint(0)===ei)?(this.consumeCodePoint(),{type:22,value:K.value}):(this.consumeBadUrlRemnants(),Ic)}for(;;){var _e=this.consumeCodePoint();if(_e===ca||_e===ei)return{type:22,value:H.apply(void 0,R)};if($h(_e))return this.consumeWhiteSpace(),this.peekCodePoint(0)===ca||this.peekCodePoint(0)===ei?(this.consumeCodePoint(),{type:22,value:H.apply(void 0,R)}):(this.consumeBadUrlRemnants(),Ic);if(_e===Yt||_e===fr||_e===wr||sc(_e))return this.consumeBadUrlRemnants(),Ic;if(_e===gt)if(pu(_e,this.peekCodePoint(0)))R.push(this.consumeEscapedCodePoint());else return this.consumeBadUrlRemnants(),Ic;else R.push(_e)}},U.prototype.consumeWhiteSpace=function(){for(;$h(this.peekCodePoint(0));)this.consumeCodePoint()},U.prototype.consumeBadUrlRemnants=function(){for(;;){var R=this.consumeCodePoint();if(R===ei||R===ca)return;pu(R,this.peekCodePoint(0))&&this.consumeEscapedCodePoint()}},U.prototype.consumeStringSlice=function(R){for(var $=5e4,K="";R>0;){var _e=Math.min($,R);K+=H.apply(void 0,this._value.splice(0,_e)),R-=_e}return this._value.shift(),K},U.prototype.consumeStringToken=function(R){var $="",K=0;do{var _e=this._value[K];if(_e===ca||_e===void 0||_e===R)return $+=this.consumeStringSlice(K),{type:0,value:$};if(_e===Re)return this._value.splice(0,K),jc;if(_e===gt){var et=this._value[K+1];et!==ca&&et!==void 0&&(et===Re?($+=this.consumeStringSlice(K),K=-1,this._value.shift()):pu(_e,et)&&($+=this.consumeStringSlice(K),$+=H(this.consumeEscapedCodePoint()),K=-1))}K++}while(!0)},U.prototype.consumeNumber=function(){var R=[],$=Oe,K=this.peekCodePoint(0);for((K===Ln||K===jn)&&R.push(this.consumeCodePoint());ao(this.peekCodePoint(0));)R.push(this.consumeCodePoint());K=this.peekCodePoint(0);var _e=this.peekCodePoint(1);if(K===Ii&&ao(_e))for(R.push(this.consumeCodePoint(),this.consumeCodePoint()),$=Qe;ao(this.peekCodePoint(0));)R.push(this.consumeCodePoint());K=this.peekCodePoint(0),_e=this.peekCodePoint(1);var et=this.peekCodePoint(2);if((K===il||K===Zo)&&((_e===Ln||_e===jn)&&ao(et)||ao(_e)))for(R.push(this.consumeCodePoint(),this.consumeCodePoint()),$=Qe;ao(this.peekCodePoint(0));)R.push(this.consumeCodePoint());return[hf(R),$]},U.prototype.consumeNumericToken=function(){var R=this.consumeNumber(),$=R[0],K=R[1],_e=this.peekCodePoint(0),et=this.peekCodePoint(1),Ft=this.peekCodePoint(2);if(ou(_e,et,Ft)){var dn=this.consumeName();return{type:15,number:$,flags:K,unit:dn}}return _e===kr?(this.consumeCodePoint(),{type:16,number:$,flags:K}):{type:17,number:$,flags:K}},U.prototype.consumeEscapedCodePoint=function(){var R=this.consumeCodePoint();if(No(R)){for(var $=H(R);No(this.peekCodePoint(0))&&$.length<6;)$+=H(this.consumeCodePoint());$h(this.peekCodePoint(0))&&this.consumeCodePoint();var K=parseInt($,16);return K===0||sl(K)||K>1114111?Bt:K}return R===ca?Bt:R},U.prototype.consumeName=function(){for(var R="";;){var $=this.consumeCodePoint();if(Ku($))R+=H($);else if(pu($,this.peekCodePoint(0)))R+=H(this.consumeEscapedCodePoint());else return this.reconsumeCodePoint($),R}},U}(),zc=function(){function U(R){this._tokens=R}return U.create=function(R){var $=new Cu;return $.write(R),new U($.read())},U.parseValue=function(R){return U.create(R).parseComponentValue()},U.parseValues=function(R){return U.create(R).parseComponentValues()},U.prototype.parseComponentValue=function(){for(var R=this.consumeToken();R.type===31;)R=this.consumeToken();if(R.type===32)throw new SyntaxError("Error parsing CSS component value, unexpected EOF");this.reconsumeToken(R);var $=this.consumeComponentValue();do R=this.consumeToken();while(R.type===31);if(R.type===32)return $;throw new SyntaxError("Error parsing CSS component value, multiple values found when expecting only one")},U.prototype.parseComponentValues=function(){for(var R=[];;){var $=this.consumeComponentValue();if($.type===32)return R;R.push($),R.push()}},U.prototype.consumeComponentValue=function(){var R=this.consumeToken();switch(R.type){case 11:case 28:case 2:return this.consumeSimpleBlock(R.type);case 19:return this.consumeFunction(R)}return R},U.prototype.consumeSimpleBlock=function(R){for(var $={type:R,values:[]},K=this.consumeToken();;){if(K.type===32||Xu(K,R))return $;this.reconsumeToken(K),$.values.push(this.consumeComponentValue()),K=this.consumeToken()}},U.prototype.consumeFunction=function(R){for(var $={name:R.value,values:[],type:18};;){var K=this.consumeToken();if(K.type===32||K.type===3)return $;this.reconsumeToken(K),$.values.push(this.consumeComponentValue())}},U.prototype.consumeToken=function(){var R=this._tokens.shift();return typeof R=="undefined"?vh:R},U.prototype.reconsumeToken=function(R){this._tokens.unshift(R)},U}(),Ul=function(U){return U.type===15},Xl=function(U){return U.type===17},Uo=function(U){return U.type===20},Ld=function(U){return U.type===0},Yc=function(U,R){return Uo(U)&&U.value===R},gl=function(U){return U.type!==31},To=function(U){return U.type!==31&&U.type!==4},ml=function(U){var R=[],$=[];return U.forEach(function(K){if(K.type===4){if($.length===0)throw new Error("Error parsing function args, zero tokens for arg");R.push($),$=[];return}K.type!==31&&$.push(K)}),$.length&&R.push($),R},Xu=function(U,R){return R===11&&U.type===12||R===28&&U.type===29?!0:R===2&&U.type===3},mu=function(U){return U.type===17||U.type===15},Oo=function(U){return U.type===16||mu(U)},Bo=function(U){return U.length>1?[U[0],U[1]]:[U[0]]},_o={type:17,number:0,flags:Oe},na={type:16,number:50,flags:Oe},Wa={type:16,number:100,flags:Oe},yh=function(U,R,$){var K=U[0],_e=U[1];return[Yo(K,R),Yo(typeof _e!="undefined"?_e:K,$)]},Yo=function(U,R){if(U.type===16)return U.number/100*R;if(Ul(U))switch(U.unit){case"rem":case"em":return 16*U.number;case"px":default:return U.number}return U.number},Tu="deg",uu="grad",wc="rad",ac="turn",Lr={name:"angle",parse:function(U,R){if(R.type===15)switch(R.unit){case Tu:return Math.PI*R.number/180;case uu:return Math.PI/200*R.number;case wc:return R.number;case ac:return Math.PI*2*R.number}throw new Error("Unsupported angle type")}},Gr=function(U){return U.type===15&&(U.unit===Tu||U.unit===uu||U.unit===wc||U.unit===ac)},ki=function(U){var R=U.filter(Uo).map(function($){return $.value}).join(" ");switch(R){case"to bottom right":case"to right bottom":case"left top":case"top left":return[_o,_o];case"to top":case"bottom":return ju(0);case"to bottom left":case"to left bottom":case"right top":case"top right":return[_o,Wa];case"to right":case"left":return ju(90);case"to top left":case"to left top":case"right bottom":case"bottom right":return[Wa,Wa];case"to bottom":case"top":return ju(180);case"to top right":case"to right top":case"left bottom":case"bottom left":return[Wa,_o];case"to left":case"right":return ju(270)}return 0},ju=function(U){return Math.PI*U/180},bl={name:"color",parse:function(U,R){if(R.type===18){var $=rp[R.name];if(typeof $=="undefined")throw new Error('Attempting to parse an unsupported color function "'+R.name+'"');return $(U,R.values)}if(R.type===5){if(R.value.length===3){var K=R.value.substring(0,1),_e=R.value.substring(1,2),et=R.value.substring(2,3);return Ou(parseInt(K+K,16),parseInt(_e+_e,16),parseInt(et+et,16),1)}if(R.value.length===4){var K=R.value.substring(0,1),_e=R.value.substring(1,2),et=R.value.substring(2,3),Ft=R.value.substring(3,4);return Ou(parseInt(K+K,16),parseInt(_e+_e,16),parseInt(et+et,16),parseInt(Ft+Ft,16)/255)}if(R.value.length===6){var K=R.value.substring(0,2),_e=R.value.substring(2,4),et=R.value.substring(4,6);return Ou(parseInt(K,16),parseInt(_e,16),parseInt(et,16),1)}if(R.value.length===8){var K=R.value.substring(0,2),_e=R.value.substring(2,4),et=R.value.substring(4,6),Ft=R.value.substring(6,8);return Ou(parseInt(K,16),parseInt(_e,16),parseInt(et,16),parseInt(Ft,16)/255)}}if(R.type===20){var dn=lc[R.value.toUpperCase()];if(typeof dn!="undefined")return dn}return lc.TRANSPARENT}},qo=function(U){return(255&U)===0},Go=function(U){var R=255&U,$=255&U>>8,K=255&U>>16,_e=255&U>>24;return R<255?"rgba("+_e+","+K+","+$+","+R/255+")":"rgb("+_e+","+K+","+$+")"},Ou=function(U,R,$,K){return(U<<24|R<<16|$<<8|Math.round(K*255)<<0)>>>0},Oh=function(U,R){if(U.type===17)return U.number;if(U.type===16){var $=R===3?1:255;return R===3?U.number/100*$:Math.round(U.number/100*$)}return 0},oc=function(U,R){var $=R.filter(To);if($.length===3){var K=$.map(Oh),_e=K[0],et=K[1],Ft=K[2];return Ou(_e,et,Ft,1)}if($.length===4){var dn=$.map(Oh),_e=dn[0],et=dn[1],Ft=dn[2],fn=dn[3];return Ou(_e,et,Ft,fn)}return 0};function Ca(U,R,$){return $<0&&($+=1),$>=1&&($-=1),$<1/6?(R-U)*$*6+U:$<1/2?R:$<2/3?(R-U)*6*(2/3-$)+U:U}var Ud=function(U,R){var $=R.filter(To),K=$[0],_e=$[1],et=$[2],Ft=$[3],dn=(K.type===17?ju(K.number):Lr.parse(U,K))/(Math.PI*2),fn=Oo(_e)?_e.number/100:0,Ar=Oo(et)?et.number/100:0,ur=typeof Ft!="undefined"&&Oo(Ft)?Yo(Ft,1):1;if(fn===0)return Ou(Ar*255,Ar*255,Ar*255,1);var Ir=Ar<=.5?Ar*(fn+1):Ar+fn-Ar*fn,fi=Ar*2-Ir,Qs=Ca(fi,Ir,dn+1/3),us=Ca(fi,Ir,dn),bs=Ca(fi,Ir,dn-1/3);return Ou(Qs*255,us*255,bs*255,ur)},rp={hsl:Ud,hsla:Ud,rgb:oc,rgba:oc},Xh=function(U,R){return bl.parse(U,zc.create(R).parseComponentValue())},lc={ALICEBLUE:4042850303,ANTIQUEWHITE:4209760255,AQUA:16777215,AQUAMARINE:2147472639,AZURE:4043309055,BEIGE:4126530815,BISQUE:4293182719,BLACK:255,BLANCHEDALMOND:4293643775,BLUE:65535,BLUEVIOLET:2318131967,BROWN:2771004159,BURLYWOOD:3736635391,CADETBLUE:1604231423,CHARTREUSE:2147418367,CHOCOLATE:3530104575,CORAL:4286533887,CORNFLOWERBLUE:1687547391,CORNSILK:4294499583,CRIMSON:3692313855,CYAN:16777215,DARKBLUE:35839,DARKCYAN:9145343,DARKGOLDENROD:3095837695,DARKGRAY:2846468607,DARKGREEN:6553855,DARKGREY:2846468607,DARKKHAKI:3182914559,DARKMAGENTA:2332068863,DARKOLIVEGREEN:1433087999,DARKORANGE:4287365375,DARKORCHID:2570243327,DARKRED:2332033279,DARKSALMON:3918953215,DARKSEAGREEN:2411499519,DARKSLATEBLUE:1211993087,DARKSLATEGRAY:793726975,DARKSLATEGREY:793726975,DARKTURQUOISE:13554175,DARKVIOLET:2483082239,DEEPPINK:4279538687,DEEPSKYBLUE:12582911,DIMGRAY:1768516095,DIMGREY:1768516095,DODGERBLUE:512819199,FIREBRICK:2988581631,FLORALWHITE:4294635775,FORESTGREEN:579543807,FUCHSIA:4278255615,GAINSBORO:3705462015,GHOSTWHITE:4177068031,GOLD:4292280575,GOLDENROD:3668254975,GRAY:2155905279,GREEN:8388863,GREENYELLOW:2919182335,GREY:2155905279,HONEYDEW:4043305215,HOTPINK:4285117695,INDIANRED:3445382399,INDIGO:1258324735,IVORY:4294963455,KHAKI:4041641215,LAVENDER:3873897215,LAVENDERBLUSH:4293981695,LAWNGREEN:2096890111,LEMONCHIFFON:4294626815,LIGHTBLUE:2916673279,LIGHTCORAL:4034953471,LIGHTCYAN:3774873599,LIGHTGOLDENRODYELLOW:4210742015,LIGHTGRAY:3553874943,LIGHTGREEN:2431553791,LIGHTGREY:3553874943,LIGHTPINK:4290167295,LIGHTSALMON:4288707327,LIGHTSEAGREEN:548580095,LIGHTSKYBLUE:2278488831,LIGHTSLATEGRAY:2005441023,LIGHTSLATEGREY:2005441023,LIGHTSTEELBLUE:2965692159,LIGHTYELLOW:4294959359,LIME:16711935,LIMEGREEN:852308735,LINEN:4210091775,MAGENTA:4278255615,MAROON:2147483903,MEDIUMAQUAMARINE:1724754687,MEDIUMBLUE:52735,MEDIUMORCHID:3126187007,MEDIUMPURPLE:2473647103,MEDIUMSEAGREEN:1018393087,MEDIUMSLATEBLUE:2070474495,MEDIUMSPRINGGREEN:16423679,MEDIUMTURQUOISE:1221709055,MEDIUMVIOLETRED:3340076543,MIDNIGHTBLUE:421097727,MINTCREAM:4127193855,MISTYROSE:4293190143,MOCCASIN:4293178879,NAVAJOWHITE:4292783615,NAVY:33023,OLDLACE:4260751103,OLIVE:2155872511,OLIVEDRAB:1804477439,ORANGE:4289003775,ORANGERED:4282712319,ORCHID:3664828159,PALEGOLDENROD:4008225535,PALEGREEN:2566625535,PALETURQUOISE:2951671551,PALEVIOLETRED:3681588223,PAPAYAWHIP:4293907967,PEACHPUFF:4292524543,PERU:3448061951,PINK:4290825215,PLUM:3718307327,POWDERBLUE:2967529215,PURPLE:2147516671,REBECCAPURPLE:1714657791,RED:4278190335,ROSYBROWN:3163525119,ROYALBLUE:1097458175,SADDLEBROWN:2336560127,SALMON:4202722047,SANDYBROWN:4104413439,SEAGREEN:780883967,SEASHELL:4294307583,SIENNA:2689740287,SILVER:3233857791,SKYBLUE:2278484991,SLATEBLUE:1784335871,SLATEGRAY:1887473919,SLATEGREY:1887473919,SNOW:4294638335,SPRINGGREEN:16744447,STEELBLUE:1182971135,TAN:3535047935,TEAL:8421631,THISTLE:3636451583,TOMATO:4284696575,TRANSPARENT:0,TURQUOISE:1088475391,VIOLET:4001558271,WHEAT:4125012991,WHITE:4294967295,WHITESMOKE:4126537215,YELLOW:4294902015,YELLOWGREEN:2597139199},wA={name:"background-clip",initialValue:"border-box",prefix:!1,type:1,parse:function(U,R){return R.map(function($){if(Uo($))switch($.value){case"padding-box":return 1;case"content-box":return 2}return 0})}},Od={name:"background-color",initialValue:"transparent",prefix:!1,type:3,format:"color"},jh=function(U,R){var $=bl.parse(U,R[0]),K=R[1];return K&&Oo(K)?{color:$,stop:K}:{color:$,stop:null}},SA=function(U,R){var $=U[0],K=U[U.length-1];$.stop===null&&($.stop=_o),K.stop===null&&(K.stop=Wa);for(var _e=[],et=0,Ft=0;Ft<U.length;Ft++){var dn=U[Ft].stop;if(dn!==null){var fn=Yo(dn,R);fn>et?_e.push(fn):_e.push(et),et=fn}else _e.push(null)}for(var Ar=null,Ft=0;Ft<_e.length;Ft++){var ur=_e[Ft];if(ur===null)Ar===null&&(Ar=Ft);else if(Ar!==null){for(var Ir=Ft-Ar,fi=_e[Ar-1],Qs=(ur-fi)/(Ir+1),us=1;us<=Ir;us++)_e[Ar+us-1]=Qs*us;Ar=null}}return U.map(function(bs,Ja){var fa=bs.color;return{color:fa,stop:Math.max(Math.min(1,_e[Ja]/R),0)}})},md=function(U,R,$){var K=R/2,_e=$/2,et=Yo(U[0],R)-K,Ft=_e-Yo(U[1],$);return(Math.atan2(Ft,et)+Math.PI*2)%(Math.PI*2)},vd=function(U,R,$){var K=typeof U=="number"?U:md(U,R,$),_e=Math.abs(R*Math.sin(K))+Math.abs($*Math.cos(K)),et=R/2,Ft=$/2,dn=_e/2,fn=Math.sin(K-Math.PI/2)*dn,Ar=Math.cos(K-Math.PI/2)*dn;return[_e,et-Ar,et+Ar,Ft-fn,Ft+fn]},mo=function(U,R){return Math.sqrt(U*U+R*R)},wa=function(U,R,$,K,_e){var et=[[0,0],[0,R],[U,0],[U,R]];return et.reduce(function(Ft,dn){var fn=dn[0],Ar=dn[1],ur=mo($-fn,K-Ar);return(_e?ur<Ft.optimumDistance:ur>Ft.optimumDistance)?{optimumCorner:dn,optimumDistance:ur}:Ft},{optimumDistance:_e?1/0:-1/0,optimumCorner:null}).optimumCorner},Dd=function(U,R,$,K,_e){var et=0,Ft=0;switch(U.size){case 0:U.shape===0?et=Ft=Math.min(Math.abs(R),Math.abs(R-K),Math.abs($),Math.abs($-_e)):U.shape===1&&(et=Math.min(Math.abs(R),Math.abs(R-K)),Ft=Math.min(Math.abs($),Math.abs($-_e)));break;case 2:if(U.shape===0)et=Ft=Math.min(mo(R,$),mo(R,$-_e),mo(R-K,$),mo(R-K,$-_e));else if(U.shape===1){var dn=Math.min(Math.abs($),Math.abs($-_e))/Math.min(Math.abs(R),Math.abs(R-K)),fn=wa(K,_e,R,$,!0),Ar=fn[0],ur=fn[1];et=mo(Ar-R,(ur-$)/dn),Ft=dn*et}break;case 1:U.shape===0?et=Ft=Math.max(Math.abs(R),Math.abs(R-K),Math.abs($),Math.abs($-_e)):U.shape===1&&(et=Math.max(Math.abs(R),Math.abs(R-K)),Ft=Math.max(Math.abs($),Math.abs($-_e)));break;case 3:if(U.shape===0)et=Ft=Math.max(mo(R,$),mo(R,$-_e),mo(R-K,$),mo(R-K,$-_e));else if(U.shape===1){var dn=Math.max(Math.abs($),Math.abs($-_e))/Math.max(Math.abs(R),Math.abs(R-K)),Ir=wa(K,_e,R,$,!1),Ar=Ir[0],ur=Ir[1];et=mo(Ar-R,(ur-$)/dn),Ft=dn*et}break}return Array.isArray(U.size)&&(et=Yo(U.size[0],K),Ft=U.size.length===2?Yo(U.size[1],_e):et),[et,Ft]},qi=function(U,R){var $=ju(180),K=[];return ml(R).forEach(function(_e,et){if(et===0){var Ft=_e[0];if(Ft.type===20&&Ft.value==="to"){$=ki(_e);return}else if(Gr(Ft)){$=Lr.parse(U,Ft);return}}var dn=jh(U,_e);K.push(dn)}),{angle:$,stops:K,type:1}},Du=function(U,R){var $=ju(180),K=[];return ml(R).forEach(function(_e,et){if(et===0){var Ft=_e[0];if(Ft.type===20&&["top","left","right","bottom"].indexOf(Ft.value)!==-1){$=ki(_e);return}else if(Gr(Ft)){$=(Lr.parse(U,Ft)+ju(270))%ju(360);return}}var dn=jh(U,_e);K.push(dn)}),{angle:$,stops:K,type:1}},kn=function(U,R){var $=ju(180),K=[],_e=1,et=0,Ft=3,dn=[];return ml(R).forEach(function(fn,Ar){var ur=fn[0];if(Ar===0){if(Uo(ur)&&ur.value==="linear"){_e=1;return}else if(Uo(ur)&&ur.value==="radial"){_e=2;return}}if(ur.type===18){if(ur.name==="from"){var Ir=bl.parse(U,ur.values[0]);K.push({stop:_o,color:Ir})}else if(ur.name==="to"){var Ir=bl.parse(U,ur.values[0]);K.push({stop:Wa,color:Ir})}else if(ur.name==="color-stop"){var fi=ur.values.filter(To);if(fi.length===2){var Ir=bl.parse(U,fi[1]),Qs=fi[0];Xl(Qs)&&K.push({stop:{type:16,number:Qs.number*100,flags:Qs.flags},color:Ir})}}}}),_e===1?{angle:($+ju(180))%ju(360),stops:K,type:_e}:{size:Ft,shape:et,stops:K,position:dn,type:_e}},kd="closest-side",Yh="farthest-side",vl="closest-corner",He="farthest-corner",me="circle",ce="ellipse",Ze="cover",le="contain",Nt=function(U,R){var $=0,K=3,_e=[],et=[];return ml(R).forEach(function(Ft,dn){var fn=!0;if(dn===0){var Ar=!1;fn=Ft.reduce(function(Ir,fi){if(Ar)if(Uo(fi))switch(fi.value){case"center":return et.push(na),Ir;case"top":case"left":return et.push(_o),Ir;case"right":case"bottom":return et.push(Wa),Ir}else(Oo(fi)||mu(fi))&&et.push(fi);else if(Uo(fi))switch(fi.value){case me:return $=0,!1;case ce:return $=1,!1;case"at":return Ar=!0,!1;case kd:return K=0,!1;case Ze:case Yh:return K=1,!1;case le:case vl:return K=2,!1;case He:return K=3,!1}else if(mu(fi)||Oo(fi))return Array.isArray(K)||(K=[]),K.push(fi),!1;return Ir},fn)}if(fn){var ur=jh(U,Ft);_e.push(ur)}}),{size:K,shape:$,stops:_e,position:et,type:2}},Dt=function(U,R){var $=0,K=3,_e=[],et=[];return ml(R).forEach(function(Ft,dn){var fn=!0;if(dn===0?fn=Ft.reduce(function(ur,Ir){if(Uo(Ir))switch(Ir.value){case"center":return et.push(na),!1;case"top":case"left":return et.push(_o),!1;case"right":case"bottom":return et.push(Wa),!1}else if(Oo(Ir)||mu(Ir))return et.push(Ir),!1;return ur},fn):dn===1&&(fn=Ft.reduce(function(ur,Ir){if(Uo(Ir))switch(Ir.value){case me:return $=0,!1;case ce:return $=1,!1;case le:case kd:return K=0,!1;case Yh:return K=1,!1;case vl:return K=2,!1;case Ze:case He:return K=3,!1}else if(mu(Ir)||Oo(Ir))return Array.isArray(K)||(K=[]),K.push(Ir),!1;return ur},fn)),fn){var Ar=jh(U,Ft);_e.push(Ar)}}),{size:K,shape:$,stops:_e,position:et,type:2}},pn=function(U){return U.type===1},Dn=function(U){return U.type===2},hr={name:"image",parse:function(U,R){if(R.type===22){var $={url:R.value,type:0};return U.cache.addImage(R.value),$}if(R.type===18){var K=yr[R.name];if(typeof K=="undefined")throw new Error('Attempting to parse an unsupported image function "'+R.name+'"');return K(U,R.values)}throw new Error("Unsupported image type "+R.type)}};function br(U){return!(U.type===20&&U.value==="none")&&(U.type!==18||!!yr[U.name])}var yr={"linear-gradient":qi,"-moz-linear-gradient":Du,"-ms-linear-gradient":Du,"-o-linear-gradient":Du,"-webkit-linear-gradient":Du,"radial-gradient":Nt,"-moz-radial-gradient":Dt,"-ms-radial-gradient":Dt,"-o-radial-gradient":Dt,"-webkit-radial-gradient":Dt,"-webkit-gradient":kn},xr={name:"background-image",initialValue:"none",type:1,prefix:!1,parse:function(U,R){if(R.length===0)return[];var $=R[0];return $.type===20&&$.value==="none"?[]:R.filter(function(K){return To(K)&&br(K)}).map(function(K){return hr.parse(U,K)})}},Fr={name:"background-origin",initialValue:"border-box",prefix:!1,type:1,parse:function(U,R){return R.map(function($){if(Uo($))switch($.value){case"padding-box":return 1;case"content-box":return 2}return 0})}},ri={name:"background-position",initialValue:"0% 0%",type:1,prefix:!1,parse:function(U,R){return ml(R).map(function($){return $.filter(Oo)}).map(Bo)}},ai={name:"background-repeat",initialValue:"repeat",prefix:!1,type:1,parse:function(U,R){return ml(R).map(function($){return $.filter(Uo).map(function(K){return K.value}).join(" ")}).map(wi)}},wi=function(U){switch(U){case"no-repeat":return 1;case"repeat-x":case"repeat no-repeat":return 2;case"repeat-y":case"no-repeat repeat":return 3;case"repeat":default:return 0}},Vi;(function(U){U.AUTO="auto",U.CONTAIN="contain",U.COVER="cover"})(Vi||(Vi={}));var rs={name:"background-size",initialValue:"0",prefix:!1,type:1,parse:function(U,R){return ml(R).map(function($){return $.filter(as)})}},as=function(U){return Uo(U)||Oo(U)},Bs=function(U){return{name:"border-"+U+"-color",initialValue:"transparent",prefix:!1,type:3,format:"color"}},Ls=Bs("top"),zi=Bs("right"),Ni=Bs("bottom"),Ns=Bs("left"),Os=function(U){return{name:"border-radius-"+U,initialValue:"0 0",prefix:!1,type:1,parse:function(R,$){return Bo($.filter(Oo))}}},_a=Os("top-left"),Sa=Os("top-right"),oe=Os("bottom-right"),re=Os("bottom-left"),Y=function(U){return{name:"border-"+U+"-style",initialValue:"solid",prefix:!1,type:2,parse:function(R,$){switch($){case"none":return 0;case"dashed":return 2;case"dotted":return 3;case"double":return 4}return 1}}},J=Y("top"),fe=Y("right"),Te=Y("bottom"),De=Y("left"),Le=function(U){return{name:"border-"+U+"-width",initialValue:"0",type:0,prefix:!1,parse:function(R,$){return Ul($)?$.number:0}}},Xe=Le("top"),mt=Le("right"),Kt=Le("bottom"),nn=Le("left"),gn={name:"color",initialValue:"transparent",prefix:!1,type:3,format:"color"},Nn={name:"direction",initialValue:"ltr",prefix:!1,type:2,parse:function(U,R){switch(R){case"rtl":return 1;case"ltr":default:return 0}}},$n={name:"display",initialValue:"inline-block",prefix:!1,type:1,parse:function(U,R){return R.filter(Uo).reduce(function($,K){return $|Er(K.value)},0)}},Er=function(U){switch(U){case"block":case"-webkit-box":return 2;case"inline":return 4;case"run-in":return 8;case"flow":return 16;case"flow-root":return 32;case"table":return 64;case"flex":case"-webkit-flex":return 128;case"grid":case"-ms-grid":return 256;case"ruby":return 512;case"subgrid":return 1024;case"list-item":return 2048;case"table-row-group":return 4096;case"table-header-group":return 8192;case"table-footer-group":return 16384;case"table-row":return 32768;case"table-cell":return 65536;case"table-column-group":return 131072;case"table-column":return 262144;case"table-caption":return 524288;case"ruby-base":return 1048576;case"ruby-text":return 2097152;case"ruby-base-container":return 4194304;case"ruby-text-container":return 8388608;case"contents":return 16777216;case"inline-block":return 33554432;case"inline-list-item":return 67108864;case"inline-table":return 134217728;case"inline-flex":return 268435456;case"inline-grid":return 536870912}return 0},mr={name:"float",initialValue:"none",prefix:!1,type:2,parse:function(U,R){switch(R){case"left":return 1;case"right":return 2;case"inline-start":return 3;case"inline-end":return 4}return 0}},ti={name:"letter-spacing",initialValue:"0",prefix:!1,type:0,parse:function(U,R){return R.type===20&&R.value==="normal"?0:R.type===17||R.type===15?R.number:0}},jr;(function(U){U.NORMAL="normal",U.STRICT="strict"})(jr||(jr={}));var ui={name:"line-break",initialValue:"normal",prefix:!1,type:2,parse:function(U,R){switch(R){case"strict":return jr.STRICT;case"normal":default:return jr.NORMAL}}},gi={name:"line-height",initialValue:"normal",prefix:!1,type:4},oi=function(U,R){return Uo(U)&&U.value==="normal"?1.2*R:U.type===17?R*U.number:Oo(U)?Yo(U,R):R},ts={name:"list-style-image",initialValue:"none",type:0,prefix:!1,parse:function(U,R){return R.type===20&&R.value==="none"?null:hr.parse(U,R)}},fs={name:"list-style-position",initialValue:"outside",prefix:!1,type:2,parse:function(U,R){switch(R){case"inside":return 0;case"outside":default:return 1}}},Ds={name:"list-style-type",initialValue:"none",prefix:!1,type:2,parse:function(U,R){switch(R){case"disc":return 0;case"circle":return 1;case"square":return 2;case"decimal":return 3;case"cjk-decimal":return 4;case"decimal-leading-zero":return 5;case"lower-roman":return 6;case"upper-roman":return 7;case"lower-greek":return 8;case"lower-alpha":return 9;case"upper-alpha":return 10;case"arabic-indic":return 11;case"armenian":return 12;case"bengali":return 13;case"cambodian":return 14;case"cjk-earthly-branch":return 15;case"cjk-heavenly-stem":return 16;case"cjk-ideographic":return 17;case"devanagari":return 18;case"ethiopic-numeric":return 19;case"georgian":return 20;case"gujarati":return 21;case"gurmukhi":return 22;case"hebrew":return 22;case"hiragana":return 23;case"hiragana-iroha":return 24;case"japanese-formal":return 25;case"japanese-informal":return 26;case"kannada":return 27;case"katakana":return 28;case"katakana-iroha":return 29;case"khmer":return 30;case"korean-hangul-formal":return 31;case"korean-hanja-formal":return 32;case"korean-hanja-informal":return 33;case"lao":return 34;case"lower-armenian":return 35;case"malayalam":return 36;case"mongolian":return 37;case"myanmar":return 38;case"oriya":return 39;case"persian":return 40;case"simp-chinese-formal":return 41;case"simp-chinese-informal":return 42;case"tamil":return 43;case"telugu":return 44;case"thai":return 45;case"tibetan":return 46;case"trad-chinese-formal":return 47;case"trad-chinese-informal":return 48;case"upper-armenian":return 49;case"disclosure-open":return 50;case"disclosure-closed":return 51;case"none":default:return-1}}},Ba=function(U){return{name:"margin-"+U,initialValue:"0",prefix:!1,type:4}},Ka=Ba("top"),xo=Ba("right"),aa=Ba("bottom"),di=Ba("left"),Ma={name:"overflow",initialValue:"visible",prefix:!1,type:1,parse:function(U,R){return R.filter(Uo).map(function($){switch($.value){case"hidden":return 1;case"scroll":return 2;case"clip":return 3;case"auto":return 4;case"visible":default:return 0}})}},Rs={name:"overflow-wrap",initialValue:"normal",prefix:!1,type:2,parse:function(U,R){switch(R){case"break-word":return"break-word";case"normal":default:return"normal"}}},lo=function(U){return{name:"padding-"+U,initialValue:"0",prefix:!1,type:3,format:"length-percentage"}},Jo=lo("top"),zs=lo("right"),Ya=lo("bottom"),pa=lo("left"),al={name:"text-align",initialValue:"left",prefix:!1,type:2,parse:function(U,R){switch(R){case"right":return 2;case"center":case"justify":return 1;case"left":default:return 0}}},qa={name:"position",initialValue:"static",prefix:!1,type:2,parse:function(U,R){switch(R){case"relative":return 1;case"absolute":return 2;case"fixed":return 3;case"sticky":return 4}return 0}},Ua={name:"text-shadow",initialValue:"none",type:1,prefix:!1,parse:function(U,R){return R.length===1&&Yc(R[0],"none")?[]:ml(R).map(function($){for(var K={color:lc.TRANSPARENT,offsetX:_o,offsetY:_o,blur:_o},_e=0,et=0;et<$.length;et++){var Ft=$[et];mu(Ft)?(_e===0?K.offsetX=Ft:_e===1?K.offsetY=Ft:K.blur=Ft,_e++):K.color=bl.parse(U,Ft)}return K})}},dl={name:"text-transform",initialValue:"none",prefix:!1,type:2,parse:function(U,R){switch(R){case"uppercase":return 2;case"lowercase":return 1;case"capitalize":return 3}return 0}},Sc={name:"transform",initialValue:"none",prefix:!0,type:0,parse:function(U,R){if(R.type===20&&R.value==="none")return null;if(R.type===18){var $=uc[R.name];if(typeof $=="undefined")throw new Error('Attempting to parse an unsupported transform function "'+R.name+'"');return $(R.values)}return null}},zl=function(U){var R=U.filter(function($){return $.type===17}).map(function($){return $.number});return R.length===6?R:null},Gc=function(U){var R=U.filter(function(fn){return fn.type===17}).map(function(fn){return fn.number}),$=R[0],K=R[1];R[2],R[3];var _e=R[4],et=R[5];R[6],R[7],R[8],R[9],R[10],R[11];var Ft=R[12],dn=R[13];return R[14],R[15],R.length===16?[$,K,_e,et,Ft,dn]:null},uc={matrix:zl,matrix3d:Gc},Bu={type:16,number:50,flags:Oe},cu=[Bu,Bu],qc={name:"transform-origin",initialValue:"50% 50%",prefix:!0,type:1,parse:function(U,R){var $=R.filter(Oo);return $.length!==2?cu:[$[0],$[1]]}},_l={name:"visible",initialValue:"none",prefix:!1,type:2,parse:function(U,R){switch(R){case"hidden":return 1;case"collapse":return 2;case"visible":default:return 0}}},Ho;(function(U){U.NORMAL="normal",U.BREAK_ALL="break-all",U.KEEP_ALL="keep-all"})(Ho||(Ho={}));for(var jl={name:"word-break",initialValue:"normal",prefix:!1,type:2,parse:function(U,R){switch(R){case"break-all":return Ho.BREAK_ALL;case"keep-all":return Ho.KEEP_ALL;case"normal":default:return Ho.NORMAL}}},Jc={name:"z-index",initialValue:"auto",prefix:!1,type:0,parse:function(U,R){if(R.type===20)return{auto:!0,order:0};if(Xl(R))return{auto:!1,order:R.number};throw new Error("Invalid z-index number parsed")}},eh={name:"time",parse:function(U,R){if(R.type===15)switch(R.unit.toLowerCase()){case"s":return 1e3*R.number;case"ms":return R.number}throw new Error("Unsupported time type")}},df={name:"opacity",initialValue:"1",type:0,prefix:!1,parse:function(U,R){return Xl(R)?R.number:1}},xh={name:"text-decoration-color",initialValue:"transparent",prefix:!1,type:3,format:"color"},MA={name:"text-decoration-line",initialValue:"none",prefix:!1,type:1,parse:function(U,R){return R.filter(Uo).map(function($){switch($.value){case"underline":return 1;case"overline":return 2;case"line-through":return 3;case"none":return 4}return 0}).filter(function($){return $!==0})}},yl={name:"font-family",initialValue:"",prefix:!1,type:1,parse:function(U,R){var $=[],K=[];return R.forEach(function(_e){switch(_e.type){case 20:case 0:$.push(_e.value);break;case 17:$.push(_e.number.toString());break;case 4:K.push($.join(" ")),$.length=0;break}}),$.length&&K.push($.join(" ")),K.map(function(_e){return _e.indexOf(" ")===-1?_e:"'"+_e+"'"})}},Nc={name:"font-size",initialValue:"0",prefix:!1,type:3,format:"length"},bh={name:"font-weight",initialValue:"normal",type:0,prefix:!1,parse:function(U,R){if(Xl(R))return R.number;if(Uo(R))switch(R.value){case"bold":return 700;case"normal":default:return 400}return 400}},Wf={name:"font-variant",initialValue:"none",type:1,prefix:!1,parse:function(U,R){return R.filter(Uo).map(function($){return $.value})}},_h={name:"font-style",initialValue:"normal",prefix:!1,type:2,parse:function(U,R){switch(R){case"oblique":return"oblique";case"italic":return"italic";case"normal":default:return"normal"}}},ol=function(U,R){return(U&R)!==0},Bl={name:"content",initialValue:"none",type:1,prefix:!1,parse:function(U,R){if(R.length===0)return[];var $=R[0];return $.type===20&&$.value==="none"?[]:R}},yd={name:"counter-increment",initialValue:"none",prefix:!0,type:1,parse:function(U,R){if(R.length===0)return null;var $=R[0];if($.type===20&&$.value==="none")return null;for(var K=[],_e=R.filter(gl),et=0;et<_e.length;et++){var Ft=_e[et],dn=_e[et+1];if(Ft.type===20){var fn=dn&&Xl(dn)?dn.number:1;K.push({counter:Ft.value,increment:fn})}}return K}},Co={name:"counter-reset",initialValue:"none",prefix:!0,type:1,parse:function(U,R){if(R.length===0)return[];for(var $=[],K=R.filter(gl),_e=0;_e<K.length;_e++){var et=K[_e],Ft=K[_e+1];if(Uo(et)&&et.value!=="none"){var dn=Ft&&Xl(Ft)?Ft.number:0;$.push({counter:et.value,reset:dn})}}return $}},vu={name:"duration",initialValue:"0s",prefix:!1,type:1,parse:function(U,R){return R.filter(Ul).map(function($){return eh.parse(U,$)})}},Gl={name:"quotes",initialValue:"none",prefix:!0,type:1,parse:function(U,R){if(R.length===0)return null;var $=R[0];if($.type===20&&$.value==="none")return null;var K=[],_e=R.filter(Ld);if(_e.length%2!==0)return null;for(var et=0;et<_e.length;et+=2){var Ft=_e[et].value,dn=_e[et+1].value;K.push({open:Ft,close:dn})}return K}},Ea=function(U,R,$){if(!U)return"";var K=U[Math.min(R,U.length-1)];return K?$?K.open:K.close:""},Rl={name:"box-shadow",initialValue:"none",type:1,prefix:!1,parse:function(U,R){return R.length===1&&Yc(R[0],"none")?[]:ml(R).map(function($){for(var K={color:255,offsetX:_o,offsetY:_o,blur:_o,spread:_o,inset:!1},_e=0,et=0;et<$.length;et++){var Ft=$[et];Yc(Ft,"inset")?K.inset=!0:mu(Ft)?(_e===0?K.offsetX=Ft:_e===1?K.offsetY=Ft:_e===2?K.blur=Ft:K.spread=Ft,_e++):K.color=bl.parse(U,Ft)}return K})}},Zf={name:"paint-order",initialValue:"normal",prefix:!1,type:1,parse:function(U,R){var $=[0,1,2],K=[];return R.filter(Uo).forEach(function(_e){switch(_e.value){case"stroke":K.push(1);break;case"fill":K.push(0);break;case"markers":K.push(2);break}}),$.forEach(function(_e){K.indexOf(_e)===-1&&K.push(_e)}),K}},ku={name:"-webkit-text-stroke-color",initialValue:"currentcolor",prefix:!1,type:3,format:"color"},Dh={name:"-webkit-text-stroke-width",initialValue:"0",type:0,prefix:!1,parse:function(U,R){return Ul(R)?R.number:0}},Vu=function(){function U(R,$){var K,_e;this.animationDuration=Wr(R,vu,$.animationDuration),this.backgroundClip=Wr(R,wA,$.backgroundClip),this.backgroundColor=Wr(R,Od,$.backgroundColor),this.backgroundImage=Wr(R,xr,$.backgroundImage),this.backgroundOrigin=Wr(R,Fr,$.backgroundOrigin),this.backgroundPosition=Wr(R,ri,$.backgroundPosition),this.backgroundRepeat=Wr(R,ai,$.backgroundRepeat),this.backgroundSize=Wr(R,rs,$.backgroundSize),this.borderTopColor=Wr(R,Ls,$.borderTopColor),this.borderRightColor=Wr(R,zi,$.borderRightColor),this.borderBottomColor=Wr(R,Ni,$.borderBottomColor),this.borderLeftColor=Wr(R,Ns,$.borderLeftColor),this.borderTopLeftRadius=Wr(R,_a,$.borderTopLeftRadius),this.borderTopRightRadius=Wr(R,Sa,$.borderTopRightRadius),this.borderBottomRightRadius=Wr(R,oe,$.borderBottomRightRadius),this.borderBottomLeftRadius=Wr(R,re,$.borderBottomLeftRadius),this.borderTopStyle=Wr(R,J,$.borderTopStyle),this.borderRightStyle=Wr(R,fe,$.borderRightStyle),this.borderBottomStyle=Wr(R,Te,$.borderBottomStyle),this.borderLeftStyle=Wr(R,De,$.borderLeftStyle),this.borderTopWidth=Wr(R,Xe,$.borderTopWidth),this.borderRightWidth=Wr(R,mt,$.borderRightWidth),this.borderBottomWidth=Wr(R,Kt,$.borderBottomWidth),this.borderLeftWidth=Wr(R,nn,$.borderLeftWidth),this.boxShadow=Wr(R,Rl,$.boxShadow),this.color=Wr(R,gn,$.color),this.direction=Wr(R,Nn,$.direction),this.display=Wr(R,$n,$.display),this.float=Wr(R,mr,$.cssFloat),this.fontFamily=Wr(R,yl,$.fontFamily),this.fontSize=Wr(R,Nc,$.fontSize),this.fontStyle=Wr(R,_h,$.fontStyle),this.fontVariant=Wr(R,Wf,$.fontVariant),this.fontWeight=Wr(R,bh,$.fontWeight),this.letterSpacing=Wr(R,ti,$.letterSpacing),this.lineBreak=Wr(R,ui,$.lineBreak),this.lineHeight=Wr(R,gi,$.lineHeight),this.listStyleImage=Wr(R,ts,$.listStyleImage),this.listStylePosition=Wr(R,fs,$.listStylePosition),this.listStyleType=Wr(R,Ds,$.listStyleType),this.marginTop=Wr(R,Ka,$.marginTop),this.marginRight=Wr(R,xo,$.marginRight),this.marginBottom=Wr(R,aa,$.marginBottom),this.marginLeft=Wr(R,di,$.marginLeft),this.opacity=Wr(R,df,$.opacity);var et=Wr(R,Ma,$.overflow);this.overflowX=et[0],this.overflowY=et[et.length>1?1:0],this.overflowWrap=Wr(R,Rs,$.overflowWrap),this.paddingTop=Wr(R,Jo,$.paddingTop),this.paddingRight=Wr(R,zs,$.paddingRight),this.paddingBottom=Wr(R,Ya,$.paddingBottom),this.paddingLeft=Wr(R,pa,$.paddingLeft),this.paintOrder=Wr(R,Zf,$.paintOrder),this.position=Wr(R,qa,$.position),this.textAlign=Wr(R,al,$.textAlign),this.textDecorationColor=Wr(R,xh,(K=$.textDecorationColor)!==null&&K!==void 0?K:$.color),this.textDecorationLine=Wr(R,MA,(_e=$.textDecorationLine)!==null&&_e!==void 0?_e:$.textDecoration),this.textShadow=Wr(R,Ua,$.textShadow),this.textTransform=Wr(R,dl,$.textTransform),this.transform=Wr(R,Sc,$.transform),this.transformOrigin=Wr(R,qc,$.transformOrigin),this.visibility=Wr(R,_l,$.visibility),this.webkitTextStrokeColor=Wr(R,ku,$.webkitTextStrokeColor),this.webkitTextStrokeWidth=Wr(R,Dh,$.webkitTextStrokeWidth),this.wordBreak=Wr(R,jl,$.wordBreak),this.zIndex=Wr(R,Jc,$.zIndex)}return U.prototype.isVisible=function(){return this.display>0&&this.opacity>0&&this.visibility===0},U.prototype.isTransparent=function(){return qo(this.backgroundColor)},U.prototype.isTransformed=function(){return this.transform!==null},U.prototype.isPositioned=function(){return this.position!==0},U.prototype.isPositionedWithZIndex=function(){return this.isPositioned()&&!this.zIndex.auto},U.prototype.isFloating=function(){return this.float!==0},U.prototype.isInlineLevel=function(){return ol(this.display,4)||ol(this.display,33554432)||ol(this.display,268435456)||ol(this.display,536870912)||ol(this.display,67108864)||ol(this.display,134217728)},U}(),EA=function(){function U(R,$){this.content=Wr(R,Bl,$.content),this.quotes=Wr(R,Gl,$.quotes)}return U}(),zu=function(){function U(R,$){this.counterIncrement=Wr(R,yd,$.counterIncrement),this.counterReset=Wr(R,Co,$.counterReset)}return U}(),Wr=function(U,R,$){var K=new Cu,_e=$!==null&&typeof $!="undefined"?$.toString():R.initialValue;K.write(_e);var et=new zc(K.read());switch(R.type){case 2:var Ft=et.parseComponentValue();return R.parse(U,Uo(Ft)?Ft.value:R.initialValue);case 0:return R.parse(U,et.parseComponentValue());case 1:return R.parse(U,et.parseComponentValues());case 4:return et.parseComponentValue();case 3:switch(R.format){case"angle":return Lr.parse(U,et.parseComponentValue());case"color":return bl.parse(U,et.parseComponentValue());case"image":return hr.parse(U,et.parseComponentValue());case"length":var dn=et.parseComponentValue();return mu(dn)?dn:_o;case"length-percentage":var fn=et.parseComponentValue();return Oo(fn)?fn:_o;case"time":return eh.parse(U,et.parseComponentValue())}break}},Hc="data-html2canvas-debug",yu=function(U){var R=U.getAttribute(Hc);switch(R){case"all":return 1;case"clone":return 2;case"parse":return 3;case"render":return 4;default:return 0}},Hl=function(U,R){var $=yu(U);return $===1||R===$},Yl=function(){function U(R,$){if(this.context=R,this.textNodes=[],this.elements=[],this.flags=0,Hl($,3))debugger;this.styles=new Vu(R,window.getComputedStyle($,null)),wf($)&&(this.styles.animationDuration.some(function(K){return K>0})&&($.style.animationDuration="0s"),this.styles.transform!==null&&($.style.transform="none")),this.bounds=F(this.context,$),Hl($,4)&&(this.flags|=16)}return U}(),Ql="AAAAAAAAAAAAEA4AGBkAAFAaAAACAAAAAAAIABAAGAAwADgACAAQAAgAEAAIABAACAAQAAgAEAAIABAACAAQAAgAEAAIABAAQABIAEQATAAIABAACAAQAAgAEAAIABAAVABcAAgAEAAIABAACAAQAGAAaABwAHgAgACIAI4AlgAIABAAmwCjAKgAsAC2AL4AvQDFAMoA0gBPAVYBWgEIAAgACACMANoAYgFkAWwBdAF8AX0BhQGNAZUBlgGeAaMBlQGWAasBswF8AbsBwwF0AcsBYwHTAQgA2wG/AOMBdAF8AekB8QF0AfkB+wHiAHQBfAEIAAMC5gQIAAsCEgIIAAgAFgIeAggAIgIpAggAMQI5AkACygEIAAgASAJQAlgCYAIIAAgACAAKBQoFCgUTBRMFGQUrBSsFCAAIAAgACAAIAAgACAAIAAgACABdAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABoAmgCrwGvAQgAbgJ2AggAHgEIAAgACADnAXsCCAAIAAgAgwIIAAgACAAIAAgACACKAggAkQKZAggAPADJAAgAoQKkAqwCsgK6AsICCADJAggA0AIIAAgACAAIANYC3gIIAAgACAAIAAgACABAAOYCCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAkASoB+QIEAAgACAA8AEMCCABCBQgACABJBVAFCAAIAAgACAAIAAgACAAIAAgACABTBVoFCAAIAFoFCABfBWUFCAAIAAgACAAIAAgAbQUIAAgACAAIAAgACABzBXsFfQWFBYoFigWKBZEFigWKBYoFmAWfBaYFrgWxBbkFCAAIAAgACAAIAAgACAAIAAgACAAIAMEFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAMgFCADQBQgACAAIAAgACAAIAAgACAAIAAgACAAIAO4CCAAIAAgAiQAIAAgACABAAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAD0AggACAD8AggACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIANYFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAMDvwAIAAgAJAIIAAgACAAIAAgACAAIAAgACwMTAwgACAB9BOsEGwMjAwgAKwMyAwsFYgE3A/MEPwMIAEUDTQNRAwgAWQOsAGEDCAAIAAgACAAIAAgACABpAzQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFIQUoBSwFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABtAwgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABMAEwACAAIAAgACAAIABgACAAIAAgACAC/AAgACAAyAQgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACACAAIAAwAAgACAAIAAgACAAIAAgACAAIAAAARABIAAgACAAIABQASAAIAAgAIABwAEAAjgCIABsAqAC2AL0AigDQAtwC+IJIQqVAZUBWQqVAZUBlQGVAZUBlQGrC5UBlQGVAZUBlQGVAZUBlQGVAXsKlQGVAbAK6wsrDGUMpQzlDJUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAfAKAAuZA64AtwCJALoC6ADwAAgAuACgA/oEpgO6AqsD+AAIAAgAswMIAAgACAAIAIkAuwP5AfsBwwPLAwgACAAIAAgACADRA9kDCAAIAOED6QMIAAgACAAIAAgACADuA/YDCAAIAP4DyQAIAAgABgQIAAgAXQAOBAgACAAIAAgACAAIABMECAAIAAgACAAIAAgACAD8AAQBCAAIAAgAGgQiBCoECAExBAgAEAEIAAgACAAIAAgACAAIAAgACAAIAAgACAA4BAgACABABEYECAAIAAgATAQYAQgAVAQIAAgACAAIAAgACAAIAAgACAAIAFoECAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAOQEIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAB+BAcACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAEABhgSMBAgACAAIAAgAlAQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAwAEAAQABAADAAMAAwADAAQABAAEAAQABAAEAAQABHATAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAdQMIAAgACAAIAAgACAAIAMkACAAIAAgAfQMIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACACFA4kDCAAIAAgACAAIAOcBCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAIcDCAAIAAgACAAIAAgACAAIAAgACAAIAJEDCAAIAAgACADFAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABgBAgAZgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAbAQCBXIECAAIAHkECAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABAAJwEQACjBKoEsgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAC6BMIECAAIAAgACAAIAAgACABmBAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAxwQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAGYECAAIAAgAzgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAigWKBYoFigWKBYoFigWKBd0FXwUIAOIF6gXxBYoF3gT5BQAGCAaKBYoFigWKBYoFigWKBYoFigWKBYoFigXWBIoFigWKBYoFigWKBYoFigWKBYsFEAaKBYoFigWKBYoFigWKBRQGCACKBYoFigWKBQgACAAIANEECAAIABgGigUgBggAJgYIAC4GMwaKBYoF0wQ3Bj4GigWKBYoFigWKBYoFigWKBYoFigWKBYoFigUIAAgACAAIAAgACAAIAAgAigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWLBf///////wQABAAEAAQABAAEAAQABAAEAAQAAwAEAAQAAgAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAQADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAUAAAAFAAUAAAAFAAUAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUAAQAAAAUABQAFAAUABQAFAAAAAAAFAAUAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAFAAUAAQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUABQAFAAAABwAHAAcAAAAHAAcABwAFAAEAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAcABwAFAAUAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAAAAQABAAAAAAAAAAAAAAAFAAUABQAFAAAABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABwAHAAcAAAAHAAcAAAAAAAUABQAHAAUAAQAHAAEABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABwABAAUABQAFAAUAAAAAAAAAAAAAAAEAAQABAAEAAQABAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABQANAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEAAQABAAEAAQABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAABQAHAAUABQAFAAAAAAAAAAcABQAFAAUABQAFAAQABAAEAAQABAAEAAQABAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUAAAAFAAUABQAFAAUAAAAFAAUABQAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAAAAAAAAAAAAUABQAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAUAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABwAHAAcABwAFAAcABwAAAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAUABwAHAAUABQAFAAUAAAAAAAcABwAAAAAABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAABQAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAABwAHAAcABQAFAAAAAAAAAAAABQAFAAAAAAAFAAUABQAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAFAAUABQAFAAUAAAAFAAUABwAAAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAFAAUABwAFAAUABQAFAAAAAAAHAAcAAAAAAAcABwAFAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABwAAAAAAAAAHAAcABwAAAAcABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAABQAHAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAcABwAAAAUABQAFAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABQAHAAcABQAHAAcAAAAFAAcABwAAAAcABwAFAAUAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAFAAcABwAFAAUABQAAAAUAAAAHAAcABwAHAAcABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAHAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAABwAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAUAAAAFAAAAAAAAAAAABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUABQAFAAUAAAAFAAUAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABwAFAAUABQAFAAUABQAAAAUABQAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABQAFAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABQAFAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAHAAUABQAFAAUABQAFAAUABwAHAAcABwAHAAcABwAHAAUABwAHAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABwAHAAcABwAFAAUABwAHAAcAAAAAAAAAAAAHAAcABQAHAAcABwAHAAcABwAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAHAAUABQAFAAUABQAFAAUAAAAFAAAABQAAAAAABQAFAAUABQAFAAUABQAFAAcABwAHAAcABwAHAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAUABQAFAAUABQAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABwAFAAcABwAHAAcABwAFAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAUABQAFAAUABwAHAAUABQAHAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABQAFAAcABwAHAAUABwAFAAUABQAHAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAUABQAFAAUABQAFAAUABQAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAcABQAFAAUABQAFAAUABQAAAAAAAAAAAAUAAAAAAAAAAAAAAAAABQAAAAAABwAFAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUAAAAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAABQAAAAAAAAAFAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAUABQAHAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAHAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABwAFAAUABQAFAAcABwAFAAUABwAHAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAcABwAFAAUABwAHAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAFAAUABQAAAAAABQAFAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAFAAcABwAAAAAAAAAAAAAABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAFAAcABwAFAAcABwAAAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAFAAUABQAAAAUABQAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABwAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABQAFAAUABQAFAAUABQAFAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAHAAcABQAHAAUABQAAAAAAAAAAAAAAAAAFAAAABwAHAAcABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAcABwAAAAAABwAHAAAAAAAHAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABwAHAAUABQAFAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABQAFAAUABQAFAAUABwAFAAcABwAFAAcABQAFAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABQAFAAUABQAAAAAABwAHAAcABwAFAAUABwAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAHAAUABQAFAAUABQAFAAUABQAHAAcABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAFAAcABwAFAAUABQAFAAUABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAcABwAFAAUABQAFAAcABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABQAHAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAAAAAAFAAUABwAHAAcABwAFAAAAAAAAAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABwAHAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAHAAUABQAFAAUABQAFAAUABwAFAAUABwAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAAAAAAAABQAAAAUABQAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAHAAcAAAAFAAUAAAAHAAcABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAAAAAAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAUABQAFAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAABQAFAAUABQAFAAUABQAAAAUABQAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAFAAUABQAFAAUADgAOAA4ADgAOAA4ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAAAAAAAAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAMAAwADAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkAAAAAAAAAAAAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAAAAAAAAAAAAsADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwACwAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAADgAOAA4AAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAAAA4ADgAOAA4ADgAOAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAA4AAAAOAAAAAAAAAAAAAAAAAA4AAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAADgAAAAAAAAAAAA4AAAAOAAAAAAAAAAAADgAOAA4AAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAAAAA4ADgAOAA4ADgAOAA4ADgAOAAAADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4AAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAOAA4ADgAOAA4ADgAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAAAAAAA=",Km="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Ol=typeof Uint8Array=="undefined"?[]:new Uint8Array(256),Kf=0;Kf<Km.length;Kf++)Ol[Km.charCodeAt(Kf)]=Kf;for(var Zv=function(U){var R=U.length*.75,$=U.length,K,_e=0,et,Ft,dn,fn;U[U.length-1]==="="&&(R--,U[U.length-2]==="="&&R--);var Ar=typeof ArrayBuffer!="undefined"&&typeof Uint8Array!="undefined"&&typeof Uint8Array.prototype.slice!="undefined"?new ArrayBuffer(R):new Array(R),ur=Array.isArray(Ar)?Ar:new Uint8Array(Ar);for(K=0;K<$;K+=4)et=Ol[U.charCodeAt(K)],Ft=Ol[U.charCodeAt(K+1)],dn=Ol[U.charCodeAt(K+2)],fn=Ol[U.charCodeAt(K+3)],ur[_e++]=et<<2|Ft>>4,ur[_e++]=(Ft&15)<<4|dn>>2,ur[_e++]=(dn&3)<<6|fn&63;return Ar},ql=function(U){for(var R=U.length,$=[],K=0;K<R;K+=2)$.push(U[K+1]<<8|U[K]);return $},Rp=function(U){for(var R=U.length,$=[],K=0;K<R;K+=4)$.push(U[K+3]<<24|U[K+2]<<16|U[K+1]<<8|U[K]);return $},$f=5,wl=11,ha=2,$m=wl-$f,kh=65536>>$f,lm=1<<$f,qh=lm-1,th=1024>>$f,ff=kh+th,Yu=ff,Ui=32,Fc=Yu+Ui,Gu=65536>>wl,CA=1<<$m,Xf=CA-1,cc=function(U,R,$){return U.slice?U.slice(R,$):new Uint16Array(Array.prototype.slice.call(U,R,$))},Vd=function(U,R,$){return U.slice?U.slice(R,$):new Uint32Array(Array.prototype.slice.call(U,R,$))},Ru=function(U,R){var $=Zv(U),K=Array.isArray($)?Rp($):new Uint32Array($),_e=Array.isArray($)?ql($):new Uint16Array($),et=24,Ft=cc(_e,et/2,K[4]/2),dn=K[5]===2?cc(_e,(et+K[4])/2):Vd(K,Math.ceil((et+K[4])/4));return new ka(K[0],K[1],K[2],K[3],Ft,dn)},ka=function(){function U(R,$,K,_e,et,Ft){this.initialValue=R,this.errorValue=$,this.highStart=K,this.highValueIndex=_e,this.index=et,this.data=Ft}return U.prototype.get=function(R){var $;if(R>=0){if(R<55296||R>56319&&R<=65535)return $=this.index[R>>$f],$=($<<ha)+(R&qh),this.data[$];if(R<=65535)return $=this.index[kh+(R-55296>>$f)],$=($<<ha)+(R&qh),this.data[$];if(R<this.highStart)return $=Fc-Gu+(R>>wl),$=this.index[$],$+=R>>$f&Xf,$=this.index[$],$=($<<ha)+(R&qh),this.data[$];if(R<=1114111)return this.data[this.highValueIndex]}return this.errorValue},U}(),Af="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Sl=typeof Uint8Array=="undefined"?[]:new Uint8Array(256),xd=0;xd<Af.length;xd++)Sl[Af.charCodeAt(xd)]=xd;var zd=1,TA=2,Gd=3,Hd=4,pf=5,Ip=7,_g=8,ip=9,Il=10,um=11,sp=12,bd=13,jf=14,Jl=15,cm=function(U){for(var R=[],$=0,K=U.length;$<K;){var _e=U.charCodeAt($++);if(_e>=55296&&_e<=56319&&$<K){var et=U.charCodeAt($++);(et&64512)===56320?R.push(((_e&1023)<<10)+(et&1023)+65536):(R.push(_e),$--)}else R.push(_e)}return R},wg=function(){for(var U=[],R=0;R<arguments.length;R++)U[R]=arguments[R];if(String.fromCodePoint)return String.fromCodePoint.apply(String,U);var $=U.length;if(!$)return"";for(var K=[],_e=-1,et="";++_e<$;){var Ft=U[_e];Ft<=65535?K.push(Ft):(Ft-=65536,K.push((Ft>>10)+55296,Ft%1024+56320)),(_e+1===$||K.length>16384)&&(et+=String.fromCharCode.apply(String,K),K.length=0)}return et},Vh=Ru(Ql),Pc="\xD7",Jh="\xF7",nh=function(U){return Vh.get(U)},Qd=function(U,R,$){var K=$-2,_e=R[K],et=R[$-1],Ft=R[$];if(et===TA&&Ft===Gd)return Pc;if(et===TA||et===Gd||et===Hd||Ft===TA||Ft===Gd||Ft===Hd)return Jh;if(et===_g&&[_g,ip,um,sp].indexOf(Ft)!==-1||(et===um||et===ip)&&(Ft===ip||Ft===Il)||(et===sp||et===Il)&&Ft===Il||Ft===bd||Ft===pf||Ft===Ip||et===zd)return Pc;if(et===bd&&Ft===jf){for(;_e===pf;)_e=R[--K];if(_e===jf)return Pc}if(et===Jl&&Ft===Jl){for(var dn=0;_e===Jl;)dn++,_e=R[--K];if(dn%2===0)return Pc}return Jh},Wd=function(U){var R=cm(U),$=R.length,K=0,_e=0,et=R.map(nh);return{next:function(){if(K>=$)return{done:!0,value:null};for(var Ft=Pc;K<$&&(Ft=Qd(R,et,++K))===Pc;);if(Ft!==Pc||K===$){var dn=wg.apply(null,R.slice(_e,K));return _e=K,{value:dn,done:!1}}return{done:!0,value:null}}}},xu=function(U){for(var R=Wd(U),$=[],K;!(K=R.next()).done;)K.value&&$.push(K.value.slice());return $},Sg=function(U){var R=123;if(U.createRange){var $=U.createRange();if($.getBoundingClientRect){var K=U.createElement("boundtest");K.style.height=R+"px",K.style.display="block",U.body.appendChild(K),$.selectNode(K);var _e=$.getBoundingClientRect(),et=Math.round(_e.height);if(U.body.removeChild(K),et===R)return!0}}return!1},vo=function(U){var R=U.createElement("boundtest");R.style.width="50px",R.style.display="block",R.style.fontSize="12px",R.style.letterSpacing="0px",R.style.wordSpacing="0px",U.body.appendChild(R);var $=U.createRange();R.innerHTML=typeof"".repeat=="function"?"&#128104;".repeat(10):"";var K=R.firstChild,_e=P(K.data).map(function(fn){return H(fn)}),et=0,Ft={},dn=_e.every(function(fn,Ar){$.setStart(K,et),$.setEnd(K,et+fn.length);var ur=$.getBoundingClientRect();et+=fn.length;var Ir=ur.x>Ft.x||ur.y>Ft.y;return Ft=ur,Ar===0?!0:Ir});return U.body.removeChild(R),dn},gf=function(){return typeof new Image().crossOrigin!="undefined"},mf=function(){return typeof new XMLHttpRequest().responseType=="string"},Np=function(U){var R=new Image,$=U.createElement("canvas"),K=$.getContext("2d");if(!K)return!1;R.src="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg'></svg>";try{K.drawImage(R,0,0),$.toDataURL()}catch(_e){return!1}return!0},rh=function(U){return U[0]===0&&U[1]===255&&U[2]===0&&U[3]===255},Mc=function(U){var R=U.createElement("canvas"),$=100;R.width=$,R.height=$;var K=R.getContext("2d");if(!K)return Promise.reject(!1);K.fillStyle="rgb(0, 255, 0)",K.fillRect(0,0,$,$);var _e=new Image,et=R.toDataURL();_e.src=et;var Ft=ih($,$,0,0,_e);return K.fillStyle="red",K.fillRect(0,0,$,$),Fp(Ft).then(function(dn){K.drawImage(dn,0,0);var fn=K.getImageData(0,0,$,$).data;K.fillStyle="red",K.fillRect(0,0,$,$);var Ar=U.createElement("div");return Ar.style.backgroundImage="url("+et+")",Ar.style.height=$+"px",rh(fn)?Fp(ih($,$,0,0,Ar)):Promise.reject(!1)}).then(function(dn){return K.drawImage(dn,0,0),rh(K.getImageData(0,0,$,$).data)}).catch(function(){return!1})},ih=function(U,R,$,K,_e){var et="http://www.w3.org/2000/svg",Ft=document.createElementNS(et,"svg"),dn=document.createElementNS(et,"foreignObject");return Ft.setAttributeNS(null,"width",U.toString()),Ft.setAttributeNS(null,"height",R.toString()),dn.setAttributeNS(null,"width","100%"),dn.setAttributeNS(null,"height","100%"),dn.setAttributeNS(null,"x",$.toString()),dn.setAttributeNS(null,"y",K.toString()),dn.setAttributeNS(null,"externalResourcesRequired","true"),Ft.appendChild(dn),dn.appendChild(_e),Ft},Fp=function(U){return new Promise(function(R,$){var K=new Image;K.onload=function(){return R(K)},K.onerror=$,K.src="data:image/svg+xml;charset=utf-8,"+encodeURIComponent(new XMLSerializer().serializeToString(U))})},Ra={get SUPPORT_RANGE_BOUNDS(){var U=Sg(document);return Object.defineProperty(Ra,"SUPPORT_RANGE_BOUNDS",{value:U}),U},get SUPPORT_WORD_BREAKING(){var U=Ra.SUPPORT_RANGE_BOUNDS&&vo(document);return Object.defineProperty(Ra,"SUPPORT_WORD_BREAKING",{value:U}),U},get SUPPORT_SVG_DRAWING(){var U=Np(document);return Object.defineProperty(Ra,"SUPPORT_SVG_DRAWING",{value:U}),U},get SUPPORT_FOREIGNOBJECT_DRAWING(){var U=typeof Array.from=="function"&&typeof window.fetch=="function"?Mc(document):Promise.resolve(!1);return Object.defineProperty(Ra,"SUPPORT_FOREIGNOBJECT_DRAWING",{value:U}),U},get SUPPORT_CORS_IMAGES(){var U=gf();return Object.defineProperty(Ra,"SUPPORT_CORS_IMAGES",{value:U}),U},get SUPPORT_RESPONSE_TYPE(){var U=mf();return Object.defineProperty(Ra,"SUPPORT_RESPONSE_TYPE",{value:U}),U},get SUPPORT_CORS_XHR(){var U="withCredentials"in new XMLHttpRequest;return Object.defineProperty(Ra,"SUPPORT_CORS_XHR",{value:U}),U},get SUPPORT_NATIVE_TEXT_SEGMENTATION(){var U=!!(typeof Intl!="undefined"&&Intl.Segmenter);return Object.defineProperty(Ra,"SUPPORT_NATIVE_TEXT_SEGMENTATION",{value:U}),U}},Hu=function(){function U(R,$){this.text=R,this.bounds=$}return U}(),vf=function(U,R,$,K){var _e=BA(R,$),et=[],Ft=0;return _e.forEach(function(dn){if($.textDecorationLine.length||dn.trim().length>0)if(Ra.SUPPORT_RANGE_BOUNDS){var fn=wh(K,Ft,dn.length).getClientRects();if(fn.length>1){var Ar=Iu(dn),ur=0;Ar.forEach(function(fi){et.push(new Hu(fi,E.fromDOMRectList(U,wh(K,ur+Ft,fi.length).getClientRects()))),ur+=fi.length})}else et.push(new Hu(dn,E.fromDOMRectList(U,fn)))}else{var Ir=K.splitText(dn.length);et.push(new Hu(dn,_d(U,K))),K=Ir}else Ra.SUPPORT_RANGE_BOUNDS||(K=K.splitText(dn.length));Ft+=dn.length}),et},_d=function(U,R){var $=R.ownerDocument;if($){var K=$.createElement("html2canvaswrapper");K.appendChild(R.cloneNode(!0));var _e=R.parentNode;if(_e){_e.replaceChild(K,R);var et=F(U,K);return K.firstChild&&_e.replaceChild(K.firstChild,K),et}}return E.EMPTY},wh=function(U,R,$){var K=U.ownerDocument;if(!K)throw new Error("Node has no owner document");var _e=K.createRange();return _e.setStart(U,R),_e.setEnd(U,R+$),_e},Iu=function(U){if(Ra.SUPPORT_NATIVE_TEXT_SEGMENTATION){var R=new Intl.Segmenter(void 0,{granularity:"grapheme"});return Array.from(R.segment(U)).map(function($){return $.segment})}return xu(U)},yf=function(U,R){if(Ra.SUPPORT_NATIVE_TEXT_SEGMENTATION){var $=new Intl.Segmenter(void 0,{granularity:"word"});return Array.from($.segment(U)).map(function(K){return K.segment})}return xf(U,R)},BA=function(U,R){return R.letterSpacing!==0?Iu(U):yf(U,R)},Lc=[32,160,4961,65792,65793,4153,4241],xf=function(U,R){for(var $=At(U,{lineBreak:R.lineBreak,wordBreak:R.overflowWrap==="break-word"?"break-word":R.wordBreak}),K=[],_e,et=function(){if(_e.value){var Ft=_e.value.slice(),dn=P(Ft),fn="";dn.forEach(function(Ar){Lc.indexOf(Ar)===-1?fn+=H(Ar):(fn.length&&K.push(fn),K.push(H(Ar)),fn="")}),fn.length&&K.push(fn)}};!(_e=$.next()).done;)et();return K},Sh=function(){function U(R,$,K){this.text=bf($.data,K.textTransform),this.textBounds=vf(R,this.text,K,$)}return U}(),bf=function(U,R){switch(R){case 1:return U.toLowerCase();case 3:return U.replace(Yf,RA);case 2:return U.toUpperCase();default:return U}},Yf=/(^|\s|:|-|\(|\))([a-z])/g,RA=function(U,R,$){return U.length>0?R+$.toUpperCase():U},wd=function(U){b(R,U);function R($,K){var _e=U.call(this,$,K)||this;return _e.src=K.currentSrc||K.src,_e.intrinsicWidth=K.naturalWidth,_e.intrinsicHeight=K.naturalHeight,_e.context.cache.addImage(_e.src),_e}return R}(Yl),sh=function(U){b(R,U);function R($,K){var _e=U.call(this,$,K)||this;return _e.canvas=K,_e.intrinsicWidth=K.width,_e.intrinsicHeight=K.height,_e}return R}(Yl),Sd=function(U){b(R,U);function R($,K){var _e=U.call(this,$,K)||this,et=new XMLSerializer,Ft=F($,K);return K.setAttribute("width",Ft.width+"px"),K.setAttribute("height",Ft.height+"px"),_e.svg="data:image/svg+xml,"+encodeURIComponent(et.serializeToString(K)),_e.intrinsicWidth=K.width.baseVal.value,_e.intrinsicHeight=K.height.baseVal.value,_e.context.cache.addImage(_e.svg),_e}return R}(Yl),IA=function(U){b(R,U);function R($,K){var _e=U.call(this,$,K)||this;return _e.value=K.value,_e}return R}(Yl),NA=function(U){b(R,U);function R($,K){var _e=U.call(this,$,K)||this;return _e.start=K.start,_e.reversed=typeof K.reversed=="boolean"&&K.reversed===!0,_e}return R}(Yl),qf=[{type:15,flags:0,unit:"px",number:3}],Mg=[{type:16,flags:0,number:50}],hm=function(U){return U.width>U.height?new E(U.left+(U.width-U.height)/2,U.top,U.height,U.height):U.width<U.height?new E(U.left,U.top+(U.height-U.width)/2,U.width,U.width):U},ed=function(U){var R=U.type===dm?new Array(U.value.length+1).join("\u2022"):U.value;return R.length===0?U.placeholder||"":R},td="checkbox",Jf="radio",dm="password",ap=707406591,Pp=function(U){b(R,U);function R($,K){var _e=U.call(this,$,K)||this;switch(_e.type=K.type.toLowerCase(),_e.checked=K.checked,_e.value=ed(K),(_e.type===td||_e.type===Jf)&&(_e.styles.backgroundColor=3739148031,_e.styles.borderTopColor=_e.styles.borderRightColor=_e.styles.borderBottomColor=_e.styles.borderLeftColor=2779096575,_e.styles.borderTopWidth=_e.styles.borderRightWidth=_e.styles.borderBottomWidth=_e.styles.borderLeftWidth=1,_e.styles.borderTopStyle=_e.styles.borderRightStyle=_e.styles.borderBottomStyle=_e.styles.borderLeftStyle=1,_e.styles.backgroundClip=[0],_e.styles.backgroundOrigin=[0],_e.bounds=hm(_e.bounds)),_e.type){case td:_e.styles.borderTopRightRadius=_e.styles.borderTopLeftRadius=_e.styles.borderBottomRightRadius=_e.styles.borderBottomLeftRadius=qf;break;case Jf:_e.styles.borderTopRightRadius=_e.styles.borderTopLeftRadius=_e.styles.borderBottomRightRadius=_e.styles.borderBottomLeftRadius=Mg;break}return _e}return R}(Yl),Lp=function(U){b(R,U);function R($,K){var _e=U.call(this,$,K)||this,et=K.options[K.selectedIndex||0];return _e.value=et&&et.text||"",_e}return R}(Yl),Md=function(U){b(R,U);function R($,K){var _e=U.call(this,$,K)||this;return _e.value=K.value,_e}return R}(Yl),Up=function(U){b(R,U);function R($,K){var _e=U.call(this,$,K)||this;_e.src=K.src,_e.width=parseInt(K.width,10)||0,_e.height=parseInt(K.height,10)||0,_e.backgroundColor=_e.styles.backgroundColor;try{if(K.contentWindow&&K.contentWindow.document&&K.contentWindow.document.documentElement){_e.tree=Zd($,K.contentWindow.document.documentElement);var et=K.contentWindow.document.documentElement?Xh($,getComputedStyle(K.contentWindow.document.documentElement).backgroundColor):lc.TRANSPARENT,Ft=K.contentWindow.document.body?Xh($,getComputedStyle(K.contentWindow.document.body).backgroundColor):lc.TRANSPARENT;_e.backgroundColor=qo(et)?qo(Ft)?_e.styles.backgroundColor:Ft:et}}catch(dn){}return _e}return R}(Yl),Op=["OL","UL","MENU"],_f=function(U,R,$,K){for(var _e=R.firstChild,et=void 0;_e;_e=et)if(et=_e.nextSibling,ah(_e)&&_e.data.trim().length>0)$.textNodes.push(new Sh(U,_e,$.styles));else if(tA(_e))if(fm(_e)&&_e.assignedNodes)_e.assignedNodes().forEach(function(dn){return _f(U,dn,$,K)});else{var Ft=eA(U,_e);Ft.styles.isVisible()&&(Oi(_e,Ft,K)?Ft.flags|=4:op(Ft.styles)&&(Ft.flags|=2),Op.indexOf(_e.tagName)!==-1&&(Ft.flags|=8),$.elements.push(Ft),_e.slot,_e.shadowRoot?_f(U,_e.shadowRoot,Ft,K):!Ec(_e)&&!Do(_e)&&!zh(_e)&&_f(U,_e,Ft,K))}},eA=function(U,R){return lp(R)?new wd(U,R):Qc(R)?new sh(U,R):Do(R)?new Sd(U,R):Mh(R)?new IA(U,R):Ed(R)?new NA(U,R):Eg(R)?new Pp(U,R):zh(R)?new Lp(U,R):Ec(R)?new Md(U,R):wo(R)?new Up(U,R):new Yl(U,R)},Zd=function(U,R){var $=eA(U,R);return $.flags|=4,_f(U,R,$,$),$},Oi=function(U,R,$){return R.styles.isPositionedWithZIndex()||R.styles.opacity<1||R.styles.isTransformed()||$d(U)&&$.styles.isTransparent()},op=function(U){return U.isPositioned()||U.isFloating()},ah=function(U){return U.nodeType===Node.TEXT_NODE},tA=function(U){return U.nodeType===Node.ELEMENT_NODE},wf=function(U){return tA(U)&&typeof U.style!="undefined"&&!Kd(U)},Kd=function(U){return typeof U.className=="object"},Mh=function(U){return U.tagName==="LI"},Ed=function(U){return U.tagName==="OL"},Eg=function(U){return U.tagName==="INPUT"},Dp=function(U){return U.tagName==="HTML"},Do=function(U){return U.tagName==="svg"},$d=function(U){return U.tagName==="BODY"},Qc=function(U){return U.tagName==="CANVAS"},Eh=function(U){return U.tagName==="VIDEO"},lp=function(U){return U.tagName==="IMG"},wo=function(U){return U.tagName==="IFRAME"},Ch=function(U){return U.tagName==="STYLE"},Cg=function(U){return U.tagName==="SCRIPT"},Ec=function(U){return U.tagName==="TEXTAREA"},zh=function(U){return U.tagName==="SELECT"},fm=function(U){return U.tagName==="SLOT"},Xd=function(U){return U.tagName.indexOf("-")>0},qu=function(){function U(){this.counters={}}return U.prototype.getCounterValue=function(R){var $=this.counters[R];return $&&$.length?$[$.length-1]:1},U.prototype.getCounterValues=function(R){var $=this.counters[R];return $||[]},U.prototype.pop=function(R){var $=this;R.forEach(function(K){return $.counters[K].pop()})},U.prototype.parse=function(R){var $=this,K=R.counterIncrement,_e=R.counterReset,et=!0;K!==null&&K.forEach(function(dn){var fn=$.counters[dn.counter];fn&&dn.increment!==0&&(et=!1,fn.length||fn.push(1),fn[Math.max(0,fn.length-1)]+=dn.increment)});var Ft=[];return et&&_e.forEach(function(dn){var fn=$.counters[dn.counter];Ft.push(dn.counter),fn||(fn=$.counters[dn.counter]=[]),fn.push(dn.reset)}),Ft},U}(),Th={integers:[1e3,900,500,400,100,90,50,40,10,9,5,4,1],values:["M","CM","D","CD","C","XC","L","XL","X","IX","V","IV","I"]},oh={integers:[9e3,8e3,7e3,6e3,5e3,4e3,3e3,2e3,1e3,900,800,700,600,500,400,300,200,100,90,80,70,60,50,40,30,20,10,9,8,7,6,5,4,3,2,1],values:["\u0554","\u0553","\u0552","\u0551","\u0550","\u054F","\u054E","\u054D","\u054C","\u054B","\u054A","\u0549","\u0548","\u0547","\u0546","\u0545","\u0544","\u0543","\u0542","\u0541","\u0540","\u053F","\u053E","\u053D","\u053C","\u053B","\u053A","\u0539","\u0538","\u0537","\u0536","\u0535","\u0534","\u0533","\u0532","\u0531"]},kp={integers:[1e4,9e3,8e3,7e3,6e3,5e3,4e3,3e3,2e3,1e3,400,300,200,100,90,80,70,60,50,40,30,20,19,18,17,16,15,10,9,8,7,6,5,4,3,2,1],values:["\u05D9\u05F3","\u05D8\u05F3","\u05D7\u05F3","\u05D6\u05F3","\u05D5\u05F3","\u05D4\u05F3","\u05D3\u05F3","\u05D2\u05F3","\u05D1\u05F3","\u05D0\u05F3","\u05EA","\u05E9","\u05E8","\u05E7","\u05E6","\u05E4","\u05E2","\u05E1","\u05E0","\u05DE","\u05DC","\u05DB","\u05D9\u05D8","\u05D9\u05D7","\u05D9\u05D6","\u05D8\u05D6","\u05D8\u05D5","\u05D9","\u05D8","\u05D7","\u05D6","\u05D5","\u05D4","\u05D3","\u05D2","\u05D1","\u05D0"]},Sf={integers:[1e4,9e3,8e3,7e3,6e3,5e3,4e3,3e3,2e3,1e3,900,800,700,600,500,400,300,200,100,90,80,70,60,50,40,30,20,10,9,8,7,6,5,4,3,2,1],values:["\u10F5","\u10F0","\u10EF","\u10F4","\u10EE","\u10ED","\u10EC","\u10EB","\u10EA","\u10E9","\u10E8","\u10E7","\u10E6","\u10E5","\u10E4","\u10F3","\u10E2","\u10E1","\u10E0","\u10DF","\u10DE","\u10DD","\u10F2","\u10DC","\u10DB","\u10DA","\u10D9","\u10D8","\u10D7","\u10F1","\u10D6","\u10D5","\u10D4","\u10D3","\u10D2","\u10D1","\u10D0"]},Gh=function(U,R,$,K,_e,et){return U<R||U>$?_u(U,_e,et.length>0):K.integers.reduce(function(Ft,dn,fn){for(;U>=dn;)U-=dn,Ft+=K.values[fn];return Ft},"")+et},Mf=function(U,R,$,K){var _e="";do $||U--,_e=K(U)+_e,U/=R;while(U*R>=R);return _e},bu=function(U,R,$,K,_e){var et=$-R+1;return(U<0?"-":"")+(Mf(Math.abs(U),et,K,function(Ft){return H(Math.floor(Ft%et)+R)})+_e)},eu=function(U,R,$){$===void 0&&($=". ");var K=R.length;return Mf(Math.abs(U),K,!1,function(_e){return R[Math.floor(_e%K)]})+$},Ef=1,Dl=2,Bh=4,Cf=8,tu=function(U,R,$,K,_e,et){if(U<-9999||U>9999)return _u(U,4,_e.length>0);var Ft=Math.abs(U),dn=_e;if(Ft===0)return R[0]+dn;for(var fn=0;Ft>0&&fn<=4;fn++){var Ar=Ft%10;Ar===0&&ol(et,Ef)&&dn!==""?dn=R[Ar]+dn:Ar>1||Ar===1&&fn===0||Ar===1&&fn===1&&ol(et,Dl)||Ar===1&&fn===1&&ol(et,Bh)&&U>100||Ar===1&&fn>1&&ol(et,Cf)?dn=R[Ar]+(fn>0?$[fn-1]:"")+dn:Ar===1&&fn>0&&(dn=$[fn-1]+dn),Ft=Math.floor(Ft/10)}return(U<0?K:"")+dn},FA="\u5341\u767E\u5343\u842C",Wc="\u62FE\u4F70\u4EDF\u842C",PA="\u30DE\u30A4\u30CA\u30B9",jd="\uB9C8\uC774\uB108\uC2A4",_u=function(U,R,$){var K=$?". ":"",_e=$?"\u3001":"",et=$?", ":"",Ft=$?" ":"";switch(R){case 0:return"\u2022"+Ft;case 1:return"\u25E6"+Ft;case 2:return"\u25FE"+Ft;case 5:var dn=bu(U,48,57,!0,K);return dn.length<4?"0"+dn:dn;case 4:return eu(U,"\u3007\u4E00\u4E8C\u4E09\u56DB\u4E94\u516D\u4E03\u516B\u4E5D",_e);case 6:return Gh(U,1,3999,Th,3,K).toLowerCase();case 7:return Gh(U,1,3999,Th,3,K);case 8:return bu(U,945,969,!1,K);case 9:return bu(U,97,122,!1,K);case 10:return bu(U,65,90,!1,K);case 11:return bu(U,1632,1641,!0,K);case 12:case 49:return Gh(U,1,9999,oh,3,K);case 35:return Gh(U,1,9999,oh,3,K).toLowerCase();case 13:return bu(U,2534,2543,!0,K);case 14:case 30:return bu(U,6112,6121,!0,K);case 15:return eu(U,"\u5B50\u4E11\u5BC5\u536F\u8FB0\u5DF3\u5348\u672A\u7533\u9149\u620C\u4EA5",_e);case 16:return eu(U,"\u7532\u4E59\u4E19\u4E01\u620A\u5DF1\u5E9A\u8F9B\u58EC\u7678",_e);case 17:case 48:return tu(U,"\u96F6\u4E00\u4E8C\u4E09\u56DB\u4E94\u516D\u4E03\u516B\u4E5D",FA,"\u8CA0",_e,Dl|Bh|Cf);case 47:return tu(U,"\u96F6\u58F9\u8CB3\u53C3\u8086\u4F0D\u9678\u67D2\u634C\u7396",Wc,"\u8CA0",_e,Ef|Dl|Bh|Cf);case 42:return tu(U,"\u96F6\u4E00\u4E8C\u4E09\u56DB\u4E94\u516D\u4E03\u516B\u4E5D",FA,"\u8D1F",_e,Dl|Bh|Cf);case 41:return tu(U,"\u96F6\u58F9\u8D30\u53C1\u8086\u4F0D\u9646\u67D2\u634C\u7396",Wc,"\u8D1F",_e,Ef|Dl|Bh|Cf);case 26:return tu(U,"\u3007\u4E00\u4E8C\u4E09\u56DB\u4E94\u516D\u4E03\u516B\u4E5D","\u5341\u767E\u5343\u4E07",PA,_e,0);case 25:return tu(U,"\u96F6\u58F1\u5F10\u53C2\u56DB\u4F0D\u516D\u4E03\u516B\u4E5D","\u62FE\u767E\u5343\u4E07",PA,_e,Ef|Dl|Bh);case 31:return tu(U,"\uC601\uC77C\uC774\uC0BC\uC0AC\uC624\uC721\uCE60\uD314\uAD6C","\uC2ED\uBC31\uCC9C\uB9CC",jd,et,Ef|Dl|Bh);case 33:return tu(U,"\u96F6\u4E00\u4E8C\u4E09\u56DB\u4E94\u516D\u4E03\u516B\u4E5D","\u5341\u767E\u5343\u842C",jd,et,0);case 32:return tu(U,"\u96F6\u58F9\u8CB3\u53C3\u56DB\u4E94\u516D\u4E03\u516B\u4E5D","\u62FE\u767E\u5343",jd,et,Ef|Dl|Bh);case 18:return bu(U,2406,2415,!0,K);case 20:return Gh(U,1,19999,Sf,3,K);case 21:return bu(U,2790,2799,!0,K);case 22:return bu(U,2662,2671,!0,K);case 22:return Gh(U,1,10999,kp,3,K);case 23:return eu(U,"\u3042\u3044\u3046\u3048\u304A\u304B\u304D\u304F\u3051\u3053\u3055\u3057\u3059\u305B\u305D\u305F\u3061\u3064\u3066\u3068\u306A\u306B\u306C\u306D\u306E\u306F\u3072\u3075\u3078\u307B\u307E\u307F\u3080\u3081\u3082\u3084\u3086\u3088\u3089\u308A\u308B\u308C\u308D\u308F\u3090\u3091\u3092\u3093");case 24:return eu(U,"\u3044\u308D\u306F\u306B\u307B\u3078\u3068\u3061\u308A\u306C\u308B\u3092\u308F\u304B\u3088\u305F\u308C\u305D\u3064\u306D\u306A\u3089\u3080\u3046\u3090\u306E\u304A\u304F\u3084\u307E\u3051\u3075\u3053\u3048\u3066\u3042\u3055\u304D\u3086\u3081\u307F\u3057\u3091\u3072\u3082\u305B\u3059");case 27:return bu(U,3302,3311,!0,K);case 28:return eu(U,"\u30A2\u30A4\u30A6\u30A8\u30AA\u30AB\u30AD\u30AF\u30B1\u30B3\u30B5\u30B7\u30B9\u30BB\u30BD\u30BF\u30C1\u30C4\u30C6\u30C8\u30CA\u30CB\u30CC\u30CD\u30CE\u30CF\u30D2\u30D5\u30D8\u30DB\u30DE\u30DF\u30E0\u30E1\u30E2\u30E4\u30E6\u30E8\u30E9\u30EA\u30EB\u30EC\u30ED\u30EF\u30F0\u30F1\u30F2\u30F3",_e);case 29:return eu(U,"\u30A4\u30ED\u30CF\u30CB\u30DB\u30D8\u30C8\u30C1\u30EA\u30CC\u30EB\u30F2\u30EF\u30AB\u30E8\u30BF\u30EC\u30BD\u30C4\u30CD\u30CA\u30E9\u30E0\u30A6\u30F0\u30CE\u30AA\u30AF\u30E4\u30DE\u30B1\u30D5\u30B3\u30A8\u30C6\u30A2\u30B5\u30AD\u30E6\u30E1\u30DF\u30B7\u30F1\u30D2\u30E2\u30BB\u30B9",_e);case 34:return bu(U,3792,3801,!0,K);case 37:return bu(U,6160,6169,!0,K);case 38:return bu(U,4160,4169,!0,K);case 39:return bu(U,2918,2927,!0,K);case 40:return bu(U,1776,1785,!0,K);case 43:return bu(U,3046,3055,!0,K);case 44:return bu(U,3174,3183,!0,K);case 45:return bu(U,3664,3673,!0,K);case 46:return bu(U,3872,3881,!0,K);case 3:default:return bu(U,48,57,!0,K)}},Yd="data-html2canvas-ignore",up=function(){function U(R,$,K){if(this.context=R,this.options=K,this.scrolledElements=[],this.referenceElement=$,this.counters=new qu,this.quoteDepth=0,!$.ownerDocument)throw new Error("Cloned element does not have an owner document");this.documentElement=this.cloneNode($.ownerDocument.documentElement,!1)}return U.prototype.toIFrame=function(R,$){var K=this,_e=Xm(R,$);if(!_e.contentWindow)return Promise.reject("Unable to find iframe window");var et=R.defaultView.pageXOffset,Ft=R.defaultView.pageYOffset,dn=_e.contentWindow,fn=dn.document,Ar=cp(_e).then(function(){return Z(K,void 0,void 0,function(){var ur,Ir;return V(this,function(fi){switch(fi.label){case 0:return this.scrolledElements.forEach(Vp),dn&&(dn.scrollTo($.left,$.top),/(iPad|iPhone|iPod)/g.test(navigator.userAgent)&&(dn.scrollY!==$.top||dn.scrollX!==$.left)&&(this.context.logger.warn("Unable to restore scroll position for cloned document"),this.context.windowBounds=this.context.windowBounds.add(dn.scrollX-$.left,dn.scrollY-$.top,0,0))),ur=this.options.onclone,Ir=this.clonedReferenceElement,typeof Ir=="undefined"?[2,Promise.reject("Error finding the "+this.referenceElement.nodeName+" in the cloned document")]:fn.fonts&&fn.fonts.ready?[4,fn.fonts.ready]:[3,2];case 1:fi.sent(),fi.label=2;case 2:return/(AppleWebKit)/g.test(navigator.userAgent)?[4,Tf(fn)]:[3,4];case 3:fi.sent(),fi.label=4;case 4:return typeof ur=="function"?[2,Promise.resolve().then(function(){return ur(fn,Ir)}).then(function(){return _e})]:[2,_e]}})})});return fn.open(),fn.write(nA(document.doctype)+"<html></html>"),LA(this.referenceElement.ownerDocument,et,Ft),fn.replaceChild(fn.adoptNode(this.documentElement),fn.documentElement),fn.close(),Ar},U.prototype.createElementClone=function(R){if(Hl(R,2))debugger;if(Qc(R))return this.createCanvasClone(R);if(Eh(R))return this.createVideoClone(R);if(Ch(R))return this.createStyleClone(R);var $=R.cloneNode(!1);return lp($)&&(lp(R)&&R.currentSrc&&R.currentSrc!==R.src&&($.src=R.currentSrc,$.srcset=""),$.loading==="lazy"&&($.loading="eager")),Xd($)?this.createCustomElementClone($):$},U.prototype.createCustomElementClone=function(R){var $=document.createElement("html2canvascustomelement");return nd(R.style,$),$},U.prototype.createStyleClone=function(R){try{var $=R.sheet;if($&&$.cssRules){var K=[].slice.call($.cssRules,0).reduce(function(et,Ft){return Ft&&typeof Ft.cssText=="string"?et+Ft.cssText:et},""),_e=R.cloneNode(!1);return _e.textContent=K,_e}}catch(et){if(this.context.logger.error("Unable to access cssRules property",et),et.name!=="SecurityError")throw et}return R.cloneNode(!1)},U.prototype.createCanvasClone=function(R){var $;if(this.options.inlineImages&&R.ownerDocument){var K=R.ownerDocument.createElement("img");try{return K.src=R.toDataURL(),K}catch(Ar){this.context.logger.info("Unable to inline canvas contents, canvas is tainted",R)}}var _e=R.cloneNode(!1);try{_e.width=R.width,_e.height=R.height;var et=R.getContext("2d"),Ft=_e.getContext("2d");if(Ft)if(!this.options.allowTaint&&et)Ft.putImageData(et.getImageData(0,0,R.width,R.height),0,0);else{var dn=($=R.getContext("webgl2"))!==null&&$!==void 0?$:R.getContext("webgl");if(dn){var fn=dn.getContextAttributes();(fn==null?void 0:fn.preserveDrawingBuffer)===!1&&this.context.logger.warn("Unable to clone WebGL context as it has preserveDrawingBuffer=false",R)}Ft.drawImage(R,0,0)}return _e}catch(Ar){this.context.logger.info("Unable to clone canvas as it is tainted",R)}return _e},U.prototype.createVideoClone=function(R){var $=R.ownerDocument.createElement("canvas");$.width=R.offsetWidth,$.height=R.offsetHeight;var K=$.getContext("2d");try{return K&&(K.drawImage(R,0,0,$.width,$.height),this.options.allowTaint||K.getImageData(0,0,$.width,$.height)),$}catch(et){this.context.logger.info("Unable to clone video as it is tainted",R)}var _e=R.ownerDocument.createElement("canvas");return _e.width=R.offsetWidth,_e.height=R.offsetHeight,_e},U.prototype.appendChildNode=function(R,$,K){(!tA($)||!Cg($)&&!$.hasAttribute(Yd)&&(typeof this.options.ignoreElements!="function"||!this.options.ignoreElements($)))&&(!this.options.copyStyles||!tA($)||!Ch($))&&R.appendChild(this.cloneNode($,K))},U.prototype.cloneChildNodes=function(R,$,K){for(var _e=this,et=R.shadowRoot?R.shadowRoot.firstChild:R.firstChild;et;et=et.nextSibling)if(tA(et)&&fm(et)&&typeof et.assignedNodes=="function"){var Ft=et.assignedNodes();Ft.length&&Ft.forEach(function(dn){return _e.appendChildNode($,dn,K)})}else this.appendChildNode($,et,K)},U.prototype.cloneNode=function(R,$){if(ah(R))return document.createTextNode(R.data);if(!R.ownerDocument)return R.cloneNode(!1);var K=R.ownerDocument.defaultView;if(K&&tA(R)&&(wf(R)||Kd(R))){var _e=this.createElementClone(R);_e.style.transitionProperty="none";var et=K.getComputedStyle(R),Ft=K.getComputedStyle(R,":before"),dn=K.getComputedStyle(R,":after");this.referenceElement===R&&wf(_e)&&(this.clonedReferenceElement=_e),$d(_e)&&Kv(_e);var fn=this.counters.parse(new zu(this.context,et)),Ar=this.resolvePseudoContent(R,_e,Ft,lh.BEFORE);Xd(R)&&($=!0),Eh(R)||this.cloneChildNodes(R,_e,$),Ar&&_e.insertBefore(Ar,_e.firstChild);var ur=this.resolvePseudoContent(R,_e,dn,lh.AFTER);return ur&&_e.appendChild(ur),this.counters.pop(fn),(et&&(this.options.copyStyles||Kd(R))&&!wo(R)||$)&&nd(et,_e),(R.scrollTop!==0||R.scrollLeft!==0)&&this.scrolledElements.push([_e,R.scrollLeft,R.scrollTop]),(Ec(R)||zh(R))&&(Ec(_e)||zh(_e))&&(_e.value=R.value),_e}return R.cloneNode(!1)},U.prototype.resolvePseudoContent=function(R,$,K,_e){var et=this;if(K){var Ft=K.content,dn=$.ownerDocument;if(!(!dn||!Ft||Ft==="none"||Ft==="-moz-alt-content"||K.display==="none")){this.counters.parse(new zu(this.context,K));var fn=new EA(this.context,K),Ar=dn.createElement("html2canvaspseudoelement");nd(K,Ar),fn.content.forEach(function(Ir){if(Ir.type===0)Ar.appendChild(dn.createTextNode(Ir.value));else if(Ir.type===22){var fi=dn.createElement("img");fi.src=Ir.value,fi.style.opacity="1",Ar.appendChild(fi)}else if(Ir.type===18){if(Ir.name==="attr"){var Qs=Ir.values.filter(Uo);Qs.length&&Ar.appendChild(dn.createTextNode(R.getAttribute(Qs[0].value)||""))}else if(Ir.name==="counter"){var us=Ir.values.filter(To),bs=us[0],Ja=us[1];if(bs&&Uo(bs)){var fa=et.counters.getCounterValue(bs.value),ea=Ja&&Uo(Ja)?Ds.parse(et.context,Ja.value):3;Ar.appendChild(dn.createTextNode(_u(fa,ea,!1)))}}else if(Ir.name==="counters"){var ko=Ir.values.filter(To),bs=ko[0],uo=ko[1],Ja=ko[2];if(bs&&Uo(bs)){var Oa=et.counters.getCounterValues(bs.value),ks=Ja&&Uo(Ja)?Ds.parse(et.context,Ja.value):3,So=uo&&uo.type===0?uo.value:"",eo=Oa.map(function(wu){return _u(wu,ks,!1)}).join(So);Ar.appendChild(dn.createTextNode(eo))}}}else if(Ir.type===20)switch(Ir.value){case"open-quote":Ar.appendChild(dn.createTextNode(Ea(fn.quotes,et.quoteDepth++,!0)));break;case"close-quote":Ar.appendChild(dn.createTextNode(Ea(fn.quotes,--et.quoteDepth,!1)));break;default:Ar.appendChild(dn.createTextNode(Ir.value))}}),Ar.className=UA+" "+hp;var ur=_e===lh.BEFORE?" "+UA:" "+hp;return Kd($)?$.className.baseValue+=ur:$.className+=ur,Ar}}},U.destroy=function(R){return R.parentNode?(R.parentNode.removeChild(R),!0):!1},U}(),lh;(function(U){U[U.BEFORE=0]="BEFORE",U[U.AFTER=1]="AFTER"})(lh||(lh={}));var Xm=function(U,R){var $=U.createElement("iframe");return $.className="html2canvas-container",$.style.visibility="hidden",$.style.position="fixed",$.style.left="-10000px",$.style.top="0px",$.style.border="0",$.width=R.width.toString(),$.height=R.height.toString(),$.scrolling="no",$.setAttribute(Yd,"true"),U.body.appendChild($),$},fl=function(U){return new Promise(function(R){if(U.complete){R();return}if(!U.src){R();return}U.onload=R,U.onerror=R})},Tf=function(U){return Promise.all([].slice.call(U.images,0).map(fl))},cp=function(U){return new Promise(function(R,$){var K=U.contentWindow;if(!K)return $("No window assigned for iframe");var _e=K.document;K.onload=U.onload=function(){K.onload=U.onload=null;var et=setInterval(function(){_e.body.childNodes.length>0&&_e.readyState==="complete"&&(clearInterval(et),R(U))},50)}})},Tg=["all","d","content"],nd=function(U,R){for(var $=U.length-1;$>=0;$--){var K=U.item($);Tg.indexOf(K)===-1&&R.style.setProperty(K,U.getPropertyValue(K))}return R},nA=function(U){var R="";return U&&(R+="<!DOCTYPE ",U.name&&(R+=U.name),U.internalSubset&&(R+=U.internalSubset),U.publicId&&(R+='"'+U.publicId+'"'),U.systemId&&(R+='"'+U.systemId+'"'),R+=">"),R},LA=function(U,R,$){U&&U.defaultView&&(R!==U.defaultView.pageXOffset||$!==U.defaultView.pageYOffset)&&U.defaultView.scrollTo(R,$)},Vp=function(U){var R=U[0],$=U[1],K=U[2];R.scrollLeft=$,R.scrollTop=K},qd=":before",rA=":after",UA="___html2canvas___pseudoelement_before",hp="___html2canvas___pseudoelement_after",dp=`{
content: "" !important;
display: none !important;
}`,Kv=function(U){jm(U,"."+UA+qd+dp+`
.`+hp+rA+dp)},jm=function(U,R){var $=U.ownerDocument;if($){var K=$.createElement("style");K.textContent=R,U.appendChild(K)}},fp=function(){function U(){}return U.getOrigin=function(R){var $=U._link;return $?($.href=R,$.href=$.href,$.protocol+$.hostname+$.port):"about:blank"},U.isSameOrigin=function(R){return U.getOrigin(R)===U._origin},U.setContext=function(R){U._link=R.document.createElement("a"),U._origin=U.getOrigin(R.location.href)},U._origin="about:blank",U}(),rd=function(){function U(R,$){this.context=R,this._options=$,this._cache={}}return U.prototype.addImage=function(R){var $=Promise.resolve();return this.has(R)||(OA(R)||Ym(R))&&(this._cache[R]=this.loadImage(R)).catch(function(){}),$},U.prototype.match=function(R){return this._cache[R]},U.prototype.loadImage=function(R){return Z(this,void 0,void 0,function(){var $,K,_e,et,Ft=this;return V(this,function(dn){switch(dn.label){case 0:return $=fp.isSameOrigin(R),K=!k0(R)&&this._options.useCORS===!0&&Ra.SUPPORT_CORS_IMAGES&&!$,_e=!k0(R)&&!$&&!OA(R)&&typeof this._options.proxy=="string"&&Ra.SUPPORT_CORS_XHR&&!K,!$&&this._options.allowTaint===!1&&!k0(R)&&!OA(R)&&!_e&&!K?[2]:(et=R,_e?[4,this.proxy(et)]:[3,2]);case 1:et=dn.sent(),dn.label=2;case 2:return this.context.logger.debug("Added image "+R.substring(0,256)),[4,new Promise(function(fn,Ar){var ur=new Image;ur.onload=function(){return fn(ur)},ur.onerror=Ar,(gm(et)||K)&&(ur.crossOrigin="anonymous"),ur.src=et,ur.complete===!0&&setTimeout(function(){return fn(ur)},500),Ft._options.imageTimeout>0&&setTimeout(function(){return Ar("Timed out ("+Ft._options.imageTimeout+"ms) loading image")},Ft._options.imageTimeout)})];case 3:return[2,dn.sent()]}})})},U.prototype.has=function(R){return typeof this._cache[R]!="undefined"},U.prototype.keys=function(){return Promise.resolve(Object.keys(this._cache))},U.prototype.proxy=function(R){var $=this,K=this._options.proxy;if(!K)throw new Error("No proxy defined");var _e=R.substring(0,256);return new Promise(function(et,Ft){var dn=Ra.SUPPORT_RESPONSE_TYPE?"blob":"text",fn=new XMLHttpRequest;fn.onload=function(){if(fn.status===200)if(dn==="text")et(fn.response);else{var Ir=new FileReader;Ir.addEventListener("load",function(){return et(Ir.result)},!1),Ir.addEventListener("error",function(fi){return Ft(fi)},!1),Ir.readAsDataURL(fn.response)}else Ft("Failed to proxy resource "+_e+" with status code "+fn.status)},fn.onerror=Ft;var Ar=K.indexOf("?")>-1?"&":"?";if(fn.open("GET",""+K+Ar+"url="+encodeURIComponent(R)+"&responseType="+dn),dn!=="text"&&fn instanceof XMLHttpRequest&&(fn.responseType=dn),$._options.imageTimeout){var ur=$._options.imageTimeout;fn.timeout=ur,fn.ontimeout=function(){return Ft("Timed out ("+ur+"ms) proxying "+_e)}}fn.send()})},U}(),Am=/^data:image\/svg\+xml/i,pm=/^data:image\/.*;base64,/i,D0=/^data:image\/.*/i,Ym=function(U){return Ra.SUPPORT_SVG_DRAWING||!DA(U)},k0=function(U){return D0.test(U)},gm=function(U){return pm.test(U)},OA=function(U){return U.substr(0,4)==="blob"},DA=function(U){return U.substr(-3).toLowerCase()==="svg"||Am.test(U)},Us=function(){function U(R,$){this.type=0,this.x=R,this.y=$}return U.prototype.add=function(R,$){return new U(this.x+R,this.y+$)},U}(),Cd=function(U,R,$){return new Us(U.x+(R.x-U.x)*$,U.y+(R.y-U.y)*$)},iA=function(){function U(R,$,K,_e){this.type=1,this.start=R,this.startControl=$,this.endControl=K,this.end=_e}return U.prototype.subdivide=function(R,$){var K=Cd(this.start,this.startControl,R),_e=Cd(this.startControl,this.endControl,R),et=Cd(this.endControl,this.end,R),Ft=Cd(K,_e,R),dn=Cd(_e,et,R),fn=Cd(Ft,dn,R);return $?new U(this.start,K,Ft,fn):new U(fn,dn,et,this.end)},U.prototype.add=function(R,$){return new U(this.start.add(R,$),this.startControl.add(R,$),this.endControl.add(R,$),this.end.add(R,$))},U.prototype.reverse=function(){return new U(this.end,this.endControl,this.startControl,this.start)},U}(),Al=function(U){return U.type===1},sA=function(){function U(R){var $=R.styles,K=R.bounds,_e=yh($.borderTopLeftRadius,K.width,K.height),et=_e[0],Ft=_e[1],dn=yh($.borderTopRightRadius,K.width,K.height),fn=dn[0],Ar=dn[1],ur=yh($.borderBottomRightRadius,K.width,K.height),Ir=ur[0],fi=ur[1],Qs=yh($.borderBottomLeftRadius,K.width,K.height),us=Qs[0],bs=Qs[1],Ja=[];Ja.push((et+fn)/K.width),Ja.push((us+Ir)/K.width),Ja.push((Ft+bs)/K.height),Ja.push((Ar+fi)/K.height);var fa=Math.max.apply(Math,Ja);fa>1&&(et/=fa,Ft/=fa,fn/=fa,Ar/=fa,Ir/=fa,fi/=fa,us/=fa,bs/=fa);var ea=K.width-fn,ko=K.height-fi,uo=K.width-Ir,Oa=K.height-bs,ks=$.borderTopWidth,So=$.borderRightWidth,eo=$.borderBottomWidth,za=$.borderLeftWidth,nu=Yo($.paddingTop,R.bounds.width),wu=Yo($.paddingRight,R.bounds.width),hu=Yo($.paddingBottom,R.bounds.width),pl=Yo($.paddingLeft,R.bounds.width);this.topLeftBorderDoubleOuterBox=et>0||Ft>0?ll(K.left+za/3,K.top+ks/3,et-za/3,Ft-ks/3,Fo.TOP_LEFT):new Us(K.left+za/3,K.top+ks/3),this.topRightBorderDoubleOuterBox=et>0||Ft>0?ll(K.left+ea,K.top+ks/3,fn-So/3,Ar-ks/3,Fo.TOP_RIGHT):new Us(K.left+K.width-So/3,K.top+ks/3),this.bottomRightBorderDoubleOuterBox=Ir>0||fi>0?ll(K.left+uo,K.top+ko,Ir-So/3,fi-eo/3,Fo.BOTTOM_RIGHT):new Us(K.left+K.width-So/3,K.top+K.height-eo/3),this.bottomLeftBorderDoubleOuterBox=us>0||bs>0?ll(K.left+za/3,K.top+Oa,us-za/3,bs-eo/3,Fo.BOTTOM_LEFT):new Us(K.left+za/3,K.top+K.height-eo/3),this.topLeftBorderDoubleInnerBox=et>0||Ft>0?ll(K.left+za*2/3,K.top+ks*2/3,et-za*2/3,Ft-ks*2/3,Fo.TOP_LEFT):new Us(K.left+za*2/3,K.top+ks*2/3),this.topRightBorderDoubleInnerBox=et>0||Ft>0?ll(K.left+ea,K.top+ks*2/3,fn-So*2/3,Ar-ks*2/3,Fo.TOP_RIGHT):new Us(K.left+K.width-So*2/3,K.top+ks*2/3),this.bottomRightBorderDoubleInnerBox=Ir>0||fi>0?ll(K.left+uo,K.top+ko,Ir-So*2/3,fi-eo*2/3,Fo.BOTTOM_RIGHT):new Us(K.left+K.width-So*2/3,K.top+K.height-eo*2/3),this.bottomLeftBorderDoubleInnerBox=us>0||bs>0?ll(K.left+za*2/3,K.top+Oa,us-za*2/3,bs-eo*2/3,Fo.BOTTOM_LEFT):new Us(K.left+za*2/3,K.top+K.height-eo*2/3),this.topLeftBorderStroke=et>0||Ft>0?ll(K.left+za/2,K.top+ks/2,et-za/2,Ft-ks/2,Fo.TOP_LEFT):new Us(K.left+za/2,K.top+ks/2),this.topRightBorderStroke=et>0||Ft>0?ll(K.left+ea,K.top+ks/2,fn-So/2,Ar-ks/2,Fo.TOP_RIGHT):new Us(K.left+K.width-So/2,K.top+ks/2),this.bottomRightBorderStroke=Ir>0||fi>0?ll(K.left+uo,K.top+ko,Ir-So/2,fi-eo/2,Fo.BOTTOM_RIGHT):new Us(K.left+K.width-So/2,K.top+K.height-eo/2),this.bottomLeftBorderStroke=us>0||bs>0?ll(K.left+za/2,K.top+Oa,us-za/2,bs-eo/2,Fo.BOTTOM_LEFT):new Us(K.left+za/2,K.top+K.height-eo/2),this.topLeftBorderBox=et>0||Ft>0?ll(K.left,K.top,et,Ft,Fo.TOP_LEFT):new Us(K.left,K.top),this.topRightBorderBox=fn>0||Ar>0?ll(K.left+ea,K.top,fn,Ar,Fo.TOP_RIGHT):new Us(K.left+K.width,K.top),this.bottomRightBorderBox=Ir>0||fi>0?ll(K.left+uo,K.top+ko,Ir,fi,Fo.BOTTOM_RIGHT):new Us(K.left+K.width,K.top+K.height),this.bottomLeftBorderBox=us>0||bs>0?ll(K.left,K.top+Oa,us,bs,Fo.BOTTOM_LEFT):new Us(K.left,K.top+K.height),this.topLeftPaddingBox=et>0||Ft>0?ll(K.left+za,K.top+ks,Math.max(0,et-za),Math.max(0,Ft-ks),Fo.TOP_LEFT):new Us(K.left+za,K.top+ks),this.topRightPaddingBox=fn>0||Ar>0?ll(K.left+Math.min(ea,K.width-So),K.top+ks,ea>K.width+So?0:Math.max(0,fn-So),Math.max(0,Ar-ks),Fo.TOP_RIGHT):new Us(K.left+K.width-So,K.top+ks),this.bottomRightPaddingBox=Ir>0||fi>0?ll(K.left+Math.min(uo,K.width-za),K.top+Math.min(ko,K.height-eo),Math.max(0,Ir-So),Math.max(0,fi-eo),Fo.BOTTOM_RIGHT):new Us(K.left+K.width-So,K.top+K.height-eo),this.bottomLeftPaddingBox=us>0||bs>0?ll(K.left+za,K.top+Math.min(Oa,K.height-eo),Math.max(0,us-za),Math.max(0,bs-eo),Fo.BOTTOM_LEFT):new Us(K.left+za,K.top+K.height-eo),this.topLeftContentBox=et>0||Ft>0?ll(K.left+za+pl,K.top+ks+nu,Math.max(0,et-(za+pl)),Math.max(0,Ft-(ks+nu)),Fo.TOP_LEFT):new Us(K.left+za+pl,K.top+ks+nu),this.topRightContentBox=fn>0||Ar>0?ll(K.left+Math.min(ea,K.width+za+pl),K.top+ks+nu,ea>K.width+za+pl?0:fn-za+pl,Ar-(ks+nu),Fo.TOP_RIGHT):new Us(K.left+K.width-(So+wu),K.top+ks+nu),this.bottomRightContentBox=Ir>0||fi>0?ll(K.left+Math.min(uo,K.width-(za+pl)),K.top+Math.min(ko,K.height+ks+nu),Math.max(0,Ir-(So+wu)),fi-(eo+hu),Fo.BOTTOM_RIGHT):new Us(K.left+K.width-(So+wu),K.top+K.height-(eo+hu)),this.bottomLeftContentBox=us>0||bs>0?ll(K.left+za+pl,K.top+Oa,Math.max(0,us-(za+pl)),bs-(eo+hu),Fo.BOTTOM_LEFT):new Us(K.left+za+pl,K.top+K.height-(eo+hu))}return U}(),Fo;(function(U){U[U.TOP_LEFT=0]="TOP_LEFT",U[U.TOP_RIGHT=1]="TOP_RIGHT",U[U.BOTTOM_RIGHT=2]="BOTTOM_RIGHT",U[U.BOTTOM_LEFT=3]="BOTTOM_LEFT"})(Fo||(Fo={}));var ll=function(U,R,$,K,_e){var et=4*((Math.sqrt(2)-1)/3),Ft=$*et,dn=K*et,fn=U+$,Ar=R+K;switch(_e){case Fo.TOP_LEFT:return new iA(new Us(U,Ar),new Us(U,Ar-dn),new Us(fn-Ft,R),new Us(fn,R));case Fo.TOP_RIGHT:return new iA(new Us(U,R),new Us(U+Ft,R),new Us(fn,Ar-dn),new Us(fn,Ar));case Fo.BOTTOM_RIGHT:return new iA(new Us(fn,R),new Us(fn,R+dn),new Us(U+Ft,Ar),new Us(U,Ar));case Fo.BOTTOM_LEFT:default:return new iA(new Us(fn,Ar),new Us(fn-Ft,Ar),new Us(U,R+dn),new Us(U,R))}},hc=function(U){return[U.topLeftBorderBox,U.topRightBorderBox,U.bottomRightBorderBox,U.bottomLeftBorderBox]},Cc=function(U){return[U.topLeftContentBox,U.topRightContentBox,U.bottomRightContentBox,U.bottomLeftContentBox]},Rh=function(U){return[U.topLeftPaddingBox,U.topRightPaddingBox,U.bottomRightPaddingBox,U.bottomLeftPaddingBox]},Bf=function(){function U(R,$,K){this.offsetX=R,this.offsetY=$,this.matrix=K,this.type=0,this.target=6}return U}(),Rf=function(){function U(R,$){this.path=R,this.target=$,this.type=1}return U}(),aA=function(){function U(R){this.opacity=R,this.type=2,this.target=6}return U}(),kA=function(U){return U.type===0},oA=function(U){return U.type===1},VA=function(U){return U.type===2},mm=function(U,R){return U.length===R.length?U.some(function($,K){return $===R[K]}):!1},Hh=function(U,R,$,K,_e){return U.map(function(et,Ft){switch(Ft){case 0:return et.add(R,$);case 1:return et.add(R+K,$);case 2:return et.add(R+K,$+_e);case 3:return et.add(R,$+_e)}return et})},zp=function(){function U(R){this.element=R,this.inlineLevel=[],this.nonInlineLevel=[],this.negativeZIndex=[],this.zeroOrAutoZIndexOrTransformedOrOpacity=[],this.positiveZIndex=[],this.nonPositionedFloats=[],this.nonPositionedInlineLevel=[]}return U}(),vm=function(){function U(R,$){if(this.container=R,this.parent=$,this.effects=[],this.curves=new sA(this.container),this.container.styles.opacity<1&&this.effects.push(new aA(this.container.styles.opacity)),this.container.styles.transform!==null){var K=this.container.bounds.left+this.container.styles.transformOrigin[0].number,_e=this.container.bounds.top+this.container.styles.transformOrigin[1].number,et=this.container.styles.transform;this.effects.push(new Bf(K,_e,et))}if(this.container.styles.overflowX!==0){var Ft=hc(this.curves),dn=Rh(this.curves);mm(Ft,dn)?this.effects.push(new Rf(Ft,6)):(this.effects.push(new Rf(Ft,2)),this.effects.push(new Rf(dn,4)))}}return U.prototype.getEffects=function(R){for(var $=[2,3].indexOf(this.container.styles.position)===-1,K=this.parent,_e=this.effects.slice(0);K;){var et=K.effects.filter(function(fn){return!oA(fn)});if($||K.container.styles.position!==0||!K.parent){if(_e.unshift.apply(_e,et),$=[2,3].indexOf(K.container.styles.position)===-1,K.container.styles.overflowX!==0){var Ft=hc(K.curves),dn=Rh(K.curves);mm(Ft,dn)||_e.unshift(new Rf(dn,6))}}else _e.unshift.apply(_e,et);K=K.parent}return _e.filter(function(fn){return ol(fn.target,R)})},U}(),zA=function(U,R,$,K){U.container.elements.forEach(function(_e){var et=ol(_e.flags,4),Ft=ol(_e.flags,2),dn=new vm(_e,U);ol(_e.styles.display,2048)&&K.push(dn);var fn=ol(_e.flags,8)?[]:K;if(et||Ft){var Ar=et||_e.styles.isPositioned()?$:R,ur=new zp(dn);if(_e.styles.isPositioned()||_e.styles.opacity<1||_e.styles.isTransformed()){var Ir=_e.styles.zIndex.order;if(Ir<0){var fi=0;Ar.negativeZIndex.some(function(us,bs){return Ir>us.element.container.styles.zIndex.order?(fi=bs,!1):fi>0}),Ar.negativeZIndex.splice(fi,0,ur)}else if(Ir>0){var Qs=0;Ar.positiveZIndex.some(function(us,bs){return Ir>=us.element.container.styles.zIndex.order?(Qs=bs+1,!1):Qs>0}),Ar.positiveZIndex.splice(Qs,0,ur)}else Ar.zeroOrAutoZIndexOrTransformedOrOpacity.push(ur)}else _e.styles.isFloating()?Ar.nonPositionedFloats.push(ur):Ar.nonPositionedInlineLevel.push(ur);zA(dn,ur,et?ur:$,fn)}else _e.styles.isInlineLevel()?R.inlineLevel.push(dn):R.nonInlineLevel.push(dn),zA(dn,R,$,fn);ol(_e.flags,8)&&Jd(_e,fn)})},Jd=function(U,R){for(var $=U instanceof NA?U.start:1,K=U instanceof NA?U.reversed:!1,_e=0;_e<R.length;_e++){var et=R[_e];et.container instanceof IA&&typeof et.container.value=="number"&&et.container.value!==0&&($=et.container.value),et.listValue=_u($,et.container.styles.listStyleType,!0),$+=K?-1:1}},ym=function(U){var R=new vm(U,null),$=new zp(R),K=[];return zA(R,$,$,K),Jd(R.container,K),$},x=function(U,R){switch(R){case 0:return k(U.topLeftBorderBox,U.topLeftPaddingBox,U.topRightBorderBox,U.topRightPaddingBox);case 1:return k(U.topRightBorderBox,U.topRightPaddingBox,U.bottomRightBorderBox,U.bottomRightPaddingBox);case 2:return k(U.bottomRightBorderBox,U.bottomRightPaddingBox,U.bottomLeftBorderBox,U.bottomLeftPaddingBox);case 3:default:return k(U.bottomLeftBorderBox,U.bottomLeftPaddingBox,U.topLeftBorderBox,U.topLeftPaddingBox)}},S=function(U,R){switch(R){case 0:return k(U.topLeftBorderBox,U.topLeftBorderDoubleOuterBox,U.topRightBorderBox,U.topRightBorderDoubleOuterBox);case 1:return k(U.topRightBorderBox,U.topRightBorderDoubleOuterBox,U.bottomRightBorderBox,U.bottomRightBorderDoubleOuterBox);case 2:return k(U.bottomRightBorderBox,U.bottomRightBorderDoubleOuterBox,U.bottomLeftBorderBox,U.bottomLeftBorderDoubleOuterBox);case 3:default:return k(U.bottomLeftBorderBox,U.bottomLeftBorderDoubleOuterBox,U.topLeftBorderBox,U.topLeftBorderDoubleOuterBox)}},f=function(U,R){switch(R){case 0:return k(U.topLeftBorderDoubleInnerBox,U.topLeftPaddingBox,U.topRightBorderDoubleInnerBox,U.topRightPaddingBox);case 1:return k(U.topRightBorderDoubleInnerBox,U.topRightPaddingBox,U.bottomRightBorderDoubleInnerBox,U.bottomRightPaddingBox);case 2:return k(U.bottomRightBorderDoubleInnerBox,U.bottomRightPaddingBox,U.bottomLeftBorderDoubleInnerBox,U.bottomLeftPaddingBox);case 3:default:return k(U.bottomLeftBorderDoubleInnerBox,U.bottomLeftPaddingBox,U.topLeftBorderDoubleInnerBox,U.topLeftPaddingBox)}},A=function(U,R){switch(R){case 0:return _(U.topLeftBorderStroke,U.topRightBorderStroke);case 1:return _(U.topRightBorderStroke,U.bottomRightBorderStroke);case 2:return _(U.bottomRightBorderStroke,U.bottomLeftBorderStroke);case 3:default:return _(U.bottomLeftBorderStroke,U.topLeftBorderStroke)}},_=function(U,R){var $=[];return Al(U)?$.push(U.subdivide(.5,!1)):$.push(U),Al(R)?$.push(R.subdivide(.5,!0)):$.push(R),$},k=function(U,R,$,K){var _e=[];return Al(U)?_e.push(U.subdivide(.5,!1)):_e.push(U),Al($)?_e.push($.subdivide(.5,!0)):_e.push($),Al(K)?_e.push(K.subdivide(.5,!0).reverse()):_e.push(K),Al(R)?_e.push(R.subdivide(.5,!1).reverse()):_e.push(R),_e},G=function(U){var R=U.bounds,$=U.styles;return R.add($.borderLeftWidth,$.borderTopWidth,-($.borderRightWidth+$.borderLeftWidth),-($.borderTopWidth+$.borderBottomWidth))},ae=function(U){var R=U.styles,$=U.bounds,K=Yo(R.paddingLeft,$.width),_e=Yo(R.paddingRight,$.width),et=Yo(R.paddingTop,$.width),Ft=Yo(R.paddingBottom,$.width);return $.add(K+R.borderLeftWidth,et+R.borderTopWidth,-(R.borderRightWidth+R.borderLeftWidth+K+_e),-(R.borderTopWidth+R.borderBottomWidth+et+Ft))},ge=function(U,R){return U===0?R.bounds:U===2?ae(R):G(R)},Ue=function(U,R){return U===0?R.bounds:U===2?ae(R):G(R)},rt=function(U,R,$){var K=ge(mn(U.styles.backgroundOrigin,R),U),_e=Ue(mn(U.styles.backgroundClip,R),U),et=wn(mn(U.styles.backgroundSize,R),$,K),Ft=et[0],dn=et[1],fn=yh(mn(U.styles.backgroundPosition,R),K.width-Ft,K.height-dn),Ar=Gn(mn(U.styles.backgroundRepeat,R),fn,et,K,_e),ur=Math.round(K.left+fn[0]),Ir=Math.round(K.top+fn[1]);return[Ar,ur,Ir,Ft,dn]},bt=function(U){return Uo(U)&&U.value===Vi.AUTO},Zt=function(U){return typeof U=="number"},wn=function(U,R,$){var K=R[0],_e=R[1],et=R[2],Ft=U[0],dn=U[1];if(!Ft)return[0,0];if(Oo(Ft)&&dn&&Oo(dn))return[Yo(Ft,$.width),Yo(dn,$.height)];var fn=Zt(et);if(Uo(Ft)&&(Ft.value===Vi.CONTAIN||Ft.value===Vi.COVER)){if(Zt(et)){var Ar=$.width/$.height;return Ar<et!=(Ft.value===Vi.COVER)?[$.width,$.width/et]:[$.height*et,$.height]}return[$.width,$.height]}var ur=Zt(K),Ir=Zt(_e),fi=ur||Ir;if(bt(Ft)&&(!dn||bt(dn))){if(ur&&Ir)return[K,_e];if(!fn&&!fi)return[$.width,$.height];if(fi&&fn){var Qs=ur?K:_e*et,us=Ir?_e:K/et;return[Qs,us]}var bs=ur?K:$.width,Ja=Ir?_e:$.height;return[bs,Ja]}if(fn){var fa=0,ea=0;return Oo(Ft)?fa=Yo(Ft,$.width):Oo(dn)&&(ea=Yo(dn,$.height)),bt(Ft)?fa=ea*et:(!dn||bt(dn))&&(ea=fa/et),[fa,ea]}var ko=null,uo=null;if(Oo(Ft)?ko=Yo(Ft,$.width):dn&&Oo(dn)&&(uo=Yo(dn,$.height)),ko!==null&&(!dn||bt(dn))&&(uo=ur&&Ir?ko/K*_e:$.height),uo!==null&&bt(Ft)&&(ko=ur&&Ir?uo/_e*K:$.width),ko!==null&&uo!==null)return[ko,uo];throw new Error("Unable to calculate background-size for element")},mn=function(U,R){var $=U[R];return typeof $=="undefined"?U[0]:$},Gn=function(U,R,$,K,_e){var et=R[0],Ft=R[1],dn=$[0],fn=$[1];switch(U){case 2:return[new Us(Math.round(K.left),Math.round(K.top+Ft)),new Us(Math.round(K.left+K.width),Math.round(K.top+Ft)),new Us(Math.round(K.left+K.width),Math.round(fn+K.top+Ft)),new Us(Math.round(K.left),Math.round(fn+K.top+Ft))];case 3:return[new Us(Math.round(K.left+et),Math.round(K.top)),new Us(Math.round(K.left+et+dn),Math.round(K.top)),new Us(Math.round(K.left+et+dn),Math.round(K.height+K.top)),new Us(Math.round(K.left+et),Math.round(K.height+K.top))];case 1:return[new Us(Math.round(K.left+et),Math.round(K.top+Ft)),new Us(Math.round(K.left+et+dn),Math.round(K.top+Ft)),new Us(Math.round(K.left+et+dn),Math.round(K.top+Ft+fn)),new Us(Math.round(K.left+et),Math.round(K.top+Ft+fn))];default:return[new Us(Math.round(_e.left),Math.round(_e.top)),new Us(Math.round(_e.left+_e.width),Math.round(_e.top)),new Us(Math.round(_e.left+_e.width),Math.round(_e.height+_e.top)),new Us(Math.round(_e.left),Math.round(_e.height+_e.top))]}},ir="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",tr="Hidden Text",Zn=function(){function U(R){this._data={},this._document=R}return U.prototype.parseMetrics=function(R,$){var K=this._document.createElement("div"),_e=this._document.createElement("img"),et=this._document.createElement("span"),Ft=this._document.body;K.style.visibility="hidden",K.style.fontFamily=R,K.style.fontSize=$,K.style.margin="0",K.style.padding="0",K.style.whiteSpace="nowrap",Ft.appendChild(K),_e.src=ir,_e.width=1,_e.height=1,_e.style.margin="0",_e.style.padding="0",_e.style.verticalAlign="baseline",et.style.fontFamily=R,et.style.fontSize=$,et.style.margin="0",et.style.padding="0",et.appendChild(this._document.createTextNode(tr)),K.appendChild(et),K.appendChild(_e);var dn=_e.offsetTop-et.offsetTop+2;K.removeChild(et),K.appendChild(this._document.createTextNode(tr)),K.style.lineHeight="normal",_e.style.verticalAlign="super";var fn=_e.offsetTop-K.offsetTop+2;return Ft.removeChild(K),{baseline:dn,middle:fn}},U.prototype.getMetrics=function(R,$){var K=R+" "+$;return typeof this._data[K]=="undefined"&&(this._data[K]=this.parseMetrics(R,$)),this._data[K]},U}(),Tr=function(){function U(R,$){this.context=R,this.options=$}return U}(),ni=1e4,ns=function(U){b(R,U);function R($,K){var _e=U.call(this,$,K)||this;return _e._activeEffects=[],_e.canvas=K.canvas?K.canvas:document.createElement("canvas"),_e.ctx=_e.canvas.getContext("2d"),K.canvas||(_e.canvas.width=Math.floor(K.width*K.scale),_e.canvas.height=Math.floor(K.height*K.scale),_e.canvas.style.width=K.width+"px",_e.canvas.style.height=K.height+"px"),_e.fontMetrics=new Zn(document),_e.ctx.scale(_e.options.scale,_e.options.scale),_e.ctx.translate(-K.x,-K.y),_e.ctx.textBaseline="bottom",_e._activeEffects=[],_e.context.logger.debug("Canvas renderer initialized ("+K.width+"x"+K.height+") with scale "+K.scale),_e}return R.prototype.applyEffects=function($){for(var K=this;this._activeEffects.length;)this.popEffect();$.forEach(function(_e){return K.applyEffect(_e)})},R.prototype.applyEffect=function($){this.ctx.save(),VA($)&&(this.ctx.globalAlpha=$.opacity),kA($)&&(this.ctx.translate($.offsetX,$.offsetY),this.ctx.transform($.matrix[0],$.matrix[1],$.matrix[2],$.matrix[3],$.matrix[4],$.matrix[5]),this.ctx.translate(-$.offsetX,-$.offsetY)),oA($)&&(this.path($.path),this.ctx.clip()),this._activeEffects.push($)},R.prototype.popEffect=function(){this._activeEffects.pop(),this.ctx.restore()},R.prototype.renderStack=function($){return Z(this,void 0,void 0,function(){var K;return V(this,function(_e){switch(_e.label){case 0:return K=$.element.container.styles,K.isVisible()?[4,this.renderStackContent($)]:[3,2];case 1:_e.sent(),_e.label=2;case 2:return[2]}})})},R.prototype.renderNode=function($){return Z(this,void 0,void 0,function(){return V(this,function(K){switch(K.label){case 0:if(ol($.container.flags,16))debugger;return $.container.styles.isVisible()?[4,this.renderNodeBackgroundAndBorders($)]:[3,3];case 1:return K.sent(),[4,this.renderNodeContent($)];case 2:K.sent(),K.label=3;case 3:return[2]}})})},R.prototype.renderTextWithLetterSpacing=function($,K,_e){var et=this;if(K===0)this.ctx.fillText($.text,$.bounds.left,$.bounds.top+_e);else{var Ft=Iu($.text);Ft.reduce(function(dn,fn){return et.ctx.fillText(fn,dn,$.bounds.top+_e),dn+et.ctx.measureText(fn).width},$.bounds.left)}},R.prototype.createFontStyle=function($){var K=$.fontVariant.filter(function(Ft){return Ft==="normal"||Ft==="small-caps"}).join(""),_e=_s($.fontFamily).join(", "),et=Ul($.fontSize)?""+$.fontSize.number+$.fontSize.unit:$.fontSize.number+"px";return[[$.fontStyle,K,$.fontWeight,et,_e].join(" "),_e,et]},R.prototype.renderTextNode=function($,K){return Z(this,void 0,void 0,function(){var _e,et,Ft,dn,fn,Ar,ur,Ir,fi=this;return V(this,function(Qs){return _e=this.createFontStyle(K),et=_e[0],Ft=_e[1],dn=_e[2],this.ctx.font=et,this.ctx.direction=K.direction===1?"rtl":"ltr",this.ctx.textAlign="left",this.ctx.textBaseline="alphabetic",fn=this.fontMetrics.getMetrics(Ft,dn),Ar=fn.baseline,ur=fn.middle,Ir=K.paintOrder,$.textBounds.forEach(function(us){Ir.forEach(function(bs){switch(bs){case 0:fi.ctx.fillStyle=Go(K.color),fi.renderTextWithLetterSpacing(us,K.letterSpacing,Ar);var Ja=K.textShadow;Ja.length&&us.text.trim().length&&(Ja.slice(0).reverse().forEach(function(fa){fi.ctx.shadowColor=Go(fa.color),fi.ctx.shadowOffsetX=fa.offsetX.number*fi.options.scale,fi.ctx.shadowOffsetY=fa.offsetY.number*fi.options.scale,fi.ctx.shadowBlur=fa.blur.number,fi.renderTextWithLetterSpacing(us,K.letterSpacing,Ar)}),fi.ctx.shadowColor="",fi.ctx.shadowOffsetX=0,fi.ctx.shadowOffsetY=0,fi.ctx.shadowBlur=0),K.textDecorationLine.length&&(fi.ctx.fillStyle=Go(K.textDecorationColor||K.color),K.textDecorationLine.forEach(function(fa){switch(fa){case 1:fi.ctx.fillRect(us.bounds.left,Math.round(us.bounds.top+Ar),us.bounds.width,1);break;case 2:fi.ctx.fillRect(us.bounds.left,Math.round(us.bounds.top),us.bounds.width,1);break;case 3:fi.ctx.fillRect(us.bounds.left,Math.ceil(us.bounds.top+ur),us.bounds.width,1);break}}));break;case 1:K.webkitTextStrokeWidth&&us.text.trim().length&&(fi.ctx.strokeStyle=Go(K.webkitTextStrokeColor),fi.ctx.lineWidth=K.webkitTextStrokeWidth,fi.ctx.lineJoin=window.chrome?"miter":"round",fi.ctx.strokeText(us.text,us.bounds.left,us.bounds.top+Ar)),fi.ctx.strokeStyle="",fi.ctx.lineWidth=0,fi.ctx.lineJoin="miter";break}})}),[2]})})},R.prototype.renderReplacedElement=function($,K,_e){if(_e&&$.intrinsicWidth>0&&$.intrinsicHeight>0){var et=ae($),Ft=Rh(K);this.path(Ft),this.ctx.save(),this.ctx.clip(),this.ctx.drawImage(_e,0,0,$.intrinsicWidth,$.intrinsicHeight,et.left,et.top,et.width,et.height),this.ctx.restore()}},R.prototype.renderNodeContent=function($){return Z(this,void 0,void 0,function(){var K,_e,et,Ft,dn,fn,ea,ea,Ar,ur,Ir,fi,uo,Qs,us,Oa,bs,Ja,fa,ea,ko,uo,Oa;return V(this,function(ks){switch(ks.label){case 0:this.applyEffects($.getEffects(4)),K=$.container,_e=$.curves,et=K.styles,Ft=0,dn=K.textNodes,ks.label=1;case 1:return Ft<dn.length?(fn=dn[Ft],[4,this.renderTextNode(fn,et)]):[3,4];case 2:ks.sent(),ks.label=3;case 3:return Ft++,[3,1];case 4:if(!(K instanceof wd))return[3,8];ks.label=5;case 5:return ks.trys.push([5,7,,8]),[4,this.context.cache.match(K.src)];case 6:return ea=ks.sent(),this.renderReplacedElement(K,_e,ea),[3,8];case 7:return ks.sent(),this.context.logger.error("Error loading image "+K.src),[3,8];case 8:if(K instanceof sh&&this.renderReplacedElement(K,_e,K.canvas),!(K instanceof Sd))return[3,12];ks.label=9;case 9:return ks.trys.push([9,11,,12]),[4,this.context.cache.match(K.svg)];case 10:return ea=ks.sent(),this.renderReplacedElement(K,_e,ea),[3,12];case 11:return ks.sent(),this.context.logger.error("Error loading svg "+K.svg.substring(0,255)),[3,12];case 12:return K instanceof Up&&K.tree?(Ar=new R(this.context,{scale:this.options.scale,backgroundColor:K.backgroundColor,x:0,y:0,width:K.width,height:K.height}),[4,Ar.render(K.tree)]):[3,14];case 13:ur=ks.sent(),K.width&&K.height&&this.ctx.drawImage(ur,0,0,K.width,K.height,K.bounds.left,K.bounds.top,K.bounds.width,K.bounds.height),ks.label=14;case 14:if(K instanceof Pp&&(Ir=Math.min(K.bounds.width,K.bounds.height),K.type===td?K.checked&&(this.ctx.save(),this.path([new Us(K.bounds.left+Ir*.39363,K.bounds.top+Ir*.79),new Us(K.bounds.left+Ir*.16,K.bounds.top+Ir*.5549),new Us(K.bounds.left+Ir*.27347,K.bounds.top+Ir*.44071),new Us(K.bounds.left+Ir*.39694,K.bounds.top+Ir*.5649),new Us(K.bounds.left+Ir*.72983,K.bounds.top+Ir*.23),new Us(K.bounds.left+Ir*.84,K.bounds.top+Ir*.34085),new Us(K.bounds.left+Ir*.39363,K.bounds.top+Ir*.79)]),this.ctx.fillStyle=Go(ap),this.ctx.fill(),this.ctx.restore()):K.type===Jf&&K.checked&&(this.ctx.save(),this.ctx.beginPath(),this.ctx.arc(K.bounds.left+Ir/2,K.bounds.top+Ir/2,Ir/4,0,Math.PI*2,!0),this.ctx.fillStyle=Go(ap),this.ctx.fill(),this.ctx.restore())),is(K)&&K.value.length){switch(fi=this.createFontStyle(et),uo=fi[0],Qs=fi[1],us=this.fontMetrics.getMetrics(uo,Qs).baseline,this.ctx.font=uo,this.ctx.fillStyle=Go(et.color),this.ctx.textBaseline="alphabetic",this.ctx.textAlign=Ri(K.styles.textAlign),Oa=ae(K),bs=0,K.styles.textAlign){case 1:bs+=Oa.width/2;break;case 2:bs+=Oa.width;break}Ja=Oa.add(bs,0,0,-Oa.height/2+1),this.ctx.save(),this.path([new Us(Oa.left,Oa.top),new Us(Oa.left+Oa.width,Oa.top),new Us(Oa.left+Oa.width,Oa.top+Oa.height),new Us(Oa.left,Oa.top+Oa.height)]),this.ctx.clip(),this.renderTextWithLetterSpacing(new Hu(K.value,Ja),et.letterSpacing,us),this.ctx.restore(),this.ctx.textBaseline="alphabetic",this.ctx.textAlign="left"}if(!ol(K.styles.display,2048))return[3,20];if(K.styles.listStyleImage===null)return[3,19];if(fa=K.styles.listStyleImage,fa.type!==0)return[3,18];ea=void 0,ko=fa.url,ks.label=15;case 15:return ks.trys.push([15,17,,18]),[4,this.context.cache.match(ko)];case 16:return ea=ks.sent(),this.ctx.drawImage(ea,K.bounds.left-(ea.width+10),K.bounds.top),[3,18];case 17:return ks.sent(),this.context.logger.error("Error loading list-style-image "+ko),[3,18];case 18:return[3,20];case 19:$.listValue&&K.styles.listStyleType!==-1&&(uo=this.createFontStyle(et)[0],this.ctx.font=uo,this.ctx.fillStyle=Go(et.color),this.ctx.textBaseline="middle",this.ctx.textAlign="right",Oa=new E(K.bounds.left,K.bounds.top+Yo(K.styles.paddingTop,K.bounds.width),K.bounds.width,oi(et.lineHeight,et.fontSize.number)/2+1),this.renderTextWithLetterSpacing(new Hu($.listValue,Oa),et.letterSpacing,oi(et.lineHeight,et.fontSize.number)/2+2),this.ctx.textBaseline="bottom",this.ctx.textAlign="left"),ks.label=20;case 20:return[2]}})})},R.prototype.renderStackContent=function($){return Z(this,void 0,void 0,function(){var K,_e,fa,et,Ft,fa,dn,fn,fa,Ar,ur,fa,Ir,fi,fa,Qs,us,fa,bs,Ja,fa;return V(this,function(ea){switch(ea.label){case 0:if(ol($.element.container.flags,16))debugger;return[4,this.renderNodeBackgroundAndBorders($.element)];case 1:ea.sent(),K=0,_e=$.negativeZIndex,ea.label=2;case 2:return K<_e.length?(fa=_e[K],[4,this.renderStack(fa)]):[3,5];case 3:ea.sent(),ea.label=4;case 4:return K++,[3,2];case 5:return[4,this.renderNodeContent($.element)];case 6:ea.sent(),et=0,Ft=$.nonInlineLevel,ea.label=7;case 7:return et<Ft.length?(fa=Ft[et],[4,this.renderNode(fa)]):[3,10];case 8:ea.sent(),ea.label=9;case 9:return et++,[3,7];case 10:dn=0,fn=$.nonPositionedFloats,ea.label=11;case 11:return dn<fn.length?(fa=fn[dn],[4,this.renderStack(fa)]):[3,14];case 12:ea.sent(),ea.label=13;case 13:return dn++,[3,11];case 14:Ar=0,ur=$.nonPositionedInlineLevel,ea.label=15;case 15:return Ar<ur.length?(fa=ur[Ar],[4,this.renderStack(fa)]):[3,18];case 16:ea.sent(),ea.label=17;case 17:return Ar++,[3,15];case 18:Ir=0,fi=$.inlineLevel,ea.label=19;case 19:return Ir<fi.length?(fa=fi[Ir],[4,this.renderNode(fa)]):[3,22];case 20:ea.sent(),ea.label=21;case 21:return Ir++,[3,19];case 22:Qs=0,us=$.zeroOrAutoZIndexOrTransformedOrOpacity,ea.label=23;case 23:return Qs<us.length?(fa=us[Qs],[4,this.renderStack(fa)]):[3,26];case 24:ea.sent(),ea.label=25;case 25:return Qs++,[3,23];case 26:bs=0,Ja=$.positiveZIndex,ea.label=27;case 27:return bs<Ja.length?(fa=Ja[bs],[4,this.renderStack(fa)]):[3,30];case 28:ea.sent(),ea.label=29;case 29:return bs++,[3,27];case 30:return[2]}})})},R.prototype.mask=function($){this.ctx.beginPath(),this.ctx.moveTo(0,0),this.ctx.lineTo(this.canvas.width,0),this.ctx.lineTo(this.canvas.width,this.canvas.height),this.ctx.lineTo(0,this.canvas.height),this.ctx.lineTo(0,0),this.formatPath($.slice(0).reverse()),this.ctx.closePath()},R.prototype.path=function($){this.ctx.beginPath(),this.formatPath($),this.ctx.closePath()},R.prototype.formatPath=function($){var K=this;$.forEach(function(_e,et){var Ft=Al(_e)?_e.start:_e;et===0?K.ctx.moveTo(Ft.x,Ft.y):K.ctx.lineTo(Ft.x,Ft.y),Al(_e)&&K.ctx.bezierCurveTo(_e.startControl.x,_e.startControl.y,_e.endControl.x,_e.endControl.y,_e.end.x,_e.end.y)})},R.prototype.renderRepeat=function($,K,_e,et){this.path($),this.ctx.fillStyle=K,this.ctx.translate(_e,et),this.ctx.fill(),this.ctx.translate(-_e,-et)},R.prototype.resizeImage=function($,K,_e){var et;if($.width===K&&$.height===_e)return $;var Ft=(et=this.canvas.ownerDocument)!==null&&et!==void 0?et:document,dn=Ft.createElement("canvas");dn.width=Math.max(1,K),dn.height=Math.max(1,_e);var fn=dn.getContext("2d");return fn.drawImage($,0,0,$.width,$.height,0,0,K,_e),dn},R.prototype.renderBackgroundImage=function($){return Z(this,void 0,void 0,function(){var K,_e,et,Ft,dn,fn;return V(this,function(Ar){switch(Ar.label){case 0:K=$.styles.backgroundImage.length-1,_e=function(ur){var Ir,fi,Qs,nu,Ju,Tc,pl,Nu,eo,us,nu,Ju,Tc,pl,Nu,bs,Ja,fa,ea,ko,uo,Oa,ks,So,eo,za,nu,wu,hu,pl,Nu,Qh,Ju,Tc,If,id,GA,sd,lA,ef,Nf,Td;return V(this,function(Gp){switch(Gp.label){case 0:if(ur.type!==0)return[3,5];Ir=void 0,fi=ur.url,Gp.label=1;case 1:return Gp.trys.push([1,3,,4]),[4,et.context.cache.match(fi)];case 2:return Ir=Gp.sent(),[3,4];case 3:return Gp.sent(),et.context.logger.error("Error loading background-image "+fi),[3,4];case 4:return Ir&&(Qs=rt($,K,[Ir.width,Ir.height,Ir.width/Ir.height]),nu=Qs[0],Ju=Qs[1],Tc=Qs[2],pl=Qs[3],Nu=Qs[4],eo=et.ctx.createPattern(et.resizeImage(Ir,pl,Nu),"repeat"),et.renderRepeat(nu,eo,Ju,Tc)),[3,6];case 5:pn(ur)?(us=rt($,K,[null,null,null]),nu=us[0],Ju=us[1],Tc=us[2],pl=us[3],Nu=us[4],bs=vd(ur.angle,pl,Nu),Ja=bs[0],fa=bs[1],ea=bs[2],ko=bs[3],uo=bs[4],Oa=document.createElement("canvas"),Oa.width=pl,Oa.height=Nu,ks=Oa.getContext("2d"),So=ks.createLinearGradient(fa,ko,ea,uo),SA(ur.stops,Ja).forEach(function(Hp){return So.addColorStop(Hp.stop,Go(Hp.color))}),ks.fillStyle=So,ks.fillRect(0,0,pl,Nu),pl>0&&Nu>0&&(eo=et.ctx.createPattern(Oa,"repeat"),et.renderRepeat(nu,eo,Ju,Tc))):Dn(ur)&&(za=rt($,K,[null,null,null]),nu=za[0],wu=za[1],hu=za[2],pl=za[3],Nu=za[4],Qh=ur.position.length===0?[na]:ur.position,Ju=Yo(Qh[0],pl),Tc=Yo(Qh[Qh.length-1],Nu),If=Dd(ur,Ju,Tc,pl,Nu),id=If[0],GA=If[1],id>0&&GA>0&&(sd=et.ctx.createRadialGradient(wu+Ju,hu+Tc,0,wu+Ju,hu+Tc,id),SA(ur.stops,id*2).forEach(function(Hp){return sd.addColorStop(Hp.stop,Go(Hp.color))}),et.path(nu),et.ctx.fillStyle=sd,id!==GA?(lA=$.bounds.left+.5*$.bounds.width,ef=$.bounds.top+.5*$.bounds.height,Nf=GA/id,Td=1/Nf,et.ctx.save(),et.ctx.translate(lA,ef),et.ctx.transform(1,0,0,Nf,0,0),et.ctx.translate(-lA,-ef),et.ctx.fillRect(wu,Td*(hu-ef)+ef,pl,Nu*Td),et.ctx.restore()):et.ctx.fill())),Gp.label=6;case 6:return K--,[2]}})},et=this,Ft=0,dn=$.styles.backgroundImage.slice(0).reverse(),Ar.label=1;case 1:return Ft<dn.length?(fn=dn[Ft],[5,_e(fn)]):[3,4];case 2:Ar.sent(),Ar.label=3;case 3:return Ft++,[3,1];case 4:return[2]}})})},R.prototype.renderSolidBorder=function($,K,_e){return Z(this,void 0,void 0,function(){return V(this,function(et){return this.path(x(_e,K)),this.ctx.fillStyle=Go($),this.ctx.fill(),[2]})})},R.prototype.renderDoubleBorder=function($,K,_e,et){return Z(this,void 0,void 0,function(){var Ft,dn;return V(this,function(fn){switch(fn.label){case 0:return K<3?[4,this.renderSolidBorder($,_e,et)]:[3,2];case 1:return fn.sent(),[2];case 2:return Ft=S(et,_e),this.path(Ft),this.ctx.fillStyle=Go($),this.ctx.fill(),dn=f(et,_e),this.path(dn),this.ctx.fill(),[2]}})})},R.prototype.renderNodeBackgroundAndBorders=function($){return Z(this,void 0,void 0,function(){var K,_e,et,Ft,dn,fn,Ar,ur,Ir=this;return V(this,function(fi){switch(fi.label){case 0:return this.applyEffects($.getEffects(2)),K=$.container.styles,_e=!qo(K.backgroundColor)||K.backgroundImage.length,et=[{style:K.borderTopStyle,color:K.borderTopColor,width:K.borderTopWidth},{style:K.borderRightStyle,color:K.borderRightColor,width:K.borderRightWidth},{style:K.borderBottomStyle,color:K.borderBottomColor,width:K.borderBottomWidth},{style:K.borderLeftStyle,color:K.borderLeftColor,width:K.borderLeftWidth}],Ft=bi(mn(K.backgroundClip,0),$.curves),_e||K.boxShadow.length?(this.ctx.save(),this.path(Ft),this.ctx.clip(),qo(K.backgroundColor)||(this.ctx.fillStyle=Go(K.backgroundColor),this.ctx.fill()),[4,this.renderBackgroundImage($.container)]):[3,2];case 1:fi.sent(),this.ctx.restore(),K.boxShadow.slice(0).reverse().forEach(function(Qs){Ir.ctx.save();var us=hc($.curves),bs=Qs.inset?0:ni,Ja=Hh(us,-bs+(Qs.inset?1:-1)*Qs.spread.number,(Qs.inset?1:-1)*Qs.spread.number,Qs.spread.number*(Qs.inset?-2:2),Qs.spread.number*(Qs.inset?-2:2));Qs.inset?(Ir.path(us),Ir.ctx.clip(),Ir.mask(Ja)):(Ir.mask(us),Ir.ctx.clip(),Ir.path(Ja)),Ir.ctx.shadowOffsetX=Qs.offsetX.number+bs,Ir.ctx.shadowOffsetY=Qs.offsetY.number,Ir.ctx.shadowColor=Go(Qs.color),Ir.ctx.shadowBlur=Qs.blur.number,Ir.ctx.fillStyle=Qs.inset?Go(Qs.color):"rgba(0,0,0,1)",Ir.ctx.fill(),Ir.ctx.restore()}),fi.label=2;case 2:dn=0,fn=0,Ar=et,fi.label=3;case 3:return fn<Ar.length?(ur=Ar[fn],ur.style!==0&&!qo(ur.color)&&ur.width>0?ur.style!==2?[3,5]:[4,this.renderDashedDottedBorder(ur.color,ur.width,dn,$.curves,2)]:[3,11]):[3,13];case 4:return fi.sent(),[3,11];case 5:return ur.style!==3?[3,7]:[4,this.renderDashedDottedBorder(ur.color,ur.width,dn,$.curves,3)];case 6:return fi.sent(),[3,11];case 7:return ur.style!==4?[3,9]:[4,this.renderDoubleBorder(ur.color,ur.width,dn,$.curves)];case 8:return fi.sent(),[3,11];case 9:return[4,this.renderSolidBorder(ur.color,dn,$.curves)];case 10:fi.sent(),fi.label=11;case 11:dn++,fi.label=12;case 12:return fn++,[3,3];case 13:return[2]}})})},R.prototype.renderDashedDottedBorder=function($,K,_e,et,Ft){return Z(this,void 0,void 0,function(){var dn,fn,Ar,ur,Ir,fi,Qs,us,bs,Ja,fa,ea,ko,uo,Oa,ks,Oa,ks;return V(this,function(So){return this.ctx.save(),dn=A(et,_e),fn=x(et,_e),Ft===2&&(this.path(fn),this.ctx.clip()),Al(fn[0])?(Ar=fn[0].start.x,ur=fn[0].start.y):(Ar=fn[0].x,ur=fn[0].y),Al(fn[1])?(Ir=fn[1].end.x,fi=fn[1].end.y):(Ir=fn[1].x,fi=fn[1].y),_e===0||_e===2?Qs=Math.abs(Ar-Ir):Qs=Math.abs(ur-fi),this.ctx.beginPath(),Ft===3?this.formatPath(dn):this.formatPath(fn.slice(0,2)),us=K<3?K*3:K*2,bs=K<3?K*2:K,Ft===3&&(us=K,bs=K),Ja=!0,Qs<=us*2?Ja=!1:Qs<=us*2+bs?(fa=Qs/(2*us+bs),us*=fa,bs*=fa):(ea=Math.floor((Qs+bs)/(us+bs)),ko=(Qs-ea*us)/(ea-1),uo=(Qs-(ea+1)*us)/ea,bs=uo<=0||Math.abs(bs-ko)<Math.abs(bs-uo)?ko:uo),Ja&&(Ft===3?this.ctx.setLineDash([0,us+bs]):this.ctx.setLineDash([us,bs])),Ft===3?(this.ctx.lineCap="round",this.ctx.lineWidth=K):this.ctx.lineWidth=K*2+1.1,this.ctx.strokeStyle=Go($),this.ctx.stroke(),this.ctx.setLineDash([]),Ft===2&&(Al(fn[0])&&(Oa=fn[3],ks=fn[0],this.ctx.beginPath(),this.formatPath([new Us(Oa.end.x,Oa.end.y),new Us(ks.start.x,ks.start.y)]),this.ctx.stroke()),Al(fn[1])&&(Oa=fn[1],ks=fn[2],this.ctx.beginPath(),this.formatPath([new Us(Oa.end.x,Oa.end.y),new Us(ks.start.x,ks.start.y)]),this.ctx.stroke())),this.ctx.restore(),[2]})})},R.prototype.render=function($){return Z(this,void 0,void 0,function(){var K;return V(this,function(_e){switch(_e.label){case 0:return this.options.backgroundColor&&(this.ctx.fillStyle=Go(this.options.backgroundColor),this.ctx.fillRect(this.options.x,this.options.y,this.options.width,this.options.height)),K=ym($),[4,this.renderStack(K)];case 1:return _e.sent(),this.applyEffects([]),[2,this.canvas]}})})},R}(Tr),is=function(U){return U instanceof Md||U instanceof Lp?!0:U instanceof Pp&&U.type!==Jf&&U.type!==td},bi=function(U,R){switch(U){case 0:return hc(R);case 2:return Cc(R);case 1:default:return Rh(R)}},Ri=function(U){switch(U){case 1:return"center";case 2:return"right";case 0:default:return"left"}},Gs=["-apple-system","system-ui"],_s=function(U){return/iPhone OS 15_(0|1)/.test(window.navigator.userAgent)?U.filter(function(R){return Gs.indexOf(R)===-1}):U},Hs=function(U){b(R,U);function R($,K){var _e=U.call(this,$,K)||this;return _e.canvas=K.canvas?K.canvas:document.createElement("canvas"),_e.ctx=_e.canvas.getContext("2d"),_e.options=K,_e.canvas.width=Math.floor(K.width*K.scale),_e.canvas.height=Math.floor(K.height*K.scale),_e.canvas.style.width=K.width+"px",_e.canvas.style.height=K.height+"px",_e.ctx.scale(_e.options.scale,_e.options.scale),_e.ctx.translate(-K.x,-K.y),_e.context.logger.debug("EXPERIMENTAL ForeignObject renderer initialized ("+K.width+"x"+K.height+" at "+K.x+","+K.y+") with scale "+K.scale),_e}return R.prototype.render=function($){return Z(this,void 0,void 0,function(){var K,_e;return V(this,function(et){switch(et.label){case 0:return K=ih(this.options.width*this.options.scale,this.options.height*this.options.scale,this.options.scale,this.options.scale,$),[4,Zs(K)];case 1:return _e=et.sent(),this.options.backgroundColor&&(this.ctx.fillStyle=Go(this.options.backgroundColor),this.ctx.fillRect(0,0,this.options.width*this.options.scale,this.options.height*this.options.scale)),this.ctx.drawImage(_e,-this.options.x*this.options.scale,-this.options.y*this.options.scale),[2,this.canvas]}})})},R}(Tr),Zs=function(U){return new Promise(function(R,$){var K=new Image;K.onload=function(){R(K)},K.onerror=$,K.src="data:image/svg+xml;charset=utf-8,"+encodeURIComponent(new XMLSerializer().serializeToString(U))})},Ia=function(){function U(R){var $=R.id,K=R.enabled;this.id=$,this.enabled=K,this.start=Date.now()}return U.prototype.debug=function(){for(var R=[],$=0;$<arguments.length;$++)R[$]=arguments[$];this.enabled&&(typeof window!="undefined"&&window.console&&typeof console.debug=="function"?console.debug.apply(console,N([this.id,this.getTime()+"ms"],R)):this.info.apply(this,R))},U.prototype.getTime=function(){return Date.now()-this.start},U.prototype.info=function(){for(var R=[],$=0;$<arguments.length;$++)R[$]=arguments[$];this.enabled&&typeof window!="undefined"&&window.console&&typeof console.info=="function"&&console.info.apply(console,N([this.id,this.getTime()+"ms"],R))},U.prototype.warn=function(){for(var R=[],$=0;$<arguments.length;$++)R[$]=arguments[$];this.enabled&&(typeof window!="undefined"&&window.console&&typeof console.warn=="function"?console.warn.apply(console,N([this.id,this.getTime()+"ms"],R)):this.info.apply(this,R))},U.prototype.error=function(){for(var R=[],$=0;$<arguments.length;$++)R[$]=arguments[$];this.enabled&&(typeof window!="undefined"&&window.console&&typeof console.error=="function"?console.error.apply(console,N([this.id,this.getTime()+"ms"],R)):this.info.apply(this,R))},U.instances={},U}(),Po=function(){function U(R,$){var K;this.windowBounds=$,this.instanceName="#"+U.instanceCount++,this.logger=new Ia({id:this.instanceName,enabled:R.logging}),this.cache=(K=R.cache)!==null&&K!==void 0?K:new rd(this,R)}return U.instanceCount=1,U}(),Ml=function(U,R){return R===void 0&&(R={}),El(U,R)};typeof window!="undefined"&&fp.setContext(window);var El=function(U,R){return Z(void 0,void 0,void 0,function(){var $,K,_e,et,Ft,dn,fn,Ar,ur,Ir,fi,Qs,us,bs,Ja,fa,ea,ko,uo,Oa,So,ks,So,eo,za,nu,wu,hu,pl,Nu,Qh,Ju,Tc,If,id,GA,sd,lA,ef,Nf;return V(this,function(Td){switch(Td.label){case 0:if(!U||typeof U!="object")return[2,Promise.reject("Invalid element provided as first argument")];if($=U.ownerDocument,!$)throw new Error("Element is not attached to a Document");if(K=$.defaultView,!K)throw new Error("Document is not attached to a Window");return _e={allowTaint:(eo=R.allowTaint)!==null&&eo!==void 0?eo:!1,imageTimeout:(za=R.imageTimeout)!==null&&za!==void 0?za:15e3,proxy:R.proxy,useCORS:(nu=R.useCORS)!==null&&nu!==void 0?nu:!1},et=m({logging:(wu=R.logging)!==null&&wu!==void 0?wu:!0,cache:R.cache},_e),Ft={windowWidth:(hu=R.windowWidth)!==null&&hu!==void 0?hu:K.innerWidth,windowHeight:(pl=R.windowHeight)!==null&&pl!==void 0?pl:K.innerHeight,scrollX:(Nu=R.scrollX)!==null&&Nu!==void 0?Nu:K.pageXOffset,scrollY:(Qh=R.scrollY)!==null&&Qh!==void 0?Qh:K.pageYOffset},dn=new E(Ft.scrollX,Ft.scrollY,Ft.windowWidth,Ft.windowHeight),fn=new Po(et,dn),Ar=(Ju=R.foreignObjectRendering)!==null&&Ju!==void 0?Ju:!1,ur={allowTaint:(Tc=R.allowTaint)!==null&&Tc!==void 0?Tc:!1,onclone:R.onclone,ignoreElements:R.ignoreElements,inlineImages:Ar,copyStyles:Ar},fn.logger.debug("Starting document clone with size "+dn.width+"x"+dn.height+" scrolled to "+-dn.left+","+-dn.top),Ir=new up(fn,U,ur),fi=Ir.clonedReferenceElement,fi?[4,Ir.toIFrame($,dn)]:[2,Promise.reject("Unable to find element in cloned iframe")];case 1:return Qs=Td.sent(),us=$d(fi)||Dp(fi)?C(fi.ownerDocument):F(fn,fi),bs=us.width,Ja=us.height,fa=us.left,ea=us.top,ko=Ys(fn,fi,R.backgroundColor),uo={canvas:R.canvas,backgroundColor:ko,scale:(id=(If=R.scale)!==null&&If!==void 0?If:K.devicePixelRatio)!==null&&id!==void 0?id:1,x:((GA=R.x)!==null&&GA!==void 0?GA:0)+fa,y:((sd=R.y)!==null&&sd!==void 0?sd:0)+ea,width:(lA=R.width)!==null&&lA!==void 0?lA:Math.ceil(bs),height:(ef=R.height)!==null&&ef!==void 0?ef:Math.ceil(Ja)},Ar?(fn.logger.debug("Document cloned, using foreign object rendering"),So=new Hs(fn,uo),[4,So.render(fi)]):[3,3];case 2:return Oa=Td.sent(),[3,5];case 3:return fn.logger.debug("Document cloned, element located at "+fa+","+ea+" with size "+bs+"x"+Ja+" using computed rendering"),fn.logger.debug("Starting DOM parsing"),ks=Zd(fn,fi),ko===ks.styles.backgroundColor&&(ks.styles.backgroundColor=lc.TRANSPARENT),fn.logger.debug("Starting renderer for element at "+uo.x+","+uo.y+" with size "+uo.width+"x"+uo.height),So=new ns(fn,uo),[4,So.render(ks)];case 4:Oa=Td.sent(),Td.label=5;case 5:return(!((Nf=R.removeContainer)!==null&&Nf!==void 0)||Nf)&&(up.destroy(Qs)||fn.logger.error("Cannot detach cloned iframe as it is not in the DOM anymore")),fn.logger.debug("Finished rendering"),[2,Oa]}})})},Ys=function(U,R,$){var K=R.ownerDocument,_e=K.documentElement?Xh(U,getComputedStyle(K.documentElement).backgroundColor):lc.TRANSPARENT,et=K.body?Xh(U,getComputedStyle(K.body).backgroundColor):lc.TRANSPARENT,Ft=typeof $=="string"?Xh(U,$):$===null?lc.TRANSPARENT:4294967295;return R===K.documentElement?qo(_e)?qo(et)?Ft:et:_e:Ft};return Ml})},34634:function(Be,Me,b){"use strict";b.r(Me),b.d(Me,{isAnyArray:function(){return Z}});const m=Object.prototype.toString;function Z(V){const N=m.call(V);return N.endsWith("Array]")&&!N.includes("Big")}},55973:function(Be){Be.exports=function(b){return!b||typeof b=="string"?!1:b instanceof Array||Array.isArray(b)||b.length>=0&&(b.splice instanceof Function||Object.getOwnPropertyDescriptor(b,b.length-1)&&b.constructor.name!=="String")}},15584:function(Be,Me,b){var m=b(73893),Z=b(33152),V=m(Z,"DataView");Be.exports=V},97288:function(Be,Me,b){var m=b(73893),Z=b(33152),V=m(Z,"Promise");Be.exports=V},23599:function(Be,Me,b){var m=b(73893),Z=b(33152),V=m(Z,"Set");Be.exports=V},98924:function(Be,Me,b){var m=b(52166),Z=b(34776),V=b(40393);function N(E){var F=-1,C=E==null?0:E.length;for(this.__data__=new m;++F<C;)this.add(E[F])}N.prototype.add=N.prototype.push=Z,N.prototype.has=V,Be.exports=N},26873:function(Be,Me,b){var m=b(73893),Z=b(33152),V=m(Z,"WeakMap");Be.exports=V},74809:function(Be){function Me(b,m){for(var Z=-1,V=b==null?0:b.length;++Z<V&&m(b[Z],Z,b)!==!1;);return b}Be.exports=Me},86952:function(Be){function Me(b,m){for(var Z=-1,V=b==null?0:b.length,N=0,E=[];++Z<V;){var F=b[Z];m(F,Z,b)&&(E[N++]=F)}return E}Be.exports=Me},84271:function(Be,Me,b){var m=b(17424);function Z(V,N){var E=V==null?0:V.length;return!!E&&m(V,N,0)>-1}Be.exports=Z},94874:function(Be){function Me(b,m,Z){for(var V=-1,N=b==null?0:b.length;++V<N;)if(Z(m,b[V]))return!0;return!1}Be.exports=Me},75010:function(Be){function Me(b,m){for(var Z=-1,V=b==null?0:b.length,N=Array(V);++Z<V;)N[Z]=m(b[Z],Z,b);return N}Be.exports=Me},57095:function(Be){function Me(b,m){for(var Z=-1,V=m.length,N=b.length;++Z<V;)b[N+Z]=m[Z];return b}Be.exports=Me},99861:function(Be){function Me(b,m,Z,V){var N=-1,E=b==null?0:b.length;for(V&&E&&(Z=b[++N]);++N<E;)Z=m(Z,b[N],N,b);return Z}Be.exports=Me},64045:function(Be){function Me(b,m){for(var Z=-1,V=b==null?0:b.length;++Z<V;)if(m(b[Z],Z,b))return!0;return!1}Be.exports=Me},26539:function(Be,Me,b){var m=b(22310),Z=m("length");Be.exports=Z},91937:function(Be,Me,b){var m=b(95378),Z=b(55451);function V(N,E){return N&&m(E,Z(E),N)}Be.exports=V},26680:function(Be,Me,b){var m=b(95378),Z=b(56730);function V(N,E){return N&&m(E,Z(E),N)}Be.exports=V},99045:function(Be,Me,b){var m=b(91866),Z=b(74809),V=b(60348),N=b(91937),E=b(26680),F=b(32315),C=b(47760),P=b(15168),H=b(71678),D=b(12076),X=b(22675),j=b(66139),de=b(79264),he=b(97541),we=b(4084),ve=b(80744),Ee=b(57835),$e=b(41626),Fe=b(20816),ct=b(65226),vt=b(55451),at=b(56730),kt=1,It=2,Bn=4,Lt="[object Arguments]",Wn="[object Array]",Xn="[object Boolean]",In="[object Date]",zn="[object Error]",dr="[object Function]",vn="[object GeneratorFunction]",_r="[object Map]",Ge="[object Number]",Tt="[object Object]",On="[object RegExp]",Vr="[object Set]",en="[object String]",ln="[object Symbol]",Cn="[object WeakMap]",Mt="[object ArrayBuffer]",Et="[object DataView]",pe="[object Float32Array]",Ae="[object Float64Array]",Pe="[object Int8Array]",Ut="[object Int16Array]",jt="[object Int32Array]",ft="[object Uint8Array]",on="[object Uint8ClampedArray]",hn="[object Uint16Array]",lt="[object Uint32Array]",Ct={};Ct[Lt]=Ct[Wn]=Ct[Mt]=Ct[Et]=Ct[Xn]=Ct[In]=Ct[pe]=Ct[Ae]=Ct[Pe]=Ct[Ut]=Ct[jt]=Ct[_r]=Ct[Ge]=Ct[Tt]=Ct[On]=Ct[Vr]=Ct[en]=Ct[ln]=Ct[ft]=Ct[on]=Ct[hn]=Ct[lt]=!0,Ct[zn]=Ct[dr]=Ct[Cn]=!1;function sn(W,Se,Ht,zt,Fn,Tn){var lr,je=Se&kt,be=Se&It,it=Se&Bn;if(Ht&&(lr=Fn?Ht(W,zt,Fn,Tn):Ht(W)),lr!==void 0)return lr;if(!Fe(W))return W;var wt=ve(W);if(wt){if(lr=de(W),!je)return C(W,lr)}else{var ot=j(W),ut=ot==dr||ot==vn;if(Ee(W))return F(W,je);if(ot==Tt||ot==Lt||ut&&!Fn){if(lr=be||ut?{}:we(W),!je)return be?H(W,E(lr,W)):P(W,N(lr,W))}else{if(!Ct[ot])return Fn?W:{};lr=he(W,ot,je)}}Tn||(Tn=new m);var _t=Tn.get(W);if(_t)return _t;Tn.set(W,lr),ct(W)?W.forEach(function(Qt){lr.add(sn(Qt,Se,Ht,Qt,W,Tn))}):$e(W)&&W.forEach(function(Qt,cn){lr.set(cn,sn(Qt,Se,Ht,cn,W,Tn))});var $t=it?be?X:D:be?at:vt,Vt=wt?void 0:$t(W);return Z(Vt||W,function(Qt,cn){Vt&&(cn=Qt,Qt=W[cn]),V(lr,cn,sn(Qt,Se,Ht,cn,W,Tn))}),lr}Be.exports=sn},44107:function(Be,Me,b){var m=b(85605),Z=b(49164),V=Z(m);Be.exports=V},2659:function(Be,Me,b){var m=b(45029);function Z(V,N,E){for(var F=-1,C=V.length;++F<C;){var P=V[F],H=N(P);if(H!=null&&(D===void 0?H===H&&!m(H):E(H,D)))var D=H,X=P}return X}Be.exports=Z},32872:function(Be,Me,b){var m=b(44107);function Z(V,N){var E=[];return m(V,function(F,C,P){N(F,C,P)&&E.push(F)}),E}Be.exports=Z},51533:function(Be){function Me(b,m,Z,V){for(var N=b.length,E=Z+(V?1:-1);V?E--:++E<N;)if(m(b[E],E,b))return E;return-1}Be.exports=Me},9256:function(Be,Me,b){var m=b(57095),Z=b(88133);function V(N,E,F,C,P){var H=-1,D=N.length;for(F||(F=Z),P||(P=[]);++H<D;){var X=N[H];E>0&&F(X)?E>1?V(X,E-1,F,C,P):m(P,X):C||(P[P.length]=X)}return P}Be.exports=V},85605:function(Be,Me,b){var m=b(14018),Z=b(55451);function V(N,E){return N&&m(N,E,Z)}Be.exports=V},89147:function(Be,Me,b){var m=b(1186),Z=b(9171);function V(N,E){E=m(E,N);for(var F=0,C=E.length;N!=null&&F<C;)N=N[Z(E[F++])];return F&&F==C?N:void 0}Be.exports=V},75635:function(Be,Me,b){var m=b(57095),Z=b(80744);function V(N,E,F){var C=E(N);return Z(N)?C:m(C,F(N))}Be.exports=V},40302:function(Be){function Me(b,m){return b>m}Be.exports=Me},3251:function(Be){var Me=Object.prototype,b=Me.hasOwnProperty;function m(Z,V){return Z!=null&&b.call(Z,V)}Be.exports=m},62348:function(Be){function Me(b,m){return b!=null&&m in Object(b)}Be.exports=Me},17424:function(Be,Me,b){var m=b(51533),Z=b(8373),V=b(49237);function N(E,F,C){return F===F?V(E,F,C):m(E,Z,C)}Be.exports=N},77295:function(Be,Me,b){var m=b(84412),Z=b(93913);function V(N,E,F,C,P){return N===E?!0:N==null||E==null||!Z(N)&&!Z(E)?N!==N&&E!==E:m(N,E,F,C,V,P)}Be.exports=V},84412:function(Be,Me,b){var m=b(91866),Z=b(50401),V=b(57710),N=b(4983),E=b(66139),F=b(80744),C=b(57835),P=b(18397),H=1,D="[object Arguments]",X="[object Array]",j="[object Object]",de=Object.prototype,he=de.hasOwnProperty;function we(ve,Ee,$e,Fe,ct,vt){var at=F(ve),kt=F(Ee),It=at?X:E(ve),Bn=kt?X:E(Ee);It=It==D?j:It,Bn=Bn==D?j:Bn;var Lt=It==j,Wn=Bn==j,Xn=It==Bn;if(Xn&&C(ve)){if(!C(Ee))return!1;at=!0,Lt=!1}if(Xn&&!Lt)return vt||(vt=new m),at||P(ve)?Z(ve,Ee,$e,Fe,ct,vt):V(ve,Ee,It,$e,Fe,ct,vt);if(!($e&H)){var In=Lt&&he.call(ve,"__wrapped__"),zn=Wn&&he.call(Ee,"__wrapped__");if(In||zn){var dr=In?ve.value():ve,vn=zn?Ee.value():Ee;return vt||(vt=new m),ct(dr,vn,$e,Fe,vt)}}return Xn?(vt||(vt=new m),N(ve,Ee,$e,Fe,ct,vt)):!1}Be.exports=we},55005:function(Be,Me,b){var m=b(66139),Z=b(93913),V="[object Map]";function N(E){return Z(E)&&m(E)==V}Be.exports=N},51524:function(Be,Me,b){var m=b(91866),Z=b(77295),V=1,N=2;function E(F,C,P,H){var D=P.length,X=D,j=!H;if(F==null)return!X;for(F=Object(F);D--;){var de=P[D];if(j&&de[2]?de[1]!==F[de[0]]:!(de[0]in F))return!1}for(;++D<X;){de=P[D];var he=de[0],we=F[he],ve=de[1];if(j&&de[2]){if(we===void 0&&!(he in F))return!1}else{var Ee=new m;if(H)var $e=H(we,ve,he,F,C,Ee);if(!($e===void 0?Z(ve,we,V|N,H,Ee):$e))return!1}}return!0}Be.exports=E},8373:function(Be){function Me(b){return b!==b}Be.exports=Me},38652:function(Be,Me,b){var m=b(66139),Z=b(93913),V="[object Set]";function N(E){return Z(E)&&m(E)==V}Be.exports=N},95979:function(Be,Me,b){var m=b(17632),Z=b(38933),V=b(46962),N=b(80744),E=b(35769);function F(C){return typeof C=="function"?C:C==null?V:typeof C=="object"?N(C)?Z(C[0],C[1]):m(C):E(C)}Be.exports=F},6019:function(Be,Me,b){var m=b(7975),Z=b(23730),V=Object.prototype,N=V.hasOwnProperty;function E(F){if(!m(F))return Z(F);var C=[];for(var P in Object(F))N.call(F,P)&&P!="constructor"&&C.push(P);return C}Be.exports=E},93757:function(Be){function Me(b,m){return b<m}Be.exports=Me},65487:function(Be,Me,b){var m=b(44107),Z=b(24665);function V(N,E){var F=-1,C=Z(N)?Array(N.length):[];return m(N,function(P,H,D){C[++F]=E(P,H,D)}),C}Be.exports=V},17632:function(Be,Me,b){var m=b(51524),Z=b(10261),V=b(24122);function N(E){var F=Z(E);return F.length==1&&F[0][2]?V(F[0][0],F[0][1]):function(C){return C===E||m(C,E,F)}}Be.exports=N},38933:function(Be,Me,b){var m=b(77295),Z=b(44231),V=b(37879),N=b(86773),E=b(88411),F=b(24122),C=b(9171),P=1,H=2;function D(X,j){return N(X)&&E(j)?F(C(X),j):function(de){var he=Z(de,X);return he===void 0&&he===j?V(de,X):m(j,he,P|H)}}Be.exports=D},58506:function(Be,Me,b){var m=b(75010),Z=b(89147),V=b(95979),N=b(65487),E=b(33065),F=b(38342),C=b(11249),P=b(46962),H=b(80744);function D(X,j,de){j.length?j=m(j,function(ve){return H(ve)?function(Ee){return Z(Ee,ve.length===1?ve[0]:ve)}:ve}):j=[P];var he=-1;j=m(j,F(V));var we=N(X,function(ve,Ee,$e){var Fe=m(j,function(ct){return ct(ve)});return{criteria:Fe,index:++he,value:ve}});return E(we,function(ve,Ee){return C(ve,Ee,de)})}Be.exports=D},88832:function(Be,Me,b){var m=b(10867),Z=b(37879);function V(N,E){return m(N,E,function(F,C){return Z(N,C)})}Be.exports=V},10867:function(Be,Me,b){var m=b(89147),Z=b(36897),V=b(1186);function N(E,F,C){for(var P=-1,H=F.length,D={};++P<H;){var X=F[P],j=m(E,X);C(j,X)&&Z(D,V(X,E),j)}return D}Be.exports=N},22310:function(Be){function Me(b){return function(m){return m==null?void 0:m[b]}}Be.exports=Me},96916:function(Be,Me,b){var m=b(89147);function Z(V){return function(N){return m(N,V)}}Be.exports=Z},36121:function(Be){var Me=Math.ceil,b=Math.max;function m(Z,V,N,E){for(var F=-1,C=b(Me((V-Z)/(N||1)),0),P=Array(C);C--;)P[E?C:++F]=Z,Z+=N;return P}Be.exports=m},30739:function(Be){function Me(b,m,Z,V,N){return N(b,function(E,F,C){Z=V?(V=!1,E):m(Z,E,F,C)}),Z}Be.exports=Me},36897:function(Be,Me,b){var m=b(60348),Z=b(1186),V=b(70213),N=b(20816),E=b(9171);function F(C,P,H,D){if(!N(C))return C;P=Z(P,C);for(var X=-1,j=P.length,de=j-1,he=C;he!=null&&++X<j;){var we=E(P[X]),ve=H;if(we==="__proto__"||we==="constructor"||we==="prototype")return C;if(X!=de){var Ee=he[we];ve=D?D(Ee,we,he):void 0,ve===void 0&&(ve=N(Ee)?Ee:V(P[X+1])?[]:{})}m(he,we,ve),he=he[we]}return C}Be.exports=F},33065:function(Be){function Me(b,m){var Z=b.length;for(b.sort(m);Z--;)b[Z]=b[Z].value;return b}Be.exports=Me},50230:function(Be,Me,b){var m=b(91869),Z=b(75010),V=b(80744),N=b(45029),E=1/0,F=m?m.prototype:void 0,C=F?F.toString:void 0;function P(H){if(typeof H=="string")return H;if(V(H))return Z(H,P)+"";if(N(H))return C?C.call(H):"";var D=H+"";return D=="0"&&1/H==-E?"-0":D}Be.exports=P},13927:function(Be,Me,b){var m=b(15333),Z=/^\s+/;function V(N){return N&&N.slice(0,m(N)+1).replace(Z,"")}Be.exports=V},29098:function(Be,Me,b){var m=b(98924),Z=b(84271),V=b(94874),N=b(1931),E=b(47506),F=b(79679),C=200;function P(H,D,X){var j=-1,de=Z,he=H.length,we=!0,ve=[],Ee=ve;if(X)we=!1,de=V;else if(he>=C){var $e=D?null:E(H);if($e)return F($e);we=!1,de=N,Ee=new m}else Ee=D?[]:ve;e:for(;++j<he;){var Fe=H[j],ct=D?D(Fe):Fe;if(Fe=X||Fe!==0?Fe:0,we&&ct===ct){for(var vt=Ee.length;vt--;)if(Ee[vt]===ct)continue e;D&&Ee.push(ct),ve.push(Fe)}else de(Ee,ct,X)||(Ee!==ve&&Ee.push(ct),ve.push(Fe))}return ve}Be.exports=P},20720:function(Be,Me,b){var m=b(75010);function Z(V,N){return m(N,function(E){return V[E]})}Be.exports=Z},94484:function(Be){function Me(b,m,Z){for(var V=-1,N=b.length,E=m.length,F={};++V<N;){var C=V<E?m[V]:void 0;Z(F,b[V],C)}return F}Be.exports=Me},1931:function(Be){function Me(b,m){return b.has(m)}Be.exports=Me},11756:function(Be,Me,b){var m=b(46962);function Z(V){return typeof V=="function"?V:m}Be.exports=Z},1186:function(Be,Me,b){var m=b(80744),Z=b(86773),V=b(40493),N=b(44140);function E(F,C){return m(F)?F:Z(F,C)?[F]:V(N(F))}Be.exports=E},27984:function(Be,Me,b){var m=b(20188);function Z(V,N){var E=N?m(V.buffer):V.buffer;return new V.constructor(E,V.byteOffset,V.byteLength)}Be.exports=Z},78583:function(Be){var Me=/\w*$/;function b(m){var Z=new m.constructor(m.source,Me.exec(m));return Z.lastIndex=m.lastIndex,Z}Be.exports=b},28757:function(Be,Me,b){var m=b(91869),Z=m?m.prototype:void 0,V=Z?Z.valueOf:void 0;function N(E){return V?Object(V.call(E)):{}}Be.exports=N},83018:function(Be,Me,b){var m=b(45029);function Z(V,N){if(V!==N){var E=V!==void 0,F=V===null,C=V===V,P=m(V),H=N!==void 0,D=N===null,X=N===N,j=m(N);if(!D&&!j&&!P&&V>N||P&&H&&X&&!D&&!j||F&&H&&X||!E&&X||!C)return 1;if(!F&&!P&&!j&&V<N||j&&E&&C&&!F&&!P||D&&E&&C||!H&&C||!X)return-1}return 0}Be.exports=Z},11249:function(Be,Me,b){var m=b(83018);function Z(V,N,E){for(var F=-1,C=V.criteria,P=N.criteria,H=C.length,D=E.length;++F<H;){var X=m(C[F],P[F]);if(X){if(F>=D)return X;var j=E[F];return X*(j=="desc"?-1:1)}}return V.index-N.index}Be.exports=Z},15168:function(Be,Me,b){var m=b(95378),Z=b(58966);function V(N,E){return m(N,Z(N),E)}Be.exports=V},71678:function(Be,Me,b){var m=b(95378),Z=b(66817);function V(N,E){return m(N,Z(N),E)}Be.exports=V},49164:function(Be,Me,b){var m=b(24665);function Z(V,N){return function(E,F){if(E==null)return E;if(!m(E))return V(E,F);for(var C=E.length,P=N?C:-1,H=Object(E);(N?P--:++P<C)&&F(H[P],P,H)!==!1;);return E}}Be.exports=Z},19554:function(Be,Me,b){var m=b(95979),Z=b(24665),V=b(55451);function N(E){return function(F,C,P){var H=Object(F);if(!Z(F)){var D=m(C,3);F=V(F),C=function(j){return D(H[j],j,H)}}var X=E(F,C,P);return X>-1?H[D?F[X]:X]:void 0}}Be.exports=N},76106:function(Be,Me,b){var m=b(36121),Z=b(8138),V=b(97341);function N(E){return function(F,C,P){return P&&typeof P!="number"&&Z(F,C,P)&&(C=P=void 0),F=V(F),C===void 0?(C=F,F=0):C=V(C),P=P===void 0?F<C?1:-1:V(P),m(F,C,P,E)}}Be.exports=N},47506:function(Be,Me,b){var m=b(23599),Z=b(9958),V=b(79679),N=1/0,E=m&&1/V(new m([,-0]))[1]==N?function(F){return new m(F)}:Z;Be.exports=E},50401:function(Be,Me,b){var m=b(98924),Z=b(64045),V=b(1931),N=1,E=2;function F(C,P,H,D,X,j){var de=H&N,he=C.length,we=P.length;if(he!=we&&!(de&&we>he))return!1;var ve=j.get(C),Ee=j.get(P);if(ve&&Ee)return ve==P&&Ee==C;var $e=-1,Fe=!0,ct=H&E?new m:void 0;for(j.set(C,P),j.set(P,C);++$e<he;){var vt=C[$e],at=P[$e];if(D)var kt=de?D(at,vt,$e,P,C,j):D(vt,at,$e,C,P,j);if(kt!==void 0){if(kt)continue;Fe=!1;break}if(ct){if(!Z(P,function(It,Bn){if(!V(ct,Bn)&&(vt===It||X(vt,It,H,D,j)))return ct.push(Bn)})){Fe=!1;break}}else if(!(vt===at||X(vt,at,H,D,j))){Fe=!1;break}}return j.delete(C),j.delete(P),Fe}Be.exports=F},57710:function(Be,Me,b){var m=b(91869),Z=b(77945),V=b(43607),N=b(50401),E=b(83383),F=b(79679),C=1,P=2,H="[object Boolean]",D="[object Date]",X="[object Error]",j="[object Map]",de="[object Number]",he="[object RegExp]",we="[object Set]",ve="[object String]",Ee="[object Symbol]",$e="[object ArrayBuffer]",Fe="[object DataView]",ct=m?m.prototype:void 0,vt=ct?ct.valueOf:void 0;function at(kt,It,Bn,Lt,Wn,Xn,In){switch(Bn){case Fe:if(kt.byteLength!=It.byteLength||kt.byteOffset!=It.byteOffset)return!1;kt=kt.buffer,It=It.buffer;case $e:return!(kt.byteLength!=It.byteLength||!Xn(new Z(kt),new Z(It)));case H:case D:case de:return V(+kt,+It);case X:return kt.name==It.name&&kt.message==It.message;case he:case ve:return kt==It+"";case j:var zn=E;case we:var dr=Lt&C;if(zn||(zn=F),kt.size!=It.size&&!dr)return!1;var vn=In.get(kt);if(vn)return vn==It;Lt|=P,In.set(kt,It);var _r=N(zn(kt),zn(It),Lt,Wn,Xn,In);return In.delete(kt),_r;case Ee:if(vt)return vt.call(kt)==vt.call(It)}return!1}Be.exports=at},4983:function(Be,Me,b){var m=b(12076),Z=1,V=Object.prototype,N=V.hasOwnProperty;function E(F,C,P,H,D,X){var j=P&Z,de=m(F),he=de.length,we=m(C),ve=we.length;if(he!=ve&&!j)return!1;for(var Ee=he;Ee--;){var $e=de[Ee];if(!(j?$e in C:N.call(C,$e)))return!1}var Fe=X.get(F),ct=X.get(C);if(Fe&&ct)return Fe==C&&ct==F;var vt=!0;X.set(F,C),X.set(C,F);for(var at=j;++Ee<he;){$e=de[Ee];var kt=F[$e],It=C[$e];if(H)var Bn=j?H(It,kt,$e,C,F,X):H(kt,It,$e,F,C,X);if(!(Bn===void 0?kt===It||D(kt,It,P,H,X):Bn)){vt=!1;break}at||(at=$e=="constructor")}if(vt&&!at){var Lt=F.constructor,Wn=C.constructor;Lt!=Wn&&"constructor"in F&&"constructor"in C&&!(typeof Lt=="function"&&Lt instanceof Lt&&typeof Wn=="function"&&Wn instanceof Wn)&&(vt=!1)}return X.delete(F),X.delete(C),vt}Be.exports=E},522:function(Be,Me,b){var m=b(40151),Z=b(19652),V=b(71152);function N(E){return V(Z(E,void 0,m),E+"")}Be.exports=N},12076:function(Be,Me,b){var m=b(75635),Z=b(58966),V=b(55451);function N(E){return m(E,V,Z)}Be.exports=N},22675:function(Be,Me,b){var m=b(75635),Z=b(66817),V=b(56730);function N(E){return m(E,V,Z)}Be.exports=N},10261:function(Be,Me,b){var m=b(88411),Z=b(55451);function V(N){for(var E=Z(N),F=E.length;F--;){var C=E[F],P=N[C];E[F]=[C,P,m(P)]}return E}Be.exports=V},58966:function(Be,Me,b){var m=b(86952),Z=b(4134),V=Object.prototype,N=V.propertyIsEnumerable,E=Object.getOwnPropertySymbols,F=E?function(C){return C==null?[]:(C=Object(C),m(E(C),function(P){return N.call(C,P)}))}:Z;Be.exports=F},66817:function(Be,Me,b){var m=b(57095),Z=b(49217),V=b(58966),N=b(4134),E=Object.getOwnPropertySymbols,F=E?function(C){for(var P=[];C;)m(P,V(C)),C=Z(C);return P}:N;Be.exports=F},66139:function(Be,Me,b){var m=b(15584),Z=b(40164),V=b(97288),N=b(23599),E=b(26873),F=b(86756),C=b(63256),P="[object Map]",H="[object Object]",D="[object Promise]",X="[object Set]",j="[object WeakMap]",de="[object DataView]",he=C(m),we=C(Z),ve=C(V),Ee=C(N),$e=C(E),Fe=F;(m&&Fe(new m(new ArrayBuffer(1)))!=de||Z&&Fe(new Z)!=P||V&&Fe(V.resolve())!=D||N&&Fe(new N)!=X||E&&Fe(new E)!=j)&&(Fe=function(ct){var vt=F(ct),at=vt==H?ct.constructor:void 0,kt=at?C(at):"";if(kt)switch(kt){case he:return de;case we:return P;case ve:return D;case Ee:return X;case $e:return j}return vt}),Be.exports=Fe},63100:function(Be,Me,b){var m=b(1186),Z=b(13053),V=b(80744),N=b(70213),E=b(11156),F=b(9171);function C(P,H,D){H=m(H,P);for(var X=-1,j=H.length,de=!1;++X<j;){var he=F(H[X]);if(!(de=P!=null&&D(P,he)))break;P=P[he]}return de||++X!=j?de:(j=P==null?0:P.length,!!j&&E(j)&&N(he,j)&&(V(P)||Z(P)))}Be.exports=C},55015:function(Be){var Me="\\ud800-\\udfff",b="\\u0300-\\u036f",m="\\ufe20-\\ufe2f",Z="\\u20d0-\\u20ff",V=b+m+Z,N="\\ufe0e\\ufe0f",E="\\u200d",F=RegExp("["+E+Me+V+N+"]");function C(P){return F.test(P)}Be.exports=C},79264:function(Be){var Me=Object.prototype,b=Me.hasOwnProperty;function m(Z){var V=Z.length,N=new Z.constructor(V);return V&&typeof Z[0]=="string"&&b.call(Z,"index")&&(N.index=Z.index,N.input=Z.input),N}Be.exports=m},97541:function(Be,Me,b){var m=b(20188),Z=b(27984),V=b(78583),N=b(28757),E=b(78358),F="[object Boolean]",C="[object Date]",P="[object Map]",H="[object Number]",D="[object RegExp]",X="[object Set]",j="[object String]",de="[object Symbol]",he="[object ArrayBuffer]",we="[object DataView]",ve="[object Float32Array]",Ee="[object Float64Array]",$e="[object Int8Array]",Fe="[object Int16Array]",ct="[object Int32Array]",vt="[object Uint8Array]",at="[object Uint8ClampedArray]",kt="[object Uint16Array]",It="[object Uint32Array]";function Bn(Lt,Wn,Xn){var In=Lt.constructor;switch(Wn){case he:return m(Lt);case F:case C:return new In(+Lt);case we:return Z(Lt,Xn);case ve:case Ee:case $e:case Fe:case ct:case vt:case at:case kt:case It:return E(Lt,Xn);case P:return new In;case H:case j:return new In(Lt);case D:return V(Lt);case X:return new In;case de:return N(Lt)}}Be.exports=Bn},88133:function(Be,Me,b){var m=b(91869),Z=b(13053),V=b(80744),N=m?m.isConcatSpreadable:void 0;function E(F){return V(F)||Z(F)||!!(N&&F&&F[N])}Be.exports=E},86773:function(Be,Me,b){var m=b(80744),Z=b(45029),V=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,N=/^\w*$/;function E(F,C){if(m(F))return!1;var P=typeof F;return P=="number"||P=="symbol"||P=="boolean"||F==null||Z(F)?!0:N.test(F)||!V.test(F)||C!=null&&F in Object(C)}Be.exports=E},88411:function(Be,Me,b){var m=b(20816);function Z(V){return V===V&&!m(V)}Be.exports=Z},83383:function(Be){function Me(b){var m=-1,Z=Array(b.size);return b.forEach(function(V,N){Z[++m]=[N,V]}),Z}Be.exports=Me},24122:function(Be){function Me(b,m){return function(Z){return Z==null?!1:Z[b]===m&&(m!==void 0||b in Object(Z))}}Be.exports=Me},26332:function(Be,Me,b){var m=b(52858),Z=500;function V(N){var E=m(N,function(C){return F.size===Z&&F.clear(),C}),F=E.cache;return E}Be.exports=V},23730:function(Be,Me,b){var m=b(31030),Z=m(Object.keys,Object);Be.exports=Z},34776:function(Be){var Me="__lodash_hash_undefined__";function b(m){return this.__data__.set(m,Me),this}Be.exports=b},40393:function(Be){function Me(b){return this.__data__.has(b)}Be.exports=Me},79679:function(Be){function Me(b){var m=-1,Z=Array(b.size);return b.forEach(function(V){Z[++m]=V}),Z}Be.exports=Me},49237:function(Be){function Me(b,m,Z){for(var V=Z-1,N=b.length;++V<N;)if(b[V]===m)return V;return-1}Be.exports=Me},29405:function(Be,Me,b){var m=b(26539),Z=b(55015),V=b(60844);function N(E){return Z(E)?V(E):m(E)}Be.exports=N},40493:function(Be,Me,b){var m=b(26332),Z=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,V=/\\(\\)?/g,N=m(function(E){var F=[];return E.charCodeAt(0)===46&&F.push(""),E.replace(Z,function(C,P,H,D){F.push(H?D.replace(V,"$1"):P||C)}),F});Be.exports=N},9171:function(Be,Me,b){var m=b(45029),Z=1/0;function V(N){if(typeof N=="string"||m(N))return N;var E=N+"";return E=="0"&&1/N==-Z?"-0":E}Be.exports=V},15333:function(Be){var Me=/\s/;function b(m){for(var Z=m.length;Z--&&Me.test(m.charAt(Z)););return Z}Be.exports=b},60844:function(Be){var Me="\\ud800-\\udfff",b="\\u0300-\\u036f",m="\\ufe20-\\ufe2f",Z="\\u20d0-\\u20ff",V=b+m+Z,N="\\ufe0e\\ufe0f",E="["+Me+"]",F="["+V+"]",C="\\ud83c[\\udffb-\\udfff]",P="(?:"+F+"|"+C+")",H="[^"+Me+"]",D="(?:\\ud83c[\\udde6-\\uddff]){2}",X="[\\ud800-\\udbff][\\udc00-\\udfff]",j="\\u200d",de=P+"?",he="["+N+"]?",we="(?:"+j+"(?:"+[H,D,X].join("|")+")"+he+de+")*",ve=he+de+we,Ee="(?:"+[H+F+"?",F,D,X,E].join("|")+")",$e=RegExp(C+"(?="+C+")|"+Ee+ve,"g");function Fe(ct){for(var vt=$e.lastIndex=0;$e.test(ct);)++vt;return vt}Be.exports=Fe},76833:function(Be,Me,b){var m=b(99045),Z=4;function V(N){return m(N,Z)}Be.exports=V},20250:function(Be,Me,b){var m=b(99045),Z=1,V=4;function N(E){return m(E,Z|V)}Be.exports=N},28548:function(Be,Me,b){var m=b(92918),Z=b(43607),V=b(8138),N=b(56730),E=Object.prototype,F=E.hasOwnProperty,C=m(function(P,H){P=Object(P);var D=-1,X=H.length,j=X>2?H[2]:void 0;for(j&&V(H[0],H[1],j)&&(X=1);++D<X;)for(var de=H[D],he=N(de),we=-1,ve=he.length;++we<ve;){var Ee=he[we],$e=P[Ee];($e===void 0||Z($e,E[Ee])&&!F.call(P,Ee))&&(P[Ee]=de[Ee])}return P});Be.exports=C},76934:function(Be,Me,b){Be.exports=b(99204)},64725:function(Be,Me,b){var m=b(86952),Z=b(32872),V=b(95979),N=b(80744);function E(F,C){var P=N(F)?m:Z;return P(F,V(C,3))}Be.exports=E},79785:function(Be,Me,b){var m=b(19554),Z=b(9991),V=m(Z);Be.exports=V},9991:function(Be,Me,b){var m=b(51533),Z=b(95979),V=b(12824),N=Math.max;function E(F,C,P){var H=F==null?0:F.length;if(!H)return-1;var D=P==null?0:V(P);return D<0&&(D=N(H+D,0)),m(F,Z(C,3),D)}Be.exports=E},40151:function(Be,Me,b){var m=b(9256);function Z(V){var N=V==null?0:V.length;return N?m(V,1):[]}Be.exports=Z},99204:function(Be,Me,b){var m=b(74809),Z=b(44107),V=b(11756),N=b(80744);function E(F,C){var P=N(F)?m:Z;return P(F,V(C))}Be.exports=E},23190:function(Be,Me,b){var m=b(14018),Z=b(11756),V=b(56730);function N(E,F){return E==null?E:m(E,Z(F),V)}Be.exports=N},44231:function(Be,Me,b){var m=b(89147);function Z(V,N,E){var F=V==null?void 0:m(V,N);return F===void 0?E:F}Be.exports=Z},99946:function(Be,Me,b){var m=b(3251),Z=b(63100);function V(N,E){return N!=null&&Z(N,E,m)}Be.exports=V},37879:function(Be,Me,b){var m=b(62348),Z=b(63100);function V(N,E){return N!=null&&Z(N,E,m)}Be.exports=V},61627:function(Be,Me,b){var m=b(6019),Z=b(66139),V=b(13053),N=b(80744),E=b(24665),F=b(57835),C=b(7975),P=b(18397),H="[object Map]",D="[object Set]",X=Object.prototype,j=X.hasOwnProperty;function de(he){if(he==null)return!0;if(E(he)&&(N(he)||typeof he=="string"||typeof he.splice=="function"||F(he)||P(he)||V(he)))return!he.length;var we=Z(he);if(we==H||we==D)return!he.size;if(C(he))return!m(he).length;for(var ve in he)if(j.call(he,ve))return!1;return!0}Be.exports=de},41626:function(Be,Me,b){var m=b(55005),Z=b(38342),V=b(52495),N=V&&V.isMap,E=N?Z(N):m;Be.exports=E},65226:function(Be,Me,b){var m=b(38652),Z=b(38342),V=b(52495),N=V&&V.isSet,E=N?Z(N):m;Be.exports=E},7941:function(Be,Me,b){var m=b(86756),Z=b(80744),V=b(93913),N="[object String]";function E(F){return typeof F=="string"||!Z(F)&&V(F)&&m(F)==N}Be.exports=E},45029:function(Be,Me,b){var m=b(86756),Z=b(93913),V="[object Symbol]";function N(E){return typeof E=="symbol"||Z(E)&&m(E)==V}Be.exports=N},16513:function(Be){function Me(b){return b===void 0}Be.exports=Me},55451:function(Be,Me,b){var m=b(63333),Z=b(6019),V=b(24665);function N(E){return V(E)?m(E):Z(E)}Be.exports=N},10611:function(Be){function Me(b){var m=b==null?0:b.length;return m?b[m-1]:void 0}Be.exports=Me},9924:function(Be,Me,b){var m=b(75010),Z=b(95979),V=b(65487),N=b(80744);function E(F,C){var P=N(F)?m:V;return P(F,Z(C,3))}Be.exports=E},70642:function(Be,Me,b){var m=b(42813),Z=b(85605),V=b(95979);function N(E,F){var C={};return F=V(F,3),Z(E,function(P,H,D){m(C,H,F(P,H,D))}),C}Be.exports=N},95987:function(Be,Me,b){var m=b(2659),Z=b(40302),V=b(46962);function N(E){return E&&E.length?m(E,V,Z):void 0}Be.exports=N},52858:function(Be,Me,b){var m=b(52166),Z="Expected a function";function V(N,E){if(typeof N!="function"||E!=null&&typeof E!="function")throw new TypeError(Z);var F=function(){var C=arguments,P=E?E.apply(this,C):C[0],H=F.cache;if(H.has(P))return H.get(P);var D=N.apply(this,C);return F.cache=H.set(P,D)||H,D};return F.cache=new(V.Cache||m),F}V.Cache=m,Be.exports=V},73376:function(Be,Me,b){var m=b(2659),Z=b(93757),V=b(46962);function N(E){return E&&E.length?m(E,V,Z):void 0}Be.exports=N},83296:function(Be,Me,b){var m=b(2659),Z=b(95979),V=b(93757);function N(E,F){return E&&E.length?m(E,Z(F,2),V):void 0}Be.exports=N},9958:function(Be){function Me(){}Be.exports=Me},5795:function(Be,Me,b){var m=b(33152),Z=function(){return m.Date.now()};Be.exports=Z},89409:function(Be,Me,b){var m=b(88832),Z=b(522),V=Z(function(N,E){return N==null?{}:m(N,E)});Be.exports=V},35769:function(Be,Me,b){var m=b(22310),Z=b(96916),V=b(86773),N=b(9171);function E(F){return V(F)?m(N(F)):Z(F)}Be.exports=E},60859:function(Be,Me,b){var m=b(76106),Z=m();Be.exports=Z},16473:function(Be,Me,b){var m=b(99861),Z=b(44107),V=b(95979),N=b(30739),E=b(80744);function F(C,P,H){var D=E(C)?m:N,X=arguments.length<3;return D(C,V(P,4),H,X,Z)}Be.exports=F},40617:function(Be,Me,b){var m=b(6019),Z=b(66139),V=b(24665),N=b(7941),E=b(29405),F="[object Map]",C="[object Set]";function P(H){if(H==null)return 0;if(V(H))return N(H)?E(H):H.length;var D=Z(H);return D==F||D==C?H.size:m(H).length}Be.exports=P},351:function(Be,Me,b){var m=b(9256),Z=b(58506),V=b(92918),N=b(8138),E=V(function(F,C){if(F==null)return[];var P=C.length;return P>1&&N(F,C[0],C[1])?C=[]:P>2&&N(C[0],C[1],C[2])&&(C=[C[0]]),Z(F,m(C,1),[])});Be.exports=E},4134:function(Be){function Me(){return[]}Be.exports=Me},97341:function(Be,Me,b){var m=b(59406),Z=1/0,V=17976931348623157e292;function N(E){if(!E)return E===0?E:0;if(E=m(E),E===Z||E===-Z){var F=E<0?-1:1;return F*V}return E===E?E:0}Be.exports=N},12824:function(Be,Me,b){var m=b(97341);function Z(V){var N=m(V),E=N%1;return N===N?E?N-E:N:0}Be.exports=Z},59406:function(Be,Me,b){var m=b(13927),Z=b(20816),V=b(45029),N=NaN,E=/^[-+]0x[0-9a-f]+$/i,F=/^0b[01]+$/i,C=/^0o[0-7]+$/i,P=parseInt;function H(D){if(typeof D=="number")return D;if(V(D))return N;if(Z(D)){var X=typeof D.valueOf=="function"?D.valueOf():D;D=Z(X)?X+"":X}if(typeof D!="string")return D===0?D:+D;D=m(D);var j=F.test(D);return j||C.test(D)?P(D.slice(2),j?2:8):E.test(D)?N:+D}Be.exports=H},44140:function(Be,Me,b){var m=b(50230);function Z(V){return V==null?"":m(V)}Be.exports=Z},91116:function(Be,Me,b){var m=b(74809),Z=b(35024),V=b(85605),N=b(95979),E=b(49217),F=b(80744),C=b(57835),P=b(9363),H=b(20816),D=b(18397);function X(j,de,he){var we=F(j),ve=we||C(j)||D(j);if(de=N(de,4),he==null){var Ee=j&&j.constructor;ve?he=we?new Ee:[]:H(j)?he=P(Ee)?Z(E(j)):{}:he={}}return(ve?m:V)(j,function($e,Fe,ct){return de(he,$e,Fe,ct)}),he}Be.exports=X},44065:function(Be,Me,b){var m=b(9256),Z=b(92918),V=b(29098),N=b(41590),E=Z(function(F){return V(m(F,1,N,!0))});Be.exports=E},95708:function(Be,Me,b){var m=b(44140),Z=0;function V(N){var E=++Z;return m(N)+E}Be.exports=V},81229:function(Be,Me,b){var m=b(20720),Z=b(55451);function V(N){return N==null?[]:m(N,Z(N))}Be.exports=V},65441:function(Be,Me,b){var m=b(60348),Z=b(94484);function V(N,E){return Z(N||[],E||[],m)}Be.exports=V},34402:function(Be,Me,b){"use strict";b.r(Me),b.d(Me,{default:function(){return N}});var m=b(34634);function Z(E){var F=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!(0,m.isAnyArray)(E))throw new TypeError("input must be an array");if(E.length===0)throw new TypeError("input must not be empty");var C=F.fromIndex,P=C===void 0?0:C,H=F.toIndex,D=H===void 0?E.length:H;if(P<0||P>=E.length||!Number.isInteger(P))throw new Error("fromIndex must be a positive integer smaller than length");if(D<=P||D>E.length||!Number.isInteger(D))throw new Error("toIndex must be an integer greater than fromIndex and at most equal to length");for(var X=E[P],j=P+1;j<D;j++)E[j]>X&&(X=E[j]);return X}function V(E){var F=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!(0,m.isAnyArray)(E))throw new TypeError("input must be an array");if(E.length===0)throw new TypeError("input must not be empty");var C=F.fromIndex,P=C===void 0?0:C,H=F.toIndex,D=H===void 0?E.length:H;if(P<0||P>=E.length||!Number.isInteger(P))throw new Error("fromIndex must be a positive integer smaller than length");if(D<=P||D>E.length||!Number.isInteger(D))throw new Error("toIndex must be an integer greater than fromIndex and at most equal to length");for(var X=E[P],j=P+1;j<D;j++)E[j]<X&&(X=E[j]);return X}function N(E){var F=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if((0,m.isAnyArray)(E)){if(E.length===0)throw new TypeError("input must not be empty")}else throw new TypeError("input must be an array");var C;if(F.output!==void 0){if(!(0,m.isAnyArray)(F.output))throw new TypeError("output option must be an array if specified");C=F.output}else C=new Array(E.length);var P=V(E),H=Z(E);if(P===H)throw new RangeError("minimum and maximum input values are equal. Cannot rescale a constant array");var D=F.min,X=D===void 0?F.autoMinMax?P:0:D,j=F.max,de=j===void 0?F.autoMinMax?H:1:j;if(X>=de)throw new RangeError("min option must be smaller than max option");for(var he=(de-X)/(H-P),we=0;we<E.length;we++)C[we]=(E[we]-P)*he+X;return C}},91998:function(Be,Me,b){Be.exports=Z,Be.exports.simulator=b(72879);var m=b(82396);function Z(N,E){if(!N)throw new Error("Graph structure cannot be undefined");var F=E&&E.createSimulator||b(72879),C=F(E);if(Array.isArray(E))throw new Error("Physics settings is expected to be an object");var P=N.version>19?_r:vn;E&&typeof E.nodeMass=="function"&&(P=E.nodeMass);var H=new Map,D={},X=0,j=C.settings.springTransform||V;kt(),ct();var de=!1,he={step:function(){if(X===0)return we(!0),!0;var Ge=C.step();he.lastMove=Ge,he.fire("step");var Tt=Ge/X,On=Tt<=.01;return we(On),On},getNodePosition:function(Ge){return dr(Ge).pos},setNodePosition:function(Ge){var Tt=dr(Ge);Tt.setPosition.apply(Tt,Array.prototype.slice.call(arguments,1))},getLinkPosition:function(Ge){var Tt=D[Ge];if(Tt)return{from:Tt.from.pos,to:Tt.to.pos}},getGraphRect:function(){return C.getBBox()},forEachBody:ve,pinNode:function(Ge,Tt){var On=dr(Ge.id);On.isPinned=!!Tt},isNodePinned:function(Ge){return dr(Ge.id).isPinned},dispose:function(){N.off("changed",at),he.fire("disposed")},getBody:Fe,getSpring:$e,getForceVectorLength:Ee,simulator:C,graph:N,lastMove:0};return m(he),he;function we(Ge){de!==Ge&&(de=Ge,vt(Ge))}function ve(Ge){H.forEach(Ge)}function Ee(){var Ge=0,Tt=0;return ve(function(On){Ge+=Math.abs(On.force.x),Tt+=Math.abs(On.force.y)}),Math.sqrt(Ge*Ge+Tt*Tt)}function $e(Ge,Tt){var On;if(Tt===void 0)typeof Ge!="object"?On=Ge:On=Ge.id;else{var Vr=N.hasLink(Ge,Tt);if(!Vr)return;On=Vr.id}return D[On]}function Fe(Ge){return H.get(Ge)}function ct(){N.on("changed",at)}function vt(Ge){he.fire("stable",Ge)}function at(Ge){for(var Tt=0;Tt<Ge.length;++Tt){var On=Ge[Tt];On.changeType==="add"?(On.node&&It(On.node.id),On.link&&Lt(On.link)):On.changeType==="remove"&&(On.node&&Bn(On.node),On.link&&Wn(On.link))}X=N.getNodesCount()}function kt(){X=0,N.forEachNode(function(Ge){It(Ge.id),X+=1}),N.forEachLink(Lt)}function It(Ge){var Tt=H.get(Ge);if(!Tt){var On=N.getNode(Ge);if(!On)throw new Error("initBody() was called with unknown node id");var Vr=On.position;if(!Vr){var en=Xn(On);Vr=C.getBestNewBodyPosition(en)}Tt=C.addBodyAt(Vr),Tt.id=Ge,H.set(Ge,Tt),In(Ge),zn(On)&&(Tt.isPinned=!0)}}function Bn(Ge){var Tt=Ge.id,On=H.get(Tt);On&&(H.delete(Tt),C.removeBody(On))}function Lt(Ge){In(Ge.fromId),In(Ge.toId);var Tt=H.get(Ge.fromId),On=H.get(Ge.toId),Vr=C.addSpring(Tt,On,Ge.length);j(Ge,Vr),D[Ge.id]=Vr}function Wn(Ge){var Tt=D[Ge.id];if(Tt){var On=N.getNode(Ge.fromId),Vr=N.getNode(Ge.toId);On&&In(On.id),Vr&&In(Vr.id),delete D[Ge.id],C.removeSpring(Tt)}}function Xn(Ge){var Tt=[];if(!Ge.links)return Tt;for(var On=Math.min(Ge.links.length,2),Vr=0;Vr<On;++Vr){var en=Ge.links[Vr],ln=en.fromId!==Ge.id?H.get(en.fromId):H.get(en.toId);ln&&ln.pos&&Tt.push(ln)}return Tt}function In(Ge){var Tt=H.get(Ge);if(Tt.mass=P(Ge),Number.isNaN(Tt.mass))throw new Error("Node mass should be a number")}function zn(Ge){return Ge&&(Ge.isPinned||Ge.data&&Ge.data.isPinned)}function dr(Ge){var Tt=H.get(Ge);return Tt||(It(Ge),Tt=H.get(Ge)),Tt}function vn(Ge){var Tt=N.getLinks(Ge);return Tt?1+Tt.length/3:1}function _r(Ge){var Tt=N.getLinks(Ge);return Tt?1+Tt.size/3:1}}function V(){}},98786:function(Be,Me,b){const m=b(59321);Be.exports=function(V){return N;function N(E,F){let C=F&&F.indent||0,P=F&&F.join!==void 0?F.join:`
`,H=Array(C+1).join(" "),D=[];for(let X=0;X<V;++X){let j=m(X),de=X===0?"":H;D.push(de+E.replace(/{var}/g,j))}return D.join(P)}}},41085:function(Be,Me,b){Be.exports=Z,Be.exports.generateFunctionBody=V;const m=b(98786);function Z(N){let E=V(N);return new Function("bodies","settings","random",E)}function V(N){let E=m(N);return`
var boundingBox = {
${E("min_{var}: 0, max_{var}: 0,",{indent:4})}
};
return {
box: boundingBox,
update: updateBoundingBox,
reset: resetBoundingBox,
getBestNewPosition: function (neighbors) {
var ${E("base_{var} = 0",{join:", "})};
if (neighbors.length) {
for (var i = 0; i < neighbors.length; ++i) {
let neighborPos = neighbors[i].pos;
${E("base_{var} += neighborPos.{var};",{indent:10})}
}
${E("base_{var} /= neighbors.length;",{indent:8})}
} else {
${E("base_{var} = (boundingBox.min_{var} + boundingBox.max_{var}) / 2;",{indent:8})}
}
var springLength = settings.springLength;
return {
${E("{var}: base_{var} + (random.nextDouble() - 0.5) * springLength,",{indent:8})}
};
}
};
function updateBoundingBox() {
var i = bodies.length;
if (i === 0) return; // No bodies - no borders.
${E("var max_{var} = -Infinity;",{indent:4})}
${E("var min_{var} = Infinity;",{indent:4})}
while(i--) {
// this is O(n), it could be done faster with quadtree, if we check the root node bounds
var bodyPos = bodies[i].pos;
${E("if (bodyPos.{var} < min_{var}) min_{var} = bodyPos.{var};",{indent:6})}
${E("if (bodyPos.{var} > max_{var}) max_{var} = bodyPos.{var};",{indent:6})}
}
${E("boundingBox.min_{var} = min_{var};",{indent:4})}
${E("boundingBox.max_{var} = max_{var};",{indent:4})}
}
function resetBoundingBox() {
${E("boundingBox.min_{var} = boundingBox.max_{var} = 0;",{indent:4})}
}
`}},53623:function(Be,Me,b){const m=b(98786);Be.exports=Z,Be.exports.generateCreateBodyFunctionBody=V,Be.exports.getVectorCode=E,Be.exports.getBodyCode=N;function Z(F,C){let P=V(F,C),{Body:H}=new Function(P)();return H}function V(F,C){return`
${E(F,C)}
${N(F,C)}
return {Body: Body, Vector: Vector};
`}function N(F){let C=m(F),P=C("{var}",{join:", "});return`
function Body(${P}) {
this.isPinned = false;
this.pos = new Vector(${P});
this.force = new Vector();
this.velocity = new Vector();
this.mass = 1;
this.springCount = 0;
this.springLength = 0;
}
Body.prototype.reset = function() {
this.force.reset();
this.springCount = 0;
this.springLength = 0;
}
Body.prototype.setPosition = function (${P}) {
${C("this.pos.{var} = {var} || 0;",{indent:2})}
};`}function E(F,C){let P=m(F),H="";return C&&(H=`${P(`
var v{var};
Object.defineProperty(this, '{var}', {
set: function(v) {
if (!Number.isFinite(v)) throw new Error('Cannot set non-numbers to {var}');
v{var} = v;
},
get: function() { return v{var}; }
});`)}`),`function Vector(${P("{var}",{join:", "})}) {
${H}
if (typeof arguments[0] === 'object') {
// could be another vector
let v = arguments[0];
${P('if (!Number.isFinite(v.{var})) throw new Error("Expected value is not a finite number at Vector constructor ({var})");',{indent:4})}
${P("this.{var} = v.{var};",{indent:4})}
} else {
${P('this.{var} = typeof {var} === "number" ? {var} : 0;',{indent:4})}
}
}
Vector.prototype.reset = function () {
${P("this.{var} = ",{join:""})}0;
};`}},48812:function(Be,Me,b){const m=b(98786);Be.exports=Z,Be.exports.generateCreateDragForceFunctionBody=V;function Z(N){let E=V(N);return new Function("options",E)}function V(N){return`
if (!Number.isFinite(options.dragCoefficient)) throw new Error('dragCoefficient is not a finite number');
return {
update: function(body) {
${m(N)("body.force.{var} -= options.dragCoefficient * body.velocity.{var};",{indent:6})}
}
};
`}},7584:function(Be,Me,b){const m=b(98786);Be.exports=Z,Be.exports.generateCreateSpringForceFunctionBody=V;function Z(N){let E=V(N);return new Function("options","random",E)}function V(N){let E=m(N);return`
if (!Number.isFinite(options.springCoefficient)) throw new Error('Spring coefficient is not a number');
if (!Number.isFinite(options.springLength)) throw new Error('Spring length is not a number');
return {
/**
* Updates forces acting on a spring
*/
update: function (spring) {
var body1 = spring.from;
var body2 = spring.to;
var length = spring.length < 0 ? options.springLength : spring.length;
${E("var d{var} = body2.pos.{var} - body1.pos.{var};",{indent:6})}
var r = Math.sqrt(${E("d{var} * d{var}",{join:" + "})});
if (r === 0) {
${E("d{var} = (random.nextDouble() - 0.5) / 50;",{indent:8})}
r = Math.sqrt(${E("d{var} * d{var}",{join:" + "})});
}
var d = r - length;
var coefficient = ((spring.coefficient > 0) ? spring.coefficient : options.springCoefficient) * d / r;
${E("body1.force.{var} += coefficient * d{var}",{indent:6})};
body1.springCount += 1;
body1.springLength += r;
${E("body2.force.{var} -= coefficient * d{var}",{indent:6})};
body2.springCount += 1;
body2.springLength += r;
}
};
`}},26302:function(Be,Me,b){const m=b(98786);Be.exports=Z,Be.exports.generateIntegratorFunctionBody=V;function Z(N){let E=V(N);return new Function("bodies","timeStep","adaptiveTimeStepWeight",E)}function V(N){let E=m(N);return`
var length = bodies.length;
if (length === 0) return 0;
${E("var d{var} = 0, t{var} = 0;",{indent:2})}
for (var i = 0; i < length; ++i) {
var body = bodies[i];
if (body.isPinned) continue;
if (adaptiveTimeStepWeight && body.springCount) {
timeStep = (adaptiveTimeStepWeight * body.springLength/body.springCount);
}
var coeff = timeStep / body.mass;
${E("body.velocity.{var} += coeff * body.force.{var};",{indent:4})}
${E("var v{var} = body.velocity.{var};",{indent:4})}
var v = Math.sqrt(${E("v{var} * v{var}",{join:" + "})});
if (v > 1) {
// We normalize it so that we move within timeStep range.
// for the case when v <= 1 - we let velocity to fade out.
${E("body.velocity.{var} = v{var} / v;",{indent:6})}
}
${E("d{var} = timeStep * body.velocity.{var};",{indent:4})}
${E("body.pos.{var} += d{var};",{indent:4})}
${E("t{var} += Math.abs(d{var});",{indent:4})}
}
return (${E("t{var} * t{var}",{join:" + "})})/length;
`}},48300:function(Be,Me,b){const m=b(98786),Z=b(59321);Be.exports=V,Be.exports.generateQuadTreeFunctionBody=N,Be.exports.getInsertStackCode=H,Be.exports.getQuadNodeCode=P,Be.exports.isSamePosition=E,Be.exports.getChildBodyCode=C,Be.exports.setChildBodyCode=F;function V(D){let X=N(D);return new Function(X)()}function N(D){let X=m(D),j=Math.pow(2,D);return`
${H()}
${P(D)}
${E(D)}
${C(D)}
${F(D)}
function createQuadTree(options, random) {
options = options || {};
options.gravity = typeof options.gravity === 'number' ? options.gravity : -1;
options.theta = typeof options.theta === 'number' ? options.theta : 0.8;
var gravity = options.gravity;
var updateQueue = [];
var insertStack = new InsertStack();
var theta = options.theta;
var nodesCache = [];
var currentInCache = 0;
var root = newNode();
return {
insertBodies: insertBodies,
/**
* Gets root node if it is present
*/
getRoot: function() {
return root;
},
updateBodyForce: update,
options: function(newOptions) {
if (newOptions) {
if (typeof newOptions.gravity === 'number') {
gravity = newOptions.gravity;
}
if (typeof newOptions.theta === 'number') {
theta = newOptions.theta;
}
return this;
}
return {
gravity: gravity,
theta: theta
};
}
};
function newNode() {
// To avoid pressure on GC we reuse nodes.
var node = nodesCache[currentInCache];
if (node) {
${ve(" node.")}
node.body = null;
node.mass = ${X("node.mass_{var} = ",{join:""})}0;
${X("node.min_{var} = node.max_{var} = ",{join:""})}0;
} else {
node = new QuadNode();
nodesCache[currentInCache] = node;
}
++currentInCache;
return node;
}
function update(sourceBody) {
var queue = updateQueue;
var v;
${X("var d{var};",{indent:4})}
var r;
${X("var f{var} = 0;",{indent:4})}
var queueLength = 1;
var shiftIdx = 0;
var pushIdx = 1;
queue[0] = root;
while (queueLength) {
var node = queue[shiftIdx];
var body = node.body;
queueLength -= 1;
shiftIdx += 1;
var differentBody = (body !== sourceBody);
if (body && differentBody) {
// If the current node is a leaf node (and it is not source body),
// calculate the force exerted by the current node on body, and add this
// amount to body's net force.
${X("d{var} = body.pos.{var} - sourceBody.pos.{var};",{indent:8})}
r = Math.sqrt(${X("d{var} * d{var}",{join:" + "})});
if (r === 0) {
// Poor man's protection against zero distance.
${X("d{var} = (random.nextDouble() - 0.5) / 50;",{indent:10})}
r = Math.sqrt(${X("d{var} * d{var}",{join:" + "})});
}
// This is standard gravitation force calculation but we divide
// by r^3 to save two operations when normalizing force vector.
v = gravity * body.mass * sourceBody.mass / (r * r * r);
${X("f{var} += v * d{var};",{indent:8})}
} else if (differentBody) {
// Otherwise, calculate the ratio s / r, where s is the width of the region
// represented by the internal node, and r is the distance between the body
// and the node's center-of-mass
${X("d{var} = node.mass_{var} / node.mass - sourceBody.pos.{var};",{indent:8})}
r = Math.sqrt(${X("d{var} * d{var}",{join:" + "})});
if (r === 0) {
// Sorry about code duplication. I don't want to create many functions
// right away. Just want to see performance first.
${X("d{var} = (random.nextDouble() - 0.5) / 50;",{indent:10})}
r = Math.sqrt(${X("d{var} * d{var}",{join:" + "})});
}
// If s / r < \u03B8, treat this internal node as a single body, and calculate the
// force it exerts on sourceBody, and add this amount to sourceBody's net force.
if ((node.max_${Z(0)} - node.min_${Z(0)}) / r < theta) {
// in the if statement above we consider node's width only
// because the region was made into square during tree creation.
// Thus there is no difference between using width or height.
v = gravity * node.mass * sourceBody.mass / (r * r * r);
${X("f{var} += v * d{var};",{indent:10})}
} else {
// Otherwise, run the procedure recursively on each of the current node's children.
// I intentionally unfolded this loop, to save several CPU cycles.
${we()}
}
}
}
${X("sourceBody.force.{var} += f{var};",{indent:4})}
}
function insertBodies(bodies) {
${X("var {var}min = Number.MAX_VALUE;",{indent:4})}
${X("var {var}max = Number.MIN_VALUE;",{indent:4})}
var i = bodies.length;
// To reduce quad tree depth we are looking for exact bounding box of all particles.
while (i--) {
var pos = bodies[i].pos;
${X("if (pos.{var} < {var}min) {var}min = pos.{var};",{indent:6})}
${X("if (pos.{var} > {var}max) {var}max = pos.{var};",{indent:6})}
}
// Makes the bounds square.
var maxSideLength = -Infinity;
${X("if ({var}max - {var}min > maxSideLength) maxSideLength = {var}max - {var}min ;",{indent:4})}
currentInCache = 0;
root = newNode();
${X("root.min_{var} = {var}min;",{indent:4})}
${X("root.max_{var} = {var}min + maxSideLength;",{indent:4})}
i = bodies.length - 1;
if (i >= 0) {
root.body = bodies[i];
}
while (i--) {
insert(bodies[i], root);
}
}
function insert(newBody) {
insertStack.reset();
insertStack.push(root, newBody);
while (!insertStack.isEmpty()) {
var stackItem = insertStack.pop();
var node = stackItem.node;
var body = stackItem.body;
if (!node.body) {
// This is internal node. Update the total mass of the node and center-of-mass.
${X("var {var} = body.pos.{var};",{indent:8})}
node.mass += body.mass;
${X("node.mass_{var} += body.mass * {var};",{indent:8})}
// Recursively insert the body in the appropriate quadrant.
// But first find the appropriate quadrant.
var quadIdx = 0; // Assume we are in the 0's quad.
${X("var min_{var} = node.min_{var};",{indent:8})}
${X("var max_{var} = (min_{var} + node.max_{var}) / 2;",{indent:8})}
${he(8)}
var child = getChild(node, quadIdx);
if (!child) {
// The node is internal but this quadrant is not taken. Add
// subnode to it.
child = newNode();
${X("child.min_{var} = min_{var};",{indent:10})}
${X("child.max_{var} = max_{var};",{indent:10})}
child.body = body;
setChild(node, quadIdx, child);
} else {
// continue searching in this quadrant.
insertStack.push(child, body);
}
} else {
// We are trying to add to the leaf node.
// We have to convert current leaf into internal node
// and continue adding two nodes.
var oldBody = node.body;
node.body = null; // internal nodes do not cary bodies
if (isSamePosition(oldBody.pos, body.pos)) {
// Prevent infinite subdivision by bumping one node
// anywhere in this quadrant
var retriesCount = 3;
do {
var offset = random.nextDouble();
${X("var d{var} = (node.max_{var} - node.min_{var}) * offset;",{indent:12})}
${X("oldBody.pos.{var} = node.min_{var} + d{var};",{indent:12})}
retriesCount -= 1;
// Make sure we don't bump it out of the box. If we do, next iteration should fix it
} while (retriesCount > 0 && isSamePosition(oldBody.pos, body.pos));
if (retriesCount === 0 && isSamePosition(oldBody.pos, body.pos)) {
// This is very bad, we ran out of precision.
// if we do not return from the method we'll get into
// infinite loop here. So we sacrifice correctness of layout, and keep the app running
// Next layout iteration should get larger bounding box in the first step and fix this
return;
}
}
// Next iteration should subdivide node further.
insertStack.push(node, oldBody);
insertStack.push(node, body);
}
}
}
}
return createQuadTree;
`;function he(Ee){let $e=[],Fe=Array(Ee+1).join(" ");for(let ct=0;ct<D;++ct)$e.push(Fe+`if (${Z(ct)} > max_${Z(ct)}) {`),$e.push(Fe+` quadIdx = quadIdx + ${Math.pow(2,ct)};`),$e.push(Fe+` min_${Z(ct)} = max_${Z(ct)};`),$e.push(Fe+` max_${Z(ct)} = node.max_${Z(ct)};`),$e.push(Fe+"}");return $e.join(`
`)}function we(){let Ee=Array(11).join(" "),$e=[];for(let Fe=0;Fe<j;++Fe)$e.push(Ee+`if (node.quad${Fe}) {`),$e.push(Ee+` queue[pushIdx] = node.quad${Fe};`),$e.push(Ee+" queueLength += 1;"),$e.push(Ee+" pushIdx += 1;"),$e.push(Ee+"}");return $e.join(`
`)}function ve(Ee){let $e=[];for(let Fe=0;Fe<j;++Fe)$e.push(`${Ee}quad${Fe} = null;`);return $e.join(`
`)}}function E(D){let X=m(D);return`
function isSamePosition(point1, point2) {
${X("var d{var} = Math.abs(point1.{var} - point2.{var});",{indent:2})}
return ${X("d{var} < 1e-8",{join:" && "})};
}
`}function F(D){var X=Math.pow(2,D);return`
function setChild(node, idx, child) {
${j()}
}`;function j(){let de=[];for(let he=0;he<X;++he){let we=he===0?" ":" else ";de.push(`${we}if (idx === ${he}) node.quad${he} = child;`)}return de.join(`
`)}}function C(D){return`function getChild(node, idx) {
${X()}
return null;
}`;function X(){let j=[],de=Math.pow(2,D);for(let he=0;he<de;++he)j.push(` if (idx === ${he}) return node.quad${he};`);return j.join(`
`)}}function P(D){let X=m(D),j=Math.pow(2,D);var de=`
function QuadNode() {
// body stored inside this node. In quad tree only leaf nodes (by construction)
// contain bodies:
this.body = null;
// Child nodes are stored in quads. Each quad is presented by number:
// 0 | 1
// -----
// 2 | 3
${he(" this.")}
// Total mass of current node
this.mass = 0;
// Center of mass coordinates
${X("this.mass_{var} = 0;",{indent:2})}
// bounding box coordinates
${X("this.min_{var} = 0;",{indent:2})}
${X("this.max_{var} = 0;",{indent:2})}
}
`;return de;function he(we){let ve=[];for(let Ee=0;Ee<j;++Ee)ve.push(`${we}quad${Ee} = null;`);return ve.join(`
`)}}function H(){return`
/**
* Our implementation of QuadTree is non-recursive to avoid GC hit
* This data structure represent stack of elements
* which we are trying to insert into quad tree.
*/
function InsertStack () {
this.stack = [];
this.popIdx = 0;
}
InsertStack.prototype = {
isEmpty: function() {
return this.popIdx === 0;
},
push: function (node, body) {
var item = this.stack[this.popIdx];
if (!item) {
// we are trying to avoid memory pressure: create new element
// only when absolutely necessary
this.stack[this.popIdx] = new InsertStackElement(node, body);
} else {
item.node = node;
item.body = body;
}
++this.popIdx;
},
pop: function () {
if (this.popIdx > 0) {
return this.stack[--this.popIdx];
}
},
reset: function () {
this.popIdx = 0;
}
};
function InsertStackElement(node, body) {
this.node = node; // QuadTree node
this.body = body; // physical body which needs to be inserted to node
}
`}},59321:function(Be){Be.exports=function(b){return b===0?"x":b===1?"y":b===2?"z":"c"+(b+1)}},72879:function(Be,Me,b){Be.exports=P;var m=b(53623),Z=b(48300),V=b(41085),N=b(48812),E=b(7584),F=b(26302),C={};function P(X){var j=b(75877),de=b(35764),he=b(82396);if(X){if(X.springCoeff!==void 0)throw new Error("springCoeff was renamed to springCoefficient");if(X.dragCoeff!==void 0)throw new Error("dragCoeff was renamed to dragCoefficient")}X=de(X,{springLength:10,springCoefficient:.8,gravity:-12,theta:.8,dragCoefficient:.9,timeStep:.5,adaptiveTimeStepWeight:0,dimensions:2,debug:!1});var we=C[X.dimensions];if(!we){var ve=X.dimensions;we={Body:m(ve,X.debug),createQuadTree:Z(ve),createBounds:V(ve),createDragForce:N(ve),createSpringForce:E(ve),integrate:F(ve)},C[ve]=we}var Ee=we.Body,$e=we.createQuadTree,Fe=we.createBounds,ct=we.createDragForce,vt=we.createSpringForce,at=we.integrate,kt=Et=>new Ee(Et),It=b(40232).random(42),Bn=[],Lt=[],Wn=$e(X,It),Xn=Fe(Bn,X,It),In=vt(X,It),zn=ct(X),dr=0,vn=[],_r=new Map,Ge=0;Vr("nbody",Cn),Vr("spring",Mt);var Tt={bodies:Bn,quadTree:Wn,springs:Lt,settings:X,addForce:Vr,removeForce:en,getForces:ln,step:function(){for(var Et=0;Et<vn.length;++Et)vn[Et](Ge);var pe=at(Bn,X.timeStep,X.adaptiveTimeStepWeight);return Ge+=1,pe},addBody:function(Et){if(!Et)throw new Error("Body is required");return Bn.push(Et),Et},addBodyAt:function(Et){if(!Et)throw new Error("Body position is required");var pe=kt(Et);return Bn.push(pe),pe},removeBody:function(Et){if(Et){var pe=Bn.indexOf(Et);if(!(pe<0))return Bn.splice(pe,1),Bn.length===0&&Xn.reset(),!0}},addSpring:function(Et,pe,Ae,Pe){if(!Et||!pe)throw new Error("Cannot add null spring to force simulator");typeof Ae!="number"&&(Ae=-1);var Ut=new j(Et,pe,Ae,Pe>=0?Pe:-1);return Lt.push(Ut),Ut},getTotalMovement:function(){return dr},removeSpring:function(Et){if(Et){var pe=Lt.indexOf(Et);if(pe>-1)return Lt.splice(pe,1),!0}},getBestNewBodyPosition:function(Et){return Xn.getBestNewPosition(Et)},getBBox:On,getBoundingBox:On,invalidateBBox:function(){console.warn("invalidateBBox() is deprecated, bounds always recomputed on `getBBox()` call")},gravity:function(Et){return Et!==void 0?(X.gravity=Et,Wn.options({gravity:Et}),this):X.gravity},theta:function(Et){return Et!==void 0?(X.theta=Et,Wn.options({theta:Et}),this):X.theta},random:It};return H(X,Tt),he(Tt),Tt;function On(){return Xn.update(),Xn.box}function Vr(Et,pe){if(_r.has(Et))throw new Error("Force "+Et+" is already added");_r.set(Et,pe),vn.push(pe)}function en(Et){var pe=vn.indexOf(_r.get(Et));pe<0||(vn.splice(pe,1),_r.delete(Et))}function ln(){return _r}function Cn(){if(Bn.length!==0){Wn.insertBodies(Bn);for(var Et=Bn.length;Et--;){var pe=Bn[Et];pe.isPinned||(pe.reset(),Wn.updateBodyForce(pe),zn.update(pe))}}}function Mt(){for(var Et=Lt.length;Et--;)In.update(Lt[Et])}}function H(X,j){for(var de in X)D(X,j,de)}function D(X,j,de){if(X.hasOwnProperty(de)&&typeof j[de]!="function"){var he=Number.isFinite(X[de]);he?j[de]=function(we){if(we!==void 0){if(!Number.isFinite(we))throw new Error("Value of "+de+" should be a valid number.");return X[de]=we,j}return X[de]}:j[de]=function(we){return we!==void 0?(X[de]=we,j):X[de]}}}},75877:function(Be){Be.exports=Me;function Me(b,m,Z,V){this.from=b,this.to=m,this.length=Z,this.coefficient=V}},35764:function(Be){Be.exports=Me;function Me(b,m){var Z;if(b||(b={}),m){for(Z in m)if(m.hasOwnProperty(Z)){var V=b.hasOwnProperty(Z),N=typeof m[Z],E=!V||typeof b[Z]!==N;E?b[Z]=m[Z]:N==="object"&&(b[Z]=Me(b[Z],m[Z]))}}return b}},40232:function(Be){Be.exports=Me,Be.exports.random=Me,Be.exports.randomIterator=F;function Me(C){var P=typeof C=="number"?C:+new Date;return new b(P)}function b(C){this.seed=C}b.prototype.next=E,b.prototype.nextDouble=N,b.prototype.uniform=N,b.prototype.gaussian=m,b.prototype.random=N;function m(){var C,P,H;do P=this.nextDouble()*2-1,H=this.nextDouble()*2-1,C=P*P+H*H;while(C>=1||C===0);return P*Math.sqrt(-2*Math.log(C)/C)}b.prototype.levy=Z;function Z(){var C=1.5,P=Math.pow(V(1+C)*Math.sin(Math.PI*C/2)/(V((1+C)/2)*C*Math.pow(2,(C-1)/2)),1/C);return this.gaussian()*P/Math.pow(Math.abs(this.gaussian()),1/C)}function V(C){return Math.sqrt(2*Math.PI/C)*Math.pow(1/Math.E*(C+1/(12*C-1/(10*C))),C)}function N(){var C=this.seed;return C=C+2127912214+(C<<12)&4294967295,C=(C^3345072700^C>>>19)&4294967295,C=C+374761393+(C<<5)&4294967295,C=(C+3550635116^C<<9)&4294967295,C=C+4251993797+(C<<3)&4294967295,C=(C^3042594569^C>>>16)&4294967295,this.seed=C,(C&268435455)/268435456}function E(C){return Math.floor(this.nextDouble()*C)}function F(C,P){var H=P||Me();if(typeof H.next!="function")throw new Error("customRandom does not match expected API: next() function is missing");return{forEach:X,shuffle:D};function D(){var j,de,he;for(j=C.length-1;j>0;--j)de=H.next(j+1),he=C[de],C[de]=C[j],C[j]=he;return C}function X(j){var de,he,we;for(de=C.length-1;de>0;--de)he=H.next(de+1),we=C[he],C[he]=C[de],C[de]=we,j(we);C.length&&j(C[0])}}},5630:function(Be,Me,b){"use strict";var m=b(54476),Z=b(33885),V=b(20068),N=b(42978),E=b(75931),F=b(92310),C=b.n(F),P=b(18929),H=b(59301),D=["prefixCls","className","style","checked","disabled","defaultChecked","type","title","onChange"],X=(0,H.forwardRef)(function(j,de){var he,we=j.prefixCls,ve=we===void 0?"rc-checkbox":we,Ee=j.className,$e=j.style,Fe=j.checked,ct=j.disabled,vt=j.defaultChecked,at=vt===void 0?!1:vt,kt=j.type,It=kt===void 0?"checkbox":kt,Bn=j.title,Lt=j.onChange,Wn=(0,E.Z)(j,D),Xn=(0,H.useRef)(null),In=(0,P.Z)(at,{value:Fe}),zn=(0,N.Z)(In,2),dr=zn[0],vn=zn[1];(0,H.useImperativeHandle)(de,function(){return{focus:function(){var On;(On=Xn.current)===null||On===void 0||On.focus()},blur:function(){var On;(On=Xn.current)===null||On===void 0||On.blur()},input:Xn.current}});var _r=C()(ve,Ee,(he={},(0,V.Z)(he,"".concat(ve,"-checked"),dr),(0,V.Z)(he,"".concat(ve,"-disabled"),ct),he)),Ge=function(On){ct||("checked"in j||vn(On.target.checked),Lt==null||Lt({target:(0,Z.Z)((0,Z.Z)({},j),{},{type:It,checked:On.target.checked}),stopPropagation:function(){On.stopPropagation()},preventDefault:function(){On.preventDefault()},nativeEvent:On.nativeEvent}))};return H.createElement("span",{className:_r,title:Bn,style:$e},H.createElement("input",(0,m.Z)({},Wn,{className:"".concat(ve,"-input"),ref:Xn,onChange:Ge,disabled:ct,checked:!!dr,type:It})),H.createElement("span",{className:"".concat(ve,"-inner")}))});Me.Z=X},81683:function(Be,Me,b){"use strict";var m=b(55973),Z=Array.prototype.concat,V=Array.prototype.slice,N=Be.exports=function(F){for(var C=[],P=0,H=F.length;P<H;P++){var D=F[P];m(D)?C=Z.call(C,V.call(D)):C.push(D)}return C};N.wrap=function(E){return function(){return E(N(arguments))}}},82396:function(Be){"use strict";function Me(Z){m(Z);const V=b(Z);return Z.on=V.on,Z.off=V.off,Z.fire=V.fire,Z}function b(Z){let V=Object.create(null);return{on:function(N,E,F){if(typeof E!="function")throw new Error("callback is expected to be a function");let C=V[N];return C||(C=V[N]=[]),C.push({callback:E,ctx:F}),Z},off:function(N,E){if(typeof N>"u")return V=Object.create(null),Z;if(V[N])if(typeof E!="function")delete V[N];else{const F=V[N];for(let C=0;C<F.length;++C)F[C].callback===E&&F.splice(C,1)}return Z},fire:function(N){const E=V[N];if(!E)return Z;let F;arguments.length>1&&(F=Array.prototype.slice.call(arguments,1));for(let C=0;C<E.length;++C){const P=E[C];P.callback.apply(P.ctx,F)}return Z}}}function m(Z){if(!Z)throw new Error("Eventify cannot use falsy object as events subject");const V=["on","fire","off"];for(let N=0;N<V.length;++N)if(Z.hasOwnProperty(V[N]))throw new Error("Subject cannot be eventified, since it already has property '"+V[N]+"'")}Be.exports=Me},68026:function(Be,Me,b){"use strict";b.d(Me,{Z:function(){return V$}});const m="182",Z={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},V={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},N=0,E=1,F=2,C=3,P=0,H=1,D=2,X=3,j=0,de=1,he=2,we=0,ve=1,Ee=2,$e=3,Fe=4,ct=5,vt=100,at=101,kt=102,It=103,Bn=104,Lt=200,Wn=201,Xn=202,In=203,zn=204,dr=205,vn=206,_r=207,Ge=208,Tt=209,On=210,Vr=211,en=212,ln=213,Cn=214,Mt=0,Et=1,pe=2,Ae=3,Pe=4,Ut=5,jt=6,ft=7,on=0,hn=1,lt=2,Ct=0,sn=1,W=2,Se=3,Ht=4,zt=5,Fn=6,Tn=7,lr="attached",je="detached",be=300,it=301,wt=302,ot=303,ut=304,_t=306,$t=1e3,Vt=1001,Qt=1002,cn=1003,Yn=1004,qn=1004,Sr=1005,Jr=1005,vr=1006,Ki=1007,Mi=1007,yi=1008,qr=1008,es=1009,Ci=1010,En=1011,rn=1012,Xt=1013,st=1014,dt=1015,Wt=1016,bn=1017,Jt=1018,ar=1020,rr=35902,Kr=35899,si=1021,Ie=1022,L=1023,Q=1026,w=1027,z=1028,ie=1029,ze=1030,Je=1031,At=1032,xt=1033,Sn=33776,Oe=33777,Qe=33778,Re=33779,Ke=35840,gt=35841,tn=35842,yt=35843,Yt=36196,Rn=37492,er=37496,Jn=37488,kr=37489,fr=37490,wr=37491,ei=37808,_n=37809,jn=37810,Hr=37811,Pr=37812,$i=37813,Zi=37814,Xi=37815,Ei=37816,ms=37817,_i=37818,Es=37819,ua=37820,Hn=37821,Pt=36492,Gt=36494,Bt=36495,yn=36283,Ln=36284,gr=36285,Rr=36286,$r=2200,Ii=2201,Di=2202,ss=2300,vs=2301,Cs=2302,Aa=2400,sa=2401,ca=2402,Ai=2500,$a=2501,Zo=0,Ko=1,$o=2,bo=3200,Pl=3201,il=3202,go=3203,Ll=0,Lu=1,ao="",sl="srgb",No="srgb-linear",Uu="linear",ws="srgb",Kh="",dh="rg",$h="ga",Uh=0,Ku=7680,sc=7681,pu=7682,ou=7683,Ad=34055,hf=34056,Xo=5386,fh=512,Qf=513,pd=514,Ah=515,Vc=516,jo=517,gd=518,lu=519,gu=512,oo=513,Ic=514,jc=515,ph=516,Lo=517,Ji=518,$u=519,gh=35044,mh=35048,np=35040,vh=35045,Cu=35049,zc=35041,Ul=35046,Xl=35050,Uo=35042,Ld="100",Yc="300 es",gl=2e3,To=2001,ml={COMPUTE:"compute",RENDER:"render"},Xu={PERSPECTIVE:"perspective",LINEAR:"linear",FLAT:"flat"},mu={NORMAL:"normal",CENTROID:"centroid",SAMPLE:"sample",FIRST:"first",EITHER:"either"};function Oo(s){for(let e=s.length-1;e>=0;--e)if(s[e]>=65535)return!0;return!1}const Bo={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array};function _o(s,e){return new Bo[s](e)}function na(s){return ArrayBuffer.isView(s)&&!(s instanceof DataView)}function Wa(s){return document.createElementNS("http://www.w3.org/1999/xhtml",s)}function yh(){const s=Wa("canvas");return s.style.display="block",s}const Yo={};let Tu=null;function uu(s){Tu=s}function wc(){return Tu}function ac(...s){const e="THREE."+s.shift();Tu?Tu("log",e,...s):console.log(e,...s)}function Lr(...s){const e="THREE."+s.shift();Tu?Tu("warn",e,...s):console.warn(e,...s)}function Gr(...s){const e="THREE."+s.shift();Tu?Tu("error",e,...s):console.error(e,...s)}function ki(...s){const e=s.join(" ");e in Yo||(Yo[e]=!0,Lr(...s))}function ju(s,e,t){return new Promise(function(n,i){function a(){switch(s.clientWaitSync(e,s.SYNC_FLUSH_COMMANDS_BIT,0)){case s.WAIT_FAILED:i();break;case s.TIMEOUT_EXPIRED:setTimeout(a,t);break;default:n()}}setTimeout(a,t)})}class bl{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){const n=this._listeners;return n===void 0?!1:n[e]!==void 0&&n[e].indexOf(t)!==-1}removeEventListener(e,t){const n=this._listeners;if(n===void 0)return;const i=n[e];if(i!==void 0){const a=i.indexOf(t);a!==-1&&i.splice(a,1)}}dispatchEvent(e){const t=this._listeners;if(t===void 0)return;const n=t[e.type];if(n!==void 0){e.target=this;const i=n.slice(0);for(let a=0,o=i.length;a<o;a++)i[a].call(this,e);e.target=null}}}const qo=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"];let Go=1234567;const Ou=Math.PI/180,Oh=180/Math.PI;function oc(){const s=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,n=Math.random()*4294967295|0;return(qo[s&255]+qo[s>>8&255]+qo[s>>16&255]+qo[s>>24&255]+"-"+qo[e&255]+qo[e>>8&255]+"-"+qo[e>>16&15|64]+qo[e>>24&255]+"-"+qo[t&63|128]+qo[t>>8&255]+"-"+qo[t>>16&255]+qo[t>>24&255]+qo[n&255]+qo[n>>8&255]+qo[n>>16&255]+qo[n>>24&255]).toLowerCase()}function Ca(s,e,t){return Math.max(e,Math.min(t,s))}function Ud(s,e){return(s%e+e)%e}function rp(s,e,t,n,i){return n+(s-e)*(i-n)/(t-e)}function Xh(s,e,t){return s!==e?(t-s)/(e-s):0}function lc(s,e,t){return(1-t)*s+t*e}function wA(s,e,t,n){return lc(s,e,1-Math.exp(-t*n))}function Od(s,e=1){return e-Math.abs(Ud(s,e*2)-e)}function jh(s,e,t){return s<=e?0:s>=t?1:(s=(s-e)/(t-e),s*s*(3-2*s))}function SA(s,e,t){return s<=e?0:s>=t?1:(s=(s-e)/(t-e),s*s*s*(s*(s*6-15)+10))}function md(s,e){return s+Math.floor(Math.random()*(e-s+1))}function vd(s,e){return s+Math.random()*(e-s)}function mo(s){return s*(.5-Math.random())}function wa(s){s!==void 0&&(Go=s);let e=Go+=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 Dd(s){return s*Ou}function qi(s){return s*Oh}function Du(s){return(s&s-1)===0&&s!==0}function kn(s){return Math.pow(2,Math.ceil(Math.log(s)/Math.LN2))}function kd(s){return Math.pow(2,Math.floor(Math.log(s)/Math.LN2))}function Yh(s,e,t,n,i){const a=Math.cos,o=Math.sin,u=a(t/2),c=o(t/2),d=a((e+n)/2),g=o((e+n)/2),v=a((e-n)/2),M=o((e-n)/2),B=a((n-e)/2),I=o((n-e)/2);switch(i){case"XYX":s.set(u*g,c*v,c*M,u*d);break;case"YZY":s.set(c*M,u*g,c*v,u*d);break;case"ZXZ":s.set(c*v,c*M,u*g,u*d);break;case"XZX":s.set(u*g,c*I,c*B,u*d);break;case"YXY":s.set(c*B,u*g,c*I,u*d);break;case"ZYZ":s.set(c*I,c*B,u*g,u*d);break;default:Lr("MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+i)}}function vl(s,e){switch(e.constructor){case Float32Array:return s;case Uint32Array:return s/4294967295;case Uint16Array:return s/65535;case Uint8Array:return s/255;case Int32Array:return Math.max(s/2147483647,-1);case Int16Array:return Math.max(s/32767,-1);case Int8Array:return Math.max(s/127,-1);default:throw new Error("Invalid component type.")}}function He(s,e){switch(e.constructor){case Float32Array:return s;case Uint32Array:return Math.round(s*4294967295);case Uint16Array:return Math.round(s*65535);case Uint8Array:return Math.round(s*255);case Int32Array:return Math.round(s*2147483647);case Int16Array:return Math.round(s*32767);case Int8Array:return Math.round(s*127);default:throw new Error("Invalid component type.")}}const me={DEG2RAD:Ou,RAD2DEG:Oh,generateUUID:oc,clamp:Ca,euclideanModulo:Ud,mapLinear:rp,inverseLerp:Xh,lerp:lc,damp:wA,pingpong:Od,smoothstep:jh,smootherstep:SA,randInt:md,randFloat:vd,randFloatSpread:mo,seededRandom:wa,degToRad:Dd,radToDeg:qi,isPowerOfTwo:Du,ceilPowerOfTwo:kn,floorPowerOfTwo:kd,setQuaternionFromProperEuler:Yh,normalize:He,denormalize:vl};class ce{constructor(e=0,t=0){ce.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,i=e.elements;return this.x=i[0]*t+i[3]*n+i[6],this.y=i[1]*t+i[4]*n+i[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=Ca(this.x,e.x,t.x),this.y=Ca(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=Ca(this.x,e,t),this.y=Ca(this.y,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Ca(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(Ca(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),i=Math.sin(t),a=this.x-e.x,o=this.y-e.y;return this.x=a*n-o*i+e.x,this.y=a*i+o*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class Ze{constructor(e=0,t=0,n=0,i=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=n,this._w=i}static slerpFlat(e,t,n,i,a,o,u){let c=n[i+0],d=n[i+1],g=n[i+2],v=n[i+3],M=a[o+0],B=a[o+1],I=a[o+2],ne=a[o+3];if(u<=0){e[t+0]=c,e[t+1]=d,e[t+2]=g,e[t+3]=v;return}if(u>=1){e[t+0]=M,e[t+1]=B,e[t+2]=I,e[t+3]=ne;return}if(v!==ne||c!==M||d!==B||g!==I){let ee=c*M+d*B+g*I+v*ne;ee<0&&(M=-M,B=-B,I=-I,ne=-ne,ee=-ee);let q=1-u;if(ee<.9995){const ye=Math.acos(ee),Ce=Math.sin(ye);q=Math.sin(q*ye)/Ce,u=Math.sin(u*ye)/Ce,c=c*q+M*u,d=d*q+B*u,g=g*q+I*u,v=v*q+ne*u}else{c=c*q+M*u,d=d*q+B*u,g=g*q+I*u,v=v*q+ne*u;const ye=1/Math.sqrt(c*c+d*d+g*g+v*v);c*=ye,d*=ye,g*=ye,v*=ye}}e[t]=c,e[t+1]=d,e[t+2]=g,e[t+3]=v}static multiplyQuaternionsFlat(e,t,n,i,a,o){const u=n[i],c=n[i+1],d=n[i+2],g=n[i+3],v=a[o],M=a[o+1],B=a[o+2],I=a[o+3];return e[t]=u*I+g*v+c*B-d*M,e[t+1]=c*I+g*M+d*v-u*B,e[t+2]=d*I+g*B+u*M-c*v,e[t+3]=g*I-u*v-c*M-d*B,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,i){return this._x=e,this._y=t,this._z=n,this._w=i,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,i=e._y,a=e._z,o=e._order,u=Math.cos,c=Math.sin,d=u(n/2),g=u(i/2),v=u(a/2),M=c(n/2),B=c(i/2),I=c(a/2);switch(o){case"XYZ":this._x=M*g*v+d*B*I,this._y=d*B*v-M*g*I,this._z=d*g*I+M*B*v,this._w=d*g*v-M*B*I;break;case"YXZ":this._x=M*g*v+d*B*I,this._y=d*B*v-M*g*I,this._z=d*g*I-M*B*v,this._w=d*g*v+M*B*I;break;case"ZXY":this._x=M*g*v-d*B*I,this._y=d*B*v+M*g*I,this._z=d*g*I+M*B*v,this._w=d*g*v-M*B*I;break;case"ZYX":this._x=M*g*v-d*B*I,this._y=d*B*v+M*g*I,this._z=d*g*I-M*B*v,this._w=d*g*v+M*B*I;break;case"YZX":this._x=M*g*v+d*B*I,this._y=d*B*v+M*g*I,this._z=d*g*I-M*B*v,this._w=d*g*v-M*B*I;break;case"XZY":this._x=M*g*v-d*B*I,this._y=d*B*v-M*g*I,this._z=d*g*I+M*B*v,this._w=d*g*v+M*B*I;break;default:Lr("Quaternion: .setFromEuler() encountered an unknown order: "+o)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const n=t/2,i=Math.sin(n);return this._x=e.x*i,this._y=e.y*i,this._z=e.z*i,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,n=t[0],i=t[4],a=t[8],o=t[1],u=t[5],c=t[9],d=t[2],g=t[6],v=t[10],M=n+u+v;if(M>0){const B=.5/Math.sqrt(M+1);this._w=.25/B,this._x=(g-c)*B,this._y=(a-d)*B,this._z=(o-i)*B}else if(n>u&&n>v){const B=2*Math.sqrt(1+n-u-v);this._w=(g-c)/B,this._x=.25*B,this._y=(i+o)/B,this._z=(a+d)/B}else if(u>v){const B=2*Math.sqrt(1+u-n-v);this._w=(a-d)/B,this._x=(i+o)/B,this._y=.25*B,this._z=(c+g)/B}else{const B=2*Math.sqrt(1+v-n-u);this._w=(o-i)/B,this._x=(a+d)/B,this._y=(c+g)/B,this._z=.25*B}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;return n<1e-8?(n=0,Math.abs(e.x)>Math.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(Ca(this.dot(e),-1,1)))}rotateTowards(e,t){const n=this.angleTo(e);if(n===0)return this;const i=Math.min(1,t/n);return this.slerp(e,i),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,i=e._y,a=e._z,o=e._w,u=t._x,c=t._y,d=t._z,g=t._w;return this._x=n*g+o*u+i*d-a*c,this._y=i*g+o*c+a*u-n*d,this._z=a*g+o*d+n*c-i*u,this._w=o*g-n*u-i*c-a*d,this._onChangeCallback(),this}slerp(e,t){if(t<=0)return this;if(t>=1)return this.copy(e);let n=e._x,i=e._y,a=e._z,o=e._w,u=this.dot(e);u<0&&(n=-n,i=-i,a=-a,o=-o,u=-u);let c=1-t;if(u<.9995){const d=Math.acos(u),g=Math.sin(d);c=Math.sin(c*d)/g,t=Math.sin(t*d)/g,this._x=this._x*c+n*t,this._y=this._y*c+i*t,this._z=this._z*c+a*t,this._w=this._w*c+o*t,this._onChangeCallback()}else this._x=this._x*c+n*t,this._y=this._y*c+i*t,this._z=this._z*c+a*t,this._w=this._w*c+o*t,this.normalize();return 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(),i=Math.sqrt(1-n),a=Math.sqrt(n);return this.set(i*Math.sin(e),i*Math.cos(e),a*Math.sin(t),a*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 le{constructor(e=0,t=0,n=0){le.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(Dt.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(Dt.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,n=this.y,i=this.z,a=e.elements;return this.x=a[0]*t+a[3]*n+a[6]*i,this.y=a[1]*t+a[4]*n+a[7]*i,this.z=a[2]*t+a[5]*n+a[8]*i,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,n=this.y,i=this.z,a=e.elements,o=1/(a[3]*t+a[7]*n+a[11]*i+a[15]);return this.x=(a[0]*t+a[4]*n+a[8]*i+a[12])*o,this.y=(a[1]*t+a[5]*n+a[9]*i+a[13])*o,this.z=(a[2]*t+a[6]*n+a[10]*i+a[14])*o,this}applyQuaternion(e){const t=this.x,n=this.y,i=this.z,a=e.x,o=e.y,u=e.z,c=e.w,d=2*(o*i-u*n),g=2*(u*t-a*i),v=2*(a*n-o*t);return this.x=t+c*d+o*v-u*g,this.y=n+c*g+u*d-a*v,this.z=i+c*v+a*g-o*d,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,i=this.z,a=e.elements;return this.x=a[0]*t+a[4]*n+a[8]*i,this.y=a[1]*t+a[5]*n+a[9]*i,this.z=a[2]*t+a[6]*n+a[10]*i,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=Ca(this.x,e.x,t.x),this.y=Ca(this.y,e.y,t.y),this.z=Ca(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=Ca(this.x,e,t),this.y=Ca(this.y,e,t),this.z=Ca(this.z,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Ca(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,i=e.y,a=e.z,o=t.x,u=t.y,c=t.z;return this.x=i*c-a*u,this.y=a*o-n*c,this.z=n*u-i*o,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 Nt.copy(this).projectOnVector(e),this.sub(Nt)}reflect(e){return this.sub(Nt.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(Ca(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y,i=this.z-e.z;return t*t+n*n+i*i}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 i=Math.sin(t)*e;return this.x=i*Math.sin(n),this.y=Math.cos(t)*e,this.z=i*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(),i=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=i,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 Nt=new le,Dt=new Ze;class pn{constructor(e,t,n,i,a,o,u,c,d){pn.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,n,i,a,o,u,c,d)}set(e,t,n,i,a,o,u,c,d){const g=this.elements;return g[0]=e,g[1]=i,g[2]=u,g[3]=t,g[4]=a,g[5]=c,g[6]=n,g[7]=o,g[8]=d,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,i=t.elements,a=this.elements,o=n[0],u=n[3],c=n[6],d=n[1],g=n[4],v=n[7],M=n[2],B=n[5],I=n[8],ne=i[0],ee=i[3],q=i[6],ye=i[1],Ce=i[4],ke=i[7],nt=i[2],Ye=i[5],ht=i[8];return a[0]=o*ne+u*ye+c*nt,a[3]=o*ee+u*Ce+c*Ye,a[6]=o*q+u*ke+c*ht,a[1]=d*ne+g*ye+v*nt,a[4]=d*ee+g*Ce+v*Ye,a[7]=d*q+g*ke+v*ht,a[2]=M*ne+B*ye+I*nt,a[5]=M*ee+B*Ce+I*Ye,a[8]=M*q+B*ke+I*ht,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],i=e[2],a=e[3],o=e[4],u=e[5],c=e[6],d=e[7],g=e[8];return t*o*g-t*u*d-n*a*g+n*u*c+i*a*d-i*o*c}invert(){const e=this.elements,t=e[0],n=e[1],i=e[2],a=e[3],o=e[4],u=e[5],c=e[6],d=e[7],g=e[8],v=g*o-u*d,M=u*c-g*a,B=d*a-o*c,I=t*v+n*M+i*B;if(I===0)return this.set(0,0,0,0,0,0,0,0,0);const ne=1/I;return e[0]=v*ne,e[1]=(i*d-g*n)*ne,e[2]=(u*n-i*o)*ne,e[3]=M*ne,e[4]=(g*t-i*c)*ne,e[5]=(i*a-u*t)*ne,e[6]=B*ne,e[7]=(n*c-d*t)*ne,e[8]=(o*t-n*a)*ne,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,i,a,o,u){const c=Math.cos(a),d=Math.sin(a);return this.set(n*c,n*d,-n*(c*o+d*u)+o+e,-i*d,i*c,-i*(-d*o+c*u)+u+t,0,0,1),this}scale(e,t){return this.premultiply(Dn.makeScale(e,t)),this}rotate(e){return this.premultiply(Dn.makeRotation(-e)),this}translate(e,t){return this.premultiply(Dn.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 i=0;i<9;i++)if(t[i]!==n[i])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 Dn=new pn,hr=new pn().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),br=new pn().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function yr(){const s={enabled:!0,workingColorSpace:No,spaces:{},convert:function(i,a,o){return this.enabled===!1||a===o||!a||!o||(this.spaces[a].transfer===ws&&(i.r=Fr(i.r),i.g=Fr(i.g),i.b=Fr(i.b)),this.spaces[a].primaries!==this.spaces[o].primaries&&(i.applyMatrix3(this.spaces[a].toXYZ),i.applyMatrix3(this.spaces[o].fromXYZ)),this.spaces[o].transfer===ws&&(i.r=ri(i.r),i.g=ri(i.g),i.b=ri(i.b))),i},workingToColorSpace:function(i,a){return this.convert(i,this.workingColorSpace,a)},colorSpaceToWorking:function(i,a){return this.convert(i,a,this.workingColorSpace)},getPrimaries:function(i){return this.spaces[i].primaries},getTransfer:function(i){return i===ao?Uu:this.spaces[i].transfer},getToneMappingMode:function(i){return this.spaces[i].outputColorSpaceConfig.toneMappingMode||"standard"},getLuminanceCoefficients:function(i,a=this.workingColorSpace){return i.fromArray(this.spaces[a].luminanceCoefficients)},define:function(i){Object.assign(this.spaces,i)},_getMatrix:function(i,a,o){return i.copy(this.spaces[a].toXYZ).multiply(this.spaces[o].fromXYZ)},_getDrawingBufferColorSpace:function(i){return this.spaces[i].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(i=this.workingColorSpace){return this.spaces[i].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(i,a){return ki("ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),s.workingToColorSpace(i,a)},toWorkingColorSpace:function(i,a){return ki("ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),s.colorSpaceToWorking(i,a)}},e=[.64,.33,.3,.6,.15,.06],t=[.2126,.7152,.0722],n=[.3127,.329];return s.define({[No]:{primaries:e,whitePoint:n,transfer:Uu,toXYZ:hr,fromXYZ:br,luminanceCoefficients:t,workingColorSpaceConfig:{unpackColorSpace:sl},outputColorSpaceConfig:{drawingBufferColorSpace:sl}},[sl]:{primaries:e,whitePoint:n,transfer:ws,toXYZ:hr,fromXYZ:br,luminanceCoefficients:t,outputColorSpaceConfig:{drawingBufferColorSpace:sl}}}),s}const xr=yr();function Fr(s){return s<.04045?s*.0773993808:Math.pow(s*.9478672986+.0521327014,2.4)}function ri(s){return s<.0031308?s*12.92:1.055*Math.pow(s,.41666)-.055}let ai;class wi{static getDataURL(e,t="image/png"){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement=="undefined")return e.src;let n;if(e instanceof HTMLCanvasElement)n=e;else{ai===void 0&&(ai=Wa("canvas")),ai.width=e.width,ai.height=e.height;const i=ai.getContext("2d");e instanceof ImageData?i.putImageData(e,0,0):i.drawImage(e,0,0,e.width,e.height),n=ai}return n.toDataURL(t)}static sRGBToLinear(e){if(typeof HTMLImageElement!="undefined"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement!="undefined"&&e instanceof HTMLCanvasElement||typeof ImageBitmap!="undefined"&&e instanceof ImageBitmap){const t=Wa("canvas");t.width=e.width,t.height=e.height;const n=t.getContext("2d");n.drawImage(e,0,0,e.width,e.height);const i=n.getImageData(0,0,e.width,e.height),a=i.data;for(let o=0;o<a.length;o++)a[o]=Fr(a[o]/255)*255;return n.putImageData(i,0,0),t}else if(e.data){const t=e.data.slice(0);for(let n=0;n<t.length;n++)t instanceof Uint8Array||t instanceof Uint8ClampedArray?t[n]=Math.floor(Fr(t[n]/255)*255):t[n]=Fr(t[n]);return{data:t,width:e.width,height:e.height}}else return Lr("ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}}let Vi=0;class rs{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:Vi++}),this.uuid=oc(),this.data=e,this.dataReady=!0,this.version=0}getSize(e){const t=this.data;return typeof HTMLVideoElement!="undefined"&&t instanceof HTMLVideoElement?e.set(t.videoWidth,t.videoHeight,0):typeof VideoFrame!="undefined"&&t instanceof VideoFrame?e.set(t.displayHeight,t.displayWidth,0):t!==null?e.set(t.width,t.height,t.depth||0):e.set(0,0,0),e}set needsUpdate(e){e===!0&&this.version++}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.images[this.uuid]!==void 0)return e.images[this.uuid];const n={uuid:this.uuid,url:""},i=this.data;if(i!==null){let a;if(Array.isArray(i)){a=[];for(let o=0,u=i.length;o<u;o++)i[o].isDataTexture?a.push(as(i[o].image)):a.push(as(i[o]))}else a=as(i);n.url=a}return t||(e.images[this.uuid]=n),n}}function as(s){return typeof HTMLImageElement!="undefined"&&s instanceof HTMLImageElement||typeof HTMLCanvasElement!="undefined"&&s instanceof HTMLCanvasElement||typeof ImageBitmap!="undefined"&&s instanceof ImageBitmap?wi.getDataURL(s):s.data?{data:Array.from(s.data),width:s.width,height:s.height,type:s.data.constructor.name}:(Lr("Texture: Unable to serialize Texture."),{})}let Bs=0;const Ls=new le;class zi extends bl{constructor(e=zi.DEFAULT_IMAGE,t=zi.DEFAULT_MAPPING,n=Vt,i=Vt,a=vr,o=yi,u=L,c=es,d=zi.DEFAULT_ANISOTROPY,g=ao){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:Bs++}),this.uuid=oc(),this.name="",this.source=new rs(e),this.mipmaps=[],this.mapping=t,this.channel=0,this.wrapS=n,this.wrapT=i,this.magFilter=a,this.minFilter=o,this.anisotropy=d,this.format=u,this.internalFormat=null,this.type=c,this.offset=new ce(0,0),this.repeat=new ce(1,1),this.center=new ce(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new pn,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=g,this.userData={},this.updateRanges=[],this.version=0,this.onUpdate=null,this.renderTarget=null,this.isRenderTargetTexture=!1,this.isArrayTexture=!!(e&&e.depth&&e.depth>1),this.pmremVersion=0}get width(){return this.source.getSize(Ls).x}get height(){return this.source.getSize(Ls).y}get depth(){return this.source.getSize(Ls).z}get image(){return this.source.data}set image(e=null){this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace=e.colorSpace,this.renderTarget=e.renderTarget,this.isRenderTargetTexture=e.isRenderTargetTexture,this.isArrayTexture=e.isArrayTexture,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}setValues(e){for(const t in e){const n=e[t];if(n===void 0){Lr(`Texture.setValues(): parameter '${t}' has value of undefined.`);continue}const i=this[t];if(i===void 0){Lr(`Texture.setValues(): property '${t}' does not exist.`);continue}i&&n&&i.isVector2&&n.isVector2||i&&n&&i.isVector3&&n.isVector3||i&&n&&i.isMatrix3&&n.isMatrix3?i.copy(n):this[t]=n}}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];const n={metadata:{version:4.7,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(n.userData=this.userData),t||(e.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==be)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case $t:e.x=e.x-Math.floor(e.x);break;case Vt:e.x=e.x<0?0:1;break;case Qt: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 $t:e.y=e.y-Math.floor(e.y);break;case Vt:e.y=e.y<0?0:1;break;case Qt: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++}}zi.DEFAULT_IMAGE=null,zi.DEFAULT_MAPPING=be,zi.DEFAULT_ANISOTROPY=1;class Ni{constructor(e=0,t=0,n=0,i=1){Ni.prototype.isVector4=!0,this.x=e,this.y=t,this.z=n,this.w=i}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,i){return this.x=e,this.y=t,this.z=n,this.w=i,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,i=this.z,a=this.w,o=e.elements;return this.x=o[0]*t+o[4]*n+o[8]*i+o[12]*a,this.y=o[1]*t+o[5]*n+o[9]*i+o[13]*a,this.z=o[2]*t+o[6]*n+o[10]*i+o[14]*a,this.w=o[3]*t+o[7]*n+o[11]*i+o[15]*a,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,i,a;const c=e.elements,d=c[0],g=c[4],v=c[8],M=c[1],B=c[5],I=c[9],ne=c[2],ee=c[6],q=c[10];if(Math.abs(g-M)<.01&&Math.abs(v-ne)<.01&&Math.abs(I-ee)<.01){if(Math.abs(g+M)<.1&&Math.abs(v+ne)<.1&&Math.abs(I+ee)<.1&&Math.abs(d+B+q-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const Ce=(d+1)/2,ke=(B+1)/2,nt=(q+1)/2,Ye=(g+M)/4,ht=(v+ne)/4,Rt=(I+ee)/4;return Ce>ke&&Ce>nt?Ce<.01?(n=0,i=.707106781,a=.707106781):(n=Math.sqrt(Ce),i=Ye/n,a=ht/n):ke>nt?ke<.01?(n=.707106781,i=0,a=.707106781):(i=Math.sqrt(ke),n=Ye/i,a=Rt/i):nt<.01?(n=.707106781,i=.707106781,a=0):(a=Math.sqrt(nt),n=ht/a,i=Rt/a),this.set(n,i,a,t),this}let ye=Math.sqrt((ee-I)*(ee-I)+(v-ne)*(v-ne)+(M-g)*(M-g));return Math.abs(ye)<.001&&(ye=1),this.x=(ee-I)/ye,this.y=(v-ne)/ye,this.z=(M-g)/ye,this.w=Math.acos((d+B+q-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=Ca(this.x,e.x,t.x),this.y=Ca(this.y,e.y,t.y),this.z=Ca(this.z,e.z,t.z),this.w=Ca(this.w,e.w,t.w),this}clampScalar(e,t){return this.x=Ca(this.x,e,t),this.y=Ca(this.y,e,t),this.z=Ca(this.z,e,t),this.w=Ca(this.w,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Ca(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 Ns extends bl{constructor(e=1,t=1,n={}){super(),n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:vr,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1,depth:1,multiview:!1},n),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=n.depth,this.scissor=new Ni(0,0,e,t),this.scissorTest=!1,this.viewport=new Ni(0,0,e,t);const i={width:e,height:t,depth:n.depth},a=new zi(i);this.textures=[];const o=n.count;for(let u=0;u<o;u++)this.textures[u]=a.clone(),this.textures[u].isRenderTargetTexture=!0,this.textures[u].renderTarget=this;this._setTextureOptions(n),this.depthBuffer=n.depthBuffer,this.stencilBuffer=n.stencilBuffer,this.resolveDepthBuffer=n.resolveDepthBuffer,this.resolveStencilBuffer=n.resolveStencilBuffer,this._depthTexture=null,this.depthTexture=n.depthTexture,this.samples=n.samples,this.multiview=n.multiview}_setTextureOptions(e={}){const t={minFilter:vr,generateMipmaps:!1,flipY:!1,internalFormat:null};e.mapping!==void 0&&(t.mapping=e.mapping),e.wrapS!==void 0&&(t.wrapS=e.wrapS),e.wrapT!==void 0&&(t.wrapT=e.wrapT),e.wrapR!==void 0&&(t.wrapR=e.wrapR),e.magFilter!==void 0&&(t.magFilter=e.magFilter),e.minFilter!==void 0&&(t.minFilter=e.minFilter),e.format!==void 0&&(t.format=e.format),e.type!==void 0&&(t.type=e.type),e.anisotropy!==void 0&&(t.anisotropy=e.anisotropy),e.colorSpace!==void 0&&(t.colorSpace=e.colorSpace),e.flipY!==void 0&&(t.flipY=e.flipY),e.generateMipmaps!==void 0&&(t.generateMipmaps=e.generateMipmaps),e.internalFormat!==void 0&&(t.internalFormat=e.internalFormat);for(let n=0;n<this.textures.length;n++)this.textures[n].setValues(t)}get texture(){return this.textures[0]}set texture(e){this.textures[0]=e}set depthTexture(e){this._depthTexture!==null&&(this._depthTexture.renderTarget=null),e!==null&&(e.renderTarget=this),this._depthTexture=e}get depthTexture(){return this._depthTexture}setSize(e,t,n=1){if(this.width!==e||this.height!==t||this.depth!==n){this.width=e,this.height=t,this.depth=n;for(let i=0,a=this.textures.length;i<a;i++)this.textures[i].image.width=e,this.textures[i].image.height=t,this.textures[i].image.depth=n,this.textures[i].isData3DTexture!==!0&&(this.textures[i].isArrayTexture=this.textures[i].image.depth>1);this.dispose()}this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.textures.length=0;for(let t=0,n=e.textures.length;t<n;t++){this.textures[t]=e.textures[t].clone(),this.textures[t].isRenderTargetTexture=!0,this.textures[t].renderTarget=this;const i=Object.assign({},e.textures[t].image);this.textures[t].source=new rs(i)}return this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.resolveDepthBuffer=e.resolveDepthBuffer,this.resolveStencilBuffer=e.resolveStencilBuffer,e.depthTexture!==null&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}}class Os extends Ns{constructor(e=1,t=1,n={}){super(e,t,n),this.isWebGLRenderTarget=!0}}class _a extends zi{constructor(e=null,t=1,n=1,i=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:n,depth:i},this.magFilter=cn,this.minFilter=cn,this.wrapR=Vt,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class Sa extends null{constructor(e=1,t=1,n=1,i={}){super(e,t,i),this.isWebGLArrayRenderTarget=!0,this.depth=n,this.texture=new _a(null,e,t,n),this._setTextureOptions(i),this.texture.isRenderTargetTexture=!0}}class oe extends zi{constructor(e=null,t=1,n=1,i=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:n,depth:i},this.magFilter=cn,this.minFilter=cn,this.wrapR=Vt,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class re extends null{constructor(e=1,t=1,n=1,i={}){super(e,t,i),this.isWebGL3DRenderTarget=!0,this.depth=n,this.texture=new oe(null,e,t,n),this._setTextureOptions(i),this.texture.isRenderTargetTexture=!0}}class Y{constructor(e=new le(1/0,1/0,1/0),t=new le(-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<n;t+=3)this.expandByPoint(fe.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,n=e.count;t<n;t++)this.expandByPoint(fe.fromBufferAttribute(e,t));return this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){const n=fe.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}setFromObject(e,t=!1){return this.makeEmpty(),this.expandByObject(e,t)}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}expandByObject(e,t=!1){e.updateWorldMatrix(!1,!1);const n=e.geometry;if(n!==void 0){const a=n.getAttribute("position");if(t===!0&&a!==void 0&&e.isInstancedMesh!==!0)for(let o=0,u=a.count;o<u;o++)e.isMesh===!0?e.getVertexPosition(o,fe):fe.fromBufferAttribute(a,o),fe.applyMatrix4(e.matrixWorld),this.expandByPoint(fe);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),Te.copy(e.boundingBox)):(n.boundingBox===null&&n.computeBoundingBox(),Te.copy(n.boundingBox)),Te.applyMatrix4(e.matrixWorld),this.union(Te)}const i=e.children;for(let a=0,o=i.length;a<o;a++)this.expandByObject(i[a],t);return this}containsPoint(e){return e.x>=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,fe),fe.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(gn),Nn.subVectors(this.max,gn),De.subVectors(e.a,gn),Le.subVectors(e.b,gn),Xe.subVectors(e.c,gn),mt.subVectors(Le,De),Kt.subVectors(Xe,Le),nn.subVectors(De,Xe);let t=[0,-mt.z,mt.y,0,-Kt.z,Kt.y,0,-nn.z,nn.y,mt.z,0,-mt.x,Kt.z,0,-Kt.x,nn.z,0,-nn.x,-mt.y,mt.x,0,-Kt.y,Kt.x,0,-nn.y,nn.x,0];return!mr(t,De,Le,Xe,Nn)||(t=[1,0,0,0,1,0,0,0,1],!mr(t,De,Le,Xe,Nn))?!1:($n.crossVectors(mt,Kt),t=[$n.x,$n.y,$n.z],mr(t,De,Le,Xe,Nn))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,fe).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(fe).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:(J[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),J[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),J[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),J[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),J[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),J[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),J[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),J[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(J),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)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(e){return this.min.fromArray(e.min),this.max.fromArray(e.max),this}}const J=[new le,new le,new le,new le,new le,new le,new le,new le],fe=new le,Te=new Y,De=new le,Le=new le,Xe=new le,mt=new le,Kt=new le,nn=new le,gn=new le,Nn=new le,$n=new le,Er=new le;function mr(s,e,t,n,i){for(let a=0,o=s.length-3;a<=o;a+=3){Er.fromArray(s,a);const u=i.x*Math.abs(Er.x)+i.y*Math.abs(Er.y)+i.z*Math.abs(Er.z),c=e.dot(Er),d=t.dot(Er),g=n.dot(Er);if(Math.max(-Math.max(c,d,g),Math.min(c,d,g))>u)return!1}return!0}const ti=new Y,jr=new le,ui=new le;class gi{constructor(e=new le,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):ti.setFromPoints(e).getCenter(n);let i=0;for(let a=0,o=e.length;a<o;a++)i=Math.max(i,n.distanceToSquared(e[a]));return this.radius=Math.sqrt(i),this}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(e){return e.distanceTo(this.center)-this.radius}intersectsSphere(e){const t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t}intersectsBox(e){return e.intersectsSphere(this)}intersectsPlane(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}clampPoint(e,t){const n=this.center.distanceToSquared(e);return t.copy(e),n>this.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;jr.subVectors(e,this.center);const t=jr.lengthSq();if(t>this.radius*this.radius){const n=Math.sqrt(t),i=(n-this.radius)*.5;this.center.addScaledVector(jr,i/n),this.radius+=i}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):(ui.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(jr.copy(e.center).add(ui)),this.expandByPoint(jr.copy(e.center).sub(ui))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}toJSON(){return{radius:this.radius,center:this.center.toArray()}}fromJSON(e){return this.radius=e.radius,this.center.fromArray(e.center),this}}const oi=new le,ts=new le,fs=new le,Ds=new le,Ba=new le,Ka=new le,xo=new le;class aa{constructor(e=new le,t=new le(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,oi)),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=oi.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(oi.copy(this.origin).addScaledVector(this.direction,t),oi.distanceToSquared(e))}distanceSqToSegment(e,t,n,i){ts.copy(e).add(t).multiplyScalar(.5),fs.copy(t).sub(e).normalize(),Ds.copy(this.origin).sub(ts);const a=e.distanceTo(t)*.5,o=-this.direction.dot(fs),u=Ds.dot(this.direction),c=-Ds.dot(fs),d=Ds.lengthSq(),g=Math.abs(1-o*o);let v,M,B,I;if(g>0)if(v=o*c-u,M=o*u-c,I=a*g,v>=0)if(M>=-I)if(M<=I){const ne=1/g;v*=ne,M*=ne,B=v*(v+o*M+2*u)+M*(o*v+M+2*c)+d}else M=a,v=Math.max(0,-(o*M+u)),B=-v*v+M*(M+2*c)+d;else M=-a,v=Math.max(0,-(o*M+u)),B=-v*v+M*(M+2*c)+d;else M<=-I?(v=Math.max(0,-(-o*a+u)),M=v>0?-a:Math.min(Math.max(-a,-c),a),B=-v*v+M*(M+2*c)+d):M<=I?(v=0,M=Math.min(Math.max(-a,-c),a),B=M*(M+2*c)+d):(v=Math.max(0,-(o*a+u)),M=v>0?a:Math.min(Math.max(-a,-c),a),B=-v*v+M*(M+2*c)+d);else M=o>0?-a:a,v=Math.max(0,-(o*M+u)),B=-v*v+M*(M+2*c)+d;return n&&n.copy(this.origin).addScaledVector(this.direction,v),i&&i.copy(ts).addScaledVector(fs,M),B}intersectSphere(e,t){oi.subVectors(e.center,this.origin);const n=oi.dot(this.direction),i=oi.dot(oi)-n*n,a=e.radius*e.radius;if(i>a)return null;const o=Math.sqrt(a-i),u=n-o,c=n+o;return c<0?null:u<0?this.at(c,t):this.at(u,t)}intersectsSphere(e){return e.radius<0?!1: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,i,a,o,u,c;const d=1/this.direction.x,g=1/this.direction.y,v=1/this.direction.z,M=this.origin;return d>=0?(n=(e.min.x-M.x)*d,i=(e.max.x-M.x)*d):(n=(e.max.x-M.x)*d,i=(e.min.x-M.x)*d),g>=0?(a=(e.min.y-M.y)*g,o=(e.max.y-M.y)*g):(a=(e.max.y-M.y)*g,o=(e.min.y-M.y)*g),n>o||a>i||((a>n||isNaN(n))&&(n=a),(o<i||isNaN(i))&&(i=o),v>=0?(u=(e.min.z-M.z)*v,c=(e.max.z-M.z)*v):(u=(e.max.z-M.z)*v,c=(e.min.z-M.z)*v),n>c||u>i)||((u>n||n!==n)&&(n=u),(c<i||i!==i)&&(i=c),i<0)?null:this.at(n>=0?n:i,t)}intersectsBox(e){return this.intersectBox(e,oi)!==null}intersectTriangle(e,t,n,i,a){Ba.subVectors(t,e),Ka.subVectors(n,e),xo.crossVectors(Ba,Ka);let o=this.direction.dot(xo),u;if(o>0){if(i)return null;u=1}else if(o<0)u=-1,o=-o;else return null;Ds.subVectors(this.origin,e);const c=u*this.direction.dot(Ka.crossVectors(Ds,Ka));if(c<0)return null;const d=u*this.direction.dot(Ba.cross(Ds));if(d<0||c+d>o)return null;const g=-u*Ds.dot(xo);return g<0?null:this.at(g/o,a)}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 di{constructor(e,t,n,i,a,o,u,c,d,g,v,M,B,I,ne,ee){di.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,i,a,o,u,c,d,g,v,M,B,I,ne,ee)}set(e,t,n,i,a,o,u,c,d,g,v,M,B,I,ne,ee){const q=this.elements;return q[0]=e,q[4]=t,q[8]=n,q[12]=i,q[1]=a,q[5]=o,q[9]=u,q[13]=c,q[2]=d,q[6]=g,q[10]=v,q[14]=M,q[3]=B,q[7]=I,q[11]=ne,q[15]=ee,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 di().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 this.determinant()===0?(e.set(1,0,0),t.set(0,1,0),n.set(0,0,1),this):(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){if(e.determinant()===0)return this.identity();const t=this.elements,n=e.elements,i=1/Ma.setFromMatrixColumn(e,0).length(),a=1/Ma.setFromMatrixColumn(e,1).length(),o=1/Ma.setFromMatrixColumn(e,2).length();return t[0]=n[0]*i,t[1]=n[1]*i,t[2]=n[2]*i,t[3]=0,t[4]=n[4]*a,t[5]=n[5]*a,t[6]=n[6]*a,t[7]=0,t[8]=n[8]*o,t[9]=n[9]*o,t[10]=n[10]*o,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,i=e.y,a=e.z,o=Math.cos(n),u=Math.sin(n),c=Math.cos(i),d=Math.sin(i),g=Math.cos(a),v=Math.sin(a);if(e.order==="XYZ"){const M=o*g,B=o*v,I=u*g,ne=u*v;t[0]=c*g,t[4]=-c*v,t[8]=d,t[1]=B+I*d,t[5]=M-ne*d,t[9]=-u*c,t[2]=ne-M*d,t[6]=I+B*d,t[10]=o*c}else if(e.order==="YXZ"){const M=c*g,B=c*v,I=d*g,ne=d*v;t[0]=M+ne*u,t[4]=I*u-B,t[8]=o*d,t[1]=o*v,t[5]=o*g,t[9]=-u,t[2]=B*u-I,t[6]=ne+M*u,t[10]=o*c}else if(e.order==="ZXY"){const M=c*g,B=c*v,I=d*g,ne=d*v;t[0]=M-ne*u,t[4]=-o*v,t[8]=I+B*u,t[1]=B+I*u,t[5]=o*g,t[9]=ne-M*u,t[2]=-o*d,t[6]=u,t[10]=o*c}else if(e.order==="ZYX"){const M=o*g,B=o*v,I=u*g,ne=u*v;t[0]=c*g,t[4]=I*d-B,t[8]=M*d+ne,t[1]=c*v,t[5]=ne*d+M,t[9]=B*d-I,t[2]=-d,t[6]=u*c,t[10]=o*c}else if(e.order==="YZX"){const M=o*c,B=o*d,I=u*c,ne=u*d;t[0]=c*g,t[4]=ne-M*v,t[8]=I*v+B,t[1]=v,t[5]=o*g,t[9]=-u*g,t[2]=-d*g,t[6]=B*v+I,t[10]=M-ne*v}else if(e.order==="XZY"){const M=o*c,B=o*d,I=u*c,ne=u*d;t[0]=c*g,t[4]=-v,t[8]=d*g,t[1]=M*v+ne,t[5]=o*g,t[9]=B*v-I,t[2]=I*v-B,t[6]=u*g,t[10]=ne*v+M}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(lo,e,Jo)}lookAt(e,t,n){const i=this.elements;return pa.subVectors(e,t),pa.lengthSq()===0&&(pa.z=1),pa.normalize(),zs.crossVectors(n,pa),zs.lengthSq()===0&&(Math.abs(n.z)===1?pa.x+=1e-4:pa.z+=1e-4,pa.normalize(),zs.crossVectors(n,pa)),zs.normalize(),Ya.crossVectors(pa,zs),i[0]=zs.x,i[4]=Ya.x,i[8]=pa.x,i[1]=zs.y,i[5]=Ya.y,i[9]=pa.y,i[2]=zs.z,i[6]=Ya.z,i[10]=pa.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,i=t.elements,a=this.elements,o=n[0],u=n[4],c=n[8],d=n[12],g=n[1],v=n[5],M=n[9],B=n[13],I=n[2],ne=n[6],ee=n[10],q=n[14],ye=n[3],Ce=n[7],ke=n[11],nt=n[15],Ye=i[0],ht=i[4],Rt=i[8],qe=i[12],pt=i[1],xn=i[5],cr=i[9],pr=i[13],Br=i[2],zr=i[6],Dr=i[10],Zr=i[14],Ti=i[3],ds=i[7],As=i[11],Xr=i[15];return a[0]=o*Ye+u*pt+c*Br+d*Ti,a[4]=o*ht+u*xn+c*zr+d*ds,a[8]=o*Rt+u*cr+c*Dr+d*As,a[12]=o*qe+u*pr+c*Zr+d*Xr,a[1]=g*Ye+v*pt+M*Br+B*Ti,a[5]=g*ht+v*xn+M*zr+B*ds,a[9]=g*Rt+v*cr+M*Dr+B*As,a[13]=g*qe+v*pr+M*Zr+B*Xr,a[2]=I*Ye+ne*pt+ee*Br+q*Ti,a[6]=I*ht+ne*xn+ee*zr+q*ds,a[10]=I*Rt+ne*cr+ee*Dr+q*As,a[14]=I*qe+ne*pr+ee*Zr+q*Xr,a[3]=ye*Ye+Ce*pt+ke*Br+nt*Ti,a[7]=ye*ht+Ce*xn+ke*zr+nt*ds,a[11]=ye*Rt+Ce*cr+ke*Dr+nt*As,a[15]=ye*qe+Ce*pr+ke*Zr+nt*Xr,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],i=e[8],a=e[12],o=e[1],u=e[5],c=e[9],d=e[13],g=e[2],v=e[6],M=e[10],B=e[14],I=e[3],ne=e[7],ee=e[11],q=e[15],ye=c*B-d*M,Ce=u*B-d*v,ke=u*M-c*v,nt=o*B-d*g,Ye=o*M-c*g,ht=o*v-u*g;return t*(ne*ye-ee*Ce+q*ke)-n*(I*ye-ee*nt+q*Ye)+i*(I*Ce-ne*nt+q*ht)-a*(I*ke-ne*Ye+ee*ht)}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 i=this.elements;return e.isVector3?(i[12]=e.x,i[13]=e.y,i[14]=e.z):(i[12]=e,i[13]=t,i[14]=n),this}invert(){const e=this.elements,t=e[0],n=e[1],i=e[2],a=e[3],o=e[4],u=e[5],c=e[6],d=e[7],g=e[8],v=e[9],M=e[10],B=e[11],I=e[12],ne=e[13],ee=e[14],q=e[15],ye=v*ee*d-ne*M*d+ne*c*B-u*ee*B-v*c*q+u*M*q,Ce=I*M*d-g*ee*d-I*c*B+o*ee*B+g*c*q-o*M*q,ke=g*ne*d-I*v*d+I*u*B-o*ne*B-g*u*q+o*v*q,nt=I*v*c-g*ne*c-I*u*M+o*ne*M+g*u*ee-o*v*ee,Ye=t*ye+n*Ce+i*ke+a*nt;if(Ye===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const ht=1/Ye;return e[0]=ye*ht,e[1]=(ne*M*a-v*ee*a-ne*i*B+n*ee*B+v*i*q-n*M*q)*ht,e[2]=(u*ee*a-ne*c*a+ne*i*d-n*ee*d-u*i*q+n*c*q)*ht,e[3]=(v*c*a-u*M*a-v*i*d+n*M*d+u*i*B-n*c*B)*ht,e[4]=Ce*ht,e[5]=(g*ee*a-I*M*a+I*i*B-t*ee*B-g*i*q+t*M*q)*ht,e[6]=(I*c*a-o*ee*a-I*i*d+t*ee*d+o*i*q-t*c*q)*ht,e[7]=(o*M*a-g*c*a+g*i*d-t*M*d-o*i*B+t*c*B)*ht,e[8]=ke*ht,e[9]=(I*v*a-g*ne*a-I*n*B+t*ne*B+g*n*q-t*v*q)*ht,e[10]=(o*ne*a-I*u*a+I*n*d-t*ne*d-o*n*q+t*u*q)*ht,e[11]=(g*u*a-o*v*a-g*n*d+t*v*d+o*n*B-t*u*B)*ht,e[12]=nt*ht,e[13]=(g*ne*i-I*v*i+I*n*M-t*ne*M-g*n*ee+t*v*ee)*ht,e[14]=(I*u*i-o*ne*i-I*n*c+t*ne*c+o*n*ee-t*u*ee)*ht,e[15]=(o*v*i-g*u*i+g*n*c-t*v*c-o*n*M+t*u*M)*ht,this}scale(e){const t=this.elements,n=e.x,i=e.y,a=e.z;return t[0]*=n,t[4]*=i,t[8]*=a,t[1]*=n,t[5]*=i,t[9]*=a,t[2]*=n,t[6]*=i,t[10]*=a,t[3]*=n,t[7]*=i,t[11]*=a,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],i=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,i))}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),i=Math.sin(t),a=1-n,o=e.x,u=e.y,c=e.z,d=a*o,g=a*u;return this.set(d*o+n,d*u-i*c,d*c+i*u,0,d*u+i*c,g*u+n,g*c-i*o,0,d*c-i*u,g*c+i*o,a*c*c+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,i,a,o){return this.set(1,n,a,0,e,1,o,0,t,i,1,0,0,0,0,1),this}compose(e,t,n){const i=this.elements,a=t._x,o=t._y,u=t._z,c=t._w,d=a+a,g=o+o,v=u+u,M=a*d,B=a*g,I=a*v,ne=o*g,ee=o*v,q=u*v,ye=c*d,Ce=c*g,ke=c*v,nt=n.x,Ye=n.y,ht=n.z;return i[0]=(1-(ne+q))*nt,i[1]=(B+ke)*nt,i[2]=(I-Ce)*nt,i[3]=0,i[4]=(B-ke)*Ye,i[5]=(1-(M+q))*Ye,i[6]=(ee+ye)*Ye,i[7]=0,i[8]=(I+Ce)*ht,i[9]=(ee-ye)*ht,i[10]=(1-(M+ne))*ht,i[11]=0,i[12]=e.x,i[13]=e.y,i[14]=e.z,i[15]=1,this}decompose(e,t,n){const i=this.elements;if(e.x=i[12],e.y=i[13],e.z=i[14],this.determinant()===0)return n.set(1,1,1),t.identity(),this;let a=Ma.set(i[0],i[1],i[2]).length();const o=Ma.set(i[4],i[5],i[6]).length(),u=Ma.set(i[8],i[9],i[10]).length();this.determinant()<0&&(a=-a),Rs.copy(this);const d=1/a,g=1/o,v=1/u;return Rs.elements[0]*=d,Rs.elements[1]*=d,Rs.elements[2]*=d,Rs.elements[4]*=g,Rs.elements[5]*=g,Rs.elements[6]*=g,Rs.elements[8]*=v,Rs.elements[9]*=v,Rs.elements[10]*=v,t.setFromRotationMatrix(Rs),n.x=a,n.y=o,n.z=u,this}makePerspective(e,t,n,i,a,o,u=gl,c=!1){const d=this.elements,g=2*a/(t-e),v=2*a/(n-i),M=(t+e)/(t-e),B=(n+i)/(n-i);let I,ne;if(c)I=a/(o-a),ne=o*a/(o-a);else if(u===gl)I=-(o+a)/(o-a),ne=-2*o*a/(o-a);else if(u===To)I=-o/(o-a),ne=-o*a/(o-a);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+u);return d[0]=g,d[4]=0,d[8]=M,d[12]=0,d[1]=0,d[5]=v,d[9]=B,d[13]=0,d[2]=0,d[6]=0,d[10]=I,d[14]=ne,d[3]=0,d[7]=0,d[11]=-1,d[15]=0,this}makeOrthographic(e,t,n,i,a,o,u=gl,c=!1){const d=this.elements,g=2/(t-e),v=2/(n-i),M=-(t+e)/(t-e),B=-(n+i)/(n-i);let I,ne;if(c)I=1/(o-a),ne=o/(o-a);else if(u===gl)I=-2/(o-a),ne=-(o+a)/(o-a);else if(u===To)I=-1/(o-a),ne=-a/(o-a);else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+u);return d[0]=g,d[4]=0,d[8]=0,d[12]=M,d[1]=0,d[5]=v,d[9]=0,d[13]=B,d[2]=0,d[6]=0,d[10]=I,d[14]=ne,d[3]=0,d[7]=0,d[11]=0,d[15]=1,this}equals(e){const t=this.elements,n=e.elements;for(let i=0;i<16;i++)if(t[i]!==n[i])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 Ma=new le,Rs=new di,lo=new le(0,0,0),Jo=new le(1,1,1),zs=new le,Ya=new le,pa=new le,al=new di,qa=new Ze;class Ua{constructor(e=0,t=0,n=0,i=Ua.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=n,this._order=i}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,i=this._order){return this._x=e,this._y=t,this._z=n,this._order=i,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 i=e.elements,a=i[0],o=i[4],u=i[8],c=i[1],d=i[5],g=i[9],v=i[2],M=i[6],B=i[10];switch(t){case"XYZ":this._y=Math.asin(Ca(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(-g,B),this._z=Math.atan2(-o,a)):(this._x=Math.atan2(M,d),this._z=0);break;case"YXZ":this._x=Math.asin(-Ca(g,-1,1)),Math.abs(g)<.9999999?(this._y=Math.atan2(u,B),this._z=Math.atan2(c,d)):(this._y=Math.atan2(-v,a),this._z=0);break;case"ZXY":this._x=Math.asin(Ca(M,-1,1)),Math.abs(M)<.9999999?(this._y=Math.atan2(-v,B),this._z=Math.atan2(-o,d)):(this._y=0,this._z=Math.atan2(c,a));break;case"ZYX":this._y=Math.asin(-Ca(v,-1,1)),Math.abs(v)<.9999999?(this._x=Math.atan2(M,B),this._z=Math.atan2(c,a)):(this._x=0,this._z=Math.atan2(-o,d));break;case"YZX":this._z=Math.asin(Ca(c,-1,1)),Math.abs(c)<.9999999?(this._x=Math.atan2(-g,d),this._y=Math.atan2(-v,a)):(this._x=0,this._y=Math.atan2(u,B));break;case"XZY":this._z=Math.asin(-Ca(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(M,d),this._y=Math.atan2(u,a)):(this._x=Math.atan2(-g,B),this._y=0);break;default:Lr("Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,n===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,n){return al.makeRotationFromQuaternion(e),this.setFromRotationMatrix(al,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return qa.setFromEuler(this),this.setFromQuaternion(qa,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}}Ua.DEFAULT_ORDER="XYZ";class dl{constructor(){this.mask=1}set(e){this.mask=(1<<e|0)>>>0}enable(e){this.mask|=1<<e|0}enableAll(){this.mask=-1}toggle(e){this.mask^=1<<e|0}disable(e){this.mask&=~(1<<e|0)}disableAll(){this.mask=0}test(e){return(this.mask&e.mask)!==0}isEnabled(e){return(this.mask&(1<<e|0))!==0}}let Sc=0;const zl=new le,Gc=new Ze,uc=new di,Bu=new le,cu=new le,qc=new le,_l=new Ze,Ho=new le(1,0,0),jl=new le(0,1,0),Jc=new le(0,0,1),eh={type:"added"},df={type:"removed"},xh={type:"childadded",child:null},MA={type:"childremoved",child:null};class yl extends bl{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:Sc++}),this.uuid=oc(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=yl.DEFAULT_UP.clone();const e=new le,t=new Ua,n=new Ze,i=new le(1,1,1);function a(){n.setFromEuler(t,!1)}function o(){t.setFromQuaternion(n,void 0,!1)}t._onChange(a),n._onChange(o),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:t},quaternion:{configurable:!0,enumerable:!0,value:n},scale:{configurable:!0,enumerable:!0,value:i},modelViewMatrix:{value:new di},normalMatrix:{value:new pn}}),this.matrix=new di,this.matrixWorld=new di,this.matrixAutoUpdate=yl.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=yl.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new dl,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.customDepthMaterial=void 0,this.customDistanceMaterial=void 0,this.userData={}}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,t){this.quaternion.setFromAxisAngle(e,t)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,t){return Gc.setFromAxisAngle(e,t),this.quaternion.multiply(Gc),this}rotateOnWorldAxis(e,t){return Gc.setFromAxisAngle(e,t),this.quaternion.premultiply(Gc),this}rotateX(e){return this.rotateOnAxis(Ho,e)}rotateY(e){return this.rotateOnAxis(jl,e)}rotateZ(e){return this.rotateOnAxis(Jc,e)}translateOnAxis(e,t){return zl.copy(e).applyQuaternion(this.quaternion),this.position.add(zl.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(Ho,e)}translateY(e){return this.translateOnAxis(jl,e)}translateZ(e){return this.translateOnAxis(Jc,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(uc.copy(this.matrixWorld).invert())}lookAt(e,t,n){e.isVector3?Bu.copy(e):Bu.set(e,t,n);const i=this.parent;this.updateWorldMatrix(!0,!1),cu.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?uc.lookAt(cu,Bu,this.up):uc.lookAt(Bu,cu,this.up),this.quaternion.setFromRotationMatrix(uc),i&&(uc.extractRotation(i.matrixWorld),Gc.setFromRotationMatrix(uc),this.quaternion.premultiply(Gc.invert()))}add(e){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?(Gr("Object3D.add: object can't be added as a child of itself.",e),this):(e&&e.isObject3D?(e.removeFromParent(),e.parent=this,this.children.push(e),e.dispatchEvent(eh),xh.child=e,this.dispatchEvent(xh),xh.child=null):Gr("Object3D.add: object not an instance of THREE.Object3D.",e),this)}remove(e){if(arguments.length>1){for(let n=0;n<arguments.length;n++)this.remove(arguments[n]);return this}const t=this.children.indexOf(e);return t!==-1&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(df),MA.child=e,this.dispatchEvent(MA),MA.child=null),this}removeFromParent(){const e=this.parent;return e!==null&&e.remove(this),this}clear(){return this.remove(...this.children)}attach(e){return this.updateWorldMatrix(!0,!1),uc.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),uc.multiply(e.parent.matrixWorld)),e.applyMatrix4(uc),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(eh),xh.child=e,this.dispatchEvent(xh),xh.child=null,this}getObjectById(e){return this.getObjectByProperty("id",e)}getObjectByName(e){return this.getObjectByProperty("name",e)}getObjectByProperty(e,t){if(this[e]===t)return this;for(let n=0,i=this.children.length;n<i;n++){const o=this.children[n].getObjectByProperty(e,t);if(o!==void 0)return o}}getObjectsByProperty(e,t,n=[]){this[e]===t&&n.push(this);const i=this.children;for(let a=0,o=i.length;a<o;a++)i[a].getObjectsByProperty(e,t,n);return n}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(cu,e,qc),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(cu,_l,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);const t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);const t=this.children;for(let n=0,i=t.length;n<i;n++)t[n].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);const t=this.children;for(let n=0,i=t.length;n<i;n++)t[n].traverseVisible(e)}traverseAncestors(e){const t=this.parent;t!==null&&(e(t),t.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,e=!0);const t=this.children;for(let n=0,i=t.length;n<i;n++)t[n].updateMatrixWorld(e)}updateWorldMatrix(e,t){const n=this.parent;if(e===!0&&n!==null&&n.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),t===!0){const i=this.children;for(let a=0,o=i.length;a<o;a++)i[a].updateWorldMatrix(!1,!0)}}toJSON(e){const t=e===void 0||typeof e=="string",n={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},n.metadata={version:4.7,type:"Object",generator:"Object3D.toJSON"});const i={};i.uuid=this.uuid,i.type=this.type,this.name!==""&&(i.name=this.name),this.castShadow===!0&&(i.castShadow=!0),this.receiveShadow===!0&&(i.receiveShadow=!0),this.visible===!1&&(i.visible=!1),this.frustumCulled===!1&&(i.frustumCulled=!1),this.renderOrder!==0&&(i.renderOrder=this.renderOrder),Object.keys(this.userData).length>0&&(i.userData=this.userData),i.layers=this.layers.mask,i.matrix=this.matrix.toArray(),i.up=this.up.toArray(),this.matrixAutoUpdate===!1&&(i.matrixAutoUpdate=!1),this.isInstancedMesh&&(i.type="InstancedMesh",i.count=this.count,i.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(i.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(i.type="BatchedMesh",i.perObjectFrustumCulled=this.perObjectFrustumCulled,i.sortObjects=this.sortObjects,i.drawRanges=this._drawRanges,i.reservedRanges=this._reservedRanges,i.geometryInfo=this._geometryInfo.map(u=>fd(rl({},u),{boundingBox:u.boundingBox?u.boundingBox.toJSON():void 0,boundingSphere:u.boundingSphere?u.boundingSphere.toJSON():void 0})),i.instanceInfo=this._instanceInfo.map(u=>rl({},u)),i.availableInstanceIds=this._availableInstanceIds.slice(),i.availableGeometryIds=this._availableGeometryIds.slice(),i.nextIndexStart=this._nextIndexStart,i.nextVertexStart=this._nextVertexStart,i.geometryCount=this._geometryCount,i.maxInstanceCount=this._maxInstanceCount,i.maxVertexCount=this._maxVertexCount,i.maxIndexCount=this._maxIndexCount,i.geometryInitialized=this._geometryInitialized,i.matricesTexture=this._matricesTexture.toJSON(e),i.indirectTexture=this._indirectTexture.toJSON(e),this._colorsTexture!==null&&(i.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(i.boundingSphere=this.boundingSphere.toJSON()),this.boundingBox!==null&&(i.boundingBox=this.boundingBox.toJSON()));function a(u,c){return u[c.uuid]===void 0&&(u[c.uuid]=c.toJSON(e)),c.uuid}if(this.isScene)this.background&&(this.background.isColor?i.background=this.background.toJSON():this.background.isTexture&&(i.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(i.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){i.geometry=a(e.geometries,this.geometry);const u=this.geometry.parameters;if(u!==void 0&&u.shapes!==void 0){const c=u.shapes;if(Array.isArray(c))for(let d=0,g=c.length;d<g;d++){const v=c[d];a(e.shapes,v)}else a(e.shapes,c)}}if(this.isSkinnedMesh&&(i.bindMode=this.bindMode,i.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(a(e.skeletons,this.skeleton),i.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){const u=[];for(let c=0,d=this.material.length;c<d;c++)u.push(a(e.materials,this.material[c]));i.material=u}else i.material=a(e.materials,this.material);if(this.children.length>0){i.children=[];for(let u=0;u<this.children.length;u++)i.children.push(this.children[u].toJSON(e).object)}if(this.animations.length>0){i.animations=[];for(let u=0;u<this.animations.length;u++){const c=this.animations[u];i.animations.push(a(e.animations,c))}}if(t){const u=o(e.geometries),c=o(e.materials),d=o(e.textures),g=o(e.images),v=o(e.shapes),M=o(e.skeletons),B=o(e.animations),I=o(e.nodes);u.length>0&&(n.geometries=u),c.length>0&&(n.materials=c),d.length>0&&(n.textures=d),g.length>0&&(n.images=g),v.length>0&&(n.shapes=v),M.length>0&&(n.skeletons=M),B.length>0&&(n.animations=B),I.length>0&&(n.nodes=I)}return n.object=i,n;function o(u){const c=[];for(const d in u){const g=u[d];delete g.metadata,c.push(g)}return c}}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;n<e.children.length;n++){const i=e.children[n];this.add(i.clone())}return this}}yl.DEFAULT_UP=new le(0,1,0),yl.DEFAULT_MATRIX_AUTO_UPDATE=!0,yl.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;const Nc=new le,bh=new le,Wf=new le,_h=new le,ol=new le,Bl=new le,yd=new le,Co=new le,vu=new le,Gl=new le,Ea=new Ni,Rl=new Ni,Zf=new Ni;class ku{constructor(e=new le,t=new le,n=new le){this.a=e,this.b=t,this.c=n}static getNormal(e,t,n,i){i.subVectors(n,t),Nc.subVectors(e,t),i.cross(Nc);const a=i.lengthSq();return a>0?i.multiplyScalar(1/Math.sqrt(a)):i.set(0,0,0)}static getBarycoord(e,t,n,i,a){Nc.subVectors(i,t),bh.subVectors(n,t),Wf.subVectors(e,t);const o=Nc.dot(Nc),u=Nc.dot(bh),c=Nc.dot(Wf),d=bh.dot(bh),g=bh.dot(Wf),v=o*d-u*u;if(v===0)return a.set(0,0,0),null;const M=1/v,B=(d*c-u*g)*M,I=(o*g-u*c)*M;return a.set(1-B-I,I,B)}static containsPoint(e,t,n,i){return this.getBarycoord(e,t,n,i,_h)===null?!1:_h.x>=0&&_h.y>=0&&_h.x+_h.y<=1}static getInterpolation(e,t,n,i,a,o,u,c){return this.getBarycoord(e,t,n,i,_h)===null?(c.x=0,c.y=0,"z"in c&&(c.z=0),"w"in c&&(c.w=0),null):(c.setScalar(0),c.addScaledVector(a,_h.x),c.addScaledVector(o,_h.y),c.addScaledVector(u,_h.z),c)}static getInterpolatedAttribute(e,t,n,i,a,o){return Ea.setScalar(0),Rl.setScalar(0),Zf.setScalar(0),Ea.fromBufferAttribute(e,t),Rl.fromBufferAttribute(e,n),Zf.fromBufferAttribute(e,i),o.setScalar(0),o.addScaledVector(Ea,a.x),o.addScaledVector(Rl,a.y),o.addScaledVector(Zf,a.z),o}static isFrontFacing(e,t,n,i){return Nc.subVectors(n,t),bh.subVectors(e,t),Nc.cross(bh).dot(i)<0}set(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}setFromPointsAndIndices(e,t,n,i){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[i]),this}setFromAttributeAndIndices(e,t,n,i){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),this.c.fromBufferAttribute(e,i),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 Nc.subVectors(this.c,this.b),bh.subVectors(this.a,this.b),Nc.cross(bh).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return ku.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return ku.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,n,i,a){return ku.getInterpolation(e,this.a,this.b,this.c,t,n,i,a)}containsPoint(e){return ku.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return ku.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const n=this.a,i=this.b,a=this.c;let o,u;ol.subVectors(i,n),Bl.subVectors(a,n),Co.subVectors(e,n);const c=ol.dot(Co),d=Bl.dot(Co);if(c<=0&&d<=0)return t.copy(n);vu.subVectors(e,i);const g=ol.dot(vu),v=Bl.dot(vu);if(g>=0&&v<=g)return t.copy(i);const M=c*v-g*d;if(M<=0&&c>=0&&g<=0)return o=c/(c-g),t.copy(n).addScaledVector(ol,o);Gl.subVectors(e,a);const B=ol.dot(Gl),I=Bl.dot(Gl);if(I>=0&&B<=I)return t.copy(a);const ne=B*d-c*I;if(ne<=0&&d>=0&&I<=0)return u=d/(d-I),t.copy(n).addScaledVector(Bl,u);const ee=g*I-B*v;if(ee<=0&&v-g>=0&&B-I>=0)return yd.subVectors(a,i),u=(v-g)/(v-g+(B-I)),t.copy(i).addScaledVector(yd,u);const q=1/(ee+ne+M);return o=ne*q,u=M*q,t.copy(n).addScaledVector(ol,o).addScaledVector(Bl,u)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}const Dh={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},Vu={h:0,s:0,l:0},EA={h:0,s:0,l:0};function zu(s,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?s+(e-s)*6*t:t<1/2?e:t<2/3?s+(e-s)*6*(2/3-t):s}class Wr{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 i=e;i&&i.isColor?this.copy(i):typeof i=="number"?this.setHex(i):typeof i=="string"&&this.setStyle(i)}else this.setRGB(e,t,n);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=sl){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,xr.colorSpaceToWorking(this,t),this}setRGB(e,t,n,i=xr.workingColorSpace){return this.r=e,this.g=t,this.b=n,xr.colorSpaceToWorking(this,i),this}setHSL(e,t,n,i=xr.workingColorSpace){if(e=Ud(e,1),t=Ca(t,0,1),n=Ca(n,0,1),t===0)this.r=this.g=this.b=n;else{const a=n<=.5?n*(1+t):n+t-n*t,o=2*n-a;this.r=zu(o,a,e+1/3),this.g=zu(o,a,e),this.b=zu(o,a,e-1/3)}return xr.colorSpaceToWorking(this,i),this}setStyle(e,t=sl){function n(a){a!==void 0&&parseFloat(a)<1&&Lr("Color: Alpha component of "+e+" will be ignored.")}let i;if(i=/^(\w+)\(([^\)]*)\)/.exec(e)){let a;const o=i[1],u=i[2];switch(o){case"rgb":case"rgba":if(a=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(u))return n(a[4]),this.setRGB(Math.min(255,parseInt(a[1],10))/255,Math.min(255,parseInt(a[2],10))/255,Math.min(255,parseInt(a[3],10))/255,t);if(a=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(u))return n(a[4]),this.setRGB(Math.min(100,parseInt(a[1],10))/100,Math.min(100,parseInt(a[2],10))/100,Math.min(100,parseInt(a[3],10))/100,t);break;case"hsl":case"hsla":if(a=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(u))return n(a[4]),this.setHSL(parseFloat(a[1])/360,parseFloat(a[2])/100,parseFloat(a[3])/100,t);break;default:Lr("Color: Unknown color model "+e)}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(e)){const a=i[1],o=a.length;if(o===3)return this.setRGB(parseInt(a.charAt(0),16)/15,parseInt(a.charAt(1),16)/15,parseInt(a.charAt(2),16)/15,t);if(o===6)return this.setHex(parseInt(a,16),t);Lr("Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=sl){const n=Dh[e.toLowerCase()];return n!==void 0?this.setHex(n,t):Lr("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=Fr(e.r),this.g=Fr(e.g),this.b=Fr(e.b),this}copyLinearToSRGB(e){return this.r=ri(e.r),this.g=ri(e.g),this.b=ri(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=sl){return xr.workingToColorSpace(Hc.copy(this),e),Math.round(Ca(Hc.r*255,0,255))*65536+Math.round(Ca(Hc.g*255,0,255))*256+Math.round(Ca(Hc.b*255,0,255))}getHexString(e=sl){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=xr.workingColorSpace){xr.workingToColorSpace(Hc.copy(this),t);const n=Hc.r,i=Hc.g,a=Hc.b,o=Math.max(n,i,a),u=Math.min(n,i,a);let c,d;const g=(u+o)/2;if(u===o)c=0,d=0;else{const v=o-u;switch(d=g<=.5?v/(o+u):v/(2-o-u),o){case n:c=(i-a)/v+(i<a?6:0);break;case i:c=(a-n)/v+2;break;case a:c=(n-i)/v+4;break}c/=6}return e.h=c,e.s=d,e.l=g,e}getRGB(e,t=xr.workingColorSpace){return xr.workingToColorSpace(Hc.copy(this),t),e.r=Hc.r,e.g=Hc.g,e.b=Hc.b,e}getStyle(e=sl){xr.workingToColorSpace(Hc.copy(this),e);const t=Hc.r,n=Hc.g,i=Hc.b;return e!==sl?`color(${e} ${t.toFixed(3)} ${n.toFixed(3)} ${i.toFixed(3)})`:`rgb(${Math.round(t*255)},${Math.round(n*255)},${Math.round(i*255)})`}offsetHSL(e,t,n){return this.getHSL(Vu),this.setHSL(Vu.h+e,Vu.s+t,Vu.l+n)}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this}lerpColors(e,t,n){return this.r=e.r+(t.r-e.r)*n,this.g=e.g+(t.g-e.g)*n,this.b=e.b+(t.b-e.b)*n,this}lerpHSL(e,t){this.getHSL(Vu),e.getHSL(EA);const n=lc(Vu.h,EA.h,t),i=lc(Vu.s,EA.s,t),a=lc(Vu.l,EA.l,t);return this.setHSL(n,i,a),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){const t=this.r,n=this.g,i=this.b,a=e.elements;return this.r=a[0]*t+a[3]*n+a[6]*i,this.g=a[1]*t+a[4]*n+a[7]*i,this.b=a[2]*t+a[5]*n+a[8]*i,this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,t=0){return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}toArray(e=[],t=0){return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}fromBufferAttribute(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}}const Hc=new Wr;Wr.NAMES=Dh;let yu=0;class Hl extends bl{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:yu++}),this.uuid=oc(),this.name="",this.type="Material",this.blending=ve,this.side=j,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=zn,this.blendDst=dr,this.blendEquation=vt,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new Wr(0,0,0),this.blendAlpha=0,this.depthFunc=Ae,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=lu,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=Ku,this.stencilZFail=Ku,this.stencilZPass=Ku,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.allowOverride=!0,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=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){Lr(`Material: parameter '${t}' has value of undefined.`);continue}const i=this[t];if(i===void 0){Lr(`Material: '${t}' is not a property of THREE.${this.type}.`);continue}i&&i.isColor?i.set(n):i&&i.isVector3&&n&&n.isVector3?i.copy(n):this[t]=n}}toJSON(e){const t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});const n={metadata:{version:4.7,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.sheenColorMap&&this.sheenColorMap.isTexture&&(n.sheenColorMap=this.sheenColorMap.toJSON(e).uuid),this.sheenRoughnessMap&&this.sheenRoughnessMap.isTexture&&(n.sheenRoughnessMap=this.sheenRoughnessMap.toJSON(e).uuid),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!==ve&&(n.blending=this.blending),this.side!==j&&(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!==zn&&(n.blendSrc=this.blendSrc),this.blendDst!==dr&&(n.blendDst=this.blendDst),this.blendEquation!==vt&&(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!==Ae&&(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!==lu&&(n.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(n.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==Ku&&(n.stencilFail=this.stencilFail),this.stencilZFail!==Ku&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==Ku&&(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.allowOverride===!1&&(n.allowOverride=!1),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 i(a){const o=[];for(const u in a){const c=a[u];delete c.metadata,o.push(c)}return o}if(t){const a=i(e.textures),o=i(e.images);a.length>0&&(n.textures=a),o.length>0&&(n.images=o)}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 i=t.length;n=new Array(i);for(let a=0;a!==i;++a)n[a]=t[a].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.allowOverride=e.allowOverride,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++}}class Yl extends Hl{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new Wr(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 Ua,this.combine=on,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 Ql=Km();function Km(){const s=new ArrayBuffer(4),e=new Float32Array(s),t=new Uint32Array(s),n=new Uint32Array(512),i=new Uint32Array(512);for(let c=0;c<256;++c){const d=c-127;d<-27?(n[c]=0,n[c|256]=32768,i[c]=24,i[c|256]=24):d<-14?(n[c]=1024>>-d-14,n[c|256]=1024>>-d-14|32768,i[c]=-d-1,i[c|256]=-d-1):d<=15?(n[c]=d+15<<10,n[c|256]=d+15<<10|32768,i[c]=13,i[c|256]=13):d<128?(n[c]=31744,n[c|256]=64512,i[c]=24,i[c|256]=24):(n[c]=31744,n[c|256]=64512,i[c]=13,i[c|256]=13)}const a=new Uint32Array(2048),o=new Uint32Array(64),u=new Uint32Array(64);for(let c=1;c<1024;++c){let d=c<<13,g=0;for(;!(d&8388608);)d<<=1,g-=8388608;d&=-8388609,g+=947912704,a[c]=d|g}for(let c=1024;c<2048;++c)a[c]=939524096+(c-1024<<13);for(let c=1;c<31;++c)o[c]=c<<23;o[31]=1199570944,o[32]=2147483648;for(let c=33;c<63;++c)o[c]=2147483648+(c-32<<23);o[63]=3347054592;for(let c=1;c<64;++c)c!==32&&(u[c]=1024);return{floatView:e,uint32View:t,baseTable:n,shiftTable:i,mantissaTable:a,exponentTable:o,offsetTable:u}}function Ol(s){Math.abs(s)>65504&&Lr("DataUtils.toHalfFloat(): Value out of range."),s=Ca(s,-65504,65504),Ql.floatView[0]=s;const e=Ql.uint32View[0],t=e>>23&511;return Ql.baseTable[t]+((e&8388607)>>Ql.shiftTable[t])}function Kf(s){const e=s>>10;return Ql.uint32View[0]=Ql.mantissaTable[Ql.offsetTable[e]+(s&1023)]+Ql.exponentTable[e],Ql.floatView[0]}class Zv{static toHalfFloat(e){return Ol(e)}static fromHalfFloat(e){return Kf(e)}}const ql=new le,Rp=new ce;let $f=0;class wl{constructor(e,t,n=!1){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:$f++}),this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=n,this.usage=gh,this.updateRanges=[],this.gpuType=dt,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 i=0,a=this.itemSize;i<a;i++)this.array[e+i]=t.array[n+i];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(this.itemSize===2)for(let t=0,n=this.count;t<n;t++)Rp.fromBufferAttribute(this,t),Rp.applyMatrix3(e),this.setXY(t,Rp.x,Rp.y);else if(this.itemSize===3)for(let t=0,n=this.count;t<n;t++)ql.fromBufferAttribute(this,t),ql.applyMatrix3(e),this.setXYZ(t,ql.x,ql.y,ql.z);return this}applyMatrix4(e){for(let t=0,n=this.count;t<n;t++)ql.fromBufferAttribute(this,t),ql.applyMatrix4(e),this.setXYZ(t,ql.x,ql.y,ql.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)ql.fromBufferAttribute(this,t),ql.applyNormalMatrix(e),this.setXYZ(t,ql.x,ql.y,ql.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)ql.fromBufferAttribute(this,t),ql.transformDirection(e),this.setXYZ(t,ql.x,ql.y,ql.z);return this}set(e,t=0){return this.array.set(e,t),this}getComponent(e,t){let n=this.array[e*this.itemSize+t];return this.normalized&&(n=vl(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=He(n,this.array)),this.array[e*this.itemSize+t]=n,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=vl(t,this.array)),t}setX(e,t){return this.normalized&&(t=He(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=vl(t,this.array)),t}setY(e,t){return this.normalized&&(t=He(t,this.array)),this.array[e*this.itemSize+1]=t,this}getZ(e){let t=this.array[e*this.itemSize+2];return this.normalized&&(t=vl(t,this.array)),t}setZ(e,t){return this.normalized&&(t=He(t,this.array)),this.array[e*this.itemSize+2]=t,this}getW(e){let t=this.array[e*this.itemSize+3];return this.normalized&&(t=vl(t,this.array)),t}setW(e,t){return this.normalized&&(t=He(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=He(t,this.array),n=He(n,this.array)),this.array[e+0]=t,this.array[e+1]=n,this}setXYZ(e,t,n,i){return e*=this.itemSize,this.normalized&&(t=He(t,this.array),n=He(n,this.array),i=He(i,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=i,this}setXYZW(e,t,n,i,a){return e*=this.itemSize,this.normalized&&(t=He(t,this.array),n=He(n,this.array),i=He(i,this.array),a=He(a,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=i,this.array[e+3]=a,this}onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){const e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return this.name!==""&&(e.name=this.name),this.usage!==gh&&(e.usage=this.usage),e}}class ha extends null{constructor(e,t,n){super(new Int8Array(e),t,n)}}class $m extends null{constructor(e,t,n){super(new Uint8Array(e),t,n)}}class kh extends null{constructor(e,t,n){super(new Uint8ClampedArray(e),t,n)}}class lm extends null{constructor(e,t,n){super(new Int16Array(e),t,n)}}class qh extends wl{constructor(e,t,n){super(new Uint16Array(e),t,n)}}class th extends null{constructor(e,t,n){super(new Int32Array(e),t,n)}}class ff extends wl{constructor(e,t,n){super(new Uint32Array(e),t,n)}}class Yu extends wl{constructor(e,t,n){super(new Uint16Array(e),t,n),this.isFloat16BufferAttribute=!0}getX(e){let t=Kf(this.array[e*this.itemSize]);return this.normalized&&(t=vl(t,this.array)),t}setX(e,t){return this.normalized&&(t=He(t,this.array)),this.array[e*this.itemSize]=Ol(t),this}getY(e){let t=Kf(this.array[e*this.itemSize+1]);return this.normalized&&(t=vl(t,this.array)),t}setY(e,t){return this.normalized&&(t=He(t,this.array)),this.array[e*this.itemSize+1]=Ol(t),this}getZ(e){let t=Kf(this.array[e*this.itemSize+2]);return this.normalized&&(t=vl(t,this.array)),t}setZ(e,t){return this.normalized&&(t=He(t,this.array)),this.array[e*this.itemSize+2]=Ol(t),this}getW(e){let t=Kf(this.array[e*this.itemSize+3]);return this.normalized&&(t=vl(t,this.array)),t}setW(e,t){return this.normalized&&(t=He(t,this.array)),this.array[e*this.itemSize+3]=Ol(t),this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=He(t,this.array),n=He(n,this.array)),this.array[e+0]=Ol(t),this.array[e+1]=Ol(n),this}setXYZ(e,t,n,i){return e*=this.itemSize,this.normalized&&(t=He(t,this.array),n=He(n,this.array),i=He(i,this.array)),this.array[e+0]=Ol(t),this.array[e+1]=Ol(n),this.array[e+2]=Ol(i),this}setXYZW(e,t,n,i,a){return e*=this.itemSize,this.normalized&&(t=He(t,this.array),n=He(n,this.array),i=He(i,this.array),a=He(a,this.array)),this.array[e+0]=Ol(t),this.array[e+1]=Ol(n),this.array[e+2]=Ol(i),this.array[e+3]=Ol(a),this}}class Ui extends wl{constructor(e,t,n){super(new Float32Array(e),t,n)}}let Fc=0;const Gu=new di,CA=new yl,Xf=new le,cc=new Y,Vd=new Y,Ru=new le;class ka extends bl{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:Fc++}),this.uuid=oc(),this.name="",this.type="BufferGeometry",this.index=null,this.indirect=null,this.indirectOffset=0,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(e){return Array.isArray(e)?this.index=new(Oo(e)?ff:qh)(e,1):this.index=e,this}setIndirect(e,t=0){return this.indirect=e,this.indirectOffset=t,this}getIndirect(){return this.indirect}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return this.attributes[e]!==void 0}addGroup(e,t,n=0){this.groups.push({start:e,count:t,materialIndex:n})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){const t=this.attributes.position;t!==void 0&&(t.applyMatrix4(e),t.needsUpdate=!0);const n=this.attributes.normal;if(n!==void 0){const a=new pn().getNormalMatrix(e);n.applyNormalMatrix(a),n.needsUpdate=!0}const i=this.attributes.tangent;return i!==void 0&&(i.transformDirection(e),i.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(e){return Gu.makeRotationFromQuaternion(e),this.applyMatrix4(Gu),this}rotateX(e){return Gu.makeRotationX(e),this.applyMatrix4(Gu),this}rotateY(e){return Gu.makeRotationY(e),this.applyMatrix4(Gu),this}rotateZ(e){return Gu.makeRotationZ(e),this.applyMatrix4(Gu),this}translate(e,t,n){return Gu.makeTranslation(e,t,n),this.applyMatrix4(Gu),this}scale(e,t,n){return Gu.makeScale(e,t,n),this.applyMatrix4(Gu),this}lookAt(e){return CA.lookAt(e),CA.updateMatrix(),this.applyMatrix4(CA.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(Xf).negate(),this.translate(Xf.x,Xf.y,Xf.z),this}setFromPoints(e){const t=this.getAttribute("position");if(t===void 0){const n=[];for(let i=0,a=e.length;i<a;i++){const o=e[i];n.push(o.x,o.y,o.z||0)}this.setAttribute("position",new Ui(n,3))}else{const n=Math.min(e.length,t.count);for(let i=0;i<n;i++){const a=e[i];t.setXYZ(i,a.x,a.y,a.z||0)}e.length>t.count&&Lr("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 Y);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){Gr("BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new le(-1/0,-1/0,-1/0),new le(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let n=0,i=t.length;n<i;n++){const a=t[n];cc.setFromBufferAttribute(a),this.morphTargetsRelative?(Ru.addVectors(this.boundingBox.min,cc.min),this.boundingBox.expandByPoint(Ru),Ru.addVectors(this.boundingBox.max,cc.max),this.boundingBox.expandByPoint(Ru)):(this.boundingBox.expandByPoint(cc.min),this.boundingBox.expandByPoint(cc.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&Gr('BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new gi);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){Gr("BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new le,1/0);return}if(e){const n=this.boundingSphere.center;if(cc.setFromBufferAttribute(e),t)for(let a=0,o=t.length;a<o;a++){const u=t[a];Vd.setFromBufferAttribute(u),this.morphTargetsRelative?(Ru.addVectors(cc.min,Vd.min),cc.expandByPoint(Ru),Ru.addVectors(cc.max,Vd.max),cc.expandByPoint(Ru)):(cc.expandByPoint(Vd.min),cc.expandByPoint(Vd.max))}cc.getCenter(n);let i=0;for(let a=0,o=e.count;a<o;a++)Ru.fromBufferAttribute(e,a),i=Math.max(i,n.distanceToSquared(Ru));if(t)for(let a=0,o=t.length;a<o;a++){const u=t[a],c=this.morphTargetsRelative;for(let d=0,g=u.count;d<g;d++)Ru.fromBufferAttribute(u,d),c&&(Xf.fromBufferAttribute(e,d),Ru.add(Xf)),i=Math.max(i,n.distanceToSquared(Ru))}this.boundingSphere.radius=Math.sqrt(i),isNaN(this.boundingSphere.radius)&&Gr('BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){const e=this.index,t=this.attributes;if(e===null||t.position===void 0||t.normal===void 0||t.uv===void 0){Gr("BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}const n=t.position,i=t.normal,a=t.uv;this.hasAttribute("tangent")===!1&&this.setAttribute("tangent",new wl(new Float32Array(4*n.count),4));const o=this.getAttribute("tangent"),u=[],c=[];for(let Rt=0;Rt<n.count;Rt++)u[Rt]=new le,c[Rt]=new le;const d=new le,g=new le,v=new le,M=new ce,B=new ce,I=new ce,ne=new le,ee=new le;function q(Rt,qe,pt){d.fromBufferAttribute(n,Rt),g.fromBufferAttribute(n,qe),v.fromBufferAttribute(n,pt),M.fromBufferAttribute(a,Rt),B.fromBufferAttribute(a,qe),I.fromBufferAttribute(a,pt),g.sub(d),v.sub(d),B.sub(M),I.sub(M);const xn=1/(B.x*I.y-I.x*B.y);isFinite(xn)&&(ne.copy(g).multiplyScalar(I.y).addScaledVector(v,-B.y).multiplyScalar(xn),ee.copy(v).multiplyScalar(B.x).addScaledVector(g,-I.x).multiplyScalar(xn),u[Rt].add(ne),u[qe].add(ne),u[pt].add(ne),c[Rt].add(ee),c[qe].add(ee),c[pt].add(ee))}let ye=this.groups;ye.length===0&&(ye=[{start:0,count:e.count}]);for(let Rt=0,qe=ye.length;Rt<qe;++Rt){const pt=ye[Rt],xn=pt.start,cr=pt.count;for(let pr=xn,Br=xn+cr;pr<Br;pr+=3)q(e.getX(pr+0),e.getX(pr+1),e.getX(pr+2))}const Ce=new le,ke=new le,nt=new le,Ye=new le;function ht(Rt){nt.fromBufferAttribute(i,Rt),Ye.copy(nt);const qe=u[Rt];Ce.copy(qe),Ce.sub(nt.multiplyScalar(nt.dot(qe))).normalize(),ke.crossVectors(Ye,qe);const xn=ke.dot(c[Rt])<0?-1:1;o.setXYZW(Rt,Ce.x,Ce.y,Ce.z,xn)}for(let Rt=0,qe=ye.length;Rt<qe;++Rt){const pt=ye[Rt],xn=pt.start,cr=pt.count;for(let pr=xn,Br=xn+cr;pr<Br;pr+=3)ht(e.getX(pr+0)),ht(e.getX(pr+1)),ht(e.getX(pr+2))}}computeVertexNormals(){const e=this.index,t=this.getAttribute("position");if(t!==void 0){let n=this.getAttribute("normal");if(n===void 0)n=new wl(new Float32Array(t.count*3),3),this.setAttribute("normal",n);else for(let M=0,B=n.count;M<B;M++)n.setXYZ(M,0,0,0);const i=new le,a=new le,o=new le,u=new le,c=new le,d=new le,g=new le,v=new le;if(e)for(let M=0,B=e.count;M<B;M+=3){const I=e.getX(M+0),ne=e.getX(M+1),ee=e.getX(M+2);i.fromBufferAttribute(t,I),a.fromBufferAttribute(t,ne),o.fromBufferAttribute(t,ee),g.subVectors(o,a),v.subVectors(i,a),g.cross(v),u.fromBufferAttribute(n,I),c.fromBufferAttribute(n,ne),d.fromBufferAttribute(n,ee),u.add(g),c.add(g),d.add(g),n.setXYZ(I,u.x,u.y,u.z),n.setXYZ(ne,c.x,c.y,c.z),n.setXYZ(ee,d.x,d.y,d.z)}else for(let M=0,B=t.count;M<B;M+=3)i.fromBufferAttribute(t,M+0),a.fromBufferAttribute(t,M+1),o.fromBufferAttribute(t,M+2),g.subVectors(o,a),v.subVectors(i,a),g.cross(v),n.setXYZ(M+0,g.x,g.y,g.z),n.setXYZ(M+1,g.x,g.y,g.z),n.setXYZ(M+2,g.x,g.y,g.z);this.normalizeNormals(),n.needsUpdate=!0}}normalizeNormals(){const e=this.attributes.normal;for(let t=0,n=e.count;t<n;t++)Ru.fromBufferAttribute(e,t),Ru.normalize(),e.setXYZ(t,Ru.x,Ru.y,Ru.z)}toNonIndexed(){function e(u,c){const d=u.array,g=u.itemSize,v=u.normalized,M=new d.constructor(c.length*g);let B=0,I=0;for(let ne=0,ee=c.length;ne<ee;ne++){u.isInterleavedBufferAttribute?B=c[ne]*u.data.stride+u.offset:B=c[ne]*g;for(let q=0;q<g;q++)M[I++]=d[B++]}return new wl(M,g,v)}if(this.index===null)return Lr("BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const t=new ka,n=this.index.array,i=this.attributes;for(const u in i){const c=i[u],d=e(c,n);t.setAttribute(u,d)}const a=this.morphAttributes;for(const u in a){const c=[],d=a[u];for(let g=0,v=d.length;g<v;g++){const M=d[g],B=e(M,n);c.push(B)}t.morphAttributes[u]=c}t.morphTargetsRelative=this.morphTargetsRelative;const o=this.groups;for(let u=0,c=o.length;u<c;u++){const d=o[u];t.addGroup(d.start,d.count,d.materialIndex)}return t}toJSON(){const e={metadata:{version:4.7,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,this.name!==""&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),this.parameters!==void 0){const c=this.parameters;for(const d in c)c[d]!==void 0&&(e[d]=c[d]);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 c in n){const d=n[c];e.data.attributes[c]=d.toJSON(e.data)}const i={};let a=!1;for(const c in this.morphAttributes){const d=this.morphAttributes[c],g=[];for(let v=0,M=d.length;v<M;v++){const B=d[v];g.push(B.toJSON(e.data))}g.length>0&&(i[c]=g,a=!0)}a&&(e.data.morphAttributes=i,e.data.morphTargetsRelative=this.morphTargetsRelative);const o=this.groups;o.length>0&&(e.data.groups=JSON.parse(JSON.stringify(o)));const u=this.boundingSphere;return u!==null&&(e.data.boundingSphere=u.toJSON()),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());const i=e.attributes;for(const d in i){const g=i[d];this.setAttribute(d,g.clone(t))}const a=e.morphAttributes;for(const d in a){const g=[],v=a[d];for(let M=0,B=v.length;M<B;M++)g.push(v[M].clone(t));this.morphAttributes[d]=g}this.morphTargetsRelative=e.morphTargetsRelative;const o=e.groups;for(let d=0,g=o.length;d<g;d++){const v=o[d];this.addGroup(v.start,v.count,v.materialIndex)}const u=e.boundingBox;u!==null&&(this.boundingBox=u.clone());const c=e.boundingSphere;return c!==null&&(this.boundingSphere=c.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}}const Af=new di,Sl=new aa,xd=new gi,zd=new le,TA=new le,Gd=new le,Hd=new le,pf=new le,Ip=new le,_g=new le,ip=new le;class Il extends yl{constructor(e=new ka,t=new Yl){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.count=1,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),e.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),e.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}updateMorphTargets(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){const i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let a=0,o=i.length;a<o;a++){const u=i[a].name||String(a);this.morphTargetInfluences.push(0),this.morphTargetDictionary[u]=a}}}}getVertexPosition(e,t){const n=this.geometry,i=n.attributes.position,a=n.morphAttributes.position,o=n.morphTargetsRelative;t.fromBufferAttribute(i,e);const u=this.morphTargetInfluences;if(a&&u){Ip.set(0,0,0);for(let c=0,d=a.length;c<d;c++){const g=u[c],v=a[c];g!==0&&(pf.fromBufferAttribute(v,e),o?Ip.addScaledVector(pf,g):Ip.addScaledVector(pf.sub(t),g))}t.add(Ip)}return t}raycast(e,t){const n=this.geometry,i=this.material,a=this.matrixWorld;i!==void 0&&(n.boundingSphere===null&&n.computeBoundingSphere(),xd.copy(n.boundingSphere),xd.applyMatrix4(a),Sl.copy(e.ray).recast(e.near),!(xd.containsPoint(Sl.origin)===!1&&(Sl.intersectSphere(xd,zd)===null||Sl.origin.distanceToSquared(zd)>Bp(e.far-e.near,2)))&&(Af.copy(a).invert(),Sl.copy(e.ray).applyMatrix4(Af),!(n.boundingBox!==null&&Sl.intersectsBox(n.boundingBox)===!1)&&this._computeIntersections(e,t,Sl)))}_computeIntersections(e,t,n){let i;const a=this.geometry,o=this.material,u=a.index,c=a.attributes.position,d=a.attributes.uv,g=a.attributes.uv1,v=a.attributes.normal,M=a.groups,B=a.drawRange;if(u!==null)if(Array.isArray(o))for(let I=0,ne=M.length;I<ne;I++){const ee=M[I],q=o[ee.materialIndex],ye=Math.max(ee.start,B.start),Ce=Math.min(u.count,Math.min(ee.start+ee.count,B.start+B.count));for(let ke=ye,nt=Ce;ke<nt;ke+=3){const Ye=u.getX(ke),ht=u.getX(ke+1),Rt=u.getX(ke+2);i=sp(this,q,e,n,d,g,v,Ye,ht,Rt),i&&(i.faceIndex=Math.floor(ke/3),i.face.materialIndex=ee.materialIndex,t.push(i))}}else{const I=Math.max(0,B.start),ne=Math.min(u.count,B.start+B.count);for(let ee=I,q=ne;ee<q;ee+=3){const ye=u.getX(ee),Ce=u.getX(ee+1),ke=u.getX(ee+2);i=sp(this,o,e,n,d,g,v,ye,Ce,ke),i&&(i.faceIndex=Math.floor(ee/3),t.push(i))}}else if(c!==void 0)if(Array.isArray(o))for(let I=0,ne=M.length;I<ne;I++){const ee=M[I],q=o[ee.materialIndex],ye=Math.max(ee.start,B.start),Ce=Math.min(c.count,Math.min(ee.start+ee.count,B.start+B.count));for(let ke=ye,nt=Ce;ke<nt;ke+=3){const Ye=ke,ht=ke+1,Rt=ke+2;i=sp(this,q,e,n,d,g,v,Ye,ht,Rt),i&&(i.faceIndex=Math.floor(ke/3),i.face.materialIndex=ee.materialIndex,t.push(i))}}else{const I=Math.max(0,B.start),ne=Math.min(c.count,B.start+B.count);for(let ee=I,q=ne;ee<q;ee+=3){const ye=ee,Ce=ee+1,ke=ee+2;i=sp(this,o,e,n,d,g,v,ye,Ce,ke),i&&(i.faceIndex=Math.floor(ee/3),t.push(i))}}}}function um(s,e,t,n,i,a,o,u){let c;if(e.side===de?c=n.intersectTriangle(o,a,i,!0,u):c=n.intersectTriangle(i,a,o,e.side===j,u),c===null)return null;ip.copy(u),ip.applyMatrix4(s.matrixWorld);const d=t.ray.origin.distanceTo(ip);return d<t.near||d>t.far?null:{distance:d,point:ip.clone(),object:s}}function sp(s,e,t,n,i,a,o,u,c,d){s.getVertexPosition(u,TA),s.getVertexPosition(c,Gd),s.getVertexPosition(d,Hd);const g=um(s,e,t,n,TA,Gd,Hd,_g);if(g){const v=new le;ku.getBarycoord(_g,TA,Gd,Hd,v),i&&(g.uv=ku.getInterpolatedAttribute(i,u,c,d,v,new ce)),a&&(g.uv1=ku.getInterpolatedAttribute(a,u,c,d,v,new ce)),o&&(g.normal=ku.getInterpolatedAttribute(o,u,c,d,v,new le),g.normal.dot(n.direction)>0&&g.normal.multiplyScalar(-1));const M={a:u,b:c,c:d,normal:new le,materialIndex:0};ku.getNormal(TA,Gd,Hd,M.normal),g.face=M,g.barycoord=v}return g}class bd extends ka{constructor(e=1,t=1,n=1,i=1,a=1,o=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:i,heightSegments:a,depthSegments:o};const u=this;i=Math.floor(i),a=Math.floor(a),o=Math.floor(o);const c=[],d=[],g=[],v=[];let M=0,B=0;I("z","y","x",-1,-1,n,t,e,o,a,0),I("z","y","x",1,-1,n,t,-e,o,a,1),I("x","z","y",1,1,e,n,t,i,o,2),I("x","z","y",1,-1,e,n,-t,i,o,3),I("x","y","z",1,-1,e,t,n,i,a,4),I("x","y","z",-1,-1,e,t,-n,i,a,5),this.setIndex(c),this.setAttribute("position",new Ui(d,3)),this.setAttribute("normal",new Ui(g,3)),this.setAttribute("uv",new Ui(v,2));function I(ne,ee,q,ye,Ce,ke,nt,Ye,ht,Rt,qe){const pt=ke/ht,xn=nt/Rt,cr=ke/2,pr=nt/2,Br=Ye/2,zr=ht+1,Dr=Rt+1;let Zr=0,Ti=0;const ds=new le;for(let As=0;As<Dr;As++){const Xr=As*xn-pr;for(let Yi=0;Yi<zr;Yi++){const ps=Yi*pt-cr;ds[ne]=ps*ye,ds[ee]=Xr*Ce,ds[q]=Br,d.push(ds.x,ds.y,ds.z),ds[ne]=0,ds[ee]=0,ds[q]=Ye>0?1:-1,g.push(ds.x,ds.y,ds.z),v.push(Yi/ht),v.push(1-As/Rt),Zr+=1}}for(let As=0;As<Rt;As++)for(let Xr=0;Xr<ht;Xr++){const Yi=M+Xr+zr*As,ps=M+Xr+zr*(As+1),Xa=M+(Xr+1)+zr*(As+1),Pi=M+(Xr+1)+zr*As;c.push(Yi,ps,Pi),c.push(ps,Xa,Pi),Ti+=6}u.addGroup(B,Ti,qe),B+=Ti,M+=Zr}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new bd(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}function jf(s){const e={};for(const t in s){e[t]={};for(const n in s[t]){const i=s[t][n];i&&(i.isColor||i.isMatrix3||i.isMatrix4||i.isVector2||i.isVector3||i.isVector4||i.isTexture||i.isQuaternion)?i.isRenderTargetTexture?(Lr("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),e[t][n]=null):e[t][n]=i.clone():Array.isArray(i)?e[t][n]=i.slice():e[t][n]=i}}return e}function Jl(s){const e={};for(let t=0;t<s.length;t++){const n=jf(s[t]);for(const i in n)e[i]=n[i]}return e}function cm(s){const e=[];for(let t=0;t<s.length;t++)e.push(s[t].clone());return e}function wg(s){const e=s.getRenderTarget();return e===null?s.outputColorSpace:e.isXRRenderTarget===!0?e.texture.colorSpace:xr.workingColorSpace}const Vh={clone:jf,merge:Jl};var Pc=`void main() {
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
}`,Jh=`void main() {
gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );
}`;class nh extends Hl{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=Pc,this.fragmentShader=Jh,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=jf(e.uniforms),this.uniformsGroups=cm(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.defaultAttributeValues=Object.assign({},e.defaultAttributeValues),this.index0AttributeName=e.index0AttributeName,this.uniformsNeedUpdate=e.uniformsNeedUpdate,this}toJSON(e){const t=super.toJSON(e);t.glslVersion=this.glslVersion,t.uniforms={};for(const i in this.uniforms){const o=this.uniforms[i].value;o&&o.isTexture?t.uniforms[i]={type:"t",value:o.toJSON(e).uuid}:o&&o.isColor?t.uniforms[i]={type:"c",value:o.getHex()}:o&&o.isVector2?t.uniforms[i]={type:"v2",value:o.toArray()}:o&&o.isVector3?t.uniforms[i]={type:"v3",value:o.toArray()}:o&&o.isVector4?t.uniforms[i]={type:"v4",value:o.toArray()}:o&&o.isMatrix3?t.uniforms[i]={type:"m3",value:o.toArray()}:o&&o.isMatrix4?t.uniforms[i]={type:"m4",value:o.toArray()}:t.uniforms[i]={value:o}}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 i in this.extensions)this.extensions[i]===!0&&(n[i]=!0);return Object.keys(n).length>0&&(t.extensions=n),t}}class Qd extends yl{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new di,this.projectionMatrix=new di,this.projectionMatrixInverse=new di,this.coordinateSystem=gl,this._reversedDepth=!1}get reversedDepth(){return this._reversedDepth}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 Wd=new le,xu=new ce,Sg=new ce;class vo extends Qd{constructor(e=50,t=1,n=.1,i=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=n,this.far=i,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=Oh*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(Ou*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return Oh*2*Math.atan(Math.tan(Ou*.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){Wd.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(Wd.x,Wd.y).multiplyScalar(-e/Wd.z),Wd.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(Wd.x,Wd.y).multiplyScalar(-e/Wd.z)}getViewSize(e,t){return this.getViewBounds(e,xu,Sg),t.subVectors(Sg,xu)}setViewOffset(e,t,n,i,a,o){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=i,this.view.width=a,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let t=e*Math.tan(Ou*.5*this.fov)/this.zoom,n=2*t,i=this.aspect*n,a=-.5*i;const o=this.view;if(this.view!==null&&this.view.enabled){const c=o.fullWidth,d=o.fullHeight;a+=o.offsetX*i/c,t-=o.offsetY*n/d,i*=o.width/c,n*=o.height/d}const u=this.filmOffset;u!==0&&(a+=e*u/this.getFilmWidth()),this.projectionMatrix.makePerspective(a,a+i,t,t-n,e,this.far,this.coordinateSystem,this.reversedDepth),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 gf=-90,mf=1;class Np extends yl{constructor(e,t,n){super(),this.type="CubeCamera",this.renderTarget=n,this.coordinateSystem=null,this.activeMipmapLevel=0;const i=new vo(gf,mf,e,t);i.layers=this.layers,this.add(i);const a=new vo(gf,mf,e,t);a.layers=this.layers,this.add(a);const o=new vo(gf,mf,e,t);o.layers=this.layers,this.add(o);const u=new vo(gf,mf,e,t);u.layers=this.layers,this.add(u);const c=new vo(gf,mf,e,t);c.layers=this.layers,this.add(c);const d=new vo(gf,mf,e,t);d.layers=this.layers,this.add(d)}updateCoordinateSystem(){const e=this.coordinateSystem,t=this.children.concat(),[n,i,a,o,u,c]=t;for(const d of t)this.remove(d);if(e===gl)n.up.set(0,1,0),n.lookAt(1,0,0),i.up.set(0,1,0),i.lookAt(-1,0,0),a.up.set(0,0,-1),a.lookAt(0,1,0),o.up.set(0,0,1),o.lookAt(0,-1,0),u.up.set(0,1,0),u.lookAt(0,0,1),c.up.set(0,1,0),c.lookAt(0,0,-1);else if(e===To)n.up.set(0,-1,0),n.lookAt(-1,0,0),i.up.set(0,-1,0),i.lookAt(1,0,0),a.up.set(0,0,1),a.lookAt(0,1,0),o.up.set(0,0,-1),o.lookAt(0,-1,0),u.up.set(0,-1,0),u.lookAt(0,0,1),c.up.set(0,-1,0),c.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(const d of t)this.add(d),d.updateMatrixWorld()}update(e,t){this.parent===null&&this.updateMatrixWorld();const{renderTarget:n,activeMipmapLevel:i}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());const[a,o,u,c,d,g]=this.children,v=e.getRenderTarget(),M=e.getActiveCubeFace(),B=e.getActiveMipmapLevel(),I=e.xr.enabled;e.xr.enabled=!1;const ne=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,e.setRenderTarget(n,0,i),e.render(t,a),e.setRenderTarget(n,1,i),e.render(t,o),e.setRenderTarget(n,2,i),e.render(t,u),e.setRenderTarget(n,3,i),e.render(t,c),e.setRenderTarget(n,4,i),e.render(t,d),n.texture.generateMipmaps=ne,e.setRenderTarget(n,5,i),e.render(t,g),e.setRenderTarget(v,M,B),e.xr.enabled=I,n.texture.needsPMREMUpdate=!0}}class rh extends zi{constructor(e=[],t=it,n,i,a,o,u,c,d,g){super(e,t,n,i,a,o,u,c,d,g),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class Mc extends Os{constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;const n={width:e,height:e,depth:1},i=[n,n,n,n,n,n];this.texture=new rh(i),this._setTextureOptions(t),this.texture.isRenderTargetTexture=!0}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;
vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
}
void main() {
vWorldDirection = transformDirection( position, modelMatrix );
#include <begin_vertex>
#include <project_vertex>
}
`,fragmentShader:`
uniform sampler2D tEquirect;
varying vec3 vWorldDirection;
#include <common>
void main() {
vec3 direction = normalize( vWorldDirection );
vec2 sampleUV = equirectUv( direction );
gl_FragColor = texture2D( tEquirect, sampleUV );
}
`},i=new bd(5,5,5),a=new nh({name:"CubemapFromEquirect",uniforms:jf(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:de,blending:we});a.uniforms.tEquirect.value=t;const o=new Il(i,a),u=t.minFilter;return t.minFilter===yi&&(t.minFilter=vr),new Np(1,10,this).update(e,o),t.minFilter=u,o.geometry.dispose(),o.material.dispose(),this}clear(e,t=!0,n=!0,i=!0){const a=e.getRenderTarget();for(let o=0;o<6;o++)e.setRenderTarget(this,o),e.clear(t,n,i);e.setRenderTarget(a)}}class ih extends yl{constructor(){super(),this.isGroup=!0,this.type="Group"}}const Fp={type:"move"};class Ra{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new ih,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 ih,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new le,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new le),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new ih,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new le,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new le),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 i=null,a=null,o=null;const u=this._targetRay,c=this._grip,d=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(d&&e.hand){o=!0;for(const ne of e.hand.values()){const ee=t.getJointPose(ne,n),q=this._getHandJoint(d,ne);ee!==null&&(q.matrix.fromArray(ee.transform.matrix),q.matrix.decompose(q.position,q.rotation,q.scale),q.matrixWorldNeedsUpdate=!0,q.jointRadius=ee.radius),q.visible=ee!==null}const g=d.joints["index-finger-tip"],v=d.joints["thumb-tip"],M=g.position.distanceTo(v.position),B=.02,I=.005;d.inputState.pinching&&M>B+I?(d.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!d.inputState.pinching&&M<=B-I&&(d.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else c!==null&&e.gripSpace&&(a=t.getPose(e.gripSpace,n),a!==null&&(c.matrix.fromArray(a.transform.matrix),c.matrix.decompose(c.position,c.rotation,c.scale),c.matrixWorldNeedsUpdate=!0,a.linearVelocity?(c.hasLinearVelocity=!0,c.linearVelocity.copy(a.linearVelocity)):c.hasLinearVelocity=!1,a.angularVelocity?(c.hasAngularVelocity=!0,c.angularVelocity.copy(a.angularVelocity)):c.hasAngularVelocity=!1));u!==null&&(i=t.getPose(e.targetRaySpace,n),i===null&&a!==null&&(i=a),i!==null&&(u.matrix.fromArray(i.transform.matrix),u.matrix.decompose(u.position,u.rotation,u.scale),u.matrixWorldNeedsUpdate=!0,i.linearVelocity?(u.hasLinearVelocity=!0,u.linearVelocity.copy(i.linearVelocity)):u.hasLinearVelocity=!1,i.angularVelocity?(u.hasAngularVelocity=!0,u.angularVelocity.copy(i.angularVelocity)):u.hasAngularVelocity=!1,this.dispatchEvent(Fp)))}return u!==null&&(u.visible=i!==null),c!==null&&(c.visible=a!==null),d!==null&&(d.visible=o!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){const n=new ih;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}}class Hu{constructor(e,t=25e-5){this.isFogExp2=!0,this.name="",this.color=new Wr(e),this.density=t}clone(){return new Hu(this.color,this.density)}toJSON(){return{type:"FogExp2",name:this.name,color:this.color.getHex(),density:this.density}}}class vf{constructor(e,t=1,n=1e3){this.isFog=!0,this.name="",this.color=new Wr(e),this.near=t,this.far=n}clone(){return new vf(this.color,this.near,this.far)}toJSON(){return{type:"Fog",name:this.name,color:this.color.getHex(),near:this.near,far:this.far}}}class _d extends yl{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 Ua,this.environmentIntensity=1,this.environmentRotation=new Ua,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__!="undefined"&&__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 wh{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=gh,this.updateRanges=[],this.version=0,this.uuid=oc()}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 i=0,a=this.stride;i<a;i++)this.array[e+i]=t.array[n+i];return this}set(e,t=0){return this.array.set(e,t),this}clone(e){e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=oc()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);const t=new this.array.constructor(e.arrayBuffers[this.array.buffer._uuid]),n=new this.constructor(t,this.stride);return n.setUsage(this.usage),n}onUpload(e){return this.onUploadCallback=e,this}toJSON(e){return e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=oc()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=Array.from(new Uint32Array(this.array.buffer))),{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}}const Iu=new le;class yf{constructor(e,t,n,i=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=e,this.itemSize=t,this.offset=n,this.normalized=i}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(e){this.data.needsUpdate=e}applyMatrix4(e){for(let t=0,n=this.data.count;t<n;t++)Iu.fromBufferAttribute(this,t),Iu.applyMatrix4(e),this.setXYZ(t,Iu.x,Iu.y,Iu.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)Iu.fromBufferAttribute(this,t),Iu.applyNormalMatrix(e),this.setXYZ(t,Iu.x,Iu.y,Iu.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)Iu.fromBufferAttribute(this,t),Iu.transformDirection(e),this.setXYZ(t,Iu.x,Iu.y,Iu.z);return this}getComponent(e,t){let n=this.array[e*this.data.stride+this.offset+t];return this.normalized&&(n=vl(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=He(n,this.array)),this.data.array[e*this.data.stride+this.offset+t]=n,this}setX(e,t){return this.normalized&&(t=He(t,this.array)),this.data.array[e*this.data.stride+this.offset]=t,this}setY(e,t){return this.normalized&&(t=He(t,this.array)),this.data.array[e*this.data.stride+this.offset+1]=t,this}setZ(e,t){return this.normalized&&(t=He(t,this.array)),this.data.array[e*this.data.stride+this.offset+2]=t,this}setW(e,t){return this.normalized&&(t=He(t,this.array)),this.data.array[e*this.data.stride+this.offset+3]=t,this}getX(e){let t=this.data.array[e*this.data.stride+this.offset];return this.normalized&&(t=vl(t,this.array)),t}getY(e){let t=this.data.array[e*this.data.stride+this.offset+1];return this.normalized&&(t=vl(t,this.array)),t}getZ(e){let t=this.data.array[e*this.data.stride+this.offset+2];return this.normalized&&(t=vl(t,this.array)),t}getW(e){let t=this.data.array[e*this.data.stride+this.offset+3];return this.normalized&&(t=vl(t,this.array)),t}setXY(e,t,n){return e=e*this.data.stride+this.offset,this.normalized&&(t=He(t,this.array),n=He(n,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this}setXYZ(e,t,n,i){return e=e*this.data.stride+this.offset,this.normalized&&(t=He(t,this.array),n=He(n,this.array),i=He(i,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=i,this}setXYZW(e,t,n,i,a){return e=e*this.data.stride+this.offset,this.normalized&&(t=He(t,this.array),n=He(n,this.array),i=He(i,this.array),a=He(a,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=i,this.data.array[e+3]=a,this}clone(e){if(e===void 0){ac("InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.");const t=[];for(let n=0;n<this.count;n++){const i=n*this.data.stride+this.offset;for(let a=0;a<this.itemSize;a++)t.push(this.data.array[i+a])}return new wl(new this.array.constructor(t),this.itemSize,this.normalized)}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.clone(e)),new yf(e.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(e){if(e===void 0){ac("InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.");const t=[];for(let n=0;n<this.count;n++){const i=n*this.data.stride+this.offset;for(let a=0;a<this.itemSize;a++)t.push(this.data.array[i+a])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:t,normalized:this.normalized}}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.toJSON(e)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}}class BA extends Hl{constructor(e){super(),this.isSpriteMaterial=!0,this.type="SpriteMaterial",this.color=new Wr(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.rotation=e.rotation,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}}let Lc;const xf=new le,Sh=new le,bf=new le,Yf=new ce,RA=new ce,wd=new di,sh=new le,Sd=new le,IA=new le,NA=new ce,qf=new ce,Mg=new ce;class hm extends null{constructor(e=new BA){if(super(),this.isSprite=!0,this.type="Sprite",Lc===void 0){Lc=new ka;const t=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),n=new wh(t,5);Lc.setIndex([0,1,2,0,2,3]),Lc.setAttribute("position",new yf(n,3,0,!1)),Lc.setAttribute("uv",new yf(n,2,3,!1))}this.geometry=Lc,this.material=e,this.center=new ce(.5,.5),this.count=1}raycast(e,t){e.camera===null&&Gr('Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),Sh.setFromMatrixScale(this.matrixWorld),wd.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),bf.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&Sh.multiplyScalar(-bf.z);const n=this.material.rotation;let i,a;n!==0&&(a=Math.cos(n),i=Math.sin(n));const o=this.center;ed(sh.set(-.5,-.5,0),bf,o,Sh,i,a),ed(Sd.set(.5,-.5,0),bf,o,Sh,i,a),ed(IA.set(.5,.5,0),bf,o,Sh,i,a),NA.set(0,0),qf.set(1,0),Mg.set(1,1);let u=e.ray.intersectTriangle(sh,Sd,IA,!1,xf);if(u===null&&(ed(Sd.set(-.5,.5,0),bf,o,Sh,i,a),qf.set(0,1),u=e.ray.intersectTriangle(sh,IA,Sd,!1,xf),u===null))return;const c=e.ray.origin.distanceTo(xf);c<e.near||c>e.far||t.push({distance:c,point:xf.clone(),uv:ku.getInterpolation(xf,sh,Sd,IA,NA,qf,Mg,new ce),face:null,object:this})}copy(e,t){return super.copy(e,t),e.center!==void 0&&this.center.copy(e.center),this.material=e.material,this}}function ed(s,e,t,n,i,a){Yf.subVectors(s,t).addScalar(.5).multiply(n),i!==void 0?(RA.x=a*Yf.x-i*Yf.y,RA.y=i*Yf.x+a*Yf.y):RA.copy(Yf),s.copy(e),s.x+=RA.x,s.y+=RA.y,s.applyMatrix4(wd)}const td=new le,Jf=new le;class dm extends null{constructor(){super(),this.isLOD=!0,this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]}}),this.autoUpdate=!0}copy(e){super.copy(e,!1);const t=e.levels;for(let n=0,i=t.length;n<i;n++){const a=t[n];this.addLevel(a.object.clone(),a.distance,a.hysteresis)}return this.autoUpdate=e.autoUpdate,this}addLevel(e,t=0,n=0){t=Math.abs(t);const i=this.levels;let a;for(a=0;a<i.length&&!(t<i[a].distance);a++);return i.splice(a,0,{distance:t,hysteresis:n,object:e}),this.add(e),this}removeLevel(e){const t=this.levels;for(let n=0;n<t.length;n++)if(t[n].distance===e){const i=t.splice(n,1);return this.remove(i[0].object),!0}return!1}getCurrentLevel(){return this._currentLevel}getObjectForDistance(e){const t=this.levels;if(t.length>0){let n,i;for(n=1,i=t.length;n<i;n++){let a=t[n].distance;if(t[n].object.visible&&(a-=a*t[n].hysteresis),e<a)break}return t[n-1].object}return null}raycast(e,t){if(this.levels.length>0){td.setFromMatrixPosition(this.matrixWorld);const i=e.ray.origin.distanceTo(td);this.getObjectForDistance(i).raycast(e,t)}}update(e){const t=this.levels;if(t.length>1){td.setFromMatrixPosition(e.matrixWorld),Jf.setFromMatrixPosition(this.matrixWorld);const n=td.distanceTo(Jf)/e.zoom;t[0].object.visible=!0;let i,a;for(i=1,a=t.length;i<a;i++){let o=t[i].distance;if(t[i].object.visible&&(o-=o*t[i].hysteresis),n>=o)t[i-1].object.visible=!1,t[i].object.visible=!0;else break}for(this._currentLevel=i-1;i<a;i++)t[i].object.visible=!1}}toJSON(e){const t=super.toJSON(e);this.autoUpdate===!1&&(t.object.autoUpdate=!1),t.object.levels=[];const n=this.levels;for(let i=0,a=n.length;i<a;i++){const o=n[i];t.object.levels.push({object:o.object.uuid,distance:o.distance,hysteresis:o.hysteresis})}return t}}const ap=new le,Pp=new Ni,Lp=new Ni,Md=new le,Up=new di,Op=new le,_f=new gi,eA=new di,Zd=new aa;class Oi extends null{constructor(e,t){super(e,t),this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode=lr,this.bindMatrix=new di,this.bindMatrixInverse=new di,this.boundingBox=null,this.boundingSphere=null}computeBoundingBox(){const e=this.geometry;this.boundingBox===null&&(this.boundingBox=new Y),this.boundingBox.makeEmpty();const t=e.getAttribute("position");for(let n=0;n<t.count;n++)this.getVertexPosition(n,Op),this.boundingBox.expandByPoint(Op)}computeBoundingSphere(){const e=this.geometry;this.boundingSphere===null&&(this.boundingSphere=new gi),this.boundingSphere.makeEmpty();const t=e.getAttribute("position");for(let n=0;n<t.count;n++)this.getVertexPosition(n,Op),this.boundingSphere.expandByPoint(Op)}copy(e,t){return super.copy(e,t),this.bindMode=e.bindMode,this.bindMatrix.copy(e.bindMatrix),this.bindMatrixInverse.copy(e.bindMatrixInverse),this.skeleton=e.skeleton,e.boundingBox!==null&&(this.boundingBox=e.boundingBox.clone()),e.boundingSphere!==null&&(this.boundingSphere=e.boundingSphere.clone()),this}raycast(e,t){const n=this.material,i=this.matrixWorld;n!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),_f.copy(this.boundingSphere),_f.applyMatrix4(i),e.ray.intersectsSphere(_f)!==!1&&(eA.copy(i).invert(),Zd.copy(e.ray).applyMatrix4(eA),!(this.boundingBox!==null&&Zd.intersectsBox(this.boundingBox)===!1)&&this._computeIntersections(e,t,Zd)))}getVertexPosition(e,t){return super.getVertexPosition(e,t),this.applyBoneTransform(e,t),t}bind(e,t){this.skeleton=e,t===void 0&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),t=this.matrixWorld),this.bindMatrix.copy(t),this.bindMatrixInverse.copy(t).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(){const e=new Ni,t=this.geometry.attributes.skinWeight;for(let n=0,i=t.count;n<i;n++){e.fromBufferAttribute(t,n);const a=1/e.manhattanLength();a!==1/0?e.multiplyScalar(a):e.set(1,0,0,0),t.setXYZW(n,e.x,e.y,e.z,e.w)}}updateMatrixWorld(e){super.updateMatrixWorld(e),this.bindMode===lr?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode===je?this.bindMatrixInverse.copy(this.bindMatrix).invert():Lr("SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}applyBoneTransform(e,t){const n=this.skeleton,i=this.geometry;Pp.fromBufferAttribute(i.attributes.skinIndex,e),Lp.fromBufferAttribute(i.attributes.skinWeight,e),ap.copy(t).applyMatrix4(this.bindMatrix),t.set(0,0,0);for(let a=0;a<4;a++){const o=Lp.getComponent(a);if(o!==0){const u=Pp.getComponent(a);Up.multiplyMatrices(n.bones[u].matrixWorld,n.boneInverses[u]),t.addScaledVector(Md.copy(ap).applyMatrix4(Up),o)}}return t.applyMatrix4(this.bindMatrixInverse)}}class op extends null{constructor(){super(),this.isBone=!0,this.type="Bone"}}class ah extends zi{constructor(e=null,t=1,n=1,i,a,o,u,c,d=cn,g=cn,v,M){super(null,o,u,c,d,g,i,a,v,M),this.isDataTexture=!0,this.image={data:e,width:t,height:n},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}const tA=new di,wf=new di;class Kd{constructor(e=[],t=[]){this.uuid=oc(),this.bones=e.slice(0),this.boneInverses=t,this.boneMatrices=null,this.previousBoneMatrices=null,this.boneTexture=null,this.init()}init(){const e=this.bones,t=this.boneInverses;if(this.boneMatrices=new Float32Array(e.length*16),t.length===0)this.calculateInverses();else if(e.length!==t.length){Lr("Skeleton: Number of inverse bone matrices does not match amount of bones."),this.boneInverses=[];for(let n=0,i=this.bones.length;n<i;n++)this.boneInverses.push(new di)}}calculateInverses(){this.boneInverses.length=0;for(let e=0,t=this.bones.length;e<t;e++){const n=new di;this.bones[e]&&n.copy(this.bones[e].matrixWorld).invert(),this.boneInverses.push(n)}}pose(){for(let e=0,t=this.bones.length;e<t;e++){const n=this.bones[e];n&&n.matrixWorld.copy(this.boneInverses[e]).invert()}for(let e=0,t=this.bones.length;e<t;e++){const n=this.bones[e];n&&(n.parent&&n.parent.isBone?(n.matrix.copy(n.parent.matrixWorld).invert(),n.matrix.multiply(n.matrixWorld)):n.matrix.copy(n.matrixWorld),n.matrix.decompose(n.position,n.quaternion,n.scale))}}update(){const e=this.bones,t=this.boneInverses,n=this.boneMatrices,i=this.boneTexture;for(let a=0,o=e.length;a<o;a++){const u=e[a]?e[a].matrixWorld:wf;tA.multiplyMatrices(u,t[a]),tA.toArray(n,a*16)}i!==null&&(i.needsUpdate=!0)}clone(){return new Kd(this.bones,this.boneInverses)}computeBoneTexture(){let e=Math.sqrt(this.bones.length*4);e=Math.ceil(e/4)*4,e=Math.max(e,4);const t=new Float32Array(e*e*4);t.set(this.boneMatrices);const n=new ah(t,e,e,L,dt);return n.needsUpdate=!0,this.boneMatrices=t,this.boneTexture=n,this}getBoneByName(e){for(let t=0,n=this.bones.length;t<n;t++){const i=this.bones[t];if(i.name===e)return i}}dispose(){this.boneTexture!==null&&(this.boneTexture.dispose(),this.boneTexture=null)}fromJSON(e,t){this.uuid=e.uuid;for(let n=0,i=e.bones.length;n<i;n++){const a=e.bones[n];let o=t[a];o===void 0&&(Lr("Skeleton: No bone found with UUID:",a),o=new op),this.bones.push(o),this.boneInverses.push(new di().fromArray(e.boneInverses[n]))}return this.init(),this}toJSON(){const e={metadata:{version:4.7,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};e.uuid=this.uuid;const t=this.bones,n=this.boneInverses;for(let i=0,a=t.length;i<a;i++){const o=t[i];e.bones.push(o.uuid);const u=n[i];e.boneInverses.push(u.toArray())}return e}}class Mh extends wl{constructor(e,t,n,i=1){super(e,t,n),this.isInstancedBufferAttribute=!0,this.meshPerAttribute=i}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}toJSON(){const e=super.toJSON();return e.meshPerAttribute=this.meshPerAttribute,e.isInstancedBufferAttribute=!0,e}}const Ed=new di,Eg=new di,Dp=null,Do=new Y,$d=new di,Qc=new Il,Eh=new gi;class lp extends null{constructor(e,t,n){super(e,t),this.isInstancedMesh=!0,this.instanceMatrix=new Mh(new Float32Array(n*16),16),this.instanceColor=null,this.morphTexture=null,this.count=n,this.boundingBox=null,this.boundingSphere=null;for(let i=0;i<n;i++)this.setMatrixAt(i,$d)}computeBoundingBox(){const e=this.geometry,t=this.count;this.boundingBox===null&&(this.boundingBox=new Y),e.boundingBox===null&&e.computeBoundingBox(),this.boundingBox.makeEmpty();for(let n=0;n<t;n++)this.getMatrixAt(n,Ed),Do.copy(e.boundingBox).applyMatrix4(Ed),this.boundingBox.union(Do)}computeBoundingSphere(){const e=this.geometry,t=this.count;this.boundingSphere===null&&(this.boundingSphere=new gi),e.boundingSphere===null&&e.computeBoundingSphere(),this.boundingSphere.makeEmpty();for(let n=0;n<t;n++)this.getMatrixAt(n,Ed),Eh.copy(e.boundingSphere).applyMatrix4(Ed),this.boundingSphere.union(Eh)}copy(e,t){return super.copy(e,t),this.instanceMatrix.copy(e.instanceMatrix),e.morphTexture!==null&&(this.morphTexture=e.morphTexture.clone()),e.instanceColor!==null&&(this.instanceColor=e.instanceColor.clone()),this.count=e.count,e.boundingBox!==null&&(this.boundingBox=e.boundingBox.clone()),e.boundingSphere!==null&&(this.boundingSphere=e.boundingSphere.clone()),this}getColorAt(e,t){t.fromArray(this.instanceColor.array,e*3)}getMatrixAt(e,t){t.fromArray(this.instanceMatrix.array,e*16)}getMorphAt(e,t){const n=t.morphTargetInfluences,i=this.morphTexture.source.data.data,a=n.length+1,o=e*a+1;for(let u=0;u<n.length;u++)n[u]=i[o+u]}raycast(e,t){const n=this.matrixWorld,i=this.count;if(Qc.geometry=this.geometry,Qc.material=this.material,Qc.material!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),Eh.copy(this.boundingSphere),Eh.applyMatrix4(n),e.ray.intersectsSphere(Eh)!==!1))for(let a=0;a<i;a++){this.getMatrixAt(a,Ed),Eg.multiplyMatrices(n,Ed),Qc.matrixWorld=Eg,Qc.raycast(e,Dp);for(let o=0,u=Dp.length;o<u;o++){const c=Dp[o];c.instanceId=a,c.object=this,t.push(c)}Dp.length=0}}setColorAt(e,t){this.instanceColor===null&&(this.instanceColor=new Mh(new Float32Array(this.instanceMatrix.count*3).fill(1),3)),t.toArray(this.instanceColor.array,e*3)}setMatrixAt(e,t){t.toArray(this.instanceMatrix.array,e*16)}setMorphAt(e,t){const n=t.morphTargetInfluences,i=n.length+1;this.morphTexture===null&&(this.morphTexture=new ah(new Float32Array(i*this.count),i,this.count,z,dt));const a=this.morphTexture.source.data.data;let o=0;for(let d=0;d<n.length;d++)o+=n[d];const u=this.geometry.morphTargetsRelative?1:1-o,c=i*e;a[c]=u,a.set(n,c+1)}updateMorphTargets(){}dispose(){this.dispatchEvent({type:"dispose"}),this.morphTexture!==null&&(this.morphTexture.dispose(),this.morphTexture=null)}}const wo=new le,Ch=new le,Cg=new pn;class Ec{constructor(e=new le(1,0,0),t=0){this.isPlane=!0,this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,n,i){return this.normal.set(e,t,n),this.constant=i,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,n){const i=wo.subVectors(n,t).cross(Ch.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(i,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){const e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,t){return t.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectLine(e,t){const n=e.delta(wo),i=this.normal.dot(n);if(i===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;const a=-(e.start.dot(this.normal)+this.constant)/i;return a<0||a>1?null:t.copy(e.start).addScaledVector(n,a)}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||Cg.getNormalMatrix(e),i=this.coplanarPoint(wo).applyMatrix4(e),a=this.normal.applyMatrix3(n).normalize();return this.constant=-i.dot(a),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 zh=new gi,fm=new ce(.5,.5),Xd=new le;class qu{constructor(e=new Ec,t=new Ec,n=new Ec,i=new Ec,a=new Ec,o=new Ec){this.planes=[e,t,n,i,a,o]}set(e,t,n,i,a,o){const u=this.planes;return u[0].copy(e),u[1].copy(t),u[2].copy(n),u[3].copy(i),u[4].copy(a),u[5].copy(o),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=gl,n=!1){const i=this.planes,a=e.elements,o=a[0],u=a[1],c=a[2],d=a[3],g=a[4],v=a[5],M=a[6],B=a[7],I=a[8],ne=a[9],ee=a[10],q=a[11],ye=a[12],Ce=a[13],ke=a[14],nt=a[15];if(i[0].setComponents(d-o,B-g,q-I,nt-ye).normalize(),i[1].setComponents(d+o,B+g,q+I,nt+ye).normalize(),i[2].setComponents(d+u,B+v,q+ne,nt+Ce).normalize(),i[3].setComponents(d-u,B-v,q-ne,nt-Ce).normalize(),n)i[4].setComponents(c,M,ee,ke).normalize(),i[5].setComponents(d-c,B-M,q-ee,nt-ke).normalize();else if(i[4].setComponents(d-c,B-M,q-ee,nt-ke).normalize(),t===gl)i[5].setComponents(d+c,B+M,q+ee,nt+ke).normalize();else if(t===To)i[5].setComponents(c,M,ee,ke).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(),zh.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),zh.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(zh)}intersectsSprite(e){zh.center.set(0,0,0);const t=fm.distanceTo(e.center);return zh.radius=.7071067811865476+t,zh.applyMatrix4(e.matrixWorld),this.intersectsSphere(zh)}intersectsSphere(e){const t=this.planes,n=e.center,i=-e.radius;for(let a=0;a<6;a++)if(t[a].distanceToPoint(n)<i)return!1;return!0}intersectsBox(e){const t=this.planes;for(let n=0;n<6;n++){const i=t[n];if(Xd.x=i.normal.x>0?e.max.x:e.min.x,Xd.y=i.normal.y>0?e.max.y:e.min.y,Xd.z=i.normal.z>0?e.max.z:e.min.z,i.distanceToPoint(Xd)<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)}}const Th=new di,oh=new qu;class kp{constructor(){this.coordinateSystem=gl}intersectsObject(e,t){if(!t.isArrayCamera||t.cameras.length===0)return!1;for(let n=0;n<t.cameras.length;n++){const i=t.cameras[n];if(Th.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),oh.setFromProjectionMatrix(Th,i.coordinateSystem,i.reversedDepth),oh.intersectsObject(e))return!0}return!1}intersectsSprite(e,t){if(!t||!t.cameras||t.cameras.length===0)return!1;for(let n=0;n<t.cameras.length;n++){const i=t.cameras[n];if(Th.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),oh.setFromProjectionMatrix(Th,i.coordinateSystem,i.reversedDepth),oh.intersectsSprite(e))return!0}return!1}intersectsSphere(e,t){if(!t||!t.cameras||t.cameras.length===0)return!1;for(let n=0;n<t.cameras.length;n++){const i=t.cameras[n];if(Th.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),oh.setFromProjectionMatrix(Th,i.coordinateSystem,i.reversedDepth),oh.intersectsSphere(e))return!0}return!1}intersectsBox(e,t){if(!t||!t.cameras||t.cameras.length===0)return!1;for(let n=0;n<t.cameras.length;n++){const i=t.cameras[n];if(Th.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),oh.setFromProjectionMatrix(Th,i.coordinateSystem,i.reversedDepth),oh.intersectsBox(e))return!0}return!1}containsPoint(e,t){if(!t||!t.cameras||t.cameras.length===0)return!1;for(let n=0;n<t.cameras.length;n++){const i=t.cameras[n];if(Th.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),oh.setFromProjectionMatrix(Th,i.coordinateSystem,i.reversedDepth),oh.containsPoint(e))return!0}return!1}clone(){return new kp}}function Sf(s,e){return s-e}function Gh(s,e){return s.z-e.z}function Mf(s,e){return e.z-s.z}class bu{constructor(){this.index=0,this.pool=[],this.list=[]}push(e,t,n,i){const a=this.pool,o=this.list;this.index>=a.length&&a.push({start:-1,count:-1,z:-1,index:-1});const u=a[this.index];o.push(u),this.index++,u.start=e,u.count=t,u.z=n,u.index=i}reset(){this.list.length=0,this.index=0}}const eu=new di,Ef=new Wr(1,1,1),Dl=new qu,Bh=new kp,Cf=new Y,tu=new gi,FA=new le,Wc=new le,PA=new le,jd=new bu,_u=new Il,Yd=null;function up(s,e,t=0){const n=e.itemSize;if(s.isInterleavedBufferAttribute||s.array.constructor!==e.array.constructor){const i=s.count;for(let a=0;a<i;a++)for(let o=0;o<n;o++)e.setComponent(a+t,o,s.getComponent(a,o))}else e.array.set(s.array,t*n);e.needsUpdate=!0}function lh(s,e){if(s.constructor!==e.constructor){const t=Math.min(s.length,e.length);for(let n=0;n<t;n++)e[n]=s[n]}else{const t=Math.min(s.length,e.length);e.set(new s.constructor(s.buffer,0,t))}}class Xm extends null{constructor(e,t,n=t*2,i){super(new ka,i),this.isBatchedMesh=!0,this.perObjectFrustumCulled=!0,this.sortObjects=!0,this.boundingBox=null,this.boundingSphere=null,this.customSort=null,this._instanceInfo=[],this._geometryInfo=[],this._availableInstanceIds=[],this._availableGeometryIds=[],this._nextIndexStart=0,this._nextVertexStart=0,this._geometryCount=0,this._visibilityChanged=!0,this._geometryInitialized=!1,this._maxInstanceCount=e,this._maxVertexCount=t,this._maxIndexCount=n,this._multiDrawCounts=new Int32Array(e),this._multiDrawStarts=new Int32Array(e),this._multiDrawCount=0,this._multiDrawInstances=null,this._matricesTexture=null,this._indirectTexture=null,this._colorsTexture=null,this._initMatricesTexture(),this._initIndirectTexture()}get maxInstanceCount(){return this._maxInstanceCount}get instanceCount(){return this._instanceInfo.length-this._availableInstanceIds.length}get unusedVertexCount(){return this._maxVertexCount-this._nextVertexStart}get unusedIndexCount(){return this._maxIndexCount-this._nextIndexStart}_initMatricesTexture(){let e=Math.sqrt(this._maxInstanceCount*4);e=Math.ceil(e/4)*4,e=Math.max(e,4);const t=new Float32Array(e*e*4),n=new ah(t,e,e,L,dt);this._matricesTexture=n}_initIndirectTexture(){let e=Math.sqrt(this._maxInstanceCount);e=Math.ceil(e);const t=new Uint32Array(e*e),n=new ah(t,e,e,ie,st);this._indirectTexture=n}_initColorsTexture(){let e=Math.sqrt(this._maxInstanceCount);e=Math.ceil(e);const t=new Float32Array(e*e*4).fill(1),n=new ah(t,e,e,L,dt);n.colorSpace=xr.workingColorSpace,this._colorsTexture=n}_initializeGeometry(e){const t=this.geometry,n=this._maxVertexCount,i=this._maxIndexCount;if(this._geometryInitialized===!1){for(const a in e.attributes){const o=e.getAttribute(a),{array:u,itemSize:c,normalized:d}=o,g=new u.constructor(n*c),v=new wl(g,c,d);t.setAttribute(a,v)}if(e.getIndex()!==null){const a=n>65535?new Uint32Array(i):new Uint16Array(i);t.setIndex(new wl(a,1))}this._geometryInitialized=!0}}_validateGeometry(e){const t=this.geometry;if(!!e.getIndex()!=!!t.getIndex())throw new Error('THREE.BatchedMesh: All geometries must consistently have "index".');for(const n in t.attributes){if(!e.hasAttribute(n))throw new Error(`THREE.BatchedMesh: Added geometry missing "${n}". All geometries must have consistent attributes.`);const i=e.getAttribute(n),a=t.getAttribute(n);if(i.itemSize!==a.itemSize||i.normalized!==a.normalized)throw new Error("THREE.BatchedMesh: All attributes must have a consistent itemSize and normalized value.")}}validateInstanceId(e){const t=this._instanceInfo;if(e<0||e>=t.length||t[e].active===!1)throw new Error(`THREE.BatchedMesh: Invalid instanceId ${e}. Instance is either out of range or has been deleted.`)}validateGeometryId(e){const t=this._geometryInfo;if(e<0||e>=t.length||t[e].active===!1)throw new Error(`THREE.BatchedMesh: Invalid geometryId ${e}. Geometry is either out of range or has been deleted.`)}setCustomSort(e){return this.customSort=e,this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Y);const e=this.boundingBox,t=this._instanceInfo;e.makeEmpty();for(let n=0,i=t.length;n<i;n++){if(t[n].active===!1)continue;const a=t[n].geometryIndex;this.getMatrixAt(n,eu),this.getBoundingBoxAt(a,Cf).applyMatrix4(eu),e.union(Cf)}}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new gi);const e=this.boundingSphere,t=this._instanceInfo;e.makeEmpty();for(let n=0,i=t.length;n<i;n++){if(t[n].active===!1)continue;const a=t[n].geometryIndex;this.getMatrixAt(n,eu),this.getBoundingSphereAt(a,tu).applyMatrix4(eu),e.union(tu)}}addInstance(e){if(this._instanceInfo.length>=this.maxInstanceCount&&this._availableInstanceIds.length===0)throw new Error("THREE.BatchedMesh: Maximum item count reached.");const n={visible:!0,active:!0,geometryIndex:e};let i=null;this._availableInstanceIds.length>0?(this._availableInstanceIds.sort(Sf),i=this._availableInstanceIds.shift(),this._instanceInfo[i]=n):(i=this._instanceInfo.length,this._instanceInfo.push(n));const a=this._matricesTexture;eu.identity().toArray(a.image.data,i*16),a.needsUpdate=!0;const o=this._colorsTexture;return o&&(Ef.toArray(o.image.data,i*4),o.needsUpdate=!0),this._visibilityChanged=!0,i}addGeometry(e,t=-1,n=-1){this._initializeGeometry(e),this._validateGeometry(e);const i={vertexStart:-1,vertexCount:-1,reservedVertexCount:-1,indexStart:-1,indexCount:-1,reservedIndexCount:-1,start:-1,count:-1,boundingBox:null,boundingSphere:null,active:!0},a=this._geometryInfo;i.vertexStart=this._nextVertexStart,i.reservedVertexCount=t===-1?e.getAttribute("position").count:t;const o=e.getIndex();if(o!==null&&(i.indexStart=this._nextIndexStart,i.reservedIndexCount=n===-1?o.count:n),i.indexStart!==-1&&i.indexStart+i.reservedIndexCount>this._maxIndexCount||i.vertexStart+i.reservedVertexCount>this._maxVertexCount)throw new Error("THREE.BatchedMesh: Reserved space request exceeds the maximum buffer size.");let c;return this._availableGeometryIds.length>0?(this._availableGeometryIds.sort(Sf),c=this._availableGeometryIds.shift(),a[c]=i):(c=this._geometryCount,this._geometryCount++,a.push(i)),this.setGeometryAt(c,e),this._nextIndexStart=i.indexStart+i.reservedIndexCount,this._nextVertexStart=i.vertexStart+i.reservedVertexCount,c}setGeometryAt(e,t){if(e>=this._geometryCount)throw new Error("THREE.BatchedMesh: Maximum geometry count reached.");this._validateGeometry(t);const n=this.geometry,i=n.getIndex()!==null,a=n.getIndex(),o=t.getIndex(),u=this._geometryInfo[e];if(i&&o.count>u.reservedIndexCount||t.attributes.position.count>u.reservedVertexCount)throw new Error("THREE.BatchedMesh: Reserved space not large enough for provided geometry.");const c=u.vertexStart,d=u.reservedVertexCount;u.vertexCount=t.getAttribute("position").count;for(const g in n.attributes){const v=t.getAttribute(g),M=n.getAttribute(g);up(v,M,c);const B=v.itemSize;for(let I=v.count,ne=d;I<ne;I++){const ee=c+I;for(let q=0;q<B;q++)M.setComponent(ee,q,0)}M.needsUpdate=!0,M.addUpdateRange(c*B,d*B)}if(i){const g=u.indexStart,v=u.reservedIndexCount;u.indexCount=t.getIndex().count;for(let M=0;M<o.count;M++)a.setX(g+M,c+o.getX(M));for(let M=o.count,B=v;M<B;M++)a.setX(g+M,c);a.needsUpdate=!0,a.addUpdateRange(g,u.reservedIndexCount)}return u.start=i?u.indexStart:u.vertexStart,u.count=i?u.indexCount:u.vertexCount,u.boundingBox=null,t.boundingBox!==null&&(u.boundingBox=t.boundingBox.clone()),u.boundingSphere=null,t.boundingSphere!==null&&(u.boundingSphere=t.boundingSphere.clone()),this._visibilityChanged=!0,e}deleteGeometry(e){const t=this._geometryInfo;if(e>=t.length||t[e].active===!1)return this;const n=this._instanceInfo;for(let i=0,a=n.length;i<a;i++)n[i].active&&n[i].geometryIndex===e&&this.deleteInstance(i);return t[e].active=!1,this._availableGeometryIds.push(e),this._visibilityChanged=!0,this}deleteInstance(e){return this.validateInstanceId(e),this._instanceInfo[e].active=!1,this._availableInstanceIds.push(e),this._visibilityChanged=!0,this}optimize(){let e=0,t=0;const n=this._geometryInfo,i=n.map((o,u)=>u).sort((o,u)=>n[o].vertexStart-n[u].vertexStart),a=this.geometry;for(let o=0,u=n.length;o<u;o++){const c=i[o],d=n[c];if(d.active!==!1){if(a.index!==null){if(d.indexStart!==t){const{indexStart:g,vertexStart:v,reservedIndexCount:M}=d,B=a.index,I=B.array,ne=e-v;for(let ee=g;ee<g+M;ee++)I[ee]=I[ee]+ne;B.array.copyWithin(t,g,g+M),B.addUpdateRange(t,M),B.needsUpdate=!0,d.indexStart=t}t+=d.reservedIndexCount}if(d.vertexStart!==e){const{vertexStart:g,reservedVertexCount:v}=d,M=a.attributes;for(const B in M){const I=M[B],{array:ne,itemSize:ee}=I;ne.copyWithin(e*ee,g*ee,(g+v)*ee),I.addUpdateRange(e*ee,v*ee),I.needsUpdate=!0}d.vertexStart=e}e+=d.reservedVertexCount,d.start=a.index?d.indexStart:d.vertexStart,this._nextIndexStart=a.index?d.indexStart+d.reservedIndexCount:0,this._nextVertexStart=d.vertexStart+d.reservedVertexCount}}return this._visibilityChanged=!0,this}getBoundingBoxAt(e,t){if(e>=this._geometryCount)return null;const n=this.geometry,i=this._geometryInfo[e];if(i.boundingBox===null){const a=new Y,o=n.index,u=n.attributes.position;for(let c=i.start,d=i.start+i.count;c<d;c++){let g=c;o&&(g=o.getX(g)),a.expandByPoint(FA.fromBufferAttribute(u,g))}i.boundingBox=a}return t.copy(i.boundingBox),t}getBoundingSphereAt(e,t){if(e>=this._geometryCount)return null;const n=this.geometry,i=this._geometryInfo[e];if(i.boundingSphere===null){const a=new gi;this.getBoundingBoxAt(e,Cf),Cf.getCenter(a.center);const o=n.index,u=n.attributes.position;let c=0;for(let d=i.start,g=i.start+i.count;d<g;d++){let v=d;o&&(v=o.getX(v)),FA.fromBufferAttribute(u,v),c=Math.max(c,a.center.distanceToSquared(FA))}a.radius=Math.sqrt(c),i.boundingSphere=a}return t.copy(i.boundingSphere),t}setMatrixAt(e,t){this.validateInstanceId(e);const n=this._matricesTexture,i=this._matricesTexture.image.data;return t.toArray(i,e*16),n.needsUpdate=!0,this}getMatrixAt(e,t){return this.validateInstanceId(e),t.fromArray(this._matricesTexture.image.data,e*16)}setColorAt(e,t){return this.validateInstanceId(e),this._colorsTexture===null&&this._initColorsTexture(),t.toArray(this._colorsTexture.image.data,e*4),this._colorsTexture.needsUpdate=!0,this}getColorAt(e,t){return this.validateInstanceId(e),t.fromArray(this._colorsTexture.image.data,e*4)}setVisibleAt(e,t){return this.validateInstanceId(e),this._instanceInfo[e].visible===t?this:(this._instanceInfo[e].visible=t,this._visibilityChanged=!0,this)}getVisibleAt(e){return this.validateInstanceId(e),this._instanceInfo[e].visible}setGeometryIdAt(e,t){return this.validateInstanceId(e),this.validateGeometryId(t),this._instanceInfo[e].geometryIndex=t,this}getGeometryIdAt(e){return this.validateInstanceId(e),this._instanceInfo[e].geometryIndex}getGeometryRangeAt(e,t={}){this.validateGeometryId(e);const n=this._geometryInfo[e];return t.vertexStart=n.vertexStart,t.vertexCount=n.vertexCount,t.reservedVertexCount=n.reservedVertexCount,t.indexStart=n.indexStart,t.indexCount=n.indexCount,t.reservedIndexCount=n.reservedIndexCount,t.start=n.start,t.count=n.count,t}setInstanceCount(e){const t=this._availableInstanceIds,n=this._instanceInfo;for(t.sort(Sf);t[t.length-1]===n.length-1;)n.pop(),t.pop();if(e<n.length)throw new Error(`BatchedMesh: Instance ids outside the range ${e} are being used. Cannot shrink instance count.`);const i=new Int32Array(e),a=new Int32Array(e);lh(this._multiDrawCounts,i),lh(this._multiDrawStarts,a),this._multiDrawCounts=i,this._multiDrawStarts=a,this._maxInstanceCount=e;const o=this._indirectTexture,u=this._matricesTexture,c=this._colorsTexture;o.dispose(),this._initIndirectTexture(),lh(o.image.data,this._indirectTexture.image.data),u.dispose(),this._initMatricesTexture(),lh(u.image.data,this._matricesTexture.image.data),c&&(c.dispose(),this._initColorsTexture(),lh(c.image.data,this._colorsTexture.image.data))}setGeometrySize(e,t){const n=[...this._geometryInfo].filter(u=>u.active);if(Math.max(...n.map(u=>u.vertexStart+u.reservedVertexCount))>e)throw new Error(`BatchedMesh: Geometry vertex values are being used outside the range ${t}. Cannot shrink further.`);if(this.geometry.index&&Math.max(...n.map(c=>c.indexStart+c.reservedIndexCount))>t)throw new Error(`BatchedMesh: Geometry index values are being used outside the range ${t}. Cannot shrink further.`);const a=this.geometry;a.dispose(),this._maxVertexCount=e,this._maxIndexCount=t,this._geometryInitialized&&(this._geometryInitialized=!1,this.geometry=new ka,this._initializeGeometry(a));const o=this.geometry;a.index&&lh(a.index.array,o.index.array);for(const u in a.attributes)lh(a.attributes[u].array,o.attributes[u].array)}raycast(e,t){const n=this._instanceInfo,i=this._geometryInfo,a=this.matrixWorld,o=this.geometry;_u.material=this.material,_u.geometry.index=o.index,_u.geometry.attributes=o.attributes,_u.geometry.boundingBox===null&&(_u.geometry.boundingBox=new Y),_u.geometry.boundingSphere===null&&(_u.geometry.boundingSphere=new gi);for(let u=0,c=n.length;u<c;u++){if(!n[u].visible||!n[u].active)continue;const d=n[u].geometryIndex,g=i[d];_u.geometry.setDrawRange(g.start,g.count),this.getMatrixAt(u,_u.matrixWorld).premultiply(a),this.getBoundingBoxAt(d,_u.geometry.boundingBox),this.getBoundingSphereAt(d,_u.geometry.boundingSphere),_u.raycast(e,Yd);for(let v=0,M=Yd.length;v<M;v++){const B=Yd[v];B.object=this,B.batchId=u,t.push(B)}Yd.length=0}_u.material=null,_u.geometry.index=null,_u.geometry.attributes={},_u.geometry.setDrawRange(0,1/0)}copy(e){return super.copy(e),this.geometry=e.geometry.clone(),this.perObjectFrustumCulled=e.perObjectFrustumCulled,this.sortObjects=e.sortObjects,this.boundingBox=e.boundingBox!==null?e.boundingBox.clone():null,this.boundingSphere=e.boundingSphere!==null?e.boundingSphere.clone():null,this._geometryInfo=e._geometryInfo.map(t=>fd(rl({},t),{boundingBox:t.boundingBox!==null?t.boundingBox.clone():null,boundingSphere:t.boundingSphere!==null?t.boundingSphere.clone():null})),this._instanceInfo=e._instanceInfo.map(t=>rl({},t)),this._availableInstanceIds=e._availableInstanceIds.slice(),this._availableGeometryIds=e._availableGeometryIds.slice(),this._nextIndexStart=e._nextIndexStart,this._nextVertexStart=e._nextVertexStart,this._geometryCount=e._geometryCount,this._maxInstanceCount=e._maxInstanceCount,this._maxVertexCount=e._maxVertexCount,this._maxIndexCount=e._maxIndexCount,this._geometryInitialized=e._geometryInitialized,this._multiDrawCounts=e._multiDrawCounts.slice(),this._multiDrawStarts=e._multiDrawStarts.slice(),this._indirectTexture=e._indirectTexture.clone(),this._indirectTexture.image.data=this._indirectTexture.image.data.slice(),this._matricesTexture=e._matricesTexture.clone(),this._matricesTexture.image.data=this._matricesTexture.image.data.slice(),this._colorsTexture!==null&&(this._colorsTexture=e._colorsTexture.clone(),this._colorsTexture.image.data=this._colorsTexture.image.data.slice()),this}dispose(){this.geometry.dispose(),this._matricesTexture.dispose(),this._matricesTexture=null,this._indirectTexture.dispose(),this._indirectTexture=null,this._colorsTexture!==null&&(this._colorsTexture.dispose(),this._colorsTexture=null)}onBeforeRender(e,t,n,i,a){if(!this._visibilityChanged&&!this.perObjectFrustumCulled&&!this.sortObjects)return;const o=i.getIndex(),u=o===null?1:o.array.BYTES_PER_ELEMENT,c=this._instanceInfo,d=this._multiDrawStarts,g=this._multiDrawCounts,v=this._geometryInfo,M=this.perObjectFrustumCulled,B=this._indirectTexture,I=B.image.data,ne=n.isArrayCamera?Bh:Dl;M&&!n.isArrayCamera&&(eu.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse).multiply(this.matrixWorld),Dl.setFromProjectionMatrix(eu,n.coordinateSystem,n.reversedDepth));let ee=0;if(this.sortObjects){eu.copy(this.matrixWorld).invert(),FA.setFromMatrixPosition(n.matrixWorld).applyMatrix4(eu),Wc.set(0,0,-1).transformDirection(n.matrixWorld).transformDirection(eu);for(let Ce=0,ke=c.length;Ce<ke;Ce++)if(c[Ce].visible&&c[Ce].active){const nt=c[Ce].geometryIndex;this.getMatrixAt(Ce,eu),this.getBoundingSphereAt(nt,tu).applyMatrix4(eu);let Ye=!1;if(M&&(Ye=!ne.intersectsSphere(tu,n)),!Ye){const ht=v[nt],Rt=PA.subVectors(tu.center,FA).dot(Wc);jd.push(ht.start,ht.count,Rt,Ce)}}const q=jd.list,ye=this.customSort;ye===null?q.sort(a.transparent?Mf:Gh):ye.call(this,q,n);for(let Ce=0,ke=q.length;Ce<ke;Ce++){const nt=q[Ce];d[ee]=nt.start*u,g[ee]=nt.count,I[ee]=nt.index,ee++}jd.reset()}else for(let q=0,ye=c.length;q<ye;q++)if(c[q].visible&&c[q].active){const Ce=c[q].geometryIndex;let ke=!1;if(M&&(this.getMatrixAt(q,eu),this.getBoundingSphereAt(Ce,tu).applyMatrix4(eu),ke=!ne.intersectsSphere(tu,n)),!ke){const nt=v[Ce];d[ee]=nt.start*u,g[ee]=nt.count,I[ee]=q,ee++}}B.needsUpdate=!0,this._multiDrawCount=ee,this._visibilityChanged=!1}onBeforeShadow(e,t,n,i,a,o){this.onBeforeRender(e,null,i,a,o)}}class fl extends Hl{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new Wr(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 Tf=new le,cp=new le,Tg=new di,nd=new aa,nA=new gi,LA=new le,Vp=new le;class qd extends yl{constructor(e=new ka,t=new fl){super(),this.isLine=!0,this.type="Line",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,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 i=1,a=t.count;i<a;i++)Tf.fromBufferAttribute(t,i-1),cp.fromBufferAttribute(t,i),n[i]=n[i-1],n[i]+=Tf.distanceTo(cp);e.setAttribute("lineDistance",new Ui(n,1))}else Lr("Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(e,t){const n=this.geometry,i=this.matrixWorld,a=e.params.Line.threshold,o=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),nA.copy(n.boundingSphere),nA.applyMatrix4(i),nA.radius+=a,e.ray.intersectsSphere(nA)===!1)return;Tg.copy(i).invert(),nd.copy(e.ray).applyMatrix4(Tg);const u=a/((this.scale.x+this.scale.y+this.scale.z)/3),c=u*u,d=this.isLineSegments?2:1,g=n.index,M=n.attributes.position;if(g!==null){const B=Math.max(0,o.start),I=Math.min(g.count,o.start+o.count);for(let ne=B,ee=I-1;ne<ee;ne+=d){const q=g.getX(ne),ye=g.getX(ne+1),Ce=rA(this,e,nd,c,q,ye,ne);Ce&&t.push(Ce)}if(this.isLineLoop){const ne=g.getX(I-1),ee=g.getX(B),q=rA(this,e,nd,c,ne,ee,I-1);q&&t.push(q)}}else{const B=Math.max(0,o.start),I=Math.min(M.count,o.start+o.count);for(let ne=B,ee=I-1;ne<ee;ne+=d){const q=rA(this,e,nd,c,ne,ne+1,ne);q&&t.push(q)}if(this.isLineLoop){const ne=rA(this,e,nd,c,I-1,B,I-1);ne&&t.push(ne)}}}updateMorphTargets(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){const i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let a=0,o=i.length;a<o;a++){const u=i[a].name||String(a);this.morphTargetInfluences.push(0),this.morphTargetDictionary[u]=a}}}}}function rA(s,e,t,n,i,a,o){const u=s.geometry.attributes.position;if(Tf.fromBufferAttribute(u,i),cp.fromBufferAttribute(u,a),t.distanceSqToSegment(Tf,cp,LA,Vp)>n)return;LA.applyMatrix4(s.matrixWorld);const d=e.ray.origin.distanceTo(LA);if(!(d<e.near||d>e.far))return{distance:d,point:Vp.clone().applyMatrix4(s.matrixWorld),index:o,face:null,faceIndex:null,barycoord:null,object:s}}const UA=new le,hp=new le;class dp extends null{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 i=0,a=t.count;i<a;i+=2)UA.fromBufferAttribute(t,i),hp.fromBufferAttribute(t,i+1),n[i]=i===0?0:n[i-1],n[i+1]=n[i]+UA.distanceTo(hp);e.setAttribute("lineDistance",new Ui(n,1))}else Lr("LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class Kv extends null{constructor(e,t){super(e,t),this.isLineLoop=!0,this.type="LineLoop"}}class jm extends Hl{constructor(e){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new Wr(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}}const fp=new di,rd=new aa,Am=new gi,pm=new le;class D0 extends null{constructor(e=new ka,t=new jm){super(),this.isPoints=!0,this.type="Points",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,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}raycast(e,t){const n=this.geometry,i=this.matrixWorld,a=e.params.Points.threshold,o=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),Am.copy(n.boundingSphere),Am.applyMatrix4(i),Am.radius+=a,e.ray.intersectsSphere(Am)===!1)return;fp.copy(i).invert(),rd.copy(e.ray).applyMatrix4(fp);const u=a/((this.scale.x+this.scale.y+this.scale.z)/3),c=u*u,d=n.index,v=n.attributes.position;if(d!==null){const M=Math.max(0,o.start),B=Math.min(d.count,o.start+o.count);for(let I=M,ne=B;I<ne;I++){const ee=d.getX(I);pm.fromBufferAttribute(v,ee),Ym(pm,ee,c,i,e,t,this)}}else{const M=Math.max(0,o.start),B=Math.min(v.count,o.start+o.count);for(let I=M,ne=B;I<ne;I++)pm.fromBufferAttribute(v,I),Ym(pm,I,c,i,e,t,this)}}updateMorphTargets(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){const i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let a=0,o=i.length;a<o;a++){const u=i[a].name||String(a);this.morphTargetInfluences.push(0),this.morphTargetDictionary[u]=a}}}}}function Ym(s,e,t,n,i,a,o){const u=rd.distanceSqToPoint(s);if(u<t){const c=new le;rd.closestPointToPoint(s,c),c.applyMatrix4(n);const d=i.ray.origin.distanceTo(c);if(d<i.near||d>i.far)return;a.push({distance:d,distanceToRay:Math.sqrt(u),point:c,index:e,face:null,faceIndex:null,barycoord:null,object:o})}}class k0 extends null{constructor(e,t,n,i,a=vr,o=vr,u,c,d){super(e,t,n,i,a,o,u,c,d),this.isVideoTexture=!0,this.generateMipmaps=!1,this._requestVideoFrameCallbackId=0;const g=this;function v(){g.needsUpdate=!0,g._requestVideoFrameCallbackId=e.requestVideoFrameCallback(v)}"requestVideoFrameCallback"in e&&(this._requestVideoFrameCallbackId=e.requestVideoFrameCallback(v))}clone(){return new this.constructor(this.image).copy(this)}update(){const e=this.image;"requestVideoFrameCallback"in e===!1&&e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}dispose(){this._requestVideoFrameCallbackId!==0&&(this.source.data.cancelVideoFrameCallback(this._requestVideoFrameCallbackId),this._requestVideoFrameCallbackId=0),super.dispose()}}class gm extends null{constructor(e,t,n,i,a,o,u,c){super({},e,t,n,i,a,o,u,c),this.isVideoFrameTexture=!0}update(){}clone(){return new this.constructor().copy(this)}setFrame(e){this.image=e,this.needsUpdate=!0}}class OA extends zi{constructor(e,t){super({width:e,height:t}),this.isFramebufferTexture=!0,this.magFilter=cn,this.minFilter=cn,this.generateMipmaps=!1,this.needsUpdate=!0}}class DA extends null{constructor(e,t,n,i,a,o,u,c,d,g,v,M){super(null,o,u,c,d,g,i,a,v,M),this.isCompressedTexture=!0,this.image={width:t,height:n},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}}class Us extends null{constructor(e,t,n,i,a,o){super(e,t,n,a,o),this.isCompressedArrayTexture=!0,this.image.depth=i,this.wrapR=Vt,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class Cd extends null{constructor(e,t,n){super(void 0,e[0].width,e[0].height,t,n,it),this.isCompressedCubeTexture=!0,this.isCubeTexture=!0,this.image=e}}class iA extends null{constructor(e,t,n,i,a,o,u,c,d){super(e,t,n,i,a,o,u,c,d),this.isCanvasTexture=!0,this.needsUpdate=!0}}class Al extends zi{constructor(e,t,n=st,i,a,o,u=cn,c=cn,d,g=Q,v=1){if(g!==Q&&g!==w)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");const M={width:e,height:t,depth:v};super(M,i,a,o,u,c,g,n,d),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.source=new rs(Object.assign({},e.image)),this.compareFunction=e.compareFunction,this}toJSON(e){const t=super.toJSON(e);return this.compareFunction!==null&&(t.compareFunction=this.compareFunction),t}}class sA extends Al{constructor(e,t=st,n=it,i,a,o=cn,u=cn,c,d=Q){const g={width:e,height:e,depth:1},v=[g,g,g,g,g,g];super(e,e,t,n,i,a,o,u,c,d),this.image=v,this.isCubeDepthTexture=!0,this.isCubeTexture=!0}get images(){return this.image}set images(e){this.image=e}}class Fo extends zi{constructor(e=null){super(),this.sourceTexture=e,this.isExternalTexture=!0}copy(e){return super.copy(e),this.sourceTexture=e.sourceTexture,this}}class ll extends ka{constructor(e=1,t=1,n=4,i=8,a=1){super(),this.type="CapsuleGeometry",this.parameters={radius:e,height:t,capSegments:n,radialSegments:i,heightSegments:a},t=Math.max(0,t),n=Math.max(1,Math.floor(n)),i=Math.max(3,Math.floor(i)),a=Math.max(1,Math.floor(a));const o=[],u=[],c=[],d=[],g=t/2,v=Math.PI/2*e,M=t,B=2*v+M,I=n*2+a,ne=i+1,ee=new le,q=new le;for(let ye=0;ye<=I;ye++){let Ce=0,ke=0,nt=0,Ye=0;if(ye<=n){const qe=ye/n,pt=qe*Math.PI/2;ke=-g-e*Math.cos(pt),nt=e*Math.sin(pt),Ye=-e*Math.cos(pt),Ce=qe*v}else if(ye<=n+a){const qe=(ye-n)/a;ke=-g+qe*t,nt=e,Ye=0,Ce=v+qe*M}else{const qe=(ye-n-a)/n,pt=qe*Math.PI/2;ke=g+e*Math.sin(pt),nt=e*Math.cos(pt),Ye=e*Math.sin(pt),Ce=v+M+qe*v}const ht=Math.max(0,Math.min(1,Ce/B));let Rt=0;ye===0?Rt=.5/i:ye===I&&(Rt=-.5/i);for(let qe=0;qe<=i;qe++){const pt=qe/i,xn=pt*Math.PI*2,cr=Math.sin(xn),pr=Math.cos(xn);q.x=-nt*pr,q.y=ke,q.z=nt*cr,u.push(q.x,q.y,q.z),ee.set(-nt*pr,Ye,nt*cr),ee.normalize(),c.push(ee.x,ee.y,ee.z),d.push(pt+Rt,ht)}if(ye>0){const qe=(ye-1)*ne;for(let pt=0;pt<i;pt++){const xn=qe+pt,cr=qe+pt+1,pr=ye*ne+pt,Br=ye*ne+pt+1;o.push(xn,cr,pr),o.push(cr,Br,pr)}}}this.setIndex(o),this.setAttribute("position",new Ui(u,3)),this.setAttribute("normal",new Ui(c,3)),this.setAttribute("uv",new Ui(d,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new ll(e.radius,e.height,e.capSegments,e.radialSegments,e.heightSegments)}}class hc extends ka{constructor(e=1,t=32,n=0,i=Math.PI*2){super(),this.type="CircleGeometry",this.parameters={radius:e,segments:t,thetaStart:n,thetaLength:i},t=Math.max(3,t);const a=[],o=[],u=[],c=[],d=new le,g=new ce;o.push(0,0,0),u.push(0,0,1),c.push(.5,.5);for(let v=0,M=3;v<=t;v++,M+=3){const B=n+v/t*i;d.x=e*Math.cos(B),d.y=e*Math.sin(B),o.push(d.x,d.y,d.z),u.push(0,0,1),g.x=(o[M]/e+1)/2,g.y=(o[M+1]/e+1)/2,c.push(g.x,g.y)}for(let v=1;v<=t;v++)a.push(v,v+1,0);this.setIndex(a),this.setAttribute("position",new Ui(o,3)),this.setAttribute("normal",new Ui(u,3)),this.setAttribute("uv",new Ui(c,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new hc(e.radius,e.segments,e.thetaStart,e.thetaLength)}}class Cc extends ka{constructor(e=1,t=1,n=1,i=32,a=1,o=!1,u=0,c=Math.PI*2){super(),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:n,radialSegments:i,heightSegments:a,openEnded:o,thetaStart:u,thetaLength:c};const d=this;i=Math.floor(i),a=Math.floor(a);const g=[],v=[],M=[],B=[];let I=0;const ne=[],ee=n/2;let q=0;ye(),o===!1&&(e>0&&Ce(!0),t>0&&Ce(!1)),this.setIndex(g),this.setAttribute("position",new Ui(v,3)),this.setAttribute("normal",new Ui(M,3)),this.setAttribute("uv",new Ui(B,2));function ye(){const ke=new le,nt=new le;let Ye=0;const ht=(t-e)/n;for(let Rt=0;Rt<=a;Rt++){const qe=[],pt=Rt/a,xn=pt*(t-e)+e;for(let cr=0;cr<=i;cr++){const pr=cr/i,Br=pr*c+u,zr=Math.sin(Br),Dr=Math.cos(Br);nt.x=xn*zr,nt.y=-pt*n+ee,nt.z=xn*Dr,v.push(nt.x,nt.y,nt.z),ke.set(zr,ht,Dr).normalize(),M.push(ke.x,ke.y,ke.z),B.push(pr,1-pt),qe.push(I++)}ne.push(qe)}for(let Rt=0;Rt<i;Rt++)for(let qe=0;qe<a;qe++){const pt=ne[qe][Rt],xn=ne[qe+1][Rt],cr=ne[qe+1][Rt+1],pr=ne[qe][Rt+1];(e>0||qe!==0)&&(g.push(pt,xn,pr),Ye+=3),(t>0||qe!==a-1)&&(g.push(xn,cr,pr),Ye+=3)}d.addGroup(q,Ye,0),q+=Ye}function Ce(ke){const nt=I,Ye=new ce,ht=new le;let Rt=0;const qe=ke===!0?e:t,pt=ke===!0?1:-1;for(let cr=1;cr<=i;cr++)v.push(0,ee*pt,0),M.push(0,pt,0),B.push(.5,.5),I++;const xn=I;for(let cr=0;cr<=i;cr++){const Br=cr/i*c+u,zr=Math.cos(Br),Dr=Math.sin(Br);ht.x=qe*Dr,ht.y=ee*pt,ht.z=qe*zr,v.push(ht.x,ht.y,ht.z),M.push(0,pt,0),Ye.x=zr*.5+.5,Ye.y=Dr*.5*pt+.5,B.push(Ye.x,Ye.y),I++}for(let cr=0;cr<i;cr++){const pr=nt+cr,Br=xn+cr;ke===!0?g.push(Br,Br+1,pr):g.push(Br+1,Br,pr),Rt+=3}d.addGroup(q,Rt,ke===!0?1:2),q+=Rt}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Cc(e.radiusTop,e.radiusBottom,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class Rh extends Cc{constructor(e=1,t=1,n=32,i=1,a=!1,o=0,u=Math.PI*2){super(0,e,t,n,i,a,o,u),this.type="ConeGeometry",this.parameters={radius:e,height:t,radialSegments:n,heightSegments:i,openEnded:a,thetaStart:o,thetaLength:u}}static fromJSON(e){return new Rh(e.radius,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class Bf extends ka{constructor(e=[],t=[],n=1,i=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:e,indices:t,radius:n,detail:i};const a=[],o=[];u(i),d(n),g(),this.setAttribute("position",new Ui(a,3)),this.setAttribute("normal",new Ui(a.slice(),3)),this.setAttribute("uv",new Ui(o,2)),i===0?this.computeVertexNormals():this.normalizeNormals();function u(ye){const Ce=new le,ke=new le,nt=new le;for(let Ye=0;Ye<t.length;Ye+=3)B(t[Ye+0],Ce),B(t[Ye+1],ke),B(t[Ye+2],nt),c(Ce,ke,nt,ye)}function c(ye,Ce,ke,nt){const Ye=nt+1,ht=[];for(let Rt=0;Rt<=Ye;Rt++){ht[Rt]=[];const qe=ye.clone().lerp(ke,Rt/Ye),pt=Ce.clone().lerp(ke,Rt/Ye),xn=Ye-Rt;for(let cr=0;cr<=xn;cr++)cr===0&&Rt===Ye?ht[Rt][cr]=qe:ht[Rt][cr]=qe.clone().lerp(pt,cr/xn)}for(let Rt=0;Rt<Ye;Rt++)for(let qe=0;qe<2*(Ye-Rt)-1;qe++){const pt=Math.floor(qe/2);qe%2===0?(M(ht[Rt][pt+1]),M(ht[Rt+1][pt]),M(ht[Rt][pt])):(M(ht[Rt][pt+1]),M(ht[Rt+1][pt+1]),M(ht[Rt+1][pt]))}}function d(ye){const Ce=new le;for(let ke=0;ke<a.length;ke+=3)Ce.x=a[ke+0],Ce.y=a[ke+1],Ce.z=a[ke+2],Ce.normalize().multiplyScalar(ye),a[ke+0]=Ce.x,a[ke+1]=Ce.y,a[ke+2]=Ce.z}function g(){const ye=new le;for(let Ce=0;Ce<a.length;Ce+=3){ye.x=a[Ce+0],ye.y=a[Ce+1],ye.z=a[Ce+2];const ke=ee(ye)/2/Math.PI+.5,nt=q(ye)/Math.PI+.5;o.push(ke,1-nt)}I(),v()}function v(){for(let ye=0;ye<o.length;ye+=6){const Ce=o[ye+0],ke=o[ye+2],nt=o[ye+4],Ye=Math.max(Ce,ke,nt),ht=Math.min(Ce,ke,nt);Ye>.9&&ht<.1&&(Ce<.2&&(o[ye+0]+=1),ke<.2&&(o[ye+2]+=1),nt<.2&&(o[ye+4]+=1))}}function M(ye){a.push(ye.x,ye.y,ye.z)}function B(ye,Ce){const ke=ye*3;Ce.x=e[ke+0],Ce.y=e[ke+1],Ce.z=e[ke+2]}function I(){const ye=new le,Ce=new le,ke=new le,nt=new le,Ye=new ce,ht=new ce,Rt=new ce;for(let qe=0,pt=0;qe<a.length;qe+=9,pt+=6){ye.set(a[qe+0],a[qe+1],a[qe+2]),Ce.set(a[qe+3],a[qe+4],a[qe+5]),ke.set(a[qe+6],a[qe+7],a[qe+8]),Ye.set(o[pt+0],o[pt+1]),ht.set(o[pt+2],o[pt+3]),Rt.set(o[pt+4],o[pt+5]),nt.copy(ye).add(Ce).add(ke).divideScalar(3);const xn=ee(nt);ne(Ye,pt+0,ye,xn),ne(ht,pt+2,Ce,xn),ne(Rt,pt+4,ke,xn)}}function ne(ye,Ce,ke,nt){nt<0&&ye.x===1&&(o[Ce]=ye.x-1),ke.x===0&&ke.z===0&&(o[Ce]=nt/2/Math.PI+.5)}function ee(ye){return Math.atan2(ye.z,-ye.x)}function q(ye){return Math.atan2(-ye.y,Math.sqrt(ye.x*ye.x+ye.z*ye.z))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Bf(e.vertices,e.indices,e.radius,e.detail)}}class Rf extends Bf{constructor(e=1,t=0){const n=(1+Math.sqrt(5))/2,i=1/n,a=[-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-i,-n,0,-i,n,0,i,-n,0,i,n,-i,-n,0,-i,n,0,i,-n,0,i,n,0,-n,0,-i,n,0,-i,-n,0,i,n,0,i],o=[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9];super(a,o,e,t),this.type="DodecahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new Rf(e.radius,e.detail)}}const aA=new le,kA=new le,oA=new le,VA=new ku;class mm extends ka{constructor(e=null,t=1){if(super(),this.type="EdgesGeometry",this.parameters={geometry:e,thresholdAngle:t},e!==null){const i=Math.pow(10,4),a=Math.cos(Ou*t),o=e.getIndex(),u=e.getAttribute("position"),c=o?o.count:u.count,d=[0,0,0],g=["a","b","c"],v=new Array(3),M={},B=[];for(let I=0;I<c;I+=3){o?(d[0]=o.getX(I),d[1]=o.getX(I+1),d[2]=o.getX(I+2)):(d[0]=I,d[1]=I+1,d[2]=I+2);const{a:ne,b:ee,c:q}=VA;if(ne.fromBufferAttribute(u,d[0]),ee.fromBufferAttribute(u,d[1]),q.fromBufferAttribute(u,d[2]),VA.getNormal(oA),v[0]=`${Math.round(ne.x*i)},${Math.round(ne.y*i)},${Math.round(ne.z*i)}`,v[1]=`${Math.round(ee.x*i)},${Math.round(ee.y*i)},${Math.round(ee.z*i)}`,v[2]=`${Math.round(q.x*i)},${Math.round(q.y*i)},${Math.round(q.z*i)}`,!(v[0]===v[1]||v[1]===v[2]||v[2]===v[0]))for(let ye=0;ye<3;ye++){const Ce=(ye+1)%3,ke=v[ye],nt=v[Ce],Ye=VA[g[ye]],ht=VA[g[Ce]],Rt=`${ke}_${nt}`,qe=`${nt}_${ke}`;qe in M&&M[qe]?(oA.dot(M[qe].normal)<=a&&(B.push(Ye.x,Ye.y,Ye.z),B.push(ht.x,ht.y,ht.z)),M[qe]=null):Rt in M||(M[Rt]={index0:d[ye],index1:d[Ce],normal:oA.clone()})}}for(const I in M)if(M[I]){const{index0:ne,index1:ee}=M[I];aA.fromBufferAttribute(u,ne),kA.fromBufferAttribute(u,ee),B.push(aA.x,aA.y,aA.z),B.push(kA.x,kA.y,kA.z)}this.setAttribute("position",new Ui(B,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}}class Hh{constructor(){this.type="Curve",this.arcLengthDivisions=200,this.needsUpdate=!1,this.cacheArcLengths=null}getPoint(){Lr("Curve: .getPoint() not implemented.")}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,i=this.getPoint(0),a=0;t.push(0);for(let o=1;o<=e;o++)n=this.getPoint(o/e),a+=n.distanceTo(i),t.push(a),i=n;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t=null){const n=this.getLengths();let i=0;const a=n.length;let o;t?o=t:o=e*n[a-1];let u=0,c=a-1,d;for(;u<=c;)if(i=Math.floor(u+(c-u)/2),d=n[i]-o,d<0)u=i+1;else if(d>0)c=i-1;else{c=i;break}if(i=c,n[i]===o)return i/(a-1);const g=n[i],M=n[i+1]-g,B=(o-g)/M;return(i+B)/(a-1)}getTangent(e,t){let i=e-1e-4,a=e+1e-4;i<0&&(i=0),a>1&&(a=1);const o=this.getPoint(i),u=this.getPoint(a),c=t||(o.isVector2?new ce:new le);return c.copy(u).sub(o).normalize(),c}getTangentAt(e,t){const n=this.getUtoTmapping(e);return this.getTangent(n,t)}computeFrenetFrames(e,t=!1){const n=new le,i=[],a=[],o=[],u=new le,c=new di;for(let B=0;B<=e;B++){const I=B/e;i[B]=this.getTangentAt(I,new le)}a[0]=new le,o[0]=new le;let d=Number.MAX_VALUE;const g=Math.abs(i[0].x),v=Math.abs(i[0].y),M=Math.abs(i[0].z);g<=d&&(d=g,n.set(1,0,0)),v<=d&&(d=v,n.set(0,1,0)),M<=d&&n.set(0,0,1),u.crossVectors(i[0],n).normalize(),a[0].crossVectors(i[0],u),o[0].crossVectors(i[0],a[0]);for(let B=1;B<=e;B++){if(a[B]=a[B-1].clone(),o[B]=o[B-1].clone(),u.crossVectors(i[B-1],i[B]),u.length()>Number.EPSILON){u.normalize();const I=Math.acos(Ca(i[B-1].dot(i[B]),-1,1));a[B].applyMatrix4(c.makeRotationAxis(u,I))}o[B].crossVectors(i[B],a[B])}if(t===!0){let B=Math.acos(Ca(a[0].dot(a[e]),-1,1));B/=e,i[0].dot(u.crossVectors(a[0],a[e]))>0&&(B=-B);for(let I=1;I<=e;I++)a[I].applyMatrix4(c.makeRotationAxis(i[I],B*I)),o[I].crossVectors(i[I],a[I])}return{tangents:i,normals:a,binormals:o}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){const e={metadata:{version:4.7,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}class zp extends Hh{constructor(e=0,t=0,n=1,i=1,a=0,o=Math.PI*2,u=!1,c=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=n,this.yRadius=i,this.aStartAngle=a,this.aEndAngle=o,this.aClockwise=u,this.aRotation=c}getPoint(e,t=new ce){const n=t,i=Math.PI*2;let a=this.aEndAngle-this.aStartAngle;const o=Math.abs(a)<Number.EPSILON;for(;a<0;)a+=i;for(;a>i;)a-=i;a<Number.EPSILON&&(o?a=0:a=i),this.aClockwise===!0&&!o&&(a===i?a=-i:a=a-i);const u=this.aStartAngle+e*a;let c=this.aX+this.xRadius*Math.cos(u),d=this.aY+this.yRadius*Math.sin(u);if(this.aRotation!==0){const g=Math.cos(this.aRotation),v=Math.sin(this.aRotation),M=c-this.aX,B=d-this.aY;c=M*g-B*v+this.aX,d=M*v+B*g+this.aY}return n.set(c,d)}copy(e){return super.copy(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}toJSON(){const e=super.toJSON();return e.aX=this.aX,e.aY=this.aY,e.xRadius=this.xRadius,e.yRadius=this.yRadius,e.aStartAngle=this.aStartAngle,e.aEndAngle=this.aEndAngle,e.aClockwise=this.aClockwise,e.aRotation=this.aRotation,e}fromJSON(e){return super.fromJSON(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}}class vm extends zp{constructor(e,t,n,i,a,o){super(e,t,n,n,i,a,o),this.isArcCurve=!0,this.type="ArcCurve"}}function zA(){let s=0,e=0,t=0,n=0;function i(a,o,u,c){s=a,e=u,t=-3*a+3*o-2*u-c,n=2*a-2*o+u+c}return{initCatmullRom:function(a,o,u,c,d){i(o,u,d*(u-a),d*(c-o))},initNonuniformCatmullRom:function(a,o,u,c,d,g,v){let M=(o-a)/d-(u-a)/(d+g)+(u-o)/g,B=(u-o)/g-(c-o)/(g+v)+(c-u)/v;M*=g,B*=g,i(o,u,M,B)},calc:function(a){const o=a*a,u=o*a;return s+e*a+t*o+n*u}}}const Jd=new le,ym=new zA,x=new zA,S=new zA;class f extends Hh{constructor(e=[],t=!1,n="centripetal",i=.5){super(),this.isCatmullRomCurve3=!0,this.type="CatmullRomCurve3",this.points=e,this.closed=t,this.curveType=n,this.tension=i}getPoint(e,t=new le){const n=t,i=this.points,a=i.length,o=(a-(this.closed?0:1))*e;let u=Math.floor(o),c=o-u;this.closed?u+=u>0?0:(Math.floor(Math.abs(u)/a)+1)*a:c===0&&u===a-1&&(u=a-2,c=1);let d,g;this.closed||u>0?d=i[(u-1)%a]:(Jd.subVectors(i[0],i[1]).add(i[0]),d=Jd);const v=i[u%a],M=i[(u+1)%a];if(this.closed||u+2<a?g=i[(u+2)%a]:(Jd.subVectors(i[a-1],i[a-2]).add(i[a-1]),g=Jd),this.curveType==="centripetal"||this.curveType==="chordal"){const B=this.curveType==="chordal"?.5:.25;let I=Math.pow(d.distanceToSquared(v),B),ne=Math.pow(v.distanceToSquared(M),B),ee=Math.pow(M.distanceToSquared(g),B);ne<1e-4&&(ne=1),I<1e-4&&(I=ne),ee<1e-4&&(ee=ne),ym.initNonuniformCatmullRom(d.x,v.x,M.x,g.x,I,ne,ee),x.initNonuniformCatmullRom(d.y,v.y,M.y,g.y,I,ne,ee),S.initNonuniformCatmullRom(d.z,v.z,M.z,g.z,I,ne,ee)}else this.curveType==="catmullrom"&&(ym.initCatmullRom(d.x,v.x,M.x,g.x,this.tension),x.initCatmullRom(d.y,v.y,M.y,g.y,this.tension),S.initCatmullRom(d.z,v.z,M.z,g.z,this.tension));return n.set(ym.calc(c),x.calc(c),S.calc(c)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const i=e.points[t];this.points.push(i.clone())}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}toJSON(){const e=super.toJSON();e.points=[];for(let t=0,n=this.points.length;t<n;t++){const i=this.points[t];e.points.push(i.toArray())}return e.closed=this.closed,e.curveType=this.curveType,e.tension=this.tension,e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const i=e.points[t];this.points.push(new le().fromArray(i))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}}function A(s,e,t,n,i){const a=(n-e)*.5,o=(i-t)*.5,u=s*s,c=s*u;return(2*t-2*n+a+o)*c+(-3*t+3*n-2*a-o)*u+a*s+t}function _(s,e){const t=1-s;return t*t*e}function k(s,e){return 2*(1-s)*s*e}function G(s,e){return s*s*e}function ae(s,e,t,n){return _(s,e)+k(s,t)+G(s,n)}function ge(s,e){const t=1-s;return t*t*t*e}function Ue(s,e){const t=1-s;return 3*t*t*s*e}function rt(s,e){return 3*(1-s)*s*s*e}function bt(s,e){return s*s*s*e}function Zt(s,e,t,n,i){return ge(s,e)+Ue(s,t)+rt(s,n)+bt(s,i)}class wn extends Hh{constructor(e=new ce,t=new ce,n=new ce,i=new ce){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=e,this.v1=t,this.v2=n,this.v3=i}getPoint(e,t=new ce){const n=t,i=this.v0,a=this.v1,o=this.v2,u=this.v3;return n.set(Zt(e,i.x,a.x,o.x,u.x),Zt(e,i.y,a.y,o.y,u.y)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}}class mn extends Hh{constructor(e=new le,t=new le,n=new le,i=new le){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=e,this.v1=t,this.v2=n,this.v3=i}getPoint(e,t=new le){const n=t,i=this.v0,a=this.v1,o=this.v2,u=this.v3;return n.set(Zt(e,i.x,a.x,o.x,u.x),Zt(e,i.y,a.y,o.y,u.y),Zt(e,i.z,a.z,o.z,u.z)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}}class Gn extends Hh{constructor(e=new ce,t=new ce){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=e,this.v2=t}getPoint(e,t=new ce){const n=t;return e===1?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t=new ce){return t.subVectors(this.v2,this.v1).normalize()}getTangentAt(e,t){return this.getTangent(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class ir extends Hh{constructor(e=new le,t=new le){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=e,this.v2=t}getPoint(e,t=new le){const n=t;return e===1?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t=new le){return t.subVectors(this.v2,this.v1).normalize()}getTangentAt(e,t){return this.getTangent(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class tr extends Hh{constructor(e=new ce,t=new ce,n=new ce){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=e,this.v1=t,this.v2=n}getPoint(e,t=new ce){const n=t,i=this.v0,a=this.v1,o=this.v2;return n.set(ae(e,i.x,a.x,o.x),ae(e,i.y,a.y,o.y)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class Zn extends Hh{constructor(e=new le,t=new le,n=new le){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=e,this.v1=t,this.v2=n}getPoint(e,t=new le){const n=t,i=this.v0,a=this.v1,o=this.v2;return n.set(ae(e,i.x,a.x,o.x),ae(e,i.y,a.y,o.y),ae(e,i.z,a.z,o.z)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class Tr extends Hh{constructor(e=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=e}getPoint(e,t=new ce){const n=t,i=this.points,a=(i.length-1)*e,o=Math.floor(a),u=a-o,c=i[o===0?o:o-1],d=i[o],g=i[o>i.length-2?i.length-1:o+1],v=i[o>i.length-3?i.length-1:o+2];return n.set(A(u,c.x,d.x,g.x,v.x),A(u,c.y,d.y,g.y,v.y)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const i=e.points[t];this.points.push(i.clone())}return this}toJSON(){const e=super.toJSON();e.points=[];for(let t=0,n=this.points.length;t<n;t++){const i=this.points[t];e.points.push(i.toArray())}return e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const i=e.points[t];this.points.push(new ce().fromArray(i))}return this}}var ni=Object.freeze({__proto__:null,ArcCurve:vm,CatmullRomCurve3:f,CubicBezierCurve:wn,CubicBezierCurve3:mn,EllipseCurve:zp,LineCurve:Gn,LineCurve3:ir,QuadraticBezierCurve:tr,QuadraticBezierCurve3:Zn,SplineCurve:Tr});class ns extends Hh{constructor(){super(),this.type="CurvePath",this.curves=[],this.autoClose=!1}add(e){this.curves.push(e)}closePath(){const e=this.curves[0].getPoint(0),t=this.curves[this.curves.length-1].getPoint(1);if(!e.equals(t)){const n=e.isVector2===!0?"LineCurve":"LineCurve3";this.curves.push(new ni[n](t,e))}return this}getPoint(e,t){const n=e*this.getLength(),i=this.getCurveLengths();let a=0;for(;a<i.length;){if(i[a]>=n){const o=i[a]-n,u=this.curves[a],c=u.getLength(),d=c===0?0:1-o/c;return u.getPointAt(d,t)}a++}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,i=this.curves.length;n<i;n++)t+=this.curves[n].getLength(),e.push(t);return this.cacheLengths=e,e}getSpacedPoints(e=40){const t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return this.autoClose&&t.push(t[0]),t}getPoints(e=12){const t=[];let n;for(let i=0,a=this.curves;i<a.length;i++){const o=a[i],u=o.isEllipseCurve?e*2:o.isLineCurve||o.isLineCurve3?1:o.isSplineCurve?e*o.points.length:e,c=o.getPoints(u);for(let d=0;d<c.length;d++){const g=c[d];n&&n.equals(g)||(t.push(g),n=g)}}return this.autoClose&&t.length>1&&!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;t<n;t++){const i=e.curves[t];this.curves.push(i.clone())}return this.autoClose=e.autoClose,this}toJSON(){const e=super.toJSON();e.autoClose=this.autoClose,e.curves=[];for(let t=0,n=this.curves.length;t<n;t++){const i=this.curves[t];e.curves.push(i.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.autoClose=e.autoClose,this.curves=[];for(let t=0,n=e.curves.length;t<n;t++){const i=e.curves[t];this.curves.push(new ni[i.type]().fromJSON(i))}return this}}class is extends ns{constructor(e){super(),this.type="Path",this.currentPoint=new ce,e&&this.setFromPoints(e)}setFromPoints(e){this.moveTo(e[0].x,e[0].y);for(let t=1,n=e.length;t<n;t++)this.lineTo(e[t].x,e[t].y);return this}moveTo(e,t){return this.currentPoint.set(e,t),this}lineTo(e,t){const n=new Gn(this.currentPoint.clone(),new ce(e,t));return this.curves.push(n),this.currentPoint.set(e,t),this}quadraticCurveTo(e,t,n,i){const a=new tr(this.currentPoint.clone(),new ce(e,t),new ce(n,i));return this.curves.push(a),this.currentPoint.set(n,i),this}bezierCurveTo(e,t,n,i,a,o){const u=new wn(this.currentPoint.clone(),new ce(e,t),new ce(n,i),new ce(a,o));return this.curves.push(u),this.currentPoint.set(a,o),this}splineThru(e){const t=[this.currentPoint.clone()].concat(e),n=new Tr(t);return this.curves.push(n),this.currentPoint.copy(e[e.length-1]),this}arc(e,t,n,i,a,o){const u=this.currentPoint.x,c=this.currentPoint.y;return this.absarc(e+u,t+c,n,i,a,o),this}absarc(e,t,n,i,a,o){return this.absellipse(e,t,n,n,i,a,o),this}ellipse(e,t,n,i,a,o,u,c){const d=this.currentPoint.x,g=this.currentPoint.y;return this.absellipse(e+d,t+g,n,i,a,o,u,c),this}absellipse(e,t,n,i,a,o,u,c){const d=new zp(e,t,n,i,a,o,u,c);if(this.curves.length>0){const v=d.getPoint(0);v.equals(this.currentPoint)||this.lineTo(v.x,v.y)}this.curves.push(d);const g=d.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 bi extends is{constructor(e){super(e),this.uuid=oc(),this.type="Shape",this.holes=[]}getPointsHoles(e){const t=[];for(let n=0,i=this.holes.length;n<i;n++)t[n]=this.holes[n].getPoints(e);return t}extractPoints(e){return{shape:this.getPoints(e),holes:this.getPointsHoles(e)}}copy(e){super.copy(e),this.holes=[];for(let t=0,n=e.holes.length;t<n;t++){const i=e.holes[t];this.holes.push(i.clone())}return this}toJSON(){const e=super.toJSON();e.uuid=this.uuid,e.holes=[];for(let t=0,n=this.holes.length;t<n;t++){const i=this.holes[t];e.holes.push(i.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.uuid=e.uuid,this.holes=[];for(let t=0,n=e.holes.length;t<n;t++){const i=e.holes[t];this.holes.push(new is().fromJSON(i))}return this}}function Ri(s,e,t=2){const n=e&&e.length,i=n?e[0]*t:s.length;let a=Gs(s,0,i,t,!0);const o=[];if(!a||a.next===a.prev)return o;let u,c,d;if(n&&(a=El(s,e,a,t)),s.length>80*t){u=s[0],c=s[1];let g=u,v=c;for(let M=t;M<i;M+=t){const B=s[M],I=s[M+1];B<u&&(u=B),I<c&&(c=I),B>g&&(g=B),I>v&&(v=I)}d=Math.max(g-u,v-c),d=d!==0?32767/d:0}return Hs(a,o,t,u,c,d,0),o}function Gs(s,e,t,n,i){let a;if(i===ks(s,e,t,n)>0)for(let o=e;o<t;o+=n)a=ko(o/n|0,s[o],s[o+1],a);else for(let o=t-n;o>=e;o-=n)a=ko(o/n|0,s[o],s[o+1],a);return a&&Ir(a,a.next)&&(uo(a),a=a.next),a}function _s(s,e){if(!s)return s;e||(e=s);let t=s,n;do if(n=!1,!t.steiner&&(Ir(t,t.next)||ur(t.prev,t,t.next)===0)){if(uo(t),t=e=t.prev,t===t.next)break;n=!0}else t=t.next;while(n||t!==e);return e}function Hs(s,e,t,n,i,a,o){if(!s)return;!o&&a&&K(s,n,i,a);let u=s;for(;s.prev!==s.next;){const c=s.prev,d=s.next;if(a?Ia(s,n,i,a):Zs(s)){e.push(c.i,s.i,d.i),uo(s),s=d.next,u=d.next;continue}if(s=d,s===u){o?o===1?(s=Po(_s(s),e),Hs(s,e,t,n,i,a,2)):o===2&&Ml(s,e,t,n,i,a):Hs(_s(s),e,t,n,i,a,1);break}}}function Zs(s){const e=s.prev,t=s,n=s.next;if(ur(e,t,n)>=0)return!1;const i=e.x,a=t.x,o=n.x,u=e.y,c=t.y,d=n.y,g=Math.min(i,a,o),v=Math.min(u,c,d),M=Math.max(i,a,o),B=Math.max(u,c,d);let I=n.next;for(;I!==e;){if(I.x>=g&&I.x<=M&&I.y>=v&&I.y<=B&&fn(i,u,a,c,o,d,I.x,I.y)&&ur(I.prev,I,I.next)>=0)return!1;I=I.next}return!0}function Ia(s,e,t,n){const i=s.prev,a=s,o=s.next;if(ur(i,a,o)>=0)return!1;const u=i.x,c=a.x,d=o.x,g=i.y,v=a.y,M=o.y,B=Math.min(u,c,d),I=Math.min(g,v,M),ne=Math.max(u,c,d),ee=Math.max(g,v,M),q=et(B,I,e,t,n),ye=et(ne,ee,e,t,n);let Ce=s.prevZ,ke=s.nextZ;for(;Ce&&Ce.z>=q&&ke&&ke.z<=ye;){if(Ce.x>=B&&Ce.x<=ne&&Ce.y>=I&&Ce.y<=ee&&Ce!==i&&Ce!==o&&fn(u,g,c,v,d,M,Ce.x,Ce.y)&&ur(Ce.prev,Ce,Ce.next)>=0||(Ce=Ce.prevZ,ke.x>=B&&ke.x<=ne&&ke.y>=I&&ke.y<=ee&&ke!==i&&ke!==o&&fn(u,g,c,v,d,M,ke.x,ke.y)&&ur(ke.prev,ke,ke.next)>=0))return!1;ke=ke.nextZ}for(;Ce&&Ce.z>=q;){if(Ce.x>=B&&Ce.x<=ne&&Ce.y>=I&&Ce.y<=ee&&Ce!==i&&Ce!==o&&fn(u,g,c,v,d,M,Ce.x,Ce.y)&&ur(Ce.prev,Ce,Ce.next)>=0)return!1;Ce=Ce.prevZ}for(;ke&&ke.z<=ye;){if(ke.x>=B&&ke.x<=ne&&ke.y>=I&&ke.y<=ee&&ke!==i&&ke!==o&&fn(u,g,c,v,d,M,ke.x,ke.y)&&ur(ke.prev,ke,ke.next)>=0)return!1;ke=ke.nextZ}return!0}function Po(s,e){let t=s;do{const n=t.prev,i=t.next.next;!Ir(n,i)&&fi(n,t,t.next,i)&&Ja(n,i)&&Ja(i,n)&&(e.push(n.i,t.i,i.i),uo(t),uo(t.next),t=s=i),t=t.next}while(t!==s);return _s(t)}function Ml(s,e,t,n,i,a){let o=s;do{let u=o.next.next;for(;u!==o.prev;){if(o.i!==u.i&&Ar(o,u)){let c=ea(o,u);o=_s(o,o.next),c=_s(c,c.next),Hs(o,e,t,n,i,a,0),Hs(c,e,t,n,i,a,0);return}u=u.next}o=o.next}while(o!==s)}function El(s,e,t,n){const i=[];for(let a=0,o=e.length;a<o;a++){const u=e[a]*n,c=a<o-1?e[a+1]*n:s.length,d=Gs(s,u,c,n,!1);d===d.next&&(d.steiner=!0),i.push(Ft(d))}i.sort(Ys);for(let a=0;a<i.length;a++)t=U(i[a],t);return t}function Ys(s,e){let t=s.x-e.x;if(t===0&&(t=s.y-e.y,t===0)){const n=(s.next.y-s.y)/(s.next.x-s.x),i=(e.next.y-e.y)/(e.next.x-e.x);t=n-i}return t}function U(s,e){const t=R(s,e);if(!t)return e;const n=ea(t,s);return _s(n,n.next),_s(t,t.next)}function R(s,e){let t=e;const n=s.x,i=s.y;let a=-1/0,o;if(Ir(s,t))return t;do{if(Ir(s,t.next))return t.next;if(i<=t.y&&i>=t.next.y&&t.next.y!==t.y){const v=t.x+(i-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(v<=n&&v>a&&(a=v,o=t.x<t.next.x?t:t.next,v===n))return o}t=t.next}while(t!==e);if(!o)return null;const u=o,c=o.x,d=o.y;let g=1/0;t=o;do{if(n>=t.x&&t.x>=c&&n!==t.x&&dn(i<d?n:a,i,c,d,i<d?a:n,i,t.x,t.y)){const v=Math.abs(i-t.y)/(n-t.x);Ja(t,s)&&(v<g||v===g&&(t.x>o.x||t.x===o.x&&$(o,t)))&&(o=t,g=v)}t=t.next}while(t!==u);return o}function $(s,e){return ur(s.prev,s,e.prev)<0&&ur(e.next,s,s.next)<0}function K(s,e,t,n){let i=s;do i.z===0&&(i.z=et(i.x,i.y,e,t,n)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==s);i.prevZ.nextZ=null,i.prevZ=null,_e(i)}function _e(s){let e,t=1;do{let n=s,i;s=null;let a=null;for(e=0;n;){e++;let o=n,u=0;for(let d=0;d<t&&(u++,o=o.nextZ,!!o);d++);let c=t;for(;u>0||c>0&&o;)u!==0&&(c===0||!o||n.z<=o.z)?(i=n,n=n.nextZ,u--):(i=o,o=o.nextZ,c--),a?a.nextZ=i:s=i,i.prevZ=a,a=i;n=o}a.nextZ=null,t*=2}while(e>1);return s}function et(s,e,t,n,i){return s=(s-t)*i|0,e=(e-n)*i|0,s=(s|s<<8)&16711935,s=(s|s<<4)&252645135,s=(s|s<<2)&858993459,s=(s|s<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,s|e<<1}function Ft(s){let e=s,t=s;do(e.x<t.x||e.x===t.x&&e.y<t.y)&&(t=e),e=e.next;while(e!==s);return t}function dn(s,e,t,n,i,a,o,u){return(i-o)*(e-u)>=(s-o)*(a-u)&&(s-o)*(n-u)>=(t-o)*(e-u)&&(t-o)*(a-u)>=(i-o)*(n-u)}function fn(s,e,t,n,i,a,o,u){return!(s===o&&e===u)&&dn(s,e,t,n,i,a,o,u)}function Ar(s,e){return s.next.i!==e.i&&s.prev.i!==e.i&&!bs(s,e)&&(Ja(s,e)&&Ja(e,s)&&fa(s,e)&&(ur(s.prev,s,e.prev)||ur(s,e.prev,e))||Ir(s,e)&&ur(s.prev,s,s.next)>0&&ur(e.prev,e,e.next)>0)}function ur(s,e,t){return(e.y-s.y)*(t.x-e.x)-(e.x-s.x)*(t.y-e.y)}function Ir(s,e){return s.x===e.x&&s.y===e.y}function fi(s,e,t,n){const i=us(ur(s,e,t)),a=us(ur(s,e,n)),o=us(ur(t,n,s)),u=us(ur(t,n,e));return!!(i!==a&&o!==u||i===0&&Qs(s,t,e)||a===0&&Qs(s,n,e)||o===0&&Qs(t,s,n)||u===0&&Qs(t,e,n))}function Qs(s,e,t){return e.x<=Math.max(s.x,t.x)&&e.x>=Math.min(s.x,t.x)&&e.y<=Math.max(s.y,t.y)&&e.y>=Math.min(s.y,t.y)}function us(s){return s>0?1:s<0?-1:0}function bs(s,e){let t=s;do{if(t.i!==s.i&&t.next.i!==s.i&&t.i!==e.i&&t.next.i!==e.i&&fi(t,t.next,s,e))return!0;t=t.next}while(t!==s);return!1}function Ja(s,e){return ur(s.prev,s,s.next)<0?ur(s,e,s.next)>=0&&ur(s,s.prev,e)>=0:ur(s,e,s.prev)<0||ur(s,s.next,e)<0}function fa(s,e){let t=s,n=!1;const i=(s.x+e.x)/2,a=(s.y+e.y)/2;do t.y>a!=t.next.y>a&&t.next.y!==t.y&&i<(t.next.x-t.x)*(a-t.y)/(t.next.y-t.y)+t.x&&(n=!n),t=t.next;while(t!==s);return n}function ea(s,e){const t=Oa(s.i,s.x,s.y),n=Oa(e.i,e.x,e.y),i=s.next,a=e.prev;return s.next=e,e.prev=s,t.next=i,i.prev=t,n.next=t,t.prev=n,a.next=n,n.prev=a,n}function ko(s,e,t,n){const i=Oa(s,e,t);return n?(i.next=n.next,i.prev=n,n.next.prev=i,n.next=i):(i.prev=i,i.next=i),i}function uo(s){s.next.prev=s.prev,s.prev.next=s.next,s.prevZ&&(s.prevZ.nextZ=s.nextZ),s.nextZ&&(s.nextZ.prevZ=s.prevZ)}function Oa(s,e,t){return{i:s,x:e,y:t,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function ks(s,e,t,n){let i=0;for(let a=e,o=t-n;a<t;a+=n)i+=(s[o]-s[a])*(s[a+1]+s[o+1]),o=a;return i}class So{static triangulate(e,t,n=2){return Ri(e,t,n)}}class eo{static area(e){const t=e.length;let n=0;for(let i=t-1,a=0;a<t;i=a++)n+=e[i].x*e[a].y-e[a].x*e[i].y;return n*.5}static isClockWise(e){return eo.area(e)<0}static triangulateShape(e,t){const n=[],i=[],a=[];za(e),nu(n,e);let o=e.length;t.forEach(za);for(let c=0;c<t.length;c++)i.push(o),o+=t[c].length,nu(n,t[c]);const u=So.triangulate(n,i);for(let c=0;c<u.length;c+=3)a.push(u.slice(c,c+3));return a}}function za(s){const e=s.length;e>2&&s[e-1].equals(s[0])&&s.pop()}function nu(s,e){for(let t=0;t<e.length;t++)s.push(e[t].x),s.push(e[t].y)}class wu extends ka{constructor(e=new bi([new ce(.5,.5),new ce(-.5,.5),new ce(-.5,-.5),new ce(.5,-.5)]),t={}){super(),this.type="ExtrudeGeometry",this.parameters={shapes:e,options:t},e=Array.isArray(e)?e:[e];const n=this,i=[],a=[];for(let u=0,c=e.length;u<c;u++){const d=e[u];o(d)}this.setAttribute("position",new Ui(i,3)),this.setAttribute("uv",new Ui(a,2)),this.computeVertexNormals();function o(u){const c=[],d=t.curveSegments!==void 0?t.curveSegments:12,g=t.steps!==void 0?t.steps:1,v=t.depth!==void 0?t.depth:1;let M=t.bevelEnabled!==void 0?t.bevelEnabled:!0,B=t.bevelThickness!==void 0?t.bevelThickness:.2,I=t.bevelSize!==void 0?t.bevelSize:B-.1,ne=t.bevelOffset!==void 0?t.bevelOffset:0,ee=t.bevelSegments!==void 0?t.bevelSegments:3;const q=t.extrudePath,ye=t.UVGenerator!==void 0?t.UVGenerator:hu;let Ce,ke=!1,nt,Ye,ht,Rt;if(q){Ce=q.getSpacedPoints(g),ke=!0,M=!1;const Li=q.isCatmullRomCurve3?q.closed:!1;nt=q.computeFrenetFrames(g,Li),Ye=new le,ht=new le,Rt=new le}M||(ee=0,B=0,I=0,ne=0);const qe=u.extractPoints(d);let pt=qe.shape;const xn=qe.holes;if(!eo.isClockWise(pt)){pt=pt.reverse();for(let Li=0,os=xn.length;Li<os;Li++){const Hi=xn[Li];eo.isClockWise(Hi)&&(xn[Li]=Hi.reverse())}}function pr(Li){const Hi=10000000000000001e-36;let Fs=Li[0];for(let Pn=1;Pn<=Li.length;Pn++){const ja=Pn%Li.length,da=Li[ja],ho=da.x-Fs.x,Ps=da.y-Fs.y,Mn=ho*ho+Ps*Ps,St=Math.max(Math.abs(da.x),Math.abs(da.y),Math.abs(Fs.x),Math.abs(Fs.y)),Cr=Hi*St*St;if(Mn<=Cr){Li.splice(ja,1),Pn--;continue}Fs=da}}pr(pt),xn.forEach(pr);const Br=xn.length,zr=pt;for(let Li=0;Li<Br;Li++){const os=xn[Li];pt=pt.concat(os)}function Dr(Li,os,Hi){return os||Gr("ExtrudeGeometry: vec does not exist"),Li.clone().addScaledVector(os,Hi)}const Zr=pt.length;function Ti(Li,os,Hi){let Fs,Pn,ja;const da=Li.x-os.x,ho=Li.y-os.y,Ps=Hi.x-Li.x,Mn=Hi.y-Li.y,St=da*da+ho*ho,Cr=da*Mn-ho*Ps;if(Math.abs(Cr)>Number.EPSILON){const xi=Math.sqrt(St),Qi=Math.sqrt(Ps*Ps+Mn*Mn),Si=os.x-ho/xi,La=os.y+da/xi,Vs=Hi.x-Mn/Qi,Na=Hi.y+Ps/Qi,po=((Vs-Si)*Mn-(Na-La)*Ps)/(da*Mn-ho*Ps);Fs=Si+da*po-Li.x,Pn=La+ho*po-Li.y;const hs=Fs*Fs+Pn*Pn;if(hs<=2)return new ce(Fs,Pn);ja=Math.sqrt(hs/2)}else{let xi=!1;da>Number.EPSILON?Ps>Number.EPSILON&&(xi=!0):da<-Number.EPSILON?Ps<-Number.EPSILON&&(xi=!0):Math.sign(ho)===Math.sign(Mn)&&(xi=!0),xi?(Fs=-ho,Pn=da,ja=Math.sqrt(St)):(Fs=da,Pn=ho,ja=Math.sqrt(St/2))}return new ce(Fs/ja,Pn/ja)}const ds=[];for(let Li=0,os=zr.length,Hi=os-1,Fs=Li+1;Li<os;Li++,Hi++,Fs++)Hi===os&&(Hi=0),Fs===os&&(Fs=0),ds[Li]=Ti(zr[Li],zr[Hi],zr[Fs]);const As=[];let Xr,Yi=ds.concat();for(let Li=0,os=Br;Li<os;Li++){const Hi=xn[Li];Xr=[];for(let Fs=0,Pn=Hi.length,ja=Pn-1,da=Fs+1;Fs<Pn;Fs++,ja++,da++)ja===Pn&&(ja=0),da===Pn&&(da=0),Xr[Fs]=Ti(Hi[Fs],Hi[ja],Hi[da]);As.push(Xr),Yi=Yi.concat(Xr)}let ps;if(ee===0)ps=eo.triangulateShape(zr,xn);else{const Li=[],os=[];for(let Hi=0;Hi<ee;Hi++){const Fs=Hi/ee,Pn=B*Math.cos(Fs*Math.PI/2),ja=I*Math.sin(Fs*Math.PI/2)+ne;for(let da=0,ho=zr.length;da<ho;da++){const Ps=Dr(zr[da],ds[da],ja);oa(Ps.x,Ps.y,-Pn),Fs===0&&Li.push(Ps)}for(let da=0,ho=Br;da<ho;da++){const Ps=xn[da];Xr=As[da];const Mn=[];for(let St=0,Cr=Ps.length;St<Cr;St++){const xi=Dr(Ps[St],Xr[St],ja);oa(xi.x,xi.y,-Pn),Fs===0&&Mn.push(xi)}Fs===0&&os.push(Mn)}}ps=eo.triangulateShape(Li,os)}const Xa=ps.length,Pi=I+ne;for(let Li=0;Li<Zr;Li++){const os=M?Dr(pt[Li],Yi[Li],Pi):pt[Li];ke?(ht.copy(nt.normals[0]).multiplyScalar(os.x),Ye.copy(nt.binormals[0]).multiplyScalar(os.y),Rt.copy(Ce[0]).add(ht).add(Ye),oa(Rt.x,Rt.y,Rt.z)):oa(os.x,os.y,0)}for(let Li=1;Li<=g;Li++)for(let os=0;os<Zr;os++){const Hi=M?Dr(pt[os],Yi[os],Pi):pt[os];ke?(ht.copy(nt.normals[Li]).multiplyScalar(Hi.x),Ye.copy(nt.binormals[Li]).multiplyScalar(Hi.y),Rt.copy(Ce[Li]).add(ht).add(Ye),oa(Rt.x,Rt.y,Rt.z)):oa(Hi.x,Hi.y,v/g*Li)}for(let Li=ee-1;Li>=0;Li--){const os=Li/ee,Hi=B*Math.cos(os*Math.PI/2),Fs=I*Math.sin(os*Math.PI/2)+ne;for(let Pn=0,ja=zr.length;Pn<ja;Pn++){const da=Dr(zr[Pn],ds[Pn],Fs);oa(da.x,da.y,v+Hi)}for(let Pn=0,ja=xn.length;Pn<ja;Pn++){const da=xn[Pn];Xr=As[Pn];for(let ho=0,Ps=da.length;ho<Ps;ho++){const Mn=Dr(da[ho],Xr[ho],Fs);ke?oa(Mn.x,Mn.y+Ce[g-1].y,Ce[g-1].x+Hi):oa(Mn.x,Mn.y,v+Hi)}}}Nr(),Yr();function Nr(){const Li=i.length/3;if(M){let os=0,Hi=Zr*os;for(let Fs=0;Fs<Xa;Fs++){const Pn=ps[Fs];Ms(Pn[2]+Hi,Pn[1]+Hi,Pn[0]+Hi)}os=g+ee*2,Hi=Zr*os;for(let Fs=0;Fs<Xa;Fs++){const Pn=ps[Fs];Ms(Pn[0]+Hi,Pn[1]+Hi,Pn[2]+Hi)}}else{for(let os=0;os<Xa;os++){const Hi=ps[os];Ms(Hi[2],Hi[1],Hi[0])}for(let os=0;os<Xa;os++){const Hi=ps[os];Ms(Hi[0]+Zr*g,Hi[1]+Zr*g,Hi[2]+Zr*g)}}n.addGroup(Li,i.length/3-Li,0)}function Yr(){const Li=i.length/3;let os=0;cs(zr,os),os+=zr.length;for(let Hi=0,Fs=xn.length;Hi<Fs;Hi++){const Pn=xn[Hi];cs(Pn,os),os+=Pn.length}n.addGroup(Li,i.length/3-Li,1)}function cs(Li,os){let Hi=Li.length;for(;--Hi>=0;){const Fs=Hi;let Pn=Hi-1;Pn<0&&(Pn=Li.length-1);for(let ja=0,da=g+ee*2;ja<da;ja++){const ho=Zr*ja,Ps=Zr*(ja+1),Mn=os+Fs+ho,St=os+Pn+ho,Cr=os+Pn+Ps,xi=os+Fs+Ps;Ha(Mn,St,Cr,xi)}}}function oa(Li,os,Hi){c.push(Li),c.push(os),c.push(Hi)}function Ms(Li,os,Hi){Qo(Li),Qo(os),Qo(Hi);const Fs=i.length/3,Pn=ye.generateTopUV(n,i,Fs-3,Fs-2,Fs-1);co(Pn[0]),co(Pn[1]),co(Pn[2])}function Ha(Li,os,Hi,Fs){Qo(Li),Qo(os),Qo(Fs),Qo(os),Qo(Hi),Qo(Fs);const Pn=i.length/3,ja=ye.generateSideWallUV(n,i,Pn-6,Pn-3,Pn-2,Pn-1);co(ja[0]),co(ja[1]),co(ja[3]),co(ja[1]),co(ja[2]),co(ja[3])}function Qo(Li){i.push(c[Li*3+0]),i.push(c[Li*3+1]),i.push(c[Li*3+2])}function co(Li){a.push(Li.x),a.push(Li.y)}}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){const e=super.toJSON(),t=this.parameters.shapes,n=this.parameters.options;return pl(t,n,e)}static fromJSON(e,t){const n=[];for(let a=0,o=e.shapes.length;a<o;a++){const u=t[e.shapes[a]];n.push(u)}const i=e.options.extrudePath;return i!==void 0&&(e.options.extrudePath=new ni[i.type]().fromJSON(i)),new wu(n,e.options)}}const hu={generateTopUV:function(s,e,t,n,i){const a=e[t*3],o=e[t*3+1],u=e[n*3],c=e[n*3+1],d=e[i*3],g=e[i*3+1];return[new ce(a,o),new ce(u,c),new ce(d,g)]},generateSideWallUV:function(s,e,t,n,i,a){const o=e[t*3],u=e[t*3+1],c=e[t*3+2],d=e[n*3],g=e[n*3+1],v=e[n*3+2],M=e[i*3],B=e[i*3+1],I=e[i*3+2],ne=e[a*3],ee=e[a*3+1],q=e[a*3+2];return Math.abs(u-g)<Math.abs(o-d)?[new ce(o,1-c),new ce(d,1-v),new ce(M,1-I),new ce(ne,1-q)]:[new ce(u,1-c),new ce(g,1-v),new ce(B,1-I),new ce(ee,1-q)]}};function pl(s,e,t){if(t.shapes=[],Array.isArray(s))for(let n=0,i=s.length;n<i;n++){const a=s[n];t.shapes.push(a.uuid)}else t.shapes.push(s.uuid);return t.options=Object.assign({},e),e.extrudePath!==void 0&&(t.options.extrudePath=e.extrudePath.toJSON()),t}class Nu extends Bf{constructor(e=1,t=0){const n=(1+Math.sqrt(5))/2,i=[-1,n,0,1,n,0,-1,-n,0,1,-n,0,0,-1,n,0,1,n,0,-1,-n,0,1,-n,n,0,-1,n,0,1,-n,0,-1,-n,0,1],a=[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1];super(i,a,e,t),this.type="IcosahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new Nu(e.radius,e.detail)}}class Qh extends ka{constructor(e=[new ce(0,-.5),new ce(.5,0),new ce(0,.5)],t=12,n=0,i=Math.PI*2){super(),this.type="LatheGeometry",this.parameters={points:e,segments:t,phiStart:n,phiLength:i},t=Math.floor(t),i=Ca(i,0,Math.PI*2);const a=[],o=[],u=[],c=[],d=[],g=1/t,v=new le,M=new ce,B=new le,I=new le,ne=new le;let ee=0,q=0;for(let ye=0;ye<=e.length-1;ye++)switch(ye){case 0:ee=e[ye+1].x-e[ye].x,q=e[ye+1].y-e[ye].y,B.x=q*1,B.y=-ee,B.z=q*0,ne.copy(B),B.normalize(),c.push(B.x,B.y,B.z);break;case e.length-1:c.push(ne.x,ne.y,ne.z);break;default:ee=e[ye+1].x-e[ye].x,q=e[ye+1].y-e[ye].y,B.x=q*1,B.y=-ee,B.z=q*0,I.copy(B),B.x+=ne.x,B.y+=ne.y,B.z+=ne.z,B.normalize(),c.push(B.x,B.y,B.z),ne.copy(I)}for(let ye=0;ye<=t;ye++){const Ce=n+ye*g*i,ke=Math.sin(Ce),nt=Math.cos(Ce);for(let Ye=0;Ye<=e.length-1;Ye++){v.x=e[Ye].x*ke,v.y=e[Ye].y,v.z=e[Ye].x*nt,o.push(v.x,v.y,v.z),M.x=ye/t,M.y=Ye/(e.length-1),u.push(M.x,M.y);const ht=c[3*Ye+0]*ke,Rt=c[3*Ye+1],qe=c[3*Ye+0]*nt;d.push(ht,Rt,qe)}}for(let ye=0;ye<t;ye++)for(let Ce=0;Ce<e.length-1;Ce++){const ke=Ce+ye*e.length,nt=ke,Ye=ke+e.length,ht=ke+e.length+1,Rt=ke+1;a.push(nt,Ye,Rt),a.push(ht,Rt,Ye)}this.setIndex(a),this.setAttribute("position",new Ui(o,3)),this.setAttribute("uv",new Ui(u,2)),this.setAttribute("normal",new Ui(d,3))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Qh(e.points,e.segments,e.phiStart,e.phiLength)}}class Ju extends Bf{constructor(e=1,t=0){const n=[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],i=[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2];super(n,i,e,t),this.type="OctahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new Ju(e.radius,e.detail)}}class Tc extends ka{constructor(e=1,t=1,n=1,i=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:n,heightSegments:i};const a=e/2,o=t/2,u=Math.floor(n),c=Math.floor(i),d=u+1,g=c+1,v=e/u,M=t/c,B=[],I=[],ne=[],ee=[];for(let q=0;q<g;q++){const ye=q*M-o;for(let Ce=0;Ce<d;Ce++){const ke=Ce*v-a;I.push(ke,-ye,0),ne.push(0,0,1),ee.push(Ce/u),ee.push(1-q/c)}}for(let q=0;q<c;q++)for(let ye=0;ye<u;ye++){const Ce=ye+d*q,ke=ye+d*(q+1),nt=ye+1+d*(q+1),Ye=ye+1+d*q;B.push(Ce,ke,Ye),B.push(ke,nt,Ye)}this.setIndex(B),this.setAttribute("position",new Ui(I,3)),this.setAttribute("normal",new Ui(ne,3)),this.setAttribute("uv",new Ui(ee,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Tc(e.width,e.height,e.widthSegments,e.heightSegments)}}class If extends ka{constructor(e=.5,t=1,n=32,i=1,a=0,o=Math.PI*2){super(),this.type="RingGeometry",this.parameters={innerRadius:e,outerRadius:t,thetaSegments:n,phiSegments:i,thetaStart:a,thetaLength:o},n=Math.max(3,n),i=Math.max(1,i);const u=[],c=[],d=[],g=[];let v=e;const M=(t-e)/i,B=new le,I=new ce;for(let ne=0;ne<=i;ne++){for(let ee=0;ee<=n;ee++){const q=a+ee/n*o;B.x=v*Math.cos(q),B.y=v*Math.sin(q),c.push(B.x,B.y,B.z),d.push(0,0,1),I.x=(B.x/t+1)/2,I.y=(B.y/t+1)/2,g.push(I.x,I.y)}v+=M}for(let ne=0;ne<i;ne++){const ee=ne*(n+1);for(let q=0;q<n;q++){const ye=q+ee,Ce=ye,ke=ye+n+1,nt=ye+n+2,Ye=ye+1;u.push(Ce,ke,Ye),u.push(ke,nt,Ye)}}this.setIndex(u),this.setAttribute("position",new Ui(c,3)),this.setAttribute("normal",new Ui(d,3)),this.setAttribute("uv",new Ui(g,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new If(e.innerRadius,e.outerRadius,e.thetaSegments,e.phiSegments,e.thetaStart,e.thetaLength)}}class id extends ka{constructor(e=new bi([new ce(0,.5),new ce(-.5,-.5),new ce(.5,-.5)]),t=12){super(),this.type="ShapeGeometry",this.parameters={shapes:e,curveSegments:t};const n=[],i=[],a=[],o=[];let u=0,c=0;if(Array.isArray(e)===!1)d(e);else for(let g=0;g<e.length;g++)d(e[g]),this.addGroup(u,c,g),u+=c,c=0;this.setIndex(n),this.setAttribute("position",new Ui(i,3)),this.setAttribute("normal",new Ui(a,3)),this.setAttribute("uv",new Ui(o,2));function d(g){const v=i.length/3,M=g.extractPoints(t);let B=M.shape;const I=M.holes;eo.isClockWise(B)===!1&&(B=B.reverse());for(let ee=0,q=I.length;ee<q;ee++){const ye=I[ee];eo.isClockWise(ye)===!0&&(I[ee]=ye.reverse())}const ne=eo.triangulateShape(B,I);for(let ee=0,q=I.length;ee<q;ee++){const ye=I[ee];B=B.concat(ye)}for(let ee=0,q=B.length;ee<q;ee++){const ye=B[ee];i.push(ye.x,ye.y,0),a.push(0,0,1),o.push(ye.x,ye.y)}for(let ee=0,q=ne.length;ee<q;ee++){const ye=ne[ee],Ce=ye[0]+v,ke=ye[1]+v,nt=ye[2]+v;n.push(Ce,ke,nt),c+=3}}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){const e=super.toJSON(),t=this.parameters.shapes;return GA(t,e)}static fromJSON(e,t){const n=[];for(let i=0,a=e.shapes.length;i<a;i++){const o=t[e.shapes[i]];n.push(o)}return new id(n,e.curveSegments)}}function GA(s,e){if(e.shapes=[],Array.isArray(s))for(let t=0,n=s.length;t<n;t++){const i=s[t];e.shapes.push(i.uuid)}else e.shapes.push(s.uuid);return e}class sd extends ka{constructor(e=1,t=32,n=16,i=0,a=Math.PI*2,o=0,u=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:n,phiStart:i,phiLength:a,thetaStart:o,thetaLength:u},t=Math.max(3,Math.floor(t)),n=Math.max(2,Math.floor(n));const c=Math.min(o+u,Math.PI);let d=0;const g=[],v=new le,M=new le,B=[],I=[],ne=[],ee=[];for(let q=0;q<=n;q++){const ye=[],Ce=q/n;let ke=0;q===0&&o===0?ke=.5/t:q===n&&c===Math.PI&&(ke=-.5/t);for(let nt=0;nt<=t;nt++){const Ye=nt/t;v.x=-e*Math.cos(i+Ye*a)*Math.sin(o+Ce*u),v.y=e*Math.cos(o+Ce*u),v.z=e*Math.sin(i+Ye*a)*Math.sin(o+Ce*u),I.push(v.x,v.y,v.z),M.copy(v).normalize(),ne.push(M.x,M.y,M.z),ee.push(Ye+ke,1-Ce),ye.push(d++)}g.push(ye)}for(let q=0;q<n;q++)for(let ye=0;ye<t;ye++){const Ce=g[q][ye+1],ke=g[q][ye],nt=g[q+1][ye],Ye=g[q+1][ye+1];(q!==0||o>0)&&B.push(Ce,ke,Ye),(q!==n-1||c<Math.PI)&&B.push(ke,nt,Ye)}this.setIndex(B),this.setAttribute("position",new Ui(I,3)),this.setAttribute("normal",new Ui(ne,3)),this.setAttribute("uv",new Ui(ee,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new sd(e.radius,e.widthSegments,e.heightSegments,e.phiStart,e.phiLength,e.thetaStart,e.thetaLength)}}class lA extends Bf{constructor(e=1,t=0){const n=[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],i=[2,1,0,0,3,2,1,3,0,2,3,1];super(n,i,e,t),this.type="TetrahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new lA(e.radius,e.detail)}}class ef extends ka{constructor(e=1,t=.4,n=12,i=48,a=Math.PI*2){super(),this.type="TorusGeometry",this.parameters={radius:e,tube:t,radialSegments:n,tubularSegments:i,arc:a},n=Math.floor(n),i=Math.floor(i);const o=[],u=[],c=[],d=[],g=new le,v=new le,M=new le;for(let B=0;B<=n;B++)for(let I=0;I<=i;I++){const ne=I/i*a,ee=B/n*Math.PI*2;v.x=(e+t*Math.cos(ee))*Math.cos(ne),v.y=(e+t*Math.cos(ee))*Math.sin(ne),v.z=t*Math.sin(ee),u.push(v.x,v.y,v.z),g.x=e*Math.cos(ne),g.y=e*Math.sin(ne),M.subVectors(v,g).normalize(),c.push(M.x,M.y,M.z),d.push(I/i),d.push(B/n)}for(let B=1;B<=n;B++)for(let I=1;I<=i;I++){const ne=(i+1)*B+I-1,ee=(i+1)*(B-1)+I-1,q=(i+1)*(B-1)+I,ye=(i+1)*B+I;o.push(ne,ee,ye),o.push(ee,q,ye)}this.setIndex(o),this.setAttribute("position",new Ui(u,3)),this.setAttribute("normal",new Ui(c,3)),this.setAttribute("uv",new Ui(d,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new ef(e.radius,e.tube,e.radialSegments,e.tubularSegments,e.arc)}}class Nf extends ka{constructor(e=1,t=.4,n=64,i=8,a=2,o=3){super(),this.type="TorusKnotGeometry",this.parameters={radius:e,tube:t,tubularSegments:n,radialSegments:i,p:a,q:o},n=Math.floor(n),i=Math.floor(i);const u=[],c=[],d=[],g=[],v=new le,M=new le,B=new le,I=new le,ne=new le,ee=new le,q=new le;for(let Ce=0;Ce<=n;++Ce){const ke=Ce/n*a*Math.PI*2;ye(ke,a,o,e,B),ye(ke+.01,a,o,e,I),ee.subVectors(I,B),q.addVectors(I,B),ne.crossVectors(ee,q),q.crossVectors(ne,ee),ne.normalize(),q.normalize();for(let nt=0;nt<=i;++nt){const Ye=nt/i*Math.PI*2,ht=-t*Math.cos(Ye),Rt=t*Math.sin(Ye);v.x=B.x+(ht*q.x+Rt*ne.x),v.y=B.y+(ht*q.y+Rt*ne.y),v.z=B.z+(ht*q.z+Rt*ne.z),c.push(v.x,v.y,v.z),M.subVectors(v,B).normalize(),d.push(M.x,M.y,M.z),g.push(Ce/n),g.push(nt/i)}}for(let Ce=1;Ce<=n;Ce++)for(let ke=1;ke<=i;ke++){const nt=(i+1)*(Ce-1)+(ke-1),Ye=(i+1)*Ce+(ke-1),ht=(i+1)*Ce+ke,Rt=(i+1)*(Ce-1)+ke;u.push(nt,Ye,Rt),u.push(Ye,ht,Rt)}this.setIndex(u),this.setAttribute("position",new Ui(c,3)),this.setAttribute("normal",new Ui(d,3)),this.setAttribute("uv",new Ui(g,2));function ye(Ce,ke,nt,Ye,ht){const Rt=Math.cos(Ce),qe=Math.sin(Ce),pt=nt/ke*Ce,xn=Math.cos(pt);ht.x=Ye*(2+xn)*.5*Rt,ht.y=Ye*(2+xn)*qe*.5,ht.z=Ye*Math.sin(pt)*.5}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Nf(e.radius,e.tube,e.tubularSegments,e.radialSegments,e.p,e.q)}}class Td extends ka{constructor(e=new Zn(new le(-1,-1,0),new le(-1,1,0),new le(1,1,0)),t=64,n=1,i=8,a=!1){super(),this.type="TubeGeometry",this.parameters={path:e,tubularSegments:t,radius:n,radialSegments:i,closed:a};const o=e.computeFrenetFrames(t,a);this.tangents=o.tangents,this.normals=o.normals,this.binormals=o.binormals;const u=new le,c=new le,d=new ce;let g=new le;const v=[],M=[],B=[],I=[];ne(),this.setIndex(I),this.setAttribute("position",new Ui(v,3)),this.setAttribute("normal",new Ui(M,3)),this.setAttribute("uv",new Ui(B,2));function ne(){for(let Ce=0;Ce<t;Ce++)ee(Ce);ee(a===!1?t:0),ye(),q()}function ee(Ce){g=e.getPointAt(Ce/t,g);const ke=o.normals[Ce],nt=o.binormals[Ce];for(let Ye=0;Ye<=i;Ye++){const ht=Ye/i*Math.PI*2,Rt=Math.sin(ht),qe=-Math.cos(ht);c.x=qe*ke.x+Rt*nt.x,c.y=qe*ke.y+Rt*nt.y,c.z=qe*ke.z+Rt*nt.z,c.normalize(),M.push(c.x,c.y,c.z),u.x=g.x+n*c.x,u.y=g.y+n*c.y,u.z=g.z+n*c.z,v.push(u.x,u.y,u.z)}}function q(){for(let Ce=1;Ce<=t;Ce++)for(let ke=1;ke<=i;ke++){const nt=(i+1)*(Ce-1)+(ke-1),Ye=(i+1)*Ce+(ke-1),ht=(i+1)*Ce+ke,Rt=(i+1)*(Ce-1)+ke;I.push(nt,Ye,Rt),I.push(Ye,ht,Rt)}}function ye(){for(let Ce=0;Ce<=t;Ce++)for(let ke=0;ke<=i;ke++)d.x=Ce/t,d.y=ke/i,B.push(d.x,d.y)}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){const e=super.toJSON();return e.path=this.parameters.path.toJSON(),e}static fromJSON(e){return new Td(new ni[e.path.type]().fromJSON(e.path),e.tubularSegments,e.radius,e.radialSegments,e.closed)}}class Gp extends ka{constructor(e=null){if(super(),this.type="WireframeGeometry",this.parameters={geometry:e},e!==null){const t=[],n=new Set,i=new le,a=new le;if(e.index!==null){const o=e.attributes.position,u=e.index;let c=e.groups;c.length===0&&(c=[{start:0,count:u.count,materialIndex:0}]);for(let d=0,g=c.length;d<g;++d){const v=c[d],M=v.start,B=v.count;for(let I=M,ne=M+B;I<ne;I+=3)for(let ee=0;ee<3;ee++){const q=u.getX(I+ee),ye=u.getX(I+(ee+1)%3);i.fromBufferAttribute(o,q),a.fromBufferAttribute(o,ye),Hp(i,a,n)===!0&&(t.push(i.x,i.y,i.z),t.push(a.x,a.y,a.z))}}}else{const o=e.attributes.position;for(let u=0,c=o.count/3;u<c;u++)for(let d=0;d<3;d++){const g=3*u+d,v=3*u+(d+1)%3;i.fromBufferAttribute(o,g),a.fromBufferAttribute(o,v),Hp(i,a,n)===!0&&(t.push(i.x,i.y,i.z),t.push(a.x,a.y,a.z))}}this.setAttribute("position",new Ui(t,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}}function Hp(s,e,t){const n=`${s.x},${s.y},${s.z}-${e.x},${e.y},${e.z}`,i=`${e.x},${e.y},${e.z}-${s.x},${s.y},${s.z}`;return t.has(n)===!0||t.has(i)===!0?!1:(t.add(n),t.add(i),!0)}var Ex=Object.freeze({__proto__:null,BoxGeometry:bd,CapsuleGeometry:ll,CircleGeometry:hc,ConeGeometry:Rh,CylinderGeometry:Cc,DodecahedronGeometry:Rf,EdgesGeometry:mm,ExtrudeGeometry:wu,IcosahedronGeometry:Nu,LatheGeometry:Qh,OctahedronGeometry:Ju,PlaneGeometry:Tc,PolyhedronGeometry:Bf,RingGeometry:If,ShapeGeometry:id,SphereGeometry:sd,TetrahedronGeometry:lA,TorusGeometry:ef,TorusKnotGeometry:Nf,TubeGeometry:Td,WireframeGeometry:Gp});class Cx extends Hl{constructor(e){super(),this.isShadowMaterial=!0,this.type="ShadowMaterial",this.color=new Wr(0),this.transparent=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.fog=e.fog,this}}class Tx extends nh{constructor(e){super(e),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}}class $v extends Hl{constructor(e){super(),this.isMeshStandardMaterial=!0,this.type="MeshStandardMaterial",this.defines={STANDARD:""},this.color=new Wr(16777215),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Wr(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Ll,this.normalScale=new ce(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Ua,this.envMapIntensity=1,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.defines={STANDARD:""},this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,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.roughnessMap=e.roughnessMap,this.metalnessMap=e.metalnessMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.envMapIntensity=e.envMapIntensity,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 Qp extends $v{constructor(e){super(),this.isMeshPhysicalMaterial=!0,this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.anisotropyRotation=0,this.anisotropyMap=null,this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new ce(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return Ca(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(t){this.ior=(1+.4*t)/(1-.4*t)}}),this.iridescenceMap=null,this.iridescenceIOR=1.3,this.iridescenceThicknessRange=[100,400],this.iridescenceThicknessMap=null,this.sheenColor=new Wr(0),this.sheenColorMap=null,this.sheenRoughness=1,this.sheenRoughnessMap=null,this.transmissionMap=null,this.thickness=0,this.thicknessMap=null,this.attenuationDistance=1/0,this.attenuationColor=new Wr(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new Wr(1,1,1),this.specularColorMap=null,this._anisotropy=0,this._clearcoat=0,this._dispersion=0,this._iridescence=0,this._sheen=0,this._transmission=0,this.setValues(e)}get anisotropy(){return this._anisotropy}set anisotropy(e){this._anisotropy>0!=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 Xv extends Hl{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new Wr(16777215),this.specular=new Wr(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Wr(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Ll,this.normalScale=new ce(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Ua,this.combine=on,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 jv extends Hl{constructor(e){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new Wr(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Wr(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Ll,this.normalScale=new ce(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 V0 extends Hl{constructor(e){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Ll,this.normalScale=new ce(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 qm extends Hl{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new Wr(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Wr(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Ll,this.normalScale=new ce(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Ua,this.combine=on,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 Bx extends Hl{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=bo,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 Rx extends Hl{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 nw extends Hl{constructor(e){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new Wr(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Ll,this.normalScale=new ce(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,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.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.flatShading=e.flatShading,this.fog=e.fog,this}}class xm extends fl{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}}function Bg(s,e){return!s||s.constructor===e?s:typeof e.BYTES_PER_ELEMENT=="number"?new e(s):Array.prototype.slice.call(s)}function Yv(s){function e(i,a){return s[i]-s[a]}const t=s.length,n=new Array(t);for(let i=0;i!==t;++i)n[i]=i;return n.sort(e),n}function qv(s,e,t){const n=s.length,i=new s.constructor(n);for(let a=0,o=0;o!==n;++a){const u=t[a]*e;for(let c=0;c!==e;++c)i[o++]=s[u+c]}return i}function tf(s,e,t,n){let i=1,a=s[0];for(;a!==void 0&&a[n]===void 0;)a=s[i++];if(a===void 0)return;let o=a[n];if(o!==void 0)if(Array.isArray(o))do o=a[n],o!==void 0&&(e.push(a.time),t.push(...o)),a=s[i++];while(a!==void 0);else if(o.toArray!==void 0)do o=a[n],o!==void 0&&(e.push(a.time),o.toArray(t,t.length)),a=s[i++];while(a!==void 0);else do o=a[n],o!==void 0&&(e.push(a.time),t.push(o)),a=s[i++];while(a!==void 0)}function bm(s,e,t,n,i=30){const a=s.clone();a.name=e;const o=[];for(let c=0;c<a.tracks.length;++c){const d=a.tracks[c],g=d.getValueSize(),v=[],M=[];for(let B=0;B<d.times.length;++B){const I=d.times[B]*i;if(!(I<t||I>=n)){v.push(d.times[B]);for(let ne=0;ne<g;++ne)M.push(d.values[B*g+ne])}}v.length!==0&&(d.times=Bg(v,d.times.constructor),d.values=Bg(M,d.values.constructor),o.push(d))}a.tracks=o;let u=1/0;for(let c=0;c<a.tracks.length;++c)u>a.tracks[c].times[0]&&(u=a.tracks[c].times[0]);for(let c=0;c<a.tracks.length;++c)a.tracks[c].shift(-1*u);return a.resetDuration(),a}function Ix(s,e=0,t=s,n=30){n<=0&&(n=30);const i=t.tracks.length,a=e/n;for(let o=0;o<i;++o){const u=t.tracks[o],c=u.ValueTypeName;if(c==="bool"||c==="string")continue;const d=s.tracks.find(function(q){return q.name===u.name&&q.ValueTypeName===c});if(d===void 0)continue;let g=0;const v=u.getValueSize();u.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(g=v/3);let M=0;const B=d.getValueSize();d.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(M=B/3);const I=u.times.length-1;let ne;if(a<=u.times[0]){const q=g,ye=v-g;ne=u.values.slice(q,ye)}else if(a>=u.times[I]){const q=I*v+g,ye=q+v-g;ne=u.values.slice(q,ye)}else{const q=u.createInterpolant(),ye=g,Ce=v-g;q.evaluate(a),ne=q.resultBuffer.slice(ye,Ce)}c==="quaternion"&&new Ze().fromArray(ne).normalize().conjugate().toArray(ne);const ee=d.times.length;for(let q=0;q<ee;++q){const ye=q*B+M;if(c==="quaternion")Ze.multiplyQuaternionsFlat(d.values,ye,ne,0,d.values,ye);else{const Ce=B-M*2;for(let ke=0;ke<Ce;++ke)d.values[ye+ke]-=ne[ke]}}}return s.blendMode=$a,s}class Jv{static convertArray(e,t){return Bg(e,t)}static isTypedArray(e){return na(e)}static getKeyframeOrder(e){return Yv(e)}static sortedArray(e,t,n){return qv(e,t,n)}static flattenJSON(e,t,n,i){tf(e,t,n,i)}static subclip(e,t,n,i,a=30){return bm(e,t,n,i,a)}static makeClipAdditive(e,t=0,n=e,i=30){return Ix(e,t,n,i)}}class z0{constructor(e,t,n,i){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=i!==void 0?i:new t.constructor(n),this.sampleValues=t,this.valueSize=n,this.settings=null,this.DefaultSettings_={}}evaluate(e){const t=this.parameterPositions;let n=this._cachedIndex,i=t[n],a=t[n-1];e:{t:{let o;n:{r:if(!(e<i)){for(let u=n+2;;){if(i===void 0){if(e<a)break r;return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}if(n===u)break;if(a=i,i=t[++n],e<i)break t}o=t.length;break n}if(!(e>=a)){const u=t[1];e<u&&(n=2,a=u);for(let c=n-2;;){if(a===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(n===c)break;if(i=a,a=t[--n-1],e>=a)break t}o=n,n=0;break n}break e}for(;n<o;){const u=n+o>>>1;e<t[u]?o=u:n=u+1}if(i=t[n],a=t[n-1],a===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(i===void 0)return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}this._cachedIndex=n,this.intervalChanged_(n,a,i)}return this.interpolate_(n,a,e,i)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(e){const t=this.resultBuffer,n=this.sampleValues,i=this.valueSize,a=e*i;for(let o=0;o!==i;++o)t[o]=n[a+o];return t}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}}class G0 extends z0{constructor(e,t,n,i){super(e,t,n,i),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:Aa,endingEnd:Aa}}intervalChanged_(e,t,n){const i=this.parameterPositions;let a=e-2,o=e+1,u=i[a],c=i[o];if(u===void 0)switch(this.getSettings_().endingStart){case sa:a=e,u=2*t-n;break;case ca:a=i.length-2,u=t+i[a]-i[a+1];break;default:a=e,u=n}if(c===void 0)switch(this.getSettings_().endingEnd){case sa:o=e,c=2*n-t;break;case ca:o=1,c=n+i[1]-i[0];break;default:o=e-1,c=t}const d=(n-t)*.5,g=this.valueSize;this._weightPrev=d/(t-u),this._weightNext=d/(c-n),this._offsetPrev=a*g,this._offsetNext=o*g}interpolate_(e,t,n,i){const a=this.resultBuffer,o=this.sampleValues,u=this.valueSize,c=e*u,d=c-u,g=this._offsetPrev,v=this._offsetNext,M=this._weightPrev,B=this._weightNext,I=(n-t)/(i-t),ne=I*I,ee=ne*I,q=-M*ee+2*M*ne-M*I,ye=(1+M)*ee+(-1.5-2*M)*ne+(-.5+M)*I+1,Ce=(-1-B)*ee+(1.5+B)*ne+.5*I,ke=B*ee-B*ne;for(let nt=0;nt!==u;++nt)a[nt]=q*o[g+nt]+ye*o[d+nt]+Ce*o[c+nt]+ke*o[v+nt];return a}}class Rg extends z0{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){const a=this.resultBuffer,o=this.sampleValues,u=this.valueSize,c=e*u,d=c-u,g=(n-t)/(i-t),v=1-g;for(let M=0;M!==u;++M)a[M]=o[d+M]*v+o[c+M]*g;return a}}class H0 extends z0{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e){return this.copySampleValue_(e-1)}}class Bd{constructor(e,t,n,i){if(e===void 0)throw new Error("THREE.KeyframeTrack: track name is undefined");if(t===void 0||t.length===0)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+e);this.name=e,this.times=Bg(t,this.TimeBufferType),this.values=Bg(n,this.ValueBufferType),this.setInterpolation(i||this.DefaultInterpolation)}static toJSON(e){const t=e.constructor;let n;if(t.toJSON!==this.toJSON)n=t.toJSON(e);else{n={name:e.name,times:Bg(e.times,Array),values:Bg(e.values,Array)};const i=e.getInterpolation();i!==e.DefaultInterpolation&&(n.interpolation=i)}return n.type=e.ValueTypeName,n}InterpolantFactoryMethodDiscrete(e){return new H0(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new Rg(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new G0(this.times,this.values,this.getValueSize(),e)}setInterpolation(e){let t;switch(e){case ss:t=this.InterpolantFactoryMethodDiscrete;break;case vs:t=this.InterpolantFactoryMethodLinear;break;case Cs:t=this.InterpolantFactoryMethodSmooth;break}if(t===void 0){const n="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(this.createInterpolant===void 0)if(e!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw new Error(n);return Lr("KeyframeTrack:",n),this}return this.createInterpolant=t,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return ss;case this.InterpolantFactoryMethodLinear:return vs;case this.InterpolantFactoryMethodSmooth:return Cs}}getValueSize(){return this.values.length/this.times.length}shift(e){if(e!==0){const t=this.times;for(let n=0,i=t.length;n!==i;++n)t[n]+=e}return this}scale(e){if(e!==1){const t=this.times;for(let n=0,i=t.length;n!==i;++n)t[n]*=e}return this}trim(e,t){const n=this.times,i=n.length;let a=0,o=i-1;for(;a!==i&&n[a]<e;)++a;for(;o!==-1&&n[o]>t;)--o;if(++o,a!==0||o!==i){a>=o&&(o=Math.max(o,1),a=o-1);const u=this.getValueSize();this.times=n.slice(a,o),this.values=this.values.slice(a*u,o*u)}return this}validate(){let e=!0;const t=this.getValueSize();t-Math.floor(t)!==0&&(Gr("KeyframeTrack: Invalid value size in track.",this),e=!1);const n=this.times,i=this.values,a=n.length;a===0&&(Gr("KeyframeTrack: Track is empty.",this),e=!1);let o=null;for(let u=0;u!==a;u++){const c=n[u];if(typeof c=="number"&&isNaN(c)){Gr("KeyframeTrack: Time is not a valid number.",this,u,c),e=!1;break}if(o!==null&&o>c){Gr("KeyframeTrack: Out of order keys.",this,u,c,o),e=!1;break}o=c}if(i!==void 0&&na(i))for(let u=0,c=i.length;u!==c;++u){const d=i[u];if(isNaN(d)){Gr("KeyframeTrack: Value is not a valid number.",this,u,d),e=!1;break}}return e}optimize(){const e=this.times.slice(),t=this.values.slice(),n=this.getValueSize(),i=this.getInterpolation()===Cs,a=e.length-1;let o=1;for(let u=1;u<a;++u){let c=!1;const d=e[u],g=e[u+1];if(d!==g&&(u!==1||d!==e[0]))if(i)c=!0;else{const v=u*n,M=v-n,B=v+n;for(let I=0;I!==n;++I){const ne=t[v+I];if(ne!==t[M+I]||ne!==t[B+I]){c=!0;break}}}if(c){if(u!==o){e[o]=e[u];const v=u*n,M=o*n;for(let B=0;B!==n;++B)t[M+B]=t[v+B]}++o}}if(a>0){e[o]=e[a];for(let u=a*n,c=o*n,d=0;d!==n;++d)t[c+d]=t[u+d];++o}return o!==e.length?(this.times=e.slice(0,o),this.values=t.slice(0,o*n)):(this.times=e,this.values=t),this}clone(){const e=this.times.slice(),t=this.values.slice(),n=this.constructor,i=new n(this.name,e,t);return i.createInterpolant=this.createInterpolant,i}}Bd.prototype.ValueTypeName="",Bd.prototype.TimeBufferType=Float32Array,Bd.prototype.ValueBufferType=Float32Array,Bd.prototype.DefaultInterpolation=vs;class _m extends Bd{constructor(e,t,n){super(e,t,n)}}_m.prototype.ValueTypeName="bool",_m.prototype.ValueBufferType=Array,_m.prototype.DefaultInterpolation=ss,_m.prototype.InterpolantFactoryMethodLinear=void 0,_m.prototype.InterpolantFactoryMethodSmooth=void 0;class Nx extends Bd{constructor(e,t,n,i){super(e,t,n,i)}}Nx.prototype.ValueTypeName="color";class Ff extends Bd{constructor(e,t,n,i){super(e,t,n,i)}}Ff.prototype.ValueTypeName="number";class Fx extends z0{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){const a=this.resultBuffer,o=this.sampleValues,u=this.valueSize,c=(n-t)/(i-t);let d=e*u;for(let g=d+u;d!==g;d+=4)Ze.slerpFlat(a,0,o,d-u,o,d,c);return a}}class Q0 extends Bd{constructor(e,t,n,i){super(e,t,n,i)}InterpolantFactoryMethodLinear(e){return new Fx(this.times,this.values,this.getValueSize(),e)}}Q0.prototype.ValueTypeName="quaternion",Q0.prototype.InterpolantFactoryMethodSmooth=void 0;class wm extends Bd{constructor(e,t,n){super(e,t,n)}}wm.prototype.ValueTypeName="string",wm.prototype.ValueBufferType=Array,wm.prototype.DefaultInterpolation=ss,wm.prototype.InterpolantFactoryMethodLinear=void 0,wm.prototype.InterpolantFactoryMethodSmooth=void 0;class Pf extends Bd{constructor(e,t,n,i){super(e,t,n,i)}}Pf.prototype.ValueTypeName="vector";class W0{constructor(e="",t=-1,n=[],i=Ai){this.name=e,this.tracks=n,this.duration=t,this.blendMode=i,this.uuid=oc(),this.userData={},this.duration<0&&this.resetDuration()}static parse(e){const t=[],n=e.tracks,i=1/(e.fps||1);for(let o=0,u=n.length;o!==u;++o)t.push(PE(n[o]).scale(i));const a=new this(e.name,e.duration,t,e.blendMode);return a.uuid=e.uuid,a.userData=JSON.parse(e.userData||"{}"),a}static toJSON(e){const t=[],n=e.tracks,i={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode,userData:JSON.stringify(e.userData)};for(let a=0,o=n.length;a!==o;++a)t.push(Bd.toJSON(n[a]));return i}static CreateFromMorphTargetSequence(e,t,n,i){const a=t.length,o=[];for(let u=0;u<a;u++){let c=[],d=[];c.push((u+a-1)%a,u,(u+1)%a),d.push(0,1,0);const g=Yv(c);c=qv(c,1,g),d=qv(d,1,g),!i&&c[0]===0&&(c.push(a),d.push(d[0])),o.push(new Ff(".morphTargetInfluences["+t[u].name+"]",c,d).scale(1/n))}return new this(e,-1,o)}static findByName(e,t){let n=e;if(!Array.isArray(e)){const i=e;n=i.geometry&&i.geometry.animations||i.animations}for(let i=0;i<n.length;i++)if(n[i].name===t)return n[i];return null}static CreateClipsFromMorphTargetSequences(e,t,n){const i={},a=/^([\w-]*?)([\d]+)$/;for(let u=0,c=e.length;u<c;u++){const d=e[u],g=d.name.match(a);if(g&&g.length>1){const v=g[1];let M=i[v];M||(i[v]=M=[]),M.push(d)}}const o=[];for(const u in i)o.push(this.CreateFromMorphTargetSequence(u,i[u],t,n));return o}static parseAnimation(e,t){if(Lr("AnimationClip: parseAnimation() is deprecated and will be removed with r185"),!e)return Gr("AnimationClip: No animation in JSONLoader data."),null;const n=function(v,M,B,I,ne){if(B.length!==0){const ee=[],q=[];tf(B,ee,q,I),ee.length!==0&&ne.push(new v(M,ee,q))}},i=[],a=e.name||"default",o=e.fps||30,u=e.blendMode;let c=e.length||-1;const d=e.hierarchy||[];for(let v=0;v<d.length;v++){const M=d[v].keys;if(!(!M||M.length===0))if(M[0].morphTargets){const B={};let I;for(I=0;I<M.length;I++)if(M[I].morphTargets)for(let ne=0;ne<M[I].morphTargets.length;ne++)B[M[I].morphTargets[ne]]=-1;for(const ne in B){const ee=[],q=[];for(let ye=0;ye!==M[I].morphTargets.length;++ye){const Ce=M[I];ee.push(Ce.time),q.push(Ce.morphTarget===ne?1:0)}i.push(new Ff(".morphTargetInfluence["+ne+"]",ee,q))}c=B.length*o}else{const B=".bones["+t[v].name+"]";n(Pf,B+".position",M,"pos",i),n(Q0,B+".quaternion",M,"rot",i),n(Pf,B+".scale",M,"scl",i)}}return i.length===0?null:new this(a,c,i,u)}resetDuration(){const e=this.tracks;let t=0;for(let n=0,i=e.length;n!==i;++n){const a=this.tracks[n];t=Math.max(t,a.times[a.times.length-1])}return this.duration=t,this}trim(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].trim(0,this.duration);return this}validate(){let e=!0;for(let t=0;t<this.tracks.length;t++)e=e&&this.tracks[t].validate();return e}optimize(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].optimize();return this}clone(){const e=[];for(let n=0;n<this.tracks.length;n++)e.push(this.tracks[n].clone());const t=new this.constructor(this.name,this.duration,e,this.blendMode);return t.userData=JSON.parse(JSON.stringify(this.userData)),t}toJSON(){return this.constructor.toJSON(this)}}function Wp(s){switch(s.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return Ff;case"vector":case"vector2":case"vector3":case"vector4":return Pf;case"color":return Nx;case"quaternion":return Q0;case"bool":case"boolean":return _m;case"string":return wm}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+s)}function PE(s){if(s.type===void 0)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");const e=Wp(s.type);if(s.times===void 0){const t=[],n=[];tf(s.keys,t,n,"value"),s.times=t,s.values=n}return e.parse!==void 0?e.parse(s):new e(s.name,s.times,s.values,s.interpolation)}const Zp={enabled:!1,files:{},add:function(s,e){this.enabled!==!1&&(this.files[s]=e)},get:function(s){if(this.enabled!==!1)return this.files[s]},remove:function(s){delete this.files[s]},clear:function(){this.files={}}};class Ig{constructor(e,t,n){const i=this;let a=!1,o=0,u=0,c;const d=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=n,this._abortController=null,this.itemStart=function(g){u++,a===!1&&i.onStart!==void 0&&i.onStart(g,o,u),a=!0},this.itemEnd=function(g){o++,i.onProgress!==void 0&&i.onProgress(g,o,u),o===u&&(a=!1,i.onLoad!==void 0&&i.onLoad())},this.itemError=function(g){i.onError!==void 0&&i.onError(g)},this.resolveURL=function(g){return c?c(g):g},this.setURLModifier=function(g){return c=g,this},this.addHandler=function(g,v){return d.push(g,v),this},this.removeHandler=function(g){const v=d.indexOf(g);return v!==-1&&d.splice(v,2),this},this.getHandler=function(g){for(let v=0,M=d.length;v<M;v+=2){const B=d[v],I=d[v+1];if(B.global&&(B.lastIndex=0),B.test(g))return I}return null},this.abort=function(){return this.abortController.abort(),this._abortController=null,this}}get abortController(){return this._abortController||(this._abortController=new AbortController),this._abortController}}const Z0=new Ig;class Px{constructor(e){this.manager=e!==void 0?e:Z0,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(e,t){const n=this;return new Promise(function(i,a){n.load(e,i,t,a)})}parse(){}setCrossOrigin(e){return this.crossOrigin=e,this}setWithCredentials(e){return this.withCredentials=e,this}setPath(e){return this.path=e,this}setResourcePath(e){return this.resourcePath=e,this}setRequestHeader(e){return this.requestHeader=e,this}abort(){return this}}Px.DEFAULT_MATERIAL_NAME="__DEFAULT";const Kp={};class LE extends null{constructor(e,t){super(e),this.response=t}}class Ng extends null{constructor(e){super(e),this.mimeType="",this.responseType="",this._abortController=new AbortController}load(e,t,n,i){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const a=Zp.get(`file:${e}`);if(a!==void 0)return this.manager.itemStart(e),setTimeout(()=>{t&&t(a),this.manager.itemEnd(e)},0),a;if(Kp[e]!==void 0){Kp[e].push({onLoad:t,onProgress:n,onError:i});return}Kp[e]=[],Kp[e].push({onLoad:t,onProgress:n,onError:i});const o=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin",signal:typeof AbortSignal.any=="function"?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal}),u=this.mimeType,c=this.responseType;fetch(o).then(d=>{if(d.status===200||d.status===0){if(d.status===0&&Lr("FileLoader: HTTP Status 0 received."),typeof ReadableStream=="undefined"||d.body===void 0||d.body.getReader===void 0)return d;const g=Kp[e],v=d.body.getReader(),M=d.headers.get("X-File-Size")||d.headers.get("Content-Length"),B=M?parseInt(M):0,I=B!==0;let ne=0;const ee=new ReadableStream({start(q){ye();function ye(){v.read().then(({done:Ce,value:ke})=>{if(Ce)q.close();else{ne+=ke.byteLength;const nt=new ProgressEvent("progress",{lengthComputable:I,loaded:ne,total:B});for(let Ye=0,ht=g.length;Ye<ht;Ye++){const Rt=g[Ye];Rt.onProgress&&Rt.onProgress(nt)}q.enqueue(ke),ye()}},Ce=>{q.error(Ce)})}}});return new Response(ee)}else throw new LE(`fetch for "${d.url}" responded with ${d.status}: ${d.statusText}`,d)}).then(d=>{switch(c){case"arraybuffer":return d.arrayBuffer();case"blob":return d.blob();case"document":return d.text().then(g=>new DOMParser().parseFromString(g,u));case"json":return d.json();default:if(u==="")return d.text();{const v=/charset="?([^;"\s]*)"?/i.exec(u),M=v&&v[1]?v[1].toLowerCase():void 0,B=new TextDecoder(M);return d.arrayBuffer().then(I=>B.decode(I))}}}).then(d=>{Zp.add(`file:${e}`,d);const g=Kp[e];delete Kp[e];for(let v=0,M=g.length;v<M;v++){const B=g[v];B.onLoad&&B.onLoad(d)}}).catch(d=>{const g=Kp[e];if(g===void 0)throw this.manager.itemError(e),d;delete Kp[e];for(let v=0,M=g.length;v<M;v++){const B=g[v];B.onError&&B.onError(d)}this.manager.itemError(e)}).finally(()=>{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}}class UE extends null{constructor(e){super(e)}load(e,t,n,i){const a=this,o=new Ng(this.manager);o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,function(u){try{t(a.parse(JSON.parse(u)))}catch(c){i?i(c):Gr(c),a.manager.itemError(e)}},n,i)}parse(e){const t=[];for(let n=0;n<e.length;n++){const i=W0.parse(e[n]);t.push(i)}return t}}class Lx extends null{constructor(e){super(e)}load(e,t,n,i){const a=this,o=[],u=new DA,c=new Ng(this.manager);c.setPath(this.path),c.setResponseType("arraybuffer"),c.setRequestHeader(this.requestHeader),c.setWithCredentials(a.withCredentials);let d=0;function g(v){c.load(e[v],function(M){const B=a.parse(M,!0);o[v]={width:B.width,height:B.height,format:B.format,mipmaps:B.mipmaps},d+=1,d===6&&(B.mipmapCount===1&&(u.minFilter=vr),u.image=o,u.format=B.format,u.needsUpdate=!0,t&&t(u))},n,i)}if(Array.isArray(e))for(let v=0,M=e.length;v<M;++v)g(v);else c.load(e,function(v){const M=a.parse(v,!0);if(M.isCubemap){const B=M.mipmaps.length/M.mipmapCount;for(let I=0;I<B;I++){o[I]={mipmaps:[]};for(let ne=0;ne<M.mipmapCount;ne++)o[I].mipmaps.push(M.mipmaps[I*M.mipmapCount+ne]),o[I].format=M.format,o[I].width=M.width,o[I].height=M.height}u.image=o}else u.image.width=M.width,u.image.height=M.height,u.mipmaps=M.mipmaps;M.mipmapCount===1&&(u.minFilter=vr),u.format=M.format,u.needsUpdate=!0,t&&t(u)},n,i);return u}}const Fg=new WeakMap;class Jm extends Px{constructor(e){super(e)}load(e,t,n,i){this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const a=this,o=Zp.get(`image:${e}`);if(o!==void 0){if(o.complete===!0)a.manager.itemStart(e),setTimeout(function(){t&&t(o),a.manager.itemEnd(e)},0);else{let v=Fg.get(o);v===void 0&&(v=[],Fg.set(o,v)),v.push({onLoad:t,onError:i})}return o}const u=Wa("img");function c(){g(),t&&t(this);const v=Fg.get(this)||[];for(let M=0;M<v.length;M++){const B=v[M];B.onLoad&&B.onLoad(this)}Fg.delete(this),a.manager.itemEnd(e)}function d(v){g(),i&&i(v),Zp.remove(`image:${e}`);const M=Fg.get(this)||[];for(let B=0;B<M.length;B++){const I=M[B];I.onError&&I.onError(v)}Fg.delete(this),a.manager.itemError(e),a.manager.itemEnd(e)}function g(){u.removeEventListener("load",c,!1),u.removeEventListener("error",d,!1)}return u.addEventListener("load",c,!1),u.addEventListener("error",d,!1),e.slice(0,5)!=="data:"&&this.crossOrigin!==void 0&&(u.crossOrigin=this.crossOrigin),Zp.add(`image:${e}`,u),a.manager.itemStart(e),u.src=e,u}}class BP extends null{constructor(e){super(e)}load(e,t,n,i){const a=new rh;a.colorSpace=sl;const o=new Jm(this.manager);o.setCrossOrigin(this.crossOrigin),o.setPath(this.path);let u=0;function c(d){o.load(e[d],function(g){a.images[d]=g,u++,u===6&&(a.needsUpdate=!0,t&&t(a))},void 0,i)}for(let d=0;d<e.length;++d)c(d);return a}}class OE extends null{constructor(e){super(e)}load(e,t,n,i){const a=this,o=new ah,u=new Ng(this.manager);return u.setResponseType("arraybuffer"),u.setRequestHeader(this.requestHeader),u.setPath(this.path),u.setWithCredentials(a.withCredentials),u.load(e,function(c){let d;try{d=a.parse(c)}catch(g){if(i!==void 0)i(g);else{g(g);return}}d.image!==void 0?o.image=d.image:d.data!==void 0&&(o.image.width=d.width,o.image.height=d.height,o.image.data=d.data),o.wrapS=d.wrapS!==void 0?d.wrapS:Vt,o.wrapT=d.wrapT!==void 0?d.wrapT:Vt,o.magFilter=d.magFilter!==void 0?d.magFilter:vr,o.minFilter=d.minFilter!==void 0?d.minFilter:vr,o.anisotropy=d.anisotropy!==void 0?d.anisotropy:1,d.colorSpace!==void 0&&(o.colorSpace=d.colorSpace),d.flipY!==void 0&&(o.flipY=d.flipY),d.format!==void 0&&(o.format=d.format),d.type!==void 0&&(o.type=d.type),d.mipmaps!==void 0&&(o.mipmaps=d.mipmaps,o.minFilter=yi),d.mipmapCount===1&&(o.minFilter=vr),d.generateMipmaps!==void 0&&(o.generateMipmaps=d.generateMipmaps),o.needsUpdate=!0,t&&t(o,d)},n,i),o}}class rw extends Px{constructor(e){super(e)}load(e,t,n,i){const a=new zi,o=new Jm(this.manager);return o.setCrossOrigin(this.crossOrigin),o.setPath(this.path),o.load(e,function(u){a.image=u,a.needsUpdate=!0,t!==void 0&&t(a)},n,i),a}}class $p extends yl{constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new Wr(e),this.intensity=t}dispose(){this.dispatchEvent({type:"dispose"})}copy(e,t){return super.copy(e,t),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){const t=super.toJSON(e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,t}}class Sm extends $p{constructor(e,t,n){super(e,n),this.isHemisphereLight=!0,this.type="HemisphereLight",this.position.copy(yl.DEFAULT_UP),this.updateMatrix(),this.groundColor=new Wr(t)}copy(e,t){return super.copy(e,t),this.groundColor.copy(e.groundColor),this}toJSON(e){const t=super.toJSON(e);return t.object.groundColor=this.groundColor.getHex(),t}}const e0=new di,Ux=new le,Ox=new le;class K0{constructor(e){this.camera=e,this.intensity=1,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new ce(512,512),this.mapType=es,this.map=null,this.mapPass=null,this.matrix=new di,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new qu,this._frameExtents=new ce(1,1),this._viewportCount=1,this._viewports=[new Ni(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const t=this.camera,n=this.matrix;Ux.setFromMatrixPosition(e.matrixWorld),t.position.copy(Ux),Ox.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(Ox),t.updateMatrixWorld(),e0.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(e0,t.coordinateSystem,t.reversedDepth),t.reversedDepth?n.set(.5,0,0,.5,0,.5,0,.5,0,0,1,0,0,0,0,1):n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(e0)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(e){return this.camera=e.camera.clone(),this.intensity=e.intensity,this.bias=e.bias,this.radius=e.radius,this.autoUpdate=e.autoUpdate,this.needsUpdate=e.needsUpdate,this.normalBias=e.normalBias,this.blurSamples=e.blurSamples,this.mapSize.copy(e.mapSize),this}clone(){return new this.constructor().copy(this)}toJSON(){const e={};return this.intensity!==1&&(e.intensity=this.intensity),this.bias!==0&&(e.bias=this.bias),this.normalBias!==0&&(e.normalBias=this.normalBias),this.radius!==1&&(e.radius=this.radius),(this.mapSize.x!==512||this.mapSize.y!==512)&&(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}}class iw extends K0{constructor(){super(new vo(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1,this.aspect=1}updateMatrices(e){const t=this.camera,n=Oh*2*e.angle*this.focus,i=this.mapSize.width/this.mapSize.height*this.aspect,a=e.distance||t.far;(n!==t.fov||i!==t.aspect||a!==t.far)&&(t.fov=n,t.aspect=i,t.far=a,t.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}}class $0 extends $p{constructor(e,t,n=0,i=Math.PI/3,a=0,o=2){super(e,t),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(yl.DEFAULT_UP),this.updateMatrix(),this.target=new yl,this.distance=n,this.angle=i,this.penumbra=a,this.decay=o,this.map=null,this.shadow=new iw}get power(){return this.intensity*Math.PI}set power(e){this.intensity=e/Math.PI}dispose(){super.dispose(),this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.map=e.map,this.shadow=e.shadow.clone(),this}toJSON(e){const t=super.toJSON(e);return t.object.distance=this.distance,t.object.angle=this.angle,t.object.decay=this.decay,t.object.penumbra=this.penumbra,t.object.target=this.target.uuid,this.map&&this.map.isTexture&&(t.object.map=this.map.toJSON(e).uuid),t.object.shadow=this.shadow.toJSON(),t}}class sw extends K0{constructor(){super(new vo(90,1,.5,500)),this.isPointLightShadow=!0}}class Dx extends $p{constructor(e,t,n=0,i=2){super(e,t),this.isPointLight=!0,this.type="PointLight",this.distance=n,this.decay=i,this.shadow=new sw}get power(){return this.intensity*4*Math.PI}set power(e){this.intensity=e/(4*Math.PI)}dispose(){super.dispose(),this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}toJSON(e){const t=super.toJSON(e);return t.object.distance=this.distance,t.object.decay=this.decay,t.object.shadow=this.shadow.toJSON(),t}}class Pg extends Qd{constructor(e=-1,t=1,n=1,i=-1,a=.1,o=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=n,this.bottom=i,this.near=a,this.far=o,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this}setViewOffset(e,t,n,i,a,o){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=i,this.view.width=a,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,i=(this.top+this.bottom)/2;let a=n-e,o=n+e,u=i+t,c=i-t;if(this.view!==null&&this.view.enabled){const d=(this.right-this.left)/this.view.fullWidth/this.zoom,g=(this.top-this.bottom)/this.view.fullHeight/this.zoom;a+=d*this.view.offsetX,o=a+d*this.view.width,u-=g*this.view.offsetY,c=u-g*this.view.height}this.projectionMatrix.makeOrthographic(a,o,u,c,this.near,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,this.view!==null&&(t.object.view=Object.assign({},this.view)),t}}class aw extends K0{constructor(){super(new Pg(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class t0 extends $p{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(yl.DEFAULT_UP),this.updateMatrix(),this.target=new yl,this.shadow=new aw}dispose(){super.dispose(),this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}toJSON(e){const t=super.toJSON(e);return t.object.shadow=this.shadow.toJSON(),t.object.target=this.target.uuid,t}}class X0 extends $p{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type="AmbientLight"}}class kx extends $p{constructor(e,t,n=10,i=10){super(e,t),this.isRectAreaLight=!0,this.type="RectAreaLight",this.width=n,this.height=i}get power(){return this.intensity*this.width*this.height*Math.PI}set power(e){this.intensity=e/(this.width*this.height*Math.PI)}copy(e){return super.copy(e),this.width=e.width,this.height=e.height,this}toJSON(e){const t=super.toJSON(e);return t.object.width=this.width,t.object.height=this.height,t}}class Vx{constructor(){this.isSphericalHarmonics3=!0,this.coefficients=[];for(let e=0;e<9;e++)this.coefficients.push(new le)}set(e){for(let t=0;t<9;t++)this.coefficients[t].copy(e[t]);return this}zero(){for(let e=0;e<9;e++)this.coefficients[e].set(0,0,0);return this}getAt(e,t){const n=e.x,i=e.y,a=e.z,o=this.coefficients;return t.copy(o[0]).multiplyScalar(.282095),t.addScaledVector(o[1],.488603*i),t.addScaledVector(o[2],.488603*a),t.addScaledVector(o[3],.488603*n),t.addScaledVector(o[4],1.092548*(n*i)),t.addScaledVector(o[5],1.092548*(i*a)),t.addScaledVector(o[6],.315392*(3*a*a-1)),t.addScaledVector(o[7],1.092548*(n*a)),t.addScaledVector(o[8],.546274*(n*n-i*i)),t}getIrradianceAt(e,t){const n=e.x,i=e.y,a=e.z,o=this.coefficients;return t.copy(o[0]).multiplyScalar(.886227),t.addScaledVector(o[1],2*.511664*i),t.addScaledVector(o[2],2*.511664*a),t.addScaledVector(o[3],2*.511664*n),t.addScaledVector(o[4],2*.429043*n*i),t.addScaledVector(o[5],2*.429043*i*a),t.addScaledVector(o[6],.743125*a*a-.247708),t.addScaledVector(o[7],2*.429043*n*a),t.addScaledVector(o[8],.429043*(n*n-i*i)),t}add(e){for(let t=0;t<9;t++)this.coefficients[t].add(e.coefficients[t]);return this}addScaledSH(e,t){for(let n=0;n<9;n++)this.coefficients[n].addScaledVector(e.coefficients[n],t);return this}scale(e){for(let t=0;t<9;t++)this.coefficients[t].multiplyScalar(e);return this}lerp(e,t){for(let n=0;n<9;n++)this.coefficients[n].lerp(e.coefficients[n],t);return this}equals(e){for(let t=0;t<9;t++)if(!this.coefficients[t].equals(e.coefficients[t]))return!1;return!0}copy(e){return this.set(e.coefficients)}clone(){return new this.constructor().copy(this)}fromArray(e,t=0){const n=this.coefficients;for(let i=0;i<9;i++)n[i].fromArray(e,t+i*3);return this}toArray(e=[],t=0){const n=this.coefficients;for(let i=0;i<9;i++)n[i].toArray(e,t+i*3);return e}static getBasisAt(e,t){const n=e.x,i=e.y,a=e.z;t[0]=.282095,t[1]=.488603*i,t[2]=.488603*a,t[3]=.488603*n,t[4]=1.092548*n*i,t[5]=1.092548*i*a,t[6]=.315392*(3*a*a-1),t[7]=1.092548*n*a,t[8]=.546274*(n*n-i*i)}}class ow extends $p{constructor(e=new Vx,t=1){super(void 0,t),this.isLightProbe=!0,this.sh=e}copy(e){return super.copy(e),this.sh.copy(e.sh),this}toJSON(e){const t=super.toJSON(e);return t.object.sh=this.sh.toArray(),t}}class ey extends null{constructor(e){super(e),this.textures={}}load(e,t,n,i){const a=this,o=new Ng(a.manager);o.setPath(a.path),o.setRequestHeader(a.requestHeader),o.setWithCredentials(a.withCredentials),o.load(e,function(u){try{t(a.parse(JSON.parse(u)))}catch(c){i?i(c):Gr(c),a.manager.itemError(e)}},n,i)}parse(e){const t=this.textures;function n(a){return t[a]===void 0&&Lr("MaterialLoader: Undefined texture",a),t[a]}const i=this.createMaterialFromType(e.type);if(e.uuid!==void 0&&(i.uuid=e.uuid),e.name!==void 0&&(i.name=e.name),e.color!==void 0&&i.color!==void 0&&i.color.setHex(e.color),e.roughness!==void 0&&(i.roughness=e.roughness),e.metalness!==void 0&&(i.metalness=e.metalness),e.sheen!==void 0&&(i.sheen=e.sheen),e.sheenColor!==void 0&&(i.sheenColor=new Wr().setHex(e.sheenColor)),e.sheenRoughness!==void 0&&(i.sheenRoughness=e.sheenRoughness),e.emissive!==void 0&&i.emissive!==void 0&&i.emissive.setHex(e.emissive),e.specular!==void 0&&i.specular!==void 0&&i.specular.setHex(e.specular),e.specularIntensity!==void 0&&(i.specularIntensity=e.specularIntensity),e.specularColor!==void 0&&i.specularColor!==void 0&&i.specularColor.setHex(e.specularColor),e.shininess!==void 0&&(i.shininess=e.shininess),e.clearcoat!==void 0&&(i.clearcoat=e.clearcoat),e.clearcoatRoughness!==void 0&&(i.clearcoatRoughness=e.clearcoatRoughness),e.dispersion!==void 0&&(i.dispersion=e.dispersion),e.iridescence!==void 0&&(i.iridescence=e.iridescence),e.iridescenceIOR!==void 0&&(i.iridescenceIOR=e.iridescenceIOR),e.iridescenceThicknessRange!==void 0&&(i.iridescenceThicknessRange=e.iridescenceThicknessRange),e.transmission!==void 0&&(i.transmission=e.transmission),e.thickness!==void 0&&(i.thickness=e.thickness),e.attenuationDistance!==void 0&&(i.attenuationDistance=e.attenuationDistance),e.attenuationColor!==void 0&&i.attenuationColor!==void 0&&i.attenuationColor.setHex(e.attenuationColor),e.anisotropy!==void 0&&(i.anisotropy=e.anisotropy),e.anisotropyRotation!==void 0&&(i.anisotropyRotation=e.anisotropyRotation),e.fog!==void 0&&(i.fog=e.fog),e.flatShading!==void 0&&(i.flatShading=e.flatShading),e.blending!==void 0&&(i.blending=e.blending),e.combine!==void 0&&(i.combine=e.combine),e.side!==void 0&&(i.side=e.side),e.shadowSide!==void 0&&(i.shadowSide=e.shadowSide),e.opacity!==void 0&&(i.opacity=e.opacity),e.transparent!==void 0&&(i.transparent=e.transparent),e.alphaTest!==void 0&&(i.alphaTest=e.alphaTest),e.alphaHash!==void 0&&(i.alphaHash=e.alphaHash),e.depthFunc!==void 0&&(i.depthFunc=e.depthFunc),e.depthTest!==void 0&&(i.depthTest=e.depthTest),e.depthWrite!==void 0&&(i.depthWrite=e.depthWrite),e.colorWrite!==void 0&&(i.colorWrite=e.colorWrite),e.blendSrc!==void 0&&(i.blendSrc=e.blendSrc),e.blendDst!==void 0&&(i.blendDst=e.blendDst),e.blendEquation!==void 0&&(i.blendEquation=e.blendEquation),e.blendSrcAlpha!==void 0&&(i.blendSrcAlpha=e.blendSrcAlpha),e.blendDstAlpha!==void 0&&(i.blendDstAlpha=e.blendDstAlpha),e.blendEquationAlpha!==void 0&&(i.blendEquationAlpha=e.blendEquationAlpha),e.blendColor!==void 0&&i.blendColor!==void 0&&i.blendColor.setHex(e.blendColor),e.blendAlpha!==void 0&&(i.blendAlpha=e.blendAlpha),e.stencilWriteMask!==void 0&&(i.stencilWriteMask=e.stencilWriteMask),e.stencilFunc!==void 0&&(i.stencilFunc=e.stencilFunc),e.stencilRef!==void 0&&(i.stencilRef=e.stencilRef),e.stencilFuncMask!==void 0&&(i.stencilFuncMask=e.stencilFuncMask),e.stencilFail!==void 0&&(i.stencilFail=e.stencilFail),e.stencilZFail!==void 0&&(i.stencilZFail=e.stencilZFail),e.stencilZPass!==void 0&&(i.stencilZPass=e.stencilZPass),e.stencilWrite!==void 0&&(i.stencilWrite=e.stencilWrite),e.wireframe!==void 0&&(i.wireframe=e.wireframe),e.wireframeLinewidth!==void 0&&(i.wireframeLinewidth=e.wireframeLinewidth),e.wireframeLinecap!==void 0&&(i.wireframeLinecap=e.wireframeLinecap),e.wireframeLinejoin!==void 0&&(i.wireframeLinejoin=e.wireframeLinejoin),e.rotation!==void 0&&(i.rotation=e.rotation),e.linewidth!==void 0&&(i.linewidth=e.linewidth),e.dashSize!==void 0&&(i.dashSize=e.dashSize),e.gapSize!==void 0&&(i.gapSize=e.gapSize),e.scale!==void 0&&(i.scale=e.scale),e.polygonOffset!==void 0&&(i.polygonOffset=e.polygonOffset),e.polygonOffsetFactor!==void 0&&(i.polygonOffsetFactor=e.polygonOffsetFactor),e.polygonOffsetUnits!==void 0&&(i.polygonOffsetUnits=e.polygonOffsetUnits),e.dithering!==void 0&&(i.dithering=e.dithering),e.alphaToCoverage!==void 0&&(i.alphaToCoverage=e.alphaToCoverage),e.premultipliedAlpha!==void 0&&(i.premultipliedAlpha=e.premultipliedAlpha),e.forceSinglePass!==void 0&&(i.forceSinglePass=e.forceSinglePass),e.allowOverride!==void 0&&(i.allowOverride=e.allowOverride),e.visible!==void 0&&(i.visible=e.visible),e.toneMapped!==void 0&&(i.toneMapped=e.toneMapped),e.userData!==void 0&&(i.userData=e.userData),e.vertexColors!==void 0&&(typeof e.vertexColors=="number"?i.vertexColors=e.vertexColors>0:i.vertexColors=e.vertexColors),e.uniforms!==void 0)for(const a in e.uniforms){const o=e.uniforms[a];switch(i.uniforms[a]={},o.type){case"t":i.uniforms[a].value=n(o.value);break;case"c":i.uniforms[a].value=new Wr().setHex(o.value);break;case"v2":i.uniforms[a].value=new ce().fromArray(o.value);break;case"v3":i.uniforms[a].value=new le().fromArray(o.value);break;case"v4":i.uniforms[a].value=new Ni().fromArray(o.value);break;case"m3":i.uniforms[a].value=new pn().fromArray(o.value);break;case"m4":i.uniforms[a].value=new di().fromArray(o.value);break;default:i.uniforms[a].value=o.value}}if(e.defines!==void 0&&(i.defines=e.defines),e.vertexShader!==void 0&&(i.vertexShader=e.vertexShader),e.fragmentShader!==void 0&&(i.fragmentShader=e.fragmentShader),e.glslVersion!==void 0&&(i.glslVersion=e.glslVersion),e.extensions!==void 0)for(const a in e.extensions)i.extensions[a]=e.extensions[a];if(e.lights!==void 0&&(i.lights=e.lights),e.clipping!==void 0&&(i.clipping=e.clipping),e.size!==void 0&&(i.size=e.size),e.sizeAttenuation!==void 0&&(i.sizeAttenuation=e.sizeAttenuation),e.map!==void 0&&(i.map=n(e.map)),e.matcap!==void 0&&(i.matcap=n(e.matcap)),e.alphaMap!==void 0&&(i.alphaMap=n(e.alphaMap)),e.bumpMap!==void 0&&(i.bumpMap=n(e.bumpMap)),e.bumpScale!==void 0&&(i.bumpScale=e.bumpScale),e.normalMap!==void 0&&(i.normalMap=n(e.normalMap)),e.normalMapType!==void 0&&(i.normalMapType=e.normalMapType),e.normalScale!==void 0){let a=e.normalScale;Array.isArray(a)===!1&&(a=[a,a]),i.normalScale=new ce().fromArray(a)}return e.displacementMap!==void 0&&(i.displacementMap=n(e.displacementMap)),e.displacementScale!==void 0&&(i.displacementScale=e.displacementScale),e.displacementBias!==void 0&&(i.displacementBias=e.displacementBias),e.roughnessMap!==void 0&&(i.roughnessMap=n(e.roughnessMap)),e.metalnessMap!==void 0&&(i.metalnessMap=n(e.metalnessMap)),e.emissiveMap!==void 0&&(i.emissiveMap=n(e.emissiveMap)),e.emissiveIntensity!==void 0&&(i.emissiveIntensity=e.emissiveIntensity),e.specularMap!==void 0&&(i.specularMap=n(e.specularMap)),e.specularIntensityMap!==void 0&&(i.specularIntensityMap=n(e.specularIntensityMap)),e.specularColorMap!==void 0&&(i.specularColorMap=n(e.specularColorMap)),e.envMap!==void 0&&(i.envMap=n(e.envMap)),e.envMapRotation!==void 0&&i.envMapRotation.fromArray(e.envMapRotation),e.envMapIntensity!==void 0&&(i.envMapIntensity=e.envMapIntensity),e.reflectivity!==void 0&&(i.reflectivity=e.reflectivity),e.refractionRatio!==void 0&&(i.refractionRatio=e.refractionRatio),e.lightMap!==void 0&&(i.lightMap=n(e.lightMap)),e.lightMapIntensity!==void 0&&(i.lightMapIntensity=e.lightMapIntensity),e.aoMap!==void 0&&(i.aoMap=n(e.aoMap)),e.aoMapIntensity!==void 0&&(i.aoMapIntensity=e.aoMapIntensity),e.gradientMap!==void 0&&(i.gradientMap=n(e.gradientMap)),e.clearcoatMap!==void 0&&(i.clearcoatMap=n(e.clearcoatMap)),e.clearcoatRoughnessMap!==void 0&&(i.clearcoatRoughnessMap=n(e.clearcoatRoughnessMap)),e.clearcoatNormalMap!==void 0&&(i.clearcoatNormalMap=n(e.clearcoatNormalMap)),e.clearcoatNormalScale!==void 0&&(i.clearcoatNormalScale=new ce().fromArray(e.clearcoatNormalScale)),e.iridescenceMap!==void 0&&(i.iridescenceMap=n(e.iridescenceMap)),e.iridescenceThicknessMap!==void 0&&(i.iridescenceThicknessMap=n(e.iridescenceThicknessMap)),e.transmissionMap!==void 0&&(i.transmissionMap=n(e.transmissionMap)),e.thicknessMap!==void 0&&(i.thicknessMap=n(e.thicknessMap)),e.anisotropyMap!==void 0&&(i.anisotropyMap=n(e.anisotropyMap)),e.sheenColorMap!==void 0&&(i.sheenColorMap=n(e.sheenColorMap)),e.sheenRoughnessMap!==void 0&&(i.sheenRoughnessMap=n(e.sheenRoughnessMap)),i}setTextures(e){return this.textures=e,this}createMaterialFromType(e){return ey.createMaterialFromType(e)}static createMaterialFromType(e){const t={ShadowMaterial:Cx,SpriteMaterial:BA,RawShaderMaterial:Tx,ShaderMaterial:nh,PointsMaterial:jm,MeshPhysicalMaterial:Qp,MeshStandardMaterial:$v,MeshPhongMaterial:Xv,MeshToonMaterial:jv,MeshNormalMaterial:V0,MeshLambertMaterial:qm,MeshDepthMaterial:Bx,MeshDistanceMaterial:Rx,MeshBasicMaterial:Yl,MeshMatcapMaterial:nw,LineDashedMaterial:xm,LineBasicMaterial:fl,Material:Hl};return new t[e]}}class ty{static extractUrlBase(e){const t=e.lastIndexOf("/");return t===-1?"./":e.slice(0,t+1)}static resolveURL(e,t){return typeof e!="string"||e===""?"":(/^https?:\/\//i.test(t)&&/^\//.test(e)&&(t=t.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(e)||/^data:.*,.*$/i.test(e)||/^blob:.*$/i.test(e)?e:t+e)}}class zx extends null{constructor(){super(),this.isInstancedBufferGeometry=!0,this.type="InstancedBufferGeometry",this.instanceCount=1/0}copy(e){return super.copy(e),this.instanceCount=e.instanceCount,this}toJSON(){const e=super.toJSON();return e.instanceCount=this.instanceCount,e.isInstancedBufferGeometry=!0,e}}class ny extends null{constructor(e){super(e)}load(e,t,n,i){const a=this,o=new Ng(a.manager);o.setPath(a.path),o.setRequestHeader(a.requestHeader),o.setWithCredentials(a.withCredentials),o.load(e,function(u){try{t(a.parse(JSON.parse(u)))}catch(c){i?i(c):Gr(c),a.manager.itemError(e)}},n,i)}parse(e){const t={},n={};function i(B,I){if(t[I]!==void 0)return t[I];const ee=B.interleavedBuffers[I],q=a(B,ee.buffer),ye=_o(ee.type,q),Ce=new wh(ye,ee.stride);return Ce.uuid=ee.uuid,t[I]=Ce,Ce}function a(B,I){if(n[I]!==void 0)return n[I];const ee=B.arrayBuffers[I],q=new Uint32Array(ee).buffer;return n[I]=q,q}const o=e.isInstancedBufferGeometry?new zx:new ka,u=e.data.index;if(u!==void 0){const B=_o(u.type,u.array);o.setIndex(new wl(B,1))}const c=e.data.attributes;for(const B in c){const I=c[B];let ne;if(I.isInterleavedBufferAttribute){const ee=i(e.data,I.data);ne=new yf(ee,I.itemSize,I.offset,I.normalized)}else{const ee=_o(I.type,I.array),q=I.isInstancedBufferAttribute?Mh:wl;ne=new q(ee,I.itemSize,I.normalized)}I.name!==void 0&&(ne.name=I.name),I.usage!==void 0&&ne.setUsage(I.usage),o.setAttribute(B,ne)}const d=e.data.morphAttributes;if(d)for(const B in d){const I=d[B],ne=[];for(let ee=0,q=I.length;ee<q;ee++){const ye=I[ee];let Ce;if(ye.isInterleavedBufferAttribute){const ke=i(e.data,ye.data);Ce=new yf(ke,ye.itemSize,ye.offset,ye.normalized)}else{const ke=_o(ye.type,ye.array);Ce=new wl(ke,ye.itemSize,ye.normalized)}ye.name!==void 0&&(Ce.name=ye.name),ne.push(Ce)}o.morphAttributes[B]=ne}e.data.morphTargetsRelative&&(o.morphTargetsRelative=!0);const v=e.data.groups||e.data.drawcalls||e.data.offsets;if(v!==void 0)for(let B=0,I=v.length;B!==I;++B){const ne=v[B];o.addGroup(ne.start,ne.count,ne.materialIndex)}const M=e.data.boundingSphere;return M!==void 0&&(o.boundingSphere=new gi().fromJSON(M)),e.name&&(o.name=e.name),e.userData&&(o.userData=e.userData),o}}class RP extends null{constructor(e){super(e)}load(e,t,n,i){const a=this,o=this.path===""?ty.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||o;const u=new Ng(this.manager);u.setPath(this.path),u.setRequestHeader(this.requestHeader),u.setWithCredentials(this.withCredentials),u.load(e,function(c){let d=null;try{d=JSON.parse(c)}catch(v){i!==void 0&&i(v),v("ObjectLoader: Can't parse "+e+".",v.message);return}const g=d.metadata;if(g===void 0||g.type===void 0||g.type.toLowerCase()==="geometry"){i!==void 0&&i(new Error("THREE.ObjectLoader: Can't load "+e)),Gr("ObjectLoader: Can't load "+e);return}a.parse(d,t)},n,i)}loadAsync(e,t){return Pa(this,null,function*(){const n=this,i=this.path===""?ty.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||i;const a=new Ng(this.manager);a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials);const o=yield a.loadAsync(e,t),u=JSON.parse(o),c=u.metadata;if(c===void 0||c.type===void 0||c.type.toLowerCase()==="geometry")throw new Error("THREE.ObjectLoader: Can't load "+e);return yield n.parseAsync(u)})}parse(e,t){const n=this.parseAnimations(e.animations),i=this.parseShapes(e.shapes),a=this.parseGeometries(e.geometries,i),o=this.parseImages(e.images,function(){t!==void 0&&t(d)}),u=this.parseTextures(e.textures,o),c=this.parseMaterials(e.materials,u),d=this.parseObject(e.object,a,c,u,n),g=this.parseSkeletons(e.skeletons,d);if(this.bindSkeletons(d,g),this.bindLightTargets(d),t!==void 0){let v=!1;for(const M in o)if(o[M].data instanceof HTMLImageElement){v=!0;break}v===!1&&t(d)}return d}parseAsync(e){return Pa(this,null,function*(){const t=this.parseAnimations(e.animations),n=this.parseShapes(e.shapes),i=this.parseGeometries(e.geometries,n),a=yield this.parseImagesAsync(e.images),o=this.parseTextures(e.textures,a),u=this.parseMaterials(e.materials,o),c=this.parseObject(e.object,i,u,o,t),d=this.parseSkeletons(e.skeletons,c);return this.bindSkeletons(c,d),this.bindLightTargets(c),c})}parseShapes(e){const t={};if(e!==void 0)for(let n=0,i=e.length;n<i;n++){const a=new bi().fromJSON(e[n]);t[a.uuid]=a}return t}parseSkeletons(e,t){const n={},i={};if(t.traverse(function(a){a.isBone&&(i[a.uuid]=a)}),e!==void 0)for(let a=0,o=e.length;a<o;a++){const u=new Kd().fromJSON(e[a],i);n[u.uuid]=u}return n}parseGeometries(e,t){const n={};if(e!==void 0){const i=new ny;for(let a=0,o=e.length;a<o;a++){let u;const c=e[a];switch(c.type){case"BufferGeometry":case"InstancedBufferGeometry":u=i.parse(c);break;default:c.type in Ex?u=Ex[c.type].fromJSON(c,t):Lr(`ObjectLoader: Unsupported geometry type "${c.type}"`)}u.uuid=c.uuid,c.name!==void 0&&(u.name=c.name),c.userData!==void 0&&(u.userData=c.userData),n[c.uuid]=u}}return n}parseMaterials(e,t){const n={},i={};if(e!==void 0){const a=new ey;a.setTextures(t);for(let o=0,u=e.length;o<u;o++){const c=e[o];n[c.uuid]===void 0&&(n[c.uuid]=a.parse(c)),i[c.uuid]=n[c.uuid]}}return i}parseAnimations(e){const t={};if(e!==void 0)for(let n=0;n<e.length;n++){const i=e[n],a=W0.parse(i);t[a.uuid]=a}return t}parseImages(e,t){const n=this,i={};let a;function o(c){return n.manager.itemStart(c),a.load(c,function(){n.manager.itemEnd(c)},void 0,function(){n.manager.itemError(c),n.manager.itemEnd(c)})}function u(c){if(typeof c=="string"){const d=c,g=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(d)?d:n.resourcePath+d;return o(g)}else return c.data?{data:_o(c.type,c.data),width:c.width,height:c.height}:null}if(e!==void 0&&e.length>0){const c=new Ig(t);a=new Jm(c),a.setCrossOrigin(this.crossOrigin);for(let d=0,g=e.length;d<g;d++){const v=e[d],M=v.url;if(Array.isArray(M)){const B=[];for(let I=0,ne=M.length;I<ne;I++){const ee=M[I],q=u(ee);q!==null&&(q instanceof HTMLImageElement?B.push(q):B.push(new ah(q.data,q.width,q.height)))}i[v.uuid]=new rs(B)}else{const B=u(v.url);i[v.uuid]=new rs(B)}}}return i}parseImagesAsync(e){return Pa(this,null,function*(){const t=this,n={};let i;function a(o){return Pa(this,null,function*(){if(typeof o=="string"){const u=o,c=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(u)?u:t.resourcePath+u;return yield i.loadAsync(c)}else return o.data?{data:_o(o.type,o.data),width:o.width,height:o.height}:null})}if(e!==void 0&&e.length>0){i=new Jm(this.manager),i.setCrossOrigin(this.crossOrigin);for(let o=0,u=e.length;o<u;o++){const c=e[o],d=c.url;if(Array.isArray(d)){const g=[];for(let v=0,M=d.length;v<M;v++){const B=d[v],I=yield a(B);I!==null&&(I instanceof HTMLImageElement?g.push(I):g.push(new ah(I.data,I.width,I.height)))}n[c.uuid]=new rs(g)}else{const g=yield a(c.url);n[c.uuid]=new rs(g)}}}return n})}parseTextures(e,t){function n(a,o){return typeof a=="number"?a:(Lr("ObjectLoader.parseTexture: Constant should be in numeric form.",a),o[a])}const i={};if(e!==void 0)for(let a=0,o=e.length;a<o;a++){const u=e[a];u.image===void 0&&Lr('ObjectLoader: No "image" specified for',u.uuid),t[u.image]===void 0&&Lr("ObjectLoader: Undefined image",u.image);const c=t[u.image],d=c.data;let g;Array.isArray(d)?(g=new rh,d.length===6&&(g.needsUpdate=!0)):(d&&d.data?g=new ah:g=new zi,d&&(g.needsUpdate=!0)),g.source=c,g.uuid=u.uuid,u.name!==void 0&&(g.name=u.name),u.mapping!==void 0&&(g.mapping=n(u.mapping,j0)),u.channel!==void 0&&(g.channel=u.channel),u.offset!==void 0&&g.offset.fromArray(u.offset),u.repeat!==void 0&&g.repeat.fromArray(u.repeat),u.center!==void 0&&g.center.fromArray(u.center),u.rotation!==void 0&&(g.rotation=u.rotation),u.wrap!==void 0&&(g.wrapS=n(u.wrap[0],ry),g.wrapT=n(u.wrap[1],ry)),u.format!==void 0&&(g.format=u.format),u.internalFormat!==void 0&&(g.internalFormat=u.internalFormat),u.type!==void 0&&(g.type=u.type),u.colorSpace!==void 0&&(g.colorSpace=u.colorSpace),u.minFilter!==void 0&&(g.minFilter=n(u.minFilter,lw)),u.magFilter!==void 0&&(g.magFilter=n(u.magFilter,lw)),u.anisotropy!==void 0&&(g.anisotropy=u.anisotropy),u.flipY!==void 0&&(g.flipY=u.flipY),u.generateMipmaps!==void 0&&(g.generateMipmaps=u.generateMipmaps),u.premultiplyAlpha!==void 0&&(g.premultiplyAlpha=u.premultiplyAlpha),u.unpackAlignment!==void 0&&(g.unpackAlignment=u.unpackAlignment),u.compareFunction!==void 0&&(g.compareFunction=u.compareFunction),u.userData!==void 0&&(g.userData=u.userData),i[u.uuid]=g}return i}parseObject(e,t,n,i,a){let o;function u(M){return t[M]===void 0&&Lr("ObjectLoader: Undefined geometry",M),t[M]}function c(M){if(M!==void 0){if(Array.isArray(M)){const B=[];for(let I=0,ne=M.length;I<ne;I++){const ee=M[I];n[ee]===void 0&&Lr("ObjectLoader: Undefined material",ee),B.push(n[ee])}return B}return n[M]===void 0&&Lr("ObjectLoader: Undefined material",M),n[M]}}function d(M){return i[M]===void 0&&Lr("ObjectLoader: Undefined texture",M),i[M]}let g,v;switch(e.type){case"Scene":o=new _d,e.background!==void 0&&(Number.isInteger(e.background)?o.background=new Wr(e.background):o.background=d(e.background)),e.environment!==void 0&&(o.environment=d(e.environment)),e.fog!==void 0&&(e.fog.type==="Fog"?o.fog=new vf(e.fog.color,e.fog.near,e.fog.far):e.fog.type==="FogExp2"&&(o.fog=new Hu(e.fog.color,e.fog.density)),e.fog.name!==""&&(o.fog.name=e.fog.name)),e.backgroundBlurriness!==void 0&&(o.backgroundBlurriness=e.backgroundBlurriness),e.backgroundIntensity!==void 0&&(o.backgroundIntensity=e.backgroundIntensity),e.backgroundRotation!==void 0&&o.backgroundRotation.fromArray(e.backgroundRotation),e.environmentIntensity!==void 0&&(o.environmentIntensity=e.environmentIntensity),e.environmentRotation!==void 0&&o.environmentRotation.fromArray(e.environmentRotation);break;case"PerspectiveCamera":o=new vo(e.fov,e.aspect,e.near,e.far),e.focus!==void 0&&(o.focus=e.focus),e.zoom!==void 0&&(o.zoom=e.zoom),e.filmGauge!==void 0&&(o.filmGauge=e.filmGauge),e.filmOffset!==void 0&&(o.filmOffset=e.filmOffset),e.view!==void 0&&(o.view=Object.assign({},e.view));break;case"OrthographicCamera":o=new Pg(e.left,e.right,e.top,e.bottom,e.near,e.far),e.zoom!==void 0&&(o.zoom=e.zoom),e.view!==void 0&&(o.view=Object.assign({},e.view));break;case"AmbientLight":o=new X0(e.color,e.intensity);break;case"DirectionalLight":o=new t0(e.color,e.intensity),o.target=e.target||"";break;case"PointLight":o=new Dx(e.color,e.intensity,e.distance,e.decay);break;case"RectAreaLight":o=new kx(e.color,e.intensity,e.width,e.height);break;case"SpotLight":o=new $0(e.color,e.intensity,e.distance,e.angle,e.penumbra,e.decay),o.target=e.target||"";break;case"HemisphereLight":o=new Sm(e.color,e.groundColor,e.intensity);break;case"LightProbe":const M=new Vx().fromArray(e.sh);o=new ow(M,e.intensity);break;case"SkinnedMesh":g=u(e.geometry),v=c(e.material),o=new Oi(g,v),e.bindMode!==void 0&&(o.bindMode=e.bindMode),e.bindMatrix!==void 0&&o.bindMatrix.fromArray(e.bindMatrix),e.skeleton!==void 0&&(o.skeleton=e.skeleton);break;case"Mesh":g=u(e.geometry),v=c(e.material),o=new Il(g,v);break;case"InstancedMesh":g=u(e.geometry),v=c(e.material);const B=e.count,I=e.instanceMatrix,ne=e.instanceColor;o=new lp(g,v,B),o.instanceMatrix=new Mh(new Float32Array(I.array),16),ne!==void 0&&(o.instanceColor=new Mh(new Float32Array(ne.array),ne.itemSize));break;case"BatchedMesh":g=u(e.geometry),v=c(e.material),o=new Xm(e.maxInstanceCount,e.maxVertexCount,e.maxIndexCount,v),o.geometry=g,o.perObjectFrustumCulled=e.perObjectFrustumCulled,o.sortObjects=e.sortObjects,o._drawRanges=e.drawRanges,o._reservedRanges=e.reservedRanges,o._geometryInfo=e.geometryInfo.map(ee=>{let q=null,ye=null;return ee.boundingBox!==void 0&&(q=new Y().fromJSON(ee.boundingBox)),ee.boundingSphere!==void 0&&(ye=new gi().fromJSON(ee.boundingSphere)),fd(rl({},ee),{boundingBox:q,boundingSphere:ye})}),o._instanceInfo=e.instanceInfo,o._availableInstanceIds=e._availableInstanceIds,o._availableGeometryIds=e._availableGeometryIds,o._nextIndexStart=e.nextIndexStart,o._nextVertexStart=e.nextVertexStart,o._geometryCount=e.geometryCount,o._maxInstanceCount=e.maxInstanceCount,o._maxVertexCount=e.maxVertexCount,o._maxIndexCount=e.maxIndexCount,o._geometryInitialized=e.geometryInitialized,o._matricesTexture=d(e.matricesTexture.uuid),o._indirectTexture=d(e.indirectTexture.uuid),e.colorsTexture!==void 0&&(o._colorsTexture=d(e.colorsTexture.uuid)),e.boundingSphere!==void 0&&(o.boundingSphere=new gi().fromJSON(e.boundingSphere)),e.boundingBox!==void 0&&(o.boundingBox=new Y().fromJSON(e.boundingBox));break;case"LOD":o=new dm;break;case"Line":o=new qd(u(e.geometry),c(e.material));break;case"LineLoop":o=new Kv(u(e.geometry),c(e.material));break;case"LineSegments":o=new dp(u(e.geometry),c(e.material));break;case"PointCloud":case"Points":o=new D0(u(e.geometry),c(e.material));break;case"Sprite":o=new hm(c(e.material));break;case"Group":o=new ih;break;case"Bone":o=new op;break;default:o=new yl}if(o.uuid=e.uuid,e.name!==void 0&&(o.name=e.name),e.matrix!==void 0?(o.matrix.fromArray(e.matrix),e.matrixAutoUpdate!==void 0&&(o.matrixAutoUpdate=e.matrixAutoUpdate),o.matrixAutoUpdate&&o.matrix.decompose(o.position,o.quaternion,o.scale)):(e.position!==void 0&&o.position.fromArray(e.position),e.rotation!==void 0&&o.rotation.fromArray(e.rotation),e.quaternion!==void 0&&o.quaternion.fromArray(e.quaternion),e.scale!==void 0&&o.scale.fromArray(e.scale)),e.up!==void 0&&o.up.fromArray(e.up),e.castShadow!==void 0&&(o.castShadow=e.castShadow),e.receiveShadow!==void 0&&(o.receiveShadow=e.receiveShadow),e.shadow&&(e.shadow.intensity!==void 0&&(o.shadow.intensity=e.shadow.intensity),e.shadow.bias!==void 0&&(o.shadow.bias=e.shadow.bias),e.shadow.normalBias!==void 0&&(o.shadow.normalBias=e.shadow.normalBias),e.shadow.radius!==void 0&&(o.shadow.radius=e.shadow.radius),e.shadow.mapSize!==void 0&&o.shadow.mapSize.fromArray(e.shadow.mapSize),e.shadow.camera!==void 0&&(o.shadow.camera=this.parseObject(e.shadow.camera))),e.visible!==void 0&&(o.visible=e.visible),e.frustumCulled!==void 0&&(o.frustumCulled=e.frustumCulled),e.renderOrder!==void 0&&(o.renderOrder=e.renderOrder),e.userData!==void 0&&(o.userData=e.userData),e.layers!==void 0&&(o.layers.mask=e.layers),e.children!==void 0){const M=e.children;for(let B=0;B<M.length;B++)o.add(this.parseObject(M[B],t,n,i,a))}if(e.animations!==void 0){const M=e.animations;for(let B=0;B<M.length;B++){const I=M[B];o.animations.push(a[I])}}if(e.type==="LOD"){e.autoUpdate!==void 0&&(o.autoUpdate=e.autoUpdate);const M=e.levels;for(let B=0;B<M.length;B++){const I=M[B],ne=o.getObjectByProperty("uuid",I.object);ne!==void 0&&o.addLevel(ne,I.distance,I.hysteresis)}}return o}bindSkeletons(e,t){Object.keys(t).length!==0&&e.traverse(function(n){if(n.isSkinnedMesh===!0&&n.skeleton!==void 0){const i=t[n.skeleton];i===void 0?Lr("ObjectLoader: No skeleton found with UUID:",n.skeleton):n.bind(i,n.bindMatrix)}})}bindLightTargets(e){e.traverse(function(t){if(t.isDirectionalLight||t.isSpotLight){const n=t.target,i=e.getObjectByProperty("uuid",n);i!==void 0?t.target=i:t.target=new yl}})}}const j0={UVMapping:be,CubeReflectionMapping:it,CubeRefractionMapping:wt,EquirectangularReflectionMapping:ot,EquirectangularRefractionMapping:ut,CubeUVReflectionMapping:_t},ry={RepeatWrapping:$t,ClampToEdgeWrapping:Vt,MirroredRepeatWrapping:Qt},lw={NearestFilter:cn,NearestMipmapNearestFilter:Yn,NearestMipmapLinearFilter:Sr,LinearFilter:vr,LinearMipmapNearestFilter:Ki,LinearMipmapLinearFilter:yi},Y0=new WeakMap;class uw extends null{constructor(e){super(e),this.isImageBitmapLoader=!0,typeof createImageBitmap=="undefined"&&Lr("ImageBitmapLoader: createImageBitmap() not supported."),typeof fetch=="undefined"&&Lr("ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"},this._abortController=new AbortController}setOptions(e){return this.options=e,this}load(e,t,n,i){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const a=this,o=Zp.get(`image-bitmap:${e}`);if(o!==void 0){if(a.manager.itemStart(e),o.then){o.then(d=>{if(Y0.has(o)===!0)i&&i(Y0.get(o)),a.manager.itemError(e),a.manager.itemEnd(e);else return t&&t(d),a.manager.itemEnd(e),d});return}return setTimeout(function(){t&&t(o),a.manager.itemEnd(e)},0),o}const u={};u.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",u.headers=this.requestHeader,u.signal=typeof AbortSignal.any=="function"?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal;const c=fetch(e,u).then(function(d){return d.blob()}).then(function(d){return createImageBitmap(d,Object.assign(a.options,{colorSpaceConversion:"none"}))}).then(function(d){return Zp.add(`image-bitmap:${e}`,d),t&&t(d),a.manager.itemEnd(e),d}).catch(function(d){i&&i(d),Y0.set(c,d),Zp.remove(`image-bitmap:${e}`),a.manager.itemError(e),a.manager.itemEnd(e)});Zp.add(`image-bitmap:${e}`,c),a.manager.itemStart(e)}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}}let HA;class cw{static getContext(){return HA===void 0&&(HA=new(window.AudioContext||window.webkitAudioContext)),HA}static setContext(e){HA=e}}class IP extends null{constructor(e){super(e)}load(e,t,n,i){const a=this,o=new Ng(this.manager);o.setResponseType("arraybuffer"),o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,function(c){try{const d=c.slice(0);cw.getContext().decodeAudioData(d,function(v){t(v)}).catch(u)}catch(d){u(d)}},n,i);function u(c){i?i(c):Gr(c),a.manager.itemError(e)}}}const Gx=new di,Xp=new di,Ap=new di;class DE{constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new vo,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new vo,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1,this._cache={focus:null,fov:null,aspect:null,near:null,far:null,zoom:null,eyeSep:null}}update(e){const t=this._cache;if(t.focus!==e.focus||t.fov!==e.fov||t.aspect!==e.aspect*this.aspect||t.near!==e.near||t.far!==e.far||t.zoom!==e.zoom||t.eyeSep!==this.eyeSep){t.focus=e.focus,t.fov=e.fov,t.aspect=e.aspect*this.aspect,t.near=e.near,t.far=e.far,t.zoom=e.zoom,t.eyeSep=this.eyeSep,Ap.copy(e.projectionMatrix);const i=t.eyeSep/2,a=i*t.near/t.focus,o=t.near*Math.tan(Ou*t.fov*.5)/t.zoom;let u,c;Xp.elements[12]=-i,Gx.elements[12]=i,u=-o*t.aspect+a,c=o*t.aspect+a,Ap.elements[0]=2*t.near/(c-u),Ap.elements[8]=(c+u)/(c-u),this.cameraL.projectionMatrix.copy(Ap),u=-o*t.aspect-a,c=o*t.aspect-a,Ap.elements[0]=2*t.near/(c-u),Ap.elements[8]=(c+u)/(c-u),this.cameraR.projectionMatrix.copy(Ap)}this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(Xp),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply(Gx)}}class jp extends vo{constructor(e=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=e}}class pp{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=performance.now(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}stop(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}getElapsedTime(){return this.getDelta(),this.elapsedTime}getDelta(){let e=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){const t=performance.now();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}}const Mm=new le,Hx=new Ze,Lg=new le,Yp=new le,Ug=new le;class Em extends null{constructor(){super(),this.type="AudioListener",this.context=cw.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new pp}getInput(){return this.gain}removeFilter(){return this.filter!==null&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null),this}getFilter(){return this.filter}setFilter(e){return this.filter!==null?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=e,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this}getMasterVolume(){return this.gain.gain.value}setMasterVolume(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}updateMatrixWorld(e){super.updateMatrixWorld(e);const t=this.context.listener;if(this.timeDelta=this._clock.getDelta(),this.matrixWorld.decompose(Mm,Hx,Lg),Yp.set(0,0,-1).applyQuaternion(Hx),Ug.set(0,1,0).applyQuaternion(Hx),t.positionX){const n=this.context.currentTime+this.timeDelta;t.positionX.linearRampToValueAtTime(Mm.x,n),t.positionY.linearRampToValueAtTime(Mm.y,n),t.positionZ.linearRampToValueAtTime(Mm.z,n),t.forwardX.linearRampToValueAtTime(Yp.x,n),t.forwardY.linearRampToValueAtTime(Yp.y,n),t.forwardZ.linearRampToValueAtTime(Yp.z,n),t.upX.linearRampToValueAtTime(Ug.x,n),t.upY.linearRampToValueAtTime(Ug.y,n),t.upZ.linearRampToValueAtTime(Ug.z,n)}else t.setPosition(Mm.x,Mm.y,Mm.z),t.setOrientation(Yp.x,Yp.y,Yp.z,Ug.x,Ug.y,Ug.z)}}class NP extends null{constructor(e){super(),this.type="Audio",this.listener=e,this.context=e.context,this.gain=this.context.createGain(),this.gain.connect(e.getInput()),this.autoplay=!1,this.buffer=null,this.detune=0,this.loop=!1,this.loopStart=0,this.loopEnd=0,this.offset=0,this.duration=void 0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.source=null,this.sourceType="empty",this._startedAt=0,this._progress=0,this._connected=!1,this.filters=[]}getOutput(){return this.gain}setNodeSource(e){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=e,this.connect(),this}setMediaElementSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(e),this.connect(),this}setMediaStreamSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(e),this.connect(),this}setBuffer(e){return this.buffer=e,this.sourceType="buffer",this.autoplay&&this.play(),this}play(e=0){if(this.isPlaying===!0){Lr("Audio: Audio is already playing.");return}if(this.hasPlaybackControl===!1){Lr("Audio: this Audio has no playback control.");return}this._startedAt=this.context.currentTime+e;const t=this.context.createBufferSource();return t.buffer=this.buffer,t.loop=this.loop,t.loopStart=this.loopStart,t.loopEnd=this.loopEnd,t.onended=this.onEnded.bind(this),t.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=t,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}pause(){if(this.hasPlaybackControl===!1){Lr("Audio: this Audio has no playback control.");return}return this.isPlaying===!0&&(this._progress+=Math.max(this.context.currentTime-this._startedAt,0)*this.playbackRate,this.loop===!0&&(this._progress=this._progress%(this.duration||this.buffer.duration)),this.source.stop(),this.source.onended=null,this.isPlaying=!1),this}stop(e=0){if(this.hasPlaybackControl===!1){Lr("Audio: this Audio has no playback control.");return}return this._progress=0,this.source!==null&&(this.source.stop(this.context.currentTime+e),this.source.onended=null),this.isPlaying=!1,this}connect(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(let e=1,t=this.filters.length;e<t;e++)this.filters[e-1].connect(this.filters[e]);this.filters[this.filters.length-1].connect(this.getOutput())}else this.source.connect(this.getOutput());return this._connected=!0,this}disconnect(){if(this._connected!==!1){if(this.filters.length>0){this.source.disconnect(this.filters[0]);for(let e=1,t=this.filters.length;e<t;e++)this.filters[e-1].disconnect(this.filters[e]);this.filters[this.filters.length-1].disconnect(this.getOutput())}else this.source.disconnect(this.getOutput());return this._connected=!1,this}}getFilters(){return this.filters}setFilters(e){return e||(e=[]),this._connected===!0?(this.disconnect(),this.filters=e.slice(),this.connect()):this.filters=e.slice(),this}setDetune(e){return this.detune=e,this.isPlaying===!0&&this.source.detune!==void 0&&this.source.detune.setTargetAtTime(this.detune,this.context.currentTime,.01),this}getDetune(){return this.detune}getFilter(){return this.getFilters()[0]}setFilter(e){return this.setFilters(e?[e]:[])}setPlaybackRate(e){if(this.hasPlaybackControl===!1){Lr("Audio: this Audio has no playback control.");return}return this.playbackRate=e,this.isPlaying===!0&&this.source.playbackRate.setTargetAtTime(this.playbackRate,this.context.currentTime,.01),this}getPlaybackRate(){return this.playbackRate}onEnded(){this.isPlaying=!1,this._progress=0}getLoop(){return this.hasPlaybackControl===!1?(Lr("Audio: this Audio has no playback control."),!1):this.loop}setLoop(e){if(this.hasPlaybackControl===!1){Lr("Audio: this Audio has no playback control.");return}return this.loop=e,this.isPlaying===!0&&(this.source.loop=this.loop),this}setLoopStart(e){return this.loopStart=e,this}setLoopEnd(e){return this.loopEnd=e,this}getVolume(){return this.gain.gain.value}setVolume(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}copy(e,t){return super.copy(e,t),e.sourceType!=="buffer"?(Lr("Audio: Audio source type cannot be copied."),this):(this.autoplay=e.autoplay,this.buffer=e.buffer,this.detune=e.detune,this.loop=e.loop,this.loopStart=e.loopStart,this.loopEnd=e.loopEnd,this.offset=e.offset,this.duration=e.duration,this.playbackRate=e.playbackRate,this.hasPlaybackControl=e.hasPlaybackControl,this.sourceType=e.sourceType,this.filters=e.filters.slice(),this)}clone(e){return new this.constructor(this.listener).copy(this,e)}}const Cm=new le,Qx=new Ze,iy=new le,Og=new le;class Wx extends null{constructor(e){super(e),this.panner=this.context.createPanner(),this.panner.panningModel="HRTF",this.panner.connect(this.gain)}connect(){return super.connect(),this.panner.connect(this.gain),this}disconnect(){return super.disconnect(),this.panner.disconnect(this.gain),this}getOutput(){return this.panner}getRefDistance(){return this.panner.refDistance}setRefDistance(e){return this.panner.refDistance=e,this}getRolloffFactor(){return this.panner.rolloffFactor}setRolloffFactor(e){return this.panner.rolloffFactor=e,this}getDistanceModel(){return this.panner.distanceModel}setDistanceModel(e){return this.panner.distanceModel=e,this}getMaxDistance(){return this.panner.maxDistance}setMaxDistance(e){return this.panner.maxDistance=e,this}setDirectionalCone(e,t,n){return this.panner.coneInnerAngle=e,this.panner.coneOuterAngle=t,this.panner.coneOuterGain=n,this}updateMatrixWorld(e){if(super.updateMatrixWorld(e),this.hasPlaybackControl===!0&&this.isPlaying===!1)return;this.matrixWorld.decompose(Cm,Qx,iy),Og.set(0,0,1).applyQuaternion(Qx);const t=this.panner;if(t.positionX){const n=this.context.currentTime+this.listener.timeDelta;t.positionX.linearRampToValueAtTime(Cm.x,n),t.positionY.linearRampToValueAtTime(Cm.y,n),t.positionZ.linearRampToValueAtTime(Cm.z,n),t.orientationX.linearRampToValueAtTime(Og.x,n),t.orientationY.linearRampToValueAtTime(Og.y,n),t.orientationZ.linearRampToValueAtTime(Og.z,n)}else t.setPosition(Cm.x,Cm.y,Cm.z),t.setOrientation(Og.x,Og.y,Og.z)}}class kE{constructor(e,t=2048){this.analyser=e.context.createAnalyser(),this.analyser.fftSize=t,this.data=new Uint8Array(this.analyser.frequencyBinCount),e.getOutput().connect(this.analyser)}getFrequencyData(){return this.analyser.getByteFrequencyData(this.data),this.data}getAverageFrequency(){let e=0;const t=this.getFrequencyData();for(let n=0;n<t.length;n++)e+=t[n];return e/t.length}}class hw{constructor(e,t,n){this.binding=e,this.valueSize=n;let i,a,o;switch(t){case"quaternion":i=this._slerp,a=this._slerpAdditive,o=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(n*6),this._workIndex=5;break;case"string":case"bool":i=this._select,a=this._select,o=this._setAdditiveIdentityOther,this.buffer=new Array(n*5);break;default:i=this._lerp,a=this._lerpAdditive,o=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(n*5)}this._mixBufferRegion=i,this._mixBufferRegionAdditive=a,this._setIdentity=o,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0}accumulate(e,t){const n=this.buffer,i=this.valueSize,a=e*i+i;let o=this.cumulativeWeight;if(o===0){for(let u=0;u!==i;++u)n[a+u]=n[u];o=t}else{o+=t;const u=t/o;this._mixBufferRegion(n,a,0,u,i)}this.cumulativeWeight=o}accumulateAdditive(e){const t=this.buffer,n=this.valueSize,i=n*this._addIndex;this.cumulativeWeightAdditive===0&&this._setIdentity(),this._mixBufferRegionAdditive(t,i,0,e,n),this.cumulativeWeightAdditive+=e}apply(e){const t=this.valueSize,n=this.buffer,i=e*t+t,a=this.cumulativeWeight,o=this.cumulativeWeightAdditive,u=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,a<1){const c=t*this._origIndex;this._mixBufferRegion(n,i,c,1-a,t)}o>0&&this._mixBufferRegionAdditive(n,i,this._addIndex*t,1,t);for(let c=t,d=t+t;c!==d;++c)if(n[c]!==n[c+t]){u.setValue(n,i);break}}saveOriginalState(){const e=this.binding,t=this.buffer,n=this.valueSize,i=n*this._origIndex;e.getValue(t,i);for(let a=n,o=i;a!==o;++a)t[a]=t[i+a%n];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){const e=this.valueSize*3;this.binding.setValue(this.buffer,e)}_setAdditiveIdentityNumeric(){const e=this._addIndex*this.valueSize,t=e+this.valueSize;for(let n=e;n<t;n++)this.buffer[n]=0}_setAdditiveIdentityQuaternion(){this._setAdditiveIdentityNumeric(),this.buffer[this._addIndex*this.valueSize+3]=1}_setAdditiveIdentityOther(){const e=this._origIndex*this.valueSize,t=this._addIndex*this.valueSize;for(let n=0;n<this.valueSize;n++)this.buffer[t+n]=this.buffer[e+n]}_select(e,t,n,i,a){if(i>=.5)for(let o=0;o!==a;++o)e[t+o]=e[n+o]}_slerp(e,t,n,i){Ze.slerpFlat(e,t,e,t,e,n,i)}_slerpAdditive(e,t,n,i,a){const o=this._workIndex*a;Ze.multiplyQuaternionsFlat(e,o,e,t,e,n),Ze.slerpFlat(e,t,e,t,e,o,i)}_lerp(e,t,n,i,a){const o=1-i;for(let u=0;u!==a;++u){const c=t+u;e[c]=e[c]*o+e[n+u]*i}}_lerpAdditive(e,t,n,i,a){for(let o=0;o!==a;++o){const u=t+o;e[u]=e[u]+e[n+o]*i}}}const sy="\\[\\]\\.:\\/",dw=new RegExp("["+sy+"]","g"),ay="[^"+sy+"]",fw="[^"+sy.replace("\\.","")+"]",Aw=/((?:WC+[\/:])*)/.source.replace("WC",ay),pw=/(WCOD+)?/.source.replace("WCOD",fw),Cl=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",ay),VE=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",ay),gw=new RegExp("^"+Aw+pw+Cl+VE+"$"),mw=["material","materials","bones","map"];class zE{constructor(e,t,n){const i=n||Nl.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,i)}getValue(e,t){this.bind();const n=this._targetGroup.nCachedObjects_,i=this._bindings[n];i!==void 0&&i.getValue(e,t)}setValue(e,t){const n=this._bindings;for(let i=this._targetGroup.nCachedObjects_,a=n.length;i!==a;++i)n[i].setValue(e,t)}bind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].bind()}unbind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].unbind()}}class Nl{constructor(e,t,n){this.path=t,this.parsedPath=n||Nl.parseTrackName(t),this.node=Nl.findNode(e,this.parsedPath.nodeName),this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,n){return e&&e.isAnimationObjectGroup?new Nl.Composite(e,t,n):new Nl(e,t,n)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(dw,"")}static parseTrackName(e){const t=gw.exec(e);if(t===null)throw new Error("PropertyBinding: Cannot parse trackName: "+e);const n={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},i=n.nodeName&&n.nodeName.lastIndexOf(".");if(i!==void 0&&i!==-1){const a=n.nodeName.substring(i+1);mw.indexOf(a)!==-1&&(n.nodeName=n.nodeName.substring(0,i),n.objectName=a)}if(n.propertyName===null||n.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return n}static findNode(e,t){if(t===void 0||t===""||t==="."||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){const n=e.skeleton.getBoneByName(t);if(n!==void 0)return n}if(e.children){const n=function(a){for(let o=0;o<a.length;o++){const u=a[o];if(u.name===t||u.uuid===t)return u;const c=n(u.children);if(c)return c}return null},i=n(e.children);if(i)return i}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(e,t){e[t]=this.targetObject[this.propertyName]}_getValue_array(e,t){const n=this.resolvedProperty;for(let i=0,a=n.length;i!==a;++i)e[t++]=n[i]}_getValue_arrayElement(e,t){e[t]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(e,t){this.resolvedProperty.toArray(e,t)}_setValue_direct(e,t){this.targetObject[this.propertyName]=e[t]}_setValue_direct_setNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(e,t){const n=this.resolvedProperty;for(let i=0,a=n.length;i!==a;++i)n[i]=e[t++]}_setValue_array_setNeedsUpdate(e,t){const n=this.resolvedProperty;for(let i=0,a=n.length;i!==a;++i)n[i]=e[t++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(e,t){const n=this.resolvedProperty;for(let i=0,a=n.length;i!==a;++i)n[i]=e[t++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(e,t){this.resolvedProperty[this.propertyIndex]=e[t]}_setValue_arrayElement_setNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(e,t){this.resolvedProperty.fromArray(e,t)}_setValue_fromArray_setNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(e,t){this.bind(),this.getValue(e,t)}_setValue_unbound(e,t){this.bind(),this.setValue(e,t)}bind(){let e=this.node;const t=this.parsedPath,n=t.objectName,i=t.propertyName;let a=t.propertyIndex;if(e||(e=Nl.findNode(this.rootNode,t.nodeName),this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!e){Lr("PropertyBinding: No target node found for track: "+this.path+".");return}if(n){let d=t.objectIndex;switch(n){case"materials":if(!e.material){Gr("PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.materials){Gr("PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);return}e=e.material.materials;break;case"bones":if(!e.skeleton){Gr("PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);return}e=e.skeleton.bones;for(let g=0;g<e.length;g++)if(e[g].name===d){d=g;break}break;case"map":if("map"in e){e=e.map;break}if(!e.material){Gr("PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.map){Gr("PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);return}e=e.material.map;break;default:if(e[n]===void 0){Gr("PropertyBinding: Can not bind to objectName of node undefined.",this);return}e=e[n]}if(d!==void 0){if(e[d]===void 0){Gr("PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);return}e=e[d]}}const o=e[i];if(o===void 0){const d=t.nodeName;Gr("PropertyBinding: Trying to update property for track: "+d+"."+i+" but it wasn't found.",e);return}let u=this.Versioning.None;this.targetObject=e,e.isMaterial===!0?u=this.Versioning.NeedsUpdate:e.isObject3D===!0&&(u=this.Versioning.MatrixWorldNeedsUpdate);let c=this.BindingType.Direct;if(a!==void 0){if(i==="morphTargetInfluences"){if(!e.geometry){Gr("PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(!e.geometry.morphAttributes){Gr("PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);return}e.morphTargetDictionary[a]!==void 0&&(a=e.morphTargetDictionary[a])}c=this.BindingType.ArrayElement,this.resolvedProperty=o,this.propertyIndex=a}else o.fromArray!==void 0&&o.toArray!==void 0?(c=this.BindingType.HasFromToArray,this.resolvedProperty=o):Array.isArray(o)?(c=this.BindingType.EntireArray,this.resolvedProperty=o):this.propertyName=i;this.getValue=this.GetterByBindingType[c],this.setValue=this.SetterByBindingTypeAndVersioning[c][u]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}Nl.Composite=zE,Nl.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},Nl.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},Nl.prototype.GetterByBindingType=[Nl.prototype._getValue_direct,Nl.prototype._getValue_array,Nl.prototype._getValue_arrayElement,Nl.prototype._getValue_toArray],Nl.prototype.SetterByBindingTypeAndVersioning=[[Nl.prototype._setValue_direct,Nl.prototype._setValue_direct_setNeedsUpdate,Nl.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[Nl.prototype._setValue_array,Nl.prototype._setValue_array_setNeedsUpdate,Nl.prototype._setValue_array_setMatrixWorldNeedsUpdate],[Nl.prototype._setValue_arrayElement,Nl.prototype._setValue_arrayElement_setNeedsUpdate,Nl.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[Nl.prototype._setValue_fromArray,Nl.prototype._setValue_fromArray_setNeedsUpdate,Nl.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];class vw{constructor(){this.isAnimationObjectGroup=!0,this.uuid=oc(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;const e={};this._indicesByUUID=e;for(let n=0,i=arguments.length;n!==i;++n)e[arguments[n].uuid]=n;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};const t=this;this.stats={objects:{get total(){return t._objects.length},get inUse(){return this.total-t.nCachedObjects_}},get bindingsPerObject(){return t._bindings.length}}}add(){const e=this._objects,t=this._indicesByUUID,n=this._paths,i=this._parsedPaths,a=this._bindings,o=a.length;let u,c=e.length,d=this.nCachedObjects_;for(let g=0,v=arguments.length;g!==v;++g){const M=arguments[g],B=M.uuid;let I=t[B];if(I===void 0){I=c++,t[B]=I,e.push(M);for(let ne=0,ee=o;ne!==ee;++ne)a[ne].push(new Nl(M,n[ne],i[ne]))}else if(I<d){u=e[I];const ne=--d,ee=e[ne];t[ee.uuid]=I,e[I]=ee,t[B]=ne,e[ne]=M;for(let q=0,ye=o;q!==ye;++q){const Ce=a[q],ke=Ce[ne];let nt=Ce[I];Ce[I]=ke,nt===void 0&&(nt=new Nl(M,n[q],i[q])),Ce[ne]=nt}}else e[I]!==u&&Gr("AnimationObjectGroup: Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes.")}this.nCachedObjects_=d}remove(){const e=this._objects,t=this._indicesByUUID,n=this._bindings,i=n.length;let a=this.nCachedObjects_;for(let o=0,u=arguments.length;o!==u;++o){const c=arguments[o],d=c.uuid,g=t[d];if(g!==void 0&&g>=a){const v=a++,M=e[v];t[M.uuid]=g,e[g]=M,t[d]=v,e[v]=c;for(let B=0,I=i;B!==I;++B){const ne=n[B],ee=ne[v],q=ne[g];ne[g]=ee,ne[v]=q}}}this.nCachedObjects_=a}uncache(){const e=this._objects,t=this._indicesByUUID,n=this._bindings,i=n.length;let a=this.nCachedObjects_,o=e.length;for(let u=0,c=arguments.length;u!==c;++u){const d=arguments[u],g=d.uuid,v=t[g];if(v!==void 0)if(delete t[g],v<a){const M=--a,B=e[M],I=--o,ne=e[I];t[B.uuid]=v,e[v]=B,t[ne.uuid]=M,e[M]=ne,e.pop();for(let ee=0,q=i;ee!==q;++ee){const ye=n[ee],Ce=ye[M],ke=ye[I];ye[v]=Ce,ye[M]=ke,ye.pop()}}else{const M=--o,B=e[M];M>0&&(t[B.uuid]=v),e[v]=B,e.pop();for(let I=0,ne=i;I!==ne;++I){const ee=n[I];ee[v]=ee[M],ee.pop()}}}this.nCachedObjects_=a}subscribe_(e,t){const n=this._bindingsIndicesByPath;let i=n[e];const a=this._bindings;if(i!==void 0)return a[i];const o=this._paths,u=this._parsedPaths,c=this._objects,d=c.length,g=this.nCachedObjects_,v=new Array(d);i=a.length,n[e]=i,o.push(e),u.push(t),a.push(v);for(let M=g,B=c.length;M!==B;++M){const I=c[M];v[M]=new Nl(I,e,t)}return v}unsubscribe_(e){const t=this._bindingsIndicesByPath,n=t[e];if(n!==void 0){const i=this._paths,a=this._parsedPaths,o=this._bindings,u=o.length-1,c=o[u],d=e[u];t[d]=n,o[n]=c,o.pop(),a[n]=a[u],a.pop(),i[n]=i[u],i.pop()}}}class yw{constructor(e,t,n=null,i=t.blendMode){this._mixer=e,this._clip=t,this._localRoot=n,this.blendMode=i;const a=t.tracks,o=a.length,u=new Array(o),c={endingStart:Aa,endingEnd:Aa};for(let d=0;d!==o;++d){const g=a[d].createInterpolant(null);u[d]=g,g.settings=c}this._interpolantSettings=c,this._interpolants=u,this._propertyBindings=new Array(o),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=Ii,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}play(){return this._mixer._activateAction(this),this}stop(){return this._mixer._deactivateAction(this),this.reset()}reset(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}isRunning(){return this.enabled&&!this.paused&&this.timeScale!==0&&this._startTime===null&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(e){return this._startTime=e,this}setLoop(e,t){return this.loop=e,this.repetitions=t,this}setEffectiveWeight(e){return this.weight=e,this._effectiveWeight=this.enabled?e:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(e){return this._scheduleFading(e,0,1)}fadeOut(e){return this._scheduleFading(e,1,0)}crossFadeFrom(e,t,n=!1){if(e.fadeOut(t),this.fadeIn(t),n===!0){const i=this._clip.duration,a=e._clip.duration,o=a/i,u=i/a;e.warp(1,o,t),this.warp(u,1,t)}return this}crossFadeTo(e,t,n=!1){return e.crossFadeFrom(this,t,n)}stopFading(){const e=this._weightInterpolant;return e!==null&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}setEffectiveTimeScale(e){return this.timeScale=e,this._effectiveTimeScale=this.paused?0:e,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(e){return this.timeScale=this._clip.duration/e,this.stopWarping()}syncWith(e){return this.time=e.time,this.timeScale=e.timeScale,this.stopWarping()}halt(e){return this.warp(this._effectiveTimeScale,0,e)}warp(e,t,n){const i=this._mixer,a=i.time,o=this.timeScale;let u=this._timeScaleInterpolant;u===null&&(u=i._lendControlInterpolant(),this._timeScaleInterpolant=u);const c=u.parameterPositions,d=u.sampleValues;return c[0]=a,c[1]=a+n,d[0]=e/o,d[1]=t/o,this}stopWarping(){const e=this._timeScaleInterpolant;return e!==null&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(e,t,n,i){if(!this.enabled){this._updateWeight(e);return}const a=this._startTime;if(a!==null){const c=(e-a)*n;c<0||n===0?t=0:(this._startTime=null,t=n*c)}t*=this._updateTimeScale(e);const o=this._updateTime(t),u=this._updateWeight(e);if(u>0){const c=this._interpolants,d=this._propertyBindings;switch(this.blendMode){case $a:for(let g=0,v=c.length;g!==v;++g)c[g].evaluate(o),d[g].accumulateAdditive(u);break;case Ai:default:for(let g=0,v=c.length;g!==v;++g)c[g].evaluate(o),d[g].accumulate(i,u)}}}_updateWeight(e){let t=0;if(this.enabled){t=this.weight;const n=this._weightInterpolant;if(n!==null){const i=n.evaluate(e)[0];t*=i,e>n.parameterPositions[1]&&(this.stopFading(),i===0&&(this.enabled=!1))}}return this._effectiveWeight=t,t}_updateTimeScale(e){let t=0;if(!this.paused){t=this.timeScale;const n=this._timeScaleInterpolant;if(n!==null){const i=n.evaluate(e)[0];t*=i,e>n.parameterPositions[1]&&(this.stopWarping(),t===0?this.paused=!0:this.timeScale=t)}}return this._effectiveTimeScale=t,t}_updateTime(e){const t=this._clip.duration,n=this.loop;let i=this.time+e,a=this._loopCount;const o=n===Di;if(e===0)return a===-1?i:o&&(a&1)===1?t-i:i;if(n===$r){a===-1&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(i>=t)i=t;else if(i<0)i=0;else{this.time=i;break e}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(a===-1&&(e>=0?(a=0,this._setEndings(!0,this.repetitions===0,o)):this._setEndings(this.repetitions===0,!0,o)),i>=t||i<0){const u=Math.floor(i/t);i-=t*u,a+=Math.abs(u);const c=this.repetitions-a;if(c<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,i=e>0?t:0,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(c===1){const d=e<0;this._setEndings(d,!d,o)}else this._setEndings(!1,!1,o);this._loopCount=a,this.time=i,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:u})}}else this.time=i;if(o&&(a&1)===1)return t-i}return i}_setEndings(e,t,n){const i=this._interpolantSettings;n?(i.endingStart=sa,i.endingEnd=sa):(e?i.endingStart=this.zeroSlopeAtStart?sa:Aa:i.endingStart=ca,t?i.endingEnd=this.zeroSlopeAtEnd?sa:Aa:i.endingEnd=ca)}_scheduleFading(e,t,n){const i=this._mixer,a=i.time;let o=this._weightInterpolant;o===null&&(o=i._lendControlInterpolant(),this._weightInterpolant=o);const u=o.parameterPositions,c=o.sampleValues;return u[0]=a,c[0]=t,u[1]=a+e,c[1]=n,this}}const GE=new Float32Array(1);class FP extends null{constructor(e){super(),this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(e,t){const n=e._localRoot||this._root,i=e._clip.tracks,a=i.length,o=e._propertyBindings,u=e._interpolants,c=n.uuid,d=this._bindingsByRootAndName;let g=d[c];g===void 0&&(g={},d[c]=g);for(let v=0;v!==a;++v){const M=i[v],B=M.name;let I=g[B];if(I!==void 0)++I.referenceCount,o[v]=I;else{if(I=o[v],I!==void 0){I._cacheIndex===null&&(++I.referenceCount,this._addInactiveBinding(I,c,B));continue}const ne=t&&t._propertyBindings[v].binding.parsedPath;I=new hw(Nl.create(n,B,ne),M.ValueTypeName,M.getValueSize()),++I.referenceCount,this._addInactiveBinding(I,c,B),o[v]=I}u[v].resultBuffer=I.buffer}}_activateAction(e){if(!this._isActiveAction(e)){if(e._cacheIndex===null){const n=(e._localRoot||this._root).uuid,i=e._clip.uuid,a=this._actionsByClip[i];this._bindAction(e,a&&a.knownActions[0]),this._addInactiveAction(e,i,n)}const t=e._propertyBindings;for(let n=0,i=t.length;n!==i;++n){const a=t[n];a.useCount++===0&&(this._lendBinding(a),a.saveOriginalState())}this._lendAction(e)}}_deactivateAction(e){if(this._isActiveAction(e)){const t=e._propertyBindings;for(let n=0,i=t.length;n!==i;++n){const a=t[n];--a.useCount===0&&(a.restoreOriginalState(),this._takeBackBinding(a))}this._takeBackAction(e)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;const e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}}_isActiveAction(e){const t=e._cacheIndex;return t!==null&&t<this._nActiveActions}_addInactiveAction(e,t,n){const i=this._actions,a=this._actionsByClip;let o=a[t];if(o===void 0)o={knownActions:[e],actionByRoot:{}},e._byClipCacheIndex=0,a[t]=o;else{const u=o.knownActions;e._byClipCacheIndex=u.length,u.push(e)}e._cacheIndex=i.length,i.push(e),o.actionByRoot[n]=e}_removeInactiveAction(e){const t=this._actions,n=t[t.length-1],i=e._cacheIndex;n._cacheIndex=i,t[i]=n,t.pop(),e._cacheIndex=null;const a=e._clip.uuid,o=this._actionsByClip,u=o[a],c=u.knownActions,d=c[c.length-1],g=e._byClipCacheIndex;d._byClipCacheIndex=g,c[g]=d,c.pop(),e._byClipCacheIndex=null;const v=u.actionByRoot,M=(e._localRoot||this._root).uuid;delete v[M],c.length===0&&delete o[a],this._removeInactiveBindingsForAction(e)}_removeInactiveBindingsForAction(e){const t=e._propertyBindings;for(let n=0,i=t.length;n!==i;++n){const a=t[n];--a.referenceCount===0&&this._removeInactiveBinding(a)}}_lendAction(e){const t=this._actions,n=e._cacheIndex,i=this._nActiveActions++,a=t[i];e._cacheIndex=i,t[i]=e,a._cacheIndex=n,t[n]=a}_takeBackAction(e){const t=this._actions,n=e._cacheIndex,i=--this._nActiveActions,a=t[i];e._cacheIndex=i,t[i]=e,a._cacheIndex=n,t[n]=a}_addInactiveBinding(e,t,n){const i=this._bindingsByRootAndName,a=this._bindings;let o=i[t];o===void 0&&(o={},i[t]=o),o[n]=e,e._cacheIndex=a.length,a.push(e)}_removeInactiveBinding(e){const t=this._bindings,n=e.binding,i=n.rootNode.uuid,a=n.path,o=this._bindingsByRootAndName,u=o[i],c=t[t.length-1],d=e._cacheIndex;c._cacheIndex=d,t[d]=c,t.pop(),delete u[a],Object.keys(u).length===0&&delete o[i]}_lendBinding(e){const t=this._bindings,n=e._cacheIndex,i=this._nActiveBindings++,a=t[i];e._cacheIndex=i,t[i]=e,a._cacheIndex=n,t[n]=a}_takeBackBinding(e){const t=this._bindings,n=e._cacheIndex,i=--this._nActiveBindings,a=t[i];e._cacheIndex=i,t[i]=e,a._cacheIndex=n,t[n]=a}_lendControlInterpolant(){const e=this._controlInterpolants,t=this._nActiveControlInterpolants++;let n=e[t];return n===void 0&&(n=new Rg(new Float32Array(2),new Float32Array(2),1,GE),n.__cacheIndex=t,e[t]=n),n}_takeBackControlInterpolant(e){const t=this._controlInterpolants,n=e.__cacheIndex,i=--this._nActiveControlInterpolants,a=t[i];e.__cacheIndex=i,t[i]=e,a.__cacheIndex=n,t[n]=a}clipAction(e,t,n){const i=t||this._root,a=i.uuid;let o=typeof e=="string"?W0.findByName(i,e):e;const u=o!==null?o.uuid:e,c=this._actionsByClip[u];let d=null;if(n===void 0&&(o!==null?n=o.blendMode:n=Ai),c!==void 0){const v=c.actionByRoot[a];if(v!==void 0&&v.blendMode===n)return v;d=c.knownActions[0],o===null&&(o=d._clip)}if(o===null)return null;const g=new yw(this,o,t,n);return this._bindAction(g,d),this._addInactiveAction(g,u,a),g}existingAction(e,t){const n=t||this._root,i=n.uuid,a=typeof e=="string"?W0.findByName(n,e):e,o=a?a.uuid:e,u=this._actionsByClip[o];return u!==void 0&&u.actionByRoot[i]||null}stopAllAction(){const e=this._actions,t=this._nActiveActions;for(let n=t-1;n>=0;--n)e[n].stop();return this}update(e){e*=this.timeScale;const t=this._actions,n=this._nActiveActions,i=this.time+=e,a=Math.sign(e),o=this._accuIndex^=1;for(let d=0;d!==n;++d)t[d]._update(i,e,a,o);const u=this._bindings,c=this._nActiveBindings;for(let d=0;d!==c;++d)u[d].apply(o);return this}setTime(e){this.time=0;for(let t=0;t<this._actions.length;t++)this._actions[t].time=0;return this.update(e)}getRoot(){return this._root}uncacheClip(e){const t=this._actions,n=e.uuid,i=this._actionsByClip,a=i[n];if(a!==void 0){const o=a.knownActions;for(let u=0,c=o.length;u!==c;++u){const d=o[u];this._deactivateAction(d);const g=d._cacheIndex,v=t[t.length-1];d._cacheIndex=null,d._byClipCacheIndex=null,v._cacheIndex=g,t[g]=v,t.pop(),this._removeInactiveBindingsForAction(d)}delete i[n]}}uncacheRoot(e){const t=e.uuid,n=this._actionsByClip;for(const o in n){const u=n[o].actionByRoot,c=u[t];c!==void 0&&(this._deactivateAction(c),this._removeInactiveAction(c))}const i=this._bindingsByRootAndName,a=i[t];if(a!==void 0)for(const o in a){const u=a[o];u.restoreOriginalState(),this._removeInactiveBinding(u)}}uncacheAction(e,t){const n=this.existingAction(e,t);n!==null&&(this._deactivateAction(n),this._removeInactiveAction(n))}}class PP extends null{constructor(e=1,t=1,n=1,i={}){super(e,t,i),this.isRenderTarget3D=!0,this.depth=n,this.texture=new oe(null,e,t,n),this._setTextureOptions(i),this.texture.isRenderTargetTexture=!0}}class oy{constructor(e){this.value=e}clone(){return new oy(this.value.clone===void 0?this.value:this.value.clone())}}let HE=0;class xw extends null{constructor(){super(),this.isUniformsGroup=!0,Object.defineProperty(this,"id",{value:HE++}),this.name="",this.usage=gh,this.uniforms=[]}add(e){return this.uniforms.push(e),this}remove(e){const t=this.uniforms.indexOf(e);return t!==-1&&this.uniforms.splice(t,1),this}setName(e){return this.name=e,this}setUsage(e){return this.usage=e,this}dispose(){this.dispatchEvent({type:"dispose"})}copy(e){this.name=e.name,this.usage=e.usage;const t=e.uniforms;this.uniforms.length=0;for(let n=0,i=t.length;n<i;n++){const a=Array.isArray(t[n])?t[n]:[t[n]];for(let o=0;o<a.length;o++)this.uniforms.push(a[o].clone())}return this}clone(){return new this.constructor().copy(this)}}class ly extends wh{constructor(e,t,n=1){super(e,t),this.isInstancedInterleavedBuffer=!0,this.meshPerAttribute=n}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}clone(e){const t=super.clone(e);return t.meshPerAttribute=this.meshPerAttribute,t}toJSON(e){const t=super.toJSON(e);return t.isInstancedInterleavedBuffer=!0,t.meshPerAttribute=this.meshPerAttribute,t}}class LP{constructor(e,t,n,i,a,o=!1){this.isGLBufferAttribute=!0,this.name="",this.buffer=e,this.type=t,this.itemSize=n,this.elementSize=i,this.count=a,this.normalized=o,this.version=0}set needsUpdate(e){e===!0&&this.version++}setBuffer(e){return this.buffer=e,this}setType(e,t){return this.type=e,this.elementSize=t,this}setItemSize(e){return this.itemSize=e,this}setCount(e){return this.count=e,this}}const Zx=new di;class bw{constructor(e,t,n=0,i=1/0){this.ray=new aa(e,t),this.near=n,this.far=i,this.camera=null,this.layers=new dl,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(e,t){this.ray.set(e,t)}setFromCamera(e,t){t.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(e.x,e.y,.5).unproject(t).sub(this.ray.origin).normalize(),this.camera=t):t.isOrthographicCamera?(this.ray.origin.set(e.x,e.y,(t.near+t.far)/(t.near-t.far)).unproject(t),this.ray.direction.set(0,0,-1).transformDirection(t.matrixWorld),this.camera=t):Gr("Raycaster: Unsupported camera type: "+t.type)}setFromXRController(e){return Zx.identity().extractRotation(e.matrixWorld),this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(0,0,-1).applyMatrix4(Zx),this}intersectObject(e,t=!0,n=[]){return q0(e,this,n,t),n.sort(_w),n}intersectObjects(e,t=!0,n=[]){for(let i=0,a=e.length;i<a;i++)q0(e[i],this,n,t);return n.sort(_w),n}}function _w(s,e){return s.distance-e.distance}function q0(s,e,t,n){let i=!0;if(s.layers.test(e.layers)&&s.raycast(e,t)===!1&&(i=!1),i===!0&&n===!0){const a=s.children;for(let o=0,u=a.length;o<u;o++)q0(a[o],e,t,!0)}}class ww{constructor(){this._previousTime=0,this._currentTime=0,this._startTime=performance.now(),this._delta=0,this._elapsed=0,this._timescale=1,this._document=null,this._pageVisibilityHandler=null}connect(e){this._document=e,e.hidden!==void 0&&(this._pageVisibilityHandler=QE.bind(this),e.addEventListener("visibilitychange",this._pageVisibilityHandler,!1))}disconnect(){this._pageVisibilityHandler!==null&&(this._document.removeEventListener("visibilitychange",this._pageVisibilityHandler),this._pageVisibilityHandler=null),this._document=null}getDelta(){return this._delta/1e3}getElapsed(){return this._elapsed/1e3}getTimescale(){return this._timescale}setTimescale(e){return this._timescale=e,this}reset(){return this._currentTime=performance.now()-this._startTime,this}dispose(){this.disconnect()}update(e){return this._pageVisibilityHandler!==null&&this._document.hidden===!0?this._delta=0:(this._previousTime=this._currentTime,this._currentTime=(e!==void 0?e:performance.now())-this._startTime,this._delta=(this._currentTime-this._previousTime)*this._timescale,this._elapsed+=this._delta),this}}function QE(){this._document.hidden===!1&&this.reset()}class uy{constructor(e=1,t=0,n=0){this.radius=e,this.phi=t,this.theta=n}set(e,t,n){return this.radius=e,this.phi=t,this.theta=n,this}copy(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this}makeSafe(){return this.phi=Ca(this.phi,1e-6,Math.PI-1e-6),this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,n){return this.radius=Math.sqrt(e*e+t*t+n*n),this.radius===0?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,n),this.phi=Math.acos(Ca(t/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}}class cy{constructor(e=1,t=0,n=0){this.radius=e,this.theta=t,this.y=n}set(e,t,n){return this.radius=e,this.theta=t,this.y=n,this}copy(e){return this.radius=e.radius,this.theta=e.theta,this.y=e.y,this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,n){return this.radius=Math.sqrt(e*e+n*n),this.theta=Math.atan2(e,n),this.y=t,this}clone(){return new this.constructor().copy(this)}}class gp{constructor(e,t,n,i){gp.prototype.isMatrix2=!0,this.elements=[1,0,0,1],e!==void 0&&this.set(e,t,n,i)}identity(){return this.set(1,0,0,1),this}fromArray(e,t=0){for(let n=0;n<4;n++)this.elements[n]=e[n+t];return this}set(e,t,n,i){const a=this.elements;return a[0]=e,a[2]=t,a[1]=n,a[3]=i,this}}const Dg=new ce;class Kx{constructor(e=new ce(1/0,1/0),t=new ce(-1/0,-1/0)){this.isBox2=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){const n=Dg.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y}getCenter(e){return this.isEmpty()?e.set(0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}containsPoint(e){return e.x>=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y}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}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))}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}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Dg).distanceTo(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}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 $x=new le,J0=new le,n0=new le,kg=new le,Xx=new le,qp=new le,ev=new le;class jx{constructor(e=new le,t=new le){this.start=e,this.end=t}set(e,t){return this.start.copy(e),this.end.copy(t),this}copy(e){return this.start.copy(e.start),this.end.copy(e.end),this}getCenter(e){return e.addVectors(this.start,this.end).multiplyScalar(.5)}delta(e){return e.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(e,t){return this.delta(t).multiplyScalar(e).add(this.start)}closestPointToPointParameter(e,t){$x.subVectors(e,this.start),J0.subVectors(this.end,this.start);const n=J0.dot(J0);let a=J0.dot($x)/n;return t&&(a=Ca(a,0,1)),a}closestPointToPoint(e,t,n){const i=this.closestPointToPointParameter(e,t);return this.delta(n).multiplyScalar(i).add(this.start)}distanceSqToLine3(e,t=qp,n=ev){const i=10000000000000001e-32;let a,o;const u=this.start,c=e.start,d=this.end,g=e.end;n0.subVectors(d,u),kg.subVectors(g,c),Xx.subVectors(u,c);const v=n0.dot(n0),M=kg.dot(kg),B=kg.dot(Xx);if(v<=i&&M<=i)return t.copy(u),n.copy(c),t.sub(n),t.dot(t);if(v<=i)a=0,o=B/M,o=Ca(o,0,1);else{const I=n0.dot(Xx);if(M<=i)o=0,a=Ca(-I/v,0,1);else{const ne=n0.dot(kg),ee=v*M-ne*ne;ee!==0?a=Ca((ne*B-I*M)/ee,0,1):a=0,o=(ne*a+B)/M,o<0?(o=0,a=Ca(-I/v,0,1)):o>1&&(o=1,a=Ca((ne-I)/v,0,1))}}return t.copy(u).add(n0.multiplyScalar(a)),n.copy(c).add(kg.multiplyScalar(o)),t.sub(n),t.dot(t)}applyMatrix4(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this}equals(e){return e.start.equals(this.start)&&e.end.equals(this.end)}clone(){return new this.constructor().copy(this)}}const Sw=new le;class Mw extends null{constructor(e,t){super(),this.light=e,this.matrixAutoUpdate=!1,this.color=t,this.type="SpotLightHelper";const n=new ka,i=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1];for(let o=0,u=1,c=32;o<c;o++,u++){const d=o/c*Math.PI*2,g=u/c*Math.PI*2;i.push(Math.cos(d),Math.sin(d),1,Math.cos(g),Math.sin(g),1)}n.setAttribute("position",new Ui(i,3));const a=new fl({fog:!1,toneMapped:!1});this.cone=new dp(n,a),this.add(this.cone),this.update()}dispose(){this.cone.geometry.dispose(),this.cone.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.light.target.updateWorldMatrix(!0,!1),this.parent?(this.parent.updateWorldMatrix(!0),this.matrix.copy(this.parent.matrixWorld).invert().multiply(this.light.matrixWorld)):this.matrix.copy(this.light.matrixWorld),this.matrixWorld.copy(this.light.matrixWorld);const e=this.light.distance?this.light.distance:1e3,t=e*Math.tan(this.light.angle);this.cone.scale.set(t,t,e),Sw.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(Sw),this.color!==void 0?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)}}const Vg=new le,tv=new di,nv=new di;class Ew extends null{constructor(e){const t=Cw(e),n=new ka,i=[],a=[];for(let d=0;d<t.length;d++){const g=t[d];g.parent&&g.parent.isBone&&(i.push(0,0,0),i.push(0,0,0),a.push(0,0,0),a.push(0,0,0))}n.setAttribute("position",new Ui(i,3)),n.setAttribute("color",new Ui(a,3));const o=new fl({vertexColors:!0,depthTest:!1,depthWrite:!1,toneMapped:!1,transparent:!0});super(n,o),this.isSkeletonHelper=!0,this.type="SkeletonHelper",this.root=e,this.bones=t,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1;const u=new Wr(255),c=new Wr(65280);this.setColors(u,c)}updateMatrixWorld(e){const t=this.bones,n=this.geometry,i=n.getAttribute("position");nv.copy(this.root.matrixWorld).invert();for(let a=0,o=0;a<t.length;a++){const u=t[a];u.parent&&u.parent.isBone&&(tv.multiplyMatrices(nv,u.matrixWorld),Vg.setFromMatrixPosition(tv),i.setXYZ(o,Vg.x,Vg.y,Vg.z),tv.multiplyMatrices(nv,u.parent.matrixWorld),Vg.setFromMatrixPosition(tv),i.setXYZ(o+1,Vg.x,Vg.y,Vg.z),o+=2)}n.getAttribute("position").needsUpdate=!0,super.updateMatrixWorld(e)}setColors(e,t){const i=this.geometry.getAttribute("color");for(let a=0;a<i.count;a+=2)i.setXYZ(a,e.r,e.g,e.b),i.setXYZ(a+1,t.r,t.g,t.b);return i.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}}function Cw(s){const e=[];s.isBone===!0&&e.push(s);for(let t=0;t<s.children.length;t++)e.push(...Cw(s.children[t]));return e}class UP extends null{constructor(e,t,n){const i=new sd(t,4,2),a=new Yl({wireframe:!0,fog:!1,toneMapped:!1});super(i,a),this.light=e,this.color=n,this.type="PointLightHelper",this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1,this.update()}dispose(){this.geometry.dispose(),this.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.color!==void 0?this.material.color.set(this.color):this.material.color.copy(this.light.color)}}const WE=new le,hy=new Wr,r0=new Wr;class Tw extends null{constructor(e,t,n){super(),this.light=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=n,this.type="HemisphereLightHelper";const i=new Ju(t);i.rotateY(Math.PI*.5),this.material=new Yl({wireframe:!0,fog:!1,toneMapped:!1}),this.color===void 0&&(this.material.vertexColors=!0);const a=i.getAttribute("position"),o=new Float32Array(a.count*3);i.setAttribute("color",new wl(o,3)),this.add(new Il(i,this.material)),this.update()}dispose(){this.children[0].geometry.dispose(),this.children[0].material.dispose()}update(){const e=this.children[0];if(this.color!==void 0)this.material.color.set(this.color);else{const t=e.geometry.getAttribute("color");hy.copy(this.light.color),r0.copy(this.light.groundColor);for(let n=0,i=t.count;n<i;n++){const a=n<i/2?hy:r0;t.setXYZ(n,a.r,a.g,a.b)}t.needsUpdate=!0}this.light.updateWorldMatrix(!0,!1),e.lookAt(WE.setFromMatrixPosition(this.light.matrixWorld).negate())}}class OP extends null{constructor(e=10,t=10,n=4473924,i=8947848){n=new Wr(n),i=new Wr(i);const a=t/2,o=e/t,u=e/2,c=[],d=[];for(let M=0,B=0,I=-u;M<=t;M++,I+=o){c.push(-u,0,I,u,0,I),c.push(I,0,-u,I,0,u);const ne=M===a?n:i;ne.toArray(d,B),B+=3,ne.toArray(d,B),B+=3,ne.toArray(d,B),B+=3,ne.toArray(d,B),B+=3}const g=new ka;g.setAttribute("position",new Ui(c,3)),g.setAttribute("color",new Ui(d,3));const v=new fl({vertexColors:!0,toneMapped:!1});super(g,v),this.type="GridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}class dy extends null{constructor(e=10,t=16,n=8,i=64,a=4473924,o=8947848){a=new Wr(a),o=new Wr(o);const u=[],c=[];if(t>1)for(let v=0;v<t;v++){const M=v/t*(Math.PI*2),B=Math.sin(M)*e,I=Math.cos(M)*e;u.push(0,0,0),u.push(B,0,I);const ne=v&1?a:o;c.push(ne.r,ne.g,ne.b),c.push(ne.r,ne.g,ne.b)}for(let v=0;v<n;v++){const M=v&1?a:o,B=e-e/n*v;for(let I=0;I<i;I++){let ne=I/i*(Math.PI*2),ee=Math.sin(ne)*B,q=Math.cos(ne)*B;u.push(ee,0,q),c.push(M.r,M.g,M.b),ne=(I+1)/i*(Math.PI*2),ee=Math.sin(ne)*B,q=Math.cos(ne)*B,u.push(ee,0,q),c.push(M.r,M.g,M.b)}}const d=new ka;d.setAttribute("position",new Ui(u,3)),d.setAttribute("color",new Ui(c,3));const g=new fl({vertexColors:!0,toneMapped:!1});super(d,g),this.type="PolarGridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}const ec=new le,fy=new le,dc=new le;class Ay extends null{constructor(e,t,n){super(),this.light=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=n,this.type="DirectionalLightHelper",t===void 0&&(t=1);let i=new ka;i.setAttribute("position",new Ui([-t,t,0,t,t,0,t,-t,0,-t,-t,0,-t,t,0],3));const a=new fl({fog:!1,toneMapped:!1});this.lightPlane=new qd(i,a),this.add(this.lightPlane),i=new ka,i.setAttribute("position",new Ui([0,0,0,0,0,1],3)),this.targetLine=new qd(i,a),this.add(this.targetLine),this.update()}dispose(){this.lightPlane.geometry.dispose(),this.lightPlane.material.dispose(),this.targetLine.geometry.dispose(),this.targetLine.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.light.target.updateWorldMatrix(!0,!1),ec.setFromMatrixPosition(this.light.matrixWorld),fy.setFromMatrixPosition(this.light.target.matrixWorld),dc.subVectors(fy,ec),this.lightPlane.lookAt(fy),this.color!==void 0?(this.lightPlane.material.color.set(this.color),this.targetLine.material.color.set(this.color)):(this.lightPlane.material.color.copy(this.light.color),this.targetLine.material.color.copy(this.light.color)),this.targetLine.lookAt(fy),this.targetLine.scale.z=dc.length()}}const py=new le,Bc=new Qd;class DP extends null{constructor(e){const t=new ka,n=new fl({color:16777215,vertexColors:!0,toneMapped:!1}),i=[],a=[],o={};u("n1","n2"),u("n2","n4"),u("n4","n3"),u("n3","n1"),u("f1","f2"),u("f2","f4"),u("f4","f3"),u("f3","f1"),u("n1","f1"),u("n2","f2"),u("n3","f3"),u("n4","f4"),u("p","n1"),u("p","n2"),u("p","n3"),u("p","n4"),u("u1","u2"),u("u2","u3"),u("u3","u1"),u("c","t"),u("p","c"),u("cn1","cn2"),u("cn3","cn4"),u("cf1","cf2"),u("cf3","cf4");function u(I,ne){c(I),c(ne)}function c(I){i.push(0,0,0),a.push(0,0,0),o[I]===void 0&&(o[I]=[]),o[I].push(i.length/3-1)}t.setAttribute("position",new Ui(i,3)),t.setAttribute("color",new Ui(a,3)),super(t,n),this.type="CameraHelper",this.camera=e,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=o,this.update();const d=new Wr(16755200),g=new Wr(16711680),v=new Wr(43775),M=new Wr(16777215),B=new Wr(3355443);this.setColors(d,g,v,M,B)}setColors(e,t,n,i,a){const u=this.geometry.getAttribute("color");return u.setXYZ(0,e.r,e.g,e.b),u.setXYZ(1,e.r,e.g,e.b),u.setXYZ(2,e.r,e.g,e.b),u.setXYZ(3,e.r,e.g,e.b),u.setXYZ(4,e.r,e.g,e.b),u.setXYZ(5,e.r,e.g,e.b),u.setXYZ(6,e.r,e.g,e.b),u.setXYZ(7,e.r,e.g,e.b),u.setXYZ(8,e.r,e.g,e.b),u.setXYZ(9,e.r,e.g,e.b),u.setXYZ(10,e.r,e.g,e.b),u.setXYZ(11,e.r,e.g,e.b),u.setXYZ(12,e.r,e.g,e.b),u.setXYZ(13,e.r,e.g,e.b),u.setXYZ(14,e.r,e.g,e.b),u.setXYZ(15,e.r,e.g,e.b),u.setXYZ(16,e.r,e.g,e.b),u.setXYZ(17,e.r,e.g,e.b),u.setXYZ(18,e.r,e.g,e.b),u.setXYZ(19,e.r,e.g,e.b),u.setXYZ(20,e.r,e.g,e.b),u.setXYZ(21,e.r,e.g,e.b),u.setXYZ(22,e.r,e.g,e.b),u.setXYZ(23,e.r,e.g,e.b),u.setXYZ(24,t.r,t.g,t.b),u.setXYZ(25,t.r,t.g,t.b),u.setXYZ(26,t.r,t.g,t.b),u.setXYZ(27,t.r,t.g,t.b),u.setXYZ(28,t.r,t.g,t.b),u.setXYZ(29,t.r,t.g,t.b),u.setXYZ(30,t.r,t.g,t.b),u.setXYZ(31,t.r,t.g,t.b),u.setXYZ(32,n.r,n.g,n.b),u.setXYZ(33,n.r,n.g,n.b),u.setXYZ(34,n.r,n.g,n.b),u.setXYZ(35,n.r,n.g,n.b),u.setXYZ(36,n.r,n.g,n.b),u.setXYZ(37,n.r,n.g,n.b),u.setXYZ(38,i.r,i.g,i.b),u.setXYZ(39,i.r,i.g,i.b),u.setXYZ(40,a.r,a.g,a.b),u.setXYZ(41,a.r,a.g,a.b),u.setXYZ(42,a.r,a.g,a.b),u.setXYZ(43,a.r,a.g,a.b),u.setXYZ(44,a.r,a.g,a.b),u.setXYZ(45,a.r,a.g,a.b),u.setXYZ(46,a.r,a.g,a.b),u.setXYZ(47,a.r,a.g,a.b),u.setXYZ(48,a.r,a.g,a.b),u.setXYZ(49,a.r,a.g,a.b),u.needsUpdate=!0,this}update(){const e=this.geometry,t=this.pointMap,n=1,i=1;let a,o;if(Bc.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),this.camera.reversedDepth===!0)a=1,o=0;else if(this.camera.coordinateSystem===gl)a=-1,o=1;else if(this.camera.coordinateSystem===To)a=0,o=1;else throw new Error("THREE.CameraHelper.update(): Invalid coordinate system: "+this.camera.coordinateSystem);fc("c",t,e,Bc,0,0,a),fc("t",t,e,Bc,0,0,o),fc("n1",t,e,Bc,-n,-i,a),fc("n2",t,e,Bc,n,-i,a),fc("n3",t,e,Bc,-n,i,a),fc("n4",t,e,Bc,n,i,a),fc("f1",t,e,Bc,-n,-i,o),fc("f2",t,e,Bc,n,-i,o),fc("f3",t,e,Bc,-n,i,o),fc("f4",t,e,Bc,n,i,o),fc("u1",t,e,Bc,n*.7,i*1.1,a),fc("u2",t,e,Bc,-n*.7,i*1.1,a),fc("u3",t,e,Bc,0,i*2,a),fc("cf1",t,e,Bc,-n,0,o),fc("cf2",t,e,Bc,n,0,o),fc("cf3",t,e,Bc,0,-i,o),fc("cf4",t,e,Bc,0,i,o),fc("cn1",t,e,Bc,-n,0,a),fc("cn2",t,e,Bc,n,0,a),fc("cn3",t,e,Bc,0,-i,a),fc("cn4",t,e,Bc,0,i,a),e.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}}function fc(s,e,t,n,i,a,o){py.set(i,a,o).unproject(n);const u=e[s];if(u!==void 0){const c=t.getAttribute("position");for(let d=0,g=u.length;d<g;d++)c.setXYZ(u[d],py.x,py.y,py.z)}}const zg=new Y;class Yx extends null{constructor(e,t=16776960){const n=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),i=new Float32Array(8*3),a=new ka;a.setIndex(new wl(n,1)),a.setAttribute("position",new wl(i,3)),super(a,new fl({color:t,toneMapped:!1})),this.object=e,this.type="BoxHelper",this.matrixAutoUpdate=!1,this.update()}update(){if(this.object!==void 0&&zg.setFromObject(this.object),zg.isEmpty())return;const e=zg.min,t=zg.max,n=this.geometry.attributes.position,i=n.array;i[0]=t.x,i[1]=t.y,i[2]=t.z,i[3]=e.x,i[4]=t.y,i[5]=t.z,i[6]=e.x,i[7]=e.y,i[8]=t.z,i[9]=t.x,i[10]=e.y,i[11]=t.z,i[12]=t.x,i[13]=t.y,i[14]=e.z,i[15]=e.x,i[16]=t.y,i[17]=e.z,i[18]=e.x,i[19]=e.y,i[20]=e.z,i[21]=t.x,i[22]=e.y,i[23]=e.z,n.needsUpdate=!0,this.geometry.computeBoundingSphere()}setFromObject(e){return this.object=e,this.update(),this}copy(e,t){return super.copy(e,t),this.object=e.object,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class kP extends null{constructor(e,t=16776960){const n=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),i=[1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1],a=new ka;a.setIndex(new wl(n,1)),a.setAttribute("position",new Ui(i,3)),super(a,new fl({color:t,toneMapped:!1})),this.box=e,this.type="Box3Helper",this.geometry.computeBoundingSphere()}updateMatrixWorld(e){const t=this.box;t.isEmpty()||(t.getCenter(this.position),t.getSize(this.scale),this.scale.multiplyScalar(.5),super.updateMatrixWorld(e))}dispose(){this.geometry.dispose(),this.material.dispose()}}class VP extends null{constructor(e,t=1,n=16776960){const i=n,a=[1,-1,0,-1,1,0,-1,-1,0,1,1,0,-1,1,0,-1,-1,0,1,-1,0,1,1,0],o=new ka;o.setAttribute("position",new Ui(a,3)),o.computeBoundingSphere(),super(o,new fl({color:i,toneMapped:!1})),this.type="PlaneHelper",this.plane=e,this.size=t;const u=[1,1,0,-1,1,0,-1,-1,0,1,1,0,-1,-1,0,1,-1,0],c=new ka;c.setAttribute("position",new Ui(u,3)),c.computeBoundingSphere(),this.add(new Il(c,new Yl({color:i,opacity:.2,transparent:!0,depthWrite:!1,toneMapped:!1})))}updateMatrixWorld(e){this.position.set(0,0,0),this.scale.set(.5*this.size,.5*this.size,1),this.lookAt(this.plane.normal),this.translateZ(-this.plane.constant),super.updateMatrixWorld(e)}dispose(){this.geometry.dispose(),this.material.dispose(),this.children[0].geometry.dispose(),this.children[0].material.dispose()}}const Bw=new le;let gy,my;class ZE extends null{constructor(e=new le(0,0,1),t=new le(0,0,0),n=1,i=16776960,a=n*.2,o=a*.2){super(),this.type="ArrowHelper",gy===void 0&&(gy=new ka,gy.setAttribute("position",new Ui([0,0,0,0,1,0],3)),my=new Rh(.5,1,5,1),my.translate(0,-.5,0)),this.position.copy(t),this.line=new qd(gy,new fl({color:i,toneMapped:!1})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new Il(my,new Yl({color:i,toneMapped:!1})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(e),this.setLength(n,a,o)}setDirection(e){if(e.y>.99999)this.quaternion.set(0,0,0,1);else if(e.y<-.99999)this.quaternion.set(1,0,0,0);else{Bw.set(e.z,0,-e.x).normalize();const t=Math.acos(e.y);this.quaternion.setFromAxisAngle(Bw,t)}}setLength(e,t=e*.2,n=t*.2){this.line.scale.set(1,Math.max(1e-4,e-t),1),this.line.updateMatrix(),this.cone.scale.set(n,t,n),this.cone.position.y=e,this.cone.updateMatrix()}setColor(e){this.line.material.color.set(e),this.cone.material.color.set(e)}copy(e){return super.copy(e,!1),this.line.copy(e.line),this.cone.copy(e.cone),this}dispose(){this.line.geometry.dispose(),this.line.material.dispose(),this.cone.geometry.dispose(),this.cone.material.dispose()}}class KE extends null{constructor(e=1){const t=[0,0,0,e,0,0,0,0,0,0,e,0,0,0,0,0,0,e],n=[1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],i=new ka;i.setAttribute("position",new Ui(t,3)),i.setAttribute("color",new Ui(n,3));const a=new fl({vertexColors:!0,toneMapped:!1});super(i,a),this.type="AxesHelper"}setColors(e,t,n){const i=new Wr,a=this.geometry.attributes.color.array;return i.set(e),i.toArray(a,0),i.toArray(a,3),i.set(t),i.toArray(a,6),i.toArray(a,9),i.set(n),i.toArray(a,12),i.toArray(a,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class $E{constructor(){this.type="ShapePath",this.color=new Wr,this.subPaths=[],this.currentPath=null}moveTo(e,t){return this.currentPath=new is,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t),this}lineTo(e,t){return this.currentPath.lineTo(e,t),this}quadraticCurveTo(e,t,n,i){return this.currentPath.quadraticCurveTo(e,t,n,i),this}bezierCurveTo(e,t,n,i,a,o){return this.currentPath.bezierCurveTo(e,t,n,i,a,o),this}splineThru(e){return this.currentPath.splineThru(e),this}toShapes(e){function t(q){const ye=[];for(let Ce=0,ke=q.length;Ce<ke;Ce++){const nt=q[Ce],Ye=new bi;Ye.curves=nt.curves,ye.push(Ye)}return ye}function n(q,ye){const Ce=ye.length;let ke=!1;for(let nt=Ce-1,Ye=0;Ye<Ce;nt=Ye++){let ht=ye[nt],Rt=ye[Ye],qe=Rt.x-ht.x,pt=Rt.y-ht.y;if(Math.abs(pt)>Number.EPSILON){if(pt<0&&(ht=ye[Ye],qe=-qe,Rt=ye[nt],pt=-pt),q.y<ht.y||q.y>Rt.y)continue;if(q.y===ht.y){if(q.x===ht.x)return!0}else{const xn=pt*(q.x-ht.x)-qe*(q.y-ht.y);if(xn===0)return!0;if(xn<0)continue;ke=!ke}}else{if(q.y!==ht.y)continue;if(Rt.x<=q.x&&q.x<=ht.x||ht.x<=q.x&&q.x<=Rt.x)return!0}}return ke}const i=eo.isClockWise,a=this.subPaths;if(a.length===0)return[];let o,u,c;const d=[];if(a.length===1)return u=a[0],c=new bi,c.curves=u.curves,d.push(c),d;let g=!i(a[0].getPoints());g=e?!g:g;const v=[],M=[];let B=[],I=0,ne;M[I]=void 0,B[I]=[];for(let q=0,ye=a.length;q<ye;q++)u=a[q],ne=u.getPoints(),o=i(ne),o=e?!o:o,o?(!g&&M[I]&&I++,M[I]={s:new bi,p:ne},M[I].s.curves=u.curves,g&&I++,B[I]=[]):B[I].push({h:u,p:ne[0]});if(!M[0])return t(a);if(M.length>1){let q=!1,ye=0;for(let Ce=0,ke=M.length;Ce<ke;Ce++)v[Ce]=[];for(let Ce=0,ke=M.length;Ce<ke;Ce++){const nt=B[Ce];for(let Ye=0;Ye<nt.length;Ye++){const ht=nt[Ye];let Rt=!0;for(let qe=0;qe<M.length;qe++)n(ht.p,M[qe].p)&&(Ce!==qe&&ye++,Rt?(Rt=!1,v[qe].push(ht)):q=!0);Rt&&v[Ce].push(ht)}}ye>0&&q===!1&&(B=v)}let ee;for(let q=0,ye=M.length;q<ye;q++){c=M[q].s,d.push(c),ee=B[q];for(let Ce=0,ke=ee.length;Ce<ke;Ce++)c.holes.push(ee[Ce].h)}return d}}class rv extends bl{constructor(e,t=null){super(),this.object=e,this.domElement=t,this.enabled=!0,this.state=-1,this.keys={},this.mouseButtons={LEFT:null,MIDDLE:null,RIGHT:null},this.touches={ONE:null,TWO:null}}connect(e){if(e===void 0){Lr("Controls: connect() now requires an element.");return}this.domElement!==null&&this.disconnect(),this.domElement=e}disconnect(){}dispose(){}update(){}}function XE(s,e){const t=s.image&&s.image.width?s.image.width/s.image.height:1;return t>e?(s.repeat.x=1,s.repeat.y=t/e,s.offset.x=0,s.offset.y=(1-s.repeat.y)/2):(s.repeat.x=e/t,s.repeat.y=1,s.offset.x=(1-s.repeat.x)/2,s.offset.y=0),s}function ue(s,e){const t=s.image&&s.image.width?s.image.width/s.image.height:1;return t>e?(s.repeat.x=e/t,s.repeat.y=1,s.offset.x=(1-s.repeat.x)/2,s.offset.y=0):(s.repeat.x=1,s.repeat.y=t/e,s.offset.x=0,s.offset.y=(1-s.repeat.y)/2),s}function r(s){return s.repeat.x=1,s.repeat.y=1,s.offset.x=0,s.offset.y=0,s}function l(s,e,t,n){const i=h(n);switch(t){case si:return s*e;case z:return s*e/i.components*i.byteLength;case ie:return s*e/i.components*i.byteLength;case ze:return s*e*2/i.components*i.byteLength;case Je:return s*e*2/i.components*i.byteLength;case Ie:return s*e*3/i.components*i.byteLength;case L:return s*e*4/i.components*i.byteLength;case xt:return s*e*4/i.components*i.byteLength;case Sn:case Oe:return Math.floor((s+3)/4)*Math.floor((e+3)/4)*8;case Qe:case Re:return Math.floor((s+3)/4)*Math.floor((e+3)/4)*16;case gt:case yt:return Math.max(s,16)*Math.max(e,8)/4;case Ke:case tn:return Math.max(s,8)*Math.max(e,8)/2;case Yt:case Rn:case Jn:case kr:return Math.floor((s+3)/4)*Math.floor((e+3)/4)*8;case er:case fr:case wr:return Math.floor((s+3)/4)*Math.floor((e+3)/4)*16;case ei:return Math.floor((s+3)/4)*Math.floor((e+3)/4)*16;case _n:return Math.floor((s+4)/5)*Math.floor((e+3)/4)*16;case jn:return Math.floor((s+4)/5)*Math.floor((e+4)/5)*16;case Hr:return Math.floor((s+5)/6)*Math.floor((e+4)/5)*16;case Pr:return Math.floor((s+5)/6)*Math.floor((e+5)/6)*16;case $i:return Math.floor((s+7)/8)*Math.floor((e+4)/5)*16;case Zi:return Math.floor((s+7)/8)*Math.floor((e+5)/6)*16;case Xi:return Math.floor((s+7)/8)*Math.floor((e+7)/8)*16;case Ei:return Math.floor((s+9)/10)*Math.floor((e+4)/5)*16;case ms:return Math.floor((s+9)/10)*Math.floor((e+5)/6)*16;case _i:return Math.floor((s+9)/10)*Math.floor((e+7)/8)*16;case Es:return Math.floor((s+9)/10)*Math.floor((e+9)/10)*16;case ua:return Math.floor((s+11)/12)*Math.floor((e+9)/10)*16;case Hn:return Math.floor((s+11)/12)*Math.floor((e+11)/12)*16;case Pt:case Gt:case Bt:return Math.ceil(s/4)*Math.ceil(e/4)*16;case yn:case Ln:return Math.ceil(s/4)*Math.ceil(e/4)*8;case gr:case Rr:return Math.ceil(s/4)*Math.ceil(e/4)*16}throw new Error(`Unable to determine texture byte length for ${t} format.`)}function h(s){switch(s){case es:case Ci:return{byteLength:1,components:1};case rn:case En:case Wt:return{byteLength:2,components:1};case bn:case Jt:return{byteLength:2,components:4};case st:case Xt:case dt:return{byteLength:4,components:1};case rr:case Kr:return{byteLength:4,components:3}}throw new Error(`Unknown texture type ${s}.`)}class p{static contain(e,t){return XE(e,t)}static cover(e,t){return ue(e,t)}static fill(e){return r(e)}static getByteLength(e,t,n,i){return l(e,t,n,i)}}typeof __THREE_DEVTOOLS__!="undefined"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:m}})),typeof window!="undefined"&&(window.__THREE__?Lr("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=m);const y=new Ec,T=new ce,O=new le,te=new ce,se=new ce,xe=new le,Ne=new le,Ve=new di,We=new le,tt=new le;let Ot=null,An=null;const un=[],Un={NONE:-1,PAN:0,ROTATE:1};class Vn extends rv{constructor(e,t,n=null){super(t,n),this.objects=e,this.recursive=!0,this.transformGroup=!1,this.rotateSpeed=1,this.raycaster=new bw,this.mouseButtons={LEFT:Z.PAN,MIDDLE:Z.PAN,RIGHT:Z.ROTATE},this.touches={ONE:V.PAN},this._onPointerMove=nr.bind(this),this._onPointerDown=ii.bind(this),this._onPointerCancel=pi.bind(this),this._onContextMenu=Bi.bind(this),n!==null&&this.connect(n)}connect(e){super.connect(e),this.domElement.addEventListener("pointermove",this._onPointerMove),this.domElement.addEventListener("pointerdown",this._onPointerDown),this.domElement.addEventListener("pointerup",this._onPointerCancel),this.domElement.addEventListener("pointerleave",this._onPointerCancel),this.domElement.addEventListener("contextmenu",this._onContextMenu),this.domElement.style.touchAction="none"}disconnect(){this.domElement.removeEventListener("pointermove",this._onPointerMove),this.domElement.removeEventListener("pointerdown",this._onPointerDown),this.domElement.removeEventListener("pointerup",this._onPointerCancel),this.domElement.removeEventListener("pointerleave",this._onPointerCancel),this.domElement.removeEventListener("contextmenu",this._onContextMenu),this.domElement.style.touchAction="auto",this.domElement.style.cursor=""}dispose(){this.disconnect()}_updatePointer(e){const t=this.domElement.getBoundingClientRect();T.x=(e.clientX-t.left)/t.width*2-1,T.y=-(e.clientY-t.top)/t.height*2+1}_updateState(e){let t;if(e.pointerType==="touch")t=this.touches.ONE;else switch(e.button){case 0:t=this.mouseButtons.LEFT;break;case 1:t=this.mouseButtons.MIDDLE;break;case 2:t=this.mouseButtons.RIGHT;break;default:t=null}switch(t){case Z.PAN:case V.PAN:this.state=Un.PAN;break;case Z.ROTATE:case V.ROTATE:this.state=Un.ROTATE;break;default:this.state=Un.NONE}}}function nr(s){const e=this.object,t=this.domElement,n=this.raycaster;if(this.enabled!==!1){if(this._updatePointer(s),n.setFromCamera(T,e),Ot)this.state===Un.PAN?n.ray.intersectPlane(y,xe)&&(Ot.position.copy(xe.sub(O).applyMatrix4(Ve)),this.dispatchEvent({type:"drag",object:Ot})):this.state===Un.ROTATE&&(te.subVectors(T,se).multiplyScalar(this.rotateSpeed),Ot.rotateOnWorldAxis(We,te.x),Ot.rotateOnWorldAxis(tt.normalize(),-te.y),this.dispatchEvent({type:"drag",object:Ot})),se.copy(T);else if(s.pointerType==="mouse"||s.pointerType==="pen")if(un.length=0,n.setFromCamera(T,e),n.intersectObjects(this.objects,this.recursive,un),un.length>0){const i=un[0].object;y.setFromNormalAndCoplanarPoint(e.getWorldDirection(y.normal),Ne.setFromMatrixPosition(i.matrixWorld)),An!==i&&An!==null&&(this.dispatchEvent({type:"hoveroff",object:An}),t.style.cursor="auto",An=null),An!==i&&(this.dispatchEvent({type:"hoveron",object:i}),t.style.cursor="pointer",An=i)}else An!==null&&(this.dispatchEvent({type:"hoveroff",object:An}),t.style.cursor="auto",An=null);se.copy(T)}}function ii(s){const e=this.object,t=this.domElement,n=this.raycaster;this.enabled!==!1&&(this._updatePointer(s),this._updateState(s),un.length=0,n.setFromCamera(T,e),n.intersectObjects(this.objects,this.recursive,un),un.length>0&&(this.transformGroup===!0?Ot=mi(un[0].object):Ot=un[0].object,y.setFromNormalAndCoplanarPoint(e.getWorldDirection(y.normal),Ne.setFromMatrixPosition(Ot.matrixWorld)),n.ray.intersectPlane(y,xe)&&(this.state===Un.PAN?(Ve.copy(Ot.parent.matrixWorld).invert(),O.copy(xe).sub(Ne.setFromMatrixPosition(Ot.matrixWorld)),t.style.cursor="move",this.dispatchEvent({type:"dragstart",object:Ot})):this.state===Un.ROTATE&&(We.set(0,1,0).applyQuaternion(e.quaternion).normalize(),tt.set(1,0,0).applyQuaternion(e.quaternion).normalize(),t.style.cursor="move",this.dispatchEvent({type:"dragstart",object:Ot})))),se.copy(T))}function pi(){this.enabled!==!1&&(Ot&&(this.dispatchEvent({type:"dragend",object:Ot}),Ot=null),this.domElement.style.cursor=An?"pointer":"auto",this.state=Un.NONE)}function Bi(s){this.enabled!==!1&&s.preventDefault()}function mi(s,e=null){return s.isGroup&&(e=s),s.parent===null?e:mi(s.parent,e)}var ls=b(21668),ys=b(76633),Da=b(61147),Mo=b(38192),Ro=b(85320);function du(s,e,t,n){var i,a,o=(0,Ro.Z)(.1),u,c;typeof s!="function"&&(s=(0,Ro.Z)(+s)),e==null&&(e=0),t==null&&(t=0),n==null&&(n=0);function d(v){for(var M=0,B=i.length;M<B;++M){var I=i[M],ne=I.x-e||1e-6,ee=(I.y||0)-t||1e-6,q=(I.z||0)-n||1e-6,ye=Math.sqrt(ne*ne+ee*ee+q*q),Ce=(c[M]-ye)*u[M]*v/ye;I.vx+=ne*Ce,a>1&&(I.vy+=ee*Ce),a>2&&(I.vz+=q*Ce)}}function g(){if(i){var v,M=i.length;for(u=new Array(M),c=new Array(M),v=0;v<M;++v)c[v]=+s(i[v],v,i),u[v]=isNaN(c[v])?0:+o(i[v],v,i)}}return d.initialize=function(v,...M){i=v,a=M.find(B=>[1,2,3].includes(B))||2,g()},d.strength=function(v){return arguments.length?(o=typeof v=="function"?v:(0,Ro.Z)(+v),g(),d):o},d.radius=function(v){return arguments.length?(s=typeof v=="function"?v:(0,Ro.Z)(+v),g(),d):s},d.x=function(v){return arguments.length?(e=+v,d):e},d.y=function(v){return arguments.length?(t=+v,d):t},d.z=function(v){return arguments.length?(n=+v,d):n},d}function ru(s){Ih(s);const e=Zc(s);return s.on=e.on,s.off=e.off,s.fire=e.fire,s}function Zc(s){let e=Object.create(null);return{on:function(t,n,i){if(typeof n!="function")throw new Error("callback is expected to be a function");let a=e[t];return a||(a=e[t]=[]),a.push({callback:n,ctx:i}),s},off:function(t,n){if(typeof t=="undefined")return e=Object.create(null),s;if(e[t])if(typeof n!="function")delete e[t];else{const o=e[t];for(let u=0;u<o.length;++u)o[u].callback===n&&o.splice(u,1)}return s},fire:function(t){const n=e[t];if(!n)return s;let i;arguments.length>1&&(i=Array.prototype.slice.call(arguments,1));for(let a=0;a<n.length;++a){const o=n[a];o.callback.apply(o.ctx,i)}return s}}}function Ih(s){if(!s)throw new Error("Eventify cannot use falsy object as events subject");const e=["on","fire","off"];for(let t=0;t<e.length;++t)if(s.hasOwnProperty(e[t]))throw new Error("Subject cannot be eventified, since it already has property '"+e[t]+"'")}var uA=Ac;function Ac(s){if(s=s||{},"uniqueLinkId"in s&&(console.warn("ngraph.graph: Starting from version 0.14 `uniqueLinkId` is deprecated.\nUse `multigraph` option instead\n",`
`,`Note: there is also change in default behavior: From now on each graph
is considered to be not a multigraph by default (each edge is unique).`),s.multigraph=s.uniqueLinkId),s.multigraph===void 0&&(s.multigraph=!1),typeof Map!="function")throw new Error("ngraph.graph requires `Map` to be defined. Please polyfill it before using ngraph");var e=new Map,t=new Map,n={},i=0,a=s.multigraph?ke:Ce,o=[],u=Zr,c=Zr,d=Zr,g=Zr,v={version:20,addNode:ne,addLink:ye,removeLink:Rt,removeNode:q,getNode:ee,getNodeCount:nt,getLinkCount:Ye,getEdgeCount:Ye,getLinksCount:Ye,getNodesCount:nt,getLinks:ht,forEachNode:As,forEachLinkedNode:Br,forEachLink:pr,beginUpdate:d,endUpdate:g,clear:cr,hasLink:pt,hasNode:ee,getLink:pt,getLinkById:xn};return ru(v),M(),v;function M(){var Xr=v.on;v.on=Yi;function Yi(){return v.beginUpdate=d=Ti,v.endUpdate=g=ds,u=B,c=I,v.on=Xr,Xr.apply(v,arguments)}}function B(Xr,Yi){o.push({link:Xr,changeType:Yi})}function I(Xr,Yi){o.push({node:Xr,changeType:Yi})}function ne(Xr,Yi){if(Xr===void 0)throw new Error("Invalid node identifier");d();var ps=ee(Xr);return ps?(ps.data=Yi,c(ps,"update")):(ps=new Uc(Xr,Yi),c(ps,"add")),e.set(Xr,ps),g(),ps}function ee(Xr){return e.get(Xr)}function q(Xr){var Yi=ee(Xr);if(!Yi)return!1;d();var ps=Yi.links;return ps&&(ps.forEach(qe),Yi.links=null),e.delete(Xr),c(Yi,"remove"),g(),!0}function ye(Xr,Yi,ps){d();var Xa=ee(Xr)||ne(Xr),Pi=ee(Yi)||ne(Yi),Nr=a(Xr,Yi,ps),Yr=t.has(Nr.id);return t.set(Nr.id,Nr),tc(Xa,Nr),Xr!==Yi&&tc(Pi,Nr),u(Nr,Yr?"update":"add"),g(),Nr}function Ce(Xr,Yi,ps){var Xa=ad(Xr,Yi),Pi=t.get(Xa);return Pi?(Pi.data=ps,Pi):new Lf(Xr,Yi,ps,Xa)}function ke(Xr,Yi,ps){var Xa=ad(Xr,Yi),Pi=n.hasOwnProperty(Xa);if(Pi||pt(Xr,Yi)){Pi||(n[Xa]=0);var Nr="@"+ ++n[Xa];Xa=ad(Xr+Nr,Yi+Nr)}return new Lf(Xr,Yi,ps,Xa)}function nt(){return e.size}function Ye(){return t.size}function ht(Xr){var Yi=ee(Xr);return Yi?Yi.links:null}function Rt(Xr,Yi){return Yi!==void 0&&(Xr=pt(Xr,Yi)),qe(Xr)}function qe(Xr){if(!Xr||!t.get(Xr.id))return!1;d(),t.delete(Xr.id);var Yi=ee(Xr.fromId),ps=ee(Xr.toId);return Yi&&Yi.links.delete(Xr),ps&&ps.links.delete(Xr),u(Xr,"remove"),g(),!0}function pt(Xr,Yi){if(!(Xr===void 0||Yi===void 0))return t.get(ad(Xr,Yi))}function xn(Xr){if(Xr!==void 0)return t.get(Xr)}function cr(){d(),As(function(Xr){q(Xr.id)}),g()}function pr(Xr){if(typeof Xr=="function")for(var Yi=t.values(),ps=Yi.next();!ps.done;){if(Xr(ps.value))return!0;ps=Yi.next()}}function Br(Xr,Yi,ps){var Xa=ee(Xr);if(Xa&&Xa.links&&typeof Yi=="function")return ps?Dr(Xa.links,Xr,Yi):zr(Xa.links,Xr,Yi)}function zr(Xr,Yi,ps){for(var Xa,Pi=Xr.values(),Nr=Pi.next();!Nr.done;){var Yr=Nr.value,cs=Yr.fromId===Yi?Yr.toId:Yr.fromId;if(Xa=ps(e.get(cs),Yr),Xa)return!0;Nr=Pi.next()}}function Dr(Xr,Yi,ps){for(var Xa,Pi=Xr.values(),Nr=Pi.next();!Nr.done;){var Yr=Nr.value;if(Yr.fromId===Yi&&(Xa=ps(e.get(Yr.toId),Yr),Xa))return!0;Nr=Pi.next()}}function Zr(){}function Ti(){i+=1}function ds(){i-=1,i===0&&o.length>0&&(v.fire("changed",o),o.length=0)}function As(Xr){if(typeof Xr!="function")throw new Error("Function is expected to iterate over graph nodes. You passed "+Xr);for(var Yi=e.values(),ps=Yi.next();!ps.done;){if(Xr(ps.value))return!0;ps=Yi.next()}}}function Uc(s,e){this.id=s,this.links=null,this.data=e}function tc(s,e){s.links?s.links.add(e):s.links=new Set([e])}function Lf(s,e,t,n){this.fromId=s,this.toId=e,this.data=t,this.id=n}function ad(s,e){return s.toString()+"\u{1F449} "+e.toString()}var Tm=b(91998),Gg=b(91519),Rw=b(12778),Iw=function(){return Rw.Z.Date.now()},iv=Iw,mp=/\s/;function sv(s){for(var e=s.length;e--&&mp.test(s.charAt(e)););return e}var Nw=sv,vp=/^\s+/;function yp(s){return s&&s.slice(0,Nw(s)+1).replace(vp,"")}var Xs=yp,ma=b(90681),ya=b(64162),Za="[object Symbol]";function Ga(s){return typeof s=="symbol"||(0,ya.Z)(s)&&(0,ma.Z)(s)==Za}var Tl=Ga,Io=NaN,Qu=/^[-+]0x[0-9a-f]+$/i,nc=/^0b[01]+$/i,Kc=/^0o[0-7]+$/i,nf=parseInt;function Hg(s){if(typeof s=="number")return s;if(Tl(s))return Io;if((0,Gg.Z)(s)){var e=typeof s.valueOf=="function"?s.valueOf():s;s=(0,Gg.Z)(e)?e+"":e}if(typeof s!="string")return s===0?s:+s;s=Xs(s);var t=nc.test(s);return t||Kc.test(s)?nf(s.slice(2),t?2:8):Qu.test(s)?Io:+s}var Rd=Hg,qx="Expected a function",Jx=Math.max,eb=Math.min;function Fw(s,e,t){var n,i,a,o,u,c,d=0,g=!1,v=!1,M=!0;if(typeof s!="function")throw new TypeError(qx);e=Rd(e)||0,(0,Gg.Z)(t)&&(g=!!t.leading,v="maxWait"in t,a=v?Jx(Rd(t.maxWait)||0,e):a,M="trailing"in t?!!t.trailing:M);function B(Ye){var ht=n,Rt=i;return n=i=void 0,d=Ye,o=s.apply(Rt,ht),o}function I(Ye){return d=Ye,u=setTimeout(q,e),g?B(Ye):o}function ne(Ye){var ht=Ye-c,Rt=Ye-d,qe=e-ht;return v?eb(qe,a-Rt):qe}function ee(Ye){var ht=Ye-c,Rt=Ye-d;return c===void 0||ht>=e||ht<0||v&&Rt>=a}function q(){var Ye=iv();if(ee(Ye))return ye(Ye);u=setTimeout(q,ne(Ye))}function ye(Ye){return u=void 0,M&&n?B(Ye):(n=i=void 0,o)}function Ce(){u!==void 0&&clearTimeout(u),d=0,n=c=i=u=void 0}function ke(){return u===void 0?o:ye(iv())}function nt(){var Ye=iv(),ht=ee(Ye);if(n=arguments,i=this,c=Ye,ht){if(u===void 0)return I(c);if(v)return clearTimeout(u),u=setTimeout(q,e),B(c)}return u===void 0&&(u=setTimeout(q,e)),o}return nt.cancel=Ce,nt.flush=ke,nt}var Pw=Fw;function vy(s,e){(e==null||e>s.length)&&(e=s.length);for(var t=0,n=Array(e);t<e;t++)n[t]=s[t];return n}function tb(s){if(Array.isArray(s))return s}function zP(s,e){if(!(s instanceof e))throw new TypeError("Cannot call a class as a function")}function GP(s,e,t){return Object.defineProperty(s,"prototype",{writable:!1}),s}function HP(s,e){var t=s==null?null:typeof Symbol!="undefined"&&s[Symbol.iterator]||s["@@iterator"];if(t!=null){var n,i,a,o,u=[],c=!0,d=!1;try{if(a=(t=t.call(s)).next,e!==0)for(;!(c=(n=a.call(t)).done)&&(u.push(n.value),u.length!==e);c=!0);}catch(g){d=!0,i=g}finally{try{if(!c&&t.return!=null&&(o=t.return(),Object(o)!==o))return}finally{if(d)throw i}}return u}}function QP(){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 WP(s,e){return tb(s)||HP(s,e)||ZP(s,e)||QP()}function ZP(s,e){if(s){if(typeof s=="string")return vy(s,e);var t={}.toString.call(s).slice(8,-1);return t==="Object"&&s.constructor&&(t=s.constructor.name),t==="Map"||t==="Set"?Array.from(s):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?vy(s,e):void 0}}var KP=GP(function s(e,t){var n=t.default,i=n===void 0?null:n,a=t.triggerUpdate,o=a===void 0?!0:a,u=t.onChange,c=u===void 0?function(d,g){}:u;zP(this,s),this.name=e,this.defaultVal=i,this.triggerUpdate=o,this.onChange=c});function nb(s){var e=s.stateInit,t=e===void 0?function(){return{}}:e,n=s.props,i=n===void 0?{}:n,a=s.methods,o=a===void 0?{}:a,u=s.aliases,c=u===void 0?{}:u,d=s.init,g=d===void 0?function(){}:d,v=s.update,M=v===void 0?function(){}:v,B=Object.keys(i).map(function(I){return new KP(I,i[I])});return function I(){for(var ne=arguments.length,ee=new Array(ne),q=0;q<ne;q++)ee[q]=arguments[q];var ye=!!(this instanceof I&&this.constructor),Ce=ye?ee.shift():void 0,ke=ee[0],nt=ke===void 0?{}:ke,Ye=Object.assign({},t instanceof Function?t(nt):t,{initialised:!1}),ht={};function Rt(xn){return qe(xn,nt),pt(),Rt}var qe=function(cr,pr){g.call(Rt,cr,Ye,pr),Ye.initialised=!0},pt=Pw(function(){Ye.initialised&&(M.call(Rt,Ye,ht),ht={})},1);return B.forEach(function(xn){Rt[xn.name]=cr(xn);function cr(pr){var Br=pr.name,zr=pr.triggerUpdate,Dr=zr===void 0?!1:zr,Zr=pr.onChange,Ti=Zr===void 0?function(Xr,Yi){}:Zr,ds=pr.defaultVal,As=ds===void 0?null:ds;return function(Xr){var Yi=Ye[Br];if(!arguments.length)return Yi;var ps=Xr===void 0?As:Xr;return Ye[Br]=ps,Ti.call(Rt,ps,Ye,Yi),!ht.hasOwnProperty(Br)&&(ht[Br]=Yi),Dr&&pt(),Rt}}}),Object.keys(o).forEach(function(xn){Rt[xn]=function(){for(var cr,pr=arguments.length,Br=new Array(pr),zr=0;zr<pr;zr++)Br[zr]=arguments[zr];return(cr=o[xn]).call.apply(cr,[Rt,Ye].concat(Br))}}),Object.entries(c).forEach(function(xn){var cr=WP(xn,2),pr=cr[0],Br=cr[1];return Rt[pr]=Rt[Br]}),Rt.resetProps=function(){return B.forEach(function(xn){Rt[xn.name](xn.defaultVal)}),Rt},Rt.resetProps(),Ye._rerender=pt,ye&&Ce&&Rt(Ce),Rt}}var ul=function(s){return typeof s=="function"?s:typeof s=="string"?function(e){return e[s]}:function(e){return s}};function $P(s,e){let t;if(e===void 0)for(const n of s)n!=null&&(t>n||t===void 0&&n>=n)&&(t=n);else{let n=-1;for(let i of s)(i=e(i,++n,s))!=null&&(t>i||t===void 0&&i>=i)&&(t=i)}return t}function XP(s,e){let t;if(e===void 0)for(const n of s)n!=null&&(t<n||t===void 0&&n>=n)&&(t=n);else{let n=-1;for(let i of s)(i=e(i,++n,s))!=null&&(t<i||t===void 0&&i>=i)&&(t=i)}return t}function Lw(s,e){(e==null||e>s.length)&&(e=s.length);for(var t=0,n=Array(e);t<e;t++)n[t]=s[t];return n}function jP(s){if(Array.isArray(s))return s}function YP(s){if(Array.isArray(s))return Lw(s)}function jE(s,e,t){if(typeof s=="function"?s===e:s.has(e))return arguments.length<3?e:t;throw new TypeError("Private element is not present on this object")}function qP(s,e){if(e.has(s))throw new TypeError("Cannot initialize the same private elements twice on an object")}function JP(s,e){if(!(s instanceof e))throw new TypeError("Cannot call a class as a function")}function Id(s,e){return s.get(jE(s,e))}function av(s,e,t){qP(s,e),e.set(s,t)}function rb(s,e,t){return s.set(jE(s,e),t),t}function eL(s,e){for(var t=0;t<e.length;t++){var n=e[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(s,uL(n.key),n)}}function tL(s,e,t){return e&&eL(s.prototype,e),Object.defineProperty(s,"prototype",{writable:!1}),s}function nL(s){if(typeof Symbol!="undefined"&&s[Symbol.iterator]!=null||s["@@iterator"]!=null)return Array.from(s)}function rL(s,e){var t=s==null?null:typeof Symbol!="undefined"&&s[Symbol.iterator]||s["@@iterator"];if(t!=null){var n,i,a,o,u=[],c=!0,d=!1;try{if(a=(t=t.call(s)).next,e!==0)for(;!(c=(n=a.call(t)).done)&&(u.push(n.value),u.length!==e);c=!0);}catch(g){d=!0,i=g}finally{try{if(!c&&t.return!=null&&(o=t.return(),Object(o)!==o))return}finally{if(d)throw i}}return u}}function iL(){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 sL(){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 aL(s,e){return jP(s)||rL(s,e)||YE(s,e)||iL()}function oL(s){return YP(s)||nL(s)||YE(s)||sL()}function lL(s,e){if(typeof s!="object"||!s)return s;var t=s[Symbol.toPrimitive];if(t!==void 0){var n=t.call(s,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(s)}function uL(s){var e=lL(s,"string");return typeof e=="symbol"?e:e+""}function YE(s,e){if(s){if(typeof s=="string")return Lw(s,e);var t={}.toString.call(s).slice(8,-1);return t==="Object"&&s.constructor&&(t=s.constructor.name),t==="Map"||t==="Set"?Array.from(s):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?Lw(s,e):void 0}}var ov=new WeakMap,yy=new WeakMap,lv=new WeakMap,Uw=new WeakMap,Ow=new WeakMap,Dw=new WeakMap,cL=function(){function s(){JP(this,s),av(this,ov,new Map),av(this,yy,new Map),av(this,lv,function(e){return e}),av(this,Uw,function(){return{}}),av(this,Ow,function(){}),av(this,Dw,function(){})}return tL(s,[{key:"getObj",value:function(t){return Id(ov,this).get(Id(lv,this).call(this,t))}},{key:"getData",value:function(t){return Id(yy,this).get(t)}},{key:"entries",value:function(){return oL(Id(yy,this).entries()).map(function(t){var n=aL(t,2),i=n[0],a=n[1];return[a,i]})}},{key:"id",value:function(t){return rb(lv,this,ul(t)),this}},{key:"onCreateObj",value:function(t){return rb(Uw,this,t),this}},{key:"onUpdateObj",value:function(t){return rb(Ow,this,t),this}},{key:"onRemoveObj",value:function(t){return rb(Dw,this,t),this}},{key:"digest",value:function(t){var n=this;t.filter(function(a){return!Id(ov,n).has(Id(lv,n).call(n,a))}).forEach(function(a){var o=Id(Uw,n).call(n,a);Id(ov,n).set(Id(lv,n).call(n,a),o),Id(yy,n).set(o,a)});var i=new Map(t.map(function(a){return[Id(lv,n).call(n,a),a]}));return Id(ov,this).forEach(function(a,o){i.has(o)?Id(Ow,n).call(n,a,i.get(o)):(Id(Dw,n).call(n,a,o),Id(ov,n).delete(o),Id(yy,n).delete(a))}),this}},{key:"clear",value:function(){return this.digest([]),this}}])}();class qE extends Map{constructor(e,t=tC){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:t}}),e!=null)for(const[n,i]of e)this.set(n,i)}get(e){return super.get(kw(this,e))}has(e){return super.has(kw(this,e))}set(e,t){return super.set(JE(this,e),t)}delete(e){return super.delete(eC(this,e))}}class nX extends null{constructor(e,t=tC){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:t}}),e!=null)for(const n of e)this.add(n)}has(e){return super.has(kw(this,e))}add(e){return super.add(JE(this,e))}delete(e){return super.delete(eC(this,e))}}function kw({_intern:s,_key:e},t){const n=e(t);return s.has(n)?s.get(n):t}function JE({_intern:s,_key:e},t){const n=e(t);return s.has(n)?s.get(n):(s.set(n,t),t)}function eC({_intern:s,_key:e},t){const n=e(t);return s.has(n)&&(t=s.get(n),s.delete(n)),t}function tC(s){return s!==null&&typeof s=="object"?s.valueOf():s}function hL(s,e){switch(arguments.length){case 0:break;case 1:this.range(s);break;default:this.range(e).domain(s);break}return this}function rX(s,e){switch(arguments.length){case 0:break;case 1:{typeof s=="function"?this.interpolator(s):this.range(s);break}default:{this.domain(s),typeof e=="function"?this.interpolator(e):this.range(e);break}}return this}const nC=Symbol("implicit");function rC(){var s=new qE,e=[],t=[],n=nC;function i(a){let o=s.get(a);if(o===void 0){if(n!==nC)return n;s.set(a,o=e.push(a)-1)}return t[o%t.length]}return i.domain=function(a){if(!arguments.length)return e.slice();e=[],s=new qE;for(const o of a)s.has(o)||s.set(o,e.push(o)-1);return i},i.range=function(a){return arguments.length?(t=Array.from(a),i):t.slice()},i.unknown=function(a){return arguments.length?(n=a,i):n},i.copy=function(){return rC(e,t).unknown(n)},hL.apply(i,arguments),i}function dL(s){for(var e=s.length/6|0,t=new Array(e),n=0;n<e;)t[n]="#"+s.slice(n*6,++n*6);return t}var fL=dL("a6cee31f78b4b2df8a33a02cfb9a99e31a1cfdbf6fff7f00cab2d66a3d9affff99b15928"),iC=b(23097);function Vw(s,e){(e==null||e>s.length)&&(e=s.length);for(var t=0,n=Array(e);t<e;t++)n[t]=s[t];return n}function AL(s){if(Array.isArray(s))return s}function pL(s){if(Array.isArray(s))return Vw(s)}function sC(s,e,t){if(typeof s=="function"?s===e:s.has(e))return arguments.length<3?e:t;throw new TypeError("Private element is not present on this object")}function gL(s){if(s===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return s}function aC(s,e,t){return e=uv(e),SL(s,Hw()?Reflect.construct(e,t||[],uv(s).constructor):e.apply(s,t))}function mL(s,e){if(e.has(s))throw new TypeError("Cannot initialize the same private elements twice on an object")}function oC(s,e){if(!(s instanceof e))throw new TypeError("Cannot call a class as a function")}function zw(s,e){return s.get(sC(s,e))}function lC(s,e,t){mL(s,e),e.set(s,t)}function uC(s,e,t){return s.set(sC(s,e),t),t}function cC(s,e,t){if(Hw())return Reflect.construct.apply(null,arguments);var n=[null];n.push.apply(n,e);var i=new(s.bind.apply(s,n));return i}function vL(s,e){for(var t=0;t<e.length;t++){var n=e[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(s,AC(n.key),n)}}function hC(s,e,t){return e&&vL(s.prototype,e),Object.defineProperty(s,"prototype",{writable:!1}),s}function ib(s,e,t){return(e=AC(e))in s?Object.defineProperty(s,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):s[e]=t,s}function Gw(){return Gw=typeof Reflect!="undefined"&&Reflect.get?Reflect.get.bind():function(s,e,t){var n=ML(s,e);if(n){var i=Object.getOwnPropertyDescriptor(n,e);return i.get?i.get.call(arguments.length<3?s:t):i.value}},Gw.apply(null,arguments)}function uv(s){return uv=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},uv(s)}function dC(s,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");s.prototype=Object.create(e&&e.prototype,{constructor:{value:s,writable:!0,configurable:!0}}),Object.defineProperty(s,"prototype",{writable:!1}),e&&Qw(s,e)}function Hw(){try{var s=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(Hw=function(){return!!s})()}function yL(s){if(typeof Symbol!="undefined"&&s[Symbol.iterator]!=null||s["@@iterator"]!=null)return Array.from(s)}function xL(s,e){var t=s==null?null:typeof Symbol!="undefined"&&s[Symbol.iterator]||s["@@iterator"];if(t!=null){var n,i,a,o,u=[],c=!0,d=!1;try{if(a=(t=t.call(s)).next,e!==0)for(;!(c=(n=a.call(t)).done)&&(u.push(n.value),u.length!==e);c=!0);}catch(g){d=!0,i=g}finally{try{if(!c&&t.return!=null&&(o=t.return(),Object(o)!==o))return}finally{if(d)throw i}}return u}}function bL(){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 _L(){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 fC(s,e){var t=Object.keys(s);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(s);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(s,i).enumerable})),t.push.apply(t,n)}return t}function wL(s){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?fC(Object(t),!0).forEach(function(n){ib(s,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(s,Object.getOwnPropertyDescriptors(t)):fC(Object(t)).forEach(function(n){Object.defineProperty(s,n,Object.getOwnPropertyDescriptor(t,n))})}return s}function SL(s,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 gL(s)}function Qw(s,e){return Qw=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t},Qw(s,e)}function xy(s,e){return AL(s)||xL(s,e)||pC(s,e)||bL()}function ML(s,e){for(;!{}.hasOwnProperty.call(s,e)&&(s=uv(s))!==null;);return s}function Ww(s,e,t,n){var i=Gw(uv(s.prototype),e,t);return typeof i=="function"?function(a){return i.apply(t,a)}:i}function xp(s){return pL(s)||yL(s)||pC(s)||_L()}function EL(s,e){if(typeof s!="object"||!s)return s;var t=s[Symbol.toPrimitive];if(t!==void 0){var n=t.call(s,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(s)}function AC(s){var e=EL(s,"string");return typeof e=="symbol"?e:e+""}function Zw(s){"@babel/helpers - typeof";return Zw=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},Zw(s)}function pC(s,e){if(s){if(typeof s=="string")return Vw(s,e);var t={}.toString.call(s).slice(8,-1);return t==="Object"&&s.constructor&&(t=s.constructor.name),t==="Map"||t==="Set"?Array.from(s):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?Vw(s,e):void 0}}var gC=function(e){e instanceof Array?e.forEach(gC):(e.map&&e.map.dispose(),e.dispose())},mC=function(e){e.geometry&&e.geometry.dispose(),e.material&&gC(e.material),e.texture&&e.texture.dispose(),e.children&&e.children.forEach(mC)},Kw=function(e){for(;e.children.length;){var t=e.children[0];e.remove(t),mC(t)}},$w=new WeakMap,sb=new WeakMap,by=function(s){function e(t){var n,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},a=i.dataBindAttr,o=a===void 0?"__data":a,u=i.objBindAttr,c=u===void 0?"__threeObj":u;return oC(this,e),n=aC(this,e),ib(n,"scene",void 0),lC(n,$w,void 0),lC(n,sb,void 0),n.scene=t,uC($w,n,o),uC(sb,n,c),n.onRemoveObj(function(){}),n}return dC(e,s),hC(e,[{key:"onCreateObj",value:function(n){var i=this;return Ww(e,"onCreateObj",this)([function(a){var o=n(a);return a[zw(sb,i)]=o,o[zw($w,i)]=a,i.scene.add(o),o}]),this}},{key:"onRemoveObj",value:function(n){var i=this;return Ww(e,"onRemoveObj",this)([function(a,o){var u=Ww(e,"getData",i)([a]);n(a,o),i.scene.remove(a),Kw(a),delete u[zw(sb,i)]}]),this}}])}(cL),_y=function(e){return isNaN(e)?parseInt((0,iC.Z)(e).toHex(),16):e},Xw=function(e){return isNaN(e)?(0,iC.Z)(e).getAlpha():1},CL=rC(fL);function vC(s,e,t){!e||typeof t!="string"||s.filter(function(n){return!n[t]}).forEach(function(n){n[t]=CL(e(n))})}function TL(s,e){var t=s.nodes,n=s.links,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=i.nodeFilter,o=a===void 0?function(){return!0}:a,u=i.onLoopError,c=u===void 0?function(B){throw"Invalid DAG structure! Found cycle in node path: ".concat(B.join(" -> "),".")}:u,d={};t.forEach(function(B){return d[e(B)]={data:B,out:[],depth:-1,skip:!o(B)}}),n.forEach(function(B){var I=B.source,ne=B.target,ee=ke(I),q=ke(ne);if(!d.hasOwnProperty(ee))throw"Missing source node with id: ".concat(ee);if(!d.hasOwnProperty(q))throw"Missing target node with id: ".concat(q);var ye=d[ee],Ce=d[q];ye.out.push(Ce);function ke(nt){return Zw(nt)==="object"?e(nt):nt}});var g=[];M(Object.values(d));var v=Object.assign.apply(Object,[{}].concat(xp(Object.entries(d).filter(function(B){var I=xy(B,2),ne=I[1];return!ne.skip}).map(function(B){var I=xy(B,2),ne=I[0],ee=I[1];return ib({},ne,ee.depth)}))));return v;function M(B){for(var I=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],ne=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,ee=function(){var ke=B[q];if(I.indexOf(ke)!==-1){var nt=[].concat(xp(I.slice(I.indexOf(ke))),[ke]).map(function(Ye){return e(Ye.data)});return g.some(function(Ye){return Ye.length===nt.length&&Ye.every(function(ht,Rt){return ht===nt[Rt]})})||(g.push(nt),c(nt)),1}ne>ke.depth&&(ke.depth=ne,M(ke.out,[].concat(xp(I),[ke]),ne+(ke.skip?0:1)))},q=0,ye=B.length;q<ye;q++)ee()}}var fo=window.THREE?window.THREE:{Group:ih,Mesh:Il,MeshLambertMaterial:qm,Color:Wr,BufferGeometry:ka,BufferAttribute:wl,Matrix4:di,Vector3:le,SphereGeometry:sd,CylinderGeometry:Cc,TubeGeometry:Td,ConeGeometry:Rh,Line:qd,LineBasicMaterial:fl,QuadraticBezierCurve3:Zn,CubicBezierCurve3:mn,Box3:Y},yC={graph:uA,forcelayout:Tm},BL=2,jw=new fo.BufferGeometry().setAttribute?"setAttribute":"addAttribute",ab=new fo.BufferGeometry().applyMatrix4?"applyMatrix4":"applyMatrix",RL=nb({props:{jsonUrl:{onChange:function(e,t){var n=this;e&&!t.fetchingJson&&(t.fetchingJson=!0,t.onLoading(),fetch(e).then(function(i){return i.json()}).then(function(i){t.fetchingJson=!1,t.onFinishLoading(i),n.graphData(i)}))},triggerUpdate:!1},graphData:{default:{nodes:[],links:[]},onChange:function(e,t){t.engineRunning=!1}},numDimensions:{default:3,onChange:function(e,t){var n=t.d3ForceLayout.force("charge");n&&n.strength(e>2?-60:-30),e<3&&i(t.graphData.nodes,"z"),e<2&&i(t.graphData.nodes,"y");function i(a,o){a.forEach(function(u){delete u[o],delete u["v".concat(o)]})}}},dagMode:{onChange:function(e,t){!e&&t.forceEngine==="d3"&&(t.graphData.nodes||[]).forEach(function(n){return n.fx=n.fy=n.fz=void 0})}},dagLevelDistance:{},dagNodeFilter:{default:function(e){return!0}},onDagError:{triggerUpdate:!1},nodeRelSize:{default:4},nodeId:{default:"id"},nodeVal:{default:"val"},nodeResolution:{default:8},nodeColor:{default:"color"},nodeAutoColorBy:{},nodeOpacity:{default:.75},nodeVisibility:{default:!0},nodeThreeObject:{},nodeThreeObjectExtend:{default:!1},nodePositionUpdate:{triggerUpdate:!1},linkSource:{default:"source"},linkTarget:{default:"target"},linkVisibility:{default:!0},linkColor:{default:"color"},linkAutoColorBy:{},linkOpacity:{default:.2},linkWidth:{},linkResolution:{default:6},linkCurvature:{default:0,triggerUpdate:!1},linkCurveRotation:{default:0,triggerUpdate:!1},linkMaterial:{},linkThreeObject:{},linkThreeObjectExtend:{default:!1},linkPositionUpdate:{triggerUpdate:!1},linkDirectionalArrowLength:{default:0},linkDirectionalArrowColor:{},linkDirectionalArrowRelPos:{default:.5,triggerUpdate:!1},linkDirectionalArrowResolution:{default:8},linkDirectionalParticles:{default:0},linkDirectionalParticleSpeed:{default:.01,triggerUpdate:!1},linkDirectionalParticleOffset:{default:0,triggerUpdate:!1},linkDirectionalParticleWidth:{default:.5},linkDirectionalParticleColor:{},linkDirectionalParticleResolution:{default:4},linkDirectionalParticleThreeObject:{},forceEngine:{default:"d3"},d3AlphaMin:{default:0},d3AlphaDecay:{default:.0228,triggerUpdate:!1,onChange:function(e,t){t.d3ForceLayout.alphaDecay(e)}},d3AlphaTarget:{default:0,triggerUpdate:!1,onChange:function(e,t){t.d3ForceLayout.alphaTarget(e)}},d3VelocityDecay:{default:.4,triggerUpdate:!1,onChange:function(e,t){t.d3ForceLayout.velocityDecay(e)}},ngraphPhysics:{default:{timeStep:20,gravity:-1.2,theta:.8,springLength:30,springCoefficient:8e-4,dragCoefficient:.02}},warmupTicks:{default:0,triggerUpdate:!1},cooldownTicks:{default:1/0,triggerUpdate:!1},cooldownTime:{default:15e3,triggerUpdate:!1},onLoading:{default:function(){},triggerUpdate:!1},onFinishLoading:{default:function(){},triggerUpdate:!1},onUpdate:{default:function(){},triggerUpdate:!1},onFinishUpdate:{default:function(){},triggerUpdate:!1},onEngineTick:{default:function(){},triggerUpdate:!1},onEngineStop:{default:function(){},triggerUpdate:!1}},methods:{refresh:function(e){return e._flushObjects=!0,e._rerender(),this},d3Force:function(e,t,n){return n===void 0?e.d3ForceLayout.force(t):(e.d3ForceLayout.force(t,n),this)},d3ReheatSimulation:function(e){return e.d3ForceLayout.alpha(1),this.resetCountdown(),this},resetCountdown:function(e){return e.cntTicks=0,e.startTickTime=new Date,e.engineRunning=!0,this},tickFrame:function(e){var t=e.forceEngine!=="ngraph";return e.engineRunning&&n(),i(),a(),this;function n(){++e.cntTicks>e.cooldownTicks||new Date-e.startTickTime>e.cooldownTime||t&&e.d3AlphaMin>0&&e.d3ForceLayout.alpha()<e.d3AlphaMin?(e.engineRunning=!1,e.onEngineStop()):(e.layout[t?"tick":"step"](),e.onEngineTick());var o=ul(e.nodeThreeObjectExtend);e.nodeDataMapper.entries().forEach(function(M){var B=xy(M,2),I=B[0],ne=B[1];if(ne){var ee=t?I:e.layout.getNodePosition(I[e.nodeId]),q=o(I);(!e.nodePositionUpdate||!e.nodePositionUpdate(q?ne.children[0]:ne,{x:ee.x,y:ee.y,z:ee.z},I)||q)&&(ne.position.x=ee.x,ne.position.y=ee.y||0,ne.position.z=ee.z||0)}});var u=ul(e.linkWidth),c=ul(e.linkCurvature),d=ul(e.linkCurveRotation),g=ul(e.linkThreeObjectExtend);e.linkDataMapper.entries().forEach(function(M){var B=xy(M,2),I=B[0],ne=B[1];if(ne){var ee=t?I:e.layout.getLinkPosition(e.layout.graph.getLink(I.source,I.target).id),q=ee[t?"source":"from"],ye=ee[t?"target":"to"];if(!(!q||!ye||!q.hasOwnProperty("x")||!ye.hasOwnProperty("x"))){v(I);var Ce=g(I);if(!(e.linkPositionUpdate&&e.linkPositionUpdate(Ce?ne.children[1]:ne,{start:{x:q.x,y:q.y,z:q.z},end:{x:ye.x,y:ye.y,z:ye.z}},I)&&!Ce)){var ke=30,nt=I.__curve,Ye=ne.children.length?ne.children[0]:ne;if(Ye.type==="Line"){if(nt){var Rt=nt.getPoints(ke);Ye.geometry.getAttribute("position").array.length!==Rt.length*3&&Ye.geometry[jw]("position",new fo.BufferAttribute(new Float32Array(Rt.length*3),3)),Ye.geometry.setFromPoints(Rt)}else{var ht=Ye.geometry.getAttribute("position");(!ht||!ht.array||ht.array.length!==6)&&Ye.geometry[jw]("position",ht=new fo.BufferAttribute(new Float32Array(2*3),3)),ht.array[0]=q.x,ht.array[1]=q.y||0,ht.array[2]=q.z||0,ht.array[3]=ye.x,ht.array[4]=ye.y||0,ht.array[5]=ye.z||0,ht.needsUpdate=!0}Ye.geometry.computeBoundingSphere()}else if(Ye.type==="Mesh")if(nt){Ye.geometry.type.match(/^Tube(Buffer)?Geometry$/)||(Ye.position.set(0,0,0),Ye.rotation.set(0,0,0),Ye.scale.set(1,1,1));var zr=Math.ceil(u(I)*10)/10,Dr=zr/2,Zr=new fo.TubeGeometry(nt,ke,Dr,e.linkResolution,!1);Ye.geometry.dispose(),Ye.geometry=Zr}else{if(!Ye.geometry.type.match(/^Cylinder(Buffer)?Geometry$/)){var qe=Math.ceil(u(I)*10)/10,pt=qe/2,xn=new fo.CylinderGeometry(pt,pt,1,e.linkResolution,1,!1);xn[ab](new fo.Matrix4().makeTranslation(0,1/2,0)),xn[ab](new fo.Matrix4().makeRotationX(Math.PI/2)),Ye.geometry.dispose(),Ye.geometry=xn}var cr=new fo.Vector3(q.x,q.y||0,q.z||0),pr=new fo.Vector3(ye.x,ye.y||0,ye.z||0),Br=cr.distanceTo(pr);Ye.position.x=cr.x,Ye.position.y=cr.y,Ye.position.z=cr.z,Ye.scale.z=Br,Ye.parent.localToWorld(pr),Ye.lookAt(pr)}}}}});function v(M){var B=t?M:e.layout.getLinkPosition(e.layout.graph.getLink(M.source,M.target).id),I=B[t?"source":"from"],ne=B[t?"target":"to"];if(!(!I||!ne||!I.hasOwnProperty("x")||!ne.hasOwnProperty("x"))){var ee=c(M);if(!ee)M.__curve=null;else{var q=new fo.Vector3(I.x,I.y||0,I.z||0),ye=new fo.Vector3(ne.x,ne.y||0,ne.z||0),Ce=q.distanceTo(ye),ke,nt=d(M);if(Ce>0){var Ye=ne.x-I.x,ht=ne.y-I.y||0,Rt=new fo.Vector3().subVectors(ye,q),qe=Rt.clone().multiplyScalar(ee).cross(Ye!==0||ht!==0?new fo.Vector3(0,0,1):new fo.Vector3(0,1,0)).applyAxisAngle(Rt.normalize(),nt).add(new fo.Vector3().addVectors(q,ye).divideScalar(2));ke=new fo.QuadraticBezierCurve3(q,qe,ye)}else{var pt=ee*70,xn=-nt,cr=xn+Math.PI/2;ke=new fo.CubicBezierCurve3(q,new fo.Vector3(pt*Math.cos(cr),pt*Math.sin(cr),0).add(q),new fo.Vector3(pt*Math.cos(xn),pt*Math.sin(xn),0).add(q),ye)}M.__curve=ke}}}}function i(){var o=ul(e.linkDirectionalArrowRelPos),u=ul(e.linkDirectionalArrowLength),c=ul(e.nodeVal);e.arrowDataMapper.entries().forEach(function(d){var g=xy(d,2),v=g[0],M=g[1];if(M){var B=t?v:e.layout.getLinkPosition(e.layout.graph.getLink(v.source,v.target).id),I=B[t?"source":"from"],ne=B[t?"target":"to"];if(!(!I||!ne||!I.hasOwnProperty("x")||!ne.hasOwnProperty("x"))){var ee=Math.cbrt(Math.max(0,c(I)||1))*e.nodeRelSize,q=Math.cbrt(Math.max(0,c(ne)||1))*e.nodeRelSize,ye=u(v),Ce=o(v),ke=v.__curve?function(pt){return v.__curve.getPoint(pt)}:function(pt){var xn=function(pr,Br,zr,Dr){return Br[pr]+(zr[pr]-Br[pr])*Dr||0};return{x:xn("x",I,ne,pt),y:xn("y",I,ne,pt),z:xn("z",I,ne,pt)}},nt=v.__curve?v.__curve.getLength():Math.sqrt(["x","y","z"].map(function(pt){return Math.pow((ne[pt]||0)-(I[pt]||0),2)}).reduce(function(pt,xn){return pt+xn},0)),Ye=ee+ye+(nt-ee-q-ye)*Ce,ht=ke(Ye/nt),Rt=ke((Ye-ye)/nt);["x","y","z"].forEach(function(pt){return M.position[pt]=Rt[pt]});var qe=cC(fo.Vector3,xp(["x","y","z"].map(function(pt){return ht[pt]})));M.parent.localToWorld(qe),M.lookAt(qe)}}})}function a(){var o=ul(e.linkDirectionalParticleSpeed),u=ul(e.linkDirectionalParticleOffset);e.graphData.links.forEach(function(c){var d=e.particlesDataMapper.getObj(c),g=d&&d.children,v=c.__singleHopPhotonsObj&&c.__singleHopPhotonsObj.children;if(!((!v||!v.length)&&(!g||!g.length))){var M=t?c:e.layout.getLinkPosition(e.layout.graph.getLink(c.source,c.target).id),B=M[t?"source":"from"],I=M[t?"target":"to"];if(!(!B||!I||!B.hasOwnProperty("x")||!I.hasOwnProperty("x"))){var ne=o(c),ee=Math.abs(u(c)),q=c.__curve?function(Ce){return c.__curve.getPoint(Ce)}:function(Ce){var ke=function(Ye,ht,Rt,qe){return ht[Ye]+(Rt[Ye]-ht[Ye])*qe||0};return{x:ke("x",B,I,Ce),y:ke("y",B,I,Ce),z:ke("z",B,I,Ce)}},ye=[].concat(xp(g||[]),xp(v||[]));ye.forEach(function(Ce,ke){var nt=Ce.parent.__linkThreeObjType==="singleHopPhotons";if(Ce.hasOwnProperty("__progressRatio")||(Ce.__progressRatio=nt?0:(ke+ee)/g.length),Ce.__progressRatio+=ne,Ce.__progressRatio>=1)if(!nt)Ce.__progressRatio=Ce.__progressRatio%1;else{Ce.parent.remove(Ce),Kw(Ce);return}var Ye=Ce.__progressRatio,ht=q(Ye);Ce.geometry.type!=="SphereGeometry"&&Ce.lookAt(ht.x,ht.y,ht.z),["x","y","z"].forEach(function(Rt){return Ce.position[Rt]=ht[Rt]})})}}})}},emitParticle:function(e,t){if(t&&e.graphData.links.includes(t)){if(!t.__singleHopPhotonsObj){var n=new fo.Group;n.__linkThreeObjType="singleHopPhotons",t.__singleHopPhotonsObj=n,e.graphScene.add(n)}var i=ul(e.linkDirectionalParticleThreeObject)(t);if(i&&e.linkDirectionalParticleThreeObject===i&&(i=i.clone()),!i){var a=ul(e.linkDirectionalParticleWidth),o=Math.ceil(a(t)*10)/10/2,u=e.linkDirectionalParticleResolution,c=new fo.SphereGeometry(o,u,u),d=ul(e.linkColor),g=ul(e.linkDirectionalParticleColor),v=g(t)||d(t)||"#f0f0f0",M=new fo.Color(_y(v)),B=e.linkOpacity*3,I=new fo.MeshLambertMaterial({color:M,transparent:!0,opacity:B});i=new fo.Mesh(c,I)}t.__singleHopPhotonsObj.add(i)}return this},getGraphBbox:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:function(){return!0};if(!e.initialised)return null;var n=function i(a){var o=[];if(a.geometry){a.geometry.computeBoundingBox();var u=new fo.Box3;u.copy(a.geometry.boundingBox).applyMatrix4(a.matrixWorld),o.push(u)}return o.concat.apply(o,xp((a.children||[]).filter(function(c){return!c.hasOwnProperty("__graphObjType")||c.__graphObjType==="node"&&t(c.__data)}).map(i)))}(e.graphScene);return n.length?Object.assign.apply(Object,xp(["x","y","z"].map(function(i){return ib({},i,[$P(n,function(a){return a.min[i]}),XP(n,function(a){return a.max[i]})])}))):null}},stateInit:function(){return{d3ForceLayout:(0,ls.Z)().force("link",(0,ys.Z)()).force("charge",(0,Da.Z)()).force("center",(0,Mo.Z)()).force("dagRadial",null).stop(),engineRunning:!1}},init:function(e,t){t.graphScene=e,t.nodeDataMapper=new by(e,{objBindAttr:"__threeObj"}),t.linkDataMapper=new by(e,{objBindAttr:"__lineObj"}),t.arrowDataMapper=new by(e,{objBindAttr:"__arrowObj"}),t.particlesDataMapper=new by(e,{objBindAttr:"__photonsObj"})},update:function(e,t){var n=function(Nr){return Nr.some(function(Yr){return t.hasOwnProperty(Yr)})};if(e.engineRunning=!1,typeof e.onUpdate=="function"&&e.onUpdate(),e.nodeAutoColorBy!==null&&n(["nodeAutoColorBy","graphData","nodeColor"])&&vC(e.graphData.nodes,ul(e.nodeAutoColorBy),e.nodeColor),e.linkAutoColorBy!==null&&n(["linkAutoColorBy","graphData","linkColor"])&&vC(e.graphData.links,ul(e.linkAutoColorBy),e.linkColor),e._flushObjects||n(["graphData","nodeThreeObject","nodeThreeObjectExtend","nodeVal","nodeColor","nodeVisibility","nodeRelSize","nodeResolution","nodeOpacity"])){var i=ul(e.nodeThreeObject),a=ul(e.nodeThreeObjectExtend),o=ul(e.nodeVal),u=ul(e.nodeColor),c=ul(e.nodeVisibility),d={},g={};(e._flushObjects||n(["nodeThreeObject","nodeThreeObjectExtend"]))&&e.nodeDataMapper.clear(),e.nodeDataMapper.onCreateObj(function(Pi){var Nr=i(Pi),Yr=a(Pi);Nr&&e.nodeThreeObject===Nr&&(Nr=Nr.clone());var cs;return Nr&&!Yr?cs=Nr:(cs=new fo.Mesh,cs.__graphDefaultObj=!0,Nr&&Yr&&cs.add(Nr)),cs.__graphObjType="node",cs}).onUpdateObj(function(Pi,Nr){if(Pi.__graphDefaultObj){var Yr=o(Nr)||1,cs=Math.cbrt(Yr)*e.nodeRelSize,oa=e.nodeResolution;(!Pi.geometry.type.match(/^Sphere(Buffer)?Geometry$/)||Pi.geometry.parameters.radius!==cs||Pi.geometry.parameters.widthSegments!==oa)&&(d.hasOwnProperty(Yr)||(d[Yr]=new fo.SphereGeometry(cs,oa,oa)),Pi.geometry.dispose(),Pi.geometry=d[Yr]);var Ms=u(Nr),Ha=new fo.Color(_y(Ms||"#ffffaa")),Qo=e.nodeOpacity*Xw(Ms);(Pi.material.type!=="MeshLambertMaterial"||!Pi.material.color.equals(Ha)||Pi.material.opacity!==Qo)&&(g.hasOwnProperty(Ms)||(g[Ms]=new fo.MeshLambertMaterial({color:Ha,transparent:!0,opacity:Qo})),Pi.material.dispose(),Pi.material=g[Ms])}}).digest(e.graphData.nodes.filter(c))}if(e._flushObjects||n(["graphData","linkThreeObject","linkThreeObjectExtend","linkMaterial","linkColor","linkWidth","linkVisibility","linkResolution","linkOpacity","linkDirectionalArrowLength","linkDirectionalArrowColor","linkDirectionalArrowResolution","linkDirectionalParticles","linkDirectionalParticleWidth","linkDirectionalParticleColor","linkDirectionalParticleResolution","linkDirectionalParticleThreeObject"])){var v=ul(e.linkThreeObject),M=ul(e.linkThreeObjectExtend),B=ul(e.linkMaterial),I=ul(e.linkVisibility),ne=ul(e.linkColor),ee=ul(e.linkWidth),q={},ye={},Ce={},ke=e.graphData.links.filter(I);if((e._flushObjects||n(["linkThreeObject","linkThreeObjectExtend","linkWidth"]))&&e.linkDataMapper.clear(),e.linkDataMapper.onRemoveObj(function(Pi){var Nr=Pi.__data&&Pi.__data.__singleHopPhotonsObj;Nr&&(Nr.parent.remove(Nr),Kw(Nr),delete Pi.__data.__singleHopPhotonsObj)}).onCreateObj(function(Pi){var Nr=v(Pi),Yr=M(Pi);Nr&&e.linkThreeObject===Nr&&(Nr=Nr.clone());var cs;if(!Nr||Yr){var oa=!!ee(Pi);if(oa)cs=new fo.Mesh;else{var Ms=new fo.BufferGeometry;Ms[jw]("position",new fo.BufferAttribute(new Float32Array(2*3),3)),cs=new fo.Line(Ms)}}var Ha;return Nr?Yr?(Ha=new fo.Group,Ha.__graphDefaultObj=!0,Ha.add(cs),Ha.add(Nr)):Ha=Nr:(Ha=cs,Ha.__graphDefaultObj=!0),Ha.renderOrder=10,Ha.__graphObjType="link",Ha}).onUpdateObj(function(Pi,Nr){if(Pi.__graphDefaultObj){var Yr=Pi.children.length?Pi.children[0]:Pi,cs=Math.ceil(ee(Nr)*10)/10,oa=!!cs;if(oa){var Ms=cs/2,Ha=e.linkResolution;if(!Yr.geometry.type.match(/^Cylinder(Buffer)?Geometry$/)||Yr.geometry.parameters.radiusTop!==Ms||Yr.geometry.parameters.radialSegments!==Ha){if(!q.hasOwnProperty(cs)){var Qo=new fo.CylinderGeometry(Ms,Ms,1,Ha,1,!1);Qo[ab](new fo.Matrix4().makeTranslation(0,1/2,0)),Qo[ab](new fo.Matrix4().makeRotationX(Math.PI/2)),q[cs]=Qo}Yr.geometry.dispose(),Yr.geometry=q[cs]}}var co=B(Nr);if(co)Yr.material=co;else{var Li=ne(Nr),os=new fo.Color(_y(Li||"#f0f0f0")),Hi=e.linkOpacity*Xw(Li),Fs=oa?"MeshLambertMaterial":"LineBasicMaterial";if(Yr.material.type!==Fs||!Yr.material.color.equals(os)||Yr.material.opacity!==Hi){var Pn=oa?ye:Ce;Pn.hasOwnProperty(Li)||(Pn[Li]=new fo[Fs]({color:os,transparent:Hi<1,opacity:Hi,depthWrite:Hi>=1})),Yr.material.dispose(),Yr.material=Pn[Li]}}}}).digest(ke),e.linkDirectionalArrowLength||t.hasOwnProperty("linkDirectionalArrowLength")){var nt=ul(e.linkDirectionalArrowLength),Ye=ul(e.linkDirectionalArrowColor);e.arrowDataMapper.onCreateObj(function(){var Pi=new fo.Mesh(void 0,new fo.MeshLambertMaterial({transparent:!0}));return Pi.__linkThreeObjType="arrow",Pi}).onUpdateObj(function(Pi,Nr){var Yr=nt(Nr),cs=e.linkDirectionalArrowResolution;if(!Pi.geometry.type.match(/^Cone(Buffer)?Geometry$/)||Pi.geometry.parameters.height!==Yr||Pi.geometry.parameters.radialSegments!==cs){var oa=new fo.ConeGeometry(Yr*.25,Yr,cs);oa.translate(0,Yr/2,0),oa.rotateX(Math.PI/2),Pi.geometry.dispose(),Pi.geometry=oa}var Ms=Ye(Nr)||ne(Nr)||"#f0f0f0";Pi.material.color=new fo.Color(_y(Ms)),Pi.material.opacity=e.linkOpacity*3*Xw(Ms)}).digest(ke.filter(nt))}if(e.linkDirectionalParticles||t.hasOwnProperty("linkDirectionalParticles")){var ht=ul(e.linkDirectionalParticles),Rt=ul(e.linkDirectionalParticleWidth),qe=ul(e.linkDirectionalParticleColor),pt=ul(e.linkDirectionalParticleThreeObject),xn={},cr={};e.particlesDataMapper.onCreateObj(function(){var Pi=new fo.Group;return Pi.__linkThreeObjType="photons",Pi.__photonDataMapper=new by(Pi),Pi}).onUpdateObj(function(Pi,Nr){var Yr=!!Pi.children.length&&Pi.children[0],cs=pt(Nr),oa,Ms;if(cs)oa=cs.geometry,Ms=cs.material;else{var Ha=Math.ceil(Rt(Nr)*10)/10/2,Qo=e.linkDirectionalParticleResolution;Yr&&Yr.geometry.parameters.radius===Ha&&Yr.geometry.parameters.widthSegments===Qo?oa=Yr.geometry:(cr.hasOwnProperty(Ha)||(cr[Ha]=new fo.SphereGeometry(Ha,Qo,Qo)),oa=cr[Ha]);var co=qe(Nr)||ne(Nr)||"#f0f0f0",Li=new fo.Color(_y(co)),os=e.linkOpacity*3;Yr&&Yr.material.color.equals(Li)&&Yr.material.opacity===os?Ms=Yr.material:(xn.hasOwnProperty(co)||(xn[co]=new fo.MeshLambertMaterial({color:Li,transparent:!0,opacity:os})),Ms=xn[co])}Yr&&(Yr.geometry!==oa&&Yr.geometry.dispose(),Yr.material!==Ms&&Yr.material.dispose());var Hi=Math.round(Math.abs(ht(Nr)));Pi.__photonDataMapper.id(function(Fs){return Fs.idx}).onCreateObj(function(){return new fo.Mesh(oa,Ms)}).onUpdateObj(function(Fs){Fs.geometry=oa,Fs.material=Ms}).digest(xp(new Array(Hi)).map(function(Fs,Pn){return{idx:Pn}}))}).digest(ke.filter(ht))}}if(e._flushObjects=!1,n(["graphData","nodeId","linkSource","linkTarget","numDimensions","forceEngine","dagMode","dagNodeFilter","dagLevelDistance"])){e.engineRunning=!1,e.graphData.links.forEach(function(Pi){Pi.source=Pi[e.linkSource],Pi.target=Pi[e.linkTarget]});var pr=e.forceEngine!=="ngraph",Br;if(pr){(Br=e.d3ForceLayout).stop().alpha(1).numDimensions(e.numDimensions).nodes(e.graphData.nodes);var zr=e.d3ForceLayout.force("link");zr&&zr.id(function(Pi){return Pi[e.nodeId]}).links(e.graphData.links);var Dr=e.dagMode&&TL(e.graphData,function(Pi){return Pi[e.nodeId]},{nodeFilter:e.dagNodeFilter,onLoopError:e.onDagError||void 0}),Zr=Math.max.apply(Math,xp(Object.values(Dr||[]))),Ti=e.dagLevelDistance||e.graphData.nodes.length/(Zr||1)*BL*(["radialin","radialout"].indexOf(e.dagMode)!==-1?.7:1);if(["lr","rl","td","bu","zin","zout"].includes(t.dagMode)){var ds=["lr","rl"].includes(t.dagMode)?"fx":["td","bu"].includes(t.dagMode)?"fy":"fz";e.graphData.nodes.filter(e.dagNodeFilter).forEach(function(Pi){return delete Pi[ds]})}if(["lr","rl","td","bu","zin","zout"].includes(e.dagMode)){var As=["rl","td","zout"].includes(e.dagMode),Xr=function(Nr){return(Dr[Nr[e.nodeId]]-Zr/2)*Ti*(As?-1:1)},Yi=["lr","rl"].includes(e.dagMode)?"fx":["td","bu"].includes(e.dagMode)?"fy":"fz";e.graphData.nodes.filter(e.dagNodeFilter).forEach(function(Pi){return Pi[Yi]=Xr(Pi)})}e.d3ForceLayout.force("dagRadial",["radialin","radialout"].indexOf(e.dagMode)!==-1?du(function(Pi){var Nr=Dr[Pi[e.nodeId]]||-1;return(e.dagMode==="radialin"?Zr-Nr:Nr)*Ti}).strength(function(Pi){return e.dagNodeFilter(Pi)?1:0}):null)}else{var ps=yC.graph();e.graphData.nodes.forEach(function(Pi){ps.addNode(Pi[e.nodeId])}),e.graphData.links.forEach(function(Pi){ps.addLink(Pi.source,Pi.target)}),Br=yC.forcelayout(ps,wL({dimensions:e.numDimensions},e.ngraphPhysics)),Br.graph=ps}for(var Xa=0;Xa<e.warmupTicks&&!(pr&&e.d3AlphaMin>0&&e.d3ForceLayout.alpha()<e.d3AlphaMin);Xa++)Br[pr?"tick":"step"]();e.layout=Br,this.resetCountdown()}e.engineRunning=!0,e.onFinishUpdate()}});function IL(s){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Object,t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,n=function(i){function a(){var o;oC(this,a);for(var u=arguments.length,c=new Array(u),d=0;d<u;d++)c[d]=arguments[d];return o=aC(this,a,[].concat(c)),o.__kapsuleInstance=cC(s,[].concat(xp(t?[o]:[]),c)),o}return dC(a,i),hC(a)}(e);return Object.keys(s()).forEach(function(i){return n.prototype[i]=function(){var a,o=(a=this.__kapsuleInstance)[i].apply(a,arguments);return o===this.__kapsuleInstance?this:o}}),n}var NL=window.THREE?window.THREE:{Group:ih},xC=IL(RL,NL.Group,!0);function bC(){let s=null,e=!1,t=null,n=null;function i(a,o){t(a,o),n=s.requestAnimationFrame(i)}return{start:function(){e!==!0&&t!==null&&(n=s.requestAnimationFrame(i),e=!0)},stop:function(){s.cancelAnimationFrame(n),e=!1},setAnimationLoop:function(a){t=a},setContext:function(a){s=a}}}function FL(s){const e=new WeakMap;function t(u,c){const d=u.array,g=u.usage,v=d.byteLength,M=s.createBuffer();s.bindBuffer(c,M),s.bufferData(c,d,g),u.onUploadCallback();let B;if(d instanceof Float32Array)B=s.FLOAT;else if(typeof Float16Array!="undefined"&&d instanceof Float16Array)B=s.HALF_FLOAT;else if(d instanceof Uint16Array)u.isFloat16BufferAttribute?B=s.HALF_FLOAT:B=s.UNSIGNED_SHORT;else if(d instanceof Int16Array)B=s.SHORT;else if(d instanceof Uint32Array)B=s.UNSIGNED_INT;else if(d instanceof Int32Array)B=s.INT;else if(d instanceof Int8Array)B=s.BYTE;else if(d instanceof Uint8Array)B=s.UNSIGNED_BYTE;else if(d instanceof Uint8ClampedArray)B=s.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+d);return{buffer:M,type:B,bytesPerElement:d.BYTES_PER_ELEMENT,version:u.version,size:v}}function n(u,c,d){const g=c.array,v=c.updateRanges;if(s.bindBuffer(d,u),v.length===0)s.bufferSubData(d,0,g);else{v.sort((B,I)=>B.start-I.start);let M=0;for(let B=1;B<v.length;B++){const I=v[M],ne=v[B];ne.start<=I.start+I.count+1?I.count=Math.max(I.count,ne.start+ne.count-I.start):(++M,v[M]=ne)}v.length=M+1;for(let B=0,I=v.length;B<I;B++){const ne=v[B];s.bufferSubData(d,ne.start*g.BYTES_PER_ELEMENT,g,ne.start,ne.count)}c.clearUpdateRanges()}c.onUploadCallback()}function i(u){return u.isInterleavedBufferAttribute&&(u=u.data),e.get(u)}function a(u){u.isInterleavedBufferAttribute&&(u=u.data);const c=e.get(u);c&&(s.deleteBuffer(c.buffer),e.delete(u))}function o(u,c){if(u.isInterleavedBufferAttribute&&(u=u.data),u.isGLBufferAttribute){const g=e.get(u);(!g||g.version<u.version)&&e.set(u,{buffer:u.buffer,type:u.type,bytesPerElement:u.elementSize,version:u.version});return}const d=e.get(u);if(d===void 0)e.set(u,t(u,c));else if(d.version<u.version){if(d.size!==u.array.byteLength)throw new Error("THREE.WebGLAttributes: The size of the buffer attribute's array buffer does not match the original size. Resizing buffer attributes is not supported.");n(d.buffer,u,c),d.version=u.version}}return{get:i,remove:a,update:o}}var PL=`#ifdef USE_ALPHAHASH
if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;
#endif`,LL=`#ifdef USE_ALPHAHASH
const float ALPHA_HASH_SCALE = 0.05;
float hash2D( vec2 value ) {
return fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) );
}
float hash3D( vec3 value ) {
return hash2D( vec2( hash2D( value.xy ), value.z ) );
}
float getAlphaHashThreshold( vec3 position ) {
float maxDeriv = max(
length( dFdx( position.xyz ) ),
length( dFdy( position.xyz ) )
);
float pixScale = 1.0 / ( ALPHA_HASH_SCALE * maxDeriv );
vec2 pixScales = vec2(
exp2( floor( log2( pixScale ) ) ),
exp2( ceil( log2( pixScale ) ) )
);
vec2 alpha = vec2(
hash3D( floor( pixScales.x * position.xyz ) ),
hash3D( floor( pixScales.y * position.xyz ) )
);
float lerpFactor = fract( log2( pixScale ) );
float x = ( 1.0 - lerpFactor ) * alpha.x + lerpFactor * alpha.y;
float a = min( lerpFactor, 1.0 - lerpFactor );
vec3 cases = vec3(
x * x / ( 2.0 * a * ( 1.0 - a ) ),
( x - 0.5 * a ) / ( 1.0 - a ),
1.0 - ( ( 1.0 - x ) * ( 1.0 - x ) / ( 2.0 * a * ( 1.0 - a ) ) )
);
float threshold = ( x < ( 1.0 - a ) )
? ( ( x < a ) ? cases.x : cases.y )
: cases.z;
return clamp( threshold , 1.0e-6, 1.0 );
}
#endif`,UL=`#ifdef USE_ALPHAMAP
diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;
#endif`,OL=`#ifdef USE_ALPHAMAP
uniform sampler2D alphaMap;
#endif`,DL=`#ifdef USE_ALPHATEST
#ifdef ALPHA_TO_COVERAGE
diffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a );
if ( diffuseColor.a == 0.0 ) discard;
#else
if ( diffuseColor.a < alphaTest ) discard;
#endif
#endif`,kL=`#ifdef USE_ALPHATEST
uniform float alphaTest;
#endif`,VL=`#ifdef USE_AOMAP
float ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;
reflectedLight.indirectDiffuse *= ambientOcclusion;
#if defined( USE_CLEARCOAT )
clearcoatSpecularIndirect *= ambientOcclusion;
#endif
#if defined( USE_SHEEN )
sheenSpecularIndirect *= ambientOcclusion;
#endif
#if defined( USE_ENVMAP ) && defined( STANDARD )
float dotNV = saturate( dot( geometryNormal, geometryViewDir ) );
reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );
#endif
#endif`,zL=`#ifdef USE_AOMAP
uniform sampler2D aoMap;
uniform float aoMapIntensity;
#endif`,GL=`#ifdef USE_BATCHING
#if ! defined( GL_ANGLE_multi_draw )
#define gl_DrawID _gl_DrawID
uniform int _gl_DrawID;
#endif
uniform highp sampler2D batchingTexture;
uniform highp usampler2D batchingIdTexture;
mat4 getBatchingMatrix( const in float i ) {
int size = textureSize( batchingTexture, 0 ).x;
int j = int( i ) * 4;
int x = j % size;
int y = j / size;
vec4 v1 = texelFetch( batchingTexture, ivec2( x, y ), 0 );
vec4 v2 = texelFetch( batchingTexture, ivec2( x + 1, y ), 0 );
vec4 v3 = texelFetch( batchingTexture, ivec2( x + 2, y ), 0 );
vec4 v4 = texelFetch( batchingTexture, ivec2( x + 3, y ), 0 );
return mat4( v1, v2, v3, v4 );
}
float getIndirectIndex( const in int i ) {
int size = textureSize( batchingIdTexture, 0 ).x;
int x = i % size;
int y = i / size;
return float( texelFetch( batchingIdTexture, ivec2( x, y ), 0 ).r );
}
#endif
#ifdef USE_BATCHING_COLOR
uniform sampler2D batchingColorTexture;
vec3 getBatchingColor( const in float i ) {
int size = textureSize( batchingColorTexture, 0 ).x;
int j = int( i );
int x = j % size;
int y = j / size;
return texelFetch( batchingColorTexture, ivec2( x, y ), 0 ).rgb;
}
#endif`,HL=`#ifdef USE_BATCHING
mat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) );
#endif`,QL=`vec3 transformed = vec3( position );
#ifdef USE_ALPHAHASH
vPosition = vec3( position );
#endif`,WL=`vec3 objectNormal = vec3( normal );
#ifdef USE_TANGENT
vec3 objectTangent = vec3( tangent.xyz );
#endif`,ZL=`float G_BlinnPhong_Implicit( ) {
return 0.25;
}
float D_BlinnPhong( const in float shininess, const in float dotNH ) {
return RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );
}
vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {
vec3 halfDir = normalize( lightDir + viewDir );
float dotNH = saturate( dot( normal, halfDir ) );
float dotVH = saturate( dot( viewDir, halfDir ) );
vec3 F = F_Schlick( specularColor, 1.0, dotVH );
float G = G_BlinnPhong_Implicit( );
float D = D_BlinnPhong( shininess, dotNH );
return F * ( G * D );
} // validated`,KL=`#ifdef USE_IRIDESCENCE
const mat3 XYZ_TO_REC709 = mat3(
3.2404542, -0.9692660, 0.0556434,
-1.5371385, 1.8760108, -0.2040259,
-0.4985314, 0.0415560, 1.0572252
);
vec3 Fresnel0ToIor( vec3 fresnel0 ) {
vec3 sqrtF0 = sqrt( fresnel0 );
return ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 );
}
vec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) {
return pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) );
}
float IorToFresnel0( float transmittedIor, float incidentIor ) {
return pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor ));
}
vec3 evalSensitivity( float OPD, vec3 shift ) {
float phase = 2.0 * PI * OPD * 1.0e-9;
vec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 );
vec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 );
vec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 );
vec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var );
xyz.x += 9.7470e-14 * sqrt( 2.0 * PI * 4.5282e+09 ) * cos( 2.2399e+06 * phase + shift[ 0 ] ) * exp( - 4.5282e+09 * pow2( phase ) );
xyz /= 1.0685e-7;
vec3 rgb = XYZ_TO_REC709 * xyz;
return rgb;
}
vec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) {
vec3 I;
float iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );
float sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) );
float cosTheta2Sq = 1.0 - sinTheta2Sq;
if ( cosTheta2Sq < 0.0 ) {
return vec3( 1.0 );
}
float cosTheta2 = sqrt( cosTheta2Sq );
float R0 = IorToFresnel0( iridescenceIOR, outsideIOR );
float R12 = F_Schlick( R0, 1.0, cosTheta1 );
float T121 = 1.0 - R12;
float phi12 = 0.0;
if ( iridescenceIOR < outsideIOR ) phi12 = PI;
float phi21 = PI - phi12;
vec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) ); vec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR );
vec3 R23 = F_Schlick( R1, 1.0, cosTheta2 );
vec3 phi23 = vec3( 0.0 );
if ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI;
if ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI;
if ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI;
float OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2;
vec3 phi = vec3( phi21 ) + phi23;
vec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 );
vec3 r123 = sqrt( R123 );
vec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 );
vec3 C0 = R12 + Rs;
I = C0;
vec3 Cm = Rs - T121;
for ( int m = 1; m <= 2; ++ m ) {
Cm *= r123;
vec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi );
I += Cm * Sm;
}
return max( I, vec3( 0.0 ) );
}
#endif`,$L=`#ifdef USE_BUMPMAP
uniform sampler2D bumpMap;
uniform float bumpScale;
vec2 dHdxy_fwd() {
vec2 dSTdx = dFdx( vBumpMapUv );
vec2 dSTdy = dFdy( vBumpMapUv );
float Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x;
float dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll;
float dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll;
return vec2( dBx, dBy );
}
vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {
vec3 vSigmaX = normalize( dFdx( surf_pos.xyz ) );
vec3 vSigmaY = normalize( dFdy( surf_pos.xyz ) );
vec3 vN = surf_norm;
vec3 R1 = cross( vSigmaY, vN );
vec3 R2 = cross( vN, vSigmaX );
float fDet = dot( vSigmaX, R1 ) * faceDirection;
vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );
return normalize( abs( fDet ) * surf_norm - vGrad );
}
#endif`,XL=`#if NUM_CLIPPING_PLANES > 0
vec4 plane;
#ifdef ALPHA_TO_COVERAGE
float distanceToPlane, distanceGradient;
float clipOpacity = 1.0;
#pragma unroll_loop_start
for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {
plane = clippingPlanes[ i ];
distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;
distanceGradient = fwidth( distanceToPlane ) / 2.0;
clipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane );
if ( clipOpacity == 0.0 ) discard;
}
#pragma unroll_loop_end
#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES
float unionClipOpacity = 1.0;
#pragma unroll_loop_start
for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {
plane = clippingPlanes[ i ];
distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;
distanceGradient = fwidth( distanceToPlane ) / 2.0;
unionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane );
}
#pragma unroll_loop_end
clipOpacity *= 1.0 - unionClipOpacity;
#endif
diffuseColor.a *= clipOpacity;
if ( diffuseColor.a == 0.0 ) discard;
#else
#pragma unroll_loop_start
for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {
plane = clippingPlanes[ i ];
if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;
}
#pragma unroll_loop_end
#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES
bool clipped = true;
#pragma unroll_loop_start
for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {
plane = clippingPlanes[ i ];
clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;
}
#pragma unroll_loop_end
if ( clipped ) discard;
#endif
#endif
#endif`,jL=`#if NUM_CLIPPING_PLANES > 0
varying vec3 vClipPosition;
uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];
#endif`,YL=`#if NUM_CLIPPING_PLANES > 0
varying vec3 vClipPosition;
#endif`,qL=`#if NUM_CLIPPING_PLANES > 0
vClipPosition = - mvPosition.xyz;
#endif`,JL=`#if defined( USE_COLOR_ALPHA )
diffuseColor *= vColor;
#elif defined( USE_COLOR )
diffuseColor.rgb *= vColor;
#endif`,eU=`#if defined( USE_COLOR_ALPHA )
varying vec4 vColor;
#elif defined( USE_COLOR )
varying vec3 vColor;
#endif`,tU=`#if defined( USE_COLOR_ALPHA )
varying vec4 vColor;
#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )
varying vec3 vColor;
#endif`,nU=`#if defined( USE_COLOR_ALPHA )
vColor = vec4( 1.0 );
#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )
vColor = vec3( 1.0 );
#endif
#ifdef USE_COLOR
vColor *= color;
#endif
#ifdef USE_INSTANCING_COLOR
vColor.xyz *= instanceColor.xyz;
#endif
#ifdef USE_BATCHING_COLOR
vec3 batchingColor = getBatchingColor( getIndirectIndex( gl_DrawID ) );
vColor.xyz *= batchingColor.xyz;
#endif`,rU=`#define PI 3.141592653589793
#define PI2 6.283185307179586
#define PI_HALF 1.5707963267948966
#define RECIPROCAL_PI 0.3183098861837907
#define RECIPROCAL_PI2 0.15915494309189535
#define EPSILON 1e-6
#ifndef saturate
#define saturate( a ) clamp( a, 0.0, 1.0 )
#endif
#define whiteComplement( a ) ( 1.0 - saturate( a ) )
float pow2( const in float x ) { return x*x; }
vec3 pow2( const in vec3 x ) { return x*x; }
float pow3( const in float x ) { return x*x*x; }
float pow4( const in float x ) { float x2 = x*x; return x2*x2; }
float max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }
float average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }
highp float rand( const in vec2 uv ) {
const highp float a = 12.9898, b = 78.233, c = 43758.5453;
highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );
return fract( sin( sn ) * c );
}
#ifdef HIGH_PRECISION
float precisionSafeLength( vec3 v ) { return length( v ); }
#else
float precisionSafeLength( vec3 v ) {
float maxComponent = max3( abs( v ) );
return length( v / maxComponent ) * maxComponent;
}
#endif
struct IncidentLight {
vec3 color;
vec3 direction;
bool visible;
};
struct ReflectedLight {
vec3 directDiffuse;
vec3 directSpecular;
vec3 indirectDiffuse;
vec3 indirectSpecular;
};
#ifdef USE_ALPHAHASH
varying vec3 vPosition;
#endif
vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
}
vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {
return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );
}
bool isPerspectiveMatrix( mat4 m ) {
return m[ 2 ][ 3 ] == - 1.0;
}
vec2 equirectUv( in vec3 dir ) {
float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;
float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;
return vec2( u, v );
}
vec3 BRDF_Lambert( const in vec3 diffuseColor ) {
return RECIPROCAL_PI * diffuseColor;
}
vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {
float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );
return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );
}
float F_Schlick( const in float f0, const in float f90, const in float dotVH ) {
float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );
return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );
} // validated`,iU=`#ifdef ENVMAP_TYPE_CUBE_UV
#define cubeUV_minMipLevel 4.0
#define cubeUV_minTileSize 16.0
float getFace( vec3 direction ) {
vec3 absDirection = abs( direction );
float face = - 1.0;
if ( absDirection.x > absDirection.z ) {
if ( absDirection.x > absDirection.y )
face = direction.x > 0.0 ? 0.0 : 3.0;
else
face = direction.y > 0.0 ? 1.0 : 4.0;
} else {
if ( absDirection.z > absDirection.y )
face = direction.z > 0.0 ? 2.0 : 5.0;
else
face = direction.y > 0.0 ? 1.0 : 4.0;
}
return face;
}
vec2 getUV( vec3 direction, float face ) {
vec2 uv;
if ( face == 0.0 ) {
uv = vec2( direction.z, direction.y ) / abs( direction.x );
} else if ( face == 1.0 ) {
uv = vec2( - direction.x, - direction.z ) / abs( direction.y );
} else if ( face == 2.0 ) {
uv = vec2( - direction.x, direction.y ) / abs( direction.z );
} else if ( face == 3.0 ) {
uv = vec2( - direction.z, direction.y ) / abs( direction.x );
} else if ( face == 4.0 ) {
uv = vec2( - direction.x, direction.z ) / abs( direction.y );
} else {
uv = vec2( direction.x, direction.y ) / abs( direction.z );
}
return 0.5 * ( uv + 1.0 );
}
vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {
float face = getFace( direction );
float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );
mipInt = max( mipInt, cubeUV_minMipLevel );
float faceSize = exp2( mipInt );
highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;
if ( face > 2.0 ) {
uv.y += faceSize;
face -= 3.0;
}
uv.x += face * faceSize;
uv.x += filterInt * 3.0 * cubeUV_minTileSize;
uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );
uv.x *= CUBEUV_TEXEL_WIDTH;
uv.y *= CUBEUV_TEXEL_HEIGHT;
#ifdef texture2DGradEXT
return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;
#else
return texture2D( envMap, uv ).rgb;
#endif
}
#define cubeUV_r0 1.0
#define cubeUV_m0 - 2.0
#define cubeUV_r1 0.8
#define cubeUV_m1 - 1.0
#define cubeUV_r4 0.4
#define cubeUV_m4 2.0
#define cubeUV_r5 0.305
#define cubeUV_m5 3.0
#define cubeUV_r6 0.21
#define cubeUV_m6 4.0
float roughnessToMip( float roughness ) {
float mip = 0.0;
if ( roughness >= cubeUV_r1 ) {
mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;
} else if ( roughness >= cubeUV_r4 ) {
mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;
} else if ( roughness >= cubeUV_r5 ) {
mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;
} else if ( roughness >= cubeUV_r6 ) {
mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;
} else {
mip = - 2.0 * log2( 1.16 * roughness ); }
return mip;
}
vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {
float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );
float mipF = fract( mip );
float mipInt = floor( mip );
vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );
if ( mipF == 0.0 ) {
return vec4( color0, 1.0 );
} else {
vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );
return vec4( mix( color0, color1, mipF ), 1.0 );
}
}
#endif`,sU=`vec3 transformedNormal = objectNormal;
#ifdef USE_TANGENT
vec3 transformedTangent = objectTangent;
#endif
#ifdef USE_BATCHING
mat3 bm = mat3( batchingMatrix );
transformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) );
transformedNormal = bm * transformedNormal;
#ifdef USE_TANGENT
transformedTangent = bm * transformedTangent;
#endif
#endif
#ifdef USE_INSTANCING
mat3 im = mat3( instanceMatrix );
transformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) );
transformedNormal = im * transformedNormal;
#ifdef USE_TANGENT
transformedTangent = im * transformedTangent;
#endif
#endif
transformedNormal = normalMatrix * transformedNormal;
#ifdef FLIP_SIDED
transformedNormal = - transformedNormal;
#endif
#ifdef USE_TANGENT
transformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz;
#ifdef FLIP_SIDED
transformedTangent = - transformedTangent;
#endif
#endif`,aU=`#ifdef USE_DISPLACEMENTMAP
uniform sampler2D displacementMap;
uniform float displacementScale;
uniform float displacementBias;
#endif`,oU=`#ifdef USE_DISPLACEMENTMAP
transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );
#endif`,lU=`#ifdef USE_EMISSIVEMAP
vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );
#ifdef DECODE_VIDEO_TEXTURE_EMISSIVE
emissiveColor = sRGBTransferEOTF( emissiveColor );
#endif
totalEmissiveRadiance *= emissiveColor.rgb;
#endif`,uU=`#ifdef USE_EMISSIVEMAP
uniform sampler2D emissiveMap;
#endif`,cU="gl_FragColor = linearToOutputTexel( gl_FragColor );",hU=`vec4 LinearTransferOETF( in vec4 value ) {
return value;
}
vec4 sRGBTransferEOTF( in vec4 value ) {
return vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.a );
}
vec4 sRGBTransferOETF( in vec4 value ) {
return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );
}`,dU=`#ifdef USE_ENVMAP
#ifdef ENV_WORLDPOS
vec3 cameraToFrag;
if ( isOrthographic ) {
cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );
} else {
cameraToFrag = normalize( vWorldPosition - cameraPosition );
}
vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
#ifdef ENVMAP_MODE_REFLECTION
vec3 reflectVec = reflect( cameraToFrag, worldNormal );
#else
vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );
#endif
#else
vec3 reflectVec = vReflect;
#endif
#ifdef ENVMAP_TYPE_CUBE
vec4 envColor = textureCube( envMap, envMapRotation * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );
#else
vec4 envColor = vec4( 0.0 );
#endif
#ifdef ENVMAP_BLENDING_MULTIPLY
outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );
#elif defined( ENVMAP_BLENDING_MIX )
outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );
#elif defined( ENVMAP_BLENDING_ADD )
outgoingLight += envColor.xyz * specularStrength * reflectivity;
#endif
#endif`,fU=`#ifdef USE_ENVMAP
uniform float envMapIntensity;
uniform float flipEnvMap;
uniform mat3 envMapRotation;
#ifdef ENVMAP_TYPE_CUBE
uniform samplerCube envMap;
#else
uniform sampler2D envMap;
#endif
#endif`,AU=`#ifdef USE_ENVMAP
uniform float reflectivity;
#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
#define ENV_WORLDPOS
#endif
#ifdef ENV_WORLDPOS
varying vec3 vWorldPosition;
uniform float refractionRatio;
#else
varying vec3 vReflect;
#endif
#endif`,pU=`#ifdef USE_ENVMAP
#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
#define ENV_WORLDPOS
#endif
#ifdef ENV_WORLDPOS
varying vec3 vWorldPosition;
#else
varying vec3 vReflect;
uniform float refractionRatio;
#endif
#endif`,gU=`#ifdef USE_ENVMAP
#ifdef ENV_WORLDPOS
vWorldPosition = worldPosition.xyz;
#else
vec3 cameraToVertex;
if ( isOrthographic ) {
cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );
} else {
cameraToVertex = normalize( worldPosition.xyz - cameraPosition );
}
vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );
#ifdef ENVMAP_MODE_REFLECTION
vReflect = reflect( cameraToVertex, worldNormal );
#else
vReflect = refract( cameraToVertex, worldNormal, refractionRatio );
#endif
#endif
#endif`,mU=`#ifdef USE_FOG
vFogDepth = - mvPosition.z;
#endif`,vU=`#ifdef USE_FOG
varying float vFogDepth;
#endif`,yU=`#ifdef USE_FOG
#ifdef FOG_EXP2
float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );
#else
float fogFactor = smoothstep( fogNear, fogFar, vFogDepth );
#endif
gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );
#endif`,xU=`#ifdef USE_FOG
uniform vec3 fogColor;
varying float vFogDepth;
#ifdef FOG_EXP2
uniform float fogDensity;
#else
uniform float fogNear;
uniform float fogFar;
#endif
#endif`,bU=`#ifdef USE_GRADIENTMAP
uniform sampler2D gradientMap;
#endif
vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {
float dotNL = dot( normal, lightDirection );
vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );
#ifdef USE_GRADIENTMAP
return vec3( texture2D( gradientMap, coord ).r );
#else
vec2 fw = fwidth( coord ) * 0.5;
return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );
#endif
}`,_U=`#ifdef USE_LIGHTMAP
uniform sampler2D lightMap;
uniform float lightMapIntensity;
#endif`,wU=`LambertMaterial material;
material.diffuseColor = diffuseColor.rgb;
material.specularStrength = specularStrength;`,SU=`varying vec3 vViewPosition;
struct LambertMaterial {
vec3 diffuseColor;
float specularStrength;
};
void RE_Direct_Lambert( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {
float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
vec3 irradiance = dotNL * directLight.color;
reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
}
void RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {
reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
}
#define RE_Direct RE_Direct_Lambert
#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,MU=`uniform bool receiveShadow;
uniform vec3 ambientLightColor;
#if defined( USE_LIGHT_PROBES )
uniform vec3 lightProbe[ 9 ];
#endif
vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {
float x = normal.x, y = normal.y, z = normal.z;
vec3 result = shCoefficients[ 0 ] * 0.886227;
result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;
result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;
result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;
result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;
result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;
result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );
result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;
result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );
return result;
}
vec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {
vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );
return irradiance;
}
vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {
vec3 irradiance = ambientLightColor;
return irradiance;
}
float getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {
float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );
if ( cutoffDistance > 0.0 ) {
distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );
}
return distanceFalloff;
}
float getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {
return smoothstep( coneCosine, penumbraCosine, angleCosine );
}
#if NUM_DIR_LIGHTS > 0
struct DirectionalLight {
vec3 direction;
vec3 color;
};
uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];
void getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) {
light.color = directionalLight.color;
light.direction = directionalLight.direction;
light.visible = true;
}
#endif
#if NUM_POINT_LIGHTS > 0
struct PointLight {
vec3 position;
vec3 color;
float distance;
float decay;
};
uniform PointLight pointLights[ NUM_POINT_LIGHTS ];
void getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) {
vec3 lVector = pointLight.position - geometryPosition;
light.direction = normalize( lVector );
float lightDistance = length( lVector );
light.color = pointLight.color;
light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );
light.visible = ( light.color != vec3( 0.0 ) );
}
#endif
#if NUM_SPOT_LIGHTS > 0
struct SpotLight {
vec3 position;
vec3 direction;
vec3 color;
float distance;
float decay;
float coneCos;
float penumbraCos;
};
uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];
void getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) {
vec3 lVector = spotLight.position - geometryPosition;
light.direction = normalize( lVector );
float angleCos = dot( light.direction, spotLight.direction );
float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );
if ( spotAttenuation > 0.0 ) {
float lightDistance = length( lVector );
light.color = spotLight.color * spotAttenuation;
light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );
light.visible = ( light.color != vec3( 0.0 ) );
} else {
light.color = vec3( 0.0 );
light.visible = false;
}
}
#endif
#if NUM_RECT_AREA_LIGHTS > 0
struct RectAreaLight {
vec3 color;
vec3 position;
vec3 halfWidth;
vec3 halfHeight;
};
uniform sampler2D ltc_1; uniform sampler2D ltc_2;
uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];
#endif
#if NUM_HEMI_LIGHTS > 0
struct HemisphereLight {
vec3 direction;
vec3 skyColor;
vec3 groundColor;
};
uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];
vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {
float dotNL = dot( normal, hemiLight.direction );
float hemiDiffuseWeight = 0.5 * dotNL + 0.5;
vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );
return irradiance;
}
#endif`,EU=`#ifdef USE_ENVMAP
vec3 getIBLIrradiance( const in vec3 normal ) {
#ifdef ENVMAP_TYPE_CUBE_UV
vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
vec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 );
return PI * envMapColor.rgb * envMapIntensity;
#else
return vec3( 0.0 );
#endif
}
vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {
#ifdef ENVMAP_TYPE_CUBE_UV
vec3 reflectVec = reflect( - viewDir, normal );
reflectVec = normalize( mix( reflectVec, normal, pow4( roughness ) ) );
reflectVec = inverseTransformDirection( reflectVec, viewMatrix );
vec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness );
return envMapColor.rgb * envMapIntensity;
#else
return vec3( 0.0 );
#endif
}
#ifdef USE_ANISOTROPY
vec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {
#ifdef ENVMAP_TYPE_CUBE_UV
vec3 bentNormal = cross( bitangent, viewDir );
bentNormal = normalize( cross( bentNormal, bitangent ) );
bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );
return getIBLRadiance( viewDir, bentNormal, roughness );
#else
return vec3( 0.0 );
#endif
}
#endif
#endif`,CU=`ToonMaterial material;
material.diffuseColor = diffuseColor.rgb;`,TU=`varying vec3 vViewPosition;
struct ToonMaterial {
vec3 diffuseColor;
};
void RE_Direct_Toon( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {
vec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color;
reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
}
void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {
reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
}
#define RE_Direct RE_Direct_Toon
#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,BU=`BlinnPhongMaterial material;
material.diffuseColor = diffuseColor.rgb;
material.specularColor = specular;
material.specularShininess = shininess;
material.specularStrength = specularStrength;`,RU=`varying vec3 vViewPosition;
struct BlinnPhongMaterial {
vec3 diffuseColor;
vec3 specularColor;
float specularShininess;
float specularStrength;
};
void RE_Direct_BlinnPhong( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {
float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
vec3 irradiance = dotNL * directLight.color;
reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength;
}
void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {
reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
}
#define RE_Direct RE_Direct_BlinnPhong
#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,IU=`PhysicalMaterial material;
material.diffuseColor = diffuseColor.rgb;
material.diffuseContribution = diffuseColor.rgb * ( 1.0 - metalnessFactor );
material.metalness = metalnessFactor;
vec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) );
float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );
material.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;
material.roughness = min( material.roughness, 1.0 );
#ifdef IOR
material.ior = ior;
#ifdef USE_SPECULAR
float specularIntensityFactor = specularIntensity;
vec3 specularColorFactor = specularColor;
#ifdef USE_SPECULAR_COLORMAP
specularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;
#endif
#ifdef USE_SPECULAR_INTENSITYMAP
specularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;
#endif
material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );
#else
float specularIntensityFactor = 1.0;
vec3 specularColorFactor = vec3( 1.0 );
material.specularF90 = 1.0;
#endif
material.specularColor = min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor;
material.specularColorBlended = mix( material.specularColor, diffuseColor.rgb, metalnessFactor );
#else
material.specularColor = vec3( 0.04 );
material.specularColorBlended = mix( material.specularColor, diffuseColor.rgb, metalnessFactor );
material.specularF90 = 1.0;
#endif
#ifdef USE_CLEARCOAT
material.clearcoat = clearcoat;
material.clearcoatRoughness = clearcoatRoughness;
material.clearcoatF0 = vec3( 0.04 );
material.clearcoatF90 = 1.0;
#ifdef USE_CLEARCOATMAP
material.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x;
#endif
#ifdef USE_CLEARCOAT_ROUGHNESSMAP
material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y;
#endif
material.clearcoat = saturate( material.clearcoat ); material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );
material.clearcoatRoughness += geometryRoughness;
material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );
#endif
#ifdef USE_DISPERSION
material.dispersion = dispersion;
#endif
#ifdef USE_IRIDESCENCE
material.iridescence = iridescence;
material.iridescenceIOR = iridescenceIOR;
#ifdef USE_IRIDESCENCEMAP
material.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;
#endif
#ifdef USE_IRIDESCENCE_THICKNESSMAP
material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;
#else
material.iridescenceThickness = iridescenceThicknessMaximum;
#endif
#endif
#ifdef USE_SHEEN
material.sheenColor = sheenColor;
#ifdef USE_SHEEN_COLORMAP
material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;
#endif
material.sheenRoughness = clamp( sheenRoughness, 0.0001, 1.0 );
#ifdef USE_SHEEN_ROUGHNESSMAP
material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;
#endif
#endif
#ifdef USE_ANISOTROPY
#ifdef USE_ANISOTROPYMAP
mat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x );
vec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb;
vec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b;
#else
vec2 anisotropyV = anisotropyVector;
#endif
material.anisotropy = length( anisotropyV );
if( material.anisotropy == 0.0 ) {
anisotropyV = vec2( 1.0, 0.0 );
} else {
anisotropyV /= material.anisotropy;
material.anisotropy = saturate( material.anisotropy );
}
material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );
material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;
material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;
#endif`,NU=`uniform sampler2D dfgLUT;
struct PhysicalMaterial {
vec3 diffuseColor;
vec3 diffuseContribution;
vec3 specularColor;
vec3 specularColorBlended;
float roughness;
float metalness;
float specularF90;
float dispersion;
#ifdef USE_CLEARCOAT
float clearcoat;
float clearcoatRoughness;
vec3 clearcoatF0;
float clearcoatF90;
#endif
#ifdef USE_IRIDESCENCE
float iridescence;
float iridescenceIOR;
float iridescenceThickness;
vec3 iridescenceFresnel;
vec3 iridescenceF0;
vec3 iridescenceFresnelDielectric;
vec3 iridescenceFresnelMetallic;
#endif
#ifdef USE_SHEEN
vec3 sheenColor;
float sheenRoughness;
#endif
#ifdef IOR
float ior;
#endif
#ifdef USE_TRANSMISSION
float transmission;
float transmissionAlpha;
float thickness;
float attenuationDistance;
vec3 attenuationColor;
#endif
#ifdef USE_ANISOTROPY
float anisotropy;
float alphaT;
vec3 anisotropyT;
vec3 anisotropyB;
#endif
};
vec3 clearcoatSpecularDirect = vec3( 0.0 );
vec3 clearcoatSpecularIndirect = vec3( 0.0 );
vec3 sheenSpecularDirect = vec3( 0.0 );
vec3 sheenSpecularIndirect = vec3(0.0 );
vec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {
float x = clamp( 1.0 - dotVH, 0.0, 1.0 );
float x2 = x * x;
float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );
return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );
}
float V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {
float a2 = pow2( alpha );
float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );
float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );
return 0.5 / max( gv + gl, EPSILON );
}
float D_GGX( const in float alpha, const in float dotNH ) {
float a2 = pow2( alpha );
float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;
return RECIPROCAL_PI * a2 / pow2( denom );
}
#ifdef USE_ANISOTROPY
float V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) {
float gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );
float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );
float v = 0.5 / ( gv + gl );
return v;
}
float D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {
float a2 = alphaT * alphaB;
highp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );
highp float v2 = dot( v, v );
float w2 = a2 / v2;
return RECIPROCAL_PI * a2 * pow2 ( w2 );
}
#endif
#ifdef USE_CLEARCOAT
vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {
vec3 f0 = material.clearcoatF0;
float f90 = material.clearcoatF90;
float roughness = material.clearcoatRoughness;
float alpha = pow2( roughness );
vec3 halfDir = normalize( lightDir + viewDir );
float dotNL = saturate( dot( normal, lightDir ) );
float dotNV = saturate( dot( normal, viewDir ) );
float dotNH = saturate( dot( normal, halfDir ) );
float dotVH = saturate( dot( viewDir, halfDir ) );
vec3 F = F_Schlick( f0, f90, dotVH );
float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );
float D = D_GGX( alpha, dotNH );
return F * ( V * D );
}
#endif
vec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {
vec3 f0 = material.specularColorBlended;
float f90 = material.specularF90;
float roughness = material.roughness;
float alpha = pow2( roughness );
vec3 halfDir = normalize( lightDir + viewDir );
float dotNL = saturate( dot( normal, lightDir ) );
float dotNV = saturate( dot( normal, viewDir ) );
float dotNH = saturate( dot( normal, halfDir ) );
float dotVH = saturate( dot( viewDir, halfDir ) );
vec3 F = F_Schlick( f0, f90, dotVH );
#ifdef USE_IRIDESCENCE
F = mix( F, material.iridescenceFresnel, material.iridescence );
#endif
#ifdef USE_ANISOTROPY
float dotTL = dot( material.anisotropyT, lightDir );
float dotTV = dot( material.anisotropyT, viewDir );
float dotTH = dot( material.anisotropyT, halfDir );
float dotBL = dot( material.anisotropyB, lightDir );
float dotBV = dot( material.anisotropyB, viewDir );
float dotBH = dot( material.anisotropyB, halfDir );
float V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );
float D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );
#else
float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );
float D = D_GGX( alpha, dotNH );
#endif
return F * ( V * D );
}
vec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {
const float LUT_SIZE = 64.0;
const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;
const float LUT_BIAS = 0.5 / LUT_SIZE;
float dotNV = saturate( dot( N, V ) );
vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );
uv = uv * LUT_SCALE + LUT_BIAS;
return uv;
}
float LTC_ClippedSphereFormFactor( const in vec3 f ) {
float l = length( f );
return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );
}
vec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {
float x = dot( v1, v2 );
float y = abs( x );
float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;
float b = 3.4175940 + ( 4.1616724 + y ) * y;
float v = a / b;
float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;
return cross( v1, v2 ) * theta_sintheta;
}
vec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {
vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];
vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];
vec3 lightNormal = cross( v1, v2 );
if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );
vec3 T1, T2;
T1 = normalize( V - N * dot( V, N ) );
T2 = - cross( N, T1 );
mat3 mat = mInv * transpose( mat3( T1, T2, N ) );
vec3 coords[ 4 ];
coords[ 0 ] = mat * ( rectCoords[ 0 ] - P );
coords[ 1 ] = mat * ( rectCoords[ 1 ] - P );
coords[ 2 ] = mat * ( rectCoords[ 2 ] - P );
coords[ 3 ] = mat * ( rectCoords[ 3 ] - P );
coords[ 0 ] = normalize( coords[ 0 ] );
coords[ 1 ] = normalize( coords[ 1 ] );
coords[ 2 ] = normalize( coords[ 2 ] );
coords[ 3 ] = normalize( coords[ 3 ] );
vec3 vectorFormFactor = vec3( 0.0 );
vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );
vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );
vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );
vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );
float result = LTC_ClippedSphereFormFactor( vectorFormFactor );
return vec3( result );
}
#if defined( USE_SHEEN )
float D_Charlie( float roughness, float dotNH ) {
float alpha = pow2( roughness );
float invAlpha = 1.0 / alpha;
float cos2h = dotNH * dotNH;
float sin2h = max( 1.0 - cos2h, 0.0078125 );
return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );
}
float V_Neubelt( float dotNV, float dotNL ) {
return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );
}
vec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {
vec3 halfDir = normalize( lightDir + viewDir );
float dotNL = saturate( dot( normal, lightDir ) );
float dotNV = saturate( dot( normal, viewDir ) );
float dotNH = saturate( dot( normal, halfDir ) );
float D = D_Charlie( sheenRoughness, dotNH );
float V = V_Neubelt( dotNV, dotNL );
return sheenColor * ( D * V );
}
#endif
float IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {
float dotNV = saturate( dot( normal, viewDir ) );
float r2 = roughness * roughness;
float rInv = 1.0 / ( roughness + 0.1 );
float a = -1.9362 + 1.0678 * roughness + 0.4573 * r2 - 0.8469 * rInv;
float b = -0.6014 + 0.5538 * roughness - 0.4670 * r2 - 0.1255 * rInv;
float DG = exp( a * dotNV + b );
return saturate( DG );
}
vec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {
float dotNV = saturate( dot( normal, viewDir ) );
vec2 fab = texture2D( dfgLUT, vec2( roughness, dotNV ) ).rg;
return specularColor * fab.x + specularF90 * fab.y;
}
#ifdef USE_IRIDESCENCE
void computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {
#else
void computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {
#endif
float dotNV = saturate( dot( normal, viewDir ) );
vec2 fab = texture2D( dfgLUT, vec2( roughness, dotNV ) ).rg;
#ifdef USE_IRIDESCENCE
vec3 Fr = mix( specularColor, iridescenceF0, iridescence );
#else
vec3 Fr = specularColor;
#endif
vec3 FssEss = Fr * fab.x + specularF90 * fab.y;
float Ess = fab.x + fab.y;
float Ems = 1.0 - Ess;
vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619; vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );
singleScatter += FssEss;
multiScatter += Fms * Ems;
}
vec3 BRDF_GGX_Multiscatter( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {
vec3 singleScatter = BRDF_GGX( lightDir, viewDir, normal, material );
float dotNL = saturate( dot( normal, lightDir ) );
float dotNV = saturate( dot( normal, viewDir ) );
vec2 dfgV = texture2D( dfgLUT, vec2( material.roughness, dotNV ) ).rg;
vec2 dfgL = texture2D( dfgLUT, vec2( material.roughness, dotNL ) ).rg;
vec3 FssEss_V = material.specularColorBlended * dfgV.x + material.specularF90 * dfgV.y;
vec3 FssEss_L = material.specularColorBlended * dfgL.x + material.specularF90 * dfgL.y;
float Ess_V = dfgV.x + dfgV.y;
float Ess_L = dfgL.x + dfgL.y;
float Ems_V = 1.0 - Ess_V;
float Ems_L = 1.0 - Ess_L;
vec3 Favg = material.specularColorBlended + ( 1.0 - material.specularColorBlended ) * 0.047619;
vec3 Fms = FssEss_V * FssEss_L * Favg / ( 1.0 - Ems_V * Ems_L * Favg + EPSILON );
float compensationFactor = Ems_V * Ems_L;
vec3 multiScatter = Fms * compensationFactor;
return singleScatter + multiScatter;
}
#if NUM_RECT_AREA_LIGHTS > 0
void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
vec3 normal = geometryNormal;
vec3 viewDir = geometryViewDir;
vec3 position = geometryPosition;
vec3 lightPos = rectAreaLight.position;
vec3 halfWidth = rectAreaLight.halfWidth;
vec3 halfHeight = rectAreaLight.halfHeight;
vec3 lightColor = rectAreaLight.color;
float roughness = material.roughness;
vec3 rectCoords[ 4 ];
rectCoords[ 0 ] = lightPos + halfWidth - halfHeight; rectCoords[ 1 ] = lightPos - halfWidth - halfHeight;
rectCoords[ 2 ] = lightPos - halfWidth + halfHeight;
rectCoords[ 3 ] = lightPos + halfWidth + halfHeight;
vec2 uv = LTC_Uv( normal, viewDir, roughness );
vec4 t1 = texture2D( ltc_1, uv );
vec4 t2 = texture2D( ltc_2, uv );
mat3 mInv = mat3(
vec3( t1.x, 0, t1.y ),
vec3( 0, 1, 0 ),
vec3( t1.z, 0, t1.w )
);
vec3 fresnel = ( material.specularColorBlended * t2.x + ( vec3( 1.0 ) - material.specularColorBlended ) * t2.y );
reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );
reflectedLight.directDiffuse += lightColor * material.diffuseContribution * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );
}
#endif
void RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
vec3 irradiance = dotNL * directLight.color;
#ifdef USE_CLEARCOAT
float dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) );
vec3 ccIrradiance = dotNLcc * directLight.color;
clearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material );
#endif
#ifdef USE_SHEEN
sheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness );
float sheenAlbedoV = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );
float sheenAlbedoL = IBLSheenBRDF( geometryNormal, directLight.direction, material.sheenRoughness );
float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * max( sheenAlbedoV, sheenAlbedoL );
irradiance *= sheenEnergyComp;
#endif
reflectedLight.directSpecular += irradiance * BRDF_GGX_Multiscatter( directLight.direction, geometryViewDir, geometryNormal, material );
reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseContribution );
}
void RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
vec3 diffuse = irradiance * BRDF_Lambert( material.diffuseContribution );
#ifdef USE_SHEEN
float sheenAlbedo = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );
float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * sheenAlbedo;
diffuse *= sheenEnergyComp;
#endif
reflectedLight.indirectDiffuse += diffuse;
}
void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {
#ifdef USE_CLEARCOAT
clearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );
#endif
#ifdef USE_SHEEN
sheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ) * RECIPROCAL_PI;
#endif
vec3 singleScatteringDielectric = vec3( 0.0 );
vec3 multiScatteringDielectric = vec3( 0.0 );
vec3 singleScatteringMetallic = vec3( 0.0 );
vec3 multiScatteringMetallic = vec3( 0.0 );
#ifdef USE_IRIDESCENCE
computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnelDielectric, material.roughness, singleScatteringDielectric, multiScatteringDielectric );
computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.diffuseColor, material.specularF90, material.iridescence, material.iridescenceFresnelMetallic, material.roughness, singleScatteringMetallic, multiScatteringMetallic );
#else
computeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScatteringDielectric, multiScatteringDielectric );
computeMultiscattering( geometryNormal, geometryViewDir, material.diffuseColor, material.specularF90, material.roughness, singleScatteringMetallic, multiScatteringMetallic );
#endif
vec3 singleScattering = mix( singleScatteringDielectric, singleScatteringMetallic, material.metalness );
vec3 multiScattering = mix( multiScatteringDielectric, multiScatteringMetallic, material.metalness );
vec3 totalScatteringDielectric = singleScatteringDielectric + multiScatteringDielectric;
vec3 diffuse = material.diffuseContribution * ( 1.0 - totalScatteringDielectric );
vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;
vec3 indirectSpecular = radiance * singleScattering;
indirectSpecular += multiScattering * cosineWeightedIrradiance;
vec3 indirectDiffuse = diffuse * cosineWeightedIrradiance;
#ifdef USE_SHEEN
float sheenAlbedo = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );
float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * sheenAlbedo;
indirectSpecular *= sheenEnergyComp;
indirectDiffuse *= sheenEnergyComp;
#endif
reflectedLight.indirectSpecular += indirectSpecular;
reflectedLight.indirectDiffuse += indirectDiffuse;
}
#define RE_Direct RE_Direct_Physical
#define RE_Direct_RectArea RE_Direct_RectArea_Physical
#define RE_IndirectDiffuse RE_IndirectDiffuse_Physical
#define RE_IndirectSpecular RE_IndirectSpecular_Physical
float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {
return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );
}`,FU=`
vec3 geometryPosition = - vViewPosition;
vec3 geometryNormal = normal;
vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );
vec3 geometryClearcoatNormal = vec3( 0.0 );
#ifdef USE_CLEARCOAT
geometryClearcoatNormal = clearcoatNormal;
#endif
#ifdef USE_IRIDESCENCE
float dotNVi = saturate( dot( normal, geometryViewDir ) );
if ( material.iridescenceThickness == 0.0 ) {
material.iridescence = 0.0;
} else {
material.iridescence = saturate( material.iridescence );
}
if ( material.iridescence > 0.0 ) {
material.iridescenceFresnelDielectric = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );
material.iridescenceFresnelMetallic = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.diffuseColor );
material.iridescenceFresnel = mix( material.iridescenceFresnelDielectric, material.iridescenceFresnelMetallic, material.metalness );
material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );
}
#endif
IncidentLight directLight;
#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )
PointLight pointLight;
#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0
PointLightShadow pointLightShadow;
#endif
#pragma unroll_loop_start
for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {
pointLight = pointLights[ i ];
getPointLightInfo( pointLight, geometryPosition, directLight );
#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS ) && ( defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_BASIC ) )
pointLightShadow = pointLightShadows[ i ];
directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;
#endif
RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
}
#pragma unroll_loop_end
#endif
#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )
SpotLight spotLight;
vec4 spotColor;
vec3 spotLightCoord;
bool inSpotLightMap;
#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0
SpotLightShadow spotLightShadow;
#endif
#pragma unroll_loop_start
for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {
spotLight = spotLights[ i ];
getSpotLightInfo( spotLight, geometryPosition, directLight );
#if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )
#define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX
#elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
#define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS
#else
#define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )
#endif
#if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )
spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;
inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );
spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );
directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;
#endif
#undef SPOT_LIGHT_MAP_INDEX
#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
spotLightShadow = spotLightShadows[ i ];
directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;
#endif
RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
}
#pragma unroll_loop_end
#endif
#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )
DirectionalLight directionalLight;
#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0
DirectionalLightShadow directionalLightShadow;
#endif
#pragma unroll_loop_start
for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {
directionalLight = directionalLights[ i ];
getDirectionalLightInfo( directionalLight, directLight );
#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )
directionalLightShadow = directionalLightShadows[ i ];
directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
#endif
RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
}
#pragma unroll_loop_end
#endif
#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )
RectAreaLight rectAreaLight;
#pragma unroll_loop_start
for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {
rectAreaLight = rectAreaLights[ i ];
RE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
}
#pragma unroll_loop_end
#endif
#if defined( RE_IndirectDiffuse )
vec3 iblIrradiance = vec3( 0.0 );
vec3 irradiance = getAmbientLightIrradiance( ambientLightColor );
#if defined( USE_LIGHT_PROBES )
irradiance += getLightProbeIrradiance( lightProbe, geometryNormal );
#endif
#if ( NUM_HEMI_LIGHTS > 0 )
#pragma unroll_loop_start
for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {
irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal );
}
#pragma unroll_loop_end
#endif
#endif
#if defined( RE_IndirectSpecular )
vec3 radiance = vec3( 0.0 );
vec3 clearcoatRadiance = vec3( 0.0 );
#endif`,PU=`#if defined( RE_IndirectDiffuse )
#ifdef USE_LIGHTMAP
vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;
irradiance += lightMapIrradiance;
#endif
#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )
iblIrradiance += getIBLIrradiance( geometryNormal );
#endif
#endif
#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )
#ifdef USE_ANISOTROPY
radiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy );
#else
radiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness );
#endif
#ifdef USE_CLEARCOAT
clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );
#endif
#endif`,LU=`#if defined( RE_IndirectDiffuse )
RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
#endif
#if defined( RE_IndirectSpecular )
RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
#endif`,UU=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )
gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;
#endif`,OU=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )
uniform float logDepthBufFC;
varying float vFragDepth;
varying float vIsPerspective;
#endif`,DU=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER
varying float vFragDepth;
varying float vIsPerspective;
#endif`,kU=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER
vFragDepth = 1.0 + gl_Position.w;
vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );
#endif`,VU=`#ifdef USE_MAP
vec4 sampledDiffuseColor = texture2D( map, vMapUv );
#ifdef DECODE_VIDEO_TEXTURE
sampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor );
#endif
diffuseColor *= sampledDiffuseColor;
#endif`,zU=`#ifdef USE_MAP
uniform sampler2D map;
#endif`,GU=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
#if defined( USE_POINTS_UV )
vec2 uv = vUv;
#else
vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;
#endif
#endif
#ifdef USE_MAP
diffuseColor *= texture2D( map, uv );
#endif
#ifdef USE_ALPHAMAP
diffuseColor.a *= texture2D( alphaMap, uv ).g;
#endif`,HU=`#if defined( USE_POINTS_UV )
varying vec2 vUv;
#else
#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
uniform mat3 uvTransform;
#endif
#endif
#ifdef USE_MAP
uniform sampler2D map;
#endif
#ifdef USE_ALPHAMAP
uniform sampler2D alphaMap;
#endif`,QU=`float metalnessFactor = metalness;
#ifdef USE_METALNESSMAP
vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );
metalnessFactor *= texelMetalness.b;
#endif`,WU=`#ifdef USE_METALNESSMAP
uniform sampler2D metalnessMap;
#endif`,ZU=`#ifdef USE_INSTANCING_MORPH
float morphTargetInfluences[ MORPHTARGETS_COUNT ];
float morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r;
for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
morphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r;
}
#endif`,KU=`#if defined( USE_MORPHCOLORS )
vColor *= morphTargetBaseInfluence;
for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
#if defined( USE_COLOR_ALPHA )
if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];
#elif defined( USE_COLOR )
if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];
#endif
}
#endif`,$U=`#ifdef USE_MORPHNORMALS
objectNormal *= morphTargetBaseInfluence;
for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];
}
#endif`,XU=`#ifdef USE_MORPHTARGETS
#ifndef USE_INSTANCING_MORPH
uniform float morphTargetBaseInfluence;
uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];
#endif
uniform sampler2DArray morphTargetsTexture;
uniform ivec2 morphTargetsTextureSize;
vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {
int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;
int y = texelIndex / morphTargetsTextureSize.x;
int x = texelIndex - y * morphTargetsTextureSize.x;
ivec3 morphUV = ivec3( x, y, morphTargetIndex );
return texelFetch( morphTargetsTexture, morphUV, 0 );
}
#endif`,jU=`#ifdef USE_MORPHTARGETS
transformed *= morphTargetBaseInfluence;
for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];
}
#endif`,YU=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;
#ifdef FLAT_SHADED
vec3 fdx = dFdx( vViewPosition );
vec3 fdy = dFdy( vViewPosition );
vec3 normal = normalize( cross( fdx, fdy ) );
#else
vec3 normal = normalize( vNormal );
#ifdef DOUBLE_SIDED
normal *= faceDirection;
#endif
#endif
#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY )
#ifdef USE_TANGENT
mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );
#else
mat3 tbn = getTangentFrame( - vViewPosition, normal,
#if defined( USE_NORMALMAP )
vNormalMapUv
#elif defined( USE_CLEARCOAT_NORMALMAP )
vClearcoatNormalMapUv
#else
vUv
#endif
);
#endif
#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )
tbn[0] *= faceDirection;
tbn[1] *= faceDirection;
#endif
#endif
#ifdef USE_CLEARCOAT_NORMALMAP
#ifdef USE_TANGENT
mat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );
#else
mat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );
#endif
#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )
tbn2[0] *= faceDirection;
tbn2[1] *= faceDirection;
#endif
#endif
vec3 nonPerturbedNormal = normal;`,qU=`#ifdef USE_NORMALMAP_OBJECTSPACE
normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;
#ifdef FLIP_SIDED
normal = - normal;
#endif
#ifdef DOUBLE_SIDED
normal = normal * faceDirection;
#endif
normal = normalize( normalMatrix * normal );
#elif defined( USE_NORMALMAP_TANGENTSPACE )
vec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;
mapN.xy *= normalScale;
normal = normalize( tbn * mapN );
#elif defined( USE_BUMPMAP )
normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );
#endif`,JU=`#ifndef FLAT_SHADED
varying vec3 vNormal;
#ifdef USE_TANGENT
varying vec3 vTangent;
varying vec3 vBitangent;
#endif
#endif`,eO=`#ifndef FLAT_SHADED
varying vec3 vNormal;
#ifdef USE_TANGENT
varying vec3 vTangent;
varying vec3 vBitangent;
#endif
#endif`,tO=`#ifndef FLAT_SHADED
vNormal = normalize( transformedNormal );
#ifdef USE_TANGENT
vTangent = normalize( transformedTangent );
vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );
#endif
#endif`,nO=`#ifdef USE_NORMALMAP
uniform sampler2D normalMap;
uniform vec2 normalScale;
#endif
#ifdef USE_NORMALMAP_OBJECTSPACE
uniform mat3 normalMatrix;
#endif
#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) )
mat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {
vec3 q0 = dFdx( eye_pos.xyz );
vec3 q1 = dFdy( eye_pos.xyz );
vec2 st0 = dFdx( uv.st );
vec2 st1 = dFdy( uv.st );
vec3 N = surf_norm;
vec3 q1perp = cross( q1, N );
vec3 q0perp = cross( N, q0 );
vec3 T = q1perp * st0.x + q0perp * st1.x;
vec3 B = q1perp * st0.y + q0perp * st1.y;
float det = max( dot( T, T ), dot( B, B ) );
float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );
return mat3( T * scale, B * scale, N );
}
#endif`,rO=`#ifdef USE_CLEARCOAT
vec3 clearcoatNormal = nonPerturbedNormal;
#endif`,iO=`#ifdef USE_CLEARCOAT_NORMALMAP
vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;
clearcoatMapN.xy *= clearcoatNormalScale;
clearcoatNormal = normalize( tbn2 * clearcoatMapN );
#endif`,sO=`#ifdef USE_CLEARCOATMAP
uniform sampler2D clearcoatMap;
#endif
#ifdef USE_CLEARCOAT_NORMALMAP
uniform sampler2D clearcoatNormalMap;
uniform vec2 clearcoatNormalScale;
#endif
#ifdef USE_CLEARCOAT_ROUGHNESSMAP
uniform sampler2D clearcoatRoughnessMap;
#endif`,aO=`#ifdef USE_IRIDESCENCEMAP
uniform sampler2D iridescenceMap;
#endif
#ifdef USE_IRIDESCENCE_THICKNESSMAP
uniform sampler2D iridescenceThicknessMap;
#endif`,oO=`#ifdef OPAQUE
diffuseColor.a = 1.0;
#endif
#ifdef USE_TRANSMISSION
diffuseColor.a *= material.transmissionAlpha;
#endif
gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,lO=`vec3 packNormalToRGB( const in vec3 normal ) {
return normalize( normal ) * 0.5 + 0.5;
}
vec3 unpackRGBToNormal( const in vec3 rgb ) {
return 2.0 * rgb.xyz - 1.0;
}
const float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;const float ShiftRight8 = 1. / 256.;
const float Inv255 = 1. / 255.;
const vec4 PackFactors = vec4( 1.0, 256.0, 256.0 * 256.0, 256.0 * 256.0 * 256.0 );
const vec2 UnpackFactors2 = vec2( UnpackDownscale, 1.0 / PackFactors.g );
const vec3 UnpackFactors3 = vec3( UnpackDownscale / PackFactors.rg, 1.0 / PackFactors.b );
const vec4 UnpackFactors4 = vec4( UnpackDownscale / PackFactors.rgb, 1.0 / PackFactors.a );
vec4 packDepthToRGBA( const in float v ) {
if( v <= 0.0 )
return vec4( 0., 0., 0., 0. );
if( v >= 1.0 )
return vec4( 1., 1., 1., 1. );
float vuf;
float af = modf( v * PackFactors.a, vuf );
float bf = modf( vuf * ShiftRight8, vuf );
float gf = modf( vuf * ShiftRight8, vuf );
return vec4( vuf * Inv255, gf * PackUpscale, bf * PackUpscale, af );
}
vec3 packDepthToRGB( const in float v ) {
if( v <= 0.0 )
return vec3( 0., 0., 0. );
if( v >= 1.0 )
return vec3( 1., 1., 1. );
float vuf;
float bf = modf( v * PackFactors.b, vuf );
float gf = modf( vuf * ShiftRight8, vuf );
return vec3( vuf * Inv255, gf * PackUpscale, bf );
}
vec2 packDepthToRG( const in float v ) {
if( v <= 0.0 )
return vec2( 0., 0. );
if( v >= 1.0 )
return vec2( 1., 1. );
float vuf;
float gf = modf( v * 256., vuf );
return vec2( vuf * Inv255, gf );
}
float unpackRGBAToDepth( const in vec4 v ) {
return dot( v, UnpackFactors4 );
}
float unpackRGBToDepth( const in vec3 v ) {
return dot( v, UnpackFactors3 );
}
float unpackRGToDepth( const in vec2 v ) {
return v.r * UnpackFactors2.r + v.g * UnpackFactors2.g;
}
vec4 pack2HalfToRGBA( const in vec2 v ) {
vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );
return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );
}
vec2 unpackRGBATo2Half( const in vec4 v ) {
return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );
}
float viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {
return ( viewZ + near ) / ( near - far );
}
float orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) {
return depth * ( near - far ) - near;
}
float viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {
return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );
}
float perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) {
return ( near * far ) / ( ( far - near ) * depth - far );
}`,uO=`#ifdef PREMULTIPLIED_ALPHA
gl_FragColor.rgb *= gl_FragColor.a;
#endif`,cO=`vec4 mvPosition = vec4( transformed, 1.0 );
#ifdef USE_BATCHING
mvPosition = batchingMatrix * mvPosition;
#endif
#ifdef USE_INSTANCING
mvPosition = instanceMatrix * mvPosition;
#endif
mvPosition = modelViewMatrix * mvPosition;
gl_Position = projectionMatrix * mvPosition;`,hO=`#ifdef DITHERING
gl_FragColor.rgb = dithering( gl_FragColor.rgb );
#endif`,dO=`#ifdef DITHERING
vec3 dithering( vec3 color ) {
float grid_position = rand( gl_FragCoord.xy );
vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );
dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );
return color + dither_shift_RGB;
}
#endif`,fO=`float roughnessFactor = roughness;
#ifdef USE_ROUGHNESSMAP
vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );
roughnessFactor *= texelRoughness.g;
#endif`,AO=`#ifdef USE_ROUGHNESSMAP
uniform sampler2D roughnessMap;
#endif`,pO=`#if NUM_SPOT_LIGHT_COORDS > 0
varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
#endif
#if NUM_SPOT_LIGHT_MAPS > 0
uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];
#endif
#ifdef USE_SHADOWMAP
#if NUM_DIR_LIGHT_SHADOWS > 0
#if defined( SHADOWMAP_TYPE_PCF )
uniform sampler2DShadow directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];
#else
uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];
#endif
varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
struct DirectionalLightShadow {
float shadowIntensity;
float shadowBias;
float shadowNormalBias;
float shadowRadius;
vec2 shadowMapSize;
};
uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
#endif
#if NUM_SPOT_LIGHT_SHADOWS > 0
#if defined( SHADOWMAP_TYPE_PCF )
uniform sampler2DShadow spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];
#else
uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];
#endif
struct SpotLightShadow {
float shadowIntensity;
float shadowBias;
float shadowNormalBias;
float shadowRadius;
vec2 shadowMapSize;
};
uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];
#endif
#if NUM_POINT_LIGHT_SHADOWS > 0
#if defined( SHADOWMAP_TYPE_PCF )
uniform samplerCubeShadow pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];
#elif defined( SHADOWMAP_TYPE_BASIC )
uniform samplerCube pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];
#endif
varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
struct PointLightShadow {
float shadowIntensity;
float shadowBias;
float shadowNormalBias;
float shadowRadius;
vec2 shadowMapSize;
float shadowCameraNear;
float shadowCameraFar;
};
uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
#endif
#if defined( SHADOWMAP_TYPE_PCF )
float interleavedGradientNoise( vec2 position ) {
return fract( 52.9829189 * fract( dot( position, vec2( 0.06711056, 0.00583715 ) ) ) );
}
vec2 vogelDiskSample( int sampleIndex, int samplesCount, float phi ) {
const float goldenAngle = 2.399963229728653;
float r = sqrt( ( float( sampleIndex ) + 0.5 ) / float( samplesCount ) );
float theta = float( sampleIndex ) * goldenAngle + phi;
return vec2( cos( theta ), sin( theta ) ) * r;
}
#endif
#if defined( SHADOWMAP_TYPE_PCF )
float getShadow( sampler2DShadow shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {
float shadow = 1.0;
shadowCoord.xyz /= shadowCoord.w;
shadowCoord.z += shadowBias;
bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;
bool frustumTest = inFrustum && shadowCoord.z <= 1.0;
if ( frustumTest ) {
vec2 texelSize = vec2( 1.0 ) / shadowMapSize;
float radius = shadowRadius * texelSize.x;
float phi = interleavedGradientNoise( gl_FragCoord.xy ) * 6.28318530718;
shadow = (
texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 0, 5, phi ) * radius, shadowCoord.z ) ) +
texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 1, 5, phi ) * radius, shadowCoord.z ) ) +
texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 2, 5, phi ) * radius, shadowCoord.z ) ) +
texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 3, 5, phi ) * radius, shadowCoord.z ) ) +
texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 4, 5, phi ) * radius, shadowCoord.z ) )
) * 0.2;
}
return mix( 1.0, shadow, shadowIntensity );
}
#elif defined( SHADOWMAP_TYPE_VSM )
float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {
float shadow = 1.0;
shadowCoord.xyz /= shadowCoord.w;
shadowCoord.z += shadowBias;
bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;
bool frustumTest = inFrustum && shadowCoord.z <= 1.0;
if ( frustumTest ) {
vec2 distribution = texture2D( shadowMap, shadowCoord.xy ).rg;
float mean = distribution.x;
float variance = distribution.y * distribution.y;
#ifdef USE_REVERSED_DEPTH_BUFFER
float hard_shadow = step( mean, shadowCoord.z );
#else
float hard_shadow = step( shadowCoord.z, mean );
#endif
if ( hard_shadow == 1.0 ) {
shadow = 1.0;
} else {
variance = max( variance, 0.0000001 );
float d = shadowCoord.z - mean;
float p_max = variance / ( variance + d * d );
p_max = clamp( ( p_max - 0.3 ) / 0.65, 0.0, 1.0 );
shadow = max( hard_shadow, p_max );
}
}
return mix( 1.0, shadow, shadowIntensity );
}
#else
float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {
float shadow = 1.0;
shadowCoord.xyz /= shadowCoord.w;
shadowCoord.z += shadowBias;
bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;
bool frustumTest = inFrustum && shadowCoord.z <= 1.0;
if ( frustumTest ) {
float depth = texture2D( shadowMap, shadowCoord.xy ).r;
#ifdef USE_REVERSED_DEPTH_BUFFER
shadow = step( depth, shadowCoord.z );
#else
shadow = step( shadowCoord.z, depth );
#endif
}
return mix( 1.0, shadow, shadowIntensity );
}
#endif
#if NUM_POINT_LIGHT_SHADOWS > 0
#if defined( SHADOWMAP_TYPE_PCF )
float getPointShadow( samplerCubeShadow shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {
float shadow = 1.0;
vec3 lightToPosition = shadowCoord.xyz;
vec3 bd3D = normalize( lightToPosition );
vec3 absVec = abs( lightToPosition );
float viewSpaceZ = max( max( absVec.x, absVec.y ), absVec.z );
if ( viewSpaceZ - shadowCameraFar <= 0.0 && viewSpaceZ - shadowCameraNear >= 0.0 ) {
float dp = ( shadowCameraFar * ( viewSpaceZ - shadowCameraNear ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) );
dp += shadowBias;
float texelSize = shadowRadius / shadowMapSize.x;
vec3 absDir = abs( bd3D );
vec3 tangent = absDir.x > absDir.z ? vec3( 0.0, 1.0, 0.0 ) : vec3( 1.0, 0.0, 0.0 );
tangent = normalize( cross( bd3D, tangent ) );
vec3 bitangent = cross( bd3D, tangent );
float phi = interleavedGradientNoise( gl_FragCoord.xy ) * 6.28318530718;
shadow = (
texture( shadowMap, vec4( bd3D + ( tangent * vogelDiskSample( 0, 5, phi ).x + bitangent * vogelDiskSample( 0, 5, phi ).y ) * texelSize, dp ) ) +
texture( shadowMap, vec4( bd3D + ( tangent * vogelDiskSample( 1, 5, phi ).x + bitangent * vogelDiskSample( 1, 5, phi ).y ) * texelSize, dp ) ) +
texture( shadowMap, vec4( bd3D + ( tangent * vogelDiskSample( 2, 5, phi ).x + bitangent * vogelDiskSample( 2, 5, phi ).y ) * texelSize, dp ) ) +
texture( shadowMap, vec4( bd3D + ( tangent * vogelDiskSample( 3, 5, phi ).x + bitangent * vogelDiskSample( 3, 5, phi ).y ) * texelSize, dp ) ) +
texture( shadowMap, vec4( bd3D + ( tangent * vogelDiskSample( 4, 5, phi ).x + bitangent * vogelDiskSample( 4, 5, phi ).y ) * texelSize, dp ) )
) * 0.2;
}
return mix( 1.0, shadow, shadowIntensity );
}
#elif defined( SHADOWMAP_TYPE_BASIC )
float getPointShadow( samplerCube shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {
float shadow = 1.0;
vec3 lightToPosition = shadowCoord.xyz;
vec3 bd3D = normalize( lightToPosition );
vec3 absVec = abs( lightToPosition );
float viewSpaceZ = max( max( absVec.x, absVec.y ), absVec.z );
if ( viewSpaceZ - shadowCameraFar <= 0.0 && viewSpaceZ - shadowCameraNear >= 0.0 ) {
float dp = ( shadowCameraFar * ( viewSpaceZ - shadowCameraNear ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) );
dp += shadowBias;
float depth = textureCube( shadowMap, bd3D ).r;
#ifdef USE_REVERSED_DEPTH_BUFFER
shadow = step( depth, dp );
#else
shadow = step( dp, depth );
#endif
}
return mix( 1.0, shadow, shadowIntensity );
}
#endif
#endif
#endif`,gO=`#if NUM_SPOT_LIGHT_COORDS > 0
uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];
varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
#endif
#ifdef USE_SHADOWMAP
#if NUM_DIR_LIGHT_SHADOWS > 0
uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];
varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
struct DirectionalLightShadow {
float shadowIntensity;
float shadowBias;
float shadowNormalBias;
float shadowRadius;
vec2 shadowMapSize;
};
uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
#endif
#if NUM_SPOT_LIGHT_SHADOWS > 0
struct SpotLightShadow {
float shadowIntensity;
float shadowBias;
float shadowNormalBias;
float shadowRadius;
vec2 shadowMapSize;
};
uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];
#endif
#if NUM_POINT_LIGHT_SHADOWS > 0
uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];
varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
struct PointLightShadow {
float shadowIntensity;
float shadowBias;
float shadowNormalBias;
float shadowRadius;
vec2 shadowMapSize;
float shadowCameraNear;
float shadowCameraFar;
};
uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
#endif
#endif`,mO=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )
vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );
vec4 shadowWorldPosition;
#endif
#if defined( USE_SHADOWMAP )
#if NUM_DIR_LIGHT_SHADOWS > 0
#pragma unroll_loop_start
for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {
shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );
vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;
}
#pragma unroll_loop_end
#endif
#if NUM_POINT_LIGHT_SHADOWS > 0
#pragma unroll_loop_start
for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {
shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );
vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;
}
#pragma unroll_loop_end
#endif
#endif
#if NUM_SPOT_LIGHT_COORDS > 0
#pragma unroll_loop_start
for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {
shadowWorldPosition = worldPosition;
#if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;
#endif
vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;
}
#pragma unroll_loop_end
#endif`,vO=`float getShadowMask() {
float shadow = 1.0;
#ifdef USE_SHADOWMAP
#if NUM_DIR_LIGHT_SHADOWS > 0
DirectionalLightShadow directionalLight;
#pragma unroll_loop_start
for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {
directionalLight = directionalLightShadows[ i ];
shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowIntensity, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
}
#pragma unroll_loop_end
#endif
#if NUM_SPOT_LIGHT_SHADOWS > 0
SpotLightShadow spotLight;
#pragma unroll_loop_start
for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {
spotLight = spotLightShadows[ i ];
shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowIntensity, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;
}
#pragma unroll_loop_end
#endif
#if NUM_POINT_LIGHT_SHADOWS > 0 && ( defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_BASIC ) )
PointLightShadow pointLight;
#pragma unroll_loop_start
for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {
pointLight = pointLightShadows[ i ];
shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;
}
#pragma unroll_loop_end
#endif
#endif
return shadow;
}`,yO=`#ifdef USE_SKINNING
mat4 boneMatX = getBoneMatrix( skinIndex.x );
mat4 boneMatY = getBoneMatrix( skinIndex.y );
mat4 boneMatZ = getBoneMatrix( skinIndex.z );
mat4 boneMatW = getBoneMatrix( skinIndex.w );
#endif`,xO=`#ifdef USE_SKINNING
uniform mat4 bindMatrix;
uniform mat4 bindMatrixInverse;
uniform highp sampler2D boneTexture;
mat4 getBoneMatrix( const in float i ) {
int size = textureSize( boneTexture, 0 ).x;
int j = int( i ) * 4;
int x = j % size;
int y = j / size;
vec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 );
vec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 );
vec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 );
vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );
return mat4( v1, v2, v3, v4 );
}
#endif`,bO=`#ifdef USE_SKINNING
vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );
vec4 skinned = vec4( 0.0 );
skinned += boneMatX * skinVertex * skinWeight.x;
skinned += boneMatY * skinVertex * skinWeight.y;
skinned += boneMatZ * skinVertex * skinWeight.z;
skinned += boneMatW * skinVertex * skinWeight.w;
transformed = ( bindMatrixInverse * skinned ).xyz;
#endif`,_O=`#ifdef USE_SKINNING
mat4 skinMatrix = mat4( 0.0 );
skinMatrix += skinWeight.x * boneMatX;
skinMatrix += skinWeight.y * boneMatY;
skinMatrix += skinWeight.z * boneMatZ;
skinMatrix += skinWeight.w * boneMatW;
skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;
objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;
#ifdef USE_TANGENT
objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;
#endif
#endif`,wO=`float specularStrength;
#ifdef USE_SPECULARMAP
vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );
specularStrength = texelSpecular.r;
#else
specularStrength = 1.0;
#endif`,SO=`#ifdef USE_SPECULARMAP
uniform sampler2D specularMap;
#endif`,MO=`#if defined( TONE_MAPPING )
gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );
#endif`,EO=`#ifndef saturate
#define saturate( a ) clamp( a, 0.0, 1.0 )
#endif
uniform float toneMappingExposure;
vec3 LinearToneMapping( vec3 color ) {
return saturate( toneMappingExposure * color );
}
vec3 ReinhardToneMapping( vec3 color ) {
color *= toneMappingExposure;
return saturate( color / ( vec3( 1.0 ) + color ) );
}
vec3 CineonToneMapping( vec3 color ) {
color *= toneMappingExposure;
color = max( vec3( 0.0 ), color - 0.004 );
return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );
}
vec3 RRTAndODTFit( vec3 v ) {
vec3 a = v * ( v + 0.0245786 ) - 0.000090537;
vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;
return a / b;
}
vec3 ACESFilmicToneMapping( vec3 color ) {
const mat3 ACESInputMat = mat3(
vec3( 0.59719, 0.07600, 0.02840 ), vec3( 0.35458, 0.90834, 0.13383 ),
vec3( 0.04823, 0.01566, 0.83777 )
);
const mat3 ACESOutputMat = mat3(
vec3( 1.60475, -0.10208, -0.00327 ), vec3( -0.53108, 1.10813, -0.07276 ),
vec3( -0.07367, -0.00605, 1.07602 )
);
color *= toneMappingExposure / 0.6;
color = ACESInputMat * color;
color = RRTAndODTFit( color );
color = ACESOutputMat * color;
return saturate( color );
}
const mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3(
vec3( 1.6605, - 0.1246, - 0.0182 ),
vec3( - 0.5876, 1.1329, - 0.1006 ),
vec3( - 0.0728, - 0.0083, 1.1187 )
);
const mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3(
vec3( 0.6274, 0.0691, 0.0164 ),
vec3( 0.3293, 0.9195, 0.0880 ),
vec3( 0.0433, 0.0113, 0.8956 )
);
vec3 agxDefaultContrastApprox( vec3 x ) {
vec3 x2 = x * x;
vec3 x4 = x2 * x2;
return + 15.5 * x4 * x2
- 40.14 * x4 * x
+ 31.96 * x4
- 6.868 * x2 * x
+ 0.4298 * x2
+ 0.1191 * x
- 0.00232;
}
vec3 AgXToneMapping( vec3 color ) {
const mat3 AgXInsetMatrix = mat3(
vec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ),
vec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ),
vec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 )
);
const mat3 AgXOutsetMatrix = mat3(
vec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ),
vec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ),
vec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 )
);
const float AgxMinEv = - 12.47393; const float AgxMaxEv = 4.026069;
color *= toneMappingExposure;
color = LINEAR_SRGB_TO_LINEAR_REC2020 * color;
color = AgXInsetMatrix * color;
color = max( color, 1e-10 ); color = log2( color );
color = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv );
color = clamp( color, 0.0, 1.0 );
color = agxDefaultContrastApprox( color );
color = AgXOutsetMatrix * color;
color = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) );
color = LINEAR_REC2020_TO_LINEAR_SRGB * color;
color = clamp( color, 0.0, 1.0 );
return color;
}
vec3 NeutralToneMapping( vec3 color ) {
const float StartCompression = 0.8 - 0.04;
const float Desaturation = 0.15;
color *= toneMappingExposure;
float x = min( color.r, min( color.g, color.b ) );
float offset = x < 0.08 ? x - 6.25 * x * x : 0.04;
color -= offset;
float peak = max( color.r, max( color.g, color.b ) );
if ( peak < StartCompression ) return color;
float d = 1. - StartCompression;
float newPeak = 1. - d * d / ( peak + d - StartCompression );
color *= newPeak / peak;
float g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. );
return mix( color, vec3( newPeak ), g );
}
vec3 CustomToneMapping( vec3 color ) { return color; }`,CO=`#ifdef USE_TRANSMISSION
material.transmission = transmission;
material.transmissionAlpha = 1.0;
material.thickness = thickness;
material.attenuationDistance = attenuationDistance;
material.attenuationColor = attenuationColor;
#ifdef USE_TRANSMISSIONMAP
material.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;
#endif
#ifdef USE_THICKNESSMAP
material.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;
#endif
vec3 pos = vWorldPosition;
vec3 v = normalize( cameraPosition - pos );
vec3 n = inverseTransformDirection( normal, viewMatrix );
vec4 transmitted = getIBLVolumeRefraction(
n, v, material.roughness, material.diffuseContribution, material.specularColorBlended, material.specularF90,
pos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness,
material.attenuationColor, material.attenuationDistance );
material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );
totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );
#endif`,TO=`#ifdef USE_TRANSMISSION
uniform float transmission;
uniform float thickness;
uniform float attenuationDistance;
uniform vec3 attenuationColor;
#ifdef USE_TRANSMISSIONMAP
uniform sampler2D transmissionMap;
#endif
#ifdef USE_THICKNESSMAP
uniform sampler2D thicknessMap;
#endif
uniform vec2 transmissionSamplerSize;
uniform sampler2D transmissionSamplerMap;
uniform mat4 modelMatrix;
uniform mat4 projectionMatrix;
varying vec3 vWorldPosition;
float w0( float a ) {
return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );
}
float w1( float a ) {
return ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 );
}
float w2( float a ){
return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );
}
float w3( float a ) {
return ( 1.0 / 6.0 ) * ( a * a * a );
}
float g0( float a ) {
return w0( a ) + w1( a );
}
float g1( float a ) {
return w2( a ) + w3( a );
}
float h0( float a ) {
return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );
}
float h1( float a ) {
return 1.0 + w3( a ) / ( w2( a ) + w3( a ) );
}
vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) {
uv = uv * texelSize.zw + 0.5;
vec2 iuv = floor( uv );
vec2 fuv = fract( uv );
float g0x = g0( fuv.x );
float g1x = g1( fuv.x );
float h0x = h0( fuv.x );
float h1x = h1( fuv.x );
float h0y = h0( fuv.y );
float h1y = h1( fuv.y );
vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;
vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;
vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;
vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;
return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) +
g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );
}
vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {
vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );
vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );
vec2 fLodSizeInv = 1.0 / fLodSize;
vec2 cLodSizeInv = 1.0 / cLodSize;
vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) );
vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) );
return mix( fSample, cSample, fract( lod ) );
}
vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {
vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );
vec3 modelScale;
modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );
modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );
modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );
return normalize( refractionVector ) * thickness * modelScale;
}
float applyIorToRoughness( const in float roughness, const in float ior ) {
return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );
}
vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {
float lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );
return textureBicubic( transmissionSamplerMap, fragCoord.xy, lod );
}
vec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {
if ( isinf( attenuationDistance ) ) {
return vec3( 1.0 );
} else {
vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;
vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance ); return transmittance;
}
}
vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,
const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,
const in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness,
const in vec3 attenuationColor, const in float attenuationDistance ) {
vec4 transmittedLight;
vec3 transmittance;
#ifdef USE_DISPERSION
float halfSpread = ( ior - 1.0 ) * 0.025 * dispersion;
vec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread );
for ( int i = 0; i < 3; i ++ ) {
vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix );
vec3 refractedRayExit = position + transmissionRay;
vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );
vec2 refractionCoords = ndcPos.xy / ndcPos.w;
refractionCoords += 1.0;
refractionCoords /= 2.0;
vec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] );
transmittedLight[ i ] = transmissionSample[ i ];
transmittedLight.a += transmissionSample.a;
transmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ];
}
transmittedLight.a /= 3.0;
#else
vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );
vec3 refractedRayExit = position + transmissionRay;
vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );
vec2 refractionCoords = ndcPos.xy / ndcPos.w;
refractionCoords += 1.0;
refractionCoords /= 2.0;
transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );
transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance );
#endif
vec3 attenuatedColor = transmittance * transmittedLight.rgb;
vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );
float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;
return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );
}
#endif`,BO=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
varying vec2 vUv;
#endif
#ifdef USE_MAP
varying vec2 vMapUv;
#endif
#ifdef USE_ALPHAMAP
varying vec2 vAlphaMapUv;
#endif
#ifdef USE_LIGHTMAP
varying vec2 vLightMapUv;
#endif
#ifdef USE_AOMAP
varying vec2 vAoMapUv;
#endif
#ifdef USE_BUMPMAP
varying vec2 vBumpMapUv;
#endif
#ifdef USE_NORMALMAP
varying vec2 vNormalMapUv;
#endif
#ifdef USE_EMISSIVEMAP
varying vec2 vEmissiveMapUv;
#endif
#ifdef USE_METALNESSMAP
varying vec2 vMetalnessMapUv;
#endif
#ifdef USE_ROUGHNESSMAP
varying vec2 vRoughnessMapUv;
#endif
#ifdef USE_ANISOTROPYMAP
varying vec2 vAnisotropyMapUv;
#endif
#ifdef USE_CLEARCOATMAP
varying vec2 vClearcoatMapUv;
#endif
#ifdef USE_CLEARCOAT_NORMALMAP
varying vec2 vClearcoatNormalMapUv;
#endif
#ifdef USE_CLEARCOAT_ROUGHNESSMAP
varying vec2 vClearcoatRoughnessMapUv;
#endif
#ifdef USE_IRIDESCENCEMAP
varying vec2 vIridescenceMapUv;
#endif
#ifdef USE_IRIDESCENCE_THICKNESSMAP
varying vec2 vIridescenceThicknessMapUv;
#endif
#ifdef USE_SHEEN_COLORMAP
varying vec2 vSheenColorMapUv;
#endif
#ifdef USE_SHEEN_ROUGHNESSMAP
varying vec2 vSheenRoughnessMapUv;
#endif
#ifdef USE_SPECULARMAP
varying vec2 vSpecularMapUv;
#endif
#ifdef USE_SPECULAR_COLORMAP
varying vec2 vSpecularColorMapUv;
#endif
#ifdef USE_SPECULAR_INTENSITYMAP
varying vec2 vSpecularIntensityMapUv;
#endif
#ifdef USE_TRANSMISSIONMAP
uniform mat3 transmissionMapTransform;
varying vec2 vTransmissionMapUv;
#endif
#ifdef USE_THICKNESSMAP
uniform mat3 thicknessMapTransform;
varying vec2 vThicknessMapUv;
#endif`,RO=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
varying vec2 vUv;
#endif
#ifdef USE_MAP
uniform mat3 mapTransform;
varying vec2 vMapUv;
#endif
#ifdef USE_ALPHAMAP
uniform mat3 alphaMapTransform;
varying vec2 vAlphaMapUv;
#endif
#ifdef USE_LIGHTMAP
uniform mat3 lightMapTransform;
varying vec2 vLightMapUv;
#endif
#ifdef USE_AOMAP
uniform mat3 aoMapTransform;
varying vec2 vAoMapUv;
#endif
#ifdef USE_BUMPMAP
uniform mat3 bumpMapTransform;
varying vec2 vBumpMapUv;
#endif
#ifdef USE_NORMALMAP
uniform mat3 normalMapTransform;
varying vec2 vNormalMapUv;
#endif
#ifdef USE_DISPLACEMENTMAP
uniform mat3 displacementMapTransform;
varying vec2 vDisplacementMapUv;
#endif
#ifdef USE_EMISSIVEMAP
uniform mat3 emissiveMapTransform;
varying vec2 vEmissiveMapUv;
#endif
#ifdef USE_METALNESSMAP
uniform mat3 metalnessMapTransform;
varying vec2 vMetalnessMapUv;
#endif
#ifdef USE_ROUGHNESSMAP
uniform mat3 roughnessMapTransform;
varying vec2 vRoughnessMapUv;
#endif
#ifdef USE_ANISOTROPYMAP
uniform mat3 anisotropyMapTransform;
varying vec2 vAnisotropyMapUv;
#endif
#ifdef USE_CLEARCOATMAP
uniform mat3 clearcoatMapTransform;
varying vec2 vClearcoatMapUv;
#endif
#ifdef USE_CLEARCOAT_NORMALMAP
uniform mat3 clearcoatNormalMapTransform;
varying vec2 vClearcoatNormalMapUv;
#endif
#ifdef USE_CLEARCOAT_ROUGHNESSMAP
uniform mat3 clearcoatRoughnessMapTransform;
varying vec2 vClearcoatRoughnessMapUv;
#endif
#ifdef USE_SHEEN_COLORMAP
uniform mat3 sheenColorMapTransform;
varying vec2 vSheenColorMapUv;
#endif
#ifdef USE_SHEEN_ROUGHNESSMAP
uniform mat3 sheenRoughnessMapTransform;
varying vec2 vSheenRoughnessMapUv;
#endif
#ifdef USE_IRIDESCENCEMAP
uniform mat3 iridescenceMapTransform;
varying vec2 vIridescenceMapUv;
#endif
#ifdef USE_IRIDESCENCE_THICKNESSMAP
uniform mat3 iridescenceThicknessMapTransform;
varying vec2 vIridescenceThicknessMapUv;
#endif
#ifdef USE_SPECULARMAP
uniform mat3 specularMapTransform;
varying vec2 vSpecularMapUv;
#endif
#ifdef USE_SPECULAR_COLORMAP
uniform mat3 specularColorMapTransform;
varying vec2 vSpecularColorMapUv;
#endif
#ifdef USE_SPECULAR_INTENSITYMAP
uniform mat3 specularIntensityMapTransform;
varying vec2 vSpecularIntensityMapUv;
#endif
#ifdef USE_TRANSMISSIONMAP
uniform mat3 transmissionMapTransform;
varying vec2 vTransmissionMapUv;
#endif
#ifdef USE_THICKNESSMAP
uniform mat3 thicknessMapTransform;
varying vec2 vThicknessMapUv;
#endif`,IO=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
vUv = vec3( uv, 1 ).xy;
#endif
#ifdef USE_MAP
vMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy;
#endif
#ifdef USE_ALPHAMAP
vAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_LIGHTMAP
vLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_AOMAP
vAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_BUMPMAP
vBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_NORMALMAP
vNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_DISPLACEMENTMAP
vDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_EMISSIVEMAP
vEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_METALNESSMAP
vMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_ROUGHNESSMAP
vRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_ANISOTROPYMAP
vAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_CLEARCOATMAP
vClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_CLEARCOAT_NORMALMAP
vClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_CLEARCOAT_ROUGHNESSMAP
vClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_IRIDESCENCEMAP
vIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_IRIDESCENCE_THICKNESSMAP
vIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_SHEEN_COLORMAP
vSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_SHEEN_ROUGHNESSMAP
vSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_SPECULARMAP
vSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_SPECULAR_COLORMAP
vSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_SPECULAR_INTENSITYMAP
vSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_TRANSMISSIONMAP
vTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_THICKNESSMAP
vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;
#endif`,NO=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0
vec4 worldPosition = vec4( transformed, 1.0 );
#ifdef USE_BATCHING
worldPosition = batchingMatrix * worldPosition;
#endif
#ifdef USE_INSTANCING
worldPosition = instanceMatrix * worldPosition;
#endif
worldPosition = modelMatrix * worldPosition;
#endif`;const Vo={alphahash_fragment:PL,alphahash_pars_fragment:LL,alphamap_fragment:UL,alphamap_pars_fragment:OL,alphatest_fragment:DL,alphatest_pars_fragment:kL,aomap_fragment:VL,aomap_pars_fragment:zL,batching_pars_vertex:GL,batching_vertex:HL,begin_vertex:QL,beginnormal_vertex:WL,bsdfs:ZL,iridescence_fragment:KL,bumpmap_pars_fragment:$L,clipping_planes_fragment:XL,clipping_planes_pars_fragment:jL,clipping_planes_pars_vertex:YL,clipping_planes_vertex:qL,color_fragment:JL,color_pars_fragment:eU,color_pars_vertex:tU,color_vertex:nU,common:rU,cube_uv_reflection_fragment:iU,defaultnormal_vertex:sU,displacementmap_pars_vertex:aU,displacementmap_vertex:oU,emissivemap_fragment:lU,emissivemap_pars_fragment:uU,colorspace_fragment:cU,colorspace_pars_fragment:hU,envmap_fragment:dU,envmap_common_pars_fragment:fU,envmap_pars_fragment:AU,envmap_pars_vertex:pU,envmap_physical_pars_fragment:EU,envmap_vertex:gU,fog_vertex:mU,fog_pars_vertex:vU,fog_fragment:yU,fog_pars_fragment:xU,gradientmap_pars_fragment:bU,lightmap_pars_fragment:_U,lights_lambert_fragment:wU,lights_lambert_pars_fragment:SU,lights_pars_begin:MU,lights_toon_fragment:CU,lights_toon_pars_fragment:TU,lights_phong_fragment:BU,lights_phong_pars_fragment:RU,lights_physical_fragment:IU,lights_physical_pars_fragment:NU,lights_fragment_begin:FU,lights_fragment_maps:PU,lights_fragment_end:LU,logdepthbuf_fragment:UU,logdepthbuf_pars_fragment:OU,logdepthbuf_pars_vertex:DU,logdepthbuf_vertex:kU,map_fragment:VU,map_pars_fragment:zU,map_particle_fragment:GU,map_particle_pars_fragment:HU,metalnessmap_fragment:QU,metalnessmap_pars_fragment:WU,morphinstance_vertex:ZU,morphcolor_vertex:KU,morphnormal_vertex:$U,morphtarget_pars_vertex:XU,morphtarget_vertex:jU,normal_fragment_begin:YU,normal_fragment_maps:qU,normal_pars_fragment:JU,normal_pars_vertex:eO,normal_vertex:tO,normalmap_pars_fragment:nO,clearcoat_normal_fragment_begin:rO,clearcoat_normal_fragment_maps:iO,clearcoat_pars_fragment:sO,iridescence_pars_fragment:aO,opaque_fragment:oO,packing:lO,premultiplied_alpha_fragment:uO,project_vertex:cO,dithering_fragment:hO,dithering_pars_fragment:dO,roughnessmap_fragment:fO,roughnessmap_pars_fragment:AO,shadowmap_pars_fragment:pO,shadowmap_pars_vertex:gO,shadowmap_vertex:mO,shadowmask_pars_fragment:vO,skinbase_vertex:yO,skinning_pars_vertex:xO,skinning_vertex:bO,skinnormal_vertex:_O,specularmap_fragment:wO,specularmap_pars_fragment:SO,tonemapping_fragment:MO,tonemapping_pars_fragment:EO,transmission_fragment:CO,transmission_pars_fragment:TO,uv_pars_fragment:BO,uv_pars_vertex:RO,uv_vertex:IO,worldpos_vertex:NO,background_vert:`varying vec2 vUv;
uniform mat3 uvTransform;
void main() {
vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
gl_Position = vec4( position.xy, 1.0, 1.0 );
}`,background_frag:`uniform sampler2D t2D;
uniform float backgroundIntensity;
varying vec2 vUv;
void main() {
vec4 texColor = texture2D( t2D, vUv );
#ifdef DECODE_VIDEO_TEXTURE
texColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w );
#endif
texColor.rgb *= backgroundIntensity;
gl_FragColor = texColor;
#include <tonemapping_fragment>
#include <colorspace_fragment>
}`,backgroundCube_vert:`varying vec3 vWorldDirection;
#include <common>
void main() {
vWorldDirection = transformDirection( position, modelMatrix );
#include <begin_vertex>
#include <project_vertex>
gl_Position.z = gl_Position.w;
}`,backgroundCube_frag:`#ifdef ENVMAP_TYPE_CUBE
uniform samplerCube envMap;
#elif defined( ENVMAP_TYPE_CUBE_UV )
uniform sampler2D envMap;
#endif
uniform float flipEnvMap;
uniform float backgroundBlurriness;
uniform float backgroundIntensity;
uniform mat3 backgroundRotation;
varying vec3 vWorldDirection;
#include <cube_uv_reflection_fragment>
void main() {
#ifdef ENVMAP_TYPE_CUBE
vec4 texColor = textureCube( envMap, backgroundRotation * vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) );
#elif defined( ENVMAP_TYPE_CUBE_UV )
vec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness );
#else
vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );
#endif
texColor.rgb *= backgroundIntensity;
gl_FragColor = texColor;
#include <tonemapping_fragment>
#include <colorspace_fragment>
}`,cube_vert:`varying vec3 vWorldDirection;
#include <common>
void main() {
vWorldDirection = transformDirection( position, modelMatrix );
#include <begin_vertex>
#include <project_vertex>
gl_Position.z = gl_Position.w;
}`,cube_frag:`uniform samplerCube tCube;
uniform float tFlip;
uniform float opacity;
varying vec3 vWorldDirection;
void main() {
vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );
gl_FragColor = texColor;
gl_FragColor.a *= opacity;
#include <tonemapping_fragment>
#include <colorspace_fragment>
}`,depth_vert:`#include <common>
#include <batching_pars_vertex>
#include <uv_pars_vertex>
#include <displacementmap_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
varying vec2 vHighPrecisionZW;
void main() {
#include <uv_vertex>
#include <batching_vertex>
#include <skinbase_vertex>
#include <morphinstance_vertex>
#ifdef USE_DISPLACEMENTMAP
#include <beginnormal_vertex>
#include <morphnormal_vertex>
#include <skinnormal_vertex>
#endif
#include <begin_vertex>
#include <morphtarget_vertex>
#include <skinning_vertex>
#include <displacementmap_vertex>
#include <project_vertex>
#include <logdepthbuf_vertex>
#include <clipping_planes_vertex>
vHighPrecisionZW = gl_Position.zw;
}`,depth_frag:`#if DEPTH_PACKING == 3200
uniform float opacity;
#endif
#include <common>
#include <packing>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
varying vec2 vHighPrecisionZW;
void main() {
vec4 diffuseColor = vec4( 1.0 );
#include <clipping_planes_fragment>
#if DEPTH_PACKING == 3200
diffuseColor.a = opacity;
#endif
#include <map_fragment>
#include <alphamap_fragment>
#include <alphatest_fragment>
#include <alphahash_fragment>
#include <logdepthbuf_fragment>
#ifdef USE_REVERSED_DEPTH_BUFFER
float fragCoordZ = vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ];
#else
float fragCoordZ = 0.5 * vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ] + 0.5;
#endif
#if DEPTH_PACKING == 3200
gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );
#elif DEPTH_PACKING == 3201
gl_FragColor = packDepthToRGBA( fragCoordZ );
#elif DEPTH_PACKING == 3202
gl_FragColor = vec4( packDepthToRGB( fragCoordZ ), 1.0 );
#elif DEPTH_PACKING == 3203
gl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 );
#endif
}`,distance_vert:`#define DISTANCE
varying vec3 vWorldPosition;
#include <common>
#include <batching_pars_vertex>
#include <uv_pars_vertex>
#include <displacementmap_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
#include <uv_vertex>
#include <batching_vertex>
#include <skinbase_vertex>
#include <morphinstance_vertex>
#ifdef USE_DISPLACEMENTMAP
#include <beginnormal_vertex>
#include <morphnormal_vertex>
#include <skinnormal_vertex>
#endif
#include <begin_vertex>
#include <morphtarget_vertex>
#include <skinning_vertex>
#include <displacementmap_vertex>
#include <project_vertex>
#include <worldpos_vertex>
#include <clipping_planes_vertex>
vWorldPosition = worldPosition.xyz;
}`,distance_frag:`#define DISTANCE
uniform vec3 referencePosition;
uniform float nearDistance;
uniform float farDistance;
varying vec3 vWorldPosition;
#include <common>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <clipping_planes_pars_fragment>
void main () {
vec4 diffuseColor = vec4( 1.0 );
#include <clipping_planes_fragment>
#include <map_fragment>
#include <alphamap_fragment>
#include <alphatest_fragment>
#include <alphahash_fragment>
float dist = length( vWorldPosition - referencePosition );
dist = ( dist - nearDistance ) / ( farDistance - nearDistance );
dist = saturate( dist );
gl_FragColor = vec4( dist, 0.0, 0.0, 1.0 );
}`,equirect_vert:`varying vec3 vWorldDirection;
#include <common>
void main() {
vWorldDirection = transformDirection( position, modelMatrix );
#include <begin_vertex>
#include <project_vertex>
}`,equirect_frag:`uniform sampler2D tEquirect;
varying vec3 vWorldDirection;
#include <common>
void main() {
vec3 direction = normalize( vWorldDirection );
vec2 sampleUV = equirectUv( direction );
gl_FragColor = texture2D( tEquirect, sampleUV );
#include <tonemapping_fragment>
#include <colorspace_fragment>
}`,linedashed_vert:`uniform float scale;
attribute float lineDistance;
varying float vLineDistance;
#include <common>
#include <uv_pars_vertex>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <morphtarget_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
vLineDistance = scale * lineDistance;
#include <uv_vertex>
#include <color_vertex>
#include <morphinstance_vertex>
#include <morphcolor_vertex>
#include <begin_vertex>
#include <morphtarget_vertex>
#include <project_vertex>
#include <logdepthbuf_vertex>
#include <clipping_planes_vertex>
#include <fog_vertex>
}`,linedashed_frag:`uniform vec3 diffuse;
uniform float opacity;
uniform float dashSize;
uniform float totalSize;
varying float vLineDistance;
#include <common>
#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <fog_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
vec4 diffuseColor = vec4( diffuse, opacity );
#include <clipping_planes_fragment>
if ( mod( vLineDistance, totalSize ) > dashSize ) {
discard;
}
vec3 outgoingLight = vec3( 0.0 );
#include <logdepthbuf_fragment>
#include <map_fragment>
#include <color_fragment>
outgoingLight = diffuseColor.rgb;
#include <opaque_fragment>
#include <tonemapping_fragment>
#include <colorspace_fragment>
#include <fog_fragment>
#include <premultiplied_alpha_fragment>
}`,meshbasic_vert:`#include <common>
#include <batching_pars_vertex>
#include <uv_pars_vertex>
#include <envmap_pars_vertex>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
#include <uv_vertex>
#include <color_vertex>
#include <morphinstance_vertex>
#include <morphcolor_vertex>
#include <batching_vertex>
#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )
#include <beginnormal_vertex>
#include <morphnormal_vertex>
#include <skinbase_vertex>
#include <skinnormal_vertex>
#include <defaultnormal_vertex>
#endif
#include <begin_vertex>
#include <morphtarget_vertex>
#include <skinning_vertex>
#include <project_vertex>
#include <logdepthbuf_vertex>
#include <clipping_planes_vertex>
#include <worldpos_vertex>
#include <envmap_vertex>
#include <fog_vertex>
}`,meshbasic_frag:`uniform vec3 diffuse;
uniform float opacity;
#ifndef FLAT_SHADED
varying vec3 vNormal;
#endif
#include <common>
#include <dithering_pars_fragment>
#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <aomap_pars_fragment>
#include <lightmap_pars_fragment>
#include <envmap_common_pars_fragment>
#include <envmap_pars_fragment>
#include <fog_pars_fragment>
#include <specularmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
vec4 diffuseColor = vec4( diffuse, opacity );
#include <clipping_planes_fragment>
#include <logdepthbuf_fragment>
#include <map_fragment>
#include <color_fragment>
#include <alphamap_fragment>
#include <alphatest_fragment>
#include <alphahash_fragment>
#include <specularmap_fragment>
ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
#ifdef USE_LIGHTMAP
vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;
#else
reflectedLight.indirectDiffuse += vec3( 1.0 );
#endif
#include <aomap_fragment>
reflectedLight.indirectDiffuse *= diffuseColor.rgb;
vec3 outgoingLight = reflectedLight.indirectDiffuse;
#include <envmap_fragment>
#include <opaque_fragment>
#include <tonemapping_fragment>
#include <colorspace_fragment>
#include <fog_fragment>
#include <premultiplied_alpha_fragment>
#include <dithering_fragment>
}`,meshlambert_vert:`#define LAMBERT
varying vec3 vViewPosition;
#include <common>
#include <batching_pars_vertex>
#include <uv_pars_vertex>
#include <displacementmap_pars_vertex>
#include <envmap_pars_vertex>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <normal_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <shadowmap_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
#include <uv_vertex>
#include <color_vertex>
#include <morphinstance_vertex>
#include <morphcolor_vertex>
#include <batching_vertex>
#include <beginnormal_vertex>
#include <morphnormal_vertex>
#include <skinbase_vertex>
#include <skinnormal_vertex>
#include <defaultnormal_vertex>
#include <normal_vertex>
#include <begin_vertex>
#include <morphtarget_vertex>
#include <skinning_vertex>
#include <displacementmap_vertex>
#include <project_vertex>
#include <logdepthbuf_vertex>
#include <clipping_planes_vertex>
vViewPosition = - mvPosition.xyz;
#include <worldpos_vertex>
#include <envmap_vertex>
#include <shadowmap_vertex>
#include <fog_vertex>
}`,meshlambert_frag:`#define LAMBERT
uniform vec3 diffuse;
uniform vec3 emissive;
uniform float opacity;
#include <common>
#include <dithering_pars_fragment>
#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <aomap_pars_fragment>
#include <lightmap_pars_fragment>
#include <emissivemap_pars_fragment>
#include <envmap_common_pars_fragment>
#include <envmap_pars_fragment>
#include <fog_pars_fragment>
#include <bsdfs>
#include <lights_pars_begin>
#include <normal_pars_fragment>
#include <lights_lambert_pars_fragment>
#include <shadowmap_pars_fragment>
#include <bumpmap_pars_fragment>
#include <normalmap_pars_fragment>
#include <specularmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
vec4 diffuseColor = vec4( diffuse, opacity );
#include <clipping_planes_fragment>
ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
vec3 totalEmissiveRadiance = emissive;
#include <logdepthbuf_fragment>
#include <map_fragment>
#include <color_fragment>
#include <alphamap_fragment>
#include <alphatest_fragment>
#include <alphahash_fragment>
#include <specularmap_fragment>
#include <normal_fragment_begin>
#include <normal_fragment_maps>
#include <emissivemap_fragment>
#include <lights_lambert_fragment>
#include <lights_fragment_begin>
#include <lights_fragment_maps>
#include <lights_fragment_end>
#include <aomap_fragment>
vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
#include <envmap_fragment>
#include <opaque_fragment>
#include <tonemapping_fragment>
#include <colorspace_fragment>
#include <fog_fragment>
#include <premultiplied_alpha_fragment>
#include <dithering_fragment>
}`,meshmatcap_vert:`#define MATCAP
varying vec3 vViewPosition;
#include <common>
#include <batching_pars_vertex>
#include <uv_pars_vertex>
#include <color_pars_vertex>
#include <displacementmap_pars_vertex>
#include <fog_pars_vertex>
#include <normal_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
#include <uv_vertex>
#include <color_vertex>
#include <morphinstance_vertex>
#include <morphcolor_vertex>
#include <batching_vertex>
#include <beginnormal_vertex>
#include <morphnormal_vertex>
#include <skinbase_vertex>
#include <skinnormal_vertex>
#include <defaultnormal_vertex>
#include <normal_vertex>
#include <begin_vertex>
#include <morphtarget_vertex>
#include <skinning_vertex>
#include <displacementmap_vertex>
#include <project_vertex>
#include <logdepthbuf_vertex>
#include <clipping_planes_vertex>
#include <fog_vertex>
vViewPosition = - mvPosition.xyz;
}`,meshmatcap_frag:`#define MATCAP
uniform vec3 diffuse;
uniform float opacity;
uniform sampler2D matcap;
varying vec3 vViewPosition;
#include <common>
#include <dithering_pars_fragment>
#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <fog_pars_fragment>
#include <normal_pars_fragment>
#include <bumpmap_pars_fragment>
#include <normalmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
vec4 diffuseColor = vec4( diffuse, opacity );
#include <clipping_planes_fragment>
#include <logdepthbuf_fragment>
#include <map_fragment>
#include <color_fragment>
#include <alphamap_fragment>
#include <alphatest_fragment>
#include <alphahash_fragment>
#include <normal_fragment_begin>
#include <normal_fragment_maps>
vec3 viewDir = normalize( vViewPosition );
vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );
vec3 y = cross( viewDir, x );
vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;
#ifdef USE_MATCAP
vec4 matcapColor = texture2D( matcap, uv );
#else
vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );
#endif
vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;
#include <opaque_fragment>
#include <tonemapping_fragment>
#include <colorspace_fragment>
#include <fog_fragment>
#include <premultiplied_alpha_fragment>
#include <dithering_fragment>
}`,meshnormal_vert:`#define NORMAL
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
varying vec3 vViewPosition;
#endif
#include <common>
#include <batching_pars_vertex>
#include <uv_pars_vertex>
#include <displacementmap_pars_vertex>
#include <normal_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
#include <uv_vertex>
#include <batching_vertex>
#include <beginnormal_vertex>
#include <morphinstance_vertex>
#include <morphnormal_vertex>
#include <skinbase_vertex>
#include <skinnormal_vertex>
#include <defaultnormal_vertex>
#include <normal_vertex>
#include <begin_vertex>
#include <morphtarget_vertex>
#include <skinning_vertex>
#include <displacementmap_vertex>
#include <project_vertex>
#include <logdepthbuf_vertex>
#include <clipping_planes_vertex>
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
vViewPosition = - mvPosition.xyz;
#endif
}`,meshnormal_frag:`#define NORMAL
uniform float opacity;
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
varying vec3 vViewPosition;
#endif
#include <uv_pars_fragment>
#include <normal_pars_fragment>
#include <bumpmap_pars_fragment>
#include <normalmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
vec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity );
#include <clipping_planes_fragment>
#include <logdepthbuf_fragment>
#include <normal_fragment_begin>
#include <normal_fragment_maps>
gl_FragColor = vec4( normalize( normal ) * 0.5 + 0.5, diffuseColor.a );
#ifdef OPAQUE
gl_FragColor.a = 1.0;
#endif
}`,meshphong_vert:`#define PHONG
varying vec3 vViewPosition;
#include <common>
#include <batching_pars_vertex>
#include <uv_pars_vertex>
#include <displacementmap_pars_vertex>
#include <envmap_pars_vertex>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <normal_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <shadowmap_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
#include <uv_vertex>
#include <color_vertex>
#include <morphcolor_vertex>
#include <batching_vertex>
#include <beginnormal_vertex>
#include <morphinstance_vertex>
#include <morphnormal_vertex>
#include <skinbase_vertex>
#include <skinnormal_vertex>
#include <defaultnormal_vertex>
#include <normal_vertex>
#include <begin_vertex>
#include <morphtarget_vertex>
#include <skinning_vertex>
#include <displacementmap_vertex>
#include <project_vertex>
#include <logdepthbuf_vertex>
#include <clipping_planes_vertex>
vViewPosition = - mvPosition.xyz;
#include <worldpos_vertex>
#include <envmap_vertex>
#include <shadowmap_vertex>
#include <fog_vertex>
}`,meshphong_frag:`#define PHONG
uniform vec3 diffuse;
uniform vec3 emissive;
uniform vec3 specular;
uniform float shininess;
uniform float opacity;
#include <common>
#include <dithering_pars_fragment>
#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <aomap_pars_fragment>
#include <lightmap_pars_fragment>
#include <emissivemap_pars_fragment>
#include <envmap_common_pars_fragment>
#include <envmap_pars_fragment>
#include <fog_pars_fragment>
#include <bsdfs>
#include <lights_pars_begin>
#include <normal_pars_fragment>
#include <lights_phong_pars_fragment>
#include <shadowmap_pars_fragment>
#include <bumpmap_pars_fragment>
#include <normalmap_pars_fragment>
#include <specularmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
vec4 diffuseColor = vec4( diffuse, opacity );
#include <clipping_planes_fragment>
ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
vec3 totalEmissiveRadiance = emissive;
#include <logdepthbuf_fragment>
#include <map_fragment>
#include <color_fragment>
#include <alphamap_fragment>
#include <alphatest_fragment>
#include <alphahash_fragment>
#include <specularmap_fragment>
#include <normal_fragment_begin>
#include <normal_fragment_maps>
#include <emissivemap_fragment>
#include <lights_phong_fragment>
#include <lights_fragment_begin>
#include <lights_fragment_maps>
#include <lights_fragment_end>
#include <aomap_fragment>
vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;
#include <envmap_fragment>
#include <opaque_fragment>
#include <tonemapping_fragment>
#include <colorspace_fragment>
#include <fog_fragment>
#include <premultiplied_alpha_fragment>
#include <dithering_fragment>
}`,meshphysical_vert:`#define STANDARD
varying vec3 vViewPosition;
#ifdef USE_TRANSMISSION
varying vec3 vWorldPosition;
#endif
#include <common>
#include <batching_pars_vertex>
#include <uv_pars_vertex>
#include <displacementmap_pars_vertex>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <normal_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <shadowmap_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
#include <uv_vertex>
#include <color_vertex>
#include <morphinstance_vertex>
#include <morphcolor_vertex>
#include <batching_vertex>
#include <beginnormal_vertex>
#include <morphnormal_vertex>
#include <skinbase_vertex>
#include <skinnormal_vertex>
#include <defaultnormal_vertex>
#include <normal_vertex>
#include <begin_vertex>
#include <morphtarget_vertex>
#include <skinning_vertex>
#include <displacementmap_vertex>
#include <project_vertex>
#include <logdepthbuf_vertex>
#include <clipping_planes_vertex>
vViewPosition = - mvPosition.xyz;
#include <worldpos_vertex>
#include <shadowmap_vertex>
#include <fog_vertex>
#ifdef USE_TRANSMISSION
vWorldPosition = worldPosition.xyz;
#endif
}`,meshphysical_frag:`#define STANDARD
#ifdef PHYSICAL
#define IOR
#define USE_SPECULAR
#endif
uniform vec3 diffuse;
uniform vec3 emissive;
uniform float roughness;
uniform float metalness;
uniform float opacity;
#ifdef IOR
uniform float ior;
#endif
#ifdef USE_SPECULAR
uniform float specularIntensity;
uniform vec3 specularColor;
#ifdef USE_SPECULAR_COLORMAP
uniform sampler2D specularColorMap;
#endif
#ifdef USE_SPECULAR_INTENSITYMAP
uniform sampler2D specularIntensityMap;
#endif
#endif
#ifdef USE_CLEARCOAT
uniform float clearcoat;
uniform float clearcoatRoughness;
#endif
#ifdef USE_DISPERSION
uniform float dispersion;
#endif
#ifdef USE_IRIDESCENCE
uniform float iridescence;
uniform float iridescenceIOR;
uniform float iridescenceThicknessMinimum;
uniform float iridescenceThicknessMaximum;
#endif
#ifdef USE_SHEEN
uniform vec3 sheenColor;
uniform float sheenRoughness;
#ifdef USE_SHEEN_COLORMAP
uniform sampler2D sheenColorMap;
#endif
#ifdef USE_SHEEN_ROUGHNESSMAP
uniform sampler2D sheenRoughnessMap;
#endif
#endif
#ifdef USE_ANISOTROPY
uniform vec2 anisotropyVector;
#ifdef USE_ANISOTROPYMAP
uniform sampler2D anisotropyMap;
#endif
#endif
varying vec3 vViewPosition;
#include <common>
#include <dithering_pars_fragment>
#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <aomap_pars_fragment>
#include <lightmap_pars_fragment>
#include <emissivemap_pars_fragment>
#include <iridescence_fragment>
#include <cube_uv_reflection_fragment>
#include <envmap_common_pars_fragment>
#include <envmap_physical_pars_fragment>
#include <fog_pars_fragment>
#include <lights_pars_begin>
#include <normal_pars_fragment>
#include <lights_physical_pars_fragment>
#include <transmission_pars_fragment>
#include <shadowmap_pars_fragment>
#include <bumpmap_pars_fragment>
#include <normalmap_pars_fragment>
#include <clearcoat_pars_fragment>
#include <iridescence_pars_fragment>
#include <roughnessmap_pars_fragment>
#include <metalnessmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
vec4 diffuseColor = vec4( diffuse, opacity );
#include <clipping_planes_fragment>
ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
vec3 totalEmissiveRadiance = emissive;
#include <logdepthbuf_fragment>
#include <map_fragment>
#include <color_fragment>
#include <alphamap_fragment>
#include <alphatest_fragment>
#include <alphahash_fragment>
#include <roughnessmap_fragment>
#include <metalnessmap_fragment>
#include <normal_fragment_begin>
#include <normal_fragment_maps>
#include <clearcoat_normal_fragment_begin>
#include <clearcoat_normal_fragment_maps>
#include <emissivemap_fragment>
#include <lights_physical_fragment>
#include <lights_fragment_begin>
#include <lights_fragment_maps>
#include <lights_fragment_end>
#include <aomap_fragment>
vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;
vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;
#include <transmission_fragment>
vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;
#ifdef USE_SHEEN
outgoingLight = outgoingLight + sheenSpecularDirect + sheenSpecularIndirect;
#endif
#ifdef USE_CLEARCOAT
float dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) );
vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );
outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat;
#endif
#include <opaque_fragment>
#include <tonemapping_fragment>
#include <colorspace_fragment>
#include <fog_fragment>
#include <premultiplied_alpha_fragment>
#include <dithering_fragment>
}`,meshtoon_vert:`#define TOON
varying vec3 vViewPosition;
#include <common>
#include <batching_pars_vertex>
#include <uv_pars_vertex>
#include <displacementmap_pars_vertex>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <normal_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <shadowmap_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
#include <uv_vertex>
#include <color_vertex>
#include <morphinstance_vertex>
#include <morphcolor_vertex>
#include <batching_vertex>
#include <beginnormal_vertex>
#include <morphnormal_vertex>
#include <skinbase_vertex>
#include <skinnormal_vertex>
#include <defaultnormal_vertex>
#include <normal_vertex>
#include <begin_vertex>
#include <morphtarget_vertex>
#include <skinning_vertex>
#include <displacementmap_vertex>
#include <project_vertex>
#include <logdepthbuf_vertex>
#include <clipping_planes_vertex>
vViewPosition = - mvPosition.xyz;
#include <worldpos_vertex>
#include <shadowmap_vertex>
#include <fog_vertex>
}`,meshtoon_frag:`#define TOON
uniform vec3 diffuse;
uniform vec3 emissive;
uniform float opacity;
#include <common>
#include <dithering_pars_fragment>
#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <aomap_pars_fragment>
#include <lightmap_pars_fragment>
#include <emissivemap_pars_fragment>
#include <gradientmap_pars_fragment>
#include <fog_pars_fragment>
#include <bsdfs>
#include <lights_pars_begin>
#include <normal_pars_fragment>
#include <lights_toon_pars_fragment>
#include <shadowmap_pars_fragment>
#include <bumpmap_pars_fragment>
#include <normalmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
vec4 diffuseColor = vec4( diffuse, opacity );
#include <clipping_planes_fragment>
ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
vec3 totalEmissiveRadiance = emissive;
#include <logdepthbuf_fragment>
#include <map_fragment>
#include <color_fragment>
#include <alphamap_fragment>
#include <alphatest_fragment>
#include <alphahash_fragment>
#include <normal_fragment_begin>
#include <normal_fragment_maps>
#include <emissivemap_fragment>
#include <lights_toon_fragment>
#include <lights_fragment_begin>
#include <lights_fragment_maps>
#include <lights_fragment_end>
#include <aomap_fragment>
vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
#include <opaque_fragment>
#include <tonemapping_fragment>
#include <colorspace_fragment>
#include <fog_fragment>
#include <premultiplied_alpha_fragment>
#include <dithering_fragment>
}`,points_vert:`uniform float size;
uniform float scale;
#include <common>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <morphtarget_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
#ifdef USE_POINTS_UV
varying vec2 vUv;
uniform mat3 uvTransform;
#endif
void main() {
#ifdef USE_POINTS_UV
vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
#endif
#include <color_vertex>
#include <morphinstance_vertex>
#include <morphcolor_vertex>
#include <begin_vertex>
#include <morphtarget_vertex>
#include <project_vertex>
gl_PointSize = size;
#ifdef USE_SIZEATTENUATION
bool isPerspective = isPerspectiveMatrix( projectionMatrix );
if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );
#endif
#include <logdepthbuf_vertex>
#include <clipping_planes_vertex>
#include <worldpos_vertex>
#include <fog_vertex>
}`,points_frag:`uniform vec3 diffuse;
uniform float opacity;
#include <common>
#include <color_pars_fragment>
#include <map_particle_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <fog_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
vec4 diffuseColor = vec4( diffuse, opacity );
#include <clipping_planes_fragment>
vec3 outgoingLight = vec3( 0.0 );
#include <logdepthbuf_fragment>
#include <map_particle_fragment>
#include <color_fragment>
#include <alphatest_fragment>
#include <alphahash_fragment>
outgoingLight = diffuseColor.rgb;
#include <opaque_fragment>
#include <tonemapping_fragment>
#include <colorspace_fragment>
#include <fog_fragment>
#include <premultiplied_alpha_fragment>
}`,shadow_vert:`#include <common>
#include <batching_pars_vertex>
#include <fog_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <shadowmap_pars_vertex>
void main() {
#include <batching_vertex>
#include <beginnormal_vertex>
#include <morphinstance_vertex>
#include <morphnormal_vertex>
#include <skinbase_vertex>
#include <skinnormal_vertex>
#include <defaultnormal_vertex>
#include <begin_vertex>
#include <morphtarget_vertex>
#include <skinning_vertex>
#include <project_vertex>
#include <logdepthbuf_vertex>
#include <worldpos_vertex>
#include <shadowmap_vertex>
#include <fog_vertex>
}`,shadow_frag:`uniform vec3 color;
uniform float opacity;
#include <common>
#include <fog_pars_fragment>
#include <bsdfs>
#include <lights_pars_begin>
#include <logdepthbuf_pars_fragment>
#include <shadowmap_pars_fragment>
#include <shadowmask_pars_fragment>
void main() {
#include <logdepthbuf_fragment>
gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );
#include <tonemapping_fragment>
#include <colorspace_fragment>
#include <fog_fragment>
}`,sprite_vert:`uniform float rotation;
uniform vec2 center;
#include <common>
#include <uv_pars_vertex>
#include <fog_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
#include <uv_vertex>
vec4 mvPosition = modelViewMatrix[ 3 ];
vec2 scale = vec2( length( modelMatrix[ 0 ].xyz ), length( modelMatrix[ 1 ].xyz ) );
#ifndef USE_SIZEATTENUATION
bool isPerspective = isPerspectiveMatrix( projectionMatrix );
if ( isPerspective ) scale *= - mvPosition.z;
#endif
vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;
vec2 rotatedPosition;
rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;
rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;
mvPosition.xy += rotatedPosition;
gl_Position = projectionMatrix * mvPosition;
#include <logdepthbuf_vertex>
#include <clipping_planes_vertex>
#include <fog_vertex>
}`,sprite_frag:`uniform vec3 diffuse;
uniform float opacity;
#include <common>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <fog_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
vec4 diffuseColor = vec4( diffuse, opacity );
#include <clipping_planes_fragment>
vec3 outgoingLight = vec3( 0.0 );
#include <logdepthbuf_fragment>
#include <map_fragment>
#include <alphamap_fragment>
#include <alphatest_fragment>
#include <alphahash_fragment>
outgoingLight = diffuseColor.rgb;
#include <opaque_fragment>
#include <tonemapping_fragment>
#include <colorspace_fragment>
#include <fog_fragment>
}`},Js={common:{diffuse:{value:new Wr(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new pn},alphaMap:{value:null},alphaMapTransform:{value:new pn},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new pn}},envmap:{envMap:{value:null},envMapRotation:{value:new pn},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98},dfgLUT:{value:null}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new pn}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new pn}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new pn},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new pn},normalScale:{value:new ce(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new pn},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new pn}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new pn}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new pn}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Wr(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 Wr(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new pn},alphaTest:{value:0},uvTransform:{value:new pn}},sprite:{diffuse:{value:new Wr(16777215)},opacity:{value:1},center:{value:new ce(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new pn},alphaMap:{value:null},alphaMapTransform:{value:new pn},alphaTest:{value:0}}},Jp={basic:{uniforms:Jl([Js.common,Js.specularmap,Js.envmap,Js.aomap,Js.lightmap,Js.fog]),vertexShader:Vo.meshbasic_vert,fragmentShader:Vo.meshbasic_frag},lambert:{uniforms:Jl([Js.common,Js.specularmap,Js.envmap,Js.aomap,Js.lightmap,Js.emissivemap,Js.bumpmap,Js.normalmap,Js.displacementmap,Js.fog,Js.lights,{emissive:{value:new Wr(0)}}]),vertexShader:Vo.meshlambert_vert,fragmentShader:Vo.meshlambert_frag},phong:{uniforms:Jl([Js.common,Js.specularmap,Js.envmap,Js.aomap,Js.lightmap,Js.emissivemap,Js.bumpmap,Js.normalmap,Js.displacementmap,Js.fog,Js.lights,{emissive:{value:new Wr(0)},specular:{value:new Wr(1118481)},shininess:{value:30}}]),vertexShader:Vo.meshphong_vert,fragmentShader:Vo.meshphong_frag},standard:{uniforms:Jl([Js.common,Js.envmap,Js.aomap,Js.lightmap,Js.emissivemap,Js.bumpmap,Js.normalmap,Js.displacementmap,Js.roughnessmap,Js.metalnessmap,Js.fog,Js.lights,{emissive:{value:new Wr(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Vo.meshphysical_vert,fragmentShader:Vo.meshphysical_frag},toon:{uniforms:Jl([Js.common,Js.aomap,Js.lightmap,Js.emissivemap,Js.bumpmap,Js.normalmap,Js.displacementmap,Js.gradientmap,Js.fog,Js.lights,{emissive:{value:new Wr(0)}}]),vertexShader:Vo.meshtoon_vert,fragmentShader:Vo.meshtoon_frag},matcap:{uniforms:Jl([Js.common,Js.bumpmap,Js.normalmap,Js.displacementmap,Js.fog,{matcap:{value:null}}]),vertexShader:Vo.meshmatcap_vert,fragmentShader:Vo.meshmatcap_frag},points:{uniforms:Jl([Js.points,Js.fog]),vertexShader:Vo.points_vert,fragmentShader:Vo.points_frag},dashed:{uniforms:Jl([Js.common,Js.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Vo.linedashed_vert,fragmentShader:Vo.linedashed_frag},depth:{uniforms:Jl([Js.common,Js.displacementmap]),vertexShader:Vo.depth_vert,fragmentShader:Vo.depth_frag},normal:{uniforms:Jl([Js.common,Js.bumpmap,Js.normalmap,Js.displacementmap,{opacity:{value:1}}]),vertexShader:Vo.meshnormal_vert,fragmentShader:Vo.meshnormal_frag},sprite:{uniforms:Jl([Js.sprite,Js.fog]),vertexShader:Vo.sprite_vert,fragmentShader:Vo.sprite_frag},background:{uniforms:{uvTransform:{value:new pn},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:Vo.background_vert,fragmentShader:Vo.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new pn}},vertexShader:Vo.backgroundCube_vert,fragmentShader:Vo.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Vo.cube_vert,fragmentShader:Vo.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Vo.equirect_vert,fragmentShader:Vo.equirect_frag},distance:{uniforms:Jl([Js.common,Js.displacementmap,{referencePosition:{value:new le},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Vo.distance_vert,fragmentShader:Vo.distance_frag},shadow:{uniforms:Jl([Js.lights,Js.fog,{color:{value:new Wr(0)},opacity:{value:1}}]),vertexShader:Vo.shadow_vert,fragmentShader:Vo.shadow_frag}};Jp.physical={uniforms:Jl([Jp.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new pn},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new pn},clearcoatNormalScale:{value:new ce(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new pn},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new pn},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new pn},sheen:{value:0},sheenColor:{value:new Wr(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new pn},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new pn},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new pn},transmissionSamplerSize:{value:new ce},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new pn},attenuationDistance:{value:0},attenuationColor:{value:new Wr(0)},specularColor:{value:new Wr(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new pn},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new pn},anisotropyVector:{value:new ce},anisotropyMap:{value:null},anisotropyMapTransform:{value:new pn}}]),vertexShader:Vo.meshphysical_vert,fragmentShader:Vo.meshphysical_frag};const ob={r:0,b:0,g:0},i0=new Ua,FO=new di;function PO(s,e,t,n,i,a,o){const u=new Wr(0);let c=a===!0?0:1,d,g,v=null,M=0,B=null;function I(Ce){let ke=Ce.isScene===!0?Ce.background:null;return ke&&ke.isTexture&&(ke=(Ce.backgroundBlurriness>0?t:e).get(ke)),ke}function ne(Ce){let ke=!1;const nt=I(Ce);nt===null?q(u,c):nt&&nt.isColor&&(q(nt,1),ke=!0);const Ye=s.xr.getEnvironmentBlendMode();Ye==="additive"?n.buffers.color.setClear(0,0,0,1,o):Ye==="alpha-blend"&&n.buffers.color.setClear(0,0,0,0,o),(s.autoClear||ke)&&(n.buffers.depth.setTest(!0),n.buffers.depth.setMask(!0),n.buffers.color.setMask(!0),s.clear(s.autoClearColor,s.autoClearDepth,s.autoClearStencil))}function ee(Ce,ke){const nt=I(ke);nt&&(nt.isCubeTexture||nt.mapping===_t)?(g===void 0&&(g=new Il(new bd(1,1,1),new nh({name:"BackgroundCubeMaterial",uniforms:jf(Jp.backgroundCube.uniforms),vertexShader:Jp.backgroundCube.vertexShader,fragmentShader:Jp.backgroundCube.fragmentShader,side:de,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),g.geometry.deleteAttribute("normal"),g.geometry.deleteAttribute("uv"),g.onBeforeRender=function(Ye,ht,Rt){this.matrixWorld.copyPosition(Rt.matrixWorld)},Object.defineProperty(g.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),i.update(g)),i0.copy(ke.backgroundRotation),i0.x*=-1,i0.y*=-1,i0.z*=-1,nt.isCubeTexture&&nt.isRenderTargetTexture===!1&&(i0.y*=-1,i0.z*=-1),g.material.uniforms.envMap.value=nt,g.material.uniforms.flipEnvMap.value=nt.isCubeTexture&&nt.isRenderTargetTexture===!1?-1:1,g.material.uniforms.backgroundBlurriness.value=ke.backgroundBlurriness,g.material.uniforms.backgroundIntensity.value=ke.backgroundIntensity,g.material.uniforms.backgroundRotation.value.setFromMatrix4(FO.makeRotationFromEuler(i0)),g.material.toneMapped=xr.getTransfer(nt.colorSpace)!==ws,(v!==nt||M!==nt.version||B!==s.toneMapping)&&(g.material.needsUpdate=!0,v=nt,M=nt.version,B=s.toneMapping),g.layers.enableAll(),Ce.unshift(g,g.geometry,g.material,0,0,null)):nt&&nt.isTexture&&(d===void 0&&(d=new Il(new Tc(2,2),new nh({name:"BackgroundMaterial",uniforms:jf(Jp.background.uniforms),vertexShader:Jp.background.vertexShader,fragmentShader:Jp.background.fragmentShader,side:j,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),d.geometry.deleteAttribute("normal"),Object.defineProperty(d.material,"map",{get:function(){return this.uniforms.t2D.value}}),i.update(d)),d.material.uniforms.t2D.value=nt,d.material.uniforms.backgroundIntensity.value=ke.backgroundIntensity,d.material.toneMapped=xr.getTransfer(nt.colorSpace)!==ws,nt.matrixAutoUpdate===!0&&nt.updateMatrix(),d.material.uniforms.uvTransform.value.copy(nt.matrix),(v!==nt||M!==nt.version||B!==s.toneMapping)&&(d.material.needsUpdate=!0,v=nt,M=nt.version,B=s.toneMapping),d.layers.enableAll(),Ce.unshift(d,d.geometry,d.material,0,0,null))}function q(Ce,ke){Ce.getRGB(ob,wg(s)),n.buffers.color.setClear(ob.r,ob.g,ob.b,ke,o)}function ye(){g!==void 0&&(g.geometry.dispose(),g.material.dispose(),g=void 0),d!==void 0&&(d.geometry.dispose(),d.material.dispose(),d=void 0)}return{getClearColor:function(){return u},setClearColor:function(Ce,ke=1){u.set(Ce),c=ke,q(u,c)},getClearAlpha:function(){return c},setClearAlpha:function(Ce){c=Ce,q(u,c)},render:ne,addToRenderList:ee,dispose:ye}}function LO(s,e){const t=s.getParameter(s.MAX_VERTEX_ATTRIBS),n={},i=M(null);let a=i,o=!1;function u(pt,xn,cr,pr,Br){let zr=!1;const Dr=v(pr,cr,xn);a!==Dr&&(a=Dr,d(a.object)),zr=B(pt,pr,cr,Br),zr&&I(pt,pr,cr,Br),Br!==null&&e.update(Br,s.ELEMENT_ARRAY_BUFFER),(zr||o)&&(o=!1,ke(pt,xn,cr,pr),Br!==null&&s.bindBuffer(s.ELEMENT_ARRAY_BUFFER,e.get(Br).buffer))}function c(){return s.createVertexArray()}function d(pt){return s.bindVertexArray(pt)}function g(pt){return s.deleteVertexArray(pt)}function v(pt,xn,cr){const pr=cr.wireframe===!0;let Br=n[pt.id];Br===void 0&&(Br={},n[pt.id]=Br);let zr=Br[xn.id];zr===void 0&&(zr={},Br[xn.id]=zr);let Dr=zr[pr];return Dr===void 0&&(Dr=M(c()),zr[pr]=Dr),Dr}function M(pt){const xn=[],cr=[],pr=[];for(let Br=0;Br<t;Br++)xn[Br]=0,cr[Br]=0,pr[Br]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:xn,enabledAttributes:cr,attributeDivisors:pr,object:pt,attributes:{},index:null}}function B(pt,xn,cr,pr){const Br=a.attributes,zr=xn.attributes;let Dr=0;const Zr=cr.getAttributes();for(const Ti in Zr)if(Zr[Ti].location>=0){const As=Br[Ti];let Xr=zr[Ti];if(Xr===void 0&&(Ti==="instanceMatrix"&&pt.instanceMatrix&&(Xr=pt.instanceMatrix),Ti==="instanceColor"&&pt.instanceColor&&(Xr=pt.instanceColor)),As===void 0||As.attribute!==Xr||Xr&&As.data!==Xr.data)return!0;Dr++}return a.attributesNum!==Dr||a.index!==pr}function I(pt,xn,cr,pr){const Br={},zr=xn.attributes;let Dr=0;const Zr=cr.getAttributes();for(const Ti in Zr)if(Zr[Ti].location>=0){let As=zr[Ti];As===void 0&&(Ti==="instanceMatrix"&&pt.instanceMatrix&&(As=pt.instanceMatrix),Ti==="instanceColor"&&pt.instanceColor&&(As=pt.instanceColor));const Xr={};Xr.attribute=As,As&&As.data&&(Xr.data=As.data),Br[Ti]=Xr,Dr++}a.attributes=Br,a.attributesNum=Dr,a.index=pr}function ne(){const pt=a.newAttributes;for(let xn=0,cr=pt.length;xn<cr;xn++)pt[xn]=0}function ee(pt){q(pt,0)}function q(pt,xn){const cr=a.newAttributes,pr=a.enabledAttributes,Br=a.attributeDivisors;cr[pt]=1,pr[pt]===0&&(s.enableVertexAttribArray(pt),pr[pt]=1),Br[pt]!==xn&&(s.vertexAttribDivisor(pt,xn),Br[pt]=xn)}function ye(){const pt=a.newAttributes,xn=a.enabledAttributes;for(let cr=0,pr=xn.length;cr<pr;cr++)xn[cr]!==pt[cr]&&(s.disableVertexAttribArray(cr),xn[cr]=0)}function Ce(pt,xn,cr,pr,Br,zr,Dr){Dr===!0?s.vertexAttribIPointer(pt,xn,cr,Br,zr):s.vertexAttribPointer(pt,xn,cr,pr,Br,zr)}function ke(pt,xn,cr,pr){ne();const Br=pr.attributes,zr=cr.getAttributes(),Dr=xn.defaultAttributeValues;for(const Zr in zr){const Ti=zr[Zr];if(Ti.location>=0){let ds=Br[Zr];if(ds===void 0&&(Zr==="instanceMatrix"&&pt.instanceMatrix&&(ds=pt.instanceMatrix),Zr==="instanceColor"&&pt.instanceColor&&(ds=pt.instanceColor)),ds!==void 0){const As=ds.normalized,Xr=ds.itemSize,Yi=e.get(ds);if(Yi===void 0)continue;const ps=Yi.buffer,Xa=Yi.type,Pi=Yi.bytesPerElement,Nr=Xa===s.INT||Xa===s.UNSIGNED_INT||ds.gpuType===Xt;if(ds.isInterleavedBufferAttribute){const Yr=ds.data,cs=Yr.stride,oa=ds.offset;if(Yr.isInstancedInterleavedBuffer){for(let Ms=0;Ms<Ti.locationSize;Ms++)q(Ti.location+Ms,Yr.meshPerAttribute);pt.isInstancedMesh!==!0&&pr._maxInstanceCount===void 0&&(pr._maxInstanceCount=Yr.meshPerAttribute*Yr.count)}else for(let Ms=0;Ms<Ti.locationSize;Ms++)ee(Ti.location+Ms);s.bindBuffer(s.ARRAY_BUFFER,ps);for(let Ms=0;Ms<Ti.locationSize;Ms++)Ce(Ti.location+Ms,Xr/Ti.locationSize,Xa,As,cs*Pi,(oa+Xr/Ti.locationSize*Ms)*Pi,Nr)}else{if(ds.isInstancedBufferAttribute){for(let Yr=0;Yr<Ti.locationSize;Yr++)q(Ti.location+Yr,ds.meshPerAttribute);pt.isInstancedMesh!==!0&&pr._maxInstanceCount===void 0&&(pr._maxInstanceCount=ds.meshPerAttribute*ds.count)}else for(let Yr=0;Yr<Ti.locationSize;Yr++)ee(Ti.location+Yr);s.bindBuffer(s.ARRAY_BUFFER,ps);for(let Yr=0;Yr<Ti.locationSize;Yr++)Ce(Ti.location+Yr,Xr/Ti.locationSize,Xa,As,Xr*Pi,Xr/Ti.locationSize*Yr*Pi,Nr)}}else if(Dr!==void 0){const As=Dr[Zr];if(As!==void 0)switch(As.length){case 2:s.vertexAttrib2fv(Ti.location,As);break;case 3:s.vertexAttrib3fv(Ti.location,As);break;case 4:s.vertexAttrib4fv(Ti.location,As);break;default:s.vertexAttrib1fv(Ti.location,As)}}}}ye()}function nt(){Rt();for(const pt in n){const xn=n[pt];for(const cr in xn){const pr=xn[cr];for(const Br in pr)g(pr[Br].object),delete pr[Br];delete xn[cr]}delete n[pt]}}function Ye(pt){if(n[pt.id]===void 0)return;const xn=n[pt.id];for(const cr in xn){const pr=xn[cr];for(const Br in pr)g(pr[Br].object),delete pr[Br];delete xn[cr]}delete n[pt.id]}function ht(pt){for(const xn in n){const cr=n[xn];if(cr[pt.id]===void 0)continue;const pr=cr[pt.id];for(const Br in pr)g(pr[Br].object),delete pr[Br];delete cr[pt.id]}}function Rt(){qe(),o=!0,a!==i&&(a=i,d(a.object))}function qe(){i.geometry=null,i.program=null,i.wireframe=!1}return{setup:u,reset:Rt,resetDefaultState:qe,dispose:nt,releaseStatesOfGeometry:Ye,releaseStatesOfProgram:ht,initAttributes:ne,enableAttribute:ee,disableUnusedAttributes:ye}}function UO(s,e,t){let n;function i(d){n=d}function a(d,g){s.drawArrays(n,d,g),t.update(g,n,1)}function o(d,g,v){v!==0&&(s.drawArraysInstanced(n,d,g,v),t.update(g,n,v))}function u(d,g,v){if(v===0)return;e.get("WEBGL_multi_draw").multiDrawArraysWEBGL(n,d,0,g,0,v);let B=0;for(let I=0;I<v;I++)B+=g[I];t.update(B,n,1)}function c(d,g,v,M){if(v===0)return;const B=e.get("WEBGL_multi_draw");if(B===null)for(let I=0;I<d.length;I++)o(d[I],g[I],M[I]);else{B.multiDrawArraysInstancedWEBGL(n,d,0,g,0,M,0,v);let I=0;for(let ne=0;ne<v;ne++)I+=g[ne]*M[ne];t.update(I,n,1)}}this.setMode=i,this.render=a,this.renderInstances=o,this.renderMultiDraw=u,this.renderMultiDrawInstances=c}function OO(s,e,t,n){let i;function a(){if(i!==void 0)return i;if(e.has("EXT_texture_filter_anisotropic")===!0){const ht=e.get("EXT_texture_filter_anisotropic");i=s.getParameter(ht.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else i=0;return i}function o(ht){return!(ht!==L&&n.convert(ht)!==s.getParameter(s.IMPLEMENTATION_COLOR_READ_FORMAT))}function u(ht){const Rt=ht===Wt&&(e.has("EXT_color_buffer_half_float")||e.has("EXT_color_buffer_float"));return!(ht!==es&&n.convert(ht)!==s.getParameter(s.IMPLEMENTATION_COLOR_READ_TYPE)&&ht!==dt&&!Rt)}function c(ht){if(ht==="highp"){if(s.getShaderPrecisionFormat(s.VERTEX_SHADER,s.HIGH_FLOAT).precision>0&&s.getShaderPrecisionFormat(s.FRAGMENT_SHADER,s.HIGH_FLOAT).precision>0)return"highp";ht="mediump"}return ht==="mediump"&&s.getShaderPrecisionFormat(s.VERTEX_SHADER,s.MEDIUM_FLOAT).precision>0&&s.getShaderPrecisionFormat(s.FRAGMENT_SHADER,s.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let d=t.precision!==void 0?t.precision:"highp";const g=c(d);g!==d&&(Lr("WebGLRenderer:",d,"not supported, using",g,"instead."),d=g);const v=t.logarithmicDepthBuffer===!0,M=t.reversedDepthBuffer===!0&&e.has("EXT_clip_control"),B=s.getParameter(s.MAX_TEXTURE_IMAGE_UNITS),I=s.getParameter(s.MAX_VERTEX_TEXTURE_IMAGE_UNITS),ne=s.getParameter(s.MAX_TEXTURE_SIZE),ee=s.getParameter(s.MAX_CUBE_MAP_TEXTURE_SIZE),q=s.getParameter(s.MAX_VERTEX_ATTRIBS),ye=s.getParameter(s.MAX_VERTEX_UNIFORM_VECTORS),Ce=s.getParameter(s.MAX_VARYING_VECTORS),ke=s.getParameter(s.MAX_FRAGMENT_UNIFORM_VECTORS),nt=s.getParameter(s.MAX_SAMPLES),Ye=s.getParameter(s.SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:a,getMaxPrecision:c,textureFormatReadable:o,textureTypeReadable:u,precision:d,logarithmicDepthBuffer:v,reversedDepthBuffer:M,maxTextures:B,maxVertexTextures:I,maxTextureSize:ne,maxCubemapSize:ee,maxAttributes:q,maxVertexUniforms:ye,maxVaryings:Ce,maxFragmentUniforms:ke,maxSamples:nt,samples:Ye}}function DO(s){const e=this;let t=null,n=0,i=!1,a=!1;const o=new Ec,u=new pn,c={value:null,needsUpdate:!1};this.uniform=c,this.numPlanes=0,this.numIntersection=0,this.init=function(v,M){const B=v.length!==0||M||n!==0||i;return i=M,n=v.length,B},this.beginShadows=function(){a=!0,g(null)},this.endShadows=function(){a=!1},this.setGlobalState=function(v,M){t=g(v,M,0)},this.setState=function(v,M,B){const I=v.clippingPlanes,ne=v.clipIntersection,ee=v.clipShadows,q=s.get(v);if(!i||I===null||I.length===0||a&&!ee)a?g(null):d();else{const ye=a?0:n,Ce=ye*4;let ke=q.clippingState||null;c.value=ke,ke=g(I,M,Ce,B);for(let nt=0;nt!==Ce;++nt)ke[nt]=t[nt];q.clippingState=ke,this.numIntersection=ne?this.numPlanes:0,this.numPlanes+=ye}};function d(){c.value!==t&&(c.value=t,c.needsUpdate=n>0),e.numPlanes=n,e.numIntersection=0}function g(v,M,B,I){const ne=v!==null?v.length:0;let ee=null;if(ne!==0){if(ee=c.value,I!==!0||ee===null){const q=B+ne*4,ye=M.matrixWorldInverse;u.getNormalMatrix(ye),(ee===null||ee.length<q)&&(ee=new Float32Array(q));for(let Ce=0,ke=B;Ce!==ne;++Ce,ke+=4)o.copy(v[Ce]).applyMatrix4(ye,u),o.normal.toArray(ee,ke),ee[ke+3]=o.constant}c.value=ee,c.needsUpdate=!0}return e.numPlanes=ne,e.numIntersection=0,ee}}function kO(s){let e=new WeakMap;function t(o,u){return u===ot?o.mapping=it:u===ut&&(o.mapping=wt),o}function n(o){if(o&&o.isTexture){const u=o.mapping;if(u===ot||u===ut)if(e.has(o)){const c=e.get(o).texture;return t(c,o.mapping)}else{const c=o.image;if(c&&c.height>0){const d=new Mc(c.height);return d.fromEquirectangularTexture(s,o),e.set(o,d),o.addEventListener("dispose",i),t(d.texture,o.mapping)}else return null}}return o}function i(o){const u=o.target;u.removeEventListener("dispose",i);const c=e.get(u);c!==void 0&&(e.delete(u),c.dispose())}function a(){e=new WeakMap}return{get:n,dispose:a}}const Bm=4,_C=[.125,.215,.35,.446,.526,.582],s0=20,VO=256,wy=new Pg,wC=new Wr;let Yw=null,qw=0,Jw=0,e1=!1;const zO=new le;class SC{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._sizeLods=[],this._sigmas=[],this._lodMeshes=[],this._backgroundBox=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._blurMaterial=null,this._ggxMaterial=null}fromScene(e,t=0,n=.1,i=100,a={}){const{size:o=256,position:u=zO}=a;Yw=this._renderer.getRenderTarget(),qw=this._renderer.getActiveCubeFace(),Jw=this._renderer.getActiveMipmapLevel(),e1=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(o);const c=this._allocateTargets();return c.depthBuffer=!0,this._sceneToCubeUV(e,n,i,c,u),t>0&&this._blur(c,0,0,t),this._applyPMREM(c),this._cleanup(c),c}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=CC(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=EC(),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())}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._ggxMaterial!==null&&this._ggxMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e<this._lodMeshes.length;e++)this._lodMeshes[e].geometry.dispose()}_cleanup(e){this._renderer.setRenderTarget(Yw,qw,Jw),this._renderer.xr.enabled=e1,e.scissorTest=!1,cv(e,0,0,e.width,e.height)}_fromTexture(e,t){e.mapping===it||e.mapping===wt?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),Yw=this._renderer.getRenderTarget(),qw=this._renderer.getActiveCubeFace(),Jw=this._renderer.getActiveMipmapLevel(),e1=this._renderer.xr.enabled,this._renderer.xr.enabled=!1;const n=t||this._allocateTargets();return this._textureToCubeUV(e,n),this._applyPMREM(n),this._cleanup(n),n}_allocateTargets(){const e=3*Math.max(this._cubeSize,112),t=4*this._cubeSize,n={magFilter:vr,minFilter:vr,generateMipmaps:!1,type:Wt,format:L,colorSpace:No,depthBuffer:!1},i=MC(e,t,n);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=MC(e,t,n);const{_lodMax:a}=this;({lodMeshes:this._lodMeshes,sizeLods:this._sizeLods,sigmas:this._sigmas}=GO(a)),this._blurMaterial=QO(a,e,t),this._ggxMaterial=HO(a,e,t)}return i}_compileMaterial(e){const t=new Il(new ka,e);this._renderer.compile(t,wy)}_sceneToCubeUV(e,t,n,i,a){const c=new vo(90,1,t,n),d=[1,-1,1,1,1,1],g=[1,1,1,-1,-1,-1],v=this._renderer,M=v.autoClear,B=v.toneMapping;v.getClearColor(wC),v.toneMapping=Ct,v.autoClear=!1,v.state.buffers.depth.getReversed()&&(v.setRenderTarget(i),v.clearDepth(),v.setRenderTarget(null)),this._backgroundBox===null&&(this._backgroundBox=new Il(new bd,new Yl({name:"PMREM.Background",side:de,depthWrite:!1,depthTest:!1})));const ne=this._backgroundBox,ee=ne.material;let q=!1;const ye=e.background;ye?ye.isColor&&(ee.color.copy(ye),e.background=null,q=!0):(ee.color.copy(wC),q=!0);for(let Ce=0;Ce<6;Ce++){const ke=Ce%3;ke===0?(c.up.set(0,d[Ce],0),c.position.set(a.x,a.y,a.z),c.lookAt(a.x+g[Ce],a.y,a.z)):ke===1?(c.up.set(0,0,d[Ce]),c.position.set(a.x,a.y,a.z),c.lookAt(a.x,a.y+g[Ce],a.z)):(c.up.set(0,d[Ce],0),c.position.set(a.x,a.y,a.z),c.lookAt(a.x,a.y,a.z+g[Ce]));const nt=this._cubeSize;cv(i,ke*nt,Ce>2?nt:0,nt,nt),v.setRenderTarget(i),q&&v.render(ne,c),v.render(e,c)}v.toneMapping=B,v.autoClear=M,e.background=ye}_textureToCubeUV(e,t){const n=this._renderer,i=e.mapping===it||e.mapping===wt;i?(this._cubemapMaterial===null&&(this._cubemapMaterial=CC()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=EC());const a=i?this._cubemapMaterial:this._equirectMaterial,o=this._lodMeshes[0];o.material=a;const u=a.uniforms;u.envMap.value=e;const c=this._cubeSize;cv(t,0,0,3*c,2*c),n.setRenderTarget(t),n.render(o,wy)}_applyPMREM(e){const t=this._renderer,n=t.autoClear;t.autoClear=!1;const i=this._lodMeshes.length;for(let a=1;a<i;a++)this._applyGGXFilter(e,a-1,a);t.autoClear=n}_applyGGXFilter(e,t,n){const i=this._renderer,a=this._pingPongRenderTarget,o=this._ggxMaterial,u=this._lodMeshes[n];u.material=o;const c=o.uniforms,d=n/(this._lodMeshes.length-1),g=t/(this._lodMeshes.length-1),v=Math.sqrt(d*d-g*g),M=0+d*1.25,B=v*M,{_lodMax:I}=this,ne=this._sizeLods[n],ee=3*ne*(n>I-Bm?n-I+Bm:0),q=4*(this._cubeSize-ne);c.envMap.value=e.texture,c.roughness.value=B,c.mipInt.value=I-t,cv(a,ee,q,3*ne,2*ne),i.setRenderTarget(a),i.render(u,wy),c.envMap.value=a.texture,c.roughness.value=0,c.mipInt.value=I-n,cv(e,ee,q,3*ne,2*ne),i.setRenderTarget(e),i.render(u,wy)}_blur(e,t,n,i,a){const o=this._pingPongRenderTarget;this._halfBlur(e,o,t,n,i,"latitudinal",a),this._halfBlur(o,e,n,n,i,"longitudinal",a)}_halfBlur(e,t,n,i,a,o,u){const c=this._renderer,d=this._blurMaterial;o!=="latitudinal"&&o!=="longitudinal"&&Gr("blur direction must be either latitudinal or longitudinal!");const g=3,v=this._lodMeshes[i];v.material=d;const M=d.uniforms,B=this._sizeLods[n]-1,I=isFinite(a)?Math.PI/(2*B):2*Math.PI/(2*s0-1),ne=a/I,ee=isFinite(a)?1+Math.floor(g*ne):s0;ee>s0&&Lr(`sigmaRadians, ${a}, is too large and will clip, as it requested ${ee} samples when the maximum is set to ${s0}`);const q=[];let ye=0;for(let ht=0;ht<s0;++ht){const Rt=ht/ne,qe=Math.exp(-Rt*Rt/2);q.push(qe),ht===0?ye+=qe:ht<ee&&(ye+=2*qe)}for(let ht=0;ht<q.length;ht++)q[ht]=q[ht]/ye;M.envMap.value=e.texture,M.samples.value=ee,M.weights.value=q,M.latitudinal.value=o==="latitudinal",u&&(M.poleAxis.value=u);const{_lodMax:Ce}=this;M.dTheta.value=I,M.mipInt.value=Ce-n;const ke=this._sizeLods[i],nt=3*ke*(i>Ce-Bm?i-Ce+Bm:0),Ye=4*(this._cubeSize-ke);cv(t,nt,Ye,3*ke,2*ke),c.setRenderTarget(t),c.render(v,wy)}}function GO(s){const e=[],t=[],n=[];let i=s;const a=s-Bm+1+_C.length;for(let o=0;o<a;o++){const u=Math.pow(2,i);e.push(u);let c=1/u;o>s-Bm?c=_C[o-s+Bm-1]:o===0&&(c=0),t.push(c);const d=1/(u-2),g=-d,v=1+d,M=[g,g,v,g,v,v,g,g,v,v,g,v],B=6,I=6,ne=3,ee=2,q=1,ye=new Float32Array(ne*I*B),Ce=new Float32Array(ee*I*B),ke=new Float32Array(q*I*B);for(let Ye=0;Ye<B;Ye++){const ht=Ye%3*2/3-1,Rt=Ye>2?0:-1,qe=[ht,Rt,0,ht+2/3,Rt,0,ht+2/3,Rt+1,0,ht,Rt,0,ht+2/3,Rt+1,0,ht,Rt+1,0];ye.set(qe,ne*I*Ye),Ce.set(M,ee*I*Ye);const pt=[Ye,Ye,Ye,Ye,Ye,Ye];ke.set(pt,q*I*Ye)}const nt=new ka;nt.setAttribute("position",new wl(ye,ne)),nt.setAttribute("uv",new wl(Ce,ee)),nt.setAttribute("faceIndex",new wl(ke,q)),n.push(new Il(nt,null)),i>Bm&&i--}return{lodMeshes:n,sizeLods:e,sigmas:t}}function MC(s,e,t){const n=new Os(s,e,t);return n.texture.mapping=_t,n.texture.name="PMREM.cubeUv",n.scissorTest=!0,n}function cv(s,e,t,n,i){s.viewport.set(e,t,n,i),s.scissor.set(e,t,n,i)}function HO(s,e,t){return new nh({name:"PMREMGGXConvolution",defines:{GGX_SAMPLES:VO,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${s}.0`},uniforms:{envMap:{value:null},roughness:{value:0},mipInt:{value:0}},vertexShader:lb(),fragmentShader:`
precision highp float;
precision highp int;
varying vec3 vOutputDirection;
uniform sampler2D envMap;
uniform float roughness;
uniform float mipInt;
#define ENVMAP_TYPE_CUBE_UV
#include <cube_uv_reflection_fragment>
#define PI 3.14159265359
// Van der Corput radical inverse
float radicalInverse_VdC(uint bits) {
bits = (bits << 16u) | (bits >> 16u);
bits = ((bits & 0x55555555u) << 1u) | ((bits & 0xAAAAAAAAu) >> 1u);
bits = ((bits & 0x33333333u) << 2u) | ((bits & 0xCCCCCCCCu) >> 2u);
bits = ((bits & 0x0F0F0F0Fu) << 4u) | ((bits & 0xF0F0F0F0u) >> 4u);
bits = ((bits & 0x00FF00FFu) << 8u) | ((bits & 0xFF00FF00u) >> 8u);
return float(bits) * 2.3283064365386963e-10; // / 0x100000000
}
// Hammersley sequence
vec2 hammersley(uint i, uint N) {
return vec2(float(i) / float(N), radicalInverse_VdC(i));
}
// GGX VNDF importance sampling (Eric Heitz 2018)
// "Sampling the GGX Distribution of Visible Normals"
// https://jcgt.org/published/0007/04/01/
vec3 importanceSampleGGX_VNDF(vec2 Xi, vec3 V, float roughness) {
float alpha = roughness * roughness;
// Section 3.2: Transform view direction to hemisphere configuration
vec3 Vh = normalize(vec3(alpha * V.x, alpha * V.y, V.z));
// Section 4.1: Orthonormal basis
float lensq = Vh.x * Vh.x + Vh.y * Vh.y;
vec3 T1 = lensq > 0.0 ? vec3(-Vh.y, Vh.x, 0.0) / sqrt(lensq) : vec3(1.0, 0.0, 0.0);
vec3 T2 = cross(Vh, T1);
// Section 4.2: Parameterization of projected area
float r = sqrt(Xi.x);
float phi = 2.0 * PI * Xi.y;
float t1 = r * cos(phi);
float t2 = r * sin(phi);
float s = 0.5 * (1.0 + Vh.z);
t2 = (1.0 - s) * sqrt(1.0 - t1 * t1) + s * t2;
// Section 4.3: Reprojection onto hemisphere
vec3 Nh = t1 * T1 + t2 * T2 + sqrt(max(0.0, 1.0 - t1 * t1 - t2 * t2)) * Vh;
// Section 3.4: Transform back to ellipsoid configuration
return normalize(vec3(alpha * Nh.x, alpha * Nh.y, max(0.0, Nh.z)));
}
void main() {
vec3 N = normalize(vOutputDirection);
vec3 V = N; // Assume view direction equals normal for pre-filtering
vec3 prefilteredColor = vec3(0.0);
float totalWeight = 0.0;
// For very low roughness, just sample the environment directly
if (roughness < 0.001) {
gl_FragColor = vec4(bilinearCubeUV(envMap, N, mipInt), 1.0);
return;
}
// Tangent space basis for VNDF sampling
vec3 up = abs(N.z) < 0.999 ? vec3(0.0, 0.0, 1.0) : vec3(1.0, 0.0, 0.0);
vec3 tangent = normalize(cross(up, N));
vec3 bitangent = cross(N, tangent);
for(uint i = 0u; i < uint(GGX_SAMPLES); i++) {
vec2 Xi = hammersley(i, uint(GGX_SAMPLES));
// For PMREM, V = N, so in tangent space V is always (0, 0, 1)
vec3 H_tangent = importanceSampleGGX_VNDF(Xi, vec3(0.0, 0.0, 1.0), roughness);
// Transform H back to world space
vec3 H = normalize(tangent * H_tangent.x + bitangent * H_tangent.y + N * H_tangent.z);
vec3 L = normalize(2.0 * dot(V, H) * H - V);
float NdotL = max(dot(N, L), 0.0);
if(NdotL > 0.0) {
// Sample environment at fixed mip level
// VNDF importance sampling handles the distribution filtering
vec3 sampleColor = bilinearCubeUV(envMap, L, mipInt);
// Weight by NdotL for the split-sum approximation
// VNDF PDF naturally accounts for the visible microfacet distribution
prefilteredColor += sampleColor * NdotL;
totalWeight += NdotL;
}
}
if (totalWeight > 0.0) {
prefilteredColor = prefilteredColor / totalWeight;
}
gl_FragColor = vec4(prefilteredColor, 1.0);
}
`,blending:we,depthTest:!1,depthWrite:!1})}function QO(s,e,t){const n=new Float32Array(s0),i=new le(0,1,0);return new nh({name:"SphericalGaussianBlur",defines:{n:s0,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${s}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:n},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:i}},vertexShader:lb(),fragmentShader:`
precision mediump float;
precision mediump int;
varying vec3 vOutputDirection;
uniform sampler2D envMap;
uniform int samples;
uniform float weights[ n ];
uniform bool latitudinal;
uniform float dTheta;
uniform float mipInt;
uniform vec3 poleAxis;
#define ENVMAP_TYPE_CUBE_UV
#include <cube_uv_reflection_fragment>
vec3 getSample( float theta, vec3 axis ) {
float cosTheta = cos( theta );
// Rodrigues' axis-angle rotation
vec3 sampleDirection = vOutputDirection * cosTheta
+ cross( axis, vOutputDirection ) * sin( theta )
+ axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );
return bilinearCubeUV( envMap, sampleDirection, mipInt );
}
void main() {
vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );
if ( all( equal( axis, vec3( 0.0 ) ) ) ) {
axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );
}
axis = normalize( axis );
gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );
gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );
for ( int i = 1; i < n; i++ ) {
if ( i >= samples ) {
break;
}
float theta = dTheta * float( i );
gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );
gl_FragColor.rgb += weights[ i ] * getSample( theta, axis );
}
}
`,blending:we,depthTest:!1,depthWrite:!1})}function EC(){return new nh({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:lb(),fragmentShader:`
precision mediump float;
precision mediump int;
varying vec3 vOutputDirection;
uniform sampler2D envMap;
#include <common>
void main() {
vec3 outputDirection = normalize( vOutputDirection );
vec2 uv = equirectUv( outputDirection );
gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );
}
`,blending:we,depthTest:!1,depthWrite:!1})}function CC(){return new nh({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:lb(),fragmentShader:`
precision mediump float;
precision mediump int;
uniform float flipEnvMap;
varying vec3 vOutputDirection;
uniform samplerCube envMap;
void main() {
gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );
}
`,blending:we,depthTest:!1,depthWrite:!1})}function lb(){return`
precision mediump float;
precision mediump int;
attribute float faceIndex;
varying vec3 vOutputDirection;
// RH coordinate system; PMREM face-indexing convention
vec3 getDirection( vec2 uv, float face ) {
uv = 2.0 * uv - 1.0;
vec3 direction = vec3( uv, 1.0 );
if ( face == 0.0 ) {
direction = direction.zyx; // ( 1, v, u ) pos x
} else if ( face == 1.0 ) {
direction = direction.xzy;
direction.xz *= -1.0; // ( -u, 1, -v ) pos y
} else if ( face == 2.0 ) {
direction.x *= -1.0; // ( -u, v, 1 ) pos z
} else if ( face == 3.0 ) {
direction = direction.zyx;
direction.xz *= -1.0; // ( -1, v, -u ) neg x
} else if ( face == 4.0 ) {
direction = direction.xzy;
direction.xy *= -1.0; // ( -u, -1, v ) neg y
} else if ( face == 5.0 ) {
direction.z *= -1.0; // ( u, v, -1 ) neg z
}
return direction;
}
void main() {
vOutputDirection = getDirection( uv, faceIndex );
gl_Position = vec4( position, 1.0 );
}
`}function WO(s){let e=new WeakMap,t=null;function n(u){if(u&&u.isTexture){const c=u.mapping,d=c===ot||c===ut,g=c===it||c===wt;if(d||g){let v=e.get(u);const M=v!==void 0?v.texture.pmremVersion:0;if(u.isRenderTargetTexture&&u.pmremVersion!==M)return t===null&&(t=new SC(s)),v=d?t.fromEquirectangular(u,v):t.fromCubemap(u,v),v.texture.pmremVersion=u.pmremVersion,e.set(u,v),v.texture;if(v!==void 0)return v.texture;{const B=u.image;return d&&B&&B.height>0||g&&B&&i(B)?(t===null&&(t=new SC(s)),v=d?t.fromEquirectangular(u):t.fromCubemap(u),v.texture.pmremVersion=u.pmremVersion,e.set(u,v),u.addEventListener("dispose",a),v.texture):null}}}return u}function i(u){let c=0;const d=6;for(let g=0;g<d;g++)u[g]!==void 0&&c++;return c===d}function a(u){const c=u.target;c.removeEventListener("dispose",a);const d=e.get(c);d!==void 0&&(e.delete(c),d.dispose())}function o(){e=new WeakMap,t!==null&&(t.dispose(),t=null)}return{get:n,dispose:o}}function ZO(s){const e={};function t(n){if(e[n]!==void 0)return e[n];const i=s.getExtension(n);return e[n]=i,i}return{has:function(n){return t(n)!==null},init:function(){t("EXT_color_buffer_float"),t("WEBGL_clip_cull_distance"),t("OES_texture_float_linear"),t("EXT_color_buffer_half_float"),t("WEBGL_multisampled_render_to_texture"),t("WEBGL_render_shared_exponent")},get:function(n){const i=t(n);return i===null&&ki("WebGLRenderer: "+n+" extension not supported."),i}}}function KO(s,e,t,n){const i={},a=new WeakMap;function o(v){const M=v.target;M.index!==null&&e.remove(M.index);for(const I in M.attributes)e.remove(M.attributes[I]);M.removeEventListener("dispose",o),delete i[M.id];const B=a.get(M);B&&(e.remove(B),a.delete(M)),n.releaseStatesOfGeometry(M),M.isInstancedBufferGeometry===!0&&delete M._maxInstanceCount,t.memory.geometries--}function u(v,M){return i[M.id]===!0||(M.addEventListener("dispose",o),i[M.id]=!0,t.memory.geometries++),M}function c(v){const M=v.attributes;for(const B in M)e.update(M[B],s.ARRAY_BUFFER)}function d(v){const M=[],B=v.index,I=v.attributes.position;let ne=0;if(B!==null){const ye=B.array;ne=B.version;for(let Ce=0,ke=ye.length;Ce<ke;Ce+=3){const nt=ye[Ce+0],Ye=ye[Ce+1],ht=ye[Ce+2];M.push(nt,Ye,Ye,ht,ht,nt)}}else if(I!==void 0){const ye=I.array;ne=I.version;for(let Ce=0,ke=ye.length/3-1;Ce<ke;Ce+=3){const nt=Ce+0,Ye=Ce+1,ht=Ce+2;M.push(nt,Ye,Ye,ht,ht,nt)}}else return;const ee=new(Oo(M)?ff:qh)(M,1);ee.version=ne;const q=a.get(v);q&&e.remove(q),a.set(v,ee)}function g(v){const M=a.get(v);if(M){const B=v.index;B!==null&&M.version<B.version&&d(v)}else d(v);return a.get(v)}return{get:u,update:c,getWireframeAttribute:g}}function $O(s,e,t){let n;function i(M){n=M}let a,o;function u(M){a=M.type,o=M.bytesPerElement}function c(M,B){s.drawElements(n,B,a,M*o),t.update(B,n,1)}function d(M,B,I){I!==0&&(s.drawElementsInstanced(n,B,a,M*o,I),t.update(B,n,I))}function g(M,B,I){if(I===0)return;e.get("WEBGL_multi_draw").multiDrawElementsWEBGL(n,B,0,a,M,0,I);let ee=0;for(let q=0;q<I;q++)ee+=B[q];t.update(ee,n,1)}function v(M,B,I,ne){if(I===0)return;const ee=e.get("WEBGL_multi_draw");if(ee===null)for(let q=0;q<M.length;q++)d(M[q]/o,B[q],ne[q]);else{ee.multiDrawElementsInstancedWEBGL(n,B,0,a,M,0,ne,0,I);let q=0;for(let ye=0;ye<I;ye++)q+=B[ye]*ne[ye];t.update(q,n,1)}}this.setMode=i,this.setIndex=u,this.render=c,this.renderInstances=d,this.renderMultiDraw=g,this.renderMultiDrawInstances=v}function XO(s){const e={geometries:0,textures:0},t={frame:0,calls:0,triangles:0,points:0,lines:0};function n(a,o,u){switch(t.calls++,o){case s.TRIANGLES:t.triangles+=u*(a/3);break;case s.LINES:t.lines+=u*(a/2);break;case s.LINE_STRIP:t.lines+=u*(a-1);break;case s.LINE_LOOP:t.lines+=u*a;break;case s.POINTS:t.points+=u*a;break;default:Gr("WebGLInfo: Unknown draw mode:",o);break}}function i(){t.calls=0,t.triangles=0,t.points=0,t.lines=0}return{memory:e,render:t,programs:null,autoReset:!0,reset:i,update:n}}function jO(s,e,t){const n=new WeakMap,i=new Ni;function a(o,u,c){const d=o.morphTargetInfluences,g=u.morphAttributes.position||u.morphAttributes.normal||u.morphAttributes.color,v=g!==void 0?g.length:0;let M=n.get(u);if(M===void 0||M.count!==v){let qe=function(){ht.dispose(),n.delete(u),u.removeEventListener("dispose",qe)};M!==void 0&&M.texture.dispose();const B=u.morphAttributes.position!==void 0,I=u.morphAttributes.normal!==void 0,ne=u.morphAttributes.color!==void 0,ee=u.morphAttributes.position||[],q=u.morphAttributes.normal||[],ye=u.morphAttributes.color||[];let Ce=0;B===!0&&(Ce=1),I===!0&&(Ce=2),ne===!0&&(Ce=3);let ke=u.attributes.position.count*Ce,nt=1;ke>e.maxTextureSize&&(nt=Math.ceil(ke/e.maxTextureSize),ke=e.maxTextureSize);const Ye=new Float32Array(ke*nt*4*v),ht=new _a(Ye,ke,nt,v);ht.type=dt,ht.needsUpdate=!0;const Rt=Ce*4;for(let pt=0;pt<v;pt++){const xn=ee[pt],cr=q[pt],pr=ye[pt],Br=ke*nt*4*pt;for(let zr=0;zr<xn.count;zr++){const Dr=zr*Rt;B===!0&&(i.fromBufferAttribute(xn,zr),Ye[Br+Dr+0]=i.x,Ye[Br+Dr+1]=i.y,Ye[Br+Dr+2]=i.z,Ye[Br+Dr+3]=0),I===!0&&(i.fromBufferAttribute(cr,zr),Ye[Br+Dr+4]=i.x,Ye[Br+Dr+5]=i.y,Ye[Br+Dr+6]=i.z,Ye[Br+Dr+7]=0),ne===!0&&(i.fromBufferAttribute(pr,zr),Ye[Br+Dr+8]=i.x,Ye[Br+Dr+9]=i.y,Ye[Br+Dr+10]=i.z,Ye[Br+Dr+11]=pr.itemSize===4?i.w:1)}}M={count:v,texture:ht,size:new ce(ke,nt)},n.set(u,M),u.addEventListener("dispose",qe)}if(o.isInstancedMesh===!0&&o.morphTexture!==null)c.getUniforms().setValue(s,"morphTexture",o.morphTexture,t);else{let B=0;for(let ne=0;ne<d.length;ne++)B+=d[ne];const I=u.morphTargetsRelative?1:1-B;c.getUniforms().setValue(s,"morphTargetBaseInfluence",I),c.getUniforms().setValue(s,"morphTargetInfluences",d)}c.getUniforms().setValue(s,"morphTargetsTexture",M.texture,t),c.getUniforms().setValue(s,"morphTargetsTextureSize",M.size)}return{update:a}}function YO(s,e,t,n){let i=new WeakMap;function a(c){const d=n.render.frame,g=c.geometry,v=e.get(c,g);if(i.get(v)!==d&&(e.update(v),i.set(v,d)),c.isInstancedMesh&&(c.hasEventListener("dispose",u)===!1&&c.addEventListener("dispose",u),i.get(c)!==d&&(t.update(c.instanceMatrix,s.ARRAY_BUFFER),c.instanceColor!==null&&t.update(c.instanceColor,s.ARRAY_BUFFER),i.set(c,d))),c.isSkinnedMesh){const M=c.skeleton;i.get(M)!==d&&(M.update(),i.set(M,d))}return v}function o(){i=new WeakMap}function u(c){const d=c.target;d.removeEventListener("dispose",u),t.remove(d.instanceMatrix),d.instanceColor!==null&&t.remove(d.instanceColor)}return{update:a,dispose:o}}const qO={[sn]:"LINEAR_TONE_MAPPING",[W]:"REINHARD_TONE_MAPPING",[Se]:"CINEON_TONE_MAPPING",[Ht]:"ACES_FILMIC_TONE_MAPPING",[Fn]:"AGX_TONE_MAPPING",[Tn]:"NEUTRAL_TONE_MAPPING",[zt]:"CUSTOM_TONE_MAPPING"};function JO(s,e,t,n,i){const a=new Os(e,t,{type:s,depthBuffer:n,stencilBuffer:i}),o=new Os(e,t,{type:Wt,depthBuffer:!1,stencilBuffer:!1}),u=new ka;u.setAttribute("position",new Ui([-1,3,0,-1,-1,0,3,-1,0],3)),u.setAttribute("uv",new Ui([0,2,0,0,2,0],2));const c=new Tx({uniforms:{tDiffuse:{value:null}},vertexShader:`
precision highp float;
uniform mat4 modelViewMatrix;
uniform mat4 projectionMatrix;
attribute vec3 position;
attribute vec2 uv;
varying vec2 vUv;
void main() {
vUv = uv;
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
}`,fragmentShader:`
precision highp float;
uniform sampler2D tDiffuse;
varying vec2 vUv;
#include <tonemapping_pars_fragment>
#include <colorspace_pars_fragment>
void main() {
gl_FragColor = texture2D( tDiffuse, vUv );
#ifdef LINEAR_TONE_MAPPING
gl_FragColor.rgb = LinearToneMapping( gl_FragColor.rgb );
#elif defined( REINHARD_TONE_MAPPING )
gl_FragColor.rgb = ReinhardToneMapping( gl_FragColor.rgb );
#elif defined( CINEON_TONE_MAPPING )
gl_FragColor.rgb = CineonToneMapping( gl_FragColor.rgb );
#elif defined( ACES_FILMIC_TONE_MAPPING )
gl_FragColor.rgb = ACESFilmicToneMapping( gl_FragColor.rgb );
#elif defined( AGX_TONE_MAPPING )
gl_FragColor.rgb = AgXToneMapping( gl_FragColor.rgb );
#elif defined( NEUTRAL_TONE_MAPPING )
gl_FragColor.rgb = NeutralToneMapping( gl_FragColor.rgb );
#elif defined( CUSTOM_TONE_MAPPING )
gl_FragColor.rgb = CustomToneMapping( gl_FragColor.rgb );
#endif
#ifdef SRGB_TRANSFER
gl_FragColor = sRGBTransferOETF( gl_FragColor );
#endif
}`,depthTest:!1,depthWrite:!1}),d=new Il(u,c),g=new Pg(-1,1,1,-1,0,1);let v=null,M=null,B=!1,I,ne=null,ee=[],q=!1;this.setSize=function(ye,Ce){a.setSize(ye,Ce),o.setSize(ye,Ce);for(let ke=0;ke<ee.length;ke++){const nt=ee[ke];nt.setSize&&nt.setSize(ye,Ce)}},this.setEffects=function(ye){ee=ye,q=ee.length>0&&ee[0].isRenderPass===!0;const Ce=a.width,ke=a.height;for(let nt=0;nt<ee.length;nt++){const Ye=ee[nt];Ye.setSize&&Ye.setSize(Ce,ke)}},this.begin=function(ye,Ce){if(B||ye.toneMapping===Ct&&ee.length===0)return!1;if(ne=Ce,Ce!==null){const ke=Ce.width,nt=Ce.height;(a.width!==ke||a.height!==nt)&&this.setSize(ke,nt)}return q===!1&&ye.setRenderTarget(a),I=ye.toneMapping,ye.toneMapping=Ct,!0},this.hasRenderPass=function(){return q},this.end=function(ye,Ce){ye.toneMapping=I,B=!0;let ke=a,nt=o;for(let Ye=0;Ye<ee.length;Ye++){const ht=ee[Ye];if(ht.enabled!==!1&&(ht.render(ye,nt,ke,Ce),ht.needsSwap!==!1)){const Rt=ke;ke=nt,nt=Rt}}if(v!==ye.outputColorSpace||M!==ye.toneMapping){v=ye.outputColorSpace,M=ye.toneMapping,c.defines={},xr.getTransfer(v)===ws&&(c.defines.SRGB_TRANSFER="");const Ye=qO[M];Ye&&(c.defines[Ye]=""),c.needsUpdate=!0}c.uniforms.tDiffuse.value=ke.texture,ye.setRenderTarget(ne),ye.render(d,g),ne=null,B=!1},this.isCompositing=function(){return B},this.dispose=function(){a.dispose(),o.dispose(),u.dispose(),c.dispose()}}const TC=new zi,t1=new Al(1,1),BC=new _a,RC=new oe,IC=new rh,NC=[],FC=[],PC=new Float32Array(16),LC=new Float32Array(9),UC=new Float32Array(4);function hv(s,e,t){const n=s[0];if(n<=0||n>0)return s;const i=e*t;let a=NC[i];if(a===void 0&&(a=new Float32Array(i),NC[i]=a),e!==0){n.toArray(a,0);for(let o=1,u=0;o!==e;++o)u+=t,s[o].toArray(a,u)}return a}function Nh(s,e){if(s.length!==e.length)return!1;for(let t=0,n=s.length;t<n;t++)if(s[t]!==e[t])return!1;return!0}function Fh(s,e){for(let t=0,n=e.length;t<n;t++)s[t]=e[t]}function ub(s,e){let t=FC[e];t===void 0&&(t=new Int32Array(e),FC[e]=t);for(let n=0;n!==e;++n)t[n]=s.allocateTextureUnit();return t}function eD(s,e){const t=this.cache;t[0]!==e&&(s.uniform1f(this.addr,e),t[0]=e)}function tD(s,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(s.uniform2f(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(Nh(t,e))return;s.uniform2fv(this.addr,e),Fh(t,e)}}function nD(s,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(s.uniform3f(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else if(e.r!==void 0)(t[0]!==e.r||t[1]!==e.g||t[2]!==e.b)&&(s.uniform3f(this.addr,e.r,e.g,e.b),t[0]=e.r,t[1]=e.g,t[2]=e.b);else{if(Nh(t,e))return;s.uniform3fv(this.addr,e),Fh(t,e)}}function rD(s,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(s.uniform4f(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(Nh(t,e))return;s.uniform4fv(this.addr,e),Fh(t,e)}}function iD(s,e){const t=this.cache,n=e.elements;if(n===void 0){if(Nh(t,e))return;s.uniformMatrix2fv(this.addr,!1,e),Fh(t,e)}else{if(Nh(t,n))return;UC.set(n),s.uniformMatrix2fv(this.addr,!1,UC),Fh(t,n)}}function sD(s,e){const t=this.cache,n=e.elements;if(n===void 0){if(Nh(t,e))return;s.uniformMatrix3fv(this.addr,!1,e),Fh(t,e)}else{if(Nh(t,n))return;LC.set(n),s.uniformMatrix3fv(this.addr,!1,LC),Fh(t,n)}}function aD(s,e){const t=this.cache,n=e.elements;if(n===void 0){if(Nh(t,e))return;s.uniformMatrix4fv(this.addr,!1,e),Fh(t,e)}else{if(Nh(t,n))return;PC.set(n),s.uniformMatrix4fv(this.addr,!1,PC),Fh(t,n)}}function oD(s,e){const t=this.cache;t[0]!==e&&(s.uniform1i(this.addr,e),t[0]=e)}function lD(s,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(s.uniform2i(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(Nh(t,e))return;s.uniform2iv(this.addr,e),Fh(t,e)}}function uD(s,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(s.uniform3i(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(Nh(t,e))return;s.uniform3iv(this.addr,e),Fh(t,e)}}function cD(s,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(s.uniform4i(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(Nh(t,e))return;s.uniform4iv(this.addr,e),Fh(t,e)}}function hD(s,e){const t=this.cache;t[0]!==e&&(s.uniform1ui(this.addr,e),t[0]=e)}function dD(s,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(s.uniform2ui(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(Nh(t,e))return;s.uniform2uiv(this.addr,e),Fh(t,e)}}function fD(s,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(s.uniform3ui(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(Nh(t,e))return;s.uniform3uiv(this.addr,e),Fh(t,e)}}function AD(s,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(s.uniform4ui(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(Nh(t,e))return;s.uniform4uiv(this.addr,e),Fh(t,e)}}function pD(s,e,t){const n=this.cache,i=t.allocateTextureUnit();n[0]!==i&&(s.uniform1i(this.addr,i),n[0]=i);let a;this.type===s.SAMPLER_2D_SHADOW?(t1.compareFunction=t.isReversedDepthBuffer()?Ji:jc,a=t1):a=TC,t.setTexture2D(e||a,i)}function gD(s,e,t){const n=this.cache,i=t.allocateTextureUnit();n[0]!==i&&(s.uniform1i(this.addr,i),n[0]=i),t.setTexture3D(e||RC,i)}function mD(s,e,t){const n=this.cache,i=t.allocateTextureUnit();n[0]!==i&&(s.uniform1i(this.addr,i),n[0]=i),t.setTextureCube(e||IC,i)}function vD(s,e,t){const n=this.cache,i=t.allocateTextureUnit();n[0]!==i&&(s.uniform1i(this.addr,i),n[0]=i),t.setTexture2DArray(e||BC,i)}function yD(s){switch(s){case 5126:return eD;case 35664:return tD;case 35665:return nD;case 35666:return rD;case 35674:return iD;case 35675:return sD;case 35676:return aD;case 5124:case 35670:return oD;case 35667:case 35671:return lD;case 35668:case 35672:return uD;case 35669:case 35673:return cD;case 5125:return hD;case 36294:return dD;case 36295:return fD;case 36296:return AD;case 35678:case 36198:case 36298:case 36306:case 35682:return pD;case 35679:case 36299:case 36307:return gD;case 35680:case 36300:case 36308:case 36293:return mD;case 36289:case 36303:case 36311:case 36292:return vD}}function xD(s,e){s.uniform1fv(this.addr,e)}function bD(s,e){const t=hv(e,this.size,2);s.uniform2fv(this.addr,t)}function _D(s,e){const t=hv(e,this.size,3);s.uniform3fv(this.addr,t)}function wD(s,e){const t=hv(e,this.size,4);s.uniform4fv(this.addr,t)}function SD(s,e){const t=hv(e,this.size,4);s.uniformMatrix2fv(this.addr,!1,t)}function MD(s,e){const t=hv(e,this.size,9);s.uniformMatrix3fv(this.addr,!1,t)}function ED(s,e){const t=hv(e,this.size,16);s.uniformMatrix4fv(this.addr,!1,t)}function CD(s,e){s.uniform1iv(this.addr,e)}function TD(s,e){s.uniform2iv(this.addr,e)}function BD(s,e){s.uniform3iv(this.addr,e)}function RD(s,e){s.uniform4iv(this.addr,e)}function ID(s,e){s.uniform1uiv(this.addr,e)}function ND(s,e){s.uniform2uiv(this.addr,e)}function FD(s,e){s.uniform3uiv(this.addr,e)}function PD(s,e){s.uniform4uiv(this.addr,e)}function LD(s,e,t){const n=this.cache,i=e.length,a=ub(t,i);Nh(n,a)||(s.uniform1iv(this.addr,a),Fh(n,a));let o;this.type===s.SAMPLER_2D_SHADOW?o=t1:o=TC;for(let u=0;u!==i;++u)t.setTexture2D(e[u]||o,a[u])}function UD(s,e,t){const n=this.cache,i=e.length,a=ub(t,i);Nh(n,a)||(s.uniform1iv(this.addr,a),Fh(n,a));for(let o=0;o!==i;++o)t.setTexture3D(e[o]||RC,a[o])}function OD(s,e,t){const n=this.cache,i=e.length,a=ub(t,i);Nh(n,a)||(s.uniform1iv(this.addr,a),Fh(n,a));for(let o=0;o!==i;++o)t.setTextureCube(e[o]||IC,a[o])}function DD(s,e,t){const n=this.cache,i=e.length,a=ub(t,i);Nh(n,a)||(s.uniform1iv(this.addr,a),Fh(n,a));for(let o=0;o!==i;++o)t.setTexture2DArray(e[o]||BC,a[o])}function kD(s){switch(s){case 5126:return xD;case 35664:return bD;case 35665:return _D;case 35666:return wD;case 35674:return SD;case 35675:return MD;case 35676:return ED;case 5124:case 35670:return CD;case 35667:case 35671:return TD;case 35668:case 35672:return BD;case 35669:case 35673:return RD;case 5125:return ID;case 36294:return ND;case 36295:return FD;case 36296:return PD;case 35678:case 36198:case 36298:case 36306:case 35682:return LD;case 35679:case 36299:case 36307:return UD;case 35680:case 36300:case 36308:case 36293:return OD;case 36289:case 36303:case 36311:case 36292:return DD}}class VD{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.setValue=yD(t.type)}}class zD{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.size=t.size,this.setValue=kD(t.type)}}class GD{constructor(e){this.id=e,this.seq=[],this.map={}}setValue(e,t,n){const i=this.seq;for(let a=0,o=i.length;a!==o;++a){const u=i[a];u.setValue(e,t[u.id],n)}}}const n1=/(\w+)(\])?(\[|\.)?/g;function OC(s,e){s.seq.push(e),s.map[e.id]=e}function HD(s,e,t){const n=s.name,i=n.length;for(n1.lastIndex=0;;){const a=n1.exec(n),o=n1.lastIndex;let u=a[1];const c=a[2]==="]",d=a[3];if(c&&(u=u|0),d===void 0||d==="["&&o+2===i){OC(t,d===void 0?new VD(u,s,e):new zD(u,s,e));break}else{let v=t.map[u];v===void 0&&(v=new GD(u),OC(t,v)),t=v}}}class cb{constructor(e,t){this.seq=[],this.map={};const n=e.getProgramParameter(t,e.ACTIVE_UNIFORMS);for(let o=0;o<n;++o){const u=e.getActiveUniform(t,o),c=e.getUniformLocation(t,u.name);HD(u,c,this)}const i=[],a=[];for(const o of this.seq)o.type===e.SAMPLER_2D_SHADOW||o.type===e.SAMPLER_CUBE_SHADOW||o.type===e.SAMPLER_2D_ARRAY_SHADOW?i.push(o):a.push(o);i.length>0&&(this.seq=i.concat(a))}setValue(e,t,n,i){const a=this.map[t];a!==void 0&&a.setValue(e,n,i)}setOptional(e,t,n){const i=t[n];i!==void 0&&this.setValue(e,n,i)}static upload(e,t,n,i){for(let a=0,o=t.length;a!==o;++a){const u=t[a],c=n[u.id];c.needsUpdate!==!1&&u.setValue(e,c.value,i)}}static seqWithValue(e,t){const n=[];for(let i=0,a=e.length;i!==a;++i){const o=e[i];o.id in t&&n.push(o)}return n}}function DC(s,e,t){const n=s.createShader(e);return s.shaderSource(n,t),s.compileShader(n),n}const QD=37297;let WD=0;function ZD(s,e){const t=s.split(`
`),n=[],i=Math.max(e-6,0),a=Math.min(e+6,t.length);for(let o=i;o<a;o++){const u=o+1;n.push(`${u===e?">":" "} ${u}: ${t[o]}`)}return n.join(`
`)}const kC=new pn;function KD(s){xr._getMatrix(kC,xr.workingColorSpace,s);const e=`mat3( ${kC.elements.map(t=>t.toFixed(4))} )`;switch(xr.getTransfer(s)){case Uu:return[e,"LinearTransferOETF"];case ws:return[e,"sRGBTransferOETF"];default:return Lr("WebGLProgram: Unsupported color space: ",s),[e,"LinearTransferOETF"]}}function VC(s,e,t){const n=s.getShaderParameter(e,s.COMPILE_STATUS),a=(s.getShaderInfoLog(e)||"").trim();if(n&&a==="")return"";const o=/ERROR: 0:(\d+)/.exec(a);if(o){const u=parseInt(o[1]);return t.toUpperCase()+`
`+a+`
`+ZD(s.getShaderSource(e),u)}else return a}function $D(s,e){const t=KD(e);return[`vec4 ${s}( vec4 value ) {`,` return ${t[1]}( vec4( value.rgb * ${t[0]}, value.a ) );`,"}"].join(`
`)}const XD={[sn]:"Linear",[W]:"Reinhard",[Se]:"Cineon",[Ht]:"ACESFilmic",[Fn]:"AgX",[Tn]:"Neutral",[zt]:"Custom"};function jD(s,e){const t=XD[e];return t===void 0?(Lr("WebGLProgram: Unsupported toneMapping:",e),"vec3 "+s+"( vec3 color ) { return LinearToneMapping( color ); }"):"vec3 "+s+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}const hb=new le;function YD(){xr.getLuminanceCoefficients(hb);const s=hb.x.toFixed(4),e=hb.y.toFixed(4),t=hb.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",` const vec3 weights = vec3( ${s}, ${e}, ${t} );`," return dot( weights, rgb );","}"].join(`
`)}function qD(s){return[s.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",s.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(Sy).join(`
`)}function JD(s){const e=[];for(const t in s){const n=s[t];n!==!1&&e.push("#define "+t+" "+n)}return e.join(`
`)}function e3(s,e){const t={},n=s.getProgramParameter(e,s.ACTIVE_ATTRIBUTES);for(let i=0;i<n;i++){const a=s.getActiveAttrib(e,i),o=a.name;let u=1;a.type===s.FLOAT_MAT2&&(u=2),a.type===s.FLOAT_MAT3&&(u=3),a.type===s.FLOAT_MAT4&&(u=4),t[o]={type:a.type,location:s.getAttribLocation(e,o),locationSize:u}}return t}function Sy(s){return s!==""}function zC(s,e){const t=e.numSpotLightShadows+e.numSpotLightMaps-e.numSpotLightShadowsWithMaps;return s.replace(/NUM_DIR_LIGHTS/g,e.numDirLights).replace(/NUM_SPOT_LIGHTS/g,e.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,e.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,t).replace(/NUM_RECT_AREA_LIGHTS/g,e.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,e.numPointLights).replace(/NUM_HEMI_LIGHTS/g,e.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,e.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,e.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,e.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,e.numPointLightShadows)}function GC(s,e){return s.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}const t3=/^[ \t]*#include +<([\w\d./]+)>/gm;function r1(s){return s.replace(t3,r3)}const n3=new Map;function r3(s,e){let t=Vo[e];if(t===void 0){const n=n3.get(e);if(n!==void 0)t=Vo[n],Lr('WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,n);else throw new Error("Can not resolve #include <"+e+">")}return r1(t)}const i3=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function HC(s){return s.replace(i3,s3)}function s3(s,e,t,n){let i="";for(let a=parseInt(e);a<parseInt(t);a++)i+=n.replace(/\[\s*i\s*\]/g,"[ "+a+" ]").replace(/UNROLLED_LOOP_INDEX/g,a);return i}function QC(s){let e=`precision ${s.precision} float;
precision ${s.precision} int;
precision ${s.precision} sampler2D;
precision ${s.precision} samplerCube;
precision ${s.precision} sampler3D;
precision ${s.precision} sampler2DArray;
precision ${s.precision} sampler2DShadow;
precision ${s.precision} samplerCubeShadow;
precision ${s.precision} sampler2DArrayShadow;
precision ${s.precision} isampler2D;
precision ${s.precision} isampler3D;
precision ${s.precision} isamplerCube;
precision ${s.precision} isampler2DArray;
precision ${s.precision} usampler2D;
precision ${s.precision} usampler3D;
precision ${s.precision} usamplerCube;
precision ${s.precision} usampler2DArray;
`;return s.precision==="highp"?e+=`
#define HIGH_PRECISION`:s.precision==="mediump"?e+=`
#define MEDIUM_PRECISION`:s.precision==="lowp"&&(e+=`
#define LOW_PRECISION`),e}const a3={[H]:"SHADOWMAP_TYPE_PCF",[X]:"SHADOWMAP_TYPE_VSM"};function o3(s){return a3[s.shadowMapType]||"SHADOWMAP_TYPE_BASIC"}const l3={[it]:"ENVMAP_TYPE_CUBE",[wt]:"ENVMAP_TYPE_CUBE",[_t]:"ENVMAP_TYPE_CUBE_UV"};function u3(s){return s.envMap===!1?"ENVMAP_TYPE_CUBE":l3[s.envMapMode]||"ENVMAP_TYPE_CUBE"}const c3={[wt]:"ENVMAP_MODE_REFRACTION"};function h3(s){return s.envMap===!1?"ENVMAP_MODE_REFLECTION":c3[s.envMapMode]||"ENVMAP_MODE_REFLECTION"}const d3={[on]:"ENVMAP_BLENDING_MULTIPLY",[hn]:"ENVMAP_BLENDING_MIX",[lt]:"ENVMAP_BLENDING_ADD"};function f3(s){return s.envMap===!1?"ENVMAP_BLENDING_NONE":d3[s.combine]||"ENVMAP_BLENDING_NONE"}function A3(s){const e=s.envMapCubeUVHeight;if(e===null)return null;const t=Math.log2(e)-2,n=1/e;return{texelWidth:1/(3*Math.max(Math.pow(2,t),7*16)),texelHeight:n,maxMip:t}}function p3(s,e,t,n){const i=s.getContext(),a=t.defines;let o=t.vertexShader,u=t.fragmentShader;const c=o3(t),d=u3(t),g=h3(t),v=f3(t),M=A3(t),B=qD(t),I=JD(a),ne=i.createProgram();let ee,q,ye=t.glslVersion?"#version "+t.glslVersion+`
`:"";t.isRawShaderMaterial?(ee=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,I].filter(Sy).join(`
`),ee.length>0&&(ee+=`
`),q=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,I].filter(Sy).join(`
`),q.length>0&&(q+=`
`)):(ee=[QC(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,I,t.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",t.batching?"#define USE_BATCHING":"",t.batchingColor?"#define USE_BATCHING_COLOR":"",t.instancing?"#define USE_INSTANCING":"",t.instancingColor?"#define USE_INSTANCING_COLOR":"",t.instancingMorph?"#define USE_INSTANCING_MORPH":"",t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+g:"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.displacementMap?"#define USE_DISPLACEMENTMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.mapUv?"#define MAP_UV "+t.mapUv:"",t.alphaMapUv?"#define ALPHAMAP_UV "+t.alphaMapUv:"",t.lightMapUv?"#define LIGHTMAP_UV "+t.lightMapUv:"",t.aoMapUv?"#define AOMAP_UV "+t.aoMapUv:"",t.emissiveMapUv?"#define EMISSIVEMAP_UV "+t.emissiveMapUv:"",t.bumpMapUv?"#define BUMPMAP_UV "+t.bumpMapUv:"",t.normalMapUv?"#define NORMALMAP_UV "+t.normalMapUv:"",t.displacementMapUv?"#define DISPLACEMENTMAP_UV "+t.displacementMapUv:"",t.metalnessMapUv?"#define METALNESSMAP_UV "+t.metalnessMapUv:"",t.roughnessMapUv?"#define ROUGHNESSMAP_UV "+t.roughnessMapUv:"",t.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+t.anisotropyMapUv:"",t.clearcoatMapUv?"#define CLEARCOATMAP_UV "+t.clearcoatMapUv:"",t.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+t.clearcoatNormalMapUv:"",t.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+t.clearcoatRoughnessMapUv:"",t.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+t.iridescenceMapUv:"",t.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+t.iridescenceThicknessMapUv:"",t.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+t.sheenColorMapUv:"",t.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+t.sheenRoughnessMapUv:"",t.specularMapUv?"#define SPECULARMAP_UV "+t.specularMapUv:"",t.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+t.specularColorMapUv:"",t.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+t.specularIntensityMapUv:"",t.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+t.transmissionMapUv:"",t.thicknessMapUv?"#define THICKNESSMAP_UV "+t.thicknessMapUv:"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.flatShading?"#define FLAT_SHADED":"",t.skinning?"#define USE_SKINNING":"",t.morphTargets?"#define USE_MORPHTARGETS":"",t.morphNormals&&t.flatShading===!1?"#define USE_MORPHNORMALS":"",t.morphColors?"#define USE_MORPHCOLORS":"",t.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+t.morphTextureStride:"",t.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+t.morphTargetsCount:"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+c:"",t.sizeAttenuation?"#define USE_SIZEATTENUATION":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",t.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING"," attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR"," attribute vec3 instanceColor;","#endif","#ifdef USE_INSTANCING_MORPH"," uniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1"," attribute vec2 uv1;","#endif","#ifdef USE_UV2"," attribute vec2 uv2;","#endif","#ifdef USE_UV3"," attribute vec2 uv3;","#endif","#ifdef USE_TANGENT"," attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )"," attribute vec4 color;","#elif defined( USE_COLOR )"," attribute vec3 color;","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif",`
`].filter(Sy).join(`
`),q=[QC(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,I,t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",t.map?"#define USE_MAP":"",t.matcap?"#define USE_MATCAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+d:"",t.envMap?"#define "+g:"",t.envMap?"#define "+v:"",M?"#define CUBEUV_TEXEL_WIDTH "+M.texelWidth:"",M?"#define CUBEUV_TEXEL_HEIGHT "+M.texelHeight:"",M?"#define CUBEUV_MAX_MIP "+M.maxMip+".0":"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoat?"#define USE_CLEARCOAT":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.dispersion?"#define USE_DISPERSION":"",t.iridescence?"#define USE_IRIDESCENCE":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaTest?"#define USE_ALPHATEST":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.sheen?"#define USE_SHEEN":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors||t.instancingColor||t.batchingColor?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.gradientMap?"#define USE_GRADIENTMAP":"",t.flatShading?"#define FLAT_SHADED":"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+c:"",t.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",t.decodeVideoTextureEmissive?"#define DECODE_VIDEO_TEXTURE_EMISSIVE":"",t.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",t.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",t.toneMapping!==Ct?"#define TONE_MAPPING":"",t.toneMapping!==Ct?Vo.tonemapping_pars_fragment:"",t.toneMapping!==Ct?jD("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",Vo.colorspace_pars_fragment,$D("linearToOutputTexel",t.outputColorSpace),YD(),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",`
`].filter(Sy).join(`
`)),o=r1(o),o=zC(o,t),o=GC(o,t),u=r1(u),u=zC(u,t),u=GC(u,t),o=HC(o),u=HC(u),t.isRawShaderMaterial!==!0&&(ye=`#version 300 es
`,ee=[B,"#define attribute in","#define varying out","#define texture2D texture"].join(`
`)+`
`+ee,q=["#define varying in",t.glslVersion===Yc?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===Yc?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join(`
`)+`
`+q);const Ce=ye+ee+o,ke=ye+q+u,nt=DC(i,i.VERTEX_SHADER,Ce),Ye=DC(i,i.FRAGMENT_SHADER,ke);i.attachShader(ne,nt),i.attachShader(ne,Ye),t.index0AttributeName!==void 0?i.bindAttribLocation(ne,0,t.index0AttributeName):t.morphTargets===!0&&i.bindAttribLocation(ne,0,"position"),i.linkProgram(ne);function ht(xn){if(s.debug.checkShaderErrors){const cr=i.getProgramInfoLog(ne)||"",pr=i.getShaderInfoLog(nt)||"",Br=i.getShaderInfoLog(Ye)||"",zr=cr.trim(),Dr=pr.trim(),Zr=Br.trim();let Ti=!0,ds=!0;if(i.getProgramParameter(ne,i.LINK_STATUS)===!1)if(Ti=!1,typeof s.debug.onShaderError=="function")s.debug.onShaderError(i,ne,nt,Ye);else{const As=VC(i,nt,"vertex"),Xr=VC(i,Ye,"fragment");Gr("THREE.WebGLProgram: Shader Error "+i.getError()+" - VALIDATE_STATUS "+i.getProgramParameter(ne,i.VALIDATE_STATUS)+`
Material Name: `+xn.name+`
Material Type: `+xn.type+`
Program Info Log: `+zr+`
`+As+`
`+Xr)}else zr!==""?Lr("WebGLProgram: Program Info Log:",zr):(Dr===""||Zr==="")&&(ds=!1);ds&&(xn.diagnostics={runnable:Ti,programLog:zr,vertexShader:{log:Dr,prefix:ee},fragmentShader:{log:Zr,prefix:q}})}i.deleteShader(nt),i.deleteShader(Ye),Rt=new cb(i,ne),qe=e3(i,ne)}let Rt;this.getUniforms=function(){return Rt===void 0&&ht(this),Rt};let qe;this.getAttributes=function(){return qe===void 0&&ht(this),qe};let pt=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return pt===!1&&(pt=i.getProgramParameter(ne,QD)),pt},this.destroy=function(){n.releaseStatesOfProgram(this),i.deleteProgram(ne),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=WD++,this.cacheKey=e,this.usedTimes=1,this.program=ne,this.vertexShader=nt,this.fragmentShader=Ye,this}let g3=0;class m3{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const t=e.vertexShader,n=e.fragmentShader,i=this._getShaderStage(t),a=this._getShaderStage(n),o=this._getShaderCacheForMaterial(e);return o.has(i)===!1&&(o.add(i),i.usedTimes++),o.has(a)===!1&&(o.add(a),a.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 v3(e),t.set(e,n)),n}}class v3{constructor(e){this.id=g3++,this.code=e,this.usedTimes=0}}function y3(s,e,t,n,i,a,o){const u=new dl,c=new m3,d=new Set,g=[],v=new Map,M=i.logarithmicDepthBuffer;let B=i.precision;const I={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distance",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 ne(qe){return d.add(qe),qe===0?"uv":`uv${qe}`}function ee(qe,pt,xn,cr,pr){const Br=cr.fog,zr=pr.geometry,Dr=qe.isMeshStandardMaterial?cr.environment:null,Zr=(qe.isMeshStandardMaterial?t:e).get(qe.envMap||Dr),Ti=Zr&&Zr.mapping===_t?Zr.image.height:null,ds=I[qe.type];qe.precision!==null&&(B=i.getMaxPrecision(qe.precision),B!==qe.precision&&Lr("WebGLProgram.getParameters:",qe.precision,"not supported, using",B,"instead."));const As=zr.morphAttributes.position||zr.morphAttributes.normal||zr.morphAttributes.color,Xr=As!==void 0?As.length:0;let Yi=0;zr.morphAttributes.position!==void 0&&(Yi=1),zr.morphAttributes.normal!==void 0&&(Yi=2),zr.morphAttributes.color!==void 0&&(Yi=3);let ps,Xa,Pi,Nr;if(ds){const fu=Jp[ds];ps=fu.vertexShader,Xa=fu.fragmentShader}else ps=qe.vertexShader,Xa=qe.fragmentShader,c.update(qe),Pi=c.getVertexShaderID(qe),Nr=c.getFragmentShaderID(qe);const Yr=s.getRenderTarget(),cs=s.state.buffers.depth.getReversed(),oa=pr.isInstancedMesh===!0,Ms=pr.isBatchedMesh===!0,Ha=!!qe.map,Qo=!!qe.matcap,co=!!Zr,Li=!!qe.aoMap,os=!!qe.lightMap,Hi=!!qe.bumpMap,Fs=!!qe.normalMap,Pn=!!qe.displacementMap,ja=!!qe.emissiveMap,da=!!qe.metalnessMap,ho=!!qe.roughnessMap,Ps=qe.anisotropy>0,Mn=qe.clearcoat>0,St=qe.dispersion>0,Cr=qe.iridescence>0,xi=qe.sheen>0,Qi=qe.transmission>0,Si=Ps&&!!qe.anisotropyMap,La=Mn&&!!qe.clearcoatMap,Vs=Mn&&!!qe.clearcoatNormalMap,Na=Mn&&!!qe.clearcoatRoughnessMap,po=Cr&&!!qe.iridescenceMap,hs=Cr&&!!qe.iridescenceThicknessMap,js=xi&&!!qe.sheenColorMap,Fa=xi&&!!qe.sheenRoughnessMap,Va=!!qe.specularMap,$s=!!qe.specularColorMap,Wo=!!qe.specularIntensityMap,Mr=Qi&&!!qe.transmissionMap,la=Qi&&!!qe.thicknessMap,Ts=!!qe.gradientMap,ga=!!qe.alphaMap,gs=qe.alphaTest>0,Wi=!!qe.alphaHash,Ws=!!qe.extensions;let Eo=Ct;qe.toneMapped&&(Yr===null||Yr.isXRRenderTarget===!0)&&(Eo=s.toneMapping);const Wu={shaderID:ds,shaderType:qe.type,shaderName:qe.name,vertexShader:ps,fragmentShader:Xa,defines:qe.defines,customVertexShaderID:Pi,customFragmentShaderID:Nr,isRawShaderMaterial:qe.isRawShaderMaterial===!0,glslVersion:qe.glslVersion,precision:B,batching:Ms,batchingColor:Ms&&pr._colorsTexture!==null,instancing:oa,instancingColor:oa&&pr.instanceColor!==null,instancingMorph:oa&&pr.morphTexture!==null,outputColorSpace:Yr===null?s.outputColorSpace:Yr.isXRRenderTarget===!0?Yr.texture.colorSpace:No,alphaToCoverage:!!qe.alphaToCoverage,map:Ha,matcap:Qo,envMap:co,envMapMode:co&&Zr.mapping,envMapCubeUVHeight:Ti,aoMap:Li,lightMap:os,bumpMap:Hi,normalMap:Fs,displacementMap:Pn,emissiveMap:ja,normalMapObjectSpace:Fs&&qe.normalMapType===Lu,normalMapTangentSpace:Fs&&qe.normalMapType===Ll,metalnessMap:da,roughnessMap:ho,anisotropy:Ps,anisotropyMap:Si,clearcoat:Mn,clearcoatMap:La,clearcoatNormalMap:Vs,clearcoatRoughnessMap:Na,dispersion:St,iridescence:Cr,iridescenceMap:po,iridescenceThicknessMap:hs,sheen:xi,sheenColorMap:js,sheenRoughnessMap:Fa,specularMap:Va,specularColorMap:$s,specularIntensityMap:Wo,transmission:Qi,transmissionMap:Mr,thicknessMap:la,gradientMap:Ts,opaque:qe.transparent===!1&&qe.blending===ve&&qe.alphaToCoverage===!1,alphaMap:ga,alphaTest:gs,alphaHash:Wi,combine:qe.combine,mapUv:Ha&&ne(qe.map.channel),aoMapUv:Li&&ne(qe.aoMap.channel),lightMapUv:os&&ne(qe.lightMap.channel),bumpMapUv:Hi&&ne(qe.bumpMap.channel),normalMapUv:Fs&&ne(qe.normalMap.channel),displacementMapUv:Pn&&ne(qe.displacementMap.channel),emissiveMapUv:ja&&ne(qe.emissiveMap.channel),metalnessMapUv:da&&ne(qe.metalnessMap.channel),roughnessMapUv:ho&&ne(qe.roughnessMap.channel),anisotropyMapUv:Si&&ne(qe.anisotropyMap.channel),clearcoatMapUv:La&&ne(qe.clearcoatMap.channel),clearcoatNormalMapUv:Vs&&ne(qe.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:Na&&ne(qe.clearcoatRoughnessMap.channel),iridescenceMapUv:po&&ne(qe.iridescenceMap.channel),iridescenceThicknessMapUv:hs&&ne(qe.iridescenceThicknessMap.channel),sheenColorMapUv:js&&ne(qe.sheenColorMap.channel),sheenRoughnessMapUv:Fa&&ne(qe.sheenRoughnessMap.channel),specularMapUv:Va&&ne(qe.specularMap.channel),specularColorMapUv:$s&&ne(qe.specularColorMap.channel),specularIntensityMapUv:Wo&&ne(qe.specularIntensityMap.channel),transmissionMapUv:Mr&&ne(qe.transmissionMap.channel),thicknessMapUv:la&&ne(qe.thicknessMap.channel),alphaMapUv:ga&&ne(qe.alphaMap.channel),vertexTangents:!!zr.attributes.tangent&&(Fs||Ps),vertexColors:qe.vertexColors,vertexAlphas:qe.vertexColors===!0&&!!zr.attributes.color&&zr.attributes.color.itemSize===4,pointsUvs:pr.isPoints===!0&&!!zr.attributes.uv&&(Ha||ga),fog:!!Br,useFog:qe.fog===!0,fogExp2:!!Br&&Br.isFogExp2,flatShading:qe.flatShading===!0&&qe.wireframe===!1,sizeAttenuation:qe.sizeAttenuation===!0,logarithmicDepthBuffer:M,reversedDepthBuffer:cs,skinning:pr.isSkinnedMesh===!0,morphTargets:zr.morphAttributes.position!==void 0,morphNormals:zr.morphAttributes.normal!==void 0,morphColors:zr.morphAttributes.color!==void 0,morphTargetsCount:Xr,morphTextureStride:Yi,numDirLights:pt.directional.length,numPointLights:pt.point.length,numSpotLights:pt.spot.length,numSpotLightMaps:pt.spotLightMap.length,numRectAreaLights:pt.rectArea.length,numHemiLights:pt.hemi.length,numDirLightShadows:pt.directionalShadowMap.length,numPointLightShadows:pt.pointShadowMap.length,numSpotLightShadows:pt.spotShadowMap.length,numSpotLightShadowsWithMaps:pt.numSpotLightShadowsWithMaps,numLightProbes:pt.numLightProbes,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,dithering:qe.dithering,shadowMapEnabled:s.shadowMap.enabled&&xn.length>0,shadowMapType:s.shadowMap.type,toneMapping:Eo,decodeVideoTexture:Ha&&qe.map.isVideoTexture===!0&&xr.getTransfer(qe.map.colorSpace)===ws,decodeVideoTextureEmissive:ja&&qe.emissiveMap.isVideoTexture===!0&&xr.getTransfer(qe.emissiveMap.colorSpace)===ws,premultipliedAlpha:qe.premultipliedAlpha,doubleSided:qe.side===he,flipSided:qe.side===de,useDepthPacking:qe.depthPacking>=0,depthPacking:qe.depthPacking||0,index0AttributeName:qe.index0AttributeName,extensionClipCullDistance:Ws&&qe.extensions.clipCullDistance===!0&&n.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(Ws&&qe.extensions.multiDraw===!0||Ms)&&n.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:n.has("KHR_parallel_shader_compile"),customProgramCacheKey:qe.customProgramCacheKey()};return Wu.vertexUv1s=d.has(1),Wu.vertexUv2s=d.has(2),Wu.vertexUv3s=d.has(3),d.clear(),Wu}function q(qe){const pt=[];if(qe.shaderID?pt.push(qe.shaderID):(pt.push(qe.customVertexShaderID),pt.push(qe.customFragmentShaderID)),qe.defines!==void 0)for(const xn in qe.defines)pt.push(xn),pt.push(qe.defines[xn]);return qe.isRawShaderMaterial===!1&&(ye(pt,qe),Ce(pt,qe),pt.push(s.outputColorSpace)),pt.push(qe.customProgramCacheKey),pt.join()}function ye(qe,pt){qe.push(pt.precision),qe.push(pt.outputColorSpace),qe.push(pt.envMapMode),qe.push(pt.envMapCubeUVHeight),qe.push(pt.mapUv),qe.push(pt.alphaMapUv),qe.push(pt.lightMapUv),qe.push(pt.aoMapUv),qe.push(pt.bumpMapUv),qe.push(pt.normalMapUv),qe.push(pt.displacementMapUv),qe.push(pt.emissiveMapUv),qe.push(pt.metalnessMapUv),qe.push(pt.roughnessMapUv),qe.push(pt.anisotropyMapUv),qe.push(pt.clearcoatMapUv),qe.push(pt.clearcoatNormalMapUv),qe.push(pt.clearcoatRoughnessMapUv),qe.push(pt.iridescenceMapUv),qe.push(pt.iridescenceThicknessMapUv),qe.push(pt.sheenColorMapUv),qe.push(pt.sheenRoughnessMapUv),qe.push(pt.specularMapUv),qe.push(pt.specularColorMapUv),qe.push(pt.specularIntensityMapUv),qe.push(pt.transmissionMapUv),qe.push(pt.thicknessMapUv),qe.push(pt.combine),qe.push(pt.fogExp2),qe.push(pt.sizeAttenuation),qe.push(pt.morphTargetsCount),qe.push(pt.morphAttributeCount),qe.push(pt.numDirLights),qe.push(pt.numPointLights),qe.push(pt.numSpotLights),qe.push(pt.numSpotLightMaps),qe.push(pt.numHemiLights),qe.push(pt.numRectAreaLights),qe.push(pt.numDirLightShadows),qe.push(pt.numPointLightShadows),qe.push(pt.numSpotLightShadows),qe.push(pt.numSpotLightShadowsWithMaps),qe.push(pt.numLightProbes),qe.push(pt.shadowMapType),qe.push(pt.toneMapping),qe.push(pt.numClippingPlanes),qe.push(pt.numClipIntersection),qe.push(pt.depthPacking)}function Ce(qe,pt){u.disableAll(),pt.instancing&&u.enable(0),pt.instancingColor&&u.enable(1),pt.instancingMorph&&u.enable(2),pt.matcap&&u.enable(3),pt.envMap&&u.enable(4),pt.normalMapObjectSpace&&u.enable(5),pt.normalMapTangentSpace&&u.enable(6),pt.clearcoat&&u.enable(7),pt.iridescence&&u.enable(8),pt.alphaTest&&u.enable(9),pt.vertexColors&&u.enable(10),pt.vertexAlphas&&u.enable(11),pt.vertexUv1s&&u.enable(12),pt.vertexUv2s&&u.enable(13),pt.vertexUv3s&&u.enable(14),pt.vertexTangents&&u.enable(15),pt.anisotropy&&u.enable(16),pt.alphaHash&&u.enable(17),pt.batching&&u.enable(18),pt.dispersion&&u.enable(19),pt.batchingColor&&u.enable(20),pt.gradientMap&&u.enable(21),qe.push(u.mask),u.disableAll(),pt.fog&&u.enable(0),pt.useFog&&u.enable(1),pt.flatShading&&u.enable(2),pt.logarithmicDepthBuffer&&u.enable(3),pt.reversedDepthBuffer&&u.enable(4),pt.skinning&&u.enable(5),pt.morphTargets&&u.enable(6),pt.morphNormals&&u.enable(7),pt.morphColors&&u.enable(8),pt.premultipliedAlpha&&u.enable(9),pt.shadowMapEnabled&&u.enable(10),pt.doubleSided&&u.enable(11),pt.flipSided&&u.enable(12),pt.useDepthPacking&&u.enable(13),pt.dithering&&u.enable(14),pt.transmission&&u.enable(15),pt.sheen&&u.enable(16),pt.opaque&&u.enable(17),pt.pointsUvs&&u.enable(18),pt.decodeVideoTexture&&u.enable(19),pt.decodeVideoTextureEmissive&&u.enable(20),pt.alphaToCoverage&&u.enable(21),qe.push(u.mask)}function ke(qe){const pt=I[qe.type];let xn;if(pt){const cr=Jp[pt];xn=Vh.clone(cr.uniforms)}else xn=qe.uniforms;return xn}function nt(qe,pt){let xn=v.get(pt);return xn!==void 0?++xn.usedTimes:(xn=new p3(s,pt,qe,a),g.push(xn),v.set(pt,xn)),xn}function Ye(qe){if(--qe.usedTimes===0){const pt=g.indexOf(qe);g[pt]=g[g.length-1],g.pop(),v.delete(qe.cacheKey),qe.destroy()}}function ht(qe){c.remove(qe)}function Rt(){c.dispose()}return{getParameters:ee,getProgramCacheKey:q,getUniforms:ke,acquireProgram:nt,releaseProgram:Ye,releaseShaderCache:ht,programs:g,dispose:Rt}}function x3(){let s=new WeakMap;function e(o){return s.has(o)}function t(o){let u=s.get(o);return u===void 0&&(u={},s.set(o,u)),u}function n(o){s.delete(o)}function i(o,u,c){s.get(o)[u]=c}function a(){s=new WeakMap}return{has:e,get:t,remove:n,update:i,dispose:a}}function b3(s,e){return s.groupOrder!==e.groupOrder?s.groupOrder-e.groupOrder:s.renderOrder!==e.renderOrder?s.renderOrder-e.renderOrder:s.material.id!==e.material.id?s.material.id-e.material.id:s.z!==e.z?s.z-e.z:s.id-e.id}function WC(s,e){return s.groupOrder!==e.groupOrder?s.groupOrder-e.groupOrder:s.renderOrder!==e.renderOrder?s.renderOrder-e.renderOrder:s.z!==e.z?e.z-s.z:s.id-e.id}function ZC(){const s=[];let e=0;const t=[],n=[],i=[];function a(){e=0,t.length=0,n.length=0,i.length=0}function o(v,M,B,I,ne,ee){let q=s[e];return q===void 0?(q={id:v.id,object:v,geometry:M,material:B,groupOrder:I,renderOrder:v.renderOrder,z:ne,group:ee},s[e]=q):(q.id=v.id,q.object=v,q.geometry=M,q.material=B,q.groupOrder=I,q.renderOrder=v.renderOrder,q.z=ne,q.group=ee),e++,q}function u(v,M,B,I,ne,ee){const q=o(v,M,B,I,ne,ee);B.transmission>0?n.push(q):B.transparent===!0?i.push(q):t.push(q)}function c(v,M,B,I,ne,ee){const q=o(v,M,B,I,ne,ee);B.transmission>0?n.unshift(q):B.transparent===!0?i.unshift(q):t.unshift(q)}function d(v,M){t.length>1&&t.sort(v||b3),n.length>1&&n.sort(M||WC),i.length>1&&i.sort(M||WC)}function g(){for(let v=e,M=s.length;v<M;v++){const B=s[v];if(B.id===null)break;B.id=null,B.object=null,B.geometry=null,B.material=null,B.group=null}}return{opaque:t,transmissive:n,transparent:i,init:a,push:u,unshift:c,finish:g,sort:d}}function _3(){let s=new WeakMap;function e(n,i){const a=s.get(n);let o;return a===void 0?(o=new ZC,s.set(n,[o])):i>=a.length?(o=new ZC,a.push(o)):o=a[i],o}function t(){s=new WeakMap}return{get:e,dispose:t}}function w3(){const s={};return{get:function(e){if(s[e.id]!==void 0)return s[e.id];let t;switch(e.type){case"DirectionalLight":t={direction:new le,color:new Wr};break;case"SpotLight":t={position:new le,direction:new le,color:new Wr,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new le,color:new Wr,distance:0,decay:0};break;case"HemisphereLight":t={direction:new le,skyColor:new Wr,groundColor:new Wr};break;case"RectAreaLight":t={color:new Wr,position:new le,halfWidth:new le,halfHeight:new le};break}return s[e.id]=t,t}}}function S3(){const s={};return{get:function(e){if(s[e.id]!==void 0)return s[e.id];let t;switch(e.type){case"DirectionalLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new ce};break;case"SpotLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new ce};break;case"PointLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new ce,shadowCameraNear:1,shadowCameraFar:1e3};break}return s[e.id]=t,t}}}let M3=0;function E3(s,e){return(e.castShadow?2:0)-(s.castShadow?2:0)+(e.map?1:0)-(s.map?1:0)}function C3(s){const e=new w3,t=S3(),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 d=0;d<9;d++)n.probe.push(new le);const i=new le,a=new di,o=new di;function u(d){let g=0,v=0,M=0;for(let qe=0;qe<9;qe++)n.probe[qe].set(0,0,0);let B=0,I=0,ne=0,ee=0,q=0,ye=0,Ce=0,ke=0,nt=0,Ye=0,ht=0;d.sort(E3);for(let qe=0,pt=d.length;qe<pt;qe++){const xn=d[qe],cr=xn.color,pr=xn.intensity,Br=xn.distance;let zr=null;if(xn.shadow&&xn.shadow.map&&(xn.shadow.map.texture.format===ze?zr=xn.shadow.map.texture:zr=xn.shadow.map.depthTexture||xn.shadow.map.texture),xn.isAmbientLight)g+=cr.r*pr,v+=cr.g*pr,M+=cr.b*pr;else if(xn.isLightProbe){for(let Dr=0;Dr<9;Dr++)n.probe[Dr].addScaledVector(xn.sh.coefficients[Dr],pr);ht++}else if(xn.isDirectionalLight){const Dr=e.get(xn);if(Dr.color.copy(xn.color).multiplyScalar(xn.intensity),xn.castShadow){const Zr=xn.shadow,Ti=t.get(xn);Ti.shadowIntensity=Zr.intensity,Ti.shadowBias=Zr.bias,Ti.shadowNormalBias=Zr.normalBias,Ti.shadowRadius=Zr.radius,Ti.shadowMapSize=Zr.mapSize,n.directionalShadow[B]=Ti,n.directionalShadowMap[B]=zr,n.directionalShadowMatrix[B]=xn.shadow.matrix,ye++}n.directional[B]=Dr,B++}else if(xn.isSpotLight){const Dr=e.get(xn);Dr.position.setFromMatrixPosition(xn.matrixWorld),Dr.color.copy(cr).multiplyScalar(pr),Dr.distance=Br,Dr.coneCos=Math.cos(xn.angle),Dr.penumbraCos=Math.cos(xn.angle*(1-xn.penumbra)),Dr.decay=xn.decay,n.spot[ne]=Dr;const Zr=xn.shadow;if(xn.map&&(n.spotLightMap[nt]=xn.map,nt++,Zr.updateMatrices(xn),xn.castShadow&&Ye++),n.spotLightMatrix[ne]=Zr.matrix,xn.castShadow){const Ti=t.get(xn);Ti.shadowIntensity=Zr.intensity,Ti.shadowBias=Zr.bias,Ti.shadowNormalBias=Zr.normalBias,Ti.shadowRadius=Zr.radius,Ti.shadowMapSize=Zr.mapSize,n.spotShadow[ne]=Ti,n.spotShadowMap[ne]=zr,ke++}ne++}else if(xn.isRectAreaLight){const Dr=e.get(xn);Dr.color.copy(cr).multiplyScalar(pr),Dr.halfWidth.set(xn.width*.5,0,0),Dr.halfHeight.set(0,xn.height*.5,0),n.rectArea[ee]=Dr,ee++}else if(xn.isPointLight){const Dr=e.get(xn);if(Dr.color.copy(xn.color).multiplyScalar(xn.intensity),Dr.distance=xn.distance,Dr.decay=xn.decay,xn.castShadow){const Zr=xn.shadow,Ti=t.get(xn);Ti.shadowIntensity=Zr.intensity,Ti.shadowBias=Zr.bias,Ti.shadowNormalBias=Zr.normalBias,Ti.shadowRadius=Zr.radius,Ti.shadowMapSize=Zr.mapSize,Ti.shadowCameraNear=Zr.camera.near,Ti.shadowCameraFar=Zr.camera.far,n.pointShadow[I]=Ti,n.pointShadowMap[I]=zr,n.pointShadowMatrix[I]=xn.shadow.matrix,Ce++}n.point[I]=Dr,I++}else if(xn.isHemisphereLight){const Dr=e.get(xn);Dr.skyColor.copy(xn.color).multiplyScalar(pr),Dr.groundColor.copy(xn.groundColor).multiplyScalar(pr),n.hemi[q]=Dr,q++}}ee>0&&(s.has("OES_texture_float_linear")===!0?(n.rectAreaLTC1=Js.LTC_FLOAT_1,n.rectAreaLTC2=Js.LTC_FLOAT_2):(n.rectAreaLTC1=Js.LTC_HALF_1,n.rectAreaLTC2=Js.LTC_HALF_2)),n.ambient[0]=g,n.ambient[1]=v,n.ambient[2]=M;const Rt=n.hash;(Rt.directionalLength!==B||Rt.pointLength!==I||Rt.spotLength!==ne||Rt.rectAreaLength!==ee||Rt.hemiLength!==q||Rt.numDirectionalShadows!==ye||Rt.numPointShadows!==Ce||Rt.numSpotShadows!==ke||Rt.numSpotMaps!==nt||Rt.numLightProbes!==ht)&&(n.directional.length=B,n.spot.length=ne,n.rectArea.length=ee,n.point.length=I,n.hemi.length=q,n.directionalShadow.length=ye,n.directionalShadowMap.length=ye,n.pointShadow.length=Ce,n.pointShadowMap.length=Ce,n.spotShadow.length=ke,n.spotShadowMap.length=ke,n.directionalShadowMatrix.length=ye,n.pointShadowMatrix.length=Ce,n.spotLightMatrix.length=ke+nt-Ye,n.spotLightMap.length=nt,n.numSpotLightShadowsWithMaps=Ye,n.numLightProbes=ht,Rt.directionalLength=B,Rt.pointLength=I,Rt.spotLength=ne,Rt.rectAreaLength=ee,Rt.hemiLength=q,Rt.numDirectionalShadows=ye,Rt.numPointShadows=Ce,Rt.numSpotShadows=ke,Rt.numSpotMaps=nt,Rt.numLightProbes=ht,n.version=M3++)}function c(d,g){let v=0,M=0,B=0,I=0,ne=0;const ee=g.matrixWorldInverse;for(let q=0,ye=d.length;q<ye;q++){const Ce=d[q];if(Ce.isDirectionalLight){const ke=n.directional[v];ke.direction.setFromMatrixPosition(Ce.matrixWorld),i.setFromMatrixPosition(Ce.target.matrixWorld),ke.direction.sub(i),ke.direction.transformDirection(ee),v++}else if(Ce.isSpotLight){const ke=n.spot[B];ke.position.setFromMatrixPosition(Ce.matrixWorld),ke.position.applyMatrix4(ee),ke.direction.setFromMatrixPosition(Ce.matrixWorld),i.setFromMatrixPosition(Ce.target.matrixWorld),ke.direction.sub(i),ke.direction.transformDirection(ee),B++}else if(Ce.isRectAreaLight){const ke=n.rectArea[I];ke.position.setFromMatrixPosition(Ce.matrixWorld),ke.position.applyMatrix4(ee),o.identity(),a.copy(Ce.matrixWorld),a.premultiply(ee),o.extractRotation(a),ke.halfWidth.set(Ce.width*.5,0,0),ke.halfHeight.set(0,Ce.height*.5,0),ke.halfWidth.applyMatrix4(o),ke.halfHeight.applyMatrix4(o),I++}else if(Ce.isPointLight){const ke=n.point[M];ke.position.setFromMatrixPosition(Ce.matrixWorld),ke.position.applyMatrix4(ee),M++}else if(Ce.isHemisphereLight){const ke=n.hemi[ne];ke.direction.setFromMatrixPosition(Ce.matrixWorld),ke.direction.transformDirection(ee),ne++}}}return{setup:u,setupView:c,state:n}}function KC(s){const e=new C3(s),t=[],n=[];function i(g){d.camera=g,t.length=0,n.length=0}function a(g){t.push(g)}function o(g){n.push(g)}function u(){e.setup(t)}function c(g){e.setupView(t,g)}const d={lightsArray:t,shadowsArray:n,camera:null,lights:e,transmissionRenderTarget:{}};return{init:i,state:d,setupLights:u,setupLightsView:c,pushLight:a,pushShadow:o}}function T3(s){let e=new WeakMap;function t(i,a=0){const o=e.get(i);let u;return o===void 0?(u=new KC(s),e.set(i,[u])):a>=o.length?(u=new KC(s),o.push(u)):u=o[a],u}function n(){e=new WeakMap}return{get:t,dispose:n}}const B3=`void main() {
gl_Position = vec4( position, 1.0 );
}`,R3=`uniform sampler2D shadow_pass;
uniform vec2 resolution;
uniform float radius;
void main() {
const float samples = float( VSM_SAMPLES );
float mean = 0.0;
float squared_mean = 0.0;
float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );
float uvStart = samples <= 1.0 ? 0.0 : - 1.0;
for ( float i = 0.0; i < samples; i ++ ) {
float uvOffset = uvStart + i * uvStride;
#ifdef HORIZONTAL_PASS
vec2 distribution = texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ).rg;
mean += distribution.x;
squared_mean += distribution.y * distribution.y + distribution.x * distribution.x;
#else
float depth = texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ).r;
mean += depth;
squared_mean += depth * depth;
#endif
}
mean = mean / samples;
squared_mean = squared_mean / samples;
float std_dev = sqrt( max( 0.0, squared_mean - mean * mean ) );
gl_FragColor = vec4( mean, std_dev, 0.0, 1.0 );
}`,I3=[new le(1,0,0),new le(-1,0,0),new le(0,1,0),new le(0,-1,0),new le(0,0,1),new le(0,0,-1)],N3=[new le(0,-1,0),new le(0,-1,0),new le(0,0,1),new le(0,0,-1),new le(0,-1,0),new le(0,-1,0)],$C=new di,My=new le,i1=new le;function F3(s,e,t){let n=new qu;const i=new ce,a=new ce,o=new Ni,u=new Bx,c=new Rx,d={},g=t.maxTextureSize,v={[j]:de,[de]:j,[he]:he},M=new nh({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new ce},radius:{value:4}},vertexShader:B3,fragmentShader:R3}),B=M.clone();B.defines.HORIZONTAL_PASS=1;const I=new ka;I.setAttribute("position",new wl(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const ne=new Il(I,M),ee=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=H;let q=this.type;this.render=function(Ye,ht,Rt){if(ee.enabled===!1||ee.autoUpdate===!1&&ee.needsUpdate===!1||Ye.length===0)return;Ye.type===D&&(Lr("WebGLShadowMap: PCFSoftShadowMap has been deprecated. Using PCFShadowMap instead."),Ye.type=H);const qe=s.getRenderTarget(),pt=s.getActiveCubeFace(),xn=s.getActiveMipmapLevel(),cr=s.state;cr.setBlending(we),cr.buffers.depth.getReversed()===!0?cr.buffers.color.setClear(0,0,0,0):cr.buffers.color.setClear(1,1,1,1),cr.buffers.depth.setTest(!0),cr.setScissorTest(!1);const pr=q!==this.type;pr&&ht.traverse(function(Br){Br.material&&(Array.isArray(Br.material)?Br.material.forEach(zr=>zr.needsUpdate=!0):Br.material.needsUpdate=!0)});for(let Br=0,zr=Ye.length;Br<zr;Br++){const Dr=Ye[Br],Zr=Dr.shadow;if(Zr===void 0){Lr("WebGLShadowMap:",Dr,"has no shadow.");continue}if(Zr.autoUpdate===!1&&Zr.needsUpdate===!1)continue;i.copy(Zr.mapSize);const Ti=Zr.getFrameExtents();if(i.multiply(Ti),a.copy(Zr.mapSize),(i.x>g||i.y>g)&&(i.x>g&&(a.x=Math.floor(g/Ti.x),i.x=a.x*Ti.x,Zr.mapSize.x=a.x),i.y>g&&(a.y=Math.floor(g/Ti.y),i.y=a.y*Ti.y,Zr.mapSize.y=a.y)),Zr.map===null||pr===!0){if(Zr.map!==null&&(Zr.map.depthTexture!==null&&(Zr.map.depthTexture.dispose(),Zr.map.depthTexture=null),Zr.map.dispose()),this.type===X){if(Dr.isPointLight){Lr("WebGLShadowMap: VSM shadow maps are not supported for PointLights. Use PCF or BasicShadowMap instead.");continue}Zr.map=new Os(i.x,i.y,{format:ze,type:Wt,minFilter:vr,magFilter:vr,generateMipmaps:!1}),Zr.map.texture.name=Dr.name+".shadowMap",Zr.map.depthTexture=new Al(i.x,i.y,dt),Zr.map.depthTexture.name=Dr.name+".shadowMapDepth",Zr.map.depthTexture.format=Q,Zr.map.depthTexture.compareFunction=null,Zr.map.depthTexture.minFilter=cn,Zr.map.depthTexture.magFilter=cn}else{Dr.isPointLight?(Zr.map=new Mc(i.x),Zr.map.depthTexture=new sA(i.x,st)):(Zr.map=new Os(i.x,i.y),Zr.map.depthTexture=new Al(i.x,i.y,st)),Zr.map.depthTexture.name=Dr.name+".shadowMap",Zr.map.depthTexture.format=Q;const As=s.state.buffers.depth.getReversed();this.type===H?(Zr.map.depthTexture.compareFunction=As?Ji:jc,Zr.map.depthTexture.minFilter=vr,Zr.map.depthTexture.magFilter=vr):(Zr.map.depthTexture.compareFunction=null,Zr.map.depthTexture.minFilter=cn,Zr.map.depthTexture.magFilter=cn)}Zr.camera.updateProjectionMatrix()}const ds=Zr.map.isWebGLCubeRenderTarget?6:1;for(let As=0;As<ds;As++){if(Zr.map.isWebGLCubeRenderTarget)s.setRenderTarget(Zr.map,As),s.clear();else{As===0&&(s.setRenderTarget(Zr.map),s.clear());const Xr=Zr.getViewport(As);o.set(a.x*Xr.x,a.y*Xr.y,a.x*Xr.z,a.y*Xr.w),cr.viewport(o)}if(Dr.isPointLight){const Xr=Zr.camera,Yi=Zr.matrix,ps=Dr.distance||Xr.far;ps!==Xr.far&&(Xr.far=ps,Xr.updateProjectionMatrix()),My.setFromMatrixPosition(Dr.matrixWorld),Xr.position.copy(My),i1.copy(Xr.position),i1.add(I3[As]),Xr.up.copy(N3[As]),Xr.lookAt(i1),Xr.updateMatrixWorld(),Yi.makeTranslation(-My.x,-My.y,-My.z),$C.multiplyMatrices(Xr.projectionMatrix,Xr.matrixWorldInverse),Zr._frustum.setFromProjectionMatrix($C,Xr.coordinateSystem,Xr.reversedDepth)}else Zr.updateMatrices(Dr);n=Zr.getFrustum(),ke(ht,Rt,Zr.camera,Dr,this.type)}Zr.isPointLightShadow!==!0&&this.type===X&&ye(Zr,Rt),Zr.needsUpdate=!1}q=this.type,ee.needsUpdate=!1,s.setRenderTarget(qe,pt,xn)};function ye(Ye,ht){const Rt=e.update(ne);M.defines.VSM_SAMPLES!==Ye.blurSamples&&(M.defines.VSM_SAMPLES=Ye.blurSamples,B.defines.VSM_SAMPLES=Ye.blurSamples,M.needsUpdate=!0,B.needsUpdate=!0),Ye.mapPass===null&&(Ye.mapPass=new Os(i.x,i.y,{format:ze,type:Wt})),M.uniforms.shadow_pass.value=Ye.map.depthTexture,M.uniforms.resolution.value=Ye.mapSize,M.uniforms.radius.value=Ye.radius,s.setRenderTarget(Ye.mapPass),s.clear(),s.renderBufferDirect(ht,null,Rt,M,ne,null),B.uniforms.shadow_pass.value=Ye.mapPass.texture,B.uniforms.resolution.value=Ye.mapSize,B.uniforms.radius.value=Ye.radius,s.setRenderTarget(Ye.map),s.clear(),s.renderBufferDirect(ht,null,Rt,B,ne,null)}function Ce(Ye,ht,Rt,qe){let pt=null;const xn=Rt.isPointLight===!0?Ye.customDistanceMaterial:Ye.customDepthMaterial;if(xn!==void 0)pt=xn;else if(pt=Rt.isPointLight===!0?c:u,s.localClippingEnabled&&ht.clipShadows===!0&&Array.isArray(ht.clippingPlanes)&&ht.clippingPlanes.length!==0||ht.displacementMap&&ht.displacementScale!==0||ht.alphaMap&&ht.alphaTest>0||ht.map&&ht.alphaTest>0||ht.alphaToCoverage===!0){const cr=pt.uuid,pr=ht.uuid;let Br=d[cr];Br===void 0&&(Br={},d[cr]=Br);let zr=Br[pr];zr===void 0&&(zr=pt.clone(),Br[pr]=zr,ht.addEventListener("dispose",nt)),pt=zr}if(pt.visible=ht.visible,pt.wireframe=ht.wireframe,qe===X?pt.side=ht.shadowSide!==null?ht.shadowSide:ht.side:pt.side=ht.shadowSide!==null?ht.shadowSide:v[ht.side],pt.alphaMap=ht.alphaMap,pt.alphaTest=ht.alphaToCoverage===!0?.5:ht.alphaTest,pt.map=ht.map,pt.clipShadows=ht.clipShadows,pt.clippingPlanes=ht.clippingPlanes,pt.clipIntersection=ht.clipIntersection,pt.displacementMap=ht.displacementMap,pt.displacementScale=ht.displacementScale,pt.displacementBias=ht.displacementBias,pt.wireframeLinewidth=ht.wireframeLinewidth,pt.linewidth=ht.linewidth,Rt.isPointLight===!0&&pt.isMeshDistanceMaterial===!0){const cr=s.properties.get(pt);cr.light=Rt}return pt}function ke(Ye,ht,Rt,qe,pt){if(Ye.visible===!1)return;if(Ye.layers.test(ht.layers)&&(Ye.isMesh||Ye.isLine||Ye.isPoints)&&(Ye.castShadow||Ye.receiveShadow&&pt===X)&&(!Ye.frustumCulled||n.intersectsObject(Ye))){Ye.modelViewMatrix.multiplyMatrices(Rt.matrixWorldInverse,Ye.matrixWorld);const pr=e.update(Ye),Br=Ye.material;if(Array.isArray(Br)){const zr=pr.groups;for(let Dr=0,Zr=zr.length;Dr<Zr;Dr++){const Ti=zr[Dr],ds=Br[Ti.materialIndex];if(ds&&ds.visible){const As=Ce(Ye,ds,qe,pt);Ye.onBeforeShadow(s,Ye,ht,Rt,pr,As,Ti),s.renderBufferDirect(Rt,null,pr,As,Ye,Ti),Ye.onAfterShadow(s,Ye,ht,Rt,pr,As,Ti)}}}else if(Br.visible){const zr=Ce(Ye,Br,qe,pt);Ye.onBeforeShadow(s,Ye,ht,Rt,pr,zr,null),s.renderBufferDirect(Rt,null,pr,zr,Ye,null),Ye.onAfterShadow(s,Ye,ht,Rt,pr,zr,null)}}const cr=Ye.children;for(let pr=0,Br=cr.length;pr<Br;pr++)ke(cr[pr],ht,Rt,qe,pt)}function nt(Ye){Ye.target.removeEventListener("dispose",nt);for(const Rt in d){const qe=d[Rt],pt=Ye.target.uuid;pt in qe&&(qe[pt].dispose(),delete qe[pt])}}}const P3={[Mt]:Et,[pe]:jt,[Pe]:ft,[Ae]:Ut,[Et]:Mt,[jt]:pe,[ft]:Pe,[Ut]:Ae};function L3(s,e){function t(){let Mr=!1;const la=new Ni;let Ts=null;const ga=new Ni(0,0,0,0);return{setMask:function(gs){Ts!==gs&&!Mr&&(s.colorMask(gs,gs,gs,gs),Ts=gs)},setLocked:function(gs){Mr=gs},setClear:function(gs,Wi,Ws,Eo,Wu){Wu===!0&&(gs*=Eo,Wi*=Eo,Ws*=Eo),la.set(gs,Wi,Ws,Eo),ga.equals(la)===!1&&(s.clearColor(gs,Wi,Ws,Eo),ga.copy(la))},reset:function(){Mr=!1,Ts=null,ga.set(-1,0,0,0)}}}function n(){let Mr=!1,la=!1,Ts=null,ga=null,gs=null;return{setReversed:function(Wi){if(la!==Wi){const Ws=e.get("EXT_clip_control");Wi?Ws.clipControlEXT(Ws.LOWER_LEFT_EXT,Ws.ZERO_TO_ONE_EXT):Ws.clipControlEXT(Ws.LOWER_LEFT_EXT,Ws.NEGATIVE_ONE_TO_ONE_EXT),la=Wi;const Eo=gs;gs=null,this.setClear(Eo)}},getReversed:function(){return la},setTest:function(Wi){Wi?Yr(s.DEPTH_TEST):cs(s.DEPTH_TEST)},setMask:function(Wi){Ts!==Wi&&!Mr&&(s.depthMask(Wi),Ts=Wi)},setFunc:function(Wi){if(la&&(Wi=P3[Wi]),ga!==Wi){switch(Wi){case Mt:s.depthFunc(s.NEVER);break;case Et:s.depthFunc(s.ALWAYS);break;case pe:s.depthFunc(s.LESS);break;case Ae:s.depthFunc(s.LEQUAL);break;case Pe:s.depthFunc(s.EQUAL);break;case Ut:s.depthFunc(s.GEQUAL);break;case jt:s.depthFunc(s.GREATER);break;case ft:s.depthFunc(s.NOTEQUAL);break;default:s.depthFunc(s.LEQUAL)}ga=Wi}},setLocked:function(Wi){Mr=Wi},setClear:function(Wi){gs!==Wi&&(la&&(Wi=1-Wi),s.clearDepth(Wi),gs=Wi)},reset:function(){Mr=!1,Ts=null,ga=null,gs=null,la=!1}}}function i(){let Mr=!1,la=null,Ts=null,ga=null,gs=null,Wi=null,Ws=null,Eo=null,Wu=null;return{setTest:function(fu){Mr||(fu?Yr(s.STENCIL_TEST):cs(s.STENCIL_TEST))},setMask:function(fu){la!==fu&&!Mr&&(s.stencilMask(fu),la=fu)},setFunc:function(fu,bg,om){(Ts!==fu||ga!==bg||gs!==om)&&(s.stencilFunc(fu,bg,om),Ts=fu,ga=bg,gs=om)},setOp:function(fu,bg,om){(Wi!==fu||Ws!==bg||Eo!==om)&&(s.stencilOp(fu,bg,om),Wi=fu,Ws=bg,Eo=om)},setLocked:function(fu){Mr=fu},setClear:function(fu){Wu!==fu&&(s.clearStencil(fu),Wu=fu)},reset:function(){Mr=!1,la=null,Ts=null,ga=null,gs=null,Wi=null,Ws=null,Eo=null,Wu=null}}}const a=new t,o=new n,u=new i,c=new WeakMap,d=new WeakMap;let g={},v={},M=new WeakMap,B=[],I=null,ne=!1,ee=null,q=null,ye=null,Ce=null,ke=null,nt=null,Ye=null,ht=new Wr(0,0,0),Rt=0,qe=!1,pt=null,xn=null,cr=null,pr=null,Br=null;const zr=s.getParameter(s.MAX_COMBINED_TEXTURE_IMAGE_UNITS);let Dr=!1,Zr=0;const Ti=s.getParameter(s.VERSION);Ti.indexOf("WebGL")!==-1?(Zr=parseFloat(/^WebGL (\d)/.exec(Ti)[1]),Dr=Zr>=1):Ti.indexOf("OpenGL ES")!==-1&&(Zr=parseFloat(/^OpenGL ES (\d)/.exec(Ti)[1]),Dr=Zr>=2);let ds=null,As={};const Xr=s.getParameter(s.SCISSOR_BOX),Yi=s.getParameter(s.VIEWPORT),ps=new Ni().fromArray(Xr),Xa=new Ni().fromArray(Yi);function Pi(Mr,la,Ts,ga){const gs=new Uint8Array(4),Wi=s.createTexture();s.bindTexture(Mr,Wi),s.texParameteri(Mr,s.TEXTURE_MIN_FILTER,s.NEAREST),s.texParameteri(Mr,s.TEXTURE_MAG_FILTER,s.NEAREST);for(let Ws=0;Ws<Ts;Ws++)Mr===s.TEXTURE_3D||Mr===s.TEXTURE_2D_ARRAY?s.texImage3D(la,0,s.RGBA,1,1,ga,0,s.RGBA,s.UNSIGNED_BYTE,gs):s.texImage2D(la+Ws,0,s.RGBA,1,1,0,s.RGBA,s.UNSIGNED_BYTE,gs);return Wi}const Nr={};Nr[s.TEXTURE_2D]=Pi(s.TEXTURE_2D,s.TEXTURE_2D,1),Nr[s.TEXTURE_CUBE_MAP]=Pi(s.TEXTURE_CUBE_MAP,s.TEXTURE_CUBE_MAP_POSITIVE_X,6),Nr[s.TEXTURE_2D_ARRAY]=Pi(s.TEXTURE_2D_ARRAY,s.TEXTURE_2D_ARRAY,1,1),Nr[s.TEXTURE_3D]=Pi(s.TEXTURE_3D,s.TEXTURE_3D,1,1),a.setClear(0,0,0,1),o.setClear(1),u.setClear(0),Yr(s.DEPTH_TEST),o.setFunc(Ae),Hi(!1),Fs(E),Yr(s.CULL_FACE),Li(we);function Yr(Mr){g[Mr]!==!0&&(s.enable(Mr),g[Mr]=!0)}function cs(Mr){g[Mr]!==!1&&(s.disable(Mr),g[Mr]=!1)}function oa(Mr,la){return v[Mr]!==la?(s.bindFramebuffer(Mr,la),v[Mr]=la,Mr===s.DRAW_FRAMEBUFFER&&(v[s.FRAMEBUFFER]=la),Mr===s.FRAMEBUFFER&&(v[s.DRAW_FRAMEBUFFER]=la),!0):!1}function Ms(Mr,la){let Ts=B,ga=!1;if(Mr){Ts=M.get(la),Ts===void 0&&(Ts=[],M.set(la,Ts));const gs=Mr.textures;if(Ts.length!==gs.length||Ts[0]!==s.COLOR_ATTACHMENT0){for(let Wi=0,Ws=gs.length;Wi<Ws;Wi++)Ts[Wi]=s.COLOR_ATTACHMENT0+Wi;Ts.length=gs.length,ga=!0}}else Ts[0]!==s.BACK&&(Ts[0]=s.BACK,ga=!0);ga&&s.drawBuffers(Ts)}function Ha(Mr){return I!==Mr?(s.useProgram(Mr),I=Mr,!0):!1}const Qo={[vt]:s.FUNC_ADD,[at]:s.FUNC_SUBTRACT,[kt]:s.FUNC_REVERSE_SUBTRACT};Qo[It]=s.MIN,Qo[Bn]=s.MAX;const co={[Lt]:s.ZERO,[Wn]:s.ONE,[Xn]:s.SRC_COLOR,[zn]:s.SRC_ALPHA,[On]:s.SRC_ALPHA_SATURATE,[Ge]:s.DST_COLOR,[vn]:s.DST_ALPHA,[In]:s.ONE_MINUS_SRC_COLOR,[dr]:s.ONE_MINUS_SRC_ALPHA,[Tt]:s.ONE_MINUS_DST_COLOR,[_r]:s.ONE_MINUS_DST_ALPHA,[Vr]:s.CONSTANT_COLOR,[en]:s.ONE_MINUS_CONSTANT_COLOR,[ln]:s.CONSTANT_ALPHA,[Cn]:s.ONE_MINUS_CONSTANT_ALPHA};function Li(Mr,la,Ts,ga,gs,Wi,Ws,Eo,Wu,fu){if(Mr===we){ne===!0&&(cs(s.BLEND),ne=!1);return}if(ne===!1&&(Yr(s.BLEND),ne=!0),Mr!==ct){if(Mr!==ee||fu!==qe){if((q!==vt||ke!==vt)&&(s.blendEquation(s.FUNC_ADD),q=vt,ke=vt),fu)switch(Mr){case ve:s.blendFuncSeparate(s.ONE,s.ONE_MINUS_SRC_ALPHA,s.ONE,s.ONE_MINUS_SRC_ALPHA);break;case Ee:s.blendFunc(s.ONE,s.ONE);break;case $e:s.blendFuncSeparate(s.ZERO,s.ONE_MINUS_SRC_COLOR,s.ZERO,s.ONE);break;case Fe:s.blendFuncSeparate(s.DST_COLOR,s.ONE_MINUS_SRC_ALPHA,s.ZERO,s.ONE);break;default:Gr("WebGLState: Invalid blending: ",Mr);break}else switch(Mr){case ve:s.blendFuncSeparate(s.SRC_ALPHA,s.ONE_MINUS_SRC_ALPHA,s.ONE,s.ONE_MINUS_SRC_ALPHA);break;case Ee:s.blendFuncSeparate(s.SRC_ALPHA,s.ONE,s.ONE,s.ONE);break;case $e:Gr("WebGLState: SubtractiveBlending requires material.premultipliedAlpha = true");break;case Fe:Gr("WebGLState: MultiplyBlending requires material.premultipliedAlpha = true");break;default:Gr("WebGLState: Invalid blending: ",Mr);break}ye=null,Ce=null,nt=null,Ye=null,ht.set(0,0,0),Rt=0,ee=Mr,qe=fu}return}gs=gs||la,Wi=Wi||Ts,Ws=Ws||ga,(la!==q||gs!==ke)&&(s.blendEquationSeparate(Qo[la],Qo[gs]),q=la,ke=gs),(Ts!==ye||ga!==Ce||Wi!==nt||Ws!==Ye)&&(s.blendFuncSeparate(co[Ts],co[ga],co[Wi],co[Ws]),ye=Ts,Ce=ga,nt=Wi,Ye=Ws),(Eo.equals(ht)===!1||Wu!==Rt)&&(s.blendColor(Eo.r,Eo.g,Eo.b,Wu),ht.copy(Eo),Rt=Wu),ee=Mr,qe=!1}function os(Mr,la){Mr.side===he?cs(s.CULL_FACE):Yr(s.CULL_FACE);let Ts=Mr.side===de;la&&(Ts=!Ts),Hi(Ts),Mr.blending===ve&&Mr.transparent===!1?Li(we):Li(Mr.blending,Mr.blendEquation,Mr.blendSrc,Mr.blendDst,Mr.blendEquationAlpha,Mr.blendSrcAlpha,Mr.blendDstAlpha,Mr.blendColor,Mr.blendAlpha,Mr.premultipliedAlpha),o.setFunc(Mr.depthFunc),o.setTest(Mr.depthTest),o.setMask(Mr.depthWrite),a.setMask(Mr.colorWrite);const ga=Mr.stencilWrite;u.setTest(ga),ga&&(u.setMask(Mr.stencilWriteMask),u.setFunc(Mr.stencilFunc,Mr.stencilRef,Mr.stencilFuncMask),u.setOp(Mr.stencilFail,Mr.stencilZFail,Mr.stencilZPass)),ja(Mr.polygonOffset,Mr.polygonOffsetFactor,Mr.polygonOffsetUnits),Mr.alphaToCoverage===!0?Yr(s.SAMPLE_ALPHA_TO_COVERAGE):cs(s.SAMPLE_ALPHA_TO_COVERAGE)}function Hi(Mr){pt!==Mr&&(Mr?s.frontFace(s.CW):s.frontFace(s.CCW),pt=Mr)}function Fs(Mr){Mr!==N?(Yr(s.CULL_FACE),Mr!==xn&&(Mr===E?s.cullFace(s.BACK):Mr===F?s.cullFace(s.FRONT):s.cullFace(s.FRONT_AND_BACK))):cs(s.CULL_FACE),xn=Mr}function Pn(Mr){Mr!==cr&&(Dr&&s.lineWidth(Mr),cr=Mr)}function ja(Mr,la,Ts){Mr?(Yr(s.POLYGON_OFFSET_FILL),(pr!==la||Br!==Ts)&&(s.polygonOffset(la,Ts),pr=la,Br=Ts)):cs(s.POLYGON_OFFSET_FILL)}function da(Mr){Mr?Yr(s.SCISSOR_TEST):cs(s.SCISSOR_TEST)}function ho(Mr){Mr===void 0&&(Mr=s.TEXTURE0+zr-1),ds!==Mr&&(s.activeTexture(Mr),ds=Mr)}function Ps(Mr,la,Ts){Ts===void 0&&(ds===null?Ts=s.TEXTURE0+zr-1:Ts=ds);let ga=As[Ts];ga===void 0&&(ga={type:void 0,texture:void 0},As[Ts]=ga),(ga.type!==Mr||ga.texture!==la)&&(ds!==Ts&&(s.activeTexture(Ts),ds=Ts),s.bindTexture(Mr,la||Nr[Mr]),ga.type=Mr,ga.texture=la)}function Mn(){const Mr=As[ds];Mr!==void 0&&Mr.type!==void 0&&(s.bindTexture(Mr.type,null),Mr.type=void 0,Mr.texture=void 0)}function St(){try{s.compressedTexImage2D(...arguments)}catch(Mr){Gr("WebGLState:",Mr)}}function Cr(){try{s.compressedTexImage3D(...arguments)}catch(Mr){Gr("WebGLState:",Mr)}}function xi(){try{s.texSubImage2D(...arguments)}catch(Mr){Gr("WebGLState:",Mr)}}function Qi(){try{s.texSubImage3D(...arguments)}catch(Mr){Gr("WebGLState:",Mr)}}function Si(){try{s.compressedTexSubImage2D(...arguments)}catch(Mr){Gr("WebGLState:",Mr)}}function La(){try{s.compressedTexSubImage3D(...arguments)}catch(Mr){Gr("WebGLState:",Mr)}}function Vs(){try{s.texStorage2D(...arguments)}catch(Mr){Gr("WebGLState:",Mr)}}function Na(){try{s.texStorage3D(...arguments)}catch(Mr){Gr("WebGLState:",Mr)}}function po(){try{s.texImage2D(...arguments)}catch(Mr){Gr("WebGLState:",Mr)}}function hs(){try{s.texImage3D(...arguments)}catch(Mr){Gr("WebGLState:",Mr)}}function js(Mr){ps.equals(Mr)===!1&&(s.scissor(Mr.x,Mr.y,Mr.z,Mr.w),ps.copy(Mr))}function Fa(Mr){Xa.equals(Mr)===!1&&(s.viewport(Mr.x,Mr.y,Mr.z,Mr.w),Xa.copy(Mr))}function Va(Mr,la){let Ts=d.get(la);Ts===void 0&&(Ts=new WeakMap,d.set(la,Ts));let ga=Ts.get(Mr);ga===void 0&&(ga=s.getUniformBlockIndex(la,Mr.name),Ts.set(Mr,ga))}function $s(Mr,la){const ga=d.get(la).get(Mr);c.get(la)!==ga&&(s.uniformBlockBinding(la,ga,Mr.__bindingPointIndex),c.set(la,ga))}function Wo(){s.disable(s.BLEND),s.disable(s.CULL_FACE),s.disable(s.DEPTH_TEST),s.disable(s.POLYGON_OFFSET_FILL),s.disable(s.SCISSOR_TEST),s.disable(s.STENCIL_TEST),s.disable(s.SAMPLE_ALPHA_TO_COVERAGE),s.blendEquation(s.FUNC_ADD),s.blendFunc(s.ONE,s.ZERO),s.blendFuncSeparate(s.ONE,s.ZERO,s.ONE,s.ZERO),s.blendColor(0,0,0,0),s.colorMask(!0,!0,!0,!0),s.clearColor(0,0,0,0),s.depthMask(!0),s.depthFunc(s.LESS),o.setReversed(!1),s.clearDepth(1),s.stencilMask(4294967295),s.stencilFunc(s.ALWAYS,0,4294967295),s.stencilOp(s.KEEP,s.KEEP,s.KEEP),s.clearStencil(0),s.cullFace(s.BACK),s.frontFace(s.CCW),s.polygonOffset(0,0),s.activeTexture(s.TEXTURE0),s.bindFramebuffer(s.FRAMEBUFFER,null),s.bindFramebuffer(s.DRAW_FRAMEBUFFER,null),s.bindFramebuffer(s.READ_FRAMEBUFFER,null),s.useProgram(null),s.lineWidth(1),s.scissor(0,0,s.canvas.width,s.canvas.height),s.viewport(0,0,s.canvas.width,s.canvas.height),g={},ds=null,As={},v={},M=new WeakMap,B=[],I=null,ne=!1,ee=null,q=null,ye=null,Ce=null,ke=null,nt=null,Ye=null,ht=new Wr(0,0,0),Rt=0,qe=!1,pt=null,xn=null,cr=null,pr=null,Br=null,ps.set(0,0,s.canvas.width,s.canvas.height),Xa.set(0,0,s.canvas.width,s.canvas.height),a.reset(),o.reset(),u.reset()}return{buffers:{color:a,depth:o,stencil:u},enable:Yr,disable:cs,bindFramebuffer:oa,drawBuffers:Ms,useProgram:Ha,setBlending:Li,setMaterial:os,setFlipSided:Hi,setCullFace:Fs,setLineWidth:Pn,setPolygonOffset:ja,setScissorTest:da,activeTexture:ho,bindTexture:Ps,unbindTexture:Mn,compressedTexImage2D:St,compressedTexImage3D:Cr,texImage2D:po,texImage3D:hs,updateUBOMapping:Va,uniformBlockBinding:$s,texStorage2D:Vs,texStorage3D:Na,texSubImage2D:xi,texSubImage3D:Qi,compressedTexSubImage2D:Si,compressedTexSubImage3D:La,scissor:js,viewport:Fa,reset:Wo}}function U3(s,e,t,n,i,a,o){const u=e.has("WEBGL_multisampled_render_to_texture")?e.get("WEBGL_multisampled_render_to_texture"):null,c=typeof navigator=="undefined"?!1:/OculusBrowser/g.test(navigator.userAgent),d=new ce,g=new WeakMap;let v;const M=new WeakMap;let B=!1;try{B=typeof OffscreenCanvas!="undefined"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch(Mn){}function I(Mn,St){return B?new OffscreenCanvas(Mn,St):Wa("canvas")}function ne(Mn,St,Cr){let xi=1;const Qi=Ps(Mn);if((Qi.width>Cr||Qi.height>Cr)&&(xi=Cr/Math.max(Qi.width,Qi.height)),xi<1)if(typeof HTMLImageElement!="undefined"&&Mn instanceof HTMLImageElement||typeof HTMLCanvasElement!="undefined"&&Mn instanceof HTMLCanvasElement||typeof ImageBitmap!="undefined"&&Mn instanceof ImageBitmap||typeof VideoFrame!="undefined"&&Mn instanceof VideoFrame){const Si=Math.floor(xi*Qi.width),La=Math.floor(xi*Qi.height);v===void 0&&(v=I(Si,La));const Vs=St?I(Si,La):v;return Vs.width=Si,Vs.height=La,Vs.getContext("2d").drawImage(Mn,0,0,Si,La),Lr("WebGLRenderer: Texture has been resized from ("+Qi.width+"x"+Qi.height+") to ("+Si+"x"+La+")."),Vs}else return"data"in Mn&&Lr("WebGLRenderer: Image in DataTexture is too big ("+Qi.width+"x"+Qi.height+")."),Mn;return Mn}function ee(Mn){return Mn.generateMipmaps}function q(Mn){s.generateMipmap(Mn)}function ye(Mn){return Mn.isWebGLCubeRenderTarget?s.TEXTURE_CUBE_MAP:Mn.isWebGL3DRenderTarget?s.TEXTURE_3D:Mn.isWebGLArrayRenderTarget||Mn.isCompressedArrayTexture?s.TEXTURE_2D_ARRAY:s.TEXTURE_2D}function Ce(Mn,St,Cr,xi,Qi=!1){if(Mn!==null){if(s[Mn]!==void 0)return s[Mn];Lr("WebGLRenderer: Attempt to use non-existing WebGL internal format '"+Mn+"'")}let Si=St;if(St===s.RED&&(Cr===s.FLOAT&&(Si=s.R32F),Cr===s.HALF_FLOAT&&(Si=s.R16F),Cr===s.UNSIGNED_BYTE&&(Si=s.R8)),St===s.RED_INTEGER&&(Cr===s.UNSIGNED_BYTE&&(Si=s.R8UI),Cr===s.UNSIGNED_SHORT&&(Si=s.R16UI),Cr===s.UNSIGNED_INT&&(Si=s.R32UI),Cr===s.BYTE&&(Si=s.R8I),Cr===s.SHORT&&(Si=s.R16I),Cr===s.INT&&(Si=s.R32I)),St===s.RG&&(Cr===s.FLOAT&&(Si=s.RG32F),Cr===s.HALF_FLOAT&&(Si=s.RG16F),Cr===s.UNSIGNED_BYTE&&(Si=s.RG8)),St===s.RG_INTEGER&&(Cr===s.UNSIGNED_BYTE&&(Si=s.RG8UI),Cr===s.UNSIGNED_SHORT&&(Si=s.RG16UI),Cr===s.UNSIGNED_INT&&(Si=s.RG32UI),Cr===s.BYTE&&(Si=s.RG8I),Cr===s.SHORT&&(Si=s.RG16I),Cr===s.INT&&(Si=s.RG32I)),St===s.RGB_INTEGER&&(Cr===s.UNSIGNED_BYTE&&(Si=s.RGB8UI),Cr===s.UNSIGNED_SHORT&&(Si=s.RGB16UI),Cr===s.UNSIGNED_INT&&(Si=s.RGB32UI),Cr===s.BYTE&&(Si=s.RGB8I),Cr===s.SHORT&&(Si=s.RGB16I),Cr===s.INT&&(Si=s.RGB32I)),St===s.RGBA_INTEGER&&(Cr===s.UNSIGNED_BYTE&&(Si=s.RGBA8UI),Cr===s.UNSIGNED_SHORT&&(Si=s.RGBA16UI),Cr===s.UNSIGNED_INT&&(Si=s.RGBA32UI),Cr===s.BYTE&&(Si=s.RGBA8I),Cr===s.SHORT&&(Si=s.RGBA16I),Cr===s.INT&&(Si=s.RGBA32I)),St===s.RGB&&(Cr===s.UNSIGNED_INT_5_9_9_9_REV&&(Si=s.RGB9_E5),Cr===s.UNSIGNED_INT_10F_11F_11F_REV&&(Si=s.R11F_G11F_B10F)),St===s.RGBA){const La=Qi?Uu:xr.getTransfer(xi);Cr===s.FLOAT&&(Si=s.RGBA32F),Cr===s.HALF_FLOAT&&(Si=s.RGBA16F),Cr===s.UNSIGNED_BYTE&&(Si=La===ws?s.SRGB8_ALPHA8:s.RGBA8),Cr===s.UNSIGNED_SHORT_4_4_4_4&&(Si=s.RGBA4),Cr===s.UNSIGNED_SHORT_5_5_5_1&&(Si=s.RGB5_A1)}return(Si===s.R16F||Si===s.R32F||Si===s.RG16F||Si===s.RG32F||Si===s.RGBA16F||Si===s.RGBA32F)&&e.get("EXT_color_buffer_float"),Si}function ke(Mn,St){let Cr;return Mn?St===null||St===st||St===ar?Cr=s.DEPTH24_STENCIL8:St===dt?Cr=s.DEPTH32F_STENCIL8:St===rn&&(Cr=s.DEPTH24_STENCIL8,Lr("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):St===null||St===st||St===ar?Cr=s.DEPTH_COMPONENT24:St===dt?Cr=s.DEPTH_COMPONENT32F:St===rn&&(Cr=s.DEPTH_COMPONENT16),Cr}function nt(Mn,St){return ee(Mn)===!0||Mn.isFramebufferTexture&&Mn.minFilter!==cn&&Mn.minFilter!==vr?Math.log2(Math.max(St.width,St.height))+1:Mn.mipmaps!==void 0&&Mn.mipmaps.length>0?Mn.mipmaps.length:Mn.isCompressedTexture&&Array.isArray(Mn.image)?St.mipmaps.length:1}function Ye(Mn){const St=Mn.target;St.removeEventListener("dispose",Ye),Rt(St),St.isVideoTexture&&g.delete(St)}function ht(Mn){const St=Mn.target;St.removeEventListener("dispose",ht),pt(St)}function Rt(Mn){const St=n.get(Mn);if(St.__webglInit===void 0)return;const Cr=Mn.source,xi=M.get(Cr);if(xi){const Qi=xi[St.__cacheKey];Qi.usedTimes--,Qi.usedTimes===0&&qe(Mn),Object.keys(xi).length===0&&M.delete(Cr)}n.remove(Mn)}function qe(Mn){const St=n.get(Mn);s.deleteTexture(St.__webglTexture);const Cr=Mn.source,xi=M.get(Cr);delete xi[St.__cacheKey],o.memory.textures--}function pt(Mn){const St=n.get(Mn);if(Mn.depthTexture&&(Mn.depthTexture.dispose(),n.remove(Mn.depthTexture)),Mn.isWebGLCubeRenderTarget)for(let xi=0;xi<6;xi++){if(Array.isArray(St.__webglFramebuffer[xi]))for(let Qi=0;Qi<St.__webglFramebuffer[xi].length;Qi++)s.deleteFramebuffer(St.__webglFramebuffer[xi][Qi]);else s.deleteFramebuffer(St.__webglFramebuffer[xi]);St.__webglDepthbuffer&&s.deleteRenderbuffer(St.__webglDepthbuffer[xi])}else{if(Array.isArray(St.__webglFramebuffer))for(let xi=0;xi<St.__webglFramebuffer.length;xi++)s.deleteFramebuffer(St.__webglFramebuffer[xi]);else s.deleteFramebuffer(St.__webglFramebuffer);if(St.__webglDepthbuffer&&s.deleteRenderbuffer(St.__webglDepthbuffer),St.__webglMultisampledFramebuffer&&s.deleteFramebuffer(St.__webglMultisampledFramebuffer),St.__webglColorRenderbuffer)for(let xi=0;xi<St.__webglColorRenderbuffer.length;xi++)St.__webglColorRenderbuffer[xi]&&s.deleteRenderbuffer(St.__webglColorRenderbuffer[xi]);St.__webglDepthRenderbuffer&&s.deleteRenderbuffer(St.__webglDepthRenderbuffer)}const Cr=Mn.textures;for(let xi=0,Qi=Cr.length;xi<Qi;xi++){const Si=n.get(Cr[xi]);Si.__webglTexture&&(s.deleteTexture(Si.__webglTexture),o.memory.textures--),n.remove(Cr[xi])}n.remove(Mn)}let xn=0;function cr(){xn=0}function pr(){const Mn=xn;return Mn>=i.maxTextures&&Lr("WebGLTextures: Trying to use "+Mn+" texture units while this GPU supports only "+i.maxTextures),xn+=1,Mn}function Br(Mn){const St=[];return St.push(Mn.wrapS),St.push(Mn.wrapT),St.push(Mn.wrapR||0),St.push(Mn.magFilter),St.push(Mn.minFilter),St.push(Mn.anisotropy),St.push(Mn.internalFormat),St.push(Mn.format),St.push(Mn.type),St.push(Mn.generateMipmaps),St.push(Mn.premultiplyAlpha),St.push(Mn.flipY),St.push(Mn.unpackAlignment),St.push(Mn.colorSpace),St.join()}function zr(Mn,St){const Cr=n.get(Mn);if(Mn.isVideoTexture&&da(Mn),Mn.isRenderTargetTexture===!1&&Mn.isExternalTexture!==!0&&Mn.version>0&&Cr.__version!==Mn.version){const xi=Mn.image;if(xi===null)Lr("WebGLRenderer: Texture marked for update but no image data found.");else if(xi.complete===!1)Lr("WebGLRenderer: Texture marked for update but image is incomplete");else{Nr(Cr,Mn,St);return}}else Mn.isExternalTexture&&(Cr.__webglTexture=Mn.sourceTexture?Mn.sourceTexture:null);t.bindTexture(s.TEXTURE_2D,Cr.__webglTexture,s.TEXTURE0+St)}function Dr(Mn,St){const Cr=n.get(Mn);if(Mn.isRenderTargetTexture===!1&&Mn.version>0&&Cr.__version!==Mn.version){Nr(Cr,Mn,St);return}else Mn.isExternalTexture&&(Cr.__webglTexture=Mn.sourceTexture?Mn.sourceTexture:null);t.bindTexture(s.TEXTURE_2D_ARRAY,Cr.__webglTexture,s.TEXTURE0+St)}function Zr(Mn,St){const Cr=n.get(Mn);if(Mn.isRenderTargetTexture===!1&&Mn.version>0&&Cr.__version!==Mn.version){Nr(Cr,Mn,St);return}t.bindTexture(s.TEXTURE_3D,Cr.__webglTexture,s.TEXTURE0+St)}function Ti(Mn,St){const Cr=n.get(Mn);if(Mn.isCubeDepthTexture!==!0&&Mn.version>0&&Cr.__version!==Mn.version){Yr(Cr,Mn,St);return}t.bindTexture(s.TEXTURE_CUBE_MAP,Cr.__webglTexture,s.TEXTURE0+St)}const ds={[$t]:s.REPEAT,[Vt]:s.CLAMP_TO_EDGE,[Qt]:s.MIRRORED_REPEAT},As={[cn]:s.NEAREST,[Yn]:s.NEAREST_MIPMAP_NEAREST,[Sr]:s.NEAREST_MIPMAP_LINEAR,[vr]:s.LINEAR,[Ki]:s.LINEAR_MIPMAP_NEAREST,[yi]:s.LINEAR_MIPMAP_LINEAR},Xr={[gu]:s.NEVER,[$u]:s.ALWAYS,[oo]:s.LESS,[jc]:s.LEQUAL,[Ic]:s.EQUAL,[Ji]:s.GEQUAL,[ph]:s.GREATER,[Lo]:s.NOTEQUAL};function Yi(Mn,St){if(St.type===dt&&e.has("OES_texture_float_linear")===!1&&(St.magFilter===vr||St.magFilter===Ki||St.magFilter===Sr||St.magFilter===yi||St.minFilter===vr||St.minFilter===Ki||St.minFilter===Sr||St.minFilter===yi)&&Lr("WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),s.texParameteri(Mn,s.TEXTURE_WRAP_S,ds[St.wrapS]),s.texParameteri(Mn,s.TEXTURE_WRAP_T,ds[St.wrapT]),(Mn===s.TEXTURE_3D||Mn===s.TEXTURE_2D_ARRAY)&&s.texParameteri(Mn,s.TEXTURE_WRAP_R,ds[St.wrapR]),s.texParameteri(Mn,s.TEXTURE_MAG_FILTER,As[St.magFilter]),s.texParameteri(Mn,s.TEXTURE_MIN_FILTER,As[St.minFilter]),St.compareFunction&&(s.texParameteri(Mn,s.TEXTURE_COMPARE_MODE,s.COMPARE_REF_TO_TEXTURE),s.texParameteri(Mn,s.TEXTURE_COMPARE_FUNC,Xr[St.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(St.magFilter===cn||St.minFilter!==Sr&&St.minFilter!==yi||St.type===dt&&e.has("OES_texture_float_linear")===!1)return;if(St.anisotropy>1||n.get(St).__currentAnisotropy){const Cr=e.get("EXT_texture_filter_anisotropic");s.texParameterf(Mn,Cr.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(St.anisotropy,i.getMaxAnisotropy())),n.get(St).__currentAnisotropy=St.anisotropy}}}function ps(Mn,St){let Cr=!1;Mn.__webglInit===void 0&&(Mn.__webglInit=!0,St.addEventListener("dispose",Ye));const xi=St.source;let Qi=M.get(xi);Qi===void 0&&(Qi={},M.set(xi,Qi));const Si=Br(St);if(Si!==Mn.__cacheKey){Qi[Si]===void 0&&(Qi[Si]={texture:s.createTexture(),usedTimes:0},o.memory.textures++,Cr=!0),Qi[Si].usedTimes++;const La=Qi[Mn.__cacheKey];La!==void 0&&(Qi[Mn.__cacheKey].usedTimes--,La.usedTimes===0&&qe(St)),Mn.__cacheKey=Si,Mn.__webglTexture=Qi[Si].texture}return Cr}function Xa(Mn,St,Cr){return Math.floor(Math.floor(Mn/Cr)/St)}function Pi(Mn,St,Cr,xi){const Si=Mn.updateRanges;if(Si.length===0)t.texSubImage2D(s.TEXTURE_2D,0,0,0,St.width,St.height,Cr,xi,St.data);else{Si.sort((hs,js)=>hs.start-js.start);let La=0;for(let hs=1;hs<Si.length;hs++){const js=Si[La],Fa=Si[hs],Va=js.start+js.count,$s=Xa(Fa.start,St.width,4),Wo=Xa(js.start,St.width,4);Fa.start<=Va+1&&$s===Wo&&Xa(Fa.start+Fa.count-1,St.width,4)===$s?js.count=Math.max(js.count,Fa.start+Fa.count-js.start):(++La,Si[La]=Fa)}Si.length=La+1;const Vs=s.getParameter(s.UNPACK_ROW_LENGTH),Na=s.getParameter(s.UNPACK_SKIP_PIXELS),po=s.getParameter(s.UNPACK_SKIP_ROWS);s.pixelStorei(s.UNPACK_ROW_LENGTH,St.width);for(let hs=0,js=Si.length;hs<js;hs++){const Fa=Si[hs],Va=Math.floor(Fa.start/4),$s=Math.ceil(Fa.count/4),Wo=Va%St.width,Mr=Math.floor(Va/St.width),la=$s,Ts=1;s.pixelStorei(s.UNPACK_SKIP_PIXELS,Wo),s.pixelStorei(s.UNPACK_SKIP_ROWS,Mr),t.texSubImage2D(s.TEXTURE_2D,0,Wo,Mr,la,Ts,Cr,xi,St.data)}Mn.clearUpdateRanges(),s.pixelStorei(s.UNPACK_ROW_LENGTH,Vs),s.pixelStorei(s.UNPACK_SKIP_PIXELS,Na),s.pixelStorei(s.UNPACK_SKIP_ROWS,po)}}function Nr(Mn,St,Cr){let xi=s.TEXTURE_2D;(St.isDataArrayTexture||St.isCompressedArrayTexture)&&(xi=s.TEXTURE_2D_ARRAY),St.isData3DTexture&&(xi=s.TEXTURE_3D);const Qi=ps(Mn,St),Si=St.source;t.bindTexture(xi,Mn.__webglTexture,s.TEXTURE0+Cr);const La=n.get(Si);if(Si.version!==La.__version||Qi===!0){t.activeTexture(s.TEXTURE0+Cr);const Vs=xr.getPrimaries(xr.workingColorSpace),Na=St.colorSpace===ao?null:xr.getPrimaries(St.colorSpace),po=St.colorSpace===ao||Vs===Na?s.NONE:s.BROWSER_DEFAULT_WEBGL;s.pixelStorei(s.UNPACK_FLIP_Y_WEBGL,St.flipY),s.pixelStorei(s.UNPACK_PREMULTIPLY_ALPHA_WEBGL,St.premultiplyAlpha),s.pixelStorei(s.UNPACK_ALIGNMENT,St.unpackAlignment),s.pixelStorei(s.UNPACK_COLORSPACE_CONVERSION_WEBGL,po);let hs=ne(St.image,!1,i.maxTextureSize);hs=ho(St,hs);const js=a.convert(St.format,St.colorSpace),Fa=a.convert(St.type);let Va=Ce(St.internalFormat,js,Fa,St.colorSpace,St.isVideoTexture);Yi(xi,St);let $s;const Wo=St.mipmaps,Mr=St.isVideoTexture!==!0,la=La.__version===void 0||Qi===!0,Ts=Si.dataReady,ga=nt(St,hs);if(St.isDepthTexture)Va=ke(St.format===w,St.type),la&&(Mr?t.texStorage2D(s.TEXTURE_2D,1,Va,hs.width,hs.height):t.texImage2D(s.TEXTURE_2D,0,Va,hs.width,hs.height,0,js,Fa,null));else if(St.isDataTexture)if(Wo.length>0){Mr&&la&&t.texStorage2D(s.TEXTURE_2D,ga,Va,Wo[0].width,Wo[0].height);for(let gs=0,Wi=Wo.length;gs<Wi;gs++)$s=Wo[gs],Mr?Ts&&t.texSubImage2D(s.TEXTURE_2D,gs,0,0,$s.width,$s.height,js,Fa,$s.data):t.texImage2D(s.TEXTURE_2D,gs,Va,$s.width,$s.height,0,js,Fa,$s.data);St.generateMipmaps=!1}else Mr?(la&&t.texStorage2D(s.TEXTURE_2D,ga,Va,hs.width,hs.height),Ts&&Pi(St,hs,js,Fa)):t.texImage2D(s.TEXTURE_2D,0,Va,hs.width,hs.height,0,js,Fa,hs.data);else if(St.isCompressedTexture)if(St.isCompressedArrayTexture){Mr&&la&&t.texStorage3D(s.TEXTURE_2D_ARRAY,ga,Va,Wo[0].width,Wo[0].height,hs.depth);for(let gs=0,Wi=Wo.length;gs<Wi;gs++)if($s=Wo[gs],St.format!==L)if(js!==null)if(Mr){if(Ts)if(St.layerUpdates.size>0){const Ws=l($s.width,$s.height,St.format,St.type);for(const Eo of St.layerUpdates){const Wu=$s.data.subarray(Eo*Ws/$s.data.BYTES_PER_ELEMENT,(Eo+1)*Ws/$s.data.BYTES_PER_ELEMENT);t.compressedTexSubImage3D(s.TEXTURE_2D_ARRAY,gs,0,0,Eo,$s.width,$s.height,1,js,Wu)}St.clearLayerUpdates()}else t.compressedTexSubImage3D(s.TEXTURE_2D_ARRAY,gs,0,0,0,$s.width,$s.height,hs.depth,js,$s.data)}else t.compressedTexImage3D(s.TEXTURE_2D_ARRAY,gs,Va,$s.width,$s.height,hs.depth,0,$s.data,0,0);else Lr("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else Mr?Ts&&t.texSubImage3D(s.TEXTURE_2D_ARRAY,gs,0,0,0,$s.width,$s.height,hs.depth,js,Fa,$s.data):t.texImage3D(s.TEXTURE_2D_ARRAY,gs,Va,$s.width,$s.height,hs.depth,0,js,Fa,$s.data)}else{Mr&&la&&t.texStorage2D(s.TEXTURE_2D,ga,Va,Wo[0].width,Wo[0].height);for(let gs=0,Wi=Wo.length;gs<Wi;gs++)$s=Wo[gs],St.format!==L?js!==null?Mr?Ts&&t.compressedTexSubImage2D(s.TEXTURE_2D,gs,0,0,$s.width,$s.height,js,$s.data):t.compressedTexImage2D(s.TEXTURE_2D,gs,Va,$s.width,$s.height,0,$s.data):Lr("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):Mr?Ts&&t.texSubImage2D(s.TEXTURE_2D,gs,0,0,$s.width,$s.height,js,Fa,$s.data):t.texImage2D(s.TEXTURE_2D,gs,Va,$s.width,$s.height,0,js,Fa,$s.data)}else if(St.isDataArrayTexture)if(Mr){if(la&&t.texStorage3D(s.TEXTURE_2D_ARRAY,ga,Va,hs.width,hs.height,hs.depth),Ts)if(St.layerUpdates.size>0){const gs=l(hs.width,hs.height,St.format,St.type);for(const Wi of St.layerUpdates){const Ws=hs.data.subarray(Wi*gs/hs.data.BYTES_PER_ELEMENT,(Wi+1)*gs/hs.data.BYTES_PER_ELEMENT);t.texSubImage3D(s.TEXTURE_2D_ARRAY,0,0,0,Wi,hs.width,hs.height,1,js,Fa,Ws)}St.clearLayerUpdates()}else t.texSubImage3D(s.TEXTURE_2D_ARRAY,0,0,0,0,hs.width,hs.height,hs.depth,js,Fa,hs.data)}else t.texImage3D(s.TEXTURE_2D_ARRAY,0,Va,hs.width,hs.height,hs.depth,0,js,Fa,hs.data);else if(St.isData3DTexture)Mr?(la&&t.texStorage3D(s.TEXTURE_3D,ga,Va,hs.width,hs.height,hs.depth),Ts&&t.texSubImage3D(s.TEXTURE_3D,0,0,0,0,hs.width,hs.height,hs.depth,js,Fa,hs.data)):t.texImage3D(s.TEXTURE_3D,0,Va,hs.width,hs.height,hs.depth,0,js,Fa,hs.data);else if(St.isFramebufferTexture){if(la)if(Mr)t.texStorage2D(s.TEXTURE_2D,ga,Va,hs.width,hs.height);else{let gs=hs.width,Wi=hs.height;for(let Ws=0;Ws<ga;Ws++)t.texImage2D(s.TEXTURE_2D,Ws,Va,gs,Wi,0,js,Fa,null),gs>>=1,Wi>>=1}}else if(Wo.length>0){if(Mr&&la){const gs=Ps(Wo[0]);t.texStorage2D(s.TEXTURE_2D,ga,Va,gs.width,gs.height)}for(let gs=0,Wi=Wo.length;gs<Wi;gs++)$s=Wo[gs],Mr?Ts&&t.texSubImage2D(s.TEXTURE_2D,gs,0,0,js,Fa,$s):t.texImage2D(s.TEXTURE_2D,gs,Va,js,Fa,$s);St.generateMipmaps=!1}else if(Mr){if(la){const gs=Ps(hs);t.texStorage2D(s.TEXTURE_2D,ga,Va,gs.width,gs.height)}Ts&&t.texSubImage2D(s.TEXTURE_2D,0,0,0,js,Fa,hs)}else t.texImage2D(s.TEXTURE_2D,0,Va,js,Fa,hs);ee(St)&&q(xi),La.__version=Si.version,St.onUpdate&&St.onUpdate(St)}Mn.__version=St.version}function Yr(Mn,St,Cr){if(St.image.length!==6)return;const xi=ps(Mn,St),Qi=St.source;t.bindTexture(s.TEXTURE_CUBE_MAP,Mn.__webglTexture,s.TEXTURE0+Cr);const Si=n.get(Qi);if(Qi.version!==Si.__version||xi===!0){t.activeTexture(s.TEXTURE0+Cr);const La=xr.getPrimaries(xr.workingColorSpace),Vs=St.colorSpace===ao?null:xr.getPrimaries(St.colorSpace),Na=St.colorSpace===ao||La===Vs?s.NONE:s.BROWSER_DEFAULT_WEBGL;s.pixelStorei(s.UNPACK_FLIP_Y_WEBGL,St.flipY),s.pixelStorei(s.UNPACK_PREMULTIPLY_ALPHA_WEBGL,St.premultiplyAlpha),s.pixelStorei(s.UNPACK_ALIGNMENT,St.unpackAlignment),s.pixelStorei(s.UNPACK_COLORSPACE_CONVERSION_WEBGL,Na);const po=St.isCompressedTexture||St.image[0].isCompressedTexture,hs=St.image[0]&&St.image[0].isDataTexture,js=[];for(let Wi=0;Wi<6;Wi++)!po&&!hs?js[Wi]=ne(St.image[Wi],!0,i.maxCubemapSize):js[Wi]=hs?St.image[Wi].image:St.image[Wi],js[Wi]=ho(St,js[Wi]);const Fa=js[0],Va=a.convert(St.format,St.colorSpace),$s=a.convert(St.type),Wo=Ce(St.internalFormat,Va,$s,St.colorSpace),Mr=St.isVideoTexture!==!0,la=Si.__version===void 0||xi===!0,Ts=Qi.dataReady;let ga=nt(St,Fa);Yi(s.TEXTURE_CUBE_MAP,St);let gs;if(po){Mr&&la&&t.texStorage2D(s.TEXTURE_CUBE_MAP,ga,Wo,Fa.width,Fa.height);for(let Wi=0;Wi<6;Wi++){gs=js[Wi].mipmaps;for(let Ws=0;Ws<gs.length;Ws++){const Eo=gs[Ws];St.format!==L?Va!==null?Mr?Ts&&t.compressedTexSubImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+Wi,Ws,0,0,Eo.width,Eo.height,Va,Eo.data):t.compressedTexImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+Wi,Ws,Wo,Eo.width,Eo.height,0,Eo.data):Lr("WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):Mr?Ts&&t.texSubImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+Wi,Ws,0,0,Eo.width,Eo.height,Va,$s,Eo.data):t.texImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+Wi,Ws,Wo,Eo.width,Eo.height,0,Va,$s,Eo.data)}}}else{if(gs=St.mipmaps,Mr&&la){gs.length>0&&ga++;const Wi=Ps(js[0]);t.texStorage2D(s.TEXTURE_CUBE_MAP,ga,Wo,Wi.width,Wi.height)}for(let Wi=0;Wi<6;Wi++)if(hs){Mr?Ts&&t.texSubImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+Wi,0,0,0,js[Wi].width,js[Wi].height,Va,$s,js[Wi].data):t.texImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+Wi,0,Wo,js[Wi].width,js[Wi].height,0,Va,$s,js[Wi].data);for(let Ws=0;Ws<gs.length;Ws++){const Wu=gs[Ws].image[Wi].image;Mr?Ts&&t.texSubImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+Wi,Ws+1,0,0,Wu.width,Wu.height,Va,$s,Wu.data):t.texImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+Wi,Ws+1,Wo,Wu.width,Wu.height,0,Va,$s,Wu.data)}}else{Mr?Ts&&t.texSubImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+Wi,0,0,0,Va,$s,js[Wi]):t.texImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+Wi,0,Wo,Va,$s,js[Wi]);for(let Ws=0;Ws<gs.length;Ws++){const Eo=gs[Ws];Mr?Ts&&t.texSubImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+Wi,Ws+1,0,0,Va,$s,Eo.image[Wi]):t.texImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+Wi,Ws+1,Wo,Va,$s,Eo.image[Wi])}}}ee(St)&&q(s.TEXTURE_CUBE_MAP),Si.__version=Qi.version,St.onUpdate&&St.onUpdate(St)}Mn.__version=St.version}function cs(Mn,St,Cr,xi,Qi,Si){const La=a.convert(Cr.format,Cr.colorSpace),Vs=a.convert(Cr.type),Na=Ce(Cr.internalFormat,La,Vs,Cr.colorSpace),po=n.get(St),hs=n.get(Cr);if(hs.__renderTarget=St,!po.__hasExternalTextures){const js=Math.max(1,St.width>>Si),Fa=Math.max(1,St.height>>Si);Qi===s.TEXTURE_3D||Qi===s.TEXTURE_2D_ARRAY?t.texImage3D(Qi,Si,Na,js,Fa,St.depth,0,La,Vs,null):t.texImage2D(Qi,Si,Na,js,Fa,0,La,Vs,null)}t.bindFramebuffer(s.FRAMEBUFFER,Mn),ja(St)?u.framebufferTexture2DMultisampleEXT(s.FRAMEBUFFER,xi,Qi,hs.__webglTexture,0,Pn(St)):(Qi===s.TEXTURE_2D||Qi>=s.TEXTURE_CUBE_MAP_POSITIVE_X&&Qi<=s.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&s.framebufferTexture2D(s.FRAMEBUFFER,xi,Qi,hs.__webglTexture,Si),t.bindFramebuffer(s.FRAMEBUFFER,null)}function oa(Mn,St,Cr){if(s.bindRenderbuffer(s.RENDERBUFFER,Mn),St.depthBuffer){const xi=St.depthTexture,Qi=xi&&xi.isDepthTexture?xi.type:null,Si=ke(St.stencilBuffer,Qi),La=St.stencilBuffer?s.DEPTH_STENCIL_ATTACHMENT:s.DEPTH_ATTACHMENT;ja(St)?u.renderbufferStorageMultisampleEXT(s.RENDERBUFFER,Pn(St),Si,St.width,St.height):Cr?s.renderbufferStorageMultisample(s.RENDERBUFFER,Pn(St),Si,St.width,St.height):s.renderbufferStorage(s.RENDERBUFFER,Si,St.width,St.height),s.framebufferRenderbuffer(s.FRAMEBUFFER,La,s.RENDERBUFFER,Mn)}else{const xi=St.textures;for(let Qi=0;Qi<xi.length;Qi++){const Si=xi[Qi],La=a.convert(Si.format,Si.colorSpace),Vs=a.convert(Si.type),Na=Ce(Si.internalFormat,La,Vs,Si.colorSpace);ja(St)?u.renderbufferStorageMultisampleEXT(s.RENDERBUFFER,Pn(St),Na,St.width,St.height):Cr?s.renderbufferStorageMultisample(s.RENDERBUFFER,Pn(St),Na,St.width,St.height):s.renderbufferStorage(s.RENDERBUFFER,Na,St.width,St.height)}}s.bindRenderbuffer(s.RENDERBUFFER,null)}function Ms(Mn,St,Cr){const xi=St.isWebGLCubeRenderTarget===!0;if(t.bindFramebuffer(s.FRAMEBUFFER,Mn),!(St.depthTexture&&St.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");const Qi=n.get(St.depthTexture);if(Qi.__renderTarget=St,(!Qi.__webglTexture||St.depthTexture.image.width!==St.width||St.depthTexture.image.height!==St.height)&&(St.depthTexture.image.width=St.width,St.depthTexture.image.height=St.height,St.depthTexture.needsUpdate=!0),xi){if(Qi.__webglInit===void 0&&(Qi.__webglInit=!0,St.depthTexture.addEventListener("dispose",Ye)),Qi.__webglTexture===void 0){Qi.__webglTexture=s.createTexture(),t.bindTexture(s.TEXTURE_CUBE_MAP,Qi.__webglTexture),Yi(s.TEXTURE_CUBE_MAP,St.depthTexture);const po=a.convert(St.depthTexture.format),hs=a.convert(St.depthTexture.type);let js;St.depthTexture.format===Q?js=s.DEPTH_COMPONENT24:St.depthTexture.format===w&&(js=s.DEPTH24_STENCIL8);for(let Fa=0;Fa<6;Fa++)s.texImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+Fa,0,js,St.width,St.height,0,po,hs,null)}}else zr(St.depthTexture,0);const Si=Qi.__webglTexture,La=Pn(St),Vs=xi?s.TEXTURE_CUBE_MAP_POSITIVE_X+Cr:s.TEXTURE_2D,Na=St.depthTexture.format===w?s.DEPTH_STENCIL_ATTACHMENT:s.DEPTH_ATTACHMENT;if(St.depthTexture.format===Q)ja(St)?u.framebufferTexture2DMultisampleEXT(s.FRAMEBUFFER,Na,Vs,Si,0,La):s.framebufferTexture2D(s.FRAMEBUFFER,Na,Vs,Si,0);else if(St.depthTexture.format===w)ja(St)?u.framebufferTexture2DMultisampleEXT(s.FRAMEBUFFER,Na,Vs,Si,0,La):s.framebufferTexture2D(s.FRAMEBUFFER,Na,Vs,Si,0);else throw new Error("Unknown depthTexture format")}function Ha(Mn){const St=n.get(Mn),Cr=Mn.isWebGLCubeRenderTarget===!0;if(St.__boundDepthTexture!==Mn.depthTexture){const xi=Mn.depthTexture;if(St.__depthDisposeCallback&&St.__depthDisposeCallback(),xi){const Qi=()=>{delete St.__boundDepthTexture,delete St.__depthDisposeCallback,xi.removeEventListener("dispose",Qi)};xi.addEventListener("dispose",Qi),St.__depthDisposeCallback=Qi}St.__boundDepthTexture=xi}if(Mn.depthTexture&&!St.__autoAllocateDepthBuffer)if(Cr)for(let xi=0;xi<6;xi++)Ms(St.__webglFramebuffer[xi],Mn,xi);else{const xi=Mn.texture.mipmaps;xi&&xi.length>0?Ms(St.__webglFramebuffer[0],Mn,0):Ms(St.__webglFramebuffer,Mn,0)}else if(Cr){St.__webglDepthbuffer=[];for(let xi=0;xi<6;xi++)if(t.bindFramebuffer(s.FRAMEBUFFER,St.__webglFramebuffer[xi]),St.__webglDepthbuffer[xi]===void 0)St.__webglDepthbuffer[xi]=s.createRenderbuffer(),oa(St.__webglDepthbuffer[xi],Mn,!1);else{const Qi=Mn.stencilBuffer?s.DEPTH_STENCIL_ATTACHMENT:s.DEPTH_ATTACHMENT,Si=St.__webglDepthbuffer[xi];s.bindRenderbuffer(s.RENDERBUFFER,Si),s.framebufferRenderbuffer(s.FRAMEBUFFER,Qi,s.RENDERBUFFER,Si)}}else{const xi=Mn.texture.mipmaps;if(xi&&xi.length>0?t.bindFramebuffer(s.FRAMEBUFFER,St.__webglFramebuffer[0]):t.bindFramebuffer(s.FRAMEBUFFER,St.__webglFramebuffer),St.__webglDepthbuffer===void 0)St.__webglDepthbuffer=s.createRenderbuffer(),oa(St.__webglDepthbuffer,Mn,!1);else{const Qi=Mn.stencilBuffer?s.DEPTH_STENCIL_ATTACHMENT:s.DEPTH_ATTACHMENT,Si=St.__webglDepthbuffer;s.bindRenderbuffer(s.RENDERBUFFER,Si),s.framebufferRenderbuffer(s.FRAMEBUFFER,Qi,s.RENDERBUFFER,Si)}}t.bindFramebuffer(s.FRAMEBUFFER,null)}function Qo(Mn,St,Cr){const xi=n.get(Mn);St!==void 0&&cs(xi.__webglFramebuffer,Mn,Mn.texture,s.COLOR_ATTACHMENT0,s.TEXTURE_2D,0),Cr!==void 0&&Ha(Mn)}function co(Mn){const St=Mn.texture,Cr=n.get(Mn),xi=n.get(St);Mn.addEventListener("dispose",ht);const Qi=Mn.textures,Si=Mn.isWebGLCubeRenderTarget===!0,La=Qi.length>1;if(La||(xi.__webglTexture===void 0&&(xi.__webglTexture=s.createTexture()),xi.__version=St.version,o.memory.textures++),Si){Cr.__webglFramebuffer=[];for(let Vs=0;Vs<6;Vs++)if(St.mipmaps&&St.mipmaps.length>0){Cr.__webglFramebuffer[Vs]=[];for(let Na=0;Na<St.mipmaps.length;Na++)Cr.__webglFramebuffer[Vs][Na]=s.createFramebuffer()}else Cr.__webglFramebuffer[Vs]=s.createFramebuffer()}else{if(St.mipmaps&&St.mipmaps.length>0){Cr.__webglFramebuffer=[];for(let Vs=0;Vs<St.mipmaps.length;Vs++)Cr.__webglFramebuffer[Vs]=s.createFramebuffer()}else Cr.__webglFramebuffer=s.createFramebuffer();if(La)for(let Vs=0,Na=Qi.length;Vs<Na;Vs++){const po=n.get(Qi[Vs]);po.__webglTexture===void 0&&(po.__webglTexture=s.createTexture(),o.memory.textures++)}if(Mn.samples>0&&ja(Mn)===!1){Cr.__webglMultisampledFramebuffer=s.createFramebuffer(),Cr.__webglColorRenderbuffer=[],t.bindFramebuffer(s.FRAMEBUFFER,Cr.__webglMultisampledFramebuffer);for(let Vs=0;Vs<Qi.length;Vs++){const Na=Qi[Vs];Cr.__webglColorRenderbuffer[Vs]=s.createRenderbuffer(),s.bindRenderbuffer(s.RENDERBUFFER,Cr.__webglColorRenderbuffer[Vs]);const po=a.convert(Na.format,Na.colorSpace),hs=a.convert(Na.type),js=Ce(Na.internalFormat,po,hs,Na.colorSpace,Mn.isXRRenderTarget===!0),Fa=Pn(Mn);s.renderbufferStorageMultisample(s.RENDERBUFFER,Fa,js,Mn.width,Mn.height),s.framebufferRenderbuffer(s.FRAMEBUFFER,s.COLOR_ATTACHMENT0+Vs,s.RENDERBUFFER,Cr.__webglColorRenderbuffer[Vs])}s.bindRenderbuffer(s.RENDERBUFFER,null),Mn.depthBuffer&&(Cr.__webglDepthRenderbuffer=s.createRenderbuffer(),oa(Cr.__webglDepthRenderbuffer,Mn,!0)),t.bindFramebuffer(s.FRAMEBUFFER,null)}}if(Si){t.bindTexture(s.TEXTURE_CUBE_MAP,xi.__webglTexture),Yi(s.TEXTURE_CUBE_MAP,St);for(let Vs=0;Vs<6;Vs++)if(St.mipmaps&&St.mipmaps.length>0)for(let Na=0;Na<St.mipmaps.length;Na++)cs(Cr.__webglFramebuffer[Vs][Na],Mn,St,s.COLOR_ATTACHMENT0,s.TEXTURE_CUBE_MAP_POSITIVE_X+Vs,Na);else cs(Cr.__webglFramebuffer[Vs],Mn,St,s.COLOR_ATTACHMENT0,s.TEXTURE_CUBE_MAP_POSITIVE_X+Vs,0);ee(St)&&q(s.TEXTURE_CUBE_MAP),t.unbindTexture()}else if(La){for(let Vs=0,Na=Qi.length;Vs<Na;Vs++){const po=Qi[Vs],hs=n.get(po);let js=s.TEXTURE_2D;(Mn.isWebGL3DRenderTarget||Mn.isWebGLArrayRenderTarget)&&(js=Mn.isWebGL3DRenderTarget?s.TEXTURE_3D:s.TEXTURE_2D_ARRAY),t.bindTexture(js,hs.__webglTexture),Yi(js,po),cs(Cr.__webglFramebuffer,Mn,po,s.COLOR_ATTACHMENT0+Vs,js,0),ee(po)&&q(js)}t.unbindTexture()}else{let Vs=s.TEXTURE_2D;if((Mn.isWebGL3DRenderTarget||Mn.isWebGLArrayRenderTarget)&&(Vs=Mn.isWebGL3DRenderTarget?s.TEXTURE_3D:s.TEXTURE_2D_ARRAY),t.bindTexture(Vs,xi.__webglTexture),Yi(Vs,St),St.mipmaps&&St.mipmaps.length>0)for(let Na=0;Na<St.mipmaps.length;Na++)cs(Cr.__webglFramebuffer[Na],Mn,St,s.COLOR_ATTACHMENT0,Vs,Na);else cs(Cr.__webglFramebuffer,Mn,St,s.COLOR_ATTACHMENT0,Vs,0);ee(St)&&q(Vs),t.unbindTexture()}Mn.depthBuffer&&Ha(Mn)}function Li(Mn){const St=Mn.textures;for(let Cr=0,xi=St.length;Cr<xi;Cr++){const Qi=St[Cr];if(ee(Qi)){const Si=ye(Mn),La=n.get(Qi).__webglTexture;t.bindTexture(Si,La),q(Si),t.unbindTexture()}}}const os=[],Hi=[];function Fs(Mn){if(Mn.samples>0){if(ja(Mn)===!1){const St=Mn.textures,Cr=Mn.width,xi=Mn.height;let Qi=s.COLOR_BUFFER_BIT;const Si=Mn.stencilBuffer?s.DEPTH_STENCIL_ATTACHMENT:s.DEPTH_ATTACHMENT,La=n.get(Mn),Vs=St.length>1;if(Vs)for(let po=0;po<St.length;po++)t.bindFramebuffer(s.FRAMEBUFFER,La.__webglMultisampledFramebuffer),s.framebufferRenderbuffer(s.FRAMEBUFFER,s.COLOR_ATTACHMENT0+po,s.RENDERBUFFER,null),t.bindFramebuffer(s.FRAMEBUFFER,La.__webglFramebuffer),s.framebufferTexture2D(s.DRAW_FRAMEBUFFER,s.COLOR_ATTACHMENT0+po,s.TEXTURE_2D,null,0);t.bindFramebuffer(s.READ_FRAMEBUFFER,La.__webglMultisampledFramebuffer);const Na=Mn.texture.mipmaps;Na&&Na.length>0?t.bindFramebuffer(s.DRAW_FRAMEBUFFER,La.__webglFramebuffer[0]):t.bindFramebuffer(s.DRAW_FRAMEBUFFER,La.__webglFramebuffer);for(let po=0;po<St.length;po++){if(Mn.resolveDepthBuffer&&(Mn.depthBuffer&&(Qi|=s.DEPTH_BUFFER_BIT),Mn.stencilBuffer&&Mn.resolveStencilBuffer&&(Qi|=s.STENCIL_BUFFER_BIT)),Vs){s.framebufferRenderbuffer(s.READ_FRAMEBUFFER,s.COLOR_ATTACHMENT0,s.RENDERBUFFER,La.__webglColorRenderbuffer[po]);const hs=n.get(St[po]).__webglTexture;s.framebufferTexture2D(s.DRAW_FRAMEBUFFER,s.COLOR_ATTACHMENT0,s.TEXTURE_2D,hs,0)}s.blitFramebuffer(0,0,Cr,xi,0,0,Cr,xi,Qi,s.NEAREST),c===!0&&(os.length=0,Hi.length=0,os.push(s.COLOR_ATTACHMENT0+po),Mn.depthBuffer&&Mn.resolveDepthBuffer===!1&&(os.push(Si),Hi.push(Si),s.invalidateFramebuffer(s.DRAW_FRAMEBUFFER,Hi)),s.invalidateFramebuffer(s.READ_FRAMEBUFFER,os))}if(t.bindFramebuffer(s.READ_FRAMEBUFFER,null),t.bindFramebuffer(s.DRAW_FRAMEBUFFER,null),Vs)for(let po=0;po<St.length;po++){t.bindFramebuffer(s.FRAMEBUFFER,La.__webglMultisampledFramebuffer),s.framebufferRenderbuffer(s.FRAMEBUFFER,s.COLOR_ATTACHMENT0+po,s.RENDERBUFFER,La.__webglColorRenderbuffer[po]);const hs=n.get(St[po]).__webglTexture;t.bindFramebuffer(s.FRAMEBUFFER,La.__webglFramebuffer),s.framebufferTexture2D(s.DRAW_FRAMEBUFFER,s.COLOR_ATTACHMENT0+po,s.TEXTURE_2D,hs,0)}t.bindFramebuffer(s.DRAW_FRAMEBUFFER,La.__webglMultisampledFramebuffer)}else if(Mn.depthBuffer&&Mn.resolveDepthBuffer===!1&&c){const St=Mn.stencilBuffer?s.DEPTH_STENCIL_ATTACHMENT:s.DEPTH_ATTACHMENT;s.invalidateFramebuffer(s.DRAW_FRAMEBUFFER,[St])}}}function Pn(Mn){return Math.min(i.maxSamples,Mn.samples)}function ja(Mn){const St=n.get(Mn);return Mn.samples>0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&St.__useRenderToTexture!==!1}function da(Mn){const St=o.render.frame;g.get(Mn)!==St&&(g.set(Mn,St),Mn.update())}function ho(Mn,St){const Cr=Mn.colorSpace,xi=Mn.format,Qi=Mn.type;return Mn.isCompressedTexture===!0||Mn.isVideoTexture===!0||Cr!==No&&Cr!==ao&&(xr.getTransfer(Cr)===ws?(xi!==L||Qi!==es)&&Lr("WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):Gr("WebGLTextures: Unsupported texture color space:",Cr)),St}function Ps(Mn){return typeof HTMLImageElement!="undefined"&&Mn instanceof HTMLImageElement?(d.width=Mn.naturalWidth||Mn.width,d.height=Mn.naturalHeight||Mn.height):typeof VideoFrame!="undefined"&&Mn instanceof VideoFrame?(d.width=Mn.displayWidth,d.height=Mn.displayHeight):(d.width=Mn.width,d.height=Mn.height),d}this.allocateTextureUnit=pr,this.resetTextureUnits=cr,this.setTexture2D=zr,this.setTexture2DArray=Dr,this.setTexture3D=Zr,this.setTextureCube=Ti,this.rebindTextures=Qo,this.setupRenderTarget=co,this.updateRenderTargetMipmap=Li,this.updateMultisampleRenderTarget=Fs,this.setupDepthRenderbuffer=Ha,this.setupFrameBufferTexture=cs,this.useMultisampledRTT=ja,this.isReversedDepthBuffer=function(){return t.buffers.depth.getReversed()}}function O3(s,e){function t(n,i=ao){let a;const o=xr.getTransfer(i);if(n===es)return s.UNSIGNED_BYTE;if(n===bn)return s.UNSIGNED_SHORT_4_4_4_4;if(n===Jt)return s.UNSIGNED_SHORT_5_5_5_1;if(n===rr)return s.UNSIGNED_INT_5_9_9_9_REV;if(n===Kr)return s.UNSIGNED_INT_10F_11F_11F_REV;if(n===Ci)return s.BYTE;if(n===En)return s.SHORT;if(n===rn)return s.UNSIGNED_SHORT;if(n===Xt)return s.INT;if(n===st)return s.UNSIGNED_INT;if(n===dt)return s.FLOAT;if(n===Wt)return s.HALF_FLOAT;if(n===si)return s.ALPHA;if(n===Ie)return s.RGB;if(n===L)return s.RGBA;if(n===Q)return s.DEPTH_COMPONENT;if(n===w)return s.DEPTH_STENCIL;if(n===z)return s.RED;if(n===ie)return s.RED_INTEGER;if(n===ze)return s.RG;if(n===Je)return s.RG_INTEGER;if(n===xt)return s.RGBA_INTEGER;if(n===Sn||n===Oe||n===Qe||n===Re)if(o===ws)if(a=e.get("WEBGL_compressed_texture_s3tc_srgb"),a!==null){if(n===Sn)return a.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===Oe)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===Qe)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===Re)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(a=e.get("WEBGL_compressed_texture_s3tc"),a!==null){if(n===Sn)return a.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===Oe)return a.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===Qe)return a.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===Re)return a.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(n===Ke||n===gt||n===tn||n===yt)if(a=e.get("WEBGL_compressed_texture_pvrtc"),a!==null){if(n===Ke)return a.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===gt)return a.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===tn)return a.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===yt)return a.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(n===Yt||n===Rn||n===er||n===Jn||n===kr||n===fr||n===wr)if(a=e.get("WEBGL_compressed_texture_etc"),a!==null){if(n===Yt||n===Rn)return o===ws?a.COMPRESSED_SRGB8_ETC2:a.COMPRESSED_RGB8_ETC2;if(n===er)return o===ws?a.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:a.COMPRESSED_RGBA8_ETC2_EAC;if(n===Jn)return a.COMPRESSED_R11_EAC;if(n===kr)return a.COMPRESSED_SIGNED_R11_EAC;if(n===fr)return a.COMPRESSED_RG11_EAC;if(n===wr)return a.COMPRESSED_SIGNED_RG11_EAC}else return null;if(n===ei||n===_n||n===jn||n===Hr||n===Pr||n===$i||n===Zi||n===Xi||n===Ei||n===ms||n===_i||n===Es||n===ua||n===Hn)if(a=e.get("WEBGL_compressed_texture_astc"),a!==null){if(n===ei)return o===ws?a.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:a.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===_n)return o===ws?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:a.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===jn)return o===ws?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:a.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===Hr)return o===ws?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:a.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===Pr)return o===ws?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:a.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===$i)return o===ws?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:a.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===Zi)return o===ws?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:a.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===Xi)return o===ws?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:a.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===Ei)return o===ws?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:a.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===ms)return o===ws?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:a.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===_i)return o===ws?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:a.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===Es)return o===ws?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:a.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===ua)return o===ws?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:a.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===Hn)return o===ws?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:a.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(n===Pt||n===Gt||n===Bt)if(a=e.get("EXT_texture_compression_bptc"),a!==null){if(n===Pt)return o===ws?a.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:a.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(n===Gt)return a.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(n===Bt)return a.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(n===yn||n===Ln||n===gr||n===Rr)if(a=e.get("EXT_texture_compression_rgtc"),a!==null){if(n===yn)return a.COMPRESSED_RED_RGTC1_EXT;if(n===Ln)return a.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(n===gr)return a.COMPRESSED_RED_GREEN_RGTC2_EXT;if(n===Rr)return a.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return n===ar?s.UNSIGNED_INT_24_8:s[n]!==void 0?s[n]:null}return{convert:t}}const D3=`
void main() {
gl_Position = vec4( position, 1.0 );
}`,k3=`
uniform sampler2DArray depthColor;
uniform float depthWidth;
uniform float depthHeight;
void main() {
vec2 coord = vec2( gl_FragCoord.x / depthWidth, gl_FragCoord.y / depthHeight );
if ( coord.x >= 1.0 ) {
gl_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r;
} else {
gl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r;
}
}`;class V3{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t){if(this.texture===null){const n=new Fo(e.texture);(e.depthNear!==t.depthNear||e.depthFar!==t.depthFar)&&(this.depthNear=e.depthNear,this.depthFar=e.depthFar),this.texture=n}}getMesh(e){if(this.texture!==null&&this.mesh===null){const t=e.cameras[0].viewport,n=new nh({vertexShader:D3,fragmentShader:k3,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new Il(new Tc(20,20),n)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class z3 extends bl{constructor(e,t){super();const n=this;let i=null,a=1,o=null,u="local-floor",c=1,d=null,g=null,v=null,M=null,B=null,I=null;const ne=typeof XRWebGLBinding!="undefined",ee=new V3,q={},ye=t.getContextAttributes();let Ce=null,ke=null;const nt=[],Ye=[],ht=new ce;let Rt=null;const qe=new vo;qe.viewport=new Ni;const pt=new vo;pt.viewport=new Ni;const xn=[qe,pt],cr=new jp;let pr=null,Br=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(Nr){let Yr=nt[Nr];return Yr===void 0&&(Yr=new Ra,nt[Nr]=Yr),Yr.getTargetRaySpace()},this.getControllerGrip=function(Nr){let Yr=nt[Nr];return Yr===void 0&&(Yr=new Ra,nt[Nr]=Yr),Yr.getGripSpace()},this.getHand=function(Nr){let Yr=nt[Nr];return Yr===void 0&&(Yr=new Ra,nt[Nr]=Yr),Yr.getHandSpace()};function zr(Nr){const Yr=Ye.indexOf(Nr.inputSource);if(Yr===-1)return;const cs=nt[Yr];cs!==void 0&&(cs.update(Nr.inputSource,Nr.frame,d||o),cs.dispatchEvent({type:Nr.type,data:Nr.inputSource}))}function Dr(){i.removeEventListener("select",zr),i.removeEventListener("selectstart",zr),i.removeEventListener("selectend",zr),i.removeEventListener("squeeze",zr),i.removeEventListener("squeezestart",zr),i.removeEventListener("squeezeend",zr),i.removeEventListener("end",Dr),i.removeEventListener("inputsourceschange",Zr);for(let Nr=0;Nr<nt.length;Nr++){const Yr=Ye[Nr];Yr!==null&&(Ye[Nr]=null,nt[Nr].disconnect(Yr))}pr=null,Br=null,ee.reset();for(const Nr in q)delete q[Nr];e.setRenderTarget(Ce),B=null,M=null,v=null,i=null,ke=null,Pi.stop(),n.isPresenting=!1,e.setPixelRatio(Rt),e.setSize(ht.width,ht.height,!1),n.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(Nr){a=Nr,n.isPresenting===!0&&Lr("WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(Nr){u=Nr,n.isPresenting===!0&&Lr("WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return d||o},this.setReferenceSpace=function(Nr){d=Nr},this.getBaseLayer=function(){return M!==null?M:B},this.getBinding=function(){return v===null&&ne&&(v=new XRWebGLBinding(i,t)),v},this.getFrame=function(){return I},this.getSession=function(){return i},this.setSession=function(Nr){return Pa(this,null,function*(){if(i=Nr,i!==null){if(Ce=e.getRenderTarget(),i.addEventListener("select",zr),i.addEventListener("selectstart",zr),i.addEventListener("selectend",zr),i.addEventListener("squeeze",zr),i.addEventListener("squeezestart",zr),i.addEventListener("squeezeend",zr),i.addEventListener("end",Dr),i.addEventListener("inputsourceschange",Zr),ye.xrCompatible!==!0&&(yield t.makeXRCompatible()),Rt=e.getPixelRatio(),e.getSize(ht),ne&&"createProjectionLayer"in XRWebGLBinding.prototype){let cs=null,oa=null,Ms=null;ye.depth&&(Ms=ye.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,cs=ye.stencil?w:Q,oa=ye.stencil?ar:st);const Ha={colorFormat:t.RGBA8,depthFormat:Ms,scaleFactor:a};v=this.getBinding(),M=v.createProjectionLayer(Ha),i.updateRenderState({layers:[M]}),e.setPixelRatio(1),e.setSize(M.textureWidth,M.textureHeight,!1),ke=new Os(M.textureWidth,M.textureHeight,{format:L,type:es,depthTexture:new Al(M.textureWidth,M.textureHeight,oa,void 0,void 0,void 0,void 0,void 0,void 0,cs),stencilBuffer:ye.stencil,colorSpace:e.outputColorSpace,samples:ye.antialias?4:0,resolveDepthBuffer:M.ignoreDepthValues===!1,resolveStencilBuffer:M.ignoreDepthValues===!1})}else{const cs={antialias:ye.antialias,alpha:!0,depth:ye.depth,stencil:ye.stencil,framebufferScaleFactor:a};B=new XRWebGLLayer(i,t,cs),i.updateRenderState({baseLayer:B}),e.setPixelRatio(1),e.setSize(B.framebufferWidth,B.framebufferHeight,!1),ke=new Os(B.framebufferWidth,B.framebufferHeight,{format:L,type:es,colorSpace:e.outputColorSpace,stencilBuffer:ye.stencil,resolveDepthBuffer:B.ignoreDepthValues===!1,resolveStencilBuffer:B.ignoreDepthValues===!1})}ke.isXRRenderTarget=!0,this.setFoveation(c),d=null,o=yield i.requestReferenceSpace(u),Pi.setContext(i),Pi.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}})},this.getEnvironmentBlendMode=function(){if(i!==null)return i.environmentBlendMode},this.getDepthTexture=function(){return ee.getDepthTexture()};function Zr(Nr){for(let Yr=0;Yr<Nr.removed.length;Yr++){const cs=Nr.removed[Yr],oa=Ye.indexOf(cs);oa>=0&&(Ye[oa]=null,nt[oa].disconnect(cs))}for(let Yr=0;Yr<Nr.added.length;Yr++){const cs=Nr.added[Yr];let oa=Ye.indexOf(cs);if(oa===-1){for(let Ha=0;Ha<nt.length;Ha++)if(Ha>=Ye.length){Ye.push(cs),oa=Ha;break}else if(Ye[Ha]===null){Ye[Ha]=cs,oa=Ha;break}if(oa===-1)break}const Ms=nt[oa];Ms&&Ms.connect(cs)}}const Ti=new le,ds=new le;function As(Nr,Yr,cs){Ti.setFromMatrixPosition(Yr.matrixWorld),ds.setFromMatrixPosition(cs.matrixWorld);const oa=Ti.distanceTo(ds),Ms=Yr.projectionMatrix.elements,Ha=cs.projectionMatrix.elements,Qo=Ms[14]/(Ms[10]-1),co=Ms[14]/(Ms[10]+1),Li=(Ms[9]+1)/Ms[5],os=(Ms[9]-1)/Ms[5],Hi=(Ms[8]-1)/Ms[0],Fs=(Ha[8]+1)/Ha[0],Pn=Qo*Hi,ja=Qo*Fs,da=oa/(-Hi+Fs),ho=da*-Hi;if(Yr.matrixWorld.decompose(Nr.position,Nr.quaternion,Nr.scale),Nr.translateX(ho),Nr.translateZ(da),Nr.matrixWorld.compose(Nr.position,Nr.quaternion,Nr.scale),Nr.matrixWorldInverse.copy(Nr.matrixWorld).invert(),Ms[10]===-1)Nr.projectionMatrix.copy(Yr.projectionMatrix),Nr.projectionMatrixInverse.copy(Yr.projectionMatrixInverse);else{const Ps=Qo+da,Mn=co+da,St=Pn-ho,Cr=ja+(oa-ho),xi=Li*co/Mn*Ps,Qi=os*co/Mn*Ps;Nr.projectionMatrix.makePerspective(St,Cr,xi,Qi,Ps,Mn),Nr.projectionMatrixInverse.copy(Nr.projectionMatrix).invert()}}function Xr(Nr,Yr){Yr===null?Nr.matrixWorld.copy(Nr.matrix):Nr.matrixWorld.multiplyMatrices(Yr.matrixWorld,Nr.matrix),Nr.matrixWorldInverse.copy(Nr.matrixWorld).invert()}this.updateCamera=function(Nr){if(i===null)return;let Yr=Nr.near,cs=Nr.far;ee.texture!==null&&(ee.depthNear>0&&(Yr=ee.depthNear),ee.depthFar>0&&(cs=ee.depthFar)),cr.near=pt.near=qe.near=Yr,cr.far=pt.far=qe.far=cs,(pr!==cr.near||Br!==cr.far)&&(i.updateRenderState({depthNear:cr.near,depthFar:cr.far}),pr=cr.near,Br=cr.far),cr.layers.mask=Nr.layers.mask|6,qe.layers.mask=cr.layers.mask&3,pt.layers.mask=cr.layers.mask&5;const oa=Nr.parent,Ms=cr.cameras;Xr(cr,oa);for(let Ha=0;Ha<Ms.length;Ha++)Xr(Ms[Ha],oa);Ms.length===2?As(cr,qe,pt):cr.projectionMatrix.copy(qe.projectionMatrix),Yi(Nr,cr,oa)};function Yi(Nr,Yr,cs){cs===null?Nr.matrix.copy(Yr.matrixWorld):(Nr.matrix.copy(cs.matrixWorld),Nr.matrix.invert(),Nr.matrix.multiply(Yr.matrixWorld)),Nr.matrix.decompose(Nr.position,Nr.quaternion,Nr.scale),Nr.updateMatrixWorld(!0),Nr.projectionMatrix.copy(Yr.projectionMatrix),Nr.projectionMatrixInverse.copy(Yr.projectionMatrixInverse),Nr.isPerspectiveCamera&&(Nr.fov=Oh*2*Math.atan(1/Nr.projectionMatrix.elements[5]),Nr.zoom=1)}this.getCamera=function(){return cr},this.getFoveation=function(){if(!(M===null&&B===null))return c},this.setFoveation=function(Nr){c=Nr,M!==null&&(M.fixedFoveation=Nr),B!==null&&B.fixedFoveation!==void 0&&(B.fixedFoveation=Nr)},this.hasDepthSensing=function(){return ee.texture!==null},this.getDepthSensingMesh=function(){return ee.getMesh(cr)},this.getCameraTexture=function(Nr){return q[Nr]};let ps=null;function Xa(Nr,Yr){if(g=Yr.getViewerPose(d||o),I=Yr,g!==null){const cs=g.views;B!==null&&(e.setRenderTargetFramebuffer(ke,B.framebuffer),e.setRenderTarget(ke));let oa=!1;cs.length!==cr.cameras.length&&(cr.cameras.length=0,oa=!0);for(let co=0;co<cs.length;co++){const Li=cs[co];let os=null;if(B!==null)os=B.getViewport(Li);else{const Fs=v.getViewSubImage(M,Li);os=Fs.viewport,co===0&&(e.setRenderTargetTextures(ke,Fs.colorTexture,Fs.depthStencilTexture),e.setRenderTarget(ke))}let Hi=xn[co];Hi===void 0&&(Hi=new vo,Hi.layers.enable(co),Hi.viewport=new Ni,xn[co]=Hi),Hi.matrix.fromArray(Li.transform.matrix),Hi.matrix.decompose(Hi.position,Hi.quaternion,Hi.scale),Hi.projectionMatrix.fromArray(Li.projectionMatrix),Hi.projectionMatrixInverse.copy(Hi.projectionMatrix).invert(),Hi.viewport.set(os.x,os.y,os.width,os.height),co===0&&(cr.matrix.copy(Hi.matrix),cr.matrix.decompose(cr.position,cr.quaternion,cr.scale)),oa===!0&&cr.cameras.push(Hi)}const Ms=i.enabledFeatures;if(Ms&&Ms.includes("depth-sensing")&&i.depthUsage=="gpu-optimized"&&ne){v=n.getBinding();const co=v.getDepthInformation(cs[0]);co&&co.isValid&&co.texture&&ee.init(co,i.renderState)}if(Ms&&Ms.includes("camera-access")&&ne){e.state.unbindTexture(),v=n.getBinding();for(let co=0;co<cs.length;co++){const Li=cs[co].camera;if(Li){let os=q[Li];os||(os=new Fo,q[Li]=os);const Hi=v.getCameraImage(Li);os.sourceTexture=Hi}}}}for(let cs=0;cs<nt.length;cs++){const oa=Ye[cs],Ms=nt[cs];oa!==null&&Ms!==void 0&&Ms.update(oa,Yr,d||o)}ps&&ps(Nr,Yr),Yr.detectedPlanes&&n.dispatchEvent({type:"planesdetected",data:Yr}),I=null}const Pi=new bC;Pi.setAnimationLoop(Xa),this.setAnimationLoop=function(Nr){ps=Nr},this.dispose=function(){}}}const a0=new Ua,G3=new di;function H3(s,e){function t(ee,q){ee.matrixAutoUpdate===!0&&ee.updateMatrix(),q.value.copy(ee.matrix)}function n(ee,q){q.color.getRGB(ee.fogColor.value,wg(s)),q.isFog?(ee.fogNear.value=q.near,ee.fogFar.value=q.far):q.isFogExp2&&(ee.fogDensity.value=q.density)}function i(ee,q,ye,Ce,ke){q.isMeshBasicMaterial||q.isMeshLambertMaterial?a(ee,q):q.isMeshToonMaterial?(a(ee,q),v(ee,q)):q.isMeshPhongMaterial?(a(ee,q),g(ee,q)):q.isMeshStandardMaterial?(a(ee,q),M(ee,q),q.isMeshPhysicalMaterial&&B(ee,q,ke)):q.isMeshMatcapMaterial?(a(ee,q),I(ee,q)):q.isMeshDepthMaterial?a(ee,q):q.isMeshDistanceMaterial?(a(ee,q),ne(ee,q)):q.isMeshNormalMaterial?a(ee,q):q.isLineBasicMaterial?(o(ee,q),q.isLineDashedMaterial&&u(ee,q)):q.isPointsMaterial?c(ee,q,ye,Ce):q.isSpriteMaterial?d(ee,q):q.isShadowMaterial?(ee.color.value.copy(q.color),ee.opacity.value=q.opacity):q.isShaderMaterial&&(q.uniformsNeedUpdate=!1)}function a(ee,q){ee.opacity.value=q.opacity,q.color&&ee.diffuse.value.copy(q.color),q.emissive&&ee.emissive.value.copy(q.emissive).multiplyScalar(q.emissiveIntensity),q.map&&(ee.map.value=q.map,t(q.map,ee.mapTransform)),q.alphaMap&&(ee.alphaMap.value=q.alphaMap,t(q.alphaMap,ee.alphaMapTransform)),q.bumpMap&&(ee.bumpMap.value=q.bumpMap,t(q.bumpMap,ee.bumpMapTransform),ee.bumpScale.value=q.bumpScale,q.side===de&&(ee.bumpScale.value*=-1)),q.normalMap&&(ee.normalMap.value=q.normalMap,t(q.normalMap,ee.normalMapTransform),ee.normalScale.value.copy(q.normalScale),q.side===de&&ee.normalScale.value.negate()),q.displacementMap&&(ee.displacementMap.value=q.displacementMap,t(q.displacementMap,ee.displacementMapTransform),ee.displacementScale.value=q.displacementScale,ee.displacementBias.value=q.displacementBias),q.emissiveMap&&(ee.emissiveMap.value=q.emissiveMap,t(q.emissiveMap,ee.emissiveMapTransform)),q.specularMap&&(ee.specularMap.value=q.specularMap,t(q.specularMap,ee.specularMapTransform)),q.alphaTest>0&&(ee.alphaTest.value=q.alphaTest);const ye=e.get(q),Ce=ye.envMap,ke=ye.envMapRotation;Ce&&(ee.envMap.value=Ce,a0.copy(ke),a0.x*=-1,a0.y*=-1,a0.z*=-1,Ce.isCubeTexture&&Ce.isRenderTargetTexture===!1&&(a0.y*=-1,a0.z*=-1),ee.envMapRotation.value.setFromMatrix4(G3.makeRotationFromEuler(a0)),ee.flipEnvMap.value=Ce.isCubeTexture&&Ce.isRenderTargetTexture===!1?-1:1,ee.reflectivity.value=q.reflectivity,ee.ior.value=q.ior,ee.refractionRatio.value=q.refractionRatio),q.lightMap&&(ee.lightMap.value=q.lightMap,ee.lightMapIntensity.value=q.lightMapIntensity,t(q.lightMap,ee.lightMapTransform)),q.aoMap&&(ee.aoMap.value=q.aoMap,ee.aoMapIntensity.value=q.aoMapIntensity,t(q.aoMap,ee.aoMapTransform))}function o(ee,q){ee.diffuse.value.copy(q.color),ee.opacity.value=q.opacity,q.map&&(ee.map.value=q.map,t(q.map,ee.mapTransform))}function u(ee,q){ee.dashSize.value=q.dashSize,ee.totalSize.value=q.dashSize+q.gapSize,ee.scale.value=q.scale}function c(ee,q,ye,Ce){ee.diffuse.value.copy(q.color),ee.opacity.value=q.opacity,ee.size.value=q.size*ye,ee.scale.value=Ce*.5,q.map&&(ee.map.value=q.map,t(q.map,ee.uvTransform)),q.alphaMap&&(ee.alphaMap.value=q.alphaMap,t(q.alphaMap,ee.alphaMapTransform)),q.alphaTest>0&&(ee.alphaTest.value=q.alphaTest)}function d(ee,q){ee.diffuse.value.copy(q.color),ee.opacity.value=q.opacity,ee.rotation.value=q.rotation,q.map&&(ee.map.value=q.map,t(q.map,ee.mapTransform)),q.alphaMap&&(ee.alphaMap.value=q.alphaMap,t(q.alphaMap,ee.alphaMapTransform)),q.alphaTest>0&&(ee.alphaTest.value=q.alphaTest)}function g(ee,q){ee.specular.value.copy(q.specular),ee.shininess.value=Math.max(q.shininess,1e-4)}function v(ee,q){q.gradientMap&&(ee.gradientMap.value=q.gradientMap)}function M(ee,q){ee.metalness.value=q.metalness,q.metalnessMap&&(ee.metalnessMap.value=q.metalnessMap,t(q.metalnessMap,ee.metalnessMapTransform)),ee.roughness.value=q.roughness,q.roughnessMap&&(ee.roughnessMap.value=q.roughnessMap,t(q.roughnessMap,ee.roughnessMapTransform)),q.envMap&&(ee.envMapIntensity.value=q.envMapIntensity)}function B(ee,q,ye){ee.ior.value=q.ior,q.sheen>0&&(ee.sheenColor.value.copy(q.sheenColor).multiplyScalar(q.sheen),ee.sheenRoughness.value=q.sheenRoughness,q.sheenColorMap&&(ee.sheenColorMap.value=q.sheenColorMap,t(q.sheenColorMap,ee.sheenColorMapTransform)),q.sheenRoughnessMap&&(ee.sheenRoughnessMap.value=q.sheenRoughnessMap,t(q.sheenRoughnessMap,ee.sheenRoughnessMapTransform))),q.clearcoat>0&&(ee.clearcoat.value=q.clearcoat,ee.clearcoatRoughness.value=q.clearcoatRoughness,q.clearcoatMap&&(ee.clearcoatMap.value=q.clearcoatMap,t(q.clearcoatMap,ee.clearcoatMapTransform)),q.clearcoatRoughnessMap&&(ee.clearcoatRoughnessMap.value=q.clearcoatRoughnessMap,t(q.clearcoatRoughnessMap,ee.clearcoatRoughnessMapTransform)),q.clearcoatNormalMap&&(ee.clearcoatNormalMap.value=q.clearcoatNormalMap,t(q.clearcoatNormalMap,ee.clearcoatNormalMapTransform),ee.clearcoatNormalScale.value.copy(q.clearcoatNormalScale),q.side===de&&ee.clearcoatNormalScale.value.negate())),q.dispersion>0&&(ee.dispersion.value=q.dispersion),q.iridescence>0&&(ee.iridescence.value=q.iridescence,ee.iridescenceIOR.value=q.iridescenceIOR,ee.iridescenceThicknessMinimum.value=q.iridescenceThicknessRange[0],ee.iridescenceThicknessMaximum.value=q.iridescenceThicknessRange[1],q.iridescenceMap&&(ee.iridescenceMap.value=q.iridescenceMap,t(q.iridescenceMap,ee.iridescenceMapTransform)),q.iridescenceThicknessMap&&(ee.iridescenceThicknessMap.value=q.iridescenceThicknessMap,t(q.iridescenceThicknessMap,ee.iridescenceThicknessMapTransform))),q.transmission>0&&(ee.transmission.value=q.transmission,ee.transmissionSamplerMap.value=ye.texture,ee.transmissionSamplerSize.value.set(ye.width,ye.height),q.transmissionMap&&(ee.transmissionMap.value=q.transmissionMap,t(q.transmissionMap,ee.transmissionMapTransform)),ee.thickness.value=q.thickness,q.thicknessMap&&(ee.thicknessMap.value=q.thicknessMap,t(q.thicknessMap,ee.thicknessMapTransform)),ee.attenuationDistance.value=q.attenuationDistance,ee.attenuationColor.value.copy(q.attenuationColor)),q.anisotropy>0&&(ee.anisotropyVector.value.set(q.anisotropy*Math.cos(q.anisotropyRotation),q.anisotropy*Math.sin(q.anisotropyRotation)),q.anisotropyMap&&(ee.anisotropyMap.value=q.anisotropyMap,t(q.anisotropyMap,ee.anisotropyMapTransform))),ee.specularIntensity.value=q.specularIntensity,ee.specularColor.value.copy(q.specularColor),q.specularColorMap&&(ee.specularColorMap.value=q.specularColorMap,t(q.specularColorMap,ee.specularColorMapTransform)),q.specularIntensityMap&&(ee.specularIntensityMap.value=q.specularIntensityMap,t(q.specularIntensityMap,ee.specularIntensityMapTransform))}function I(ee,q){q.matcap&&(ee.matcap.value=q.matcap)}function ne(ee,q){const ye=e.get(q).light;ee.referencePosition.value.setFromMatrixPosition(ye.matrixWorld),ee.nearDistance.value=ye.shadow.camera.near,ee.farDistance.value=ye.shadow.camera.far}return{refreshFogUniforms:n,refreshMaterialUniforms:i}}function Q3(s,e,t,n){let i={},a={},o=[];const u=s.getParameter(s.MAX_UNIFORM_BUFFER_BINDINGS);function c(ye,Ce){const ke=Ce.program;n.uniformBlockBinding(ye,ke)}function d(ye,Ce){let ke=i[ye.id];ke===void 0&&(I(ye),ke=g(ye),i[ye.id]=ke,ye.addEventListener("dispose",ee));const nt=Ce.program;n.updateUBOMapping(ye,nt);const Ye=e.render.frame;a[ye.id]!==Ye&&(M(ye),a[ye.id]=Ye)}function g(ye){const Ce=v();ye.__bindingPointIndex=Ce;const ke=s.createBuffer(),nt=ye.__size,Ye=ye.usage;return s.bindBuffer(s.UNIFORM_BUFFER,ke),s.bufferData(s.UNIFORM_BUFFER,nt,Ye),s.bindBuffer(s.UNIFORM_BUFFER,null),s.bindBufferBase(s.UNIFORM_BUFFER,Ce,ke),ke}function v(){for(let ye=0;ye<u;ye++)if(o.indexOf(ye)===-1)return o.push(ye),ye;return Gr("WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function M(ye){const Ce=i[ye.id],ke=ye.uniforms,nt=ye.__cache;s.bindBuffer(s.UNIFORM_BUFFER,Ce);for(let Ye=0,ht=ke.length;Ye<ht;Ye++){const Rt=Array.isArray(ke[Ye])?ke[Ye]:[ke[Ye]];for(let qe=0,pt=Rt.length;qe<pt;qe++){const xn=Rt[qe];if(B(xn,Ye,qe,nt)===!0){const cr=xn.__offset,pr=Array.isArray(xn.value)?xn.value:[xn.value];let Br=0;for(let zr=0;zr<pr.length;zr++){const Dr=pr[zr],Zr=ne(Dr);typeof Dr=="number"||typeof Dr=="boolean"?(xn.__data[0]=Dr,s.bufferSubData(s.UNIFORM_BUFFER,cr+Br,xn.__data)):Dr.isMatrix3?(xn.__data[0]=Dr.elements[0],xn.__data[1]=Dr.elements[1],xn.__data[2]=Dr.elements[2],xn.__data[3]=0,xn.__data[4]=Dr.elements[3],xn.__data[5]=Dr.elements[4],xn.__data[6]=Dr.elements[5],xn.__data[7]=0,xn.__data[8]=Dr.elements[6],xn.__data[9]=Dr.elements[7],xn.__data[10]=Dr.elements[8],xn.__data[11]=0):(Dr.toArray(xn.__data,Br),Br+=Zr.storage/Float32Array.BYTES_PER_ELEMENT)}s.bufferSubData(s.UNIFORM_BUFFER,cr,xn.__data)}}}s.bindBuffer(s.UNIFORM_BUFFER,null)}function B(ye,Ce,ke,nt){const Ye=ye.value,ht=Ce+"_"+ke;if(nt[ht]===void 0)return typeof Ye=="number"||typeof Ye=="boolean"?nt[ht]=Ye:nt[ht]=Ye.clone(),!0;{const Rt=nt[ht];if(typeof Ye=="number"||typeof Ye=="boolean"){if(Rt!==Ye)return nt[ht]=Ye,!0}else if(Rt.equals(Ye)===!1)return Rt.copy(Ye),!0}return!1}function I(ye){const Ce=ye.uniforms;let ke=0;const nt=16;for(let ht=0,Rt=Ce.length;ht<Rt;ht++){const qe=Array.isArray(Ce[ht])?Ce[ht]:[Ce[ht]];for(let pt=0,xn=qe.length;pt<xn;pt++){const cr=qe[pt],pr=Array.isArray(cr.value)?cr.value:[cr.value];for(let Br=0,zr=pr.length;Br<zr;Br++){const Dr=pr[Br],Zr=ne(Dr),Ti=ke%nt,ds=Ti%Zr.boundary,As=Ti+ds;ke+=ds,As!==0&&nt-As<Zr.storage&&(ke+=nt-As),cr.__data=new Float32Array(Zr.storage/Float32Array.BYTES_PER_ELEMENT),cr.__offset=ke,ke+=Zr.storage}}}const Ye=ke%nt;return Ye>0&&(ke+=nt-Ye),ye.__size=ke,ye.__cache={},this}function ne(ye){const Ce={boundary:0,storage:0};return typeof ye=="number"||typeof ye=="boolean"?(Ce.boundary=4,Ce.storage=4):ye.isVector2?(Ce.boundary=8,Ce.storage=8):ye.isVector3||ye.isColor?(Ce.boundary=16,Ce.storage=12):ye.isVector4?(Ce.boundary=16,Ce.storage=16):ye.isMatrix3?(Ce.boundary=48,Ce.storage=48):ye.isMatrix4?(Ce.boundary=64,Ce.storage=64):ye.isTexture?Lr("WebGLRenderer: Texture samplers can not be part of an uniforms group."):Lr("WebGLRenderer: Unsupported uniform value type.",ye),Ce}function ee(ye){const Ce=ye.target;Ce.removeEventListener("dispose",ee);const ke=o.indexOf(Ce.__bindingPointIndex);o.splice(ke,1),s.deleteBuffer(i[Ce.id]),delete i[Ce.id],delete a[Ce.id]}function q(){for(const ye in i)s.deleteBuffer(i[ye]);o=[],i={},a={}}return{bind:c,update:d,dispose:q}}const W3=new Uint16Array([12469,15057,12620,14925,13266,14620,13807,14376,14323,13990,14545,13625,14713,13328,14840,12882,14931,12528,14996,12233,15039,11829,15066,11525,15080,11295,15085,10976,15082,10705,15073,10495,13880,14564,13898,14542,13977,14430,14158,14124,14393,13732,14556,13410,14702,12996,14814,12596,14891,12291,14937,11834,14957,11489,14958,11194,14943,10803,14921,10506,14893,10278,14858,9960,14484,14039,14487,14025,14499,13941,14524,13740,14574,13468,14654,13106,14743,12678,14818,12344,14867,11893,14889,11509,14893,11180,14881,10751,14852,10428,14812,10128,14765,9754,14712,9466,14764,13480,14764,13475,14766,13440,14766,13347,14769,13070,14786,12713,14816,12387,14844,11957,14860,11549,14868,11215,14855,10751,14825,10403,14782,10044,14729,9651,14666,9352,14599,9029,14967,12835,14966,12831,14963,12804,14954,12723,14936,12564,14917,12347,14900,11958,14886,11569,14878,11247,14859,10765,14828,10401,14784,10011,14727,9600,14660,9289,14586,8893,14508,8533,15111,12234,15110,12234,15104,12216,15092,12156,15067,12010,15028,11776,14981,11500,14942,11205,14902,10752,14861,10393,14812,9991,14752,9570,14682,9252,14603,8808,14519,8445,14431,8145,15209,11449,15208,11451,15202,11451,15190,11438,15163,11384,15117,11274,15055,10979,14994,10648,14932,10343,14871,9936,14803,9532,14729,9218,14645,8742,14556,8381,14461,8020,14365,7603,15273,10603,15272,10607,15267,10619,15256,10631,15231,10614,15182,10535,15118,10389,15042,10167,14963,9787,14883,9447,14800,9115,14710,8665,14615,8318,14514,7911,14411,7507,14279,7198,15314,9675,15313,9683,15309,9712,15298,9759,15277,9797,15229,9773,15166,9668,15084,9487,14995,9274,14898,8910,14800,8539,14697,8234,14590,7790,14479,7409,14367,7067,14178,6621,15337,8619,15337,8631,15333,8677,15325,8769,15305,8871,15264,8940,15202,8909,15119,8775,15022,8565,14916,8328,14804,8009,14688,7614,14569,7287,14448,6888,14321,6483,14088,6171,15350,7402,15350,7419,15347,7480,15340,7613,15322,7804,15287,7973,15229,8057,15148,8012,15046,7846,14933,7611,14810,7357,14682,7069,14552,6656,14421,6316,14251,5948,14007,5528,15356,5942,15356,5977,15353,6119,15348,6294,15332,6551,15302,6824,15249,7044,15171,7122,15070,7050,14949,6861,14818,6611,14679,6349,14538,6067,14398,5651,14189,5311,13935,4958,15359,4123,15359,4153,15356,4296,15353,4646,15338,5160,15311,5508,15263,5829,15188,6042,15088,6094,14966,6001,14826,5796,14678,5543,14527,5287,14377,4985,14133,4586,13869,4257,15360,1563,15360,1642,15358,2076,15354,2636,15341,3350,15317,4019,15273,4429,15203,4732,15105,4911,14981,4932,14836,4818,14679,4621,14517,4386,14359,4156,14083,3795,13808,3437,15360,122,15360,137,15358,285,15355,636,15344,1274,15322,2177,15281,2765,15215,3223,15120,3451,14995,3569,14846,3567,14681,3466,14511,3305,14344,3121,14037,2800,13753,2467,15360,0,15360,1,15359,21,15355,89,15346,253,15325,479,15287,796,15225,1148,15133,1492,15008,1749,14856,1882,14685,1886,14506,1783,14324,1608,13996,1398,13702,1183]);let eg=null;function Z3(){return eg===null&&(eg=new ah(W3,16,16,ze,Wt),eg.name="DFG_LUT",eg.minFilter=vr,eg.magFilter=vr,eg.wrapS=Vt,eg.wrapT=Vt,eg.generateMipmaps=!1,eg.needsUpdate=!0),eg}class K3{constructor(e={}){const{canvas:t=yh(),context:n=null,depth:i=!0,stencil:a=!1,alpha:o=!1,antialias:u=!1,premultipliedAlpha:c=!0,preserveDrawingBuffer:d=!1,powerPreference:g="default",failIfMajorPerformanceCaveat:v=!1,reversedDepthBuffer:M=!1,outputBufferType:B=es}=e;this.isWebGLRenderer=!0;let I;if(n!==null){if(typeof WebGLRenderingContext!="undefined"&&n instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");I=n.getContextAttributes().alpha}else I=o;const ne=B,ee=new Set([xt,Je,ie]),q=new Set([es,st,rn,ar,bn,Jt]),ye=new Uint32Array(4),Ce=new Int32Array(4);let ke=null,nt=null;const Ye=[],ht=[];let Rt=null;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.toneMapping=Ct,this.toneMappingExposure=1,this.transmissionResolutionScale=1;const qe=this;let pt=!1;this._outputColorSpace=sl;let xn=0,cr=0,pr=null,Br=-1,zr=null;const Dr=new Ni,Zr=new Ni;let Ti=null;const ds=new Wr(0);let As=0,Xr=t.width,Yi=t.height,ps=1,Xa=null,Pi=null;const Nr=new Ni(0,0,Xr,Yi),Yr=new Ni(0,0,Xr,Yi);let cs=!1;const oa=new qu;let Ms=!1,Ha=!1;const Qo=new di,co=new le,Li=new Ni,os={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let Hi=!1;function Fs(){return pr===null?ps:1}let Pn=n;function ja(an,Ur){return t.getContext(an,Ur)}try{const an={alpha:!0,depth:i,stencil:a,antialias:u,premultipliedAlpha:c,preserveDrawingBuffer:d,powerPreference:g,failIfMajorPerformanceCaveat:v};if("setAttribute"in t&&t.setAttribute("data-engine",`three.js r${m}`),t.addEventListener("webglcontextlost",Eo,!1),t.addEventListener("webglcontextrestored",Wu,!1),t.addEventListener("webglcontextcreationerror",fu,!1),Pn===null){const Ur="webgl2";if(Pn=ja(Ur,an),Pn===null)throw ja(Ur)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(an){throw Gr("WebGLRenderer: "+an.message),an}let da,ho,Ps,Mn,St,Cr,xi,Qi,Si,La,Vs,Na,po,hs,js,Fa,Va,$s,Wo,Mr,la,Ts,ga,gs;function Wi(){da=new ZO(Pn),da.init(),Ts=new O3(Pn,da),ho=new OO(Pn,da,e,Ts),Ps=new L3(Pn,da),ho.reversedDepthBuffer&&M&&Ps.buffers.depth.setReversed(!0),Mn=new XO(Pn),St=new x3,Cr=new U3(Pn,da,Ps,St,ho,Ts,Mn),xi=new kO(qe),Qi=new WO(qe),Si=new FL(Pn),ga=new LO(Pn,Si),La=new KO(Pn,Si,Mn,ga),Vs=new YO(Pn,La,Si,Mn),Wo=new jO(Pn,ho,Cr),Fa=new DO(St),Na=new y3(qe,xi,Qi,da,ho,ga,Fa),po=new H3(qe,St),hs=new _3,js=new T3(da),$s=new PO(qe,xi,Qi,Ps,Vs,I,c),Va=new F3(qe,Vs,ho),gs=new Q3(Pn,Mn,ho,Ps),Mr=new UO(Pn,da,Mn),la=new $O(Pn,da,Mn),Mn.programs=Na.programs,qe.capabilities=ho,qe.extensions=da,qe.properties=St,qe.renderLists=hs,qe.shadowMap=Va,qe.state=Ps,qe.info=Mn}Wi(),ne!==es&&(Rt=new JO(ne,t.width,t.height,i,a));const Ws=new z3(qe,Pn);this.xr=Ws,this.getContext=function(){return Pn},this.getContextAttributes=function(){return Pn.getContextAttributes()},this.forceContextLoss=function(){const an=da.get("WEBGL_lose_context");an&&an.loseContext()},this.forceContextRestore=function(){const an=da.get("WEBGL_lose_context");an&&an.restoreContext()},this.getPixelRatio=function(){return ps},this.setPixelRatio=function(an){an!==void 0&&(ps=an,this.setSize(Xr,Yi,!1))},this.getSize=function(an){return an.set(Xr,Yi)},this.setSize=function(an,Ur,hi=!0){if(Ws.isPresenting){Lr("WebGLRenderer: Can't change size while VR device is presenting.");return}Xr=an,Yi=Ur,t.width=Math.floor(an*ps),t.height=Math.floor(Ur*ps),hi===!0&&(t.style.width=an+"px",t.style.height=Ur+"px"),Rt!==null&&Rt.setSize(t.width,t.height),this.setViewport(0,0,an,Ur)},this.getDrawingBufferSize=function(an){return an.set(Xr*ps,Yi*ps).floor()},this.setDrawingBufferSize=function(an,Ur,hi){Xr=an,Yi=Ur,ps=hi,t.width=Math.floor(an*hi),t.height=Math.floor(Ur*hi),this.setViewport(0,0,an,Ur)},this.setEffects=function(an){if(ne===es){console.error("THREE.WebGLRenderer: setEffects() requires outputBufferType set to HalfFloatType or FloatType.");return}if(an){for(let Ur=0;Ur<an.length;Ur++)if(an[Ur].isOutputPass===!0){console.warn("THREE.WebGLRenderer: OutputPass is not needed in setEffects(). Tone mapping and color space conversion are applied automatically.");break}}Rt.setEffects(an||[])},this.getCurrentViewport=function(an){return an.copy(Dr)},this.getViewport=function(an){return an.copy(Nr)},this.setViewport=function(an,Ur,hi,li){an.isVector4?Nr.set(an.x,an.y,an.z,an.w):Nr.set(an,Ur,hi,li),Ps.viewport(Dr.copy(Nr).multiplyScalar(ps).round())},this.getScissor=function(an){return an.copy(Yr)},this.setScissor=function(an,Ur,hi,li){an.isVector4?Yr.set(an.x,an.y,an.z,an.w):Yr.set(an,Ur,hi,li),Ps.scissor(Zr.copy(Yr).multiplyScalar(ps).round())},this.getScissorTest=function(){return cs},this.setScissorTest=function(an){Ps.setScissorTest(cs=an)},this.setOpaqueSort=function(an){Xa=an},this.setTransparentSort=function(an){Pi=an},this.getClearColor=function(an){return an.copy($s.getClearColor())},this.setClearColor=function(){$s.setClearColor(...arguments)},this.getClearAlpha=function(){return $s.getClearAlpha()},this.setClearAlpha=function(){$s.setClearAlpha(...arguments)},this.clear=function(an=!0,Ur=!0,hi=!0){let li=0;if(an){let Qr=!1;if(pr!==null){const qs=pr.texture.format;Qr=ee.has(qs)}if(Qr){const qs=pr.texture.type,ba=q.has(qs),ia=$s.getClearColor(),Ta=$s.getClearAlpha(),Qa=ia.r,yo=ia.g,io=ia.b;ba?(ye[0]=Qa,ye[1]=yo,ye[2]=io,ye[3]=Ta,Pn.clearBufferuiv(Pn.COLOR,0,ye)):(Ce[0]=Qa,Ce[1]=yo,Ce[2]=io,Ce[3]=Ta,Pn.clearBufferiv(Pn.COLOR,0,Ce))}else li|=Pn.COLOR_BUFFER_BIT}Ur&&(li|=Pn.DEPTH_BUFFER_BIT),hi&&(li|=Pn.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),Pn.clear(li)},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",Eo,!1),t.removeEventListener("webglcontextrestored",Wu,!1),t.removeEventListener("webglcontextcreationerror",fu,!1),$s.dispose(),hs.dispose(),js.dispose(),St.dispose(),xi.dispose(),Qi.dispose(),Vs.dispose(),ga.dispose(),gs.dispose(),Na.dispose(),Ws.dispose(),Ws.removeEventListener("sessionstart",xP),Ws.removeEventListener("sessionend",bP),U0.stop()};function Eo(an){an.preventDefault(),ac("WebGLRenderer: Context Lost."),pt=!0}function Wu(){ac("WebGLRenderer: Context Restored."),pt=!1;const an=Mn.autoReset,Ur=Va.enabled,hi=Va.autoUpdate,li=Va.needsUpdate,Qr=Va.type;Wi(),Mn.autoReset=an,Va.enabled=Ur,Va.autoUpdate=hi,Va.needsUpdate=li,Va.type=Qr}function fu(an){Gr("WebGLRenderer: A WebGL context could not be created. Reason: ",an.statusMessage)}function bg(an){const Ur=an.target;Ur.removeEventListener("dispose",bg),om(Ur)}function om(an){z$(an),St.remove(an)}function z$(an){const Ur=St.get(an).programs;Ur!==void 0&&(Ur.forEach(function(hi){Na.releaseProgram(hi)}),an.isShaderMaterial&&Na.releaseShaderCache(an))}this.renderBufferDirect=function(an,Ur,hi,li,Qr,qs){Ur===null&&(Ur=os);const ba=Qr.isMesh&&Qr.matrixWorld.determinant()<0,ia=H$(an,Ur,hi,li,Qr);Ps.setMaterial(li,ba);let Ta=hi.index,Qa=1;if(li.wireframe===!0){if(Ta=La.getWireframeAttribute(hi),Ta===void 0)return;Qa=2}const yo=hi.drawRange,io=hi.attributes.position;let nl=yo.start*Qa,Eu=(yo.start+yo.count)*Qa;qs!==null&&(nl=Math.max(nl,qs.start*Qa),Eu=Math.min(Eu,(qs.start+qs.count)*Qa)),Ta!==null?(nl=Math.max(nl,0),Eu=Math.min(Eu,Ta.count)):io!=null&&(nl=Math.max(nl,0),Eu=Math.min(Eu,io.count));const Dc=Eu-nl;if(Dc<0||Dc===1/0)return;ga.setup(Qr,li,ia,hi,Ta);let kc,Pu=Mr;if(Ta!==null&&(kc=Si.get(Ta),Pu=la,Pu.setIndex(kc)),Qr.isMesh)li.wireframe===!0?(Ps.setLineWidth(li.wireframeLinewidth*Fs()),Pu.setMode(Pn.LINES)):Pu.setMode(Pn.TRIANGLES);else if(Qr.isLine){let so=li.linewidth;so===void 0&&(so=1),Ps.setLineWidth(so*Fs()),Qr.isLineSegments?Pu.setMode(Pn.LINES):Qr.isLineLoop?Pu.setMode(Pn.LINE_LOOP):Pu.setMode(Pn.LINE_STRIP)}else Qr.isPoints?Pu.setMode(Pn.POINTS):Qr.isSprite&&Pu.setMode(Pn.TRIANGLES);if(Qr.isBatchedMesh)if(Qr._multiDrawInstances!==null)ki("WebGLRenderer: renderMultiDrawInstances has been deprecated and will be removed in r184. Append to renderMultiDraw arguments and use indirection."),Pu.renderMultiDrawInstances(Qr._multiDrawStarts,Qr._multiDrawCounts,Qr._multiDrawCount,Qr._multiDrawInstances);else if(da.get("WEBGL_multi_draw"))Pu.renderMultiDraw(Qr._multiDrawStarts,Qr._multiDrawCounts,Qr._multiDrawCount);else{const so=Qr._multiDrawStarts,Au=Qr._multiDrawCounts,Vl=Qr._multiDrawCount,bA=Ta?Si.get(Ta).bytesPerElement:1,Wv=St.get(li).currentProgram.getUniforms();for(let _A=0;_A<Vl;_A++)Wv.setValue(Pn,"_gl_DrawID",_A),Pu.render(so[_A]/bA,Au[_A])}else if(Qr.isInstancedMesh)Pu.renderInstances(nl,Dc,Qr.count);else if(hi.isInstancedBufferGeometry){const so=hi._maxInstanceCount!==void 0?hi._maxInstanceCount:1/0,Au=Math.min(hi.instanceCount,so);Pu.renderInstances(nl,Dc,Au)}else Pu.render(nl,Dc)};function yP(an,Ur,hi){an.transparent===!0&&an.side===he&&an.forceSinglePass===!1?(an.side=de,an.needsUpdate=!0,tw(an,Ur,hi),an.side=j,an.needsUpdate=!0,tw(an,Ur,hi),an.side=he):tw(an,Ur,hi)}this.compile=function(an,Ur,hi=null){hi===null&&(hi=an),nt=js.get(hi),nt.init(Ur),ht.push(nt),hi.traverseVisible(function(Qr){Qr.isLight&&Qr.layers.test(Ur.layers)&&(nt.pushLight(Qr),Qr.castShadow&&nt.pushShadow(Qr))}),an!==hi&&an.traverseVisible(function(Qr){Qr.isLight&&Qr.layers.test(Ur.layers)&&(nt.pushLight(Qr),Qr.castShadow&&nt.pushShadow(Qr))}),nt.setupLights();const li=new Set;return an.traverse(function(Qr){if(!(Qr.isMesh||Qr.isPoints||Qr.isLine||Qr.isSprite))return;const qs=Qr.material;if(qs)if(Array.isArray(qs))for(let ba=0;ba<qs.length;ba++){const ia=qs[ba];yP(ia,hi,Qr),li.add(ia)}else yP(qs,hi,Qr),li.add(qs)}),nt=ht.pop(),li},this.compileAsync=function(an,Ur,hi=null){const li=this.compile(an,Ur,hi);return new Promise(Qr=>{function qs(){if(li.forEach(function(ba){St.get(ba).currentProgram.isReady()&&li.delete(ba)}),li.size===0){Qr(an);return}setTimeout(qs,10)}da.get("KHR_parallel_shader_compile")!==null?qs():setTimeout(qs,10)})};let TE=null;function G$(an){TE&&TE(an)}function xP(){U0.stop()}function bP(){U0.start()}const U0=new bC;U0.setAnimationLoop(G$),typeof self!="undefined"&&U0.setContext(self),this.setAnimationLoop=function(an){TE=an,Ws.setAnimationLoop(an),an===null?U0.stop():U0.start()},Ws.addEventListener("sessionstart",xP),Ws.addEventListener("sessionend",bP),this.render=function(an,Ur){if(Ur!==void 0&&Ur.isCamera!==!0){Gr("WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(pt===!0)return;const hi=Ws.enabled===!0&&Ws.isPresenting===!0,li=Rt!==null&&(pr===null||hi)&&Rt.begin(qe,pr);if(an.matrixWorldAutoUpdate===!0&&an.updateMatrixWorld(),Ur.parent===null&&Ur.matrixWorldAutoUpdate===!0&&Ur.updateMatrixWorld(),Ws.enabled===!0&&Ws.isPresenting===!0&&(Rt===null||Rt.isCompositing()===!1)&&(Ws.cameraAutoUpdate===!0&&Ws.updateCamera(Ur),Ur=Ws.getCamera()),an.isScene===!0&&an.onBeforeRender(qe,an,Ur,pr),nt=js.get(an,ht.length),nt.init(Ur),ht.push(nt),Qo.multiplyMatrices(Ur.projectionMatrix,Ur.matrixWorldInverse),oa.setFromProjectionMatrix(Qo,gl,Ur.reversedDepth),Ha=this.localClippingEnabled,Ms=Fa.init(this.clippingPlanes,Ha),ke=hs.get(an,Ye.length),ke.init(),Ye.push(ke),Ws.enabled===!0&&Ws.isPresenting===!0){const ba=qe.xr.getDepthSensingMesh();ba!==null&&BE(ba,Ur,-1/0,qe.sortObjects)}BE(an,Ur,0,qe.sortObjects),ke.finish(),qe.sortObjects===!0&&ke.sort(Xa,Pi),Hi=Ws.enabled===!1||Ws.isPresenting===!1||Ws.hasDepthSensing()===!1,Hi&&$s.addToRenderList(ke,an),this.info.render.frame++,Ms===!0&&Fa.beginShadows();const Qr=nt.state.shadowsArray;if(Va.render(Qr,an,Ur),Ms===!0&&Fa.endShadows(),this.info.autoReset===!0&&this.info.reset(),(li&&Rt.hasRenderPass())===!1){const ba=ke.opaque,ia=ke.transmissive;if(nt.setupLights(),Ur.isArrayCamera){const Ta=Ur.cameras;if(ia.length>0)for(let Qa=0,yo=Ta.length;Qa<yo;Qa++){const io=Ta[Qa];wP(ba,ia,an,io)}Hi&&$s.render(an);for(let Qa=0,yo=Ta.length;Qa<yo;Qa++){const io=Ta[Qa];_P(ke,an,io,io.viewport)}}else ia.length>0&&wP(ba,ia,an,Ur),Hi&&$s.render(an),_P(ke,an,Ur)}pr!==null&&cr===0&&(Cr.updateMultisampleRenderTarget(pr),Cr.updateRenderTargetMipmap(pr)),li&&Rt.end(qe),an.isScene===!0&&an.onAfterRender(qe,an,Ur),ga.resetDefaultState(),Br=-1,zr=null,ht.pop(),ht.length>0?(nt=ht[ht.length-1],Ms===!0&&Fa.setGlobalState(qe.clippingPlanes,nt.state.camera)):nt=null,Ye.pop(),Ye.length>0?ke=Ye[Ye.length-1]:ke=null};function BE(an,Ur,hi,li){if(an.visible===!1)return;if(an.layers.test(Ur.layers)){if(an.isGroup)hi=an.renderOrder;else if(an.isLOD)an.autoUpdate===!0&&an.update(Ur);else if(an.isLight)nt.pushLight(an),an.castShadow&&nt.pushShadow(an);else if(an.isSprite){if(!an.frustumCulled||oa.intersectsSprite(an)){li&&Li.setFromMatrixPosition(an.matrixWorld).applyMatrix4(Qo);const ba=Vs.update(an),ia=an.material;ia.visible&&ke.push(an,ba,ia,hi,Li.z,null)}}else if((an.isMesh||an.isLine||an.isPoints)&&(!an.frustumCulled||oa.intersectsObject(an))){const ba=Vs.update(an),ia=an.material;if(li&&(an.boundingSphere!==void 0?(an.boundingSphere===null&&an.computeBoundingSphere(),Li.copy(an.boundingSphere.center)):(ba.boundingSphere===null&&ba.computeBoundingSphere(),Li.copy(ba.boundingSphere.center)),Li.applyMatrix4(an.matrixWorld).applyMatrix4(Qo)),Array.isArray(ia)){const Ta=ba.groups;for(let Qa=0,yo=Ta.length;Qa<yo;Qa++){const io=Ta[Qa],nl=ia[io.materialIndex];nl&&nl.visible&&ke.push(an,ba,nl,hi,Li.z,io)}}else ia.visible&&ke.push(an,ba,ia,hi,Li.z,null)}}const qs=an.children;for(let ba=0,ia=qs.length;ba<ia;ba++)BE(qs[ba],Ur,hi,li)}function _P(an,Ur,hi,li){const{opaque:Qr,transmissive:qs,transparent:ba}=an;nt.setupLightsView(hi),Ms===!0&&Fa.setGlobalState(qe.clippingPlanes,hi),li&&Ps.viewport(Dr.copy(li)),Qr.length>0&&ew(Qr,Ur,hi),qs.length>0&&ew(qs,Ur,hi),ba.length>0&&ew(ba,Ur,hi),Ps.buffers.depth.setTest(!0),Ps.buffers.depth.setMask(!0),Ps.buffers.color.setMask(!0),Ps.setPolygonOffset(!1)}function wP(an,Ur,hi,li){if((hi.isScene===!0?hi.overrideMaterial:null)!==null)return;if(nt.state.transmissionRenderTarget[li.id]===void 0){const nl=da.has("EXT_color_buffer_half_float")||da.has("EXT_color_buffer_float");nt.state.transmissionRenderTarget[li.id]=new Os(1,1,{generateMipmaps:!0,type:nl?Wt:es,minFilter:yi,samples:ho.samples,stencilBuffer:a,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:xr.workingColorSpace})}const qs=nt.state.transmissionRenderTarget[li.id],ba=li.viewport||Dr;qs.setSize(ba.z*qe.transmissionResolutionScale,ba.w*qe.transmissionResolutionScale);const ia=qe.getRenderTarget(),Ta=qe.getActiveCubeFace(),Qa=qe.getActiveMipmapLevel();qe.setRenderTarget(qs),qe.getClearColor(ds),As=qe.getClearAlpha(),As<1&&qe.setClearColor(16777215,.5),qe.clear(),Hi&&$s.render(hi);const yo=qe.toneMapping;qe.toneMapping=Ct;const io=li.viewport;if(li.viewport!==void 0&&(li.viewport=void 0),nt.setupLightsView(li),Ms===!0&&Fa.setGlobalState(qe.clippingPlanes,li),ew(an,hi,li),Cr.updateMultisampleRenderTarget(qs),Cr.updateRenderTargetMipmap(qs),da.has("WEBGL_multisampled_render_to_texture")===!1){let nl=!1;for(let Eu=0,Dc=Ur.length;Eu<Dc;Eu++){const kc=Ur[Eu],{object:Pu,geometry:so,material:Au,group:Vl}=kc;if(Au.side===he&&Pu.layers.test(li.layers)){const bA=Au.side;Au.side=de,Au.needsUpdate=!0,SP(Pu,hi,li,so,Au,Vl),Au.side=bA,Au.needsUpdate=!0,nl=!0}}nl===!0&&(Cr.updateMultisampleRenderTarget(qs),Cr.updateRenderTargetMipmap(qs))}qe.setRenderTarget(ia,Ta,Qa),qe.setClearColor(ds,As),io!==void 0&&(li.viewport=io),qe.toneMapping=yo}function ew(an,Ur,hi){const li=Ur.isScene===!0?Ur.overrideMaterial:null;for(let Qr=0,qs=an.length;Qr<qs;Qr++){const ba=an[Qr],{object:ia,geometry:Ta,group:Qa}=ba;let yo=ba.material;yo.allowOverride===!0&&li!==null&&(yo=li),ia.layers.test(hi.layers)&&SP(ia,Ur,hi,Ta,yo,Qa)}}function SP(an,Ur,hi,li,Qr,qs){an.onBeforeRender(qe,Ur,hi,li,Qr,qs),an.modelViewMatrix.multiplyMatrices(hi.matrixWorldInverse,an.matrixWorld),an.normalMatrix.getNormalMatrix(an.modelViewMatrix),Qr.onBeforeRender(qe,Ur,hi,li,an,qs),Qr.transparent===!0&&Qr.side===he&&Qr.forceSinglePass===!1?(Qr.side=de,Qr.needsUpdate=!0,qe.renderBufferDirect(hi,Ur,li,Qr,an,qs),Qr.side=j,Qr.needsUpdate=!0,qe.renderBufferDirect(hi,Ur,li,Qr,an,qs),Qr.side=he):qe.renderBufferDirect(hi,Ur,li,Qr,an,qs),an.onAfterRender(qe,Ur,hi,li,Qr,qs)}function tw(an,Ur,hi){Ur.isScene!==!0&&(Ur=os);const li=St.get(an),Qr=nt.state.lights,qs=nt.state.shadowsArray,ba=Qr.state.version,ia=Na.getParameters(an,Qr.state,qs,Ur,hi),Ta=Na.getProgramCacheKey(ia);let Qa=li.programs;li.environment=an.isMeshStandardMaterial?Ur.environment:null,li.fog=Ur.fog,li.envMap=(an.isMeshStandardMaterial?Qi:xi).get(an.envMap||li.environment),li.envMapRotation=li.environment!==null&&an.envMap===null?Ur.environmentRotation:an.envMapRotation,Qa===void 0&&(an.addEventListener("dispose",bg),Qa=new Map,li.programs=Qa);let yo=Qa.get(Ta);if(yo!==void 0){if(li.currentProgram===yo&&li.lightsStateVersion===ba)return EP(an,ia),yo}else ia.uniforms=Na.getUniforms(an),an.onBeforeCompile(ia,qe),yo=Na.acquireProgram(ia,Ta),Qa.set(Ta,yo),li.uniforms=ia.uniforms;const io=li.uniforms;return(!an.isShaderMaterial&&!an.isRawShaderMaterial||an.clipping===!0)&&(io.clippingPlanes=Fa.uniform),EP(an,ia),li.needsLights=W$(an),li.lightsStateVersion=ba,li.needsLights&&(io.ambientLightColor.value=Qr.state.ambient,io.lightProbe.value=Qr.state.probe,io.directionalLights.value=Qr.state.directional,io.directionalLightShadows.value=Qr.state.directionalShadow,io.spotLights.value=Qr.state.spot,io.spotLightShadows.value=Qr.state.spotShadow,io.rectAreaLights.value=Qr.state.rectArea,io.ltc_1.value=Qr.state.rectAreaLTC1,io.ltc_2.value=Qr.state.rectAreaLTC2,io.pointLights.value=Qr.state.point,io.pointLightShadows.value=Qr.state.pointShadow,io.hemisphereLights.value=Qr.state.hemi,io.directionalShadowMap.value=Qr.state.directionalShadowMap,io.directionalShadowMatrix.value=Qr.state.directionalShadowMatrix,io.spotShadowMap.value=Qr.state.spotShadowMap,io.spotLightMatrix.value=Qr.state.spotLightMatrix,io.spotLightMap.value=Qr.state.spotLightMap,io.pointShadowMap.value=Qr.state.pointShadowMap,io.pointShadowMatrix.value=Qr.state.pointShadowMatrix),li.currentProgram=yo,li.uniformsList=null,yo}function MP(an){if(an.uniformsList===null){const Ur=an.currentProgram.getUniforms();an.uniformsList=cb.seqWithValue(Ur.seq,an.uniforms)}return an.uniformsList}function EP(an,Ur){const hi=St.get(an);hi.outputColorSpace=Ur.outputColorSpace,hi.batching=Ur.batching,hi.batchingColor=Ur.batchingColor,hi.instancing=Ur.instancing,hi.instancingColor=Ur.instancingColor,hi.instancingMorph=Ur.instancingMorph,hi.skinning=Ur.skinning,hi.morphTargets=Ur.morphTargets,hi.morphNormals=Ur.morphNormals,hi.morphColors=Ur.morphColors,hi.morphTargetsCount=Ur.morphTargetsCount,hi.numClippingPlanes=Ur.numClippingPlanes,hi.numIntersection=Ur.numClipIntersection,hi.vertexAlphas=Ur.vertexAlphas,hi.vertexTangents=Ur.vertexTangents,hi.toneMapping=Ur.toneMapping}function H$(an,Ur,hi,li,Qr){Ur.isScene!==!0&&(Ur=os),Cr.resetTextureUnits();const qs=Ur.fog,ba=li.isMeshStandardMaterial?Ur.environment:null,ia=pr===null?qe.outputColorSpace:pr.isXRRenderTarget===!0?pr.texture.colorSpace:No,Ta=(li.isMeshStandardMaterial?Qi:xi).get(li.envMap||ba),Qa=li.vertexColors===!0&&!!hi.attributes.color&&hi.attributes.color.itemSize===4,yo=!!hi.attributes.tangent&&(!!li.normalMap||li.anisotropy>0),io=!!hi.morphAttributes.position,nl=!!hi.morphAttributes.normal,Eu=!!hi.morphAttributes.color;let Dc=Ct;li.toneMapped&&(pr===null||pr.isXRRenderTarget===!0)&&(Dc=qe.toneMapping);const kc=hi.morphAttributes.position||hi.morphAttributes.normal||hi.morphAttributes.color,Pu=kc!==void 0?kc.length:0,so=St.get(li),Au=nt.state.lights;if(Ms===!0&&(Ha===!0||an!==zr)){const cf=an===zr&&li.id===Br;Fa.setState(li,an,cf)}let Vl=!1;li.version===so.__version?(so.needsLights&&so.lightsStateVersion!==Au.state.version||so.outputColorSpace!==ia||Qr.isBatchedMesh&&so.batching===!1||!Qr.isBatchedMesh&&so.batching===!0||Qr.isBatchedMesh&&so.batchingColor===!0&&Qr.colorTexture===null||Qr.isBatchedMesh&&so.batchingColor===!1&&Qr.colorTexture!==null||Qr.isInstancedMesh&&so.instancing===!1||!Qr.isInstancedMesh&&so.instancing===!0||Qr.isSkinnedMesh&&so.skinning===!1||!Qr.isSkinnedMesh&&so.skinning===!0||Qr.isInstancedMesh&&so.instancingColor===!0&&Qr.instanceColor===null||Qr.isInstancedMesh&&so.instancingColor===!1&&Qr.instanceColor!==null||Qr.isInstancedMesh&&so.instancingMorph===!0&&Qr.morphTexture===null||Qr.isInstancedMesh&&so.instancingMorph===!1&&Qr.morphTexture!==null||so.envMap!==Ta||li.fog===!0&&so.fog!==qs||so.numClippingPlanes!==void 0&&(so.numClippingPlanes!==Fa.numPlanes||so.numIntersection!==Fa.numIntersection)||so.vertexAlphas!==Qa||so.vertexTangents!==yo||so.morphTargets!==io||so.morphNormals!==nl||so.morphColors!==Eu||so.toneMapping!==Dc||so.morphTargetsCount!==Pu)&&(Vl=!0):(Vl=!0,so.__version=li.version);let bA=so.currentProgram;Vl===!0&&(bA=tw(li,Ur,Qr));let Wv=!1,_A=!1,Mx=!1;const Zu=bA.getUniforms(),Gf=so.uniforms;if(Ps.useProgram(bA.program)&&(Wv=!0,_A=!0,Mx=!0),li.id!==Br&&(Br=li.id,_A=!0),Wv||zr!==an){Ps.buffers.depth.getReversed()&&an.reversedDepth!==!0&&(an._reversedDepth=!0,an.updateProjectionMatrix()),Zu.setValue(Pn,"projectionMatrix",an.projectionMatrix),Zu.setValue(Pn,"viewMatrix",an.matrixWorldInverse);const Hf=Zu.map.cameraPosition;Hf!==void 0&&Hf.setValue(Pn,co.setFromMatrixPosition(an.matrixWorld)),ho.logarithmicDepthBuffer&&Zu.setValue(Pn,"logDepthBufFC",2/(Math.log(an.far+1)/Math.LN2)),(li.isMeshPhongMaterial||li.isMeshToonMaterial||li.isMeshLambertMaterial||li.isMeshBasicMaterial||li.isMeshStandardMaterial||li.isShaderMaterial)&&Zu.setValue(Pn,"isOrthographic",an.isOrthographicCamera===!0),zr!==an&&(zr=an,_A=!0,Mx=!0)}if(so.needsLights&&(Au.state.directionalShadowMap.length>0&&Zu.setValue(Pn,"directionalShadowMap",Au.state.directionalShadowMap,Cr),Au.state.spotShadowMap.length>0&&Zu.setValue(Pn,"spotShadowMap",Au.state.spotShadowMap,Cr),Au.state.pointShadowMap.length>0&&Zu.setValue(Pn,"pointShadowMap",Au.state.pointShadowMap,Cr)),Qr.isSkinnedMesh){Zu.setOptional(Pn,Qr,"bindMatrix"),Zu.setOptional(Pn,Qr,"bindMatrixInverse");const cf=Qr.skeleton;cf&&(cf.boneTexture===null&&cf.computeBoneTexture(),Zu.setValue(Pn,"boneTexture",cf.boneTexture,Cr))}Qr.isBatchedMesh&&(Zu.setOptional(Pn,Qr,"batchingTexture"),Zu.setValue(Pn,"batchingTexture",Qr._matricesTexture,Cr),Zu.setOptional(Pn,Qr,"batchingIdTexture"),Zu.setValue(Pn,"batchingIdTexture",Qr._indirectTexture,Cr),Zu.setOptional(Pn,Qr,"batchingColorTexture"),Qr._colorsTexture!==null&&Zu.setValue(Pn,"batchingColorTexture",Qr._colorsTexture,Cr));const tp=hi.morphAttributes;if((tp.position!==void 0||tp.normal!==void 0||tp.color!==void 0)&&Wo.update(Qr,hi,bA),(_A||so.receiveShadow!==Qr.receiveShadow)&&(so.receiveShadow=Qr.receiveShadow,Zu.setValue(Pn,"receiveShadow",Qr.receiveShadow)),li.isMeshGouraudMaterial&&li.envMap!==null&&(Gf.envMap.value=Ta,Gf.flipEnvMap.value=Ta.isCubeTexture&&Ta.isRenderTargetTexture===!1?-1:1),li.isMeshStandardMaterial&&li.envMap===null&&Ur.environment!==null&&(Gf.envMapIntensity.value=Ur.environmentIntensity),Gf.dfgLUT!==void 0&&(Gf.dfgLUT.value=Z3()),_A&&(Zu.setValue(Pn,"toneMappingExposure",qe.toneMappingExposure),so.needsLights&&Q$(Gf,Mx),qs&&li.fog===!0&&po.refreshFogUniforms(Gf,qs),po.refreshMaterialUniforms(Gf,li,ps,Yi,nt.state.transmissionRenderTarget[an.id]),cb.upload(Pn,MP(so),Gf,Cr)),li.isShaderMaterial&&li.uniformsNeedUpdate===!0&&(cb.upload(Pn,MP(so),Gf,Cr),li.uniformsNeedUpdate=!1),li.isSpriteMaterial&&Zu.setValue(Pn,"center",Qr.center),Zu.setValue(Pn,"modelViewMatrix",Qr.modelViewMatrix),Zu.setValue(Pn,"normalMatrix",Qr.normalMatrix),Zu.setValue(Pn,"modelMatrix",Qr.matrixWorld),li.isShaderMaterial||li.isRawShaderMaterial){const cf=li.uniformsGroups;for(let Hf=0,RE=cf.length;Hf<RE;Hf++){const O0=cf[Hf];gs.update(O0,bA),gs.bind(O0,bA)}}return bA}function Q$(an,Ur){an.ambientLightColor.needsUpdate=Ur,an.lightProbe.needsUpdate=Ur,an.directionalLights.needsUpdate=Ur,an.directionalLightShadows.needsUpdate=Ur,an.pointLights.needsUpdate=Ur,an.pointLightShadows.needsUpdate=Ur,an.spotLights.needsUpdate=Ur,an.spotLightShadows.needsUpdate=Ur,an.rectAreaLights.needsUpdate=Ur,an.hemisphereLights.needsUpdate=Ur}function W$(an){return an.isMeshLambertMaterial||an.isMeshToonMaterial||an.isMeshPhongMaterial||an.isMeshStandardMaterial||an.isShadowMaterial||an.isShaderMaterial&&an.lights===!0}this.getActiveCubeFace=function(){return xn},this.getActiveMipmapLevel=function(){return cr},this.getRenderTarget=function(){return pr},this.setRenderTargetTextures=function(an,Ur,hi){const li=St.get(an);li.__autoAllocateDepthBuffer=an.resolveDepthBuffer===!1,li.__autoAllocateDepthBuffer===!1&&(li.__useRenderToTexture=!1),St.get(an.texture).__webglTexture=Ur,St.get(an.depthTexture).__webglTexture=li.__autoAllocateDepthBuffer?void 0:hi,li.__hasExternalTextures=!0},this.setRenderTargetFramebuffer=function(an,Ur){const hi=St.get(an);hi.__webglFramebuffer=Ur,hi.__useDefaultFramebuffer=Ur===void 0};const Z$=Pn.createFramebuffer();this.setRenderTarget=function(an,Ur=0,hi=0){pr=an,xn=Ur,cr=hi;let li=null,Qr=!1,qs=!1;if(an){const ia=St.get(an);if(ia.__useDefaultFramebuffer!==void 0){Ps.bindFramebuffer(Pn.FRAMEBUFFER,ia.__webglFramebuffer),Dr.copy(an.viewport),Zr.copy(an.scissor),Ti=an.scissorTest,Ps.viewport(Dr),Ps.scissor(Zr),Ps.setScissorTest(Ti),Br=-1;return}else if(ia.__webglFramebuffer===void 0)Cr.setupRenderTarget(an);else if(ia.__hasExternalTextures)Cr.rebindTextures(an,St.get(an.texture).__webglTexture,St.get(an.depthTexture).__webglTexture);else if(an.depthBuffer){const yo=an.depthTexture;if(ia.__boundDepthTexture!==yo){if(yo!==null&&St.has(yo)&&(an.width!==yo.image.width||an.height!==yo.image.height))throw new Error("WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.");Cr.setupDepthRenderbuffer(an)}}const Ta=an.texture;(Ta.isData3DTexture||Ta.isDataArrayTexture||Ta.isCompressedArrayTexture)&&(qs=!0);const Qa=St.get(an).__webglFramebuffer;an.isWebGLCubeRenderTarget?(Array.isArray(Qa[Ur])?li=Qa[Ur][hi]:li=Qa[Ur],Qr=!0):an.samples>0&&Cr.useMultisampledRTT(an)===!1?li=St.get(an).__webglMultisampledFramebuffer:Array.isArray(Qa)?li=Qa[hi]:li=Qa,Dr.copy(an.viewport),Zr.copy(an.scissor),Ti=an.scissorTest}else Dr.copy(Nr).multiplyScalar(ps).floor(),Zr.copy(Yr).multiplyScalar(ps).floor(),Ti=cs;if(hi!==0&&(li=Z$),Ps.bindFramebuffer(Pn.FRAMEBUFFER,li)&&Ps.drawBuffers(an,li),Ps.viewport(Dr),Ps.scissor(Zr),Ps.setScissorTest(Ti),Qr){const ia=St.get(an.texture);Pn.framebufferTexture2D(Pn.FRAMEBUFFER,Pn.COLOR_ATTACHMENT0,Pn.TEXTURE_CUBE_MAP_POSITIVE_X+Ur,ia.__webglTexture,hi)}else if(qs){const ia=Ur;for(let Ta=0;Ta<an.textures.length;Ta++){const Qa=St.get(an.textures[Ta]);Pn.framebufferTextureLayer(Pn.FRAMEBUFFER,Pn.COLOR_ATTACHMENT0+Ta,Qa.__webglTexture,hi,ia)}}else if(an!==null&&hi!==0){const ia=St.get(an.texture);Pn.framebufferTexture2D(Pn.FRAMEBUFFER,Pn.COLOR_ATTACHMENT0,Pn.TEXTURE_2D,ia.__webglTexture,hi)}Br=-1},this.readRenderTargetPixels=function(an,Ur,hi,li,Qr,qs,ba,ia=0){if(!(an&&an.isWebGLRenderTarget)){Gr("WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let Ta=St.get(an).__webglFramebuffer;if(an.isWebGLCubeRenderTarget&&ba!==void 0&&(Ta=Ta[ba]),Ta){Ps.bindFramebuffer(Pn.FRAMEBUFFER,Ta);try{const Qa=an.textures[ia],yo=Qa.format,io=Qa.type;if(!ho.textureFormatReadable(yo)){Gr("WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!ho.textureTypeReadable(io)){Gr("WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}Ur>=0&&Ur<=an.width-li&&hi>=0&&hi<=an.height-Qr&&(an.textures.length>1&&Pn.readBuffer(Pn.COLOR_ATTACHMENT0+ia),Pn.readPixels(Ur,hi,li,Qr,Ts.convert(yo),Ts.convert(io),qs))}finally{const Qa=pr!==null?St.get(pr).__webglFramebuffer:null;Ps.bindFramebuffer(Pn.FRAMEBUFFER,Qa)}}},this.readRenderTargetPixelsAsync=function(an,Ur,hi,li,Qr,qs,ba,ia=0){return Pa(this,null,function*(){if(!(an&&an.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let Ta=St.get(an).__webglFramebuffer;if(an.isWebGLCubeRenderTarget&&ba!==void 0&&(Ta=Ta[ba]),Ta)if(Ur>=0&&Ur<=an.width-li&&hi>=0&&hi<=an.height-Qr){Ps.bindFramebuffer(Pn.FRAMEBUFFER,Ta);const Qa=an.textures[ia],yo=Qa.format,io=Qa.type;if(!ho.textureFormatReadable(yo))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!ho.textureTypeReadable(io))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");const nl=Pn.createBuffer();Pn.bindBuffer(Pn.PIXEL_PACK_BUFFER,nl),Pn.bufferData(Pn.PIXEL_PACK_BUFFER,qs.byteLength,Pn.STREAM_READ),an.textures.length>1&&Pn.readBuffer(Pn.COLOR_ATTACHMENT0+ia),Pn.readPixels(Ur,hi,li,Qr,Ts.convert(yo),Ts.convert(io),0);const Eu=pr!==null?St.get(pr).__webglFramebuffer:null;Ps.bindFramebuffer(Pn.FRAMEBUFFER,Eu);const Dc=Pn.fenceSync(Pn.SYNC_GPU_COMMANDS_COMPLETE,0);return Pn.flush(),yield ju(Pn,Dc,4),Pn.bindBuffer(Pn.PIXEL_PACK_BUFFER,nl),Pn.getBufferSubData(Pn.PIXEL_PACK_BUFFER,0,qs),Pn.deleteBuffer(nl),Pn.deleteSync(Dc),qs}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")})},this.copyFramebufferToTexture=function(an,Ur=null,hi=0){const li=Math.pow(2,-hi),Qr=Math.floor(an.image.width*li),qs=Math.floor(an.image.height*li),ba=Ur!==null?Ur.x:0,ia=Ur!==null?Ur.y:0;Cr.setTexture2D(an,0),Pn.copyTexSubImage2D(Pn.TEXTURE_2D,hi,0,0,ba,ia,Qr,qs),Ps.unbindTexture()};const K$=Pn.createFramebuffer(),$$=Pn.createFramebuffer();this.copyTextureToTexture=function(an,Ur,hi=null,li=null,Qr=0,qs=null){qs===null&&(Qr!==0?(ki("WebGLRenderer: copyTextureToTexture function signature has changed to support src and dst mipmap levels."),qs=Qr,Qr=0):qs=0);let ba,ia,Ta,Qa,yo,io,nl,Eu,Dc;const kc=an.isCompressedTexture?an.mipmaps[qs]:an.image;if(hi!==null)ba=hi.max.x-hi.min.x,ia=hi.max.y-hi.min.y,Ta=hi.isBox3?hi.max.z-hi.min.z:1,Qa=hi.min.x,yo=hi.min.y,io=hi.isBox3?hi.min.z:0;else{const tp=Math.pow(2,-Qr);ba=Math.floor(kc.width*tp),ia=Math.floor(kc.height*tp),an.isDataArrayTexture?Ta=kc.depth:an.isData3DTexture?Ta=Math.floor(kc.depth*tp):Ta=1,Qa=0,yo=0,io=0}li!==null?(nl=li.x,Eu=li.y,Dc=li.z):(nl=0,Eu=0,Dc=0);const Pu=Ts.convert(Ur.format),so=Ts.convert(Ur.type);let Au;Ur.isData3DTexture?(Cr.setTexture3D(Ur,0),Au=Pn.TEXTURE_3D):Ur.isDataArrayTexture||Ur.isCompressedArrayTexture?(Cr.setTexture2DArray(Ur,0),Au=Pn.TEXTURE_2D_ARRAY):(Cr.setTexture2D(Ur,0),Au=Pn.TEXTURE_2D),Pn.pixelStorei(Pn.UNPACK_FLIP_Y_WEBGL,Ur.flipY),Pn.pixelStorei(Pn.UNPACK_PREMULTIPLY_ALPHA_WEBGL,Ur.premultiplyAlpha),Pn.pixelStorei(Pn.UNPACK_ALIGNMENT,Ur.unpackAlignment);const Vl=Pn.getParameter(Pn.UNPACK_ROW_LENGTH),bA=Pn.getParameter(Pn.UNPACK_IMAGE_HEIGHT),Wv=Pn.getParameter(Pn.UNPACK_SKIP_PIXELS),_A=Pn.getParameter(Pn.UNPACK_SKIP_ROWS),Mx=Pn.getParameter(Pn.UNPACK_SKIP_IMAGES);Pn.pixelStorei(Pn.UNPACK_ROW_LENGTH,kc.width),Pn.pixelStorei(Pn.UNPACK_IMAGE_HEIGHT,kc.height),Pn.pixelStorei(Pn.UNPACK_SKIP_PIXELS,Qa),Pn.pixelStorei(Pn.UNPACK_SKIP_ROWS,yo),Pn.pixelStorei(Pn.UNPACK_SKIP_IMAGES,io);const Zu=an.isDataArrayTexture||an.isData3DTexture,Gf=Ur.isDataArrayTexture||Ur.isData3DTexture;if(an.isDepthTexture){const tp=St.get(an),cf=St.get(Ur),Hf=St.get(tp.__renderTarget),RE=St.get(cf.__renderTarget);Ps.bindFramebuffer(Pn.READ_FRAMEBUFFER,Hf.__webglFramebuffer),Ps.bindFramebuffer(Pn.DRAW_FRAMEBUFFER,RE.__webglFramebuffer);for(let O0=0;O0<Ta;O0++)Zu&&(Pn.framebufferTextureLayer(Pn.READ_FRAMEBUFFER,Pn.COLOR_ATTACHMENT0,St.get(an).__webglTexture,Qr,io+O0),Pn.framebufferTextureLayer(Pn.DRAW_FRAMEBUFFER,Pn.COLOR_ATTACHMENT0,St.get(Ur).__webglTexture,qs,Dc+O0)),Pn.blitFramebuffer(Qa,yo,ba,ia,nl,Eu,ba,ia,Pn.DEPTH_BUFFER_BIT,Pn.NEAREST);Ps.bindFramebuffer(Pn.READ_FRAMEBUFFER,null),Ps.bindFramebuffer(Pn.DRAW_FRAMEBUFFER,null)}else if(Qr!==0||an.isRenderTargetTexture||St.has(an)){const tp=St.get(an),cf=St.get(Ur);Ps.bindFramebuffer(Pn.READ_FRAMEBUFFER,K$),Ps.bindFramebuffer(Pn.DRAW_FRAMEBUFFER,$$);for(let Hf=0;Hf<Ta;Hf++)Zu?Pn.framebufferTextureLayer(Pn.READ_FRAMEBUFFER,Pn.COLOR_ATTACHMENT0,tp.__webglTexture,Qr,io+Hf):Pn.framebufferTexture2D(Pn.READ_FRAMEBUFFER,Pn.COLOR_ATTACHMENT0,Pn.TEXTURE_2D,tp.__webglTexture,Qr),Gf?Pn.framebufferTextureLayer(Pn.DRAW_FRAMEBUFFER,Pn.COLOR_ATTACHMENT0,cf.__webglTexture,qs,Dc+Hf):Pn.framebufferTexture2D(Pn.DRAW_FRAMEBUFFER,Pn.COLOR_ATTACHMENT0,Pn.TEXTURE_2D,cf.__webglTexture,qs),Qr!==0?Pn.blitFramebuffer(Qa,yo,ba,ia,nl,Eu,ba,ia,Pn.COLOR_BUFFER_BIT,Pn.NEAREST):Gf?Pn.copyTexSubImage3D(Au,qs,nl,Eu,Dc+Hf,Qa,yo,ba,ia):Pn.copyTexSubImage2D(Au,qs,nl,Eu,Qa,yo,ba,ia);Ps.bindFramebuffer(Pn.READ_FRAMEBUFFER,null),Ps.bindFramebuffer(Pn.DRAW_FRAMEBUFFER,null)}else Gf?an.isDataTexture||an.isData3DTexture?Pn.texSubImage3D(Au,qs,nl,Eu,Dc,ba,ia,Ta,Pu,so,kc.data):Ur.isCompressedArrayTexture?Pn.compressedTexSubImage3D(Au,qs,nl,Eu,Dc,ba,ia,Ta,Pu,kc.data):Pn.texSubImage3D(Au,qs,nl,Eu,Dc,ba,ia,Ta,Pu,so,kc):an.isDataTexture?Pn.texSubImage2D(Pn.TEXTURE_2D,qs,nl,Eu,ba,ia,Pu,so,kc.data):an.isCompressedTexture?Pn.compressedTexSubImage2D(Pn.TEXTURE_2D,qs,nl,Eu,kc.width,kc.height,Pu,kc.data):Pn.texSubImage2D(Pn.TEXTURE_2D,qs,nl,Eu,ba,ia,Pu,so,kc);Pn.pixelStorei(Pn.UNPACK_ROW_LENGTH,Vl),Pn.pixelStorei(Pn.UNPACK_IMAGE_HEIGHT,bA),Pn.pixelStorei(Pn.UNPACK_SKIP_PIXELS,Wv),Pn.pixelStorei(Pn.UNPACK_SKIP_ROWS,_A),Pn.pixelStorei(Pn.UNPACK_SKIP_IMAGES,Mx),qs===0&&Ur.generateMipmaps&&Pn.generateMipmap(Au),Ps.unbindTexture()},this.initRenderTarget=function(an){St.get(an).__webglFramebuffer===void 0&&Cr.setupRenderTarget(an)},this.initTexture=function(an){an.isCubeTexture?Cr.setTextureCube(an,0):an.isData3DTexture?Cr.setTexture3D(an,0):an.isDataArrayTexture||an.isCompressedArrayTexture?Cr.setTexture2DArray(an,0):Cr.setTexture2D(an,0),Ps.unbindTexture()},this.resetState=function(){xn=0,cr=0,pr=null,Ps.reset(),ga.reset()},typeof __THREE_DEVTOOLS__!="undefined"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return gl}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;const t=this.getContext();t.drawingBufferColorSpace=xr._getDrawingBufferColorSpace(e),t.unpackColorSpace=xr._getUnpackColorSpace()}}const $3=["alphaMap","alphaTest","anisotropy","anisotropyMap","anisotropyRotation","aoMap","aoMapIntensity","attenuationColor","attenuationDistance","bumpMap","clearcoat","clearcoatMap","clearcoatNormalMap","clearcoatNormalScale","clearcoatRoughness","color","dispersion","displacementMap","emissive","emissiveIntensity","emissiveMap","envMap","envMapIntensity","gradientMap","ior","iridescence","iridescenceIOR","iridescenceMap","iridescenceThicknessMap","lightMap","lightMapIntensity","map","matcap","metalness","metalnessMap","normalMap","normalScale","opacity","roughness","roughnessMap","sheen","sheenColor","sheenColorMap","sheenRoughnessMap","shininess","specular","specularColor","specularColorMap","specularIntensity","specularIntensityMap","specularMap","thickness","transmission","transmissionMap"],s1=new WeakMap;class X3{constructor(e){this.renderObjects=new WeakMap,this.hasNode=this.containsNode(e),this.hasAnimation=e.object.isSkinnedMesh===!0,this.refreshUniforms=$3,this.renderId=0}firstInitialization(e){return this.renderObjects.has(e)===!1?(this.getRenderObjectData(e),!0):!1}needsVelocity(e){const t=e.getMRT();return t!==null&&t.has("velocity")}getRenderObjectData(e){let t=this.renderObjects.get(e);if(t===void 0){const{geometry:n,material:i,object:a}=e;if(t={material:this.getMaterialData(i),geometry:{id:n.id,attributes:this.getAttributesData(n.attributes),indexVersion:n.index?n.index.version:null,drawRange:{start:n.drawRange.start,count:n.drawRange.count}},worldMatrix:a.matrixWorld.clone()},a.center&&(t.center=a.center.clone()),a.morphTargetInfluences&&(t.morphTargetInfluences=a.morphTargetInfluences.slice()),e.bundle!==null&&(t.version=e.bundle.version),t.material.transmission>0){const{width:o,height:u}=e.context;t.bufferWidth=o,t.bufferHeight=u}t.lights=this.getLightsData(e.lightsNode.getLights()),this.renderObjects.set(e,t)}return t}getAttributesData(e){const t={};for(const n in e){const i=e[n];t[n]={version:i.version}}return t}containsNode(e){const t=e.material;for(const n in t)if(t[n]&&t[n].isNode)return!0;return!!(e.context.modelViewMatrix||e.context.modelNormalViewMatrix||e.context.getAO||e.context.getShadow)}getMaterialData(e){const t={};for(const n of this.refreshUniforms){const i=e[n];i!=null&&(typeof i=="object"&&i.clone!==void 0?i.isTexture===!0?t[n]={id:i.id,version:i.version}:t[n]=i.clone():t[n]=i)}return t}equals(e,t){const{object:n,material:i,geometry:a}=e,o=this.getRenderObjectData(e);if(o.worldMatrix.equals(n.matrixWorld)!==!0)return o.worldMatrix.copy(n.matrixWorld),!1;const u=o.material;for(const ee in u){const q=u[ee],ye=i[ee];if(q.equals!==void 0){if(q.equals(ye)===!1)return q.copy(ye),!1}else if(ye.isTexture===!0){if(q.id!==ye.id||q.version!==ye.version)return q.id=ye.id,q.version=ye.version,!1}else if(q!==ye)return u[ee]=ye,!1}if(u.transmission>0){const{width:ee,height:q}=e.context;if(o.bufferWidth!==ee||o.bufferHeight!==q)return o.bufferWidth=ee,o.bufferHeight=q,!1}const c=o.geometry,d=a.attributes,g=c.attributes,v=Object.keys(g),M=Object.keys(d);if(c.id!==a.id)return c.id=a.id,!1;if(v.length!==M.length)return o.geometry.attributes=this.getAttributesData(d),!1;for(const ee of v){const q=g[ee],ye=d[ee];if(ye===void 0)return delete g[ee],!1;if(q.version!==ye.version)return q.version=ye.version,!1}const B=a.index,I=c.indexVersion,ne=B?B.version:null;if(I!==ne)return c.indexVersion=ne,!1;if(c.drawRange.start!==a.drawRange.start||c.drawRange.count!==a.drawRange.count)return c.drawRange.start=a.drawRange.start,c.drawRange.count=a.drawRange.count,!1;if(o.morphTargetInfluences){let ee=!1;for(let q=0;q<o.morphTargetInfluences.length;q++)o.morphTargetInfluences[q]!==n.morphTargetInfluences[q]&&(o.morphTargetInfluences[q]=n.morphTargetInfluences[q],ee=!0);if(ee)return!1}if(o.lights){for(let ee=0;ee<t.length;ee++)if(o.lights[ee].map!==t[ee].map)return!1}return o.center&&o.center.equals(n.center)===!1?(o.center.copy(n.center),!0):(e.bundle!==null&&(o.version=e.bundle.version),!0)}getLightsData(e){const t=[];for(const n of e)n.isSpotLight===!0&&n.map!==null&&t.push({map:n.map.version});return t}getLights(e,t){if(s1.has(e)){const i=s1.get(e);if(i.renderId===t)return i.lightsData}const n=this.getLightsData(e.getLights());return s1.set(e,{renderId:t,lightsData:n}),n}needsRefresh(e,t){if(this.hasNode||this.hasAnimation||this.firstInitialization(e)||this.needsVelocity(t.renderer))return!0;const{renderId:n}=t;if(this.renderId!==n)return this.renderId=n,!0;const i=e.object.static===!0,a=e.bundle!==null&&e.bundle.static===!0&&this.getRenderObjectData(e).version===e.bundle.version;if(i||a)return!1;const o=this.getLights(e.lightsNode,n);return this.equals(e,o)!==!0}}function a1(s,e=0){let t=3735928559^e,n=1103547991^e;if(s instanceof Array)for(let i=0,a;i<s.length;i++)a=s[i],t=Math.imul(t^a,2654435761),n=Math.imul(n^a,1597334677);else for(let i=0,a;i<s.length;i++)a=s.charCodeAt(i),t=Math.imul(t^a,2654435761),n=Math.imul(n^a,1597334677);return t=Math.imul(t^t>>>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 dv=s=>a1(s),o0=s=>a1(s),fv=(...s)=>a1(s),j3=new Map([[1,"float"],[2,"vec2"],[3,"vec3"],[4,"vec4"],[9,"mat3"],[16,"mat4"]]),XC=new WeakMap;function o1(s){return j3.get(s)}function Ey(s){if(/[iu]?vec\d/.test(s))return s.startsWith("ivec")?Int32Array:s.startsWith("uvec")?Uint32Array:Float32Array;if(/mat\d/.test(s)||/float/.test(s))return Float32Array;if(/uint/.test(s))return Uint32Array;if(/int/.test(s))return Int32Array;throw new Error(`THREE.NodeUtils: Unsupported type: ${s}`)}function l1(s){if(/float|int|uint/.test(s))return 1;if(/vec2/.test(s))return 2;if(/vec3/.test(s))return 3;if(/vec4/.test(s)||/mat2/.test(s))return 4;if(/mat3/.test(s))return 9;if(/mat4/.test(s))return 16;Gr("TSL: Unsupported type:",s)}function jC(s){if(/float|int|uint/.test(s))return 1;if(/vec2/.test(s))return 2;if(/vec3/.test(s))return 3;if(/vec4/.test(s)||/mat2/.test(s))return 4;if(/mat3/.test(s))return 12;if(/mat4/.test(s))return 16;Gr("TSL: Unsupported type:",s)}function YC(s){if(/float|int|uint/.test(s))return 4;if(/vec2/.test(s))return 8;if(/vec3/.test(s)||/vec4/.test(s))return 16;if(/mat2/.test(s))return 8;if(/mat3/.test(s)||/mat4/.test(s))return 16;Gr("TSL: Unsupported type:",s)}function Qg(s){if(s==null)return null;const e=typeof s;return s.isNode===!0?"node":e==="number"?"float":e==="boolean"?"bool":e==="string"?"string":e==="function"?"shader":s.isVector2===!0?"vec2":s.isVector3===!0?"vec3":s.isVector4===!0?"vec4":s.isMatrix2===!0?"mat2":s.isMatrix3===!0?"mat3":s.isMatrix4===!0?"mat4":s.isColor===!0?"color":s instanceof ArrayBuffer?"ArrayBuffer":null}function db(s,...e){const t=s?s.slice(-4):void 0;return e.length===1&&(t==="vec2"?e=[e[0],e[0]]:t==="vec3"?e=[e[0],e[0],e[0]]:t==="vec4"&&(e=[e[0],e[0],e[0],e[0]])),s==="color"?new Wr(...e):t==="vec2"?new ce(...e):t==="vec3"?new le(...e):t==="vec4"?new Ni(...e):t==="mat2"?new gp(...e):t==="mat3"?new pn(...e):t==="mat4"?new di(...e):s==="bool"?e[0]||!1:s==="float"||s==="int"||s==="uint"?e[0]||0:s==="string"?e[0]||"":s==="ArrayBuffer"?h1(e[0]):null}function u1(s){let e=XC.get(s);return e===void 0&&(e={},XC.set(s,e)),e}function c1(s){let e="";const t=new Uint8Array(s);for(let n=0;n<t.length;n++)e+=String.fromCharCode(t[n]);return btoa(e)}function h1(s){return Uint8Array.from(atob(s),e=>e.charCodeAt(0)).buffer}var DX=Object.freeze({__proto__:null,arrayBufferToBase64:c1,base64ToArrayBuffer:h1,getAlignmentFromType:YC,getDataFromObject:u1,getLengthFromType:l1,getMemoryLengthFromType:jC,getTypeFromLength:o1,getTypedArrayFromType:Ey,getValueFromType:db,getValueType:Qg,hash:fv,hashArray:o0,hashString:dv});const Cy={VERTEX:"vertex",FRAGMENT:"fragment"},Ao={NONE:"none",FRAME:"frame",RENDER:"render",OBJECT:"object"},Y3={BOOLEAN:"bool",INTEGER:"int",FLOAT:"float",VECTOR2:"vec2",VECTOR3:"vec3",VECTOR4:"vec4",MATRIX2:"mat2",MATRIX3:"mat3",MATRIX4:"mat4"},od={READ_ONLY:"readOnly",WRITE_ONLY:"writeOnly",READ_WRITE:"readWrite"},qC=["fragment","vertex"],d1=["setup","analyze","generate"],f1=[...qC,"compute"],l0=["x","y","z","w"],q3={analyze:"setup",generate:"analyze"};let J3=0;class ta extends bl{static get type(){return"Node"}constructor(e=null){super(),this.nodeType=e,this.updateType=Ao.NONE,this.updateBeforeType=Ao.NONE,this.updateAfterType=Ao.NONE,this.uuid=me.generateUUID(),this.version=0,this.name="",this.global=!1,this.parents=!1,this.isNode=!0,this._beforeNodes=null,this._cacheKey=null,this._cacheKeyVersion=0,Object.defineProperty(this,"id",{value:J3++})}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),this}onFrameUpdate(e){return this.onUpdate(e,Ao.FRAME)}onRenderUpdate(e){return this.onUpdate(e,Ao.RENDER)}onObjectUpdate(e){return this.onUpdate(e,Ao.OBJECT)}onReference(e){return this.updateReference=e.bind(this),this}updateReference(){return this}isGlobal(){return this.global}*getChildren(){for(const{childNode:e}of this._getChildren())yield e}dispose(){this.dispatchEvent({type:"dispose"})}traverse(e){e(this);for(const t of this.getChildren())t.traverse(e)}_getChildren(e=new Set){const t=[];e.add(this);for(const n of Object.getOwnPropertyNames(this)){const i=this[n];if(!(n.startsWith("_")===!0||e.has(i))){if(Array.isArray(i)===!0)for(let a=0;a<i.length;a++){const o=i[a];o&&o.isNode===!0&&t.push({property:n,index:a,childNode:o})}else if(i&&i.isNode===!0)t.push({property:n,childNode:i});else if(i&&Object.getPrototypeOf(i)===Object.prototype)for(const a in i){if(a.startsWith("_")===!0)continue;const o=i[a];o&&o.isNode===!0&&t.push({property:n,index:a,childNode:o})}}}return t}getCacheKey(e=!1,t=null){if(e=e||this.version!==this._cacheKeyVersion,e===!0||this._cacheKey===null){t===null&&(t=new Set);const n=[];for(const{property:i,childNode:a}of this._getChildren(t))n.push(dv(i.slice(0,-4)),a.getCacheKey(e,t));this._cacheKey=fv(o0(n),this.customCacheKey()),this._cacheKeyVersion=this.version}return this._cacheKey}customCacheKey(){return this.id}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)}getMemberType(){return"void"}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}getArrayCount(){return null}setup(e){const t=e.getNodeProperties(this);let n=0;for(const i of this.getChildren())t["node"+n++]=i;return t.outputNode||null}analyze(e,t=null){const n=e.increaseUsage(this);if(this.parents===!0){const i=e.getDataFromNode(this,"any");i.stages=i.stages||{},i.stages[e.shaderStage]=i.stages[e.shaderStage]||[],i.stages[e.shaderStage].push(t)}if(n===1){const i=e.getNodeProperties(this);for(const a of Object.values(i))a&&a.isNode===!0&&a.build(e,this)}}generate(e,t){const{outputNode:n}=e.getNodeProperties(this);if(n&&n.isNode===!0)return n.build(e,t)}updateBefore(){Lr("Abstract function.")}updateAfter(){Lr("Abstract function.")}update(){Lr("Abstract function.")}before(e){return this._beforeNodes===null&&(this._beforeNodes=[]),this._beforeNodes.push(e),this}build(e,t=null){const n=this.getShared(e);if(this!==n)return n.build(e,t);if(this._beforeNodes!==null){const c=this._beforeNodes;this._beforeNodes=null;for(const d of c)d.build(e,t);this._beforeNodes=c}const i=e.getDataFromNode(this);i.buildStages=i.buildStages||{},i.buildStages[e.buildStage]=!0;const a=q3[e.buildStage];if(a&&i.buildStages[a]!==!0){const c=e.getBuildStage();e.setBuildStage(a),this.build(e),e.setBuildStage(c)}e.addNode(this),e.addChain(this);let o=null;const u=e.getBuildStage();if(u==="setup"){this.updateReference(e);const c=e.getNodeProperties(this);if(c.initialized!==!0){c.initialized=!0,c.outputNode=this.setup(e)||c.outputNode||null;for(const d of Object.values(c))if(d&&d.isNode===!0){if(d.parents===!0){const g=e.getNodeProperties(d);g.parents=g.parents||[],g.parents.push(this)}d.build(e)}}o=c.outputNode}else if(u==="analyze")this.analyze(e,t);else if(u==="generate"){if(this.generate.length<2){const d=this.getNodeType(e),g=e.getDataFromNode(this);o=g.snippet,o===void 0?g.generated===void 0?(g.generated=!0,o=this.generate(e)||"",g.snippet=o):(Lr("Node: Recursion detected.",this),o="/* Recursion detected. */"):g.flowCodes!==void 0&&e.context.nodeBlock!==void 0&&e.addFlowCodeHierarchy(this,e.context.nodeBlock),o=e.format(o,d,t)}else o=this.generate(e,t)||"";o===""&&t!==null&&t!=="void"&&t!=="OutputType"&&(Gr(`TSL: Invalid generated code, expected a "${t}".`),o=e.generateConst(t))}return e.removeChain(this),e.addSequentialNode(this),o}getSerializeChildren(){return this._getChildren()}serialize(e){const t=this.getSerializeChildren(),n={};for(const{property:i,index:a,childNode:o}of t)a!==void 0?(n[i]===void 0&&(n[i]=Number.isInteger(a)?[]:{}),n[i][a]=o.toJSON(e.meta).uuid):n[i]=o.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 i=[];for(const a of e.inputNodes[n])i.push(t[a]);this[n]=i}else if(typeof e.inputNodes[n]=="object"){const i={};for(const a in e.inputNodes[n]){const o=e.inputNodes[n][a];i[a]=t[o]}this[n]=i}else{const i=e.inputNodes[n];this[n]=t[i]}}}toJSON(e){const{uuid:t,type:n}=this,i=e===void 0||typeof e=="string";i&&(e={textures:{},images:{},nodes:{}});let a=e.nodes[t];a===void 0&&(a={uuid:t,type:n,meta:e,metadata:{version:4.7,type:"Node",generator:"Node.toJSON"}},i!==!0&&(e.nodes[a.uuid]=a),this.serialize(a),delete a.meta);function o(u){const c=[];for(const d in u){const g=u[d];delete g.metadata,c.push(g)}return c}if(i){const u=o(e.textures),c=o(e.images),d=o(e.nodes);u.length>0&&(a.textures=u),c.length>0&&(a.images=c),d.length>0&&(a.nodes=d)}return a}}class u0 extends ta{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)}getMemberType(e,t){return this.node.getMemberType(e,t)}generate(e){const t=this.indexNode.getNodeType(e),n=this.node.build(e),i=this.indexNode.build(e,!e.isVector(t)&&e.isInteger(t)?t:"uint");return`${n}[ ${i} ]`}}class JC extends ta{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 i of this.convertTo.split("|"))(n===null||e.getTypeLength(t)===e.getTypeLength(i))&&(n=i);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,i=this.getNodeType(e),a=n.build(e,i);return e.format(a,i,t)}}class pc extends ta{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 i=e.getVectorType(this.getNodeType(e,t)),a=e.getDataFromNode(this);if(a.propertyName!==void 0)return e.format(a.propertyName,i,t);if(i!=="void"&&t!=="void"&&this.hasDependencies(e)){const o=super.build(e,i),u=e.getVarFromNode(this,null,i),c=e.getPropertyName(u);return e.addLineFlowCode(`${c} = ${o}`,this),a.snippet=o,a.propertyName=c,e.format(a.propertyName,i,t)}}return super.build(e,t)}}class ek extends pc{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),i=e.getTypeLength(n),a=this.nodes,o=e.getComponentType(n),u=[];let c=0;for(const g of a){if(c>=i){Gr(`TSL: Length of parameters exceeds maximum length of function '${n}()' type.`);break}let v=g.getNodeType(e),M=e.getTypeLength(v),B;if(c+M>i&&(Gr(`TSL: Length of '${n}()' data exceeds maximum length of output type.`),M=i-c,v=e.getTypeFromLength(M)),c+=M,B=g.build(e,v),e.getComponentType(v)!==o){const ne=e.getTypeFromLength(M,o);B=e.format(B,v,ne)}u.push(B)}const d=`${e.getType(n)}( ${u.join(", ")} )`;return e.format(d,n,t)}}const tk=l0.join("");class eT extends ta{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(l0.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))}getScope(){return this.node.getScope()}generate(e,t){const n=this.node,i=e.getTypeLength(n.getNodeType(e));let a=null;if(i>1){let o=null;this.getVectorLength()>=i&&(o=e.getTypeFromLength(this.getVectorLength(),this.getComponentType(e)));const c=n.build(e,o);this.components.length===i&&this.components===tk.slice(0,this.components.length)?a=e.format(c,o,t):a=e.format(`${c}.${this.components}`,this.getNodeType(e),t)}else a=n.build(e,t);return a}serialize(e){super.serialize(e),e.components=this.components}deserialize(e){super.deserialize(e),this.components=e.components}}class nk extends pc{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:i}=this,a=this.getNodeType(e),o=e.getComponentType(i.getNodeType(e)),u=e.getTypeFromLength(n.length,o),c=i.build(e,u),d=t.build(e,a),g=e.getTypeLength(a),v=[];for(let M=0;M<g;M++){const B=l0[M];B===n[0]?(v.push(c),M+=n.length-1):v.push(d+"."+B)}return`${e.getType(a)}( ${v.join(", ")} )`}}class rk extends pc{static get type(){return"FlipNode"}constructor(e,t){super(),this.sourceNode=e,this.components=t}getNodeType(e){return this.sourceNode.getNodeType(e)}generate(e){const{components:t,sourceNode:n}=this,i=this.getNodeType(e),a=n.build(e),o=e.getVarFromNode(this),u=e.getPropertyName(o);e.addLineFlowCode(u+" = "+a,this);const c=e.getTypeLength(i),d=[];let g=0;for(let v=0;v<c;v++){const M=l0[v];M===t[g]?(d.push("1.0 - "+(u+"."+M)),g++):d.push(u+"."+M)}return`${e.getType(i)}( ${d.join(", ")} )`}}class A1 extends ta{static get type(){return"InputNode"}constructor(e,t=null){super(t),this.isInputNode=!0,this.value=e,this.precision=null}getNodeType(){return this.nodeType===null?Qg(this.value):this.nodeType}getInputType(e){return this.getNodeType(e)}setPrecision(e){return this.precision=e,this}serialize(e){super.serialize(e),e.value=this.value,this.value&&this.value.toArray&&(e.value=this.value.toArray()),e.valueType=Qg(this.value),e.nodeType=this.nodeType,e.valueType==="ArrayBuffer"&&(e.value=c1(e.value)),e.precision=this.precision}deserialize(e){super.deserialize(e),this.nodeType=e.nodeType,this.value=Array.isArray(e.value)?db(e.valueType,...e.value):e.value,this.precision=e.precision||null,this.value&&this.value.fromArray&&(this.value=this.value.fromArray(e.value))}generate(){Lr("Abstract function.")}}const tT=/float|u?int/;class QA extends A1{static get type(){return"ConstNode"}constructor(e,t=null){super(e,t),this.isConstNode=!0}generateConst(e){return e.generateConst(this.getNodeType(e),this.value)}generate(e,t){const n=this.getNodeType(e);return tT.test(n)&&tT.test(t)?e.generateConst(t,this.value):e.format(this.generateConst(e),n,t)}}class ik extends ta{static get type(){return"MemberNode"}constructor(e,t){super(),this.structNode=e,this.property=t,this.isMemberNode=!0}hasMember(e){return this.structNode.isMemberNode&&this.structNode.hasMember(e)===!1?!1:this.structNode.getMemberType(e,this.property)!=="void"}getNodeType(e){return this.hasMember(e)===!1?"float":this.structNode.getMemberType(e,this.property)}getMemberType(e,t){if(this.hasMember(e)===!1)return"float";const n=this.getNodeType(e);return e.getStructTypeNode(n).getMemberType(e,t)}generate(e){if(this.hasMember(e)===!1){Lr(`TSL: Member "${this.property}" does not exist in struct.`);const n=this.getNodeType(e);return e.generateConst(n)}return this.structNode.build(e)+"."+this.property}}let Rm=null;const p1=new Map;function ci(s,e){if(p1.has(s)){Lr(`TSL: Redefinition of method chaining '${s}'.`);return}if(typeof e!="function")throw new Error(`THREE.TSL: Node element ${s} is not a function`);p1.set(s,e),s!=="assign"&&(ta.prototype[s]=function(...t){return this.isStackNode?this.addToStack(e(...t)):e(this,...t)},ta.prototype[s+"Assign"]=function(...t){return this.isStackNode?this.assign(t[0],e(...t)):this.assign(e(this,...t))})}const sk=s=>s.replace(/r|s/g,"x").replace(/g|t/g,"y").replace(/b|p/g,"z").replace(/a|q/g,"w"),nT=s=>sk(s).split("").sort().join("");ta.prototype.assign=function(...s){if(this.isStackNode!==!0)return Rm!==null?Rm.assign(this,...s):Gr("TSL: No stack defined for assign operation. Make sure the assign is inside a Fn()."),this;{const e=p1.get("assign");return this.addToStack(e(...s))}},ta.prototype.toVarIntent=function(){return this},ta.prototype.get=function(s){return new ik(this,s)};const Ty={};function fb(s,e,t){Ty[s]=Ty[e]=Ty[t]={get(){this._cache=this._cache||{};let o=this._cache[s];return o===void 0&&(o=new eT(this,s),this._cache[s]=o),o},set(o){this[s].assign(Ss(o))}};const n=s.toUpperCase(),i=e.toUpperCase(),a=t.toUpperCase();ta.prototype["set"+n]=ta.prototype["set"+i]=ta.prototype["set"+a]=function(o){const u=nT(s);return new nk(this,u,Ss(o))},ta.prototype["flip"+n]=ta.prototype["flip"+i]=ta.prototype["flip"+a]=function(){const o=nT(s);return new rk(this,o)}}const tg=["x","y","z","w"],ng=["r","g","b","a"],rg=["s","t","p","q"];for(let s=0;s<4;s++){let e=tg[s],t=ng[s],n=rg[s];fb(e,t,n);for(let i=0;i<4;i++){e=tg[s]+tg[i],t=ng[s]+ng[i],n=rg[s]+rg[i],fb(e,t,n);for(let a=0;a<4;a++){e=tg[s]+tg[i]+tg[a],t=ng[s]+ng[i]+ng[a],n=rg[s]+rg[i]+rg[a],fb(e,t,n);for(let o=0;o<4;o++)e=tg[s]+tg[i]+tg[a]+tg[o],t=ng[s]+ng[i]+ng[a]+ng[o],n=rg[s]+rg[i]+rg[a]+rg[o],fb(e,t,n)}}}for(let s=0;s<32;s++)Ty[s]={get(){this._cache=this._cache||{};let e=this._cache[s];return e===void 0&&(e=new u0(this,new QA(s,"uint")),this._cache[s]=e),e},set(e){this[s].assign(Ss(e))}};Object.defineProperties(ta.prototype,Ty);const rT=new WeakMap,ak=function(s,e=null){const t=Qg(s);return t==="node"?s:e===null&&(t==="float"||t==="boolean")||t&&t!=="shader"&&t!=="string"?Ss(y1(s,e)):t==="shader"?s.isFn?s:or(s):s},ok=function(s,e=null){for(const t in s)s[t]=Ss(s[t],e);return s},lk=function(s,e=null){const t=s.length;for(let n=0;n<t;n++)s[n]=Ss(s[n],e);return s},iT=function(s,e=null,t=null,n=null){function i(g){return n!==null?(g=Ss(Object.assign(g,n)),n.intent===!0&&(g=g.toVarIntent())):g=Ss(g),g}let a,o=e,u,c;function d(g){let v;return o?v=/[a-z]/i.test(o)?o+"()":o:v=s.type,u!==void 0&&g.length<u?(Gr(`TSL: "${v}" parameter length is less than minimum required.`),g.concat(new Array(u-g.length).fill(0))):c!==void 0&&g.length>c?(Gr(`TSL: "${v}" parameter length exceeds limit.`),g.slice(0,c)):g}return e===null?a=(...g)=>i(new s(...c0(d(g)))):t!==null?(t=Ss(t),a=(...g)=>i(new s(e,...c0(d(g)),t))):a=(...g)=>i(new s(e,...c0(d(g)))),a.setParameterLength=(...g)=>(g.length===1?u=c=g[0]:g.length===2&&([u,c]=g),a),a.setName=g=>(o=g,a),a},uk=function(s,...e){return new s(...c0(e))};class ck extends ta{constructor(e,t){super(),this.shaderNode=e,this.rawInputs=t,this.isShaderCallNodeInternal=!0}getNodeType(e){return this.shaderNode.nodeType||this.getOutputNode(e).getNodeType(e)}getElementType(e){return this.getOutputNode(e).getElementType(e)}getMemberType(e,t){return this.getOutputNode(e).getMemberType(e,t)}call(e){const{shaderNode:t,rawInputs:n}=this,i=e.getNodeProperties(t),a=e.getClosestSubBuild(t.subBuilds)||"",o=a||"default";if(i[o])return i[o];const u=e.subBuildFn,c=e.fnCall;e.subBuildFn=a,e.fnCall=this;let d=null;if(t.layout){let g=rT.get(e.constructor);g===void 0&&(g=new WeakMap,rT.set(e.constructor,g));let v=g.get(t);v===void 0&&(v=Ss(e.buildFunctionNode(t)),g.set(t,v)),e.addInclude(v);const M=n?hk(n):null;d=Ss(v.call(M))}else{const g=new Proxy(e,{get:(ne,ee,q)=>{let ye;return Symbol.iterator===ee?ye=function*(){yield void 0}:ye=Reflect.get(ne,ee,q),ye}}),v=n?dk(n):null,M=Array.isArray(n)?n.length>0:n!==null,B=t.jsFunc,I=M||B.length>1?B(v,g):B(g);d=Ss(I)}return e.subBuildFn=u,e.fnCall=c,t.once&&(i[o]=d),d}setupOutput(e){return e.addStack(),e.stack.outputNode=this.call(e),e.removeStack()}getOutputNode(e){const t=e.getNodeProperties(this),n=e.getSubBuildOutput(this);return t[n]=t[n]||this.setupOutput(e),t[n].subBuild=e.getClosestSubBuild(this),t[n]}build(e,t=null){let n=null;const i=e.getBuildStage(),a=e.getNodeProperties(this),o=e.getSubBuildOutput(this),u=this.getOutputNode(e),c=e.fnCall;if(e.fnCall=this,i==="setup"){const d=e.getSubBuildProperty("initialized",this);if(a[d]!==!0&&(a[d]=!0,a[o]=this.getOutputNode(e),a[o].build(e),this.shaderNode.subBuilds))for(const g of e.chaining){const v=e.getDataFromNode(g,"any");v.subBuilds=v.subBuilds||new Set;for(const M of this.shaderNode.subBuilds)v.subBuilds.add(M)}n=a[o]}else i==="analyze"?u.build(e,t):i==="generate"&&(n=u.build(e,t)||"");return e.fnCall=c,n}}function hk(s){let e;return gb(s),s[0]&&(s[0].isNode||Object.getPrototypeOf(s[0])!==Object.prototype)?e=[...s]:e=s[0],e}function dk(s){let e=0;return gb(s),new Proxy(s,{get:(t,n,i)=>{let a;if(n==="length")return a=s.length,a;if(Symbol.iterator===n)a=function*(){for(const o of s)yield Ss(o)};else{if(s.length>0)if(Object.getPrototypeOf(s[0])===Object.prototype){const o=s[0];o[n]===void 0?a=o[e++]:a=Reflect.get(o,n,i)}else s[0]instanceof ta&&(s[n]===void 0?a=s[e++]:a=Reflect.get(s,n,i));else a=Reflect.get(t,n,i);a=Ss(a)}return a}})}class fk extends ta{constructor(e,t){super(t),this.jsFunc=e,this.layout=null,this.global=!0,this.once=!1}setLayout(e){return this.layout=e,this}getLayout(){return this.layout}call(e=null){return new ck(this,e)}setup(){return this.call()}}const Ak=[!1,!0],pk=[0,1,2,3],gk=[-1,-2],sT=[.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],g1=new Map;for(const s of Ak)g1.set(s,new QA(s));const m1=new Map;for(const s of pk)m1.set(s,new QA(s,"uint"));const v1=new Map([...m1].map(s=>new QA(s.value,"int")));for(const s of gk)v1.set(s,new QA(s,"int"));const Ab=new Map([...v1].map(s=>new QA(s.value)));for(const s of sT)Ab.set(s,new QA(s));for(const s of sT)Ab.set(-s,new QA(-s));const pb={bool:g1,uint:m1,ints:v1,float:Ab},aT=new Map([...g1,...Ab]),y1=(s,e)=>aT.has(s)?aT.get(s):s.isNode===!0?s:new QA(s,e),uh=function(s,e=null){return(...t)=>{for(const i of t)if(i===void 0)return Gr(`TSL: Invalid parameter for the type "${s}".`),new QA(0,s);if((t.length===0||!["bool","float","int","uint"].includes(s)&&t.every(i=>{const a=typeof i;return a!=="object"&&a!=="function"}))&&(t=[db(s,...t)]),t.length===1&&e!==null&&e.has(t[0]))return Ry(e.get(t[0]));if(t.length===1){const i=y1(t[0],s);return i.nodeType===s?Ry(i):Ry(new JC(i,s))}const n=t.map(i=>y1(i));return Ry(new ek(n,s))}},By=s=>typeof s=="object"&&s!==null?s.value:s,oT=s=>s!=null?s.nodeType||s.convertTo||(typeof s=="string"?s:null):null;function Av(s,e){return new fk(s,e)}const Ss=(s,e=null)=>ak(s,e),Ry=(s,e=null)=>Ss(s,e).toVarIntent(),gb=(s,e=null)=>new ok(s,e),c0=(s,e=null)=>new lk(s,e),to=(s,e=null,t=null,n=null)=>new iT(s,e,t,n),xs=(s,...e)=>new uk(s,...e),ji=(s,e=null,t=null,n={})=>new iT(s,e,t,fd(rl({},n),{intent:!0}));let mk=0;class vk extends ta{constructor(e,t=null){super();let n=null;t!==null&&(typeof t=="object"?n=t.return:(typeof t=="string"?n=t:Gr("TSL: Invalid layout type."),t=null)),this.shaderNode=new Av(e,n),t!==null&&this.setLayout(t),this.isFn=!0}setLayout(e){const t=this.shaderNode.nodeType;if(typeof e.inputs!="object"){const n={name:"fn"+mk++,type:t,inputs:[]};for(const i in e)i!=="return"&&n.inputs.push({name:i,type:e[i]});e=n}return this.shaderNode.setLayout(e),this}getNodeType(e){return this.shaderNode.getNodeType(e)||"float"}call(...e){const t=this.shaderNode.call(e);return this.shaderNode.nodeType==="void"&&t.toStack(),t.toVarIntent()}once(e=null){return this.shaderNode.once=!0,this.shaderNode.subBuilds=e,this}generate(e){const t=this.getNodeType(e);return Gr('TSL: "Fn()" was declared but not invoked. Try calling it like "Fn()( ...params )".'),e.generateConst(t)}}function or(s,e=null){const t=new vk(s,e);return new Proxy(()=>{},{apply(n,i,a){return t.call(...a)},get(n,i,a){return Reflect.get(t,i,a)},set(n,i,a,o){return Reflect.set(t,i,a,o)}})}const Iy=s=>{Rm=s},x1=()=>Rm,ra=(...s)=>Rm.If(...s),yk=(...s)=>Rm.Switch(...s);function mb(s){return Rm&&Rm.addToStack(s),s}ci("toStack",mb);const lT=new uh("color"),qt=new uh("float",pb.float),Qn=new uh("int",pb.ints),Fi=new uh("uint",pb.uint),WA=new uh("bool",pb.bool),Gi=new uh("vec2"),ch=new uh("ivec2"),b1=new uh("uvec2"),uT=new uh("bvec2"),Kn=new uh("vec3"),_1=new uh("ivec3"),h0=new uh("uvec3"),w1=new uh("bvec3"),Ks=new uh("vec4"),S1=new uh("ivec4"),M1=new uh("uvec4"),cT=new uh("bvec4"),vb=new uh("mat2"),ld=new uh("mat3"),Im=new uh("mat4"),xk=(s="")=>new QA(s,"string"),bk=s=>new QA(s,"ArrayBuffer");ci("toColor",lT),ci("toFloat",qt),ci("toInt",Qn),ci("toUint",Fi),ci("toBool",WA),ci("toVec2",Gi),ci("toIVec2",ch),ci("toUVec2",b1),ci("toBVec2",uT),ci("toVec3",Kn),ci("toIVec3",_1),ci("toUVec3",h0),ci("toBVec3",w1),ci("toVec4",Ks),ci("toIVec4",S1),ci("toUVec4",M1),ci("toBVec4",cT),ci("toMat2",vb),ci("toMat3",ld),ci("toMat4",Im);const hT=to(u0).setParameterLength(2),dT=(s,e)=>Ss(new JC(Ss(s),e)),_k=(s,e)=>Ss(new eT(Ss(s),e));ci("element",hT),ci("convert",dT);const wk=s=>(Lr("TSL: append() has been renamed to Stack()."),mb(s));ci("append",s=>(Lr("TSL: .append() has been renamed to .toStack()."),mb(s)));class Fl extends ta{static get type(){return"PropertyNode"}constructor(e,t=null,n=!1){super(e),this.name=t,this.varying=n,this.isPropertyNode=!0,this.global=!0}customCacheKey(){return dv(this.type+":"+(this.name||"")+":"+(this.varying?"1":"0"))}getHash(e){return this.name||super.getHash(e)}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 bp=(s,e)=>new Fl(s,e),cA=(s,e)=>new Fl(s,e,!0),Wl=xs(Fl,"vec4","DiffuseColor"),d0=xs(Fl,"vec3","DiffuseContribution"),E1=xs(Fl,"vec3","EmissiveColor"),ig=xs(Fl,"float","Roughness"),Wg=xs(Fl,"float","Metalness"),yb=xs(Fl,"float","Clearcoat"),Ny=xs(Fl,"float","ClearcoatRoughness"),hA=xs(Fl,"vec3","Sheen"),Nm=xs(Fl,"float","SheenRoughness"),xb=xs(Fl,"float","Iridescence"),bb=xs(Fl,"float","IridescenceIOR"),_b=xs(Fl,"float","IridescenceThickness"),wb=xs(Fl,"float","AlphaT"),Fm=xs(Fl,"float","Anisotropy"),Fy=xs(Fl,"vec3","AnisotropyT"),f0=xs(Fl,"vec3","AnisotropyB"),Pm=xs(Fl,"color","SpecularColor"),A0=xs(Fl,"color","SpecularColorBlended"),pv=xs(Fl,"float","SpecularF90"),Sb=xs(Fl,"float","Shininess"),gv=xs(Fl,"vec4","Output"),p0=xs(Fl,"float","dashSize"),Py=xs(Fl,"float","gapSize"),Sk=xs(Fl,"float","pointWidth"),Ly=xs(Fl,"float","IOR"),Mb=xs(Fl,"float","Transmission"),C1=xs(Fl,"float","Thickness"),T1=xs(Fl,"float","AttenuationDistance"),B1=xs(Fl,"color","AttenuationColor"),R1=xs(Fl,"float","Dispersion");class fT extends ta{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 AT=s=>new fT(s),Eb=(s,e=0)=>new fT(s,!0,e),pT=Eb("frame"),xa=Eb("render"),I1=AT("object");class Uy extends A1{static get type(){return"UniformNode"}constructor(e,t=null){super(e,t),this.isUniformNode=!0,this.name="",this.groupNode=I1}setName(e){return this.name=e,this}label(e){return Lr('TSL: "label()" has been deprecated. Use "setName()" instead.'),this.setName(e)}setGroup(e){return this.groupNode=e,this}getGroup(){return this.groupNode}getUniformHash(e){return this.getHash(e)}onUpdate(e,t){return e=e.bind(this),super.onUpdate(n=>{const i=e(n,this);i!==void 0&&(this.value=i)},t)}getInputType(e){let t=super.getInputType(e);return t==="bool"&&(t="uint"),t}generate(e,t){const n=this.getNodeType(e),i=this.getUniformHash(e);let a=e.getNodeFromHash(i);a===void 0&&(e.setHashNode(this,i),a=this);const o=a.getInputType(e),u=e.getUniformFromNode(a,o,e.shaderStage,this.name||e.context.nodeName),c=e.getPropertyName(u);e.context.nodeName!==void 0&&delete e.context.nodeName;let d=c;if(n==="bool"){const g=e.getDataFromNode(this);let v=g.propertyName;if(v===void 0){const M=e.getVarFromNode(this,null,"bool");v=e.getPropertyName(M),g.propertyName=v,d=e.format(c,o,n),e.addLineFlowCode(`${v} = ${d}`,this)}d=v}return e.format(d,n,t)}}const va=(s,e)=>{const t=oT(e||s);if(t===s&&(s=db(t)),s&&s.isNode===!0){let n=s.value;s.traverse(i=>{i.isConstNode===!0&&(n=i.value)}),s=n}return new Uy(s,t)};class gT extends pc{static get type(){return"ArrayNode"}constructor(e,t,n=null){super(e),this.count=t,this.values=n,this.isArrayNode=!0}getArrayCount(){return this.count}getNodeType(e){return this.nodeType===null?this.values[0].getNodeType(e):this.nodeType}getElementType(e){return this.getNodeType(e)}getMemberType(e,t){return this.nodeType===null?this.values[0].getMemberType(e,t):super.getMemberType(e,t)}generate(e){const t=this.getNodeType(e);return e.generateArray(t,this.count,this.values)}}const mT=(...s)=>{let e;if(s.length===1){const t=s[0];e=new gT(null,t.length,t)}else{const t=s[0],n=s[1];e=new gT(t,n)}return Ss(e)};ci("toArray",(s,e)=>mT(Array(e).fill(s)));class Mk extends pc{static get type(){return"AssignNode"}constructor(e,t){super(),this.targetNode=e,this.sourceNode=t,this.isAssignNode=!0}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 l0.join("").slice(0,n)!==t.components}return!1}setup(e){const{targetNode:t,sourceNode:n}=this,i=t.getScope(),a=e.getDataFromNode(i);a.assign=!0;const o=e.getNodeProperties(this);o.sourceNode=n,o.targetNode=t.context({assign:!0})}generate(e,t){const{targetNode:n,sourceNode:i}=e.getNodeProperties(this),a=this.needsSplitAssign(e),o=n.build(e),u=n.getNodeType(e),c=i.build(e,u),d=i.getNodeType(e),g=e.getDataFromNode(this);let v;if(g.initialized===!0)t!=="void"&&(v=o);else if(a){const M=e.getVarFromNode(this,null,u),B=e.getPropertyName(M);e.addLineFlowCode(`${B} = ${c}`,this);const I=n.node,ee=I.node.context({assign:!0}).build(e);for(let q=0;q<I.components.length;q++){const ye=I.components[q];e.addLineFlowCode(`${ee}.${ye} = ${B}[ ${q} ]`,this)}t!=="void"&&(v=o)}else v=`${o} = ${c}`,(t==="void"||d==="void")&&(e.addLineFlowCode(v,this),t!=="void"&&(v=o));return g.initialized=!0,e.format(v,u,t)}}const vT=to(Mk).setParameterLength(2);ci("assign",vT);class Ek extends pc{static get type(){return"FunctionCallNode"}constructor(e=null,t={}){super(),this.functionNode=e,this.parameters=t}setParameters(e){return this.parameters=e,this}getParameters(){return this.parameters}getNodeType(e){return this.functionNode.getNodeType(e)}getMemberType(e,t){return this.functionNode.getMemberType(e,t)}generate(e){const t=[],n=this.functionNode,i=n.getInputs(e),a=this.parameters,o=(c,d)=>{const g=d.type,v=g==="pointer";let M;return v?M="&"+c.build(e):M=c.build(e,g),M};if(Array.isArray(a)){if(a.length>i.length)Gr("TSL: The number of provided parameters exceeds the expected number of inputs in 'Fn()'."),a.length=i.length;else if(a.length<i.length)for(Gr("TSL: The number of provided parameters is less than the expected number of inputs in 'Fn()'.");a.length<i.length;)a.push(qt(0));for(let c=0;c<a.length;c++)t.push(o(a[c],i[c]))}else for(const c of i){const d=a[c.name];d!==void 0?t.push(o(d,c)):(Gr(`TSL: Input '${c.name}' not found in 'Fn()'.`),t.push(o(qt(0),c)))}return`${n.build(e,"property")}( ${t.join(", ")} )`}}const yT=(s,...e)=>(e=e.length>1||e[0]&&e[0].isNode===!0?c0(e):gb(e[0]),new Ek(Ss(s),e));ci("call",yT);const Ck={"==":"equal","!=":"notEqual","<":"lessThan",">":"greaterThan","<=":"lessThanEqual",">=":"greaterThanEqual","%":"mod"};class gc extends pc{static get type(){return"OperatorNode"}constructor(e,t,n,...i){if(super(),i.length>0){let a=new gc(e,t,n);for(let o=0;o<i.length-1;o++)a=new gc(e,a,i[o]);t=a,n=i[i.length-1]}this.op=e,this.aNode=t,this.bNode=n,this.isOperatorNode=!0}getOperatorMethod(e,t){return e.getMethod(Ck[this.op],t)}getNodeType(e,t=null){const n=this.op,i=this.aNode,a=this.bNode,o=i.getNodeType(e),u=a?a.getNodeType(e):null;if(o==="void"||u==="void")return t||"void";if(n==="%")return o;if(n==="~"||n==="&"||n==="|"||n==="^"||n===">>"||n==="<<")return e.getIntegerType(o);if(n==="!"||n==="&&"||n==="||"||n==="^^")return"bool";if(n==="=="||n==="!="||n==="<"||n===">"||n==="<="||n===">="){const c=Math.max(e.getTypeLength(o),e.getTypeLength(u));return c>1?`bvec${c}`:"bool"}else{if(e.isMatrix(o)){if(u==="float")return o;if(e.isVector(u))return e.getVectorFromMatrix(o);if(e.isMatrix(u))return o}else if(e.isMatrix(u)){if(o==="float")return u;if(e.isVector(o))return e.getVectorFromMatrix(u)}return e.getTypeLength(u)>e.getTypeLength(o)?u:o}}generate(e,t){const n=this.op,{aNode:i,bNode:a}=this,o=this.getNodeType(e,t);let u=null,c=null;o!=="void"?(u=i.getNodeType(e),c=a?a.getNodeType(e):null,n==="<"||n===">"||n==="<="||n===">="||n==="=="||n==="!="?e.isVector(u)?c=u:e.isVector(c)?u=c:u!==c&&(u=c="float"):n===">>"||n==="<<"?(u=o,c=e.changeComponentType(c,"uint")):n==="%"?(u=o,c=e.isInteger(u)&&e.isInteger(c)?c:u):e.isMatrix(u)?c==="float"?c="float":e.isVector(c)?c=e.getVectorFromMatrix(u):e.isMatrix(c)||(u=c=o):e.isMatrix(c)?u==="float"?u="float":e.isVector(u)?u=e.getVectorFromMatrix(c):u=c=o:u=c=o):u=c=o;const d=i.build(e,u),g=a?a.build(e,c):null,v=e.getFunctionOperator(n);if(t!=="void"){const M=e.renderer.coordinateSystem===gl;if(n==="=="||n==="!="||n==="<"||n===">"||n==="<="||n===">=")return M?e.isVector(u)?e.format(`${this.getOperatorMethod(e,t)}( ${d}, ${g} )`,o,t):e.format(`( ${d} ${n} ${g} )`,o,t):e.format(`( ${d} ${n} ${g} )`,o,t);if(n==="%")return e.isInteger(c)?e.format(`( ${d} % ${g} )`,o,t):e.format(`${this.getOperatorMethod(e,o)}( ${d}, ${g} )`,o,t);if(n==="!"||n==="~")return e.format(`(${n}${d})`,u,t);if(v)return e.format(`${v}( ${d}, ${g} )`,o,t);if(e.isMatrix(u)&&c==="float")return e.format(`( ${g} ${n} ${d} )`,o,t);if(u==="float"&&e.isMatrix(c))return e.format(`${d} ${n} ${g}`,o,t);{let B=`( ${d} ${n} ${g} )`;return!M&&o==="bool"&&e.isVector(u)&&e.isVector(c)&&(B=`all${B}`),e.format(B,o,t)}}else if(u!=="void")return v?e.format(`${v}( ${d}, ${g} )`,o,t):e.isMatrix(u)&&c==="float"?e.format(`${g} ${n} ${d}`,o,t):e.format(`${d} ${n} ${g}`,o,t)}serialize(e){super.serialize(e),e.op=this.op}deserialize(e){super.deserialize(e),this.op=e.op}}const $c=ji(gc,"+").setParameterLength(2,1/0).setName("add"),el=ji(gc,"-").setParameterLength(2,1/0).setName("sub"),no=ji(gc,"*").setParameterLength(2,1/0).setName("mul"),dA=ji(gc,"/").setParameterLength(2,1/0).setName("div"),Oy=ji(gc,"%").setParameterLength(2).setName("mod"),N1=ji(gc,"==").setParameterLength(2).setName("equal"),xT=ji(gc,"!=").setParameterLength(2).setName("notEqual"),bT=ji(gc,"<").setParameterLength(2).setName("lessThan"),F1=ji(gc,">").setParameterLength(2).setName("greaterThan"),_T=ji(gc,"<=").setParameterLength(2).setName("lessThanEqual"),wT=ji(gc,">=").setParameterLength(2).setName("greaterThanEqual"),ST=ji(gc,"&&").setParameterLength(2,1/0).setName("and"),MT=ji(gc,"||").setParameterLength(2,1/0).setName("or"),ET=ji(gc,"!").setParameterLength(1).setName("not"),CT=ji(gc,"^^").setParameterLength(2).setName("xor"),TT=ji(gc,"&").setParameterLength(2).setName("bitAnd"),BT=ji(gc,"~").setParameterLength(1).setName("bitNot"),RT=ji(gc,"|").setParameterLength(2).setName("bitOr"),IT=ji(gc,"^").setParameterLength(2).setName("bitXor"),NT=ji(gc,"<<").setParameterLength(2).setName("shiftLeft"),FT=ji(gc,">>").setParameterLength(2).setName("shiftRight"),PT=or(([s])=>(s.addAssign(1),s)),LT=or(([s])=>(s.subAssign(1),s)),UT=or(([s])=>{const e=Qn(s).toConst();return s.addAssign(1),e}),OT=or(([s])=>{const e=Qn(s).toConst();return s.subAssign(1),e});ci("add",$c),ci("sub",el),ci("mul",no),ci("div",dA),ci("mod",Oy),ci("equal",N1),ci("notEqual",xT),ci("lessThan",bT),ci("greaterThan",F1),ci("lessThanEqual",_T),ci("greaterThanEqual",wT),ci("and",ST),ci("or",MT),ci("not",ET),ci("xor",CT),ci("bitAnd",TT),ci("bitNot",BT),ci("bitOr",RT),ci("bitXor",IT),ci("shiftLeft",NT),ci("shiftRight",FT),ci("incrementBefore",PT),ci("decrementBefore",LT),ci("increment",UT),ci("decrement",OT);const DT=(s,e)=>(Lr('TSL: "modInt()" is deprecated. Use "mod( int( ... ) )" instead.'),Oy(Qn(s),Qn(e)));ci("modInt",DT);class Or extends pc{static get type(){return"MathNode"}constructor(e,t,n=null,i=null){if(super(),(e===Or.MAX||e===Or.MIN)&&arguments.length>3){let a=new Or(e,t,n);for(let o=2;o<arguments.length-1;o++)a=new Or(e,a,arguments[o]);t=a,n=arguments[arguments.length-1],i=null}this.method=e,this.aNode=t,this.bNode=n,this.cNode=i,this.isMathNode=!0}getInputType(e){const t=this.aNode.getNodeType(e),n=this.bNode?this.bNode.getNodeType(e):null,i=this.cNode?this.cNode.getNodeType(e):null,a=e.isMatrix(t)?0:e.getTypeLength(t),o=e.isMatrix(n)?0:e.getTypeLength(n),u=e.isMatrix(i)?0:e.getTypeLength(i);return a>o&&a>u?t:o>u?n:u>a?i:t}getNodeType(e){const t=this.method;return t===Or.LENGTH||t===Or.DISTANCE||t===Or.DOT?"float":t===Or.CROSS?"vec3":t===Or.ALL||t===Or.ANY?"bool":t===Or.EQUALS?e.changeComponentType(this.aNode.getNodeType(e),"bool"):this.getInputType(e)}setup(e){const{aNode:t,bNode:n,method:i}=this;let a=null;if(i===Or.ONE_MINUS)a=el(1,t);else if(i===Or.RECIPROCAL)a=dA(1,t);else if(i===Or.DIFFERENCE)a=Su(el(t,n));else if(i===Or.TRANSFORM_DIRECTION){let o=t,u=n;e.isMatrix(o.getNodeType(e))?u=Ks(Kn(u),0):o=Ks(Kn(o),0);const c=no(o,u).xyz;a=rf(c)}return a!==null?a:super.setup(e)}generate(e,t){if(e.getNodeProperties(this).outputNode)return super.generate(e,t);let i=this.method;const a=this.getNodeType(e),o=this.getInputType(e),u=this.aNode,c=this.bNode,d=this.cNode,g=e.renderer.coordinateSystem;if(i===Or.NEGATE)return e.format("( - "+u.build(e,o)+" )",a,t);{const v=[];return i===Or.CROSS?v.push(u.build(e,a),c.build(e,a)):g===gl&&i===Or.STEP?v.push(u.build(e,e.getTypeLength(u.getNodeType(e))===1?"float":o),c.build(e,o)):g===gl&&(i===Or.MIN||i===Or.MAX)?v.push(u.build(e,o),c.build(e,e.getTypeLength(c.getNodeType(e))===1?"float":o)):i===Or.REFRACT?v.push(u.build(e,o),c.build(e,o),d.build(e,"float")):i===Or.MIX?v.push(u.build(e,o),c.build(e,o),d.build(e,e.getTypeLength(d.getNodeType(e))===1?"float":o)):(g===To&&i===Or.ATAN&&c!==null&&(i="atan2"),e.shaderStage!=="fragment"&&(i===Or.DFDX||i===Or.DFDY)&&(Lr(`TSL: '${i}' is not supported in the ${e.shaderStage} stage.`),i="/*"+i+"*/"),v.push(u.build(e,o)),c!==null&&v.push(c.build(e,o)),d!==null&&v.push(d.build(e,o))),e.format(`${e.getMethod(i,a)}( ${v.join(", ")} )`,a,t)}}serialize(e){super.serialize(e),e.method=this.method}deserialize(e){super.deserialize(e),this.method=e.method}}Or.ALL="all",Or.ANY="any",Or.RADIANS="radians",Or.DEGREES="degrees",Or.EXP="exp",Or.EXP2="exp2",Or.LOG="log",Or.LOG2="log2",Or.SQRT="sqrt",Or.INVERSE_SQRT="inversesqrt",Or.FLOOR="floor",Or.CEIL="ceil",Or.NORMALIZE="normalize",Or.FRACT="fract",Or.SIN="sin",Or.COS="cos",Or.TAN="tan",Or.ASIN="asin",Or.ACOS="acos",Or.ATAN="atan",Or.ABS="abs",Or.SIGN="sign",Or.LENGTH="length",Or.NEGATE="negate",Or.ONE_MINUS="oneMinus",Or.DFDX="dFdx",Or.DFDY="dFdy",Or.ROUND="round",Or.RECIPROCAL="reciprocal",Or.TRUNC="trunc",Or.FWIDTH="fwidth",Or.TRANSPOSE="transpose",Or.DETERMINANT="determinant",Or.INVERSE="inverse",Or.EQUALS="equals",Or.MIN="min",Or.MAX="max",Or.STEP="step",Or.REFLECT="reflect",Or.DISTANCE="distance",Or.DIFFERENCE="difference",Or.DOT="dot",Or.CROSS="cross",Or.POW="pow",Or.TRANSFORM_DIRECTION="transformDirection",Or.MIX="mix",Or.CLAMP="clamp",Or.REFRACT="refract",Or.SMOOTHSTEP="smoothstep",Or.FACEFORWARD="faceforward";const P1=qt(1e-6),Tk=qt(1e6),Cb=qt(Math.PI),Bk=qt(Math.PI*2),Rk=qt(Math.PI*2),Ik=qt(Math.PI*.5),kT=ji(Or,Or.ALL).setParameterLength(1),VT=ji(Or,Or.ANY).setParameterLength(1),zT=ji(Or,Or.RADIANS).setParameterLength(1),GT=ji(Or,Or.DEGREES).setParameterLength(1),L1=ji(Or,Or.EXP).setParameterLength(1),mv=ji(Or,Or.EXP2).setParameterLength(1),Tb=ji(Or,Or.LOG).setParameterLength(1),sg=ji(Or,Or.LOG2).setParameterLength(1),Nd=ji(Or,Or.SQRT).setParameterLength(1),U1=ji(Or,Or.INVERSE_SQRT).setParameterLength(1),ag=ji(Or,Or.FLOOR).setParameterLength(1),Bb=ji(Or,Or.CEIL).setParameterLength(1),rf=ji(Or,Or.NORMALIZE).setParameterLength(1),_p=ji(Or,Or.FRACT).setParameterLength(1),sf=ji(Or,Or.SIN).setParameterLength(1),wp=ji(Or,Or.COS).setParameterLength(1),HT=ji(Or,Or.TAN).setParameterLength(1),QT=ji(Or,Or.ASIN).setParameterLength(1),O1=ji(Or,Or.ACOS).setParameterLength(1),Rb=ji(Or,Or.ATAN).setParameterLength(1,2),Su=ji(Or,Or.ABS).setParameterLength(1),D1=ji(Or,Or.SIGN).setParameterLength(1),og=ji(Or,Or.LENGTH).setParameterLength(1),k1=ji(Or,Or.NEGATE).setParameterLength(1),WT=ji(Or,Or.ONE_MINUS).setParameterLength(1),V1=ji(Or,Or.DFDX).setParameterLength(1),z1=ji(Or,Or.DFDY).setParameterLength(1),ZT=ji(Or,Or.ROUND).setParameterLength(1),KT=ji(Or,Or.RECIPROCAL).setParameterLength(1),G1=ji(Or,Or.TRUNC).setParameterLength(1),H1=ji(Or,Or.FWIDTH).setParameterLength(1),$T=ji(Or,Or.TRANSPOSE).setParameterLength(1),XT=ji(Or,Or.DETERMINANT).setParameterLength(1),jT=ji(Or,Or.INVERSE).setParameterLength(1),YT=(s,e)=>(Lr('TSL: "equals" is deprecated. Use "equal" inside a vector instead, like: "bvec*( equal( ... ) )"'),N1(s,e)),Uf=ji(Or,Or.MIN).setParameterLength(2,1/0),mc=ji(Or,Or.MAX).setParameterLength(2,1/0),Ib=ji(Or,Or.STEP).setParameterLength(2),qT=ji(Or,Or.REFLECT).setParameterLength(2),JT=ji(Or,Or.DISTANCE).setParameterLength(2),eB=ji(Or,Or.DIFFERENCE).setParameterLength(2),ZA=ji(Or,Or.DOT).setParameterLength(2),Zg=ji(Or,Or.CROSS).setParameterLength(2),KA=ji(Or,Or.POW).setParameterLength(2),Q1=s=>no(s,s),tB=s=>no(s,s,s),W1=s=>no(s,s,s,s),nB=ji(Or,Or.TRANSFORM_DIRECTION).setParameterLength(2),rB=s=>no(D1(s),KA(Su(s),1/3)),Z1=s=>ZA(s,s),zo=ji(Or,Or.MIX).setParameterLength(3),Sp=(s,e=0,t=1)=>Ss(new Or(Or.CLAMP,Ss(s),Ss(e),Ss(t))),Nb=s=>Sp(s),K1=ji(Or,Or.REFRACT).setParameterLength(3),fA=ji(Or,Or.SMOOTHSTEP).setParameterLength(3),$1=ji(Or,Or.FACEFORWARD).setParameterLength(3),iB=or(([s])=>{const n=43758.5453,i=ZA(s.xy,Gi(12.9898,78.233)),a=Oy(i,Cb);return _p(sf(a).mul(n))}),sB=(s,e,t)=>zo(e,t,s),aB=(s,e,t)=>fA(e,t,s),oB=(s,e)=>Ib(e,s),lB=(s,e)=>(Lr('TSL: "atan2" is overloaded. Use "atan" instead.'),Rb(s,e)),Nk=$1,Fk=U1;ci("all",kT),ci("any",VT),ci("equals",YT),ci("radians",zT),ci("degrees",GT),ci("exp",L1),ci("exp2",mv),ci("log",Tb),ci("log2",sg),ci("sqrt",Nd),ci("inverseSqrt",U1),ci("floor",ag),ci("ceil",Bb),ci("normalize",rf),ci("fract",_p),ci("sin",sf),ci("cos",wp),ci("tan",HT),ci("asin",QT),ci("acos",O1),ci("atan",Rb),ci("abs",Su),ci("sign",D1),ci("length",og),ci("lengthSq",Z1),ci("negate",k1),ci("oneMinus",WT),ci("dFdx",V1),ci("dFdy",z1),ci("round",ZT),ci("reciprocal",KT),ci("trunc",G1),ci("fwidth",H1),ci("atan2",lB),ci("min",Uf),ci("max",mc),ci("step",oB),ci("reflect",qT),ci("distance",JT),ci("dot",ZA),ci("cross",Zg),ci("pow",KA),ci("pow2",Q1),ci("pow3",tB),ci("pow4",W1),ci("transformDirection",nB),ci("mix",sB),ci("clamp",Sp),ci("refract",K1),ci("smoothstep",aB),ci("faceForward",$1),ci("difference",eB),ci("saturate",Nb),ci("cbrt",rB),ci("transpose",$T),ci("determinant",XT),ci("inverse",jT),ci("rand",iB);class Pk extends ta{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 e.flowBuildStage(this,"setup"),this.getNodeType(e);const i=t.getNodeType(e);if(n!==null){const a=n.getNodeType(e);if(e.getTypeLength(a)>e.getTypeLength(i))return a}return i}setup(e){const t=this.condNode,n=this.ifNode.isolate(),i=this.elseNode?this.elseNode.isolate():null,a=e.context.nodeBlock;e.getDataFromNode(n).parentNodeBlock=a,i!==null&&(e.getDataFromNode(i).parentNodeBlock=a);const o=e.context.uniformFlow,u=e.getNodeProperties(this);u.condNode=t,u.ifNode=o?n:n.context({nodeBlock:n}),u.elseNode=i?o?i:i.context({nodeBlock:i}):null}generate(e,t){const n=this.getNodeType(e),i=e.getDataFromNode(this);if(i.nodeProperty!==void 0)return i.nodeProperty;const{condNode:a,ifNode:o,elseNode:u}=e.getNodeProperties(this),c=e.currentFunctionNode,d=t!=="void",g=d?bp(n).build(e):"";i.nodeProperty=g;const v=a.build(e,"bool");if(e.context.uniformFlow&&u!==null){const I=o.build(e,n),ne=u.build(e,n),ee=e.getTernary(v,I,ne);return e.format(ee,n,t)}e.addFlowCode(`
${e.tab}if ( ${v} ) {
`).addFlowTab();let B=o.build(e,n);if(B&&(d?B=g+" = "+B+";":(B="return "+B+";",c===null&&(Lr("TSL: Return statement used in an inline 'Fn()'. Define a layout struct to allow return values."),B="// "+B))),e.removeFlowTab().addFlowCode(e.tab+" "+B+`
`+e.tab+"}"),u!==null){e.addFlowCode(` else {
`).addFlowTab();let I=u.build(e,n);I&&(d?I=g+" = "+I+";":(I="return "+I+";",c===null&&(Lr("TSL: Return statement used in an inline 'Fn()'. Define a layout struct to allow return values."),I="// "+I))),e.removeFlowTab().addFlowCode(e.tab+" "+I+`
`+e.tab+`}
`)}else e.addFlowCode(`
`);return e.format(g,n,t)}}const ud=to(Pk).setParameterLength(2,3);ci("select",ud);class uB extends ta{static get type(){return"ContextNode"}constructor(e=null,t={}){super(),this.isContextNode=!0,this.node=e,this.value=t}getScope(){return this.node.getScope()}getNodeType(e){return this.node.getNodeType(e)}getFlowContextData(){const e=[];return this.traverse(t=>{t.isContextNode===!0&&e.push(t.value)}),Object.assign({},...e)}getMemberType(e,t){return this.node.getMemberType(e,t)}analyze(e){const t=e.addContext(this.value);this.node.build(e),e.setContext(t)}setup(e){const t=e.addContext(this.value);this.node.build(e),e.setContext(t)}generate(e,t){const n=e.addContext(this.value),i=this.node.build(e,t);return e.setContext(n),i}}const Kg=(s=null,e={})=>{let t=s;return(t===null||t.isNode!==!0)&&(e=t||e,t=null),new uB(t,e)},cB=s=>Kg(s,{uniformFlow:!0}),X1=(s,e)=>Kg(s,{nodeName:e});function hB(s,e,t=null){return Kg(t,{getShadow:({light:n,shadowColorNode:i})=>e===n?i.mul(s):i})}function dB(s,e=null){return Kg(e,{getAO:(t,{material:n})=>n.transparent===!0?t:t!==null?t.mul(s):s})}function fB(s,e){return Lr('TSL: "label()" has been deprecated. Use "setName()" instead.'),X1(s,e)}ci("context",Kg),ci("label",fB),ci("uniformFlow",cB),ci("setName",X1),ci("builtinShadowContext",(s,e,t)=>hB(e,t,s)),ci("builtinAOContext",(s,e)=>dB(e,s));class Fb extends ta{static get type(){return"VarNode"}constructor(e,t=null,n=!1){super(),this.node=e,this.name=t,this.global=!0,this.isVarNode=!0,this.readOnly=n,this.parents=!0,this.intent=!1}setIntent(e){return this.intent=e,this}isIntent(e){return e.getDataFromNode(this).forceDeclaration===!0?!1:this.intent}getIntent(){return this.intent}getMemberType(e,t){return this.node.getMemberType(e,t)}getElementType(e){return this.node.getElementType(e)}getNodeType(e){return this.node.getNodeType(e)}getArrayCount(e){return this.node.getArrayCount(e)}isAssign(e){return e.getDataFromNode(this).assign}build(...e){const t=e[0];if(this._hasStack(t)===!1&&t.buildStage==="setup"&&(t.context.nodeLoop||t.context.nodeBlock)){let n=!1;if(this.node.isShaderCallNodeInternal&&this.node.shaderNode.getLayout()===null&&t.fnCall&&t.fnCall.shaderNode&&t.getDataFromNode(this.node.shaderNode).hasLoop){const o=t.getDataFromNode(this);o.forceDeclaration=!0,n=!0}const i=t.getBaseStack();n?i.addToStackBefore(this):i.addToStack(this)}return this.isIntent(t)&&this.isAssign(t)!==!0?this.node.build(...e):super.build(...e)}generate(e){const{node:t,name:n,readOnly:i}=this,{renderer:a}=e,o=a.backend.isWebGPUBackend===!0;let u=!1,c=!1;i&&(u=e.isDeterministic(t),c=o?i:u);const d=this.getNodeType(e);if(d=="void")return this.isIntent(e)!==!0&&Gr('TSL: ".toVar()" can not be used with void type.'),t.build(e);const g=e.getVectorType(d),v=t.build(e,g),M=e.getVarFromNode(this,n,g,void 0,c),B=e.getPropertyName(M);let I=B;if(c)if(o)I=u?`const ${B}`:`let ${B}`;else{const ne=t.getArrayCount(e);I=`const ${e.getVar(M.type,B,ne)}`}return e.addLineFlowCode(`${I} = ${v}`,this),B}_hasStack(e){return e.getDataFromNode(this).stack!==void 0}}const j1=to(Fb),AB=(s,e=null)=>j1(s,e).toStack(),pB=(s,e=null)=>j1(s,e,!0).toStack(),gB=s=>j1(s).setIntent(!0).toStack();ci("toVar",AB),ci("toConst",pB),ci("toVarIntent",gB);class Lk extends ta{static get type(){return"SubBuild"}constructor(e,t,n=null){super(n),this.node=e,this.name=t,this.isSubBuildNode=!0}getNodeType(e){if(this.nodeType!==null)return this.nodeType;e.addSubBuild(this.name);const t=this.node.getNodeType(e);return e.removeSubBuild(),t}build(e,...t){e.addSubBuild(this.name);const n=this.node.build(e,...t);return e.removeSubBuild(),n}}const vv=(s,e,t=null)=>Ss(new Lk(Ss(s),e,t));class Uk extends ta{static get type(){return"VaryingNode"}constructor(e,t=null){super(),this.node=e,this.name=t,this.isVaryingNode=!0,this.interpolationType=null,this.interpolationSampling=null,this.global=!0}setInterpolation(e,t=null){return this.interpolationType=e,this.interpolationSampling=t,this}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 i=this.name,a=this.getNodeType(e),o=this.interpolationType,u=this.interpolationSampling;t.varying=n=e.getVaryingFromNode(this,i,a,o,u),t.node=vv(this.node,"VERTEX")}return n.needsInterpolation||(n.needsInterpolation=e.shaderStage==="fragment"),n}setup(e){this.setupVarying(e),e.flowNodeFromShaderStage(Cy.VERTEX,this.node)}analyze(e){this.setupVarying(e),e.flowNodeFromShaderStage(Cy.VERTEX,this.node)}generate(e){const t=e.getSubBuildProperty("property",e.currentStack),n=e.getNodeProperties(this),i=this.setupVarying(e);if(n[t]===void 0){const a=this.getNodeType(e),o=e.getPropertyName(i,Cy.VERTEX);e.flowNodeFromShaderStage(Cy.VERTEX,n.node,a,o),n[t]=o}return e.getPropertyName(i)}}const lg=to(Uk).setParameterLength(1,2),mB=s=>lg(s);ci("toVarying",lg),ci("toVertexStage",mB),ci("varying",(...s)=>(Lr("TSL: .varying() has been renamed to .toVarying()."),lg(...s))),ci("vertexStage",(...s)=>(Lr("TSL: .vertexStage() has been renamed to .toVertexStage()."),lg(...s)));const vB=or(([s])=>{const e=s.mul(.9478672986).add(.0521327014).pow(2.4),t=s.mul(.0773993808),n=s.lessThanEqual(.04045);return zo(e,t,n)}).setLayout({name:"sRGBTransferEOTF",type:"vec3",inputs:[{name:"color",type:"vec3"}]}),yB=or(([s])=>{const e=s.pow(.41666).mul(1.055).sub(.055),t=s.mul(12.92),n=s.lessThanEqual(.0031308);return zo(e,t,n)}).setLayout({name:"sRGBTransferOETF",type:"vec3",inputs:[{name:"color",type:"vec3"}]}),Y1="WorkingColorSpace",Ok="OutputColorSpace";class q1 extends pc{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===Y1?xr.workingColorSpace:t===Ok?e.context.outputColorSpace||e.renderer.outputColorSpace:t}setup(e){const{colorNode:t}=this,n=this.resolveColorSpace(e,this.source),i=this.resolveColorSpace(e,this.target);let a=t;return xr.enabled===!1||n===i||!n||!i||(xr.getTransfer(n)===ws&&(a=Ks(vB(a.rgb),a.a)),xr.getPrimaries(n)!==xr.getPrimaries(i)&&(a=Ks(ld(xr._getMatrix(new pn,n,i)).mul(a.rgb),a.a)),xr.getTransfer(i)===ws&&(a=Ks(yB(a.rgb),a.a))),a}}const xB=(s,e)=>Ss(new q1(Ss(s),Y1,e)),Pb=(s,e)=>Ss(new q1(Ss(s),e,Y1)),Dk=(s,e,t)=>Ss(new q1(Ss(s),e,t));ci("workingToColorSpace",xB),ci("colorSpaceToWorking",Pb);let kk=class extends u0{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(),i=this.getNodeType();return e.format(t,n,i)}};class bB extends ta{static get type(){return"ReferenceBaseNode"}constructor(e,t,n=null,i=null){super(),this.property=e,this.uniformType=t,this.object=n,this.count=i,this.properties=e.split("."),this.reference=n,this.node=null,this.group=null,this.updateType=Ao.OBJECT}setGroup(e){return this.group=e,this}element(e){return new kk(this,Ss(e))}setNodeType(e){const t=va(null,e);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 i=1;i<t.length;i++)n=n[t[i]];return n}updateReference(e){return this.reference=this.object!==null?this.object:e.object,this.reference}setup(){return this.updateValue(),this.node}update(){this.updateValue()}updateValue(){this.node===null&&this.setNodeType(this.uniformType);const e=this.getValueFromReference();Array.isArray(e)?this.node.array=e:this.node.value=e}}const Vk=(s,e,t)=>new bB(s,e,t);class zk extends bB{static get type(){return"RendererReferenceNode"}constructor(e,t,n=null){super(e,t,n),this.renderer=n,this.setGroup(xa)}updateReference(e){return this.reference=this.renderer!==null?this.renderer:e.renderer,this.reference}}const _B=(s,e,t=null)=>new zk(s,e,t);class Gk extends pc{static get type(){return"ToneMappingNode"}constructor(e,t=SB,n=null){super("vec3"),this._toneMapping=e,this.exposureNode=t,this.colorNode=n}customCacheKey(){return fv(this._toneMapping)}setToneMapping(e){return this._toneMapping=e,this}getToneMapping(){return this._toneMapping}setup(e){const t=this.colorNode||e.context.color,n=this._toneMapping;if(n===Ct)return t;let i=null;const a=e.renderer.library.getToneMappingFunction(n);return a!==null?i=Ks(a(t.rgb,this.exposureNode),t.a):(Gr("ToneMappingNode: Unsupported Tone Mapping configuration.",n),i=t),i}}const wB=(s,e,t)=>Ss(new Gk(s,Ss(e),Ss(t))),SB=_B("toneMappingExposure","float");ci("toneMapping",(s,e,t)=>wB(e,t,s));const MB=new WeakMap;function EB(s,e){let t=MB.get(s);return t===void 0&&(t=new wh(s,e),MB.set(s,t)),t}class Lm extends A1{static get type(){return"BufferAttributeNode"}constructor(e,t=null,n=0,i=0){super(e,t),this.isBufferNode=!0,this.bufferType=t,this.bufferStride=n,this.bufferOffset=i,this.usage=gh,this.instanced=!1,this.attribute=null,this.global=!0,e&&e.isBufferAttribute===!0&&e.itemSize<=4&&(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=e.getTypeLength(t),i=this.value,a=this.bufferStride||n,o=this.bufferOffset;let u;i.isInterleavedBuffer===!0?u=i:i.isBufferAttribute===!0?u=EB(i.array,a):u=EB(i,a);const c=new yf(u,n,o);u.setUsage(this.usage),this.attribute=c,this.attribute.isInstancedBufferAttribute=this.instanced}generate(e){const t=this.getNodeType(e),n=e.getBufferAttributeFromNode(this,t),i=e.getPropertyName(n);let a=null;return e.shaderStage==="vertex"||e.shaderStage==="compute"?(this.name=i,a=i):a=lg(this).build(e,t),a}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}}function Lb(s,e=null,t=0,n=0,i=gh,a=!1){return e==="mat3"||e===null&&s.itemSize===9?ld(new Lm(s,"vec3",9,0).setUsage(i).setInstanced(a),new Lm(s,"vec3",9,3).setUsage(i).setInstanced(a),new Lm(s,"vec3",9,6).setUsage(i).setInstanced(a)):e==="mat4"||e===null&&s.itemSize===16?Im(new Lm(s,"vec4",16,0).setUsage(i).setInstanced(a),new Lm(s,"vec4",16,4).setUsage(i).setInstanced(a),new Lm(s,"vec4",16,8).setUsage(i).setInstanced(a),new Lm(s,"vec4",16,12).setUsage(i).setInstanced(a)):new Lm(s,e,t,n)}const J1=(s,e=null,t=0,n=0)=>Lb(s,e,t,n),Hk=(s,e=null,t=0,n=0)=>Lb(s,e,t,n,mh),Ub=(s,e=null,t=0,n=0)=>Lb(s,e,t,n,gh,!0),eS=(s,e=null,t=0,n=0)=>Lb(s,e,t,n,mh,!0);ci("toAttribute",s=>J1(s.value));class Qk extends ta{static get type(){return"ComputeNode"}constructor(e,t){super("void"),this.isComputeNode=!0,this.computeNode=e,this.workgroupSize=t,this.count=null,this.version=1,this.name="",this.updateBeforeType=Ao.OBJECT,this.onInitFunction=null}setCount(e){return this.count=e,this}getCount(){return this.count}dispose(){this.dispatchEvent({type:"dispose"})}setName(e){return this.name=e,this}label(e){return Lr('TSL: "label()" has been deprecated. Use "setName()" instead.'),this.setName(e)}onInit(e){return this.onInitFunction=e,this}updateBefore({renderer:e}){e.compute(this)}setup(e){const t=this.computeNode.build(e);if(t){const n=e.getNodeProperties(this);n.outputComputeNode=t.outputNode,t.outputNode=null}return t}generate(e,t){const{shaderStage:n}=e;if(n==="compute"){const i=this.computeNode.build(e,"void");i!==""&&e.addLineFlowCode(i,this)}else{const a=e.getNodeProperties(this).outputComputeNode;if(a)return a.build(e,t)}}}const tS=(s,e=[64])=>{(e.length===0||e.length>3)&&Gr("TSL: compute() workgroupSize must have 1, 2, or 3 elements");for(let t=0;t<e.length;t++){const n=e[t];(typeof n!="number"||n<=0||!Number.isInteger(n))&&Gr(`TSL: compute() workgroupSize element at index [ ${t} ] must be a positive integer`)}for(;e.length<3;)e.push(1);return Ss(new Qk(Ss(s),e))},CB=(s,e,t)=>tS(s,t).setCount(e);ci("compute",CB),ci("computeKernel",tS);class Wk extends ta{static get type(){return"IsolateNode"}constructor(e,t=!0){super(),this.node=e,this.parent=t,this.isIsolateNode=!0}getNodeType(e){const t=e.getCache(),n=e.getCacheFromNode(this,this.parent);e.setCache(n);const i=this.node.getNodeType(e);return e.setCache(t),i}build(e,...t){const n=e.getCache(),i=e.getCacheFromNode(this,this.parent);e.setCache(i);const a=this.node.build(e,...t);return e.setCache(n),a}setParent(e){return this.parent=e,this}getParent(){return this.parent}}const yv=s=>new Wk(Ss(s));function TB(s,e=!0){return Lr('TSL: "cache()" has been deprecated. Use "isolate()" instead.'),yv(s).setParent(e)}ci("cache",TB),ci("isolate",yv);class Zk extends ta{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 BB=to(Zk).setParameterLength(2);ci("bypass",BB);class RB extends ta{static get type(){return"RemapNode"}constructor(e,t,n,i=qt(0),a=qt(1)){super(),this.node=e,this.inLowNode=t,this.inHighNode=n,this.outLowNode=i,this.outHighNode=a,this.doClamp=!0}setup(){const{node:e,inLowNode:t,inHighNode:n,outLowNode:i,outHighNode:a,doClamp:o}=this;let u=e.sub(t).div(n.sub(t));return o===!0&&(u=u.clamp()),u.mul(a.sub(i)).add(i)}}const IB=to(RB,null,null,{doClamp:!1}).setParameterLength(3,5),NB=to(RB).setParameterLength(3,5);ci("remap",IB),ci("remapClamp",NB);class Ob extends ta{static get type(){return"ExpressionNode"}constructor(e="",t="void"){super(t),this.snippet=e}generate(e,t){const n=this.getNodeType(e),i=this.snippet;if(n==="void")e.addLineFlowCode(i,this);else return e.format(i,n,t)}}const $g=to(Ob).setParameterLength(1,2),FB=s=>(s?ud(s,$g("discard")):$g("discard")).toStack(),Kk=()=>$g("return").toStack();ci("discard",FB);class $k extends pc{static get type(){return"RenderOutputNode"}constructor(e,t,n){super("vec4"),this.colorNode=e,this._toneMapping=t,this.outputColorSpace=n,this.isRenderOutputNode=!0}setToneMapping(e){return this._toneMapping=e,this}getToneMapping(){return this._toneMapping}setup({context:e}){let t=this.colorNode||e.color;const n=(this._toneMapping!==null?this._toneMapping:e.toneMapping)||Ct,i=(this.outputColorSpace!==null?this.outputColorSpace:e.outputColorSpace)||ao;return n!==Ct&&(t=t.toneMapping(n)),i!==ao&&i!==xr.workingColorSpace&&(t=t.workingToColorSpace(i)),t}}const nS=(s,e=null,t=null)=>Ss(new $k(Ss(s),e,t));ci("renderOutput",nS);class Xk extends pc{static get type(){return"DebugNode"}constructor(e,t=null){super(),this.node=e,this.callback=t}getNodeType(e){return this.node.getNodeType(e)}setup(e){return this.node.build(e)}analyze(e){return this.node.build(e)}generate(e){const t=this.callback,n=this.node.build(e),i="--- TSL debug - "+e.shaderStage+" shader ---",a="-".repeat(i.length);let o="";return o+="// #"+i+`#
`,o+=e.flow.code.replace(/^\t/mg,"")+`
`,o+="/* ... */ "+n+` /* ... */
`,o+="// #"+a+`#
`,t!==null?t(e,o):ac(o),n}}const PB=(s,e=null)=>Ss(new Xk(Ss(s),e)).toStack();ci("debug",PB);class LB{constructor(){this._renderer=null,this.currentFrame=null}get nodeFrame(){return this._renderer._nodes.nodeFrame}setRenderer(e){return this._renderer=e,this}getRenderer(){return this._renderer}init(){}begin(){}finish(){}inspect(){}computeAsync(){}beginCompute(){}finishCompute(){}beginRender(){}finishRender(){}copyTextureToTexture(){}copyFramebufferToTexture(){}}class jk extends ta{static get type(){return"InspectorNode"}constructor(e,t="",n=null){super(),this.node=e,this.name=t,this.callback=n,this.updateType=Ao.FRAME,this.isInspectorNode=!0}getName(){return this.name||this.node.name}update(e){e.renderer.inspector.inspect(this)}getNodeType(e){return this.node.getNodeType(e)}setup(e){let t=this.node;return e.context.inspector===!0&&this.callback!==null&&(t=this.callback(t)),e.renderer.backend.isWebGPUBackend!==!0&&e.renderer.inspector.constructor!==LB&&ki('TSL: ".toInspector()" is only available with WebGPU.'),t}}function UB(s,e="",t=null){return s=Ss(s),s.before(new jk(s,e,t))}ci("toInspector",UB);function Yk(s){Lr("TSL: AddNodeElement has been removed in favor of tree-shaking. Trying add",s)}class OB extends ta{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 i=e.geometry.getAttribute(n);t=e.getTypeFromAttribute(i)}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 a=e.geometry.getAttribute(t),o=e.getTypeFromAttribute(a),u=e.getAttribute(t,o);return e.shaderStage==="vertex"?e.format(u.name,o,n):lg(this).build(e,n)}else return Lr(`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 af=(s,e=null)=>new OB(s,e),Zl=(s=0)=>af("uv"+(s>0?s:""),"vec2");class qk extends ta{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"),i=this.levelNode===null?"0":this.levelNode.build(e,"int");return e.format(`${e.getMethod("textureDimensions")}( ${n}, ${i} )`,this.getNodeType(e),t)}}const Xg=to(qk).setParameterLength(1,2);class Jk extends Uy{static get type(){return"MaxMipLevelNode"}constructor(e){super(0),this._textureNode=e,this.updateType=Ao.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:i,height:a}=n;this.value=Math.log2(Math.max(i,a))}}}const rS=to(Jk).setParameterLength(1),iS=new zi;class ug extends Uy{static get type(){return"TextureNode"}constructor(e=iS,t=null,n=null,i=null){super(e),this.isTextureNode=!0,this.uvNode=t,this.levelNode=n,this.biasNode=i,this.compareNode=null,this.depthNode=null,this.gradNode=null,this.offsetNode=null,this.sampler=!0,this.updateMatrix=!1,this.updateType=Ao.NONE,this.referenceNode=null,this._value=e,this._matrixUniform=null,this._flipYUniform=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===st?"uvec4":this.value.type===Xt?"ivec4":"vec4"}getInputType(){return"texture"}getDefaultUV(){return Zl(this.value.channel)}updateReference(){return this.value}getTransformedUV(e){return this._matrixUniform===null&&(this._matrixUniform=va(this.value.matrix)),this._matrixUniform.mul(Kn(e,1)).xy}setUpdateMatrix(e){return this.updateMatrix=e,this}setupUV(e,t){return e.isFlipY()&&(this._flipYUniform===null&&(this._flipYUniform=va(!1)),t=t.toVar(),this.sampler?t=this._flipYUniform.select(t.flipY(),t):t=this._flipYUniform.select(t.setY(Qn(Xg(this,this.levelNode).y).sub(t.y).sub(1)),t)),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().");const i=or(()=>{let o=this.uvNode;return(o===null||e.context.forceUVContext===!0)&&e.context.getUV&&(o=e.context.getUV(this,e)),o||(o=this.getDefaultUV()),this.updateMatrix===!0&&(o=this.getTransformedUV(o)),o=this.setupUV(e,o),this.updateType=this._matrixUniform!==null||this._flipYUniform!==null?Ao.OBJECT:Ao.NONE,o})();let a=this.levelNode;a===null&&e.context.getTextureLevel&&(a=e.context.getTextureLevel(this)),t.uvNode=i,t.levelNode=a,t.biasNode=this.biasNode,t.compareNode=this.compareNode,t.gradNode=this.gradNode,t.depthNode=this.depthNode,t.offsetNode=this.offsetNode}generateUV(e,t){return t.build(e,this.sampler===!0?"vec2":"ivec2")}generateOffset(e,t){return t.build(e,"ivec2")}generateSnippet(e,t,n,i,a,o,u,c,d){const g=this.value;let v;return a?v=e.generateTextureBias(g,t,n,a,o,d):c?v=e.generateTextureGrad(g,t,n,c,o,d):u?v=e.generateTextureCompare(g,t,n,u,o,d):this.sampler===!1?v=e.generateTextureLoad(g,t,n,i,o,d):i?v=e.generateTextureLevel(g,t,n,i,o,d):v=e.generateTexture(g,t,n,o,d),v}generate(e,t){const n=this.value,i=e.getNodeProperties(this),a=super.generate(e,"property");if(/^sampler/.test(t))return a+"_sampler";if(e.isReference(t))return a;{const o=e.getDataFromNode(this);let u=o.propertyName;if(u===void 0){const{uvNode:g,levelNode:v,biasNode:M,compareNode:B,depthNode:I,gradNode:ne,offsetNode:ee}=i,q=this.generateUV(e,g),ye=v?v.build(e,"float"):null,Ce=M?M.build(e,"float"):null,ke=I?I.build(e,"int"):null,nt=B?B.build(e,"float"):null,Ye=ne?[ne[0].build(e,"vec2"),ne[1].build(e,"vec2")]:null,ht=ee?this.generateOffset(e,ee):null,Rt=e.getVarFromNode(this);u=e.getPropertyName(Rt);const qe=this.generateSnippet(e,a,q,ye,Ce,ke,nt,Ye,ht);e.addLineFlowCode(`${u} = ${qe}`,this),o.snippet=qe,o.propertyName=u}let c=u;const d=this.getNodeType(e);return e.needsToWorkingColorSpace(n)&&(c=Pb($g(c,d),n.colorSpace).setup(e).build(e,d)),e.format(c,d,t)}}setSampler(e){return this.sampler=e,this}getSampler(){return this.sampler}uv(e){return Lr("TextureNode: .uv() has been renamed. Use .sample() instead."),this.sample(e)}sample(e){const t=this.clone();return t.uvNode=Ss(e),t.referenceNode=this.getBase(),Ss(t)}load(e){return this.sample(e).setSampler(!1)}blur(e){const t=this.clone();t.biasNode=Ss(e).mul(rS(t)),t.referenceNode=this.getBase();const n=t.value;return t.generateMipmaps===!1&&(n&&n.generateMipmaps===!1||n.minFilter===cn||n.magFilter===cn)&&(Lr("TSL: texture().blur() requires mipmaps and sampling. Use .generateMipmaps=true and .minFilter/.magFilter=THREE.LinearFilter in the Texture."),t.biasNode=null),Ss(t)}level(e){const t=this.clone();return t.levelNode=Ss(e),t.referenceNode=this.getBase(),Ss(t)}size(e){return Xg(this,e)}bias(e){const t=this.clone();return t.biasNode=Ss(e),t.referenceNode=this.getBase(),Ss(t)}getBase(){return this.referenceNode?this.referenceNode.getBase():this}compare(e){const t=this.clone();return t.compareNode=Ss(e),t.referenceNode=this.getBase(),Ss(t)}grad(e,t){const n=this.clone();return n.gradNode=[Ss(e),Ss(t)],n.referenceNode=this.getBase(),Ss(n)}depth(e){const t=this.clone();return t.depthNode=Ss(e),t.referenceNode=this.getBase(),Ss(t)}offset(e){const t=this.clone();return t.offsetNode=Ss(e),t.referenceNode=this.getBase(),Ss(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();const n=this._flipYUniform;n!==null&&(n.value=e.image instanceof ImageBitmap&&e.flipY===!0||e.isRenderTargetTexture===!0||e.isFramebufferTexture===!0||e.isDepthTexture===!0)}clone(){const e=new this.constructor(this.value,this.uvNode,this.levelNode,this.biasNode);return e.sampler=this.sampler,e.depthNode=this.depthNode,e.compareNode=this.compareNode,e.gradNode=this.gradNode,e.offsetNode=this.offsetNode,e}}const e4=to(ug).setParameterLength(1,4).setName("texture"),xl=(s=iS,e=null,t=null,n=null)=>{let i;return s&&s.isTextureNode===!0?(i=Ss(s.clone()),i.referenceNode=s.getBase(),e!==null&&(i.uvNode=Ss(e)),t!==null&&(i.levelNode=Ss(t)),n!==null&&(i.biasNode=Ss(n))):i=e4(s,e,t,n),i},t4=(s=iS)=>xl(s),Rc=(...s)=>xl(...s).setSampler(!1),n4=(s,e,t)=>xl(s,e).level(t),r4=s=>(s.isNode===!0?s:xl(s)).convert("sampler"),i4=s=>(s.isNode===!0?s:xl(s)).convert("samplerComparison");class sS extends Uy{static get type(){return"BufferNode"}constructor(e,t,n=0){super(e,t),this.isBufferNode=!0,this.bufferType=t,this.bufferCount=n,this.updateRanges=[]}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}getElementType(e){return this.getNodeType(e)}getInputType(){return"buffer"}}const Dy=(s,e,t)=>new sS(s,e,t);class s4 extends u0{static get type(){return"UniformArrayElementNode"}constructor(e,t){super(e,t),this.isArrayBufferElementNode=!0}generate(e){const t=super.generate(e),n=this.getNodeType(),i=this.node.getPaddedType();return e.format(t,i,n)}}class a4 extends sS{static get type(){return"UniformArrayNode"}constructor(e,t=null){super(null),this.array=e,this.elementType=t===null?Qg(e[0]):t,this.paddedType=this.getPaddedType(),this.updateType=Ao.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 i=0;i<e.length;i++){const a=i*4;t[a]=e[i]}else if(n==="color")for(let i=0;i<e.length;i++){const a=i*4,o=e[i];t[a]=o.r,t[a+1]=o.g,t[a+2]=o.b||0}else if(n==="mat2")for(let i=0;i<e.length;i++){const a=i*4,o=e[i];t[a]=o.elements[0],t[a+1]=o.elements[1],t[a+2]=o.elements[2],t[a+3]=o.elements[3]}else if(n==="mat3")for(let i=0;i<e.length;i++){const a=i*16,o=e[i];t[a]=o.elements[0],t[a+1]=o.elements[1],t[a+2]=o.elements[2],t[a+4]=o.elements[3],t[a+5]=o.elements[4],t[a+6]=o.elements[5],t[a+8]=o.elements[6],t[a+9]=o.elements[7],t[a+10]=o.elements[8],t[a+15]=1}else if(n==="mat4")for(let i=0;i<e.length;i++){const a=i*16,o=e[i];for(let u=0;u<o.elements.length;u++)t[a+u]=o.elements[u]}else for(let i=0;i<e.length;i++){const a=i*4,o=e[i];t[a]=o.x,t[a+1]=o.y,t[a+2]=o.z||0,t[a+3]=o.w||0}}setup(e){const t=this.array.length,n=this.elementType;let i=Float32Array;const a=this.paddedType,o=e.getTypeLength(a);return n.charAt(0)==="i"&&(i=Int32Array),n.charAt(0)==="u"&&(i=Uint32Array),this.value=new i(t*o),this.bufferCount=t,this.bufferType=a,super.setup(e)}element(e){return new s4(this,Ss(e))}}const Fd=(s,e)=>new a4(s,e);class o4 extends ta{constructor(e){super("float"),this.name=e,this.isBuiltinNode=!0}generate(){return this.name}}const jg=to(o4).setParameterLength(1);let ky,Vy;class Fu extends ta{static get type(){return"ScreenNode"}constructor(e){super(),this.scope=e,this._output=null,this.isViewportNode=!0}getNodeType(){return this.scope===Fu.DPR?"float":this.scope===Fu.VIEWPORT?"vec4":"vec2"}getUpdateType(){let e=Ao.NONE;return(this.scope===Fu.SIZE||this.scope===Fu.VIEWPORT||this.scope===Fu.DPR)&&(e=Ao.RENDER),this.updateType=e,e}update({renderer:e}){const t=e.getRenderTarget();this.scope===Fu.VIEWPORT?t!==null?Vy.copy(t.viewport):(e.getViewport(Vy),Vy.multiplyScalar(e.getPixelRatio())):this.scope===Fu.DPR?this._output.value=e.getPixelRatio():t!==null?(ky.width=t.width,ky.height=t.height):e.getDrawingBufferSize(ky)}setup(){const e=this.scope;let t=null;return e===Fu.SIZE?t=va(ky||(ky=new ce)):e===Fu.VIEWPORT?t=va(Vy||(Vy=new Ni)):e===Fu.DPR?t=va(1):t=Gi(m0.div(g0)),this._output=t,t}generate(e){if(this.scope===Fu.COORDINATE){let t=e.getFragCoord();if(e.isFlipY()){const n=e.getNodeProperties(g0).outputNode.build(e);t=`${e.getType("vec2")}( ${t}.x, ${n}.y - ${t}.y )`}return t}return super.generate(e)}}Fu.COORDINATE="coordinate",Fu.VIEWPORT="viewport",Fu.SIZE="size",Fu.UV="uv",Fu.DPR="dpr";const aS=xs(Fu,Fu.DPR),Yg=xs(Fu,Fu.UV),g0=xs(Fu,Fu.SIZE),m0=xs(Fu,Fu.COORDINATE),xv=xs(Fu,Fu.VIEWPORT),oS=xv.zw,DB=m0.sub(xv.xy),l4=DB.div(oS),u4=or(()=>(Lr('TSL: "viewportResolution" is deprecated. Use "screenSize" instead.'),g0),"vec2").once()(),Um=va(0,"uint").setName("u_cameraIndex").setGroup(Eb("cameraIndex")).toVarying("v_cameraIndex"),qg=va("float").setName("cameraNear").setGroup(xa).onRenderUpdate(({camera:s})=>s.near),Jg=va("float").setName("cameraFar").setGroup(xa).onRenderUpdate(({camera:s})=>s.far),of=or(({camera:s})=>{let e;if(s.isArrayCamera&&s.cameras.length>0){const t=[];for(const i of s.cameras)t.push(i.projectionMatrix);e=Fd(t).setGroup(xa).setName("cameraProjectionMatrices").element(s.isMultiViewCamera?jg("gl_ViewID_OVR"):Um).toConst("cameraProjectionMatrix")}else e=va("mat4").setName("cameraProjectionMatrix").setGroup(xa).onRenderUpdate(({camera:t})=>t.projectionMatrix);return e}).once()(),c4=or(({camera:s})=>{let e;if(s.isArrayCamera&&s.cameras.length>0){const t=[];for(const i of s.cameras)t.push(i.projectionMatrixInverse);e=Fd(t).setGroup(xa).setName("cameraProjectionMatricesInverse").element(s.isMultiViewCamera?jg("gl_ViewID_OVR"):Um).toConst("cameraProjectionMatrixInverse")}else e=va("mat4").setName("cameraProjectionMatrixInverse").setGroup(xa).onRenderUpdate(({camera:t})=>t.projectionMatrixInverse);return e}).once()(),AA=or(({camera:s})=>{let e;if(s.isArrayCamera&&s.cameras.length>0){const t=[];for(const i of s.cameras)t.push(i.matrixWorldInverse);e=Fd(t).setGroup(xa).setName("cameraViewMatrices").element(s.isMultiViewCamera?jg("gl_ViewID_OVR"):Um).toConst("cameraViewMatrix")}else e=va("mat4").setName("cameraViewMatrix").setGroup(xa).onRenderUpdate(({camera:t})=>t.matrixWorldInverse);return e}).once()(),h4=or(({camera:s})=>{let e;if(s.isArrayCamera&&s.cameras.length>0){const t=[];for(const i of s.cameras)t.push(i.matrixWorld);e=Fd(t).setGroup(xa).setName("cameraWorldMatrices").element(s.isMultiViewCamera?jg("gl_ViewID_OVR"):Um).toConst("cameraWorldMatrix")}else e=va("mat4").setName("cameraWorldMatrix").setGroup(xa).onRenderUpdate(({camera:t})=>t.matrixWorld);return e}).once()(),d4=or(({camera:s})=>{let e;if(s.isArrayCamera&&s.cameras.length>0){const t=[];for(const i of s.cameras)t.push(i.normalMatrix);e=Fd(t).setGroup(xa).setName("cameraNormalMatrices").element(s.isMultiViewCamera?jg("gl_ViewID_OVR"):Um).toConst("cameraNormalMatrix")}else e=va("mat3").setName("cameraNormalMatrix").setGroup(xa).onRenderUpdate(({camera:t})=>t.normalMatrix);return e}).once()(),zy=or(({camera:s})=>{let e;if(s.isArrayCamera&&s.cameras.length>0){const t=[];for(let i=0,a=s.cameras.length;i<a;i++)t.push(new le);e=Fd(t).setGroup(xa).setName("cameraPositions").onRenderUpdate(({camera:i},a)=>{const o=i.cameras,u=a.array;for(let c=0,d=o.length;c<d;c++)u[c].setFromMatrixPosition(o[c].matrixWorld)}).element(s.isMultiViewCamera?jg("gl_ViewID_OVR"):Um).toConst("cameraPosition")}else e=va(new le).setName("cameraPosition").setGroup(xa).onRenderUpdate(({camera:t},n)=>n.value.setFromMatrixPosition(t.matrixWorld));return e}).once()(),f4=or(({camera:s})=>{let e;if(s.isArrayCamera&&s.cameras.length>0){const t=[];for(const i of s.cameras)t.push(i.viewport);e=Fd(t,"vec4").setGroup(xa).setName("cameraViewports").element(Um).toConst("cameraViewport")}else e=Ks(0,0,g0.x,g0.y).toConst("cameraViewport");return e}).once()(),kB=new gi;class tl extends ta{static get type(){return"Object3DNode"}constructor(e,t=null){super(),this.scope=e,this.object3d=t,this.updateType=Ao.OBJECT,this.uniformNode=new Uy(null)}getNodeType(){const e=this.scope;if(e===tl.WORLD_MATRIX)return"mat4";if(e===tl.POSITION||e===tl.VIEW_POSITION||e===tl.DIRECTION||e===tl.SCALE)return"vec3";if(e===tl.RADIUS)return"float"}update(e){const t=this.object3d,n=this.uniformNode,i=this.scope;if(i===tl.WORLD_MATRIX)n.value=t.matrixWorld;else if(i===tl.POSITION)n.value=n.value||new le,n.value.setFromMatrixPosition(t.matrixWorld);else if(i===tl.SCALE)n.value=n.value||new le,n.value.setFromMatrixScale(t.matrixWorld);else if(i===tl.DIRECTION)n.value=n.value||new le,t.getWorldDirection(n.value);else if(i===tl.VIEW_POSITION){const a=e.camera;n.value=n.value||new le,n.value.setFromMatrixPosition(t.matrixWorld),n.value.applyMatrix4(a.matrixWorldInverse)}else if(i===tl.RADIUS){const a=e.object.geometry;a.boundingSphere===null&&a.computeBoundingSphere(),kB.copy(a.boundingSphere).applyMatrix4(t.matrixWorld),n.value=kB.radius}}generate(e){const t=this.scope;return t===tl.WORLD_MATRIX?this.uniformNode.nodeType="mat4":t===tl.POSITION||t===tl.VIEW_POSITION||t===tl.DIRECTION||t===tl.SCALE?this.uniformNode.nodeType="vec3":t===tl.RADIUS&&(this.uniformNode.nodeType="float"),this.uniformNode.build(e)}serialize(e){super.serialize(e),e.scope=this.scope}deserialize(e){super.deserialize(e),this.scope=e.scope}}tl.WORLD_MATRIX="worldMatrix",tl.POSITION="position",tl.SCALE="scale",tl.VIEW_POSITION="viewPosition",tl.DIRECTION="direction",tl.RADIUS="radius";const A4=to(tl,tl.DIRECTION).setParameterLength(1),p4=to(tl,tl.WORLD_MATRIX).setParameterLength(1),VB=to(tl,tl.POSITION).setParameterLength(1),g4=to(tl,tl.SCALE).setParameterLength(1),m4=to(tl,tl.VIEW_POSITION).setParameterLength(1),v4=to(tl,tl.RADIUS).setParameterLength(1);class $A extends tl{static get type(){return"ModelNode"}constructor(e){super(e)}update(e){this.object3d=e.object,super.update(e)}}const y4=xs($A,$A.DIRECTION),XA=xs($A,$A.WORLD_MATRIX),x4=xs($A,$A.POSITION),b4=xs($A,$A.SCALE),_4=xs($A,$A.VIEW_POSITION),zB=xs($A,$A.RADIUS),GB=va(new pn).onObjectUpdate(({object:s},e)=>e.value.getNormalMatrix(s.matrixWorld)),w4=va(new di).onObjectUpdate(({object:s},e)=>e.value.copy(s.matrixWorld).invert()),cg=or(s=>s.context.modelViewMatrix||HB).once()().toVar("modelViewMatrix"),HB=AA.mul(XA),lS=or(s=>(s.context.isHighPrecisionModelViewMatrix=!0,va("mat4").onObjectUpdate(({object:e,camera:t})=>e.modelViewMatrix.multiplyMatrices(t.matrixWorldInverse,e.matrixWorld)))).once()().toVar("highpModelViewMatrix"),uS=or(s=>{const e=s.context.isHighPrecisionModelViewMatrix;return va("mat3").onObjectUpdate(({object:t,camera:n})=>(e!==!0&&t.modelViewMatrix.multiplyMatrices(n.matrixWorldInverse,t.matrixWorld),t.normalMatrix.getNormalMatrix(t.modelViewMatrix)))}).once()().toVar("highpModelNormalViewMatrix"),cd=af("position","vec3"),vc=cd.toVarying("positionLocal"),Db=cd.toVarying("positionPrevious"),pA=or(s=>XA.mul(vc).xyz.toVarying(s.getSubBuildProperty("v_positionWorld")),"vec3").once(["POSITION"])(),cS=or(()=>vc.transformDirection(XA).toVarying("v_positionWorldDirection").normalize().toVar("positionWorldDirection"),"vec3").once(["POSITION"])(),Oc=or(s=>s.context.setupPositionView().toVarying("v_positionView"),"vec3").once(["POSITION"])(),iu=or(s=>{let e;return s.camera.isOrthographicCamera?e=Kn(0,0,1):e=Oc.negate().toVarying("v_positionViewDirection").normalize(),e.toVar("positionViewDirection")},"vec3").once(["POSITION"])();class S4 extends ta{static get type(){return"FrontFacingNode"}constructor(){super("bool"),this.isFrontFacingNode=!0}generate(e){if(e.shaderStage!=="fragment")return"true";const{material:t}=e;return t.side===de?"false":e.getFrontFacing()}}const QB=xs(S4),hS=qt(QB).mul(2).sub(1),bv=or(([s],{material:e})=>{const t=e.side;return t===de?s=s.mul(-1):t===he&&(s=s.mul(hS)),s}),kb=af("normal","vec3"),Of=or(s=>s.geometry.hasAttribute("normal")===!1?(Lr('TSL: Vertex attribute "normal" not found on geometry.'),Kn(0,1,0)):kb,"vec3").once()().toVar("normalLocal"),WB=Oc.dFdx().cross(Oc.dFdy()).normalize().toVar("normalFlat"),_v=or(s=>{let e;return s.material.flatShading===!0?e=WB:e=dS(Of).toVarying("v_normalViewGeometry").normalize(),e},"vec3").once()().toVar("normalViewGeometry"),ZB=or(s=>{let e=_v.transformDirection(AA);return s.material.flatShading!==!0&&(e=e.toVarying("v_normalWorldGeometry")),e.normalize().toVar("normalWorldGeometry")},"vec3").once()(),cl=or(({subBuildFn:s,material:e,context:t})=>{let n;return s==="NORMAL"||s==="VERTEX"?(n=_v,e.flatShading!==!0&&(n=bv(n))):n=t.setupNormal().context({getUV:null}),n},"vec3").once(["NORMAL","VERTEX"])().toVar("normalView"),Om=cl.transformDirection(AA).toVar("normalWorld"),v0=or(({subBuildFn:s,context:e})=>{let t;return s==="NORMAL"||s==="VERTEX"?t=cl:t=e.setupClearcoatNormal().context({getUV:null}),t},"vec3").once(["NORMAL","VERTEX"])().toVar("clearcoatNormalView"),KB=or(([s,e=XA])=>{const t=ld(e),n=s.div(Kn(t[0].dot(t[0]),t[1].dot(t[1]),t[2].dot(t[2])));return t.mul(n).xyz}),dS=or(([s],e)=>{const t=e.context.modelNormalViewMatrix;if(t)return t.transformDirection(s);const n=GB.mul(s);return AA.transformDirection(n)}),M4=or(()=>(Lr('TSL: "transformedNormalView" is deprecated. Use "normalView" instead.'),cl)).once(["NORMAL","VERTEX"])(),E4=or(()=>(Lr('TSL: "transformedNormalWorld" is deprecated. Use "normalWorld" instead.'),Om)).once(["NORMAL","VERTEX"])(),C4=or(()=>(Lr('TSL: "transformedClearcoatNormalView" is deprecated. Use "clearcoatNormalView" instead.'),v0)).once(["NORMAL","VERTEX"])(),$B=new Ua,fS=new di,XB=va(0).onReference(({material:s})=>s).onObjectUpdate(({material:s})=>s.refractionRatio),Vb=va(1).onReference(({material:s})=>s).onObjectUpdate(function({material:s,scene:e}){return s.envMap?s.envMapIntensity:e.environmentIntensity}),AS=va(new di).onReference(function(s){return s.material}).onObjectUpdate(function({material:s,scene:e}){const t=e.environment!==null&&s.envMap===null?e.environmentRotation:s.envMapRotation;return t?($B.copy(t),fS.makeRotationFromEuler($B)):fS.identity(),fS}),jB=iu.negate().reflect(cl),YB=iu.negate().refract(cl,XB),qB=jB.transformDirection(AA).toVar("reflectVector"),JB=YB.transformDirection(AA).toVar("reflectVector"),e2=new rh;class T4 extends ug{static get type(){return"CubeTextureNode"}constructor(e,t=null,n=null,i=null){super(e,t,n,i),this.isCubeTextureNode=!0}getInputType(){return this.value.isDepthTexture===!0?"cubeDepthTexture":"cubeTexture"}getDefaultUV(){const e=this.value;return e.mapping===it?qB:e.mapping===wt?JB:(Gr('CubeTextureNode: Mapping "%s" not supported.',e.mapping),Kn(0,0,0))}setUpdateMatrix(){}setupUV(e,t){const n=this.value;return n.isDepthTexture===!0?e.renderer.coordinateSystem===To?Kn(t.x,t.y.negate(),t.z):t:((e.renderer.coordinateSystem===To||!n.isRenderTargetTexture)&&(t=Kn(t.x.negate(),t.yz)),AS.mul(t))}generateUV(e,t){return t.build(e,this.sampler===!0?"vec3":"ivec3")}}const pS=to(T4).setParameterLength(1,4).setName("cubeTexture"),lf=(s=e2,e=null,t=null,n=null)=>{let i;return s&&s.isCubeTextureNode===!0?(i=Ss(s.clone()),i.referenceNode=s,e!==null&&(i.uvNode=Ss(e)),t!==null&&(i.levelNode=Ss(t)),n!==null&&(i.biasNode=Ss(n))):i=pS(s,e,t,n),i},B4=(s=e2)=>pS(s);class R4 extends u0{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(),i=this.getNodeType();return e.format(t,n,i)}}class zb extends ta{static get type(){return"ReferenceNode"}constructor(e,t,n=null,i=null){super(),this.property=e,this.uniformType=t,this.object=n,this.count=i,this.properties=e.split("."),this.reference=n,this.node=null,this.group=null,this.name=null,this.updateType=Ao.OBJECT}element(e){return new R4(this,Ss(e))}setGroup(e){return this.group=e,this}setName(e){return this.name=e,this}label(e){return Lr('TSL: "label()" has been deprecated. Use "setName()" instead.'),this.setName(e)}setNodeType(e){let t=null;this.count!==null?t=Dy(null,e,this.count):Array.isArray(this.getValueFromReference())?t=Fd(null,e):e==="texture"?t=xl(null):e==="cubeTexture"?t=lf(null):t=va(null,e),this.group!==null&&t.setGroup(this.group),this.name!==null&&t.setName(this.name),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 i=1;i<t.length;i++)n=n[t[i]];return n}updateReference(e){return this.reference=this.object!==null?this.object:e.object,this.reference}setup(){return this.updateValue(),this.node}update(){this.updateValue()}updateValue(){this.node===null&&this.setNodeType(this.uniformType);const e=this.getValueFromReference();Array.isArray(e)?this.node.array=e:this.node.value=e}}const su=(s,e,t)=>new zb(s,e,t),gS=(s,e,t,n)=>new zb(s,e,n,t);class I4 extends zb{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 em=(s,e,t=null)=>new I4(s,e,t),t2=Zl(),N4=Oc.dFdx(),F4=Oc.dFdy(),n2=t2.dFdx(),r2=t2.dFdy(),i2=cl,s2=F4.cross(i2),a2=i2.cross(N4),mS=s2.mul(n2.x).add(a2.mul(r2.x)),vS=s2.mul(n2.y).add(a2.mul(r2.y)),o2=mS.dot(mS).max(vS.dot(vS)),l2=o2.equal(0).select(0,o2.inverseSqrt()),P4=mS.mul(l2).toVar("tangentViewFrame"),L4=vS.mul(l2).toVar("bitangentViewFrame"),Gb=af("tangent","vec4"),Gy=Gb.xyz.toVar("tangentLocal"),Hb=or(({subBuildFn:s,geometry:e,material:t})=>{let n;return s==="VERTEX"||e.hasAttribute("tangent")?n=cg.mul(Ks(Gy,0)).xyz.toVarying("v_tangentView").normalize():n=P4,t.flatShading!==!0&&(n=bv(n)),n},"vec3").once(["NORMAL","VERTEX"])().toVar("tangentView"),u2=Hb.transformDirection(AA).toVarying("v_tangentWorld").normalize().toVar("tangentWorld"),Qb=or(([s,e],{subBuildFn:t,material:n})=>{let i=s.mul(Gb.w).xyz;return t==="NORMAL"&&n.flatShading!==!0&&(i=i.toVarying(e)),i}).once(["NORMAL"]),U4=Qb(kb.cross(Gb),"v_bitangentGeometry").normalize().toVar("bitangentGeometry"),O4=Qb(Of.cross(Gy),"v_bitangentLocal").normalize().toVar("bitangentLocal"),c2=or(({subBuildFn:s,geometry:e,material:t})=>{let n;return s==="VERTEX"||e.hasAttribute("tangent")?n=Qb(cl.cross(Hb),"v_bitangentView").normalize():n=L4,t.flatShading!==!0&&(n=bv(n)),n},"vec3").once(["NORMAL","VERTEX"])().toVar("bitangentView"),D4=Qb(Om.cross(u2),"v_bitangentWorld").normalize().toVar("bitangentWorld"),y0=ld(Hb,c2,cl).toVar("TBNViewMatrix"),h2=iu.mul(y0),k4=(s,e)=>s.sub(h2.mul(e)),d2=or(()=>{let s=f0.cross(iu);return s=s.cross(f0).normalize(),s=zo(s,cl,Fm.mul(ig.oneMinus()).oneMinus().pow2().pow2()).normalize(),s}).once()(),f2=s=>Ss(s).mul(.5).add(.5),V4=s=>Ss(s).mul(2).sub(1),yS=s=>Kn(s,Nd(Nb(qt(1).sub(ZA(s,s)))));class z4 extends pc{static get type(){return"NormalMapNode"}constructor(e,t=null){super("vec3"),this.node=e,this.scaleNode=t,this.normalMapType=Ll,this.unpackNormalMode=Kh}setup({material:e}){const{normalMapType:t,scaleNode:n,unpackNormalMode:i}=this;let a=this.node.mul(2).sub(1);if(t===Ll?i===dh?a=yS(a.xy):i===$h?a=yS(a.yw):i!==Kh&&console.error(`THREE.NodeMaterial: Unexpected unpack normal mode: ${i}`):i!==Kh&&console.error(`THREE.NodeMaterial: Normal map type '${t}' is not compatible with unpack normal mode '${i}'`),n!==null){let u=n;e.flatShading===!0&&(u=bv(u)),a=Kn(a.xy.mul(u),a.z)}let o=null;return t===Lu?o=dS(a):t===Ll?o=y0.mul(a).normalize():(Gr(`NodeMaterial: Unsupported normal map type: ${t}`),o=cl),o}}const xS=to(z4).setParameterLength(1,2),G4=or(({textureNode:s,bumpScale:e})=>{const t=i=>s.isolate().context({getUV:a=>i(a.uvNode||Zl()),forceUVContext:!0}),n=qt(t(i=>i));return Gi(qt(t(i=>i.add(i.dFdx()))).sub(n),qt(t(i=>i.add(i.dFdy()))).sub(n)).mul(e)}),H4=or(s=>{const{surf_pos:e,surf_norm:t,dHdxy:n}=s,i=e.dFdx().normalize(),a=e.dFdy().normalize(),o=t,u=a.cross(o),c=o.cross(i),d=i.dot(u).mul(hS),g=d.sign().mul(n.x.mul(u).add(n.y.mul(c)));return d.abs().mul(t).sub(g).normalize()});class Q4 extends pc{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=G4({textureNode:this.textureNode,bumpScale:e});return H4({surf_pos:Oc,surf_norm:cl,dHdxy:t})}}const bS=to(Q4).setParameterLength(1,2),A2=new Map;class vi extends ta{static get type(){return"MaterialNode"}constructor(e){super(),this.scope=e}getCache(e,t){let n=A2.get(e);return n===void 0&&(n=em(e,t),A2.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 i=null;if(n===vi.COLOR){const a=t.color!==void 0?this.getColor(n):Kn();t.map&&t.map.isTexture===!0?i=a.mul(this.getTexture("map")):i=a}else if(n===vi.OPACITY){const a=this.getFloat(n);t.alphaMap&&t.alphaMap.isTexture===!0?i=a.mul(this.getTexture("alpha")):i=a}else if(n===vi.SPECULAR_STRENGTH)t.specularMap&&t.specularMap.isTexture===!0?i=this.getTexture("specular").r:i=qt(1);else if(n===vi.SPECULAR_INTENSITY){const a=this.getFloat(n);t.specularIntensityMap&&t.specularIntensityMap.isTexture===!0?i=a.mul(this.getTexture(n).a):i=a}else if(n===vi.SPECULAR_COLOR){const a=this.getColor(n);t.specularColorMap&&t.specularColorMap.isTexture===!0?i=a.mul(this.getTexture(n).rgb):i=a}else if(n===vi.ROUGHNESS){const a=this.getFloat(n);t.roughnessMap&&t.roughnessMap.isTexture===!0?i=a.mul(this.getTexture(n).g):i=a}else if(n===vi.METALNESS){const a=this.getFloat(n);t.metalnessMap&&t.metalnessMap.isTexture===!0?i=a.mul(this.getTexture(n).b):i=a}else if(n===vi.EMISSIVE){const a=this.getFloat("emissiveIntensity"),o=this.getColor(n).mul(a);t.emissiveMap&&t.emissiveMap.isTexture===!0?i=o.mul(this.getTexture(n)):i=o}else if(n===vi.NORMAL)t.normalMap?(i=xS(this.getTexture("normal"),this.getCache("normalScale","vec2")),i.normalMapType=t.normalMapType,(t.normalMap.format==ze||t.normalMap.format==gr||t.normalMap.format==fr)&&(i.unpackNormalMode=dh)):t.bumpMap?i=bS(this.getTexture("bump").r,this.getFloat("bumpScale")):i=cl;else if(n===vi.CLEARCOAT){const a=this.getFloat(n);t.clearcoatMap&&t.clearcoatMap.isTexture===!0?i=a.mul(this.getTexture(n).r):i=a}else if(n===vi.CLEARCOAT_ROUGHNESS){const a=this.getFloat(n);t.clearcoatRoughnessMap&&t.clearcoatRoughnessMap.isTexture===!0?i=a.mul(this.getTexture(n).r):i=a}else if(n===vi.CLEARCOAT_NORMAL)t.clearcoatNormalMap?i=xS(this.getTexture(n),this.getCache(n+"Scale","vec2")):i=cl;else if(n===vi.SHEEN){const a=this.getColor("sheenColor").mul(this.getFloat("sheen"));t.sheenColorMap&&t.sheenColorMap.isTexture===!0?i=a.mul(this.getTexture("sheenColor").rgb):i=a}else if(n===vi.SHEEN_ROUGHNESS){const a=this.getFloat(n);t.sheenRoughnessMap&&t.sheenRoughnessMap.isTexture===!0?i=a.mul(this.getTexture(n).a):i=a,i=i.clamp(1e-4,1)}else if(n===vi.ANISOTROPY)if(t.anisotropyMap&&t.anisotropyMap.isTexture===!0){const a=this.getTexture(n);i=vb(wv.x,wv.y,wv.y.negate(),wv.x).mul(a.rg.mul(2).sub(Gi(1)).normalize().mul(a.b))}else i=wv;else if(n===vi.IRIDESCENCE_THICKNESS){const a=su("1","float",t.iridescenceThicknessRange);if(t.iridescenceThicknessMap){const o=su("0","float",t.iridescenceThicknessRange);i=a.sub(o).mul(this.getTexture(n).g).add(o)}else i=a}else if(n===vi.TRANSMISSION){const a=this.getFloat(n);t.transmissionMap?i=a.mul(this.getTexture(n).r):i=a}else if(n===vi.THICKNESS){const a=this.getFloat(n);t.thicknessMap?i=a.mul(this.getTexture(n).g):i=a}else if(n===vi.IOR)i=this.getFloat(n);else if(n===vi.LIGHT_MAP)i=this.getTexture(n).rgb.mul(this.getFloat("lightMapIntensity"));else if(n===vi.AO)i=this.getTexture(n).r.sub(1).mul(this.getFloat("aoMapIntensity")).add(1);else if(n===vi.LINE_DASH_OFFSET)i=t.dashOffset?this.getFloat(n):qt(0);else{const a=this.getNodeType(e);i=this.getCache(n,a)}return i}}vi.ALPHA_TEST="alphaTest",vi.COLOR="color",vi.OPACITY="opacity",vi.SHININESS="shininess",vi.SPECULAR="specular",vi.SPECULAR_STRENGTH="specularStrength",vi.SPECULAR_INTENSITY="specularIntensity",vi.SPECULAR_COLOR="specularColor",vi.REFLECTIVITY="reflectivity",vi.ROUGHNESS="roughness",vi.METALNESS="metalness",vi.NORMAL="normal",vi.CLEARCOAT="clearcoat",vi.CLEARCOAT_ROUGHNESS="clearcoatRoughness",vi.CLEARCOAT_NORMAL="clearcoatNormal",vi.EMISSIVE="emissive",vi.ROTATION="rotation",vi.SHEEN="sheen",vi.SHEEN_ROUGHNESS="sheenRoughness",vi.ANISOTROPY="anisotropy",vi.IRIDESCENCE="iridescence",vi.IRIDESCENCE_IOR="iridescenceIOR",vi.IRIDESCENCE_THICKNESS="iridescenceThickness",vi.IOR="ior",vi.TRANSMISSION="transmission",vi.THICKNESS="thickness",vi.ATTENUATION_DISTANCE="attenuationDistance",vi.ATTENUATION_COLOR="attenuationColor",vi.LINE_SCALE="scale",vi.LINE_DASH_SIZE="dashSize",vi.LINE_GAP_SIZE="gapSize",vi.LINE_WIDTH="linewidth",vi.LINE_DASH_OFFSET="dashOffset",vi.POINT_SIZE="size",vi.DISPERSION="dispersion",vi.LIGHT_MAP="light",vi.AO="ao";const p2=xs(vi,vi.ALPHA_TEST),Wb=xs(vi,vi.COLOR),g2=xs(vi,vi.SHININESS),m2=xs(vi,vi.EMISSIVE),Zb=xs(vi,vi.OPACITY),v2=xs(vi,vi.SPECULAR),_S=xs(vi,vi.SPECULAR_INTENSITY),y2=xs(vi,vi.SPECULAR_COLOR),Hy=xs(vi,vi.SPECULAR_STRENGTH),Kb=xs(vi,vi.REFLECTIVITY),x2=xs(vi,vi.ROUGHNESS),b2=xs(vi,vi.METALNESS),_2=xs(vi,vi.NORMAL),w2=xs(vi,vi.CLEARCOAT),S2=xs(vi,vi.CLEARCOAT_ROUGHNESS),M2=xs(vi,vi.CLEARCOAT_NORMAL),E2=xs(vi,vi.ROTATION),C2=xs(vi,vi.SHEEN),T2=xs(vi,vi.SHEEN_ROUGHNESS),B2=xs(vi,vi.ANISOTROPY),R2=xs(vi,vi.IRIDESCENCE),I2=xs(vi,vi.IRIDESCENCE_IOR),N2=xs(vi,vi.IRIDESCENCE_THICKNESS),F2=xs(vi,vi.TRANSMISSION),P2=xs(vi,vi.THICKNESS),L2=xs(vi,vi.IOR),U2=xs(vi,vi.ATTENUATION_DISTANCE),O2=xs(vi,vi.ATTENUATION_COLOR),wS=xs(vi,vi.LINE_SCALE),SS=xs(vi,vi.LINE_DASH_SIZE),MS=xs(vi,vi.LINE_GAP_SIZE),$b=xs(vi,vi.LINE_WIDTH),ES=xs(vi,vi.LINE_DASH_OFFSET),D2=xs(vi,vi.POINT_SIZE),k2=xs(vi,vi.DISPERSION),CS=xs(vi,vi.LIGHT_MAP),V2=xs(vi,vi.AO),wv=va(new ce).onReference(function(s){return s.material}).onRenderUpdate(function({material:s}){this.value.set(s.anisotropy*Math.cos(s.anisotropyRotation),s.anisotropy*Math.sin(s.anisotropyRotation))}),z2=or(s=>s.context.setupModelViewProjection(),"vec4").once()().toVarying("v_modelViewProjection");class W4 extends u0{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}getMemberType(e,t){const n=this.storageBufferNode.structTypeNode;return n?n.getMemberType(e,t):"void"}setup(e){return e.isAvailable("storageBuffer")===!1&&this.node.isPBO===!0&&e.setupPBO(this.node),super.setup(e)}generate(e,t){let n;const i=e.context.assign;if(e.isAvailable("storageBuffer")===!1?this.node.isPBO===!0&&i!==!0&&(this.node.value.isInstancedBufferAttribute||e.shaderStage!=="compute")?n=e.generatePBO(this):n=this.node.build(e):n=super.generate(e),i!==!0){const a=this.getNodeType(e);n=e.format(n,a,t)}return n}}const Z4=to(W4).setParameterLength(2);class K4 extends sS{static get type(){return"StorageBufferNode"}constructor(e,t=null,n=0){let i,a=null;t&&t.isStruct?(i="struct",a=t.layout,(e.isStorageBufferAttribute||e.isStorageInstancedBufferAttribute)&&(n=e.count)):t===null&&(e.isStorageBufferAttribute||e.isStorageInstancedBufferAttribute)?(i=o1(e.itemSize),n=e.count):i=t,super(e,i,n),this.isStorageBufferNode=!0,this.structTypeNode=a,this.access=od.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 Z4(this,e)}setPBO(e){return this.isPBO=e,this}getPBO(){return this.isPBO}setAccess(e){return this.access=e,this}toReadOnly(){return this.setAccess(od.READ_ONLY)}setAtomic(e){return this.isAtomic=e,this}toAtomic(){return this.setAtomic(!0)}getAttributeData(){return this._attribute===null&&(this._attribute=J1(this.value),this._varying=lg(this._attribute)),{attribute:this._attribute,varying:this._varying}}getNodeType(e){if(this.structTypeNode!==null)return this.structTypeNode.getNodeType(e);if(e.isAvailable("storageBuffer")||e.isAvailable("indirectStorageBuffer"))return super.getNodeType(e);const{attribute:t}=this.getAttributeData();return t.getNodeType(e)}getMemberType(e,t){return this.structTypeNode!==null?this.structTypeNode.getMemberType(e,t):"void"}generate(e){if(this.structTypeNode!==null&&this.structTypeNode.build(e),e.isAvailable("storageBuffer")||e.isAvailable("indirectStorageBuffer"))return super.generate(e);const{attribute:t,varying:n}=this.getAttributeData(),i=n.build(e);return e.registerTransform(i,t),i}}const tm=(s,e=null,t=0)=>new K4(s,e,t),$4=(s,e,t)=>(Lr('TSL: "storageObject()" is deprecated. Use "storage().setPBO( true )" instead.'),tm(s,e,t).setPBO(!0));class rc extends ta{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 i;if(n===rc.VERTEX)i=e.getVertexIndex();else if(n===rc.INSTANCE)i=e.getInstanceIndex();else if(n===rc.DRAW)i=e.getDrawIndex();else if(n===rc.INVOCATION_LOCAL)i=e.getInvocationLocalIndex();else if(n===rc.INVOCATION_SUBGROUP)i=e.getInvocationSubgroupIndex();else if(n===rc.SUBGROUP)i=e.getSubgroupIndex();else throw new Error("THREE.IndexNode: Unknown scope: "+n);let a;return e.shaderStage==="vertex"||e.shaderStage==="compute"?a=i:a=lg(this).build(e,t),a}}rc.VERTEX="vertex",rc.INSTANCE="instance",rc.SUBGROUP="subgroup",rc.INVOCATION_LOCAL="invocationLocal",rc.INVOCATION_SUBGROUP="invocationSubgroup",rc.DRAW="draw";const G2=xs(rc,rc.VERTEX),hg=xs(rc,rc.INSTANCE),X4=xs(rc,rc.SUBGROUP),j4=xs(rc,rc.INVOCATION_SUBGROUP),Y4=xs(rc,rc.INVOCATION_LOCAL),H2=xs(rc,rc.DRAW);class Q2 extends ta{static get type(){return"InstanceNode"}constructor(e,t,n=null){super("void"),this.count=e,this.instanceMatrix=t,this.instanceColor=n,this.instanceMatrixNode=null,this.instanceColorNode=null,this.updateType=Ao.FRAME,this.buffer=null,this.bufferColor=null}get isStorageMatrix(){const{instanceMatrix:e}=this;return e&&e.isStorageInstancedBufferAttribute===!0}get isStorageColor(){const{instanceColor:e}=this;return e&&e.isStorageInstancedBufferAttribute===!0}setup(e){const{instanceMatrix:t,instanceColor:n,isStorageMatrix:i,isStorageColor:a}=this,{count:o}=t;let{instanceMatrixNode:u,instanceColorNode:c}=this;if(u===null){if(i)u=tm(t,"mat4",Math.max(o,1)).element(hg);else if(o<=1e3)u=Dy(t.array,"mat4",Math.max(o,1)).element(hg);else{const g=new ly(t.array,16,1);this.buffer=g;const v=t.usage===mh?eS:Ub,M=[v(g,"vec4",16,0),v(g,"vec4",16,4),v(g,"vec4",16,8),v(g,"vec4",16,12)];u=Im(...M)}this.instanceMatrixNode=u}if(n&&c===null){if(a)c=tm(n,"vec3",Math.max(n.count,1)).element(hg);else{const g=new Mh(n.array,3),v=n.usage===mh?eS:Ub;this.bufferColor=g,c=Kn(v(g,"vec3",3,0))}this.instanceColorNode=c}const d=u.mul(vc).xyz;if(vc.assign(d),e.hasGeometryAttribute("normal")){const g=KB(Of,u);Of.assign(g)}this.instanceColorNode!==null&&cA("vec3","vInstanceColor").assign(this.instanceColorNode)}update(){this.buffer!==null&&this.isStorageMatrix!==!0&&(this.buffer.clearUpdateRanges(),this.buffer.updateRanges.push(...this.instanceMatrix.updateRanges),this.instanceMatrix.usage!==mh&&this.instanceMatrix.version!==this.buffer.version&&(this.buffer.version=this.instanceMatrix.version)),this.instanceColor&&this.bufferColor!==null&&this.isStorageColor!==!0&&(this.bufferColor.clearUpdateRanges(),this.bufferColor.updateRanges.push(...this.instanceColor.updateRanges),this.instanceColor.usage!==mh&&this.instanceColor.version!==this.bufferColor.version&&(this.bufferColor.version=this.instanceColor.version))}}const q4=to(Q2).setParameterLength(2,3);class J4 extends Q2{static get type(){return"InstancedMeshNode"}constructor(e){const{count:t,instanceMatrix:n,instanceColor:i}=e;super(t,n,i),this.instancedMesh=e}}const W2=to(J4).setParameterLength(1);class eV extends ta{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=hg:this.batchingIdNode=H2);const n=or(([I])=>{const ne=Qn(Xg(Rc(this.batchMesh._indirectTexture),0).x).toConst(),ee=Qn(I).mod(ne).toConst(),q=Qn(I).div(ne).toConst();return Rc(this.batchMesh._indirectTexture,ch(ee,q)).x}).setLayout({name:"getIndirectIndex",type:"uint",inputs:[{name:"id",type:"int"}]})(Qn(this.batchingIdNode)),i=this.batchMesh._matricesTexture,a=Qn(Xg(Rc(i),0).x).toConst(),o=qt(n).mul(4).toInt().toConst(),u=o.mod(a).toConst(),c=o.div(a).toConst(),d=Im(Rc(i,ch(u,c)),Rc(i,ch(u.add(1),c)),Rc(i,ch(u.add(2),c)),Rc(i,ch(u.add(3),c))),g=this.batchMesh._colorsTexture;if(g!==null){const ne=or(([ee])=>{const q=Qn(Xg(Rc(g),0).x).toConst(),ye=ee,Ce=ye.mod(q).toConst(),ke=ye.div(q).toConst();return Rc(g,ch(Ce,ke)).rgb}).setLayout({name:"getBatchingColor",type:"vec3",inputs:[{name:"id",type:"int"}]})(n);cA("vec3","vBatchColor").assign(ne)}const v=ld(d);vc.assign(d.mul(vc));const M=Of.div(Kn(v[0].dot(v[0]),v[1].dot(v[1]),v[2].dot(v[2]))),B=v.mul(M).xyz;Of.assign(B),e.hasGeometryAttribute("tangent")&&Gy.mulAssign(v)}}const Z2=to(eV).setParameterLength(1),K2=new WeakMap;class $2 extends ta{static get type(){return"SkinningNode"}constructor(e){super("void"),this.skinnedMesh=e,this.updateType=Ao.OBJECT,this.skinIndexNode=af("skinIndex","uvec4"),this.skinWeightNode=af("skinWeight","vec4"),this.bindMatrixNode=su("bindMatrix","mat4"),this.bindMatrixInverseNode=su("bindMatrixInverse","mat4"),this.boneMatricesNode=gS("skeleton.boneMatrices","mat4",e.skeleton.bones.length),this.positionNode=vc,this.toPositionNode=vc,this.previousBoneMatricesNode=null}getSkinnedPosition(e=this.boneMatricesNode,t=this.positionNode){const{skinIndexNode:n,skinWeightNode:i,bindMatrixNode:a,bindMatrixInverseNode:o}=this,u=e.element(n.x),c=e.element(n.y),d=e.element(n.z),g=e.element(n.w),v=a.mul(t),M=$c(u.mul(i.x).mul(v),c.mul(i.y).mul(v),d.mul(i.z).mul(v),g.mul(i.w).mul(v));return o.mul(M).xyz}getSkinnedNormal(e=this.boneMatricesNode,t=Of){const{skinIndexNode:n,skinWeightNode:i,bindMatrixNode:a,bindMatrixInverseNode:o}=this,u=e.element(n.x),c=e.element(n.y),d=e.element(n.z),g=e.element(n.w);let v=$c(i.x.mul(u),i.y.mul(c),i.z.mul(d),i.w.mul(g));return v=o.mul(v).mul(a),v.transformDirection(t).xyz}getPreviousSkinnedPosition(e){const t=e.object;return this.previousBoneMatricesNode===null&&(t.skeleton.previousBoneMatrices=new Float32Array(t.skeleton.boneMatrices),this.previousBoneMatricesNode=gS("skeleton.previousBoneMatrices","mat4",t.skeleton.bones.length)),this.getSkinnedPosition(this.previousBoneMatricesNode,Db)}needsPreviousBoneMatrices(e){const t=e.renderer.getMRT();return t&&t.has("velocity")||u1(e.object).useVelocity===!0}setup(e){this.needsPreviousBoneMatrices(e)&&Db.assign(this.getPreviousSkinnedPosition(e));const t=this.getSkinnedPosition();if(this.toPositionNode&&this.toPositionNode.assign(t),e.hasGeometryAttribute("normal")){const n=this.getSkinnedNormal();Of.assign(n),e.hasGeometryAttribute("tangent")&&Gy.assign(n)}return t}generate(e,t){if(t!=="void")return super.generate(e,t)}update(e){const t=e.object&&e.object.skeleton?e.object.skeleton:this.skinnedMesh.skeleton;K2.get(t)!==e.frameId&&(K2.set(t,e.frameId),this.previousBoneMatricesNode!==null&&(t.previousBoneMatrices===null&&(t.previousBoneMatrices=new Float32Array(t.boneMatrices)),t.previousBoneMatrices.set(t.boneMatrices)),t.update())}}const X2=s=>new $2(s),tV=(s,e=null)=>{const t=new $2(s);return t.positionNode=tm(new Mh(s.geometry.getAttribute("position").array,3),"vec3").setPBO(!0).toReadOnly().element(hg).toVar(),t.skinIndexNode=tm(new Mh(new Uint32Array(s.geometry.getAttribute("skinIndex").array),4),"uvec4").setPBO(!0).toReadOnly().element(hg).toVar(),t.skinWeightNode=tm(new Mh(s.geometry.getAttribute("skinWeight").array,4),"vec4").setPBO(!0).toReadOnly().element(hg).toVar(),t.bindMatrixNode=va(s.bindMatrix,"mat4"),t.bindMatrixInverseNode=va(s.bindMatrixInverse,"mat4"),t.boneMatricesNode=Dy(s.skeleton.boneMatrices,"mat4",s.skeleton.bones.length),t.toPositionNode=e,Ss(t)};class nV extends ta{static get type(){return"LoopNode"}constructor(e=[]){super("void"),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 u=0,c=this.params.length-1;u<c;u++){const d=this.params[u],g=d.isNode!==!0&&d.name||this.getVarName(u),v=d.isNode!==!0&&d.type||"int";n[g]=$g(g,v)}const i=e.addStack(),a=this.params[this.params.length-1](n);t.returnsNode=a.context({nodeLoop:a}),t.stackNode=i;const o=this.params[0];if(o.isNode!==!0&&typeof o.update=="function"){const u=or(this.params[0].update)(n);t.updateNode=u.context({nodeLoop:u})}return e.removeStack(),t}setup(e){if(this.getProperties(e),e.fnCall){const t=e.getDataFromNode(e.fnCall.shaderNode);t.hasLoop=!0}}generate(e){const t=this.getProperties(e),n=this.params,i=t.stackNode;for(let o=0,u=n.length-1;o<u;o++){const c=n[o];let d=!1,g=null,v=null,M=null,B=null,I=null,ne=null;c.isNode?c.getNodeType(e)==="bool"?(d=!0,B="bool",v=c.build(e,B)):(B="int",M=this.getVarName(o),g="0",v=c.build(e,B),I="<"):(B=c.type||"int",M=c.name||this.getVarName(o),g=c.start,v=c.end,I=c.condition,ne=c.update,typeof g=="number"?g=e.generateConst(B,g):g&&g.isNode&&(g=g.build(e,B)),typeof v=="number"?v=e.generateConst(B,v):v&&v.isNode&&(v=v.build(e,B)),g!==void 0&&v===void 0?(g=g+" - 1",v="0",I=">="):v!==void 0&&g===void 0&&(g="0",I="<"),I===void 0&&(Number(g)>Number(v)?I=">=":I="<"));let ee;if(d)ee=`while ( ${v} )`;else{const q={start:g,end:v},ye=q.start,Ce=q.end;let ke;const nt=()=>I.includes("<")?"+=":"-=";if(ne!=null)switch(typeof ne){case"function":ke=e.flowStagesNode(t.updateNode,"void").code.replace(/\t|;/g,"");break;case"number":ke=M+" "+nt()+" "+e.generateConst(B,ne);break;case"string":ke=M+" "+ne;break;default:ne.isNode?ke=M+" "+nt()+" "+ne.build(e):(Gr("TSL: 'Loop( { update: ... } )' is not a function, string or number."),ke="break /* invalid update */")}else B==="int"||B==="uint"?ne=I.includes("<")?"++":"--":ne=nt()+" 1.",ke=M+" "+ne;const Ye=e.getVar(B,M)+" = "+ye,ht=M+" "+I+" "+Ce;ee=`for ( ${Ye}; ${ht}; ${ke} )`}e.addFlowCode((o===0?`
`:"")+e.tab+ee+` {
`).addFlowTab()}const a=i.build(e,"void");t.returnsNode.build(e,"void"),e.removeFlowTab().addFlowCode(`
`+e.tab+a);for(let o=0,u=this.params.length-1;o<u;o++)e.addFlowCode((o===0?"":e.tab)+`}
`).removeFlowTab();e.addFlowTab()}}const kl=(...s)=>new nV(c0(s,"int")).toStack(),rV=()=>$g("continue").toStack(),j2=()=>$g("break").toStack(),TS=new WeakMap,gA=new Ni,Y2=or(({bufferMap:s,influence:e,stride:t,width:n,depth:i,offset:a})=>{const o=Qn(G2).mul(t).add(a),u=o.div(n),c=o.sub(u.mul(n));return Rc(s,ch(c,u)).depth(i).xyz.mul(e)});function iV(s){const e=s.morphAttributes.position!==void 0,t=s.morphAttributes.normal!==void 0,n=s.morphAttributes.color!==void 0,i=s.morphAttributes.position||s.morphAttributes.normal||s.morphAttributes.color,a=i!==void 0?i.length:0;let o=TS.get(s);if(o===void 0||o.count!==a){let q=function(){ne.dispose(),TS.delete(s),s.removeEventListener("dispose",q)};o!==void 0&&o.texture.dispose();const u=s.morphAttributes.position||[],c=s.morphAttributes.normal||[],d=s.morphAttributes.color||[];let g=0;e===!0&&(g=1),t===!0&&(g=2),n===!0&&(g=3);let v=s.attributes.position.count*g,M=1;const B=4096;v>B&&(M=Math.ceil(v/B),v=B);const I=new Float32Array(v*M*4*a),ne=new _a(I,v,M,a);ne.type=dt,ne.needsUpdate=!0;const ee=g*4;for(let ye=0;ye<a;ye++){const Ce=u[ye],ke=c[ye],nt=d[ye],Ye=v*M*4*ye;for(let ht=0;ht<Ce.count;ht++){const Rt=ht*ee;e===!0&&(gA.fromBufferAttribute(Ce,ht),I[Ye+Rt+0]=gA.x,I[Ye+Rt+1]=gA.y,I[Ye+Rt+2]=gA.z,I[Ye+Rt+3]=0),t===!0&&(gA.fromBufferAttribute(ke,ht),I[Ye+Rt+4]=gA.x,I[Ye+Rt+5]=gA.y,I[Ye+Rt+6]=gA.z,I[Ye+Rt+7]=0),n===!0&&(gA.fromBufferAttribute(nt,ht),I[Ye+Rt+8]=gA.x,I[Ye+Rt+9]=gA.y,I[Ye+Rt+10]=gA.z,I[Ye+Rt+11]=nt.itemSize===4?gA.w:1)}}o={count:a,texture:ne,stride:g,size:new ce(v,M)},TS.set(s,o),s.addEventListener("dispose",q)}return o}class sV extends ta{static get type(){return"MorphNode"}constructor(e){super("void"),this.mesh=e,this.morphBaseInfluence=va(1),this.updateType=Ao.OBJECT}setup(e){const{geometry:t}=e,n=t.morphAttributes.position!==void 0,i=t.hasAttribute("normal")&&t.morphAttributes.normal!==void 0,a=t.morphAttributes.position||t.morphAttributes.normal||t.morphAttributes.color,o=a!==void 0?a.length:0,{texture:u,stride:c,size:d}=iV(t);n===!0&&vc.mulAssign(this.morphBaseInfluence),i===!0&&Of.mulAssign(this.morphBaseInfluence);const g=Qn(d.width);kl(o,({i:v})=>{const M=qt(0).toVar();this.mesh.count>1&&this.mesh.morphTexture!==null&&this.mesh.morphTexture!==void 0?M.assign(Rc(this.mesh.morphTexture,ch(Qn(v).add(1),Qn(hg))).r):M.assign(su("morphTargetInfluences","float").element(v).toVar()),ra(M.notEqual(0),()=>{n===!0&&vc.addAssign(Y2({bufferMap:u,influence:M,stride:c,width:g,depth:v,offset:Qn(0)})),i===!0&&Of.addAssign(Y2({bufferMap:u,influence:M,stride:c,width:g,depth:v,offset:Qn(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 q2=to(sV).setParameterLength(1);class Sv extends ta{static get type(){return"LightingNode"}constructor(){super("vec3"),this.isLightingNode=!0}}class aV extends Sv{static get type(){return"AONode"}constructor(e=null){super(),this.aoNode=e}setup(e){e.context.ambientOcclusion.mulAssign(this.aoNode)}}class oV extends uB{static get type(){return"LightingContextNode"}constructor(e,t=null,n=null,i=null){super(e),this.lightingModel=t,this.backdropNode=n,this.backdropAlphaNode=i,this._value=null}getContext(){const{backdropNode:e,backdropAlphaNode:t}=this,n=Kn().toVar("directDiffuse"),i=Kn().toVar("directSpecular"),a=Kn().toVar("indirectDiffuse"),o=Kn().toVar("indirectSpecular"),u={directDiffuse:n,directSpecular:i,indirectDiffuse:a,indirectSpecular:o};return{radiance:Kn().toVar("radiance"),irradiance:Kn().toVar("irradiance"),iblIrradiance:Kn().toVar("iblIrradiance"),ambientOcclusion:qt(1).toVar("ambientOcclusion"),reflectedLight:u,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 J2=to(oV);class lV extends Sv{static get type(){return"IrradianceNode"}constructor(e){super(),this.node=e}setup(e){e.context.irradiance.addAssign(this.node)}}const Mv=new ce;class Xb extends ug{static get type(){return"ViewportTextureNode"}constructor(e=Yg,t=null,n=null){let i=null;n===null?(i=new OA,i.minFilter=yi,n=i):i=n,super(n,e,t),this.generateMipmaps=!1,this.defaultFramebuffer=i,this.isOutputTextureNode=!0,this.updateBeforeType=Ao.FRAME,this._cacheTextures=new WeakMap}getTextureForReference(e=null){let t,n;if(this.referenceNode?(t=this.referenceNode.defaultFramebuffer,n=this.referenceNode._cacheTextures):(t=this.defaultFramebuffer,n=this._cacheTextures),e===null)return t;if(n.has(e)===!1){const i=t.clone();n.set(e,i)}return n.get(e)}updateReference(e){const t=e.renderer.getRenderTarget();return this.value=this.getTextureForReference(t),this.value}updateBefore(e){const t=e.renderer,n=t.getRenderTarget();n===null?t.getDrawingBufferSize(Mv):Mv.set(n.width,n.height);const i=this.getTextureForReference(n);(i.image.width!==Mv.width||i.image.height!==Mv.height)&&(i.image.width=Mv.width,i.image.height=Mv.height,i.needsUpdate=!0);const a=i.generateMipmaps;i.generateMipmaps=this.generateMipmaps,t.copyFramebufferToTexture(i),i.generateMipmaps=a}clone(){const e=new this.constructor(this.uvNode,this.levelNode,this.value);return e.generateMipmaps=this.generateMipmaps,e}}const uV=to(Xb).setParameterLength(0,3),BS=to(Xb,null,null,{generateMipmaps:!0}).setParameterLength(0,3);let jb=null;class cV extends Xb{static get type(){return"ViewportDepthTextureNode"}constructor(e=Yg,t=null){jb===null&&(jb=new Al),super(e,t,jb)}getTextureForReference(){return jb}}const RS=to(cV).setParameterLength(0,2);class Df extends ta{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===Df.DEPTH_BASE?e.getFragDepth():super.generate(e)}setup({camera:e}){const{scope:t}=this,n=this.valueNode;let i=null;if(t===Df.DEPTH_BASE)n!==null&&(i=eR().assign(n));else if(t===Df.DEPTH)e.isPerspectiveCamera?i=IS(Oc.z,qg,Jg):i=Ev(Oc.z,qg,Jg);else if(t===Df.LINEAR_DEPTH)if(n!==null)if(e.isPerspectiveCamera){const a=NS(n,qg,Jg);i=Ev(a,qg,Jg)}else i=n;else i=Ev(Oc.z,qg,Jg);return i}}Df.DEPTH_BASE="depthBase",Df.DEPTH="depth",Df.LINEAR_DEPTH="linearDepth";const Ev=(s,e,t)=>s.add(e).div(e.sub(t)),hV=(s,e,t)=>e.sub(t).mul(s).sub(e),IS=(s,e,t)=>e.add(s).mul(t).div(t.sub(e).mul(s)),NS=(s,e,t)=>e.mul(t).div(t.sub(e).mul(s).sub(t)),FS=(s,e,t)=>{e=e.max(1e-6).toVar();const n=sg(s.negate().div(e)),i=sg(t.div(e));return n.div(i)},dV=(s,e,t)=>{const n=s.mul(Tb(t.div(e)));return qt(Math.E).pow(n).mul(e).negate()},eR=to(Df,Df.DEPTH_BASE),PS=xs(Df,Df.DEPTH),Cv=to(Df,Df.LINEAR_DEPTH).setParameterLength(0,1),fV=Cv(RS());PS.assign=s=>eR(s);class jA extends ta{static get type(){return"ClippingNode"}constructor(e=jA.DEFAULT){super(),this.scope=e}setup(e){super.setup(e);const t=e.clippingContext,{intersectionPlanes:n,unionPlanes:i}=t;return this.hardwareClipping=e.material.hardwareClipping,this.scope===jA.ALPHA_TO_COVERAGE?this.setupAlphaToCoverage(n,i):this.scope===jA.HARDWARE?this.setupHardwareClipping(i,e):this.setupDefault(n,i)}setupAlphaToCoverage(e,t){return or(()=>{const n=qt().toVar("distanceToPlane"),i=qt().toVar("distanceToGradient"),a=qt(1).toVar("clipOpacity"),o=t.length;if(this.hardwareClipping===!1&&o>0){const c=Fd(t).setGroup(xa);kl(o,({i:d})=>{const g=c.element(d);n.assign(Oc.dot(g.xyz).negate().add(g.w)),i.assign(n.fwidth().div(2)),a.mulAssign(fA(i.negate(),i,n))})}const u=e.length;if(u>0){const c=Fd(e).setGroup(xa),d=qt(1).toVar("intersectionClipOpacity");kl(u,({i:g})=>{const v=c.element(g);n.assign(Oc.dot(v.xyz).negate().add(v.w)),i.assign(n.fwidth().div(2)),d.mulAssign(fA(i.negate(),i,n).oneMinus())}),a.mulAssign(d.oneMinus())}Wl.a.mulAssign(a),Wl.a.equal(0).discard()})()}setupDefault(e,t){return or(()=>{const n=t.length;if(this.hardwareClipping===!1&&n>0){const a=Fd(t).setGroup(xa);kl(n,({i:o})=>{const u=a.element(o);Oc.dot(u.xyz).greaterThan(u.w).discard()})}const i=e.length;if(i>0){const a=Fd(e).setGroup(xa),o=WA(!0).toVar("clipped");kl(i,({i:u})=>{const c=a.element(u);o.assign(Oc.dot(c.xyz).greaterThan(c.w).and(o))}),o.discard()}})()}setupHardwareClipping(e,t){const n=e.length;return t.enableHardwareClipping(n),or(()=>{const i=Fd(e).setGroup(xa),a=jg(t.getClipDistance());kl(n,({i:o})=>{const u=i.element(o),c=Oc.dot(u.xyz).sub(u.w).negate();a.element(o).assign(c)})})()}}jA.ALPHA_TO_COVERAGE="alphaToCoverage",jA.DEFAULT="default",jA.HARDWARE="hardware";const AV=()=>new jA,pV=()=>new jA(jA.ALPHA_TO_COVERAGE),gV=()=>new jA(jA.HARDWARE),mV=.05,tR=or(([s])=>_p(no(1e4,sf(no(17,s.x).add(no(.1,s.y)))).mul($c(.1,Su(sf(no(13,s.y).add(s.x))))))),nR=or(([s])=>tR(Gi(tR(s.xy),s.z))),vV=or(([s])=>{const e=mc(og(V1(s.xyz)),og(z1(s.xyz))),t=qt(1).div(qt(mV).mul(e)).toVar("pixScale"),n=Gi(mv(ag(sg(t))),mv(Bb(sg(t)))),i=Gi(nR(ag(n.x.mul(s.xyz))),nR(ag(n.y.mul(s.xyz)))),a=_p(sg(t)),o=$c(no(a.oneMinus(),i.x),no(a,i.y)),u=Uf(a,a.oneMinus()),c=Kn(o.mul(o).div(no(2,u).mul(el(1,u))),o.sub(no(.5,u)).div(el(1,u)),el(1,el(1,o).mul(el(1,o)).div(no(2,u).mul(el(1,u))))),d=o.lessThan(u.oneMinus()).select(o.lessThan(u).select(c.x,c.y),c.z);return Sp(d,1e-6,1)}).setLayout({name:"getAlphaHashThreshold",type:"float",inputs:[{name:"position",type:"vec3"}]});class yV extends OB{static get type(){return"VertexColorNode"}constructor(e){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 i;return n===!0?i=super.generate(e):i=e.generateConst(this.nodeType,new Ni(1,1,1,1)),i}serialize(e){super.serialize(e),e.index=this.index}deserialize(e){super.deserialize(e),this.index=e.index}}const rR=(s=0)=>new yV(s),iR=or(([s,e])=>Uf(1,s.oneMinus().div(e)).oneMinus()).setLayout({name:"blendBurn",type:"vec3",inputs:[{name:"base",type:"vec3"},{name:"blend",type:"vec3"}]}),sR=or(([s,e])=>Uf(s.div(e.oneMinus()),1)).setLayout({name:"blendDodge",type:"vec3",inputs:[{name:"base",type:"vec3"},{name:"blend",type:"vec3"}]}),aR=or(([s,e])=>s.oneMinus().mul(e.oneMinus()).oneMinus()).setLayout({name:"blendScreen",type:"vec3",inputs:[{name:"base",type:"vec3"},{name:"blend",type:"vec3"}]}),oR=or(([s,e])=>zo(s.mul(2).mul(e),s.oneMinus().mul(2).mul(e.oneMinus()).oneMinus(),Ib(.5,s))).setLayout({name:"blendOverlay",type:"vec3",inputs:[{name:"base",type:"vec3"},{name:"blend",type:"vec3"}]}),xV=or(([s,e])=>{const t=e.a.add(s.a.mul(e.a.oneMinus()));return Ks(e.rgb.mul(e.a).add(s.rgb.mul(s.a).mul(e.a.oneMinus())).div(t),t)}).setLayout({name:"blendColor",type:"vec4",inputs:[{name:"base",type:"vec4"},{name:"blend",type:"vec4"}]}),lR=or(([s])=>Ks(s.rgb.mul(s.a),s.a),{color:"vec4",return:"vec4"}),bV=or(([s])=>(ra(s.a.equal(0),()=>Ks(0)),Ks(s.rgb.div(s.a),s.a)),{color:"vec4",return:"vec4"}),_V=(...s)=>(Lr('TSL: "burn" has been renamed. Use "blendBurn" instead.'),iR(s)),wV=(...s)=>(Lr('TSL: "dodge" has been renamed. Use "blendDodge" instead.'),sR(s)),SV=(...s)=>(Lr('TSL: "screen" has been renamed. Use "blendScreen" instead.'),aR(s)),MV=(...s)=>(Lr('TSL: "overlay" has been renamed. Use "blendOverlay" instead.'),oR(s));class yc extends Hl{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.maskNode=null,this.positionNode=null,this.geometryNode=null,this.depthNode=null,this.receivedShadowPositionNode=null,this.castShadowPositionNode=null,this.receivedShadowNode=null,this.castShadowNode=null,this.outputNode=null,this.mrtNode=null,this.fragmentNode=null,this.vertexNode=null,this.contextNode=null,Object.defineProperty(this,"shadowPositionNode",{get:()=>this.receivedShadowPositionNode,set:e=>{Lr('NodeMaterial: ".shadowPositionNode" was renamed to ".receivedShadowPositionNode".'),this.receivedShadowPositionNode=e}})}_getNodeChildren(){const e=[];for(const t of Object.getOwnPropertyNames(this)){if(t.startsWith("_")===!0)continue;const n=this[t];n&&n.isNode===!0&&e.push({property:t,childNode:n})}return e}customProgramCacheKey(){const e=[];for(const{property:t,childNode:n}of this._getNodeChildren())e.push(dv(t.slice(0,-4)),n.getCacheKey());return this.type+o0(e)}build(e){this.setup(e)}setupObserver(e){return new X3(e)}setup(e){e.context.setupNormal=()=>vv(this.setupNormal(e),"NORMAL","vec3"),e.context.setupPositionView=()=>this.setupPositionView(e),e.context.setupModelViewProjection=()=>this.setupModelViewProjection(e);const t=e.renderer,n=t.getRenderTarget();t.contextNode.isContextNode===!0?e.context=rl(rl({},e.context),t.contextNode.getFlowContextData()):Gr('NodeMaterial: "renderer.contextNode" must be an instance of `context()`.'),this.contextNode!==null&&(this.contextNode.isContextNode===!0?e.context=rl(rl({},e.context),this.contextNode.getFlowContextData()):Gr('NodeMaterial: "material.contextNode" must be an instance of `context()`.')),e.addStack();const i=vv(this.setupVertex(e),"VERTEX"),a=this.vertexNode||i;e.stack.outputNode=a,this.setupHardwareClipping(e),this.geometryNode!==null&&(e.stack.outputNode=e.stack.outputNode.bypass(this.geometryNode)),e.addFlow("vertex",e.removeStack()),e.addStack();let o;const u=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 c=this.setupLighting(e);u!==null&&e.stack.addToStack(u);const d=Ks(c,Wl.a).max(0);o=this.setupOutput(e,d),gv.assign(o);const g=this.outputNode!==null;if(g&&(o=this.outputNode),e.context.getOutput&&(o=e.context.getOutput(o,e)),n!==null){const v=t.getMRT(),M=this.mrtNode;v!==null?(g&&gv.assign(o),o=v,M!==null&&(o=v.merge(M))):M!==null&&(o=M)}}else{let c=this.fragmentNode;c.isOutputStructNode!==!0&&(c=Ks(c)),o=this.setupOutput(e,c)}e.stack.outputNode=o,e.addFlow("fragment",e.removeStack()),e.observer=this.setupObserver(e)}setupClipping(e){if(e.clippingContext===null)return null;const{unionPlanes:t,intersectionPlanes:n}=e.clippingContext;let i=null;if(t.length>0||n.length>0){const a=e.renderer.currentSamples;this.alphaToCoverage&&a>1?i=pV():e.stack.addToStack(AV())}return i}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.addToStack(gV()),this.hardwareClipping=!0)}setupDepth(e){const{renderer:t,camera:n}=e;let i=this.depthNode;if(i===null){const a=t.getMRT();a&&a.has("depth")?i=a.get("depth"):t.logarithmicDepthBuffer===!0&&(n.isPerspectiveCamera?i=FS(Oc.z,qg,Jg):i=Ev(Oc.z,qg,Jg))}i!==null&&PS.assign(i).toStack()}setupPositionView(){return cg.mul(vc).xyz}setupModelViewProjection(){return of.mul(Oc)}setupVertex(e){return e.addStack(),this.setupPosition(e),e.context.vertex=e.removeStack(),z2}setupPosition(e){const{object:t,geometry:n}=e;if((n.morphAttributes.position||n.morphAttributes.normal||n.morphAttributes.color)&&q2(t).toStack(),t.isSkinnedMesh===!0&&X2(t).toStack(),this.displacementMap){const i=em("displacementMap","texture"),a=em("displacementScale","float"),o=em("displacementBias","float");vc.addAssign(Of.normalize().mul(i.x.mul(a).add(o)))}return t.isBatchedMesh&&Z2(t).toStack(),t.isInstancedMesh&&t.instanceMatrix&&t.instanceMatrix.isInstancedBufferAttribute===!0&&W2(t).toStack(),this.positionNode!==null&&vc.assign(vv(this.positionNode,"POSITION","vec3")),vc}setupDiffuseColor(e){const{object:t,geometry:n}=e;this.maskNode!==null&&WA(this.maskNode).not().discard();let i=this.colorNode?Ks(this.colorNode):Wb;this.vertexColors===!0&&n.hasAttribute("color")&&(i=i.mul(rR())),t.instanceColor&&(i=cA("vec3","vInstanceColor").mul(i)),t.isBatchedMesh&&t._colorsTexture&&(i=cA("vec3","vBatchColor").mul(i)),Wl.assign(i);const a=this.opacityNode?qt(this.opacityNode):Zb;Wl.a.assign(Wl.a.mul(a));let o=null;(this.alphaTestNode!==null||this.alphaTest>0)&&(o=this.alphaTestNode!==null?qt(this.alphaTestNode):p2,this.alphaToCoverage===!0?(Wl.a=fA(o,o.add(H1(Wl.a)),Wl.a),Wl.a.lessThanEqual(0).discard()):Wl.a.lessThanEqual(o).discard()),this.alphaHash===!0&&Wl.a.lessThan(vV(vc)).discard(),e.isOpaque()&&Wl.a.assign(1)}setupVariants(){}setupOutgoingLight(){return this.lights===!0?Kn(0):Wl.rgb}setupNormal(){return this.normalNode?Kn(this.normalNode):_2}setupEnvironment(){let e=null;return this.envNode?e=this.envNode:this.envMap&&(e=this.envMap.isCubeTexture?em("envMap","cubeTexture"):em("envMap","texture")),e}setupLightMap(e){let t=null;return e.material.lightMap&&(t=new lV(CS)),t}setupLights(e){const t=[],n=this.setupEnvironment(e);n&&n.isLightingNode&&t.push(n);const i=this.setupLightMap(e);i&&i.isLightingNode&&t.push(i);let a=this.aoNode;a===null&&e.material.aoMap&&(a=V2),e.context.getAO&&(a=e.context.getAO(a,e)),a&&t.push(new aV(a));let o=this.lightsNode||e.lightsNode;return t.length>0&&(o=e.renderer.lighting.createNode([...o.getLights(),...t])),o}setupLightingModel(){}setupLighting(e){const{material:t}=e,{backdropNode:n,backdropAlphaNode:i,emissiveNode:a}=this,u=this.lights===!0||this.lightsNode!==null?this.setupLights(e):null;let c=this.setupOutgoingLight(e);if(u&&u.getScope().hasLights){const d=this.setupLightingModel(e)||null;c=J2(u,d,n,i)}else n!==null&&(c=Kn(i!==null?zo(c,n,i):n));return(a&&a.isNode===!0||t.emissive&&t.emissive.isColor===!0)&&(E1.assign(Kn(a||m2)),c=c.add(E1)),c}setupFog(e,t){const n=e.fogNode;return n&&(gv.assign(t),t=Ks(n.toVar())),t}setupPremultipliedAlpha(e,t){return lR(t)}setupOutput(e,t){return this.fog===!0&&(t=this.setupFog(e,t)),this.premultipliedAlpha===!0&&(t=this.setupPremultipliedAlpha(e,t)),t}setDefaultValues(e){for(const n in e){const i=e[n];this[n]===void 0&&(this[n]=i,i&&i.clone&&(this[n]=i.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=Hl.prototype.toJSON.call(this,e);n.inputNodes={};for(const{property:a,childNode:o}of this._getNodeChildren())n.inputNodes[a]=o.toJSON(e).uuid;function i(a){const o=[];for(const u in a){const c=a[u];delete c.metadata,o.push(c)}return o}if(t){const a=i(e.textures),o=i(e.images),u=i(e.nodes);a.length>0&&(n.textures=a),o.length>0&&(n.images=o),u.length>0&&(n.nodes=u)}return n}copy(e){return this.lightsNode=e.lightsNode,this.envNode=e.envNode,this.aoNode=e.aoNode,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.maskNode=e.maskNode,this.positionNode=e.positionNode,this.geometryNode=e.geometryNode,this.depthNode=e.depthNode,this.receivedShadowPositionNode=e.receivedShadowPositionNode,this.castShadowPositionNode=e.castShadowPositionNode,this.receivedShadowNode=e.receivedShadowNode,this.castShadowNode=e.castShadowNode,this.outputNode=e.outputNode,this.mrtNode=e.mrtNode,this.fragmentNode=e.fragmentNode,this.vertexNode=e.vertexNode,this.contextNode=e.contextNode,super.copy(e)}}const EV=new fl;class CV extends yc{static get type(){return"LineBasicNodeMaterial"}constructor(e){super(),this.isLineBasicNodeMaterial=!0,this.setDefaultValues(EV),this.setValues(e)}}const TV=new xm;class BV extends yc{static get type(){return"LineDashedNodeMaterial"}constructor(e){super(),this.isLineDashedNodeMaterial=!0,this.setDefaultValues(TV),this.dashOffset=0,this.offsetNode=null,this.dashScaleNode=null,this.dashSizeNode=null,this.gapSizeNode=null,this.setValues(e)}setupVariants(){const e=this.offsetNode?qt(this.offsetNode):ES,t=this.dashScaleNode?qt(this.dashScaleNode):wS,n=this.dashSizeNode?qt(this.dashSizeNode):SS,i=this.gapSizeNode?qt(this.gapSizeNode):MS;p0.assign(n),Py.assign(i);const a=lg(af("lineDistance").mul(t));(e?a.add(e):a).mod(p0.add(Py)).greaterThan(p0).discard()}}let Yb=null;class RV extends Xb{static get type(){return"ViewportSharedTextureNode"}constructor(e=Yg,t=null){Yb===null&&(Yb=new OA),super(e,t,Yb)}getTextureForReference(){return Yb}updateReference(){return this}}const uR=to(RV).setParameterLength(0,2),IV=new xm;class kX extends null{static get type(){return"Line2NodeMaterial"}constructor(e={}){super(),this.isLine2NodeMaterial=!0,this.setDefaultValues(IV),this.useColor=e.vertexColors,this.dashOffset=0,this.lineColorNode=null,this.offsetNode=null,this.dashScaleNode=null,this.dashSizeNode=null,this.gapSizeNode=null,this.blending=NoBlending,this._useDash=e.dashed,this._useAlphaToCoverage=!0,this._useWorldUnits=!1,this.setValues(e)}setup(e){const{renderer:t}=e,n=this._useAlphaToCoverage,i=this.useColor,a=this._useDash,o=this._useWorldUnits,u=or(({start:d,end:g})=>{const v=of.element(2).element(2),I=of.element(3).element(2).mul(-.5).div(v).sub(d.z).div(g.z.sub(d.z));return Ks(zo(d.xyz,g.xyz,I),g.w)}).setLayout({name:"trimSegment",type:"vec4",inputs:[{name:"start",type:"vec4"},{name:"end",type:"vec4"}]});this.vertexNode=or(()=>{const d=af("instanceStart"),g=af("instanceEnd"),v=Ks(cg.mul(Ks(d,1))).toVar("start"),M=Ks(cg.mul(Ks(g,1))).toVar("end");if(a){const nt=this.dashScaleNode?qt(this.dashScaleNode):wS,Ye=this.offsetNode?qt(this.offsetNode):ES,ht=af("instanceDistanceStart"),Rt=af("instanceDistanceEnd");let qe=cd.y.lessThan(.5).select(nt.mul(ht),nt.mul(Rt));qe=qe.add(Ye),cA("float","lineDistance").assign(qe)}o&&(cA("vec3","worldStart").assign(v.xyz),cA("vec3","worldEnd").assign(M.xyz));const B=xv.z.div(xv.w),I=of.element(2).element(3).equal(-1);ra(I,()=>{ra(v.z.lessThan(0).and(M.z.greaterThan(0)),()=>{M.assign(u({start:v,end:M}))}).ElseIf(M.z.lessThan(0).and(v.z.greaterThanEqual(0)),()=>{v.assign(u({start:M,end:v}))})});const ne=of.mul(v),ee=of.mul(M),q=ne.xyz.div(ne.w),ye=ee.xyz.div(ee.w),Ce=ye.xy.sub(q.xy).toVar();Ce.x.assign(Ce.x.mul(B)),Ce.assign(Ce.normalize());const ke=Ks().toVar();if(o){const nt=M.xyz.sub(v.xyz).normalize(),Ye=zo(v.xyz,M.xyz,.5).normalize(),ht=nt.cross(Ye).normalize(),Rt=nt.cross(ht),qe=cA("vec4","worldPos");qe.assign(cd.y.lessThan(.5).select(v,M));const pt=$b.mul(.5);qe.addAssign(Ks(cd.x.lessThan(0).select(ht.mul(pt),ht.mul(pt).negate()),0)),a||(qe.addAssign(Ks(cd.y.lessThan(.5).select(nt.mul(pt).negate(),nt.mul(pt)),0)),qe.addAssign(Ks(Rt.mul(pt),0)),ra(cd.y.greaterThan(1).or(cd.y.lessThan(0)),()=>{qe.subAssign(Ks(Rt.mul(2).mul(pt),0))})),ke.assign(of.mul(qe));const xn=Kn().toVar();xn.assign(cd.y.lessThan(.5).select(q,ye)),ke.z.assign(xn.z.mul(ke.w))}else{const nt=Gi(Ce.y,Ce.x.negate()).toVar("offset");Ce.x.assign(Ce.x.div(B)),nt.x.assign(nt.x.div(B)),nt.assign(cd.x.lessThan(0).select(nt.negate(),nt)),ra(cd.y.lessThan(0),()=>{nt.assign(nt.sub(Ce))}).ElseIf(cd.y.greaterThan(1),()=>{nt.assign(nt.add(Ce))}),nt.assign(nt.mul($b)),nt.assign(nt.div(xv.w.div(aS))),ke.assign(cd.y.lessThan(.5).select(ne,ee)),nt.assign(nt.mul(ke.w)),ke.assign(ke.add(Ks(nt,0,0)))}return ke})();const c=or(({p1:d,p2:g,p3:v,p4:M})=>{const B=d.sub(v),I=M.sub(v),ne=g.sub(d),ee=B.dot(I),q=I.dot(ne),ye=B.dot(ne),Ce=I.dot(I),nt=ne.dot(ne).mul(Ce).sub(q.mul(q)),ht=ee.mul(q).sub(ye.mul(Ce)).div(nt).clamp(),Rt=ee.add(q.mul(ht)).div(Ce).clamp();return Gi(ht,Rt)});if(this.colorNode=or(()=>{const d=Zl();if(a){const M=this.dashSizeNode?qt(this.dashSizeNode):SS,B=this.gapSizeNode?qt(this.gapSizeNode):MS;p0.assign(M),Py.assign(B);const I=cA("float","lineDistance");d.y.lessThan(-1).or(d.y.greaterThan(1)).discard(),I.mod(p0.add(Py)).greaterThan(p0).discard()}const g=qt(1).toVar("alpha");if(o){const M=cA("vec3","worldStart"),B=cA("vec3","worldEnd"),I=cA("vec4","worldPos").xyz.normalize().mul(1e5),ne=B.sub(M),ee=c({p1:M,p2:B,p3:Kn(0,0,0),p4:I}),q=M.add(ne.mul(ee.x)),ye=I.mul(ee.y),nt=q.sub(ye).length().div($b);if(!a)if(n&&t.currentSamples>0){const Ye=nt.fwidth();g.assign(fA(Ye.negate().add(.5),Ye.add(.5),nt).oneMinus())}else nt.greaterThan(.5).discard()}else if(n&&t.currentSamples>0){const M=d.x,B=d.y.greaterThan(0).select(d.y.sub(1),d.y.add(1)),I=M.mul(M).add(B.mul(B)),ne=qt(I.fwidth()).toVar("dlen");ra(d.y.abs().greaterThan(1),()=>{g.assign(fA(ne.oneMinus(),ne.add(1),I).oneMinus())})}else ra(d.y.abs().greaterThan(1),()=>{const M=d.x,B=d.y.greaterThan(0).select(d.y.sub(1),d.y.add(1));M.mul(M).add(B.mul(B)).greaterThan(1).discard()});let v;if(this.lineColorNode)v=this.lineColorNode;else if(i){const M=af("instanceColorStart"),B=af("instanceColorEnd");v=cd.y.lessThan(.5).select(M,B).mul(Wb)}else v=Wb;return Ks(v,g)})(),this.transparent){const d=this.opacityNode?qt(this.opacityNode):Zb;this.outputNode=Ks(this.colorNode.rgb.mul(d).add(uR().rgb.mul(d.oneMinus())),this.colorNode.a)}super.setup(e)}get worldUnits(){return this._useWorldUnits}set worldUnits(e){this._useWorldUnits!==e&&(this._useWorldUnits=e,this.needsUpdate=!0)}get dashed(){return this._useDash}set dashed(e){this._useDash!==e&&(this._useDash=e,this.needsUpdate=!0)}get alphaToCoverage(){return this._useAlphaToCoverage}set alphaToCoverage(e){this._useAlphaToCoverage!==e&&(this._useAlphaToCoverage=e,this.needsUpdate=!0)}}const NV=new V0;class FV extends yc{static get type(){return"MeshNormalNodeMaterial"}constructor(e){super(),this.isMeshNormalNodeMaterial=!0,this.setDefaultValues(NV),this.setValues(e)}setupDiffuseColor(){const e=this.opacityNode?qt(this.opacityNode):Zb;Wl.assign(Pb(Ks(f2(cl),e),sl))}}const LS=or(([s=cS])=>{const e=s.z.atan(s.x).mul(1/(Math.PI*2)).add(.5),t=s.y.clamp(-1,1).asin().mul(1/Math.PI).add(.5);return Gi(e,t)});class cR extends Mc{constructor(e=1,t={}){super(e,t),this.isCubeRenderTarget=!0}fromEquirectangularTexture(e,t){const n=t.minFilter,i=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 a=new bd(5,5,5),o=LS(cS),u=new yc;u.colorNode=xl(t,o,0),u.side=de,u.blending=we;const c=new Il(a,u),d=new _d;d.add(c),t.minFilter===yi&&(t.minFilter=vr);const g=new Np(1,10,this),v=e.getMRT();return e.setMRT(null),g.update(e,d),e.setMRT(v),t.minFilter=n,t.currentGenerateMipmaps=i,c.geometry.dispose(),c.material.dispose(),this}}const Qy=new WeakMap;class PV extends pc{static get type(){return"CubeMapNode"}constructor(e){super("vec3"),this.envNode=e,this._cubeTexture=null,this._cubeTextureNode=lf(null);const t=new rh;t.isRenderTargetTexture=!0,this._defaultTexture=t,this.updateBeforeType=Ao.RENDER}updateBefore(e){const{renderer:t,material:n}=e,i=this.envNode;if(i.isTextureNode||i.isMaterialReferenceNode){const a=i.isTextureNode?i.value:n[i.property];if(a&&a.isTexture){const o=a.mapping;if(o===ot||o===ut){if(Qy.has(a)){const u=Qy.get(a);dR(u,a.mapping),this._cubeTexture=u}else{const u=a.image;if(LV(u)){const c=new cR(u.height);c.fromEquirectangularTexture(t,a),dR(c.texture,a.mapping),this._cubeTexture=c.texture,Qy.set(a,c.texture),a.addEventListener("dispose",hR)}else this._cubeTexture=this._defaultTexture}this._cubeTextureNode.value=this._cubeTexture}else this._cubeTextureNode=this.envNode}}}setup(e){return this.updateBefore(e),this._cubeTextureNode}}function LV(s){return s==null?!1:s.height>0}function hR(s){const e=s.target;e.removeEventListener("dispose",hR);const t=Qy.get(e);t!==void 0&&(Qy.delete(e),t.dispose())}function dR(s,e){e===ot?s.mapping=it:e===ut&&(s.mapping=wt)}const fR=to(PV).setParameterLength(1);class US extends Sv{static get type(){return"BasicEnvironmentNode"}constructor(e=null){super(),this.envNode=e}setup(e){e.context.environment=fR(this.envNode)}}class UV extends Sv{static get type(){return"BasicLightMapNode"}constructor(e=null){super(),this.lightMapNode=e}setup(e){const t=qt(1/Math.PI);e.context.irradianceLightMap=this.lightMapNode.mul(t)}}class qb{start(e){e.lightsNode.setupLights(e,e.lightsNode.getLightNodes(e)),this.indirect(e)}finish(){}direct(){}directRectArea(){}indirect(){}ambientOcclusion(){}}class AR extends qb{constructor(){super()}indirect({context:e}){const t=e.ambientOcclusion,n=e.reflectedLight,i=e.irradianceLightMap;n.indirectDiffuse.assign(Ks(0)),i?n.indirectDiffuse.addAssign(i):n.indirectDiffuse.addAssign(Ks(1,1,1,0)),n.indirectDiffuse.mulAssign(t),n.indirectDiffuse.mulAssign(Wl.rgb)}finish(e){const{material:t,context:n}=e,i=n.outgoingLight,a=e.context.environment;if(a)switch(t.combine){case on:i.rgb.assign(zo(i.rgb,i.rgb.mul(a.rgb),Hy.mul(Kb)));break;case hn:i.rgb.assign(zo(i.rgb,a.rgb,Hy.mul(Kb)));break;case lt:i.rgb.addAssign(a.rgb.mul(Hy.mul(Kb)));break;default:Lr("BasicLightingModel: Unsupported .combine value:",t.combine);break}}}const OV=new Yl;class DV extends yc{static get type(){return"MeshBasicNodeMaterial"}constructor(e){super(),this.isMeshBasicNodeMaterial=!0,this.lights=!0,this.setDefaultValues(OV),this.setValues(e)}setupNormal(){return bv(_v)}setupEnvironment(e){const t=super.setupEnvironment(e);return t?new US(t):null}setupLightMap(e){let t=null;return e.material.lightMap&&(t=new UV(CS)),t}setupOutgoingLight(){return Wl.rgb}setupLightingModel(){return new AR}}const Tv=or(({f0:s,f90:e,dotVH:t})=>{const n=t.mul(-5.55473).sub(6.98316).mul(t).exp2();return s.mul(n.oneMinus()).add(e.mul(n))}),x0=or(s=>s.diffuseColor.mul(1/Math.PI)),kV=()=>qt(.25),VV=or(({dotNH:s})=>Sb.mul(qt(.5)).add(1).mul(qt(1/Math.PI)).mul(s.pow(Sb))),zV=or(({lightDirection:s})=>{const e=s.add(iu).normalize(),t=cl.dot(e).clamp(),n=iu.dot(e).clamp(),i=Tv({f0:Pm,f90:1,dotVH:n}),a=kV(),o=VV({dotNH:t});return i.mul(a).mul(o)});class pR extends AR{constructor(e=!0){super(),this.specular=e}direct({lightDirection:e,lightColor:t,reflectedLight:n}){const a=cl.dot(e).clamp().mul(t);n.directDiffuse.addAssign(a.mul(x0({diffuseColor:Wl.rgb}))),this.specular===!0&&n.directSpecular.addAssign(a.mul(zV({lightDirection:e})).mul(Hy))}indirect(e){const{ambientOcclusion:t,irradiance:n,reflectedLight:i}=e.context;i.indirectDiffuse.addAssign(n.mul(x0({diffuseColor:Wl}))),i.indirectDiffuse.mulAssign(t)}}const GV=new qm;class HV extends yc{static get type(){return"MeshLambertNodeMaterial"}constructor(e){super(),this.isMeshLambertNodeMaterial=!0,this.lights=!0,this.setDefaultValues(GV),this.setValues(e)}setupEnvironment(e){const t=super.setupEnvironment(e);return t?new US(t):null}setupLightingModel(){return new pR(!1)}}const QV=new Xv;class WV extends yc{static get type(){return"MeshPhongNodeMaterial"}constructor(e){super(),this.isMeshPhongNodeMaterial=!0,this.lights=!0,this.shininessNode=null,this.specularNode=null,this.setDefaultValues(QV),this.setValues(e)}setupEnvironment(e){const t=super.setupEnvironment(e);return t?new US(t):null}setupLightingModel(){return new pR}setupVariants(){const e=(this.shininessNode?qt(this.shininessNode):g2).max(1e-4);Sb.assign(e);const t=this.specularNode||v2;Pm.assign(t)}copy(e){return this.shininessNode=e.shininessNode,this.specularNode=e.specularNode,super.copy(e)}}const gR=or(s=>{if(s.geometry.hasAttribute("normal")===!1)return qt(0);const e=_v.dFdx().abs().max(_v.dFdy().abs());return e.x.max(e.y).max(e.z)}),OS=or(s=>{const{roughness:e}=s,t=gR();let n=e.max(.0525);return n=n.add(t),n=n.min(1),n}),mR=or(({alpha:s,dotNL:e,dotNV:t})=>{const n=s.pow2(),i=e.mul(n.add(n.oneMinus().mul(t.pow2())).sqrt()),a=t.mul(n.add(n.oneMinus().mul(e.pow2())).sqrt());return dA(.5,i.add(a).max(P1))}).setLayout({name:"V_GGX_SmithCorrelated",type:"float",inputs:[{name:"alpha",type:"float"},{name:"dotNL",type:"float"},{name:"dotNV",type:"float"}]}),ZV=or(({alphaT:s,alphaB:e,dotTV:t,dotBV:n,dotTL:i,dotBL:a,dotNV:o,dotNL:u})=>{const c=u.mul(Kn(s.mul(t),e.mul(n),o).length()),d=o.mul(Kn(s.mul(i),e.mul(a),u).length());return dA(.5,c.add(d))}).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"}]}),vR=or(({alpha:s,dotNH:e})=>{const t=s.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"}]}),KV=qt(1/Math.PI),$V=or(({alphaT:s,alphaB:e,dotNH:t,dotTH:n,dotBH:i})=>{const a=s.mul(e),o=Kn(e.mul(n),s.mul(i),a.mul(t)),u=o.dot(o),c=a.div(u);return KV.mul(a.mul(c.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"}]}),DS=or(({lightDirection:s,f0:e,f90:t,roughness:n,f:i,normalView:a=cl,USE_IRIDESCENCE:o,USE_ANISOTROPY:u})=>{const c=n.pow2(),d=s.add(iu).normalize(),g=a.dot(s).clamp(),v=a.dot(iu).clamp(),M=a.dot(d).clamp(),B=iu.dot(d).clamp();let I=Tv({f0:e,f90:t,dotVH:B}),ne,ee;if(By(o)&&(I=xb.mix(I,i)),By(u)){const q=Fy.dot(s),ye=Fy.dot(iu),Ce=Fy.dot(d),ke=f0.dot(s),nt=f0.dot(iu),Ye=f0.dot(d);ne=ZV({alphaT:wb,alphaB:c,dotTV:ye,dotBV:nt,dotTL:q,dotBL:ke,dotNV:v,dotNL:g}),ee=$V({alphaT:wb,alphaB:c,dotNH:M,dotTH:Ce,dotBH:Ye})}else ne=mR({alpha:c,dotNL:g,dotNV:v}),ee=vR({alpha:c,dotNH:M});return I.mul(ne).mul(ee)}),XV=new Uint16Array([12469,15057,12620,14925,13266,14620,13807,14376,14323,13990,14545,13625,14713,13328,14840,12882,14931,12528,14996,12233,15039,11829,15066,11525,15080,11295,15085,10976,15082,10705,15073,10495,13880,14564,13898,14542,13977,14430,14158,14124,14393,13732,14556,13410,14702,12996,14814,12596,14891,12291,14937,11834,14957,11489,14958,11194,14943,10803,14921,10506,14893,10278,14858,9960,14484,14039,14487,14025,14499,13941,14524,13740,14574,13468,14654,13106,14743,12678,14818,12344,14867,11893,14889,11509,14893,11180,14881,10751,14852,10428,14812,10128,14765,9754,14712,9466,14764,13480,14764,13475,14766,13440,14766,13347,14769,13070,14786,12713,14816,12387,14844,11957,14860,11549,14868,11215,14855,10751,14825,10403,14782,10044,14729,9651,14666,9352,14599,9029,14967,12835,14966,12831,14963,12804,14954,12723,14936,12564,14917,12347,14900,11958,14886,11569,14878,11247,14859,10765,14828,10401,14784,10011,14727,9600,14660,9289,14586,8893,14508,8533,15111,12234,15110,12234,15104,12216,15092,12156,15067,12010,15028,11776,14981,11500,14942,11205,14902,10752,14861,10393,14812,9991,14752,9570,14682,9252,14603,8808,14519,8445,14431,8145,15209,11449,15208,11451,15202,11451,15190,11438,15163,11384,15117,11274,15055,10979,14994,10648,14932,10343,14871,9936,14803,9532,14729,9218,14645,8742,14556,8381,14461,8020,14365,7603,15273,10603,15272,10607,15267,10619,15256,10631,15231,10614,15182,10535,15118,10389,15042,10167,14963,9787,14883,9447,14800,9115,14710,8665,14615,8318,14514,7911,14411,7507,14279,7198,15314,9675,15313,9683,15309,9712,15298,9759,15277,9797,15229,9773,15166,9668,15084,9487,14995,9274,14898,8910,14800,8539,14697,8234,14590,7790,14479,7409,14367,7067,14178,6621,15337,8619,15337,8631,15333,8677,15325,8769,15305,8871,15264,8940,15202,8909,15119,8775,15022,8565,14916,8328,14804,8009,14688,7614,14569,7287,14448,6888,14321,6483,14088,6171,15350,7402,15350,7419,15347,7480,15340,7613,15322,7804,15287,7973,15229,8057,15148,8012,15046,7846,14933,7611,14810,7357,14682,7069,14552,6656,14421,6316,14251,5948,14007,5528,15356,5942,15356,5977,15353,6119,15348,6294,15332,6551,15302,6824,15249,7044,15171,7122,15070,7050,14949,6861,14818,6611,14679,6349,14538,6067,14398,5651,14189,5311,13935,4958,15359,4123,15359,4153,15356,4296,15353,4646,15338,5160,15311,5508,15263,5829,15188,6042,15088,6094,14966,6001,14826,5796,14678,5543,14527,5287,14377,4985,14133,4586,13869,4257,15360,1563,15360,1642,15358,2076,15354,2636,15341,3350,15317,4019,15273,4429,15203,4732,15105,4911,14981,4932,14836,4818,14679,4621,14517,4386,14359,4156,14083,3795,13808,3437,15360,122,15360,137,15358,285,15355,636,15344,1274,15322,2177,15281,2765,15215,3223,15120,3451,14995,3569,14846,3567,14681,3466,14511,3305,14344,3121,14037,2800,13753,2467,15360,0,15360,1,15359,21,15355,89,15346,253,15325,479,15287,796,15225,1148,15133,1492,15008,1749,14856,1882,14685,1886,14506,1783,14324,1608,13996,1398,13702,1183]);let dg=null;const Wy=or(({roughness:s,dotNV:e})=>{dg===null&&(dg=new ah(XV,16,16,ze,Wt),dg.name="DFG_LUT",dg.minFilter=vr,dg.magFilter=vr,dg.wrapS=Vt,dg.wrapT=Vt,dg.generateMipmaps=!1,dg.needsUpdate=!0);const t=Gi(s,e);return xl(dg,t).rg}),jV=or(({lightDirection:s,f0:e,f90:t,roughness:n,f:i,USE_IRIDESCENCE:a,USE_ANISOTROPY:o})=>{const u=DS({lightDirection:s,f0:e,f90:t,roughness:n,f:i,USE_IRIDESCENCE:a,USE_ANISOTROPY:o}),c=cl.dot(s).clamp(),d=cl.dot(iu).clamp(),g=Wy({roughness:n,dotNV:d}),v=Wy({roughness:n,dotNV:c}),M=e.mul(g.x).add(t.mul(g.y)),B=e.mul(v.x).add(t.mul(v.y)),I=g.x.add(g.y),ne=v.x.add(v.y),ee=qt(1).sub(I),q=qt(1).sub(ne),ye=e.add(e.oneMinus().mul(.047619)),Ce=M.mul(B).mul(ye).div(qt(1).sub(ee.mul(q).mul(ye).mul(ye)).add(P1)),ke=ee.mul(q),nt=Ce.mul(ke);return u.add(nt)}),yR=or(s=>{const{dotNV:e,specularColor:t,specularF90:n,roughness:i}=s,a=Wy({dotNV:e,roughness:i});return t.mul(a.x).add(n.mul(a.y))}),kS=or(({f:s,f90:e,dotVH:t})=>{const n=t.oneMinus().saturate(),i=n.mul(n),a=n.mul(i,i).clamp(0,.9999);return s.sub(Kn(e).mul(a)).div(a.oneMinus())}).setLayout({name:"Schlick_to_F0",type:"vec3",inputs:[{name:"f",type:"vec3"},{name:"f90",type:"float"},{name:"dotVH",type:"float"}]}),YV=or(({roughness:s,dotNH:e})=>{const t=s.pow2(),n=qt(1).div(t),a=e.pow2().oneMinus().max(.0078125);return qt(2).add(n).mul(a.pow(n.mul(.5))).div(2*Math.PI)}).setLayout({name:"D_Charlie",type:"float",inputs:[{name:"roughness",type:"float"},{name:"dotNH",type:"float"}]}),qV=or(({dotNV:s,dotNL:e})=>qt(1).div(qt(4).mul(e.add(s).sub(e.mul(s))))).setLayout({name:"V_Neubelt",type:"float",inputs:[{name:"dotNV",type:"float"},{name:"dotNL",type:"float"}]}),JV=or(({lightDirection:s})=>{const e=s.add(iu).normalize(),t=cl.dot(s).clamp(),n=cl.dot(iu).clamp(),i=cl.dot(e).clamp(),a=YV({roughness:Nm,dotNH:i}),o=qV({dotNV:n,dotNL:t});return hA.mul(a).mul(o)}),ez=or(({N:s,V:e,roughness:t})=>{const a=.0078125,o=s.dot(e).saturate(),u=Gi(t,o.oneMinus().sqrt());return u.assign(u.mul(.984375).add(a)),u}).setLayout({name:"LTC_Uv",type:"vec2",inputs:[{name:"N",type:"vec3"},{name:"V",type:"vec3"},{name:"roughness",type:"float"}]}),xR=or(({f:s})=>{const e=s.length();return mc(e.mul(e).add(s.z).div(e.add(1)),0)}).setLayout({name:"LTC_ClippedSphereFormFactor",type:"float",inputs:[{name:"f",type:"vec3"}]}),Dm=or(({v1:s,v2:e})=>{const t=s.dot(e),n=t.abs().toVar(),i=n.mul(.0145206).add(.4965155).mul(n).add(.8543985).toVar(),a=n.add(4.1616724).mul(n).add(3.417594).toVar(),o=i.div(a),u=t.greaterThan(0).select(o,mc(t.mul(t).oneMinus(),1e-7).inverseSqrt().mul(.5).sub(o));return s.cross(e).mul(u)}).setLayout({name:"LTC_EdgeVectorFormFactor",type:"vec3",inputs:[{name:"v1",type:"vec3"},{name:"v2",type:"vec3"}]}),bR=or(({N:s,V:e,P:t,mInv:n,p0:i,p1:a,p2:o,p3:u})=>{const c=a.sub(i).toVar(),d=u.sub(i).toVar(),g=c.cross(d),v=Kn().toVar();return ra(g.dot(t.sub(i)).greaterThanEqual(0),()=>{const M=e.sub(s.mul(e.dot(s))).normalize(),B=s.cross(M).negate(),I=n.mul(ld(M,B,s).transpose()).toVar(),ne=I.mul(i.sub(t)).normalize().toVar(),ee=I.mul(a.sub(t)).normalize().toVar(),q=I.mul(o.sub(t)).normalize().toVar(),ye=I.mul(u.sub(t)).normalize().toVar(),Ce=Kn(0).toVar();Ce.addAssign(Dm({v1:ne,v2:ee})),Ce.addAssign(Dm({v1:ee,v2:q})),Ce.addAssign(Dm({v1:q,v2:ye})),Ce.addAssign(Dm({v1:ye,v2:ne})),v.assign(Kn(xR({f:Ce})))}),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"}]}),tz=or(({P:s,p0:e,p1:t,p2:n,p3:i})=>{const a=t.sub(e).toVar(),o=i.sub(e).toVar(),u=a.cross(o),c=Kn().toVar();return ra(u.dot(s.sub(e)).greaterThanEqual(0),()=>{const d=e.sub(s).normalize().toVar(),g=t.sub(s).normalize().toVar(),v=n.sub(s).normalize().toVar(),M=i.sub(s).normalize().toVar(),B=Kn(0).toVar();B.addAssign(Dm({v1:d,v2:g})),B.addAssign(Dm({v1:g,v2:v})),B.addAssign(Dm({v1:v,v2:M})),B.addAssign(Dm({v1:M,v2:d})),c.assign(Kn(xR({f:B.abs()})))}),c}).setLayout({name:"LTC_Evaluate",type:"vec3",inputs:[{name:"P",type:"vec3"},{name:"p0",type:"vec3"},{name:"p1",type:"vec3"},{name:"p2",type:"vec3"},{name:"p3",type:"vec3"}]}),Jb=1/6,_R=s=>no(Jb,no(s,no(s,s.negate().add(3)).sub(3)).add(1)),VS=s=>no(Jb,no(s,no(s,no(3,s).sub(6))).add(4)),wR=s=>no(Jb,no(s,no(s,no(-3,s).add(3)).add(3)).add(1)),zS=s=>no(Jb,KA(s,3)),SR=s=>_R(s).add(VS(s)),MR=s=>wR(s).add(zS(s)),ER=s=>$c(-1,VS(s).div(_R(s).add(VS(s)))),CR=s=>$c(1,zS(s).div(wR(s).add(zS(s)))),TR=(s,e,t)=>{const n=s.uvNode,i=no(n,e.zw).add(.5),a=ag(i),o=_p(i),u=SR(o.x),c=MR(o.x),d=ER(o.x),g=CR(o.x),v=ER(o.y),M=CR(o.y),B=Gi(a.x.add(d),a.y.add(v)).sub(.5).mul(e.xy),I=Gi(a.x.add(g),a.y.add(v)).sub(.5).mul(e.xy),ne=Gi(a.x.add(d),a.y.add(M)).sub(.5).mul(e.xy),ee=Gi(a.x.add(g),a.y.add(M)).sub(.5).mul(e.xy),q=SR(o.y).mul($c(u.mul(s.sample(B).level(t)),c.mul(s.sample(I).level(t)))),ye=MR(o.y).mul($c(u.mul(s.sample(ne).level(t)),c.mul(s.sample(ee).level(t))));return q.add(ye)},GS=or(([s,e])=>{const t=Gi(s.size(Qn(e))),n=Gi(s.size(Qn(e.add(1)))),i=dA(1,t),a=dA(1,n),o=TR(s,Ks(i,t),ag(e)),u=TR(s,Ks(a,n),Bb(e));return _p(e).mix(o,u)}),nz=or(([s,e])=>{const t=e.mul(rS(s));return GS(s,t)}),BR=or(([s,e,t,n,i])=>{const a=Kn(K1(e.negate(),rf(s),dA(1,n))),o=Kn(og(i[0].xyz),og(i[1].xyz),og(i[2].xyz));return rf(a).mul(t.mul(o))}).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"}]}),rz=or(([s,e])=>s.mul(Sp(e.mul(2).sub(2),0,1))).setLayout({name:"applyIorToRoughness",type:"float",inputs:[{name:"roughness",type:"float"},{name:"ior",type:"float"}]}),iz=BS(),sz=BS(),RR=or(([s,e,t],{material:n})=>{const a=(n.side===de?iz:sz).sample(s),o=sg(g0.x).mul(rz(e,t));return GS(a,o)}),IR=or(([s,e,t])=>(ra(t.notEqual(0),()=>{const n=Tb(e).negate().div(t);return L1(n.negate().mul(s))}),Kn(1))).setLayout({name:"volumeAttenuation",type:"vec3",inputs:[{name:"transmissionDistance",type:"float"},{name:"attenuationColor",type:"vec3"},{name:"attenuationDistance",type:"float"}]}),az=or(([s,e,t,n,i,a,o,u,c,d,g,v,M,B,I])=>{let ne,ee;if(I){ne=Ks().toVar(),ee=Kn().toVar();const nt=g.sub(1).mul(I.mul(.025)),Ye=Kn(g.sub(nt),g,g.add(nt));kl({start:0,end:3},({i:ht})=>{const Rt=Ye.element(ht),qe=BR(s,e,v,Rt,u),pt=o.add(qe),xn=d.mul(c.mul(Ks(pt,1))),cr=Gi(xn.xy.div(xn.w)).toVar();cr.addAssign(1),cr.divAssign(2),cr.assign(Gi(cr.x,cr.y.oneMinus()));const pr=RR(cr,t,Rt);ne.element(ht).assign(pr.element(ht)),ne.a.addAssign(pr.a),ee.element(ht).assign(n.element(ht).mul(IR(og(qe),M,B).element(ht)))}),ne.a.divAssign(3)}else{const nt=BR(s,e,v,g,u),Ye=o.add(nt),ht=d.mul(c.mul(Ks(Ye,1))),Rt=Gi(ht.xy.div(ht.w)).toVar();Rt.addAssign(1),Rt.divAssign(2),Rt.assign(Gi(Rt.x,Rt.y.oneMinus())),ne=RR(Rt,t,g),ee=n.mul(IR(og(nt),M,B))}const q=ee.rgb.mul(ne.rgb),ye=s.dot(e).clamp(),Ce=Kn(yR({dotNV:ye,specularColor:i,specularF90:a,roughness:t})),ke=ee.r.add(ee.g,ee.b).div(3);return Ks(Ce.oneMinus().mul(q),ne.a.oneMinus().mul(ke).oneMinus())}),oz=ld(3.2404542,-.969266,.0556434,-1.5371385,1.8760108,-.2040259,-.4985314,.041556,1.0572252),lz=s=>{const e=s.sqrt();return Kn(1).add(e).div(Kn(1).sub(e))},NR=(s,e)=>s.sub(e).div(s.add(e)).pow2(),uz=(s,e)=>{const t=s.mul(2*Math.PI*1e-9),n=Kn(54856e-17,44201e-17,52481e-17),i=Kn(1681e3,1795300,2208400),a=Kn(43278e5,93046e5,66121e5),o=qt(9747e-17*Math.sqrt(2*Math.PI*45282e5)).mul(t.mul(2239900).add(e.x).cos()).mul(t.pow2().mul(-45282e5).exp());let u=n.mul(a.mul(2*Math.PI).sqrt()).mul(i.mul(t).add(e).cos()).mul(t.pow2().negate().mul(a).exp());return u=Kn(u.x.add(o),u.y,u.z).div(10685e-11),oz.mul(u)},FR=or(({outsideIOR:s,eta2:e,cosTheta1:t,thinFilmThickness:n,baseF0:i})=>{const a=zo(s,e,fA(0,.03,n)),u=s.div(a).pow2().mul(t.pow2().oneMinus()).oneMinus();ra(u.lessThan(0),()=>Kn(1));const c=u.sqrt(),d=NR(a,s),g=Tv({f0:d,f90:1,dotVH:t}),v=g.oneMinus(),M=a.lessThan(s).select(Math.PI,0),B=qt(Math.PI).sub(M),I=lz(i.clamp(0,.9999)),ne=NR(I,a.toVec3()),ee=Tv({f0:ne,f90:1,dotVH:c}),q=Kn(I.x.lessThan(a).select(Math.PI,0),I.y.lessThan(a).select(Math.PI,0),I.z.lessThan(a).select(Math.PI,0)),ye=a.mul(n,c,2),Ce=Kn(B).add(q),ke=g.mul(ee).clamp(1e-5,.9999),nt=ke.sqrt(),Ye=v.pow2().mul(ee).div(Kn(1).sub(ke)),Rt=g.add(Ye).toVar(),qe=Ye.sub(v).toVar();return kl({start:1,end:2,condition:"<=",name:"m"},({m:pt})=>{qe.mulAssign(nt);const xn=uz(qt(pt).mul(ye),qt(pt).mul(Ce)).mul(2);Rt.addAssign(qe.mul(xn))}),Rt.max(Kn(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"}]}),Zy=or(({normal:s,viewDir:e,roughness:t})=>{const n=s.dot(e).saturate(),i=t.mul(t),a=t.add(.1).reciprocal(),o=qt(-1.9362).add(t.mul(1.0678)).add(i.mul(.4573)).sub(a.mul(.8469)),u=qt(-.6014).add(t.mul(.5538)).sub(i.mul(.467)).sub(a.mul(.1255));return o.mul(n).add(u).exp().saturate()}),HS=Kn(.04),QS=qt(1);class PR extends qb{constructor(e=!1,t=!1,n=!1,i=!1,a=!1,o=!1){super(),this.clearcoat=e,this.sheen=t,this.iridescence=n,this.anisotropy=i,this.transmission=a,this.dispersion=o,this.clearcoatRadiance=null,this.clearcoatSpecularDirect=null,this.clearcoatSpecularIndirect=null,this.sheenSpecularDirect=null,this.sheenSpecularIndirect=null,this.iridescenceFresnel=null,this.iridescenceF0=null,this.iridescenceF0Dielectric=null,this.iridescenceF0Metallic=null}start(e){if(this.clearcoat===!0&&(this.clearcoatRadiance=Kn().toVar("clearcoatRadiance"),this.clearcoatSpecularDirect=Kn().toVar("clearcoatSpecularDirect"),this.clearcoatSpecularIndirect=Kn().toVar("clearcoatSpecularIndirect")),this.sheen===!0&&(this.sheenSpecularDirect=Kn().toVar("sheenSpecularDirect"),this.sheenSpecularIndirect=Kn().toVar("sheenSpecularIndirect")),this.iridescence===!0){const t=cl.dot(iu).clamp(),n=FR({outsideIOR:qt(1),eta2:bb,cosTheta1:t,thinFilmThickness:_b,baseF0:Pm}),i=FR({outsideIOR:qt(1),eta2:bb,cosTheta1:t,thinFilmThickness:_b,baseF0:Wl.rgb});this.iridescenceFresnel=zo(n,i,Wg),this.iridescenceF0Dielectric=kS({f:n,f90:1,dotVH:t}),this.iridescenceF0Metallic=kS({f:i,f90:1,dotVH:t}),this.iridescenceF0=zo(this.iridescenceF0Dielectric,this.iridescenceF0Metallic,Wg)}if(this.transmission===!0){const t=pA,n=zy.sub(pA).normalize(),i=Om,a=e.context;a.backdrop=az(i,n,ig,d0,A0,pv,t,XA,AA,of,Ly,C1,B1,T1,this.dispersion?R1:null),a.backdropAlpha=Mb,Wl.a.mulAssign(zo(1,a.backdrop.a,Mb))}super.start(e)}computeMultiscattering(e,t,n,i,a=null){const o=cl.dot(iu).clamp(),u=Wy({roughness:ig,dotNV:o}),c=a?xb.mix(i,a):i,d=c.mul(u.x).add(n.mul(u.y)),v=u.x.add(u.y).oneMinus(),M=c.add(c.oneMinus().mul(.047619)),B=d.mul(M).div(v.mul(M).oneMinus());e.addAssign(d),t.addAssign(B.mul(v))}direct({lightDirection:e,lightColor:t,reflectedLight:n}){const a=cl.dot(e).clamp().mul(t).toVar();if(this.sheen===!0){this.sheenSpecularDirect.addAssign(a.mul(JV({lightDirection:e})));const o=Zy({normal:cl,viewDir:iu,roughness:Nm}),u=Zy({normal:cl,viewDir:e,roughness:Nm}),c=hA.r.max(hA.g).max(hA.b).mul(o.max(u)).oneMinus();a.mulAssign(c)}if(this.clearcoat===!0){const u=v0.dot(e).clamp().mul(t);this.clearcoatSpecularDirect.addAssign(u.mul(DS({lightDirection:e,f0:HS,f90:QS,roughness:Ny,normalView:v0})))}n.directDiffuse.addAssign(a.mul(x0({diffuseColor:d0}))),n.directSpecular.addAssign(a.mul(jV({lightDirection:e,f0:A0,f90:1,roughness:ig,f:this.iridescenceFresnel,USE_IRIDESCENCE:this.iridescence,USE_ANISOTROPY:this.anisotropy})))}directRectArea({lightColor:e,lightPosition:t,halfWidth:n,halfHeight:i,reflectedLight:a,ltc_1:o,ltc_2:u}){const c=t.add(n).sub(i),d=t.sub(n).sub(i),g=t.sub(n).add(i),v=t.add(n).add(i),M=cl,B=iu,I=Oc.toVar(),ne=ez({N:M,V:B,roughness:ig}),ee=o.sample(ne).toVar(),q=u.sample(ne).toVar(),ye=ld(Kn(ee.x,0,ee.y),Kn(0,1,0),Kn(ee.z,0,ee.w)).toVar(),Ce=A0.mul(q.x).add(A0.oneMinus().mul(q.y)).toVar();a.directSpecular.addAssign(e.mul(Ce).mul(bR({N:M,V:B,P:I,mInv:ye,p0:c,p1:d,p2:g,p3:v}))),a.directDiffuse.addAssign(e.mul(d0).mul(bR({N:M,V:B,P:I,mInv:ld(1,0,0,0,1,0,0,0,1),p0:c,p1:d,p2:g,p3:v})))}indirect(e){this.indirectDiffuse(e),this.indirectSpecular(e),this.ambientOcclusion(e)}indirectDiffuse(e){const{irradiance:t,reflectedLight:n}=e.context,i=t.mul(x0({diffuseColor:d0})).toVar();if(this.sheen===!0){const a=Zy({normal:cl,viewDir:iu,roughness:Nm}),o=hA.r.max(hA.g).max(hA.b).mul(a).oneMinus();i.mulAssign(o)}n.indirectDiffuse.addAssign(i)}indirectSpecular(e){const{radiance:t,iblIrradiance:n,reflectedLight:i}=e.context;if(this.sheen===!0&&this.sheenSpecularIndirect.addAssign(n.mul(hA,Zy({normal:cl,viewDir:iu,roughness:Nm}))),this.clearcoat===!0){const ee=v0.dot(iu).clamp(),q=yR({dotNV:ee,specularColor:HS,specularF90:QS,roughness:Ny});this.clearcoatSpecularIndirect.addAssign(this.clearcoatRadiance.mul(q))}const a=Kn().toVar("singleScatteringDielectric"),o=Kn().toVar("multiScatteringDielectric"),u=Kn().toVar("singleScatteringMetallic"),c=Kn().toVar("multiScatteringMetallic");this.computeMultiscattering(a,o,pv,Pm,this.iridescenceF0Dielectric),this.computeMultiscattering(u,c,pv,Wl.rgb,this.iridescenceF0Metallic);const d=zo(a,u,Wg),g=zo(o,c,Wg),v=a.add(o),M=d0.mul(v.oneMinus()),B=n.mul(1/Math.PI),I=t.mul(d).add(g.mul(B)).toVar(),ne=M.mul(B).toVar();if(this.sheen===!0){const ee=Zy({normal:cl,viewDir:iu,roughness:Nm}),q=hA.r.max(hA.g).max(hA.b).mul(ee).oneMinus();I.mulAssign(q),ne.mulAssign(q)}i.indirectSpecular.addAssign(I),i.indirectDiffuse.addAssign(ne)}ambientOcclusion(e){const{ambientOcclusion:t,reflectedLight:n}=e.context,a=cl.dot(iu).clamp().add(t),o=ig.mul(-16).oneMinus().negate().exp2(),u=t.sub(a.pow(o).oneMinus()).clamp();this.clearcoat===!0&&this.clearcoatSpecularIndirect.mulAssign(t),this.sheen===!0&&this.sheenSpecularIndirect.mulAssign(t),n.indirectDiffuse.mulAssign(t),n.indirectSpecular.mulAssign(u)}finish({context:e}){const{outgoingLight:t}=e;if(this.clearcoat===!0){const n=v0.dot(iu).clamp(),i=Tv({dotVH:n,f0:HS,f90:QS}),a=t.mul(yb.mul(i).oneMinus()).add(this.clearcoatSpecularDirect.add(this.clearcoatSpecularIndirect).mul(yb));t.assign(a)}if(this.sheen===!0){const n=t.add(this.sheenSpecularDirect,this.sheenSpecularIndirect.mul(1/Math.PI));t.assign(n)}}}const LR=qt(1),WS=qt(-2),e_=qt(.8),ZS=qt(-1),t_=qt(.4),KS=qt(2),n_=qt(.305),$S=qt(3),UR=qt(.21),cz=qt(4),OR=qt(4),hz=qt(16),dz=or(([s])=>{const e=Kn(Su(s)).toVar(),t=qt(-1).toVar();return ra(e.x.greaterThan(e.z),()=>{ra(e.x.greaterThan(e.y),()=>{t.assign(ud(s.x.greaterThan(0),0,3))}).Else(()=>{t.assign(ud(s.y.greaterThan(0),1,4))})}).Else(()=>{ra(e.z.greaterThan(e.y),()=>{t.assign(ud(s.z.greaterThan(0),2,5))}).Else(()=>{t.assign(ud(s.y.greaterThan(0),1,4))})}),t}).setLayout({name:"getFace",type:"float",inputs:[{name:"direction",type:"vec3"}]}),fz=or(([s,e])=>{const t=Gi().toVar();return ra(e.equal(0),()=>{t.assign(Gi(s.z,s.y).div(Su(s.x)))}).ElseIf(e.equal(1),()=>{t.assign(Gi(s.x.negate(),s.z.negate()).div(Su(s.y)))}).ElseIf(e.equal(2),()=>{t.assign(Gi(s.x.negate(),s.y).div(Su(s.z)))}).ElseIf(e.equal(3),()=>{t.assign(Gi(s.z.negate(),s.y).div(Su(s.x)))}).ElseIf(e.equal(4),()=>{t.assign(Gi(s.x.negate(),s.z).div(Su(s.y)))}).Else(()=>{t.assign(Gi(s.x,s.y).div(Su(s.z)))}),no(.5,t.add(1))}).setLayout({name:"getUV",type:"vec2",inputs:[{name:"direction",type:"vec3"},{name:"face",type:"float"}]}),Az=or(([s])=>{const e=qt(0).toVar();return ra(s.greaterThanEqual(e_),()=>{e.assign(LR.sub(s).mul(ZS.sub(WS)).div(LR.sub(e_)).add(WS))}).ElseIf(s.greaterThanEqual(t_),()=>{e.assign(e_.sub(s).mul(KS.sub(ZS)).div(e_.sub(t_)).add(ZS))}).ElseIf(s.greaterThanEqual(n_),()=>{e.assign(t_.sub(s).mul($S.sub(KS)).div(t_.sub(n_)).add(KS))}).ElseIf(s.greaterThanEqual(UR),()=>{e.assign(n_.sub(s).mul(cz.sub($S)).div(n_.sub(UR)).add($S))}).Else(()=>{e.assign(qt(-2).mul(sg(no(1.16,s))))}),e}).setLayout({name:"roughnessToMip",type:"float",inputs:[{name:"roughness",type:"float"}]}),DR=or(([s,e])=>{const t=s.toVar();t.assign(no(2,t).sub(1));const n=Kn(t,1).toVar();return ra(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"}]}),kR=or(([s,e,t,n,i,a])=>{const o=qt(t),u=Kn(e),c=Sp(Az(o),WS,a),d=_p(c),g=ag(c),v=Kn(Ky(s,u,g,n,i,a)).toVar();return ra(d.notEqual(0),()=>{const M=Kn(Ky(s,u,g.add(1),n,i,a)).toVar();v.assign(zo(v,M,d))}),v}),Ky=or(([s,e,t,n,i,a])=>{const o=qt(t).toVar(),u=Kn(e),c=qt(dz(u)).toVar(),d=qt(mc(OR.sub(o),0)).toVar();o.assign(mc(o,OR));const g=qt(mv(o)).toVar(),v=Gi(fz(u,c).mul(g.sub(2)).add(1)).toVar();return ra(c.greaterThan(2),()=>{v.y.addAssign(g),c.subAssign(3)}),v.x.addAssign(c.mul(g)),v.x.addAssign(d.mul(no(3,hz))),v.y.addAssign(no(4,mv(a).sub(g))),v.x.mulAssign(n),v.y.mulAssign(i),s.sample(v).grad(Gi(),Gi())}),XS=or(({envMap:s,mipInt:e,outputDirection:t,theta:n,axis:i,CUBEUV_TEXEL_WIDTH:a,CUBEUV_TEXEL_HEIGHT:o,CUBEUV_MAX_MIP:u})=>{const c=wp(n),d=t.mul(c).add(i.cross(t).mul(sf(n))).add(i.mul(i.dot(t).mul(c.oneMinus())));return Ky(s,d,e,a,o,u)}),VR=or(({n:s,latitudinal:e,poleAxis:t,outputDirection:n,weights:i,samples:a,dTheta:o,mipInt:u,envMap:c,CUBEUV_TEXEL_WIDTH:d,CUBEUV_TEXEL_HEIGHT:g,CUBEUV_MAX_MIP:v})=>{const M=Kn(ud(e,t,Zg(t,n))).toVar();ra(M.equal(Kn(0)),()=>{M.assign(Kn(n.z,0,n.x.negate()))}),M.assign(rf(M));const B=Kn().toVar();return B.addAssign(i.element(0).mul(XS({theta:0,axis:M,outputDirection:n,mipInt:u,envMap:c,CUBEUV_TEXEL_WIDTH:d,CUBEUV_TEXEL_HEIGHT:g,CUBEUV_MAX_MIP:v}))),kl({start:Qn(1),end:s},({i:I})=>{ra(I.greaterThanEqual(a),()=>{j2()});const ne=qt(o.mul(qt(I))).toVar();B.addAssign(i.element(I).mul(XS({theta:ne.mul(-1),axis:M,outputDirection:n,mipInt:u,envMap:c,CUBEUV_TEXEL_WIDTH:d,CUBEUV_TEXEL_HEIGHT:g,CUBEUV_MAX_MIP:v}))),B.addAssign(i.element(I).mul(XS({theta:ne,axis:M,outputDirection:n,mipInt:u,envMap:c,CUBEUV_TEXEL_WIDTH:d,CUBEUV_TEXEL_HEIGHT:g,CUBEUV_MAX_MIP:v})))}),Ks(B,1)}),pz=or(([s])=>{const e=Fi(s).toVar();return e.assign(e.shiftLeft(Fi(16)).bitOr(e.shiftRight(Fi(16)))),e.assign(e.bitAnd(Fi(1431655765)).shiftLeft(Fi(1)).bitOr(e.bitAnd(Fi(2863311530)).shiftRight(Fi(1)))),e.assign(e.bitAnd(Fi(858993459)).shiftLeft(Fi(2)).bitOr(e.bitAnd(Fi(3435973836)).shiftRight(Fi(2)))),e.assign(e.bitAnd(Fi(252645135)).shiftLeft(Fi(4)).bitOr(e.bitAnd(Fi(4042322160)).shiftRight(Fi(4)))),e.assign(e.bitAnd(Fi(16711935)).shiftLeft(Fi(8)).bitOr(e.bitAnd(Fi(4278255360)).shiftRight(Fi(8)))),qt(e).mul(23283064365386963e-26)}),gz=or(([s,e])=>Gi(qt(s).div(qt(e)),pz(s))),mz=or(([s,e,t])=>{const n=Kn(e).toVar(),i=qt(t),a=i.mul(i).toVar(),o=rf(Kn(a.mul(n.x),a.mul(n.y),n.z)).toVar(),u=o.x.mul(o.x).add(o.y.mul(o.y)),c=ud(u.greaterThan(0),Kn(o.y.negate(),o.x,0).div(Nd(u)),Kn(1,0,0)).toVar(),d=Zg(o,c).toVar(),g=Nd(s.x),v=no(2,3.14159265359).mul(s.y),M=g.mul(wp(v)).toVar(),B=g.mul(sf(v)).toVar(),I=no(.5,o.z.add(1));B.assign(I.oneMinus().mul(Nd(M.mul(M).oneMinus())).add(I.mul(B)));const ne=c.mul(M).add(d.mul(B)).add(o.mul(Nd(mc(0,M.mul(M).add(B.mul(B)).oneMinus()))));return rf(Kn(a.mul(ne.x),a.mul(ne.y),mc(0,ne.z)))}),zR=or(({roughness:s,mipInt:e,envMap:t,N_immutable:n,GGX_SAMPLES:i,CUBEUV_TEXEL_WIDTH:a,CUBEUV_TEXEL_HEIGHT:o,CUBEUV_MAX_MIP:u})=>{const c=Kn(n).toVar(),d=Kn(0).toVar(),g=qt(0).toVar();return ra(s.lessThan(.001),()=>{d.assign(Ky(t,c,e,a,o,u))}).Else(()=>{const v=ud(Su(c.z).lessThan(.999),Kn(0,0,1),Kn(1,0,0)),M=rf(Zg(v,c)).toVar(),B=Zg(c,M).toVar();kl({start:Fi(0),end:i},({i:I})=>{const ne=gz(I,i),ee=mz(ne,Kn(0,0,1),s),q=rf(M.mul(ee.x).add(B.mul(ee.y)).add(c.mul(ee.z))),ye=rf(q.mul(ZA(c,q).mul(2)).sub(c)),Ce=mc(ZA(c,ye),0);ra(Ce.greaterThan(0),()=>{const ke=Ky(t,ye,e,a,o,u);d.addAssign(ke.mul(Ce)),g.addAssign(Ce)})}),ra(g.greaterThan(0),()=>{d.assign(d.div(g))})}),Ks(d,1)}),km=4,GR=[.125,.215,.35,.446,.526,.582],b0=20,vz=512,$y=new Pg(-1,1,1,-1,0,1),yz=new vo(90,1),HR=new Wr;let jS=null,YS=0,qS=0;const xz=new le,r_=new WeakMap,bz=[3,1,5,0,4,2],JS=DR(Zl(),af("faceIndex")).normalize(),i_=Kn(JS.x,JS.y,JS.z);class _z{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._sizeLods=[],this._sigmas=[],this._lodMeshes=[],this._blurMaterial=null,this._ggxMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._backgroundBox=null}get _hasInitialized(){return this._renderer.hasInitialized()}fromScene(e,t=0,n=.1,i=100,a={}){const{size:o=256,position:u=xz,renderTarget:c=null}=a;if(this._setSize(o),this._hasInitialized===!1){Lr('PMREMGenerator: ".fromScene()" called before the backend is initialized. Try using "await renderer.init()" instead.');const g=c||this._allocateTarget();return a.renderTarget=g,this.fromSceneAsync(e,t,n,i,a),g}jS=this._renderer.getRenderTarget(),YS=this._renderer.getActiveCubeFace(),qS=this._renderer.getActiveMipmapLevel();const d=c||this._allocateTarget();return d.depthBuffer=!0,this._init(d),this._sceneToCubeUV(e,n,i,d,u),t>0&&this._blur(d,0,0,t),this._applyPMREM(d),this._cleanup(d),d}fromSceneAsync(o){return Pa(this,arguments,function*(e,t=0,n=.1,i=100,a={}){return ki('PMREMGenerator: ".fromSceneAsync()" is deprecated. Use "await renderer.init()" instead.'),yield this._renderer.init(),this.fromScene(e,t,n,i,a)})}fromEquirectangular(e,t=null){if(this._hasInitialized===!1){Lr('PMREMGenerator: .fromEquirectangular() called before the backend is initialized. Try using "await renderer.init()" instead.'),this._setSizeFromTexture(e);const n=t||this._allocateTarget();return this.fromEquirectangularAsync(e,n),n}return this._fromTexture(e,t)}fromEquirectangularAsync(e,t=null){return Pa(this,null,function*(){return ki('PMREMGenerator: ".fromEquirectangularAsync()" is deprecated. Use "await renderer.init()" instead.'),yield this._renderer.init(),this._fromTexture(e,t)})}fromCubemap(e,t=null){if(this._hasInitialized===!1){Lr("PMREMGenerator: .fromCubemap() called before the backend is initialized. Try using .fromCubemapAsync() instead."),this._setSizeFromTexture(e);const n=t||this._allocateTarget();return this.fromCubemapAsync(e,t),n}return this._fromTexture(e,t)}fromCubemapAsync(e,t=null){return Pa(this,null,function*(){return ki('PMREMGenerator: ".fromCubemapAsync()" is deprecated. Use "await renderer.init()" instead.'),yield this._renderer.init(),this._fromTexture(e,t)})}compileCubemapShader(){return Pa(this,null,function*(){this._cubemapMaterial===null&&(this._cubemapMaterial=WR(),yield this._compileMaterial(this._cubemapMaterial))})}compileEquirectangularShader(){return Pa(this,null,function*(){this._equirectMaterial===null&&(this._equirectMaterial=ZR(),yield 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===it||e.mapping===wt?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._ggxMaterial!==null&&this._ggxMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e<this._lodMeshes.length;e++)this._lodMeshes[e].geometry.dispose()}_cleanup(e){this._renderer.setRenderTarget(jS,YS,qS),e.scissorTest=!1,Bv(e,0,0,e.width,e.height)}_fromTexture(e,t){this._setSizeFromTexture(e),jS=this._renderer.getRenderTarget(),YS=this._renderer.getActiveCubeFace(),qS=this._renderer.getActiveMipmapLevel();const n=t||this._allocateTarget();return this._init(n),this._textureToCubeUV(e,n),this._applyPMREM(n),this._cleanup(n),n}_allocateTarget(){const e=3*Math.max(this._cubeSize,112),t=4*this._cubeSize;return QR(e,t)}_init(e){if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e.width||this._pingPongRenderTarget.height!==e.height){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=QR(e.width,e.height);const{_lodMax:t}=this;({lodMeshes:this._lodMeshes,sizeLods:this._sizeLods,sigmas:this._sigmas}=wz(t)),this._blurMaterial=Sz(t,e.width,e.height),this._ggxMaterial=Mz(t,e.width,e.height)}}_compileMaterial(e){return Pa(this,null,function*(){const t=new Il(new ka,e);yield this._renderer.compile(t,$y)})}_sceneToCubeUV(e,t,n,i,a){const o=yz;o.near=t,o.far=n;const u=[1,1,1,1,-1,1],c=[1,-1,1,-1,1,-1],d=this._renderer,g=d.autoClear;d.getClearColor(HR),d.autoClear=!1,this._backgroundBox===null&&(this._backgroundBox=new Il(new bd,new Yl({name:"PMREM.Background",side:de,depthWrite:!1,depthTest:!1})));const v=this._backgroundBox,M=v.material;let B=!1;const I=e.background;I?I.isColor&&(M.color.copy(I),e.background=null,B=!0):(M.color.copy(HR),B=!0),d.setRenderTarget(i),d.clear(),B&&d.render(v,o);for(let ne=0;ne<6;ne++){const ee=ne%3;ee===0?(o.up.set(0,u[ne],0),o.position.set(a.x,a.y,a.z),o.lookAt(a.x+c[ne],a.y,a.z)):ee===1?(o.up.set(0,0,u[ne]),o.position.set(a.x,a.y,a.z),o.lookAt(a.x,a.y+c[ne],a.z)):(o.up.set(0,u[ne],0),o.position.set(a.x,a.y,a.z),o.lookAt(a.x,a.y,a.z+c[ne]));const q=this._cubeSize;Bv(i,ee*q,ne>2?q:0,q,q),d.render(e,o)}d.autoClear=g,e.background=I}_textureToCubeUV(e,t){const n=this._renderer,i=e.mapping===it||e.mapping===wt;i?this._cubemapMaterial===null&&(this._cubemapMaterial=WR(e)):this._equirectMaterial===null&&(this._equirectMaterial=ZR(e));const a=i?this._cubemapMaterial:this._equirectMaterial;a.fragmentNode.value=e;const o=this._lodMeshes[0];o.material=a;const u=this._cubeSize;Bv(t,0,0,3*u,2*u),n.setRenderTarget(t),n.render(o,$y)}_applyPMREM(e){const t=this._renderer,n=t.autoClear;t.autoClear=!1;const i=this._lodMeshes.length;for(let a=1;a<i;a++)this._applyGGXFilter(e,a-1,a);t.autoClear=n}_applyGGXFilter(e,t,n){const i=this._renderer,a=this._pingPongRenderTarget,o=this._ggxMaterial,u=this._lodMeshes[n];u.material=o;const c=r_.get(o),d=n/(this._lodMeshes.length-1),g=t/(this._lodMeshes.length-1),v=Math.sqrt(d*d-g*g),M=0+d*1.25,B=v*M,{_lodMax:I}=this,ne=this._sizeLods[n],ee=3*ne*(n>I-km?n-I+km:0),q=4*(this._cubeSize-ne);e.texture.frame=(e.texture.frame||0)+1,c.envMap.value=e.texture,c.roughness.value=B,c.mipInt.value=I-t,Bv(a,ee,q,3*ne,2*ne),i.setRenderTarget(a),i.render(u,$y),a.texture.frame=(a.texture.frame||0)+1,c.envMap.value=a.texture,c.roughness.value=0,c.mipInt.value=I-n,Bv(e,ee,q,3*ne,2*ne),i.setRenderTarget(e),i.render(u,$y)}_blur(e,t,n,i,a){const o=this._pingPongRenderTarget;this._halfBlur(e,o,t,n,i,"latitudinal",a),this._halfBlur(o,e,n,n,i,"longitudinal",a)}_halfBlur(e,t,n,i,a,o,u){const c=this._renderer,d=this._blurMaterial;o!=="latitudinal"&&o!=="longitudinal"&&Gr("blur direction must be either latitudinal or longitudinal!");const g=3,v=this._lodMeshes[i];v.material=d;const M=r_.get(d),B=this._sizeLods[n]-1,I=isFinite(a)?Math.PI/(2*B):2*Math.PI/(2*b0-1),ne=a/I,ee=isFinite(a)?1+Math.floor(g*ne):b0;ee>b0&&Lr(`sigmaRadians, ${a}, is too large and will clip, as it requested ${ee} samples when the maximum is set to ${b0}`);const q=[];let ye=0;for(let ht=0;ht<b0;++ht){const Rt=ht/ne,qe=Math.exp(-Rt*Rt/2);q.push(qe),ht===0?ye+=qe:ht<ee&&(ye+=2*qe)}for(let ht=0;ht<q.length;ht++)q[ht]=q[ht]/ye;e.texture.frame=(e.texture.frame||0)+1,M.envMap.value=e.texture,M.samples.value=ee,M.weights.array=q,M.latitudinal.value=o==="latitudinal"?1:0,u&&(M.poleAxis.value=u);const{_lodMax:Ce}=this;M.dTheta.value=I,M.mipInt.value=Ce-n;const ke=this._sizeLods[i],nt=3*ke*(i>Ce-km?i-Ce+km:0),Ye=4*(this._cubeSize-ke);Bv(t,nt,Ye,3*ke,2*ke),c.setRenderTarget(t),c.render(v,$y)}}function wz(s){const e=[],t=[],n=[];let i=s;const a=s-km+1+GR.length;for(let o=0;o<a;o++){const u=Math.pow(2,i);e.push(u);let c=1/u;o>s-km?c=GR[o-s+km-1]:o===0&&(c=0),t.push(c);const d=1/(u-2),g=-d,v=1+d,M=[g,g,v,g,v,v,g,g,v,v,g,v],B=6,I=6,ne=3,ee=2,q=1,ye=new Float32Array(ne*I*B),Ce=new Float32Array(ee*I*B),ke=new Float32Array(q*I*B);for(let Ye=0;Ye<B;Ye++){const ht=Ye%3*2/3-1,Rt=Ye>2?0:-1,qe=[ht,Rt,0,ht+2/3,Rt,0,ht+2/3,Rt+1,0,ht,Rt,0,ht+2/3,Rt+1,0,ht,Rt+1,0],pt=bz[Ye];ye.set(qe,ne*I*pt),Ce.set(M,ee*I*pt);const xn=[pt,pt,pt,pt,pt,pt];ke.set(xn,q*I*pt)}const nt=new ka;nt.setAttribute("position",new wl(ye,ne)),nt.setAttribute("uv",new wl(Ce,ee)),nt.setAttribute("faceIndex",new wl(ke,q)),n.push(new Il(nt,null)),i>km&&i--}return{lodMeshes:n,sizeLods:e,sigmas:t}}function QR(s,e){const t={magFilter:vr,minFilter:vr,generateMipmaps:!1,type:Wt,format:L,colorSpace:No},n=new Ns(s,e,t);return n.texture.mapping=_t,n.texture.name="PMREM.cubeUv",n.texture.isPMREMTexture=!0,n.scissorTest=!0,n}function Bv(s,e,t,n,i){s.viewport.set(e,t,n,i),s.scissor.set(e,t,n,i)}function s_(s){const e=new yc;return e.depthTest=!1,e.depthWrite=!1,e.blending=we,e.name=`PMREM_${s}`,e}function Sz(s,e,t){const n=Fd(new Array(b0).fill(0)),i=va(new le(0,1,0)),a=va(0),o=qt(b0),u=va(0),c=va(1),d=xl(),g=va(0),v=qt(1/e),M=qt(1/t),B=qt(s),I={n:o,latitudinal:u,weights:n,poleAxis:i,outputDirection:i_,dTheta:a,samples:c,envMap:d,mipInt:g,CUBEUV_TEXEL_WIDTH:v,CUBEUV_TEXEL_HEIGHT:M,CUBEUV_MAX_MIP:B},ne=s_("blur");return ne.fragmentNode=VR(fd(rl({},I),{latitudinal:u.equal(1)})),r_.set(ne,I),ne}function Mz(s,e,t){const n=xl(),i=va(0),a=va(0),o=qt(1/e),u=qt(1/t),c=qt(s),d={envMap:n,roughness:i,mipInt:a,CUBEUV_TEXEL_WIDTH:o,CUBEUV_TEXEL_HEIGHT:u,CUBEUV_MAX_MIP:c},g=s_("ggx");return g.fragmentNode=zR(fd(rl({},d),{N_immutable:i_,GGX_SAMPLES:Fi(vz)})),r_.set(g,d),g}function WR(s){const e=s_("cubemap");return e.fragmentNode=lf(s,i_),e}function ZR(s){const e=s_("equirect");return e.fragmentNode=xl(s,LS(i_),0),e}const KR=new WeakMap;function Ez(s){const e=Math.log2(s)-2,t=1/s;return{texelWidth:1/(3*Math.max(Math.pow(2,e),7*16)),texelHeight:t,maxMip:e}}function Cz(s,e,t){const n=Tz(e);let i=n.get(s);if((i!==void 0?i.pmremVersion:-1)!==s.pmremVersion){const o=s.image;if(s.isCubeTexture)if(Rz(o))i=t.fromCubemap(s,i);else return null;else if(Iz(o))i=t.fromEquirectangular(s,i);else return null;i.pmremVersion=s.pmremVersion,n.set(s,i)}return i.texture}function Tz(s){let e=KR.get(s);return e===void 0&&(e=new WeakMap,KR.set(s,e)),e}class Bz extends pc{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 i=new zi;i.isRenderTargetTexture=!0,this._texture=xl(i),this._width=va(0),this._height=va(0),this._maxMip=va(0),this.updateBeforeType=Ao.RENDER}set value(e){this._value=e,this._pmrem=null}get value(){return this._value}updateFromTexture(e){const t=Ez(e.image.height);this._texture.value=e,this._width.value=t.texelWidth,this._height.value=t.texelHeight,this._maxMip.value=t.maxMip}updateBefore(e){let t=this._pmrem;const n=t?t.pmremVersion:-1,i=this._value;n!==i.pmremVersion&&(i.isPMREMTexture===!0?t=i:t=Cz(i,e.renderer,this._generator),t!==null&&(this._pmrem=t,this.updateFromTexture(t)))}setup(e){this._generator===null&&(this._generator=new _z(e.renderer)),this.updateBefore(e);let t=this.uvNode;t===null&&e.context.getUV&&(t=e.context.getUV(this,e)),t=AS.mul(Kn(t.x,t.y.negate(),t.z));let n=this.levelNode;return n===null&&e.context.getTextureLevel&&(n=e.context.getTextureLevel(this)),kR(this._texture,t,n,this._width,this._height,this._maxMip)}dispose(){super.dispose(),this._generator!==null&&this._generator.dispose()}}function Rz(s){if(s==null)return!1;let e=0;const t=6;for(let n=0;n<t;n++)s[n]!==void 0&&e++;return e===t}function Iz(s){return s==null?!1:s.height>0}const eM=to(Bz).setParameterLength(1,3),$R=new WeakMap;class Nz extends Sv{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 v=n.isTextureNode?n.value:t[n.property];let M=$R.get(v);M===void 0&&(M=eM(v),$R.set(v,M)),n=M}const a=t.useAnisotropy===!0||t.anisotropy>0?d2:cl,o=n.context(XR(ig,a)).mul(Vb),u=n.context(Fz(Om)).mul(Math.PI).mul(Vb),c=yv(o),d=yv(u);e.context.radiance.addAssign(c),e.context.iblIrradiance.addAssign(d);const g=e.context.lightingModel.clearcoatRadiance;if(g){const v=n.context(XR(Ny,v0)).mul(Vb),M=yv(v);g.addAssign(M)}}}const XR=(s,e)=>{let t=null;return{getUV:()=>(t===null&&(t=iu.negate().reflect(e),t=W1(s).mix(t,e).normalize(),t=t.transformDirection(AA)),t),getTextureLevel:()=>s}},Fz=s=>({getUV:()=>s,getTextureLevel:()=>qt(1)}),Pz=new $v;class jR extends yc{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(Pz),this.setValues(e)}setupEnvironment(e){let t=super.setupEnvironment(e);return t===null&&e.environmentNode&&(t=e.environmentNode),t?new Nz(t):null}setupLightingModel(){return new PR}setupSpecular(){const e=zo(Kn(.04),Wl.rgb,Wg);Pm.assign(Kn(.04)),A0.assign(e),pv.assign(1)}setupVariants(){const e=this.metalnessNode?qt(this.metalnessNode):b2;Wg.assign(e);let t=this.roughnessNode?qt(this.roughnessNode):x2;t=OS({roughness:t}),ig.assign(t),this.setupSpecular(),d0.assign(Wl.rgb.mul(e.oneMinus()))}copy(e){return this.emissiveNode=e.emissiveNode,this.metalnessNode=e.metalnessNode,this.roughnessNode=e.roughnessNode,super.copy(e)}}const Lz=new Qp;class Uz extends jR{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(Lz),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?qt(this.iorNode):L2;Ly.assign(e),Pm.assign(Uf(Q1(Ly.sub(1).div(Ly.add(1))).mul(y2),Kn(1)).mul(_S)),A0.assign(zo(Pm,Wl.rgb,Wg)),pv.assign(zo(_S,1,Wg))}setupLightingModel(){return new PR(this.useClearcoat,this.useSheen,this.useIridescence,this.useAnisotropy,this.useTransmission,this.useDispersion)}setupVariants(e){if(super.setupVariants(e),this.useClearcoat){const t=this.clearcoatNode?qt(this.clearcoatNode):w2,n=this.clearcoatRoughnessNode?qt(this.clearcoatRoughnessNode):S2;yb.assign(t),Ny.assign(OS({roughness:n}))}if(this.useSheen){const t=this.sheenNode?Kn(this.sheenNode):C2,n=this.sheenRoughnessNode?qt(this.sheenRoughnessNode):T2;hA.assign(t),Nm.assign(n)}if(this.useIridescence){const t=this.iridescenceNode?qt(this.iridescenceNode):R2,n=this.iridescenceIORNode?qt(this.iridescenceIORNode):I2,i=this.iridescenceThicknessNode?qt(this.iridescenceThicknessNode):N2;xb.assign(t),bb.assign(n),_b.assign(i)}if(this.useAnisotropy){const t=(this.anisotropyNode?Gi(this.anisotropyNode):B2).toVar();Fm.assign(t.length()),ra(Fm.equal(0),()=>{t.assign(Gi(1,0))}).Else(()=>{t.divAssign(Gi(Fm)),Fm.assign(Fm.saturate())}),wb.assign(Fm.pow2().mix(ig.pow2(),1)),Fy.assign(y0[0].mul(t.x).add(y0[1].mul(t.y))),f0.assign(y0[1].mul(t.x).sub(y0[0].mul(t.y)))}if(this.useTransmission){const t=this.transmissionNode?qt(this.transmissionNode):F2,n=this.thicknessNode?qt(this.thicknessNode):P2,i=this.attenuationDistanceNode?qt(this.attenuationDistanceNode):U2,a=this.attenuationColorNode?Kn(this.attenuationColorNode):O2;if(Mb.assign(t),C1.assign(n),T1.assign(i),B1.assign(a),this.useDispersion){const o=this.dispersionNode?qt(this.dispersionNode):k2;R1.assign(o)}}}setupClearcoatNormal(){return this.clearcoatNormalNode?Kn(this.clearcoatNormalNode):M2}setup(e){e.context.setupClearcoatNormal=()=>vv(this.setupClearcoatNormal(e),"NORMAL","vec3"),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)}}class Oz extends null{constructor(e=!1,t=!1,n=!1,i=!1,a=!1,o=!1,u=!1){super(e,t,n,i,a,o),this.useSSS=u}direct({lightDirection:e,lightColor:t,reflectedLight:n},i){if(this.useSSS===!0){const a=i.material,{thicknessColorNode:o,thicknessDistortionNode:u,thicknessAmbientNode:c,thicknessAttenuationNode:d,thicknessPowerNode:g,thicknessScaleNode:v}=a,M=e.add(cl.mul(u)).normalize(),B=qt(iu.dot(M.negate()).saturate().pow(g).mul(v)),I=Kn(B.add(c).mul(o));n.directDiffuse.addAssign(I.mul(d.mul(t)))}super.direct({lightDirection:e,lightColor:t,reflectedLight:n},i)}}class VX extends null{static get type(){return"MeshSSSNodeMaterial"}constructor(e){super(e),this.thicknessColorNode=null,this.thicknessDistortionNode=qt(.1),this.thicknessAmbientNode=qt(0),this.thicknessAttenuationNode=qt(.1),this.thicknessPowerNode=qt(2),this.thicknessScaleNode=qt(10)}get useSSS(){return this.thicknessColorNode!==null}setupLightingModel(){return new Oz(this.useClearcoat,this.useSheen,this.useIridescence,this.useAnisotropy,this.useTransmission,this.useDispersion,this.useSSS)}copy(e){return this.thicknessColorNode=e.thicknessColorNode,this.thicknessDistortionNode=e.thicknessDistortionNode,this.thicknessAmbientNode=e.thicknessAmbientNode,this.thicknessAttenuationNode=e.thicknessAttenuationNode,this.thicknessPowerNode=e.thicknessPowerNode,this.thicknessScaleNode=e.thicknessScaleNode,super.copy(e)}}const Dz=or(({normal:s,lightDirection:e,builder:t})=>{const n=s.dot(e),i=Gi(n.mul(.5).add(.5),0);if(t.material.gradientMap){const a=em("gradientMap","texture").context({getUV:()=>i});return Kn(a.r)}else{const a=i.fwidth().mul(.5);return zo(Kn(.7),Kn(1),fA(qt(.7).sub(a.x),qt(.7).add(a.x),i.x))}});class kz extends qb{direct({lightDirection:e,lightColor:t,reflectedLight:n},i){const a=Dz({normal:kb,lightDirection:e,builder:i}).mul(t);n.directDiffuse.addAssign(a.mul(x0({diffuseColor:Wl.rgb})))}indirect(e){const{ambientOcclusion:t,irradiance:n,reflectedLight:i}=e.context;i.indirectDiffuse.addAssign(n.mul(x0({diffuseColor:Wl}))),i.indirectDiffuse.mulAssign(t)}}const Vz=new jv;class zz extends yc{static get type(){return"MeshToonNodeMaterial"}constructor(e){super(),this.isMeshToonNodeMaterial=!0,this.lights=!0,this.setDefaultValues(Vz),this.setValues(e)}setupLightingModel(){return new kz}}const YR=or(()=>{const s=Kn(iu.z,0,iu.x.negate()).normalize(),e=iu.cross(s);return Gi(s.dot(cl),e.dot(cl)).mul(.495).add(.5)}).once(["NORMAL","VERTEX"])().toVar("matcapUV"),Gz=new nw;class Hz extends yc{static get type(){return"MeshMatcapNodeMaterial"}constructor(e){super(),this.isMeshMatcapNodeMaterial=!0,this.setDefaultValues(Gz),this.setValues(e)}setupVariants(e){const t=YR;let n;e.material.matcap?n=em("matcap","texture").context({getUV:()=>t}):n=Kn(zo(.2,.8,t.y)),Wl.rgb.mulAssign(n.rgb)}}class Qz extends pc{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 a=t.cos(),o=t.sin();return vb(a,o,o.negate(),a).mul(n)}else{const a=t,o=Im(Ks(1,0,0,0),Ks(0,wp(a.x),sf(a.x).negate(),0),Ks(0,sf(a.x),wp(a.x),0),Ks(0,0,0,1)),u=Im(Ks(wp(a.y),0,sf(a.y),0),Ks(0,1,0,0),Ks(sf(a.y).negate(),0,wp(a.y),0),Ks(0,0,0,1)),c=Im(Ks(wp(a.z),sf(a.z).negate(),0,0),Ks(sf(a.z),wp(a.z),0,0),Ks(0,0,1,0),Ks(0,0,0,1));return o.mul(u).mul(c).mul(Ks(n,1)).xyz}}}const Xy=to(Qz).setParameterLength(2),Wz=new BA;class qR extends yc{static get type(){return"SpriteNodeMaterial"}constructor(e){super(),this.isSpriteNodeMaterial=!0,this._useSizeAttenuation=!0,this.positionNode=null,this.rotationNode=null,this.scaleNode=null,this.transparent=!0,this.setDefaultValues(Wz),this.setValues(e)}setupPositionView(e){const{object:t,camera:n}=e,{positionNode:i,rotationNode:a,scaleNode:o,sizeAttenuation:u}=this,c=cg.mul(Kn(i||0));let d=Gi(XA[0].xyz.length(),XA[1].xyz.length());o!==null&&(d=d.mul(Gi(o))),n.isPerspectiveCamera&&u===!1&&(d=d.mul(c.z.negate()));let g=cd.xy;if(t.center&&t.center.isVector2===!0){const B=Vk("center","vec2",t);g=g.sub(B.sub(.5))}g=g.mul(d);const v=qt(a||E2),M=Xy(g,v);return Ks(c.xy.add(M),c.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)}}const Zz=new jm,Kz=new ce;class $z extends qR{static get type(){return"PointsNodeMaterial"}constructor(e){super(),this.sizeNode=null,this.isPointsNodeMaterial=!0,this.setDefaultValues(Zz),this.setValues(e)}setupPositionView(){const{positionNode:e}=this;return cg.mul(Kn(e||vc)).xyz}setupVertexSprite(e){const{material:t,camera:n}=e,{rotationNode:i,scaleNode:a,sizeNode:o,sizeAttenuation:u}=this;let c=super.setupVertex(e);if(t.isNodeMaterial!==!0)return c;let d=o!==null?Gi(o):D2;d=d.mul(aS),n.isPerspectiveCamera&&u===!0&&(d=d.mul(Xz.div(Oc.z.negate()))),a&&a.isNode&&(d=d.mul(Gi(a)));let g=cd.xy;if(i&&i.isNode){const v=qt(i);g=Xy(g,v)}return g=g.mul(d),g=g.div(oS.div(2)),g=g.mul(c.w),c=c.add(Ks(g,0,0)),c}setupVertex(e){return e.object.isPoints?super.setupVertex(e):this.setupVertexSprite(e)}get alphaToCoverage(){return this._useAlphaToCoverage}set alphaToCoverage(e){this._useAlphaToCoverage!==e&&(this._useAlphaToCoverage=e,this.needsUpdate=!0)}}const Xz=va(1).onFrameUpdate(function({renderer:s}){const e=s.getSize(Kz);this.value=.5*e.y});class jz extends qb{constructor(){super(),this.shadowNode=qt(1).toVar("shadowMask")}direct({lightNode:e}){e.shadowNode!==null&&this.shadowNode.mulAssign(e.shadowNode)}finish({context:e}){Wl.a.mulAssign(this.shadowNode.oneMinus()),e.outgoingLight.rgb.assign(Wl.rgb)}}const Yz=new Cx;class qz extends yc{static get type(){return"ShadowNodeMaterial"}constructor(e){super(),this.isShadowNodeMaterial=!0,this.lights=!0,this.transparent=!0,this.setDefaultValues(Yz),this.setValues(e)}setupLightingModel(){return new jz}}const jy=bp("vec3"),JR=bp("vec3"),eI=bp("vec3");class Jz extends null{constructor(){super()}start(e){const{material:t}=e,n=bp("vec3"),i=bp("vec3");ra(zy.sub(pA).length().greaterThan(zB.mul(2)),()=>{n.assign(zy),i.assign(pA)}).Else(()=>{n.assign(pA),i.assign(zy)});const a=i.sub(n),o=va("int").onRenderUpdate(({material:v})=>v.steps),u=a.length().div(o).toVar(),c=a.normalize().toVar(),d=qt(0).toVar(),g=Kn(1).toVar();t.offsetNode&&d.addAssign(t.offsetNode.mul(u)),kl(o,()=>{const v=n.add(c.mul(d)),M=AA.mul(Ks(v,1)).xyz;t.depthNode!==null&&(JR.assign(Cv(IS(M.z,qg,Jg))),e.context.sceneDepthNode=Cv(t.depthNode).toVar()),e.context.positionWorld=v,e.context.shadowPositionWorld=v,e.context.positionView=M,jy.assign(0);let B;t.scatteringNode&&(B=t.scatteringNode({positionRay:v})),super.start(e),B&&jy.mulAssign(B);const I=jy.mul(.01).negate().mul(u).exp();g.mulAssign(I),d.addAssign(u)}),eI.addAssign(g.saturate().oneMinus())}scatteringLight(e,t){const n=t.context.sceneDepthNode;n?ra(n.greaterThanEqual(JR),()=>{jy.addAssign(e)}):jy.addAssign(e)}direct({lightNode:e,lightColor:t},n){if(e.light.distance===void 0)return;const i=t.xyz.toVar();i.mulAssign(e.shadowNode),this.scatteringLight(i,n)}directRectArea({lightColor:e,lightPosition:t,halfWidth:n,halfHeight:i},a){const o=t.add(n).sub(i),u=t.sub(n).sub(i),c=t.sub(n).add(i),d=t.add(n).add(i),g=a.context.positionView,v=e.xyz.mul(tz({P:g,p0:o,p1:u,p2:c,p3:d})).pow(1.5);this.scatteringLight(v,a)}finish(e){e.context.outgoingLight.assign(eI)}}class zX extends null{static get type(){return"VolumeNodeMaterial"}constructor(e){super(),this.isVolumeNodeMaterial=!0,this.steps=25,this.offsetNode=null,this.scatteringNode=null,this.lights=!0,this.transparent=!0,this.side=BackSide,this.depthTest=!1,this.depthWrite=!1,this.setValues(e)}setupLightingModel(){return new Jz}}class e5{constructor(e,t,n){this.renderer=e,this.nodes=t,this.info=n,this._context=typeof self!="undefined"?self:null,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.renderer._inspector.begin(),this._animationLoop!==null&&this._animationLoop(t,n),this.renderer._inspector.finish()};e()}stop(){this._context.cancelAnimationFrame(this._requestId),this._requestId=null}getAnimationLoop(){return this._animationLoop}setAnimationLoop(e){this._animationLoop=e}getContext(){return this._context}setContext(e){this._context=e}dispose(){this.stop()}}class Mp{constructor(){this.weakMaps={}}_getWeakMap(e){const t=e.length;let n=this.weakMaps[t];return n===void 0&&(n=new WeakMap,this.weakMaps[t]=n),n}get(e){let t=this._getWeakMap(e);for(let n=0;n<e.length-1;n++)if(t=t.get(e[n]),t===void 0)return;return t.get(e[e.length-1])}set(e,t){let n=this._getWeakMap(e);for(let i=0;i<e.length-1;i++){const a=e[i];n.has(a)===!1&&n.set(a,new WeakMap),n=n.get(a)}return n.set(e[e.length-1],t),this}delete(e){let t=this._getWeakMap(e);for(let n=0;n<e.length-1;n++)if(t=t.get(e[n]),t===void 0)return!1;return t.delete(e[e.length-1])}}let t5=0;function n5(s){const e=Object.keys(s);let t=Object.getPrototypeOf(s);for(;t;){const n=Object.getOwnPropertyDescriptors(t);for(const i in n)if(n[i]!==void 0){const a=n[i];a&&typeof a.get=="function"&&e.push(i)}t=Object.getPrototypeOf(t)}return e}class r5{constructor(e,t,n,i,a,o,u,c,d,g){this.id=t5++,this._nodes=e,this._geometries=t,this.renderer=n,this.object=i,this.material=a,this.scene=o,this.camera=u,this.lightsNode=c,this.context=d,this.geometry=i.geometry,this.version=a.version,this.drawRange=null,this.attributes=null,this.attributesId=null,this.pipeline=null,this.group=null,this.vertexBuffers=null,this.drawParams=null,this.bundle=null,this.clippingContext=g,this.clippingContextCacheKey=g!==null?g.cacheKey:"",this.initialNodesCacheKey=this.getDynamicCacheKey(),this.initialCacheKey=this.getCacheKey(),this._nodeBuilderState=null,this._bindings=null,this._monitor=null,this.onDispose=null,this.isRenderObject=!0,this.onMaterialDispose=()=>{this.dispose()},this.onGeometryDispose=()=>{this.attributes=null,this.attributesId=null},this.material.addEventListener("dispose",this.onMaterialDispose),this.geometry.addEventListener("dispose",this.onGeometryDispose)}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().observer)}getBindings(){return this._bindings||(this._bindings=this.getNodeBuilderState().createBindings())}getBindingGroup(e){for(const t of this.getBindings())if(t.name===e)return t}getIndex(){return this._geometries.getIndex(this)}getIndirect(){return this._geometries.getIndirect(this)}getIndirectOffset(){return this._geometries.getIndirectOffset(this)}getChainArray(){return[this.object,this.material,this.context,this.lightsNode]}setGeometry(e){this.geometry=e,this.attributes=null,this.attributesId=null}getAttributes(){if(this.attributes!==null)return this.attributes;const e=this.getNodeBuilderState().nodeAttributes,t=this.geometry,n=[],i=new Set,a={};for(const o of e){let u;if(o.node&&o.node.attribute?u=o.node.attribute:(u=t.getAttribute(o.name),a[o.name]=u.version),u===void 0)continue;n.push(u);const c=u.isInterleavedBufferAttribute?u.data:u;i.add(c)}return this.attributes=n,this.attributesId=a,this.vertexBuffers=Array.from(i.values()),n}getVertexBuffers(){return this.vertexBuffers===null&&this.getAttributes(),this.vertexBuffers}getDrawParameters(){const{object:e,material:t,geometry:n,group:i,drawRange:a}=this,o=this.drawParams||(this.drawParams={vertexCount:0,firstVertex:0,instanceCount:0,firstInstance:0}),u=this.getIndex(),c=u!==null;let d=1;if(n.isInstancedBufferGeometry===!0?d=n.instanceCount:e.count!==void 0&&(d=Math.max(0,e.count)),d===0)return null;if(o.instanceCount=d,e.isBatchedMesh===!0)return o;let g=1;t.wireframe===!0&&!e.isPoints&&!e.isLineSegments&&!e.isLine&&!e.isLineLoop&&(g=2);let v=a.start*g,M=(a.start+a.count)*g;i!==null&&(v=Math.max(v,i.start*g),M=Math.min(M,(i.start+i.count)*g));const B=n.attributes.position;let I=1/0;c?I=u.count:B!=null&&(I=B.count),v=Math.max(v,0),M=Math.min(M,I);const ne=M-v;return ne<0||ne===1/0?null:(o.vertexCount=ne,o.firstVertex=v,o)}getGeometryCacheKey(){const{geometry:e}=this;let t="";for(const n of Object.keys(e.attributes).sort()){const i=e.attributes[n];t+=n+",",i.data&&(t+=i.data.stride+","),i.offset&&(t+=i.offset+","),i.itemSize&&(t+=i.itemSize+","),i.normalized&&(t+="n,")}for(const n of Object.keys(e.morphAttributes).sort()){const i=e.morphAttributes[n];t+="morph-"+n+",";for(let a=0,o=i.length;a<o;a++){const u=i[a];t+=u.id+","}}return e.index&&(t+="index,"),t}getMaterialCacheKey(){const{object:e,material:t,renderer:n}=this;let i=t.customProgramCacheKey();for(const a of n5(t)){if(/^(is[A-Z]|_)|^(visible|version|uuid|name|opacity|userData)$/.test(a))continue;const o=t[a];let u;if(o!==null){const c=typeof o;c==="number"?u=o!==0?"1":"0":c==="object"?(u="{",o.isTexture&&(u+=o.mapping,n.backend.isWebGPUBackend===!0&&(u+=o.magFilter,u+=o.minFilter,u+=o.wrapS,u+=o.wrapT,u+=o.wrapR)),u+="}"):u=String(o)}else u=String(o);i+=u+","}return i+=this.clippingContextCacheKey+",",e.geometry&&(i+=this.getGeometryCacheKey()),e.skeleton&&(i+=e.skeleton.bones.length+","),e.isBatchedMesh&&(i+=e._matricesTexture.uuid+",",e._colorsTexture!==null&&(i+=e._colorsTexture.uuid+",")),(e.isInstancedMesh||e.count>1||Array.isArray(e.morphTargetInfluences))&&(i+=e.uuid+","),i+=this.context.id+",",i+=e.receiveShadow+",",dv(i)}get needsGeometryUpdate(){if(this.geometry.id!==this.object.geometry.id)return!0;if(this.attributes!==null){const e=this.attributesId;for(const t in e){const n=this.geometry.getAttribute(t);if(n===void 0||e[t]!==n.id)return!0}}return!1}get needsUpdate(){return this.initialNodesCacheKey!==this.getDynamicCacheKey()||this.clippingNeedsUpdate}getDynamicCacheKey(){let e=0;return this.material.isShadowPassMaterial!==!0&&(e=this._nodes.getCacheKey(this.scene,this.lightsNode)),this.camera.isArrayCamera&&(e=fv(e,this.camera.cameras.length)),this.object.receiveShadow&&(e=fv(e,1)),e=fv(e,this.camera.id,this.renderer.contextNode.id,this.renderer.contextNode.version),e}getCacheKey(){return this.getMaterialCacheKey()+this.getDynamicCacheKey()}dispose(){this.material.removeEventListener("dispose",this.onMaterialDispose),this.geometry.removeEventListener("dispose",this.onGeometryDispose),this.onDispose()}}const _0=[];class i5{constructor(e,t,n,i,a,o){this.renderer=e,this.nodes=t,this.geometries=n,this.pipelines=i,this.bindings=a,this.info=o,this.chainMaps={}}get(e,t,n,i,a,o,u,c){const d=this.getChainMap(c);_0[0]=e,_0[1]=t,_0[2]=o,_0[3]=a;let g=d.get(_0);return g===void 0?(g=this.createRenderObject(this.nodes,this.geometries,this.renderer,e,t,n,i,a,o,u,c),d.set(_0,g)):(g.updateClipping(u),g.needsGeometryUpdate&&g.setGeometry(e.geometry),(g.version!==t.version||g.needsUpdate)&&(g.initialCacheKey!==g.getCacheKey()?(g.dispose(),g=this.get(e,t,n,i,a,o,u,c)):g.version=t.version)),_0.length=0,g}getChainMap(e="default"){return this.chainMaps[e]||(this.chainMaps[e]=new Mp)}dispose(){this.chainMaps={}}createRenderObject(e,t,n,i,a,o,u,c,d,g,v){const M=this.getChainMap(v),B=new r5(e,t,n,i,a,o,u,c,d,g);return B.onDispose=()=>{this.pipelines.delete(B),this.bindings.deleteForRender(B),this.nodes.delete(B),M.delete(B.getChainArray())},B}}class Vm{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 YA={VERTEX:1,INDEX:2,STORAGE:3,INDIRECT:4},zm=16,s5=211,a5=212;class o5 extends Vm{constructor(e){super(),this.backend=e}delete(e){const t=super.delete(e);return t!==null&&this.backend.destroyAttribute(e),t}update(e,t){const n=this.get(e);if(n.version===void 0)t===YA.VERTEX?this.backend.createAttribute(e):t===YA.INDEX?this.backend.createIndexAttribute(e):t===YA.STORAGE?this.backend.createStorageAttribute(e):t===YA.INDIRECT&&this.backend.createIndirectStorageAttribute(e),n.version=this._getBufferAttribute(e).version;else{const i=this._getBufferAttribute(e);(n.version<i.version||i.usage===mh)&&(this.backend.updateAttribute(e),n.version=i.version)}}_getBufferAttribute(e){return e.isInterleavedBufferAttribute&&(e=e.data),e}}function tI(s){return s.index!==null?s.index.version:s.attributes.position.version}function nI(s){const e=[],t=s.index,n=s.attributes.position;if(t!==null){const a=t.array;for(let o=0,u=a.length;o<u;o+=3){const c=a[o+0],d=a[o+1],g=a[o+2];e.push(c,d,d,g,g,c)}}else{const a=n.array;for(let o=0,u=a.length/3-1;o<u;o+=3){const c=o+0,d=o+1,g=o+2;e.push(c,d,d,g,g,c)}}const i=new(Oo(e)?ff:qh)(e,1);return i.version=tI(s),i}class l5 extends Vm{constructor(e,t){super(),this.attributes=e,this.info=t,this.wireframes=new WeakMap,this.attributeCall=new WeakMap,this._geometryDisposeListeners=new Map}has(e){const t=e.geometry;return super.has(t)&&this.get(t).initialized===!0}updateForRender(e){this.has(e)===!1&&this.initGeometry(e),this.updateAttributes(e)}initGeometry(e){const t=e.geometry,n=this.get(t);n.initialized=!0,this.info.memory.geometries++;const i=()=>{this.info.memory.geometries--;const a=t.index,o=e.getAttributes();a!==null&&this.attributes.delete(a);for(const c of o)this.attributes.delete(c);const u=this.wireframes.get(t);u!==void 0&&this.attributes.delete(u),t.removeEventListener("dispose",i),this._geometryDisposeListeners.delete(t)};t.addEventListener("dispose",i),this._geometryDisposeListeners.set(t,i)}updateAttributes(e){const t=e.getAttributes();for(const a of t)a.isStorageBufferAttribute||a.isStorageInstancedBufferAttribute?this.updateAttribute(a,YA.STORAGE):this.updateAttribute(a,YA.VERTEX);const n=this.getIndex(e);n!==null&&this.updateAttribute(n,YA.INDEX);const i=e.geometry.indirect;i!==null&&this.updateAttribute(i,YA.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}getIndirectOffset(e){return e.geometry.indirectOffset}getIndex(e){const{geometry:t,material:n}=e;let i=t.index;if(n.wireframe===!0){const a=this.wireframes;let o=a.get(t);o===void 0?(o=nI(t),a.set(t,o)):o.version!==tI(t)&&(this.attributes.delete(o),o=nI(t),a.set(t,o)),i=o}return i}dispose(){for(const[e,t]of this._geometryDisposeListeners.entries())e.removeEventListener("dispose",t);this._geometryDisposeListeners.clear()}}class u5{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},this.compute={calls:0,frameCalls:0,timestamp: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):Gr("WebGPUInfo: Unknown object type.")}reset(){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 rI{constructor(e){this.cacheKey=e,this.usedTimes=0}}class c5 extends rI{constructor(e,t,n){super(e),this.vertexProgram=t,this.fragmentProgram=n}}class h5 extends rI{constructor(e,t){super(e),this.computeProgram=t,this.isComputePipeline=!0}}let d5=0;class tM{constructor(e,t,n,i=null,a=null){this.id=d5++,this.code=e,this.stage=t,this.name=n,this.transforms=i,this.attributes=a,this.usedTimes=0}}class f5 extends Vm{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,i=this.get(e);if(this._needsComputeUpdate(e)){const a=i.pipeline;a&&(a.usedTimes--,a.computeProgram.usedTimes--);const o=this.nodes.getForCompute(e);let u=this.programs.compute.get(o.computeShader);u===void 0&&(a&&a.computeProgram.usedTimes===0&&this._releaseProgram(a.computeProgram),u=new tM(o.computeShader,"compute",e.name,o.transforms,o.nodeAttributes),this.programs.compute.set(o.computeShader,u),n.createProgram(u));const c=this._getComputeCacheKey(e,u);let d=this.caches.get(c);d===void 0&&(a&&a.usedTimes===0&&this._releasePipeline(a),d=this._getComputePipeline(e,u,c,t)),d.usedTimes++,u.usedTimes++,i.version=e.version,i.pipeline=d}return i.pipeline}getForRender(e,t=null){const{backend:n}=this,i=this.get(e);if(this._needsRenderUpdate(e)){const a=i.pipeline;a&&(a.usedTimes--,a.vertexProgram.usedTimes--,a.fragmentProgram.usedTimes--);const o=e.getNodeBuilderState(),u=e.material?e.material.name:"";let c=this.programs.vertex.get(o.vertexShader);c===void 0&&(a&&a.vertexProgram.usedTimes===0&&this._releaseProgram(a.vertexProgram),c=new tM(o.vertexShader,"vertex",u),this.programs.vertex.set(o.vertexShader,c),n.createProgram(c));let d=this.programs.fragment.get(o.fragmentShader);d===void 0&&(a&&a.fragmentProgram.usedTimes===0&&this._releaseProgram(a.fragmentProgram),d=new tM(o.fragmentShader,"fragment",u),this.programs.fragment.set(o.fragmentShader,d),n.createProgram(d));const g=this._getRenderCacheKey(e,c,d);let v=this.caches.get(g);v===void 0?(a&&a.usedTimes===0&&this._releasePipeline(a),v=this._getRenderPipeline(e,c,d,g,t)):e.pipeline=v,v.usedTimes++,c.usedTimes++,d.usedTimes++,i.pipeline=v}return i.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,i){n=n||this._getComputeCacheKey(e,t);let a=this.caches.get(n);return a===void 0&&(a=new h5(n,t),this.caches.set(n,a),this.backend.createComputePipeline(a,i)),a}_getRenderPipeline(e,t,n,i,a){i=i||this._getRenderCacheKey(e,t,n);let o=this.caches.get(i);return o===void 0&&(o=new c5(i,t,n),this.caches.set(i,o),e.pipeline=o,this.backend.createRenderPipeline(e,a)),o}_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 A5 extends Vm{constructor(e,t,n,i,a,o){super(),this.backend=e,this.textures=n,this.pipelines=a,this.attributes=i,this.nodes=t,this.info=o,this.pipelines.bindings=this}getForRender(e){const t=e.getBindings();for(const n of t){const i=this.get(n);i.bindGroup===void 0&&(this._init(n),this.backend.createBindings(n,t,0),i.bindGroup=n)}return t}getForCompute(e){const t=this.nodes.getForCompute(e).bindings;for(const n of t){const i=this.get(n);i.bindGroup===void 0&&(this._init(n),this.backend.createBindings(n,t,0),i.bindGroup=n)}return t}updateForCompute(e){this._updateBindings(this.getForCompute(e))}updateForRender(e){this._updateBindings(this.getForRender(e))}deleteForCompute(e){const t=this.nodes.getForCompute(e).bindings;for(const n of t)this.backend.deleteBindGroupData(n),this.delete(n)}deleteForRender(e){const t=e.getBindings();for(const n of t)this.backend.deleteBindGroupData(n),this.delete(n)}_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.isSampler)this.textures.updateSampler(t.texture);else if(t.isStorageBuffer){const n=t.attribute,i=n.isIndirectStorageBufferAttribute?YA.INDIRECT:YA.STORAGE;this.attributes.update(n,i)}}_update(e,t){const{backend:n}=this;let i=!1,a=!0,o=0,u=0;for(const c of e.bindings)if(this.nodes.updateGroup(c)!==!1){if(c.isStorageBuffer){const g=c.attribute,v=g.isIndirectStorageBufferAttribute?YA.INDIRECT:YA.STORAGE;this.attributes.update(g,v)}if(c.isUniformBuffer)c.update()&&n.updateBinding(c);else if(c.isSampledTexture){const g=c.update(),v=c.texture,M=this.textures.get(v);if(g&&(this.textures.updateTexture(v),c.generation!==M.generation&&(c.generation=M.generation,i=!0,a=!1)),n.get(v).externalTexture!==void 0||M.isDefaultTexture?a=!1:(o=o*10+v.id,u+=v.version),v.isStorageTexture===!0&&v.mipmapsAutoUpdate===!0){const I=this.get(v);c.store===!0?I.needsMipmap=!0:this.textures.needsMipmaps(v)&&I.needsMipmap===!0&&(this.backend.generateMipmaps(v),I.needsMipmap=!1)}}else if(c.isSampler&&c.update()){const v=this.textures.updateSampler(c.texture);c.samplerKey!==v&&(c.samplerKey=v,i=!0,a=!1)}}i===!0&&this.backend.updateBindings(e,t,a?o:0,u)}}function p5(s,e){return s.groupOrder!==e.groupOrder?s.groupOrder-e.groupOrder:s.renderOrder!==e.renderOrder?s.renderOrder-e.renderOrder:s.z!==e.z?s.z-e.z:s.id-e.id}function iI(s,e){return s.groupOrder!==e.groupOrder?s.groupOrder-e.groupOrder:s.renderOrder!==e.renderOrder?s.renderOrder-e.renderOrder:s.z!==e.z?e.z-s.z:s.id-e.id}function sI(s){return(s.transmission>0||s.transmissionNode&&s.transmissionNode.isNode)&&s.side===he&&s.forceSinglePass===!1}class g5{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,i,a,o,u){let c=this.renderItems[this.renderItemsIndex];return c===void 0?(c={id:e.id,object:e,geometry:t,material:n,groupOrder:i,renderOrder:e.renderOrder,z:a,group:o,clippingContext:u},this.renderItems[this.renderItemsIndex]=c):(c.id=e.id,c.object=e,c.geometry=t,c.material=n,c.groupOrder=i,c.renderOrder=e.renderOrder,c.z=a,c.group=o,c.clippingContext=u),this.renderItemsIndex++,c}push(e,t,n,i,a,o,u){const c=this.getNextRenderItem(e,t,n,i,a,o,u);e.occlusionTest===!0&&this.occlusionQueryCount++,n.transparent===!0||n.transmission>0||n.transmissionNode&&n.transmissionNode.isNode||n.backdropNode&&n.backdropNode.isNode?(sI(n)&&this.transparentDoublePass.push(c),this.transparent.push(c)):this.opaque.push(c)}unshift(e,t,n,i,a,o,u){const c=this.getNextRenderItem(e,t,n,i,a,o,u);n.transparent===!0||n.transmission>0||n.transmissionNode&&n.transmissionNode.isNode||n.backdropNode&&n.backdropNode.isNode?(sI(n)&&this.transparentDoublePass.unshift(c),this.transparent.unshift(c)):this.opaque.unshift(c)}pushBundle(e){this.bundles.push(e)}pushLight(e){this.lightsArray.push(e)}sort(e,t){this.opaque.length>1&&this.opaque.sort(e||p5),this.transparentDoublePass.length>1&&this.transparentDoublePass.sort(t||iI),this.transparent.length>1&&this.transparent.sort(t||iI)}finish(){this.lightsNode.setLights(this.lightsArray);for(let e=this.renderItemsIndex,t=this.renderItems.length;e<t;e++){const n=this.renderItems[e];if(n.id===null)break;n.id=null,n.object=null,n.geometry=null,n.material=null,n.groupOrder=null,n.renderOrder=null,n.z=null,n.group=null,n.clippingContext=null}}}const Yy=[];class m5{constructor(e){this.lighting=e,this.lists=new Mp}get(e,t){const n=this.lists;Yy[0]=e,Yy[1]=t;let i=n.get(Yy);return i===void 0&&(i=new g5(this.lighting,e,t),n.set(Yy,i)),Yy.length=0,i}dispose(){this.lists=new Mp}}let v5=0;class y5{constructor(){this.id=v5++,this.color=!0,this.clearColor=!0,this.clearColorValue={r:0,g:0,b:0,a:1},this.depth=!0,this.clearDepth=!0,this.clearDepthValue=1,this.stencil=!1,this.clearStencil=!0,this.clearStencilValue=1,this.viewport=!1,this.viewportValue=new Ni,this.scissor=!1,this.scissorValue=new Ni,this.renderTarget=null,this.textures=null,this.depthTexture=null,this.activeCubeFace=0,this.activeMipmapLevel=0,this.sampleCount=1,this.width=0,this.height=0,this.occlusionQueryCount=0,this.clippingContext=null,this.isRenderContext=!0}getCacheKey(){return aI(this)}}function aI(s){const{textures:e,activeCubeFace:t,activeMipmapLevel:n}=s,i=[t,n];for(const a of e)i.push(a.id);return o0(i)}const Rv=[],x5=new _d,b5=new Qd;class _5{constructor(){this.chainMaps={}}get(e,t,n=null,i=null){Rv[0]=e,Rv[1]=t,i!==null&&(Rv[2]=i);let a;if(n===null)a="default";else{const c=n.texture.format;a=`${n.textures.length}:${c}:${n.samples}:${n.depthBuffer}:${n.stencilBuffer}`}const o=this._getChainMap(a);let u=o.get(Rv);return u===void 0&&(u=new y5,o.set(Rv,u)),Rv.length=0,n!==null&&(u.sampleCount=n.samples===0?1:n.samples),u}getForClear(e=null){return this.get(x5,b5,e)}_getChainMap(e){return this.chainMaps[e]||(this.chainMaps[e]=new Mp)}dispose(){this.chainMaps={}}}const w5=new le;class S5 extends Vm{constructor(e,t,n){super(),this.renderer=e,this.backend=t,this.info=n}updateRenderTarget(e,t=0){const n=this.get(e),i=e.samples===0?1:e.samples,a=n.depthTextureMips||(n.depthTextureMips={}),o=e.textures,u=this.getSize(o[0]),c=u.width>>t,d=u.height>>t;let g=e.depthTexture||a[t];const v=e.depthBuffer===!0||e.stencilBuffer===!0;let M=!1;g===void 0&&v&&(g=new Al,g.format=e.stencilBuffer?w:Q,g.type=e.stencilBuffer?ar:st,g.image.width=c,g.image.height=d,g.image.depth=u.depth,g.renderTarget=e,g.isArrayTexture=e.multiview===!0&&u.depth>1,a[t]=g),(n.width!==u.width||u.height!==n.height)&&(M=!0,g&&(g.needsUpdate=!0,g.image.width=c,g.image.height=d,g.image.depth=g.isArrayTexture?g.image.depth:1)),n.width=u.width,n.height=u.height,n.textures=o,n.depthTexture=g||null,n.depth=e.depthBuffer,n.stencil=e.stencilBuffer,n.renderTarget=e,n.sampleCount!==i&&(M=!0,g&&(g.needsUpdate=!0),n.sampleCount=i);const B={sampleCount:i};if(e.isXRRenderTarget!==!0){for(let I=0;I<o.length;I++){const ne=o[I];M&&(ne.needsUpdate=!0),this.updateTexture(ne,B)}g&&this.updateTexture(g,B)}n.initialized!==!0&&(n.initialized=!0,n.onDispose=()=>{this._destroyRenderTarget(e)},e.addEventListener("dispose",n.onDispose))}updateTexture(e,t={}){const n=this.get(e);if(n.initialized===!0&&n.version===e.version)return;const i=e.isRenderTargetTexture||e.isDepthTexture||e.isFramebufferTexture,a=this.backend;if(i&&n.initialized===!0&&a.destroyTexture(e),e.isFramebufferTexture){const d=this.renderer.getRenderTarget();d?e.type=d.texture.type:e.type=es}const{width:o,height:u,depth:c}=this.getSize(e);if(t.width=o,t.height=u,t.depth=c,t.needsMipmaps=this.needsMipmaps(e),t.levels=t.needsMipmaps?this.getMipLevels(e,o,u):1,e.isCubeTexture&&e.mipmaps.length>0&&t.levels++,i||e.isStorageTexture===!0||e.isExternalTexture===!0)a.createTexture(e,t),n.generation=e.version;else if(e.version>0){const d=e.image;if(d===void 0)Lr("Renderer: Texture marked for update but image is undefined.");else if(d.complete===!1)Lr("Renderer: Texture marked for update but image is incomplete.");else{if(e.images){const v=[];for(const M of e.images)v.push(M);t.images=v}else t.image=d;(n.isDefaultTexture===void 0||n.isDefaultTexture===!0)&&(a.createTexture(e,t),n.isDefaultTexture=!1,n.generation=e.version),e.source.dataReady===!0&&a.updateTexture(e,t);const g=e.isStorageTexture===!0&&e.mipmapsAutoUpdate===!1;t.needsMipmaps&&e.mipmaps.length===0&&!g&&a.generateMipmaps(e),e.onUpdate&&e.onUpdate(e)}}else a.createDefaultTexture(e),n.isDefaultTexture=!0,n.generation=e.version;n.initialized!==!0&&(n.initialized=!0,n.generation=e.version,this.info.memory.textures++,e.isVideoTexture&&xr.enabled===!0&&xr.getTransfer(e.colorSpace)!==ws&&Lr("WebGPURenderer: Video textures must use a color space with a sRGB transfer function, e.g. SRGBColorSpace."),n.onDispose=()=>{this._destroyTexture(e)},e.addEventListener("dispose",n.onDispose)),n.version=e.version}updateSampler(e){return this.backend.updateSampler(e)}getSize(e,t=w5){let n=e.images?e.images[0]:e.image;return n?(n.image!==void 0&&(n=n.image),typeof HTMLVideoElement!="undefined"&&n instanceof HTMLVideoElement?(t.width=n.videoWidth||1,t.height=n.videoHeight||1,t.depth=1):typeof VideoFrame!="undefined"&&n instanceof VideoFrame?(t.width=n.displayWidth||1,t.height=n.displayHeight||1,t.depth=1):(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 i;return e.mipmaps.length>0?i=e.mipmaps.length:e.isCompressedTexture===!0?i=1:i=Math.floor(Math.log2(Math.max(t,n)))+1,i}needsMipmaps(e){return e.generateMipmaps===!0||e.mipmaps.length>0}_destroyRenderTarget(e){if(this.has(e)===!0){const t=this.get(e),n=t.textures,i=t.depthTexture;e.removeEventListener("dispose",t.onDispose);for(let a=0;a<n.length;a++)this._destroyTexture(n[a]);i&&this._destroyTexture(i),this.delete(e),this.backend.delete(e)}}_destroyTexture(e){if(this.has(e)===!0){const t=this.get(e);e.removeEventListener("dispose",t.onDispose);const n=t.isDefaultTexture;this.backend.destroyTexture(e,n),this.delete(e),this.info.memory.textures--}}}class nM extends Wr{constructor(e,t,n,i=1){super(e,t,n),this.a=i}set(e,t,n,i=1){return this.a=i,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 oI extends Fl{static get type(){return"ParameterNode"}constructor(e,t=null){super(e,t),this.isParameterNode=!0}getMemberType(e,t){const n=this.getNodeType(e),i=e.getStructTypeNode(n);let a;return i!==null?a=i.getMemberType(e,t):(Gr(`TSL: Member "${t}" not found in struct "${n}".`),a="float"),a}getHash(){return this.uuid}generate(){return this.name}}const M5=(s,e)=>new oI(s,e);class E5 extends ta{static get type(){return"StackNode"}constructor(e=null){super(),this.nodes=[],this.outputNode=null,this.parent=e,this._currentCond=null,this._expressionNode=null,this._currentNode=null,this.isStackNode=!0}getElementType(e){return this.hasOutput?this.outputNode.getElementType(e):"void"}getNodeType(e){return this.hasOutput?this.outputNode.getNodeType(e):"void"}getMemberType(e,t){return this.hasOutput?this.outputNode.getMemberType(e,t):"void"}addToStack(e,t=this.nodes.length){return e.isNode!==!0?(Gr("TSL: Invalid node added to stack."),this):(this.nodes.splice(t,0,e),this)}addToStackBefore(e){const t=this._currentNode?this.nodes.indexOf(this._currentNode):0;return this.addToStack(e,t)}If(e,t){const n=new Av(t);return this._currentCond=ud(e,n),this.addToStack(this._currentCond)}ElseIf(e,t){const n=new Av(t),i=ud(e,n);return this._currentCond.elseNode=i,this._currentCond=i,this}Else(e){return this._currentCond.elseNode=new Av(e),this}Switch(e){return this._expressionNode=Ss(e),this}Case(...e){const t=[];if(e.length>=2)for(let u=0;u<e.length-1;u++)t.push(this._expressionNode.equal(Ss(e[u])));else Gr("TSL: Invalid parameter length. Case() requires at least two parameters.");const n=e[e.length-1],i=new Av(n);let a=t[0];for(let u=1;u<t.length;u++)a=a.or(t[u]);const o=ud(a,i);return this._currentCond===null?(this._currentCond=o,this.addToStack(this._currentCond)):(this._currentCond.elseNode=o,this._currentCond=o,this)}Default(e){return this.Else(e),this}setup(e){const t=e.getNodeProperties(this);let n=0;for(const i of this.getChildren())i.isVarNode&&i.isIntent(e)&&i.isAssign(e)!==!0||(t["node"+n++]=i);return t.outputNode||null}get hasOutput(){return this.outputNode&&this.outputNode.isNode}build(e,...t){const n=x1(),i=e.buildStage;Iy(this),e.setActiveStack(this);const a=d=>{if(this._currentNode=d,!(d.isVarNode&&d.isIntent(e)&&d.isAssign(e)!==!0)){if(i==="setup")d.build(e);else if(i==="analyze")d.build(e,this);else if(i==="generate"){const g=e.getDataFromNode(d,"any").stages,v=g&&g[e.shaderStage];if(d.isVarNode&&v&&v.length===1&&v[0]&&v[0].isStackNode)return;d.build(e,"void")}}},o=[...this.nodes];for(const d of o)a(d);this._currentNode=null;const u=this.nodes.filter(d=>o.indexOf(d)===-1);for(const d of u)a(d);let c;return this.hasOutput?c=this.outputNode.build(e,...t):c=super.build(e,...t),Iy(n),e.removeActiveStack(this),c}}const a_=to(E5).setParameterLength(0,1);function C5(s){return Object.entries(s).map(([e,t])=>typeof t=="string"?{name:e,type:t,atomic:!1}:{name:e,type:t.type,atomic:t.atomic||!1})}class T5 extends ta{static get type(){return"StructTypeNode"}constructor(e,t=null){super("struct"),this.membersLayout=C5(e),this.name=t,this.isStructLayoutNode=!0}getLength(){const e=Float32Array.BYTES_PER_ELEMENT;let t=1,n=0;for(const i of this.membersLayout){const a=i.type,o=jC(a),u=YC(a)/e;t=Math.max(t,u);const d=n%t%u;d!==0&&(n+=u-d),n+=o}return Math.ceil(n/t)*t}getMemberType(e,t){const n=this.membersLayout.find(i=>i.name===t);return n?n.type:"void"}getNodeType(e){return e.getStructTypeFromNode(this,this.membersLayout,this.name).name}setup(e){e.getStructTypeFromNode(this,this.membersLayout,this.name),e.addInclude(this)}generate(e){return this.getNodeType(e)}}class B5 extends ta{static get type(){return"StructNode"}constructor(e,t){super("vec3"),this.structTypeNode=e,this.values=t,this.isStructNode=!0}getNodeType(e){return this.structTypeNode.getNodeType(e)}getMemberType(e,t){return this.structTypeNode.getMemberType(e,t)}generate(e){const t=e.getVarFromNode(this),n=t.type,i=e.getPropertyName(t);return e.addLineFlowCode(`${i} = ${e.generateStruct(n,this.structTypeNode.membersLayout,this.values)}`,this),t.name}}const R5=(s,e=null)=>{const t=new T5(s,e),n=(...i)=>{let a=null;if(i.length>0)if(i[0].isNode){a={};const o=Object.keys(s);for(let u=0;u<i.length;u++)a[o[u]]=i[u]}else a=i[0];return new B5(t,a)};return n.layout=t,n.isStruct=!0,n};class lI extends ta{static get type(){return"OutputStructNode"}constructor(...e){super(),this.members=e,this.isOutputStructNode=!0}getNodeType(e){const t=e.getNodeProperties(this);if(t.membersLayout===void 0){const n=this.members,i=[];for(let a=0;a<n.length;a++){const o="m"+a,u=n[a].getNodeType(e);i.push({name:o,type:u,index:a})}t.membersLayout=i,t.structType=e.getOutputStructTypeFromNode(this,t.membersLayout)}return t.structType.name}generate(e){const t=e.getOutputStructName(),n=this.members,i=t!==""?t+".":"";for(let a=0;a<n.length;a++){const o=n[a].build(e);e.addLineFlowCode(`${i}m${a} = ${o}`,this)}return t}}const I5=to(lI);function uI(s,e){for(let t=0;t<s.length;t++)if(s[t].name===e)return t;return-1}class N5 extends lI{static get type(){return"MRTNode"}constructor(e){super(),this.outputNodes=e,this.isMRTNode=!0}has(e){return this.outputNodes[e]!==void 0}get(e){return this.outputNodes[e]}merge(e){const t=rl(rl({},this.outputNodes),e.outputNodes);return cI(t)}setup(e){const t=this.outputNodes,n=e.renderer.getRenderTarget(),i=[],a=n.textures;for(const o in t){const u=uI(a,o);i[u]=Ks(t[o])}return this.members=i,super.setup(e)}}const cI=to(N5);class qy extends pc{static get type(){return"BitcastNode"}constructor(e,t,n=null){super(),this.valueNode=e,this.conversionType=t,this.inputType=n,this.isBitcastNode=!0}getNodeType(e){if(this.inputType!==null){const t=this.valueNode.getNodeType(e),n=e.getTypeLength(t);return e.getTypeFromLength(n,this.conversionType)}return this.conversionType}generate(e){const t=this.getNodeType(e);let n="";if(this.inputType!==null){const i=this.valueNode.getNodeType(e);n=e.getTypeLength(i)===1?this.inputType:e.changeComponentType(i,this.inputType)}else n=this.valueNode.getNodeType(e);return`${e.getBitcastMethod(t,n)}( ${this.valueNode.build(e,n)} )`}}const hI=ji(qy).setParameterLength(2),F5=s=>new qy(s,"int","float"),dI=s=>new qy(s,"uint","float"),P5=s=>new qy(s,"float","int"),L5=s=>new qy(s,"float","uint"),o_={};class mA extends Or{static get type(){return"BitcountNode"}constructor(e,t){super(e,t),this.isBitcountNode=!0}_resolveElementType(e,t,n){n==="int"?t.assign(hI(e,"uint")):t.assign(e)}_returnDataNode(e){switch(e){case"uint":return Fi;case"int":return Qn;case"uvec2":return b1;case"uvec3":return h0;case"uvec4":return M1;case"ivec2":return ch;case"ivec3":return _1;case"ivec4":return S1}}_createTrailingZerosBaseLayout(e,t){const n=this._returnDataNode(t);return or(([a])=>{const o=Fi(0);this._resolveElementType(a,o,t);const u=qt(o.bitAnd(k1(o))),d=dI(u).shiftRight(23).sub(127);return n(d)}).setLayout({name:e,type:t,inputs:[{name:"value",type:t}]})}_createLeadingZerosBaseLayout(e,t){const n=this._returnDataNode(t);return or(([a])=>{ra(a.equal(Fi(0)),()=>Fi(32));const o=Fi(0),u=Fi(0);return this._resolveElementType(a,o,t),ra(o.shiftRight(16).equal(0),()=>{u.addAssign(16),o.shiftLeftAssign(16)}),ra(o.shiftRight(24).equal(0),()=>{u.addAssign(8),o.shiftLeftAssign(8)}),ra(o.shiftRight(28).equal(0),()=>{u.addAssign(4),o.shiftLeftAssign(4)}),ra(o.shiftRight(30).equal(0),()=>{u.addAssign(2),o.shiftLeftAssign(2)}),ra(o.shiftRight(31).equal(0),()=>{u.addAssign(1)}),n(u)}).setLayout({name:e,type:t,inputs:[{name:"value",type:t}]})}_createOneBitsBaseLayout(e,t){const n=this._returnDataNode(t);return or(([a])=>{const o=Fi(0);this._resolveElementType(a,o,t),o.assign(o.sub(o.shiftRight(Fi(1)).bitAnd(Fi(1431655765)))),o.assign(o.bitAnd(Fi(858993459)).add(o.shiftRight(Fi(2)).bitAnd(Fi(858993459))));const u=o.add(o.shiftRight(Fi(4))).bitAnd(Fi(252645135)).mul(Fi(16843009)).shiftRight(Fi(24));return n(u)}).setLayout({name:e,type:t,inputs:[{name:"value",type:t}]})}_createMainLayout(e,t,n,i){const a=this._returnDataNode(t);return or(([u])=>{if(n===1)return a(i(u));{const c=a(0),d=["x","y","z","w"];for(let g=0;g<n;g++){const v=d[g];c[v].assign(i(u[v]))}return c}}).setLayout({name:e,type:t,inputs:[{name:"value",type:t}]})}setup(e){const{method:t,aNode:n}=this,{renderer:i}=e;if(i.backend.isWebGPUBackend)return super.setup(e);const a=this.getInputType(e),o=e.getElementType(a),u=e.getTypeLength(a),c=`${t}_base_${o}`,d=`${t}_${a}`;let g=o_[c];if(g===void 0){switch(t){case mA.COUNT_LEADING_ZEROS:{g=this._createLeadingZerosBaseLayout(c,o);break}case mA.COUNT_TRAILING_ZEROS:{g=this._createTrailingZerosBaseLayout(c,o);break}case mA.COUNT_ONE_BITS:{g=this._createOneBitsBaseLayout(c,o);break}}o_[c]=g}let v=o_[d];return v===void 0&&(v=this._createMainLayout(d,a,u,g),o_[d]=v),or(()=>v(n))()}}mA.COUNT_TRAILING_ZEROS="countTrailingZeros",mA.COUNT_LEADING_ZEROS="countLeadingZeros",mA.COUNT_ONE_BITS="countOneBits";const U5=ji(mA,mA.COUNT_TRAILING_ZEROS).setParameterLength(1),O5=ji(mA,mA.COUNT_LEADING_ZEROS).setParameterLength(1),D5=ji(mA,mA.COUNT_ONE_BITS).setParameterLength(1),k5=or(([s])=>{const e=s.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/Bp(2,32))}),rM=(s,e)=>KA(no(4,s.mul(el(1,s))),e),V5=(s,e)=>s.lessThan(.5)?rM(s.mul(2),e).div(2):el(1,rM(no(el(1,s),2),e).div(2)),z5=(s,e,t)=>KA(dA(KA(s,e),$c(KA(s,e),KA(el(1,s),t))),1/e),G5=(s,e)=>sf(Cb.mul(e.mul(s).sub(1))).div(Cb.mul(e.mul(s).sub(1)));class iM extends pc{static get type(){return"PackFloatNode"}constructor(e,t){super(),this.vectorNode=t,this.encoding=e,this.isPackFloatNode=!0}getNodeType(){return"uint"}generate(e){const t=this.vectorNode.getNodeType(e);return`${e.getFloatPackingMethod(this.encoding)}(${this.vectorNode.build(e,t)})`}}const H5=ji(iM,"snorm").setParameterLength(1),Q5=ji(iM,"unorm").setParameterLength(1),W5=ji(iM,"float16").setParameterLength(1);class sM extends pc{static get type(){return"UnpackFloatNode"}constructor(e,t){super(),this.uintNode=t,this.encoding=e,this.isUnpackFloatNode=!0}getNodeType(){return"vec2"}generate(e){const t=this.uintNode.getNodeType(e);return`${e.getFloatUnpackingMethod(this.encoding)}(${this.uintNode.build(e,t)})`}}const Z5=ji(sM,"snorm").setParameterLength(1),K5=ji(sM,"unorm").setParameterLength(1),$5=ji(sM,"float16").setParameterLength(1),nm=or(([s])=>s.fract().sub(.5).abs()).setLayout({name:"tri",type:"float",inputs:[{name:"x",type:"float"}]}),X5=or(([s])=>Kn(nm(s.z.add(nm(s.y.mul(1)))),nm(s.z.add(nm(s.x.mul(1)))),nm(s.y.add(nm(s.x.mul(1)))))).setLayout({name:"tri3",type:"vec3",inputs:[{name:"p",type:"vec3"}]}),j5=or(([s,e,t])=>{const n=Kn(s).toVar(),i=qt(1.4).toVar(),a=qt(0).toVar(),o=Kn(n).toVar();return kl({start:qt(0),end:qt(3),type:"float",condition:"<="},()=>{const u=Kn(X5(o.mul(2))).toVar();n.addAssign(u.add(t.mul(qt(.1).mul(e)))),o.mulAssign(1.8),i.mulAssign(1.5),n.mulAssign(1.2);const c=qt(nm(n.z.add(nm(n.x.add(nm(n.y)))))).toVar();a.addAssign(c.div(i)),o.addAssign(.14)}),a}).setLayout({name:"triNoise3D",type:"float",inputs:[{name:"position",type:"vec3"},{name:"speed",type:"float"},{name:"time",type:"float"}]});class Y5 extends ta{static get type(){return"FunctionOverloadingNode"}constructor(e=[],...t){super(),this.functionNodes=e,this.parametersNodes=t,this._candidateFn=null,this.global=!0}getNodeType(e){return this.getCandidateFn(e).shaderNode.layout.type}getCandidateFn(e){const t=this.parametersNodes;let n=this._candidateFn;if(n===null){let i=null,a=-1;for(const o of this.functionNodes){const c=o.shaderNode.layout;if(c===null)throw new Error("FunctionOverloadingNode: FunctionNode must be a layout.");const d=c.inputs;if(t.length===d.length){let g=0;for(let v=0;v<t.length;v++){const M=t[v],B=d[v];M.getNodeType(e)===B.type&&g++}g>a&&(i=o,a=g)}}this._candidateFn=n=i}return n}setup(e){return this.getCandidateFn(e)(...this.parametersNodes)}}const q5=to(Y5),hd=s=>(...e)=>q5(s,...e),Iv=va(0).setGroup(xa).onRenderUpdate(s=>s.time),J5=va(0).setGroup(xa).onRenderUpdate(s=>s.deltaTime),fI=va(0,"uint").setGroup(xa).onRenderUpdate(s=>s.frameId),eG=(s=Iv)=>s.add(.75).mul(Math.PI*2).sin().mul(.5).add(.5),tG=(s=Iv)=>s.fract().round(),nG=(s=Iv)=>s.add(.5).fract().mul(2).sub(1).abs(),rG=(s=Iv)=>s.fract();function iG(s,e=null){return Kg(e,{getUV:s})}const sG=or(([s,e,t=Gi(.5)])=>Xy(s.sub(t),e).add(t)),aG=or(([s,e,t=Gi(.5)])=>{const n=s.sub(t),i=n.dot(n),o=i.mul(i).mul(e);return s.add(n.mul(o))}),oG=or(({position:s=null,horizontal:e=!0,vertical:t=!1})=>{let n;s!==null?(n=XA.toVar(),n[3][0]=s.x,n[3][1]=s.y,n[3][2]=s.z):n=XA;const i=AA.mul(n);return By(e)&&(i[0][0]=XA[0].length(),i[0][1]=0,i[0][2]=0),By(t)&&(i[1][0]=0,i[1][1]=XA[1].length(),i[1][2]=0),i[2][0]=0,i[2][1]=0,i[2][2]=1,of.mul(i).mul(vc)}),lG=or(([s=null])=>{const e=Cv();return Cv(RS(s)).sub(e).lessThan(0).select(Yg,s)});class uG extends ta{static get type(){return"SpriteSheetUVNode"}constructor(e,t=Zl(),n=qt(0)){super("vec2"),this.countNode=e,this.uvNode=t,this.frameNode=n}setup(){const{frameNode:e,uvNode:t,countNode:n}=this,{width:i,height:a}=n,o=e.mod(i.mul(a)).floor(),u=o.mod(i),c=a.sub(o.add(1).div(i).ceil()),d=n.reciprocal(),g=Gi(u,c);return t.add(g).mul(d)}}const cG=to(uG).setParameterLength(3),AI=or(([s,e=null,t=null,n=qt(1),i=vc,a=Of])=>{let o=a.abs().normalize();o=o.div(o.dot(Kn(1)));const u=i.yz.mul(n),c=i.zx.mul(n),d=i.xy.mul(n),g=s.value,v=e!==null?e.value:g,M=t!==null?t.value:g,B=xl(g,u).mul(o.x),I=xl(v,c).mul(o.y),ne=xl(M,d).mul(o.z);return $c(B,I,ne)}),hG=(...s)=>AI(...s),Nv=new Ec,w0=new le,Fv=new le,aM=new le,Jy=new di,l_=new le(0,0,-1),fg=new Ni,ex=new le,u_=new le,tx=new Ni,c_=new ce,h_=new Ns,dG=Yg.flipX();h_.depthTexture=new Al(1,1);let d_=!1;class oM extends ug{static get type(){return"ReflectorNode"}constructor(e={}){super(e.defaultTexture||h_.texture,dG),this._reflectorBaseNode=e.reflector||new fG(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=Ss(new oM({defaultTexture:h_.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.uvNode=this.uvNode,e.levelNode=this.levelNode,e.biasNode=this.biasNode,e.sampler=this.sampler,e.depthNode=this.depthNode,e.compareNode=this.compareNode,e.gradNode=this.gradNode,e.offsetNode=this.offsetNode,e._reflectorBaseNode=this._reflectorBaseNode,e}dispose(){super.dispose(),this._reflectorBaseNode.dispose()}}class fG extends ta{static get type(){return"ReflectorBaseNode"}constructor(e,t={}){super();const{target:n=new yl,resolutionScale:i=1,generateMipmaps:a=!1,bounces:o=!0,depth:u=!1,samples:c=0}=t;this.textureNode=e,this.target=n,this.resolutionScale=i,t.resolution!==void 0&&(ki('ReflectorNode: The "resolution" parameter has been renamed to "resolutionScale".'),this.resolutionScale=t.resolution),this.generateMipmaps=a,this.bounces=o,this.depth=u,this.samples=c,this.updateBeforeType=o?Ao.RENDER:Ao.FRAME,this.virtualCameras=new WeakMap,this.renderTargets=new Map,this.forceUpdate=!1,this.hasOutput=!1}_updateResolution(e,t){const n=this.resolutionScale;t.getDrawingBufferSize(c_),e.setSize(Math.round(c_.width*n),Math.round(c_.height*n))}setup(e){return this._updateResolution(h_,e.renderer),super.setup(e)}dispose(){super.dispose();for(const e of this.renderTargets.values())e.dispose()}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 Ns(0,0,{type:Wt,samples:this.samples}),this.generateMipmaps===!0&&(t.texture.minFilter=qr,t.texture.generateMipmaps=!0),this.depth===!0&&(t.depthTexture=new Al),this.renderTargets.set(e,t)),t}updateBefore(e){if(this.bounces===!1&&d_)return!1;d_=!0;const{scene:t,camera:n,renderer:i,material:a}=e,{target:o}=this,u=this.getVirtualCamera(n),c=this.getRenderTarget(u);i.getDrawingBufferSize(c_),this._updateResolution(c,i),Fv.setFromMatrixPosition(o.matrixWorld),aM.setFromMatrixPosition(n.matrixWorld),Jy.extractRotation(o.matrixWorld),w0.set(0,0,1),w0.applyMatrix4(Jy),ex.subVectors(Fv,aM);const d=ex.dot(w0)>0;let g=!1;if(d===!0&&this.forceUpdate===!1){if(this.hasOutput===!1){d_=!1;return}g=!0}ex.reflect(w0).negate(),ex.add(Fv),Jy.extractRotation(n.matrixWorld),l_.set(0,0,-1),l_.applyMatrix4(Jy),l_.add(aM),u_.subVectors(Fv,l_),u_.reflect(w0).negate(),u_.add(Fv),u.coordinateSystem=n.coordinateSystem,u.position.copy(ex),u.up.set(0,1,0),u.up.applyMatrix4(Jy),u.up.reflect(w0),u.lookAt(u_),u.near=n.near,u.far=n.far,u.updateMatrixWorld(),u.projectionMatrix.copy(n.projectionMatrix),Nv.setFromNormalAndCoplanarPoint(w0,Fv),Nv.applyMatrix4(u.matrixWorldInverse),fg.set(Nv.normal.x,Nv.normal.y,Nv.normal.z,Nv.constant);const v=u.projectionMatrix;tx.x=(Math.sign(fg.x)+v.elements[8])/v.elements[0],tx.y=(Math.sign(fg.y)+v.elements[9])/v.elements[5],tx.z=-1,tx.w=(1+v.elements[10])/v.elements[14],fg.multiplyScalar(1/fg.dot(tx));const M=0;v.elements[2]=fg.x,v.elements[6]=fg.y,v.elements[10]=i.coordinateSystem===To?fg.z-M:fg.z+1-M,v.elements[14]=fg.w,this.textureNode.value=c.texture,this.depth===!0&&(this.textureNode.getDepthNode().value=c.depthTexture),a.visible=!1;const B=i.getRenderTarget(),I=i.getMRT(),ne=i.autoClear;i.setMRT(null),i.setRenderTarget(c),i.autoClear=!0;const ee=t.name;t.name=(t.name||"Scene")+" [ Reflector ]",g?(i.clear(),this.hasOutput=!1):(i.render(t,u),this.hasOutput=!0),t.name=ee,i.setMRT(I),i.setRenderTarget(B),i.autoClear=ne,a.visible=!0,d_=!1,this.forceUpdate=!1}get resolution(){return ki('ReflectorNode: The "resolution" property has been renamed to "resolutionScale".'),this.resolutionScale}set resolution(e){ki('ReflectorNode: The "resolution" property has been renamed to "resolutionScale".'),this.resolutionScale=e}}const AG=s=>new oM(s),lM=new Pg(-1,1,1,-1,0,1);class pG extends ka{constructor(e=!1){super();const t=e===!1?[0,-1,0,1,2,1]:[0,2,0,0,2,0];this.setAttribute("position",new Ui([-1,3,0,-1,-1,0,3,-1,0],3)),this.setAttribute("uv",new Ui(t,2))}}const gG=new pG;class nx extends Il{constructor(e=null){super(gG,e),this.camera=lM,this.isQuadMesh=!0}renderAsync(e){return Pa(this,null,function*(){ki('QuadMesh: "renderAsync()" has been deprecated. Use "render()" and "await renderer.init();" when creating the renderer.'),yield e.init(),e.render(this,lM)})}render(e){e.render(this,lM)}}const mG=new ce;class vG extends ug{static get type(){return"RTTNode"}constructor(e,t=null,n=null,i={type:Wt}){const a=new Ns(t,n,i);super(a.texture,Zl()),this.isRTTNode=!0,this.node=e,this.width=t,this.height=n,this.pixelRatio=1,this.renderTarget=a,this.textureNeedsUpdate=!0,this.autoUpdate=!0,this._rttNode=null,this._quadMesh=new nx(new yc),this.updateBeforeType=Ao.RENDER}get autoResize(){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,i=t*this.pixelRatio;this.renderTarget.setSize(n,i),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.autoResize===!0){const i=e.getPixelRatio(),a=e.getSize(mG),o=Math.floor(a.width*i),u=Math.floor(a.height*i);(o!==this.renderTarget.width||u!==this.renderTarget.height)&&(this.renderTarget.setSize(o,u),this.textureNeedsUpdate=!0)}let t="RTT";this.node.name&&(t=this.node.name+" [ "+t+" ]"),this._quadMesh.material.fragmentNode=this._rttNode,this._quadMesh.name=t;const n=e.getRenderTarget();e.setRenderTarget(this.renderTarget),this._quadMesh.render(e),e.setRenderTarget(n)}clone(){const e=new ug(this.value,this.uvNode,this.levelNode);return e.sampler=this.sampler,e.referenceNode=this,e}}const pI=(s,...e)=>Ss(new vG(Ss(s),...e)),yG=(s,...e)=>s.isSampleNode||s.isTextureNode?s:s.isPassNode?s.getTextureNode():pI(s,...e),Pv=or(([s,e,t],n)=>{let i;n.renderer.coordinateSystem===To?(s=Gi(s.x,s.y.oneMinus()).mul(2).sub(1),i=Ks(Kn(s,e),1)):i=Ks(Kn(s.x,s.y.oneMinus(),e).mul(2).sub(1),1);const a=Ks(t.mul(i));return a.xyz.div(a.w)}),xG=or(([s,e])=>{const t=e.mul(Ks(s,1)),n=t.xy.div(t.w).mul(.5).add(.5).toVar();return Gi(n.x,n.y.oneMinus())}),bG=or(([s,e,t])=>{const n=Xg(Rc(e)),i=ch(s.mul(n)).toVar(),a=Rc(e,i).toVar(),o=Rc(e,i.sub(ch(2,0))).toVar(),u=Rc(e,i.sub(ch(1,0))).toVar(),c=Rc(e,i.add(ch(1,0))).toVar(),d=Rc(e,i.add(ch(2,0))).toVar(),g=Rc(e,i.add(ch(0,2))).toVar(),v=Rc(e,i.add(ch(0,1))).toVar(),M=Rc(e,i.sub(ch(0,1))).toVar(),B=Rc(e,i.sub(ch(0,2))).toVar(),I=Su(el(qt(2).mul(u).sub(o),a)).toVar(),ne=Su(el(qt(2).mul(c).sub(d),a)).toVar(),ee=Su(el(qt(2).mul(v).sub(g),a)).toVar(),q=Su(el(qt(2).mul(M).sub(B),a)).toVar(),ye=Pv(s,a,t).toVar(),Ce=I.lessThan(ne).select(ye.sub(Pv(s.sub(Gi(qt(1).div(n.x),0)),u,t)),ye.negate().add(Pv(s.add(Gi(qt(1).div(n.x),0)),c,t))),ke=ee.lessThan(q).select(ye.sub(Pv(s.add(Gi(0,qt(1).div(n.y))),v,t)),ye.negate().add(Pv(s.sub(Gi(0,qt(1).div(n.y))),M,t)));return rf(Zg(Ce,ke))}),uM=or(([s])=>_p(qt(52.9829189).mul(_p(ZA(s,Gi(.06711056,.00583715)))))).setLayout({name:"interleavedGradientNoise",type:"float",inputs:[{name:"position",type:"vec2"}]}),Ep=or(([s,e,t])=>{const n=qt(2.399963229728653),i=Nd(qt(s).add(.5).div(qt(e))),a=qt(s).mul(n).add(t);return Gi(wp(a),sf(a)).mul(i)}).setLayout({name:"vogelDiskSample",type:"vec2",inputs:[{name:"sampleIndex",type:"int"},{name:"samplesCount",type:"int"},{name:"phi",type:"float"}]});class _G extends ta{static get type(){return"SampleNode"}constructor(e,t=null){super(),this.callback=e,this.uvNode=t,this.isSampleNode=!0}setup(){return this.sample(Zl())}sample(e){return this.callback(e)}}const wG=(s,e=null)=>new _G(s,Ss(e));class kf extends ta{static get type(){return"EventNode"}constructor(e,t){super("void"),this.eventType=e,this.callback=t,e===kf.OBJECT?this.updateType=Ao.OBJECT:e===kf.MATERIAL?this.updateType=Ao.RENDER:e===kf.BEFORE_OBJECT?this.updateBeforeType=Ao.OBJECT:e===kf.BEFORE_MATERIAL&&(this.updateBeforeType=Ao.RENDER)}update(e){this.callback(e)}updateBefore(e){this.callback(e)}}kf.OBJECT="object",kf.MATERIAL="material",kf.BEFORE_OBJECT="beforeObject",kf.BEFORE_MATERIAL="beforeMaterial";const f_=(s,e)=>new kf(s,e).toStack(),SG=s=>f_(kf.OBJECT,s),MG=s=>f_(kf.MATERIAL,s),EG=s=>f_(kf.BEFORE_OBJECT,s),CG=s=>f_(kf.BEFORE_MATERIAL,s);class TG extends Mh{constructor(e,t,n=Float32Array){const i=ArrayBuffer.isView(e)?e:new n(e*t);super(i,t),this.isStorageInstancedBufferAttribute=!0}}class BG extends wl{constructor(e,t,n=Float32Array){const i=ArrayBuffer.isView(e)?e:new n(e*t);super(i,t),this.isStorageBufferAttribute=!0}}const RG=(s,e="float")=>{let t,n;e.isStruct===!0?(t=e.layout.getLength(),n=Ey("float")):(t=l1(e),n=Ey(e));const i=new BG(s,t,n);return tm(i,e,s)},IG=(s,e="float")=>{let t,n;e.isStruct===!0?(t=e.layout.getLength(),n=Ey("float")):(t=l1(e),n=Ey(e));const i=new TG(s,t,n);return tm(i,e,s)};class NG extends ta{static get type(){return"PointUVNode"}constructor(){super("vec2"),this.isPointUVNode=!0}generate(){return"vec2( gl_PointCoord.x, 1.0 - gl_PointCoord.y )"}}const FG=xs(NG),rx=new Ua,cM=new di;class Vf extends ta{static get type(){return"SceneNode"}constructor(e=Vf.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 i;return t===Vf.BACKGROUND_BLURRINESS?i=su("backgroundBlurriness","float",n):t===Vf.BACKGROUND_INTENSITY?i=su("backgroundIntensity","float",n):t===Vf.BACKGROUND_ROTATION?i=va("mat4").setName("backgroundRotation").setGroup(xa).onRenderUpdate(()=>{const a=n.background;return a!==null&&a.isTexture&&a.mapping!==be?(rx.copy(n.backgroundRotation),rx.x*=-1,rx.y*=-1,rx.z*=-1,cM.makeRotationFromEuler(rx)):cM.identity(),cM}):Gr("SceneNode: Unknown scope:",t),i}}Vf.BACKGROUND_BLURRINESS="backgroundBlurriness",Vf.BACKGROUND_INTENSITY="backgroundIntensity",Vf.BACKGROUND_ROTATION="backgroundRotation";const gI=xs(Vf,Vf.BACKGROUND_BLURRINESS),hM=xs(Vf,Vf.BACKGROUND_INTENSITY),mI=xs(Vf,Vf.BACKGROUND_ROTATION);class PG extends ug{static get type(){return"StorageTextureNode"}constructor(e,t,n=null){super(e,t),this.storeNode=n,this.mipLevel=0,this.isStorageTextureNode=!0,this.access=od.WRITE_ONLY}getInputType(){return"storageTexture"}setup(e){super.setup(e);const t=e.getNodeProperties(this);return t.storeNode=this.storeNode,t}setAccess(e){return this.access=e,this}setMipLevel(e){return this.mipLevel=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(od.READ_WRITE)}toReadOnly(){return this.setAccess(od.READ_ONLY)}toWriteOnly(){return this.setAccess(od.WRITE_ONLY)}generateStore(e){const t=e.getNodeProperties(this),{uvNode:n,storeNode:i,depthNode:a}=t,o=super.generate(e,"property"),u=n.build(e,this.value.is3DTexture===!0?"uvec3":"uvec2"),c=i.build(e,"vec4"),d=a?a.build(e,"int"):null,g=e.generateTextureStore(e,o,u,d,c);e.addLineFlowCode(g,this)}clone(){const e=super.clone();return e.storeNode=this.storeNode,e.mipLevel=this.mipLevel,e}}const vI=to(PG).setParameterLength(1,3),LG=(s,e,t)=>{const n=vI(s,e,t);return t!==null&&n.toStack(),n},UG=or(({texture:s,uv:e})=>{const n=Kn().toVar();return ra(e.x.lessThan(1e-4),()=>{n.assign(Kn(1,0,0))}).ElseIf(e.y.lessThan(1e-4),()=>{n.assign(Kn(0,1,0))}).ElseIf(e.z.lessThan(1e-4),()=>{n.assign(Kn(0,0,1))}).ElseIf(e.x.greaterThan(1-1e-4),()=>{n.assign(Kn(-1,0,0))}).ElseIf(e.y.greaterThan(1-1e-4),()=>{n.assign(Kn(0,-1,0))}).ElseIf(e.z.greaterThan(1-1e-4),()=>{n.assign(Kn(0,0,-1))}).Else(()=>{const a=s.sample(e.add(Kn(-.01,0,0))).r.sub(s.sample(e.add(Kn(.01,0,0))).r),o=s.sample(e.add(Kn(0,-.01,0))).r.sub(s.sample(e.add(Kn(0,.01,0))).r),u=s.sample(e.add(Kn(0,0,-.01))).r.sub(s.sample(e.add(Kn(0,0,.01))).r);n.assign(Kn(a,o,u))}),n.normalize()});class OG extends ug{static get type(){return"Texture3DNode"}constructor(e,t=null,n=null){super(e,t,n),this.isTexture3DNode=!0}getInputType(){return"texture3D"}getDefaultUV(){return Kn(.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(Qn(Xg(this,this.levelNode).y).sub(t.y).sub(1))),t}generateUV(e,t){return t.build(e,this.sampler===!0?"vec3":"ivec3")}generateOffset(e,t){return t.build(e,"ivec3")}normal(e){return UG({texture:this,uv:e})}}const A_=to(OG).setParameterLength(1,3),DG=(...s)=>A_(...s).setSampler(!1),kG=(s,e,t)=>A_(s,e).level(t);class VG extends zb{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 zG=(s,e,t)=>new VG(s,e,t),yI=new WeakMap;class GG extends pc{static get type(){return"VelocityNode"}constructor(){super("vec2"),this.projectionMatrix=null,this.updateType=Ao.OBJECT,this.updateAfterType=Ao.OBJECT,this.previousModelWorldMatrix=va(new di),this.previousProjectionMatrix=va(new di).setGroup(xa),this.previousCameraViewMatrix=va(new di)}setProjectionMatrix(e){this.projectionMatrix=e}update({frameId:e,camera:t,object:n}){const i=bI(n);this.previousModelWorldMatrix.value.copy(i);const a=xI(t);a.frameId!==e&&(a.frameId=e,a.previousProjectionMatrix===void 0?(a.previousProjectionMatrix=new di,a.previousCameraViewMatrix=new di,a.currentProjectionMatrix=new di,a.currentCameraViewMatrix=new di,a.previousProjectionMatrix.copy(this.projectionMatrix||t.projectionMatrix),a.previousCameraViewMatrix.copy(t.matrixWorldInverse)):(a.previousProjectionMatrix.copy(a.currentProjectionMatrix),a.previousCameraViewMatrix.copy(a.currentCameraViewMatrix)),a.currentProjectionMatrix.copy(this.projectionMatrix||t.projectionMatrix),a.currentCameraViewMatrix.copy(t.matrixWorldInverse),this.previousProjectionMatrix.value.copy(a.previousProjectionMatrix),this.previousCameraViewMatrix.value.copy(a.previousCameraViewMatrix))}updateAfter({object:e}){bI(e).copy(e.matrixWorld)}setup(){const e=this.projectionMatrix===null?of:va(this.projectionMatrix),t=this.previousCameraViewMatrix.mul(this.previousModelWorldMatrix),n=e.mul(cg).mul(vc),i=this.previousProjectionMatrix.mul(t).mul(Db),a=n.xy.div(n.w),o=i.xy.div(i.w);return el(a,o)}}function xI(s){let e=yI.get(s);return e===void 0&&(e={},yI.set(s,e)),e}function bI(s,e=0){const t=xI(s);let n=t[e];return n===void 0&&(t[e]=n=new di,t[e].copy(s.matrixWorld)),n}const HG=xs(GG),QG=or(([s])=>dM(s.rgb)),WG=or(([s,e=qt(1)])=>e.mix(dM(s.rgb),s.rgb)),ZG=or(([s,e=qt(1)])=>{const t=$c(s.r,s.g,s.b).div(3),n=s.r.max(s.g.max(s.b)),i=n.sub(t).mul(e).mul(-3);return zo(s.rgb,n,i)}),KG=or(([s,e=qt(1)])=>{const t=Kn(.57735,.57735,.57735),n=e.cos();return Kn(s.rgb.mul(n).add(t.cross(s.rgb).mul(e.sin()).add(t.mul(ZA(t,s.rgb).mul(n.oneMinus())))))}),dM=(s,e=Kn(xr.getLuminanceCoefficients(new le)))=>ZA(s,e),$G=or(([s,e=Kn(1),t=Kn(0),n=Kn(1),i=qt(1),a=Kn(xr.getLuminanceCoefficients(new le,No))])=>{const o=s.rgb.dot(Kn(a)),u=mc(s.rgb.mul(e).add(t),0).toVar(),c=u.pow(n).toVar();return ra(u.r.greaterThan(0),()=>{u.r.assign(c.r)}),ra(u.g.greaterThan(0),()=>{u.g.assign(c.g)}),ra(u.b.greaterThan(0),()=>{u.b.assign(c.b)}),u.assign(o.add(u.sub(o).mul(i))),Ks(u.rgb,s.a)});class XG extends pc{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 jG=to(XG).setParameterLength(2),p_=new ce;class _I extends ug{static get type(){return"PassTextureNode"}constructor(e,t){super(t),this.passNode=e,this.setUpdateMatrix(!1)}setup(e){return this.passNode.build(e),super.setup(e)}clone(){return new this.constructor(this.passNode,this.value)}}class wI extends _I{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(){const e=new this.constructor(this.passNode,this.textureName,this.previousTexture);return e.uvNode=this.uvNode,e.levelNode=this.levelNode,e.biasNode=this.biasNode,e.sampler=this.sampler,e.depthNode=this.depthNode,e.compareNode=this.compareNode,e.gradNode=this.gradNode,e.offsetNode=this.offsetNode,e}}class Ag extends pc{static get type(){return"PassNode"}constructor(e,t,n,i={}){super("vec4"),this.scope=e,this.scene=t,this.camera=n,this.options=i,this._pixelRatio=1,this._width=1,this._height=1;const a=new Al;a.isRenderTargetTexture=!0,a.name="depth";const o=new Ns(this._width*this._pixelRatio,this._height*this._pixelRatio,rl({type:Wt},i));o.texture.name="output",o.depthTexture=a,this.renderTarget=o,this.overrideMaterial=null,this.transparent=!0,this.opaque=!0,this.contextNode=null,this._contextNodeCache=null,this._textures={output:o.texture,depth:a},this._textureNodes={},this._linearDepthNodes={},this._viewZNodes={},this._previousTextures={},this._previousTextureNodes={},this._cameraNear=va(0),this._cameraFar=va(0),this._mrt=null,this._layers=null,this._resolutionScale=1,this._viewport=null,this._scissor=null,this.isPassNode=!0,this.updateBeforeType=Ao.FRAME,this.global=!0}setResolutionScale(e){return this._resolutionScale=e,this}getResolutionScale(){return this._resolutionScale}setResolution(e){return Lr("PassNode: .setResolution() is deprecated. Use .setResolutionScale() instead."),this.setResolutionScale(e)}getResolution(){return Lr("PassNode: .getResolution() is deprecated. Use .getResolutionScale() instead."),this.getResolutionScale()}setLayers(e){return this._layers=e,this}getLayers(){return this._layers}setMRT(e){return this._mrt=e,this}getMRT(){return this._mrt}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],i=this.renderTarget.textures.indexOf(n);this.renderTarget.textures[i]=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=new wI(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=new wI(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,i=this._cameraFar;this._viewZNodes[e]=t=NS(this.getTextureNode(e),n,i)}return t}getLinearDepthNode(e="depth"){let t=this._linearDepthNodes[e];if(t===void 0){const n=this._cameraNear,i=this._cameraFar,a=this.getViewZNode(e);this._linearDepthNodes[e]=t=Ev(a,n,i)}return t}compileAsync(e){return Pa(this,null,function*(){const t=e.getRenderTarget(),n=e.getMRT();e.setRenderTarget(this.renderTarget),e.setMRT(this._mrt),yield e.compileAsync(this.scene,this.camera),e.setRenderTarget(t),e.setMRT(n)})}setup({renderer:e}){return this.renderTarget.samples=this.options.samples===void 0?e.samples:this.options.samples,this.renderTarget.texture.type=e.getOutputBufferType(),this.scope===Ag.COLOR?this.getTextureNode():this.getLinearDepthNode()}updateBefore(e){const{renderer:t}=e,{scene:n}=this;let i,a;const o=t.getOutputRenderTarget();o&&o.isXRRenderTarget===!0?(a=1,i=t.xr.getCamera(),t.xr.updateCamera(i),p_.set(o.width,o.height)):(i=this.camera,a=t.getPixelRatio(),t.getSize(p_)),this._pixelRatio=a,this.setSize(p_.width,p_.height);const u=t.getRenderTarget(),c=t.getMRT(),d=t.autoClear,g=t.transparent,v=t.opaque,M=i.layers.mask,B=t.contextNode,I=n.overrideMaterial;this._cameraNear.value=i.near,this._cameraFar.value=i.far,this._layers!==null&&(i.layers.mask=this._layers.mask);for(const ee in this._previousTextures)this.toggleTexture(ee);this.overrideMaterial!==null&&(n.overrideMaterial=this.overrideMaterial),t.setRenderTarget(this.renderTarget),t.setMRT(this._mrt),t.autoClear=!0,t.transparent=this.transparent,t.opaque=this.opaque,this.contextNode!==null&&((this._contextNodeCache===null||this._contextNodeCache.version!==this.version)&&(this._contextNodeCache={version:this.version,context:Kg(rl(rl({},t.contextNode.getFlowContextData()),this.contextNode.getFlowContextData()))}),t.contextNode=this._contextNodeCache.context);const ne=n.name;n.name=this.name?this.name:n.name,t.render(n,i),n.name=ne,n.overrideMaterial=I,t.setRenderTarget(u),t.setMRT(c),t.autoClear=d,t.transparent=g,t.opaque=v,t.contextNode=B,i.layers.mask=M}setSize(e,t){this._width=e,this._height=t;const n=Math.floor(this._width*this._pixelRatio*this._resolutionScale),i=Math.floor(this._height*this._pixelRatio*this._resolutionScale);this.renderTarget.setSize(n,i),this._scissor!==null&&this.renderTarget.scissor.copy(this._scissor),this._viewport!==null&&this.renderTarget.viewport.copy(this._viewport)}setScissor(e,t,n,i){e===null?this._scissor=null:(this._scissor===null&&(this._scissor=new Ni),e.isVector4?this._scissor.copy(e):this._scissor.set(e,t,n,i),this._scissor.multiplyScalar(this._pixelRatio*this._resolutionScale).floor())}setViewport(e,t,n,i){e===null?this._viewport=null:(this._viewport===null&&(this._viewport=new Ni),e.isVector4?this._viewport.copy(e):this._viewport.set(e,t,n,i),this._viewport.multiplyScalar(this._pixelRatio*this._resolutionScale).floor())}setPixelRatio(e){this._pixelRatio=e,this.setSize(this._width,this._height)}dispose(){this.renderTarget.dispose()}}Ag.COLOR="color",Ag.DEPTH="depth";const YG=(s,e,t)=>new Ag(Ag.COLOR,s,e,t),qG=(s,e)=>new _I(s,e),JG=(s,e,t)=>new Ag(Ag.DEPTH,s,e,t);class eH extends Ag{static get type(){return"ToonOutlinePassNode"}constructor(e,t,n,i,a){super(Ag.COLOR,e,t),this.colorNode=n,this.thicknessNode=i,this.alphaNode=a,this._materialCache=new WeakMap,this.name="Outline Pass"}updateBefore(e){const{renderer:t}=e,n=t.getRenderObjectFunction();t.setRenderObjectFunction((i,a,o,u,c,d,g,v)=>{if((c.isMeshToonMaterial||c.isMeshToonNodeMaterial)&&c.wireframe===!1){const M=this._getOutlineMaterial(c);t.renderObject(i,a,o,u,M,d,g,v)}t.renderObject(i,a,o,u,c,d,g,v)}),super.updateBefore(e),t.setRenderObjectFunction(n)}_createMaterial(){const e=new yc;e.isMeshToonOutlineMaterial=!0,e.name="Toon_Outline",e.side=de;const t=Of.negate(),n=of.mul(cg),i=qt(1),a=n.mul(Ks(vc,1)),o=n.mul(Ks(vc.add(t),1)),u=rf(a.sub(o));return e.vertexNode=a.add(u.mul(this.thicknessNode).mul(a.w).mul(i)),e.colorNode=Ks(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 tH=(s,e,t=new Wr(0,0,0),n=.003,i=1)=>Ss(new eH(s,e,Ss(t),Ss(n),Ss(i))),SI=or(([s,e])=>s.mul(e).clamp()).setLayout({name:"linearToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),MI=or(([s,e])=>(s=s.mul(e),s.div(s.add(1)).clamp())).setLayout({name:"reinhardToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),EI=or(([s,e])=>{s=s.mul(e),s=s.sub(.004).max(0);const t=s.mul(s.mul(6.2).add(.5)),n=s.mul(s.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"}]}),nH=or(([s])=>{const e=s.mul(s.add(.0245786)).sub(90537e-9),t=s.mul(s.add(.432951).mul(.983729)).add(.238081);return e.div(t)}),CI=or(([s,e])=>{const t=ld(.59719,.35458,.04823,.076,.90834,.01566,.0284,.13383,.83777),n=ld(1.60475,-.53108,-.07367,-.10208,1.10813,-.00605,-.00327,-.07276,1.07602);return s=s.mul(e).div(.6),s=t.mul(s),s=nH(s),s=n.mul(s),s.clamp()}).setLayout({name:"acesFilmicToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),rH=ld(Kn(1.6605,-.1246,-.0182),Kn(-.5876,1.1329,-.1006),Kn(-.0728,-.0083,1.1187)),iH=ld(Kn(.6274,.0691,.0164),Kn(.3293,.9195,.088),Kn(.0433,.0113,.8956)),sH=or(([s])=>{const e=Kn(s).toVar(),t=Kn(e.mul(e)).toVar(),n=Kn(t.mul(t)).toVar();return qt(15.5).mul(n.mul(t)).sub(no(40.14,n.mul(e))).add(no(31.96,n).sub(no(6.868,t.mul(e))).add(no(.4298,t).add(no(.1191,e).sub(.00232))))}),TI=or(([s,e])=>{const t=Kn(s).toVar(),n=ld(Kn(.856627153315983,.137318972929847,.11189821299995),Kn(.0951212405381588,.761241990602591,.0767994186031903),Kn(.0482516061458583,.101439036467562,.811302368396859)),i=ld(Kn(1.1271005818144368,-.1413297634984383,-.14132976349843826),Kn(-.11060664309660323,1.157823702216272,-.11060664309660294),Kn(-.016493938717834573,-.016493938717834257,1.2519364065950405)),a=qt(-12.47393),o=qt(4.026069);return t.mulAssign(e),t.assign(iH.mul(t)),t.assign(n.mul(t)),t.assign(mc(t,1e-10)),t.assign(sg(t)),t.assign(t.sub(a).div(o.sub(a))),t.assign(Sp(t,0,1)),t.assign(sH(t)),t.assign(i.mul(t)),t.assign(KA(mc(Kn(0),t),Kn(2.2))),t.assign(rH.mul(t)),t.assign(Sp(t,0,1)),t}).setLayout({name:"agxToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),BI=or(([s,e])=>{const t=qt(.76),n=qt(.15);s=s.mul(e);const i=Uf(s.r,Uf(s.g,s.b)),a=ud(i.lessThan(.08),i.sub(no(6.25,i.mul(i))),.04);s.subAssign(a);const o=mc(s.r,mc(s.g,s.b));ra(o.lessThan(t),()=>s);const u=el(1,t),c=el(1,u.mul(u).div(o.add(u.sub(t))));s.mulAssign(c.div(o));const d=el(1,dA(1,n.mul(o.sub(c)).add(1)));return zo(s,Kn(c),d)}).setLayout({name:"neutralToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]});class Wh extends ta{static get type(){return"CodeNode"}constructor(e="",t=[],n=""){super("code"),this.isCodeNode=!0,this.global=!0,this.code=e,this.includes=t,this.language=n}setIncludes(e){return this.includes=e,this}getIncludes(){return this.includes}generate(e){const t=this.getIncludes(e);for(const i of t)i.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 g_=to(Wh).setParameterLength(1,3),aH=(s,e)=>g_(s,e,"js"),oH=(s,e)=>g_(s,e,"wgsl"),lH=(s,e)=>g_(s,e,"glsl");class RI extends Wh{static get type(){return"FunctionNode"}constructor(e="",t=[],n=""){super(e,t,n)}getNodeType(e){return this.getNodeFunction(e).type}getMemberType(e,t){const n=this.getNodeType(e);return e.getStructTypeNode(n).getMemberType(e,t)}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),i=n.name,a=n.type,o=e.getCodeFromNode(this,a);i!==""&&(o.name=i);const u=e.getPropertyName(o),c=this.getNodeFunction(e).getCode(u);return o.code=c+`
`,t==="property"?u:e.format(`${u}()`,a,t)}}const II=(s,e=[],t="")=>{for(let a=0;a<e.length;a++){const o=e[a];typeof o=="function"&&(e[a]=o.functionNode)}const n=new RI(s,e,t),i=(...a)=>n.call(...a);return i.functionNode=n,i},uH=(s,e)=>II(s,e,"glsl"),cH=(s,e)=>II(s,e,"wgsl");class hH extends ta{static get type(){return"ScriptableValueNode"}constructor(e=null){super(),this._value=e,this._cache=null,this.inputType=null,this.outputType=null,this.events=new bl,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:qt()}serialize(e){super.serialize(e),this.value!==null?this.inputType==="ArrayBuffer"?e.value=c1(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=h1(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 m_=to(hH).setParameterLength(1);class NI extends Map{get(e,t=null,...n){if(this.has(e))return super.get(e);if(t!==null){const i=t(...n);return this.set(e,i),i}}}class dH{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 v_=new NI;class fH extends ta{static get type(){return"ScriptableNode"}constructor(e=null,t={}){super(),this.codeNode=e,this.parameters=t,this._local=new NI,this._output=m_(null),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]=m_(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]=m_(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 i=this.getObject()[e];if(typeof i=="function")return i(...t)}callAsync(e,...t){return Pa(this,null,function*(){const i=this.getObject()[e];if(typeof i=="function")return i.constructor.name==="AsyncFunction"?yield i(...t):i(...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=(d,g)=>this.setOutput(d,g),n=new dH(this),i=v_.get("THREE"),a=v_.get("TSL"),o=this.getMethod(),u=[n,this._local,v_,e,t,i,a];this._object=o(...u);const c=this._object.layout;if(c&&(c.cache===!1&&this._local.clear(),this._output.outputType=c.outputType||null,Array.isArray(c.elements)))for(const d of c.elements){const g=d.id||d.name;d.inputType&&(this.getParameter(g)===void 0&&this.setParameter(g,null),this.getParameter(g).inputType=d.inputType),d.outputType&&(this.getOutput(g)===void 0&&this.setOutput(g,null),this.getOutput(g).outputType=d.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:qt()}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(", "),i="var "+n+`; var output = {};
`,a=`
return { ...output, `+n+" };",o=i+this.codeNode.code+a;return this._method=new Function(...e,o),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=[dv(this.source),this.getDefaultOutputNode().getCacheKey(e)];for(const n in this.parameters)t.push(this.parameters[n].getCacheKey(e));return o0(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 AH=to(fH).setParameterLength(1,2);function FI(s){let e;const t=s.context.getViewZ;return t!==void 0&&(e=t(this)),(e||Oc.z).negate()}const fM=or(([s,e],t)=>{const n=FI(t);return fA(s,e,n)}),AM=or(([s],e)=>{const t=FI(e);return s.mul(s,t,t).negate().exp().oneMinus()}),ix=or(([s,e])=>Ks(e.toFloat().mix(gv.rgb,s.toVec3()),gv.a));function pH(s,e,t){return Lr('TSL: "rangeFog( color, near, far )" is deprecated. Use "fog( color, rangeFogFactor( near, far ) )" instead.'),ix(s,fM(e,t))}function gH(s,e){return Lr('TSL: "densityFog( color, density )" is deprecated. Use "fog( color, densityFogFactor( density ) )" instead.'),ix(s,AM(e))}let S0=null,M0=null;class mH extends ta{static get type(){return"RangeNode"}constructor(e=qt(),t=qt()){super(),this.minNode=e,this.maxNode=t}getVectorLength(e){const t=this.getConstNode(this.minNode),n=this.getConstNode(this.maxNode),i=e.getTypeLength(Qg(t.value)),a=e.getTypeLength(Qg(n.value));return i>a?i:a}getNodeType(e){return e.object.count>1?e.getTypeFromLength(this.getVectorLength(e)):"float"}getConstNode(e){let t=null;if(e.traverse(n=>{n.isConstNode===!0&&(t=n)}),t===null)throw new Error('THREE.TSL: No "ConstNode" found in node graph.');return t}setup(e){const t=e.object;let n=null;if(t.count>1){const i=this.getConstNode(this.minNode),a=this.getConstNode(this.maxNode),o=i.value,u=a.value,c=e.getTypeLength(Qg(o)),d=e.getTypeLength(Qg(u));S0=S0||new Ni,M0=M0||new Ni,S0.setScalar(0),M0.setScalar(0),c===1?S0.setScalar(o):o.isColor?S0.set(o.r,o.g,o.b,1):S0.set(o.x,o.y,o.z||0,o.w||0),d===1?M0.setScalar(u):u.isColor?M0.set(u.r,u.g,u.b,1):M0.set(u.x,u.y,u.z||0,u.w||0);const g=4,v=g*t.count,M=new Float32Array(v);for(let I=0;I<v;I++){const ne=I%g,ee=S0.getComponent(ne),q=M0.getComponent(ne);M[I]=me.lerp(ee,q,Math.random())}const B=this.getNodeType(e);if(t.count<=4096)n=Dy(M,"vec4",t.count).element(hg).convert(B);else{const I=new Mh(M,4);e.geometry.setAttribute("__range"+this.id,I),n=Ub(I).convert(B)}}else n=qt(0);return n}}const vH=to(mH).setParameterLength(2);class yH extends ta{static get type(){return"ComputeBuiltinNode"}constructor(e,t){super(t),this._builtinName=e}getHash(e){return this.getBuiltinName(e)}getNodeType(){return this.nodeType}setBuiltinName(e){return this._builtinName=e,this}getBuiltinName(){return this._builtinName}hasBuiltin(e){return e.hasBuiltin(this._builtinName)}generate(e,t){const n=this.getBuiltinName(e),i=this.getNodeType(e);return e.shaderStage==="compute"?e.format(n,i,t):(Lr(`ComputeBuiltinNode: Compute built-in value ${n} can not be accessed in the ${e.shaderStage} stage`),e.generateConst(i))}serialize(e){super.serialize(e),e.global=this.global,e._builtinName=this._builtinName}deserialize(e){super.deserialize(e),this.global=e.global,this._builtinName=e._builtinName}}const sx=(s,e)=>new yH(s,e),xH=sx("numWorkgroups","uvec3"),bH=sx("workgroupId","uvec3"),_H=sx("globalId","uvec3"),wH=sx("localId","uvec3"),SH=sx("subgroupSize","uint");class MH extends ta{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 pM=to(MH),EH=()=>pM("workgroup").toStack(),CH=()=>pM("storage").toStack(),TH=()=>pM("texture").toStack();class BH extends u0{constructor(e,t){super(e,t),this.isWorkgroupInfoElementNode=!0}generate(e,t){let n;const i=e.context.assign;if(n=super.generate(e),i!==!0){const a=this.getNodeType(e);n=e.format(n,a,t)}return n}}class RH extends ta{constructor(e,t,n=0){super(t),this.bufferType=t,this.bufferCount=n,this.isWorkgroupInfoNode=!0,this.elementType=t,this.scope=e,this.name=""}setName(e){return this.name=e,this}label(e){return Lr('TSL: "label()" has been deprecated. Use "setName()" instead.'),this.setName(e)}setScope(e){return this.scope=e,this}getElementType(){return this.elementType}getInputType(){return`${this.scope}Array`}element(e){return new BH(this,e)}generate(e){const t=this.name!==""?this.name:`${this.scope}Array_${this.id}`;return e.getScopedArray(t,this.scope.toLowerCase(),this.bufferType,this.bufferCount)}}const IH=(s,e)=>new RH("Workgroup",s,e);class Ph extends ta{static get type(){return"AtomicFunctionNode"}constructor(e,t,n){super("uint"),this.method=e,this.pointerNode=t,this.valueNode=n,this.parents=!0}getInputType(e){return this.pointerNode.getNodeType(e)}getNodeType(e){return this.getInputType(e)}generate(e){const t=e.getNodeProperties(this),n=t.parents,i=this.method,a=this.getNodeType(e),o=this.getInputType(e),u=this.pointerNode,c=this.valueNode,d=[];d.push(`&${u.build(e,o)}`),c!==null&&d.push(c.build(e,o));const g=`${e.getMethod(i,a)}( ${d.join(", ")} )`;if(n?n.length===1&&n[0].isStackNode===!0:!1)e.addLineFlowCode(g,this);else return t.constNode===void 0&&(t.constNode=$g(g,a).toConst()),t.constNode.build(e)}}Ph.ATOMIC_LOAD="atomicLoad",Ph.ATOMIC_STORE="atomicStore",Ph.ATOMIC_ADD="atomicAdd",Ph.ATOMIC_SUB="atomicSub",Ph.ATOMIC_MAX="atomicMax",Ph.ATOMIC_MIN="atomicMin",Ph.ATOMIC_AND="atomicAnd",Ph.ATOMIC_OR="atomicOr",Ph.ATOMIC_XOR="atomicXor";const NH=to(Ph),pg=(s,e,t)=>NH(s,e,t).toStack(),FH=s=>pg(Ph.ATOMIC_LOAD,s,null),PH=(s,e)=>pg(Ph.ATOMIC_STORE,s,e),LH=(s,e)=>pg(Ph.ATOMIC_ADD,s,e),UH=(s,e)=>pg(Ph.ATOMIC_SUB,s,e),OH=(s,e)=>pg(Ph.ATOMIC_MAX,s,e),DH=(s,e)=>pg(Ph.ATOMIC_MIN,s,e),kH=(s,e)=>pg(Ph.ATOMIC_AND,s,e),VH=(s,e)=>pg(Ph.ATOMIC_OR,s,e),zH=(s,e)=>pg(Ph.ATOMIC_XOR,s,e);class Is extends pc{static get type(){return"SubgroupFunctionNode"}constructor(e,t=null,n=null){super(),this.method=e,this.aNode=t,this.bNode=n}getInputType(e){const t=this.aNode?this.aNode.getNodeType(e):null,n=this.bNode?this.bNode.getNodeType(e):null,i=e.isMatrix(t)?0:e.getTypeLength(t),a=e.isMatrix(n)?0:e.getTypeLength(n);return i>a?t:n}getNodeType(e){const t=this.method;return t===Is.SUBGROUP_ELECT?"bool":t===Is.SUBGROUP_BALLOT?"uvec4":this.getInputType(e)}generate(e,t){const n=this.method,i=this.getNodeType(e),a=this.getInputType(e),o=this.aNode,u=this.bNode,c=[];if(n===Is.SUBGROUP_BROADCAST||n===Is.SUBGROUP_SHUFFLE||n===Is.QUAD_BROADCAST){const g=u.getNodeType(e);c.push(o.build(e,i),u.build(e,g==="float"?"int":i))}else n===Is.SUBGROUP_SHUFFLE_XOR||n===Is.SUBGROUP_SHUFFLE_DOWN||n===Is.SUBGROUP_SHUFFLE_UP?c.push(o.build(e,i),u.build(e,"uint")):(o!==null&&c.push(o.build(e,a)),u!==null&&c.push(u.build(e,a)));const d=c.length===0?"()":`( ${c.join(", ")} )`;return e.format(`${e.getMethod(n,i)}${d}`,i,t)}serialize(e){super.serialize(e),e.method=this.method}deserialize(e){super.deserialize(e),this.method=e.method}}Is.SUBGROUP_ELECT="subgroupElect",Is.SUBGROUP_BALLOT="subgroupBallot",Is.SUBGROUP_ADD="subgroupAdd",Is.SUBGROUP_INCLUSIVE_ADD="subgroupInclusiveAdd",Is.SUBGROUP_EXCLUSIVE_AND="subgroupExclusiveAdd",Is.SUBGROUP_MUL="subgroupMul",Is.SUBGROUP_INCLUSIVE_MUL="subgroupInclusiveMul",Is.SUBGROUP_EXCLUSIVE_MUL="subgroupExclusiveMul",Is.SUBGROUP_AND="subgroupAnd",Is.SUBGROUP_OR="subgroupOr",Is.SUBGROUP_XOR="subgroupXor",Is.SUBGROUP_MIN="subgroupMin",Is.SUBGROUP_MAX="subgroupMax",Is.SUBGROUP_ALL="subgroupAll",Is.SUBGROUP_ANY="subgroupAny",Is.SUBGROUP_BROADCAST_FIRST="subgroupBroadcastFirst",Is.QUAD_SWAP_X="quadSwapX",Is.QUAD_SWAP_Y="quadSwapY",Is.QUAD_SWAP_DIAGONAL="quadSwapDiagonal",Is.SUBGROUP_BROADCAST="subgroupBroadcast",Is.SUBGROUP_SHUFFLE="subgroupShuffle",Is.SUBGROUP_SHUFFLE_XOR="subgroupShuffleXor",Is.SUBGROUP_SHUFFLE_UP="subgroupShuffleUp",Is.SUBGROUP_SHUFFLE_DOWN="subgroupShuffleDown",Is.QUAD_BROADCAST="quadBroadcast";const GH=ji(Is,Is.SUBGROUP_ELECT).setParameterLength(0),HH=ji(Is,Is.SUBGROUP_BALLOT).setParameterLength(1),QH=ji(Is,Is.SUBGROUP_ADD).setParameterLength(1),WH=ji(Is,Is.SUBGROUP_INCLUSIVE_ADD).setParameterLength(1),ZH=ji(Is,Is.SUBGROUP_EXCLUSIVE_AND).setParameterLength(1),KH=ji(Is,Is.SUBGROUP_MUL).setParameterLength(1),$H=ji(Is,Is.SUBGROUP_INCLUSIVE_MUL).setParameterLength(1),XH=ji(Is,Is.SUBGROUP_EXCLUSIVE_MUL).setParameterLength(1),jH=ji(Is,Is.SUBGROUP_AND).setParameterLength(1),YH=ji(Is,Is.SUBGROUP_OR).setParameterLength(1),qH=ji(Is,Is.SUBGROUP_XOR).setParameterLength(1),JH=ji(Is,Is.SUBGROUP_MIN).setParameterLength(1),eQ=ji(Is,Is.SUBGROUP_MAX).setParameterLength(1),tQ=ji(Is,Is.SUBGROUP_ALL).setParameterLength(0),nQ=ji(Is,Is.SUBGROUP_ANY).setParameterLength(0),rQ=ji(Is,Is.SUBGROUP_BROADCAST_FIRST).setParameterLength(2),iQ=ji(Is,Is.QUAD_SWAP_X).setParameterLength(1),sQ=ji(Is,Is.QUAD_SWAP_Y).setParameterLength(1),aQ=ji(Is,Is.QUAD_SWAP_DIAGONAL).setParameterLength(1),oQ=ji(Is,Is.SUBGROUP_BROADCAST).setParameterLength(2),lQ=ji(Is,Is.SUBGROUP_SHUFFLE).setParameterLength(2),uQ=ji(Is,Is.SUBGROUP_SHUFFLE_XOR).setParameterLength(2),cQ=ji(Is,Is.SUBGROUP_SHUFFLE_UP).setParameterLength(2),hQ=ji(Is,Is.SUBGROUP_SHUFFLE_DOWN).setParameterLength(2),dQ=ji(Is,Is.QUAD_BROADCAST).setParameterLength(1);let y_;function x_(s){y_=y_||new WeakMap;let e=y_.get(s);return e===void 0&&y_.set(s,e={}),e}function b_(s){const e=x_(s);return e.shadowMatrix||(e.shadowMatrix=va("mat4").setGroup(xa).onRenderUpdate(t=>((s.castShadow!==!0||t.renderer.shadowMap.enabled===!1)&&(s.shadow.camera.coordinateSystem!==t.camera.coordinateSystem&&(s.shadow.camera.coordinateSystem=t.camera.coordinateSystem,s.shadow.camera.updateProjectionMatrix()),s.shadow.updateMatrices(s)),s.shadow.matrix)))}function PI(s,e=pA){const t=b_(s).mul(e);return t.xyz.div(t.w)}function gM(s){const e=x_(s);return e.position||(e.position=va(new le).setGroup(xa).onRenderUpdate((t,n)=>n.value.setFromMatrixPosition(s.matrixWorld)))}function LI(s){const e=x_(s);return e.targetPosition||(e.targetPosition=va(new le).setGroup(xa).onRenderUpdate((t,n)=>n.value.setFromMatrixPosition(s.target.matrixWorld)))}function mM(s){const e=x_(s);return e.viewPosition||(e.viewPosition=va(new le).setGroup(xa).onRenderUpdate(({camera:t},n)=>{n.value=n.value||new le,n.value.setFromMatrixPosition(s.matrixWorld),n.value.applyMatrix4(t.matrixWorldInverse)}))}const vM=s=>AA.transformDirection(gM(s).sub(LI(s))),fQ=s=>s.sort((e,t)=>e.id-t.id),AQ=(s,e)=>{for(const t of e)if(t.isAnalyticLightNode&&t.light.id===s)return t;return null},yM=new WeakMap,ax=[];class xM extends ta{static get type(){return"LightsNode"}constructor(){super("vec3"),this.totalDiffuseNode=bp("vec3","totalDiffuse"),this.totalSpecularNode=bp("vec3","totalSpecular"),this.outgoingLightNode=bp("vec3","outgoingLight"),this._lights=[],this._lightNodes=null,this._lightNodesHash=null,this.global=!0}customCacheKey(){const e=this._lights;for(let n=0;n<e.length;n++){const i=e[n];if(ax.push(i.id),ax.push(i.castShadow?1:0),i.isSpotLight===!0){const a=i.map!==null?i.map.id:-1,o=i.colorNode?i.colorNode.getCacheKey():-1;ax.push(a,o)}}const t=o0(ax);return ax.length=0,t}getHash(e){if(this._lightNodesHash===null){this._lightNodes===null&&this.setupLightsNode(e);const t=[];for(const n of this._lightNodes)t.push(n.getHash());this._lightNodesHash="lights-"+t.join(",")}return this._lightNodesHash}analyze(e){const t=e.getNodeProperties(this);for(const n of t.nodes)n.build(e);t.outputNode.build(e)}setupLightsNode(e){const t=[],n=this._lightNodes,i=fQ(this._lights),a=e.renderer.library;for(const o of i)if(o.isNode)t.push(Ss(o));else{let u=null;if(n!==null&&(u=AQ(o.id,n)),u===null){const c=a.getLightNodeClass(o.constructor);if(c===null){Lr(`LightsNode.setupNodeLights: Light node not found for ${o.constructor.name}`);continue}let d=null;yM.has(o)?d=yM.get(o):(d=new c(o),yM.set(o,d)),t.push(d)}}this._lightNodes=t}setupDirectLight(e,t,n){const{lightingModel:i,reflectedLight:a}=e.context;i.direct(fd(rl({},n),{lightNode:t,reflectedLight:a}),e)}setupDirectRectAreaLight(e,t,n){const{lightingModel:i,reflectedLight:a}=e.context;i.directRectArea(fd(rl({},n),{lightNode:t,reflectedLight:a}),e)}setupLights(e,t){for(const n of t)n.build(e)}getLightNodes(e){return this._lightNodes===null&&this.setupLightsNode(e),this._lightNodes}setup(e){const t=e.lightsNode;e.lightsNode=this;let n=this.outgoingLightNode;const i=e.context,a=i.lightingModel,o=e.getNodeProperties(this);if(a){const{totalDiffuseNode:u,totalSpecularNode:c}=this;i.outgoingLight=n;const d=e.addStack();o.nodes=d.nodes,a.start(e);const{backdrop:g,backdropAlpha:v}=i,{directDiffuse:M,directSpecular:B,indirectDiffuse:I,indirectSpecular:ne}=i.reflectedLight;let ee=M.add(I);g!==null&&(v!==null?ee=Kn(v.mix(ee,g)):ee=Kn(g)),u.assign(ee),c.assign(B.add(ne)),n.assign(u.add(c)),a.finish(e),n=n.bypass(e.removeStack())}else o.nodes=[];return e.lightsNode=t,n}setLights(e){return this._lights=e,this._lightNodes=null,this._lightNodesHash=null,this}getLights(){return this._lights}get hasLights(){return this._lights.length>0}}const pQ=(s=[])=>new xM().setLights(s);class gQ extends ta{static get type(){return"ShadowBaseNode"}constructor(e){super(),this.light=e,this.updateBeforeType=Ao.RENDER,this.isShadowBaseNode=!0}setupShadowPosition({context:e,material:t}){bM.assign(t.receivedShadowPositionNode||e.shadowPositionWorld||pA)}}const bM=bp("vec3","shadowPositionWorld");function _M(s,e={}){return e.toneMapping=s.toneMapping,e.toneMappingExposure=s.toneMappingExposure,e.outputColorSpace=s.outputColorSpace,e.renderTarget=s.getRenderTarget(),e.activeCubeFace=s.getActiveCubeFace(),e.activeMipmapLevel=s.getActiveMipmapLevel(),e.renderObjectFunction=s.getRenderObjectFunction(),e.pixelRatio=s.getPixelRatio(),e.mrt=s.getMRT(),e.clearColor=s.getClearColor(e.clearColor||new Wr),e.clearAlpha=s.getClearAlpha(),e.autoClear=s.autoClear,e.scissorTest=s.getScissorTest(),e}function UI(s,e){return e=_M(s,e),s.setMRT(null),s.setRenderObjectFunction(null),s.setClearColor(0,1),s.autoClear=!0,e}function OI(s,e){s.toneMapping=e.toneMapping,s.toneMappingExposure=e.toneMappingExposure,s.outputColorSpace=e.outputColorSpace,s.setRenderTarget(e.renderTarget,e.activeCubeFace,e.activeMipmapLevel),s.setRenderObjectFunction(e.renderObjectFunction),s.setPixelRatio(e.pixelRatio),s.setMRT(e.mrt),s.setClearColor(e.clearColor,e.clearAlpha),s.autoClear=e.autoClear,s.setScissorTest(e.scissorTest)}function wM(s,e={}){return e.background=s.background,e.backgroundNode=s.backgroundNode,e.overrideMaterial=s.overrideMaterial,e}function DI(s,e){return e=wM(s,e),s.background=null,s.backgroundNode=null,s.overrideMaterial=null,e}function kI(s,e){s.background=e.background,s.backgroundNode=e.backgroundNode,s.overrideMaterial=e.overrideMaterial}function mQ(s,e,t={}){return t=_M(s,t),t=wM(e,t),t}function VI(s,e,t){return t=UI(s,t),t=DI(e,t),t}function zI(s,e,t){OI(s,t),kI(e,t)}var GX=Object.freeze({__proto__:null,resetRendererAndSceneState:VI,resetRendererState:UI,resetSceneState:DI,restoreRendererAndSceneState:zI,restoreRendererState:OI,restoreSceneState:kI,saveRendererAndSceneState:mQ,saveRendererState:_M,saveSceneState:wM});const __=new WeakMap,GI=or(({depthTexture:s,shadowCoord:e,depthLayer:t})=>{let n=xl(s,e.xy).setName("t_basic");return s.isArrayTexture&&(n=n.depth(t)),n.compare(e.z)}),HI=or(({depthTexture:s,shadowCoord:e,shadow:t,depthLayer:n})=>{const i=(g,v)=>{let M=xl(s,g);return s.isArrayTexture&&(M=M.depth(n)),M.compare(v)},a=su("mapSize","vec2",t).setGroup(xa),o=su("radius","float",t).setGroup(xa),u=Gi(1).div(a),c=o.mul(u.x),d=uM(m0.xy).mul(6.28318530718);return $c(i(e.xy.add(Ep(0,5,d).mul(c)),e.z),i(e.xy.add(Ep(1,5,d).mul(c)),e.z),i(e.xy.add(Ep(2,5,d).mul(c)),e.z),i(e.xy.add(Ep(3,5,d).mul(c)),e.z),i(e.xy.add(Ep(4,5,d).mul(c)),e.z)).mul(1/5)}),QI=or(({depthTexture:s,shadowCoord:e,shadow:t,depthLayer:n})=>{const i=(v,M)=>{let B=xl(s,v);return s.isArrayTexture&&(B=B.depth(n)),B.compare(M)},a=su("mapSize","vec2",t).setGroup(xa),o=Gi(1).div(a),u=o.x,c=o.y,d=e.xy,g=_p(d.mul(a).add(.5));return d.subAssign(g.mul(o)),$c(i(d,e.z),i(d.add(Gi(u,0)),e.z),i(d.add(Gi(0,c)),e.z),i(d.add(o),e.z),zo(i(d.add(Gi(u.negate(),0)),e.z),i(d.add(Gi(u.mul(2),0)),e.z),g.x),zo(i(d.add(Gi(u.negate(),c)),e.z),i(d.add(Gi(u.mul(2),c)),e.z),g.x),zo(i(d.add(Gi(0,c.negate())),e.z),i(d.add(Gi(0,c.mul(2))),e.z),g.y),zo(i(d.add(Gi(u,c.negate())),e.z),i(d.add(Gi(u,c.mul(2))),e.z),g.y),zo(zo(i(d.add(Gi(u.negate(),c.negate())),e.z),i(d.add(Gi(u.mul(2),c.negate())),e.z),g.x),zo(i(d.add(Gi(u.negate(),c.mul(2))),e.z),i(d.add(Gi(u.mul(2),c.mul(2))),e.z),g.x),g.y)).mul(1/9)}),WI=or(({depthTexture:s,shadowCoord:e,depthLayer:t})=>{let n=xl(s).sample(e.xy);s.isArrayTexture&&(n=n.depth(t)),n=n.rg;const i=n.x,a=mc(1e-7,n.y.mul(n.y)),o=Ib(e.z,i);ra(o.equal(1),()=>qt(1));const u=e.z.sub(i);let c=a.div(a.add(u.mul(u)));return c=Sp(el(c,.3).div(.65)),mc(o,c)}),vQ=or(([s,e,t])=>{let n=pA.sub(s).length();return n=n.sub(e).div(t.sub(e)),n=n.saturate(),n}),yQ=s=>{const e=s.shadow.camera,t=su("near","float",e).setGroup(xa),n=su("far","float",e).setGroup(xa),i=VB(s);return vQ(i,t,n)},ZI=s=>{let e=__.get(s);if(e===void 0){const t=s.isPointLight?yQ(s):null;e=new yc,e.colorNode=Ks(0,0,0,1),e.depthNode=t,e.isShadowPassMaterial=!0,e.name="ShadowMaterial",e.fog=!1,__.set(s,e)}return e},KI=s=>{const e=__.get(s);e!==void 0&&(e.dispose(),__.delete(s))},$I=new Mp,Lv=[],XI=(s,e,t,n)=>{Lv[0]=s,Lv[1]=e;let i=$I.get(Lv);return(i===void 0||i.shadowType!==t||i.useVelocity!==n)&&(i=(a,o,u,c,d,g,...v)=>{(a.castShadow===!0||a.receiveShadow&&t===X)&&(n&&(u1(a).useVelocity=!0),a.onBeforeShadow(s,a,u,e.camera,c,o.overrideMaterial,g),s.renderObject(a,o,u,c,d,g,...v),a.onAfterShadow(s,a,u,e.camera,c,o.overrideMaterial,g))},i.shadowType=t,i.useVelocity=n,$I.set(Lv,i)),Lv[0]=null,Lv[1]=null,i},xQ=or(({samples:s,radius:e,size:t,shadowPass:n,depthLayer:i})=>{const a=qt(0).toVar("meanVertical"),o=qt(0).toVar("squareMeanVertical"),u=s.lessThanEqual(qt(1)).select(qt(0),qt(2).div(s.sub(1))),c=s.lessThanEqual(qt(1)).select(qt(0),qt(-1));kl({start:Qn(0),end:Qn(s),type:"int",condition:"<"},({i:g})=>{const v=c.add(qt(g).mul(u));let M=n.sample($c(m0.xy,Gi(0,v).mul(e)).div(t));n.value.isArrayTexture&&(M=M.depth(i)),M=M.x,a.addAssign(M),o.addAssign(M.mul(M))}),a.divAssign(s),o.divAssign(s);const d=Nd(o.sub(a.mul(a)).max(0));return Gi(a,d)}),bQ=or(({samples:s,radius:e,size:t,shadowPass:n,depthLayer:i})=>{const a=qt(0).toVar("meanHorizontal"),o=qt(0).toVar("squareMeanHorizontal"),u=s.lessThanEqual(qt(1)).select(qt(0),qt(2).div(s.sub(1))),c=s.lessThanEqual(qt(1)).select(qt(0),qt(-1));kl({start:Qn(0),end:Qn(s),type:"int",condition:"<"},({i:g})=>{const v=c.add(qt(g).mul(u));let M=n.sample($c(m0.xy,Gi(v,0).mul(e)).div(t));n.value.isArrayTexture&&(M=M.depth(i)),a.addAssign(M.x),o.addAssign($c(M.y.mul(M.y),M.x.mul(M.x)))}),a.divAssign(s),o.divAssign(s);const d=Nd(o.sub(a.mul(a)).max(0));return Gi(a,d)}),_Q=[GI,HI,QI,WI];let SM;const w_=new nx;class jI extends gQ{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._currentShadowType=null,this._cameraFrameId=new WeakMap,this.isShadowNode=!0,this.depthLayer=0}setupShadowFilter(e,{filterFn:t,depthTexture:n,shadowCoord:i,shadow:a,depthLayer:o}){const u=i.x.greaterThanEqual(0).and(i.x.lessThanEqual(1)).and(i.y.greaterThanEqual(0)).and(i.y.lessThanEqual(1)).and(i.z.lessThanEqual(1)),c=t({depthTexture:n,shadowCoord:i,shadow:a,depthLayer:o});return u.select(c,qt(1))}setupShadowCoord(e,t){const{shadow:n}=this,{renderer:i}=e,a=su("bias","float",n).setGroup(xa);let o=t,u;if(n.camera.isOrthographicCamera||i.logarithmicDepthBuffer!==!0)o=o.xyz.div(o.w),u=o.z,i.coordinateSystem===To&&(u=u.mul(2).sub(1));else{const c=o.w;o=o.xy.div(c);const d=su("near","float",n.camera).setGroup(xa),g=su("far","float",n.camera).setGroup(xa);u=FS(c.negate(),d,g)}return o=Kn(o.x,o.y.oneMinus(),u.add(a)),o}getShadowFilterFn(e){return _Q[e]}setupRenderTarget(e,t){const n=new Al(e.mapSize.width,e.mapSize.height);n.name="ShadowDepthTexture",n.compareFunction=oo;const i=t.createRenderTarget(e.mapSize.width,e.mapSize.height);return i.texture.name="ShadowMap",i.texture.type=e.mapType,i.depthTexture=n,{shadowMap:i,depthTexture:n}}setupShadow(e){const{renderer:t,camera:n}=e,{light:i,shadow:a}=this,o=t.shadowMap.type,{depthTexture:u,shadowMap:c}=this.setupRenderTarget(a,e);if(a.camera.coordinateSystem=n.coordinateSystem,a.camera.updateProjectionMatrix(),o===X&&a.isPointLightShadow!==!0){u.compareFunction=null,c.depth>1?(c._vsmShadowMapVertical||(c._vsmShadowMapVertical=e.createRenderTarget(a.mapSize.width,a.mapSize.height,{format:ze,type:Wt,depth:c.depth,depthBuffer:!1}),c._vsmShadowMapVertical.texture.name="VSMVertical"),this.vsmShadowMapVertical=c._vsmShadowMapVertical,c._vsmShadowMapHorizontal||(c._vsmShadowMapHorizontal=e.createRenderTarget(a.mapSize.width,a.mapSize.height,{format:ze,type:Wt,depth:c.depth,depthBuffer:!1}),c._vsmShadowMapHorizontal.texture.name="VSMHorizontal"),this.vsmShadowMapHorizontal=c._vsmShadowMapHorizontal):(this.vsmShadowMapVertical=e.createRenderTarget(a.mapSize.width,a.mapSize.height,{format:ze,type:Wt,depthBuffer:!1}),this.vsmShadowMapHorizontal=e.createRenderTarget(a.mapSize.width,a.mapSize.height,{format:ze,type:Wt,depthBuffer:!1}));let Ce=xl(u);u.isArrayTexture&&(Ce=Ce.depth(this.depthLayer));let ke=xl(this.vsmShadowMapVertical.texture);u.isArrayTexture&&(ke=ke.depth(this.depthLayer));const nt=su("blurSamples","float",a).setGroup(xa),Ye=su("radius","float",a).setGroup(xa),ht=su("mapSize","vec2",a).setGroup(xa);let Rt=this.vsmMaterialVertical||(this.vsmMaterialVertical=new yc);Rt.fragmentNode=xQ({samples:nt,radius:Ye,size:ht,shadowPass:Ce,depthLayer:this.depthLayer}).context(e.getSharedContext()),Rt.name="VSMVertical",Rt=this.vsmMaterialHorizontal||(this.vsmMaterialHorizontal=new yc),Rt.fragmentNode=bQ({samples:nt,radius:Ye,size:ht,shadowPass:ke,depthLayer:this.depthLayer}).context(e.getSharedContext()),Rt.name="VSMHorizontal"}const d=su("intensity","float",a).setGroup(xa),g=su("normalBias","float",a).setGroup(xa),v=b_(i).mul(bM.add(Om.mul(g))),M=this.setupShadowCoord(e,v),B=a.filterNode||this.getShadowFilterFn(t.shadowMap.type)||null;if(B===null)throw new Error("THREE.WebGPURenderer: Shadow map type not supported yet.");const I=o===X&&a.isPointLightShadow!==!0?this.vsmShadowMapHorizontal.texture:u,ne=this.setupShadowFilter(e,{filterFn:B,shadowTexture:c.texture,depthTexture:I,shadowCoord:M,shadow:a,depthLayer:this.depthLayer});let ee;c.texture.isCubeTexture?ee=lf(c.texture,M.xyz):(ee=xl(c.texture,M),u.isArrayTexture&&(ee=ee.depth(this.depthLayer)));const q=zo(1,ne.rgb.mix(ee,1),d.mul(ee.a)).toVar();this.shadowMap=c,this.shadow.map=c;const ye=`${this.light.type} Shadow [ ${this.light.name||"ID: "+this.light.id} ]`;return q.toInspector(`${ye} / Color`,()=>this.shadowMap.texture.isCubeTexture?lf(this.shadowMap.texture):xl(this.shadowMap.texture)).toInspector(`${ye} / Depth`,()=>this.shadowMap.texture.isCubeTexture?lf(this.shadowMap.texture).r.oneMinus():Rc(this.shadowMap.depthTexture,Zl().mul(Xg(xl(this.shadowMap.depthTexture)))).r.oneMinus())}setup(e){if(e.renderer.shadowMap.enabled!==!1)return or(()=>{const t=e.renderer.shadowMap.type;this._currentShadowType!==t&&(this._reset(),this._node=null);let n=this._node;return this.setupShadowPosition(e),n===null&&(this._node=n=this.setupShadow(e),this._currentShadowType=t),e.material.shadowNode&&Lr('NodeMaterial: ".shadowNode" is deprecated. Use ".castShadowNode" instead.'),e.material.receivedShadowNode&&(n=e.material.receivedShadowNode(n)),n})()}renderShadow(e){const{shadow:t,shadowMap:n,light:i}=this,{renderer:a,scene:o}=e;t.updateMatrices(i),n.setSize(t.mapSize.width,t.mapSize.height,n.depth);const u=o.name;o.name=`Shadow Map [ ${i.name||"ID: "+i.id} ]`,a.render(o,t.camera),o.name=u}updateShadow(e){const{shadowMap:t,light:n,shadow:i}=this,{renderer:a,scene:o,camera:u}=e,c=a.shadowMap.type,d=t.depthTexture.version;this._depthVersionCached=d;const g=i.camera.layers.mask;i.camera.layers.mask&4294967294||(i.camera.layers.mask=u.layers.mask);const v=a.getRenderObjectFunction(),M=a.getMRT(),B=M?M.has("velocity"):!1;SM=VI(a,o,SM),o.overrideMaterial=ZI(n),a.setRenderObjectFunction(XI(a,i,c,B)),a.setClearColor(0,0),a.setRenderTarget(t),this.renderShadow(e),a.setRenderObjectFunction(v),c===X&&i.isPointLightShadow!==!0&&this.vsmPass(a),i.camera.layers.mask=g,zI(a,o,SM)}vsmPass(e){const{shadow:t}=this,n=this.shadowMap.depth;this.vsmShadowMapVertical.setSize(t.mapSize.width,t.mapSize.height,n),this.vsmShadowMapHorizontal.setSize(t.mapSize.width,t.mapSize.height,n),e.setRenderTarget(this.vsmShadowMapVertical),w_.material=this.vsmMaterialVertical,w_.render(e),e.setRenderTarget(this.vsmShadowMapHorizontal),w_.material=this.vsmMaterialHorizontal,w_.render(e)}dispose(){this._reset(),super.dispose()}_reset(){this._currentShadowType=null,KI(this.light),this.shadowMap&&(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)}updateBefore(e){const{shadow:t}=this;let n=t.needsUpdate||t.autoUpdate;n&&(this._cameraFrameId[e.camera]===e.frameId&&(n=!1),this._cameraFrameId[e.camera]=e.frameId),n&&(this.updateShadow(e),this.shadowMap.depthTexture.version===this._depthVersionCached&&(t.needsUpdate=!1))}}const YI=(s,e)=>new jI(s,e),wQ=new Wr,qI=new di,ox=new le,MM=new le,SQ=[new le(1,0,0),new le(-1,0,0),new le(0,-1,0),new le(0,1,0),new le(0,0,1),new le(0,0,-1)],MQ=[new le(0,-1,0),new le(0,-1,0),new le(0,0,-1),new le(0,0,1),new le(0,-1,0),new le(0,-1,0)],EQ=[new le(1,0,0),new le(-1,0,0),new le(0,1,0),new le(0,-1,0),new le(0,0,1),new le(0,0,-1)],CQ=[new le(0,-1,0),new le(0,-1,0),new le(0,0,1),new le(0,0,-1),new le(0,-1,0),new le(0,-1,0)],JI=or(({depthTexture:s,bd3D:e,dp:t})=>lf(s,e).compare(t)),eN=or(({depthTexture:s,bd3D:e,dp:t,shadow:n})=>{const i=su("radius","float",n).setGroup(xa),a=su("mapSize","vec2",n).setGroup(xa),o=i.div(a.x),u=Su(e),c=rf(Zg(e,u.x.greaterThan(u.z).select(Kn(0,1,0),Kn(1,0,0)))),d=Zg(e,c),g=uM(m0.xy).mul(6.28318530718),v=Ep(0,5,g),M=Ep(1,5,g),B=Ep(2,5,g),I=Ep(3,5,g),ne=Ep(4,5,g);return lf(s,e.add(c.mul(v.x).add(d.mul(v.y)).mul(o))).compare(t).add(lf(s,e.add(c.mul(M.x).add(d.mul(M.y)).mul(o))).compare(t)).add(lf(s,e.add(c.mul(B.x).add(d.mul(B.y)).mul(o))).compare(t)).add(lf(s,e.add(c.mul(I.x).add(d.mul(I.y)).mul(o))).compare(t)).add(lf(s,e.add(c.mul(ne.x).add(d.mul(ne.y)).mul(o))).compare(t)).mul(1/5)}),TQ=or(({filterFn:s,depthTexture:e,shadowCoord:t,shadow:n})=>{const i=t.xyz.toVar(),a=i.length(),o=va("float").setGroup(xa).onRenderUpdate(()=>n.camera.near),u=va("float").setGroup(xa).onRenderUpdate(()=>n.camera.far),c=su("bias","float",n).setGroup(xa),d=qt(1).toVar();return ra(a.sub(u).lessThanEqual(0).and(a.sub(o).greaterThanEqual(0)),()=>{const g=a.sub(o).div(u.sub(o)).toVar();g.addAssign(c);const v=i.normalize();d.assign(s({depthTexture:e,bd3D:v,dp:g,shadow:n}))}),d});class BQ extends jI{static get type(){return"PointShadowNode"}constructor(e,t=null){super(e,t)}getShadowFilterFn(e){return e===P?JI:eN}setupShadowCoord(e,t){return t}setupShadowFilter(e,{filterFn:t,depthTexture:n,shadowCoord:i,shadow:a}){return TQ({filterFn:t,depthTexture:n,shadowCoord:i,shadow:a})}setupRenderTarget(e,t){const n=new sA(e.mapSize.width);n.name="PointShadowDepthTexture",n.compareFunction=oo;const i=t.createCubeRenderTarget(e.mapSize.width);return i.texture.name="PointShadowMap",i.depthTexture=n,{shadowMap:i,depthTexture:n}}renderShadow(e){const{shadow:t,shadowMap:n,light:i}=this,{renderer:a,scene:o}=e,u=t.camera,c=t.matrix,d=a.coordinateSystem===To,g=d?SQ:EQ,v=d?MQ:CQ;n.setSize(t.mapSize.width,t.mapSize.width);const M=a.autoClear,B=a.getClearColor(wQ),I=a.getClearAlpha();a.autoClear=!1,a.setClearColor(t.clearColor,t.clearAlpha);for(let ne=0;ne<6;ne++){a.setRenderTarget(n,ne),a.clear();const ee=i.distance||u.far;ee!==u.far&&(u.far=ee,u.updateProjectionMatrix()),ox.setFromMatrixPosition(i.matrixWorld),u.position.copy(ox),MM.copy(u.position),MM.add(g[ne]),u.up.copy(v[ne]),u.lookAt(MM),u.updateMatrixWorld(),c.makeTranslation(-ox.x,-ox.y,-ox.z),qI.multiplyMatrices(u.projectionMatrix,u.matrixWorldInverse),t._frustum.setFromProjectionMatrix(qI,u.coordinateSystem,u.reversedDepth);const q=o.name;o.name=`Point Light Shadow [ ${i.name||"ID: "+i.id} ] - Face ${ne+1}`,a.render(o,u),o.name=q}a.autoClear=M,a.setClearColor(B,I)}}const tN=(s,e)=>new BQ(s,e);class E0 extends Sv{static get type(){return"AnalyticLightNode"}constructor(e=null){super(),this.light=e,this.color=new Wr,this.colorNode=e&&e.colorNode||va(this.color).setGroup(xa),this.baseColorNode=null,this.shadowNode=null,this.shadowColorNode=null,this.isAnalyticLightNode=!0,this.updateType=Ao.FRAME,e&&e.shadow&&(this._shadowDisposeListener=()=>{this.disposeShadow()},e.addEventListener("dispose",this._shadowDisposeListener))}dispose(){this._shadowDisposeListener&&this.light.removeEventListener("dispose",this._shadowDisposeListener),super.dispose()}disposeShadow(){this.shadowNode!==null&&(this.shadowNode.dispose(),this.shadowNode=null),this.shadowColorNode=null,this.baseColorNode!==null&&(this.colorNode=this.baseColorNode,this.baseColorNode=null)}getHash(){return this.light.uuid}getLightVector(e){return mM(this.light).sub(e.context.positionView||Oc)}setupDirect(){}setupDirectRectArea(){}setupShadowNode(){return YI(this.light)}setupShadow(e){const{renderer:t}=e;if(t.shadowMap.enabled===!1)return;let n=this.shadowColorNode;if(n===null){const i=this.light.shadow.shadowNode;let a;i!==void 0?a=Ss(i):a=this.setupShadowNode(),this.shadowNode=a,this.shadowColorNode=n=this.colorNode.mul(a),this.baseColorNode=this.colorNode}e.context.getShadow&&(n=e.context.getShadow(this,e)),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);const t=this.setupDirect(e),n=this.setupDirectRectArea(e);t&&e.lightsNode.setupDirectLight(e,this,t),n&&e.lightsNode.setupDirectRectAreaLight(e,this,n)}update(){const{light:e}=this;this.color.copy(e.color).multiplyScalar(e.intensity)}}const EM=or(({lightDistance:s,cutoffDistance:e,decayExponent:t})=>{const n=s.pow(t).max(.01).reciprocal();return e.greaterThan(0).select(n.mul(s.div(e).pow4().oneMinus().clamp().pow2()),n)}),nN=({color:s,lightVector:e,cutoffDistance:t,decayExponent:n})=>{const i=e.normalize(),a=e.length(),o=EM({lightDistance:a,cutoffDistance:t,decayExponent:n}),u=s.mul(o);return{lightDirection:i,lightColor:u}};class RQ extends E0{static get type(){return"PointLightNode"}constructor(e=null){super(e),this.cutoffDistanceNode=va(0).setGroup(xa),this.decayExponentNode=va(2).setGroup(xa)}update(e){const{light:t}=this;super.update(e),this.cutoffDistanceNode.value=t.distance,this.decayExponentNode.value=t.decay}setupShadowNode(){return tN(this.light)}setupDirect(e){return nN({color:this.colorNode,lightVector:this.getLightVector(e),cutoffDistance:this.cutoffDistanceNode,decayExponent:this.decayExponentNode})}}const IQ=or(([s=Zl()])=>{const e=s.mul(2),t=e.x.floor(),n=e.y.floor();return t.add(n).mod(2).sign()}),NQ=or(([s=Zl()],{renderer:e,material:t})=>{const n=Z1(s.mul(2).sub(1));let i;if(t.alphaToCoverage&&e.currentSamples>0){const a=qt(n.fwidth()).toVar();i=fA(a.oneMinus(),a.add(1),n).oneMinus()}else i=ud(n.greaterThan(1),0,1);return i}),lx=or(([s,e,t])=>{const n=qt(t).toVar(),i=qt(e).toVar(),a=WA(s).toVar();return ud(a,i,n)}).setLayout({name:"mx_select",type:"float",inputs:[{name:"b",type:"bool"},{name:"t",type:"float"},{name:"f",type:"float"}]}),S_=or(([s,e])=>{const t=WA(e).toVar(),n=qt(s).toVar();return ud(t,n.negate(),n)}).setLayout({name:"mx_negate_if",type:"float",inputs:[{name:"val",type:"float"},{name:"b",type:"bool"}]}),Xc=or(([s])=>{const e=qt(s).toVar();return Qn(ag(e))}).setLayout({name:"mx_floor",type:"int",inputs:[{name:"x",type:"float"}]}),ic=or(([s,e])=>{const t=qt(s).toVar();return e.assign(Xc(t)),t.sub(qt(e))}),rN=hd([or(([s,e,t,n,i,a])=>{const o=qt(a).toVar(),u=qt(i).toVar(),c=qt(n).toVar(),d=qt(t).toVar(),g=qt(e).toVar(),v=qt(s).toVar(),M=qt(el(1,u)).toVar();return el(1,o).mul(v.mul(M).add(g.mul(u))).add(o.mul(d.mul(M).add(c.mul(u))))}).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"}]}),or(([s,e,t,n,i,a])=>{const o=qt(a).toVar(),u=qt(i).toVar(),c=Kn(n).toVar(),d=Kn(t).toVar(),g=Kn(e).toVar(),v=Kn(s).toVar(),M=qt(el(1,u)).toVar();return el(1,o).mul(v.mul(M).add(g.mul(u))).add(o.mul(d.mul(M).add(c.mul(u))))}).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"}]})]),iN=hd([or(([s,e,t,n,i,a,o,u,c,d,g])=>{const v=qt(g).toVar(),M=qt(d).toVar(),B=qt(c).toVar(),I=qt(u).toVar(),ne=qt(o).toVar(),ee=qt(a).toVar(),q=qt(i).toVar(),ye=qt(n).toVar(),Ce=qt(t).toVar(),ke=qt(e).toVar(),nt=qt(s).toVar(),Ye=qt(el(1,B)).toVar(),ht=qt(el(1,M)).toVar();return qt(el(1,v)).toVar().mul(ht.mul(nt.mul(Ye).add(ke.mul(B))).add(M.mul(Ce.mul(Ye).add(ye.mul(B))))).add(v.mul(ht.mul(q.mul(Ye).add(ee.mul(B))).add(M.mul(ne.mul(Ye).add(I.mul(B))))))}).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"}]}),or(([s,e,t,n,i,a,o,u,c,d,g])=>{const v=qt(g).toVar(),M=qt(d).toVar(),B=qt(c).toVar(),I=Kn(u).toVar(),ne=Kn(o).toVar(),ee=Kn(a).toVar(),q=Kn(i).toVar(),ye=Kn(n).toVar(),Ce=Kn(t).toVar(),ke=Kn(e).toVar(),nt=Kn(s).toVar(),Ye=qt(el(1,B)).toVar(),ht=qt(el(1,M)).toVar();return qt(el(1,v)).toVar().mul(ht.mul(nt.mul(Ye).add(ke.mul(B))).add(M.mul(Ce.mul(Ye).add(ye.mul(B))))).add(v.mul(ht.mul(q.mul(Ye).add(ee.mul(B))).add(M.mul(ne.mul(Ye).add(I.mul(B))))))}).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"}]})]),Zh=hd([or(([s,e,t])=>{const n=qt(t).toVar(),i=qt(e).toVar(),a=Fi(s).toVar(),o=Fi(a.bitAnd(Fi(7))).toVar(),u=qt(lx(o.lessThan(Fi(4)),i,n)).toVar(),c=qt(no(2,lx(o.lessThan(Fi(4)),n,i))).toVar();return S_(u,WA(o.bitAnd(Fi(1)))).add(S_(c,WA(o.bitAnd(Fi(2)))))}).setLayout({name:"mx_gradient_float_0",type:"float",inputs:[{name:"hash",type:"uint"},{name:"x",type:"float"},{name:"y",type:"float"}]}),or(([s,e,t,n])=>{const i=qt(n).toVar(),a=qt(t).toVar(),o=qt(e).toVar(),u=Fi(s).toVar(),c=Fi(u.bitAnd(Fi(15))).toVar(),d=qt(lx(c.lessThan(Fi(8)),o,a)).toVar(),g=qt(lx(c.lessThan(Fi(4)),a,lx(c.equal(Fi(12)).or(c.equal(Fi(14))),o,i))).toVar();return S_(d,WA(c.bitAnd(Fi(1)))).add(S_(g,WA(c.bitAnd(Fi(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"}]})]),qA=hd([or(([s,e,t])=>{const n=qt(t).toVar(),i=qt(e).toVar(),a=h0(s).toVar();return Kn(Zh(a.x,i,n),Zh(a.y,i,n),Zh(a.z,i,n))}).setLayout({name:"mx_gradient_vec3_0",type:"vec3",inputs:[{name:"hash",type:"uvec3"},{name:"x",type:"float"},{name:"y",type:"float"}]}),or(([s,e,t,n])=>{const i=qt(n).toVar(),a=qt(t).toVar(),o=qt(e).toVar(),u=h0(s).toVar();return Kn(Zh(u.x,o,a,i),Zh(u.y,o,a,i),Zh(u.z,o,a,i))}).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"}]})]),FQ=or(([s])=>{const e=qt(s).toVar();return no(.6616,e)}).setLayout({name:"mx_gradient_scale2d_0",type:"float",inputs:[{name:"v",type:"float"}]}),PQ=or(([s])=>{const e=qt(s).toVar();return no(.982,e)}).setLayout({name:"mx_gradient_scale3d_0",type:"float",inputs:[{name:"v",type:"float"}]}),sN=hd([FQ,or(([s])=>{const e=Kn(s).toVar();return no(.6616,e)}).setLayout({name:"mx_gradient_scale2d_1",type:"vec3",inputs:[{name:"v",type:"vec3"}]})]),aN=hd([PQ,or(([s])=>{const e=Kn(s).toVar();return no(.982,e)}).setLayout({name:"mx_gradient_scale3d_1",type:"vec3",inputs:[{name:"v",type:"vec3"}]})]),vA=or(([s,e])=>{const t=Qn(e).toVar(),n=Fi(s).toVar();return n.shiftLeft(t).bitOr(n.shiftRight(Qn(32).sub(t)))}).setLayout({name:"mx_rotl32",type:"uint",inputs:[{name:"x",type:"uint"},{name:"k",type:"int"}]}),oN=or(([s,e,t])=>{s.subAssign(t),s.bitXorAssign(vA(t,Qn(4))),t.addAssign(e),e.subAssign(s),e.bitXorAssign(vA(s,Qn(6))),s.addAssign(t),t.subAssign(e),t.bitXorAssign(vA(e,Qn(8))),e.addAssign(s),s.subAssign(t),s.bitXorAssign(vA(t,Qn(16))),t.addAssign(e),e.subAssign(s),e.bitXorAssign(vA(s,Qn(19))),s.addAssign(t),t.subAssign(e),t.bitXorAssign(vA(e,Qn(4))),e.addAssign(s)}),ux=or(([s,e,t])=>{const n=Fi(t).toVar(),i=Fi(e).toVar(),a=Fi(s).toVar();return n.bitXorAssign(i),n.subAssign(vA(i,Qn(14))),a.bitXorAssign(n),a.subAssign(vA(n,Qn(11))),i.bitXorAssign(a),i.subAssign(vA(a,Qn(25))),n.bitXorAssign(i),n.subAssign(vA(i,Qn(16))),a.bitXorAssign(n),a.subAssign(vA(n,Qn(4))),i.bitXorAssign(a),i.subAssign(vA(a,Qn(14))),n.bitXorAssign(i),n.subAssign(vA(i,Qn(24))),n}).setLayout({name:"mx_bjfinal",type:"uint",inputs:[{name:"a",type:"uint"},{name:"b",type:"uint"},{name:"c",type:"uint"}]}),Pd=or(([s])=>{const e=Fi(s).toVar();return qt(e).div(qt(Fi(Qn(4294967295))))}).setLayout({name:"mx_bits_to_01",type:"float",inputs:[{name:"bits",type:"uint"}]}),gg=or(([s])=>{const e=qt(s).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"}]}),au=hd([or(([s])=>{const e=Qn(s).toVar(),t=Fi(Fi(1)).toVar(),n=Fi(Fi(Qn(3735928559)).add(t.shiftLeft(Fi(2))).add(Fi(13))).toVar();return ux(n.add(Fi(e)),n,n)}).setLayout({name:"mx_hash_int_0",type:"uint",inputs:[{name:"x",type:"int"}]}),or(([s,e])=>{const t=Qn(e).toVar(),n=Qn(s).toVar(),i=Fi(Fi(2)).toVar(),a=Fi().toVar(),o=Fi().toVar(),u=Fi().toVar();return a.assign(o.assign(u.assign(Fi(Qn(3735928559)).add(i.shiftLeft(Fi(2))).add(Fi(13))))),a.addAssign(Fi(n)),o.addAssign(Fi(t)),ux(a,o,u)}).setLayout({name:"mx_hash_int_1",type:"uint",inputs:[{name:"x",type:"int"},{name:"y",type:"int"}]}),or(([s,e,t])=>{const n=Qn(t).toVar(),i=Qn(e).toVar(),a=Qn(s).toVar(),o=Fi(Fi(3)).toVar(),u=Fi().toVar(),c=Fi().toVar(),d=Fi().toVar();return u.assign(c.assign(d.assign(Fi(Qn(3735928559)).add(o.shiftLeft(Fi(2))).add(Fi(13))))),u.addAssign(Fi(a)),c.addAssign(Fi(i)),d.addAssign(Fi(n)),ux(u,c,d)}).setLayout({name:"mx_hash_int_2",type:"uint",inputs:[{name:"x",type:"int"},{name:"y",type:"int"},{name:"z",type:"int"}]}),or(([s,e,t,n])=>{const i=Qn(n).toVar(),a=Qn(t).toVar(),o=Qn(e).toVar(),u=Qn(s).toVar(),c=Fi(Fi(4)).toVar(),d=Fi().toVar(),g=Fi().toVar(),v=Fi().toVar();return d.assign(g.assign(v.assign(Fi(Qn(3735928559)).add(c.shiftLeft(Fi(2))).add(Fi(13))))),d.addAssign(Fi(u)),g.addAssign(Fi(o)),v.addAssign(Fi(a)),oN(d,g,v),d.addAssign(Fi(i)),ux(d,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"}]}),or(([s,e,t,n,i])=>{const a=Qn(i).toVar(),o=Qn(n).toVar(),u=Qn(t).toVar(),c=Qn(e).toVar(),d=Qn(s).toVar(),g=Fi(Fi(5)).toVar(),v=Fi().toVar(),M=Fi().toVar(),B=Fi().toVar();return v.assign(M.assign(B.assign(Fi(Qn(3735928559)).add(g.shiftLeft(Fi(2))).add(Fi(13))))),v.addAssign(Fi(d)),M.addAssign(Fi(c)),B.addAssign(Fi(u)),oN(v,M,B),v.addAssign(Fi(o)),M.addAssign(Fi(a)),ux(v,M,B)}).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"}]})]),JA=hd([or(([s,e])=>{const t=Qn(e).toVar(),n=Qn(s).toVar(),i=Fi(au(n,t)).toVar(),a=h0().toVar();return a.x.assign(i.bitAnd(Qn(255))),a.y.assign(i.shiftRight(Qn(8)).bitAnd(Qn(255))),a.z.assign(i.shiftRight(Qn(16)).bitAnd(Qn(255))),a}).setLayout({name:"mx_hash_vec3_0",type:"uvec3",inputs:[{name:"x",type:"int"},{name:"y",type:"int"}]}),or(([s,e,t])=>{const n=Qn(t).toVar(),i=Qn(e).toVar(),a=Qn(s).toVar(),o=Fi(au(a,i,n)).toVar(),u=h0().toVar();return u.x.assign(o.bitAnd(Qn(255))),u.y.assign(o.shiftRight(Qn(8)).bitAnd(Qn(255))),u.z.assign(o.shiftRight(Qn(16)).bitAnd(Qn(255))),u}).setLayout({name:"mx_hash_vec3_1",type:"uvec3",inputs:[{name:"x",type:"int"},{name:"y",type:"int"},{name:"z",type:"int"}]})]),CM=hd([or(([s])=>{const e=Gi(s).toVar(),t=Qn().toVar(),n=Qn().toVar(),i=qt(ic(e.x,t)).toVar(),a=qt(ic(e.y,n)).toVar(),o=qt(gg(i)).toVar(),u=qt(gg(a)).toVar(),c=qt(rN(Zh(au(t,n),i,a),Zh(au(t.add(Qn(1)),n),i.sub(1),a),Zh(au(t,n.add(Qn(1))),i,a.sub(1)),Zh(au(t.add(Qn(1)),n.add(Qn(1))),i.sub(1),a.sub(1)),o,u)).toVar();return sN(c)}).setLayout({name:"mx_perlin_noise_float_0",type:"float",inputs:[{name:"p",type:"vec2"}]}),or(([s])=>{const e=Kn(s).toVar(),t=Qn().toVar(),n=Qn().toVar(),i=Qn().toVar(),a=qt(ic(e.x,t)).toVar(),o=qt(ic(e.y,n)).toVar(),u=qt(ic(e.z,i)).toVar(),c=qt(gg(a)).toVar(),d=qt(gg(o)).toVar(),g=qt(gg(u)).toVar(),v=qt(iN(Zh(au(t,n,i),a,o,u),Zh(au(t.add(Qn(1)),n,i),a.sub(1),o,u),Zh(au(t,n.add(Qn(1)),i),a,o.sub(1),u),Zh(au(t.add(Qn(1)),n.add(Qn(1)),i),a.sub(1),o.sub(1),u),Zh(au(t,n,i.add(Qn(1))),a,o,u.sub(1)),Zh(au(t.add(Qn(1)),n,i.add(Qn(1))),a.sub(1),o,u.sub(1)),Zh(au(t,n.add(Qn(1)),i.add(Qn(1))),a,o.sub(1),u.sub(1)),Zh(au(t.add(Qn(1)),n.add(Qn(1)),i.add(Qn(1))),a.sub(1),o.sub(1),u.sub(1)),c,d,g)).toVar();return aN(v)}).setLayout({name:"mx_perlin_noise_float_1",type:"float",inputs:[{name:"p",type:"vec3"}]})]),cx=hd([or(([s])=>{const e=Gi(s).toVar(),t=Qn().toVar(),n=Qn().toVar(),i=qt(ic(e.x,t)).toVar(),a=qt(ic(e.y,n)).toVar(),o=qt(gg(i)).toVar(),u=qt(gg(a)).toVar(),c=Kn(rN(qA(JA(t,n),i,a),qA(JA(t.add(Qn(1)),n),i.sub(1),a),qA(JA(t,n.add(Qn(1))),i,a.sub(1)),qA(JA(t.add(Qn(1)),n.add(Qn(1))),i.sub(1),a.sub(1)),o,u)).toVar();return sN(c)}).setLayout({name:"mx_perlin_noise_vec3_0",type:"vec3",inputs:[{name:"p",type:"vec2"}]}),or(([s])=>{const e=Kn(s).toVar(),t=Qn().toVar(),n=Qn().toVar(),i=Qn().toVar(),a=qt(ic(e.x,t)).toVar(),o=qt(ic(e.y,n)).toVar(),u=qt(ic(e.z,i)).toVar(),c=qt(gg(a)).toVar(),d=qt(gg(o)).toVar(),g=qt(gg(u)).toVar(),v=Kn(iN(qA(JA(t,n,i),a,o,u),qA(JA(t.add(Qn(1)),n,i),a.sub(1),o,u),qA(JA(t,n.add(Qn(1)),i),a,o.sub(1),u),qA(JA(t.add(Qn(1)),n.add(Qn(1)),i),a.sub(1),o.sub(1),u),qA(JA(t,n,i.add(Qn(1))),a,o,u.sub(1)),qA(JA(t.add(Qn(1)),n,i.add(Qn(1))),a.sub(1),o,u.sub(1)),qA(JA(t,n.add(Qn(1)),i.add(Qn(1))),a,o.sub(1),u.sub(1)),qA(JA(t.add(Qn(1)),n.add(Qn(1)),i.add(Qn(1))),a.sub(1),o.sub(1),u.sub(1)),c,d,g)).toVar();return aN(v)}).setLayout({name:"mx_perlin_noise_vec3_1",type:"vec3",inputs:[{name:"p",type:"vec3"}]})]),LQ=hd([or(([s])=>{const e=qt(s).toVar(),t=Qn(Xc(e)).toVar();return Pd(au(t))}).setLayout({name:"mx_cell_noise_float_0",type:"float",inputs:[{name:"p",type:"float"}]}),or(([s])=>{const e=Gi(s).toVar(),t=Qn(Xc(e.x)).toVar(),n=Qn(Xc(e.y)).toVar();return Pd(au(t,n))}).setLayout({name:"mx_cell_noise_float_1",type:"float",inputs:[{name:"p",type:"vec2"}]}),or(([s])=>{const e=Kn(s).toVar(),t=Qn(Xc(e.x)).toVar(),n=Qn(Xc(e.y)).toVar(),i=Qn(Xc(e.z)).toVar();return Pd(au(t,n,i))}).setLayout({name:"mx_cell_noise_float_2",type:"float",inputs:[{name:"p",type:"vec3"}]}),or(([s])=>{const e=Ks(s).toVar(),t=Qn(Xc(e.x)).toVar(),n=Qn(Xc(e.y)).toVar(),i=Qn(Xc(e.z)).toVar(),a=Qn(Xc(e.w)).toVar();return Pd(au(t,n,i,a))}).setLayout({name:"mx_cell_noise_float_3",type:"float",inputs:[{name:"p",type:"vec4"}]})]),M_=hd([or(([s])=>{const e=qt(s).toVar(),t=Qn(Xc(e)).toVar();return Kn(Pd(au(t,Qn(0))),Pd(au(t,Qn(1))),Pd(au(t,Qn(2))))}).setLayout({name:"mx_cell_noise_vec3_0",type:"vec3",inputs:[{name:"p",type:"float"}]}),or(([s])=>{const e=Gi(s).toVar(),t=Qn(Xc(e.x)).toVar(),n=Qn(Xc(e.y)).toVar();return Kn(Pd(au(t,n,Qn(0))),Pd(au(t,n,Qn(1))),Pd(au(t,n,Qn(2))))}).setLayout({name:"mx_cell_noise_vec3_1",type:"vec3",inputs:[{name:"p",type:"vec2"}]}),or(([s])=>{const e=Kn(s).toVar(),t=Qn(Xc(e.x)).toVar(),n=Qn(Xc(e.y)).toVar(),i=Qn(Xc(e.z)).toVar();return Kn(Pd(au(t,n,i,Qn(0))),Pd(au(t,n,i,Qn(1))),Pd(au(t,n,i,Qn(2))))}).setLayout({name:"mx_cell_noise_vec3_2",type:"vec3",inputs:[{name:"p",type:"vec3"}]}),or(([s])=>{const e=Ks(s).toVar(),t=Qn(Xc(e.x)).toVar(),n=Qn(Xc(e.y)).toVar(),i=Qn(Xc(e.z)).toVar(),a=Qn(Xc(e.w)).toVar();return Kn(Pd(au(t,n,i,a,Qn(0))),Pd(au(t,n,i,a,Qn(1))),Pd(au(t,n,i,a,Qn(2))))}).setLayout({name:"mx_cell_noise_vec3_3",type:"vec3",inputs:[{name:"p",type:"vec4"}]})]),E_=or(([s,e,t,n])=>{const i=qt(n).toVar(),a=qt(t).toVar(),o=Qn(e).toVar(),u=Kn(s).toVar(),c=qt(0).toVar(),d=qt(1).toVar();return kl(o,()=>{c.addAssign(d.mul(CM(u))),d.mulAssign(i),u.mulAssign(a)}),c}).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"}]}),C_=or(([s,e,t,n])=>{const i=qt(n).toVar(),a=qt(t).toVar(),o=Qn(e).toVar(),u=Kn(s).toVar(),c=Kn(0).toVar(),d=qt(1).toVar();return kl(o,()=>{c.addAssign(d.mul(cx(u))),d.mulAssign(i),u.mulAssign(a)}),c}).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"}]}),UQ=or(([s,e,t,n])=>{const i=qt(n).toVar(),a=qt(t).toVar(),o=Qn(e).toVar(),u=Kn(s).toVar();return Gi(E_(u,o,a,i),E_(u.add(Kn(Qn(19),Qn(193),Qn(17))),o,a,i))}).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"}]}),OQ=or(([s,e,t,n])=>{const i=qt(n).toVar(),a=qt(t).toVar(),o=Qn(e).toVar(),u=Kn(s).toVar(),c=Kn(C_(u,o,a,i)).toVar(),d=qt(E_(u.add(Kn(Qn(19),Qn(193),Qn(17))),o,a,i)).toVar();return Ks(c,d)}).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"}]}),Uv=hd([or(([s,e,t,n,i,a,o])=>{const u=Qn(o).toVar(),c=qt(a).toVar(),d=Qn(i).toVar(),g=Qn(n).toVar(),v=Qn(t).toVar(),M=Qn(e).toVar(),B=Gi(s).toVar(),I=Kn(M_(Gi(M.add(g),v.add(d)))).toVar(),ne=Gi(I.x,I.y).toVar();ne.subAssign(.5),ne.mulAssign(c),ne.addAssign(.5);const ee=Gi(Gi(qt(M),qt(v)).add(ne)).toVar(),q=Gi(ee.sub(B)).toVar();return ra(u.equal(Qn(2)),()=>Su(q.x).add(Su(q.y))),ra(u.equal(Qn(3)),()=>mc(Su(q.x),Su(q.y))),ZA(q,q)}).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"}]}),or(([s,e,t,n,i,a,o,u,c])=>{const d=Qn(c).toVar(),g=qt(u).toVar(),v=Qn(o).toVar(),M=Qn(a).toVar(),B=Qn(i).toVar(),I=Qn(n).toVar(),ne=Qn(t).toVar(),ee=Qn(e).toVar(),q=Kn(s).toVar(),ye=Kn(M_(Kn(ee.add(B),ne.add(M),I.add(v)))).toVar();ye.subAssign(.5),ye.mulAssign(g),ye.addAssign(.5);const Ce=Kn(Kn(qt(ee),qt(ne),qt(I)).add(ye)).toVar(),ke=Kn(Ce.sub(q)).toVar();return ra(d.equal(Qn(2)),()=>Su(ke.x).add(Su(ke.y)).add(Su(ke.z))),ra(d.equal(Qn(3)),()=>mc(Su(ke.x),Su(ke.y),Su(ke.z))),ZA(ke,ke)}).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"}]})]),DQ=or(([s,e,t])=>{const n=Qn(t).toVar(),i=qt(e).toVar(),a=Gi(s).toVar(),o=Qn().toVar(),u=Qn().toVar(),c=Gi(ic(a.x,o),ic(a.y,u)).toVar(),d=qt(1e6).toVar();return kl({start:-1,end:Qn(1),name:"x",condition:"<="},({x:g})=>{kl({start:-1,end:Qn(1),name:"y",condition:"<="},({y:v})=>{const M=qt(Uv(c,g,v,o,u,i,n)).toVar();d.assign(Uf(d,M))})}),ra(n.equal(Qn(0)),()=>{d.assign(Nd(d))}),d}).setLayout({name:"mx_worley_noise_float_0",type:"float",inputs:[{name:"p",type:"vec2"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),kQ=or(([s,e,t])=>{const n=Qn(t).toVar(),i=qt(e).toVar(),a=Gi(s).toVar(),o=Qn().toVar(),u=Qn().toVar(),c=Gi(ic(a.x,o),ic(a.y,u)).toVar(),d=Gi(1e6,1e6).toVar();return kl({start:-1,end:Qn(1),name:"x",condition:"<="},({x:g})=>{kl({start:-1,end:Qn(1),name:"y",condition:"<="},({y:v})=>{const M=qt(Uv(c,g,v,o,u,i,n)).toVar();ra(M.lessThan(d.x),()=>{d.y.assign(d.x),d.x.assign(M)}).ElseIf(M.lessThan(d.y),()=>{d.y.assign(M)})})}),ra(n.equal(Qn(0)),()=>{d.assign(Nd(d))}),d}).setLayout({name:"mx_worley_noise_vec2_0",type:"vec2",inputs:[{name:"p",type:"vec2"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),VQ=or(([s,e,t])=>{const n=Qn(t).toVar(),i=qt(e).toVar(),a=Gi(s).toVar(),o=Qn().toVar(),u=Qn().toVar(),c=Gi(ic(a.x,o),ic(a.y,u)).toVar(),d=Kn(1e6,1e6,1e6).toVar();return kl({start:-1,end:Qn(1),name:"x",condition:"<="},({x:g})=>{kl({start:-1,end:Qn(1),name:"y",condition:"<="},({y:v})=>{const M=qt(Uv(c,g,v,o,u,i,n)).toVar();ra(M.lessThan(d.x),()=>{d.z.assign(d.y),d.y.assign(d.x),d.x.assign(M)}).ElseIf(M.lessThan(d.y),()=>{d.z.assign(d.y),d.y.assign(M)}).ElseIf(M.lessThan(d.z),()=>{d.z.assign(M)})})}),ra(n.equal(Qn(0)),()=>{d.assign(Nd(d))}),d}).setLayout({name:"mx_worley_noise_vec3_0",type:"vec3",inputs:[{name:"p",type:"vec2"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),zQ=hd([DQ,or(([s,e,t])=>{const n=Qn(t).toVar(),i=qt(e).toVar(),a=Kn(s).toVar(),o=Qn().toVar(),u=Qn().toVar(),c=Qn().toVar(),d=Kn(ic(a.x,o),ic(a.y,u),ic(a.z,c)).toVar(),g=qt(1e6).toVar();return kl({start:-1,end:Qn(1),name:"x",condition:"<="},({x:v})=>{kl({start:-1,end:Qn(1),name:"y",condition:"<="},({y:M})=>{kl({start:-1,end:Qn(1),name:"z",condition:"<="},({z:B})=>{const I=qt(Uv(d,v,M,B,o,u,c,i,n)).toVar();g.assign(Uf(g,I))})})}),ra(n.equal(Qn(0)),()=>{g.assign(Nd(g))}),g}).setLayout({name:"mx_worley_noise_float_1",type:"float",inputs:[{name:"p",type:"vec3"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]})]),GQ=hd([kQ,or(([s,e,t])=>{const n=Qn(t).toVar(),i=qt(e).toVar(),a=Kn(s).toVar(),o=Qn().toVar(),u=Qn().toVar(),c=Qn().toVar(),d=Kn(ic(a.x,o),ic(a.y,u),ic(a.z,c)).toVar(),g=Gi(1e6,1e6).toVar();return kl({start:-1,end:Qn(1),name:"x",condition:"<="},({x:v})=>{kl({start:-1,end:Qn(1),name:"y",condition:"<="},({y:M})=>{kl({start:-1,end:Qn(1),name:"z",condition:"<="},({z:B})=>{const I=qt(Uv(d,v,M,B,o,u,c,i,n)).toVar();ra(I.lessThan(g.x),()=>{g.y.assign(g.x),g.x.assign(I)}).ElseIf(I.lessThan(g.y),()=>{g.y.assign(I)})})})}),ra(n.equal(Qn(0)),()=>{g.assign(Nd(g))}),g}).setLayout({name:"mx_worley_noise_vec2_1",type:"vec2",inputs:[{name:"p",type:"vec3"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]})]),TM=hd([VQ,or(([s,e,t])=>{const n=Qn(t).toVar(),i=qt(e).toVar(),a=Kn(s).toVar(),o=Qn().toVar(),u=Qn().toVar(),c=Qn().toVar(),d=Kn(ic(a.x,o),ic(a.y,u),ic(a.z,c)).toVar(),g=Kn(1e6,1e6,1e6).toVar();return kl({start:-1,end:Qn(1),name:"x",condition:"<="},({x:v})=>{kl({start:-1,end:Qn(1),name:"y",condition:"<="},({y:M})=>{kl({start:-1,end:Qn(1),name:"z",condition:"<="},({z:B})=>{const I=qt(Uv(d,v,M,B,o,u,c,i,n)).toVar();ra(I.lessThan(g.x),()=>{g.z.assign(g.y),g.y.assign(g.x),g.x.assign(I)}).ElseIf(I.lessThan(g.y),()=>{g.z.assign(g.y),g.y.assign(I)}).ElseIf(I.lessThan(g.z),()=>{g.z.assign(I)})})})}),ra(n.equal(Qn(0)),()=>{g.assign(Nd(g))}),g}).setLayout({name:"mx_worley_noise_vec3_1",type:"vec3",inputs:[{name:"p",type:"vec3"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]})]),HQ=or(([s,e,t,n,i,a,o,u,c,d,g])=>{const v=Qn(s).toVar(),M=Gi(e).toVar(),B=Gi(t).toVar(),I=Gi(n).toVar(),ne=qt(i).toVar(),ee=qt(a).toVar(),q=qt(o).toVar(),ye=WA(u).toVar(),Ce=Qn(c).toVar(),ke=qt(d).toVar(),nt=qt(g).toVar(),Ye=M.mul(B).add(I),ht=qt(0).toVar();return ra(v.equal(Qn(0)),()=>{ht.assign(cx(Ye))}),ra(v.equal(Qn(1)),()=>{ht.assign(M_(Ye))}),ra(v.equal(Qn(2)),()=>{ht.assign(TM(Ye,ne,Qn(0)))}),ra(v.equal(Qn(3)),()=>{ht.assign(C_(Kn(Ye,0),Ce,ke,nt))}),ht.assign(ht.mul(q.sub(ee)).add(ee)),ra(ye,()=>{ht.assign(Sp(ht,ee,q))}),ht}).setLayout({name:"mx_unifiednoise2d",type:"float",inputs:[{name:"noiseType",type:"int"},{name:"texcoord",type:"vec2"},{name:"freq",type:"vec2"},{name:"offset",type:"vec2"},{name:"jitter",type:"float"},{name:"outmin",type:"float"},{name:"outmax",type:"float"},{name:"clampoutput",type:"bool"},{name:"octaves",type:"int"},{name:"lacunarity",type:"float"},{name:"diminish",type:"float"}]}),QQ=or(([s,e,t,n,i,a,o,u,c,d,g])=>{const v=Qn(s).toVar(),M=Kn(e).toVar(),B=Kn(t).toVar(),I=Kn(n).toVar(),ne=qt(i).toVar(),ee=qt(a).toVar(),q=qt(o).toVar(),ye=WA(u).toVar(),Ce=Qn(c).toVar(),ke=qt(d).toVar(),nt=qt(g).toVar(),Ye=M.mul(B).add(I),ht=qt(0).toVar();return ra(v.equal(Qn(0)),()=>{ht.assign(cx(Ye))}),ra(v.equal(Qn(1)),()=>{ht.assign(M_(Ye))}),ra(v.equal(Qn(2)),()=>{ht.assign(TM(Ye,ne,Qn(0)))}),ra(v.equal(Qn(3)),()=>{ht.assign(C_(Ye,Ce,ke,nt))}),ht.assign(ht.mul(q.sub(ee)).add(ee)),ra(ye,()=>{ht.assign(Sp(ht,ee,q))}),ht}).setLayout({name:"mx_unifiednoise3d",type:"float",inputs:[{name:"noiseType",type:"int"},{name:"position",type:"vec3"},{name:"freq",type:"vec3"},{name:"offset",type:"vec3"},{name:"jitter",type:"float"},{name:"outmin",type:"float"},{name:"outmax",type:"float"},{name:"clampoutput",type:"bool"},{name:"octaves",type:"int"},{name:"lacunarity",type:"float"},{name:"diminish",type:"float"}]}),WQ=or(([s])=>{const e=s.y,t=s.z,n=Kn().toVar();return ra(e.lessThan(1e-4),()=>{n.assign(Kn(t,t,t))}).Else(()=>{let i=s.x;i=i.sub(ag(i)).mul(6).toVar();const a=Qn(G1(i)),o=i.sub(qt(a)),u=t.mul(e.oneMinus()),c=t.mul(e.mul(o).oneMinus()),d=t.mul(e.mul(o.oneMinus()).oneMinus());ra(a.equal(Qn(0)),()=>{n.assign(Kn(t,d,u))}).ElseIf(a.equal(Qn(1)),()=>{n.assign(Kn(c,t,u))}).ElseIf(a.equal(Qn(2)),()=>{n.assign(Kn(u,t,d))}).ElseIf(a.equal(Qn(3)),()=>{n.assign(Kn(u,c,t))}).ElseIf(a.equal(Qn(4)),()=>{n.assign(Kn(d,u,t))}).Else(()=>{n.assign(Kn(t,u,c))})}),n}).setLayout({name:"mx_hsvtorgb",type:"vec3",inputs:[{name:"hsv",type:"vec3"}]}),ZQ=or(([s])=>{const e=Kn(s).toVar(),t=qt(e.x).toVar(),n=qt(e.y).toVar(),i=qt(e.z).toVar(),a=qt(Uf(t,Uf(n,i))).toVar(),o=qt(mc(t,mc(n,i))).toVar(),u=qt(o.sub(a)).toVar(),c=qt().toVar(),d=qt().toVar(),g=qt().toVar();return g.assign(o),ra(o.greaterThan(0),()=>{d.assign(u.div(o))}).Else(()=>{d.assign(0)}),ra(d.lessThanEqual(0),()=>{c.assign(0)}).Else(()=>{ra(t.greaterThanEqual(o),()=>{c.assign(n.sub(i).div(u))}).ElseIf(n.greaterThanEqual(o),()=>{c.assign($c(2,i.sub(t).div(u)))}).Else(()=>{c.assign($c(4,t.sub(n).div(u)))}),c.mulAssign(1/6),ra(c.lessThan(0),()=>{c.addAssign(1)})}),Kn(c,d,g)}).setLayout({name:"mx_rgbtohsv",type:"vec3",inputs:[{name:"c",type:"vec3"}]}),KQ=or(([s])=>{const e=Kn(s).toVar(),t=w1(F1(e,Kn(.04045))).toVar(),n=Kn(e.div(12.92)).toVar(),i=Kn(KA(mc(e.add(Kn(.055)),Kn(0)).div(1.055),Kn(2.4))).toVar();return zo(n,i,t)}).setLayout({name:"mx_srgb_texture_to_lin_rec709",type:"vec3",inputs:[{name:"color",type:"vec3"}]}),lN=(s,e)=>{s=qt(s),e=qt(e);const t=Gi(e.dFdx(),e.dFdy()).length().mul(.7071067811865476);return fA(s.sub(t),s.add(t),e)},uN=(s,e,t,n)=>zo(s,e,t[n].clamp()),$Q=(s,e,t=Zl())=>uN(s,e,t,"x"),XQ=(s,e,t=Zl())=>uN(s,e,t,"y"),jQ=(s,e,t,n,i=Zl())=>{const a=i.x.clamp(),o=i.y.clamp(),u=zo(s,e,a),c=zo(t,n,a);return zo(u,c,o)},cN=(s,e,t,n,i)=>zo(s,e,lN(t,n[i])),YQ=(s,e,t,n=Zl())=>cN(s,e,t,n,"x"),qQ=(s,e,t,n=Zl())=>cN(s,e,t,n,"y"),JQ=(s=1,e=0,t=Zl())=>t.mul(s).add(e),e6=(s,e=1)=>(s=qt(s),s.abs().pow(e).mul(s.sign())),t6=(s,e=1,t=.5)=>qt(s).sub(t).mul(e).add(t),n6=(s=Zl(),e=1,t=0)=>CM(s.convert("vec2|vec3")).mul(e).add(t),r6=(s=Zl(),e=1,t=0)=>cx(s.convert("vec2|vec3")).mul(e).add(t),i6=(s=Zl(),e=1,t=0)=>(s=s.convert("vec2|vec3"),Ks(cx(s),CM(s.add(Gi(19,73)))).mul(e).add(t)),s6=(s,e=Zl(),t=Gi(1,1),n=Gi(0,0),i=1,a=0,o=1,u=!1,c=1,d=2,g=.5)=>HQ(s,e.convert("vec2|vec3"),t,n,i,a,o,u,c,d,g),a6=(s,e=Zl(),t=Gi(1,1),n=Gi(0,0),i=1,a=0,o=1,u=!1,c=1,d=2,g=.5)=>QQ(s,e.convert("vec2|vec3"),t,n,i,a,o,u,c,d,g),o6=(s=Zl(),e=1)=>zQ(s.convert("vec2|vec3"),e,Qn(1)),l6=(s=Zl(),e=1)=>GQ(s.convert("vec2|vec3"),e,Qn(1)),u6=(s=Zl(),e=1)=>TM(s.convert("vec2|vec3"),e,Qn(1)),c6=(s=Zl())=>LQ(s.convert("vec2|vec3")),h6=(s=Zl(),e=3,t=2,n=.5,i=1)=>E_(s,Qn(e),t,n).mul(i),d6=(s=Zl(),e=3,t=2,n=.5,i=1)=>UQ(s,Qn(e),t,n).mul(i),f6=(s=Zl(),e=3,t=2,n=.5,i=1)=>C_(s,Qn(e),t,n).mul(i),A6=(s=Zl(),e=3,t=2,n=.5,i=1)=>OQ(s,Qn(e),t,n).mul(i),p6=(s,e=qt(0))=>$c(s,e),g6=(s,e=qt(0))=>el(s,e),m6=(s,e=qt(1))=>no(s,e),v6=(s,e=qt(1))=>dA(s,e),y6=(s,e=qt(1))=>Oy(s,e),x6=(s,e=qt(1))=>KA(s,e),b6=(s=qt(0),e=qt(1))=>Rb(s,e),_6=()=>Iv,w6=()=>fI,S6=(s,e=qt(1))=>el(e,s),M6=(s,e,t,n)=>s.greaterThan(e).mix(t,n),E6=(s,e,t,n)=>s.greaterThanEqual(e).mix(t,n),C6=(s,e,t,n)=>s.equal(e).mix(t,n),T6=(s,e=null)=>{if(typeof e=="string"){const t={x:0,r:0,y:1,g:1,z:2,b:2,w:3,a:3},n=e.replace(/^out/,"").toLowerCase();if(t[n]!==void 0)return s.element(t[n])}if(typeof e=="number")return s.element(e);if(typeof e=="string"&&e.length===1){const t={x:0,r:0,y:1,g:1,z:2,b:2,w:3,a:3};if(t[e]!==void 0)return s.element(t[e])}return s},B6=(s,e=Gi(.5,.5),t=Gi(1,1),n=qt(0),i=Gi(0,0))=>{let a=s;if(e&&(a=a.sub(e)),t&&(a=a.mul(t)),n){const o=n.mul(Math.PI/180),u=o.cos(),c=o.sin();a=Gi(a.x.mul(u).sub(a.y.mul(c)),a.x.mul(c).add(a.y.mul(u)))}return e&&(a=a.add(e)),i&&(a=a.add(i)),a},R6=(s,e)=>{s=Gi(s),e=qt(e);const t=e.mul(Math.PI/180);return Xy(s,t)},I6=(s,e,t)=>{s=Kn(s),e=qt(e),t=Kn(t);const n=e.mul(Math.PI/180),i=t.normalize(),a=n.cos(),o=n.sin(),u=qt(1).sub(a);return s.mul(a).add(i.cross(s).mul(o)).add(i.mul(i.dot(s)).mul(u))},N6=(s,e)=>(s=Kn(s),e=qt(e),bS(s,e)),F6=or(([s,e,t])=>{const n=rf(s).toVar(),i=el(qt(.5).mul(e.sub(t)),pA).div(n).toVar(),a=el(qt(-.5).mul(e.sub(t)),pA).div(n).toVar(),o=Kn().toVar();o.x=n.x.greaterThan(qt(0)).select(i.x,a.x),o.y=n.y.greaterThan(qt(0)).select(i.y,a.y),o.z=n.z.greaterThan(qt(0)).select(i.z,a.z);const u=Uf(o.x,o.y,o.z).toVar();return pA.add(n.mul(u)).toVar().sub(t)}),hN=or(([s,e])=>{const t=s.x,n=s.y,i=s.z;let a=e.element(0).mul(.886227);return a=a.add(e.element(1).mul(2*.511664).mul(n)),a=a.add(e.element(2).mul(2*.511664).mul(i)),a=a.add(e.element(3).mul(2*.511664).mul(t)),a=a.add(e.element(4).mul(2*.429043).mul(t).mul(n)),a=a.add(e.element(5).mul(2*.429043).mul(n).mul(i)),a=a.add(e.element(6).mul(i.mul(i).mul(.743125).sub(.247708))),a=a.add(e.element(7).mul(2*.429043).mul(t).mul(i)),a=a.add(e.element(8).mul(.429043).mul(no(t,t).sub(no(n,n)))),a});var wj=Object.freeze({__proto__:null,BRDF_GGX:DS,BRDF_Lambert:x0,BasicPointShadowFilter:JI,BasicShadowFilter:GI,Break:j2,Const:pB,Continue:rV,DFGLUT:Wy,D_GGX:vR,Discard:FB,EPSILON:P1,F_Schlick:Tv,Fn:or,HALF_PI:Ik,INFINITY:Tk,If:ra,Loop:kl,NodeAccess:od,NodeShaderStage:Cy,NodeType:Y3,NodeUpdateType:Ao,OnBeforeMaterialUpdate:CG,OnBeforeObjectUpdate:EG,OnMaterialUpdate:MG,OnObjectUpdate:SG,PCFShadowFilter:HI,PCFSoftShadowFilter:QI,PI:Cb,PI2:Bk,PointShadowFilter:eN,Return:Kk,Schlick_to_F0:kS,ScriptableNodeResources:v_,ShaderNode:Av,Stack:mb,Switch:yk,TBNViewMatrix:y0,TWO_PI:Rk,VSMShadowFilter:WI,V_GGX_SmithCorrelated:mR,Var:AB,VarIntent:gB,abs:Su,acesFilmicToneMapping:CI,acos:O1,add:$c,addMethodChaining:ci,addNodeElement:Yk,agxToneMapping:TI,all:kT,alphaT:wb,and:ST,anisotropy:Fm,anisotropyB:f0,anisotropyT:Fy,any:VT,append:wk,array:mT,arrayBuffer:bk,asin:QT,assign:vT,atan:Rb,atan2:lB,atomicAdd:LH,atomicAnd:kH,atomicFunc:pg,atomicLoad:FH,atomicMax:OH,atomicMin:DH,atomicOr:VH,atomicStore:PH,atomicSub:UH,atomicXor:zH,attenuationColor:B1,attenuationDistance:T1,attribute:af,attributeArray:RG,backgroundBlurriness:gI,backgroundIntensity:hM,backgroundRotation:mI,batch:Z2,bentNormalView:d2,billboarding:oG,bitAnd:TT,bitNot:BT,bitOr:RT,bitXor:IT,bitangentGeometry:U4,bitangentLocal:O4,bitangentView:c2,bitangentWorld:D4,bitcast:hI,blendBurn:iR,blendColor:xV,blendDodge:sR,blendOverlay:oR,blendScreen:aR,blur:VR,bool:WA,buffer:Dy,bufferAttribute:J1,builtin:jg,builtinAOContext:dB,builtinShadowContext:hB,bumpMap:bS,burn:_V,bvec2:uT,bvec3:w1,bvec4:cT,bypass:BB,cache:TB,call:yT,cameraFar:Jg,cameraIndex:Um,cameraNear:qg,cameraNormalMatrix:d4,cameraPosition:zy,cameraProjectionMatrix:of,cameraProjectionMatrixInverse:c4,cameraViewMatrix:AA,cameraViewport:f4,cameraWorldMatrix:h4,cbrt:rB,cdl:$G,ceil:Bb,checker:IQ,cineonToneMapping:EI,clamp:Sp,clearcoat:yb,clearcoatNormalView:v0,clearcoatRoughness:Ny,code:g_,color:lT,colorSpaceToWorking:Pb,colorToDirection:V4,compute:CB,computeKernel:tS,computeSkinning:tV,context:Kg,convert:dT,convertColorSpace:Dk,convertToTexture:yG,cos:wp,countLeadingZeros:O5,countOneBits:D5,countTrailingZeros:U5,cross:Zg,cubeTexture:lf,cubeTextureBase:pS,dFdx:V1,dFdy:z1,dashSize:p0,debug:PB,decrement:OT,decrementBefore:LT,defaultBuildStages:d1,defaultShaderStages:qC,defined:By,degrees:GT,deltaTime:J5,densityFog:gH,densityFogFactor:AM,depth:PS,depthPass:JG,determinant:XT,difference:eB,diffuseColor:Wl,diffuseContribution:d0,directPointLight:nN,directionToColor:f2,directionToFaceDirection:bv,dispersion:R1,disposeShadowMaterial:KI,distance:JT,div:dA,dodge:wV,dot:ZA,drawIndex:H2,dynamicBufferAttribute:Hk,element:hT,emissive:E1,equal:N1,equals:YT,equirectUV:LS,exp:L1,exp2:mv,expression:$g,faceDirection:hS,faceForward:$1,faceforward:Nk,float:qt,floatBitsToInt:F5,floatBitsToUint:dI,floor:ag,fog:ix,fract:_p,frameGroup:pT,frameId:fI,frontFacing:QB,fwidth:H1,gain:V5,gapSize:Py,getConstNodeType:oT,getCurrentStack:x1,getDirection:DR,getDistanceAttenuation:EM,getGeometryRoughness:gR,getNormalFromDepth:bG,getParallaxCorrectNormal:F6,getRoughness:OS,getScreenPosition:xG,getShIrradianceAt:hN,getShadowMaterial:ZI,getShadowRenderObjectFunction:XI,getTextureIndex:uI,getViewPosition:Pv,ggxConvolution:zR,globalId:_H,glsl:lH,glslFn:uH,grayscale:QG,greaterThan:F1,greaterThanEqual:wT,hash:k5,highpModelNormalViewMatrix:uS,highpModelViewMatrix:lS,hue:KG,increment:UT,incrementBefore:PT,inspector:UB,instance:q4,instanceIndex:hg,instancedArray:IG,instancedBufferAttribute:Ub,instancedDynamicBufferAttribute:eS,instancedMesh:W2,int:Qn,intBitsToFloat:P5,interleavedGradientNoise:uM,inverse:jT,inverseSqrt:U1,inversesqrt:Fk,invocationLocalIndex:Y4,invocationSubgroupIndex:j4,ior:Ly,iridescence:xb,iridescenceIOR:bb,iridescenceThickness:_b,isolate:yv,ivec2:ch,ivec3:_1,ivec4:S1,js:aH,label:fB,length:og,lengthSq:Z1,lessThan:bT,lessThanEqual:_T,lightPosition:gM,lightProjectionUV:PI,lightShadowMatrix:b_,lightTargetDirection:vM,lightTargetPosition:LI,lightViewPosition:mM,lightingContext:J2,lights:pQ,linearDepth:Cv,linearToneMapping:SI,localId:wH,log:Tb,log2:sg,logarithmicDepthToViewZ:dV,luminance:dM,mat2:vb,mat3:ld,mat4:Im,matcapUV:YR,materialAO:V2,materialAlphaTest:p2,materialAnisotropy:B2,materialAnisotropyVector:wv,materialAttenuationColor:O2,materialAttenuationDistance:U2,materialClearcoat:w2,materialClearcoatNormal:M2,materialClearcoatRoughness:S2,materialColor:Wb,materialDispersion:k2,materialEmissive:m2,materialEnvIntensity:Vb,materialEnvRotation:AS,materialIOR:L2,materialIridescence:R2,materialIridescenceIOR:I2,materialIridescenceThickness:N2,materialLightMap:CS,materialLineDashOffset:ES,materialLineDashSize:SS,materialLineGapSize:MS,materialLineScale:wS,materialLineWidth:$b,materialMetalness:b2,materialNormal:_2,materialOpacity:Zb,materialPointSize:D2,materialReference:em,materialReflectivity:Kb,materialRefractionRatio:XB,materialRotation:E2,materialRoughness:x2,materialSheen:C2,materialSheenRoughness:T2,materialShininess:g2,materialSpecular:v2,materialSpecularColor:y2,materialSpecularIntensity:_S,materialSpecularStrength:Hy,materialThickness:P2,materialTransmission:F2,max:mc,maxMipLevel:rS,mediumpModelViewMatrix:HB,metalness:Wg,min:Uf,mix:zo,mixElement:sB,mod:Oy,modInt:DT,modelDirection:y4,modelNormalMatrix:GB,modelPosition:x4,modelRadius:zB,modelScale:b4,modelViewMatrix:cg,modelViewPosition:_4,modelViewProjection:z2,modelWorldMatrix:XA,modelWorldMatrixInverse:w4,morphReference:q2,mrt:cI,mul:no,mx_aastep:lN,mx_add:p6,mx_atan2:b6,mx_cell_noise_float:c6,mx_contrast:t6,mx_divide:v6,mx_fractal_noise_float:h6,mx_fractal_noise_vec2:d6,mx_fractal_noise_vec3:f6,mx_fractal_noise_vec4:A6,mx_frame:w6,mx_heighttonormal:N6,mx_hsvtorgb:WQ,mx_ifequal:C6,mx_ifgreater:M6,mx_ifgreatereq:E6,mx_invert:S6,mx_modulo:y6,mx_multiply:m6,mx_noise_float:n6,mx_noise_vec3:r6,mx_noise_vec4:i6,mx_place2d:B6,mx_power:x6,mx_ramp4:jQ,mx_ramplr:$Q,mx_ramptb:XQ,mx_rgbtohsv:ZQ,mx_rotate2d:R6,mx_rotate3d:I6,mx_safepower:e6,mx_separate:T6,mx_splitlr:YQ,mx_splittb:qQ,mx_srgb_texture_to_lin_rec709:KQ,mx_subtract:g6,mx_timer:_6,mx_transform_uv:JQ,mx_unifiednoise2d:s6,mx_unifiednoise3d:a6,mx_worley_noise_float:o6,mx_worley_noise_vec2:l6,mx_worley_noise_vec3:u6,negate:k1,neutralToneMapping:BI,nodeArray:c0,nodeImmutable:xs,nodeObject:Ss,nodeObjectIntent:Ry,nodeObjects:gb,nodeProxy:to,nodeProxyIntent:ji,normalFlat:WB,normalGeometry:kb,normalLocal:Of,normalMap:xS,normalView:cl,normalViewGeometry:_v,normalWorld:Om,normalWorldGeometry:ZB,normalize:rf,not:ET,notEqual:xT,numWorkgroups:xH,objectDirection:A4,objectGroup:I1,objectPosition:VB,objectRadius:v4,objectScale:g4,objectViewPosition:m4,objectWorldMatrix:p4,oneMinus:WT,or:MT,orthographicDepthToViewZ:hV,oscSawtooth:rG,oscSine:eG,oscSquare:tG,oscTriangle:nG,output:gv,outputStruct:I5,overlay:MV,overloadingFn:hd,packHalf2x16:W5,packSnorm2x16:H5,packUnorm2x16:Q5,parabola:rM,parallaxDirection:h2,parallaxUV:k4,parameter:M5,pass:YG,passTexture:qG,pcurve:z5,perspectiveDepthToViewZ:NS,pmremTexture:eM,pointShadow:tN,pointUV:FG,pointWidth:Sk,positionGeometry:cd,positionLocal:vc,positionPrevious:Db,positionView:Oc,positionViewDirection:iu,positionWorld:pA,positionWorldDirection:cS,posterize:jG,pow:KA,pow2:Q1,pow3:tB,pow4:W1,premultiplyAlpha:lR,property:bp,quadBroadcast:dQ,quadSwapDiagonal:aQ,quadSwapX:iQ,quadSwapY:sQ,radians:zT,rand:iB,range:vH,rangeFog:pH,rangeFogFactor:fM,reciprocal:KT,reference:su,referenceBuffer:gS,reflect:qT,reflectVector:qB,reflectView:jB,reflector:AG,refract:K1,refractVector:JB,refractView:YB,reinhardToneMapping:MI,remap:IB,remapClamp:NB,renderGroup:xa,renderOutput:nS,rendererReference:_B,replaceDefaultUV:iG,rotate:Xy,rotateUV:sG,roughness:ig,round:ZT,rtt:pI,sRGBTransferEOTF:vB,sRGBTransferOETF:yB,sample:wG,sampler:r4,samplerComparison:i4,saturate:Nb,saturation:WG,screen:SV,screenCoordinate:m0,screenDPR:aS,screenSize:g0,screenUV:Yg,scriptable:AH,scriptableValue:m_,select:ud,setCurrentStack:Iy,setName:X1,shaderStages:f1,shadow:YI,shadowPositionWorld:bM,shapeCircle:NQ,sharedUniformGroup:Eb,sheen:hA,sheenRoughness:Nm,shiftLeft:NT,shiftRight:FT,shininess:Sb,sign:D1,sin:sf,sinc:G5,skinning:X2,smoothstep:fA,smoothstepElement:aB,specularColor:Pm,specularColorBlended:A0,specularF90:pv,spherizeUV:aG,split:_k,spritesheetUV:cG,sqrt:Nd,stack:a_,step:Ib,stepElement:oB,storage:tm,storageBarrier:CH,storageObject:$4,storageTexture:vI,string:xk,struct:R5,sub:el,subBuild:vv,subgroupAdd:QH,subgroupAll:tQ,subgroupAnd:jH,subgroupAny:nQ,subgroupBallot:HH,subgroupBroadcast:oQ,subgroupBroadcastFirst:rQ,subgroupElect:GH,subgroupExclusiveAdd:ZH,subgroupExclusiveMul:XH,subgroupInclusiveAdd:WH,subgroupInclusiveMul:$H,subgroupIndex:X4,subgroupMax:eQ,subgroupMin:JH,subgroupMul:KH,subgroupOr:YH,subgroupShuffle:lQ,subgroupShuffleDown:hQ,subgroupShuffleUp:cQ,subgroupShuffleXor:uQ,subgroupSize:SH,subgroupXor:qH,tan:HT,tangentGeometry:Gb,tangentLocal:Gy,tangentView:Hb,tangentWorld:u2,texture:xl,texture3D:A_,texture3DLevel:kG,texture3DLoad:DG,textureBarrier:TH,textureBicubic:nz,textureBicubicLevel:GS,textureCubeUV:kR,textureLevel:n4,textureLoad:Rc,textureSize:Xg,textureStore:LG,thickness:C1,time:Iv,toneMapping:wB,toneMappingExposure:SB,toonOutlinePass:tH,transformDirection:nB,transformNormal:KB,transformNormalToView:dS,transformedClearcoatNormalView:C4,transformedNormalView:M4,transformedNormalWorld:E4,transmission:Mb,transpose:$T,triNoise3D:j5,triplanarTexture:hG,triplanarTextures:AI,trunc:G1,uint:Fi,uintBitsToFloat:L5,uniform:va,uniformArray:Fd,uniformCubeTexture:B4,uniformFlow:cB,uniformGroup:AT,uniformTexture:t4,unpackHalf2x16:$5,unpackNormal:yS,unpackSnorm2x16:Z5,unpackUnorm2x16:K5,unpremultiplyAlpha:bV,userData:zG,uv:Zl,uvec2:b1,uvec3:h0,uvec4:M1,varying:lg,varyingProperty:cA,vec2:Gi,vec3:Kn,vec4:Ks,vectorComponents:l0,velocity:HG,vertexColor:rR,vertexIndex:G2,vertexStage:mB,vibrance:ZG,viewZToLogarithmicDepth:FS,viewZToOrthographicDepth:Ev,viewZToPerspectiveDepth:IS,viewport:xv,viewportCoordinate:DB,viewportDepthTexture:RS,viewportLinearDepth:fV,viewportMipTexture:BS,viewportResolution:u4,viewportSafeUV:lG,viewportSharedTexture:uR,viewportSize:oS,viewportTexture:uV,viewportUV:l4,vogelDiskSample:Ep,wgsl:oH,wgslFn:cH,workgroupArray:IH,workgroupBarrier:EH,workgroupId:bH,workingToColorSpace:xB,xor:CT});const Cp=new nM;class P6 extends Vm{constructor(e,t){super(),this.renderer=e,this.nodes=t}update(e,t,n){const i=this.renderer,a=this.nodes.getBackgroundNode(e)||e.background;let o=!1;if(a===null)i._clearColor.getRGB(Cp),Cp.a=i._clearColor.a;else if(a.isColor===!0)a.getRGB(Cp),Cp.a=1,o=!0;else if(a.isNode===!0){const c=this.get(e),d=a;Cp.copy(i._clearColor);let g=c.backgroundMesh;if(g===void 0){let ye=function(){a.removeEventListener("dispose",ye),g.material.dispose(),g.geometry.dispose()};const M=Ks(d).mul(hM).context({getUV:()=>mI.mul(ZB),getTextureLevel:()=>gI}),B=of.element(3).element(3).equal(1),I=dA(1,of.element(1).element(1)).mul(3),ne=B.select(vc.mul(I),vc);let ee=of.mul(cg.mul(Ks(ne,0)));ee=ee.setZ(ee.w);const q=new yc;q.name="Background.material",q.side=de,q.depthTest=!1,q.depthWrite=!1,q.allowOverride=!1,q.fog=!1,q.lights=!1,q.vertexNode=ee,q.colorNode=M,c.backgroundMeshNode=M,c.backgroundMesh=g=new Il(new sd(1,32,32),q),g.frustumCulled=!1,g.name="Background.mesh",a.addEventListener("dispose",ye)}const v=d.getCacheKey();c.backgroundCacheKey!==v&&(c.backgroundMeshNode.node=Ks(d).mul(hM),c.backgroundMeshNode.needsUpdate=!0,g.material.needsUpdate=!0,c.backgroundCacheKey=v),t.unshift(g,g.geometry,g.material,0,0,null,null)}else Gr("Renderer: Unsupported background configuration.",a);const u=i.xr.getEnvironmentBlendMode();if(u==="additive"?Cp.set(0,0,0,1):u==="alpha-blend"&&Cp.set(0,0,0,0),i.autoClear===!0||o===!0){const c=n.clearColorValue;c.r=Cp.r,c.g=Cp.g,c.b=Cp.b,c.a=Cp.a,(i.backend.isWebGLBackend===!0||i.alpha===!0)&&(c.r*=c.a,c.g*=c.a,c.b*=c.a),n.depthClearValue=i._clearDepth,n.stencilClearValue=i._clearStencil,n.clearColor=i.autoClearColor===!0,n.clearDepth=i.autoClearDepth===!0,n.clearStencil=i.autoClearStencil===!0}else n.clearColor=!1,n.clearDepth=!1,n.clearStencil=!1}}let L6=0;class BM{constructor(e="",t=[],n=0,i=[]){this.name=e,this.bindings=t,this.index=n,this.bindingsReference=i,this.id=L6++}}class U6{constructor(e,t,n,i,a,o,u,c,d,g=[]){this.vertexShader=e,this.fragmentShader=t,this.computeShader=n,this.transforms=g,this.nodeAttributes=i,this.bindings=a,this.updateNodes=o,this.updateBeforeNodes=u,this.updateAfterNodes=c,this.observer=d,this.usedTimes=0}createBindings(){const e=[];for(const t of this.bindings)if(t.bindings[0].groupNode.shared!==!0){const i=new BM(t.name,[],t.index,t.bindingsReference);e.push(i);for(const a of t.bindings)i.bindings.push(a.clone())}else e.push(t);return e}}class dN{constructor(e,t,n=null){this.isNodeAttribute=!0,this.name=e,this.type=t,this.node=n}}class O6{constructor(e,t,n){this.isNodeUniform=!0,this.name=e,this.type=t,this.node=n}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 fN{constructor(e,t,n=!1,i=null){this.isNodeVar=!0,this.name=e,this.type=t,this.readOnly=n,this.count=i}}class D6 extends fN{constructor(e,t,n=null,i=null){super(e,t),this.needsInterpolation=!1,this.isNodeVarying=!0,this.interpolationType=n,this.interpolationSampling=i}}class k6{constructor(e,t,n=""){this.name=e,this.type=t,this.code=n,Object.defineProperty(this,"isNodeCode",{value:!0})}}let V6=0;class RM{constructor(e=null){this.id=V6++,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 z6{constructor(e,t){this.name=e,this.members=t,this.output=!1}}class Gm{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 G6 extends Gm{constructor(e,t=0){super(e,t),this.isNumberUniform=!0,this.boundary=4,this.itemSize=1}}class H6 extends Gm{constructor(e,t=new ce){super(e,t),this.isVector2Uniform=!0,this.boundary=8,this.itemSize=2}}class Q6 extends Gm{constructor(e,t=new le){super(e,t),this.isVector3Uniform=!0,this.boundary=16,this.itemSize=3}}class W6 extends Gm{constructor(e,t=new Ni){super(e,t),this.isVector4Uniform=!0,this.boundary=16,this.itemSize=4}}class Z6 extends Gm{constructor(e,t=new Wr){super(e,t),this.isColorUniform=!0,this.boundary=16,this.itemSize=3}}class K6 extends Gm{constructor(e,t=new gp){super(e,t),this.isMatrix2Uniform=!0,this.boundary=8,this.itemSize=4}}class $6 extends Gm{constructor(e,t=new pn){super(e,t),this.isMatrix3Uniform=!0,this.boundary=48,this.itemSize=12}}class X6 extends Gm{constructor(e,t=new di){super(e,t),this.isMatrix4Uniform=!0,this.boundary=64,this.itemSize=16}}class j6 extends G6{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}}class Y6 extends H6{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}}class q6 extends Q6{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}}class J6 extends W6{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}}class e8 extends Z6{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}}class t8 extends K6{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}}class n8 extends $6{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}}class r8 extends X6{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}}let i8=0;const s8=new WeakMap,AN=new WeakMap,a8=new Map([[Int8Array,"int"],[Int16Array,"int"],[Int32Array,"int"],[Uint8Array,"uint"],[Uint16Array,"uint"],[Uint32Array,"uint"],[Float32Array,"float"]]),T_=s=>/e/g.test(s)?String(s).replace(/\+/g,""):(s=Number(s),s+(s%1?"":".0"));class pN{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.observer=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.types={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.declarations={},this.flow={code:""},this.chaining=[],this.stack=a_(),this.stacks=[],this.tab=" ",this.currentFunctionNode=null,this.context={material:this.material},this.cache=new RM,this.globalCache=this.cache,this.flowsData=new WeakMap,this.shaderStage=null,this.buildStage=null,this.subBuildLayers=[],this.activeStacks=[],this.subBuildFn=null,this.fnCall=null,Object.defineProperty(this,"id",{value:i8++})}isOpaque(){const e=this.material;return e.transparent===!1&&e.blending===ve&&e.alphaToCoverage===!1}getBindGroupsCache(){let e=AN.get(this.renderer);return e===void 0&&(e=new Mp,AN.set(this.renderer,e)),e}createRenderTarget(e,t,n){return new Ns(e,t,n)}createCubeRenderTarget(e,t){return new cR(e,t)}includes(e){return this.nodes.includes(e)}getOutputStructName(){}_getBindGroup(e,t){const n=this.getBindGroupsCache(),i=[];let a=!0;for(const u of t)i.push(u),a=a&&u.groupNode.shared!==!0;let o;return a?(o=n.get(i),o===void 0&&(o=new BM(e,i,this.bindingsIndexes[e].group,i),n.set(i,o))):o=new BM(e,i,this.bindingsIndexes[e].group,i),o}getBindGroupArray(e,t){const n=this.bindings[t];let i=n[e];return i===void 0&&(this.bindingsIndexes[e]===void 0&&(this.bindingsIndexes[e]={binding:0,group:Object.keys(this.bindingsIndexes).length}),n[e]=i=[]),i}getBindings(){let e=this.bindGroups;if(e===null){const t={},n=this.bindings;for(const i of f1)for(const a in n[i]){const o=n[i][a];(t[a]||(t[a]=[])).push(...o)}e=[];for(const i in t){const a=t[i],o=this._getBindGroup(i,a);e.push(o)}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<e.length;t++){const n=e[t];this.bindingsIndexes[n.name].group=t,n.index=t}}setHashNode(e,t){this.hashNodes[t]=e}addNode(e){this.nodes.includes(e)===!1&&(this.nodes.push(e),this.setHashNode(e,e.getHash(this)))}addSequentialNode(e){this.sequentialNodes.includes(e)===!1&&this.sequentialNodes.push(e)}buildUpdateNodes(){for(const e of this.nodes)e.getUpdateType()!==Ao.NONE&&this.updateNodes.push(e);for(const e of this.sequentialNodes){const t=e.getUpdateBeforeType(),n=e.getUpdateAfterType();t!==Ao.NONE&&this.updateBeforeNodes.push(e),n!==Ao.NONE&&this.updateAfterNodes.push(e)}}get currentNode(){return this.chaining[this.chaining.length-1]}isFilteredTexture(e){return e.magFilter===vr||e.magFilter===Ki||e.magFilter===Sr||e.magFilter===yi||e.minFilter===vr||e.minFilter===Ki||e.minFilter===Sr||e.minFilter===yi}addChain(e){this.chaining.push(e)}removeChain(e){if(this.chaining.pop()!==e)throw new Error("NodeBuilder: Invalid node chaining!")}getMethod(e){return e}getTernary(){return null}getNodeFromHash(e){return this.hashNodes[e]}addFlow(e,t){return this.flowNodes[e].push(t),t}setContext(e){this.context=e}getContext(){return this.context}addContext(e){const t=this.getContext();return this.setContext(rl(rl({},this.context),e)),t}getSharedContext(){const e=rl({},this.context);return delete e.material,delete e.getUV,delete e.getOutput,delete e.getTextureLevel,delete e.getAO,delete e.getShadow,e}setCache(e){this.cache=e}getCache(){return this.cache}getCacheFromNode(e,t=!0){const n=this.getDataFromNode(e);return n.cache===void 0&&(n.cache=new RM(t?this.getCache():null)),n.cache}isAvailable(){return!1}getVertexIndex(){Lr("Abstract function.")}getInstanceIndex(){Lr("Abstract function.")}getDrawIndex(){Lr("Abstract function.")}getFrontFacing(){Lr("Abstract function.")}getFragCoord(){Lr("Abstract function.")}isFlipY(){return!1}increaseUsage(e){const t=this.getDataFromNode(e);return t.usageCount=t.usageCount===void 0?1:t.usageCount+1,t.usageCount}generateTexture(){Lr("Abstract function.")}generateTextureLod(){Lr("Abstract function.")}generateArrayDeclaration(e,t){return this.getType(e)+"[ "+t+" ]"}generateArray(e,t,n=null){let i=this.generateArrayDeclaration(e,t)+"( ";for(let a=0;a<t;a++){const o=n?n[a]:null;o!==null?i+=o.build(this,e):i+=this.generateConst(e),a<t-1&&(i+=", ")}return i+=" )",i}generateStruct(e,t,n=null){const i=[];for(const a of t){const{name:o,type:u}=a;n&&n[o]&&n[o].isNode?i.push(n[o].build(this,u)):i.push(this.generateConst(u))}return e+"( "+i.join(", ")+" )"}generateConst(e,t=null){if(t===null&&(e==="float"||e==="int"||e==="uint"?t=0:e==="bool"?t=!1:e==="color"?t=new Wr:e==="vec2"||e==="uvec2"||e==="ivec2"?t=new ce:e==="vec3"||e==="uvec3"||e==="ivec3"?t=new le:(e==="vec4"||e==="uvec4"||e==="ivec4")&&(t=new Ni)),e==="float")return T_(t);if(e==="int")return`${Math.round(t)}`;if(e==="uint")return t>=0?`${Math.round(t)}u`:"0u";if(e==="bool")return t?"true":"false";if(e==="color")return`${this.getType("vec3")}( ${T_(t.r)}, ${T_(t.g)}, ${T_(t.b)} )`;const n=this.getTypeLength(e),i=this.getComponentType(e),a=o=>this.generateConst(i,o);if(n===2)return`${this.getType(e)}( ${a(t.x)}, ${a(t.y)} )`;if(n===3)return`${this.getType(e)}( ${a(t.x)}, ${a(t.y)}, ${a(t.z)} )`;if(n===4&&e!=="mat2")return`${this.getType(e)}( ${a(t.x)}, ${a(t.y)}, ${a(t.z)}, ${a(t.w)} )`;if(n>=4&&t&&(t.isMatrix2||t.isMatrix3||t.isMatrix4))return`${this.getType(e)}( ${t.elements.map(a).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 a of n)if(a.name===e)return a;const i=new dN(e,t);return this.registerDeclaration(i),n.push(i),i}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==="samplerComparison"||e==="texture"||e==="cubeTexture"||e==="storageTexture"||e==="depthTexture"||e==="texture3D"}needsToWorkingColorSpace(){return!1}getComponentTypeFromTexture(e){const t=e.type;if(e.isDataTexture){if(t===Xt)return"int";if(t===st)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;let n=o1(e);const i=t==="float"?"":t[0];return/mat2/.test(t)===!0&&(n=n.replace("vec","mat")),i+n}getTypeFromArray(e){return a8.get(e.constructor)}isInteger(e){return/int|uint|(i|u)vec/.test(e)}getTypeFromAttribute(e){let t=e;e.isInterleavedBufferAttribute&&(t=e.data);const n=t.array,i=e.itemSize,a=e.normalized;let o;return!(e instanceof Yu)&&a!==!0&&(o=this.getTypeFromArray(n)),this.getTypeFromLength(i,o)}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")}setActiveStack(e){this.activeStacks.push(e)}removeActiveStack(e){if(this.activeStacks[this.activeStacks.length-1]===e)this.activeStacks.pop();else throw new Error("NodeBuilder: Invalid active stack removal.")}getActiveStack(){return this.activeStacks[this.activeStacks.length-1]}getBaseStack(){return this.activeStacks[0]}addStack(){this.stack=a_(this.stack);const e=x1();return this.stacks.push(e),Iy(this.stack),this.stack}removeStack(){const e=this.stack;for(const t of e.nodes){const n=this.getDataFromNode(t);n.stack=e}return this.stack=e.parent,Iy(this.stacks.pop()),e}getDataFromNode(e,t=this.shaderStage,n=null){n=n===null?e.isGlobal(this)?this.globalCache:this.cache:n;let i=n.getData(e);i===void 0&&(i={},n.setData(e,i)),i[t]===void 0&&(i[t]={});let a=i[t];const o=i.any?i.any.subBuilds:null,u=this.getClosestSubBuild(o);return u&&(a.subBuildsCache===void 0&&(a.subBuildsCache={}),a=a.subBuildsCache[u]||(a.subBuildsCache[u]={}),a.subBuilds=o),a}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,"vertex");let i=n.bufferAttribute;if(i===void 0){const a=this.uniforms.index++;i=new dN("nodeAttribute"+a,t,e),this.bufferAttributes.push(i),n.bufferAttribute=i}return i}getStructTypeNode(e,t=this.shaderStage){return this.types[t][e]||null}getStructTypeFromNode(e,t,n=null,i=this.shaderStage){const a=this.getDataFromNode(e,i,this.globalCache);let o=a.structType;if(o===void 0){const u=this.structs.index++;n===null&&(n="StructType"+u),o=new z6(n,t),this.structs[i].push(o),this.types[i][n]=e,a.structType=o}return o}getOutputStructTypeFromNode(e,t){const n=this.getStructTypeFromNode(e,t,"OutputType","fragment");return n.output=!0,n}getUniformFromNode(e,t,n=this.shaderStage,i=null){const a=this.getDataFromNode(e,n,this.globalCache);let o=a.uniform;if(o===void 0){const u=this.uniforms.index++;o=new O6(i||"nodeUniform"+u,t,e),this.uniforms[n].push(o),this.registerDeclaration(o),a.uniform=o}return o}getVarFromNode(e,t=null,n=e.getNodeType(this),i=this.shaderStage,a=!1){const o=this.getDataFromNode(e,i),u=this.getSubBuildProperty("variable",o.subBuilds);let c=o[u];if(c===void 0){const d=a?"_const":"_var",g=this.vars[i]||(this.vars[i]=[]),v=this.vars[d]||(this.vars[d]=0);t===null&&(t=(a?"nodeConst":"nodeVar")+v,this.vars[d]++),u!=="variable"&&(t=this.getSubBuildProperty(t,o.subBuilds));const M=e.getArrayCount(this);c=new fN(t,n,a,M),a||g.push(c),this.registerDeclaration(c),o[u]=c}return c}isDeterministic(e){if(e.isMathNode)return this.isDeterministic(e.aNode)&&(e.bNode?this.isDeterministic(e.bNode):!0)&&(e.cNode?this.isDeterministic(e.cNode):!0);if(e.isOperatorNode)return this.isDeterministic(e.aNode)&&(e.bNode?this.isDeterministic(e.bNode):!0);if(e.isArrayNode){if(e.values!==null){for(const t of e.values)if(!this.isDeterministic(t))return!1}return!0}else if(e.isConstNode)return!0;return!1}getVaryingFromNode(e,t=null,n=e.getNodeType(this),i=null,a=null){const o=this.getDataFromNode(e,"any"),u=this.getSubBuildProperty("varying",o.subBuilds);let c=o[u];if(c===void 0){const d=this.varyings,g=d.length;t===null&&(t="nodeVarying"+g),u!=="varying"&&(t=this.getSubBuildProperty(t,o.subBuilds)),c=new D6(t,n,i,a),d.push(c),this.registerDeclaration(c),o[u]=c}return c}registerDeclaration(e){const t=this.shaderStage,n=this.declarations[t]||(this.declarations[t]={}),i=this.getPropertyName(e);let a=1,o=i;for(;n[o]!==void 0;)o=i+"_"+a++;a>1&&(e.name=o,Lr(`TSL: Declaration name '${i}' of '${e.type}' already in use. Renamed to '${o}'.`)),n[o]=e}getCodeFromNode(e,t,n=this.shaderStage){const i=this.getDataFromNode(e);let a=i.code;if(a===void 0){const o=this.codes[n]||(this.codes[n]=[]),u=o.length;a=new k6("nodeCode"+u,t),o.push(a),i.code=a}return a}addFlowCodeHierarchy(e,t){const{flowCodes:n,flowCodeBlock:i}=this.getDataFromNode(e);let a=!0,o=t;for(;o;){if(i.get(o)===!0){a=!1;break}o=this.getDataFromNode(o).parentNodeBlock}if(a)for(const u of n)this.addLineFlowCode(u)}addLineFlowCodeBlock(e,t,n){const i=this.getDataFromNode(e),a=i.flowCodes||(i.flowCodes=[]),o=i.flowCodeBlock||(i.flowCodeBlock=new WeakMap);a.push(t),o.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}addInclude(e){this.currentFunctionNode!==null&&this.currentFunctionNode.includes.push(e)}buildFunctionNode(e){const t=new RI,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 o=0;const u=Object.values(this);return{next:()=>({value:u[o],done:o++>=u.length})}}};for(const o of t.inputs)n[o.name]=new oI(o.type,o.name);e.layout=null;const i=e.call(n),a=this.flowStagesNode(i,t.type);return e.layout=t,a}flowBuildStage(e,t,n=null){const i=this.getBuildStage();this.setBuildStage(t);const a=e.build(this,n);return this.setBuildStage(i),a}flowStagesNode(e,t=null){const n=this.flow,i=this.vars,a=this.declarations,o=this.cache,u=this.buildStage,c=this.stack,d={code:""};this.flow=d,this.vars={},this.declarations={},this.cache=new RM,this.stack=a_();for(const g of d1)this.setBuildStage(g),d.result=e.build(this,t);return d.vars=this.getVars(this.shaderStage),this.flow=n,this.vars=i,this.declarations=a,this.cache=o,this.stack=c,this.setBuildStage(u),d}getFunctionOperator(){return null}buildFunctionCode(){Lr("Abstract function.")}flowChildNode(e,t=null){const n=this.flow,i={code:""};return this.flow=i,i.result=e.build(this,t),this.flow=n,i}flowNodeFromShaderStage(e,t,n=null,i=null){const a=this.tab,o=this.cache,u=this.shaderStage,c=this.context;this.setShaderStage(e);const d=rl({},this.context);delete d.nodeBlock,this.cache=this.globalCache,this.tab=" ",this.context=d;let g=null;if(this.buildStage==="generate"){const v=this.flowChildNode(t,n);i!==null&&(v.code+=`${this.tab+i} = ${v.result};
`),this.flowCode[e]=this.flowCode[e]+v.code,g=v}else g=t.build(this);return this.setShaderStage(u),this.cache=o,this.tab=a,this.context=c,g}getAttributesArray(){return this.attributes.concat(this.bufferAttributes)}getAttributes(){Lr("Abstract function.")}getVaryings(){Lr("Abstract function.")}getVar(e,t,n=null){return`${n!==null?this.generateArrayDeclaration(e,n):this.getType(e)} ${t}`}getVars(e){let t="";const n=this.vars[e];if(n!==void 0)for(const i of n)t+=`${this.getVar(i.type,i.name)}; `;return t}getUniforms(){Lr("Abstract function.")}getCodes(e){const t=this.codes[e];let n="";if(t!==void 0)for(const i of t)n+=i.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(){Lr("Abstract function.")}get subBuild(){return this.subBuildLayers[this.subBuildLayers.length-1]||null}addSubBuild(e){this.subBuildLayers.push(e)}removeSubBuild(){return this.subBuildLayers.pop()}getClosestSubBuild(e){let t;if(e&&e.isNode?e.isShaderCallNodeInternal?t=e.shaderNode.subBuilds:e.isStackNode?t=[e.subBuild]:t=this.getDataFromNode(e,"any").subBuilds:e instanceof Set?t=[...e]:t=e,!t)return null;const n=this.subBuildLayers;for(let i=t.length-1;i>=0;i--){const a=t[i];if(n.includes(a))return a}return null}getSubBuildOutput(e){return this.getSubBuildProperty("outputNode",e)}getSubBuildProperty(e="",t=null){let n;t!==null?n=this.getClosestSubBuild(t):n=this.subBuildFn;let i;return n?i=e?n+"_"+e:n:i=e,i}build(){const{object:e,material:t,renderer:n}=this;if(t!==null){let i=n.library.fromMaterial(t);i===null&&(Gr(`NodeMaterial: Material "${t.type}" is not compatible.`),i=new yc),i.build(this)}else this.addFlow("compute",e);for(const i of d1){this.setBuildStage(i),this.context.vertex&&this.context.vertex.isNode&&this.flowNodeFromShaderStage("vertex",this.context.vertex);for(const a of f1){this.setShaderStage(a);const o=this.flowNodes[a];for(const u of o)i==="generate"?this.flowNode(u):u.build(this)}}return this.setBuildStage(null),this.setShaderStage(null),this.buildCode(),this.buildUpdateNodes(),this}getSharedDataFromNode(e){let t=s8.get(e);return t===void 0&&(t={}),t}getNodeUniform(e,t){const n=this.getSharedDataFromNode(e);let i=n.cache;if(i===void 0){if(t==="float"||t==="int"||t==="uint")i=new j6(e);else if(t==="vec2"||t==="ivec2"||t==="uvec2")i=new Y6(e);else if(t==="vec3"||t==="ivec3"||t==="uvec3")i=new q6(e);else if(t==="vec4"||t==="ivec4"||t==="uvec4")i=new J6(e);else if(t==="color")i=new e8(e);else if(t==="mat2")i=new t8(e);else if(t==="mat3")i=new n8(e);else if(t==="mat4")i=new r8(e);else throw new Error(`Uniform "${t}" not implemented.`);n.cache=i}return i}format(e,t,n){if(t=this.getVectorType(t),n=this.getVectorType(n),t===n||n===null||this.isReference(n))return e;const i=this.getTypeLength(t),a=this.getTypeLength(n);return i===16&&a===9?`${this.getType(n)}( ${e}[ 0 ].xyz, ${e}[ 1 ].xyz, ${e}[ 2 ].xyz )`:i===9&&a===4?`${this.getType(n)}( ${e}[ 0 ].xy, ${e}[ 1 ].xy )`:i>4||a>4||a===0?e:i===a?`${this.getType(n)}( ${e} )`:i>a?(e=n==="bool"?`all( ${e} )`:`${e}.${"xyz".slice(0,a)}`,this.format(e,this.getTypeFromLength(a,this.getComponentType(t)),n)):a===4&&i>1?`${this.getType(n)}( ${this.format(e,t,"vec3")}, 1.0 )`:i===2?`${this.getType(n)}( ${this.format(e,t,"vec2")}, 0.0 )`:(i===1&&a>1&&t!==this.getComponentType(n)&&(e=`${this.getType(this.getComponentType(n))}( ${e} )`),`${this.getType(n)}( ${e} )`)}getSignature(){return`// Three.js r${m} - Node System
`}}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={renderId:0,frameId:0},e.set(t,n)),n}updateBeforeNode(e){const t=e.getUpdateBeforeType(),n=e.updateReference(this);if(t===Ao.FRAME){const i=this._getMaps(this.updateBeforeMap,n);if(i.frameId!==this.frameId){const a=i.frameId;i.frameId=this.frameId,e.updateBefore(this)===!1&&(i.frameId=a)}}else if(t===Ao.RENDER){const i=this._getMaps(this.updateBeforeMap,n);if(i.renderId!==this.renderId){const a=i.renderId;i.renderId=this.renderId,e.updateBefore(this)===!1&&(i.renderId=a)}}else t===Ao.OBJECT&&e.updateBefore(this)}updateAfterNode(e){const t=e.getUpdateAfterType(),n=e.updateReference(this);if(t===Ao.FRAME){const i=this._getMaps(this.updateAfterMap,n);i.frameId!==this.frameId&&e.updateAfter(this)!==!1&&(i.frameId=this.frameId)}else if(t===Ao.RENDER){const i=this._getMaps(this.updateAfterMap,n);i.renderId!==this.renderId&&e.updateAfter(this)!==!1&&(i.renderId=this.renderId)}else t===Ao.OBJECT&&e.updateAfter(this)}updateNode(e){const t=e.getUpdateType(),n=e.updateReference(this);if(t===Ao.FRAME){const i=this._getMaps(this.updateMap,n);i.frameId!==this.frameId&&e.update(this)!==!1&&(i.frameId=this.frameId)}else if(t===Ao.RENDER){const i=this._getMaps(this.updateMap,n);i.renderId!==this.renderId&&e.update(this)!==!1&&(i.renderId=this.renderId)}else t===Ao.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 IM{constructor(e,t,n=null,i="",a=!1){this.type=e,this.name=t,this.count=n,this.qualifier=i,this.isConst=a}}IM.isNodeFunctionInput=!0;class o8 extends E0{static get type(){return"DirectionalLightNode"}constructor(e=null){super(e)}setupDirect(){const e=this.colorNode;return{lightDirection:vM(this.light),lightColor:e}}}const NM=new di,B_=new di;let hx=null;class l8 extends E0{static get type(){return"RectAreaLightNode"}constructor(e=null){super(e),this.halfHeight=va(new le).setGroup(xa),this.halfWidth=va(new le).setGroup(xa),this.updateType=Ao.RENDER}update(e){super.update(e);const{light:t}=this,n=e.camera.matrixWorldInverse;B_.identity(),NM.copy(t.matrixWorld),NM.premultiply(n),B_.extractRotation(NM),this.halfWidth.value.set(t.width*.5,0,0),this.halfHeight.value.set(0,t.height*.5,0),this.halfWidth.value.applyMatrix4(B_),this.halfHeight.value.applyMatrix4(B_)}setupDirectRectArea(e){let t,n;e.isAvailable("float32Filterable")?(t=xl(hx.LTC_FLOAT_1),n=xl(hx.LTC_FLOAT_2)):(t=xl(hx.LTC_HALF_1),n=xl(hx.LTC_HALF_2));const{colorNode:i,light:a}=this,o=mM(a);return{lightColor:i,lightPosition:o,halfWidth:this.halfWidth,halfHeight:this.halfHeight,ltc_1:t,ltc_2:n}}static setLTC(e){hx=e}}class FM extends E0{static get type(){return"SpotLightNode"}constructor(e=null){super(e),this.coneCosNode=va(0).setGroup(xa),this.penumbraCosNode=va(0).setGroup(xa),this.cutoffDistanceNode=va(0).setGroup(xa),this.decayExponentNode=va(0).setGroup(xa),this.colorNode=va(this.color).setGroup(xa)}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,t){const{coneCosNode:n,penumbraCosNode:i}=this;return fA(n,i,t)}getLightCoord(e){const t=e.getNodeProperties(this);let n=t.projectionUV;return n===void 0&&(n=PI(this.light,e.context.positionWorld),t.projectionUV=n),n}setupDirect(e){const{colorNode:t,cutoffDistanceNode:n,decayExponentNode:i,light:a}=this,o=this.getLightVector(e),u=o.normalize(),c=u.dot(vM(a)),d=this.getSpotAttenuation(e,c),g=o.length(),v=EM({lightDistance:g,cutoffDistance:n,decayExponent:i});let M=t.mul(d).mul(v),B,I;return a.colorNode?(I=this.getLightCoord(e),B=a.colorNode(I)):a.map&&(I=this.getLightCoord(e),B=xl(a.map,I.xy).onRenderUpdate(()=>a.map)),B&&(M=I.mul(2).sub(1).abs().lessThan(1).all().select(M.mul(B),M)),{lightColor:M,lightDirection:u}}}class u8 extends FM{static get type(){return"IESSpotLightNode"}getSpotAttenuation(e,t){const n=this.light.iesMap;let i=null;if(n&&n.isTexture===!0){const a=t.acos().mul(1/Math.PI);i=xl(n,Gi(a,0),0).r}else i=super.getSpotAttenuation(t);return i}}const c8=or(([s,e])=>{const t=s.abs().sub(e);return og(mc(t,0)).add(Uf(mc(t.x,t.y),0))});class h8 extends FM{static get type(){return"ProjectorLightNode"}update(e){super.update(e);const t=this.light;if(this.penumbraCosNode.value=Math.min(Math.cos(t.angle*(1-t.penumbra)),.99999),t.aspect===null){let n=1;t.map!==null&&(n=t.map.width/t.map.height),t.shadow.aspect=n}else t.shadow.aspect=t.aspect}getSpotAttenuation(e){const t=qt(0),n=this.penumbraCosNode,i=b_(this.light).mul(e.context.positionWorld||pA);return ra(i.w.greaterThan(0),()=>{const a=i.xyz.div(i.w),o=c8(a.xy.sub(Gi(.5)),Gi(.5)),u=dA(-1,el(1,O1(n)).sub(1));t.assign(Nb(o.mul(-2).mul(u)))}),t}}class d8 extends E0{static get type(){return"AmbientLightNode"}constructor(e=null){super(e)}setup({context:e}){e.irradiance.addAssign(this.colorNode)}}class f8 extends E0{static get type(){return"HemisphereLightNode"}constructor(e=null){super(e),this.lightPositionNode=gM(e),this.lightDirectionNode=this.lightPositionNode.normalize(),this.groundColorNode=va(new Wr).setGroup(xa)}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:i}=this,o=Om.dot(i).mul(.5).add(.5),u=zo(n,t,o);e.context.irradiance.addAssign(u)}}class A8 extends E0{static get type(){return"LightProbeNode"}constructor(e=null){super(e);const t=[];for(let n=0;n<9;n++)t.push(new le);this.lightProbe=Fd(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=hN(Om,this.lightProbe);e.context.irradiance.addAssign(t)}}class mN{parseFunction(){Lr("Abstract function.")}}class PM{constructor(e,t,n="",i=""){this.type=e,this.inputs=t,this.name=n,this.precision=i}getCode(){Lr("Abstract function.")}}PM.isNodeFunction=!0;const p8=/^\s*(highp|mediump|lowp)?\s*([a-z_0-9]+)\s*([a-z_0-9]+)?\s*\(([\s\S]*?)\)/i,g8=/[a-z_0-9]+/ig,vN="#pragma main",m8=s=>{s=s.trim();const e=s.indexOf(vN),t=e!==-1?s.slice(e+vN.length):s,n=t.match(p8);if(n!==null&&n.length===5){const i=n[4],a=[];let o=null;for(;(o=g8.exec(i))!==null;)a.push(o);const u=[];let c=0;for(;c<a.length;){const I=a[c][0]==="const";I===!0&&c++;let ne=a[c][0];ne==="in"||ne==="out"||ne==="inout"?c++:ne="";const ee=a[c++][0];let q=Number.parseInt(a[c][0]);Number.isNaN(q)===!1?c++:q=null;const ye=a[c++][0];u.push(new IM(ee,ye,q,ne,I))}const d=t.substring(n[0].length),g=n[3]!==void 0?n[3]:"",v=n[2],M=n[1]!==void 0?n[1]:"",B=e!==-1?s.slice(0,e):"";return{type:v,inputs:u,name:g,precision:M,inputsCode:i,blockCode:d,headerCode:B}}else throw new Error("FunctionNode: Function is not a GLSL code.")};class v8 extends PM{constructor(e){const{type:t,inputs:n,name:i,precision:a,inputsCode:o,blockCode:u,headerCode:c}=m8(e);super(t,n,i,a),this.inputsCode=o,this.blockCode=u,this.headerCode=c}getCode(e=this.name){let t;const n=this.blockCode;if(n!==""){const{type:i,inputsCode:a,headerCode:o,precision:u}=this;let c=`${i} ${e} ( ${a.trim()} )`;u!==""&&(c=`${u} ${c}`),t=o+c+n}else t="";return t}}class y8 extends mN{parseFunction(e){return new v8(e)}}const yN=new WeakMap,mg=[],Hm=[];class x8 extends Vm{constructor(e,t){super(),this.renderer=e,this.backend=t,this.nodeFrame=new gN,this.nodeBuilderCache=new Map,this.callHashCache=new Mp,this.groupsData=new Mp,this.cacheLib={}}updateGroup(e){const t=e.groupNode,n=t.name;if(n===I1.name)return!0;if(n===xa.name){const a=this.get(e),o=this.nodeFrame.renderId;return a.renderId!==o?(a.renderId=o,!0):!1}if(n===pT.name){const a=this.get(e),o=this.nodeFrame.frameId;return a.frameId!==o?(a.frameId=o,!0):!1}mg[0]=t,mg[1]=e;let i=this.groupsData.get(mg);return i===void 0&&this.groupsData.set(mg,i={}),mg.length=0,i.version!==t.version?(i.version=t.version,!0):!1}getForRenderCacheKey(e){return e.initialCacheKey}getForRender(e){const t=this.get(e);let n=t.nodeBuilderState;if(n===void 0){const{nodeBuilderCache:i}=this,a=this.getForRenderCacheKey(e);if(n=i.get(a),n===void 0){const o=c=>{const d=this.backend.createNodeBuilder(e.object,this.renderer);return d.scene=e.scene,d.material=c,d.camera=e.camera,d.context.material=c,d.lightsNode=e.lightsNode,d.environmentNode=this.getEnvironmentNode(e.scene),d.fogNode=this.getFogNode(e.scene),d.clippingContext=e.clippingContext,this.renderer.getOutputRenderTarget()&&this.renderer.getOutputRenderTarget().multiview&&d.enableMultiview(),d};let u=o(e.material);try{u.build()}catch(c){u=o(new yc),u.build(),Gr("TSL: "+c)}n=this._createNodeBuilderState(u),i.set(a,n)}n.usedTimes++,t.nodeBuilderState=n}return n}delete(e){if(e.isRenderObject){const t=this.get(e).nodeBuilderState;t.usedTimes--,t.usedTimes===0&&this.nodeBuilderCache.delete(this.getForRenderCacheKey(e))}return super.delete(e)}getForCompute(e){const t=this.get(e);let n=t.nodeBuilderState;if(n===void 0){const i=this.backend.createNodeBuilder(e,this.renderer);i.build(),n=this._createNodeBuilderState(i),t.nodeBuilderState=n}return n}_createNodeBuilderState(e){return new U6(e.vertexShader,e.fragmentShader,e.computeShader,e.getAttributesArray(),e.getBindings(),e.updateNodes,e.updateBeforeNodes,e.updateAfterNodes,e.observer,e.transforms)}getEnvironmentNode(e){this.updateEnvironment(e);let t=null;if(e.environmentNode&&e.environmentNode.isNode)t=e.environmentNode;else{const n=this.get(e);n.environmentNode&&(t=n.environmentNode)}return t}getBackgroundNode(e){this.updateBackground(e);let t=null;if(e.backgroundNode&&e.backgroundNode.isNode)t=e.backgroundNode;else{const n=this.get(e);n.backgroundNode&&(t=n.backgroundNode)}return t}getFogNode(e){return this.updateFog(e),e.fogNode||this.get(e).fogNode||null}getCacheKey(e,t){mg[0]=e,mg[1]=t;const n=this.renderer.info.calls,i=this.callHashCache.get(mg)||{};if(i.callId!==n){const a=this.getEnvironmentNode(e),o=this.getFogNode(e);t&&Hm.push(t.getCacheKey(!0)),a&&Hm.push(a.getCacheKey()),o&&Hm.push(o.getCacheKey()),Hm.push(this.renderer.getOutputRenderTarget()&&this.renderer.getOutputRenderTarget().multiview?1:0),Hm.push(this.renderer.shadowMap.enabled?1:0),Hm.push(this.renderer.shadowMap.type),i.callId=n,i.cacheKey=o0(Hm),this.callHashCache.set(mg,i),Hm.length=0}return mg.length=0,i.cacheKey}get isToneMappingState(){return!this.renderer.getRenderTarget()}updateBackground(e){const t=this.get(e),n=e.background;if(n){const i=e.backgroundBlurriness===0&&t.backgroundBlurriness>0||e.backgroundBlurriness>0&&t.backgroundBlurriness===0;if(t.background!==n||i){const a=this.getCacheNode("background",n,()=>{if(n.isCubeTexture===!0||n.mapping===ot||n.mapping===ut||n.mapping===_t){if(e.backgroundBlurriness>0||n.mapping===_t)return eM(n);{let o;return n.isCubeTexture===!0?o=lf(n):o=xl(n),fR(o)}}else{if(n.isTexture===!0)return xl(n,Yg.flipY()).setUpdateMatrix(!0);n.isColor!==!0&&Gr("WebGPUNodes: Unsupported background configuration.",n)}},i);t.backgroundNode=a,t.background=n,t.backgroundBlurriness=e.backgroundBlurriness}}else t.backgroundNode&&(delete t.backgroundNode,delete t.background)}getCacheNode(e,t,n,i=!1){const a=this.cacheLib[e]||(this.cacheLib[e]=new WeakMap);let o=a.get(t);return(o===void 0||i)&&(o=n(),a.set(t,o)),o}updateFog(e){const t=this.get(e),n=e.fog;if(n){if(t.fog!==n){const i=this.getCacheNode("fog",n,()=>{if(n.isFogExp2){const a=su("color","color",n).setGroup(xa),o=su("density","float",n).setGroup(xa);return ix(a,AM(o))}else if(n.isFog){const a=su("color","color",n).setGroup(xa),o=su("near","float",n).setGroup(xa),u=su("far","float",n).setGroup(xa);return ix(a,fM(o,u))}else Gr("Renderer: Unsupported fog configuration.",n)});t.fogNode=i,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 i=this.getCacheNode("environment",n,()=>{if(n.isCubeTexture===!0)return lf(n);if(n.isTexture===!0)return xl(n);Gr("Nodes: Unsupported environment configuration.",n)});t.environmentNode=i,t.environment=n}}else t.environmentNode&&(delete t.environmentNode,delete t.environment)}getNodeFrame(e=this.renderer,t=null,n=null,i=null,a=null){const o=this.nodeFrame;return o.renderer=e,o.scene=t,o.object=n,o.camera=i,o.material=a,o}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+","+e.xr.isPresenting}hasOutputChange(e){return yN.get(e)!==this.getOutputCacheKey()}getOutputNode(e){const t=this.renderer,n=this.getOutputCacheKey(),i=e.isArrayTexture?A_(e,Kn(Yg,jg("gl_ViewID_OVR"))).renderOutput(t.toneMapping,t.currentColorSpace):xl(e,Yg).renderOutput(t.toneMapping,t.currentColorSpace);return yN.set(e,n),i}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 i of n.updateNodes)t.updateNode(i)}updateForRender(e){const t=this.getNodeFrameForRender(e),n=e.getNodeBuilderState();for(const i of n.updateNodes)t.updateNode(i)}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 LM=new Ec;class R_{constructor(e=null){this.version=0,this.clipIntersection=null,this.cacheKey="",this.shadowPass=!1,this.viewNormalMatrix=new pn,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 i=e.length;for(let a=0;a<i;a++){LM.copy(e[a]).applyMatrix4(this.viewMatrix,this.viewNormalMatrix);const o=t[n+a],u=LM.normal;o.x=-u.x,o.y=-u.y,o.z=-u.z,o.w=LM.constant}}updateGlobal(e,t){this.shadowPass=e.overrideMaterial!==null&&e.overrideMaterial.isShadowPassMaterial,this.viewMatrix=t.matrixWorldInverse,this.viewNormalMatrix.getNormalMatrix(this.viewMatrix)}update(e,t){let n=!1;e.version!==this.parentVersion&&(this.intersectionPlanes=Array.from(e.intersectionPlanes),this.unionPlanes=Array.from(e.unionPlanes),this.parentVersion=e.version),this.clipIntersection!==t.clipIntersection&&(this.clipIntersection=t.clipIntersection,this.clipIntersection?this.unionPlanes.length=e.unionPlanes.length:this.intersectionPlanes.length=e.intersectionPlanes.length);const i=t.clippingPlanes,a=i.length;let o,u;if(this.clipIntersection?(o=this.intersectionPlanes,u=e.intersectionPlanes.length):(o=this.unionPlanes,u=e.unionPlanes.length),o.length!==u+a){o.length=u+a;for(let c=0;c<a;c++)o[u+c]=new Ni;n=!0}this.projectPlanes(i,o,u),n&&(this.version++,this.cacheKey=`${this.intersectionPlanes.length}:${this.unionPlanes.length}`)}getGroupContext(e){if(this.shadowPass&&!e.clipShadows)return this;let t=this.clippingGroupContexts.get(e);return t===void 0&&(t=new R_(this),this.clippingGroupContexts.set(e,t)),t.update(this,e),t}get unionClippingCount(){return this.unionPlanes.length}}class b8{constructor(e,t){this.bundleGroup=e,this.camera=t}}const dx=[];class _8{constructor(){this.bundles=new Mp}get(e,t){const n=this.bundles;dx[0]=e,dx[1]=t;let i=n.get(dx);return i===void 0&&(i=new b8(e,t),n.set(dx,i)),dx.length=0,i}dispose(){this.bundles=new Mp}}class xN{constructor(){this.lightNodes=new WeakMap,this.materialNodes=new Map,this.toneMappingNodes=new Map}fromMaterial(e){if(e.isNodeMaterial)return e;let t=null;const n=this.getMaterialNodeClass(e.type);if(n!==null){t=new n;for(const i in e)t[i]=e[i]}return t}addToneMapping(e,t){this.addType(e,t,this.toneMappingNodes)}getToneMappingFunction(e){return this.toneMappingNodes.get(e)||null}getMaterialNodeClass(e){return this.materialNodes.get(e)||null}addMaterial(e,t){this.addType(e,t,this.materialNodes)}getLightNodeClass(e){return this.lightNodes.get(e)||null}addLight(e,t){this.addClass(e,t,this.lightNodes)}addType(e,t,n){if(n.has(t)){Lr(`Redefinition of node ${t}`);return}if(typeof e!="function")throw new Error(`Node class ${e.name} is not a class.`);if(typeof t=="function"||typeof t=="object")throw new Error(`Base class ${t} is not a class.`);n.set(t,e)}addClass(e,t,n){if(n.has(t)){Lr(`Redefinition of node ${t.name}`);return}if(typeof e!="function")throw new Error(`Node class ${e.name} is not a class.`);if(typeof t!="function")throw new Error(`Base class ${t.name} is not a class.`);n.set(t,e)}}const w8=new xM,fx=[];class S8 extends Mp{constructor(){super()}createNode(e=[]){return new xM().setLights(e)}getNode(e,t){if(e.isQuadMesh)return w8;fx[0]=e,fx[1]=t;let n=this.get(fx);return n===void 0&&(n=this.createNode(),this.set(fx,n)),fx.length=0,n}}class Ax extends Ns{constructor(e=1,t=1,n={}){super(e,t,n),this.isXRRenderTarget=!0,this._hasExternalTextures=!1,this._autoAllocateDepthBuffer=!0,this._isOpaqueFramebuffer=!1}copy(e){return super.copy(e),this._hasExternalTextures=e._hasExternalTextures,this._autoAllocateDepthBuffer=e._autoAllocateDepthBuffer,this._isOpaqueFramebuffer=e._isOpaqueFramebuffer,this}}const bN=new le,_N=new le;class M8 extends bl{constructor(e,t=!1){super(),this.enabled=!1,this.isPresenting=!1,this.cameraAutoUpdate=!0,this._renderer=e,this._cameraL=new vo,this._cameraL.viewport=new Ni,this._cameraR=new vo,this._cameraR.viewport=new Ni,this._cameras=[this._cameraL,this._cameraR],this._cameraXR=new jp,this._currentDepthNear=null,this._currentDepthFar=null,this._controllers=[],this._controllerInputSources=[],this._xrRenderTarget=null,this._layers=[],this._sessionUsesLayers=!1,this._supportsGlBinding=typeof XRWebGLBinding!="undefined",this._frameBufferTargets=null,this._createXRLayer=I8.bind(this),this._gl=null,this._currentAnimationContext=null,this._currentAnimationLoop=null,this._currentPixelRatio=null,this._currentSize=new ce,this._onSessionEvent=T8.bind(this),this._onSessionEnd=B8.bind(this),this._onInputSourcesChange=R8.bind(this),this._onAnimationFrame=N8.bind(this),this._referenceSpace=null,this._referenceSpaceType="local-floor",this._customReferenceSpace=null,this._framebufferScaleFactor=1,this._foveation=1,this._session=null,this._glBaseLayer=null,this._glBinding=null,this._glProjLayer=null,this._xrFrame=null,this._supportsLayers=this._supportsGlBinding&&"createProjectionLayer"in XRWebGLBinding.prototype,this._useMultiviewIfPossible=t,this._useMultiview=!1}getController(e){return this._getController(e).getTargetRaySpace()}getControllerGrip(e){return this._getController(e).getGripSpace()}getHand(e){return this._getController(e).getHandSpace()}getFoveation(){if(!(this._glProjLayer===null&&this._glBaseLayer===null))return this._foveation}setFoveation(e){this._foveation=e,this._glProjLayer!==null&&(this._glProjLayer.fixedFoveation=e),this._glBaseLayer!==null&&this._glBaseLayer.fixedFoveation!==void 0&&(this._glBaseLayer.fixedFoveation=e)}getFramebufferScaleFactor(){return this._framebufferScaleFactor}setFramebufferScaleFactor(e){this._framebufferScaleFactor=e,this.isPresenting===!0&&Lr("XRManager: Cannot change framebuffer scale while presenting.")}getReferenceSpaceType(){return this._referenceSpaceType}setReferenceSpaceType(e){this._referenceSpaceType=e,this.isPresenting===!0&&Lr("XRManager: Cannot change reference space type while presenting.")}getReferenceSpace(){return this._customReferenceSpace||this._referenceSpace}setReferenceSpace(e){this._customReferenceSpace=e}getCamera(){return this._cameraXR}getEnvironmentBlendMode(){if(this._session!==null)return this._session.environmentBlendMode}getBinding(){return this._glBinding===null&&this._supportsGlBinding&&(this._glBinding=new XRWebGLBinding(this._session,this._gl)),this._glBinding}getFrame(){return this._xrFrame}useMultiview(){return this._useMultiview}createQuadLayer(e,t,n,i,a,o,u,c={}){const d=new Tc(e,t),g=new Ax(a,o,{format:L,type:es,depthTexture:new Al(a,o,c.stencil?ar:st,void 0,void 0,void 0,void 0,void 0,void 0,c.stencil?w:Q),stencilBuffer:c.stencil,resolveDepthBuffer:!1,resolveStencilBuffer:!1});g._autoAllocateDepthBuffer=!0;const v=new Yl({color:16777215,side:j});v.map=g.texture,v.map.offset.y=1,v.map.repeat.y=-1;const M=new Il(d,v);M.position.copy(n),M.quaternion.copy(i);const B={type:"quad",width:e,height:t,translation:n,quaternion:i,pixelwidth:a,pixelheight:o,plane:M,material:v,rendercall:u,renderTarget:g};if(this._layers.push(B),this._session!==null){B.plane.material=new Yl({color:16777215,side:j}),B.plane.material.blending=ct,B.plane.material.blendEquation=vt,B.plane.material.blendSrc=Lt,B.plane.material.blendDst=Lt,B.xrlayer=this._createXRLayer(B);const I=this._session.renderState.layers;I.unshift(B.xrlayer),this._session.updateRenderState({layers:I})}else g.isXRRenderTarget=!1;return M}createCylinderLayer(e,t,n,i,a,o,u,c,d={}){const g=new Cc(e,e,e*t/n,64,64,!0,Math.PI-t/2,t),v=new Ax(o,u,{format:L,type:es,depthTexture:new Al(o,u,d.stencil?ar:st,void 0,void 0,void 0,void 0,void 0,void 0,d.stencil?w:Q),stencilBuffer:d.stencil,resolveDepthBuffer:!1,resolveStencilBuffer:!1});v._autoAllocateDepthBuffer=!0;const M=new Yl({color:16777215,side:de});M.map=v.texture,M.map.offset.y=1,M.map.repeat.y=-1;const B=new Il(g,M);B.position.copy(i),B.quaternion.copy(a);const I={type:"cylinder",radius:e,centralAngle:t,aspectratio:n,translation:i,quaternion:a,pixelwidth:o,pixelheight:u,plane:B,material:M,rendercall:c,renderTarget:v};if(this._layers.push(I),this._session!==null){I.plane.material=new Yl({color:16777215,side:de}),I.plane.material.blending=ct,I.plane.material.blendEquation=vt,I.plane.material.blendSrc=Lt,I.plane.material.blendDst=Lt,I.xrlayer=this._createXRLayer(I);const ne=this._session.renderState.layers;ne.unshift(I.xrlayer),this._session.updateRenderState({layers:ne})}else v.isXRRenderTarget=!1;return B}renderLayers(){const e=new le,t=new Ze,n=this._renderer,i=this.isPresenting,a=n.getOutputRenderTarget(),o=n._frameBufferTarget;this.isPresenting=!1;const u=new ce;n.getSize(u);const c=n._quad;for(const d of this._layers)if(d.renderTarget.isXRRenderTarget=this._session!==null,d.renderTarget._hasExternalTextures=d.renderTarget.isXRRenderTarget,d.renderTarget.isXRRenderTarget&&this._sessionUsesLayers){d.xrlayer.transform=new XRRigidTransform(d.plane.getWorldPosition(e),d.plane.getWorldQuaternion(t));const g=this._glBinding.getSubImage(d.xrlayer,this._xrFrame);n.backend.setXRRenderTargetTextures(d.renderTarget,g.colorTexture,void 0),n._setXRLayerSize(d.renderTarget.width,d.renderTarget.height),n.setOutputRenderTarget(d.renderTarget),n.setRenderTarget(null),n._frameBufferTarget=null,this._frameBufferTargets||(this._frameBufferTargets=new WeakMap);const{frameBufferTarget:v,quad:M}=this._frameBufferTargets.get(d.renderTarget)||{frameBufferTarget:null,quad:null};v?(n._frameBufferTarget=v,n._quad=M):(n._quad=new nx(new yc),this._frameBufferTargets.set(d.renderTarget,{frameBufferTarget:n._getFrameBufferTarget(),quad:n._quad})),d.rendercall(),n._frameBufferTarget=null}else n.setRenderTarget(d.renderTarget),d.rendercall();n.setRenderTarget(null),n.setOutputRenderTarget(a),n._frameBufferTarget=o,n._setXRLayerSize(u.x,u.y),n._quad=c,this.isPresenting=i}getSession(){return this._session}setSession(e){return Pa(this,null,function*(){const t=this._renderer,n=t.backend;this._gl=t.getContext();const i=this._gl,a=i.getContextAttributes();if(this._session=e,e!==null){if(n.isWebGPUBackend===!0)throw new Error('THREE.XRManager: XR is currently not supported with a WebGPU backend. Use WebGL by passing "{ forceWebGL: true }" to the constructor of the renderer.');if(e.addEventListener("select",this._onSessionEvent),e.addEventListener("selectstart",this._onSessionEvent),e.addEventListener("selectend",this._onSessionEvent),e.addEventListener("squeeze",this._onSessionEvent),e.addEventListener("squeezestart",this._onSessionEvent),e.addEventListener("squeezeend",this._onSessionEvent),e.addEventListener("end",this._onSessionEnd),e.addEventListener("inputsourceschange",this._onInputSourcesChange),yield n.makeXRCompatible(),this._currentPixelRatio=t.getPixelRatio(),t.getSize(this._currentSize),this._currentAnimationContext=t._animation.getContext(),this._currentAnimationLoop=t._animation.getAnimationLoop(),t._animation.stop(),this._supportsLayers===!0){let o=null,u=null,c=null;t.depth&&(c=t.stencil?i.DEPTH24_STENCIL8:i.DEPTH_COMPONENT24,o=t.stencil?w:Q,u=t.stencil?ar:st);const d={colorFormat:i.RGBA8,depthFormat:c,scaleFactor:this._framebufferScaleFactor,clearOnAccess:!1};this._useMultiviewIfPossible&&t.hasFeature("OVR_multiview2")&&(d.textureType="texture-array",this._useMultiview=!0),this._glBinding=this.getBinding();const g=this._glBinding.createProjectionLayer(d),v=[g];this._glProjLayer=g,t.setPixelRatio(1),t._setXRLayerSize(g.textureWidth,g.textureHeight);const M=this._useMultiview?2:1,B=new Al(g.textureWidth,g.textureHeight,u,void 0,void 0,void 0,void 0,void 0,void 0,o,M);if(this._xrRenderTarget=new Ax(g.textureWidth,g.textureHeight,{format:L,type:es,colorSpace:t.outputColorSpace,depthTexture:B,stencilBuffer:t.stencil,samples:a.antialias?4:0,resolveDepthBuffer:g.ignoreDepthValues===!1,resolveStencilBuffer:g.ignoreDepthValues===!1,depth:this._useMultiview?2:1,multiview:this._useMultiview}),this._xrRenderTarget._hasExternalTextures=!0,this._xrRenderTarget.depth=this._useMultiview?2:1,this._sessionUsesLayers=e.enabledFeatures.includes("layers"),this._referenceSpace=yield e.requestReferenceSpace(this.getReferenceSpaceType()),this._sessionUsesLayers)for(const I of this._layers)I.plane.material=new Yl({color:16777215,side:I.type==="cylinder"?de:j}),I.plane.material.blending=ct,I.plane.material.blendEquation=vt,I.plane.material.blendSrc=Lt,I.plane.material.blendDst=Lt,I.xrlayer=this._createXRLayer(I),v.unshift(I.xrlayer);e.updateRenderState({layers:v})}else{const o={antialias:t.currentSamples>0,alpha:!0,depth:t.depth,stencil:t.stencil,framebufferScaleFactor:this.getFramebufferScaleFactor()},u=new XRWebGLLayer(e,i,o);this._glBaseLayer=u,e.updateRenderState({baseLayer:u}),t.setPixelRatio(1),t._setXRLayerSize(u.framebufferWidth,u.framebufferHeight),this._xrRenderTarget=new Ax(u.framebufferWidth,u.framebufferHeight,{format:L,type:es,colorSpace:t.outputColorSpace,stencilBuffer:t.stencil,resolveDepthBuffer:u.ignoreDepthValues===!1,resolveStencilBuffer:u.ignoreDepthValues===!1}),this._xrRenderTarget._isOpaqueFramebuffer=!0,this._referenceSpace=yield e.requestReferenceSpace(this.getReferenceSpaceType())}this.setFoveation(this.getFoveation()),t._animation.setAnimationLoop(this._onAnimationFrame),t._animation.setContext(e),t._animation.start(),this.isPresenting=!0,this.dispatchEvent({type:"sessionstart"})}})}updateCamera(e){const t=this._session;if(t===null)return;const n=e.near,i=e.far,a=this._cameraXR,o=this._cameraL,u=this._cameraR;a.near=u.near=o.near=n,a.far=u.far=o.far=i,a.isMultiViewCamera=this._useMultiview,(this._currentDepthNear!==a.near||this._currentDepthFar!==a.far)&&(t.updateRenderState({depthNear:a.near,depthFar:a.far}),this._currentDepthNear=a.near,this._currentDepthFar=a.far),a.layers.mask=e.layers.mask|6,o.layers.mask=a.layers.mask&3,u.layers.mask=a.layers.mask&5;const c=e.parent,d=a.cameras;wN(a,c);for(let g=0;g<d.length;g++)wN(d[g],c);d.length===2?E8(a,o,u):a.projectionMatrix.copy(o.projectionMatrix),C8(e,a,c)}_getController(e){let t=this._controllers[e];return t===void 0&&(t=new Ra,this._controllers[e]=t),t}}function E8(s,e,t){bN.setFromMatrixPosition(e.matrixWorld),_N.setFromMatrixPosition(t.matrixWorld);const n=bN.distanceTo(_N),i=e.projectionMatrix.elements,a=t.projectionMatrix.elements,o=i[14]/(i[10]-1),u=i[14]/(i[10]+1),c=(i[9]+1)/i[5],d=(i[9]-1)/i[5],g=(i[8]-1)/i[0],v=(a[8]+1)/a[0],M=o*g,B=o*v,I=n/(-g+v),ne=I*-g;if(e.matrixWorld.decompose(s.position,s.quaternion,s.scale),s.translateX(ne),s.translateZ(I),s.matrixWorld.compose(s.position,s.quaternion,s.scale),s.matrixWorldInverse.copy(s.matrixWorld).invert(),i[10]===-1)s.projectionMatrix.copy(e.projectionMatrix),s.projectionMatrixInverse.copy(e.projectionMatrixInverse);else{const ee=o+I,q=u+I,ye=M-ne,Ce=B+(n-ne),ke=c*u/q*ee,nt=d*u/q*ee;s.projectionMatrix.makePerspective(ye,Ce,ke,nt,ee,q),s.projectionMatrixInverse.copy(s.projectionMatrix).invert()}}function wN(s,e){e===null?s.matrixWorld.copy(s.matrix):s.matrixWorld.multiplyMatrices(e.matrixWorld,s.matrix),s.matrixWorldInverse.copy(s.matrixWorld).invert()}function C8(s,e,t){t===null?s.matrix.copy(e.matrixWorld):(s.matrix.copy(t.matrixWorld),s.matrix.invert(),s.matrix.multiply(e.matrixWorld)),s.matrix.decompose(s.position,s.quaternion,s.scale),s.updateMatrixWorld(!0),s.projectionMatrix.copy(e.projectionMatrix),s.projectionMatrixInverse.copy(e.projectionMatrixInverse),s.isPerspectiveCamera&&(s.fov=Oh*2*Math.atan(1/s.projectionMatrix.elements[5]),s.zoom=1)}function T8(s){const e=this._controllerInputSources.indexOf(s.inputSource);if(e===-1)return;const t=this._controllers[e];if(t!==void 0){const n=this.getReferenceSpace();t.update(s.inputSource,s.frame,n),t.dispatchEvent({type:s.type,data:s.inputSource})}}function B8(){const s=this._session,e=this._renderer;s.removeEventListener("select",this._onSessionEvent),s.removeEventListener("selectstart",this._onSessionEvent),s.removeEventListener("selectend",this._onSessionEvent),s.removeEventListener("squeeze",this._onSessionEvent),s.removeEventListener("squeezestart",this._onSessionEvent),s.removeEventListener("squeezeend",this._onSessionEvent),s.removeEventListener("end",this._onSessionEnd),s.removeEventListener("inputsourceschange",this._onInputSourcesChange);for(let t=0;t<this._controllers.length;t++){const n=this._controllerInputSources[t];n!==null&&(this._controllerInputSources[t]=null,this._controllers[t].disconnect(n))}if(this._currentDepthNear=null,this._currentDepthFar=null,e._resetXRState(),this._session=null,this._xrRenderTarget=null,this._glBinding=null,this._glBaseLayer=null,this._glProjLayer=null,this._sessionUsesLayers===!0)for(const t of this._layers)t.renderTarget=new Ax(t.pixelwidth,t.pixelheight,{format:L,type:es,depthTexture:new Al(t.pixelwidth,t.pixelheight,t.stencilBuffer?ar:st,void 0,void 0,void 0,void 0,void 0,void 0,t.stencilBuffer?w:Q),stencilBuffer:t.stencilBuffer,resolveDepthBuffer:!1,resolveStencilBuffer:!1}),t.renderTarget.isXRRenderTarget=!1,t.plane.material=t.material,t.material.map=t.renderTarget.texture,t.material.map.offset.y=1,t.material.map.repeat.y=-1,delete t.xrlayer;this.isPresenting=!1,this._useMultiview=!1,e._animation.stop(),e._animation.setAnimationLoop(this._currentAnimationLoop),e._animation.setContext(this._currentAnimationContext),e._animation.start(),e.setPixelRatio(this._currentPixelRatio),e.setSize(this._currentSize.width,this._currentSize.height,!1),this.dispatchEvent({type:"sessionend"})}function R8(s){const e=this._controllers,t=this._controllerInputSources;for(let n=0;n<s.removed.length;n++){const i=s.removed[n],a=t.indexOf(i);a>=0&&(t[a]=null,e[a].disconnect(i))}for(let n=0;n<s.added.length;n++){const i=s.added[n];let a=t.indexOf(i);if(a===-1){for(let u=0;u<e.length;u++)if(u>=t.length){t.push(i),a=u;break}else if(t[u]===null){t[u]=i,a=u;break}if(a===-1)break}const o=e[a];o&&o.connect(i)}}function I8(s){return s.type==="quad"?this._glBinding.createQuadLayer({transform:new XRRigidTransform(s.translation,s.quaternion),width:s.width/2,height:s.height/2,space:this._referenceSpace,viewPixelWidth:s.pixelwidth,viewPixelHeight:s.pixelheight,clearOnAccess:!1}):this._glBinding.createCylinderLayer({transform:new XRRigidTransform(s.translation,s.quaternion),radius:s.radius,centralAngle:s.centralAngle,aspectRatio:s.aspectRatio,space:this._referenceSpace,viewPixelWidth:s.pixelwidth,viewPixelHeight:s.pixelheight,clearOnAccess:!1})}function N8(s,e){if(e===void 0)return;const t=this._cameraXR,n=this._renderer,i=n.backend,a=this._glBaseLayer,o=this.getReferenceSpace(),u=e.getViewerPose(o);if(this._xrFrame=e,u!==null){const c=u.views;this._glBaseLayer!==null&&i.setXRTarget(a.framebuffer);let d=!1;c.length!==t.cameras.length&&(t.cameras.length=0,d=!0);for(let g=0;g<c.length;g++){const v=c[g];let M;if(this._supportsLayers===!0){const I=this._glBinding.getViewSubImage(this._glProjLayer,v);M=I.viewport,g===0&&i.setXRRenderTargetTextures(this._xrRenderTarget,I.colorTexture,this._glProjLayer.ignoreDepthValues&&!this._useMultiview?void 0:I.depthStencilTexture)}else M=a.getViewport(v);let B=this._cameras[g];B===void 0&&(B=new vo,B.layers.enable(g),B.viewport=new Ni,this._cameras[g]=B),B.matrix.fromArray(v.transform.matrix),B.matrix.decompose(B.position,B.quaternion,B.scale),B.projectionMatrix.fromArray(v.projectionMatrix),B.projectionMatrixInverse.copy(B.projectionMatrix).invert(),B.viewport.set(M.x,M.y,M.width,M.height),g===0&&(t.matrix.copy(B.matrix),t.matrix.decompose(t.position,t.quaternion,t.scale)),d===!0&&t.cameras.push(B)}n.setOutputRenderTarget(this._xrRenderTarget)}for(let c=0;c<this._controllers.length;c++){const d=this._controllerInputSources[c],g=this._controllers[c];d!==null&&g!==void 0&&g.update(d,e,o)}this._currentAnimationLoop&&this._currentAnimationLoop(s,e),e.detectedPlanes&&this.dispatchEvent({type:"planesdetected",data:e}),this._xrFrame=null}class F8 extends bl{constructor(e){super(),this.domElement=e,this._pixelRatio=1,this._width=this.domElement.width,this._height=this.domElement.height,this._viewport=new Ni(0,0,this._width,this._height),this._scissor=new Ni(0,0,this._width,this._height),this._scissorTest=!1,this.colorTexture=new OA,this.depthTexture=new Al}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.xr&&this.xr.isPresenting||(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._dispatchResize())}setSize(e,t,n=!0){this.xr&&this.xr.isPresenting||(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._dispatchResize())}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,i){const a=this._scissor;e.isVector4?a.copy(e):a.set(e,t,n,i)}getScissorTest(){return this._scissorTest}setScissorTest(e){this._scissorTest=e}getViewport(e){return e.copy(this._viewport)}setViewport(e,t,n,i,a=0,o=1){const u=this._viewport;e.isVector4?u.copy(e):u.set(e,t,n,i),u.minDepth=a,u.maxDepth=o}_dispatchResize(){this.dispatchEvent({type:"resize"})}dispose(){this.dispatchEvent({type:"dispose"})}}const SN=new _d,Ov=new ce,UM=new Ni,OM=new qu,DM=new kp,I_=new di,rm=new Ni;class P8{constructor(e,t={}){this.isRenderer=!0;const{logarithmicDepthBuffer:n=!1,alpha:i=!0,depth:a=!0,stencil:o=!1,antialias:u=!1,samples:c=0,getFallback:d=null,outputBufferType:g=Wt,multiview:v=!1}=t;this.backend=e,this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.alpha=i,this.logarithmicDepthBuffer=n,this.outputColorSpace=sl,this.toneMapping=Ct,this.toneMappingExposure=1,this.sortObjects=!0,this.depth=a,this.stencil=o,this.info=new u5,this.contextNode=Kg(),this.library=new xN,this.lighting=new S8,this._samples=c||u===!0?4:0,this._onCanvasTargetResize=this._onCanvasTargetResize.bind(this),this._canvasTarget=new F8(e.getDomElement()),this._canvasTarget.addEventListener("resize",this._onCanvasTargetResize),this._canvasTarget.isDefaultCanvasTarget=!0,this._inspector=new LB,this._inspector.setRenderer(this),this._getFallback=d,this._attributes=null,this._geometries=null,this._nodes=null,this._animation=null,this._bindings=null,this._objects=null,this._pipelines=null,this._bundles=null,this._renderLists=null,this._renderContexts=null,this._textures=null,this._background=null,this._quad=new nx(new yc),this._quad.name="Output Color Transform",this._quad.material.name="outputColorTransform",this._currentRenderContext=null,this._opaqueSort=null,this._transparentSort=null,this._frameBufferTarget=null;const M=this.alpha===!0?0:1;this._clearColor=new nM(0,0,0,M),this._clearDepth=1,this._clearStencil=0,this._renderTarget=null,this._activeCubeFace=0,this._activeMipmapLevel=0,this._outputRenderTarget=null,this._mrt=null,this._renderObjectFunction=null,this._currentRenderObjectFunction=null,this._currentRenderBundle=null,this._handleObjectFunction=this._renderObjectDirect,this._isDeviceLost=!1,this.onDeviceLost=this._onDeviceLost,this._outputBufferType=g,this._cacheShadowNodes=new WeakMap,this._initialized=!1,this._initPromise=null,this._compilationPromises=null,this.transparent=!0,this.opaque=!0,this.shadowMap={enabled:!1,type:H},this.xr=new M8(this,v),this.debug={checkShaderErrors:!0,onShaderError:null,getShaderAsync:(B,I,ne)=>Pa(this,null,function*(){yield this.compileAsync(B,I);const ee=this._renderLists.get(B,I),q=this._renderContexts.get(B,I,this._renderTarget,this._mrt),ye=B.overrideMaterial||ne.material,Ce=this._objects.get(ne,ye,B,I,ee.lightsNode,q,q.clippingContext),{fragmentShader:ke,vertexShader:nt}=Ce.getNodeBuilderState();return{fragmentShader:ke,vertexShader:nt}})}}init(){return Pa(this,null,function*(){return this._initPromise!==null?this._initPromise:(this._initPromise=new Promise((e,t)=>Pa(this,null,function*(){let n=this.backend;try{yield n.init(this)}catch(i){if(this._getFallback!==null)try{this.backend=n=this._getFallback(i),yield n.init(this)}catch(a){t(a);return}else{t(i);return}}this._nodes=new x8(this,n),this._animation=new e5(this,this._nodes,this.info),this._attributes=new o5(n),this._background=new P6(this,this._nodes),this._geometries=new l5(this._attributes,this.info),this._textures=new S5(this,n,this.info),this._pipelines=new f5(n,this._nodes),this._bindings=new A5(n,this._nodes,this._textures,this._attributes,this._pipelines,this.info),this._objects=new i5(this,this._nodes,this._geometries,this._pipelines,this._bindings,this.info),this._renderLists=new m5(this.lighting),this._bundles=new _8,this._renderContexts=new _5,this._animation.start(),this._initialized=!0,this._inspector.init(),e(this)})),this._initPromise)})}get domElement(){return this._canvasTarget.domElement}get coordinateSystem(){return this.backend.coordinateSystem}compileAsync(e,t,n=null){return Pa(this,null,function*(){if(this._isDeviceLost===!0)return;this._initialized===!1&&(yield this.init());const i=this._nodes.nodeFrame,a=i.renderId,o=this._currentRenderContext,u=this._currentRenderObjectFunction,c=this._compilationPromises,d=e.isScene===!0?e:SN;n===null&&(n=e);const g=this._renderTarget,v=this._renderContexts.get(n,t,g,this._mrt),M=this._activeMipmapLevel,B=[];this._currentRenderContext=v,this._currentRenderObjectFunction=this.renderObject,this._handleObjectFunction=this._createObjectPipeline,this._compilationPromises=B,i.renderId++,i.update(),v.depth=this.depth,v.stencil=this.stencil,v.clippingContext||(v.clippingContext=new R_),v.clippingContext.updateGlobal(d,t),d.onBeforeRender(this,e,t,g);const I=this._renderLists.get(e,t);if(I.begin(),this._projectObject(e,t,0,I,v.clippingContext),n!==e&&n.traverseVisible(function(Ce){Ce.isLight&&Ce.layers.test(t.layers)&&I.pushLight(Ce)}),I.finish(),g!==null){this._textures.updateRenderTarget(g,M);const Ce=this._textures.get(g);v.textures=Ce.textures,v.depthTexture=Ce.depthTexture}else v.textures=null,v.depthTexture=null;this._background.update(d,I,v);const ne=I.opaque,ee=I.transparent,q=I.transparentDoublePass,ye=I.lightsNode;this.opaque===!0&&ne.length>0&&this._renderObjects(ne,t,d,ye),this.transparent===!0&&ee.length>0&&this._renderTransparents(ee,q,t,d,ye),i.renderId=a,this._currentRenderContext=o,this._currentRenderObjectFunction=u,this._compilationPromises=c,this._handleObjectFunction=this._renderObjectDirect,yield Promise.all(B)})}renderAsync(e,t){return Pa(this,null,function*(){ki('Renderer: "renderAsync()" has been deprecated. Use "render()" and "await renderer.init();" when creating the renderer.'),yield this.init(),this.render(e,t)})}waitForGPU(){return Pa(this,null,function*(){Gr("Renderer: waitForGPU() has been removed. Read https://github.com/mrdoob/three.js/issues/32012 for more information.")})}set inspector(e){this._inspector!==null&&this._inspector.setRenderer(null),this._inspector=e,this._inspector.setRenderer(this)}get inspector(){return this._inspector}set highPrecision(e){const t=this.contextNode.value;e===!0?(t.modelViewMatrix=lS,t.modelNormalViewMatrix=uS):this.highPrecision&&(delete t.modelViewMatrix,delete t.modelNormalViewMatrix)}get highPrecision(){const e=this.contextNode.value;return e.modelViewMatrix===lS&&e.modelNormalViewMatrix===uS}setMRT(e){return this._mrt=e,this}getMRT(){return this._mrt}getOutputBufferType(){return this._outputBufferType}getColorBufferType(){return ki('Renderer: ".getColorBufferType()" has been renamed to ".getOutputBufferType()".'),this.getOutputBufferType()}_onDeviceLost(e){let t=`THREE.WebGPURenderer: ${e.api} Device Lost:
Message: ${e.message}`;e.reason&&(t+=`
Reason: ${e.reason}`),Gr(t),this._isDeviceLost=!0}_renderBundle(e,t,n){const{bundleGroup:i,camera:a,renderList:o}=e,u=this._currentRenderContext,c=this._bundles.get(i,a),d=this.backend.get(c);d.renderContexts===void 0&&(d.renderContexts=new Set);const g=i.version!==d.version,v=d.renderContexts.has(u)===!1||g;if(d.renderContexts.add(u),v){this.backend.beginBundle(u),(d.renderObjects===void 0||g)&&(d.renderObjects=[]),this._currentRenderBundle=c;const{transparentDoublePass:M,transparent:B,opaque:I}=o;this.opaque===!0&&I.length>0&&this._renderObjects(I,a,t,n),this.transparent===!0&&B.length>0&&this._renderTransparents(B,M,a,t,n),this._currentRenderBundle=null,this.backend.finishBundle(u,c),d.version=i.version}else{const{renderObjects:M}=d;for(let B=0,I=M.length;B<I;B++){const ne=M[B];this._nodes.needsRefresh(ne)&&(this._nodes.updateBefore(ne),this._nodes.updateForRender(ne),this._bindings.updateForRender(ne),this._nodes.updateAfter(ne))}}this.backend.addBundle(u,c)}render(e,t){if(this._initialized===!1)throw new Error('Renderer: .render() called before the backend is initialized. Use "await renderer.init();" before rendering.');this._renderScene(e,t)}get initialized(){return this._initialized}_getFrameBufferTarget(){const{currentToneMapping:e,currentColorSpace:t}=this,n=e!==Ct,i=t!==xr.workingColorSpace;if(n===!1&&i===!1)return null;const{width:a,height:o}=this.getDrawingBufferSize(Ov),{depth:u,stencil:c}=this;let d=this._frameBufferTarget;d===null&&(d=new Ns(a,o,{depthBuffer:u,stencilBuffer:c,type:this._outputBufferType,format:L,colorSpace:xr.workingColorSpace,generateMipmaps:!1,minFilter:vr,magFilter:vr,samples:this.samples}),d.isPostProcessingRenderTarget=!0,this._frameBufferTarget=d);const g=this.getOutputRenderTarget();d.depthBuffer=u,d.stencilBuffer=c,g!==null?d.setSize(g.width,g.height,g.depth):d.setSize(a,o,1);const v=this._canvasTarget;return d.viewport.copy(v._viewport),d.scissor.copy(v._scissor),d.viewport.multiplyScalar(v._pixelRatio),d.scissor.multiplyScalar(v._pixelRatio),d.scissorTest=v._scissorTest,d.multiview=g!==null?g.multiview:!1,d.resolveDepthBuffer=g!==null?g.resolveDepthBuffer:!0,d._autoAllocateDepthBuffer=g!==null?g._autoAllocateDepthBuffer:!1,d}_renderScene(e,t,n=!0){if(this._isDeviceLost===!0)return;const i=n?this._getFrameBufferTarget():null,a=this._nodes.nodeFrame,o=a.renderId,u=this._currentRenderContext,c=this._currentRenderObjectFunction,d=e.isScene===!0?e:SN,g=this._renderTarget||this._outputRenderTarget,v=this._activeCubeFace,M=this._activeMipmapLevel;let B;i!==null?(B=i,this.setRenderTarget(B)):B=g;const I=this._renderContexts.get(e,t,B,this._mrt);this._currentRenderContext=I,this._currentRenderObjectFunction=this._renderObjectFunction||this.renderObject,this.info.calls++,this.info.render.calls++,this.info.render.frameCalls++,a.renderId=this.info.calls,this.backend.updateTimeStampUID(I),this.inspector.beginRender(this.backend.getTimestampUID(I),e,t,B);const ne=this.coordinateSystem,ee=this.xr;if(t.coordinateSystem!==ne&&ee.isPresenting===!1&&(t.coordinateSystem=ne,t.updateProjectionMatrix(),t.isArrayCamera))for(const Br of t.cameras)Br.coordinateSystem=ne,Br.updateProjectionMatrix();e.matrixWorldAutoUpdate===!0&&e.updateMatrixWorld(),t.parent===null&&t.matrixWorldAutoUpdate===!0&&t.updateMatrixWorld(),ee.enabled===!0&&ee.isPresenting===!0&&(ee.cameraAutoUpdate===!0&&ee.updateCamera(t),t=ee.getCamera());const q=this._canvasTarget;let ye=q._viewport,Ce=q._scissor,ke=q._pixelRatio;B!==null&&(ye=B.viewport,Ce=B.scissor,ke=1),this.getDrawingBufferSize(Ov),UM.set(0,0,Ov.width,Ov.height);const nt=ye.minDepth===void 0?0:ye.minDepth,Ye=ye.maxDepth===void 0?1:ye.maxDepth;I.viewportValue.copy(ye).multiplyScalar(ke).floor(),I.viewportValue.width>>=M,I.viewportValue.height>>=M,I.viewportValue.minDepth=nt,I.viewportValue.maxDepth=Ye,I.viewport=I.viewportValue.equals(UM)===!1,I.scissorValue.copy(Ce).multiplyScalar(ke).floor(),I.scissor=q._scissorTest&&I.scissorValue.equals(UM)===!1,I.scissorValue.width>>=M,I.scissorValue.height>>=M,I.clippingContext||(I.clippingContext=new R_),I.clippingContext.updateGlobal(d,t),d.onBeforeRender(this,e,t,B);const ht=t.isArrayCamera?DM:OM;t.isArrayCamera||(I_.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),ht.setFromProjectionMatrix(I_,t.coordinateSystem,t.reversedDepth));const Rt=this._renderLists.get(e,t);if(Rt.begin(),this._projectObject(e,t,0,Rt,I.clippingContext),Rt.finish(),this.sortObjects===!0&&Rt.sort(this._opaqueSort,this._transparentSort),B!==null){this._textures.updateRenderTarget(B,M);const Br=this._textures.get(B);I.textures=Br.textures,I.depthTexture=Br.depthTexture,I.width=Br.width,I.height=Br.height,I.renderTarget=B,I.depth=B.depthBuffer,I.stencil=B.stencilBuffer}else I.textures=null,I.depthTexture=null,I.width=Ov.width,I.height=Ov.height,I.depth=this.depth,I.stencil=this.stencil;I.width>>=M,I.height>>=M,I.activeCubeFace=v,I.activeMipmapLevel=M,I.occlusionQueryCount=Rt.occlusionQueryCount,I.scissorValue.max(rm.set(0,0,0,0)),I.scissorValue.x+I.scissorValue.width>I.width&&(I.scissorValue.width=Math.max(I.width-I.scissorValue.x,0)),I.scissorValue.y+I.scissorValue.height>I.height&&(I.scissorValue.height=Math.max(I.height-I.scissorValue.y,0)),this._background.update(d,Rt,I),I.camera=t,this.backend.beginRender(I);const{bundles:qe,lightsNode:pt,transparentDoublePass:xn,transparent:cr,opaque:pr}=Rt;return qe.length>0&&this._renderBundles(qe,d,pt),this.opaque===!0&&pr.length>0&&this._renderObjects(pr,t,d,pt),this.transparent===!0&&cr.length>0&&this._renderTransparents(cr,xn,t,d,pt),this.backend.finishRender(I),a.renderId=o,this._currentRenderContext=u,this._currentRenderObjectFunction=c,i!==null&&(this.setRenderTarget(g,v,M),this._renderOutput(B)),d.onAfterRender(this,e,t,B),this.inspector.finishRender(this.backend.getTimestampUID(I)),I}_setXRLayerSize(e,t){this._canvasTarget._width=e,this._canvasTarget._height=t,this.setViewport(0,0,e,t)}_renderOutput(e){const t=this._quad;this._nodes.hasOutputChange(e.texture)&&(t.material.fragmentNode=this._nodes.getOutputNode(e.texture),t.material.needsUpdate=!0);const n=this.autoClear,i=this.xr.enabled;this.autoClear=!1,this.xr.enabled=!1,this._renderScene(t,t.camera,!1),this.autoClear=n,this.xr.enabled=i}getMaxAnisotropy(){return this.backend.getMaxAnisotropy()}getActiveCubeFace(){return this._activeCubeFace}getActiveMipmapLevel(){return this._activeMipmapLevel}setAnimationLoop(e){return Pa(this,null,function*(){this._initialized===!1&&(yield this.init()),this._animation.setAnimationLoop(e)})}getAnimationLoop(){return this._animation.getAnimationLoop()}getArrayBufferAsync(e){return Pa(this,null,function*(){return yield this.backend.getArrayBufferAsync(e)})}getContext(){return this.backend.getContext()}getPixelRatio(){return this._canvasTarget.getPixelRatio()}getDrawingBufferSize(e){return this._canvasTarget.getDrawingBufferSize(e)}getSize(e){return this._canvasTarget.getSize(e)}setPixelRatio(e=1){this._canvasTarget.setPixelRatio(e)}setDrawingBufferSize(e,t,n){this.xr&&this.xr.isPresenting||this._canvasTarget.setDrawingBufferSize(e,t,n)}setSize(e,t,n=!0){this.xr&&this.xr.isPresenting||this._canvasTarget.setSize(e,t,n)}setOpaqueSort(e){this._opaqueSort=e}setTransparentSort(e){this._transparentSort=e}getScissor(e){return this._canvasTarget.getScissor(e)}setScissor(e,t,n,i){this._canvasTarget.setScissor(e,t,n,i)}getScissorTest(){return this._canvasTarget.getScissorTest()}setScissorTest(e){this._canvasTarget.setScissorTest(e),this.backend.setScissorTest(e)}getViewport(e){return this._canvasTarget.getViewport(e)}setViewport(e,t,n,i,a=0,o=1){this._canvasTarget.setViewport(e,t,n,i,a,o)}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)throw new Error('Renderer: .clear() called before the backend is initialized. Use "await renderer.init();" before before using this method.');const i=this._renderTarget||this._getFrameBufferTarget();let a=null;if(i!==null){this._textures.updateRenderTarget(i);const o=this._textures.get(i);a=this._renderContexts.getForClear(i),a.textures=o.textures,a.depthTexture=o.depthTexture,a.width=o.width,a.height=o.height,a.renderTarget=i,a.depth=i.depthBuffer,a.stencil=i.stencilBuffer,a.clearColorValue=this.backend.getClearColor(),a.activeCubeFace=this.getActiveCubeFace(),a.activeMipmapLevel=this.getActiveMipmapLevel()}this.backend.clear(e,t,n,a),i!==null&&this._renderTarget===null&&this._renderOutput(i)}clearColor(){this.clear(!0,!1,!1)}clearDepth(){this.clear(!1,!0,!1)}clearStencil(){this.clear(!1,!1,!0)}clearAsync(e=!0,t=!0,n=!0){return Pa(this,null,function*(){ki('Renderer: "clearAsync()" has been deprecated. Use "clear()" and "await renderer.init();" when creating the renderer.'),yield this.init(),this.clear(e,t,n)})}clearColorAsync(){return Pa(this,null,function*(){ki('Renderer: "clearColorAsync()" has been deprecated. Use "clearColor()" and "await renderer.init();" when creating the renderer.'),this.clear(!0,!1,!1)})}clearDepthAsync(){return Pa(this,null,function*(){ki('Renderer: "clearDepthAsync()" has been deprecated. Use "clearDepth()" and "await renderer.init();" when creating the renderer.'),this.clear(!1,!0,!1)})}clearStencilAsync(){return Pa(this,null,function*(){ki('Renderer: "clearStencilAsync()" has been deprecated. Use "clearStencil()" and "await renderer.init();" when creating the renderer.'),this.clear(!1,!1,!0)})}get needsFrameBufferTarget(){const e=this.currentToneMapping!==Ct,t=this.currentColorSpace!==xr.workingColorSpace;return e||t}get samples(){return this._samples}get currentSamples(){let e=this._samples;return this._renderTarget!==null?e=this._renderTarget.samples:this.needsFrameBufferTarget&&(e=0),e}get currentToneMapping(){return this.isOutputTarget?this.toneMapping:Ct}get currentColorSpace(){return this.isOutputTarget?this.outputColorSpace:xr.workingColorSpace}get isOutputTarget(){return this._renderTarget===this._outputRenderTarget||this._renderTarget===null}dispose(){this._initialized===!0&&(this.info.dispose(),this.backend.dispose(),this._animation.dispose(),this._objects.dispose(),this._geometries.dispose(),this._pipelines.dispose(),this._nodes.dispose(),this._bindings.dispose(),this._renderLists.dispose(),this._renderContexts.dispose(),this._textures.dispose(),this._frameBufferTarget!==null&&this._frameBufferTarget.dispose(),Object.values(this.backend.timestampQueryPool).forEach(e=>{e!==null&&e.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}setOutputRenderTarget(e){this._outputRenderTarget=e}getOutputRenderTarget(){return this._outputRenderTarget}setCanvasTarget(e){this._canvasTarget.removeEventListener("resize",this._onCanvasTargetResize),this._canvasTarget=e,this._canvasTarget.addEventListener("resize",this._onCanvasTargetResize)}getCanvasTarget(){return this._canvasTarget}_resetXRState(){this.backend.setXRTarget(null),this.setOutputRenderTarget(null),this.setRenderTarget(null),this._frameBufferTarget.dispose(),this._frameBufferTarget=null}setRenderObjectFunction(e){this._renderObjectFunction=e}getRenderObjectFunction(){return this._renderObjectFunction}compute(e,t=null){if(this._isDeviceLost===!0)return;if(this._initialized===!1)return Lr("Renderer: .compute() called before the backend is initialized. Try using .computeAsync() instead."),this.computeAsync(e,t);const n=this._nodes.nodeFrame,i=n.renderId;this.info.calls++,this.info.compute.calls++,this.info.compute.frameCalls++,n.renderId=this.info.calls,this.backend.updateTimeStampUID(e),this.inspector.beginCompute(this.backend.getTimestampUID(e),e);const a=this.backend,o=this._pipelines,u=this._bindings,c=this._nodes,d=Array.isArray(e)?e:[e];if(d[0]===void 0||d[0].isComputeNode!==!0)throw new Error("THREE.Renderer: .compute() expects a ComputeNode.");a.beginCompute(e);for(const g of d){if(o.has(g)===!1){const B=()=>{g.removeEventListener("dispose",B),o.delete(g),u.deleteForCompute(g),c.delete(g)};g.addEventListener("dispose",B);const I=g.onInitFunction;I!==null&&I.call(g,{renderer:this})}c.updateForCompute(g),u.updateForCompute(g);const v=u.getForCompute(g),M=o.getForCompute(g,v);a.compute(e,g,v,M,t)}a.finishCompute(e),n.renderId=i,this.inspector.finishCompute(this.backend.getTimestampUID(e))}computeAsync(e,t=null){return Pa(this,null,function*(){this._initialized===!1&&(yield this.init()),this.compute(e,t)})}hasFeatureAsync(e){return Pa(this,null,function*(){return ki('Renderer: "hasFeatureAsync()" has been deprecated. Use "hasFeature()" and "await renderer.init();" when creating the renderer.'),yield this.init(),this.hasFeature(e)})}resolveTimestampsAsync(e="render"){return Pa(this,null,function*(){return this._initialized===!1&&(yield this.init()),this.backend.resolveTimestampsAsync(e)})}hasFeature(e){if(this._initialized===!1)throw new Error('Renderer: .hasFeature() called before the backend is initialized. Use "await renderer.init();" before before using this method.');return this.backend.hasFeature(e)}hasInitialized(){return this._initialized}initTextureAsync(e){return Pa(this,null,function*(){ki('Renderer: "initTextureAsync()" has been deprecated. Use "initTexture()" and "await renderer.init();" when creating the renderer.'),yield this.init(),this.initTexture(e)})}initTexture(e){if(this._initialized===!1)throw new Error('Renderer: .initTexture() called before the backend is initialized. Use "await renderer.init();" before before using this method.');this._textures.updateTexture(e)}copyFramebufferToTexture(e,t=null){if(t!==null)if(t.isVector2)t=rm.set(t.x,t.y,e.image.width,e.image.height).floor();else if(t.isVector4)t=rm.copy(t).floor();else{Gr("Renderer.copyFramebufferToTexture: Invalid rectangle.");return}else t=rm.set(0,0,e.image.width,e.image.height);let n=this._currentRenderContext,i;n!==null?i=n.renderTarget:(i=this._renderTarget||this._getFrameBufferTarget(),i!==null&&(this._textures.updateRenderTarget(i),n=this._textures.get(i))),this._textures.updateTexture(e,{renderTarget:i}),this.backend.copyFramebufferToTexture(e,n,t),this._inspector.copyFramebufferToTexture(e)}copyTextureToTexture(e,t,n=null,i=null,a=0,o=0){this._textures.updateTexture(e),this._textures.updateTexture(t),this.backend.copyTextureToTexture(e,t,n,i,a,o),this._inspector.copyTextureToTexture(e,t)}readRenderTargetPixelsAsync(e,t,n,i,a,o=0,u=0){return Pa(this,null,function*(){return this.backend.copyTextureToBuffer(e.textures[o],t,n,i,a,u)})}_projectObject(e,t,n,i,a){if(e.visible===!1)return;if(e.layers.test(t.layers)){if(e.isGroup)n=e.renderOrder,e.isClippingGroup&&e.enabled&&(a=a.getGroupContext(e));else if(e.isLOD)e.autoUpdate===!0&&e.update(t);else if(e.isLight)i.pushLight(e);else if(e.isSprite){const c=t.isArrayCamera?DM:OM;if(!e.frustumCulled||c.intersectsSprite(e,t)){this.sortObjects===!0&&rm.setFromMatrixPosition(e.matrixWorld).applyMatrix4(I_);const{geometry:d,material:g}=e;g.visible&&i.push(e,d,g,n,rm.z,null,a)}}else if(e.isLineLoop)Gr("Renderer: Objects of type THREE.LineLoop are not supported. Please use THREE.Line or THREE.LineSegments.");else if(e.isMesh||e.isLine||e.isPoints){const c=t.isArrayCamera?DM:OM;if(!e.frustumCulled||c.intersectsObject(e,t)){const{geometry:d,material:g}=e;if(this.sortObjects===!0&&(d.boundingSphere===null&&d.computeBoundingSphere(),rm.copy(d.boundingSphere.center).applyMatrix4(e.matrixWorld).applyMatrix4(I_)),Array.isArray(g)){const v=d.groups;for(let M=0,B=v.length;M<B;M++){const I=v[M],ne=g[I.materialIndex];ne&&ne.visible&&i.push(e,d,ne,n,rm.z,I,a)}}else g.visible&&i.push(e,d,g,n,rm.z,null,a)}}}if(e.isBundleGroup===!0&&this.backend.beginBundle!==void 0){const c=i;i=this._renderLists.get(e,t),i.begin(),c.pushBundle({bundleGroup:e,camera:t,renderList:i}),i.finish()}const u=e.children;for(let c=0,d=u.length;c<d;c++)this._projectObject(u[c],t,n,i,a)}_renderBundles(e,t,n){for(const i of e)this._renderBundle(i,t,n)}_renderTransparents(e,t,n,i,a){if(t.length>0){for(const{material:o}of t)o.side=de;this._renderObjects(t,n,i,a,"backSide");for(const{material:o}of t)o.side=j;this._renderObjects(e,n,i,a);for(const{material:o}of t)o.side=he}else this._renderObjects(e,n,i,a)}_renderObjects(e,t,n,i,a=null){for(let o=0,u=e.length;o<u;o++){const{object:c,geometry:d,material:g,group:v,clippingContext:M}=e[o];this._currentRenderObjectFunction(c,n,t,d,g,v,i,M,a)}}_getShadowNodes(e){const t=e.version;let n=this._cacheShadowNodes.get(e);if(n===void 0||n.version!==t){const i=e.map!==null,a=e.colorNode&&e.colorNode.isNode,o=e.castShadowNode&&e.castShadowNode.isNode;let u=null,c=null,d=null;if(i||a||o){let g,v;o?(g=e.castShadowNode.rgb,v=e.castShadowNode.a):(g=Kn(0),v=qt(1)),i&&(v=v.mul(su("map","texture",e).a)),a&&(v=v.mul(e.colorNode.a)),c=Ks(g,v)}e.depthNode&&e.depthNode.isNode&&(d=e.depthNode),e.castShadowPositionNode&&e.castShadowPositionNode.isNode?u=e.castShadowPositionNode:e.positionNode&&e.positionNode.isNode&&(u=e.positionNode),n={version:t,colorNode:c,depthNode:d,positionNode:u},this._cacheShadowNodes.set(e,n)}return n}renderObject(e,t,n,i,a,o,u,c=null,d=null){let g=!1,v,M,B,I;if(e.onBeforeRender(this,t,n,i,a,o),a.allowOverride===!0&&t.overrideMaterial!==null){const ne=t.overrideMaterial;if(g=!0,v=t.overrideMaterial.colorNode,M=t.overrideMaterial.depthNode,B=t.overrideMaterial.positionNode,I=t.overrideMaterial.side,a.positionNode&&a.positionNode.isNode&&(ne.positionNode=a.positionNode),ne.alphaTest=a.alphaTest,ne.alphaMap=a.alphaMap,ne.transparent=a.transparent||a.transmission>0||a.transmissionNode&&a.transmissionNode.isNode||a.backdropNode&&a.backdropNode.isNode,ne.isShadowPassMaterial){const{colorNode:ee,depthNode:q,positionNode:ye}=this._getShadowNodes(a);ne.side=a.shadowSide===null?a.side:a.shadowSide,ee!==null&&(ne.colorNode=ee),q!==null&&(ne.depthNode=q),ye!==null&&(ne.positionNode=ye)}a=ne}a.transparent===!0&&a.side===he&&a.forceSinglePass===!1?(a.side=de,this._handleObjectFunction(e,a,t,n,u,o,c,"backSide"),a.side=j,this._handleObjectFunction(e,a,t,n,u,o,c,d),a.side=he):this._handleObjectFunction(e,a,t,n,u,o,c,d),g&&(t.overrideMaterial.colorNode=v,t.overrideMaterial.depthNode=M,t.overrideMaterial.positionNode=B,t.overrideMaterial.side=I),e.onAfterRender(this,t,n,i,a,o)}_renderObjectDirect(e,t,n,i,a,o,u,c){const d=this._objects.get(e,t,n,i,a,this._currentRenderContext,u,c);d.drawRange=e.geometry.drawRange,d.group=o;const g=this._nodes.needsRefresh(d);g&&(this._nodes.updateBefore(d),this._geometries.updateForRender(d),this._nodes.updateForRender(d),this._bindings.updateForRender(d)),this._pipelines.updateForRender(d),this._currentRenderBundle!==null&&(this.backend.get(this._currentRenderBundle).renderObjects.push(d),d.bundle=this._currentRenderBundle.bundleGroup),this.backend.draw(d,this.info),g&&this._nodes.updateAfter(d)}_createObjectPipeline(e,t,n,i,a,o,u,c){const d=this._objects.get(e,t,n,i,a,this._currentRenderContext,u,c);d.drawRange=e.geometry.drawRange,d.group=o,this._nodes.updateBefore(d),this._geometries.updateForRender(d),this._nodes.updateForRender(d),this._bindings.updateForRender(d),this._pipelines.getForRender(d,this._compilationPromises),this._nodes.updateAfter(d)}_onCanvasTargetResize(){this._initialized&&this.backend.updateSize()}get compile(){return this.compileAsync}}class MN{constructor(e=""){this.name=e,this.visibility=0}setVisibility(e){this.visibility|=e}getVisibility(){return this.visibility}clone(){return Object.assign(new this.constructor,this)}}function L8(s){return s+(zm-s%zm)%zm}class EN extends MN{constructor(e,t=null){super(e),this.isBuffer=!0,this.bytesPerElement=Float32Array.BYTES_PER_ELEMENT,this._buffer=t,this._updateRanges=[]}get updateRanges(){return this._updateRanges}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}get byteLength(){return L8(this._buffer.byteLength)}get buffer(){return this._buffer}update(){return!0}}class CN extends EN{constructor(e,t=null){super(e,t),this.isUniformBuffer=!0}}let U8=0;class TN extends CN{constructor(e,t){super("UniformBuffer_"+U8++,e?e.value:null),this.nodeUniform=e,this.groupNode=t,this.isNodeUniformBuffer=!0}set updateRanges(e){this.nodeUniform.updateRanges=e}get updateRanges(){return this.nodeUniform.updateRanges}addUpdateRange(e,t){this.nodeUniform.addUpdateRange(e,t)}clearUpdateRanges(){this.nodeUniform.clearUpdateRanges()}get buffer(){return this.nodeUniform.value}}class O8 extends CN{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(){const e=this.bytesPerElement;let t=0;for(let n=0,i=this.uniforms.length;n<i;n++){const a=this.uniforms[n],o=a.boundary,u=a.itemSize*e,c=t%zm,d=c%o,g=c+d;t+=d,g!==0&&zm-g<u&&(t+=zm-g),a.offset=t/e,t+=u}return Math.ceil(t/zm)*zm}update(){let e=!1;for(const t of this.uniforms)this.updateByType(t)===!0&&(e=!0);return e}updateByType(e){if(e.isNumberUniform)return this.updateNumber(e);if(e.isVector2Uniform)return this.updateVector2(e);if(e.isVector3Uniform)return this.updateVector3(e);if(e.isVector4Uniform)return this.updateVector4(e);if(e.isColorUniform)return this.updateColor(e);if(e.isMatrix3Uniform)return this.updateMatrix3(e);if(e.isMatrix4Uniform)return this.updateMatrix4(e);Gr("WebGPUUniformsGroup: Unsupported uniform type.",e)}updateNumber(e){let t=!1;const n=this.values,i=e.getValue(),a=e.offset,o=e.getType();if(n[a]!==i){const u=this._getBufferForType(o);u[a]=n[a]=i,t=!0}return t}updateVector2(e){let t=!1;const n=this.values,i=e.getValue(),a=e.offset,o=e.getType();if(n[a+0]!==i.x||n[a+1]!==i.y){const u=this._getBufferForType(o);u[a+0]=n[a+0]=i.x,u[a+1]=n[a+1]=i.y,t=!0}return t}updateVector3(e){let t=!1;const n=this.values,i=e.getValue(),a=e.offset,o=e.getType();if(n[a+0]!==i.x||n[a+1]!==i.y||n[a+2]!==i.z){const u=this._getBufferForType(o);u[a+0]=n[a+0]=i.x,u[a+1]=n[a+1]=i.y,u[a+2]=n[a+2]=i.z,t=!0}return t}updateVector4(e){let t=!1;const n=this.values,i=e.getValue(),a=e.offset,o=e.getType();if(n[a+0]!==i.x||n[a+1]!==i.y||n[a+2]!==i.z||n[a+4]!==i.w){const u=this._getBufferForType(o);u[a+0]=n[a+0]=i.x,u[a+1]=n[a+1]=i.y,u[a+2]=n[a+2]=i.z,u[a+3]=n[a+3]=i.w,t=!0}return t}updateColor(e){let t=!1;const n=this.values,i=e.getValue(),a=e.offset;if(n[a+0]!==i.r||n[a+1]!==i.g||n[a+2]!==i.b){const o=this.buffer;o[a+0]=n[a+0]=i.r,o[a+1]=n[a+1]=i.g,o[a+2]=n[a+2]=i.b,t=!0}return t}updateMatrix3(e){let t=!1;const n=this.values,i=e.getValue().elements,a=e.offset;if(n[a+0]!==i[0]||n[a+1]!==i[1]||n[a+2]!==i[2]||n[a+4]!==i[3]||n[a+5]!==i[4]||n[a+6]!==i[5]||n[a+8]!==i[6]||n[a+9]!==i[7]||n[a+10]!==i[8]){const o=this.buffer;o[a+0]=n[a+0]=i[0],o[a+1]=n[a+1]=i[1],o[a+2]=n[a+2]=i[2],o[a+4]=n[a+4]=i[3],o[a+5]=n[a+5]=i[4],o[a+6]=n[a+6]=i[5],o[a+8]=n[a+8]=i[6],o[a+9]=n[a+9]=i[7],o[a+10]=n[a+10]=i[8],t=!0}return t}updateMatrix4(e){let t=!1;const n=this.values,i=e.getValue().elements,a=e.offset;return k8(n,i,a)===!1&&(this.buffer.set(i,a),D8(n,i,a),t=!0),t}_getBufferForType(e){return e==="int"||e==="ivec2"||e==="ivec3"||e==="ivec4"?new Int32Array(this.buffer.buffer):e==="uint"||e==="uvec2"||e==="uvec3"||e==="uvec4"?new Uint32Array(this.buffer.buffer):this.buffer}}function D8(s,e,t){for(let n=0,i=e.length;n<i;n++)s[t+n]=e[n]}function k8(s,e,t){for(let n=0,i=e.length;n<i;n++)if(s[t+n]!==e[n])return!1;return!0}let V8=0;class BN extends O8{constructor(e,t){super(e),this.id=V8++,this.groupNode=t,this.isNodeUniformsGroup=!0}}class RN extends MN{constructor(e,t){super(e),this._texture=null,this._onTextureDispose=()=>{this.generation=null,this.version=0},this.texture=t,this.version=t?t.version:0,this.generation=null,this.samplerKey="",this.isSampler=!0}set texture(e){this._texture!==e&&(this._texture&&this._texture.removeEventListener("dispose",this._onTextureDispose),this._texture=e,this.generation=null,this.version=0,this._texture&&this._texture.addEventListener("dispose",this._onTextureDispose))}get texture(){return this._texture}update(){const{texture:e,version:t}=this;return t!==e.version?(this.version=e.version,!0):!1}clone(){const e=super.clone();return e._texture=null,e._onTextureDispose=()=>{e.generation=null,e.version=0},e.texture=this.texture,e}}let z8=0;class G8 extends RN{constructor(e,t){super(e,t),this.id=z8++,this.store=!1,this.mipLevel=0,this.isSampledTexture=!0}}class N_ extends G8{constructor(e,t,n,i=null){super(e,t?t.value:null),this.textureNode=t,this.groupNode=n,this.access=i}update(){const{textureNode:e}=this;return this.texture!==e.value?(this.texture=e.value,!0):super.update()}}class IN extends N_{constructor(e,t,n,i=null){super(e,t,n,i),this.isSampledCubeTexture=!0}}class kM extends N_{constructor(e,t,n,i=null){super(e,t,n,i),this.isSampledTexture3D=!0}}const NN={bitcast_int_uint:new Wh("uint tsl_bitcast_int_to_uint ( int x ) { return floatBitsToUint( intBitsToFloat ( x ) ); }"),bitcast_uint_int:new Wh("uint tsl_bitcast_uint_to_int ( uint x ) { return floatBitsToInt( uintBitsToFloat ( x ) ); }")},H8={textureDimensions:"textureSize",equals:"equal",bitcast_float_int:"floatBitsToInt",bitcast_int_float:"intBitsToFloat",bitcast_uint_float:"uintBitsToFloat",bitcast_float_uint:"floatBitsToUint",bitcast_uint_int:"tsl_bitcast_uint_to_int",bitcast_int_uint:"tsl_bitcast_int_to_uint",floatpack_snorm_2x16:"packSnorm2x16",floatpack_unorm_2x16:"packUnorm2x16",floatpack_float16_2x16:"packHalf2x16",floatunpack_snorm_2x16:"unpackSnorm2x16",floatunpack_unorm_2x16:"unpackUnorm2x16",floatunpack_float16_2x16:"unpackHalf2x16"},Q8={low:"lowp",medium:"mediump",high:"highp"},FN={swizzleAssign:!0,storageBuffer:!1},PN={perspective:"smooth",linear:"noperspective"},LN={centroid:"centroid"},UN=`
precision highp float;
precision highp int;
precision highp sampler2D;
precision highp sampler3D;
precision highp samplerCube;
precision highp sampler2DArray;
precision highp usampler2D;
precision highp usampler3D;
precision highp usamplerCube;
precision highp usampler2DArray;
precision highp isampler2D;
precision highp isampler3D;
precision highp isamplerCube;
precision highp isampler2DArray;
precision lowp sampler2DShadow;
precision lowp sampler2DArrayShadow;
precision lowp samplerCubeShadow;
`;class W8 extends pN{constructor(e,t){super(e,t,new y8),this.uniformGroups={},this.transforms=[],this.extensions={},this.builtins={vertex:[],fragment:[],compute:[]}}needsToWorkingColorSpace(e){return e.isVideoTexture===!0&&e.colorSpace!==ao}_include(e){const t=NN[e];return t.build(this),this.addInclude(t),t}getMethod(e){return NN[e]!==void 0&&this._include(e),H8[e]||e}getBitcastMethod(e,t){return this.getMethod(`bitcast_${t}_${e}`)}getFloatPackingMethod(e){return this.getMethod(`floatpack_${e}_2x16`)}getFloatUnpackingMethod(e){return this.getMethod(`floatunpack_${e}_2x16`)}getTernary(e,t,n){return`${e} ? ${t} : ${n}`}getOutputStructName(){return""}buildFunctionCode(e){const t=e.layout,n=this.flowShaderNode(e),i=[];for(const o of t.inputs)i.push(this.getType(o.type)+" "+o.name);return`${this.getType(t.type)} ${t.name}( ${i.join(", ")} ) {
${n.vars}
${n.code}
return ${n.result};
}`}setupPBO(e){const t=e.value;if(t.pbo===void 0){const n=t.array,i=t.count*t.itemSize,{itemSize:a}=t,o=t.array.constructor.name.toLowerCase().includes("int");let u=o?ie:z;a===2?u=o?Je:ze:a===3?u=o?At:Ie:a===4&&(u=o?xt:L);const c={Float32Array:dt,Uint8Array:es,Uint16Array:rn,Uint32Array:st,Int8Array:Ci,Int16Array:En,Int32Array:Xt,Uint8ClampedArray:es},d=Math.pow(2,Math.ceil(Math.log2(Math.sqrt(i/a))));let g=Math.ceil(i/a/d);d*g*a<i&&g++;const v=d*g*a,M=new n.constructor(v);M.set(n,0),t.array=M;const B=new ah(t.array,d,g,u,c[t.array.constructor.name]||dt);B.needsUpdate=!0,B.isPBOTexture=!0;const I=new ug(B,null,null);I.setPrecision("high"),t.pboNode=I,t.pbo=I.value,this.getUniformFromNode(t.pboNode,"texture",this.shaderStage,this.context.nodeName)}}getPropertyName(e,t=this.shaderStage){return e.isNodeUniform&&e.node.isTextureNode!==!0&&e.node.isBufferNode!==!0?t.charAt(0)+"_"+e.name:super.getPropertyName(e,t)}generatePBO(e){const{node:t,indexNode:n}=e,i=t.value;if(this.renderer.backend.has(i)){const g=this.renderer.backend.get(i);g.pbo=i.pbo}const a=this.getUniformFromNode(i.pboNode,"texture",this.shaderStage,this.context.nodeName),o=this.getPropertyName(a);this.increaseUsage(n);const u=n.build(this,"uint"),c=this.getDataFromNode(e);let d=c.propertyName;if(d===void 0){const g=this.getVarFromNode(e);d=this.getPropertyName(g);const v=this.getDataFromNode(t);let M=v.propertySizeName;M===void 0&&(M=d+"Size",this.getVarFromNode(t,M,"uint"),this.addLineFlowCode(`${M} = uint( textureSize( ${o}, 0 ).x )`,e),v.propertySizeName=M);const{itemSize:B}=i,I="."+l0.join("").slice(0,B),ne=`ivec2(${u} % ${M}, ${u} / ${M})`,ee=this.generateTextureLoad(null,o,ne,"0",null,null);let q="vec4";i.pbo.type===st?q="uvec4":i.pbo.type===Xt&&(q="ivec4"),this.addLineFlowCode(`${d} = ${q}(${ee})${I}`,e),c.propertyName=d}return d}generateTextureLoad(e,t,n,i,a,o){i===null&&(i="0");let u;return a?o?u=`texelFetchOffset( ${t}, ivec3( ${n}, ${a} ), ${i}, ${o} )`:u=`texelFetch( ${t}, ivec3( ${n}, ${a} ), ${i} )`:o?u=`texelFetchOffset( ${t}, ${n}, ${i}, ${o} )`:u=`texelFetch( ${t}, ${n}, ${i} )`,e!==null&&e.isDepthTexture&&(u+=".x"),u}generateTexture(e,t,n,i,a){return i&&(n=`vec3( ${n}, ${i} )`),e.isDepthTexture?a?`textureOffset( ${t}, ${n}, ${a} ).x`:`texture( ${t}, ${n} ).x`:a?`textureOffset( ${t}, ${n}, ${a} )`:`texture( ${t}, ${n} )`}generateTextureLevel(e,t,n,i,a){return a?`textureLodOffset( ${t}, ${n}, ${i}, ${a} )`:`textureLod( ${t}, ${n}, ${i} )`}generateTextureBias(e,t,n,i,a){return a?`textureOffset( ${t}, ${n}, ${a}, ${i} )`:`texture( ${t}, ${n}, ${i} )`}generateTextureGrad(e,t,n,i,a){return a?`textureGradOffset( ${t}, ${n}, ${i[0]}, ${i[1]}, ${a} )`:`textureGrad( ${t}, ${n}, ${i[0]}, ${i[1]} )`}generateTextureCompare(e,t,n,i,a,o,u=this.shaderStage){if(u==="fragment")return e.isCubeTexture?`texture( ${t}, vec4( ${n}, ${i} ) )`:a?o?`textureOffset( ${t}, vec4( ${n}, ${a}, ${i} ), ${o} )`:`texture( ${t}, vec4( ${n}, ${a}, ${i} ) )`:o?`textureOffset( ${t}, vec3( ${n}, ${i} ), ${o} )`:`texture( ${t}, vec3( ${n}, ${i} ) )`;Gr(`WebGPURenderer: THREE.DepthTexture.compareFunction() does not support ${u} shader.`)}getVars(e){const t=[],n=this.vars[e];if(n!==void 0)for(const i of n)t.push(`${this.getVar(i.type,i.name,i.count)};`);return t.join(`
`)}getUniforms(e){const t=this.uniforms[e],n=[],i={};for(const o of t){let u=null,c=!1;if(o.type==="texture"||o.type==="texture3D"){const g=o.node.value;let v="";(g.isDataTexture===!0||g.isData3DTexture===!0)&&(g.type===st?v="u":g.type===Xt&&(v="i")),o.type==="texture3D"&&g.isArrayTexture===!1?u=`${v}sampler3D ${o.name};`:g.compareFunction?g.isArrayTexture===!0?u=`sampler2DArrayShadow ${o.name};`:u=`sampler2DShadow ${o.name};`:g.isArrayTexture===!0||g.isDataArrayTexture===!0||g.isCompressedArrayTexture===!0?u=`${v}sampler2DArray ${o.name};`:u=`${v}sampler2D ${o.name};`}else if(o.type==="cubeTexture")u=`samplerCube ${o.name};`;else if(o.type==="cubeDepthTexture")u=`samplerCubeShadow ${o.name};`;else if(o.type==="buffer"){const g=o.node,v=this.getType(g.bufferType),M=g.bufferCount,B=M>0?M:"";u=`${g.name} {
${v} ${o.name}[${B}];
};
`}else u=`${this.getVectorType(o.type)} ${this.getPropertyName(o,e)};`,c=!0;const d=o.node.precision;if(d!==null&&(u=Q8[d]+" "+u),c){u=" "+u;const g=o.groupNode.name;(i[g]||(i[g]=[])).push(u)}else u="uniform "+u,n.push(u)}let a="";for(const o in i){const u=i[o];a+=this._getGLSLUniformStruct(e+"_"+o,u.join(`
`))+`
`}return a+=n.join(`
`),a}getTypeFromAttribute(e){let t=super.getTypeFromAttribute(e);if(/^[iu]/.test(t)&&e.gpuType!==Xt){let n=e;e.isInterleavedBufferAttribute&&(n=e.data);const i=n.array;i instanceof Uint32Array||i instanceof Int32Array||(t=t.slice(1))}return t}getAttributes(e){let t="";if(e==="vertex"||e==="compute"){const n=this.getAttributesArray();let i=0;for(const a of n)t+=`layout( location = ${i++} ) in ${a.type} ${a.name};
`}return t}getStructMembers(e){const t=[];for(const n of e.members)t.push(` ${n.type} ${n.name};`);return t.join(`
`)}getStructs(e){const t=[],n=this.structs[e],i=[];for(const a of n)if(a.output)for(const o of a.members)i.push(`layout( location = ${o.index} ) out ${o.type} ${o.name};`);else{let o="struct "+a.name+` {
`;o+=this.getStructMembers(a),o+=`
};
`,t.push(o)}return i.length===0&&i.push("layout( location = 0 ) out vec4 fragColor;"),`
`+i.join(`
`)+`
`+t.join(`
`)}getVaryings(e){let t="";const n=this.varyings;if(e==="vertex"||e==="compute")for(const i of n){e==="compute"&&(i.needsInterpolation=!0);const a=this.getType(i.type);if(i.needsInterpolation)if(i.interpolationType){const o=PN[i.interpolationType]||i.interpolationType,u=LN[i.interpolationSampling]||"";t+=`${o} ${u} out ${a} ${i.name};
`}else{const o=a.includes("int")||a.includes("uv")||a.includes("iv")?"flat ":"";t+=`${o}out ${a} ${i.name};
`}else t+=`${a} ${i.name};
`}else if(e==="fragment"){for(const i of n)if(i.needsInterpolation){const a=this.getType(i.type);if(i.interpolationType){const o=PN[i.interpolationType]||i.interpolationType,u=LN[i.interpolationSampling]||"";t+=`${o} ${u} in ${a} ${i.name};
`}else{const o=a.includes("int")||a.includes("uv")||a.includes("iv")?"flat ":"";t+=`${o}in ${a} ${i.name};
`}}}for(const i of this.builtins[e])t+=`${i};
`;return t}getVertexIndex(){return"uint( gl_VertexID )"}getInstanceIndex(){return"uint( gl_InstanceID )"}getInvocationLocalIndex(){return`uint( gl_InstanceID ) % ${this.object.workgroupSize.reduce((n,i)=>n*i,1)}u`}getSubgroupSize(){Gr("GLSLNodeBuilder: WebGLBackend does not support the subgroupSize node")}getInvocationSubgroupIndex(){Gr("GLSLNodeBuilder: WebGLBackend does not support the invocationSubgroupIndex node")}getSubgroupIndex(){Gr("GLSLNodeBuilder: WebGLBackend does not support the subgroupIndex node")}getDrawIndex(){return this.renderer.backend.extensions.has("WEBGL_multi_draw")?"uint( gl_DrawID )":null}getFrontFacing(){return"gl_FrontFacing"}getFragCoord(){return"gl_FragCoord.xy"}getFragDepth(){return"gl_FragDepth"}enableExtension(e,t,n=this.shaderStage){const i=this.extensions[n]||(this.extensions[n]=new Map);i.has(e)===!1&&i.set(e,{name:e,behavior:t})}getExtensions(e){const t=[];if(e==="vertex"){const i=this.renderer.backend.extensions;this.object.isBatchedMesh&&i.has("WEBGL_multi_draw")&&this.enableExtension("GL_ANGLE_multi_draw","require",e)}const n=this.extensions[e];if(n!==void 0)for(const{name:i,behavior:a}of n.values())t.push(`#extension ${i} : ${a}`);return t.join(`
`)}getClipDistance(){return"gl_ClipDistance"}isAvailable(e){let t=FN[e];if(t===void 0){let n;switch(t=!1,e){case"float32Filterable":n="OES_texture_float_linear";break;case"clipDistance":n="WEBGL_clip_cull_distance";break}if(n!==void 0){const i=this.renderer.backend.extensions;i.has(n)&&(i.get(n),t=!0)}FN[e]=t}return t}isFlipY(){return!0}enableHardwareClipping(e){this.enableExtension("GL_ANGLE_clip_cull_distance","require"),this.builtins.vertex.push(`out float gl_ClipDistance[ ${e} ]`)}enableMultiview(){this.enableExtension("GL_OVR_multiview2","require","fragment"),this.enableExtension("GL_OVR_multiview2","require","vertex"),this.builtins.vertex.push("layout(num_views = 2) in")}registerTransform(e,t){this.transforms.push({varyingName:e,attributeNode:t})}getTransforms(){const e=this.transforms;let t="";for(let n=0;n<e.length;n++){const i=e[n],a=this.getPropertyName(i.attributeNode);a&&(t+=`${i.varyingName} = ${a};
`)}return t}_getGLSLUniformStruct(e,t){return`
layout( std140 ) uniform ${e} {
${t}
};`}_getGLSLVertexCode(e){return`#version 300 es
${this.getSignature()}
// extensions
${e.extensions}
// precision
${UN}
// uniforms
${e.uniforms}
// varyings
${e.varyings}
// attributes
${e.attributes}
// codes
${e.codes}
void main() {
// vars
${e.vars}
// transforms
${e.transforms}
// flow
${e.flow}
gl_PointSize = 1.0;
}
`}_getGLSLFragmentCode(e){return`#version 300 es
${this.getSignature()}
// extensions
${e.extensions}
// precision
${UN}
// structs
${e.structs}
// uniforms
${e.uniforms}
// varyings
${e.varyings}
// codes
${e.codes}
void main() {
// vars
${e.vars}
// flow
${e.flow}
}
`}buildCode(){const e=this.material!==null?{fragment:{},vertex:{}}:{compute:{}};this.sortBindingGroups();for(const t in e){let n=`// code
`;n+=this.flowCode[t];const i=this.flowNodes[t],a=i[i.length-1];for(const u of i){const c=this.getFlowData(u),d=u.name;d&&(n.length>0&&(n+=`
`),n+=` // flow -> ${d}
`),n+=`${c.code}
`,u===a&&t!=="compute"&&(n+=`// result
`,t==="vertex"?(n+="gl_Position = ",n+=`${c.result};`):t==="fragment"&&(u.outputNode.isOutputStructNode||(n+="fragColor = ",n+=`${c.result};`)))}const o=e[t];o.extensions=this.getExtensions(t),o.uniforms=this.getUniforms(t),o.attributes=this.getAttributes(t),o.varyings=this.getVaryings(t),o.vars=this.getVars(t),o.structs=this.getStructs(t),o.codes=this.getCodes(t),o.transforms=this.getTransforms(t),o.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,i=null){const a=super.getUniformFromNode(e,t,n,i),o=this.getDataFromNode(e,n,this.globalCache);let u=o.uniformGPU;if(u===void 0){const c=e.groupNode,d=c.name,g=this.getBindGroupArray(d,n);if(t==="texture")u=new N_(a.name,a.node,c),g.push(u);else if(t==="cubeTexture"||t==="cubeDepthTexture")u=new IN(a.name,a.node,c),g.push(u);else if(t==="texture3D")u=new kM(a.name,a.node,c),g.push(u);else if(t==="buffer"){a.name=`buffer${e.id}`;const v=this.getSharedDataFromNode(e);let M=v.buffer;M===void 0&&(e.name=`NodeBuffer_${e.id}`,M=new TN(e,c),M.name=e.name,v.buffer=M),g.push(M),u=M}else{const v=this.uniformGroups[n]||(this.uniformGroups[n]={});let M=v[d];M===void 0&&(M=new BN(n+"_"+d,c),v[d]=M,g.push(M)),u=this.getNodeUniform(a,t),M.addUniform(u)}o.uniformGPU=u}return a}}let VM=null,Dv=null;class ON{constructor(e={}){this.parameters=Object.assign({},e),this.data=new WeakMap,this.renderer=null,this.domElement=null,this.timestampQueryPool={[ml.RENDER]:null,[ml.COMPUTE]:null},this.trackTimestamp=e.trackTimestamp===!0}init(e){return Pa(this,null,function*(){this.renderer=e})}get coordinateSystem(){}beginRender(){}finishRender(){}beginCompute(){}finishCompute(){}draw(){}compute(){}createProgram(){}destroyProgram(){}createBindings(){}updateBindings(){}updateBinding(){}createRenderPipeline(){}createComputePipeline(){}needsRenderUpdate(){}getRenderCacheKey(){}createNodeBuilder(){}updateSampler(){}createDefaultTexture(){}createTexture(){}updateTexture(){}generateMipmaps(){}destroyTexture(){}copyTextureToBuffer(){return Pa(this,null,function*(){})}copyTextureToTexture(){}copyFramebufferToTexture(){}createAttribute(){}createIndexAttribute(){}createStorageAttribute(){}updateAttribute(){}destroyAttribute(){}getContext(){}updateSize(){}updateViewport(){}updateTimeStampUID(e){const t=this.get(e),n=this.renderer.info.frame;let i;e.isComputeNode===!0?i="c:"+this.renderer.info.compute.frameCalls:i="r:"+this.renderer.info.render.frameCalls,t.timestampUID=i+":"+e.id+":f"+n}getTimestampUID(e){return this.get(e).timestampUID}getTimestampFrames(e){const t=this.timestampQueryPool[e];return t?t.getTimestampFrames():[]}_getQueryPool(e){const t=e.startsWith("c:")?ml.COMPUTE:ml.RENDER;return this.timestampQueryPool[t]}getTimestamp(e){return this._getQueryPool(e).getTimestamp(e)}hasTimestamp(e){return this._getQueryPool(e).hasTimestamp(e)}isOccluded(){}resolveTimestampsAsync(e="render"){return Pa(this,null,function*(){if(!this.trackTimestamp){ki("WebGPURenderer: Timestamp tracking is disabled.");return}const t=this.timestampQueryPool[e];if(!t)return;const n=yield t.resolveQueriesAsync();return this.renderer.info[e].timestamp=n,n})}getArrayBufferAsync(){return Pa(this,null,function*(){})}hasFeatureAsync(){return Pa(this,null,function*(){})}hasFeature(){}getMaxAnisotropy(){}getDrawingBufferSize(){return VM=VM||new ce,this.renderer.getDrawingBufferSize(VM)}setScissorTest(){}getClearColor(){const e=this.renderer;return Dv=Dv||new nM,e.getClearColor(Dv),Dv.getRGB(Dv),Dv}getDomElement(){let e=this.domElement;return e===null&&(e=this.parameters.canvas!==void 0?this.parameters.canvas:yh(),"setAttribute"in e&&e.setAttribute("data-engine",`three.js r${m} 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)}deleteBindGroupData(){}dispose(){}}let Z8=0;class K8{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 $8{constructor(e){this.backend=e}createAttribute(e,t){const n=this.backend,{gl:i}=n,a=e.array,o=e.usage||i.STATIC_DRAW,u=e.isInterleavedBufferAttribute?e.data:e,c=n.get(u);let d=c.bufferGPU;d===void 0&&(d=this._createBuffer(i,t,a,o),c.bufferGPU=d,c.bufferType=t,c.version=u.version);let g;if(a instanceof Float32Array)g=i.FLOAT;else if(typeof Float16Array!="undefined"&&a instanceof Float16Array)g=i.HALF_FLOAT;else if(a instanceof Uint16Array)e.isFloat16BufferAttribute?g=i.HALF_FLOAT:g=i.UNSIGNED_SHORT;else if(a instanceof Int16Array)g=i.SHORT;else if(a instanceof Uint32Array)g=i.UNSIGNED_INT;else if(a instanceof Int32Array)g=i.INT;else if(a instanceof Int8Array)g=i.BYTE;else if(a instanceof Uint8Array)g=i.UNSIGNED_BYTE;else if(a instanceof Uint8ClampedArray)g=i.UNSIGNED_BYTE;else throw new Error("THREE.WebGLBackend: Unsupported buffer data format: "+a);let v={bufferGPU:d,bufferType:t,type:g,byteLength:a.byteLength,bytesPerElement:a.BYTES_PER_ELEMENT,version:e.version,pbo:e.pbo,isInteger:g===i.INT||g===i.UNSIGNED_INT||e.gpuType===Xt,id:Z8++};if(e.isStorageBufferAttribute||e.isStorageInstancedBufferAttribute){const M=this._createBuffer(i,t,a,o);v=new K8(v,M)}n.set(e,v)}updateAttribute(e){const t=this.backend,{gl:n}=t,i=e.array,a=e.isInterleavedBufferAttribute?e.data:e,o=t.get(a),u=o.bufferType,c=e.isInterleavedBufferAttribute?e.data.updateRanges:e.updateRanges;if(n.bindBuffer(u,o.bufferGPU),c.length===0)n.bufferSubData(u,0,i);else{for(let d=0,g=c.length;d<g;d++){const v=c[d];n.bufferSubData(u,v.start*i.BYTES_PER_ELEMENT,i,v.start,v.count)}a.clearUpdateRanges()}n.bindBuffer(u,null),o.version=a.version}destroyAttribute(e){const t=this.backend,{gl:n}=t;e.isInterleavedBufferAttribute&&t.delete(e.data);const i=t.get(e);n.deleteBuffer(i.bufferGPU),t.delete(e)}getArrayBufferAsync(e){return Pa(this,null,function*(){const t=this.backend,{gl:n}=t,i=e.isInterleavedBufferAttribute?e.data:e,{bufferGPU:a}=t.get(i),o=e.array,u=o.byteLength;n.bindBuffer(n.COPY_READ_BUFFER,a);const c=n.createBuffer();n.bindBuffer(n.COPY_WRITE_BUFFER,c),n.bufferData(n.COPY_WRITE_BUFFER,u,n.STREAM_READ),n.copyBufferSubData(n.COPY_READ_BUFFER,n.COPY_WRITE_BUFFER,0,0,u),yield t.utils._clientWaitAsync();const d=new e.array.constructor(o.length);return n.bindBuffer(n.COPY_WRITE_BUFFER,c),n.getBufferSubData(n.COPY_WRITE_BUFFER,0,d),n.deleteBuffer(c),n.bindBuffer(n.COPY_READ_BUFFER,null),n.bindBuffer(n.COPY_WRITE_BUFFER,null),d.buffer})}_createBuffer(e,t,n,i){const a=e.createBuffer();return e.bindBuffer(t,a),e.bufferData(t,n,i),e.bindBuffer(t,null),a}}let zM,px;class X8{constructor(e){this.backend=e,this.gl=this.backend.gl,this.enabled={},this.currentFlipSided=null,this.currentCullFace=null,this.currentProgram=null,this.currentBlendingEnabled=!1,this.currentBlending=null,this.currentBlendSrc=null,this.currentBlendDst=null,this.currentBlendSrcAlpha=null,this.currentBlendDstAlpha=null,this.currentPremultipledAlpha=null,this.currentPolygonOffsetFactor=null,this.currentPolygonOffsetUnits=null,this.currentColorMask=null,this.currentDepthFunc=null,this.currentDepthMask=null,this.currentStencilFunc=null,this.currentStencilRef=null,this.currentStencilFuncMask=null,this.currentStencilFail=null,this.currentStencilZFail=null,this.currentStencilZPass=null,this.currentStencilMask=null,this.currentLineWidth=null,this.currentClippingPlanes=0,this.currentVAO=null,this.currentIndex=null,this.currentBoundFramebuffers={},this.currentDrawbuffers=new WeakMap,this.maxTextures=this.gl.getParameter(this.gl.MAX_TEXTURE_IMAGE_UNITS),this.currentTextureSlot=null,this.currentBoundTextures={},this.currentBoundBufferBases={},this._init()}_init(){const e=this.gl;zM={[vt]:e.FUNC_ADD,[at]:e.FUNC_SUBTRACT,[kt]:e.FUNC_REVERSE_SUBTRACT},px={[Lt]:e.ZERO,[Wn]:e.ONE,[Xn]:e.SRC_COLOR,[zn]:e.SRC_ALPHA,[On]:e.SRC_ALPHA_SATURATE,[Ge]:e.DST_COLOR,[vn]:e.DST_ALPHA,[In]:e.ONE_MINUS_SRC_COLOR,[dr]:e.ONE_MINUS_SRC_ALPHA,[Tt]:e.ONE_MINUS_DST_COLOR,[_r]:e.ONE_MINUS_DST_ALPHA};const t=e.getParameter(e.SCISSOR_BOX),n=e.getParameter(e.VIEWPORT);this.currentScissor=new Ni().fromArray(t),this.currentViewport=new Ni().fromArray(n),this._tempVec4=new Ni}enable(e){const{enabled:t}=this;t[e]!==!0&&(this.gl.enable(e),t[e]=!0)}disable(e){const{enabled:t}=this;t[e]!==!1&&(this.gl.disable(e),t[e]=!1)}setFlipSided(e){if(this.currentFlipSided!==e){const{gl:t}=this;e?t.frontFace(t.CW):t.frontFace(t.CCW),this.currentFlipSided=e}}setCullFace(e){const{gl:t}=this;e!==N?(this.enable(t.CULL_FACE),e!==this.currentCullFace&&(e===E?t.cullFace(t.BACK):e===F?t.cullFace(t.FRONT):t.cullFace(t.FRONT_AND_BACK))):this.disable(t.CULL_FACE),this.currentCullFace=e}setLineWidth(e){const{currentLineWidth:t,gl:n}=this;e!==t&&(n.lineWidth(e),this.currentLineWidth=e)}setMRTBlending(e){const t=this.gl,n=this.backend.drawBuffersIndexedExt;if(n)for(let i=1;i<e.length;i++)n.blendFuncSeparateiOES(i,t.ONE,t.ZERO,t.ONE,t.ZERO)}setBlending(e,t,n,i,a,o,u,c){const{gl:d}=this;if(e===we){this.currentBlendingEnabled===!0&&(this.disable(d.BLEND),this.currentBlendingEnabled=!1);return}if(this.currentBlendingEnabled===!1&&(this.enable(d.BLEND),this.currentBlendingEnabled=!0),e!==ct){if(e!==this.currentBlending||c!==this.currentPremultipledAlpha){if((this.currentBlendEquation!==vt||this.currentBlendEquationAlpha!==vt)&&(d.blendEquation(d.FUNC_ADD),this.currentBlendEquation=vt,this.currentBlendEquationAlpha=vt),c)switch(e){case ve:d.blendFuncSeparate(d.ONE,d.ONE_MINUS_SRC_ALPHA,d.ONE,d.ONE_MINUS_SRC_ALPHA);break;case Ee:d.blendFunc(d.ONE,d.ONE);break;case $e:d.blendFuncSeparate(d.ZERO,d.ONE_MINUS_SRC_COLOR,d.ZERO,d.ONE);break;case Fe:d.blendFuncSeparate(d.DST_COLOR,d.ONE_MINUS_SRC_ALPHA,d.ZERO,d.ONE);break;default:Gr("WebGLState: Invalid blending: ",e);break}else switch(e){case ve:d.blendFuncSeparate(d.SRC_ALPHA,d.ONE_MINUS_SRC_ALPHA,d.ONE,d.ONE_MINUS_SRC_ALPHA);break;case Ee:d.blendFuncSeparate(d.SRC_ALPHA,d.ONE,d.ONE,d.ONE);break;case $e:Gr("WebGLState: SubtractiveBlending requires material.premultipliedAlpha = true");break;case Fe:Gr("WebGLState: MultiplyBlending requires material.premultipliedAlpha = true");break;default:Gr("WebGLState: Invalid blending: ",e);break}this.currentBlendSrc=null,this.currentBlendDst=null,this.currentBlendSrcAlpha=null,this.currentBlendDstAlpha=null,this.currentBlending=e,this.currentPremultipledAlpha=c}return}a=a||t,o=o||n,u=u||i,(t!==this.currentBlendEquation||a!==this.currentBlendEquationAlpha)&&(d.blendEquationSeparate(zM[t],zM[a]),this.currentBlendEquation=t,this.currentBlendEquationAlpha=a),(n!==this.currentBlendSrc||i!==this.currentBlendDst||o!==this.currentBlendSrcAlpha||u!==this.currentBlendDstAlpha)&&(d.blendFuncSeparate(px[n],px[i],px[o],px[u]),this.currentBlendSrc=n,this.currentBlendDst=i,this.currentBlendSrcAlpha=o,this.currentBlendDstAlpha=u),this.currentBlending=e,this.currentPremultipledAlpha=!1}setColorMask(e){this.currentColorMask!==e&&(this.gl.colorMask(e,e,e,e),this.currentColorMask=e)}setDepthTest(e){const{gl:t}=this;e?this.enable(t.DEPTH_TEST):this.disable(t.DEPTH_TEST)}setDepthMask(e){this.currentDepthMask!==e&&(this.gl.depthMask(e),this.currentDepthMask=e)}setDepthFunc(e){if(this.currentDepthFunc!==e){const{gl:t}=this;switch(e){case Mt:t.depthFunc(t.NEVER);break;case Et:t.depthFunc(t.ALWAYS);break;case pe:t.depthFunc(t.LESS);break;case Ae:t.depthFunc(t.LEQUAL);break;case Pe:t.depthFunc(t.EQUAL);break;case Ut:t.depthFunc(t.GEQUAL);break;case jt:t.depthFunc(t.GREATER);break;case ft:t.depthFunc(t.NOTEQUAL);break;default:t.depthFunc(t.LEQUAL)}this.currentDepthFunc=e}}scissor(e,t,n,i){const a=this._tempVec4.set(e,t,n,i);if(this.currentScissor.equals(a)===!1){const{gl:o}=this;o.scissor(a.x,a.y,a.z,a.w),this.currentScissor.copy(a)}}viewport(e,t,n,i){const a=this._tempVec4.set(e,t,n,i);if(this.currentViewport.equals(a)===!1){const{gl:o}=this;o.viewport(a.x,a.y,a.z,a.w),this.currentViewport.copy(a)}}setScissorTest(e){const t=this.gl;e?this.enable(t.SCISSOR_TEST):this.disable(t.SCISSOR_TEST)}setStencilTest(e){const{gl:t}=this;e?this.enable(t.STENCIL_TEST):this.disable(t.STENCIL_TEST)}setStencilMask(e){this.currentStencilMask!==e&&(this.gl.stencilMask(e),this.currentStencilMask=e)}setStencilFunc(e,t,n){(this.currentStencilFunc!==e||this.currentStencilRef!==t||this.currentStencilFuncMask!==n)&&(this.gl.stencilFunc(e,t,n),this.currentStencilFunc=e,this.currentStencilRef=t,this.currentStencilFuncMask=n)}setStencilOp(e,t,n){(this.currentStencilFail!==e||this.currentStencilZFail!==t||this.currentStencilZPass!==n)&&(this.gl.stencilOp(e,t,n),this.currentStencilFail=e,this.currentStencilZFail=t,this.currentStencilZPass=n)}setMaterial(e,t,n){const{gl:i}=this;e.side===he?this.disable(i.CULL_FACE):this.enable(i.CULL_FACE);let a=e.side===de;t&&(a=!a),this.setFlipSided(a),e.blending===ve&&e.transparent===!1?this.setBlending(we):this.setBlending(e.blending,e.blendEquation,e.blendSrc,e.blendDst,e.blendEquationAlpha,e.blendSrcAlpha,e.blendDstAlpha,e.premultipliedAlpha),this.setDepthFunc(e.depthFunc),this.setDepthTest(e.depthTest),this.setDepthMask(e.depthWrite),this.setColorMask(e.colorWrite);const o=e.stencilWrite;if(this.setStencilTest(o),o&&(this.setStencilMask(e.stencilWriteMask),this.setStencilFunc(e.stencilFunc,e.stencilRef,e.stencilFuncMask),this.setStencilOp(e.stencilFail,e.stencilZFail,e.stencilZPass)),this.setPolygonOffset(e.polygonOffset,e.polygonOffsetFactor,e.polygonOffsetUnits),e.alphaToCoverage===!0&&this.backend.renderer.currentSamples>0?this.enable(i.SAMPLE_ALPHA_TO_COVERAGE):this.disable(i.SAMPLE_ALPHA_TO_COVERAGE),n>0&&this.currentClippingPlanes!==n)for(let c=0;c<8;c++)c<n?this.enable(12288+c):this.disable(12288+c)}setPolygonOffset(e,t,n){const{gl:i}=this;e?(this.enable(i.POLYGON_OFFSET_FILL),(this.currentPolygonOffsetFactor!==t||this.currentPolygonOffsetUnits!==n)&&(i.polygonOffset(t,n),this.currentPolygonOffsetFactor=t,this.currentPolygonOffsetUnits=n)):this.disable(i.POLYGON_OFFSET_FILL)}useProgram(e){return this.currentProgram!==e?(this.gl.useProgram(e),this.currentProgram=e,!0):!1}setVertexState(e,t=null){const n=this.gl;return this.currentVAO!==e||this.currentIndex!==t?(n.bindVertexArray(e),t!==null&&n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,t),this.currentVAO=e,this.currentIndex=t,!0):!1}resetVertexState(){const e=this.gl;e.bindVertexArray(null),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,null),this.currentVAO=null,this.currentIndex=null}bindFramebuffer(e,t){const{gl:n,currentBoundFramebuffers:i}=this;return i[e]!==t?(n.bindFramebuffer(e,t),i[e]=t,e===n.DRAW_FRAMEBUFFER&&(i[n.FRAMEBUFFER]=t),e===n.FRAMEBUFFER&&(i[n.DRAW_FRAMEBUFFER]=t),!0):!1}drawBuffers(e,t){const{gl:n}=this;let i=[],a=!1;if(e.textures!==null){i=this.currentDrawbuffers.get(t),i===void 0&&(i=[],this.currentDrawbuffers.set(t,i));const o=e.textures;if(i.length!==o.length||i[0]!==n.COLOR_ATTACHMENT0){for(let u=0,c=o.length;u<c;u++)i[u]=n.COLOR_ATTACHMENT0+u;i.length=o.length,a=!0}}else i[0]!==n.BACK&&(i[0]=n.BACK,a=!0);a&&n.drawBuffers(i)}activeTexture(e){const{gl:t,currentTextureSlot:n,maxTextures:i}=this;e===void 0&&(e=t.TEXTURE0+i-1),n!==e&&(t.activeTexture(e),this.currentTextureSlot=e)}bindTexture(e,t,n){const{gl:i,currentTextureSlot:a,currentBoundTextures:o,maxTextures:u}=this;n===void 0&&(a===null?n=i.TEXTURE0+u-1:n=a);let c=o[n];c===void 0&&(c={type:void 0,texture:void 0},o[n]=c),(c.type!==e||c.texture!==t)&&(a!==n&&(i.activeTexture(n),this.currentTextureSlot=n),i.bindTexture(e,t),c.type=e,c.texture=t)}bindBufferBase(e,t,n){const{gl:i}=this,a=`${e}-${t}`;return this.currentBoundBufferBases[a]!==n?(i.bindBufferBase(e,t,n),this.currentBoundBufferBases[a]=n,!0):!1}unbindTexture(){const{gl:e,currentTextureSlot:t,currentBoundTextures:n}=this,i=n[t];i!==void 0&&i.type!==void 0&&(e.bindTexture(i.type,null),i.type=void 0,i.texture=void 0)}}class j8{constructor(e){this.backend=e,this.gl=this.backend.gl,this.extensions=e.extensions}convert(e,t=ao){const{gl:n,extensions:i}=this;let a;const o=xr.getTransfer(t);if(e===es)return n.UNSIGNED_BYTE;if(e===bn)return n.UNSIGNED_SHORT_4_4_4_4;if(e===Jt)return n.UNSIGNED_SHORT_5_5_5_1;if(e===rr)return n.UNSIGNED_INT_5_9_9_9_REV;if(e===Kr)return n.UNSIGNED_INT_10F_11F_11F_REV;if(e===Ci)return n.BYTE;if(e===En)return n.SHORT;if(e===rn)return n.UNSIGNED_SHORT;if(e===Xt)return n.INT;if(e===st)return n.UNSIGNED_INT;if(e===dt)return n.FLOAT;if(e===Wt)return n.HALF_FLOAT;if(e===si)return n.ALPHA;if(e===Ie)return n.RGB;if(e===L)return n.RGBA;if(e===Q)return n.DEPTH_COMPONENT;if(e===w)return n.DEPTH_STENCIL;if(e===z)return n.RED;if(e===ie)return n.RED_INTEGER;if(e===ze)return n.RG;if(e===Je)return n.RG_INTEGER;if(e===xt)return n.RGBA_INTEGER;if(e===Sn||e===Oe||e===Qe||e===Re)if(o===ws)if(a=i.get("WEBGL_compressed_texture_s3tc_srgb"),a!==null){if(e===Sn)return a.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(e===Oe)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(e===Qe)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(e===Re)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(a=i.get("WEBGL_compressed_texture_s3tc"),a!==null){if(e===Sn)return a.COMPRESSED_RGB_S3TC_DXT1_EXT;if(e===Oe)return a.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(e===Qe)return a.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(e===Re)return a.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(e===Ke||e===gt||e===tn||e===yt)if(a=i.get("WEBGL_compressed_texture_pvrtc"),a!==null){if(e===Ke)return a.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(e===gt)return a.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(e===tn)return a.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(e===yt)return a.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(e===Yt||e===Rn||e===er||e===Jn||e===kr||e===fr||e===wr)if(a=i.get("WEBGL_compressed_texture_etc"),a!==null){if(e===Yt||e===Rn)return o===ws?a.COMPRESSED_SRGB8_ETC2:a.COMPRESSED_RGB8_ETC2;if(e===er)return o===ws?a.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:a.COMPRESSED_RGBA8_ETC2_EAC;if(e===Jn)return a.COMPRESSED_R11_EAC;if(e===kr)return a.COMPRESSED_SIGNED_R11_EAC;if(e===fr)return a.COMPRESSED_RG11_EAC;if(e===wr)return a.COMPRESSED_SIGNED_RG11_EAC}else return null;if(e===ei||e===_n||e===jn||e===Hr||e===Pr||e===$i||e===Zi||e===Xi||e===Ei||e===ms||e===_i||e===Es||e===ua||e===Hn)if(a=i.get("WEBGL_compressed_texture_astc"),a!==null){if(e===ei)return o===ws?a.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:a.COMPRESSED_RGBA_ASTC_4x4_KHR;if(e===_n)return o===ws?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:a.COMPRESSED_RGBA_ASTC_5x4_KHR;if(e===jn)return o===ws?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:a.COMPRESSED_RGBA_ASTC_5x5_KHR;if(e===Hr)return o===ws?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:a.COMPRESSED_RGBA_ASTC_6x5_KHR;if(e===Pr)return o===ws?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:a.COMPRESSED_RGBA_ASTC_6x6_KHR;if(e===$i)return o===ws?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:a.COMPRESSED_RGBA_ASTC_8x5_KHR;if(e===Zi)return o===ws?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:a.COMPRESSED_RGBA_ASTC_8x6_KHR;if(e===Xi)return o===ws?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:a.COMPRESSED_RGBA_ASTC_8x8_KHR;if(e===Ei)return o===ws?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:a.COMPRESSED_RGBA_ASTC_10x5_KHR;if(e===ms)return o===ws?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:a.COMPRESSED_RGBA_ASTC_10x6_KHR;if(e===_i)return o===ws?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:a.COMPRESSED_RGBA_ASTC_10x8_KHR;if(e===Es)return o===ws?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:a.COMPRESSED_RGBA_ASTC_10x10_KHR;if(e===ua)return o===ws?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:a.COMPRESSED_RGBA_ASTC_12x10_KHR;if(e===Hn)return o===ws?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:a.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(e===Pt)if(a=i.get("EXT_texture_compression_bptc"),a!==null){if(e===Pt)return o===ws?a.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:a.COMPRESSED_RGBA_BPTC_UNORM_EXT}else return null;if(e===yn||e===Ln||e===gr||e===Rr)if(a=i.get("EXT_texture_compression_rgtc"),a!==null){if(e===yn)return a.COMPRESSED_RED_RGTC1_EXT;if(e===Ln)return a.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(e===gr)return a.COMPRESSED_RED_GREEN_RGTC2_EXT;if(e===Rr)return a.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return e===ar?n.UNSIGNED_INT_24_8:n[e]!==void 0?n[e]:null}_clientWaitAsync(){const{gl:e}=this,t=e.fenceSync(e.SYNC_GPU_COMMANDS_COMPLETE,0);return e.flush(),new Promise((n,i)=>{function a(){const o=e.clientWaitSync(t,e.SYNC_FLUSH_COMMANDS_BIT,0);if(o===e.WAIT_FAILED){e.deleteSync(t),i();return}if(o===e.TIMEOUT_EXPIRED){requestAnimationFrame(a);return}e.deleteSync(t),n()}a()})}}let DN=!1,F_,GM,kN;class Y8{constructor(e){this.backend=e,this.gl=e.gl,this.extensions=e.extensions,this.defaultTextures={},this._srcFramebuffer=null,this._dstFramebuffer=null,DN===!1&&(this._init(),DN=!0)}_init(){const e=this.gl;F_={[$t]:e.REPEAT,[Vt]:e.CLAMP_TO_EDGE,[Qt]:e.MIRRORED_REPEAT},GM={[cn]:e.NEAREST,[Yn]:e.NEAREST_MIPMAP_NEAREST,[Sr]:e.NEAREST_MIPMAP_LINEAR,[vr]:e.LINEAR,[Ki]:e.LINEAR_MIPMAP_NEAREST,[yi]:e.LINEAR_MIPMAP_LINEAR},kN={[gu]:e.NEVER,[$u]:e.ALWAYS,[oo]:e.LESS,[jc]:e.LEQUAL,[Ic]:e.EQUAL,[Ji]:e.GEQUAL,[ph]:e.GREATER,[Lo]:e.NOTEQUAL}}getGLTextureType(e){const{gl:t}=this;let n;return e.isCubeTexture===!0?n=t.TEXTURE_CUBE_MAP:e.isArrayTexture===!0||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,i,a=!1){const{gl:o,extensions:u}=this;if(e!==null){if(o[e]!==void 0)return o[e];Lr("WebGLBackend: Attempt to use non-existing WebGL internal format '"+e+"'")}let c=t;if(t===o.RED&&(n===o.FLOAT&&(c=o.R32F),n===o.HALF_FLOAT&&(c=o.R16F),n===o.UNSIGNED_BYTE&&(c=o.R8),n===o.UNSIGNED_SHORT&&(c=o.R16),n===o.UNSIGNED_INT&&(c=o.R32UI),n===o.BYTE&&(c=o.R8I),n===o.SHORT&&(c=o.R16I),n===o.INT&&(c=o.R32I)),t===o.RED_INTEGER&&(n===o.UNSIGNED_BYTE&&(c=o.R8UI),n===o.UNSIGNED_SHORT&&(c=o.R16UI),n===o.UNSIGNED_INT&&(c=o.R32UI),n===o.BYTE&&(c=o.R8I),n===o.SHORT&&(c=o.R16I),n===o.INT&&(c=o.R32I)),t===o.RG&&(n===o.FLOAT&&(c=o.RG32F),n===o.HALF_FLOAT&&(c=o.RG16F),n===o.UNSIGNED_BYTE&&(c=o.RG8),n===o.UNSIGNED_SHORT&&(c=o.RG16),n===o.UNSIGNED_INT&&(c=o.RG32UI),n===o.BYTE&&(c=o.RG8I),n===o.SHORT&&(c=o.RG16I),n===o.INT&&(c=o.RG32I)),t===o.RG_INTEGER&&(n===o.UNSIGNED_BYTE&&(c=o.RG8UI),n===o.UNSIGNED_SHORT&&(c=o.RG16UI),n===o.UNSIGNED_INT&&(c=o.RG32UI),n===o.BYTE&&(c=o.RG8I),n===o.SHORT&&(c=o.RG16I),n===o.INT&&(c=o.RG32I)),t===o.RGB){const d=a?Uu:xr.getTransfer(i);n===o.FLOAT&&(c=o.RGB32F),n===o.HALF_FLOAT&&(c=o.RGB16F),n===o.UNSIGNED_BYTE&&(c=o.RGB8),n===o.UNSIGNED_SHORT&&(c=o.RGB16),n===o.UNSIGNED_INT&&(c=o.RGB32UI),n===o.BYTE&&(c=o.RGB8I),n===o.SHORT&&(c=o.RGB16I),n===o.INT&&(c=o.RGB32I),n===o.UNSIGNED_BYTE&&(c=d===ws?o.SRGB8:o.RGB8),n===o.UNSIGNED_SHORT_5_6_5&&(c=o.RGB565),n===o.UNSIGNED_SHORT_5_5_5_1&&(c=o.RGB5_A1),n===o.UNSIGNED_SHORT_4_4_4_4&&(c=o.RGB4),n===o.UNSIGNED_INT_5_9_9_9_REV&&(c=o.RGB9_E5),n===o.UNSIGNED_INT_10F_11F_11F_REV&&(c=o.R11F_G11F_B10F)}if(t===o.RGB_INTEGER&&(n===o.UNSIGNED_BYTE&&(c=o.RGB8UI),n===o.UNSIGNED_SHORT&&(c=o.RGB16UI),n===o.UNSIGNED_INT&&(c=o.RGB32UI),n===o.BYTE&&(c=o.RGB8I),n===o.SHORT&&(c=o.RGB16I),n===o.INT&&(c=o.RGB32I)),t===o.RGBA){const d=a?Uu:xr.getTransfer(i);n===o.FLOAT&&(c=o.RGBA32F),n===o.HALF_FLOAT&&(c=o.RGBA16F),n===o.UNSIGNED_BYTE&&(c=o.RGBA8),n===o.UNSIGNED_SHORT&&(c=o.RGBA16),n===o.UNSIGNED_INT&&(c=o.RGBA32UI),n===o.BYTE&&(c=o.RGBA8I),n===o.SHORT&&(c=o.RGBA16I),n===o.INT&&(c=o.RGBA32I),n===o.UNSIGNED_BYTE&&(c=d===ws?o.SRGB8_ALPHA8:o.RGBA8),n===o.UNSIGNED_SHORT_4_4_4_4&&(c=o.RGBA4),n===o.UNSIGNED_SHORT_5_5_5_1&&(c=o.RGB5_A1)}return t===o.RGBA_INTEGER&&(n===o.UNSIGNED_BYTE&&(c=o.RGBA8UI),n===o.UNSIGNED_SHORT&&(c=o.RGBA16UI),n===o.UNSIGNED_INT&&(c=o.RGBA32UI),n===o.BYTE&&(c=o.RGBA8I),n===o.SHORT&&(c=o.RGBA16I),n===o.INT&&(c=o.RGBA32I)),t===o.DEPTH_COMPONENT&&(n===o.UNSIGNED_SHORT&&(c=o.DEPTH_COMPONENT16),n===o.UNSIGNED_INT&&(c=o.DEPTH_COMPONENT24),n===o.FLOAT&&(c=o.DEPTH_COMPONENT32F)),t===o.DEPTH_STENCIL&&n===o.UNSIGNED_INT_24_8&&(c=o.DEPTH24_STENCIL8),(c===o.R16F||c===o.R32F||c===o.RG16F||c===o.RG32F||c===o.RGBA16F||c===o.RGBA32F)&&u.get("EXT_color_buffer_float"),c}setTextureParameters(e,t){const{gl:n,extensions:i,backend:a}=this,o=xr.getPrimaries(xr.workingColorSpace),u=t.colorSpace===ao?null:xr.getPrimaries(t.colorSpace),c=t.colorSpace===ao||o===u?n.NONE:n.BROWSER_DEFAULT_WEBGL;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,c),n.texParameteri(e,n.TEXTURE_WRAP_S,F_[t.wrapS]),n.texParameteri(e,n.TEXTURE_WRAP_T,F_[t.wrapT]),(e===n.TEXTURE_3D||e===n.TEXTURE_2D_ARRAY)&&(t.isArrayTexture||n.texParameteri(e,n.TEXTURE_WRAP_R,F_[t.wrapR])),n.texParameteri(e,n.TEXTURE_MAG_FILTER,GM[t.magFilter]);const d=t.mipmaps!==void 0&&t.mipmaps.length>0,g=t.minFilter===vr&&d?yi:t.minFilter;if(n.texParameteri(e,n.TEXTURE_MIN_FILTER,GM[g]),t.compareFunction&&(n.texParameteri(e,n.TEXTURE_COMPARE_MODE,n.COMPARE_REF_TO_TEXTURE),n.texParameteri(e,n.TEXTURE_COMPARE_FUNC,kN[t.compareFunction])),i.has("EXT_texture_filter_anisotropic")===!0){if(t.magFilter===cn||t.minFilter!==Sr&&t.minFilter!==yi||t.type===dt&&i.has("OES_texture_float_linear")===!1)return;if(t.anisotropy>1){const v=i.get("EXT_texture_filter_anisotropic");n.texParameterf(e,v.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(t.anisotropy,a.getMaxAnisotropy()))}}}createDefaultTexture(e){const{gl:t,backend:n,defaultTextures:i}=this,a=this.getGLTextureType(e);let o=i[a];o===void 0&&(o=t.createTexture(),n.state.bindTexture(a,o),t.texParameteri(a,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(a,t.TEXTURE_MAG_FILTER,t.NEAREST),i[a]=o),n.set(e,{textureGPU:o,glTextureType:a})}createTexture(e,t){const{gl:n,backend:i}=this,{levels:a,width:o,height:u,depth:c}=t,d=i.utils.convert(e.format,e.colorSpace),g=i.utils.convert(e.type),v=this.getInternalFormat(e.internalFormat,d,g,e.colorSpace,e.isVideoTexture),M=n.createTexture(),B=this.getGLTextureType(e);i.state.bindTexture(B,M),this.setTextureParameters(B,e),e.isArrayTexture||e.isDataArrayTexture||e.isCompressedArrayTexture?n.texStorage3D(n.TEXTURE_2D_ARRAY,a,v,o,u,c):e.isData3DTexture?n.texStorage3D(n.TEXTURE_3D,a,v,o,u,c):e.isVideoTexture||n.texStorage2D(B,a,v,o,u),i.set(e,{textureGPU:M,glTextureType:B,glFormat:d,glType:g,glInternalFormat:v})}copyBufferToTexture(e,t){const{gl:n,backend:i}=this,{textureGPU:a,glTextureType:o,glFormat:u,glType:c}=i.get(t),{width:d,height:g}=t.source.data;n.bindBuffer(n.PIXEL_UNPACK_BUFFER,e),i.state.bindTexture(o,a),n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,!1),n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),n.texSubImage2D(o,0,0,0,d,g,u,c,0),n.bindBuffer(n.PIXEL_UNPACK_BUFFER,null),i.state.unbindTexture()}updateTexture(e,t){const{gl:n}=this,{width:i,height:a}=t,{textureGPU:o,glTextureType:u,glFormat:c,glType:d,glInternalFormat:g}=this.backend.get(e);if(!(e.isRenderTargetTexture||o===void 0))if(this.backend.state.bindTexture(u,o),this.setTextureParameters(u,e),e.isCompressedTexture){const v=e.mipmaps,M=t.image;for(let B=0;B<v.length;B++){const I=v[B];e.isCompressedArrayTexture?e.format!==n.RGBA?c!==null?n.compressedTexSubImage3D(n.TEXTURE_2D_ARRAY,B,0,0,0,I.width,I.height,M.depth,c,I.data):Lr("WebGLBackend: Attempt to load unsupported compressed texture format in .uploadTexture()"):n.texSubImage3D(n.TEXTURE_2D_ARRAY,B,0,0,0,I.width,I.height,M.depth,c,d,I.data):c!==null?n.compressedTexSubImage2D(n.TEXTURE_2D,B,0,0,I.width,I.height,c,I.data):Lr("WebGLBackend: Unsupported compressed texture format")}}else if(e.isCubeTexture){const v=t.images,M=e.mipmaps;for(let B=0;B<6;B++){const I=P_(v[B]);n.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+B,0,0,0,i,a,c,d,I);for(let ne=0;ne<M.length;ne++){const ee=M[ne],q=P_(ee.images[B]);n.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+B,ne+1,0,0,q.width,q.height,c,d,q)}}}else if(e.isDataArrayTexture||e.isArrayTexture){const v=t.image;if(e.layerUpdates.size>0){const M=l(v.width,v.height,e.format,e.type);for(const B of e.layerUpdates){const I=v.data.subarray(B*M/v.data.BYTES_PER_ELEMENT,(B+1)*M/v.data.BYTES_PER_ELEMENT);n.texSubImage3D(n.TEXTURE_2D_ARRAY,0,0,0,B,v.width,v.height,1,c,d,I)}e.clearLayerUpdates()}else n.texSubImage3D(n.TEXTURE_2D_ARRAY,0,0,0,0,v.width,v.height,v.depth,c,d,v.data)}else if(e.isData3DTexture){const v=t.image;n.texSubImage3D(n.TEXTURE_3D,0,0,0,0,v.width,v.height,v.depth,c,d,v.data)}else if(e.isVideoTexture)e.update(),n.texImage2D(u,0,g,c,d,t.image);else{const v=e.mipmaps;if(v.length>0)for(let M=0,B=v.length;M<B;M++){const I=v[M],ne=P_(I);n.texSubImage2D(u,M,0,0,I.width,I.height,c,d,ne)}else{const M=P_(t.image);n.texSubImage2D(u,0,0,0,i,a,c,d,M)}}}generateMipmaps(e){const{gl:t,backend:n}=this,{textureGPU:i,glTextureType:a}=n.get(e);n.state.bindTexture(a,i),t.generateMipmap(a)}deallocateRenderBuffers(e){const{gl:t,backend:n}=this;if(e){const i=n.get(e);if(i.renderBufferStorageSetup=void 0,i.framebuffers){for(const a in i.framebuffers)t.deleteFramebuffer(i.framebuffers[a]);delete i.framebuffers}if(i.depthRenderbuffer&&(t.deleteRenderbuffer(i.depthRenderbuffer),delete i.depthRenderbuffer),i.stencilRenderbuffer&&(t.deleteRenderbuffer(i.stencilRenderbuffer),delete i.stencilRenderbuffer),i.msaaFrameBuffer&&(t.deleteFramebuffer(i.msaaFrameBuffer),delete i.msaaFrameBuffer),i.msaaRenderbuffers){for(let a=0;a<i.msaaRenderbuffers.length;a++)t.deleteRenderbuffer(i.msaaRenderbuffers[a]);delete i.msaaRenderbuffers}}}destroyTexture(e,t=!1){const{gl:n,backend:i}=this,{textureGPU:a,renderTarget:o}=i.get(e);this.deallocateRenderBuffers(o),t===!1&&n.deleteTexture(a),i.delete(e)}copyTextureToTexture(e,t,n=null,i=null,a=0,o=0){const{gl:u,backend:c}=this,{state:d}=this.backend,{textureGPU:g,glTextureType:v,glType:M,glFormat:B}=c.get(t);d.bindTexture(v,g);let I,ne,ee,q,ye,Ce,ke,nt,Ye;const ht=e.isCompressedTexture?e.mipmaps[o]:e.image;if(n!==null)I=n.max.x-n.min.x,ne=n.max.y-n.min.y,ee=n.isBox3?n.max.z-n.min.z:1,q=n.min.x,ye=n.min.y,Ce=n.isBox3?n.min.z:0;else{const zr=Math.pow(2,-a);I=Math.floor(ht.width*zr),ne=Math.floor(ht.height*zr),e.isDataArrayTexture||e.isArrayTexture?ee=ht.depth:e.isData3DTexture?ee=Math.floor(ht.depth*zr):ee=1,q=0,ye=0,Ce=0}i!==null?(ke=i.x,nt=i.y,Ye=i.z):(ke=0,nt=0,Ye=0),u.pixelStorei(u.UNPACK_FLIP_Y_WEBGL,t.flipY),u.pixelStorei(u.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t.premultiplyAlpha),u.pixelStorei(u.UNPACK_ALIGNMENT,t.unpackAlignment);const Rt=u.getParameter(u.UNPACK_ROW_LENGTH),qe=u.getParameter(u.UNPACK_IMAGE_HEIGHT),pt=u.getParameter(u.UNPACK_SKIP_PIXELS),xn=u.getParameter(u.UNPACK_SKIP_ROWS),cr=u.getParameter(u.UNPACK_SKIP_IMAGES);u.pixelStorei(u.UNPACK_ROW_LENGTH,ht.width),u.pixelStorei(u.UNPACK_IMAGE_HEIGHT,ht.height),u.pixelStorei(u.UNPACK_SKIP_PIXELS,q),u.pixelStorei(u.UNPACK_SKIP_ROWS,ye),u.pixelStorei(u.UNPACK_SKIP_IMAGES,Ce);const pr=e.isDataArrayTexture||e.isData3DTexture||t.isArrayTexture,Br=t.isDataArrayTexture||t.isData3DTexture||t.isArrayTexture;if(e.isDepthTexture){const zr=c.get(e),Dr=c.get(t),Zr=c.get(zr.renderTarget),Ti=c.get(Dr.renderTarget),ds=Zr.framebuffers[zr.cacheKey],As=Ti.framebuffers[Dr.cacheKey];d.bindFramebuffer(u.READ_FRAMEBUFFER,ds),d.bindFramebuffer(u.DRAW_FRAMEBUFFER,As);for(let Xr=0;Xr<ee;Xr++)pr&&(u.framebufferTextureLayer(u.READ_FRAMEBUFFER,u.COLOR_ATTACHMENT0,zr.textureGPU,a,Ce+Xr),u.framebufferTextureLayer(u.DRAW_FRAMEBUFFER,u.COLOR_ATTACHMENT0,g,o,Ye+Xr)),u.blitFramebuffer(q,ye,I,ne,ke,nt,I,ne,u.DEPTH_BUFFER_BIT,u.NEAREST);d.bindFramebuffer(u.READ_FRAMEBUFFER,null),d.bindFramebuffer(u.DRAW_FRAMEBUFFER,null)}else if(a!==0||e.isRenderTargetTexture||c.has(e)){const zr=c.get(e);this._srcFramebuffer===null&&(this._srcFramebuffer=u.createFramebuffer()),this._dstFramebuffer===null&&(this._dstFramebuffer=u.createFramebuffer()),d.bindFramebuffer(u.READ_FRAMEBUFFER,this._srcFramebuffer),d.bindFramebuffer(u.DRAW_FRAMEBUFFER,this._dstFramebuffer);for(let Dr=0;Dr<ee;Dr++)pr?u.framebufferTextureLayer(u.READ_FRAMEBUFFER,u.COLOR_ATTACHMENT0,zr.textureGPU,a,Ce+Dr):u.framebufferTexture2D(u.READ_FRAMEBUFFER,u.COLOR_ATTACHMENT0,u.TEXTURE_2D,zr.textureGPU,a),Br?u.framebufferTextureLayer(u.DRAW_FRAMEBUFFER,u.COLOR_ATTACHMENT0,g,o,Ye+Dr):u.framebufferTexture2D(u.DRAW_FRAMEBUFFER,u.COLOR_ATTACHMENT0,u.TEXTURE_2D,g,o),a!==0?u.blitFramebuffer(q,ye,I,ne,ke,nt,I,ne,u.COLOR_BUFFER_BIT,u.NEAREST):Br?u.copyTexSubImage3D(v,o,ke,nt,Ye+Dr,q,ye,I,ne):u.copyTexSubImage2D(v,o,ke,nt,q,ye,I,ne);d.bindFramebuffer(u.READ_FRAMEBUFFER,null),d.bindFramebuffer(u.DRAW_FRAMEBUFFER,null)}else Br?e.isDataTexture||e.isData3DTexture?u.texSubImage3D(v,o,ke,nt,Ye,I,ne,ee,B,M,ht.data):t.isCompressedArrayTexture?u.compressedTexSubImage3D(v,o,ke,nt,Ye,I,ne,ee,B,ht.data):u.texSubImage3D(v,o,ke,nt,Ye,I,ne,ee,B,M,ht):e.isDataTexture?u.texSubImage2D(u.TEXTURE_2D,o,ke,nt,I,ne,B,M,ht.data):e.isCompressedTexture?u.compressedTexSubImage2D(u.TEXTURE_2D,o,ke,nt,ht.width,ht.height,B,ht.data):u.texSubImage2D(u.TEXTURE_2D,o,ke,nt,I,ne,B,M,ht);u.pixelStorei(u.UNPACK_ROW_LENGTH,Rt),u.pixelStorei(u.UNPACK_IMAGE_HEIGHT,qe),u.pixelStorei(u.UNPACK_SKIP_PIXELS,pt),u.pixelStorei(u.UNPACK_SKIP_ROWS,xn),u.pixelStorei(u.UNPACK_SKIP_IMAGES,cr),o===0&&t.generateMipmaps&&u.generateMipmap(v),d.unbindTexture()}copyFramebufferToTexture(e,t,n){const{gl:i}=this,{state:a}=this.backend,{textureGPU:o}=this.backend.get(e),{x:u,y:c,z:d,w:g}=n,v=e.isDepthTexture===!0||t.renderTarget&&t.renderTarget.samples>0,M=t.renderTarget?t.renderTarget.height:this.backend.getDrawingBufferSize().y;if(v){const B=u!==0||c!==0;let I,ne;if(e.isDepthTexture===!0?(I=i.DEPTH_BUFFER_BIT,ne=i.DEPTH_ATTACHMENT,t.stencil&&(I|=i.STENCIL_BUFFER_BIT)):(I=i.COLOR_BUFFER_BIT,ne=i.COLOR_ATTACHMENT0),B){const ee=this.backend.get(t.renderTarget),q=ee.framebuffers[t.getCacheKey()],ye=ee.msaaFrameBuffer;a.bindFramebuffer(i.DRAW_FRAMEBUFFER,q),a.bindFramebuffer(i.READ_FRAMEBUFFER,ye);const Ce=M-c-g;i.blitFramebuffer(u,Ce,u+d,Ce+g,u,Ce,u+d,Ce+g,I,i.NEAREST),a.bindFramebuffer(i.READ_FRAMEBUFFER,q),a.bindTexture(i.TEXTURE_2D,o),i.copyTexSubImage2D(i.TEXTURE_2D,0,0,0,u,Ce,d,g),a.unbindTexture()}else{const ee=i.createFramebuffer();a.bindFramebuffer(i.DRAW_FRAMEBUFFER,ee),i.framebufferTexture2D(i.DRAW_FRAMEBUFFER,ne,i.TEXTURE_2D,o,0),i.blitFramebuffer(0,0,d,g,0,0,d,g,I,i.NEAREST),i.deleteFramebuffer(ee)}}else a.bindTexture(i.TEXTURE_2D,o),i.copyTexSubImage2D(i.TEXTURE_2D,0,0,0,u,M-g-c,d,g),a.unbindTexture();e.generateMipmaps&&this.generateMipmaps(e),this.backend._setFramebuffer(t)}setupRenderBufferStorage(e,t,n,i=!1){const{gl:a}=this,o=t.renderTarget,{depthTexture:u,depthBuffer:c,stencilBuffer:d,width:g,height:v}=o;if(a.bindRenderbuffer(a.RENDERBUFFER,e),c&&!d){let M=a.DEPTH_COMPONENT24;i===!0?this.extensions.get("WEBGL_multisampled_render_to_texture").renderbufferStorageMultisampleEXT(a.RENDERBUFFER,o.samples,M,g,v):n>0?(u&&u.isDepthTexture&&u.type===a.FLOAT&&(M=a.DEPTH_COMPONENT32F),a.renderbufferStorageMultisample(a.RENDERBUFFER,n,M,g,v)):a.renderbufferStorage(a.RENDERBUFFER,M,g,v),a.framebufferRenderbuffer(a.FRAMEBUFFER,a.DEPTH_ATTACHMENT,a.RENDERBUFFER,e)}else c&&d&&(n>0?a.renderbufferStorageMultisample(a.RENDERBUFFER,n,a.DEPTH24_STENCIL8,g,v):a.renderbufferStorage(a.RENDERBUFFER,a.DEPTH_STENCIL,g,v),a.framebufferRenderbuffer(a.FRAMEBUFFER,a.DEPTH_STENCIL_ATTACHMENT,a.RENDERBUFFER,e));a.bindRenderbuffer(a.RENDERBUFFER,null)}copyTextureToBuffer(e,t,n,i,a,o){return Pa(this,null,function*(){const{backend:u,gl:c}=this,{textureGPU:d,glFormat:g,glType:v}=this.backend.get(e),M=c.createFramebuffer();u.state.bindFramebuffer(c.READ_FRAMEBUFFER,M);const B=e.isCubeTexture?c.TEXTURE_CUBE_MAP_POSITIVE_X+o:c.TEXTURE_2D;c.framebufferTexture2D(c.READ_FRAMEBUFFER,c.COLOR_ATTACHMENT0,B,d,0);const I=this._getTypedArrayType(v),ne=this._getBytesPerTexel(v,g),q=i*a*ne,ye=c.createBuffer();c.bindBuffer(c.PIXEL_PACK_BUFFER,ye),c.bufferData(c.PIXEL_PACK_BUFFER,q,c.STREAM_READ),c.readPixels(t,n,i,a,g,v,0),c.bindBuffer(c.PIXEL_PACK_BUFFER,null),yield u.utils._clientWaitAsync();const Ce=new I(q/I.BYTES_PER_ELEMENT);return c.bindBuffer(c.PIXEL_PACK_BUFFER,ye),c.getBufferSubData(c.PIXEL_PACK_BUFFER,0,Ce),c.bindBuffer(c.PIXEL_PACK_BUFFER,null),u.state.bindFramebuffer(c.READ_FRAMEBUFFER,null),c.deleteFramebuffer(M),Ce})}_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 i=0;if(e===n.UNSIGNED_BYTE&&(i=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)&&(i=2),(e===n.UNSIGNED_INT||e===n.FLOAT)&&(i=4),t===n.RGBA)return i*4;if(t===n.RGB)return i*3;if(t===n.ALPHA)return i}dispose(){const{gl:e}=this;this._srcFramebuffer!==null&&e.deleteFramebuffer(this._srcFramebuffer),this._dstFramebuffer!==null&&e.deleteFramebuffer(this._dstFramebuffer)}}function P_(s){return s.isDataTexture?s.image.data:typeof HTMLImageElement!="undefined"&&s instanceof HTMLImageElement||typeof HTMLCanvasElement!="undefined"&&s instanceof HTMLCanvasElement||typeof ImageBitmap!="undefined"&&s instanceof ImageBitmap||typeof OffscreenCanvas!="undefined"&&s instanceof OffscreenCanvas?s:s.data}class q8{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 J8{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 VN={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",WEBGL_compressed_texture_s3tc:"texture-compression-s3tc",EXT_texture_compression_bptc:"texture-compression-bc",EXT_disjoint_timer_query_webgl2:"timestamp-query",OVR_multiview2:"OVR_multiview2"};class eW{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:i,object:a,type:o,info:u,index:c}=this;c!==0?n.drawElements(i,t,o,e):n.drawArrays(i,e,t),u.update(a,t,1)}renderInstances(e,t,n){const{gl:i,mode:a,type:o,index:u,object:c,info:d}=this;n!==0&&(u!==0?i.drawElementsInstanced(a,t,o,e,n):i.drawArraysInstanced(a,e,t,n),d.update(c,t,n))}renderMultiDraw(e,t,n){const{extensions:i,mode:a,object:o,info:u}=this;if(n===0)return;const c=i.get("WEBGL_multi_draw");if(c===null)for(let d=0;d<n;d++)this.render(e[d],t[d]);else{this.index!==0?c.multiDrawElementsWEBGL(a,t,0,this.type,e,0,n):c.multiDrawArraysWEBGL(a,e,0,t,0,n);let d=0;for(let g=0;g<n;g++)d+=t[g];u.update(o,d,1)}}renderMultiDrawInstances(e,t,n,i){const{extensions:a,mode:o,object:u,info:c}=this;if(n===0)return;const d=a.get("WEBGL_multi_draw");if(d===null)for(let g=0;g<n;g++)this.renderInstances(e[g],t[g],i[g]);else{this.index!==0?d.multiDrawElementsInstancedWEBGL(o,t,0,this.type,e,0,i,0,n):d.multiDrawArraysInstancedWEBGL(o,e,0,t,0,i,0,n);let g=0;for(let v=0;v<n;v++)g+=t[v]*i[v];c.update(u,g,1)}}}class zN{constructor(e=256){this.trackTimestamp=!0,this.maxQueries=e,this.currentQueryIndex=0,this.queryOffsets=new Map,this.isDisposed=!1,this.lastValue=0,this.frames=[],this.pendingResolve=!1,this.timestamps=new Map}getTimestampFrames(){return this.frames}getTimestamp(e){let t=this.timestamps.get(e);return t===void 0&&(Lr(`TimestampQueryPool: No timestamp available for uid ${e}.`),t=0),t}hasTimestamp(e){return this.timestamps.has(e)}allocateQueriesForContext(){}resolveQueriesAsync(){return Pa(this,null,function*(){})}dispose(){}}class tW extends zN{constructor(e,t,n=2048){if(super(n),this.gl=e,this.type=t,this.ext=e.getExtension("EXT_disjoint_timer_query_webgl2")||e.getExtension("EXT_disjoint_timer_query"),!this.ext){Lr("EXT_disjoint_timer_query not supported; timestamps will be disabled."),this.trackTimestamp=!1;return}this.queries=[];for(let i=0;i<this.maxQueries;i++)this.queries.push(e.createQuery());this.activeQuery=null,this.queryStates=new Map}allocateQueriesForContext(e){if(!this.trackTimestamp)return null;if(this.currentQueryIndex+2>this.maxQueries)return ki(`WebGPUTimestampQueryPool [${this.type}]: Maximum number of queries exceeded, when using trackTimestamp it is necessary to resolves the queries via renderer.resolveTimestampsAsync( THREE.TimestampQuery.${this.type.toUpperCase()} ).`),null;const t=this.currentQueryIndex;return this.currentQueryIndex+=2,this.queryStates.set(t,"inactive"),this.queryOffsets.set(e,t),t}beginQuery(e){if(!this.trackTimestamp||this.isDisposed)return;const t=this.queryOffsets.get(e);if(t==null||this.activeQuery!==null)return;const n=this.queries[t];if(n)try{this.queryStates.get(t)==="inactive"&&(this.gl.beginQuery(this.ext.TIME_ELAPSED_EXT,n),this.activeQuery=t,this.queryStates.set(t,"started"))}catch(i){Gr("Error in beginQuery:",i),this.activeQuery=null,this.queryStates.set(t,"inactive")}}endQuery(e){if(!this.trackTimestamp||this.isDisposed)return;const t=this.queryOffsets.get(e);if(t!=null&&this.activeQuery===t)try{this.gl.endQuery(this.ext.TIME_ELAPSED_EXT),this.queryStates.set(t,"ended"),this.activeQuery=null}catch(n){Gr("Error in endQuery:",n),this.queryStates.set(t,"inactive"),this.activeQuery=null}}resolveQueriesAsync(){return Pa(this,null,function*(){if(!this.trackTimestamp||this.pendingResolve)return this.lastValue;this.pendingResolve=!0;try{const e=new Map;for(const[a,o]of this.queryOffsets)if(this.queryStates.get(o)==="ended"){const c=this.queries[o];e.set(a,this.resolveQuery(c))}if(e.size===0)return this.lastValue;const t={},n=[];for(const[a,o]of e){const u=a.match(/^(.*):f(\d+)$/),c=parseInt(u[2]);n.includes(c)===!1&&n.push(c),t[c]===void 0&&(t[c]=0);const d=yield o;this.timestamps.set(a,d),t[c]+=d}const i=t[n[n.length-1]];return this.lastValue=i,this.frames=n,this.currentQueryIndex=0,this.queryOffsets.clear(),this.queryStates.clear(),this.activeQuery=null,i}catch(e){return Gr("Error resolving queries:",e),this.lastValue}finally{this.pendingResolve=!1}})}resolveQuery(e){return Pa(this,null,function*(){return new Promise(t=>{if(this.isDisposed){t(this.lastValue);return}let n,i=!1;const a=()=>{n&&(clearTimeout(n),n=null)},o=c=>{i||(i=!0,a(),t(c))},u=()=>{if(this.isDisposed){o(this.lastValue);return}try{if(this.gl.getParameter(this.ext.GPU_DISJOINT_EXT)){o(this.lastValue);return}if(!this.gl.getQueryParameter(e,this.gl.QUERY_RESULT_AVAILABLE)){n=setTimeout(u,1);return}const g=this.gl.getQueryParameter(e,this.gl.QUERY_RESULT);t(Number(g)/1e6)}catch(c){Gr("Error checking query:",c),t(this.lastValue)}};u()})})}dispose(){if(!this.isDisposed&&(this.isDisposed=!0,!!this.trackTimestamp)){for(const e of this.queries)this.gl.deleteQuery(e);this.queries=[],this.queryStates.clear(),this.queryOffsets.clear(),this.lastValue=0,this.activeQuery=null}}}class GN extends ON{constructor(e={}){super(e),this.isWebGLBackend=!0,this.attributeUtils=null,this.extensions=null,this.capabilities=null,this.textureUtils=null,this.bufferRenderer=null,this.gl=null,this.state=null,this.utils=null,this.vaoCache={},this.transformFeedbackCache={},this.discard=!1,this.disjoint=null,this.parallel=null,this._currentContext=null,this._knownBindings=new WeakSet,this._supportsInvalidateFramebuffer=typeof navigator=="undefined"?!1:/OculusBrowser/g.test(navigator.userAgent),this._xrFramebuffer=null}init(e){super.init(e);const t=this.parameters,n={antialias:e.currentSamples>0,alpha:!0,depth:e.depth,stencil:e.stencil},i=t.context!==void 0?t.context:e.domElement.getContext("webgl2",n);function a(o){o.preventDefault();const u={api:"WebGL",message:o.statusMessage||"Unknown reason",reason:null,originalEvent:o};e.onDeviceLost(u)}this._onContextLost=a,e.domElement.addEventListener("webglcontextlost",a,!1),this.gl=i,this.extensions=new q8(this),this.capabilities=new J8(this),this.attributeUtils=new $8(this),this.textureUtils=new Y8(this),this.bufferRenderer=new eW(this),this.state=new X8(this),this.utils=new j8(this),this.extensions.get("EXT_color_buffer_float"),this.extensions.get("WEBGL_clip_cull_distance"),this.extensions.get("OES_texture_float_linear"),this.extensions.get("EXT_color_buffer_half_float"),this.extensions.get("WEBGL_multisampled_render_to_texture"),this.extensions.get("WEBGL_render_shared_exponent"),this.extensions.get("WEBGL_multi_draw"),this.extensions.get("OVR_multiview2"),this.disjoint=this.extensions.get("EXT_disjoint_timer_query_webgl2"),this.parallel=this.extensions.get("KHR_parallel_shader_compile"),this.drawBuffersIndexedExt=this.extensions.get("OES_draw_buffers_indexed")}get coordinateSystem(){return gl}getArrayBufferAsync(e){return Pa(this,null,function*(){return yield this.attributeUtils.getArrayBufferAsync(e)})}makeXRCompatible(){return Pa(this,null,function*(){this.gl.getContextAttributes().xrCompatible!==!0&&(yield this.gl.makeXRCompatible())})}setXRTarget(e){this._xrFramebuffer=e}setXRRenderTargetTextures(e,t,n=null){const i=this.gl;if(this.set(e.texture,{textureGPU:t,glInternalFormat:i.RGBA8}),n!==null){const a=e.stencilBuffer?i.DEPTH24_STENCIL8:i.DEPTH_COMPONENT24;this.set(e.depthTexture,{textureGPU:n,glInternalFormat:a}),this.extensions.has("WEBGL_multisampled_render_to_texture")===!0&&e._autoAllocateDepthBuffer===!0&&e.multiview===!1&&Lr("WebGLBackend: Render-to-texture extension was disabled because an external texture was provided"),e._autoAllocateDepthBuffer=!1}}initTimestampQuery(e,t){if(!this.disjoint||!this.trackTimestamp)return;this.timestampQueryPool[e]||(this.timestampQueryPool[e]=new tW(this.gl,e,2048));const n=this.timestampQueryPool[e];n.allocateQueriesForContext(t)!==null&&n.beginQuery(t)}prepareTimestampBuffer(e,t){if(!this.disjoint||!this.trackTimestamp)return;this.timestampQueryPool[e].endQuery(t)}getContext(){return this.gl}beginRender(e){const{state:t}=this,n=this.get(e);if(e.viewport)this.updateViewport(e);else{const{width:a,height:o}=this.getDrawingBufferSize();t.viewport(0,0,a,o)}if(e.scissor){const{x:a,y:o,width:u,height:c}=e.scissorValue;t.scissor(a,e.height-c-o,u,c)}this.initTimestampQuery(ml.RENDER,this.getTimestampUID(e)),n.previousContext=this._currentContext,this._currentContext=e,this._setFramebuffer(e),this.clear(e.clearColor,e.clearDepth,e.clearStencil,e,!1);const i=e.occlusionQueryCount;i>0&&(n.currentOcclusionQueries=n.occlusionQueries,n.currentOcclusionQueryObjects=n.occlusionQueryObjects,n.lastOcclusionObject=null,n.occlusionQueries=new Array(i),n.occlusionQueryObjects=new Array(i),n.occlusionQueryIndex=0)}finishRender(e){const{gl:t,state:n}=this,i=this.get(e),a=i.previousContext;n.resetVertexState();const o=e.occlusionQueryCount;o>0&&(o>i.occlusionQueryIndex&&t.endQuery(t.ANY_SAMPLES_PASSED),this.resolveOccludedAsync(e));const u=e.textures;if(u!==null)for(let c=0;c<u.length;c++){const d=u[c];d.generateMipmaps&&this.generateMipmaps(d)}if(this._currentContext=a,this._resolveRenderTarget(e),a!==null)if(this._setFramebuffer(a),a.viewport)this.updateViewport(a);else{const{width:c,height:d}=this.getDrawingBufferSize();n.viewport(0,0,c,d)}this.prepareTimestampBuffer(ml.RENDER,this.getTimestampUID(e))}resolveOccludedAsync(e){const t=this.get(e),{currentOcclusionQueries:n,currentOcclusionQueryObjects:i}=t;if(n&&i){const a=new WeakSet,{gl:o}=this;t.currentOcclusionQueryObjects=null,t.currentOcclusionQueries=null;const u=()=>{let c=0;for(let d=0;d<n.length;d++){const g=n[d];g!==null&&o.getQueryParameter(g,o.QUERY_RESULT_AVAILABLE)&&(o.getQueryParameter(g,o.QUERY_RESULT)===0&&a.add(i[d]),n[d]=null,o.deleteQuery(g),c++)}c<n.length?requestAnimationFrame(u):t.occluded=a};u()}}isOccluded(e,t){const n=this.get(e);return n.occluded&&n.occluded.has(t)}updateViewport(e){const{state:t}=this,{x:n,y:i,width:a,height:o}=e.viewportValue;t.viewport(n,e.height-o-i,a,o)}setScissorTest(e){this.state.setScissorTest(e)}getClearColor(){const e=super.getClearColor();return e.r*=e.a,e.g*=e.a,e.b*=e.a,e}clear(e,t,n,i=null,a=!0,o=!0){const{gl:u,renderer:c}=this;i===null&&(i={textures:null,clearColorValue:this.getClearColor()});let d=0;if(e&&(d|=u.COLOR_BUFFER_BIT),t&&(d|=u.DEPTH_BUFFER_BIT),n&&(d|=u.STENCIL_BUFFER_BIT),d!==0){let g;i.clearColorValue?g=i.clearColorValue:g=this.getClearColor();const v=c.getClearDepth(),M=c.getClearStencil();if(t&&this.state.setDepthMask(!0),i.textures===null)u.clearColor(g.r,g.g,g.b,g.a),u.clear(d);else{if(a&&this._setFramebuffer(i),e)for(let B=0;B<i.textures.length;B++)B===0?u.clearBufferfv(u.COLOR,B,[g.r,g.g,g.b,g.a]):u.clearBufferfv(u.COLOR,B,[0,0,0,1]);t&&n?u.clearBufferfi(u.DEPTH_STENCIL,0,v,M):t?u.clearBufferfv(u.DEPTH,0,[v]):n&&u.clearBufferiv(u.STENCIL,0,[M]),a&&o&&this._resolveRenderTarget(i)}}}beginCompute(e){const{state:t,gl:n}=this;t.bindFramebuffer(n.FRAMEBUFFER,null),this.initTimestampQuery(ml.COMPUTE,this.getTimestampUID(e))}compute(e,t,n,i,a=null){const{state:o,gl:u}=this;this.discard===!1&&(o.enable(u.RASTERIZER_DISCARD),this.discard=!0);const{programGPU:c,transformBuffers:d,attributes:g}=this.get(i),v=this._getVaoKey(g),M=this.vaoCache[v];M===void 0?this.vaoCache[v]=this._createVao(g):o.setVertexState(M),o.useProgram(c),this._bindUniforms(n);const B=this._getTransformFeedback(d);u.bindTransformFeedback(u.TRANSFORM_FEEDBACK,B),u.beginTransformFeedback(u.POINTS),a=a!==null?a:t.count,Array.isArray(a)?(ki("WebGLBackend.compute(): The count parameter must be a single number, not an array."),a=a[0]):a&&typeof a=="object"&&a.isIndirectStorageBufferAttribute&&(ki("WebGLBackend.compute(): The count parameter must be a single number, not IndirectStorageBufferAttribute"),a=t.count),g[0].isStorageInstancedBufferAttribute?u.drawArraysInstanced(u.POINTS,0,1,a):u.drawArrays(u.POINTS,0,a),u.endTransformFeedback(),u.bindTransformFeedback(u.TRANSFORM_FEEDBACK,null);for(let I=0;I<d.length;I++){const ne=d[I];ne.pbo&&this.has(ne.pbo)&&this.textureUtils.copyBufferToTexture(ne.transformBuffer,ne.pbo),ne.switchBuffers()}}finishCompute(e){const{state:t,gl:n}=this;this.discard=!1,t.disable(n.RASTERIZER_DISCARD),this.prepareTimestampBuffer(ml.COMPUTE,this.getTimestampUID(e)),this._currentContext&&this._setFramebuffer(this._currentContext)}_isRenderCameraDepthArray(e){return e.depthTexture&&e.depthTexture.isArrayTexture&&e.camera.isArrayCamera}draw(e){const{object:t,pipeline:n,material:i,context:a,hardwareClippingPlanes:o}=e,{programGPU:u}=this.get(n),{gl:c,state:d}=this,g=this.get(a),v=e.getDrawParameters();if(v===null)return;this._bindUniforms(e.getBindings());const M=t.isMesh&&t.matrixWorld.determinant()<0;d.setMaterial(i,M,o),a.textures!==null&&a.textures.length>1&&d.setMRTBlending(a.textures),d.useProgram(u);const B=e.getAttributes(),I=this.get(B);let ne=I.vaoGPU;if(ne===void 0){const Rt=this._getVaoKey(B);ne=this.vaoCache[Rt],ne===void 0&&(ne=this._createVao(B),this.vaoCache[Rt]=ne,I.vaoGPU=ne)}const ee=e.getIndex(),q=ee!==null?this.get(ee).bufferGPU:null;d.setVertexState(ne,q);const ye=g.lastOcclusionObject;if(ye!==t&&ye!==void 0){if(ye!==null&&ye.occlusionTest===!0&&(c.endQuery(c.ANY_SAMPLES_PASSED),g.occlusionQueryIndex++),t.occlusionTest===!0){const Rt=c.createQuery();c.beginQuery(c.ANY_SAMPLES_PASSED,Rt),g.occlusionQueries[g.occlusionQueryIndex]=Rt,g.occlusionQueryObjects[g.occlusionQueryIndex]=t}g.lastOcclusionObject=t}const Ce=this.bufferRenderer;t.isPoints?Ce.mode=c.POINTS:t.isLineSegments?Ce.mode=c.LINES:t.isLine?Ce.mode=c.LINE_STRIP:t.isLineLoop?Ce.mode=c.LINE_LOOP:i.wireframe===!0?(d.setLineWidth(i.wireframeLinewidth*this.renderer.getPixelRatio()),Ce.mode=c.LINES):Ce.mode=c.TRIANGLES;const{vertexCount:ke,instanceCount:nt}=v;let{firstVertex:Ye}=v;if(Ce.object=t,ee!==null){Ye*=ee.array.BYTES_PER_ELEMENT;const Rt=this.get(ee);Ce.index=ee.count,Ce.type=Rt.type}else Ce.index=0;const ht=()=>{t.isBatchedMesh?t._multiDrawInstances!==null?(ki("WebGLBackend: renderMultiDrawInstances has been deprecated and will be removed in r184. Append to renderMultiDraw arguments and use indirection."),Ce.renderMultiDrawInstances(t._multiDrawStarts,t._multiDrawCounts,t._multiDrawCount,t._multiDrawInstances)):this.hasFeature("WEBGL_multi_draw")?Ce.renderMultiDraw(t._multiDrawStarts,t._multiDrawCounts,t._multiDrawCount):ki("WebGLBackend: WEBGL_multi_draw not supported."):nt>1?Ce.renderInstances(Ye,ke,nt):Ce.render(Ye,ke)};if(e.camera.isArrayCamera===!0&&e.camera.cameras.length>0&&e.camera.isMultiViewCamera===!1){const Rt=this.get(e.camera),qe=e.camera.cameras,pt=e.getBindingGroup("cameraIndex").bindings[0];if(Rt.indexesGPU===void 0||Rt.indexesGPU.length!==qe.length){const Dr=new Uint32Array([0,0,0,0]),Zr=[];for(let Ti=0,ds=qe.length;Ti<ds;Ti++){const As=c.createBuffer();Dr[0]=Ti,c.bindBuffer(c.UNIFORM_BUFFER,As),c.bufferData(c.UNIFORM_BUFFER,Dr,c.STATIC_DRAW),Zr.push(As)}Rt.indexesGPU=Zr}const xn=this.get(pt),cr=this.renderer.getPixelRatio(),pr=this._currentContext.renderTarget,Br=this._isRenderCameraDepthArray(this._currentContext),zr=this._currentContext.activeCubeFace;if(Br){const Dr=this.get(pr.depthTexture);if(Dr.clearedRenderId!==this.renderer._nodes.nodeFrame.renderId){Dr.clearedRenderId=this.renderer._nodes.nodeFrame.renderId;const{stencilBuffer:Zr}=pr;for(let Ti=0,ds=qe.length;Ti<ds;Ti++)this.renderer._activeCubeFace=Ti,this._currentContext.activeCubeFace=Ti,this._setFramebuffer(this._currentContext),this.clear(!1,!0,Zr,this._currentContext,!1,!1);this.renderer._activeCubeFace=zr,this._currentContext.activeCubeFace=zr}}for(let Dr=0,Zr=qe.length;Dr<Zr;Dr++){const Ti=qe[Dr];if(t.layers.test(Ti.layers)){Br&&(this.renderer._activeCubeFace=Dr,this._currentContext.activeCubeFace=Dr,this._setFramebuffer(this._currentContext));const ds=Ti.viewport;if(ds!==void 0){const As=ds.x*cr,Xr=ds.y*cr,Yi=ds.width*cr,ps=ds.height*cr;d.viewport(Math.floor(As),Math.floor(e.context.height-ps-Xr),Math.floor(Yi),Math.floor(ps))}d.bindBufferBase(c.UNIFORM_BUFFER,xn.index,Rt.indexesGPU[Dr]),ht()}this._currentContext.activeCubeFace=zr,this.renderer._activeCubeFace=zr}}else ht()}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,t=!1){this.textureUtils.destroyTexture(e,t)}copyTextureToBuffer(e,t,n,i,a,o){return Pa(this,null,function*(){return this.textureUtils.copyTextureToBuffer(e,t,n,i,a,o)})}updateSampler(){return""}createNodeBuilder(e,t){return new W8(e,t)}createProgram(e){const t=this.gl,{stage:n,code:i}=e,a=n==="fragment"?t.createShader(t.FRAGMENT_SHADER):t.createShader(t.VERTEX_SHADER);t.shaderSource(a,i),t.compileShader(a),this.set(e,{shaderGPU:a})}destroyProgram(e){this.delete(e)}createRenderPipeline(e,t){const n=this.gl,i=e.pipeline,{fragmentProgram:a,vertexProgram:o}=i,u=n.createProgram(),c=this.get(a).shaderGPU,d=this.get(o).shaderGPU;if(n.attachShader(u,c),n.attachShader(u,d),n.linkProgram(u),this.set(i,{programGPU:u,fragmentShader:c,vertexShader:d}),t!==null&&this.parallel){const g=new Promise(v=>{const M=this.parallel,B=()=>{n.getProgramParameter(u,M.COMPLETION_STATUS_KHR)?(this._completeCompile(e,i),v()):requestAnimationFrame(B)};B()});t.push(g);return}this._completeCompile(e,i)}_handleSource(e,t){const n=e.split(`
`),i=[],a=Math.max(t-6,0),o=Math.min(t+6,n.length);for(let u=a;u<o;u++){const c=u+1;i.push(`${c===t?">":" "} ${c}: ${n[u]}`)}return i.join(`
`)}_getShaderErrors(e,t,n){const i=e.getShaderParameter(t,e.COMPILE_STATUS),o=(e.getShaderInfoLog(t)||"").trim();if(i&&o==="")return"";const u=/ERROR: 0:(\d+)/.exec(o);if(u){const c=parseInt(u[1]);return n.toUpperCase()+`
`+o+`
`+this._handleSource(e.getShaderSource(t),c)}else return o}_logProgramError(e,t,n){if(this.renderer.debug.checkShaderErrors){const i=this.gl,o=(i.getProgramInfoLog(e)||"").trim();if(i.getProgramParameter(e,i.LINK_STATUS)===!1)if(typeof this.renderer.debug.onShaderError=="function")this.renderer.debug.onShaderError(i,e,n,t);else{const u=this._getShaderErrors(i,n,"vertex"),c=this._getShaderErrors(i,t,"fragment");Gr("THREE.WebGLProgram: Shader Error "+i.getError()+" - VALIDATE_STATUS "+i.getProgramParameter(e,i.VALIDATE_STATUS)+`
Program Info Log: `+o+`
`+u+`
`+c)}else o!==""&&Lr("WebGLProgram: Program Info Log:",o)}}_completeCompile(e,t){const{state:n,gl:i}=this,a=this.get(t),{programGPU:o,fragmentShader:u,vertexShader:c}=a;i.getProgramParameter(o,i.LINK_STATUS)===!1&&this._logProgramError(o,u,c),n.useProgram(o);const d=e.getBindings();this._setupBindings(d,o),this.set(t,{programGPU:o})}createComputePipeline(e,t){const{state:n,gl:i}=this,a={stage:"fragment",code:`#version 300 es
precision highp float;
void main() {}`};this.createProgram(a);const{computeProgram:o}=e,u=i.createProgram(),c=this.get(a).shaderGPU,d=this.get(o).shaderGPU,g=o.transforms,v=[],M=[];for(let ee=0;ee<g.length;ee++){const q=g[ee];v.push(q.varyingName),M.push(q.attributeNode)}i.attachShader(u,c),i.attachShader(u,d),i.transformFeedbackVaryings(u,v,i.SEPARATE_ATTRIBS),i.linkProgram(u),i.getProgramParameter(u,i.LINK_STATUS)===!1&&this._logProgramError(u,c,d),n.useProgram(u),this._setupBindings(t,u);const B=o.attributes,I=[],ne=[];for(let ee=0;ee<B.length;ee++){const q=B[ee].node.attribute;I.push(q),this.has(q)||this.attributeUtils.createAttribute(q,i.ARRAY_BUFFER)}for(let ee=0;ee<M.length;ee++){const q=M[ee].attribute;this.has(q)||this.attributeUtils.createAttribute(q,i.ARRAY_BUFFER);const ye=this.get(q);ne.push(ye)}this.set(e,{programGPU:u,transformBuffers:ne,attributes:I})}createBindings(e,t){if(this._knownBindings.has(t)===!1){this._knownBindings.add(t);let n=0,i=0;for(const a of t){this.set(a,{textures:i,uniformBuffers:n});for(const o of a.bindings)o.isUniformBuffer&&n++,o.isSampledTexture&&i++}}this.updateBindings(e,t)}updateBindings(e){const{gl:t}=this,n=this.get(e);let i=n.uniformBuffers,a=n.textures;for(const o of e.bindings){const u=this.get(o);if(o.isUniformsGroup||o.isUniformBuffer){const c=o.buffer;let{bufferGPU:d}=this.get(c);d===void 0?(d=t.createBuffer(),t.bindBuffer(t.UNIFORM_BUFFER,d),t.bufferData(t.UNIFORM_BUFFER,c.byteLength,t.DYNAMIC_DRAW),this.set(c,{bufferGPU:d})):t.bindBuffer(t.UNIFORM_BUFFER,d);const g=o.updateRanges;if(t.bindBuffer(t.UNIFORM_BUFFER,d),g.length===0)t.bufferData(t.UNIFORM_BUFFER,c,t.DYNAMIC_DRAW);else{const v=na(c),M=v?1:c.BYTES_PER_ELEMENT;for(let B=0,I=g.length;B<I;B++){const ne=g[B],ee=ne.start*M,q=ne.count*M,ye=ee*(v?c.BYTES_PER_ELEMENT:1);t.bufferSubData(t.UNIFORM_BUFFER,ye,c,ee,q)}}u.index=i++,u.bufferGPU=d,this.set(o,u)}else if(o.isSampledTexture){const{textureGPU:c,glTextureType:d}=this.get(o.texture);u.index=a++,u.textureGPU=c,u.glTextureType=d,this.set(o,u)}}}updateBinding(e){const t=this.gl;if(e.isUniformsGroup||e.isUniformBuffer){const i=this.get(e).bufferGPU,a=e.buffer,o=e.updateRanges;if(t.bindBuffer(t.UNIFORM_BUFFER,i),o.length===0)t.bufferData(t.UNIFORM_BUFFER,a,t.DYNAMIC_DRAW);else{const u=na(a),c=u?1:a.BYTES_PER_ELEMENT;for(let d=0,g=o.length;d<g;d++){const v=o[d],M=v.start*c,B=v.count*c,I=M*(u?a.BYTES_PER_ELEMENT:1);t.bufferSubData(t.UNIFORM_BUFFER,I,a,M,B)}}}}createIndexAttribute(e){const t=this.gl;this.attributeUtils.createAttribute(e,t.ELEMENT_ARRAY_BUFFER)}createAttribute(e){if(this.has(e))return;const t=this.gl;this.attributeUtils.createAttribute(e,t.ARRAY_BUFFER)}createStorageAttribute(e){if(this.has(e))return;const t=this.gl;this.attributeUtils.createAttribute(e,t.ARRAY_BUFFER)}updateAttribute(e){this.attributeUtils.updateAttribute(e)}destroyAttribute(e){this.attributeUtils.destroyAttribute(e)}hasFeature(e){const t=Object.keys(VN).filter(i=>VN[i]===e),n=this.extensions;for(let i=0;i<t.length;i++)if(n.has(t[i]))return!0;return!1}getMaxAnisotropy(){return this.capabilities.getMaxAnisotropy()}copyTextureToTexture(e,t,n=null,i=null,a=0,o=0){this.textureUtils.copyTextureToTexture(e,t,n,i,a,o)}copyFramebufferToTexture(e,t,n){this.textureUtils.copyFramebufferToTexture(e,t,n)}_setFramebuffer(e){const{gl:t,state:n}=this;let i=null;if(e.textures!==null){const a=e.renderTarget,o=this.get(a),{samples:u,depthBuffer:c,stencilBuffer:d}=a,g=a.isWebGLCubeRenderTarget===!0,v=a.isRenderTarget3D===!0,M=a.depth>1,B=a.isXRRenderTarget===!0,I=B===!0&&a._hasExternalTextures===!0;let ne=o.msaaFrameBuffer,ee=o.depthRenderbuffer;const q=this.extensions.get("WEBGL_multisampled_render_to_texture"),ye=this.extensions.get("OVR_multiview2"),Ce=this._useMultisampledExtension(a),ke=aI(e);let nt;if(g?(o.cubeFramebuffers||(o.cubeFramebuffers={}),nt=o.cubeFramebuffers[ke]):B&&I===!1?nt=this._xrFramebuffer:(o.framebuffers||(o.framebuffers={}),nt=o.framebuffers[ke]),nt===void 0){nt=t.createFramebuffer(),n.bindFramebuffer(t.FRAMEBUFFER,nt);const Ye=e.textures,ht=[];if(g){o.cubeFramebuffers[ke]=nt;const{textureGPU:qe}=this.get(Ye[0]),pt=this.renderer._activeCubeFace,xn=this.renderer._activeMipmapLevel;t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_CUBE_MAP_POSITIVE_X+pt,qe,xn)}else{o.framebuffers[ke]=nt;for(let qe=0;qe<Ye.length;qe++){const pt=Ye[qe],xn=this.get(pt);xn.renderTarget=e.renderTarget,xn.cacheKey=ke;const cr=t.COLOR_ATTACHMENT0+qe;if(a.multiview)ye.framebufferTextureMultisampleMultiviewOVR(t.FRAMEBUFFER,cr,xn.textureGPU,0,u,0,2);else if(v||M){const pr=this.renderer._activeCubeFace,Br=this.renderer._activeMipmapLevel;t.framebufferTextureLayer(t.FRAMEBUFFER,cr,xn.textureGPU,Br,pr)}else if(Ce)q.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,cr,t.TEXTURE_2D,xn.textureGPU,0,u);else{const pr=this.renderer._activeMipmapLevel;t.framebufferTexture2D(t.FRAMEBUFFER,cr,t.TEXTURE_2D,xn.textureGPU,pr)}}}const Rt=d?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT;if(a._autoAllocateDepthBuffer===!0){const qe=t.createRenderbuffer();this.textureUtils.setupRenderBufferStorage(qe,e,0,Ce),o.xrDepthRenderbuffer=qe,ht.push(d?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT),t.bindRenderbuffer(t.RENDERBUFFER,qe),t.framebufferRenderbuffer(t.FRAMEBUFFER,Rt,t.RENDERBUFFER,qe)}else if(e.depthTexture!==null){ht.push(d?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT);const qe=this.get(e.depthTexture);if(qe.renderTarget=e.renderTarget,qe.cacheKey=ke,a.multiview)ye.framebufferTextureMultisampleMultiviewOVR(t.FRAMEBUFFER,Rt,qe.textureGPU,0,u,0,2);else if(I&&Ce)q.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,Rt,t.TEXTURE_2D,qe.textureGPU,0,u);else if(e.depthTexture.isArrayTexture){const pt=this.renderer._activeCubeFace;t.framebufferTextureLayer(t.FRAMEBUFFER,Rt,qe.textureGPU,0,pt)}else if(e.depthTexture.isCubeTexture){const pt=this.renderer._activeCubeFace;t.framebufferTexture2D(t.FRAMEBUFFER,Rt,t.TEXTURE_CUBE_MAP_POSITIVE_X+pt,qe.textureGPU,0)}else t.framebufferTexture2D(t.FRAMEBUFFER,Rt,t.TEXTURE_2D,qe.textureGPU,0)}o.depthInvalidationArray=ht}else{if(this._isRenderCameraDepthArray(e)){n.bindFramebuffer(t.FRAMEBUFFER,nt);const ht=this.renderer._activeCubeFace,Rt=this.get(e.depthTexture),qe=d?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT;t.framebufferTextureLayer(t.FRAMEBUFFER,qe,Rt.textureGPU,0,ht)}if((B||Ce||a.multiview)&&a._isOpaqueFramebuffer!==!0){n.bindFramebuffer(t.FRAMEBUFFER,nt);const ht=this.get(e.textures[0]);a.multiview?ye.framebufferTextureMultisampleMultiviewOVR(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,ht.textureGPU,0,u,0,2):Ce?q.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,ht.textureGPU,0,u):t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,ht.textureGPU,0);const Rt=d?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT;if(a._autoAllocateDepthBuffer===!0){const qe=o.xrDepthRenderbuffer;t.bindRenderbuffer(t.RENDERBUFFER,qe),t.framebufferRenderbuffer(t.FRAMEBUFFER,Rt,t.RENDERBUFFER,qe)}else{const qe=this.get(e.depthTexture);a.multiview?ye.framebufferTextureMultisampleMultiviewOVR(t.FRAMEBUFFER,Rt,qe.textureGPU,0,u,0,2):Ce?q.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,Rt,t.TEXTURE_2D,qe.textureGPU,0,u):t.framebufferTexture2D(t.FRAMEBUFFER,Rt,t.TEXTURE_2D,qe.textureGPU,0)}}}if(u>0&&Ce===!1&&!a.multiview){if(ne===void 0){const Ye=[];ne=t.createFramebuffer(),n.bindFramebuffer(t.FRAMEBUFFER,ne);const ht=[],Rt=e.textures;for(let qe=0;qe<Rt.length;qe++){ht[qe]=t.createRenderbuffer(),t.bindRenderbuffer(t.RENDERBUFFER,ht[qe]),Ye.push(t.COLOR_ATTACHMENT0+qe);const pt=e.textures[qe],xn=this.get(pt);t.renderbufferStorageMultisample(t.RENDERBUFFER,u,xn.glInternalFormat,e.width,e.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0+qe,t.RENDERBUFFER,ht[qe])}if(t.bindRenderbuffer(t.RENDERBUFFER,null),o.msaaFrameBuffer=ne,o.msaaRenderbuffers=ht,c&&ee===void 0){ee=t.createRenderbuffer(),this.textureUtils.setupRenderBufferStorage(ee,e,u),o.depthRenderbuffer=ee;const qe=d?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT;Ye.push(qe)}o.invalidationArray=Ye}i=o.msaaFrameBuffer}else i=nt;n.drawBuffers(e,nt)}n.bindFramebuffer(t.FRAMEBUFFER,i)}_getVaoKey(e){let t="";for(let n=0;n<e.length;n++){const i=this.get(e[n]);t+=":"+i.id}return t}_createVao(e){const{gl:t}=this,n=t.createVertexArray();t.bindVertexArray(n);for(let i=0;i<e.length;i++){const a=e[i],o=this.get(a);t.bindBuffer(t.ARRAY_BUFFER,o.bufferGPU),t.enableVertexAttribArray(i);let u,c;a.isInterleavedBufferAttribute===!0?(u=a.data.stride*o.bytesPerElement,c=a.offset*o.bytesPerElement):(u=0,c=0),o.isInteger?t.vertexAttribIPointer(i,a.itemSize,o.type,u,c):t.vertexAttribPointer(i,a.itemSize,o.type,a.normalized,u,c),a.isInstancedBufferAttribute&&!a.isInterleavedBufferAttribute?t.vertexAttribDivisor(i,a.meshPerAttribute):a.isInterleavedBufferAttribute&&a.data.isInstancedInterleavedBuffer&&t.vertexAttribDivisor(i,a.data.meshPerAttribute)}return t.bindBuffer(t.ARRAY_BUFFER,null),n}_getTransformFeedback(e){let t="";for(let a=0;a<e.length;a++)t+=":"+e[a].id;let n=this.transformFeedbackCache[t];if(n!==void 0)return n;const{gl:i}=this;n=i.createTransformFeedback(),i.bindTransformFeedback(i.TRANSFORM_FEEDBACK,n);for(let a=0;a<e.length;a++){const o=e[a];i.bindBufferBase(i.TRANSFORM_FEEDBACK_BUFFER,a,o.transformBuffer)}return i.bindTransformFeedback(i.TRANSFORM_FEEDBACK,null),this.transformFeedbackCache[t]=n,n}_setupBindings(e,t){const n=this.gl;for(const i of e)for(const a of i.bindings){const u=this.get(a).index;if(a.isUniformsGroup||a.isUniformBuffer){const c=n.getUniformBlockIndex(t,a.name);n.uniformBlockBinding(t,c,u)}else if(a.isSampledTexture){const c=n.getUniformLocation(t,a.name);n.uniform1i(c,u)}}}_bindUniforms(e){const{gl:t,state:n}=this;for(const i of e)for(const a of i.bindings){const o=this.get(a),u=o.index;a.isUniformsGroup||a.isUniformBuffer?n.bindBufferBase(t.UNIFORM_BUFFER,u,o.bufferGPU):a.isSampledTexture&&n.bindTexture(o.glTextureType,o.textureGPU,t.TEXTURE0+u)}}_resolveRenderTarget(e){const{gl:t,state:n}=this,i=e.renderTarget;if(e.textures!==null&&i){const a=this.get(i);if(i.samples>0&&this._useMultisampledExtension(i)===!1){const o=a.framebuffers[e.getCacheKey()];let u=t.COLOR_BUFFER_BIT;i.resolveDepthBuffer&&(i.depthBuffer&&(u|=t.DEPTH_BUFFER_BIT),i.stencilBuffer&&i.resolveStencilBuffer&&(u|=t.STENCIL_BUFFER_BIT));const c=a.msaaFrameBuffer,d=a.msaaRenderbuffers,g=e.textures,v=g.length>1;if(n.bindFramebuffer(t.READ_FRAMEBUFFER,c),n.bindFramebuffer(t.DRAW_FRAMEBUFFER,o),v)for(let M=0;M<g.length;M++)t.framebufferRenderbuffer(t.READ_FRAMEBUFFER,t.COLOR_ATTACHMENT0+M,t.RENDERBUFFER,null),t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0+M,t.TEXTURE_2D,null,0);for(let M=0;M<g.length;M++){if(v){const{textureGPU:B}=this.get(g[M]);t.framebufferRenderbuffer(t.READ_FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.RENDERBUFFER,d[M]),t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,B,0)}if(e.scissor){const{x:B,y:I,width:ne,height:ee}=e.scissorValue,q=e.height-ee-I;t.blitFramebuffer(B,q,B+ne,q+ee,B,q,B+ne,q+ee,u,t.NEAREST)}else t.blitFramebuffer(0,0,e.width,e.height,0,0,e.width,e.height,u,t.NEAREST)}if(v)for(let M=0;M<g.length;M++){const{textureGPU:B}=this.get(g[M]);t.framebufferRenderbuffer(t.READ_FRAMEBUFFER,t.COLOR_ATTACHMENT0+M,t.RENDERBUFFER,d[M]),t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0+M,t.TEXTURE_2D,B,0)}this._supportsInvalidateFramebuffer===!0&&t.invalidateFramebuffer(t.READ_FRAMEBUFFER,a.invalidationArray)}else if(i.resolveDepthBuffer===!1&&a.framebuffers){const o=a.framebuffers[e.getCacheKey()];n.bindFramebuffer(t.DRAW_FRAMEBUFFER,o),t.invalidateFramebuffer(t.DRAW_FRAMEBUFFER,a.depthInvalidationArray)}}}_useMultisampledExtension(e){return e.multiview===!0?!0:e.samples>0&&this.extensions.has("WEBGL_multisampled_render_to_texture")===!0&&e._autoAllocateDepthBuffer!==!1}dispose(){this.textureUtils!==null&&this.textureUtils.dispose();const e=this.extensions.get("WEBGL_lose_context");e&&e.loseContext(),this.renderer.domElement.removeEventListener("webglcontextlost",this._onContextLost)}}const kv={PointList:"point-list",LineList:"line-list",LineStrip:"line-strip",TriangleList:"triangle-list",TriangleStrip:"triangle-strip"},C0=typeof self!="undefined"?self.GPUShaderStage:{VERTEX:1,FRAGMENT:2,COMPUTE:4},dd={Never:"never",Less:"less",Equal:"equal",LessEqual:"less-equal",Greater:"greater",NotEqual:"not-equal",GreaterEqual:"greater-equal",Always:"always"},uf={Store:"store"},Kl={Load:"load",Clear:"clear"},HN={CCW:"ccw",CW:"cw"},QN={None:"none",Back:"back"},Vv={Uint16:"uint16",Uint32:"uint32"},sr={R8Unorm:"r8unorm",R8Snorm:"r8snorm",R8Uint:"r8uint",R8Sint:"r8sint",R16Uint:"r16uint",R16Sint:"r16sint",R16Float:"r16float",RG8Unorm:"rg8unorm",RG8Snorm:"rg8snorm",RG8Uint:"rg8uint",RG8Sint:"rg8sint",R32Uint:"r32uint",R32Sint:"r32sint",R32Float:"r32float",RG16Uint:"rg16uint",RG16Sint:"rg16sint",RG16Float:"rg16float",RGBA8Unorm:"rgba8unorm",RGBA8UnormSRGB:"rgba8unorm-srgb",RGBA8Snorm:"rgba8snorm",RGBA8Uint:"rgba8uint",RGBA8Sint:"rgba8sint",BGRA8Unorm:"bgra8unorm",BGRA8UnormSRGB:"bgra8unorm-srgb",RGB9E5UFloat:"rgb9e5ufloat",RGB10A2Unorm:"rgb10a2unorm",RG11B10UFloat:"rg11b10ufloat",RG32Uint:"rg32uint",RG32Sint:"rg32sint",RG32Float:"rg32float",RGBA16Uint:"rgba16uint",RGBA16Sint:"rgba16sint",RGBA16Float:"rgba16float",RGBA32Uint:"rgba32uint",RGBA32Sint:"rgba32sint",RGBA32Float:"rgba32float",Depth16Unorm:"depth16unorm",Depth24Plus:"depth24plus",Depth24PlusStencil8:"depth24plus-stencil8",Depth32Float:"depth32float",Depth32FloatStencil8:"depth32float-stencil8",BC1RGBAUnorm:"bc1-rgba-unorm",BC1RGBAUnormSRGB:"bc1-rgba-unorm-srgb",BC2RGBAUnorm:"bc2-rgba-unorm",BC2RGBAUnormSRGB:"bc2-rgba-unorm-srgb",BC3RGBAUnorm:"bc3-rgba-unorm",BC3RGBAUnormSRGB:"bc3-rgba-unorm-srgb",BC4RUnorm:"bc4-r-unorm",BC4RSnorm:"bc4-r-snorm",BC5RGUnorm:"bc5-rg-unorm",BC5RGSnorm:"bc5-rg-snorm",BC6HRGBUFloat:"bc6h-rgb-ufloat",BC6HRGBFloat:"bc6h-rgb-float",BC7RGBAUnorm:"bc7-rgba-unorm",BC7RGBAUnormSRGB:"bc7-rgba-unorm-srgb",ETC2RGB8Unorm:"etc2-rgb8unorm",ETC2RGB8UnormSRGB:"etc2-rgb8unorm-srgb",ETC2RGB8A1Unorm:"etc2-rgb8a1unorm",ETC2RGB8A1UnormSRGB:"etc2-rgb8a1unorm-srgb",ETC2RGBA8Unorm:"etc2-rgba8unorm",ETC2RGBA8UnormSRGB:"etc2-rgba8unorm-srgb",EACR11Unorm:"eac-r11unorm",EACR11Snorm:"eac-r11snorm",EACRG11Unorm:"eac-rg11unorm",EACRG11Snorm:"eac-rg11snorm",ASTC4x4Unorm:"astc-4x4-unorm",ASTC4x4UnormSRGB:"astc-4x4-unorm-srgb",ASTC5x4Unorm:"astc-5x4-unorm",ASTC5x4UnormSRGB:"astc-5x4-unorm-srgb",ASTC5x5Unorm:"astc-5x5-unorm",ASTC5x5UnormSRGB:"astc-5x5-unorm-srgb",ASTC6x5Unorm:"astc-6x5-unorm",ASTC6x5UnormSRGB:"astc-6x5-unorm-srgb",ASTC6x6Unorm:"astc-6x6-unorm",ASTC6x6UnormSRGB:"astc-6x6-unorm-srgb",ASTC8x5Unorm:"astc-8x5-unorm",ASTC8x5UnormSRGB:"astc-8x5-unorm-srgb",ASTC8x6Unorm:"astc-8x6-unorm",ASTC8x6UnormSRGB:"astc-8x6-unorm-srgb",ASTC8x8Unorm:"astc-8x8-unorm",ASTC8x8UnormSRGB:"astc-8x8-unorm-srgb",ASTC10x5Unorm:"astc-10x5-unorm",ASTC10x5UnormSRGB:"astc-10x5-unorm-srgb",ASTC10x6Unorm:"astc-10x6-unorm",ASTC10x6UnormSRGB:"astc-10x6-unorm-srgb",ASTC10x8Unorm:"astc-10x8-unorm",ASTC10x8UnormSRGB:"astc-10x8-unorm-srgb",ASTC10x10Unorm:"astc-10x10-unorm",ASTC10x10UnormSRGB:"astc-10x10-unorm-srgb",ASTC12x10Unorm:"astc-12x10-unorm",ASTC12x10UnormSRGB:"astc-12x10-unorm-srgb",ASTC12x12Unorm:"astc-12x12-unorm",ASTC12x12UnormSRGB:"astc-12x12-unorm-srgb"},HM={ClampToEdge:"clamp-to-edge",Repeat:"repeat",MirrorRepeat:"mirror-repeat"},T0={Linear:"linear",Nearest:"nearest"},hl={Zero:"zero",One:"one",Src:"src",OneMinusSrc:"one-minus-src",SrcAlpha:"src-alpha",OneMinusSrcAlpha:"one-minus-src-alpha",Dst:"dst",OneMinusDst:"one-minus-dst",DstAlpha:"dst-alpha",OneMinusDstAlpha:"one-minus-dst-alpha",SrcAlphaSaturated:"src-alpha-saturated",Constant:"constant",OneMinusConstant:"one-minus-constant"},B0={Add:"add",Subtract:"subtract",ReverseSubtract:"reverse-subtract",Min:"min",Max:"max"},WN={None:0,All:15},Qm={Keep:"keep",Zero:"zero",Replace:"replace",Invert:"invert",IncrementClamp:"increment-clamp",DecrementClamp:"decrement-clamp",IncrementWrap:"increment-wrap",DecrementWrap:"decrement-wrap"},QM={Storage:"storage",ReadOnlyStorage:"read-only-storage"},WM={WriteOnly:"write-only",ReadOnly:"read-only",ReadWrite:"read-write"},ZN={NonFiltering:"non-filtering",Comparison:"comparison"},R0={Float:"float",UnfilterableFloat:"unfilterable-float",Depth:"depth",SInt:"sint",UInt:"uint"},KN={TwoD:"2d",ThreeD:"3d"},hh={TwoD:"2d",TwoDArray:"2d-array",Cube:"cube",ThreeD:"3d"},nW={All:"all"},L_={Vertex:"vertex",Instance:"instance"},ZM={CoreFeaturesAndLimits:"core-features-and-limits",DepthClipControl:"depth-clip-control",Depth32FloatStencil8:"depth32float-stencil8",TextureCompressionBC:"texture-compression-bc",TextureCompressionBCSliced3D:"texture-compression-bc-sliced-3d",TextureCompressionETC2:"texture-compression-etc2",TextureCompressionASTC:"texture-compression-astc",TextureCompressionASTCSliced3D:"texture-compression-astc-sliced-3d",TimestampQuery:"timestamp-query",IndirectFirstInstance:"indirect-first-instance",ShaderF16:"shader-f16",RG11B10UFloat:"rg11b10ufloat-renderable",BGRA8UNormStorage:"bgra8unorm-storage",Float32Filterable:"float32-filterable",Float32Blendable:"float32-blendable",ClipDistances:"clip-distances",DualSourceBlending:"dual-source-blending",Subgroups:"subgroups",TextureFormatsTier1:"texture-formats-tier1",TextureFormatsTier2:"texture-formats-tier2"},$N={"texture-compression-s3tc":"texture-compression-bc","texture-compression-etc1":"texture-compression-etc2"};class rW extends RN{constructor(e,t,n){super(e,t?t.value:null),this.textureNode=t,this.groupNode=n}update(){const{textureNode:e}=this;return this.texture!==e.value?(this.texture=e.value,!0):super.update()}}class iW extends EN{constructor(e,t){super(e,t?t.array:null),this.attribute=t,this.isStorageBuffer=!0}}let sW=0;class aW extends iW{constructor(e,t){super("StorageBuffer_"+sW++,e?e.value:null),this.nodeUniform=e,this.access=e?e.access:od.READ_WRITE,this.groupNode=t}get buffer(){return this.nodeUniform.value}}class oW extends Vm{constructor(e){super(),this.device=e;const t=`
struct VarysStruct {
@builtin( position ) Position: vec4<f32>,
@location( 0 ) vTex : vec2<f32>
};
@vertex
fn main( @builtin( vertex_index ) vertexIndex : u32 ) -> VarysStruct {
var Varys : VarysStruct;
var pos = array< vec2<f32>, 4 >(
vec2<f32>( -1.0, 1.0 ),
vec2<f32>( 1.0, 1.0 ),
vec2<f32>( -1.0, -1.0 ),
vec2<f32>( 1.0, -1.0 )
);
var tex = array< vec2<f32>, 4 >(
vec2<f32>( 0.0, 0.0 ),
vec2<f32>( 1.0, 0.0 ),
vec2<f32>( 0.0, 1.0 ),
vec2<f32>( 1.0, 1.0 )
);
Varys.vTex = tex[ vertexIndex ];
Varys.Position = vec4<f32>( pos[ vertexIndex ], 0.0, 1.0 );
return Varys;
}
`,n=`
@group( 0 ) @binding( 0 )
var imgSampler : sampler;
@group( 0 ) @binding( 1 )
var img : texture_2d<f32>;
@fragment
fn main( @location( 0 ) vTex : vec2<f32> ) -> @location( 0 ) vec4<f32> {
return textureSample( img, imgSampler, vTex );
}
`,i=`
@group( 0 ) @binding( 0 )
var imgSampler : sampler;
@group( 0 ) @binding( 1 )
var img : texture_2d<f32>;
@fragment
fn main( @location( 0 ) vTex : vec2<f32> ) -> @location( 0 ) vec4<f32> {
return textureSample( img, imgSampler, vec2( vTex.x, 1.0 - vTex.y ) );
}
`;this.mipmapSampler=e.createSampler({minFilter:T0.Linear}),this.flipYSampler=e.createSampler({minFilter:T0.Nearest}),this.transferPipelines={},this.flipYPipelines={},this.mipmapVertexShaderModule=e.createShaderModule({label:"mipmapVertex",code:t}),this.mipmapFragmentShaderModule=e.createShaderModule({label:"mipmapFragment",code:n}),this.flipYFragmentShaderModule=e.createShaderModule({label:"flipYFragment",code:i})}getTransferPipeline(e){let t=this.transferPipelines[e];return t===void 0&&(t=this.device.createRenderPipeline({label:`mipmap-${e}`,vertex:{module:this.mipmapVertexShaderModule,entryPoint:"main"},fragment:{module:this.mipmapFragmentShaderModule,entryPoint:"main",targets:[{format:e}]},primitive:{topology:kv.TriangleStrip,stripIndexFormat:Vv.Uint32},layout:"auto"}),this.transferPipelines[e]=t),t}getFlipYPipeline(e){let t=this.flipYPipelines[e];return t===void 0&&(t=this.device.createRenderPipeline({label:`flipY-${e}`,vertex:{module:this.mipmapVertexShaderModule,entryPoint:"main"},fragment:{module:this.flipYFragmentShaderModule,entryPoint:"main",targets:[{format:e}]},primitive:{topology:kv.TriangleStrip,stripIndexFormat:Vv.Uint32},layout:"auto"}),this.flipYPipelines[e]=t),t}flipY(e,t,n=0){const i=t.format,{width:a,height:o}=t.size,u=this.getTransferPipeline(i),c=this.getFlipYPipeline(i),d=this.device.createTexture({size:{width:a,height:o,depthOrArrayLayers:1},format:i,usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING}),g=e.createView({baseMipLevel:0,mipLevelCount:1,dimension:hh.TwoD,baseArrayLayer:n}),v=d.createView({baseMipLevel:0,mipLevelCount:1,dimension:hh.TwoD,baseArrayLayer:0}),M=this.device.createCommandEncoder({}),B=(I,ne,ee)=>{const q=I.getBindGroupLayout(0),ye=this.device.createBindGroup({layout:q,entries:[{binding:0,resource:this.flipYSampler},{binding:1,resource:ne}]}),Ce=M.beginRenderPass({colorAttachments:[{view:ee,loadOp:Kl.Clear,storeOp:uf.Store,clearValue:[0,0,0,0]}]});Ce.setPipeline(I),Ce.setBindGroup(0,ye),Ce.draw(4,1,0,0),Ce.end()};B(u,g,v),B(c,v,g),this.device.queue.submit([M.finish()]),d.destroy()}generateMipmaps(e,t,n=0,i=null){const a=this.get(e);a.layers===void 0&&(a.layers=[]);const o=a.layers[n]||this._mipmapCreateBundles(e,t,n),u=i||this.device.createCommandEncoder({label:"mipmapEncoder"});this._mipmapRunBundles(u,o),i===null&&this.device.queue.submit([u.finish()]),a.layers[n]=o}_mipmapCreateBundles(e,t,n){const i=this.getTransferPipeline(t.format),a=i.getBindGroupLayout(0);let o=e.createView({baseMipLevel:0,mipLevelCount:1,dimension:hh.TwoD,baseArrayLayer:n});const u=[];for(let c=1;c<t.mipLevelCount;c++){const d=this.device.createBindGroup({layout:a,entries:[{binding:0,resource:this.mipmapSampler},{binding:1,resource:o}]}),g=e.createView({baseMipLevel:c,mipLevelCount:1,dimension:hh.TwoD,baseArrayLayer:n}),v={colorAttachments:[{view:g,loadOp:Kl.Clear,storeOp:uf.Store,clearValue:[0,0,0,0]}]},M=this.device.createRenderBundleEncoder({colorFormats:[t.format]});M.setPipeline(i),M.setBindGroup(0,d),M.draw(4,1,0,0),u.push({renderBundles:[M.finish()],passDescriptor:v}),o=g}return u}_mipmapRunBundles(e,t){const n=t.length;for(let i=0;i<n;i++){const a=t[i],o=e.beginRenderPass(a.passDescriptor);o.executeBundles(a.renderBundles),o.end()}}}const lW={[gu]:"never",[oo]:"less",[Ic]:"equal",[jc]:"less-equal",[ph]:"greater",[Ji]:"greater-equal",[$u]:"always",[Lo]:"not-equal"},uW=[0,1,3,2,4,5];class cW{constructor(e){this.backend=e,this._passUtils=null,this.defaultTexture={},this.defaultCubeTexture={},this.defaultVideoFrame=null,this._samplerCache=new Map}updateSampler(e){const t=this.backend,n=e.minFilter+"-"+e.magFilter+"-"+e.wrapS+"-"+e.wrapT+"-"+(e.wrapR||"0")+"-"+e.anisotropy+"-"+(e.compareFunction||0);let i=this._samplerCache.get(n);if(i===void 0){const o={addressModeU:this._convertAddressMode(e.wrapS),addressModeV:this._convertAddressMode(e.wrapT),addressModeW:this._convertAddressMode(e.wrapR),magFilter:this._convertFilterMode(e.magFilter),minFilter:this._convertFilterMode(e.minFilter),mipmapFilter:this._convertFilterMode(e.minFilter),maxAnisotropy:1};o.magFilter===T0.Linear&&o.minFilter===T0.Linear&&o.mipmapFilter===T0.Linear&&(o.maxAnisotropy=e.anisotropy),e.isDepthTexture&&e.compareFunction!==null&&(o.compare=lW[e.compareFunction]),i={sampler:t.device.createSampler(o),usedTimes:0},this._samplerCache.set(n,i)}const a=t.get(e);if(a.sampler!==i.sampler){if(a.sampler!==void 0){const o=this._samplerCache.get(a.samplerKey);o.usedTimes--,o.usedTimes===0&&this._samplerCache.delete(a.samplerKey)}a.samplerKey=n,a.sampler=i.sampler,i.usedTimes++}return n}createDefaultTexture(e){let t;const n=KM(e);e.isCubeTexture?t=this._getDefaultCubeTextureGPU(n):t=this._getDefaultTextureGPU(n),this.backend.get(e).texture=t}createTexture(e,t={}){const n=this.backend,i=n.get(e);if(i.initialized)throw new Error("WebGPUTextureUtils: Texture already initialized.");if(e.isExternalTexture){i.texture=e.sourceTexture,i.initialized=!0;return}t.needsMipmaps===void 0&&(t.needsMipmaps=!1),t.levels===void 0&&(t.levels=1),t.depth===void 0&&(t.depth=1);const{width:a,height:o,depth:u,levels:c}=t;e.isFramebufferTexture&&(t.renderTarget?t.format=this.backend.utils.getCurrentColorFormat(t.renderTarget):t.format=this.backend.utils.getPreferredCanvasFormat());const d=this._getDimension(e),g=e.internalFormat||t.format||KM(e,n.device);i.format=g;const{samples:v,primarySamples:M,isMSAA:B}=n.utils.getTextureSampleData(e);let I=GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.COPY_SRC;e.isStorageTexture===!0&&(I|=GPUTextureUsage.STORAGE_BINDING),e.isCompressedTexture!==!0&&e.isCompressedArrayTexture!==!0&&g!==sr.RGB9E5UFloat&&(I|=GPUTextureUsage.RENDER_ATTACHMENT);const ne={label:e.name,size:{width:a,height:o,depthOrArrayLayers:u},mipLevelCount:c,sampleCount:M,dimension:d,format:g,usage:I};if(g===void 0){Lr("WebGPURenderer: Texture format not supported."),this.createDefaultTexture(e);return}if(e.isCubeTexture&&(ne.textureBindingViewDimension=hh.Cube),i.texture=n.device.createTexture(ne),B){const ee=Object.assign({},ne);ee.label=ee.label+"-msaa",ee.sampleCount=v,ee.mipLevelCount=1,i.msaaTexture=n.device.createTexture(ee)}i.initialized=!0,i.textureDescriptorGPU=ne}destroyTexture(e,t=!1){const n=this.backend,i=n.get(e);i.texture!==void 0&&t===!1&&i.texture.destroy(),i.msaaTexture!==void 0&&i.msaaTexture.destroy(),n.delete(e)}generateMipmaps(e,t=null){const n=this.backend.get(e);if(e.isCubeTexture)for(let i=0;i<6;i++)this._generateMipmaps(n.texture,n.textureDescriptorGPU,i,t);else{const i=e.image.depth||1;for(let a=0;a<i;a++)this._generateMipmaps(n.texture,n.textureDescriptorGPU,a,t)}}getColorBuffer(){const e=this.backend,t=e.renderer.getCanvasTarget(),{width:n,height:i}=e.getDrawingBufferSize(),a=e.renderer.currentSamples,o=t.colorTexture,u=e.get(o);if(o.width===n&&o.height===i&&o.samples===a)return u.texture;let c=u.texture;return c&&c.destroy(),c=e.device.createTexture({label:"colorBuffer",size:{width:n,height:i,depthOrArrayLayers:1},sampleCount:e.utils.getSampleCount(e.renderer.currentSamples),format:e.utils.getPreferredCanvasFormat(),usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.COPY_SRC}),o.source.width=n,o.source.height=i,o.samples=a,u.texture=c,c}getDepthBuffer(e=!0,t=!1){const n=this.backend,i=n.renderer.getCanvasTarget(),{width:a,height:o}=n.getDrawingBufferSize(),u=n.renderer.currentSamples,c=i.depthTexture;if(c.width===a&&c.height===o&&c.samples===u&&c.depth===e&&c.stencil===t)return n.get(c).texture;const d=n.get(c).texture;let g,v;if(t?(g=w,v=ar):e&&(g=Q,v=st),d!==void 0){if(c.image.width===a&&c.image.height===o&&c.format===g&&c.type===v&&c.samples===u)return d;this.destroyTexture(c)}return c.name="depthBuffer",c.format=g,c.type=v,c.image.width=a,c.image.height=o,c.samples=u,this.createTexture(c,{width:a,height:o}),n.get(c).texture}updateTexture(e,t){const n=this.backend.get(e),i=e.mipmaps,{textureDescriptorGPU:a}=n;if(!(e.isRenderTargetTexture||a===void 0)){if(e.isDataTexture)if(i.length>0)for(let o=0,u=i.length;o<u;o++){const c=i[o];this._copyBufferToTexture(c,n.texture,a,0,e.flipY,0,o)}else this._copyBufferToTexture(t.image,n.texture,a,0,e.flipY);else if(e.isArrayTexture||e.isDataArrayTexture||e.isData3DTexture)for(let o=0;o<t.image.depth;o++)this._copyBufferToTexture(t.image,n.texture,a,o,e.flipY,o);else if(e.isCompressedTexture||e.isCompressedArrayTexture)this._copyCompressedBufferToTexture(e.mipmaps,n.texture,a);else if(e.isCubeTexture)this._copyCubeMapToTexture(e,n.texture,a);else if(i.length>0)for(let o=0,u=i.length;o<u;o++){const c=i[o];this._copyImageToTexture(c,n.texture,a,0,e.flipY,e.premultiplyAlpha,o)}else this._copyImageToTexture(t.image,n.texture,a,0,e.flipY,e.premultiplyAlpha);n.version=e.version}}copyTextureToBuffer(e,t,n,i,a,o){return Pa(this,null,function*(){const u=this.backend.device,c=this.backend.get(e),d=c.texture,g=c.textureDescriptorGPU.format,v=this._getBytesPerTexel(g);let M=i*v;M=Math.ceil(M/256)*256;const B=u.createBuffer({size:(a-1)*M+i*v,usage:GPUBufferUsage.COPY_DST|GPUBufferUsage.MAP_READ}),I=u.createCommandEncoder();I.copyTextureToBuffer({texture:d,origin:{x:t,y:n,z:o}},{buffer:B,bytesPerRow:M},{width:i,height:a});const ne=this._getTypedArrayType(g);u.queue.submit([I.finish()]),yield B.mapAsync(GPUMapMode.READ);const ee=B.getMappedRange();return new ne(ee)})}dispose(){this._samplerCache.clear()}_getDefaultTextureGPU(e){let t=this.defaultTexture[e];if(t===void 0){const n=new zi;n.minFilter=cn,n.magFilter=cn,this.createTexture(n,{width:1,height:1,format:e}),this.defaultTexture[e]=t=n}return this.backend.get(t).texture}_getDefaultCubeTextureGPU(e){let t=this.defaultCubeTexture[e];if(t===void 0){const n=new rh;n.minFilter=cn,n.magFilter=cn,this.createTexture(n,{width:1,height:1,depth:6}),this.defaultCubeTexture[e]=t=n}return this.backend.get(t).texture}_copyCubeMapToTexture(e,t,n){const i=e.images,a=e.mipmaps;for(let o=0;o<6;o++){const u=i[o],c=e.flipY===!0?uW[o]:o;u.isDataTexture?this._copyBufferToTexture(u.image,t,n,c,e.flipY):this._copyImageToTexture(u,t,n,c,e.flipY,e.premultiplyAlpha);for(let d=0;d<a.length;d++){const v=a[d].images[o];v.isDataTexture?this._copyBufferToTexture(v.image,t,n,c,e.flipY,0,d+1):this._copyImageToTexture(v,t,n,c,e.flipY,e.premultiplyAlpha,d+1)}}}_copyImageToTexture(e,t,n,i,a,o,u=0){const c=this.backend.device,d=u>0?e.width:n.size.width,g=u>0?e.height:n.size.height;try{c.queue.copyExternalImageToTexture({source:e,flipY:a},{texture:t,mipLevel:u,origin:{x:0,y:0,z:i},premultipliedAlpha:o},{width:d,height:g,depthOrArrayLayers:1})}catch(v){}}_getPassUtils(){let e=this._passUtils;return e===null&&(this._passUtils=e=new oW(this.backend.device)),e}_generateMipmaps(e,t,n=0,i=null){this._getPassUtils().generateMipmaps(e,t,n,i)}_flipY(e,t,n=0){this._getPassUtils().flipY(e,t,n)}_copyBufferToTexture(e,t,n,i,a,o=0,u=0){const c=this.backend.device,d=e.data,g=this._getBytesPerTexel(n.format),v=e.width*g;c.queue.writeTexture({texture:t,mipLevel:u,origin:{x:0,y:0,z:i}},d,{offset:e.width*e.height*g*o,bytesPerRow:v},{width:e.width,height:e.height,depthOrArrayLayers:1}),a===!0&&this._flipY(t,n,i)}_copyCompressedBufferToTexture(e,t,n){const i=this.backend.device,a=this._getBlockData(n.format),o=n.size.depthOrArrayLayers>1;for(let u=0;u<e.length;u++){const c=e[u],d=c.width,g=c.height,v=o?n.size.depthOrArrayLayers:1,M=Math.ceil(d/a.width)*a.byteLength,B=M*Math.ceil(g/a.height);for(let I=0;I<v;I++)i.queue.writeTexture({texture:t,mipLevel:u,origin:{x:0,y:0,z:I}},c.data,{offset:I*B,bytesPerRow:M,rowsPerImage:Math.ceil(g/a.height)},{width:Math.ceil(d/a.width)*a.width,height:Math.ceil(g/a.height)*a.height,depthOrArrayLayers:1})}}_getBlockData(e){if(e===sr.BC1RGBAUnorm||e===sr.BC1RGBAUnormSRGB)return{byteLength:8,width:4,height:4};if(e===sr.BC2RGBAUnorm||e===sr.BC2RGBAUnormSRGB)return{byteLength:16,width:4,height:4};if(e===sr.BC3RGBAUnorm||e===sr.BC3RGBAUnormSRGB)return{byteLength:16,width:4,height:4};if(e===sr.BC4RUnorm||e===sr.BC4RSnorm)return{byteLength:8,width:4,height:4};if(e===sr.BC5RGUnorm||e===sr.BC5RGSnorm)return{byteLength:16,width:4,height:4};if(e===sr.BC6HRGBUFloat||e===sr.BC6HRGBFloat)return{byteLength:16,width:4,height:4};if(e===sr.BC7RGBAUnorm||e===sr.BC7RGBAUnormSRGB)return{byteLength:16,width:4,height:4};if(e===sr.ETC2RGB8Unorm||e===sr.ETC2RGB8UnormSRGB)return{byteLength:8,width:4,height:4};if(e===sr.ETC2RGB8A1Unorm||e===sr.ETC2RGB8A1UnormSRGB)return{byteLength:8,width:4,height:4};if(e===sr.ETC2RGBA8Unorm||e===sr.ETC2RGBA8UnormSRGB)return{byteLength:16,width:4,height:4};if(e===sr.EACR11Unorm)return{byteLength:8,width:4,height:4};if(e===sr.EACR11Snorm)return{byteLength:8,width:4,height:4};if(e===sr.EACRG11Unorm)return{byteLength:16,width:4,height:4};if(e===sr.EACRG11Snorm)return{byteLength:16,width:4,height:4};if(e===sr.ASTC4x4Unorm||e===sr.ASTC4x4UnormSRGB)return{byteLength:16,width:4,height:4};if(e===sr.ASTC5x4Unorm||e===sr.ASTC5x4UnormSRGB)return{byteLength:16,width:5,height:4};if(e===sr.ASTC5x5Unorm||e===sr.ASTC5x5UnormSRGB)return{byteLength:16,width:5,height:5};if(e===sr.ASTC6x5Unorm||e===sr.ASTC6x5UnormSRGB)return{byteLength:16,width:6,height:5};if(e===sr.ASTC6x6Unorm||e===sr.ASTC6x6UnormSRGB)return{byteLength:16,width:6,height:6};if(e===sr.ASTC8x5Unorm||e===sr.ASTC8x5UnormSRGB)return{byteLength:16,width:8,height:5};if(e===sr.ASTC8x6Unorm||e===sr.ASTC8x6UnormSRGB)return{byteLength:16,width:8,height:6};if(e===sr.ASTC8x8Unorm||e===sr.ASTC8x8UnormSRGB)return{byteLength:16,width:8,height:8};if(e===sr.ASTC10x5Unorm||e===sr.ASTC10x5UnormSRGB)return{byteLength:16,width:10,height:5};if(e===sr.ASTC10x6Unorm||e===sr.ASTC10x6UnormSRGB)return{byteLength:16,width:10,height:6};if(e===sr.ASTC10x8Unorm||e===sr.ASTC10x8UnormSRGB)return{byteLength:16,width:10,height:8};if(e===sr.ASTC10x10Unorm||e===sr.ASTC10x10UnormSRGB)return{byteLength:16,width:10,height:10};if(e===sr.ASTC12x10Unorm||e===sr.ASTC12x10UnormSRGB)return{byteLength:16,width:12,height:10};if(e===sr.ASTC12x12Unorm||e===sr.ASTC12x12UnormSRGB)return{byteLength:16,width:12,height:12}}_convertAddressMode(e){let t=HM.ClampToEdge;return e===$t?t=HM.Repeat:e===Qt&&(t=HM.MirrorRepeat),t}_convertFilterMode(e){let t=T0.Linear;return(e===cn||e===Yn||e===Sr)&&(t=T0.Nearest),t}_getBytesPerTexel(e){if(e===sr.R8Unorm||e===sr.R8Snorm||e===sr.R8Uint||e===sr.R8Sint)return 1;if(e===sr.R16Uint||e===sr.R16Sint||e===sr.R16Float||e===sr.RG8Unorm||e===sr.RG8Snorm||e===sr.RG8Uint||e===sr.RG8Sint)return 2;if(e===sr.R32Uint||e===sr.R32Sint||e===sr.R32Float||e===sr.RG16Uint||e===sr.RG16Sint||e===sr.RG16Float||e===sr.RGBA8Unorm||e===sr.RGBA8UnormSRGB||e===sr.RGBA8Snorm||e===sr.RGBA8Uint||e===sr.RGBA8Sint||e===sr.BGRA8Unorm||e===sr.BGRA8UnormSRGB||e===sr.RGB9E5UFloat||e===sr.RGB10A2Unorm||e===sr.RG11B10UFloat||e===sr.Depth32Float||e===sr.Depth24Plus||e===sr.Depth24PlusStencil8||e===sr.Depth32FloatStencil8)return 4;if(e===sr.RG32Uint||e===sr.RG32Sint||e===sr.RG32Float||e===sr.RGBA16Uint||e===sr.RGBA16Sint||e===sr.RGBA16Float)return 8;if(e===sr.RGBA32Uint||e===sr.RGBA32Sint||e===sr.RGBA32Float)return 16}_getTypedArrayType(e){if(e===sr.R8Uint)return Uint8Array;if(e===sr.R8Sint)return Int8Array;if(e===sr.R8Unorm)return Uint8Array;if(e===sr.R8Snorm)return Int8Array;if(e===sr.RG8Uint)return Uint8Array;if(e===sr.RG8Sint)return Int8Array;if(e===sr.RG8Unorm)return Uint8Array;if(e===sr.RG8Snorm)return Int8Array;if(e===sr.RGBA8Uint)return Uint8Array;if(e===sr.RGBA8Sint)return Int8Array;if(e===sr.RGBA8Unorm||e===sr.RGBA8UnormSRGB)return Uint8Array;if(e===sr.RGBA8Snorm)return Int8Array;if(e===sr.R16Uint)return Uint16Array;if(e===sr.R16Sint)return Int16Array;if(e===sr.RG16Uint)return Uint16Array;if(e===sr.RG16Sint)return Int16Array;if(e===sr.RGBA16Uint)return Uint16Array;if(e===sr.RGBA16Sint)return Int16Array;if(e===sr.R16Float||e===sr.RG16Float||e===sr.RGBA16Float)return Uint16Array;if(e===sr.R32Uint)return Uint32Array;if(e===sr.R32Sint)return Int32Array;if(e===sr.R32Float)return Float32Array;if(e===sr.RG32Uint)return Uint32Array;if(e===sr.RG32Sint)return Int32Array;if(e===sr.RG32Float)return Float32Array;if(e===sr.RGBA32Uint)return Uint32Array;if(e===sr.RGBA32Sint)return Int32Array;if(e===sr.RGBA32Float)return Float32Array;if(e===sr.BGRA8Unorm||e===sr.BGRA8UnormSRGB)return Uint8Array;if(e===sr.RGB10A2Unorm||e===sr.RGB9E5UFloat||e===sr.RG11B10UFloat)return Uint32Array;if(e===sr.Depth32Float)return Float32Array;if(e===sr.Depth24Plus||e===sr.Depth24PlusStencil8)return Uint32Array;if(e===sr.Depth32FloatStencil8)return Float32Array}_getDimension(e){let t;return e.is3DTexture||e.isData3DTexture?t=KN.ThreeD:t=KN.TwoD,t}}function KM(s,e=null){const t=s.format,n=s.type,i=s.colorSpace,a=xr.getTransfer(i);let o;if(s.isCompressedTexture===!0||s.isCompressedArrayTexture===!0)switch(t){case Sn:case Oe:o=a===ws?sr.BC1RGBAUnormSRGB:sr.BC1RGBAUnorm;break;case Qe:o=a===ws?sr.BC2RGBAUnormSRGB:sr.BC2RGBAUnorm;break;case Re:o=a===ws?sr.BC3RGBAUnormSRGB:sr.BC3RGBAUnorm;break;case yn:o=sr.BC4RUnorm;break;case Ln:o=sr.BC4RSnorm;break;case gr:o=sr.BC5RGUnorm;break;case Rr:o=sr.BC5RGSnorm;break;case Pt:o=a===ws?sr.BC7RGBAUnormSRGB:sr.BC7RGBAUnorm;break;case Rn:case Yt:o=a===ws?sr.ETC2RGB8UnormSRGB:sr.ETC2RGB8Unorm;break;case er:o=a===ws?sr.ETC2RGBA8UnormSRGB:sr.ETC2RGBA8Unorm;break;case Jn:o=sr.EACR11Unorm;break;case kr:o=sr.EACR11Snorm;break;case fr:o=sr.EACRG11Unorm;break;case wr:o=sr.EACRG11Snorm;break;case ei:o=a===ws?sr.ASTC4x4UnormSRGB:sr.ASTC4x4Unorm;break;case _n:o=a===ws?sr.ASTC5x4UnormSRGB:sr.ASTC5x4Unorm;break;case jn:o=a===ws?sr.ASTC5x5UnormSRGB:sr.ASTC5x5Unorm;break;case Hr:o=a===ws?sr.ASTC6x5UnormSRGB:sr.ASTC6x5Unorm;break;case Pr:o=a===ws?sr.ASTC6x6UnormSRGB:sr.ASTC6x6Unorm;break;case $i:o=a===ws?sr.ASTC8x5UnormSRGB:sr.ASTC8x5Unorm;break;case Zi:o=a===ws?sr.ASTC8x6UnormSRGB:sr.ASTC8x6Unorm;break;case Xi:o=a===ws?sr.ASTC8x8UnormSRGB:sr.ASTC8x8Unorm;break;case Ei:o=a===ws?sr.ASTC10x5UnormSRGB:sr.ASTC10x5Unorm;break;case ms:o=a===ws?sr.ASTC10x6UnormSRGB:sr.ASTC10x6Unorm;break;case _i:o=a===ws?sr.ASTC10x8UnormSRGB:sr.ASTC10x8Unorm;break;case Es:o=a===ws?sr.ASTC10x10UnormSRGB:sr.ASTC10x10Unorm;break;case ua:o=a===ws?sr.ASTC12x10UnormSRGB:sr.ASTC12x10Unorm;break;case Hn:o=a===ws?sr.ASTC12x12UnormSRGB:sr.ASTC12x12Unorm;break;case L:o=a===ws?sr.RGBA8UnormSRGB:sr.RGBA8Unorm;break;default:Gr("WebGPURenderer: Unsupported texture format.",t)}else switch(t){case L:switch(n){case Ci:o=sr.RGBA8Snorm;break;case En:o=sr.RGBA16Sint;break;case rn:o=sr.RGBA16Uint;break;case st:o=sr.RGBA32Uint;break;case Xt:o=sr.RGBA32Sint;break;case es:o=a===ws?sr.RGBA8UnormSRGB:sr.RGBA8Unorm;break;case Wt:o=sr.RGBA16Float;break;case dt:o=sr.RGBA32Float;break;default:Gr("WebGPURenderer: Unsupported texture type with RGBAFormat.",n)}break;case Ie:switch(n){case rr:o=sr.RGB9E5UFloat;break;case Kr:o=sr.RG11B10UFloat;break;default:Gr("WebGPURenderer: Unsupported texture type with RGBFormat.",n)}break;case z:switch(n){case Ci:o=sr.R8Snorm;break;case En:o=sr.R16Sint;break;case rn:o=sr.R16Uint;break;case st:o=sr.R32Uint;break;case Xt:o=sr.R32Sint;break;case es:o=sr.R8Unorm;break;case Wt:o=sr.R16Float;break;case dt:o=sr.R32Float;break;default:Gr("WebGPURenderer: Unsupported texture type with RedFormat.",n)}break;case ze:switch(n){case Ci:o=sr.RG8Snorm;break;case En:o=sr.RG16Sint;break;case rn:o=sr.RG16Uint;break;case st:o=sr.RG32Uint;break;case Xt:o=sr.RG32Sint;break;case es:o=sr.RG8Unorm;break;case Wt:o=sr.RG16Float;break;case dt:o=sr.RG32Float;break;default:Gr("WebGPURenderer: Unsupported texture type with RGFormat.",n)}break;case Q:switch(n){case rn:o=sr.Depth16Unorm;break;case st:o=sr.Depth24Plus;break;case dt:o=sr.Depth32Float;break;default:Gr("WebGPURenderer: Unsupported texture type with DepthFormat.",n)}break;case w:switch(n){case ar:o=sr.Depth24PlusStencil8;break;case dt:e&&e.features.has(ZM.Depth32FloatStencil8)===!1&&Gr('WebGPURenderer: Depth textures with DepthStencilFormat + FloatType can only be used with the "depth32float-stencil8" GPU feature.'),o=sr.Depth32FloatStencil8;break;default:Gr("WebGPURenderer: Unsupported texture type with DepthStencilFormat.",n)}break;case ie:switch(n){case Xt:o=sr.R32Sint;break;case st:o=sr.R32Uint;break;default:Gr("WebGPURenderer: Unsupported texture type with RedIntegerFormat.",n)}break;case Je:switch(n){case Xt:o=sr.RG32Sint;break;case st:o=sr.RG32Uint;break;default:Gr("WebGPURenderer: Unsupported texture type with RGIntegerFormat.",n)}break;case xt:switch(n){case Xt:o=sr.RGBA32Sint;break;case st:o=sr.RGBA32Uint;break;default:Gr("WebGPURenderer: Unsupported texture type with RGBAIntegerFormat.",n)}break;default:Gr("WebGPURenderer: Unsupported texture format.",t)}return o}const hW=/^[fn]*\s*([a-z_0-9]+)?\s*\(([\s\S]*?)\)\s*[\-\>]*\s*([a-z_0-9]+(?:<[\s\S]+?>)?)/i,dW=/([a-z_0-9]+)\s*:\s*([a-z_0-9]+(?:<[\s\S]+?>)?)/ig,XN={f32:"float",i32:"int",u32:"uint",bool:"bool","vec2<f32>":"vec2","vec2<i32>":"ivec2","vec2<u32>":"uvec2","vec2<bool>":"bvec2",vec2f:"vec2",vec2i:"ivec2",vec2u:"uvec2",vec2b:"bvec2","vec3<f32>":"vec3","vec3<i32>":"ivec3","vec3<u32>":"uvec3","vec3<bool>":"bvec3",vec3f:"vec3",vec3i:"ivec3",vec3u:"uvec3",vec3b:"bvec3","vec4<f32>":"vec4","vec4<i32>":"ivec4","vec4<u32>":"uvec4","vec4<bool>":"bvec4",vec4f:"vec4",vec4i:"ivec4",vec4u:"uvec4",vec4b:"bvec4","mat2x2<f32>":"mat2",mat2x2f:"mat2","mat3x3<f32>":"mat3",mat3x3f:"mat3","mat4x4<f32>":"mat4",mat4x4f:"mat4",sampler:"sampler",texture_1d:"texture",texture_2d:"texture",texture_2d_array:"texture",texture_multisampled_2d:"cubeTexture",texture_depth_2d:"depthTexture",texture_depth_2d_array:"depthTexture",texture_depth_multisampled_2d:"depthTexture",texture_depth_cube:"depthTexture",texture_depth_cube_array:"depthTexture",texture_3d:"texture3D",texture_cube:"cubeTexture",texture_cube_array:"cubeTexture",texture_storage_1d:"storageTexture",texture_storage_2d:"storageTexture",texture_storage_2d_array:"storageTexture",texture_storage_3d:"storageTexture"},fW=s=>{s=s.trim();const e=s.match(hW);if(e!==null&&e.length===4){const t=e[2],n=[];let i=null;for(;(i=dW.exec(t))!==null;)n.push({name:i[1],type:i[2]});const a=[];for(let g=0;g<n.length;g++){const{name:v,type:M}=n[g];let B=M;B.startsWith("ptr")?B="pointer":(B.startsWith("texture")&&(B=M.split("<")[0]),B=XN[B]),a.push(new IM(B,v))}const o=s.substring(e[0].length),u=e[3]||"void",c=e[1]!==void 0?e[1]:"";return{type:XN[u]||u,inputs:a,name:c,inputsCode:t,blockCode:o,outputType:u}}else throw new Error("FunctionNode: Function is not a WGSL code.")};class AW extends PM{constructor(e){const{type:t,inputs:n,name:i,inputsCode:a,blockCode:o,outputType:u}=fW(e);super(t,n,i),this.inputsCode=a,this.blockCode=o,this.outputType=u}getCode(e=this.name){const t=this.outputType!=="void"?"-> "+this.outputType:"";return`fn ${e} ( ${this.inputsCode.trim()} ) ${t}`+this.blockCode}}class pW extends mN{parseFunction(e){return new AW(e)}}const gW={[od.READ_ONLY]:"read",[od.WRITE_ONLY]:"write",[od.READ_WRITE]:"read_write"},jN={[$t]:"repeat",[Vt]:"clamp",[Qt]:"mirror"},U_={vertex:C0.VERTEX,fragment:C0.FRAGMENT,compute:C0.COMPUTE},YN={instance:!0,swizzleAssign:!1,storageBuffer:!0},mW={"^^":"tsl_xor"},vW={float:"f32",int:"i32",uint:"u32",bool:"bool",color:"vec3<f32>",vec2:"vec2<f32>",ivec2:"vec2<i32>",uvec2:"vec2<u32>",bvec2:"vec2<bool>",vec3:"vec3<f32>",ivec3:"vec3<i32>",uvec3:"vec3<u32>",bvec3:"vec3<bool>",vec4:"vec4<f32>",ivec4:"vec4<i32>",uvec4:"vec4<u32>",bvec4:"vec4<bool>",mat2:"mat2x2<f32>",mat3:"mat3x3<f32>",mat4:"mat4x4<f32>"},qN={},gx={tsl_xor:new Wh("fn tsl_xor( a : bool, b : bool ) -> bool { return ( a || b ) && !( a && b ); }"),mod_float:new Wh("fn tsl_mod_float( x : f32, y : f32 ) -> f32 { return x - y * floor( x / y ); }"),mod_vec2:new Wh("fn tsl_mod_vec2( x : vec2f, y : vec2f ) -> vec2f { return x - y * floor( x / y ); }"),mod_vec3:new Wh("fn tsl_mod_vec3( x : vec3f, y : vec3f ) -> vec3f { return x - y * floor( x / y ); }"),mod_vec4:new Wh("fn tsl_mod_vec4( x : vec4f, y : vec4f ) -> vec4f { return x - y * floor( x / y ); }"),equals_bool:new Wh("fn tsl_equals_bool( a : bool, b : bool ) -> bool { return a == b; }"),equals_bvec2:new Wh("fn tsl_equals_bvec2( a : vec2f, b : vec2f ) -> vec2<bool> { return vec2<bool>( a.x == b.x, a.y == b.y ); }"),equals_bvec3:new Wh("fn tsl_equals_bvec3( a : vec3f, b : vec3f ) -> vec3<bool> { return vec3<bool>( a.x == b.x, a.y == b.y, a.z == b.z ); }"),equals_bvec4:new Wh("fn tsl_equals_bvec4( a : vec4f, b : vec4f ) -> vec4<bool> { return vec4<bool>( a.x == b.x, a.y == b.y, a.z == b.z, a.w == b.w ); }"),repeatWrapping_float:new Wh("fn tsl_repeatWrapping_float( coord: f32 ) -> f32 { return fract( coord ); }"),mirrorWrapping_float:new Wh("fn tsl_mirrorWrapping_float( coord: f32 ) -> f32 { let mirrored = fract( coord * 0.5 ) * 2.0; return 1.0 - abs( 1.0 - mirrored ); }"),clampWrapping_float:new Wh("fn tsl_clampWrapping_float( coord: f32 ) -> f32 { return clamp( coord, 0.0, 1.0 ); }"),biquadraticTexture:new Wh(`
fn tsl_biquadraticTexture( map : texture_2d<f32>, coord : vec2f, iRes : vec2u, level : u32 ) -> vec4f {
let res = vec2f( iRes );
let uvScaled = coord * res;
let uvWrapping = ( ( uvScaled % res ) + res ) % res;
// https://www.shadertoy.com/view/WtyXRy
let uv = uvWrapping - 0.5;
let iuv = floor( uv );
let f = fract( uv );
let rg1 = textureLoad( map, vec2u( iuv + vec2( 0.5, 0.5 ) ) % iRes, level );
let rg2 = textureLoad( map, vec2u( iuv + vec2( 1.5, 0.5 ) ) % iRes, level );
let rg3 = textureLoad( map, vec2u( iuv + vec2( 0.5, 1.5 ) ) % iRes, level );
let rg4 = textureLoad( map, vec2u( iuv + vec2( 1.5, 1.5 ) ) % iRes, level );
return mix( mix( rg1, rg2, f.x ), mix( rg3, rg4, f.x ), f.y );
}
`)},yW={dFdx:"dpdx",dFdy:"- dpdy",mod_float:"tsl_mod_float",mod_vec2:"tsl_mod_vec2",mod_vec3:"tsl_mod_vec3",mod_vec4:"tsl_mod_vec4",equals_bool:"tsl_equals_bool",equals_bvec2:"tsl_equals_bvec2",equals_bvec3:"tsl_equals_bvec3",equals_bvec4:"tsl_equals_bvec4",inversesqrt:"inverseSqrt",bitcast:"bitcast<f32>",floatpack_snorm_2x16:"pack2x16snorm",floatpack_unorm_2x16:"pack2x16unorm",floatpack_float16_2x16:"pack2x16float",floatunpack_snorm_2x16:"unpack2x16snorm",floatunpack_unorm_2x16:"unpack2x16unorm",floatunpack_float16_2x16:"unpack2x16float"};let JN="";(typeof navigator!="undefined"&&/Firefox|Deno/g.test(navigator.userAgent))!==!0&&(JN+=`diagnostic( off, derivative_uniformity );
`);class xW extends pN{constructor(e,t){super(e,t,new pW),this.uniformGroups={},this.builtins={},this.directives={},this.scopedArrays=new Map}_generateTextureSample(e,t,n,i,a,o=this.shaderStage){return o==="fragment"?i?a?`textureSample( ${t}, ${t}_sampler, ${n}, ${i}, ${a} )`:`textureSample( ${t}, ${t}_sampler, ${n}, ${i} )`:a?`textureSample( ${t}, ${t}_sampler, ${n}, ${a} )`:`textureSample( ${t}, ${t}_sampler, ${n} )`:this.generateTextureSampleLevel(e,t,n,"0",i)}generateTextureSampleLevel(e,t,n,i,a,o){return this.isUnfilterable(e)===!1?o?`textureSampleLevel( ${t}, ${t}_sampler, ${n}, ${i}, ${o} )`:`textureSampleLevel( ${t}, ${t}_sampler, ${n}, ${i} )`:this.isFilteredTexture(e)?this.generateFilteredTexture(e,t,n,o,i):this.generateTextureLod(e,t,n,a,o,i)}generateWrapFunction(e){const t=`tsl_coord_${jN[e.wrapS]}S_${jN[e.wrapT]}_${e.is3DTexture||e.isData3DTexture?"3d":"2d"}T`;let n=qN[t];if(n===void 0){const i=[],a=e.is3DTexture||e.isData3DTexture?"vec3f":"vec2f";let o=`fn ${t}( coord : ${a} ) -> ${a} {
return ${a}(
`;const u=(c,d)=>{c===$t?(i.push(gx.repeatWrapping_float),o+=` tsl_repeatWrapping_float( coord.${d} )`):c===Vt?(i.push(gx.clampWrapping_float),o+=` tsl_clampWrapping_float( coord.${d} )`):c===Qt?(i.push(gx.mirrorWrapping_float),o+=` tsl_mirrorWrapping_float( coord.${d} )`):(o+=` coord.${d}`,Lr(`WebGPURenderer: Unsupported texture wrap type "${c}" for vertex shader.`))};u(e.wrapS,"x"),o+=`,
`,u(e.wrapT,"y"),(e.is3DTexture||e.isData3DTexture)&&(o+=`,
`,u(e.wrapR,"z")),o+=`
);
}
`,qN[t]=n=new Wh(o,i)}return n.build(this),t}generateArrayDeclaration(e,t){return`array< ${this.getType(e)}, ${t} >`}generateTextureDimension(e,t,n){const i=this.getDataFromNode(e,this.shaderStage,this.globalCache);i.dimensionsSnippet===void 0&&(i.dimensionsSnippet={});let a=i.dimensionsSnippet[n];if(i.dimensionsSnippet[n]===void 0){let o,u;const{primarySamples:c}=this.renderer.backend.utils.getTextureSampleData(e),d=c>1;e.is3DTexture||e.isData3DTexture?u="vec3<u32>":u="vec2<u32>",d||e.isStorageTexture?o=t:o=`${t}${n?`, u32( ${n} )`:""}`,a=new Fb(new Ob(`textureDimensions( ${o} )`,u)),i.dimensionsSnippet[n]=a,(e.isArrayTexture||e.isDataArrayTexture||e.is3DTexture||e.isData3DTexture)&&(i.arrayLayerCount=new Fb(new Ob(`textureNumLayers(${t})`,"u32"))),e.isTextureCube&&(i.cubeFaceCount=new Fb(new Ob("6u","u32")))}return a.build(this)}generateFilteredTexture(e,t,n,i,a="0u"){this._include("biquadraticTexture");const o=this.generateWrapFunction(e),u=this.generateTextureDimension(e,t,a);return i&&(n=`${n} + vec2<f32>(${i}) / ${u}`),`tsl_biquadraticTexture( ${t}, ${o}( ${n} ), ${u}, u32( ${a} ) )`}generateTextureLod(e,t,n,i,a,o="0u"){const u=this.generateWrapFunction(e),c=this.generateTextureDimension(e,t,o),d=e.is3DTexture||e.isData3DTexture?"vec3":"vec2";a&&(n=`${n} + ${d}<f32>(${a}) / ${d}<f32>( ${c} )`);const g=`${d}<u32>( ${u}( ${n} ) * ${d}<f32>( ${c} ) )`;return this.generateTextureLoad(e,t,g,o,i,null)}generateTextureLoad(e,t,n,i,a,o){i===null&&(i="0u"),o&&(n=`${n} + ${o}`);let u;return a?u=`textureLoad( ${t}, ${n}, ${a}, u32( ${i} ) )`:(u=`textureLoad( ${t}, ${n}, u32( ${i} ) )`,this.renderer.backend.compatibilityMode&&e.isDepthTexture&&(u+=".x")),u}generateTextureStore(e,t,n,i,a){let o;return i?o=`textureStore( ${t}, ${n}, ${i}, ${a} )`:o=`textureStore( ${t}, ${n}, ${a} )`,o}isSampleCompare(e){return e.isDepthTexture===!0&&e.compareFunction!==null}isUnfilterable(e){return this.getComponentTypeFromTexture(e)!=="float"||!this.isAvailable("float32Filterable")&&e.isDataTexture===!0&&e.type===dt||this.isSampleCompare(e)===!1&&e.minFilter===cn&&e.magFilter===cn||this.renderer.backend.utils.getTextureSampleData(e).primarySamples>1}generateTexture(e,t,n,i,a,o=this.shaderStage){let u=null;return this.isUnfilterable(e)?u=this.generateTextureLod(e,t,n,i,a,"0",o):u=this._generateTextureSample(e,t,n,i,a,o),u}generateTextureGrad(e,t,n,i,a,o,u=this.shaderStage){if(u==="fragment")return o?`textureSampleGrad( ${t}, ${t}_sampler, ${n}, ${i[0]}, ${i[1]}, ${o} )`:`textureSampleGrad( ${t}, ${t}_sampler, ${n}, ${i[0]}, ${i[1]} )`;Gr(`WebGPURenderer: THREE.TextureNode.gradient() does not support ${u} shader.`)}generateTextureCompare(e,t,n,i,a,o,u=this.shaderStage){if(u==="fragment")return e.isDepthTexture===!0&&e.isArrayTexture===!0?o?`textureSampleCompare( ${t}, ${t}_sampler, ${n}, ${a}, ${i}, ${o} )`:`textureSampleCompare( ${t}, ${t}_sampler, ${n}, ${a}, ${i} )`:o?`textureSampleCompare( ${t}, ${t}_sampler, ${n}, ${i}, ${o} )`:`textureSampleCompare( ${t}, ${t}_sampler, ${n}, ${i} )`;Gr(`WebGPURenderer: THREE.DepthTexture.compareFunction() does not support ${u} shader.`)}generateTextureLevel(e,t,n,i,a,o){return this.isUnfilterable(e)===!1?o?`textureSampleLevel( ${t}, ${t}_sampler, ${n}, ${i}, ${o} )`:`textureSampleLevel( ${t}, ${t}_sampler, ${n}, ${i} )`:this.isFilteredTexture(e)?this.generateFilteredTexture(e,t,n,o,i):this.generateTextureLod(e,t,n,a,o,i)}generateTextureBias(e,t,n,i,a,o,u=this.shaderStage){if(u==="fragment")return o?`textureSampleBias( ${t}, ${t}_sampler, ${n}, ${i}, ${o} )`:`textureSampleBias( ${t}, ${t}_sampler, ${n}, ${i} )`;Gr(`WebGPURenderer: THREE.TextureNode.biasNode does not support ${u} shader.`)}getPropertyName(e,t=this.shaderStage){if(e.isNodeVarying===!0&&e.needsInterpolation===!0){if(t==="vertex")return`varyings.${e.name}`}else if(e.isNodeUniform===!0){const n=e.name,i=e.type;return i==="texture"||i==="cubeTexture"||i==="cubeDepthTexture"||i==="storageTexture"||i==="texture3D"?n:i==="buffer"||i==="storageBuffer"||i==="indirectStorageBuffer"?this.isCustomStruct(e)?n:n+".value":e.groupNode.name+"."+n}return super.getPropertyName(e)}getOutputStructName(){return"output"}getFunctionOperator(e){const t=mW[e];return t!==void 0?(this._include(t),t):null}getNodeAccess(e,t){return t!=="compute"?e.isAtomic===!0?(Lr("WebGPURenderer: Atomic operations are only supported in compute shaders."),od.READ_WRITE):od.READ_ONLY:e.access}getStorageAccess(e,t){return gW[this.getNodeAccess(e,t)]}getUniformFromNode(e,t,n,i=null){const a=super.getUniformFromNode(e,t,n,i),o=this.getDataFromNode(e,n,this.globalCache);if(o.uniformGPU===void 0){let u;const c=e.groupNode,d=c.name,g=this.getBindGroupArray(d,n);if(t==="texture"||t==="cubeTexture"||t==="cubeDepthTexture"||t==="storageTexture"||t==="texture3D"){let v=null;const M=this.getNodeAccess(e,n);if(t==="texture"||t==="storageTexture"?e.value.is3DTexture===!0?v=new kM(a.name,a.node,c,M):v=new N_(a.name,a.node,c,M):t==="cubeTexture"||t==="cubeDepthTexture"?v=new IN(a.name,a.node,c,M):t==="texture3D"&&(v=new kM(a.name,a.node,c,M)),v.store=e.isStorageTextureNode===!0,v.mipLevel=v.store?e.mipLevel:0,v.setVisibility(U_[n]),this.isUnfilterable(e.value)===!1&&v.store===!1){const B=new rW(`${a.name}_sampler`,a.node,c);B.setVisibility(U_[n]),g.push(B,v),u=[B,v]}else g.push(v),u=[v]}else if(t==="buffer"||t==="storageBuffer"||t==="indirectStorageBuffer"){const v=this.getSharedDataFromNode(e);let M=v.buffer;if(M===void 0){const B=t==="buffer"?TN:aW;M=new B(e,c),v.buffer=M}M.setVisibility(M.getVisibility()|U_[n]),g.push(M),u=M,a.name=i||"NodeBuffer_"+a.id}else{const v=this.uniformGroups[n]||(this.uniformGroups[n]={});let M=v[d];M===void 0&&(M=new BN(d,c),M.setVisibility(U_[n]),v[d]=M,g.push(M)),u=this.getNodeUniform(a,t),M.addUniform(u)}o.uniformGPU=u}return a}getBuiltin(e,t,n,i=this.shaderStage){const a=this.builtins[i]||(this.builtins[i]=new Map);return a.has(e)===!1&&a.set(e,{name:e,property:t,type:n}),t}hasBuiltin(e,t=this.shaderStage){return this.builtins[t]!==void 0&&this.builtins[t].has(e)}getVertexIndex(){return this.shaderStage==="vertex"?this.getBuiltin("vertex_index","vertexIndex","u32","attribute"):"vertexIndex"}buildFunctionCode(e){const t=e.layout,n=this.flowShaderNode(e),i=[];for(const o of t.inputs)i.push(o.name+" : "+this.getType(o.type));let a=`fn ${t.name}( ${i.join(", ")} ) -> ${this.getType(t.type)} {
${n.vars}
${n.code}
`;return n.result&&(a+=` return ${n.result};
`),a+=`
}
`,a}getInstanceIndex(){return this.shaderStage==="vertex"?this.getBuiltin("instance_index","instanceIndex","u32","attribute"):"instanceIndex"}getInvocationLocalIndex(){return this.getBuiltin("local_invocation_index","invocationLocalIndex","u32","attribute")}getSubgroupSize(){return this.enableSubGroups(),this.getBuiltin("subgroup_size","subgroupSize","u32","attribute")}getInvocationSubgroupIndex(){return this.enableSubGroups(),this.getBuiltin("subgroup_invocation_id","invocationSubgroupIndex","u32","attribute")}getSubgroupIndex(){return this.enableSubGroups(),this.getBuiltin("subgroup_id","subgroupIndex","u32","attribute")}getDrawIndex(){return null}getFrontFacing(){return this.getBuiltin("front_facing","isFront","bool")}getFragCoord(){return this.getBuiltin("position","fragCoord","vec4<f32>")+".xy"}getFragDepth(){return"output."+this.getBuiltin("frag_depth","depth","f32","output")}getClipDistance(){return"varyings.hw_clip_distances"}isFlipY(){return!1}enableDirective(e,t=this.shaderStage){(this.directives[t]||(this.directives[t]=new Set)).add(e)}getDirectives(e){const t=[],n=this.directives[e];if(n!==void 0)for(const i of n)t.push(`enable ${i};`);return t.join(`
`)}enableSubGroups(){this.enableDirective("subgroups")}enableSubgroupsF16(){this.enableDirective("subgroups-f16")}enableClipDistances(){this.enableDirective("clip_distances")}enableShaderF16(){this.enableDirective("f16")}enableDualSourceBlending(){this.enableDirective("dual_source_blending")}enableHardwareClipping(e){this.enableClipDistances(),this.getBuiltin("clip_distances","hw_clip_distances",`array<f32, ${e} >`,"vertex")}getBuiltins(e){const t=[],n=this.builtins[e];if(n!==void 0)for(const{name:i,property:a,type:o}of n.values())t.push(`@builtin( ${i} ) ${a} : ${o}`);return t.join(`,
`)}getScopedArray(e,t,n,i){return this.scopedArrays.has(e)===!1&&this.scopedArrays.set(e,{name:e,scope:t,bufferType:n,bufferCount:i}),e}getScopedArrays(e){if(e!=="compute")return;const t=[];for(const{name:n,scope:i,bufferType:a,bufferCount:o}of this.scopedArrays.values()){const u=this.getType(a);t.push(`var<${i}> ${n}: array< ${u}, ${o} >;`)}return t.join(`
`)}getAttributes(e){const t=[];if(e==="compute"&&(this.getBuiltin("global_invocation_id","globalId","vec3<u32>","attribute"),this.getBuiltin("workgroup_id","workgroupId","vec3<u32>","attribute"),this.getBuiltin("local_invocation_id","localId","vec3<u32>","attribute"),this.getBuiltin("num_workgroups","numWorkgroups","vec3<u32>","attribute"),this.renderer.hasFeature("subgroups")&&(this.enableDirective("subgroups",e),this.getBuiltin("subgroup_size","subgroupSize","u32","attribute"))),e==="vertex"||e==="compute"){const n=this.getBuiltins("attribute");n&&t.push(n);const i=this.getAttributesArray();for(let a=0,o=i.length;a<o;a++){const u=i[a],c=u.name,d=this.getType(u.type);t.push(`@location( ${a} ) ${c} : ${d}`)}}return t.join(`,
`)}getStructMembers(e){const t=[];for(const n of e.members){const i=e.output?"@location( "+n.index+" ) ":"";let a=this.getType(n.type);n.atomic&&(a="atomic< "+a+" >"),t.push(` ${i+n.name} : ${a}`)}return e.output&&t.push(` ${this.getBuiltins("output")}`),t.join(`,
`)}getStructs(e){let t="";const n=this.structs[e];if(n.length>0){const i=[];for(const a of n){let o=`struct ${a.name} {
`;o+=this.getStructMembers(a),o+=`
};`,i.push(o)}t=`
`+i.join(`
`)+`
`}return t}getVar(e,t,n=null){let i=`var ${t} : `;return n!==null?i+=this.generateArrayDeclaration(e,n):i+=this.getType(e),i}getVars(e){const t=[],n=this.vars[e];if(n!==void 0)for(const i of n)t.push(` ${this.getVar(i.type,i.name,i.count)};`);return`
${t.join(`
`)}
`}getVaryings(e){const t=[];if(e==="vertex"&&this.getBuiltin("position","Vertex","vec4<f32>","vertex"),e==="vertex"||e==="fragment"){const a=this.varyings,o=this.vars[e];for(let u=0;u<a.length;u++){const c=a[u];if(c.needsInterpolation){let d=`@location( ${u} )`;if(c.interpolationType){const g=c.interpolationSampling!==null?`, ${c.interpolationSampling} )`:" )";d+=` @interpolate( ${c.interpolationType}${g}`}else/^(int|uint|ivec|uvec)/.test(c.type)&&(d+=` @interpolate( ${this.renderer.backend.compatibilityMode?"flat, either":"flat"} )`);t.push(`${d} ${c.name} : ${this.getType(c.type)}`)}else e==="vertex"&&o.includes(c)===!1&&o.push(c)}}const n=this.getBuiltins(e);n&&t.push(n);const i=t.join(`,
`);return e==="vertex"?this._getWGSLStruct("VaryingsStruct"," "+i):i}isCustomStruct(e){const t=e.value,n=e.node,i=(t.isBufferAttribute||t.isInstancedBufferAttribute)&&n.structTypeNode!==null,a=n.value&&n.value.array&&typeof n.value.itemSize=="number"&&n.value.array.length>n.value.itemSize;return i&&!a}getUniforms(e){const t=this.uniforms[e],n=[],i=[],a=[],o={};for(const c of t){const d=c.groupNode.name,g=this.bindingsIndexes[d];if(c.type==="texture"||c.type==="cubeTexture"||c.type==="cubeDepthTexture"||c.type==="storageTexture"||c.type==="texture3D"){const v=c.node.value;this.isUnfilterable(v)===!1&&c.node.isStorageTextureNode!==!0&&(this.isSampleCompare(v)?n.push(`@binding( ${g.binding++} ) @group( ${g.group} ) var ${c.name}_sampler : sampler_comparison;`):n.push(`@binding( ${g.binding++} ) @group( ${g.group} ) var ${c.name}_sampler : sampler;`));let M,B="";const{primarySamples:I}=this.renderer.backend.utils.getTextureSampleData(v);if(I>1&&(B="_multisampled"),v.isCubeTexture===!0&&v.isDepthTexture===!0)M="texture_depth_cube";else if(v.isCubeTexture===!0)M="texture_cube<f32>";else if(v.isDepthTexture===!0)this.renderer.backend.compatibilityMode&&v.compareFunction===null?M=`texture${B}_2d<f32>`:M=`texture_depth${B}_2d${v.isArrayTexture===!0?"_array":""}`;else if(c.node.isStorageTextureNode===!0){const ne=KM(v),ee=this.getStorageAccess(c.node,e),q=c.node.value.is3DTexture,ye=c.node.value.isArrayTexture;M=`texture_storage_${q?"3d":`2d${ye?"_array":""}`}<${ne}, ${ee}>`}else if(v.isArrayTexture===!0||v.isDataArrayTexture===!0||v.isCompressedArrayTexture===!0)M="texture_2d_array<f32>";else if(v.is3DTexture===!0||v.isData3DTexture===!0)M="texture_3d<f32>";else{const ne=this.getComponentTypeFromTexture(v).charAt(0);M=`texture${B}_2d<${ne}32>`}n.push(`@binding( ${g.binding++} ) @group( ${g.group} ) var ${c.name} : ${M};`)}else if(c.type==="buffer"||c.type==="storageBuffer"||c.type==="indirectStorageBuffer"){const v=c.node,M=this.getType(v.getNodeType(this)),B=v.bufferCount,I=B>0&&c.type==="buffer"?", "+B:"",ne=v.isStorageBufferNode?`storage, ${this.getStorageAccess(v,e)}`:"uniform";if(this.isCustomStruct(c))i.push(`@binding( ${g.binding++} ) @group( ${g.group} ) var<${ne}> ${c.name} : ${M};`);else{const q=` value : array< ${v.isAtomic?`atomic<${M}>`:`${M}`}${I} >`;i.push(this._getWGSLStructBinding(c.name,q,ne,g.binding++,g.group))}}else{const v=this.getType(this.getVectorType(c.type)),M=c.groupNode.name;(o[M]||(o[M]={index:g.binding++,id:g.group,snippets:[]})).snippets.push(` ${c.name} : ${v}`)}}for(const c in o){const d=o[c];a.push(this._getWGSLStructBinding(c,d.snippets.join(`,
`),"uniform",d.index,d.id))}return[...n,...i,...a].join(`
`)}buildCode(){const e=this.material!==null?{fragment:{},vertex:{}}:{compute:{}};this.sortBindingGroups();for(const t in e){this.shaderStage=t;const n=e[t];n.uniforms=this.getUniforms(t),n.attributes=this.getAttributes(t),n.varyings=this.getVaryings(t),n.structs=this.getStructs(t),n.vars=this.getVars(t),n.codes=this.getCodes(t),n.directives=this.getDirectives(t),n.scopedArrays=this.getScopedArrays(t);let i=`// code
`;i+=this.flowCode[t];const a=this.flowNodes[t],o=a[a.length-1],u=o.outputNode,c=u!==void 0&&u.isOutputStructNode===!0;for(const d of a){const g=this.getFlowData(d),v=d.name;if(v&&(i.length>0&&(i+=`
`),i+=` // flow -> ${v}
`),i+=`${g.code}
`,d===o&&t!=="compute"){if(i+=`// result
`,t==="vertex")i+=`varyings.Vertex = ${g.result};`;else if(t==="fragment")if(c)n.returnType=u.getNodeType(this),n.structs+="var<private> output : "+n.returnType+";",i+=`return ${g.result};`;else{let M=" @location(0) color: vec4<f32>";const B=this.getBuiltins("output");B&&(M+=`,
`+B),n.returnType="OutputStruct",n.structs+=this._getWGSLStruct("OutputStruct",M),n.structs+=`
var<private> output : OutputStruct;`,i+=`output.color = ${g.result};
return output;`}}}n.flow=i}if(this.shaderStage=null,this.material!==null)this.vertexShader=this._getWGSLVertexCode(e.vertex),this.fragmentShader=this._getWGSLFragmentCode(e.fragment);else{const t=this.object.workgroupSize;this.computeShader=this._getWGSLComputeCode(e.compute,t)}}getMethod(e,t=null){let n;return t!==null&&(n=this._getWGSLMethod(e+"_"+t)),n===void 0&&(n=this._getWGSLMethod(e)),n||e}getBitcastMethod(e){return`bitcast<${this.getType(e)}>`}getFloatPackingMethod(e){return this.getMethod(`floatpack_${e}_2x16`)}getFloatUnpackingMethod(e){return this.getMethod(`floatunpack_${e}_2x16`)}getTernary(e,t,n){return`select( ${n}, ${t}, ${e} )`}getType(e){return vW[e]||e}isAvailable(e){let t=YN[e];return t===void 0&&(e==="float32Filterable"?t=this.renderer.hasFeature("float32-filterable"):e==="clipDistance"&&(t=this.renderer.hasFeature("clip-distances")),YN[e]=t),t}_getWGSLMethod(e){return gx[e]!==void 0&&this._include(e),yW[e]}_include(e){const t=gx[e];return t.build(this),this.addInclude(t),t}_getWGSLVertexCode(e){return`${this.getSignature()}
// directives
${e.directives}
// structs
${e.structs}
// uniforms
${e.uniforms}
// varyings
${e.varyings}
var<private> varyings : VaryingsStruct;
// codes
${e.codes}
@vertex
fn main( ${e.attributes} ) -> VaryingsStruct {
// vars
${e.vars}
// flow
${e.flow}
return varyings;
}
`}_getWGSLFragmentCode(e){return`${this.getSignature()}
// global
${JN}
// structs
${e.structs}
// uniforms
${e.uniforms}
// codes
${e.codes}
@fragment
fn main( ${e.varyings} ) -> ${e.returnType} {
// vars
${e.vars}
// flow
${e.flow}
}
`}_getWGSLComputeCode(e,t){const[n,i,a]=t;return`${this.getSignature()}
// directives
${e.directives}
// system
var<private> instanceIndex : u32;
// locals
${e.scopedArrays}
// structs
${e.structs}
// uniforms
${e.uniforms}
// codes
${e.codes}
@compute @workgroup_size( ${n}, ${i}, ${a} )
fn main( ${e.attributes} ) {
// system
instanceIndex = globalId.x
+ globalId.y * ( ${n} * numWorkgroups.x )
+ globalId.z * ( ${n} * numWorkgroups.x ) * ( ${i} * numWorkgroups.y );
// vars
${e.vars}
// flow
${e.flow}
}
`}_getWGSLStruct(e,t){return`
struct ${e} {
${t}
};`}_getWGSLStructBinding(e,t,n,i=0,a=0){const o=e+"Struct";return`${this._getWGSLStruct(o,t)}
@binding( ${i} ) @group( ${a} )
var<${n}> ${e} : ${o};`}}class bW{constructor(e){this.backend=e}getCurrentDepthStencilFormat(e){let t;return e.depthTexture!==null?t=this.getTextureFormatGPU(e.depthTexture):e.depth&&e.stencil?t=sr.Depth24PlusStencil8:e.depth&&(t=sr.Depth24Plus),t}getTextureFormatGPU(e){return this.backend.get(e).format}getTextureSampleData(e){let t;if(e.isFramebufferTexture)t=1;else if(e.isDepthTexture&&!e.renderTarget){const a=this.backend.renderer,o=a.getRenderTarget();t=o?o.samples:a.currentSamples}else e.renderTarget&&(t=e.renderTarget.samples);t=t||1;const n=t>1&&e.renderTarget!==null&&e.isDepthTexture!==!0&&e.isFramebufferTexture!==!0;return{samples:t,primarySamples:n?1:t,isMSAA:n}}getCurrentColorFormat(e){let t;return e.textures!==null?t=this.getTextureFormatGPU(e.textures[0]):t=this.getPreferredCanvasFormat(),t}getCurrentColorFormats(e){return e.textures!==null?e.textures.map(t=>this.getTextureFormatGPU(t)):[this.getPreferredCanvasFormat()]}getCurrentColorSpace(e){return e.textures!==null?e.textures[0].colorSpace:this.backend.renderer.outputColorSpace}getPrimitiveTopology(e,t){if(e.isPoints)return kv.PointList;if(e.isLineSegments||e.isMesh&&t.wireframe===!0)return kv.LineList;if(e.isLine)return kv.LineStrip;if(e.isMesh)return kv.TriangleList}getSampleCount(e){return e>=4?4:1}getSampleCountRenderContext(e){return e.textures!==null?this.getSampleCount(e.sampleCount):this.getSampleCount(this.backend.renderer.currentSamples)}getPreferredCanvasFormat(){const t=this.backend.parameters.outputType;if(t===void 0)return navigator.gpu.getPreferredCanvasFormat();if(t===es)return sr.BGRA8Unorm;if(t===Wt)return sr.RGBA16Float;throw new Error("Unsupported output buffer type.")}}const eF=new Map([[Int8Array,["sint8","snorm8"]],[Uint8Array,["uint8","unorm8"]],[Int16Array,["sint16","snorm16"]],[Uint16Array,["uint16","unorm16"]],[Int32Array,["sint32","snorm32"]],[Uint32Array,["uint32","unorm32"]],[Float32Array,["float32"]]]);typeof Float16Array!="undefined"&&eF.set(Float16Array,["float16"]);const _W=new Map([[Yu,["float16"]]]),wW=new Map([[Int32Array,"sint32"],[Int16Array,"sint32"],[Uint32Array,"uint32"],[Uint16Array,"uint32"],[Float32Array,"float32"]]);class SW{constructor(e){this.backend=e}createAttribute(e,t){const n=this._getBufferAttribute(e),i=this.backend,a=i.get(n);let o=a.buffer;if(o===void 0){const u=i.device;let c=n.array;if(e.normalized===!1){if(c.constructor===Int16Array||c.constructor===Int8Array)c=new Int32Array(c);else if((c.constructor===Uint16Array||c.constructor===Uint8Array)&&(c=new Uint32Array(c),t&GPUBufferUsage.INDEX))for(let v=0;v<c.length;v++)c[v]===65535&&(c[v]=4294967295)}if(n.array=c,(n.isStorageBufferAttribute||n.isStorageInstancedBufferAttribute)&&n.itemSize===3){c=new c.constructor(n.count*4);for(let v=0;v<n.count;v++)c.set(n.array.subarray(v*3,v*3+3),v*4);n.itemSize=4,n.array=c,a._force3to4BytesAlignment=!0}const d=c.byteLength,g=d+(4-d%4)%4;o=u.createBuffer({label:n.name,size:g,usage:t,mappedAtCreation:!0}),new c.constructor(o.getMappedRange()).set(c),o.unmap(),a.buffer=o}}updateAttribute(e){const t=this._getBufferAttribute(e),n=this.backend,i=n.device,a=n.get(t),o=n.get(t).buffer;let u=t.array;if(a._force3to4BytesAlignment===!0){u=new u.constructor(t.count*4);for(let d=0;d<t.count;d++)u.set(t.array.subarray(d*3,d*3+3),d*4);t.array=u}const c=t.updateRanges;if(c.length===0)i.queue.writeBuffer(o,0,u,0);else{const d=na(u),g=d?1:u.BYTES_PER_ELEMENT;for(let v=0,M=c.length;v<M;v++){const B=c[v];let I,ne;if(a._force3to4BytesAlignment===!0){const q=Math.floor(B.start/3),ye=Math.ceil(B.count/3);I=q*4*g,ne=ye*4*g}else I=B.start*g,ne=B.count*g;const ee=I*(d?u.BYTES_PER_ELEMENT:1);i.queue.writeBuffer(o,ee,u,I,ne)}t.clearUpdateRanges()}}createShaderVertexBuffers(e){const t=e.getAttributes(),n=new Map;for(let i=0;i<t.length;i++){const a=t[i],o=a.array.BYTES_PER_ELEMENT,u=this._getBufferAttribute(a);let c=n.get(u);if(c===void 0){let v,M;a.isInterleavedBufferAttribute===!0?(v=a.data.stride*o,M=a.data.isInstancedInterleavedBuffer?L_.Instance:L_.Vertex):(v=a.itemSize*o,M=a.isInstancedBufferAttribute?L_.Instance:L_.Vertex),a.normalized===!1&&(a.array.constructor===Int16Array||a.array.constructor===Uint16Array)&&(v=4),c={arrayStride:v,attributes:[],stepMode:M},n.set(u,c)}const d=this._getVertexFormat(a),g=a.isInterleavedBufferAttribute===!0?a.offset*o:0;c.attributes.push({shaderLocation:i,offset:g,format:d})}return Array.from(n.values())}destroyAttribute(e){const t=this.backend;t.get(this._getBufferAttribute(e)).buffer.destroy(),t.delete(e)}getArrayBufferAsync(e){return Pa(this,null,function*(){const t=this.backend,n=t.device,a=t.get(this._getBufferAttribute(e)).buffer,o=a.size,u=n.createBuffer({label:`${e.name}_readback`,size:o,usage:GPUBufferUsage.COPY_DST|GPUBufferUsage.MAP_READ}),c=n.createCommandEncoder({label:`readback_encoder_${e.name}`});c.copyBufferToBuffer(a,0,u,0,o);const d=c.finish();n.queue.submit([d]),yield u.mapAsync(GPUMapMode.READ);const g=u.getMappedRange(),v=new e.array.constructor(g.slice(0));return u.unmap(),v.buffer})}_getVertexFormat(e){const{itemSize:t,normalized:n}=e,i=e.array.constructor,a=e.constructor;let o;if(t===1)o=wW.get(i);else{const c=(_W.get(a)||eF.get(i))[n?1:0];if(c){const d=i.BYTES_PER_ELEMENT*t,v=Math.floor((d+3)/4)*4/i.BYTES_PER_ELEMENT;if(v%1)throw new Error("THREE.WebGPUAttributeUtils: Bad vertex format item size.");o=`${c}x${v}`}}return o||Gr("WebGPUAttributeUtils: Vertex format not supported yet."),o}_getBufferAttribute(e){return e.isInterleavedBufferAttribute&&(e=e.data),e}}class MW{constructor(e){this.layoutGPU=e,this.usedTimes=0}}class EW{constructor(e){this.backend=e,this._bindGroupLayoutCache=new Map}createBindingsLayout(e){const t=this.backend,n=t.device,i=t.get(e);if(i.layout)return i.layout.layoutGPU;const a=this._createLayoutEntries(e),o=JSON.stringify(a);let u=this._bindGroupLayoutCache.get(o);return u===void 0&&(u=new MW(n.createBindGroupLayout({entries:a})),this._bindGroupLayoutCache.set(o,u)),u.usedTimes++,i.layout=u,i.layoutKey=o,u.layoutGPU}createBindings(e,t,n,i=0){const{backend:a}=this,o=a.get(e),u=this.createBindingsLayout(e);let c;n>0&&(o.groups===void 0&&(o.groups=[],o.versions=[]),o.versions[n]===i&&(c=o.groups[n])),c===void 0&&(c=this.createBindGroup(e,u),n>0&&(o.groups[n]=c,o.versions[n]=i)),o.group=c}updateBinding(e){const t=this.backend,n=t.device,i=e.buffer,a=t.get(e).buffer,o=e.updateRanges;if(o.length===0)n.queue.writeBuffer(a,0,i,0);else{const u=na(i),c=u?1:i.BYTES_PER_ELEMENT;for(let d=0,g=o.length;d<g;d++){const v=o[d],M=v.start*c,B=v.count*c,I=M*(u?i.BYTES_PER_ELEMENT:1);n.queue.writeBuffer(a,I,i,M,B)}e.clearUpdateRanges()}}createBindGroupIndex(e,t){const i=this.backend.device,a=GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST,o=e[0],u=i.createBuffer({label:"bindingCameraIndex_"+o,size:16,usage:a});i.queue.writeBuffer(u,0,e,0);const c=[{binding:0,resource:{buffer:u}}];return i.createBindGroup({label:"bindGroupCameraIndex_"+o,layout:t,entries:c})}createBindGroup(e,t){const n=this.backend,i=n.device;let a=0;const o=[];for(const u of e.bindings){if(u.isUniformBuffer){const c=n.get(u);if(c.buffer===void 0){const d=u.byteLength,g=GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST,v=[];u.visibility&C0.VERTEX&&v.push("vertex"),u.visibility&C0.FRAGMENT&&v.push("fragment"),u.visibility&C0.COMPUTE&&v.push("compute");const M=`(${v.join(",")})`,B=i.createBuffer({label:`bindingBuffer${u.id}_${u.name}_${M}`,size:d,usage:g});c.buffer=B}o.push({binding:a,resource:{buffer:c.buffer}})}else if(u.isStorageBuffer){const c=n.get(u);if(c.buffer===void 0){const d=u.attribute;c.buffer=n.get(d).buffer}o.push({binding:a,resource:{buffer:c.buffer}})}else if(u.isSampledTexture){const c=n.get(u.texture);let d;if(c.externalTexture!==void 0)d=i.importExternalTexture({source:c.externalTexture});else{const g=u.store?1:c.texture.mipLevelCount,v=u.store?u.mipLevel:0;let M=`view-${c.texture.width}-${c.texture.height}`;if(c.texture.depthOrArrayLayers>1&&(M+=`-${c.texture.depthOrArrayLayers}`),M+=`-${g}-${v}`,d=c[M],d===void 0){const B=nW.All;let I;u.isSampledCubeTexture?I=hh.Cube:u.isSampledTexture3D?I=hh.ThreeD:u.texture.isArrayTexture||u.texture.isDataArrayTexture||u.texture.isCompressedArrayTexture?I=hh.TwoDArray:I=hh.TwoD,d=c[M]=c.texture.createView({aspect:B,dimension:I,mipLevelCount:g,baseMipLevel:v})}}o.push({binding:a,resource:d})}else if(u.isSampler){const c=n.get(u.texture);o.push({binding:a,resource:c.sampler})}a++}return i.createBindGroup({label:"bindGroup_"+e.name,layout:t,entries:o})}_createLayoutEntries(e){const t=[];let n=0;for(const i of e.bindings){const a=this.backend,o={binding:n,visibility:i.visibility};if(i.isUniformBuffer||i.isStorageBuffer){const u={};i.isStorageBuffer&&(i.visibility&C0.COMPUTE&&(i.access===od.READ_WRITE||i.access===od.WRITE_ONLY)?u.type=QM.Storage:u.type=QM.ReadOnlyStorage),o.buffer=u}else if(i.isSampledTexture&&i.store){const u={};u.format=this.backend.get(i.texture).texture.format;const c=i.access;c===od.READ_WRITE?u.access=WM.ReadWrite:c===od.WRITE_ONLY?u.access=WM.WriteOnly:u.access=WM.ReadOnly,i.texture.isArrayTexture?u.viewDimension=hh.TwoDArray:i.texture.is3DTexture&&(u.viewDimension=hh.ThreeD),o.storageTexture=u}else if(i.isSampledTexture){const u={},{primarySamples:c}=a.utils.getTextureSampleData(i.texture);if(c>1&&(u.multisampled=!0,i.texture.isDepthTexture||(u.sampleType=R0.UnfilterableFloat)),i.texture.isDepthTexture)a.compatibilityMode&&i.texture.compareFunction===null?u.sampleType=R0.UnfilterableFloat:u.sampleType=R0.Depth;else if(i.texture.isDataTexture||i.texture.isDataArrayTexture||i.texture.isData3DTexture){const d=i.texture.type;d===Xt?u.sampleType=R0.SInt:d===st?u.sampleType=R0.UInt:d===dt&&(this.backend.hasFeature("float32-filterable")?u.sampleType=R0.Float:u.sampleType=R0.UnfilterableFloat)}i.isSampledCubeTexture?u.viewDimension=hh.Cube:i.texture.isArrayTexture||i.texture.isDataArrayTexture||i.texture.isCompressedArrayTexture?u.viewDimension=hh.TwoDArray:i.isSampledTexture3D&&(u.viewDimension=hh.ThreeD),o.texture=u}else if(i.isSampler){const u={};i.texture.isDepthTexture&&(i.texture.compareFunction!==null?u.type=ZN.Comparison:a.compatibilityMode&&(u.type=ZN.NonFiltering)),o.sampler=u}else Gr(`WebGPUBindingUtils: Unsupported binding "${i}".`);t.push(o),n++}return t}deleteBindGroupData(e){const{backend:t}=this,n=t.get(e);n.layout&&(n.layout.usedTimes--,n.layout.usedTimes===0&&this._bindGroupLayoutCache.delete(n.layoutKey),n.layout=void 0,n.layoutKey=void 0)}dispose(){this._bindGroupLayoutCache.clear()}}class CW{constructor(e){this.backend=e,this._activePipelines=new WeakMap}setPipeline(e,t){this._activePipelines.get(e)!==t&&(e.setPipeline(t),this._activePipelines.set(e,t))}_getSampleCount(e){return this.backend.utils.getSampleCountRenderContext(e)}createRenderPipeline(e,t){const{object:n,material:i,geometry:a,pipeline:o}=e,{vertexProgram:u,fragmentProgram:c}=o,d=this.backend,g=d.device,v=d.utils,M=d.get(o),B=[];for(const pr of e.getBindings()){const Br=d.get(pr),{layoutGPU:zr}=Br.layout;B.push(zr)}const I=d.attributeUtils.createShaderVertexBuffers(e);let ne;i.blending!==we&&(i.blending!==ve||i.transparent!==!1)&&(ne=this._getBlending(i));let ee={};i.stencilWrite===!0&&(ee={compare:this._getStencilCompare(i),failOp:this._getStencilOperation(i.stencilFail),depthFailOp:this._getStencilOperation(i.stencilZFail),passOp:this._getStencilOperation(i.stencilZPass)});const q=this._getColorWriteMask(i),ye=[];if(e.context.textures!==null){const pr=e.context.textures;for(let Br=0;Br<pr.length;Br++){const zr=v.getTextureFormatGPU(pr[Br]);Br===0?ye.push({format:zr,blend:ne,writeMask:q}):ye.push({format:zr,writeMask:q})}}else{const pr=v.getCurrentColorFormat(e.context);ye.push({format:pr,blend:ne,writeMask:q})}const Ce=d.get(u).module,ke=d.get(c).module,nt=this._getPrimitiveState(n,a,i),Ye=this._getDepthCompare(i),ht=v.getCurrentDepthStencilFormat(e.context),Rt=this._getSampleCount(e.context),qe={label:`renderPipeline_${i.name||i.type}_${i.id}`,vertex:Object.assign({},Ce,{buffers:I}),fragment:Object.assign({},ke,{targets:ye}),primitive:nt,multisample:{count:Rt,alphaToCoverageEnabled:i.alphaToCoverage&&Rt>1},layout:g.createPipelineLayout({bindGroupLayouts:B})},pt={},xn=e.context.depth,cr=e.context.stencil;if((xn===!0||cr===!0)&&(xn===!0&&(pt.format=ht,pt.depthWriteEnabled=i.depthWrite,pt.depthCompare=Ye),cr===!0&&(pt.stencilFront=ee,pt.stencilBack={},pt.stencilReadMask=i.stencilFuncMask,pt.stencilWriteMask=i.stencilWriteMask),i.polygonOffset===!0&&(pt.depthBias=i.polygonOffsetUnits,pt.depthBiasSlopeScale=i.polygonOffsetFactor,pt.depthBiasClamp=0),qe.depthStencil=pt),g.pushErrorScope("validation"),t===null)M.pipeline=g.createRenderPipeline(qe),g.popErrorScope().then(pr=>{pr!==null&&(M.error=!0,Gr(pr.message))});else{const pr=new Promise(Br=>Pa(this,null,function*(){try{M.pipeline=yield g.createRenderPipelineAsync(qe)}catch(Dr){}const zr=yield g.popErrorScope();zr!==null&&(M.error=!0,Gr(zr.message)),Br()}));t.push(pr)}}createBundleEncoder(e,t="renderBundleEncoder"){const n=this.backend,{utils:i,device:a}=n,o=i.getCurrentDepthStencilFormat(e),u=i.getCurrentColorFormats(e),c=this._getSampleCount(e),d={label:t,colorFormats:u,depthStencilFormat:o,sampleCount:c};return a.createRenderBundleEncoder(d)}createComputePipeline(e,t){const n=this.backend,i=n.device,a=n.get(e.computeProgram).module,o=n.get(e),u=[];for(const c of t){const d=n.get(c),{layoutGPU:g}=d.layout;u.push(g)}o.pipeline=i.createComputePipeline({compute:a,layout:i.createPipelineLayout({bindGroupLayouts:u})})}_getBlending(e){let t,n;const i=e.blending,a=e.blendSrc,o=e.blendDst,u=e.blendEquation;if(i===ct){const c=e.blendSrcAlpha!==null?e.blendSrcAlpha:a,d=e.blendDstAlpha!==null?e.blendDstAlpha:o,g=e.blendEquationAlpha!==null?e.blendEquationAlpha:u;t={srcFactor:this._getBlendFactor(a),dstFactor:this._getBlendFactor(o),operation:this._getBlendOperation(u)},n={srcFactor:this._getBlendFactor(c),dstFactor:this._getBlendFactor(d),operation:this._getBlendOperation(g)}}else{const c=e.premultipliedAlpha,d=(g,v,M,B)=>{t={srcFactor:g,dstFactor:v,operation:B0.Add},n={srcFactor:M,dstFactor:B,operation:B0.Add}};if(c)switch(i){case ve:d(hl.One,hl.OneMinusSrcAlpha,hl.One,hl.OneMinusSrcAlpha);break;case Ee:d(hl.One,hl.One,hl.One,hl.One);break;case $e:d(hl.Zero,hl.OneMinusSrc,hl.Zero,hl.One);break;case Fe:d(hl.Dst,hl.OneMinusSrcAlpha,hl.Zero,hl.One);break}else switch(i){case ve:d(hl.SrcAlpha,hl.OneMinusSrcAlpha,hl.One,hl.OneMinusSrcAlpha);break;case Ee:d(hl.SrcAlpha,hl.One,hl.One,hl.One);break;case $e:Gr("WebGPURenderer: SubtractiveBlending requires material.premultipliedAlpha = true");break;case Fe:Gr("WebGPURenderer: MultiplyBlending requires material.premultipliedAlpha = true");break}}if(t!==void 0&&n!==void 0)return{color:t,alpha:n};Gr("WebGPURenderer: Invalid blending: ",i)}_getBlendFactor(e){let t;switch(e){case Lt:t=hl.Zero;break;case Wn:t=hl.One;break;case Xn:t=hl.Src;break;case In:t=hl.OneMinusSrc;break;case zn:t=hl.SrcAlpha;break;case dr:t=hl.OneMinusSrcAlpha;break;case Ge:t=hl.Dst;break;case Tt:t=hl.OneMinusDst;break;case vn:t=hl.DstAlpha;break;case _r:t=hl.OneMinusDstAlpha;break;case On:t=hl.SrcAlphaSaturated;break;case s5:t=hl.Constant;break;case a5:t=hl.OneMinusConstant;break;default:Gr("WebGPURenderer: Blend factor not supported.",e)}return t}_getStencilCompare(e){let t;const n=e.stencilFunc;switch(n){case fh:t=dd.Never;break;case lu:t=dd.Always;break;case Qf:t=dd.Less;break;case Ah:t=dd.LessEqual;break;case pd:t=dd.Equal;break;case gd:t=dd.GreaterEqual;break;case Vc:t=dd.Greater;break;case jo:t=dd.NotEqual;break;default:Gr("WebGPURenderer: Invalid stencil function.",n)}return t}_getStencilOperation(e){let t;switch(e){case Ku:t=Qm.Keep;break;case Uh:t=Qm.Zero;break;case sc:t=Qm.Replace;break;case Xo:t=Qm.Invert;break;case pu:t=Qm.IncrementClamp;break;case ou:t=Qm.DecrementClamp;break;case Ad:t=Qm.IncrementWrap;break;case hf:t=Qm.DecrementWrap;break;default:Gr("WebGPURenderer: Invalid stencil operation.",t)}return t}_getBlendOperation(e){let t;switch(e){case vt:t=B0.Add;break;case at:t=B0.Subtract;break;case kt:t=B0.ReverseSubtract;break;case It:t=B0.Min;break;case Bn:t=B0.Max;break;default:Gr("WebGPUPipelineUtils: Blend equation not supported.",e)}return t}_getPrimitiveState(e,t,n){const i={},a=this.backend.utils;i.topology=a.getPrimitiveTopology(e,n),t.index!==null&&e.isLine===!0&&e.isLineSegments!==!0&&(i.stripIndexFormat=t.index.array instanceof Uint16Array?Vv.Uint16:Vv.Uint32);let o=n.side===de;return e.isMesh&&e.matrixWorld.determinant()<0&&(o=!o),i.frontFace=o===!0?HN.CW:HN.CCW,i.cullMode=n.side===he?QN.None:QN.Back,i}_getColorWriteMask(e){return e.colorWrite===!0?WN.All:WN.None}_getDepthCompare(e){let t;if(e.depthTest===!1)t=dd.Always;else{const n=e.depthFunc;switch(n){case Mt:t=dd.Never;break;case Et:t=dd.Always;break;case pe:t=dd.Less;break;case Ae:t=dd.LessEqual;break;case Pe:t=dd.Equal;break;case Ut:t=dd.GreaterEqual;break;case jt:t=dd.Greater;break;case ft:t=dd.NotEqual;break;default:Gr("WebGPUPipelineUtils: Invalid depth function.",n)}}return t}}class TW extends zN{constructor(e,t,n=2048){super(n),this.device=e,this.type=t,this.querySet=this.device.createQuerySet({type:"timestamp",count:this.maxQueries,label:`queryset_global_timestamp_${t}`});const i=this.maxQueries*8;this.resolveBuffer=this.device.createBuffer({label:`buffer_timestamp_resolve_${t}`,size:i,usage:GPUBufferUsage.QUERY_RESOLVE|GPUBufferUsage.COPY_SRC}),this.resultBuffer=this.device.createBuffer({label:`buffer_timestamp_result_${t}`,size:i,usage:GPUBufferUsage.COPY_DST|GPUBufferUsage.MAP_READ})}allocateQueriesForContext(e){if(!this.trackTimestamp||this.isDisposed)return null;if(this.currentQueryIndex+2>this.maxQueries)return ki(`WebGPUTimestampQueryPool [${this.type}]: Maximum number of queries exceeded, when using trackTimestamp it is necessary to resolves the queries via renderer.resolveTimestampsAsync( THREE.TimestampQuery.${this.type.toUpperCase()} ).`),null;const t=this.currentQueryIndex;return this.currentQueryIndex+=2,this.queryOffsets.set(e,t),t}resolveQueriesAsync(){return Pa(this,null,function*(){if(!this.trackTimestamp||this.currentQueryIndex===0||this.isDisposed)return this.lastValue;if(this.pendingResolve)return this.pendingResolve;this.pendingResolve=this._resolveQueries();try{return yield this.pendingResolve}finally{this.pendingResolve=null}})}_resolveQueries(){return Pa(this,null,function*(){if(this.isDisposed)return this.lastValue;try{if(this.resultBuffer.mapState!=="unmapped")return this.lastValue;const e=new Map(this.queryOffsets),t=this.currentQueryIndex,n=t*8;this.currentQueryIndex=0,this.queryOffsets.clear();const i=this.device.createCommandEncoder();i.resolveQuerySet(this.querySet,0,t,this.resolveBuffer,0),i.copyBufferToBuffer(this.resolveBuffer,0,this.resultBuffer,0,n);const a=i.finish();if(this.device.queue.submit([a]),this.resultBuffer.mapState!=="unmapped")return this.lastValue;if(yield this.resultBuffer.mapAsync(GPUMapMode.READ,0,n),this.isDisposed)return this.resultBuffer.mapState==="mapped"&&this.resultBuffer.unmap(),this.lastValue;const o=new BigUint64Array(this.resultBuffer.getMappedRange(0,n)),u={},c=[];for(const[g,v]of e){const M=g.match(/^(.*):f(\d+)$/),B=parseInt(M[2]);c.includes(B)===!1&&c.push(B),u[B]===void 0&&(u[B]=0);const I=o[v],ne=o[v+1],ee=Number(ne-I)/1e6;this.timestamps.set(g,ee),u[B]+=ee}const d=u[c[c.length-1]];return this.resultBuffer.unmap(),this.lastValue=d,this.frames=c,d}catch(e){return Gr("Error resolving queries:",e),this.resultBuffer.mapState==="mapped"&&this.resultBuffer.unmap(),this.lastValue}})}dispose(){return Pa(this,null,function*(){if(!this.isDisposed){if(this.isDisposed=!0,this.pendingResolve)try{yield this.pendingResolve}catch(e){Gr("Error waiting for pending resolve:",e)}if(this.resultBuffer&&this.resultBuffer.mapState==="mapped")try{this.resultBuffer.unmap()}catch(e){Gr("Error unmapping buffer:",e)}this.querySet&&(this.querySet.destroy(),this.querySet=null),this.resolveBuffer&&(this.resolveBuffer.destroy(),this.resolveBuffer=null),this.resultBuffer&&(this.resultBuffer.destroy(),this.resultBuffer=null),this.queryOffsets.clear(),this.pendingResolve=null}})}}class $M extends ON{constructor(e={}){super(e),this.isWebGPUBackend=!0,this.parameters.alpha=e.alpha===void 0?!0:e.alpha,this.parameters.compatibilityMode=e.compatibilityMode===void 0?!1:e.compatibilityMode,this.parameters.requiredLimits=e.requiredLimits===void 0?{}:e.requiredLimits,this.compatibilityMode=this.parameters.compatibilityMode,this.device=null,this.defaultRenderPassdescriptor=null,this.utils=new bW(this),this.attributeUtils=new SW(this),this.bindingUtils=new EW(this),this.pipelineUtils=new CW(this),this.textureUtils=new cW(this),this.occludedResolveCache=new Map}init(e){return Pa(this,null,function*(){yield TP($M.prototype,this,"init").call(this,e);const t=this.parameters;let n;if(t.device===void 0){const i={powerPreference:t.powerPreference,featureLevel:t.compatibilityMode?"compatibility":void 0},a=typeof navigator!="undefined"?yield navigator.gpu.requestAdapter(i):null;if(a===null)throw new Error("WebGPUBackend: Unable to create WebGPU adapter.");const o=Object.values(ZM),u=[];for(const d of o)a.features.has(d)&&u.push(d);const c={requiredFeatures:u,requiredLimits:t.requiredLimits};n=yield a.requestDevice(c)}else n=t.device;n.lost.then(i=>{if(i.reason==="destroyed")return;const a={api:"WebGPU",message:i.message||"Unknown reason",reason:i.reason||null,originalEvent:i};e.onDeviceLost(a)}),this.device=n,this.trackTimestamp=this.trackTimestamp&&this.hasFeature(ZM.TimestampQuery),this.updateSize()})}get context(){const e=this.renderer.getCanvasTarget(),t=this.get(e);let n=t.context;if(n===void 0){const i=this.parameters;e.isDefaultCanvasTarget===!0&&i.context!==void 0?n=i.context:n=e.domElement.getContext("webgpu"),"setAttribute"in e.domElement&&e.domElement.setAttribute("data-engine",`three.js r${m} webgpu`);const a=i.alpha?"premultiplied":"opaque",o=i.outputType===Wt?"extended":"standard";n.configure({device:this.device,format:this.utils.getPreferredCanvasFormat(),usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.COPY_SRC,alphaMode:a,toneMapping:{mode:o}}),t.context=n}return n}get coordinateSystem(){return To}getArrayBufferAsync(e){return Pa(this,null,function*(){return yield this.attributeUtils.getArrayBufferAsync(e)})}getContext(){return this.context}_getDefaultRenderPassDescriptor(){const e=this.renderer,t=e.getCanvasTarget(),n=this.get(t),i=e.currentSamples;let a=n.descriptor;if(a===void 0||n.samples!==i){a={colorAttachments:[{view:null}]},(e.depth===!0||e.stencil===!0)&&(a.depthStencilAttachment={view:this.textureUtils.getDepthBuffer(e.depth,e.stencil).createView()});const u=a.colorAttachments[0];i>0?u.view=this.textureUtils.getColorBuffer().createView():u.resolveTarget=void 0,n.descriptor=a,n.samples=i}const o=a.colorAttachments[0];return i>0?o.resolveTarget=this.context.getCurrentTexture().createView():o.view=this.context.getCurrentTexture().createView(),a}_isRenderCameraDepthArray(e){return e.depthTexture&&e.depthTexture.image.depth>1&&e.camera.isArrayCamera}_getRenderPassDescriptor(e,t={}){const n=e.renderTarget,i=this.get(n);let a=i.descriptors;(a===void 0||i.width!==n.width||i.height!==n.height||i.samples!==n.samples)&&(a={},i.descriptors=a);const o=e.getCacheKey();let u=a[o];if(u===void 0){const d=e.textures,g=[];let v;const M=this._isRenderCameraDepthArray(e);for(let B=0;B<d.length;B++){const I=this.get(d[B]),ne={label:`colorAttachment_${B}`,baseMipLevel:e.activeMipmapLevel,mipLevelCount:1,baseArrayLayer:e.activeCubeFace,arrayLayerCount:1,dimension:hh.TwoD};if(n.isRenderTarget3D)v=e.activeCubeFace,ne.baseArrayLayer=0,ne.dimension=hh.ThreeD,ne.depthOrArrayLayers=d[B].image.depth;else if(n.isRenderTarget&&d[B].image.depth>1)if(M===!0){const ee=e.camera.cameras;for(let q=0;q<ee.length;q++){const ye=fd(rl({},ne),{baseArrayLayer:q,arrayLayerCount:1,dimension:hh.TwoD}),Ce=I.texture.createView(ye);g.push({view:Ce,resolveTarget:void 0,depthSlice:void 0})}}else ne.dimension=hh.TwoDArray,ne.depthOrArrayLayers=d[B].image.depth;if(M!==!0){const ee=I.texture.createView(ne);let q,ye;I.msaaTexture!==void 0?(q=I.msaaTexture.createView(),ye=ee):(q=ee,ye=void 0),g.push({view:q,resolveTarget:ye,depthSlice:v})}}if(u={textureViews:g},e.depth){const B=this.get(e.depthTexture),I={};(e.depthTexture.isArrayTexture||e.depthTexture.isCubeTexture)&&(I.dimension=hh.TwoD,I.arrayLayerCount=1,I.baseArrayLayer=e.activeCubeFace),u.depthStencilView=B.texture.createView(I)}a[o]=u,i.width=n.width,i.height=n.height,i.samples=n.samples,i.activeMipmapLevel=e.activeMipmapLevel,i.activeCubeFace=e.activeCubeFace}const c={colorAttachments:[]};for(let d=0;d<u.textureViews.length;d++){const g=u.textureViews[d];let v={r:0,g:0,b:0,a:1};d===0&&t.clearValue&&(v=t.clearValue),c.colorAttachments.push({view:g.view,depthSlice:g.depthSlice,resolveTarget:g.resolveTarget,loadOp:t.loadOp||Kl.Load,storeOp:t.storeOp||uf.Store,clearValue:v})}return u.depthStencilView&&(c.depthStencilAttachment={view:u.depthStencilView}),c}beginRender(e){const t=this.get(e),n=this.device,i=e.occlusionQueryCount;let a;i>0&&(t.currentOcclusionQuerySet&&t.currentOcclusionQuerySet.destroy(),t.currentOcclusionQueryBuffer&&t.currentOcclusionQueryBuffer.destroy(),t.currentOcclusionQuerySet=t.occlusionQuerySet,t.currentOcclusionQueryBuffer=t.occlusionQueryBuffer,t.currentOcclusionQueryObjects=t.occlusionQueryObjects,a=n.createQuerySet({type:"occlusion",count:i,label:`occlusionQuerySet_${e.id}`}),t.occlusionQuerySet=a,t.occlusionQueryIndex=0,t.occlusionQueryObjects=new Array(i),t.lastOcclusionObject=null);let o;e.textures===null?o=this._getDefaultRenderPassDescriptor():o=this._getRenderPassDescriptor(e,{loadOp:Kl.Load}),this.initTimestampQuery(ml.RENDER,this.getTimestampUID(e),o),o.occlusionQuerySet=a;const u=o.depthStencilAttachment;if(e.textures!==null){const d=o.colorAttachments;for(let g=0;g<d.length;g++){const v=d[g];e.clearColor?(v.clearValue=g===0?e.clearColorValue:{r:0,g:0,b:0,a:1},v.loadOp=Kl.Clear):v.loadOp=Kl.Load,v.storeOp=uf.Store}}else{const d=o.colorAttachments[0];e.clearColor?(d.clearValue=e.clearColorValue,d.loadOp=Kl.Clear):d.loadOp=Kl.Load,d.storeOp=uf.Store}e.depth&&(e.clearDepth?(u.depthClearValue=e.clearDepthValue,u.depthLoadOp=Kl.Clear):u.depthLoadOp=Kl.Load,u.depthStoreOp=uf.Store),e.stencil&&(e.clearStencil?(u.stencilClearValue=e.clearStencilValue,u.stencilLoadOp=Kl.Clear):u.stencilLoadOp=Kl.Load,u.stencilStoreOp=uf.Store);const c=n.createCommandEncoder({label:"renderContext_"+e.id});if(this._isRenderCameraDepthArray(e)===!0){const d=e.camera.cameras;!t.layerDescriptors||t.layerDescriptors.length!==d.length?this._createDepthLayerDescriptors(e,t,o,d):this._updateDepthLayerDescriptors(e,t,d),t.bundleEncoders=[],t.bundleSets=[];for(let g=0;g<d.length;g++){const v=this.pipelineUtils.createBundleEncoder(e,"renderBundleArrayCamera_"+g),M={attributes:{},bindingGroups:[],pipeline:null,index:null};t.bundleEncoders.push(v),t.bundleSets.push(M)}t.currentPass=null}else{const d=c.beginRenderPass(o);t.currentPass=d,e.viewport&&this.updateViewport(e),e.scissor&&this.updateScissor(e)}t.descriptor=o,t.encoder=c,t.currentSets={attributes:{},bindingGroups:[],pipeline:null,index:null},t.renderBundles=[]}_createDepthLayerDescriptors(e,t,n,i){const a=n.depthStencilAttachment;t.layerDescriptors=[];const o=this.get(e.depthTexture);o.viewCache||(o.viewCache=[]);for(let u=0;u<i.length;u++){const c=fd(rl({},n),{colorAttachments:[fd(rl({},n.colorAttachments[0]),{view:n.colorAttachments[u].view})]});if(n.depthStencilAttachment){const d=u;o.viewCache[d]||(o.viewCache[d]=o.texture.createView({dimension:hh.TwoD,baseArrayLayer:u,arrayLayerCount:1})),c.depthStencilAttachment={view:o.viewCache[d],depthLoadOp:a.depthLoadOp||Kl.Clear,depthStoreOp:a.depthStoreOp||uf.Store,depthClearValue:a.depthClearValue||1},e.stencil&&(c.depthStencilAttachment.stencilLoadOp=a.stencilLoadOp,c.depthStencilAttachment.stencilStoreOp=a.stencilStoreOp,c.depthStencilAttachment.stencilClearValue=a.stencilClearValue)}else c.depthStencilAttachment=rl({},a);t.layerDescriptors.push(c)}}_updateDepthLayerDescriptors(e,t,n){for(let i=0;i<n.length;i++){const a=t.layerDescriptors[i];if(a.depthStencilAttachment){const o=a.depthStencilAttachment;e.depth&&(e.clearDepth?(o.depthClearValue=e.clearDepthValue,o.depthLoadOp=Kl.Clear):o.depthLoadOp=Kl.Load),e.stencil&&(e.clearStencil?(o.stencilClearValue=e.clearStencilValue,o.stencilLoadOp=Kl.Clear):o.stencilLoadOp=Kl.Load)}}}finishRender(e){const t=this.get(e),n=e.occlusionQueryCount;t.renderBundles.length>0&&t.currentPass.executeBundles(t.renderBundles),n>t.occlusionQueryIndex&&t.currentPass.endOcclusionQuery();const i=t.encoder;if(this._isRenderCameraDepthArray(e)===!0){const a=[];for(let o=0;o<t.bundleEncoders.length;o++){const u=t.bundleEncoders[o];a.push(u.finish())}for(let o=0;o<t.layerDescriptors.length;o++)if(o<a.length){const u=t.layerDescriptors[o],c=i.beginRenderPass(u);if(e.viewport){const{x:d,y:g,width:v,height:M,minDepth:B,maxDepth:I}=e.viewportValue;c.setViewport(d,g,v,M,B,I)}if(e.scissor){const{x:d,y:g,width:v,height:M}=e.scissorValue;c.setScissorRect(d,g,v,M)}c.executeBundles([a[o]]),c.end()}}else t.currentPass&&t.currentPass.end();if(n>0){const a=n*8;let o=this.occludedResolveCache.get(a);o===void 0&&(o=this.device.createBuffer({size:a,usage:GPUBufferUsage.QUERY_RESOLVE|GPUBufferUsage.COPY_SRC}),this.occludedResolveCache.set(a,o));const u=this.device.createBuffer({size:a,usage:GPUBufferUsage.COPY_DST|GPUBufferUsage.MAP_READ});t.encoder.resolveQuerySet(t.occlusionQuerySet,0,n,o,0),t.encoder.copyBufferToBuffer(o,0,u,0,a),t.occlusionQueryBuffer=u,this.resolveOccludedAsync(e)}if(this.device.queue.submit([t.encoder.finish()]),e.textures!==null){const a=e.textures;for(let o=0;o<a.length;o++){const u=a[o];u.generateMipmaps===!0&&this.textureUtils.generateMipmaps(u)}}}isOccluded(e,t){const n=this.get(e);return n.occluded&&n.occluded.has(t)}resolveOccludedAsync(e){return Pa(this,null,function*(){const t=this.get(e),{currentOcclusionQueryBuffer:n,currentOcclusionQueryObjects:i}=t;if(n&&i){const a=new WeakSet;t.currentOcclusionQueryObjects=null,t.currentOcclusionQueryBuffer=null,yield n.mapAsync(GPUMapMode.READ);const o=n.getMappedRange(),u=new BigUint64Array(o);for(let c=0;c<i.length;c++)u[c]===BigInt(0)&&a.add(i[c]);n.destroy(),t.occluded=a}})}updateViewport(e){const{currentPass:t}=this.get(e),{x:n,y:i,width:a,height:o,minDepth:u,maxDepth:c}=e.viewportValue;t.setViewport(n,i,a,o,u,c)}updateScissor(e){const{currentPass:t}=this.get(e),{x:n,y:i,width:a,height:o}=e.scissorValue;t.setScissorRect(n,i,a,o)}getClearColor(){const e=super.getClearColor();return this.renderer.alpha===!0&&(e.r*=e.a,e.g*=e.a,e.b*=e.a),e}clear(e,t,n,i=null){const a=this.device,o=this.renderer;let u=[],c,d,g,v;if(e){const I=this.getClearColor();d={r:I.r,g:I.g,b:I.b,a:I.a}}if(i===null){g=o.depth,v=o.stencil;const I=this._getDefaultRenderPassDescriptor();if(e){u=I.colorAttachments;const ne=u[0];ne.clearValue=d,ne.loadOp=Kl.Clear,ne.storeOp=uf.Store}(g||v)&&(c=I.depthStencilAttachment)}else{g=i.depth,v=i.stencil;const I={loadOp:e?Kl.Clear:Kl.Load,clearValue:e?d:void 0};g&&(I.depthLoadOp=t?Kl.Clear:Kl.Load,I.depthClearValue=t?o.getClearDepth():void 0,I.depthStoreOp=uf.Store),v&&(I.stencilLoadOp=n?Kl.Clear:Kl.Load,I.stencilClearValue=n?o.getClearStencil():void 0,I.stencilStoreOp=uf.Store);const ne=this._getRenderPassDescriptor(i,I);u=ne.colorAttachments,c=ne.depthStencilAttachment}g&&c&&(t?(c.depthLoadOp=Kl.Clear,c.depthClearValue=o.getClearDepth(),c.depthStoreOp=uf.Store):(c.depthLoadOp=Kl.Load,c.depthStoreOp=uf.Store)),v&&c&&(n?(c.stencilLoadOp=Kl.Clear,c.stencilClearValue=o.getClearStencil(),c.stencilStoreOp=uf.Store):(c.stencilLoadOp=Kl.Load,c.stencilStoreOp=uf.Store));const M=a.createCommandEncoder({label:"clear"});M.beginRenderPass({colorAttachments:u,depthStencilAttachment:c}).end(),a.queue.submit([M.finish()])}beginCompute(e){const t=this.get(e),n={label:"computeGroup_"+e.id};this.initTimestampQuery(ml.COMPUTE,this.getTimestampUID(e),n),t.cmdEncoderGPU=this.device.createCommandEncoder({label:"computeGroup_"+e.id}),t.passEncoderGPU=t.cmdEncoderGPU.beginComputePass(n)}compute(e,t,n,i,a=null){const o=this.get(t),{passEncoderGPU:u}=this.get(e),c=this.get(i).pipeline;this.pipelineUtils.setPipeline(u,c);for(let d=0,g=n.length;d<g;d++){const v=n[d],M=this.get(v);u.setBindGroup(d,M.group)}if(a===null&&(a=t.count),a&&typeof a=="object"&&a.isIndirectStorageBufferAttribute){const d=this.get(a).buffer;u.dispatchWorkgroupsIndirect(d,0);return}if(typeof a=="number"){const d=a;if(o.dispatchSize===void 0||o.count!==d){o.dispatchSize=[0,1,1],o.count=d;const g=t.workgroupSize;let v=g[0];for(let I=1;I<g.length;I++)v*=g[I];const M=Math.ceil(d/v),B=this.device.limits.maxComputeWorkgroupsPerDimension;a=[M,1,1],M>B&&(a[0]=Math.min(M,B),a[1]=Math.ceil(M/B)),o.dispatchSize=a}a=o.dispatchSize}u.dispatchWorkgroups(a[0],a[1]||1,a[2]||1)}finishCompute(e){const t=this.get(e);t.passEncoderGPU.end(),this.device.queue.submit([t.cmdEncoderGPU.finish()])}draw(e,t){const{object:n,material:i,context:a,pipeline:o}=e,u=e.getBindings(),c=this.get(a),d=this.get(o),g=d.pipeline;if(d.error===!0)return;const v=e.getIndex(),M=v!==null,B=e.getDrawParameters();if(B===null)return;const I=(ee,q)=>{this.pipelineUtils.setPipeline(ee,g),q.pipeline=g;const ye=q.bindingGroups;for(let ke=0,nt=u.length;ke<nt;ke++){const Ye=u[ke],ht=this.get(Ye);ye[Ye.index]!==Ye.id&&(ee.setBindGroup(Ye.index,ht.group),ye[Ye.index]=Ye.id)}if(M===!0&&q.index!==v){const ke=this.get(v).buffer,nt=v.array instanceof Uint16Array?Vv.Uint16:Vv.Uint32;ee.setIndexBuffer(ke,nt),q.index=v}const Ce=e.getVertexBuffers();for(let ke=0,nt=Ce.length;ke<nt;ke++){const Ye=Ce[ke];if(q.attributes[ke]!==Ye){const ht=this.get(Ye).buffer;ee.setVertexBuffer(ke,ht),q.attributes[ke]=Ye}}a.stencil===!0&&i.stencilWrite===!0&&c.currentStencilRef!==i.stencilRef&&(ee.setStencilReference(i.stencilRef),c.currentStencilRef=i.stencilRef)},ne=(ee,q)=>{if(I(ee,q),n.isBatchedMesh===!0){const ye=n._multiDrawStarts,Ce=n._multiDrawCounts,ke=n._multiDrawCount,nt=n._multiDrawInstances;nt!==null&&ki("WebGPUBackend: renderMultiDrawInstances has been deprecated and will be removed in r184. Append to renderMultiDraw arguments and use indirection.");for(let Ye=0;Ye<ke;Ye++){const ht=nt?nt[Ye]:1,Rt=ht>1?0:Ye;M===!0?ee.drawIndexed(Ce[Ye],ht,ye[Ye]/v.array.BYTES_PER_ELEMENT,0,Rt):ee.draw(Ce[Ye],ht,ye[Ye],Rt),t.update(n,Ce[Ye],ht)}}else if(M===!0){const{vertexCount:ye,instanceCount:Ce,firstVertex:ke}=B,nt=e.getIndirect();if(nt!==null){const Ye=this.get(nt).buffer,ht=e.getIndirectOffset(),Rt=Array.isArray(ht)?ht:[ht];for(let qe=0;qe<Rt.length;qe++)ee.drawIndexedIndirect(Ye,Rt[qe])}else ee.drawIndexed(ye,Ce,ke,0,0);t.update(n,ye,Ce)}else{const{vertexCount:ye,instanceCount:Ce,firstVertex:ke}=B,nt=e.getIndirect();if(nt!==null){const Ye=this.get(nt).buffer,ht=e.getIndirectOffset(),Rt=Array.isArray(ht)?ht:[ht];for(let qe=0;qe<Rt.length;qe++)ee.drawIndirect(Ye,Rt[qe])}else ee.draw(ye,Ce,ke,0);t.update(n,ye,Ce)}};if(e.camera.isArrayCamera&&e.camera.cameras.length>0){const ee=this.get(e.camera),q=e.camera.cameras,ye=e.getBindingGroup("cameraIndex");if(ee.indexesGPU===void 0||ee.indexesGPU.length!==q.length){const ke=this.get(ye),nt=[],Ye=new Uint32Array([0,0,0,0]);for(let ht=0,Rt=q.length;ht<Rt;ht++){Ye[0]=ht;const{layoutGPU:qe}=ke.layout,pt=this.bindingUtils.createBindGroupIndex(Ye,qe);nt.push(pt)}ee.indexesGPU=nt}const Ce=this.renderer.getPixelRatio();for(let ke=0,nt=q.length;ke<nt;ke++){const Ye=q[ke];if(n.layers.test(Ye.layers)){const ht=Ye.viewport;let Rt=c.currentPass,qe=c.currentSets;if(c.bundleEncoders){const pt=c.bundleEncoders[ke],xn=c.bundleSets[ke];Rt=pt,qe=xn}ht&&Rt.setViewport(Math.floor(ht.x*Ce),Math.floor(ht.y*Ce),Math.floor(ht.width*Ce),Math.floor(ht.height*Ce),a.viewportValue.minDepth,a.viewportValue.maxDepth),ye&&ee.indexesGPU&&(Rt.setBindGroup(ye.index,ee.indexesGPU[ke]),qe.bindingGroups[ye.index]=ye.id),ne(Rt,qe)}}}else if(c.currentPass){if(c.occlusionQuerySet!==void 0){const ee=c.lastOcclusionObject;ee!==n&&(ee!==null&&ee.occlusionTest===!0&&(c.currentPass.endOcclusionQuery(),c.occlusionQueryIndex++),n.occlusionTest===!0&&(c.currentPass.beginOcclusionQuery(c.occlusionQueryIndex),c.occlusionQueryObjects[c.occlusionQueryIndex]=n),c.lastOcclusionObject=n)}ne(c.currentPass,c.currentSets)}}needsRenderUpdate(e){const t=this.get(e),{object:n,material:i}=e,a=this.utils,o=a.getSampleCountRenderContext(e.context),u=a.getCurrentColorSpace(e.context),c=a.getCurrentColorFormat(e.context),d=a.getCurrentDepthStencilFormat(e.context),g=a.getPrimitiveTopology(n,i);let v=!1;return(t.material!==i||t.materialVersion!==i.version||t.transparent!==i.transparent||t.blending!==i.blending||t.premultipliedAlpha!==i.premultipliedAlpha||t.blendSrc!==i.blendSrc||t.blendDst!==i.blendDst||t.blendEquation!==i.blendEquation||t.blendSrcAlpha!==i.blendSrcAlpha||t.blendDstAlpha!==i.blendDstAlpha||t.blendEquationAlpha!==i.blendEquationAlpha||t.colorWrite!==i.colorWrite||t.depthWrite!==i.depthWrite||t.depthTest!==i.depthTest||t.depthFunc!==i.depthFunc||t.stencilWrite!==i.stencilWrite||t.stencilFunc!==i.stencilFunc||t.stencilFail!==i.stencilFail||t.stencilZFail!==i.stencilZFail||t.stencilZPass!==i.stencilZPass||t.stencilFuncMask!==i.stencilFuncMask||t.stencilWriteMask!==i.stencilWriteMask||t.side!==i.side||t.alphaToCoverage!==i.alphaToCoverage||t.sampleCount!==o||t.colorSpace!==u||t.colorFormat!==c||t.depthStencilFormat!==d||t.primitiveTopology!==g||t.clippingContextCacheKey!==e.clippingContextCacheKey)&&(t.material=i,t.materialVersion=i.version,t.transparent=i.transparent,t.blending=i.blending,t.premultipliedAlpha=i.premultipliedAlpha,t.blendSrc=i.blendSrc,t.blendDst=i.blendDst,t.blendEquation=i.blendEquation,t.blendSrcAlpha=i.blendSrcAlpha,t.blendDstAlpha=i.blendDstAlpha,t.blendEquationAlpha=i.blendEquationAlpha,t.colorWrite=i.colorWrite,t.depthWrite=i.depthWrite,t.depthTest=i.depthTest,t.depthFunc=i.depthFunc,t.stencilWrite=i.stencilWrite,t.stencilFunc=i.stencilFunc,t.stencilFail=i.stencilFail,t.stencilZFail=i.stencilZFail,t.stencilZPass=i.stencilZPass,t.stencilFuncMask=i.stencilFuncMask,t.stencilWriteMask=i.stencilWriteMask,t.side=i.side,t.alphaToCoverage=i.alphaToCoverage,t.sampleCount=o,t.colorSpace=u,t.colorFormat=c,t.depthStencilFormat=d,t.primitiveTopology=g,t.clippingContextCacheKey=e.clippingContextCacheKey,v=!0),v}getRenderCacheKey(e){const{object:t,material:n}=e,i=this.utils,a=e.context,o=t.isMesh&&t.matrixWorld.determinant()<0;return[n.transparent,n.blending,n.premultipliedAlpha,n.blendSrc,n.blendDst,n.blendEquation,n.blendSrcAlpha,n.blendDstAlpha,n.blendEquationAlpha,n.colorWrite,n.depthWrite,n.depthTest,n.depthFunc,n.stencilWrite,n.stencilFunc,n.stencilFail,n.stencilZFail,n.stencilZPass,n.stencilFuncMask,n.stencilWriteMask,n.side,o,i.getSampleCountRenderContext(a),i.getCurrentColorSpace(a),i.getCurrentColorFormat(a),i.getCurrentDepthStencilFormat(a),i.getPrimitiveTopology(t,n),e.getGeometryCacheKey(),e.clippingContextCacheKey].join()}updateSampler(e){return this.textureUtils.updateSampler(e)}createDefaultTexture(e){return 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,t=!1){this.textureUtils.destroyTexture(e,t)}copyTextureToBuffer(e,t,n,i,a,o){return Pa(this,null,function*(){return this.textureUtils.copyTextureToBuffer(e,t,n,i,a,o)})}initTimestampQuery(e,t,n){if(!this.trackTimestamp)return;this.timestampQueryPool[e]||(this.timestampQueryPool[e]=new TW(this.device,e,2048));const i=this.timestampQueryPool[e],a=i.allocateQueriesForContext(t);n.timestampWrites={querySet:i.querySet,beginningOfPassWriteIndex:a,endOfPassWriteIndex:a+1}}createNodeBuilder(e,t){return new xW(e,t)}createProgram(e){const t=this.get(e);t.module={module:this.device.createShaderModule({code:e.code,label:e.stage+(e.name!==""?`_${e.name}`:"")}),entryPoint:"main"}}destroyProgram(e){this.delete(e)}createRenderPipeline(e,t){this.pipelineUtils.createRenderPipeline(e,t)}createComputePipeline(e,t){this.pipelineUtils.createComputePipeline(e,t)}beginBundle(e){const t=this.get(e);t._currentPass=t.currentPass,t._currentSets=t.currentSets,t.currentSets={attributes:{},bindingGroups:[],pipeline:null,index:null},t.currentPass=this.pipelineUtils.createBundleEncoder(e)}finishBundle(e,t){const n=this.get(e),a=n.currentPass.finish();this.get(t).bundleGPU=a,n.currentSets=n._currentSets,n.currentPass=n._currentPass}addBundle(e,t){this.get(e).renderBundles.push(this.get(t).bundleGPU)}createBindings(e,t,n,i){this.bindingUtils.createBindings(e,t,n,i)}updateBindings(e,t,n,i){this.bindingUtils.createBindings(e,t,n,i)}updateBinding(e){this.bindingUtils.updateBinding(e)}deleteBindGroupData(e){this.bindingUtils.deleteBindGroupData(e)}createIndexAttribute(e){let t=GPUBufferUsage.INDEX|GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST;(e.isStorageBufferAttribute||e.isStorageInstancedBufferAttribute)&&(t|=GPUBufferUsage.STORAGE),this.attributeUtils.createAttribute(e,t)}createAttribute(e){this.attributeUtils.createAttribute(e,GPUBufferUsage.VERTEX|GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST)}createStorageAttribute(e){this.attributeUtils.createAttribute(e,GPUBufferUsage.STORAGE|GPUBufferUsage.VERTEX|GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST)}createIndirectStorageAttribute(e){this.attributeUtils.createAttribute(e,GPUBufferUsage.STORAGE|GPUBufferUsage.INDIRECT|GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST)}updateAttribute(e){this.attributeUtils.updateAttribute(e)}destroyAttribute(e){this.attributeUtils.destroyAttribute(e)}updateSize(){this.delete(this.renderer.getCanvasTarget())}getMaxAnisotropy(){return 16}hasFeature(e){return $N[e]!==void 0&&(e=$N[e]),this.device.features.has(e)}copyTextureToTexture(e,t,n=null,i=null,a=0,o=0){let u=0,c=0,d=0,g=0,v=0,M=0,B=e.image.width,I=e.image.height,ne=1;n!==null&&(n.isBox3===!0?(g=n.min.x,v=n.min.y,M=n.min.z,B=n.max.x-n.min.x,I=n.max.y-n.min.y,ne=n.max.z-n.min.z):(g=n.min.x,v=n.min.y,B=n.max.x-n.min.x,I=n.max.y-n.min.y,ne=1)),i!==null&&(u=i.x,c=i.y,d=i.z||0);const ee=this.device.createCommandEncoder({label:"copyTextureToTexture_"+e.id+"_"+t.id}),q=this.get(e).texture,ye=this.get(t).texture;ee.copyTextureToTexture({texture:q,mipLevel:a,origin:{x:g,y:v,z:M}},{texture:ye,mipLevel:o,origin:{x:u,y:c,z:d}},[B,I,ne]),this.device.queue.submit([ee.finish()]),o===0&&t.generateMipmaps&&this.textureUtils.generateMipmaps(t)}copyFramebufferToTexture(e,t,n){const i=this.get(t);let a=null;t.renderTarget?e.isDepthTexture?a=this.get(t.depthTexture).texture:a=this.get(t.textures[0]).texture:e.isDepthTexture?a=this.textureUtils.getDepthBuffer(t.depth,t.stencil):a=this.context.getCurrentTexture();const o=this.get(e).texture;if(a.format!==o.format){Gr("WebGPUBackend: copyFramebufferToTexture: Source and destination formats do not match.",a.format,o.format);return}let u;if(i.currentPass?(i.currentPass.end(),u=i.encoder):u=this.device.createCommandEncoder({label:"copyFramebufferToTexture_"+e.id}),u.copyTextureToTexture({texture:a,origin:[n.x,n.y,0]},{texture:o},[n.z,n.w]),e.generateMipmaps&&this.textureUtils.generateMipmaps(e,u),i.currentPass){const{descriptor:c}=i;for(let d=0;d<c.colorAttachments.length;d++)c.colorAttachments[d].loadOp=Kl.Load;t.depth&&(c.depthStencilAttachment.depthLoadOp=Kl.Load),t.stencil&&(c.depthStencilAttachment.stencilLoadOp=Kl.Load),i.currentPass=u.beginRenderPass(c),i.currentSets={attributes:{},bindingGroups:[],pipeline:null,index:null},t.viewport&&this.updateViewport(t),t.scissor&&this.updateScissor(t)}else this.device.queue.submit([u.finish()])}dispose(){if(this.bindingUtils.dispose(),this.textureUtils.dispose(),this.occludedResolveCache){for(const e of this.occludedResolveCache.values())e.destroy();this.occludedResolveCache.clear()}if(this.timestampQueryPool)for(const e of Object.values(this.timestampQueryPool))e!==null&&e.dispose();this.parameters.device===void 0&&this.device!==null&&this.device.destroy()}}class BW extends $0{constructor(e,t,n,i,a,o){super(e,t,n,i,a,o),this.iesMap=null}copy(e,t){return super.copy(e,t),this.iesMap=e.iesMap,this}}class RW extends $0{constructor(e,t,n,i,a,o){super(e,t,n,i,a,o),this.aspect=null}copy(e,t){return super.copy(e,t),this.aspect=e.aspect,this}}class IW extends xN{constructor(){super(),this.addMaterial(WV,"MeshPhongMaterial"),this.addMaterial(jR,"MeshStandardMaterial"),this.addMaterial(Uz,"MeshPhysicalMaterial"),this.addMaterial(zz,"MeshToonMaterial"),this.addMaterial(DV,"MeshBasicMaterial"),this.addMaterial(HV,"MeshLambertMaterial"),this.addMaterial(FV,"MeshNormalMaterial"),this.addMaterial(Hz,"MeshMatcapMaterial"),this.addMaterial(CV,"LineBasicMaterial"),this.addMaterial(BV,"LineDashedMaterial"),this.addMaterial($z,"PointsMaterial"),this.addMaterial(qR,"SpriteMaterial"),this.addMaterial(qz,"ShadowMaterial"),this.addLight(RQ,Dx),this.addLight(o8,t0),this.addLight(l8,kx),this.addLight(FM,$0),this.addLight(d8,X0),this.addLight(f8,Sm),this.addLight(A8,ow),this.addLight(u8,BW),this.addLight(h8,RW),this.addToneMapping(SI,sn),this.addToneMapping(MI,W),this.addToneMapping(EI,Se),this.addToneMapping(CI,Ht),this.addToneMapping(TI,Fn),this.addToneMapping(BI,Tn)}}class NW extends P8{constructor(e={}){let t;e.forceWebGL?t=GN:(t=$M,e.getFallback=()=>(Lr("WebGPURenderer: WebGPU is not available, running under WebGL2 backend."),new GN(e)));const n=new t(e);super(n,e),this.library=new IW,this.isWebGPURenderer=!0,typeof __THREE_DEVTOOLS__!="undefined"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}}class Sj extends null{constructor(){super(),this.isBundleGroup=!0,this.type="BundleGroup",this.static=!0,this.version=0}set needsUpdate(e){e===!0&&this.version++}}class Mj{constructor(e,t=Ks(0,0,1,1)){this.renderer=e,this.outputNode=t,this.outputColorTransform=!0,this.needsUpdate=!0;const n=new yc;n.name="PostProcessing",this._quadMesh=new nx(n),this._quadMesh.name="Post-Processing",this._context=null}render(){const e=this.renderer;this._update(),this._context.onBeforePostProcessing!==null&&this._context.onBeforePostProcessing();const t=e.toneMapping,n=e.outputColorSpace;e.toneMapping=NoToneMapping,e.outputColorSpace=ColorManagement.workingColorSpace;const i=e.xr.enabled;e.xr.enabled=!1,this._quadMesh.render(e),e.xr.enabled=i,e.toneMapping=t,e.outputColorSpace=n,this._context.onAfterPostProcessing!==null&&this._context.onAfterPostProcessing()}get context(){return this._context}dispose(){this._quadMesh.material.dispose()}_update(){if(this.needsUpdate===!0){const e=this.renderer,t=e.toneMapping,n=e.outputColorSpace,i={postProcessing:this,onBeforePostProcessing:null,onAfterPostProcessing:null};let a=this.outputNode;this.outputColorTransform===!0?(a=a.context(i),a=nS(a,t,n)):(i.toneMapping=t,i.outputColorSpace=n,a=a.context(i)),this._context=i,this._quadMesh.material.fragmentNode=a,this._quadMesh.material.needsUpdate=!0,this.needsUpdate=!1}}renderAsync(){return Pa(this,null,function*(){warnOnce('PostProcessing: "renderAsync()" has been deprecated. Use "render()" and "await renderer.init();" when creating the renderer.'),yield this.renderer.init(),this.render()})}}class Ej extends null{constructor(e=1,t=1){super(),this.image={width:e,height:t},this.magFilter=LinearFilter,this.minFilter=LinearFilter,this.isStorageTexture=!0,this.mipmapsAutoUpdate=!0}setSize(e,t){(this.image.width!==e||this.image.height!==t)&&(this.image.width=e,this.image.height=t,this.dispose())}}class Cj extends null{constructor(e=1,t=1,n=1){super(),this.isArrayTexture=!1,this.image={width:e,height:t,depth:n},this.magFilter=LinearFilter,this.minFilter=LinearFilter,this.wrapR=ClampToEdgeWrapping,this.isStorageTexture=!0,this.is3DTexture=!0}setSize(e,t,n){(this.image.width!==e||this.image.height!==t||this.image.depth!==n)&&(this.image.width=e,this.image.height=t,this.image.depth=n,this.dispose())}}class Tj extends null{constructor(e=1,t=1,n=1){super(),this.isArrayTexture=!0,this.image={width:e,height:t,depth:n},this.magFilter=LinearFilter,this.minFilter=LinearFilter,this.isStorageTexture=!0}setSize(e,t,n){(this.image.width!==e||this.image.height!==t||this.image.depth!==n)&&(this.image.width=e,this.image.height=t,this.image.depth=n,this.dispose())}}class Bj extends null{constructor(e,t){super(e,t,Uint32Array),this.isIndirectStorageBufferAttribute=!0}}class FW extends null{constructor(e){super(e),this.textures={},this.nodes={}}load(e,t,n,i){const a=new FileLoader(this.manager);a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,o=>{try{t(this.parse(JSON.parse(o)))}catch(u){i?i(u):error(u),this.manager.itemError(e)}},n,i)}parseNodes(e){const t={};if(e!==void 0){for(const i of e){const{uuid:a,type:o}=i;t[a]=this.createNodeFromType(o),t[a].uuid=a}const n={nodes:t,textures:this.textures};for(const i of e)i.meta=n,t[i.uuid].deserialize(i),delete i.meta}return t}parse(e){const t=this.createNodeFromType(e.type);t.uuid=e.uuid;const i={nodes:this.parseNodes(e.nodes),textures:this.textures};return e.meta=i,t.deserialize(e),delete e.meta,t}setTextures(e){return this.textures=e,this}setNodes(e){return this.nodes=e,this}createNodeFromType(e){return this.nodes[e]===void 0?(error("NodeLoader: Node type not found:",e),qt()):new this.nodes[e]}}class PW extends null{constructor(e){super(e),this.nodes={},this.nodeMaterials={}}parse(e){const t=super.parse(e),n=this.nodes,i=e.inputNodes;for(const a in i){const o=i[a];t[a]=n[o]}return t}setNodes(e){return this.nodes=e,this}setNodeMaterials(e){return this.nodeMaterials=e,this}createMaterialFromType(e){const t=this.nodeMaterials[e];return t!==void 0?new t:super.createMaterialFromType(e)}}class Rj extends null{constructor(e){super(e),this.nodes={},this.nodeMaterials={},this._nodesJSON=null}setNodes(e){return this.nodes=e,this}setNodeMaterials(e){return this.nodeMaterials=e,this}parse(e,t){this._nodesJSON=e.nodes;const n=super.parse(e,t);return this._nodesJSON=null,n}parseNodes(e,t){if(e!==void 0){const n=new FW;return n.setNodes(this.nodes),n.setTextures(t),n.parseNodes(e)}return{}}parseMaterials(e,t){const n={};if(e!==void 0){const i=this.parseNodes(this._nodesJSON,t),a=new PW;a.setTextures(t),a.setNodes(i),a.setNodeMaterials(this.nodeMaterials);for(let o=0,u=e.length;o<u;o++){const c=e[o];n[c.uuid]=a.parse(c)}}return n}}class Ij extends null{constructor(){super(),this.isClippingGroup=!0,this.clippingPlanes=[],this.enabled=!0,this.clipIntersection=!1,this.clipShadows=!1}}const XM={type:"change"},jM={type:"start"},YM={type:"end"},tF=1e-6,$l={NONE:-1,ROTATE:0,ZOOM:1,PAN:2,TOUCH_ROTATE:3,TOUCH_ZOOM_PAN:4},O_=new ce,Wm=new ce,LW=new le,D_=new le,qM=new le,zv=new Ze,nF=new le,k_=new le,JM=new le,V_=new le;class UW extends rv{constructor(e,t=null){super(e,t),this.screen={left:0,top:0,width:0,height:0},this.rotateSpeed=1,this.zoomSpeed=1.2,this.panSpeed=.3,this.noRotate=!1,this.noZoom=!1,this.noPan=!1,this.staticMoving=!1,this.dynamicDampingFactor=.2,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.keys=["KeyA","KeyS","KeyD"],this.mouseButtons={LEFT:Z.ROTATE,MIDDLE:Z.DOLLY,RIGHT:Z.PAN},this.target=new le,this.state=$l.NONE,this.keyState=$l.NONE,this._lastPosition=new le,this._lastZoom=1,this._touchZoomDistanceStart=0,this._touchZoomDistanceEnd=0,this._lastAngle=0,this._eye=new le,this._movePrev=new ce,this._moveCurr=new ce,this._lastAxis=new le,this._zoomStart=new ce,this._zoomEnd=new ce,this._panStart=new ce,this._panEnd=new ce,this._pointers=[],this._pointerPositions={},this._onPointerMove=DW.bind(this),this._onPointerDown=OW.bind(this),this._onPointerUp=kW.bind(this),this._onPointerCancel=VW.bind(this),this._onContextMenu=KW.bind(this),this._onMouseWheel=ZW.bind(this),this._onKeyDown=GW.bind(this),this._onKeyUp=zW.bind(this),this._onTouchStart=$W.bind(this),this._onTouchMove=XW.bind(this),this._onTouchEnd=jW.bind(this),this._onMouseDown=HW.bind(this),this._onMouseMove=QW.bind(this),this._onMouseUp=WW.bind(this),this._target0=this.target.clone(),this._position0=this.object.position.clone(),this._up0=this.object.up.clone(),this._zoom0=this.object.zoom,t!==null&&(this.connect(t),this.handleResize()),this.update()}connect(e){super.connect(e),window.addEventListener("keydown",this._onKeyDown),window.addEventListener("keyup",this._onKeyUp),this.domElement.addEventListener("pointerdown",this._onPointerDown),this.domElement.addEventListener("pointercancel",this._onPointerCancel),this.domElement.addEventListener("wheel",this._onMouseWheel,{passive:!1}),this.domElement.addEventListener("contextmenu",this._onContextMenu),this.domElement.style.touchAction="none"}disconnect(){window.removeEventListener("keydown",this._onKeyDown),window.removeEventListener("keyup",this._onKeyUp),this.domElement.removeEventListener("pointerdown",this._onPointerDown),this.domElement.ownerDocument.removeEventListener("pointermove",this._onPointerMove),this.domElement.ownerDocument.removeEventListener("pointerup",this._onPointerUp),this.domElement.removeEventListener("pointercancel",this._onPointerCancel),this.domElement.removeEventListener("wheel",this._onMouseWheel),this.domElement.removeEventListener("contextmenu",this._onContextMenu),this.domElement.style.touchAction="auto"}dispose(){this.disconnect()}handleResize(){const e=this.domElement.getBoundingClientRect(),t=this.domElement.ownerDocument.documentElement;this.screen.left=e.left+window.pageXOffset-t.clientLeft,this.screen.top=e.top+window.pageYOffset-t.clientTop,this.screen.width=e.width,this.screen.height=e.height}update(){this._eye.subVectors(this.object.position,this.target),this.noRotate||this._rotateCamera(),this.noZoom||this._zoomCamera(),this.noPan||this._panCamera(),this.object.position.addVectors(this.target,this._eye),this.object.isPerspectiveCamera?(this._checkDistances(),this.object.lookAt(this.target),this._lastPosition.distanceToSquared(this.object.position)>tF&&(this.dispatchEvent(XM),this._lastPosition.copy(this.object.position))):this.object.isOrthographicCamera?(this.object.lookAt(this.target),(this._lastPosition.distanceToSquared(this.object.position)>tF||this._lastZoom!==this.object.zoom)&&(this.dispatchEvent(XM),this._lastPosition.copy(this.object.position),this._lastZoom=this.object.zoom)):console.warn("THREE.TrackballControls: Unsupported camera type.")}reset(){this.state=$l.NONE,this.keyState=$l.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(XM),this._lastPosition.copy(this.object.position),this._lastZoom=this.object.zoom}_panCamera(){if(Wm.copy(this._panEnd).sub(this._panStart),Wm.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;Wm.x*=e,Wm.y*=t}Wm.multiplyScalar(this._eye.length()*this.panSpeed),D_.copy(this._eye).cross(this.object.up).setLength(Wm.x),D_.add(LW.copy(this.object.up).setLength(Wm.y)),this.object.position.add(D_),this.target.add(D_),this.staticMoving?this._panStart.copy(this._panEnd):this._panStart.add(Wm.subVectors(this._panEnd,this._panStart).multiplyScalar(this.dynamicDampingFactor))}}_rotateCamera(){V_.set(this._moveCurr.x-this._movePrev.x,this._moveCurr.y-this._movePrev.y,0);let e=V_.length();e?(this._eye.copy(this.object.position).sub(this.target),nF.copy(this._eye).normalize(),k_.copy(this.object.up).normalize(),JM.crossVectors(k_,nF).normalize(),k_.setLength(this._moveCurr.y-this._movePrev.y),JM.setLength(this._moveCurr.x-this._movePrev.x),V_.copy(k_.add(JM)),qM.crossVectors(V_,this._eye).normalize(),e*=this.rotateSpeed,zv.setFromAxisAngle(qM,e),this._eye.applyQuaternion(zv),this.object.up.applyQuaternion(zv),this._lastAxis.copy(qM),this._lastAngle=e):!this.staticMoving&&this._lastAngle&&(this._lastAngle*=Math.sqrt(1-this.dynamicDampingFactor),this._eye.copy(this.object.position).sub(this.target),zv.setFromAxisAngle(this._lastAxis,this._lastAngle),this._eye.applyQuaternion(zv),this.object.up.applyQuaternion(zv)),this._movePrev.copy(this._moveCurr)}_zoomCamera(){let e;this.state===$l.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=me.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=me.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 O_.set((e-this.screen.left)/this.screen.width,(t-this.screen.top)/this.screen.height),O_}_getMouseOnCircle(e,t){return O_.set((e-this.screen.width*.5-this.screen.left)/(this.screen.width*.5),(this.screen.height+2*(this.screen.top-t))/this.screen.width),O_}_addPointer(e){this._pointers.push(e)}_removePointer(e){delete this._pointerPositions[e.pointerId];for(let t=0;t<this._pointers.length;t++)if(this._pointers[t].pointerId==e.pointerId){this._pointers.splice(t,1);return}}_trackPointer(e){let t=this._pointerPositions[e.pointerId];t===void 0&&(t=new ce,this._pointerPositions[e.pointerId]=t),t.set(e.pageX,e.pageY)}_getSecondPointerPosition(e){const t=e.pointerId===this._pointers[0].pointerId?this._pointers[1]:this._pointers[0];return this._pointerPositions[t.pointerId]}_checkDistances(){(!this.noZoom||!this.noPan)&&(this._eye.lengthSq()>this.maxDistance*this.maxDistance&&(this.object.position.addVectors(this.target,this._eye.setLength(this.maxDistance)),this._zoomStart.copy(this._zoomEnd)),this._eye.lengthSq()<this.minDistance*this.minDistance&&(this.object.position.addVectors(this.target,this._eye.setLength(this.minDistance)),this._zoomStart.copy(this._zoomEnd)))}}function OW(s){this.enabled!==!1&&(this._pointers.length===0&&(this.domElement.setPointerCapture(s.pointerId),this.domElement.ownerDocument.addEventListener("pointermove",this._onPointerMove),this.domElement.ownerDocument.addEventListener("pointerup",this._onPointerUp)),this._addPointer(s),s.pointerType==="touch"?this._onTouchStart(s):this._onMouseDown(s))}function DW(s){this.enabled!==!1&&(s.pointerType==="touch"?this._onTouchMove(s):this._onMouseMove(s))}function kW(s){this.enabled!==!1&&(s.pointerType==="touch"?this._onTouchEnd(s):this._onMouseUp(),this._removePointer(s),this._pointers.length===0&&(this.domElement.releasePointerCapture(s.pointerId),this.domElement.ownerDocument.removeEventListener("pointermove",this._onPointerMove),this.domElement.ownerDocument.removeEventListener("pointerup",this._onPointerUp)))}function VW(s){this._removePointer(s)}function zW(){this.enabled!==!1&&(this.keyState=$l.NONE,window.addEventListener("keydown",this._onKeyDown))}function GW(s){this.enabled!==!1&&(window.removeEventListener("keydown",this._onKeyDown),this.keyState===$l.NONE&&(s.code===this.keys[$l.ROTATE]&&!this.noRotate?this.keyState=$l.ROTATE:s.code===this.keys[$l.ZOOM]&&!this.noZoom?this.keyState=$l.ZOOM:s.code===this.keys[$l.PAN]&&!this.noPan&&(this.keyState=$l.PAN)))}function HW(s){let e;switch(s.button){case 0:e=this.mouseButtons.LEFT;break;case 1:e=this.mouseButtons.MIDDLE;break;case 2:e=this.mouseButtons.RIGHT;break;default:e=-1}switch(e){case Z.DOLLY:this.state=$l.ZOOM;break;case Z.ROTATE:this.state=$l.ROTATE;break;case Z.PAN:this.state=$l.PAN;break;default:this.state=$l.NONE}const t=this.keyState!==$l.NONE?this.keyState:this.state;t===$l.ROTATE&&!this.noRotate?(this._moveCurr.copy(this._getMouseOnCircle(s.pageX,s.pageY)),this._movePrev.copy(this._moveCurr)):t===$l.ZOOM&&!this.noZoom?(this._zoomStart.copy(this._getMouseOnScreen(s.pageX,s.pageY)),this._zoomEnd.copy(this._zoomStart)):t===$l.PAN&&!this.noPan&&(this._panStart.copy(this._getMouseOnScreen(s.pageX,s.pageY)),this._panEnd.copy(this._panStart)),this.dispatchEvent(jM)}function QW(s){const e=this.keyState!==$l.NONE?this.keyState:this.state;e===$l.ROTATE&&!this.noRotate?(this._movePrev.copy(this._moveCurr),this._moveCurr.copy(this._getMouseOnCircle(s.pageX,s.pageY))):e===$l.ZOOM&&!this.noZoom?this._zoomEnd.copy(this._getMouseOnScreen(s.pageX,s.pageY)):e===$l.PAN&&!this.noPan&&this._panEnd.copy(this._getMouseOnScreen(s.pageX,s.pageY))}function WW(){this.state=$l.NONE,this.dispatchEvent(YM)}function ZW(s){if(this.enabled!==!1&&this.noZoom!==!0){switch(s.preventDefault(),s.deltaMode){case 2:this._zoomStart.y-=s.deltaY*.025;break;case 1:this._zoomStart.y-=s.deltaY*.01;break;default:this._zoomStart.y-=s.deltaY*25e-5;break}this.dispatchEvent(jM),this.dispatchEvent(YM)}}function KW(s){this.enabled!==!1&&s.preventDefault()}function $W(s){switch(this._trackPointer(s),this._pointers.length){case 1:this.state=$l.TOUCH_ROTATE,this._moveCurr.copy(this._getMouseOnCircle(this._pointers[0].pageX,this._pointers[0].pageY)),this._movePrev.copy(this._moveCurr);break;default:this.state=$l.TOUCH_ZOOM_PAN;const e=this._pointers[0].pageX-this._pointers[1].pageX,t=this._pointers[0].pageY-this._pointers[1].pageY;this._touchZoomDistanceEnd=this._touchZoomDistanceStart=Math.sqrt(e*e+t*t);const n=(this._pointers[0].pageX+this._pointers[1].pageX)/2,i=(this._pointers[0].pageY+this._pointers[1].pageY)/2;this._panStart.copy(this._getMouseOnScreen(n,i)),this._panEnd.copy(this._panStart);break}this.dispatchEvent(jM)}function XW(s){switch(this._trackPointer(s),this._pointers.length){case 1:this._movePrev.copy(this._moveCurr),this._moveCurr.copy(this._getMouseOnCircle(s.pageX,s.pageY));break;default:const e=this._getSecondPointerPosition(s),t=s.pageX-e.x,n=s.pageY-e.y;this._touchZoomDistanceEnd=Math.sqrt(t*t+n*n);const i=(s.pageX+e.x)/2,a=(s.pageY+e.y)/2;this._panEnd.copy(this._getMouseOnScreen(i,a));break}}function jW(s){switch(this._pointers.length){case 0:this.state=$l.NONE;break;case 1:this.state=$l.TOUCH_ROTATE,this._moveCurr.copy(this._getMouseOnCircle(s.pageX,s.pageY)),this._movePrev.copy(this._moveCurr);break;case 2:this.state=$l.TOUCH_ZOOM_PAN;for(let e=0;e<this._pointers.length;e++)if(this._pointers[e].pointerId!==s.pointerId){const t=this._pointerPositions[this._pointers[e].pointerId];this._moveCurr.copy(this._getMouseOnCircle(t.x,t.y)),this._movePrev.copy(this._moveCurr);break}break}this.dispatchEvent(YM)}const rF={type:"change"},eE={type:"start"},iF={type:"end"},z_=new aa,sF=new Ec,YW=Math.cos(70*me.DEG2RAD),Lh=new le,zf=2*Math.PI,Mu={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6},tE=1e-6;class qW extends rv{constructor(e,t=null){super(e,t),this.state=Mu.NONE,this.target=new le,this.cursor=new le,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minTargetRadius=0,this.maxTargetRadius=1/0,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.enableDamping=!1,this.dampingFactor=.05,this.enableZoom=!0,this.zoomSpeed=1,this.enableRotate=!0,this.rotateSpeed=1,this.keyRotateSpeed=1,this.enablePan=!0,this.panSpeed=1,this.screenSpacePanning=!0,this.keyPanSpeed=7,this.zoomToCursor=!1,this.autoRotate=!1,this.autoRotateSpeed=2,this.keys={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"},this.mouseButtons={LEFT:Z.ROTATE,MIDDLE:Z.DOLLY,RIGHT:Z.PAN},this.touches={ONE:V.ROTATE,TWO:V.DOLLY_PAN},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this._domElementKeyEvents=null,this._lastPosition=new le,this._lastQuaternion=new Ze,this._lastTargetPosition=new le,this._quat=new Ze().setFromUnitVectors(e.up,new le(0,1,0)),this._quatInverse=this._quat.clone().invert(),this._spherical=new uy,this._sphericalDelta=new uy,this._scale=1,this._panOffset=new le,this._rotateStart=new ce,this._rotateEnd=new ce,this._rotateDelta=new ce,this._panStart=new ce,this._panEnd=new ce,this._panDelta=new ce,this._dollyStart=new ce,this._dollyEnd=new ce,this._dollyDelta=new ce,this._dollyDirection=new le,this._mouse=new ce,this._performCursorZoom=!1,this._pointers=[],this._pointerPositions={},this._controlActive=!1,this._onPointerMove=e9.bind(this),this._onPointerDown=JW.bind(this),this._onPointerUp=t9.bind(this),this._onContextMenu=l9.bind(this),this._onMouseWheel=i9.bind(this),this._onKeyDown=s9.bind(this),this._onTouchStart=a9.bind(this),this._onTouchMove=o9.bind(this),this._onMouseDown=n9.bind(this),this._onMouseMove=r9.bind(this),this._interceptControlDown=u9.bind(this),this._interceptControlUp=c9.bind(this),this.domElement!==null&&this.connect(this.domElement),this.update()}connect(e){super.connect(e),this.domElement.addEventListener("pointerdown",this._onPointerDown),this.domElement.addEventListener("pointercancel",this._onPointerUp),this.domElement.addEventListener("contextmenu",this._onContextMenu),this.domElement.addEventListener("wheel",this._onMouseWheel,{passive:!1}),this.domElement.getRootNode().addEventListener("keydown",this._interceptControlDown,{passive:!0,capture:!0}),this.domElement.style.touchAction="none"}disconnect(){this.domElement.removeEventListener("pointerdown",this._onPointerDown),this.domElement.ownerDocument.removeEventListener("pointermove",this._onPointerMove),this.domElement.ownerDocument.removeEventListener("pointerup",this._onPointerUp),this.domElement.removeEventListener("pointercancel",this._onPointerUp),this.domElement.removeEventListener("wheel",this._onMouseWheel),this.domElement.removeEventListener("contextmenu",this._onContextMenu),this.stopListenToKeyEvents(),this.domElement.getRootNode().removeEventListener("keydown",this._interceptControlDown,{capture:!0}),this.domElement.style.touchAction="auto"}dispose(){this.disconnect()}getPolarAngle(){return this._spherical.phi}getAzimuthalAngle(){return this._spherical.theta}getDistance(){return this.object.position.distanceTo(this.target)}listenToKeyEvents(e){e.addEventListener("keydown",this._onKeyDown),this._domElementKeyEvents=e}stopListenToKeyEvents(){this._domElementKeyEvents!==null&&(this._domElementKeyEvents.removeEventListener("keydown",this._onKeyDown),this._domElementKeyEvents=null)}saveState(){this.target0.copy(this.target),this.position0.copy(this.object.position),this.zoom0=this.object.zoom}reset(){this.target.copy(this.target0),this.object.position.copy(this.position0),this.object.zoom=this.zoom0,this.object.updateProjectionMatrix(),this.dispatchEvent(rF),this.update(),this.state=Mu.NONE}update(e=null){const t=this.object.position;Lh.copy(t).sub(this.target),Lh.applyQuaternion(this._quat),this._spherical.setFromVector3(Lh),this.autoRotate&&this.state===Mu.NONE&&this._rotateLeft(this._getAutoRotationAngle(e)),this.enableDamping?(this._spherical.theta+=this._sphericalDelta.theta*this.dampingFactor,this._spherical.phi+=this._sphericalDelta.phi*this.dampingFactor):(this._spherical.theta+=this._sphericalDelta.theta,this._spherical.phi+=this._sphericalDelta.phi);let n=this.minAzimuthAngle,i=this.maxAzimuthAngle;isFinite(n)&&isFinite(i)&&(n<-Math.PI?n+=zf:n>Math.PI&&(n-=zf),i<-Math.PI?i+=zf:i>Math.PI&&(i-=zf),n<=i?this._spherical.theta=Math.max(n,Math.min(i,this._spherical.theta)):this._spherical.theta=this._spherical.theta>(n+i)/2?Math.max(n,this._spherical.theta):Math.min(i,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 a=!1;if(this.zoomToCursor&&this._performCursorZoom||this.object.isOrthographicCamera)this._spherical.radius=this._clampDistance(this._spherical.radius);else{const o=this._spherical.radius;this._spherical.radius=this._clampDistance(this._spherical.radius*this._scale),a=o!=this._spherical.radius}if(Lh.setFromSpherical(this._spherical),Lh.applyQuaternion(this._quatInverse),t.copy(this.target).add(Lh),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 o=null;if(this.object.isPerspectiveCamera){const u=Lh.length();o=this._clampDistance(u*this._scale);const c=u-o;this.object.position.addScaledVector(this._dollyDirection,c),this.object.updateMatrixWorld(),a=!!c}else if(this.object.isOrthographicCamera){const u=new le(this._mouse.x,this._mouse.y,0);u.unproject(this.object);const c=this.object.zoom;this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._scale)),this.object.updateProjectionMatrix(),a=c!==this.object.zoom;const d=new le(this._mouse.x,this._mouse.y,0);d.unproject(this.object),this.object.position.sub(d).add(u),this.object.updateMatrixWorld(),o=Lh.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),this.zoomToCursor=!1;o!==null&&(this.screenSpacePanning?this.target.set(0,0,-1).transformDirection(this.object.matrix).multiplyScalar(o).add(this.object.position):(z_.origin.copy(this.object.position),z_.direction.set(0,0,-1).transformDirection(this.object.matrix),Math.abs(this.object.up.dot(z_.direction))<YW?this.object.lookAt(this.target):(sF.setFromNormalAndCoplanarPoint(this.object.up,this.target),z_.intersectPlane(sF,this.target))))}else if(this.object.isOrthographicCamera){const o=this.object.zoom;this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._scale)),o!==this.object.zoom&&(this.object.updateProjectionMatrix(),a=!0)}return this._scale=1,this._performCursorZoom=!1,a||this._lastPosition.distanceToSquared(this.object.position)>tE||8*(1-this._lastQuaternion.dot(this.object.quaternion))>tE||this._lastTargetPosition.distanceToSquared(this.target)>tE?(this.dispatchEvent(rF),this._lastPosition.copy(this.object.position),this._lastQuaternion.copy(this.object.quaternion),this._lastTargetPosition.copy(this.target),!0):!1}_getAutoRotationAngle(e){return e!==null?zf/60*this.autoRotateSpeed*e:zf/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){Lh.setFromMatrixColumn(t,0),Lh.multiplyScalar(-e),this._panOffset.add(Lh)}_panUp(e,t){this.screenSpacePanning===!0?Lh.setFromMatrixColumn(t,1):(Lh.setFromMatrixColumn(t,0),Lh.crossVectors(this.object.up,Lh)),Lh.multiplyScalar(e),this._panOffset.add(Lh)}_pan(e,t){const n=this.domElement;if(this.object.isPerspectiveCamera){const i=this.object.position;Lh.copy(i).sub(this.target);let a=Lh.length();a*=Math.tan(this.object.fov/2*Math.PI/180),this._panLeft(2*e*a/n.clientHeight,this.object.matrix),this._panUp(2*t*a/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(),i=e-n.left,a=t-n.top,o=n.width,u=n.height;this._mouse.x=i/o*2-1,this._mouse.y=-(a/u)*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(zf*this._rotateDelta.x/t.clientHeight),this._rotateUp(zf*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(zf*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(-zf*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(zf*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(-zf*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),i=.5*(e.pageY+t.y);this._rotateStart.set(n,i)}}_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),i=.5*(e.pageY+t.y);this._panStart.set(n,i)}}_handleTouchStartDolly(e){const t=this._getSecondPointerPosition(e),n=e.pageX-t.x,i=e.pageY-t.y,a=Math.sqrt(n*n+i*i);this._dollyStart.set(0,a)}_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),i=.5*(e.pageX+n.x),a=.5*(e.pageY+n.y);this._rotateEnd.set(i,a)}this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);const t=this.domElement;this._rotateLeft(zf*this._rotateDelta.x/t.clientHeight),this._rotateUp(zf*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),i=.5*(e.pageY+t.y);this._panEnd.set(n,i)}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,i=e.pageY-t.y,a=Math.sqrt(n*n+i*i);this._dollyEnd.set(0,a),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 o=(e.pageX+t.x)*.5,u=(e.pageY+t.y)*.5;this._updateZoomParameters(o,u)}_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;t<this._pointers.length;t++)if(this._pointers[t]==e.pointerId){this._pointers.splice(t,1);return}}_isTrackingPointer(e){for(let t=0;t<this._pointers.length;t++)if(this._pointers[t]==e.pointerId)return!0;return!1}_trackPointer(e){let t=this._pointerPositions[e.pointerId];t===void 0&&(t=new ce,this._pointerPositions[e.pointerId]=t),t.set(e.pageX,e.pageY)}_getSecondPointerPosition(e){const t=e.pointerId===this._pointers[0]?this._pointers[1]:this._pointers[0];return this._pointerPositions[t]}_customWheelEvent(e){const t=e.deltaMode,n={clientX:e.clientX,clientY:e.clientY,deltaY:e.deltaY};switch(t){case 1:n.deltaY*=16;break;case 2:n.deltaY*=100;break}return e.ctrlKey&&!this._controlActive&&(n.deltaY*=10),n}}function JW(s){this.enabled!==!1&&(this._pointers.length===0&&(this.domElement.setPointerCapture(s.pointerId),this.domElement.ownerDocument.addEventListener("pointermove",this._onPointerMove),this.domElement.ownerDocument.addEventListener("pointerup",this._onPointerUp)),!this._isTrackingPointer(s)&&(this._addPointer(s),s.pointerType==="touch"?this._onTouchStart(s):this._onMouseDown(s)))}function e9(s){this.enabled!==!1&&(s.pointerType==="touch"?this._onTouchMove(s):this._onMouseMove(s))}function t9(s){switch(this._removePointer(s),this._pointers.length){case 0:this.domElement.releasePointerCapture(s.pointerId),this.domElement.ownerDocument.removeEventListener("pointermove",this._onPointerMove),this.domElement.ownerDocument.removeEventListener("pointerup",this._onPointerUp),this.dispatchEvent(iF),this.state=Mu.NONE;break;case 1:const e=this._pointers[0],t=this._pointerPositions[e];this._onTouchStart({pointerId:e,pageX:t.x,pageY:t.y});break}}function n9(s){let e;switch(s.button){case 0:e=this.mouseButtons.LEFT;break;case 1:e=this.mouseButtons.MIDDLE;break;case 2:e=this.mouseButtons.RIGHT;break;default:e=-1}switch(e){case Z.DOLLY:if(this.enableZoom===!1)return;this._handleMouseDownDolly(s),this.state=Mu.DOLLY;break;case Z.ROTATE:if(s.ctrlKey||s.metaKey||s.shiftKey){if(this.enablePan===!1)return;this._handleMouseDownPan(s),this.state=Mu.PAN}else{if(this.enableRotate===!1)return;this._handleMouseDownRotate(s),this.state=Mu.ROTATE}break;case Z.PAN:if(s.ctrlKey||s.metaKey||s.shiftKey){if(this.enableRotate===!1)return;this._handleMouseDownRotate(s),this.state=Mu.ROTATE}else{if(this.enablePan===!1)return;this._handleMouseDownPan(s),this.state=Mu.PAN}break;default:this.state=Mu.NONE}this.state!==Mu.NONE&&this.dispatchEvent(eE)}function r9(s){switch(this.state){case Mu.ROTATE:if(this.enableRotate===!1)return;this._handleMouseMoveRotate(s);break;case Mu.DOLLY:if(this.enableZoom===!1)return;this._handleMouseMoveDolly(s);break;case Mu.PAN:if(this.enablePan===!1)return;this._handleMouseMovePan(s);break}}function i9(s){this.enabled===!1||this.enableZoom===!1||this.state!==Mu.NONE||(s.preventDefault(),this.dispatchEvent(eE),this._handleMouseWheel(this._customWheelEvent(s)),this.dispatchEvent(iF))}function s9(s){this.enabled!==!1&&this._handleKeyDown(s)}function a9(s){switch(this._trackPointer(s),this._pointers.length){case 1:switch(this.touches.ONE){case V.ROTATE:if(this.enableRotate===!1)return;this._handleTouchStartRotate(s),this.state=Mu.TOUCH_ROTATE;break;case V.PAN:if(this.enablePan===!1)return;this._handleTouchStartPan(s),this.state=Mu.TOUCH_PAN;break;default:this.state=Mu.NONE}break;case 2:switch(this.touches.TWO){case V.DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this._handleTouchStartDollyPan(s),this.state=Mu.TOUCH_DOLLY_PAN;break;case V.DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this._handleTouchStartDollyRotate(s),this.state=Mu.TOUCH_DOLLY_ROTATE;break;default:this.state=Mu.NONE}break;default:this.state=Mu.NONE}this.state!==Mu.NONE&&this.dispatchEvent(eE)}function o9(s){switch(this._trackPointer(s),this.state){case Mu.TOUCH_ROTATE:if(this.enableRotate===!1)return;this._handleTouchMoveRotate(s),this.update();break;case Mu.TOUCH_PAN:if(this.enablePan===!1)return;this._handleTouchMovePan(s),this.update();break;case Mu.TOUCH_DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this._handleTouchMoveDollyPan(s),this.update();break;case Mu.TOUCH_DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this._handleTouchMoveDollyRotate(s),this.update();break;default:this.state=Mu.NONE}}function l9(s){this.enabled!==!1&&s.preventDefault()}function u9(s){s.key==="Control"&&(this._controlActive=!0,this.domElement.getRootNode().addEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0}))}function c9(s){s.key==="Control"&&(this._controlActive=!1,this.domElement.getRootNode().removeEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0}))}const h9={type:"change"},aF=1e-6,oF=new Ze;class d9 extends rv{constructor(e,t=null){super(e,t),this.movementSpeed=1,this.rollSpeed=.005,this.dragToLook=!1,this.autoForward=!1,this._moveState={up:0,down:0,left:0,right:0,forward:0,back:0,pitchUp:0,pitchDown:0,yawLeft:0,yawRight:0,rollLeft:0,rollRight:0},this._moveVector=new le(0,0,0),this._rotationVector=new le(0,0,0),this._lastQuaternion=new Ze,this._lastPosition=new le,this._status=0,this._onKeyDown=f9.bind(this),this._onKeyUp=A9.bind(this),this._onPointerMove=g9.bind(this),this._onPointerDown=p9.bind(this),this._onPointerUp=m9.bind(this),this._onPointerCancel=v9.bind(this),this._onContextMenu=y9.bind(this),t!==null&&this.connect(t)}connect(e){super.connect(e),window.addEventListener("keydown",this._onKeyDown),window.addEventListener("keyup",this._onKeyUp),this.domElement.addEventListener("pointermove",this._onPointerMove),this.domElement.addEventListener("pointerdown",this._onPointerDown),this.domElement.addEventListener("pointerup",this._onPointerUp),this.domElement.addEventListener("pointercancel",this._onPointerCancel),this.domElement.addEventListener("contextmenu",this._onContextMenu)}disconnect(){window.removeEventListener("keydown",this._onKeyDown),window.removeEventListener("keyup",this._onKeyUp),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.domElement.removeEventListener("pointerdown",this._onPointerDown),this.domElement.removeEventListener("pointerup",this._onPointerUp),this.domElement.removeEventListener("pointercancel",this._onPointerCancel),this.domElement.removeEventListener("contextmenu",this._onContextMenu)}dispose(){this.disconnect()}update(e){if(this.enabled===!1)return;const t=this.object,n=e*this.movementSpeed,i=e*this.rollSpeed;t.translateX(this._moveVector.x*n),t.translateY(this._moveVector.y*n),t.translateZ(this._moveVector.z*n),oF.set(this._rotationVector.x*i,this._rotationVector.y*i,this._rotationVector.z*i,1).normalize(),t.quaternion.multiply(oF),(this._lastPosition.distanceToSquared(t.position)>aF||8*(1-this._lastQuaternion.dot(t.quaternion))>aF)&&(this.dispatchEvent(h9),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 f9(s){if(!(s.altKey||this.enabled===!1)){switch(s.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 A9(s){if(this.enabled!==!1){switch(s.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 p9(s){if(this.enabled!==!1)if(this.dragToLook)this._status++;else{switch(s.button){case 0:this._moveState.forward=1;break;case 2:this._moveState.back=1;break}this._updateMovementVector()}}function g9(s){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=-(s.pageX-e.offset[0]-t)/t,this._moveState.pitchDown=(s.pageY-e.offset[1]-n)/n,this._updateRotationVector()}}function m9(s){if(this.enabled!==!1){if(this.dragToLook)this._status--,this._moveState.yawLeft=this._moveState.pitchDown=0;else{switch(s.button){case 0:this._moveState.forward=0;break;case 2:this._moveState.back=0;break}this._updateMovementVector()}this._updateRotationVector()}}function v9(){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 y9(s){this.enabled!==!1&&s.preventDefault()}const x9={name:"CopyShader",uniforms:{tDiffuse:{value:null},opacity:{value:1}},vertexShader:`
varying vec2 vUv;
void main() {
vUv = uv;
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
}`,fragmentShader:`
uniform float opacity;
uniform sampler2D tDiffuse;
varying vec2 vUv;
void main() {
vec4 texel = texture2D( tDiffuse, vUv );
gl_FragColor = opacity * texel;
}`};class G_{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 b9=new Pg(-1,1,1,-1,0,1);class _9 extends ka{constructor(){super(),this.setAttribute("position",new Ui([-1,3,0,-1,-1,0,3,-1,0],3)),this.setAttribute("uv",new Ui([0,2,0,0,2,0],2))}}const w9=new _9;class S9{constructor(e){this._mesh=new Il(w9,e)}dispose(){this._mesh.geometry.dispose()}render(e){e.render(this._mesh,b9)}get material(){return this._mesh.material}set material(e){this._mesh.material=e}}class M9 extends G_{constructor(e,t="tDiffuse"){super(),this.textureID=t,this.uniforms=null,this.material=null,e instanceof nh?(this.uniforms=e.uniforms,this.material=e):e&&(this.uniforms=Vh.clone(e.uniforms),this.material=new nh({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 S9(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 lF extends G_{constructor(e,t){super(),this.scene=e,this.camera=t,this.clear=!0,this.needsSwap=!1,this.inverse=!1}render(e,t,n){const i=e.getContext(),a=e.state;a.buffers.color.setMask(!1),a.buffers.depth.setMask(!1),a.buffers.color.setLocked(!0),a.buffers.depth.setLocked(!0);let o,u;this.inverse?(o=0,u=1):(o=1,u=0),a.buffers.stencil.setTest(!0),a.buffers.stencil.setOp(i.REPLACE,i.REPLACE,i.REPLACE),a.buffers.stencil.setFunc(i.ALWAYS,o,4294967295),a.buffers.stencil.setClear(u),a.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),a.buffers.color.setLocked(!1),a.buffers.depth.setLocked(!1),a.buffers.color.setMask(!0),a.buffers.depth.setMask(!0),a.buffers.stencil.setLocked(!1),a.buffers.stencil.setFunc(i.EQUAL,1,4294967295),a.buffers.stencil.setOp(i.KEEP,i.KEEP,i.KEEP),a.buffers.stencil.setLocked(!0)}}class E9 extends G_{constructor(){super(),this.needsSwap=!1}render(e){e.state.buffers.stencil.setLocked(!1),e.state.buffers.stencil.setTest(!1)}}class C9{constructor(e,t){if(this.renderer=e,this._pixelRatio=e.getPixelRatio(),t===void 0){const n=e.getSize(new ce);this._width=n.width,this._height=n.height,t=new Os(this._width*this._pixelRatio,this._height*this._pixelRatio,{type:Wt}),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 M9(x9),this.copyPass.material.blending=we,this.clock=new pp}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<this.passes.length;t++)if(this.passes[t].enabled)return!1;return!0}render(e){e===void 0&&(e=this.clock.getDelta());const t=this.renderer.getRenderTarget();let n=!1;for(let i=0,a=this.passes.length;i<a;i++){const o=this.passes[i];if(o.enabled!==!1){if(o.renderToScreen=this.renderToScreen&&this.isLastEnabledPass(i),o.render(this.renderer,this.writeBuffer,this.readBuffer,e,n),o.needsSwap){if(n){const u=this.renderer.getContext(),c=this.renderer.state.buffers.stencil;c.setFunc(u.NOTEQUAL,1,4294967295),this.copyPass.render(this.renderer,this.writeBuffer,this.readBuffer,e),c.setFunc(u.EQUAL,1,4294967295)}this.swapBuffers()}lF!==void 0&&(o instanceof lF?n=!0:o instanceof E9&&(n=!1))}}this.renderer.setRenderTarget(t)}reset(e){if(e===void 0){const t=this.renderer.getSize(new ce);this._pixelRatio=this.renderer.getPixelRatio(),this._width=t.width,this._height=t.height,e=this.renderTarget1.clone(),e.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}this.renderTarget1.dispose(),this.renderTarget2.dispose(),this.renderTarget1=e,this.renderTarget2=e.clone(),this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2}setSize(e,t){this._width=e,this._height=t;const n=this._width*this._pixelRatio,i=this._height*this._pixelRatio;this.renderTarget1.setSize(n,i),this.renderTarget2.setSize(n,i);for(let a=0;a<this.passes.length;a++)this.passes[a].setSize(n,i)}setPixelRatio(e){this._pixelRatio=e,this.setSize(this._width,this._height)}dispose(){this.renderTarget1.dispose(),this.renderTarget2.dispose(),this.copyPass.dispose()}}class T9 extends G_{constructor(e,t,n=null,i=null,a=null){super(),this.scene=e,this.camera=t,this.overrideMaterial=n,this.clearColor=i,this.clearAlpha=a,this.clear=!0,this.clearDepth=!1,this.needsSwap=!1,this.isRenderPass=!0,this._oldClearColor=new Wr}render(e,t,n){const i=e.autoClear;e.autoClear=!1;let a,o;this.overrideMaterial!==null&&(o=this.scene.overrideMaterial,this.scene.overrideMaterial=this.overrideMaterial),this.clearColor!==null&&(e.getClearColor(this._oldClearColor),e.setClearColor(this.clearColor,e.getClearAlpha())),this.clearAlpha!==null&&(a=e.getClearAlpha(),e.setClearAlpha(this.clearAlpha)),this.clearDepth==!0&&e.clearDepth(),e.setRenderTarget(this.renderToScreen?null:n),this.clear===!0&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),e.render(this.scene,this.camera),this.clearColor!==null&&e.setClearColor(this._oldClearColor),this.clearAlpha!==null&&e.setClearAlpha(a),this.overrideMaterial!==null&&(this.scene.overrideMaterial=o),e.autoClear=i}}var ep=b(54476),B9=b(31226),R9=b(69168),I9=b(58289),uF=b(18773);function N9(s){try{return Function.toString.call(s).indexOf("[native code]")!==-1}catch(e){return typeof s=="function"}}var F9=b(75538);function P9(s,e,t){if((0,F9.Z)())return Reflect.construct.apply(null,arguments);var n=[null];n.push.apply(n,e);var i=new(s.bind.apply(s,n));return t&&(0,uF.Z)(i,t.prototype),i}function nE(s){var e=typeof Map=="function"?new Map:void 0;return nE=function(n){if(n===null||!N9(n))return n;if(typeof n!="function")throw new TypeError("Super expression must either be null or a function");if(e!==void 0){if(e.has(n))return e.get(n);e.set(n,i)}function i(){return P9(n,arguments,(0,I9.Z)(this).constructor)}return i.prototype=Object.create(n.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),(0,uF.Z)(i,n)},nE(s)}function cF(){var s;return s=arguments.length-1,s<0||arguments.length<=s?void 0:arguments[s]}function L9(s){return-s}function U9(s,e){return s+e}function O9(s,e){return s-e}function D9(s,e){return s*e}function k9(s,e){return s/e}function V9(){return Math.max.apply(Math,arguments)}function z9(){return Math.min.apply(Math,arguments)}function G9(){return Array.of.apply(Array,arguments)}var Nj={symbols:{"*":{infix:{symbol:"*",f:D9,notation:"infix",precedence:4,rightToLeft:0,argCount:2},symbol:"*",regSymbol:"\\*"},"/":{infix:{symbol:"/",f:k9,notation:"infix",precedence:4,rightToLeft:0,argCount:2},symbol:"/",regSymbol:"/"},"+":{infix:{symbol:"+",f:U9,notation:"infix",precedence:2,rightToLeft:0,argCount:2},prefix:{symbol:"+",f:cF,notation:"prefix",precedence:3,rightToLeft:0,argCount:1},symbol:"+",regSymbol:"\\+"},"-":{infix:{symbol:"-",f:O9,notation:"infix",precedence:2,rightToLeft:0,argCount:2},prefix:{symbol:"-",f:L9,notation:"prefix",precedence:3,rightToLeft:0,argCount:1},symbol:"-",regSymbol:"-"},",":{infix:{symbol:",",f:G9,notation:"infix",precedence:1,rightToLeft:0,argCount:2},symbol:",",regSymbol:","},"(":{prefix:{symbol:"(",f:cF,notation:"prefix",precedence:0,rightToLeft:0,argCount:1},symbol:"(",regSymbol:"\\("},")":{postfix:{symbol:")",f:void 0,notation:"postfix",precedence:0,rightToLeft:0,argCount:1},symbol:")",regSymbol:"\\)"},min:{func:{symbol:"min",f:z9,notation:"func",precedence:0,rightToLeft:0,argCount:1},symbol:"min",regSymbol:"min\\b"},max:{func:{symbol:"max",f:V9,notation:"func",precedence:0,rightToLeft:0,argCount:1},symbol:"max",regSymbol:"max\\b"}}},hF=null,Fj={1:`Passed invalid arguments to hsl, please pass multiple numbers e.g. hsl(360, 0.75, 0.4) or an object e.g. rgb({ hue: 255, saturation: 0.4, lightness: 0.75 }).
`,2:`Passed invalid arguments to hsla, please pass multiple numbers e.g. hsla(360, 0.75, 0.4, 0.7) or an object e.g. rgb({ hue: 255, saturation: 0.4, lightness: 0.75, alpha: 0.7 }).
`,3:`Passed an incorrect argument to a color function, please pass a string representation of a color.
`,4:`Couldn't generate valid rgb string from %s, it returned %s.
`,5:`Couldn't parse the color string. Please provide the color as a string in hex, rgb, rgba, hsl or hsla notation.
`,6:`Passed invalid arguments to rgb, please pass multiple numbers e.g. rgb(255, 205, 100) or an object e.g. rgb({ red: 255, green: 205, blue: 100 }).
`,7:`Passed invalid arguments to rgba, please pass multiple numbers e.g. rgb(255, 205, 100, 0.75) or an object e.g. rgb({ red: 255, green: 205, blue: 100, alpha: 0.75 }).
`,8:`Passed invalid argument to toColorString, please pass a RgbColor, RgbaColor, HslColor or HslaColor object.
`,9:`Please provide a number of steps to the modularScale helper.
`,10:`Please pass a number or one of the predefined scales to the modularScale helper as the ratio.
`,11:`Invalid value passed as base to modularScale, expected number or em string but got "%s"
`,12:`Expected a string ending in "px" or a number passed as the first argument to %s(), got "%s" instead.
`,13:`Expected a string ending in "px" or a number passed as the second argument to %s(), got "%s" instead.
`,14:`Passed invalid pixel value ("%s") to %s(), please pass a value like "12px" or 12.
`,15:`Passed invalid base value ("%s") to %s(), please pass a value like "12px" or 12.
`,16:`You must provide a template to this method.
`,17:`You passed an unsupported selector state to this method.
`,18:`minScreen and maxScreen must be provided as stringified numbers with the same units.
`,19:`fromSize and toSize must be provided as stringified numbers with the same units.
`,20:`expects either an array of objects or a single object with the properties prop, fromSize, and toSize.
`,21:"expects the objects in the first argument array to have the properties `prop`, `fromSize`, and `toSize`.\n\n",22:"expects the first argument object to have the properties `prop`, `fromSize`, and `toSize`.\n\n",23:`fontFace expects a name of a font-family.
`,24:`fontFace expects either the path to the font file(s) or a name of a local copy.
`,25:`fontFace expects localFonts to be an array.
`,26:`fontFace expects fileFormats to be an array.
`,27:`radialGradient requries at least 2 color-stops to properly render.
`,28:`Please supply a filename to retinaImage() as the first argument.
`,29:`Passed invalid argument to triangle, please pass correct pointingDirection e.g. 'right'.
`,30:"Passed an invalid value to `height` or `width`. Please provide a pixel based unit.\n\n",31:`The animation shorthand only takes 8 arguments. See the specification for more information: http://mdn.io/animation
`,32:`To pass multiple animations please supply them in arrays, e.g. animation(['rotate', '2s'], ['move', '1s'])
To pass a single animation please supply them in simple values, e.g. animation('rotate', '2s')
`,33:`The animation shorthand arrays can only have 8 elements. See the specification for more information: http://mdn.io/animation
`,34:`borderRadius expects a radius value as a string or number as the second argument.
`,35:`borderRadius expects one of "top", "bottom", "left" or "right" as the first argument.
`,36:`Property must be a string value.
`,37:`Syntax Error at %s.
`,38:`Formula contains a function that needs parentheses at %s.
`,39:`Formula is missing closing parenthesis at %s.
`,40:`Formula has too many closing parentheses at %s.
`,41:`All values in a formula must have the same unit or be unitless.
`,42:`Please provide a number of steps to the modularScale helper.
`,43:`Please pass a number or one of the predefined scales to the modularScale helper as the ratio.
`,44:`Invalid value passed as base to modularScale, expected number or em/rem string but got %s.
`,45:`Passed invalid argument to hslToColorString, please pass a HslColor or HslaColor object.
`,46:`Passed invalid argument to rgbToColorString, please pass a RgbColor or RgbaColor object.
`,47:`minScreen and maxScreen must be provided as stringified numbers with the same units.
`,48:`fromSize and toSize must be provided as stringified numbers with the same units.
`,49:`Expects either an array of objects or a single object with the properties prop, fromSize, and toSize.
`,50:`Expects the objects in the first argument array to have the properties prop, fromSize, and toSize.
`,51:`Expects the first argument object to have the properties prop, fromSize, and toSize.
`,52:`fontFace expects either the path to the font file(s) or a name of a local copy.
`,53:`fontFace expects localFonts to be an array.
`,54:`fontFace expects fileFormats to be an array.
`,55:`fontFace expects a name of a font-family.
`,56:`linearGradient requries at least 2 color-stops to properly render.
`,57:`radialGradient requries at least 2 color-stops to properly render.
`,58:`Please supply a filename to retinaImage() as the first argument.
`,59:`Passed invalid argument to triangle, please pass correct pointingDirection e.g. 'right'.
`,60:"Passed an invalid value to `height` or `width`. Please provide a pixel based unit.\n\n",61:`Property must be a string value.
`,62:`borderRadius expects a radius value as a string or number as the second argument.
`,63:`borderRadius expects one of "top", "bottom", "left" or "right" as the first argument.
`,64:`The animation shorthand only takes 8 arguments. See the specification for more information: http://mdn.io/animation.
`,65:`To pass multiple animations please supply them in arrays, e.g. animation(['rotate', '2s'], ['move', '1s'])\\nTo pass a single animation please supply them in simple values, e.g. animation('rotate', '2s').
`,66:`The animation shorthand arrays can only have 8 elements. See the specification for more information: http://mdn.io/animation.
`,67:`You must provide a template to this method.
`,68:`You passed an unsupported selector state to this method.
`,69:`Expected a string ending in "px" or a number passed as the first argument to %s(), got %s instead.
`,70:`Expected a string ending in "px" or a number passed as the second argument to %s(), got %s instead.
`,71:`Passed invalid pixel value %s to %s(), please pass a value like "12px" or 12.
`,72:`Passed invalid base value %s to %s(), please pass a value like "12px" or 12.
`,73:`Please provide a valid CSS variable.
`,74:`CSS variable not found and no default was provided.
`,75:`important requires a valid style object, got a %s instead.
`,76:`fromSize and toSize must be provided as stringified numbers with the same units as minScreen and maxScreen.
`,77:`remToPx expects a value in "rem" but you provided it in "%s".
`,78:`base must be set in "px" or "%" but you set it in "%s".
`};function Pj(){for(var s=arguments.length,e=new Array(s),t=0;t<s;t++)e[t]=arguments[t];var n=e[0],i=[],a;for(a=1;a<e.length;a+=1)i.push(e[a]);return i.forEach(function(o){n=n.replace(/%[a-z]/,o)}),n}var ro=function(s){(0,R9.Z)(e,s);function e(t){var n;if(1)n=s.call(this,"An error occurred. See https://github.com/styled-components/polished/blob/main/src/internalHelpers/errors.md#"+t+" for more information.")||this;else var i,a,o;return(0,B9.Z)(n)}return e}(nE(Error)),dF=/((?!\w)a|na|hc|mc|dg|me[r]?|xe|ni(?![a-zA-Z])|mm|cp|tp|xp|q(?!s)|hv|xamv|nimv|wv|sm|s(?!\D|$)|ged|darg?|nrut)/g;function H9(s){var e={};return e.symbols=s?_extends({},hF.symbols,s.symbols):_extends({},hF.symbols),e}function fF(s,e){var t,n=s.pop();return e.push(n.f.apply(n,(t=[]).concat.apply(t,e.splice(-n.argCount)))),n.precedence}function Q9(s,e){var t=H9(e),n,i=[t.symbols["("].prefix],a=[],o=new RegExp("\\d+(?:\\.\\d+)?|"+Object.keys(t.symbols).map(function(ee){return t.symbols[ee]}).sort(function(ee,q){return q.symbol.length-ee.symbol.length}).map(function(ee){return ee.regSymbol}).join("|")+"|(\\S)","g");o.lastIndex=0;var u=!1;do{n=o.exec(s);var c=n||[")",void 0],d=c[0],g=c[1],v=t.symbols[d],M=v&&!v.prefix&&!v.func,B=!v||!v.postfix&&!v.infix;if(g||(u?B:M))throw new ro(37,n?n.index:s.length,s);if(u){var I=v.postfix||v.infix;do{var ne=i[i.length-1];if((I.precedence-ne.precedence||ne.rightToLeft)>0)break}while(fF(i,a));u=I.notation==="postfix",I.symbol!==")"&&(i.push(I),u&&fF(i,a))}else if(v){if(i.push(v.prefix||v.func),v.func&&(n=o.exec(s),!n||n[0]!=="("))throw new ro(38,n?n.index:s.length,s)}else a.push(+d),u=!0}while(n&&i.length);if(i.length)throw new ro(39,n?n.index:s.length,s);if(n)throw new ro(40,n?n.index:s.length,s);return a.pop()}function rE(s){return s.split("").reverse().join("")}function Lj(s,e){var t=rE(s),n=t.match(dF);if(n&&!n.every(function(a){return a===n[0]}))throw new ro(41);var i=rE(t.replace(dF,""));return""+Q9(i,e)+(n?rE(n[0]):"")}var W9=/--[\S]*/g;function Uj(s,e){if(!s||!s.match(W9))throw new ro(73);var t;if(typeof document!="undefined"&&document.documentElement!==null&&(t=getComputedStyle(document.documentElement).getPropertyValue(s)),t)return t.trim();if(e)return e;throw new ro(74)}function mx(s){return s.charAt(0).toUpperCase()+s.slice(1)}var Z9=null;function K9(s,e){if(!s)return e.toLowerCase();var t=s.split("-");if(t.length>1)return t.splice(1,0,e),t.reduce(function(i,a){return""+i+mx(a)});var n=s.replace(/([a-z])([A-Z])/g,"$1"+e+"$2");return s===n?""+s+e:n}function $9(s,e){for(var t={},n=0;n<e.length;n+=1)(e[n]||e[n]===0)&&(t[K9(s,Z9[n])]=e[n]);return t}function I0(s){for(var e=arguments.length,t=new Array(e>1?e-1:0),n=1;n<e;n++)t[n-1]=arguments[n];var i=t[0],a=t[1],o=a===void 0?i:a,u=t[2],c=u===void 0?i:u,d=t[3],g=d===void 0?o:d,v=[i,o,c,g];return $9(s,v)}function AF(s,e){return s.substr(-e.length)===e}var X9=/^([+-]?(?:\d+|\d*\.\d+))([a-z]*|%)$/;function pF(s){if(typeof s!="string")return s;var e=s.match(X9);return e?parseFloat(s):s}var j9=function(e){return function(t,n){n===void 0&&(n="16px");var i=t,a=n;if(typeof t=="string"){if(!AF(t,"px"))throw new ro(69,e,t);i=pF(t)}if(typeof n=="string"){if(!AF(n,"px"))throw new ro(70,e,n);a=pF(n)}if(typeof i=="string")throw new ro(71,t,e);if(typeof a=="string")throw new ro(72,n,e);return""+i/a+e}},gF=j9,Oj=gF("em"),Dj=null,Y9=/^([+-]?(?:\d+|\d*\.\d+))([a-z]*|%)$/;function im(s){if(typeof s!="string")return[s,""];var e=s.match(Y9);return e?[parseFloat(s),e[2]]:[s,void 0]}function q9(s,e){if(typeof s!="object"||s===null)throw new ro(75,typeof s);var t={};return Object.keys(s).forEach(function(n){typeof s[n]=="object"&&s[n]!==null?t[n]=q9(s[n],e):!e||e&&(e===n||e.indexOf(n)>=0)?t[n]=s[n]+" !important":t[n]=s[n]}),t}var mF={minorSecond:1.067,majorSecond:1.125,minorThird:1.2,majorThird:1.25,perfectFourth:1.333,augFourth:1.414,perfectFifth:1.5,minorSixth:1.6,goldenSection:1.618,majorSixth:1.667,minorSeventh:1.778,majorSeventh:1.875,octave:2,majorTenth:2.5,majorEleventh:2.667,majorTwelfth:3,doubleOctave:4};function J9(s){return mF[s]}function kj(s,e,t){if(e===void 0&&(e="1em"),t===void 0&&(t=1.333),typeof s!="number")throw new ro(42);if(typeof t=="string"&&!mF[t])throw new ro(43);var n=typeof e=="string"?im(e):[e,""],i=n[0],a=n[1],o=typeof t=="string"?J9(t):t;if(typeof i=="string")throw new ro(44,e);return""+i*Math.pow(o,s)+(a||"")}var Vj=gF("rem"),zj=null,iE=16;function vF(s){var e=im(s);if(e[1]==="px")return parseFloat(s);if(e[1]==="%")return parseFloat(s)/100*iE;throw new ro(78,e[1])}function e7(){if(typeof document!="undefined"&&document.documentElement!==null){var s=getComputedStyle(document.documentElement).fontSize;return s?vF(s):iE}return iE}function Gj(s,e){var t=im(s);if(t[1]!=="rem"&&t[1]!=="")throw new ro(77,t[1]);var n=e?vF(e):e7();return t[0]*n+"px"}var t7={back:"cubic-bezier(0.600, -0.280, 0.735, 0.045)",circ:"cubic-bezier(0.600, 0.040, 0.980, 0.335)",cubic:"cubic-bezier(0.550, 0.055, 0.675, 0.190)",expo:"cubic-bezier(0.950, 0.050, 0.795, 0.035)",quad:"cubic-bezier(0.550, 0.085, 0.680, 0.530)",quart:"cubic-bezier(0.895, 0.030, 0.685, 0.220)",quint:"cubic-bezier(0.755, 0.050, 0.855, 0.060)",sine:"cubic-bezier(0.470, 0.000, 0.745, 0.715)"};function Hj(s){return t7[s.toLowerCase().trim()]}var n7={back:"cubic-bezier(0.680, -0.550, 0.265, 1.550)",circ:"cubic-bezier(0.785, 0.135, 0.150, 0.860)",cubic:"cubic-bezier(0.645, 0.045, 0.355, 1.000)",expo:"cubic-bezier(1.000, 0.000, 0.000, 1.000)",quad:"cubic-bezier(0.455, 0.030, 0.515, 0.955)",quart:"cubic-bezier(0.770, 0.000, 0.175, 1.000)",quint:"cubic-bezier(0.860, 0.000, 0.070, 1.000)",sine:"cubic-bezier(0.445, 0.050, 0.550, 0.950)"};function Qj(s){return n7[s.toLowerCase().trim()]}var r7={back:"cubic-bezier(0.175, 0.885, 0.320, 1.275)",cubic:"cubic-bezier(0.215, 0.610, 0.355, 1.000)",circ:"cubic-bezier(0.075, 0.820, 0.165, 1.000)",expo:"cubic-bezier(0.190, 1.000, 0.220, 1.000)",quad:"cubic-bezier(0.250, 0.460, 0.450, 0.940)",quart:"cubic-bezier(0.165, 0.840, 0.440, 1.000)",quint:"cubic-bezier(0.230, 1.000, 0.320, 1.000)",sine:"cubic-bezier(0.390, 0.575, 0.565, 1.000)"};function Wj(s){return r7[s.toLowerCase().trim()]}function yF(s,e,t,n){t===void 0&&(t="320px"),n===void 0&&(n="1200px");var i=im(s),a=i[0],o=i[1],u=im(e),c=u[0],d=u[1],g=im(t),v=g[0],M=g[1],B=im(n),I=B[0],ne=B[1];if(typeof v!="number"||typeof I!="number"||!M||!ne||M!==ne)throw new ro(47);if(typeof a!="number"||typeof c!="number"||o!==d)throw new ro(48);if(o!==M||d!==ne)throw new ro(76);var ee=(a-c)/(v-I),q=c-ee*I;return"calc("+q.toFixed(2)+(o||"")+" + "+(100*ee).toFixed(2)+"vw)"}function Zj(s){var e;s===void 0&&(s="&");var t=s+"::after";return e={},e[t]={clear:"both",content:'""',display:"table"},e}function Kj(s){return s===void 0&&(s=0),{position:"absolute",top:s,right:s,bottom:s,left:s}}function $j(s,e){e===void 0&&(e=1);var t={display:"inline-block",maxWidth:s||"100%",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",wordWrap:"normal"};return e>1?_extends({},t,{WebkitBoxOrient:"vertical",WebkitLineClamp:e,display:"-webkit-box",whiteSpace:"normal"}):t}function i7(s,e){var t=typeof Symbol!="undefined"&&s[Symbol.iterator]||s["@@iterator"];if(t)return(t=t.call(s)).next.bind(t);if(Array.isArray(s)||(t=s7(s))||e&&s&&typeof s.length=="number"){t&&(s=t);var n=0;return function(){return n>=s.length?{done:!0}:{done:!1,value:s[n++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function s7(s,e){if(s){if(typeof s=="string")return xF(s,e);var t=Object.prototype.toString.call(s).slice(8,-1);if(t==="Object"&&s.constructor&&(t=s.constructor.name),t==="Map"||t==="Set")return Array.from(s);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return xF(s,e)}}function xF(s,e){(e==null||e>s.length)&&(e=s.length);for(var t=0,n=new Array(e);t<e;t++)n[t]=s[t];return n}function Xj(s,e,t){if(e===void 0&&(e="320px"),t===void 0&&(t="1200px"),!Array.isArray(s)&&typeof s!="object"||s===null)throw new ro(49);if(Array.isArray(s)){for(var n={},i={},a=i7(s),o;!(o=a()).done;){var u,c,d=o.value;if(!d.prop||!d.fromSize||!d.toSize)throw new ro(50);i[d.prop]=d.fromSize,n["@media (min-width: "+e+")"]=_extends({},n["@media (min-width: "+e+")"],(u={},u[d.prop]=yF(d.fromSize,d.toSize,e,t),u)),n["@media (min-width: "+t+")"]=_extends({},n["@media (min-width: "+t+")"],(c={},c[d.prop]=d.toSize,c))}return _extends({},i,n)}else{var g,v,M;if(!s.prop||!s.fromSize||!s.toSize)throw new ro(51);return M={},M[s.prop]=s.fromSize,M["@media (min-width: "+e+")"]=(g={},g[s.prop]=yF(s.fromSize,s.toSize,e,t),g),M["@media (min-width: "+t+")"]=(v={},v[s.prop]=s.toSize,v),M}}var a7=/^\s*data:([a-z]+\/[a-z-]+(;[a-z-]+=[a-z-]+)?)?(;charset=[a-z0-9-]+)?(;base64)?,[a-z0-9!$&',()*+,;=\-._~:@/?%\s]*\s*$/i,o7={woff:"woff",woff2:"woff2",ttf:"truetype",otf:"opentype",eot:"embedded-opentype",svg:"svg",svgz:"svg"};function bF(s,e){return e?' format("'+o7[s]+'")':""}function l7(s){return!!s.replace(/\s+/g," ").match(a7)}function u7(s,e,t){if(l7(s))return'url("'+s+'")'+bF(e[0],t);var n=e.map(function(i){return'url("'+s+"."+i+'")'+bF(i,t)});return n.join(", ")}function c7(s){var e=s.map(function(t){return'local("'+t+'")'});return e.join(", ")}function h7(s,e,t,n){var i=[];return e&&i.push(c7(e)),s&&i.push(u7(s,t,n)),i.join(", ")}function jj(s){var e=s.fontFamily,t=s.fontFilePath,n=s.fontStretch,i=s.fontStyle,a=s.fontVariant,o=s.fontWeight,u=s.fileFormats,c=u===void 0?["eot","woff2","woff","ttf","svg"]:u,d=s.formatHint,g=d===void 0?!1:d,v=s.localFonts,M=v===void 0?[e]:v,B=s.unicodeRange,I=s.fontDisplay,ne=s.fontVariationSettings,ee=s.fontFeatureSettings;if(!e)throw new ro(55);if(!t&&!M)throw new ro(52);if(M&&!Array.isArray(M))throw new ro(53);if(!Array.isArray(c))throw new ro(54);var q={"@font-face":{fontFamily:e,src:h7(t,M,c,g),unicodeRange:B,fontStretch:n,fontStyle:i,fontVariant:a,fontWeight:o,fontDisplay:I,fontVariationSettings:ne,fontFeatureSettings:ee}};return JSON.parse(JSON.stringify(q))}function Yj(){return{textIndent:"101%",overflow:"hidden",whiteSpace:"nowrap"}}function qj(){return{border:"0",clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:"0",position:"absolute",whiteSpace:"nowrap",width:"1px"}}function d7(s){return s===void 0&&(s=1.3),`
@media only screen and (-webkit-min-device-pixel-ratio: `+s+`),
only screen and (min--moz-device-pixel-ratio: `+s+`),
only screen and (-o-min-device-pixel-ratio: `+s+`/1),
only screen and (min-resolution: `+Math.round(s*96)+`dpi),
only screen and (min-resolution: `+s+`dppx)
`}function _F(s){for(var e="",t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];for(var a=0;a<s.length;a+=1)if(e+=s[a],a===n.length-1&&n[a]){var o=n.filter(function(u){return!!u});o.length>1?(e=e.slice(0,-1),e+=", "+n[a]):o.length===1&&(e+=""+n[a])}else n[a]&&(e+=n[a]+" ");return e.trim()}var wF;function Jj(s){var e=s.colorStops,t=s.fallback,n=s.toDirection,i=n===void 0?"":n;if(!e||e.length<2)throw new ro(56);return{backgroundColor:t||e[0].replace(/,\s+/g,",").split(" ")[0].replace(/,(?=\S)/g,", "),backgroundImage:_F(wF||(wF=_taggedTemplateLiteralLoose(["linear-gradient(","",")"])),i,e.join(", ").replace(/,(?=\S)/g,", "))}}function eY(){var s;return[(s={html:{lineHeight:"1.15",textSizeAdjust:"100%"},body:{margin:"0"},main:{display:"block"},h1:{fontSize:"2em",margin:"0.67em 0"},hr:{boxSizing:"content-box",height:"0",overflow:"visible"},pre:{fontFamily:"monospace, monospace",fontSize:"1em"},a:{backgroundColor:"transparent"},"abbr[title]":{borderBottom:"none",textDecoration:"underline"}},s[`b,
strong`]={fontWeight:"bolder"},s[`code,
kbd,
samp`]={fontFamily:"monospace, monospace",fontSize:"1em"},s.small={fontSize:"80%"},s[`sub,
sup`]={fontSize:"75%",lineHeight:"0",position:"relative",verticalAlign:"baseline"},s.sub={bottom:"-0.25em"},s.sup={top:"-0.5em"},s.img={borderStyle:"none"},s[`button,
input,
optgroup,
select,
textarea`]={fontFamily:"inherit",fontSize:"100%",lineHeight:"1.15",margin:"0"},s[`button,
input`]={overflow:"visible"},s[`button,
select`]={textTransform:"none"},s[`button,
html [type="button"],
[type="reset"],
[type="submit"]`]={WebkitAppearance:"button"},s[`button::-moz-focus-inner,
[type="button"]::-moz-focus-inner,
[type="reset"]::-moz-focus-inner,
[type="submit"]::-moz-focus-inner`]={borderStyle:"none",padding:"0"},s[`button:-moz-focusring,
[type="button"]:-moz-focusring,
[type="reset"]:-moz-focusring,
[type="submit"]:-moz-focusring`]={outline:"1px dotted ButtonText"},s.fieldset={padding:"0.35em 0.625em 0.75em"},s.legend={boxSizing:"border-box",color:"inherit",display:"table",maxWidth:"100%",padding:"0",whiteSpace:"normal"},s.progress={verticalAlign:"baseline"},s.textarea={overflow:"auto"},s[`[type="checkbox"],
[type="radio"]`]={boxSizing:"border-box",padding:"0"},s[`[type="number"]::-webkit-inner-spin-button,
[type="number"]::-webkit-outer-spin-button`]={height:"auto"},s['[type="search"]']={WebkitAppearance:"textfield",outlineOffset:"-2px"},s['[type="search"]::-webkit-search-decoration']={WebkitAppearance:"none"},s["::-webkit-file-upload-button"]={WebkitAppearance:"button",font:"inherit"},s.details={display:"block"},s.summary={display:"list-item"},s.template={display:"none"},s["[hidden]"]={display:"none"},s),{"abbr[title]":{textDecoration:"underline dotted"}}]}var SF;function tY(s){var e=s.colorStops,t=s.extent,n=t===void 0?"":t,i=s.fallback,a=s.position,o=a===void 0?"":a,u=s.shape,c=u===void 0?"":u;if(!e||e.length<2)throw new ro(57);return{backgroundColor:i||e[0].split(" ")[0],backgroundImage:_F(SF||(SF=_taggedTemplateLiteralLoose(["radial-gradient(","","","",")"])),o,c,n,e.join(", "))}}function nY(s,e,t,n,i){var a;if(t===void 0&&(t="png"),i===void 0&&(i="_2x"),!s)throw new ro(58);var o=t.replace(/^\./,""),u=n?n+"."+o:""+s+i+"."+o;return a={backgroundImage:"url("+s+"."+o+")"},a[d7()]=_extends({backgroundImage:"url("+u+")"},e?{backgroundSize:e}:{}),a}var f7={easeInBack:"cubic-bezier(0.600, -0.280, 0.735, 0.045)",easeInCirc:"cubic-bezier(0.600, 0.040, 0.980, 0.335)",easeInCubic:"cubic-bezier(0.550, 0.055, 0.675, 0.190)",easeInExpo:"cubic-bezier(0.950, 0.050, 0.795, 0.035)",easeInQuad:"cubic-bezier(0.550, 0.085, 0.680, 0.530)",easeInQuart:"cubic-bezier(0.895, 0.030, 0.685, 0.220)",easeInQuint:"cubic-bezier(0.755, 0.050, 0.855, 0.060)",easeInSine:"cubic-bezier(0.470, 0.000, 0.745, 0.715)",easeOutBack:"cubic-bezier(0.175, 0.885, 0.320, 1.275)",easeOutCubic:"cubic-bezier(0.215, 0.610, 0.355, 1.000)",easeOutCirc:"cubic-bezier(0.075, 0.820, 0.165, 1.000)",easeOutExpo:"cubic-bezier(0.190, 1.000, 0.220, 1.000)",easeOutQuad:"cubic-bezier(0.250, 0.460, 0.450, 0.940)",easeOutQuart:"cubic-bezier(0.165, 0.840, 0.440, 1.000)",easeOutQuint:"cubic-bezier(0.230, 1.000, 0.320, 1.000)",easeOutSine:"cubic-bezier(0.390, 0.575, 0.565, 1.000)",easeInOutBack:"cubic-bezier(0.680, -0.550, 0.265, 1.550)",easeInOutCirc:"cubic-bezier(0.785, 0.135, 0.150, 0.860)",easeInOutCubic:"cubic-bezier(0.645, 0.045, 0.355, 1.000)",easeInOutExpo:"cubic-bezier(1.000, 0.000, 0.000, 1.000)",easeInOutQuad:"cubic-bezier(0.455, 0.030, 0.515, 0.955)",easeInOutQuart:"cubic-bezier(0.770, 0.000, 0.175, 1.000)",easeInOutQuint:"cubic-bezier(0.860, 0.000, 0.070, 1.000)",easeInOutSine:"cubic-bezier(0.445, 0.050, 0.550, 0.950)"};function A7(s){return f7[s]}function rY(s){return A7(s)}var p7=function(e,t,n){var i=""+n[0]+(n[1]||""),a=""+n[0]/2+(n[1]||""),o=""+t[0]+(t[1]||""),u=""+t[0]/2+(t[1]||"");switch(e){case"top":return"0 "+a+" "+o+" "+a;case"topLeft":return i+" "+o+" 0 0";case"left":return u+" "+i+" "+u+" 0";case"bottomLeft":return i+" 0 0 "+o;case"bottom":return o+" "+a+" 0 "+a;case"bottomRight":return"0 0 "+i+" "+o;case"right":return u+" 0 "+u+" "+i;case"topRight":default:return"0 "+i+" "+o+" 0"}},g7=function(e,t){switch(e){case"top":case"bottomRight":return{borderBottomColor:t};case"right":case"bottomLeft":return{borderLeftColor:t};case"bottom":case"topLeft":return{borderTopColor:t};case"left":case"topRight":return{borderRightColor:t};default:throw new ro(59)}};function iY(s){var e=s.pointingDirection,t=s.height,n=s.width,i=s.foregroundColor,a=s.backgroundColor,o=a===void 0?"transparent":a,u=im(n),c=im(t);if(isNaN(c[0])||isNaN(u[0]))throw new ro(60);return _extends({width:"0",height:"0",borderColor:o},g7(e,i),{borderStyle:"solid",borderWidth:p7(e,c,u)})}function sY(s){s===void 0&&(s="break-word");var e=s==="break-word"?"break-all":s;return{overflowWrap:s,wordWrap:s,wordBreak:e}}function sE(s){return Math.round(s*255)}function m7(s,e,t){return sE(s)+","+sE(e)+","+sE(t)}function vx(s,e,t,n){if(n===void 0&&(n=m7),e===0)return n(t,t,t);var i=(s%360+360)%360/60,a=(1-Math.abs(2*t-1))*e,o=a*(1-Math.abs(i%2-1)),u=0,c=0,d=0;i>=0&&i<1?(u=a,c=o):i>=1&&i<2?(u=o,c=a):i>=2&&i<3?(c=a,d=o):i>=3&&i<4?(c=o,d=a):i>=4&&i<5?(u=o,d=a):i>=5&&i<6&&(u=a,d=o);var g=t-a/2,v=u+g,M=c+g,B=d+g;return n(v,M,B)}var MF={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 v7(s){if(typeof s!="string")return s;var e=s.toLowerCase();return MF[e]?"#"+MF[e]:s}var y7=/^#[a-fA-F0-9]{6}$/,x7=/^#[a-fA-F0-9]{8}$/,b7=/^#[a-fA-F0-9]{3}$/,_7=/^#[a-fA-F0-9]{4}$/,aE=/^rgb\(\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*\)$/i,w7=/^rgb(?:a)?\(\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*(?:,|\/)\s*([-+]?\d*[.]?\d+[%]?)\s*\)$/i,S7=/^hsl\(\s*(\d{0,3}[.]?[0-9]+(?:deg)?)\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*\)$/i,M7=/^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 sm(s){if(typeof s!="string")throw new ro(3);var e=v7(s);if(e.match(y7))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(x7)){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(b7))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(_7)){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 i=aE.exec(e);if(i)return{red:parseInt(""+i[1],10),green:parseInt(""+i[2],10),blue:parseInt(""+i[3],10)};var a=w7.exec(e.substring(0,50));if(a)return{red:parseInt(""+a[1],10),green:parseInt(""+a[2],10),blue:parseInt(""+a[3],10),alpha:parseFloat(""+a[4])>1?parseFloat(""+a[4])/100:parseFloat(""+a[4])};var o=S7.exec(e);if(o){var u=parseInt(""+o[1],10),c=parseInt(""+o[2],10)/100,d=parseInt(""+o[3],10)/100,g="rgb("+vx(u,c,d)+")",v=aE.exec(g);if(!v)throw new ro(4,e,g);return{red:parseInt(""+v[1],10),green:parseInt(""+v[2],10),blue:parseInt(""+v[3],10)}}var M=M7.exec(e.substring(0,50));if(M){var B=parseInt(""+M[1],10),I=parseInt(""+M[2],10)/100,ne=parseInt(""+M[3],10)/100,ee="rgb("+vx(B,I,ne)+")",q=aE.exec(ee);if(!q)throw new ro(4,e,ee);return{red:parseInt(""+q[1],10),green:parseInt(""+q[2],10),blue:parseInt(""+q[3],10),alpha:parseFloat(""+M[4])>1?parseFloat(""+M[4])/100:parseFloat(""+M[4])}}throw new ro(5)}function E7(s){var e=s.red/255,t=s.green/255,n=s.blue/255,i=Math.max(e,t,n),a=Math.min(e,t,n),o=(i+a)/2;if(i===a)return s.alpha!==void 0?{hue:0,saturation:0,lightness:o,alpha:s.alpha}:{hue:0,saturation:0,lightness:o};var u,c=i-a,d=o>.5?c/(2-i-a):c/(i+a);switch(i){case e:u=(t-n)/c+(t<n?6:0);break;case t:u=(n-e)/c+2;break;default:u=(e-t)/c+4;break}return u*=60,s.alpha!==void 0?{hue:u,saturation:d,lightness:o,alpha:s.alpha}:{hue:u,saturation:d,lightness:o}}function vg(s){return E7(sm(s))}var C7=function(e){return e.length===7&&e[1]===e[2]&&e[3]===e[4]&&e[5]===e[6]?"#"+e[1]+e[3]+e[5]:e},oE=C7;function N0(s){var e=s.toString(16);return e.length===1?"0"+e:e}function lE(s){return N0(Math.round(s*255))}function T7(s,e,t){return oE("#"+lE(s)+lE(e)+lE(t))}function H_(s,e,t){return vx(s,e,t,T7)}function EF(s,e,t){if(typeof s=="number"&&typeof e=="number"&&typeof t=="number")return H_(s,e,t);if(typeof s=="object"&&e===void 0&&t===void 0)return H_(s.hue,s.saturation,s.lightness);throw new ro(1)}function CF(s,e,t,n){if(typeof s=="number"&&typeof e=="number"&&typeof t=="number"&&typeof n=="number")return n>=1?H_(s,e,t):"rgba("+vx(s,e,t)+","+n+")";if(typeof s=="object"&&e===void 0&&t===void 0&&n===void 0)return s.alpha>=1?H_(s.hue,s.saturation,s.lightness):"rgba("+vx(s.hue,s.saturation,s.lightness)+","+s.alpha+")";throw new ro(2)}function Q_(s,e,t){if(typeof s=="number"&&typeof e=="number"&&typeof t=="number")return oE("#"+N0(s)+N0(e)+N0(t));if(typeof s=="object"&&e===void 0&&t===void 0)return oE("#"+N0(s.red)+N0(s.green)+N0(s.blue));throw new ro(6)}function yx(s,e,t,n){if(typeof s=="string"&&typeof e=="number"){var i=sm(s);return"rgba("+i.red+","+i.green+","+i.blue+","+e+")"}else{if(typeof s=="number"&&typeof e=="number"&&typeof t=="number"&&typeof n=="number")return n>=1?Q_(s,e,t):"rgba("+s+","+e+","+t+","+n+")";if(typeof s=="object"&&e===void 0&&t===void 0&&n===void 0)return s.alpha>=1?Q_(s.red,s.green,s.blue):"rgba("+s.red+","+s.green+","+s.blue+","+s.alpha+")"}throw new ro(7)}var B7=function(e){return typeof e.red=="number"&&typeof e.green=="number"&&typeof e.blue=="number"&&(typeof e.alpha!="number"||typeof e.alpha=="undefined")},R7=function(e){return typeof e.red=="number"&&typeof e.green=="number"&&typeof e.blue=="number"&&typeof e.alpha=="number"},I7=function(e){return typeof e.hue=="number"&&typeof e.saturation=="number"&&typeof e.lightness=="number"&&(typeof e.alpha!="number"||typeof e.alpha=="undefined")},N7=function(e){return typeof e.hue=="number"&&typeof e.saturation=="number"&&typeof e.lightness=="number"&&typeof e.alpha=="number"};function Tp(s){if(typeof s!="object")throw new ro(8);if(R7(s))return yx(s);if(B7(s))return Q_(s);if(N7(s))return CF(s);if(I7(s))return EF(s);throw new ro(8)}function TF(s,e,t){return function(){var i=t.concat(Array.prototype.slice.call(arguments));return i.length>=e?s.apply(this,i):TF(s,e,i)}}function yA(s){return TF(s,s.length,[])}function F7(s,e){if(e==="transparent")return e;var t=vg(e);return Tp((0,ep.Z)({},t,{hue:t.hue+parseFloat(s)}))}var aY=yA(F7),oY=null;function lY(s){if(s==="transparent")return s;var e=vg(s);return Tp(_extends({},e,{hue:(e.hue+180)%360}))}function Gv(s,e,t){return Math.max(s,Math.min(e,t))}function P7(s,e){if(e==="transparent")return e;var t=vg(e);return Tp((0,ep.Z)({},t,{lightness:Gv(0,1,t.lightness-parseFloat(s))}))}var uY=yA(P7),cY=null;function L7(s,e){if(e==="transparent")return e;var t=vg(e);return Tp((0,ep.Z)({},t,{saturation:Gv(0,1,t.saturation-parseFloat(s))}))}var hY=yA(L7),dY=null;function uE(s){if(s==="transparent")return 0;var e=sm(s),t=Object.keys(e).map(function(o){var u=e[o]/255;return u<=.03928?u/12.92:Math.pow((u+.055)/1.055,2.4)}),n=t[0],i=t[1],a=t[2];return parseFloat((.2126*n+.7152*i+.0722*a).toFixed(3))}function BF(s,e){var t=uE(s),n=uE(e);return parseFloat((t>n?(t+.05)/(n+.05):(n+.05)/(t+.05)).toFixed(2))}function fY(s){return s==="transparent"?s:Tp(_extends({},vg(s),{saturation:0}))}function AY(s){if(typeof s=="object"&&typeof s.hue=="number"&&typeof s.saturation=="number"&&typeof s.lightness=="number")return s.alpha&&typeof s.alpha=="number"?CF({hue:s.hue,saturation:s.saturation,lightness:s.lightness,alpha:s.alpha}):EF({hue:s.hue,saturation:s.saturation,lightness:s.lightness});throw new ro(45)}function pY(s){if(s==="transparent")return s;var e=sm(s);return Tp(_extends({},e,{red:255-e.red,green:255-e.green,blue:255-e.blue}))}function U7(s,e){if(e==="transparent")return e;var t=vg(e);return Tp((0,ep.Z)({},t,{lightness:Gv(0,1,t.lightness+parseFloat(s))}))}var gY=yA(U7),mY=null;function vY(s,e){var t=BF(s,e);return{AA:t>=4.5,AALarge:t>=3,AAA:t>=7,AAALarge:t>=4.5}}function O7(s,e,t){if(e==="transparent")return t;if(t==="transparent")return e;if(s===0)return t;var n=sm(e),i=(0,ep.Z)({},n,{alpha:typeof n.alpha=="number"?n.alpha:1}),a=sm(t),o=(0,ep.Z)({},a,{alpha:typeof a.alpha=="number"?a.alpha:1}),u=i.alpha-o.alpha,c=parseFloat(s)*2-1,d=c*u===-1?c:c+u,g=1+c*u,v=(d/g+1)/2,M=1-v,B={red:Math.floor(i.red*v+o.red*M),green:Math.floor(i.green*v+o.green*M),blue:Math.floor(i.blue*v+o.blue*M),alpha:i.alpha*parseFloat(s)+o.alpha*(1-parseFloat(s))};return yx(B)}var D7=yA(O7),RF=D7;function k7(s,e){if(e==="transparent")return e;var t=sm(e),n=typeof t.alpha=="number"?t.alpha:1,i=(0,ep.Z)({},t,{alpha:Gv(0,1,(n*100+parseFloat(s)*100)/100)});return yx(i)}var V7=yA(k7),z7=V7,IF="#000",NF="#fff";function yY(s,e,t,n){e===void 0&&(e=IF),t===void 0&&(t=NF),n===void 0&&(n=!0);var i=uE(s)>.179,a=i?e:t;return!n||BF(s,a)>=4.5?a:i?IF:NF}function xY(s){if(typeof s=="object"&&typeof s.red=="number"&&typeof s.green=="number"&&typeof s.blue=="number")return typeof s.alpha=="number"?yx({red:s.red,green:s.green,blue:s.blue,alpha:s.alpha}):Q_({red:s.red,green:s.green,blue:s.blue});throw new ro(46)}function G7(s,e){if(e==="transparent")return e;var t=vg(e);return Tp((0,ep.Z)({},t,{saturation:Gv(0,1,t.saturation+parseFloat(s))}))}var bY=yA(G7),_Y=null;function H7(s,e){return e==="transparent"?e:Tp((0,ep.Z)({},vg(e),{hue:parseFloat(s)}))}var wY=yA(H7),SY=null;function Q7(s,e){return e==="transparent"?e:Tp((0,ep.Z)({},vg(e),{lightness:parseFloat(s)}))}var MY=yA(Q7),EY=null;function W7(s,e){return e==="transparent"?e:Tp((0,ep.Z)({},vg(e),{saturation:parseFloat(s)}))}var CY=yA(W7),TY=null;function Z7(s,e){return e==="transparent"?e:RF(parseFloat(s),"rgb(0, 0, 0)",e)}var BY=yA(Z7),RY=null;function K7(s,e){return e==="transparent"?e:RF(parseFloat(s),"rgb(255, 255, 255)",e)}var IY=yA(K7),NY=null;function $7(s,e){if(e==="transparent")return e;var t=sm(e),n=typeof t.alpha=="number"?t.alpha:1,i=(0,ep.Z)({},t,{alpha:Gv(0,1,+(n*100-parseFloat(s)*100).toFixed(2)/100)});return yx(i)}var FY=yA($7),PY=null;function LY(){for(var s=arguments.length,e=new Array(s),t=0;t<s;t++)e[t]=arguments[t];var n=Array.isArray(e[0]);if(!n&&e.length>8)throw new ro(64);var i=e.map(function(a){if(n&&!Array.isArray(a)||!n&&Array.isArray(a))throw new ro(65);if(Array.isArray(a)&&a.length>8)throw new ro(66);return Array.isArray(a)?a.join(" "):a}).join(", ");return{animation:i}}function UY(){for(var s=arguments.length,e=new Array(s),t=0;t<s;t++)e[t]=arguments[t];return{backgroundImage:e.join(", ")}}function OY(){for(var s=arguments.length,e=new Array(s),t=0;t<s;t++)e[t]=arguments[t];return{background:e.join(", ")}}var X7=null;function DY(s){for(var e=arguments.length,t=new Array(e>1?e-1:0),n=1;n<e;n++)t[n-1]=arguments[n];if(typeof s=="string"&&X7.indexOf(s)>=0){var i;return i={},i["border"+mx(s)+"Width"]=t[0],i["border"+mx(s)+"Style"]=t[1],i["border"+mx(s)+"Color"]=t[2],i}else return t.unshift(s),{borderWidth:t[0],borderStyle:t[1],borderColor:t[2]}}function kY(){for(var s=arguments.length,e=new Array(s),t=0;t<s;t++)e[t]=arguments[t];return I0.apply(void 0,["borderColor"].concat(e))}function VY(s,e){var t=mx(s);if(!e&&e!==0)throw new ro(62);if(t==="Top"||t==="Bottom"){var n;return n={},n["border"+t+"RightRadius"]=e,n["border"+t+"LeftRadius"]=e,n}if(t==="Left"||t==="Right"){var i;return i={},i["borderTop"+t+"Radius"]=e,i["borderBottom"+t+"Radius"]=e,i}throw new ro(63)}function zY(){for(var s=arguments.length,e=new Array(s),t=0;t<s;t++)e[t]=arguments[t];return I0.apply(void 0,["borderStyle"].concat(e))}function GY(){for(var s=arguments.length,e=new Array(s),t=0;t<s;t++)e[t]=arguments[t];return I0.apply(void 0,["borderWidth"].concat(e))}function FF(s,e){var t=e?":"+e:"";return s(t)}function PF(s,e,t){if(!e)throw new ro(67);if(s.length===0)return FF(e,null);for(var n=[],i=0;i<s.length;i+=1){if(t&&t.indexOf(s[i])<0)throw new ro(68);n.push(FF(e,s[i]))}return n=n.join(","),n}var j7=null;function Y7(s){return"button"+s+`,
input[type="button"]`+s+`,
input[type="reset"]`+s+`,
input[type="submit"]`+s}function HY(){for(var s=arguments.length,e=new Array(s),t=0;t<s;t++)e[t]=arguments[t];return PF(e,Y7,j7)}function QY(){for(var s=arguments.length,e=new Array(s),t=0;t<s;t++)e[t]=arguments[t];return I0.apply(void 0,["margin"].concat(e))}function WY(){for(var s=arguments.length,e=new Array(s),t=0;t<s;t++)e[t]=arguments[t];return I0.apply(void 0,["padding"].concat(e))}var q7=null;function ZY(s){for(var e=arguments.length,t=new Array(e>1?e-1:0),n=1;n<e;n++)t[n-1]=arguments[n];return q7.indexOf(s)>=0&&s?_extends({},I0.apply(void 0,[""].concat(t)),{position:s}):I0.apply(void 0,["",s].concat(t))}function KY(s,e){return e===void 0&&(e=s),{height:s,width:e}}var J7=null;function eZ(s){return'input[type="color"]'+s+`,
input[type="date"]`+s+`,
input[type="datetime"]`+s+`,
input[type="datetime-local"]`+s+`,
input[type="email"]`+s+`,
input[type="month"]`+s+`,
input[type="number"]`+s+`,
input[type="password"]`+s+`,
input[type="search"]`+s+`,
input[type="tel"]`+s+`,
input[type="text"]`+s+`,
input[type="time"]`+s+`,
input[type="url"]`+s+`,
input[type="week"]`+s+`,
input:not([type])`+s+`,
textarea`+s}function $Y(){for(var s=arguments.length,e=new Array(s),t=0;t<s;t++)e[t]=arguments[t];return PF(e,eZ,J7)}function XY(){for(var s=arguments.length,e=new Array(s),t=0;t<s;t++)e[t]=arguments[t];if(Array.isArray(e[0])&&e.length===2){var n=e[1];if(typeof n!="string")throw new ro(61);var i=e[0].map(function(a){return a+" "+n}).join(", ");return{transition:i}}else return{transition:e.join(", ")}}var Zm=Object.freeze({Linear:Object.freeze({None:function(s){return s},In:function(s){return s},Out:function(s){return s},InOut:function(s){return s}}),Quadratic:Object.freeze({In:function(s){return s*s},Out:function(s){return s*(2-s)},InOut:function(s){return(s*=2)<1?.5*s*s:-.5*(--s*(s-2)-1)}}),Cubic:Object.freeze({In:function(s){return s*s*s},Out:function(s){return--s*s*s+1},InOut:function(s){return(s*=2)<1?.5*s*s*s:.5*((s-=2)*s*s+2)}}),Quartic:Object.freeze({In:function(s){return s*s*s*s},Out:function(s){return 1- --s*s*s*s},InOut:function(s){return(s*=2)<1?.5*s*s*s*s:-.5*((s-=2)*s*s*s-2)}}),Quintic:Object.freeze({In:function(s){return s*s*s*s*s},Out:function(s){return--s*s*s*s*s+1},InOut:function(s){return(s*=2)<1?.5*s*s*s*s*s:.5*((s-=2)*s*s*s*s+2)}}),Sinusoidal:Object.freeze({In:function(s){return 1-Math.sin((1-s)*Math.PI/2)},Out:function(s){return Math.sin(s*Math.PI/2)},InOut:function(s){return .5*(1-Math.sin(Math.PI*(.5-s)))}}),Exponential:Object.freeze({In:function(s){return s===0?0:Math.pow(1024,s-1)},Out:function(s){return s===1?1:1-Math.pow(2,-10*s)},InOut:function(s){return s===0?0:s===1?1:(s*=2)<1?.5*Math.pow(1024,s-1):.5*(-Math.pow(2,-10*(s-1))+2)}}),Circular:Object.freeze({In:function(s){return 1-Math.sqrt(1-s*s)},Out:function(s){return Math.sqrt(1- --s*s)},InOut:function(s){return(s*=2)<1?-.5*(Math.sqrt(1-s*s)-1):.5*(Math.sqrt(1-(s-=2)*s)+1)}}),Elastic:Object.freeze({In:function(s){return s===0?0:s===1?1:-Math.pow(2,10*(s-1))*Math.sin((s-1.1)*5*Math.PI)},Out:function(s){return s===0?0:s===1?1:Math.pow(2,-10*s)*Math.sin((s-.1)*5*Math.PI)+1},InOut:function(s){return s===0?0:s===1?1:(s*=2,s<1?-.5*Math.pow(2,10*(s-1))*Math.sin((s-1.1)*5*Math.PI):.5*Math.pow(2,-10*(s-1))*Math.sin((s-1.1)*5*Math.PI)+1)}}),Back:Object.freeze({In:function(s){var e=1.70158;return s===1?1:s*s*((e+1)*s-e)},Out:function(s){var e=1.70158;return s===0?0:--s*s*((e+1)*s+e)+1},InOut:function(s){var e=2.5949095;return(s*=2)<1?.5*(s*s*((e+1)*s-e)):.5*((s-=2)*s*((e+1)*s+e)+2)}}),Bounce:Object.freeze({In:function(s){return 1-Zm.Bounce.Out(1-s)},Out:function(s){return s<1/2.75?7.5625*s*s:s<2/2.75?7.5625*(s-=1.5/2.75)*s+.75:s<2.5/2.75?7.5625*(s-=2.25/2.75)*s+.9375:7.5625*(s-=2.625/2.75)*s+.984375},InOut:function(s){return s<.5?Zm.Bounce.In(s*2)*.5:Zm.Bounce.Out(s*2-1)*.5+.5}}),generatePow:function(s){return s===void 0&&(s=4),s=s<Number.EPSILON?Number.EPSILON:s,s=s>1e4?1e4:s,{In:function(e){return Math.pow(e,s)},Out:function(e){return 1-Math.pow(1-e,s)},InOut:function(e){return e<.5?Math.pow(e*2,s)/2:(1-Math.pow(2-e*2,s))/2+.5}}}}),Hv=function(){return performance.now()},cE=function(){function s(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this._tweens={},this._tweensAddedDuringUpdate={},this.add.apply(this,e)}return s.prototype.getAll=function(){var e=this;return Object.keys(this._tweens).map(function(t){return e._tweens[t]})},s.prototype.removeAll=function(){this._tweens={}},s.prototype.add=function(){for(var e,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];for(var i=0,a=t;i<a.length;i++){var o=a[i];(e=o._group)===null||e===void 0||e.remove(o),o._group=this,this._tweens[o.getId()]=o,this._tweensAddedDuringUpdate[o.getId()]=o}},s.prototype.remove=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];for(var n=0,i=e;n<i.length;n++){var a=i[n];a._group=void 0,delete this._tweens[a.getId()],delete this._tweensAddedDuringUpdate[a.getId()]}},s.prototype.allStopped=function(){return this.getAll().every(function(e){return!e.isPlaying()})},s.prototype.update=function(e,t){e===void 0&&(e=Hv()),t===void 0&&(t=!0);var n=Object.keys(this._tweens);if(n.length!==0)for(;n.length>0;){this._tweensAddedDuringUpdate={};for(var i=0;i<n.length;i++){var a=this._tweens[n[i]],o=!t;a&&a.update(e,o)===!1&&!t&&this.remove(a)}n=Object.keys(this._tweensAddedDuringUpdate)}},s}(),F0={Linear:function(s,e){var t=s.length-1,n=t*e,i=Math.floor(n),a=F0.Utils.Linear;return e<0?a(s[0],s[1],n):e>1?a(s[t],s[t-1],t-n):a(s[i],s[i+1>t?t:i+1],n-i)},Bezier:function(s,e){for(var t=0,n=s.length-1,i=Math.pow,a=F0.Utils.Bernstein,o=0;o<=n;o++)t+=i(1-e,n-o)*i(e,o)*s[o]*a(n,o);return t},CatmullRom:function(s,e){var t=s.length-1,n=t*e,i=Math.floor(n),a=F0.Utils.CatmullRom;return s[0]===s[t]?(e<0&&(i=Math.floor(n=t*(1+e))),a(s[(i-1+t)%t],s[i],s[(i+1)%t],s[(i+2)%t],n-i)):e<0?s[0]-(a(s[0],s[0],s[1],s[1],-n)-s[0]):e>1?s[t]-(a(s[t],s[t],s[t-1],s[t-1],n-t)-s[t]):a(s[i?i-1:0],s[i],s[t<i+1?t:i+1],s[t<i+2?t:i+2],n-i)},Utils:{Linear:function(s,e,t){return(e-s)*t+s},Bernstein:function(s,e){var t=F0.Utils.Factorial;return t(s)/t(e)/t(s-e)},Factorial:function(){var s=[1];return function(e){var t=1;if(s[e])return s[e];for(var n=e;n>1;n--)t*=n;return s[e]=t,t}}(),CatmullRom:function(s,e,t,n,i){var a=(t-s)*.5,o=(n-e)*.5,u=i*i,c=i*u;return(2*e-2*t+a+o)*c+(-3*e+3*t-2*a-o)*u+a*i+e}}},hE=function(){function s(){}return s.nextId=function(){return s._nextId++},s._nextId=0,s}(),dE=new cE,fE=function(){function s(e,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=Zm.Linear.None,this._interpolationFunction=F0.Linear,this._chainedTweens=[],this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._id=hE.nextId(),this._isChainStopped=!1,this._propertiesAreSetUp=!1,this._goToEnd=!1,this._object=e,typeof t=="object"?(this._group=t,t.add(this)):t===!0&&(this._group=dE,dE.add(this))}return s.prototype.getId=function(){return this._id},s.prototype.isPlaying=function(){return this._isPlaying},s.prototype.isPaused=function(){return this._isPaused},s.prototype.getDuration=function(){return this._duration},s.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},s.prototype.duration=function(e){return e===void 0&&(e=1e3),this._duration=e<0?0:e,this},s.prototype.dynamic=function(e){return e===void 0&&(e=!1),this._isDynamic=e,this},s.prototype.start=function(e,t){if(e===void 0&&(e=Hv()),t===void 0&&(t=!1),this._isPlaying)return this;if(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 i={};for(var a in this._valuesEnd)i[a]=this._valuesEnd[a];this._valuesEnd=i}this._setupProperties(this._object,this._valuesStart,this._valuesEnd,this._valuesStartRepeat,t)}return this},s.prototype.startFromCurrentValues=function(e){return this.start(e,!0)},s.prototype._setupProperties=function(e,t,n,i,a){for(var o in n){var u=e[o],c=Array.isArray(u),d=c?"array":typeof u,g=!c&&Array.isArray(n[o]);if(!(d==="undefined"||d==="function")){if(g){var v=n[o];if(v.length===0)continue;for(var M=[u],B=0,I=v.length;B<I;B+=1){var ne=this._handleRelativeValue(u,v[B]);if(isNaN(ne)){g=!1,console.warn("Found invalid interpolation list. Skipping.");break}M.push(ne)}g&&(n[o]=M)}if((d==="object"||c)&&u&&!g){t[o]=c?[]:{};var ee=u;for(var q in ee)t[o][q]=ee[q];i[o]=c?[]:{};var v=n[o];if(!this._isDynamic){var ye={};for(var q in v)ye[q]=v[q];n[o]=v=ye}this._setupProperties(ee,t[o],v,i[o],a)}else(typeof t[o]=="undefined"||a)&&(t[o]=u),c||(t[o]*=1),g?i[o]=n[o].slice().reverse():i[o]=t[o]||0}}},s.prototype.stop=function(){return this._isChainStopped||(this._isChainStopped=!0,this.stopChainedTweens()),this._isPlaying?(this._isPlaying=!1,this._isPaused=!1,this._onStopCallback&&this._onStopCallback(this._object),this):this},s.prototype.end=function(){return this._goToEnd=!0,this.update(this._startTime+this._duration),this},s.prototype.pause=function(e){return e===void 0&&(e=Hv()),this._isPaused||!this._isPlaying?this:(this._isPaused=!0,this._pauseStart=e,this)},s.prototype.resume=function(e){return e===void 0&&(e=Hv()),!this._isPaused||!this._isPlaying?this:(this._isPaused=!1,this._startTime+=e-this._pauseStart,this._pauseStart=0,this)},s.prototype.stopChainedTweens=function(){for(var e=0,t=this._chainedTweens.length;e<t;e++)this._chainedTweens[e].stop();return this},s.prototype.group=function(e){return e?(e.add(this),this):(console.warn("tween.group() without args has been removed, use group.add(tween) instead."),this)},s.prototype.remove=function(){var e;return(e=this._group)===null||e===void 0||e.remove(this),this},s.prototype.delay=function(e){return e===void 0&&(e=0),this._delayTime=e,this},s.prototype.repeat=function(e){return e===void 0&&(e=0),this._initialRepeat=e,this._repeat=e,this},s.prototype.repeatDelay=function(e){return this._repeatDelayTime=e,this},s.prototype.yoyo=function(e){return e===void 0&&(e=!1),this._yoyo=e,this},s.prototype.easing=function(e){return e===void 0&&(e=Zm.Linear.None),this._easingFunction=e,this},s.prototype.interpolation=function(e){return e===void 0&&(e=F0.Linear),this._interpolationFunction=e,this},s.prototype.chain=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return this._chainedTweens=e,this},s.prototype.onStart=function(e){return this._onStartCallback=e,this},s.prototype.onEveryStart=function(e){return this._onEveryStartCallback=e,this},s.prototype.onUpdate=function(e){return this._onUpdateCallback=e,this},s.prototype.onRepeat=function(e){return this._onRepeatCallback=e,this},s.prototype.onComplete=function(e){return this._onCompleteCallback=e,this},s.prototype.onStop=function(e){return this._onStopCallback=e,this},s.prototype.update=function(e,t){var n=this,i;if(e===void 0&&(e=Hv()),t===void 0&&(t=s.autoStartOnUpdate),this._isPaused)return!0;var a;if(!this._goToEnd&&!this._isPlaying)if(t)this.start(e,!0);else return!1;if(this._goToEnd=!1,e<this._startTime)return!0;this._onStartCallbackFired===!1&&(this._onStartCallback&&this._onStartCallback(this._object),this._onStartCallbackFired=!0),this._onEveryStartCallbackFired===!1&&(this._onEveryStartCallback&&this._onEveryStartCallback(this._object),this._onEveryStartCallbackFired=!0);var o=e-this._startTime,u=this._duration+((i=this._repeatDelayTime)!==null&&i!==void 0?i:this._delayTime),c=this._duration+this._repeat*u,d=function(){if(n._duration===0||o>c)return 1;var ne=Math.trunc(o/u),ee=o-ne*u,q=Math.min(ee/n._duration,1);return q===0&&o===n._duration?1:q},g=d(),v=this._easingFunction(g);if(this._updateProperties(this._object,this._valuesStart,this._valuesEnd,v),this._onUpdateCallback&&this._onUpdateCallback(this._object,g),this._duration===0||o>=this._duration)if(this._repeat>0){var M=Math.min(Math.trunc((o-this._duration)/u)+1,this._repeat);isFinite(this._repeat)&&(this._repeat-=M);for(a in this._valuesStartRepeat)!this._yoyo&&typeof this._valuesEnd[a]=="string"&&(this._valuesStartRepeat[a]=this._valuesStartRepeat[a]+parseFloat(this._valuesEnd[a])),this._yoyo&&this._swapEndStartRepeatValues(a),this._valuesStart[a]=this._valuesStartRepeat[a];return this._yoyo&&(this._reversed=!this._reversed),this._startTime+=u*M,this._onRepeatCallback&&this._onRepeatCallback(this._object),this._onEveryStartCallbackFired=!1,!0}else{this._onCompleteCallback&&this._onCompleteCallback(this._object);for(var B=0,I=this._chainedTweens.length;B<I;B++)this._chainedTweens[B].start(this._startTime+this._duration,!1);return this._isPlaying=!1,!1}return!0},s.prototype._updateProperties=function(e,t,n,i){for(var a in n)if(t[a]!==void 0){var o=t[a]||0,u=n[a],c=Array.isArray(e[a]),d=Array.isArray(u),g=!c&&d;g?e[a]=this._interpolationFunction(u,i):typeof u=="object"&&u?this._updateProperties(e[a],o,u,i):(u=this._handleRelativeValue(o,u),typeof u=="number"&&(e[a]=o+(u-o)*i))}},s.prototype._handleRelativeValue=function(e,t){return typeof t!="string"?t:t.charAt(0)==="+"||t.charAt(0)==="-"?e+parseFloat(t):parseFloat(t)},s.prototype._swapEndStartRepeatValues=function(e){var t=this._valuesStartRepeat[e],n=this._valuesEnd[e];typeof n=="string"?this._valuesStartRepeat[e]=this._valuesStartRepeat[e]+parseFloat(n):this._valuesStartRepeat[e]=this._valuesEnd[e],this._valuesEnd[e]=t},s.autoStartOnUpdate=!1,s}(),tZ="25.0.0",nZ=hE.nextId,yg=dE,rZ=yg.getAll.bind(yg),iZ=yg.removeAll.bind(yg),sZ=yg.add.bind(yg),aZ=yg.remove.bind(yg),oZ=yg.update.bind(yg),jY={Easing:Zm,Group:cE,Interpolation:F0,now:Hv,Sequence:hE,nextId:nZ,Tween:fE,VERSION:tZ,getAll:rZ,removeAll:iZ,add:sZ,remove:aZ,update:oZ};function lZ(){}function LF(s){return s==null?lZ:function(){return this.querySelector(s)}}function uZ(s){typeof s!="function"&&(s=LF(s));for(var e=this._groups,t=e.length,n=new Array(t),i=0;i<t;++i)for(var a=e[i],o=a.length,u=n[i]=new Array(o),c,d,g=0;g<o;++g)(c=a[g])&&(d=s.call(c,c.__data__,g,a))&&("__data__"in c&&(d.__data__=c.__data__),u[g]=d);return new xA(n,this._parents)}function cZ(s){return s==null?[]:Array.isArray(s)?s:Array.from(s)}function hZ(){return[]}function dZ(s){return s==null?hZ:function(){return this.querySelectorAll(s)}}function fZ(s){return function(){return cZ(s.apply(this,arguments))}}function AZ(s){typeof s=="function"?s=fZ(s):s=dZ(s);for(var e=this._groups,t=e.length,n=[],i=[],a=0;a<t;++a)for(var o=e[a],u=o.length,c,d=0;d<u;++d)(c=o[d])&&(n.push(s.call(c,c.__data__,d,o)),i.push(c));return new xA(n,i)}function pZ(s){return function(){return this.matches(s)}}function UF(s){return function(e){return e.matches(s)}}var gZ=Array.prototype.find;function mZ(s){return function(){return gZ.call(this.children,s)}}function vZ(){return this.firstElementChild}function yZ(s){return this.select(s==null?vZ:mZ(typeof s=="function"?s:UF(s)))}var xZ=Array.prototype.filter;function bZ(){return Array.from(this.children)}function _Z(s){return function(){return xZ.call(this.children,s)}}function wZ(s){return this.selectAll(s==null?bZ:_Z(typeof s=="function"?s:UF(s)))}function SZ(s){typeof s!="function"&&(s=pZ(s));for(var e=this._groups,t=e.length,n=new Array(t),i=0;i<t;++i)for(var a=e[i],o=a.length,u=n[i]=[],c,d=0;d<o;++d)(c=a[d])&&s.call(c,c.__data__,d,a)&&u.push(c);return new xA(n,this._parents)}function OF(s){return new Array(s.length)}function MZ(){return new xA(this._enter||this._groups.map(OF),this._parents)}function W_(s,e){this.ownerDocument=s.ownerDocument,this.namespaceURI=s.namespaceURI,this._next=null,this._parent=s,this.__data__=e}W_.prototype={constructor:W_,appendChild:function(s){return this._parent.insertBefore(s,this._next)},insertBefore:function(s,e){return this._parent.insertBefore(s,e)},querySelector:function(s){return this._parent.querySelector(s)},querySelectorAll:function(s){return this._parent.querySelectorAll(s)}};function EZ(s){return function(){return s}}function CZ(s,e,t,n,i,a){for(var o=0,u,c=e.length,d=a.length;o<d;++o)(u=e[o])?(u.__data__=a[o],n[o]=u):t[o]=new W_(s,a[o]);for(;o<c;++o)(u=e[o])&&(i[o]=u)}function TZ(s,e,t,n,i,a,o){var u,c,d=new Map,g=e.length,v=a.length,M=new Array(g),B;for(u=0;u<g;++u)(c=e[u])&&(M[u]=B=o.call(c,c.__data__,u,e)+"",d.has(B)?i[u]=c:d.set(B,c));for(u=0;u<v;++u)B=o.call(s,a[u],u,a)+"",(c=d.get(B))?(n[u]=c,c.__data__=a[u],d.delete(B)):t[u]=new W_(s,a[u]);for(u=0;u<g;++u)(c=e[u])&&d.get(M[u])===c&&(i[u]=c)}function BZ(s){return s.__data__}function RZ(s,e){if(!arguments.length)return Array.from(this,BZ);var t=e?TZ:CZ,n=this._parents,i=this._groups;typeof s!="function"&&(s=EZ(s));for(var a=i.length,o=new Array(a),u=new Array(a),c=new Array(a),d=0;d<a;++d){var g=n[d],v=i[d],M=v.length,B=IZ(s.call(g,g&&g.__data__,d,n)),I=B.length,ne=u[d]=new Array(I),ee=o[d]=new Array(I),q=c[d]=new Array(M);t(g,v,ne,ee,q,B,e);for(var ye=0,Ce=0,ke,nt;ye<I;++ye)if(ke=ne[ye]){for(ye>=Ce&&(Ce=ye+1);!(nt=ee[Ce])&&++Ce<I;);ke._next=nt||null}}return o=new xA(o,n),o._enter=u,o._exit=c,o}function IZ(s){return typeof s=="object"&&"length"in s?s:Array.from(s)}function NZ(){return new xA(this._exit||this._groups.map(OF),this._parents)}function FZ(s,e,t){var n=this.enter(),i=this,a=this.exit();return typeof s=="function"?(n=s(n),n&&(n=n.selection())):n=n.append(s+""),e!=null&&(i=e(i),i&&(i=i.selection())),t==null?a.remove():t(a),n&&i?n.merge(i).order():i}function PZ(s){for(var e=s.selection?s.selection():s,t=this._groups,n=e._groups,i=t.length,a=n.length,o=Math.min(i,a),u=new Array(i),c=0;c<o;++c)for(var d=t[c],g=n[c],v=d.length,M=u[c]=new Array(v),B,I=0;I<v;++I)(B=d[I]||g[I])&&(M[I]=B);for(;c<i;++c)u[c]=t[c];return new xA(u,this._parents)}function LZ(){for(var s=this._groups,e=-1,t=s.length;++e<t;)for(var n=s[e],i=n.length-1,a=n[i],o;--i>=0;)(o=n[i])&&(a&&o.compareDocumentPosition(a)^4&&a.parentNode.insertBefore(o,a),a=o);return this}function UZ(s){s||(s=OZ);function e(v,M){return v&&M?s(v.__data__,M.__data__):!v-!M}for(var t=this._groups,n=t.length,i=new Array(n),a=0;a<n;++a){for(var o=t[a],u=o.length,c=i[a]=new Array(u),d,g=0;g<u;++g)(d=o[g])&&(c[g]=d);c.sort(e)}return new xA(i,this._parents).order()}function OZ(s,e){return s<e?-1:s>e?1:s>=e?0:NaN}function DZ(){var s=arguments[0];return arguments[0]=this,s.apply(null,arguments),this}function kZ(){return Array.from(this)}function VZ(){for(var s=this._groups,e=0,t=s.length;e<t;++e)for(var n=s[e],i=0,a=n.length;i<a;++i){var o=n[i];if(o)return o}return null}function zZ(){let s=0;for(const e of this)++s;return s}function GZ(){return!this.node()}function HZ(s){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var i=e[t],a=0,o=i.length,u;a<o;++a)(u=i[a])&&s.call(u,u.__data__,a,i);return this}var AE="http://www.w3.org/1999/xhtml",DF={svg:"http://www.w3.org/2000/svg",xhtml:AE,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function kF(s){var e=s+="",t=e.indexOf(":");return t>=0&&(e=s.slice(0,t))!=="xmlns"&&(s=s.slice(t+1)),DF.hasOwnProperty(e)?{space:DF[e],local:s}:s}function QZ(s){return function(){this.removeAttribute(s)}}function WZ(s){return function(){this.removeAttributeNS(s.space,s.local)}}function ZZ(s,e){return function(){this.setAttribute(s,e)}}function KZ(s,e){return function(){this.setAttributeNS(s.space,s.local,e)}}function $Z(s,e){return function(){var t=e.apply(this,arguments);t==null?this.removeAttribute(s):this.setAttribute(s,t)}}function XZ(s,e){return function(){var t=e.apply(this,arguments);t==null?this.removeAttributeNS(s.space,s.local):this.setAttributeNS(s.space,s.local,t)}}function jZ(s,e){var t=kF(s);if(arguments.length<2){var n=this.node();return t.local?n.getAttributeNS(t.space,t.local):n.getAttribute(t)}return this.each((e==null?t.local?WZ:QZ:typeof e=="function"?t.local?XZ:$Z:t.local?KZ:ZZ)(t,e))}function VF(s){return s.ownerDocument&&s.ownerDocument.defaultView||s.document&&s||s.defaultView}function YZ(s){return function(){this.style.removeProperty(s)}}function qZ(s,e,t){return function(){this.style.setProperty(s,e,t)}}function JZ(s,e,t){return function(){var n=e.apply(this,arguments);n==null?this.style.removeProperty(s):this.style.setProperty(s,n,t)}}function eK(s,e,t){return arguments.length>1?this.each((e==null?YZ:typeof e=="function"?JZ:qZ)(s,e,t==null?"":t)):tK(this.node(),s)}function tK(s,e){return s.style.getPropertyValue(e)||VF(s).getComputedStyle(s,null).getPropertyValue(e)}function nK(s){return function(){delete this[s]}}function rK(s,e){return function(){this[s]=e}}function iK(s,e){return function(){var t=e.apply(this,arguments);t==null?delete this[s]:this[s]=t}}function sK(s,e){return arguments.length>1?this.each((e==null?nK:typeof e=="function"?iK:rK)(s,e)):this.node()[s]}function zF(s){return s.trim().split(/^|\s+/)}function pE(s){return s.classList||new GF(s)}function GF(s){this._node=s,this._names=zF(s.getAttribute("class")||"")}GF.prototype={add:function(s){var e=this._names.indexOf(s);e<0&&(this._names.push(s),this._node.setAttribute("class",this._names.join(" ")))},remove:function(s){var e=this._names.indexOf(s);e>=0&&(this._names.splice(e,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(s){return this._names.indexOf(s)>=0}};function HF(s,e){for(var t=pE(s),n=-1,i=e.length;++n<i;)t.add(e[n])}function QF(s,e){for(var t=pE(s),n=-1,i=e.length;++n<i;)t.remove(e[n])}function aK(s){return function(){HF(this,s)}}function oK(s){return function(){QF(this,s)}}function lK(s,e){return function(){(e.apply(this,arguments)?HF:QF)(this,s)}}function uK(s,e){var t=zF(s+"");if(arguments.length<2){for(var n=pE(this.node()),i=-1,a=t.length;++i<a;)if(!n.contains(t[i]))return!1;return!0}return this.each((typeof e=="function"?lK:e?aK:oK)(t,e))}function cK(){this.textContent=""}function hK(s){return function(){this.textContent=s}}function dK(s){return function(){var e=s.apply(this,arguments);this.textContent=e==null?"":e}}function fK(s){return arguments.length?this.each(s==null?cK:(typeof s=="function"?dK:hK)(s)):this.node().textContent}function AK(){this.innerHTML=""}function pK(s){return function(){this.innerHTML=s}}function gK(s){return function(){var e=s.apply(this,arguments);this.innerHTML=e==null?"":e}}function mK(s){return arguments.length?this.each(s==null?AK:(typeof s=="function"?gK:pK)(s)):this.node().innerHTML}function vK(){this.nextSibling&&this.parentNode.appendChild(this)}function yK(){return this.each(vK)}function xK(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function bK(){return this.each(xK)}function _K(s){return function(){var e=this.ownerDocument,t=this.namespaceURI;return t===AE&&e.documentElement.namespaceURI===AE?e.createElement(s):e.createElementNS(t,s)}}function wK(s){return function(){return this.ownerDocument.createElementNS(s.space,s.local)}}function WF(s){var e=kF(s);return(e.local?wK:_K)(e)}function SK(s){var e=typeof s=="function"?s:WF(s);return this.select(function(){return this.appendChild(e.apply(this,arguments))})}function MK(){return null}function EK(s,e){var t=typeof s=="function"?s:WF(s),n=e==null?MK:typeof e=="function"?e:LF(e);return this.select(function(){return this.insertBefore(t.apply(this,arguments),n.apply(this,arguments)||null)})}function CK(){var s=this.parentNode;s&&s.removeChild(this)}function TK(){return this.each(CK)}function BK(){var s=this.cloneNode(!1),e=this.parentNode;return e?e.insertBefore(s,this.nextSibling):s}function RK(){var s=this.cloneNode(!0),e=this.parentNode;return e?e.insertBefore(s,this.nextSibling):s}function IK(s){return this.select(s?RK:BK)}function NK(s){return arguments.length?this.property("__data__",s):this.node().__data__}function FK(s){return function(e){s.call(this,e,this.__data__)}}function PK(s){return s.trim().split(/^|\s+/).map(function(e){var t="",n=e.indexOf(".");return n>=0&&(t=e.slice(n+1),e=e.slice(0,n)),{type:e,name:t}})}function LK(s){return function(){var e=this.__on;if(e){for(var t=0,n=-1,i=e.length,a;t<i;++t)a=e[t],(!s.type||a.type===s.type)&&a.name===s.name?this.removeEventListener(a.type,a.listener,a.options):e[++n]=a;++n?e.length=n:delete this.__on}}}function UK(s,e,t){return function(){var n=this.__on,i,a=FK(e);if(n){for(var o=0,u=n.length;o<u;++o)if((i=n[o]).type===s.type&&i.name===s.name){this.removeEventListener(i.type,i.listener,i.options),this.addEventListener(i.type,i.listener=a,i.options=t),i.value=e;return}}this.addEventListener(s.type,a,t),i={type:s.type,name:s.name,value:e,listener:a,options:t},n?n.push(i):this.__on=[i]}}function OK(s,e,t){var n=PK(s+""),i,a=n.length,o;if(arguments.length<2){var u=this.node().__on;if(u){for(var c=0,d=u.length,g;c<d;++c)for(i=0,g=u[c];i<a;++i)if((o=n[i]).type===g.type&&o.name===g.name)return g.value}return}for(u=e?UK:LK,i=0;i<a;++i)this.each(u(n[i],e,t));return this}function ZF(s,e,t){var n=VF(s),i=n.CustomEvent;typeof i=="function"?i=new i(e,t):(i=n.document.createEvent("Event"),t?(i.initEvent(e,t.bubbles,t.cancelable),i.detail=t.detail):i.initEvent(e,!1,!1)),s.dispatchEvent(i)}function DK(s,e){return function(){return ZF(this,s,e)}}function kK(s,e){return function(){return ZF(this,s,e.apply(this,arguments))}}function VK(s,e){return this.each((typeof e=="function"?kK:DK)(s,e))}function*zK(){for(var s=this._groups,e=0,t=s.length;e<t;++e)for(var n=s[e],i=0,a=n.length,o;i<a;++i)(o=n[i])&&(yield o)}var KF=[null];function xA(s,e){this._groups=s,this._parents=e}function GK(){return new xA([[document.documentElement]],KF)}function HK(){return this}xA.prototype=GK.prototype={constructor:xA,select:uZ,selectAll:AZ,selectChild:yZ,selectChildren:wZ,filter:SZ,data:RZ,enter:MZ,exit:NZ,join:FZ,merge:PZ,selection:HK,order:LZ,sort:UZ,call:DZ,nodes:kZ,node:VZ,size:zZ,empty:GZ,each:HZ,attr:jZ,style:eK,property:sK,classed:uK,text:fK,html:mK,raise:yK,lower:bK,append:SK,insert:EK,remove:TK,clone:IK,datum:NK,on:OK,dispatch:VK,[Symbol.iterator]:zK};var YY=null;function QK(s){return typeof s=="string"?new xA([[document.querySelector(s)]],[document.documentElement]):new xA([[s]],KF)}function WK(s){let e;for(;e=s.sourceEvent;)s=e;return s}function ZK(s,e){if(s=WK(s),e===void 0&&(e=s.currentTarget),e){var t=e.ownerSVGElement||e;if(t.createSVGPoint){var n=t.createSVGPoint();return n.x=s.clientX,n.y=s.clientY,n=n.matrixTransform(e.getScreenCTM().inverse()),[n.x,n.y]}if(e.getBoundingClientRect){var i=e.getBoundingClientRect();return[s.clientX-i.left-e.clientLeft,s.clientY-i.top-e.clientTop]}}return[s.pageX,s.pageY]}var xx,xc,$F,XF,P0,jF,YF,qF,JF,gE,mE,vE,eP,bx={},tP=[],KK=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,_x=Array.isArray;function xg(s,e){for(var t in e)s[t]=e[t];return s}function yE(s){s&&s.parentNode&&s.parentNode.removeChild(s)}function $K(s,e,t){var n,i,a,o={};for(a in e)a=="key"?n=e[a]:a=="ref"?i=e[a]:o[a]=e[a];if(arguments.length>2&&(o.children=arguments.length>3?xx.call(arguments,2):t),typeof s=="function"&&s.defaultProps!=null)for(a in s.defaultProps)o[a]===void 0&&(o[a]=s.defaultProps[a]);return wx(s,o,n,i,null)}function wx(s,e,t,n,i){var a={type:s,props:e,key:t,ref:n,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:i==null?++$F:i,__i:-1,__u:0};return i==null&&xc.vnode!=null&&xc.vnode(a),a}function qY(){return{current:null}}function Z_(s){return s.children}function K_(s,e){this.props=s,this.context=e}function Qv(s,e){if(e==null)return s.__?Qv(s.__,s.__i+1):null;for(var t;e<s.__k.length;e++)if((t=s.__k[e])!=null&&t.__e!=null)return t.__e;return typeof s.type=="function"?Qv(s):null}function nP(s){var e,t;if((s=s.__)!=null&&s.__c!=null){for(s.__e=s.__c.base=null,e=0;e<s.__k.length;e++)if((t=s.__k[e])!=null&&t.__e!=null){s.__e=s.__c.base=t.__e;break}return nP(s)}}function xE(s){(!s.__d&&(s.__d=!0)&&P0.push(s)&&!$_.__r++||jF!=xc.debounceRendering)&&((jF=xc.debounceRendering)||YF)($_)}function $_(){for(var s,e,t,n,i,a,o,u=1;P0.length;)P0.length>u&&P0.sort(qF),s=P0.shift(),u=P0.length,s.__d&&(t=void 0,n=void 0,i=(n=(e=s).__v).__e,a=[],o=[],e.__P&&((t=xg({},n)).__v=n.__v+1,xc.vnode&&xc.vnode(t),bE(e.__P,t,n,e.__n,e.__P.namespaceURI,32&n.__u?[i]:null,a,i==null?Qv(n):i,!!(32&n.__u),o),t.__v=n.__v,t.__.__k[t.__i]=t,oP(a,t,o),n.__e=n.__=null,t.__e!=i&&nP(t)));$_.__r=0}function rP(s,e,t,n,i,a,o,u,c,d,g){var v,M,B,I,ne,ee,q,ye=n&&n.__k||tP,Ce=e.length;for(c=XK(t,e,ye,c,Ce),v=0;v<Ce;v++)(B=t.__k[v])!=null&&(M=B.__i==-1?bx:ye[B.__i]||bx,B.__i=v,ee=bE(s,B,M,i,a,o,u,c,d,g),I=B.__e,B.ref&&M.ref!=B.ref&&(M.ref&&wE(M.ref,null,B),g.push(B.ref,B.__c||I,B)),ne==null&&I!=null&&(ne=I),(q=!!(4&B.__u))||M.__k===B.__k?c=iP(B,c,s,q):typeof B.type=="function"&&ee!==void 0?c=ee:I&&(c=I.nextSibling),B.__u&=-7);return t.__e=ne,c}function XK(s,e,t,n,i){var a,o,u,c,d,g=t.length,v=g,M=0;for(s.__k=new Array(i),a=0;a<i;a++)(o=e[a])!=null&&typeof o!="boolean"&&typeof o!="function"?(typeof o=="string"||typeof o=="number"||typeof o=="bigint"||o.constructor==String?o=s.__k[a]=wx(null,o,null,null,null):_x(o)?o=s.__k[a]=wx(Z_,{children:o},null,null,null):o.constructor==null&&o.__b>0?o=s.__k[a]=wx(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):s.__k[a]=o,c=a+M,o.__=s,o.__b=s.__b+1,u=null,(d=o.__i=YK(o,t,c,v))!=-1&&(v--,(u=t[d])&&(u.__u|=2)),u==null||u.__v==null?(d==-1&&(i>g?M--:i<g&&M++),typeof o.type!="function"&&(o.__u|=4)):d!=c&&(d==c-1?M--:d==c+1?M++:(d>c?M--:M++,o.__u|=4))):s.__k[a]=null;if(v)for(a=0;a<g;a++)(u=t[a])!=null&&!(2&u.__u)&&(u.__e==n&&(n=Qv(u)),uP(u,u));return n}function iP(s,e,t,n){var i,a;if(typeof s.type=="function"){for(i=s.__k,a=0;i&&a<i.length;a++)i[a]&&(i[a].__=s,e=iP(i[a],e,t,n));return e}s.__e!=e&&(n&&(e&&s.type&&!e.parentNode&&(e=Qv(s)),t.insertBefore(s.__e,e||null)),e=s.__e);do e=e&&e.nextSibling;while(e!=null&&e.nodeType==8);return e}function jK(s,e){return e=e||[],s==null||typeof s=="boolean"||(_x(s)?s.some(function(t){jK(t,e)}):e.push(s)),e}function YK(s,e,t,n){var i,a,o,u=s.key,c=s.type,d=e[t],g=d!=null&&(2&d.__u)==0;if(d===null&&u==null||g&&u==d.key&&c==d.type)return t;if(n>(g?1:0)){for(i=t-1,a=t+1;i>=0||a<e.length;)if((d=e[o=i>=0?i--:a++])!=null&&!(2&d.__u)&&u==d.key&&c==d.type)return o}return-1}function sP(s,e,t){e[0]=="-"?s.setProperty(e,t==null?"":t):s[e]=t==null?"":typeof t!="number"||KK.test(e)?t:t+"px"}function X_(s,e,t,n,i){var a,o;e:if(e=="style")if(typeof t=="string")s.style.cssText=t;else{if(typeof n=="string"&&(s.style.cssText=n=""),n)for(e in n)t&&e in t||sP(s.style,e,"");if(t)for(e in t)n&&t[e]==n[e]||sP(s.style,e,t[e])}else if(e[0]=="o"&&e[1]=="n")a=e!=(e=e.replace(JF,"$1")),o=e.toLowerCase(),e=o in s||e=="onFocusOut"||e=="onFocusIn"?o.slice(2):e.slice(2),s.l||(s.l={}),s.l[e+a]=t,t?n?t.u=n.u:(t.u=gE,s.addEventListener(e,a?vE:mE,a)):s.removeEventListener(e,a?vE:mE,a);else{if(i=="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 s)try{s[e]=t==null?"":t;break e}catch(u){}typeof t=="function"||(t==null||t===!1&&e[4]!="-"?s.removeAttribute(e):s.setAttribute(e,e=="popover"&&t==1?"":t))}}function aP(s){return function(e){if(this.l){var t=this.l[e.type+s];if(e.t==null)e.t=gE++;else if(e.t<t.u)return;return t(xc.event?xc.event(e):e)}}}function bE(s,e,t,n,i,a,o,u,c,d){var g,v,M,B,I,ne,ee,q,ye,Ce,ke,nt,Ye,ht,Rt,qe,pt,xn=e.type;if(e.constructor!=null)return null;128&t.__u&&(c=!!(32&t.__u),a=[u=e.__e=t.__e]),(g=xc.__b)&&g(e);e:if(typeof xn=="function")try{if(q=e.props,ye="prototype"in xn&&xn.prototype.render,Ce=(g=xn.contextType)&&n[g.__c],ke=g?Ce?Ce.props.value:g.__:n,t.__c?ee=(v=e.__c=t.__c).__=v.__E:(ye?e.__c=v=new xn(q,ke):(e.__c=v=new K_(q,ke),v.constructor=xn,v.render=JK),Ce&&Ce.sub(v),v.state||(v.state={}),v.__n=n,M=v.__d=!0,v.__h=[],v._sb=[]),ye&&v.__s==null&&(v.__s=v.state),ye&&xn.getDerivedStateFromProps!=null&&(v.__s==v.state&&(v.__s=xg({},v.__s)),xg(v.__s,xn.getDerivedStateFromProps(q,v.__s))),B=v.props,I=v.state,v.__v=e,M)ye&&xn.getDerivedStateFromProps==null&&v.componentWillMount!=null&&v.componentWillMount(),ye&&v.componentDidMount!=null&&v.__h.push(v.componentDidMount);else{if(ye&&xn.getDerivedStateFromProps==null&&q!==B&&v.componentWillReceiveProps!=null&&v.componentWillReceiveProps(q,ke),e.__v==t.__v||!v.__e&&v.shouldComponentUpdate!=null&&v.shouldComponentUpdate(q,v.__s,ke)===!1){for(e.__v!=t.__v&&(v.props=q,v.state=v.__s,v.__d=!1),e.__e=t.__e,e.__k=t.__k,e.__k.some(function(cr){cr&&(cr.__=e)}),nt=0;nt<v._sb.length;nt++)v.__h.push(v._sb[nt]);v._sb=[],v.__h.length&&o.push(v);break e}v.componentWillUpdate!=null&&v.componentWillUpdate(q,v.__s,ke),ye&&v.componentDidUpdate!=null&&v.__h.push(function(){v.componentDidUpdate(B,I,ne)})}if(v.context=ke,v.props=q,v.__P=s,v.__e=!1,Ye=xc.__r,ht=0,ye){for(v.state=v.__s,v.__d=!1,Ye&&Ye(e),g=v.render(v.props,v.state,v.context),Rt=0;Rt<v._sb.length;Rt++)v.__h.push(v._sb[Rt]);v._sb=[]}else do v.__d=!1,Ye&&Ye(e),g=v.render(v.props,v.state,v.context),v.state=v.__s;while(v.__d&&++ht<25);v.state=v.__s,v.getChildContext!=null&&(n=xg(xg({},n),v.getChildContext())),ye&&!M&&v.getSnapshotBeforeUpdate!=null&&(ne=v.getSnapshotBeforeUpdate(B,I)),qe=g,g!=null&&g.type===Z_&&g.key==null&&(qe=lP(g.props.children)),u=rP(s,_x(qe)?qe:[qe],e,t,n,i,a,o,u,c,d),v.base=e.__e,e.__u&=-161,v.__h.length&&o.push(v),ee&&(v.__E=v.__=null)}catch(cr){if(e.__v=null,c||a!=null)if(cr.then){for(e.__u|=c?160:128;u&&u.nodeType==8&&u.nextSibling;)u=u.nextSibling;a[a.indexOf(u)]=null,e.__e=u}else{for(pt=a.length;pt--;)yE(a[pt]);_E(e)}else e.__e=t.__e,e.__k=t.__k,cr.then||_E(e);xc.__e(cr,e,t)}else a==null&&e.__v==t.__v?(e.__k=t.__k,e.__e=t.__e):u=e.__e=qK(t.__e,e,t,n,i,a,o,c,d);return(g=xc.diffed)&&g(e),128&e.__u?void 0:u}function _E(s){s&&s.__c&&(s.__c.__e=!0),s&&s.__k&&s.__k.forEach(_E)}function oP(s,e,t){for(var n=0;n<t.length;n++)wE(t[n],t[++n],t[++n]);xc.__c&&xc.__c(e,s),s.some(function(i){try{s=i.__h,i.__h=[],s.some(function(a){a.call(i)})}catch(a){xc.__e(a,i.__v)}})}function lP(s){return typeof s!="object"||s==null||s.__b&&s.__b>0?s:_x(s)?s.map(lP):xg({},s)}function qK(s,e,t,n,i,a,o,u,c){var d,g,v,M,B,I,ne,ee=t.props||bx,q=e.props,ye=e.type;if(ye=="svg"?i="http://www.w3.org/2000/svg":ye=="math"?i="http://www.w3.org/1998/Math/MathML":i||(i="http://www.w3.org/1999/xhtml"),a!=null){for(d=0;d<a.length;d++)if((B=a[d])&&"setAttribute"in B==!!ye&&(ye?B.localName==ye:B.nodeType==3)){s=B,a[d]=null;break}}if(s==null){if(ye==null)return document.createTextNode(q);s=document.createElementNS(i,ye,q.is&&q),u&&(xc.__m&&xc.__m(e,a),u=!1),a=null}if(ye==null)ee===q||u&&s.data==q||(s.data=q);else{if(a=a&&xx.call(s.childNodes),!u&&a!=null)for(ee={},d=0;d<s.attributes.length;d++)ee[(B=s.attributes[d]).name]=B.value;for(d in ee)if(B=ee[d],d!="children"){if(d=="dangerouslySetInnerHTML")v=B;else if(!(d in q)){if(d=="value"&&"defaultValue"in q||d=="checked"&&"defaultChecked"in q)continue;X_(s,d,null,B,i)}}for(d in q)B=q[d],d=="children"?M=B:d=="dangerouslySetInnerHTML"?g=B:d=="value"?I=B:d=="checked"?ne=B:u&&typeof B!="function"||ee[d]===B||X_(s,d,B,ee[d],i);if(g)u||v&&(g.__html==v.__html||g.__html==s.innerHTML)||(s.innerHTML=g.__html),e.__k=[];else if(v&&(s.innerHTML=""),rP(e.type=="template"?s.content:s,_x(M)?M:[M],e,t,n,ye=="foreignObject"?"http://www.w3.org/1999/xhtml":i,a,o,a?a[0]:t.__k&&Qv(t,0),u,c),a!=null)for(d=a.length;d--;)yE(a[d]);u||(d="value",ye=="progress"&&I==null?s.removeAttribute("value"):I!=null&&(I!==s[d]||ye=="progress"&&!I||ye=="option"&&I!=ee[d])&&X_(s,d,I,ee[d],i),d="checked",ne!=null&&ne!=s[d]&&X_(s,d,ne,ee[d],i))}return s}function wE(s,e,t){try{if(typeof s=="function"){var n=typeof s.__u=="function";n&&s.__u(),n&&e==null||(s.__u=s(e))}else s.current=e}catch(i){xc.__e(i,t)}}function uP(s,e,t){var n,i;if(xc.unmount&&xc.unmount(s),(n=s.ref)&&(n.current&&n.current!=s.__e||wE(n,null,e)),(n=s.__c)!=null){if(n.componentWillUnmount)try{n.componentWillUnmount()}catch(a){xc.__e(a,e)}n.base=n.__P=null}if(n=s.__k)for(i=0;i<n.length;i++)n[i]&&uP(n[i],e,t||typeof s.type!="function");t||yE(s.__e),s.__c=s.__=s.__e=void 0}function JK(s,e,t){return this.constructor(s,t)}function cP(s,e,t){var n,i,a,o;e==document&&(e=document.documentElement),xc.__&&xc.__(s,e),i=(n=typeof t=="function")?null:t&&t.__k||e.__k,a=[],o=[],bE(e,s=(!n&&t||e).__k=$K(Z_,null,[s]),i||bx,bx,e.namespaceURI,!n&&t?[t]:i?null:e.firstChild?xx.call(e.childNodes):null,a,!n&&t?t:i?i.__e:e.firstChild,n,o),oP(a,s,o)}function e$(s,e){cP(s,e,e$)}function hP(s,e,t){var n,i,a,o,u=xg({},s.props);for(a in s.type&&s.type.defaultProps&&(o=s.type.defaultProps),e)a=="key"?n=e[a]:a=="ref"?i=e[a]:u[a]=e[a]===void 0&&o!=null?o[a]:e[a];return arguments.length>2&&(u.children=arguments.length>3?xx.call(arguments,2):t),wx(s.type,u,n||s.key,i||s.ref,null)}function JY(s){function e(t){var n,i;return this.getChildContext||(n=new Set,(i={})[e.__c]=this,this.getChildContext=function(){return i},this.componentWillUnmount=function(){n=null},this.shouldComponentUpdate=function(a){this.props.value!=a.value&&n.forEach(function(o){o.__e=!0,xE(o)})},this.sub=function(a){n.add(a);var o=a.componentWillUnmount;a.componentWillUnmount=function(){n&&n.delete(a),o&&o.call(a)}}),t.children}return e.__c="__cC"+eP++,e.__=s,e.Provider=e.__l=(e.Consumer=function(t,n){return t.children(n)}).contextType=e,e}xx=tP.slice,xc={__e:function(s,e,t,n){for(var i,a,o;e=e.__;)if((i=e.__c)&&!i.__)try{if((a=i.constructor)&&a.getDerivedStateFromError!=null&&(i.setState(a.getDerivedStateFromError(s)),o=i.__d),i.componentDidCatch!=null&&(i.componentDidCatch(s,n||{}),o=i.__d),o)return i.__E=i}catch(u){s=u}throw s}},$F=0,XF=function(s){return s!=null&&s.constructor==null},K_.prototype.setState=function(s,e){var t;t=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=xg({},this.state),typeof s=="function"&&(s=s(xg({},t),this.props)),s&&xg(t,s),s!=null&&this.__v&&(e&&this._sb.push(e),xE(this))},K_.prototype.forceUpdate=function(s){this.__v&&(this.__e=!0,s&&this.__h.push(s),xE(this))},K_.prototype.render=Z_,P0=[],YF=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,qF=function(s,e){return s.__v.__b-e.__v.__b},$_.__r=0,JF=/(PointerCapture)$|Capture$/i,gE=0,mE=aP(!1),vE=aP(!0),eP=0;function dP(s,e){(e==null||e>s.length)&&(e=s.length);for(var t=0,n=Array(e);t<e;t++)n[t]=s[t];return n}function t$(s){if(Array.isArray(s))return s}function n$(s,e,t){return(e=l$(e))in s?Object.defineProperty(s,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):s[e]=t,s}function r$(s,e){var t=s==null?null:typeof Symbol!="undefined"&&s[Symbol.iterator]||s["@@iterator"];if(t!=null){var n,i,a,o,u=[],c=!0,d=!1;try{if(a=(t=t.call(s)).next,e!==0)for(;!(c=(n=a.call(t)).done)&&(u.push(n.value),u.length!==e);c=!0);}catch(g){d=!0,i=g}finally{try{if(!c&&t.return!=null&&(o=t.return(),Object(o)!==o))return}finally{if(d)throw i}}return u}}function i$(){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 fP(s,e){var t=Object.keys(s);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(s);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(s,i).enumerable})),t.push.apply(t,n)}return t}function s$(s){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?fP(Object(t),!0).forEach(function(n){n$(s,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(s,Object.getOwnPropertyDescriptors(t)):fP(Object(t)).forEach(function(n){Object.defineProperty(s,n,Object.getOwnPropertyDescriptor(t,n))})}return s}function a$(s,e){return t$(s)||r$(s,e)||u$(s,e)||i$()}function o$(s,e){if(typeof s!="object"||!s)return s;var t=s[Symbol.toPrimitive];if(t!==void 0){var n=t.call(s,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(s)}function l$(s){var e=o$(s,"string");return typeof e=="symbol"?e:e+""}function j_(s){"@babel/helpers - typeof";return j_=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},j_(s)}function u$(s,e){if(s){if(typeof s=="string")return dP(s,e);var t={}.toString.call(s).slice(8,-1);return t==="Object"&&s.constructor&&(t=s.constructor.name),t==="Map"||t==="Set"?Array.from(s):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?dP(s,e):void 0}}var SE=function(e){if(j_(e)!=="object")return e;var t=hP(e);if(t.props){var n;t.props=s$({},t.props),t!=null&&(n=t.props)!==null&&n!==void 0&&n.children&&(t.props.children=Array.isArray(t.props.children)?t.props.children.map(SE):SE(t.props.children))}return t},c$=function(e){return XF(hP(e))},h$=function(e,t){delete t.__k,cP(SE(e),t)};function d$(s,e){e===void 0&&(e={});var t=e.insertAt;if(typeof document!="undefined"){var n=document.head||document.getElementsByTagName("head")[0],i=document.createElement("style");i.type="text/css",t==="top"&&n.firstChild?n.insertBefore(i,n.firstChild):n.appendChild(i),i.styleSheet?i.styleSheet.cssText=s:i.appendChild(document.createTextNode(s))}}var f$=`.float-tooltip-kap {
position: absolute;
width: max-content; /* prevent shrinking near right edge */
max-width: max(50%, 150px);
padding: 3px 5px;
border-radius: 3px;
font: 12px sans-serif;
color: #eee;
background: rgba(0,0,0,0.6);
pointer-events: none;
}
`;d$(f$);var A$=nb({props:{content:{default:!1},offsetX:{triggerUpdate:!1},offsetY:{triggerUpdate:!1}},init:function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},i=n.style,a=i===void 0?{}:i,o=!!e&&j_(e)==="object"&&!!e.node&&typeof e.node=="function",u=QK(o?e.node():e);u.style("position")==="static"&&u.style("position","relative"),t.tooltipEl=u.append("div").attr("class","float-tooltip-kap"),Object.entries(a).forEach(function(d){var g=a$(d,2),v=g[0],M=g[1];return t.tooltipEl.style(v,M)}),t.tooltipEl.style("left","-10000px").style("display","none");var c="tooltip-".concat(Math.round(Math.random()*1e12));t.mouseInside=!1,u.on("mousemove.".concat(c),function(d){t.mouseInside=!0;var g=ZK(d),v=u.node(),M=v.offsetWidth,B=v.offsetHeight,I=[t.offsetX===null||t.offsetX===void 0?"-".concat(g[0]/M*100,"%"):typeof t.offsetX=="number"?"calc(-50% + ".concat(t.offsetX,"px)"):t.offsetX,t.offsetY===null||t.offsetY===void 0?B>130&&B-g[1]<100?"calc(-100% - 6px)":"21px":typeof t.offsetY=="number"?t.offsetY<0?"calc(-100% - ".concat(Math.abs(t.offsetY),"px)"):"".concat(t.offsetY,"px"):t.offsetY];t.tooltipEl.style("left",g[0]+"px").style("top",g[1]+"px").style("transform","translate(".concat(I.join(","),")")),t.content&&t.tooltipEl.style("display","inline")}),u.on("mouseover.".concat(c),function(){t.mouseInside=!0,t.content&&t.tooltipEl.style("display","inline")}),u.on("mouseout.".concat(c),function(){t.mouseInside=!1,t.tooltipEl.style("display","none")})},update:function(e){e.tooltipEl.style("display",e.content&&e.mouseInside?"inline":"none"),e.content?e.content instanceof HTMLElement?(e.tooltipEl.text(""),e.tooltipEl.append(function(){return e.content})):typeof e.content=="string"?e.tooltipEl.html(e.content):c$(e.content)?(e.tooltipEl.text(""),h$(e.content,e.tooltipEl.node())):(e.tooltipEl.style("display","none"),console.warn("Tooltip content is invalid, skipping.",e.content,e.content.toString())):e.tooltipEl.text("")}});function p$(s,e){e===void 0&&(e={});var t=e.insertAt;if(typeof document!="undefined"){var n=document.head||document.getElementsByTagName("head")[0],i=document.createElement("style");i.type="text/css",t==="top"&&n.firstChild?n.insertBefore(i,n.firstChild):n.appendChild(i),i.styleSheet?i.styleSheet.cssText=s:i.appendChild(document.createTextNode(s))}}var g$=`.scene-nav-info {
position: absolute;
bottom: 5px;
width: 100%;
text-align: center;
color: slategrey;
opacity: 0.7;
font-size: 10px;
font-family: sans-serif;
pointer-events: none;
user-select: none;
}
.scene-container canvas:focus {
outline: none;
}`;p$(g$);function ME(s,e){(e==null||e>s.length)&&(e=s.length);for(var t=0,n=Array(e);t<e;t++)n[t]=s[t];return n}function m$(s){if(Array.isArray(s))return s}function v$(s){if(Array.isArray(s))return ME(s)}function y$(s,e,t){return(e=E$(e))in s?Object.defineProperty(s,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):s[e]=t,s}function x$(s){if(typeof Symbol!="undefined"&&s[Symbol.iterator]!=null||s["@@iterator"]!=null)return Array.from(s)}function b$(s,e){var t=s==null?null:typeof Symbol!="undefined"&&s[Symbol.iterator]||s["@@iterator"];if(t!=null){var n,i,a,o,u=[],c=!0,d=!1;try{if(a=(t=t.call(s)).next,e!==0)for(;!(c=(n=a.call(t)).done)&&(u.push(n.value),u.length!==e);c=!0);}catch(g){d=!0,i=g}finally{try{if(!c&&t.return!=null&&(o=t.return(),Object(o)!==o))return}finally{if(d)throw i}}return u}}function _$(){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 w$(){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 S$(s,e){return m$(s)||b$(s,e)||AP(s,e)||_$()}function L0(s){return v$(s)||x$(s)||AP(s)||w$()}function M$(s,e){if(typeof s!="object"||!s)return s;var t=s[Symbol.toPrimitive];if(t!==void 0){var n=t.call(s,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(s)}function E$(s){var e=M$(s,"string");return typeof e=="symbol"?e:e+""}function AP(s,e){if(s){if(typeof s=="string")return ME(s,e);var t={}.toString.call(s).slice(8,-1);return t==="Object"&&s.constructor&&(t=s.constructor.name),t==="Map"||t==="Set"?Array.from(s):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?ME(s,e):void 0}}var bc=window.THREE?window.THREE:{WebGLRenderer:K3,Scene:_d,PerspectiveCamera:vo,Raycaster:bw,SRGBColorSpace:sl,TextureLoader:rw,Vector2:ce,Vector3:le,Box3:Y,Color:Wr,Mesh:Il,SphereGeometry:sd,MeshBasicMaterial:Yl,BackSide:de,Clock:pp},pP=nb({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(o){return o.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 i=this.intersectingObjects(e.pointerPos.x,e.pointerPos.y);e.hoverOrderComparator&&i.sort(function(o,u){return e.hoverOrderComparator(o.object,u.object)});var a=i.find(function(o){return e.hoverFilter(o.object)})||null;n=a?a.object:null,e.intersection=a||null}n!==e.hoverObj&&(e.onHover(n,e.hoverObj,e.intersection),e.tooltip.content(n&&ul(e.tooltipContent)(n,e.intersection)||null),e.hoverObj=n)}e.tweenGroup.update()}return this},getPointerPos:function(e){var t=e.pointerPos,n=t.x,i=t.y;return{x:n,y:i}},cameraPosition:function(e,t,n,i){var a=e.camera;if(t&&e.initialised){var o=t,u=n||{x:0,y:0,z:0};if(!i)g(o),v(u);else{var c=Object.assign({},a.position),d=M();e.tweenGroup.add(new fE(c).to(o,i).easing(Zm.Quadratic.Out).onUpdate(g).start()),e.tweenGroup.add(new fE(d).to(u,i/3).easing(Zm.Quadratic.Out).onUpdate(v).start())}return this}return Object.assign({},a.position,{lookAt:M()});function g(B){var I=B.x,ne=B.y,ee=B.z;I!==void 0&&(a.position.x=I),ne!==void 0&&(a.position.y=ne),ee!==void 0&&(a.position.z=ee)}function v(B){var I=new bc.Vector3(B.x,B.y,B.z);e.controls.enabled&&e.controls.target?e.controls.target=I:a.lookAt(I)}function M(){return Object.assign(new bc.Vector3(0,0,-1e3).applyQuaternion(a.quaternion).add(a.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,i=arguments.length,a=new Array(i>3?i-3:0),o=3;o<i;o++)a[o-3]=arguments[o];return this.fitToBbox(this.getBbox.apply(this,a),t,n)},fitToBbox:function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:10,a=e.camera;if(t){var o=new bc.Vector3(0,0,0),u=Math.max.apply(Math,L0(Object.entries(t).map(function(B){var I=S$(B,2),ne=I[0],ee=I[1];return Math.max.apply(Math,L0(ee.map(function(q){return Math.abs(o[ne]-q)})))})))*2,c=(1-i*2/e.height)*a.fov,d=u/Math.atan(c*Math.PI/180),g=d/a.aspect,v=Math.max(d,g);if(v>0){var M=o.clone().sub(a.position).normalize().multiplyScalar(-v);this.cameraPosition(M,o,n)}}return this},getBbox:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:function(){return!0},n=new bc.Box3(new bc.Vector3(0,0,0),new bc.Vector3(0,0,0)),i=e.objects.filter(t);return i.length?(i.forEach(function(a){return n.expandByObject(a)}),Object.assign.apply(Object,L0(["x","y","z"].map(function(a){return y$({},a,[n.min[a],n.max[a]])})))):null},getScreenCoords:function(e,t,n,i){var a=new bc.Vector3(t,n,i);return a.project(this.camera()),{x:(a.x+1)*e.width/2,y:-(a.y-1)*e.height/2}},getSceneCoords:function(e,t,n){var i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,a=new bc.Vector2(t/e.width*2-1,-(n/e.height)*2+1),o=new bc.Raycaster;return o.setFromCamera(a,e.camera),Object.assign({},o.ray.at(i,new bc.Vector3))},intersectingObjects:function(e,t,n){var i=new bc.Vector2(t/e.width*2-1,-(n/e.height)*2+1),a=new bc.Raycaster;return a.params.Line.threshold=e.lineHoverPrecision,a.params.Points.threshold=e.pointsHoverPrecision,a.setFromCamera(i,e.camera),a.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 bc.Scene,camera:new bc.PerspectiveCamera,clock:new bc.Clock,tweenGroup:new cE,lastRaycasterCheck:0}},init:function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},i=n.controlType,a=i===void 0?"trackball":i,o=n.useWebGPU,u=o===void 0?!1:o,c=n.rendererConfig,d=c===void 0?{}:c,g=n.extraRenderers,v=g===void 0?[]:g,M=n.waitForLoadComplete,B=M===void 0?!0:M;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"}[a]||"",t.navInfo.style.display=t.showNavInfo?null:"none",t.tooltip=new A$(t.container),t.pointerPos=new bc.Vector2,t.pointerPos.x=-2,t.pointerPos.y=-2,["pointermove","pointerdown"].forEach(function(I){return t.container.addEventListener(I,function(ne){if(I==="pointerdown"&&(t.isPointerPressed=!0),!t.isPointerDragging&&ne.type==="pointermove"&&(ne.pressure>0||t.isPointerPressed)&&(ne.pointerType==="mouse"||ne.movementX===void 0||[ne.movementX,ne.movementY].some(function(ye){return Math.abs(ye)>1}))&&(t.isPointerDragging=!0),t.enablePointerInteraction){var ee=q(t.container);t.pointerPos.x=ne.pageX-ee.left,t.pointerPos.y=ne.pageY-ee.top}function q(ye){var Ce=ye.getBoundingClientRect(),ke=window.pageXOffset||document.documentElement.scrollLeft,nt=window.pageYOffset||document.documentElement.scrollTop;return{top:Ce.top+nt,left:Ce.left+ke}}},{passive:!0})}),t.container.addEventListener("pointerup",function(I){t.isPointerPressed&&(t.isPointerPressed=!1,!(t.isPointerDragging&&(t.isPointerDragging=!1,!t.clickAfterDrag))&&requestAnimationFrame(function(){I.button===0&&t.onClick(t.hoverObj||null,I,t.intersection),I.button===2&&t.onRightClick&&t.onRightClick(t.hoverObj||null,I,t.intersection)}))},{passive:!0,capture:!0}),t.container.addEventListener("contextmenu",function(I){t.onRightClick&&I.preventDefault()}),t.renderer=new(u?NW:bc.WebGLRenderer)(Object.assign({antialias:!0,alpha:!0},d)),t.renderer.setPixelRatio(Math.min(2,window.devicePixelRatio)),t.container.appendChild(t.renderer.domElement),t.extraRenderers=v,t.extraRenderers.forEach(function(I){I.domElement.style.position="absolute",I.domElement.style.top="0px",I.domElement.style.pointerEvents="none",t.container.appendChild(I.domElement)}),t.postProcessingComposer=new C9(t.renderer),t.postProcessingComposer.addPass(new T9(t.scene,t.camera)),t.controls=new{trackball:UW,orbit:qW,fly:d9}[a](t.camera,t.renderer.domElement),a==="fly"&&(t.controls.movementSpeed=300,t.controls.rollSpeed=Math.PI/6,t.controls.dragToLook=!0),(a==="trackball"||a==="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(L0(t.extraRenderers)).forEach(function(I){return I.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 bc.Mesh),t.skysphere.visible=!1,t.loadComplete=t.scene.visible=!B,window.scene=t.scene},update:function(e,t){if(e.width&&e.height&&(t.hasOwnProperty("width")||t.hasOwnProperty("height"))){var n,i=e.width,a=e.height;e.container.style.width="".concat(i,"px"),e.container.style.height="".concat(a,"px"),[e.renderer,e.postProcessingComposer].concat(L0(e.extraRenderers)).forEach(function(B){return B.setSize(i,a)}),e.camera.aspect=i/a;var o=e.viewOffset.slice(0,2);o.some(function(B){return B})&&(n=e.camera).setViewOffset.apply(n,[i,a].concat(L0(o),[i,a])),e.camera.updateProjectionMatrix()}if(t.hasOwnProperty("viewOffset")){var u,c=e.width,d=e.height,g=e.viewOffset.slice(0,2);g.some(function(B){return B})?(u=e.camera).setViewOffset.apply(u,[c,d].concat(L0(g),[c,d])):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 bc.SphereGeometry(e.skyRadius)),t.hasOwnProperty("backgroundColor")){var v=sm(e.backgroundColor).alpha;v===void 0&&(v=1),e.renderer.setClearColor(new bc.Color(z7(1,e.backgroundColor)),v)}t.hasOwnProperty("backgroundImageUrl")&&(e.backgroundImageUrl?new bc.TextureLoader().load(e.backgroundImageUrl,function(B){B.colorSpace=bc.SRGBColorSpace,e.skysphere.material=new bc.MeshBasicMaterial({map:B,side:bc.BackSide}),e.skysphere.visible=!0,e.onBackgroundImageLoaded&&setTimeout(e.onBackgroundImageLoaded),!e.loadComplete&&M()}):(e.skysphere.visible=!1,e.skysphere.material.map=null,!e.loadComplete&&M())),t.hasOwnProperty("showNavInfo")&&(e.navInfo.style.display=e.showNavInfo?null:"none"),t.hasOwnProperty("lights")&&((t.lights||[]).forEach(function(B){return e.scene.remove(B)}),e.lights.forEach(function(B){return e.scene.add(B)})),t.hasOwnProperty("objects")&&((t.objects||[]).forEach(function(B){return e.scene.remove(B)}),e.objects.forEach(function(B){return e.scene.add(B)}));function M(){e.loadComplete=e.scene.visible=!0}}});function C$(s,e){e===void 0&&(e={});var t=e.insertAt;if(typeof document!="undefined"){var n=document.head||document.getElementsByTagName("head")[0],i=document.createElement("style");i.type="text/css",t==="top"&&n.firstChild?n.insertBefore(i,n.firstChild):n.appendChild(i),i.styleSheet?i.styleSheet.cssText=s:i.appendChild(document.createTextNode(s))}}var T$=`.graph-info-msg {
top: 50%;
width: 100%;
text-align: center;
color: lavender;
opacity: 0.7;
font-size: 22px;
position: absolute;
font-family: Sans-serif;
}
.scene-container .clickable {
cursor: pointer;
}
.scene-container .grabbable {
cursor: move;
cursor: grab;
cursor: -moz-grab;
cursor: -webkit-grab;
}
.scene-container .grabbable:active {
cursor: grabbing;
cursor: -moz-grabbing;
cursor: -webkit-grabbing;
}`;C$(T$);function EE(s,e){(e==null||e>s.length)&&(e=s.length);for(var t=0,n=Array(e);t<e;t++)n[t]=s[t];return n}function B$(s){if(Array.isArray(s))return EE(s)}function Sx(s,e,t){return(e=F$(e))in s?Object.defineProperty(s,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):s[e]=t,s}function R$(s){if(typeof Symbol!="undefined"&&s[Symbol.iterator]!=null||s["@@iterator"]!=null)return Array.from(s)}function I$(){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 gP(s,e){var t=Object.keys(s);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(s);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(s,i).enumerable})),t.push.apply(t,n)}return t}function Y_(s){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?gP(Object(t),!0).forEach(function(n){Sx(s,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(s,Object.getOwnPropertyDescriptors(t)):gP(Object(t)).forEach(function(n){Object.defineProperty(s,n,Object.getOwnPropertyDescriptor(t,n))})}return s}function q_(s){return B$(s)||R$(s)||P$(s)||I$()}function N$(s,e){if(typeof s!="object"||!s)return s;var t=s[Symbol.toPrimitive];if(t!==void 0){var n=t.call(s,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(s)}function F$(s){var e=N$(s,"string");return typeof e=="symbol"?e:e+""}function P$(s,e){if(s){if(typeof s=="string")return EE(s,e);var t={}.toString.call(s).slice(8,-1);return t==="Object"&&s.constructor&&(t=s.constructor.name),t==="Map"||t==="Set"?Array.from(s):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?EE(s,e):void 0}}function mP(s,e){var t=new e;return t._destructor&&t._destructor(),{linkProp:function(i){return{default:t[i](),onChange:function(o,u){u[s][i](o)},triggerUpdate:!1}},linkMethod:function(i){return function(a){for(var o=a[s],u=arguments.length,c=new Array(u>1?u-1:0),d=1;d<u;d++)c[d-1]=arguments[d];var g=o[i].apply(o,c);return g===o?this:g}}}}var CE=window.THREE?window.THREE:{AmbientLight:X0,DirectionalLight:t0,REVISION:m},L$=170,vP=mP("forceGraph",xC),U$=Object.assign.apply(Object,q_(["jsonUrl","graphData","numDimensions","dagMode","dagLevelDistance","dagNodeFilter","onDagError","nodeRelSize","nodeId","nodeVal","nodeResolution","nodeColor","nodeAutoColorBy","nodeOpacity","nodeVisibility","nodeThreeObject","nodeThreeObjectExtend","nodePositionUpdate","linkSource","linkTarget","linkVisibility","linkColor","linkAutoColorBy","linkOpacity","linkWidth","linkResolution","linkCurvature","linkCurveRotation","linkMaterial","linkThreeObject","linkThreeObjectExtend","linkPositionUpdate","linkDirectionalArrowLength","linkDirectionalArrowColor","linkDirectionalArrowRelPos","linkDirectionalArrowResolution","linkDirectionalParticles","linkDirectionalParticleSpeed","linkDirectionalParticleOffset","linkDirectionalParticleWidth","linkDirectionalParticleColor","linkDirectionalParticleResolution","linkDirectionalParticleThreeObject","forceEngine","d3AlphaDecay","d3VelocityDecay","d3AlphaMin","ngraphPhysics","warmupTicks","cooldownTicks","cooldownTime","onEngineTick","onEngineStop"].map(function(s){return Sx({},s,vP.linkProp(s))}))),O$=Object.assign.apply(Object,q_(["refresh","getGraphBbox","d3Force","d3ReheatSimulation","emitParticle"].map(function(s){return Sx({},s,vP.linkMethod(s))}))),J_=mP("renderObjs",pP),D$=Object.assign.apply(Object,q_(["width","height","backgroundColor","showNavInfo","enablePointerInteraction"].map(function(s){return Sx({},s,J_.linkProp(s))}))),k$=Object.assign.apply(Object,q_(["lights","cameraPosition","postProcessingComposer"].map(function(s){return Sx({},s,J_.linkMethod(s))})).concat([{graph2ScreenCoords:J_.linkMethod("getScreenCoords"),screen2GraphCoords:J_.linkMethod("getSceneCoords")}])),V$=nb({props:Y_(Y_({nodeLabel:{default:"name",triggerUpdate:!1},linkLabel:{default:"name",triggerUpdate:!1},linkHoverPrecision:{default:1,onChange:function(e,t){return t.renderObjs.lineHoverPrecision(e)},triggerUpdate:!1},enableNavigationControls:{default:!0,onChange:function(e,t){var n=t.renderObjs.controls();n&&(n.enabled=e,e&&n.domElement&&n.domElement.dispatchEvent(new PointerEvent("pointerup")))},triggerUpdate:!1},enableNodeDrag:{default:!0,triggerUpdate:!1},onNodeDrag:{default:function(){},triggerUpdate:!1},onNodeDragEnd:{default:function(){},triggerUpdate:!1},onNodeClick:{triggerUpdate:!1},onNodeRightClick:{triggerUpdate:!1},onNodeHover:{triggerUpdate:!1},onLinkClick:{triggerUpdate:!1},onLinkRightClick:{triggerUpdate:!1},onLinkHover:{triggerUpdate:!1},onBackgroundClick:{triggerUpdate:!1},onBackgroundRightClick:{triggerUpdate:!1},showPointerCursor:{default:!0,triggerUpdate:!1}},U$),D$),methods:Y_(Y_({zoomToFit:function(e,t,n){for(var i,a=arguments.length,o=new Array(a>3?a-3:0),u=3;u<a;u++)o[u-3]=arguments[u];return e.renderObjs.fitToBbox((i=e.forceGraph).getGraphBbox.apply(i,o),t,n),this},pauseAnimation:function(e){return e.animationFrameRequestId!==null&&(cancelAnimationFrame(e.animationFrameRequestId),e.animationFrameRequestId=null),this},resumeAnimation:function(e){return e.animationFrameRequestId===null&&this._animationCycle(),this},_animationCycle:function(e){e.enablePointerInteraction&&(this.renderer().domElement.style.cursor=null),e.forceGraph.tickFrame(),e.renderObjs.tick(),e.animationFrameRequestId=requestAnimationFrame(this._animationCycle)},scene:function(e){return e.renderObjs.scene()},camera:function(e){return e.renderObjs.camera()},renderer:function(e){return e.renderObjs.renderer()},controls:function(e){return e.renderObjs.controls()},tbControls:function(e){return e.renderObjs.tbControls()},_destructor:function(){this.pauseAnimation(),this.graphData({nodes:[],links:[]})}},O$),k$),stateInit:function(e){var t=e.controlType,n=e.rendererConfig,i=e.extraRenderers,a=new xC;return{forceGraph:a,renderObjs:pP({controlType:t,rendererConfig:n,extraRenderers:i}).objects([a]).lights([new CE.AmbientLight(13421772,Math.PI),new CE.DirectionalLight(16777215,.6*Math.PI)])}},init:function(e,t){e.innerHTML="",e.appendChild(t.container=document.createElement("div")),t.container.style.position="relative";var n=document.createElement("div");t.container.appendChild(n),t.renderObjs(n);var i=t.renderObjs.camera(),a=t.renderObjs.renderer(),o=t.renderObjs.controls();o.enabled=!!t.enableNavigationControls,t.lastSetCameraZ=i.position.z;var u;t.container.appendChild(u=document.createElement("div")),u.className="graph-info-msg",u.textContent="",t.forceGraph.onLoading(function(){u.textContent="Loading..."}).onFinishLoading(function(){u.textContent=""}).onUpdate(function(){t.graphData=t.forceGraph.graphData(),i.position.x===0&&i.position.y===0&&i.position.z===t.lastSetCameraZ&&t.graphData.nodes.length&&(i.lookAt(t.forceGraph.position),t.lastSetCameraZ=i.position.z=Math.cbrt(t.graphData.nodes.length)*L$)}).onFinishUpdate(function(){if(t._dragControls){var c=t.graphData.nodes.find(function(g){return g.__initialFixedPos&&!g.__disposeControlsAfterDrag});c?c.__disposeControlsAfterDrag=!0:t._dragControls.dispose(),t._dragControls=void 0}if(t.enableNodeDrag&&t.enablePointerInteraction&&t.forceEngine==="d3"){var d=t._dragControls=new Vn(t.graphData.nodes.map(function(g){return g.__threeObj}).filter(function(g){return g}),i,a.domElement);d.addEventListener("dragstart",function(g){var v=am(g.object);if(v){o.enabled=!1,g.object.__initialPos=g.object.position.clone(),g.object.__prevPos=g.object.position.clone();var M=v.__data;!M.__initialFixedPos&&(M.__initialFixedPos={fx:M.fx,fy:M.fy,fz:M.fz}),!M.__initialPos&&(M.__initialPos={x:M.x,y:M.y,z:M.z}),["x","y","z"].forEach(function(B){return M["f".concat(B)]=M[B]}),a.domElement.classList.add("grabbable")}}),d.addEventListener("drag",function(g){var v=am(g.object);if(v){if(!g.object.hasOwnProperty("__graphObjType")){var M=g.object.__initialPos,B=g.object.__prevPos,I=g.object.position;v.position.add(I.clone().sub(B)),B.copy(I),I.copy(M)}var ne=v.__data,ee=v.position,q={x:ee.x-ne.x,y:ee.y-ne.y,z:ee.z-ne.z};["x","y","z"].forEach(function(ye){return ne["f".concat(ye)]=ne[ye]=ee[ye]}),t.forceGraph.d3AlphaTarget(.3).resetCountdown(),ne.__dragged=!0,t.onNodeDrag(ne,q)}}),d.addEventListener("dragend",function(g){var v=am(g.object);if(v){delete g.object.__initialPos,delete g.object.__prevPos;var M=v.__data;M.__disposeControlsAfterDrag&&(d.dispose(),delete M.__disposeControlsAfterDrag);var B=M.__initialFixedPos,I=M.__initialPos,ne={x:I.x-M.x,y:I.y-M.y,z:I.z-M.z};if(B&&(["x","y","z"].forEach(function(q){var ye="f".concat(q);B[ye]===void 0&&delete M[ye]}),delete M.__initialFixedPos,delete M.__initialPos,M.__dragged&&(delete M.__dragged,t.onNodeDragEnd(M,ne))),t.forceGraph.d3AlphaTarget(0).resetCountdown(),t.enableNavigationControls){var ee;o.enabled=!0,o._status&&((ee=o._onPointerCancel)===null||ee===void 0||ee.call(o)),o.domElement&&o.domElement.ownerDocument&&o.domElement.ownerDocument.dispatchEvent(new PointerEvent("pointerup",{pointerType:"touch"}))}a.domElement.classList.remove("grabbable")}})}}),CE.REVISION<155&&(t.renderObjs.renderer().useLegacyLights=!1),t.renderObjs.hoverOrderComparator(function(c,d){var g=am(c);if(!g)return 1;var v=am(d);if(!v)return-1;var M=function(I){return I.__graphObjType==="node"};return M(v)-M(g)}).tooltipContent(function(c){var d=am(c);return d&&ul(t["".concat(d.__graphObjType,"Label")])(d.__data)||""}).hoverDuringDrag(!1).onHover(function(c){var d=am(c);if(d!==t.hoverObj){var g=t.hoverObj?t.hoverObj.__graphObjType:null,v=t.hoverObj?t.hoverObj.__data:null,M=d?d.__graphObjType:null,B=d?d.__data:null;if(g&&g!==M){var I=t["on".concat(g==="node"?"Node":"Link","Hover")];I&&I(null,v)}if(M){var ne=t["on".concat(M==="node"?"Node":"Link","Hover")];ne&&ne(B,g===M?v:null)}a.domElement.classList[(d&&t["on".concat(M==="node"?"Node":"Link","Click")]||!d&&t.onBackgroundClick)&&ul(t.showPointerCursor)(B)?"add":"remove"]("clickable"),t.hoverObj=d}}).clickAfterDrag(!1).onClick(function(c,d){var g=am(c);if(g){var v=t["on".concat(g.__graphObjType==="node"?"Node":"Link","Click")];v&&v(g.__data,d)}else t.onBackgroundClick&&t.onBackgroundClick(d)}).onRightClick(function(c,d){var g=am(c);if(g){var v=t["on".concat(g.__graphObjType==="node"?"Node":"Link","RightClick")];v&&v(g.__data,d)}else t.onBackgroundRightClick&&t.onBackgroundRightClick(d)}),this._animationCycle()}});function am(s){for(var e=s;e&&!e.hasOwnProperty("__graphObjType");)e=e.parent;return e}},22214:function(Be,Me,b){"use strict";b.d(Me,{Z:function(){return N}});var m=b(58289),Z=b(75538),V=b(85458);function N(E,F,C){return F=(0,m.Z)(F),(0,V.Z)(E,(0,Z.Z)()?Reflect.construct(F,C||[],(0,m.Z)(E).constructor):F.apply(E,C))}},19251:function(Be,Me,b){"use strict";b.d(Me,{Z:function(){return Z}});var m=b(3208);function Z(V,N){var E=typeof Symbol!="undefined"&&V[Symbol.iterator]||V["@@iterator"];if(!E){if(Array.isArray(V)||(E=(0,m.Z)(V))||N&&V&&typeof V.length=="number"){E&&(V=E);var F=0,C=function(){};return{s:C,n:function(){return F>=V.length?{done:!0}:{done:!1,value:V[F++]}},e:function(j){throw j},f:C}}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 P,H=!0,D=!1;return{s:function(){E=E.call(V)},n:function(){var j=E.next();return H=j.done,j},e:function(j){D=!0,P=j},f:function(){try{H||E.return==null||E.return()}finally{if(D)throw P}}}}},69168:function(Be,Me,b){"use strict";b.d(Me,{Z:function(){return Z}});var m=b(18773);function Z(V,N){V.prototype=Object.create(N.prototype),V.prototype.constructor=V,(0,m.Z)(V,N)}},34907:function(Be,Me,b){"use strict";b.d(Me,{Z:function(){return N}});var m=b(58289);function Z(E,F){for(;!{}.hasOwnProperty.call(E,F)&&(E=(0,m.Z)(E))!==null;);return E}function V(){return V=typeof Reflect!="undefined"&&Reflect.get?Reflect.get.bind():function(E,F,C){var P=Z(E,F);if(P){var H=Object.getOwnPropertyDescriptor(P,F);return H.get?H.get.call(arguments.length<3?E:C):H.value}},V.apply(null,arguments)}function N(E,F,C,P){var H=V((0,m.Z)(1&P?E.prototype:E),F,C);return 2&P&&typeof H=="function"?function(D){return H.apply(C,D)}:H}},16094:function(Be,Me){"use strict";var b={value:()=>{}};function m(){for(var F=0,C=arguments.length,P={},H;F<C;++F){if(!(H=arguments[F]+"")||H in P||/[\s.]/.test(H))throw new Error("illegal type: "+H);P[H]=[]}return new Z(P)}function Z(F){this._=F}function V(F,C){return F.trim().split(/^|\s+/).map(function(P){var H="",D=P.indexOf(".");if(D>=0&&(H=P.slice(D+1),P=P.slice(0,D)),P&&!C.hasOwnProperty(P))throw new Error("unknown type: "+P);return{type:P,name:H}})}Z.prototype=m.prototype={constructor:Z,on:function(F,C){var P=this._,H=V(F+"",P),D,X=-1,j=H.length;if(arguments.length<2){for(;++X<j;)if((D=(F=H[X]).type)&&(D=N(P[D],F.name)))return D;return}if(C!=null&&typeof C!="function")throw new Error("invalid callback: "+C);for(;++X<j;)if(D=(F=H[X]).type)P[D]=E(P[D],F.name,C);else if(C==null)for(D in P)P[D]=E(P[D],F.name,null);return this},copy:function(){var F={},C=this._;for(var P in C)F[P]=C[P].slice();return new Z(F)},call:function(F,C){if((D=arguments.length-2)>0)for(var P=new Array(D),H=0,D,X;H<D;++H)P[H]=arguments[H+2];if(!this._.hasOwnProperty(F))throw new Error("unknown type: "+F);for(X=this._[F],H=0,D=X.length;H<D;++H)X[H].value.apply(C,P)},apply:function(F,C,P){if(!this._.hasOwnProperty(F))throw new Error("unknown type: "+F);for(var H=this._[F],D=0,X=H.length;D<X;++D)H[D].value.apply(C,P)}};function N(F,C){for(var P=0,H=F.length,D;P<H;++P)if((D=F[P]).name===C)return D.value}function E(F,C,P){for(var H=0,D=F.length;H<D;++H)if(F[H].name===C){F[H]=b,F=F.slice(0,H).concat(F.slice(H+1));break}return P!=null&&F.push({name:C,value:P}),F}Me.Z=m},48335:function(Be,Me,b){"use strict";b.d(Me,{Sc:function(){return Bn},y3:function(){return D}});var m=b(63648);const Z=m.XA,V=m.a_,N=m.yQ,E=m.Hs,F=m.Ec,C=m.dx,P=m.LU,H=m.Rm,D=m.y3,X=m.qK,j=m.pb,de=m.j,he=m.sO,we=m.BZ,ve=m.EK,Ee=m.Db,$e=m.Fx,Fe=m.tU,ct=m.Ym,vt=m.rs,at=m.QR,kt=m.TB,It=m.oH,Bn=m.Sc,Lt=m.BN,Wn=m.it,Xn=m.$r,In=m.QM,zn=m.AV;var dr=(m.y3,m.y3);const vn=m.GH,_r=m.SO,Ge=m.uZ,Tt=m.yU,On=m.F1,Vr=m.re},96262:function(Be,Me,b){"use strict";b.d(Me,{Ud:function(){return he},Yy:function(){return V}});const m=Symbol("Comlink.proxy"),Z=Symbol("Comlink.endpoint"),V=Symbol("Comlink.releaseProxy"),N=Symbol("Comlink.finalizer"),E=Symbol("Comlink.thrown"),F=vn=>typeof vn=="object"&&vn!==null||typeof vn=="function",C={canHandle:vn=>F(vn)&&vn[m],serialize(vn){const{port1:_r,port2:Ge}=new MessageChannel;return X(vn,_r),[Ge,[Ge]]},deserialize(vn){return vn.start(),he(vn)}},P={canHandle:vn=>F(vn)&&E in vn,serialize({value:vn}){let _r;return vn instanceof Error?_r={isError:!0,value:{message:vn.message,name:vn.name,stack:vn.stack}}:_r={isError:!1,value:vn},[_r,[]]},deserialize(vn){throw vn.isError?Object.assign(new Error(vn.value.message),vn.value):vn.value}},H=new Map([["proxy",C],["throw",P]]);function D(vn,_r){for(const Ge of vn)if(_r===Ge||Ge==="*"||Ge instanceof RegExp&&Ge.test(_r))return!0;return!1}function X(vn,_r=globalThis,Ge=["*"]){_r.addEventListener("message",function Tt(On){if(!On||!On.data)return;if(!D(Ge,On.origin)){console.warn(`Invalid origin '${On.origin}' for comlink proxy`);return}const{id:Vr,type:en,path:ln}=Object.assign({path:[]},On.data),Cn=(On.data.argumentList||[]).map(In);let Mt;try{const Et=ln.slice(0,-1).reduce((Ae,Pe)=>Ae[Pe],vn),pe=ln.reduce((Ae,Pe)=>Ae[Pe],vn);switch(en){case"GET":Mt=pe;break;case"SET":Et[ln.slice(-1)[0]]=In(On.data.value),Mt=!0;break;case"APPLY":Mt=pe.apply(Et,Cn);break;case"CONSTRUCT":{const Ae=new pe(...Cn);Mt=Lt(Ae)}break;case"ENDPOINT":{const{port1:Ae,port2:Pe}=new MessageChannel;X(vn,Pe),Mt=Bn(Ae,[Ae])}break;case"RELEASE":Mt=void 0;break;default:return}}catch(Et){Mt={value:Et,[E]:0}}Promise.resolve(Mt).catch(Et=>({value:Et,[E]:0})).then(Et=>{const[pe,Ae]=Xn(Et);_r.postMessage(Object.assign(Object.assign({},pe),{id:Vr}),Ae),en==="RELEASE"&&(_r.removeEventListener("message",Tt),de(_r),N in vn&&typeof vn[N]=="function"&&vn[N]())}).catch(Et=>{const[pe,Ae]=Xn({value:new TypeError("Unserializable return value"),[E]:0});_r.postMessage(Object.assign(Object.assign({},pe),{id:Vr}),Ae)})}),_r.start&&_r.start()}function j(vn){return vn.constructor.name==="MessagePort"}function de(vn){j(vn)&&vn.close()}function he(vn,_r){const Ge=new Map;return vn.addEventListener("message",function(On){const{data:Vr}=On;if(!Vr||!Vr.id)return;const en=Ge.get(Vr.id);if(en)try{en(Vr)}finally{Ge.delete(Vr.id)}}),vt(vn,Ge,[],_r)}function we(vn){if(vn)throw new Error("Proxy has been released and is not useable")}function ve(vn){return zn(vn,new Map,{type:"RELEASE"}).then(()=>{de(vn)})}const Ee=new WeakMap,$e="FinalizationRegistry"in globalThis&&new FinalizationRegistry(vn=>{const _r=(Ee.get(vn)||0)-1;Ee.set(vn,_r),_r===0&&ve(vn)});function Fe(vn,_r){const Ge=(Ee.get(_r)||0)+1;Ee.set(_r,Ge),$e&&$e.register(vn,_r,vn)}function ct(vn){$e&&$e.unregister(vn)}function vt(vn,_r,Ge=[],Tt=function(){}){let On=!1;const Vr=new Proxy(Tt,{get(en,ln){if(we(On),ln===V)return()=>{ct(Vr),ve(vn),_r.clear(),On=!0};if(ln==="then"){if(Ge.length===0)return{then:()=>Vr};const Cn=zn(vn,_r,{type:"GET",path:Ge.map(Mt=>Mt.toString())}).then(In);return Cn.then.bind(Cn)}return vt(vn,_r,[...Ge,ln])},set(en,ln,Cn){we(On);const[Mt,Et]=Xn(Cn);return zn(vn,_r,{type:"SET",path:[...Ge,ln].map(pe=>pe.toString()),value:Mt},Et).then(In)},apply(en,ln,Cn){we(On);const Mt=Ge[Ge.length-1];if(Mt===Z)return zn(vn,_r,{type:"ENDPOINT"}).then(In);if(Mt==="bind")return vt(vn,_r,Ge.slice(0,-1));const[Et,pe]=kt(Cn);return zn(vn,_r,{type:"APPLY",path:Ge.map(Ae=>Ae.toString()),argumentList:Et},pe).then(In)},construct(en,ln){we(On);const[Cn,Mt]=kt(ln);return zn(vn,_r,{type:"CONSTRUCT",path:Ge.map(Et=>Et.toString()),argumentList:Cn},Mt).then(In)}});return Fe(Vr,vn),Vr}function at(vn){return Array.prototype.concat.apply([],vn)}function kt(vn){const _r=vn.map(Xn);return[_r.map(Ge=>Ge[0]),at(_r.map(Ge=>Ge[1]))]}const It=new WeakMap;function Bn(vn,_r){return It.set(vn,_r),vn}function Lt(vn){return Object.assign(vn,{[m]:!0})}function Wn(vn,_r=globalThis,Ge="*"){return{postMessage:(Tt,On)=>vn.postMessage(Tt,Ge,On),addEventListener:_r.addEventListener.bind(_r),removeEventListener:_r.removeEventListener.bind(_r)}}function Xn(vn){for(const[_r,Ge]of H)if(Ge.canHandle(vn)){const[Tt,On]=Ge.serialize(vn);return[{type:"HANDLER",name:_r,value:Tt},On]}return[{type:"RAW",value:vn},It.get(vn)||[]]}function In(vn){switch(vn.type){case"HANDLER":return H.get(vn.name).deserialize(vn.value);case"RAW":return vn.value}}function zn(vn,_r,Ge,Tt){return new Promise(On=>{const Vr=dr();_r.set(Vr,On),vn.start&&vn.start(),vn.postMessage(Object.assign({id:Vr},Ge),Tt)})}function dr(){return new Array(4).fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-")}},14310:function(Be,Me,b){"use strict";b.d(Me,{H:function(){return V},Z:function(){return m}});function m(N){const E=+this._x.call(null,N);return Z(this.cover(E),E,N)}function Z(N,E,F){if(isNaN(E))return N;var C,P=N._root,H={data:F},D=N._x0,X=N._x1,j,de,he,we,ve;if(!P)return N._root=H,N;for(;P.length;)if((he=E>=(j=(D+X)/2))?D=j:X=j,C=P,!(P=P[we=+he]))return C[we]=H,N;if(de=+N._x.call(null,P.data),E===de)return H.next=P,C?C[we]=H:N._root=H,N;do C=C?C[we]=new Array(2):N._root=new Array(2),(he=E>=(j=(D+X)/2))?D=j:X=j;while((we=+he)==(ve=+(de>=j)));return C[ve]=P,C[we]=H,N}function V(N){Array.isArray(N)||(N=Array.from(N));const E=N.length,F=new Float64Array(E);let C=1/0,P=-1/0;for(let H=0,D;H<E;++H)isNaN(D=+this._x.call(null,N[H]))||(F[H]=D,D<C&&(C=D),D>P&&(P=D));if(C>P)return this;this.cover(C).cover(P);for(let H=0;H<E;++H)Z(this,F[H],N[H]);return this}},33662:function(Be,Me,b){"use strict";b.d(Me,{Z:function(){return j}});var m=b(14310),Z=b(63945),V=b(27002),N=b(44508),E=b(79150),F=b(45632),C=b(30108),P=b(90820),H=b(11706),D=b(78017),X=b(79387);function j(ve,Ee){var $e=new de(Ee==null?X.P:Ee,NaN,NaN);return ve==null?$e:$e.addAll(ve)}function de(ve,Ee,$e){this._x=ve,this._x0=Ee,this._x1=$e,this._root=void 0}function he(ve){for(var Ee={data:ve.data},$e=Ee;ve=ve.next;)$e=$e.next={data:ve.data};return Ee}var we=j.prototype=de.prototype;we.copy=function(){var ve=new de(this._x,this._x0,this._x1),Ee=this._root,$e,Fe;if(!Ee)return ve;if(!Ee.length)return ve._root=he(Ee),ve;for($e=[{source:Ee,target:ve._root=new Array(2)}];Ee=$e.pop();)for(var ct=0;ct<2;++ct)(Fe=Ee.source[ct])&&(Fe.length?$e.push({source:Fe,target:Ee.target[ct]=new Array(2)}):Ee.target[ct]=he(Fe));return ve},we.add=m.Z,we.addAll=m.H,we.cover=Z.Z,we.data=V.Z,we.extent=N.Z,we.find=E.Z,we.remove=F.Z,we.removeAll=F.x,we.root=C.Z,we.size=P.Z,we.visit=H.Z,we.visitAfter=D.Z,we.x=X.Z},63945:function(Be,Me,b){"use strict";b.d(Me,{Z:function(){return m}});function m(Z){if(isNaN(Z=+Z))return this;var V=this._x0,N=this._x1;if(isNaN(V))N=(V=Math.floor(Z))+1;else{for(var E=N-V||1,F=this._root,C,P;V>Z||Z>=N;)switch(P=+(Z<V),C=new Array(2),C[P]=F,F=C,E*=2,P){case 0:N=V+E;break;case 1:V=N-E;break}this._root&&this._root.length&&(this._root=F)}return this._x0=V,this._x1=N,this}},27002:function(Be,Me,b){"use strict";b.d(Me,{Z:function(){return m}});function m(){var Z=[];return this.visit(function(V){if(!V.length)do Z.push(V.data);while(V=V.next)}),Z}},44508:function(Be,Me,b){"use strict";b.d(Me,{Z:function(){return m}});function m(Z){return arguments.length?this.cover(+Z[0][0]).cover(+Z[1][0]):isNaN(this._x0)?void 0:[[this._x0],[this._x1]]}},79150:function(Be,Me,b){"use strict";b.d(Me,{Z:function(){return Z}});var m=b(10253);function Z(V,N){var E,F=this._x0,C,P,H=this._x1,D=[],X=this._root,j,de;for(X&&D.push(new m.Z(X,F,H)),N==null?N=1/0:(F=V-N,H=V+N);j=D.pop();)if(!(!(X=j.node)||(C=j.x0)>H||(P=j.x1)<F))if(X.length){var he=(C+P)/2;D.push(new m.Z(X[1],he,P),new m.Z(X[0],C,he)),(de=+(V>=he))&&(j=D[D.length-1],D[D.length-1]=D[D.length-1-de],D[D.length-1-de]=j)}else{var we=Math.abs(V-+this._x.call(null,X.data));we<N&&(N=we,F=V-we,H=V+we,E=X.data)}return E}},10253:function(Be,Me,b){"use strict";b.d(Me,{Z:function(){return m}});function m(Z,V,N){this.node=Z,this.x0=V,this.x1=N}},45632:function(Be,Me,b){"use strict";b.d(Me,{Z:function(){return m},x:function(){return Z}});function m(V){if(isNaN(X=+this._x.call(null,V)))return this;var N,E=this._root,F,C,P,H=this._x0,D=this._x1,X,j,de,he,we;if(!E)return this;if(E.length)for(;;){if((de=X>=(j=(H+D)/2))?H=j:D=j,N=E,!(E=E[he=+de]))return this;if(!E.length)break;N[he+1&1]&&(F=N,we=he)}for(;E.data!==V;)if(C=E,!(E=E.next))return this;return(P=E.next)&&delete E.next,C?(P?C.next=P:delete C.next,this):N?(P?N[he]=P:delete N[he],(E=N[0]||N[1])&&E===(N[1]||N[0])&&!E.length&&(F?F[we]=E:this._root=E),this):(this._root=P,this)}function Z(V){for(var N=0,E=V.length;N<E;++N)this.remove(V[N]);return this}},30108:function(Be,Me,b){"use strict";b.d(Me,{Z:function(){return m}});function m(){return this._root}},90820:function(Be,Me,b){"use strict";b.d(Me,{Z:function(){return m}});function m(){var Z=0;return this.visit(function(V){if(!V.length)do++Z;while(V=V.next)}),Z}},11706:function(Be,Me,b){"use strict";b.d(Me,{Z:function(){return Z}});var m=b(10253);function Z(V){var N=[],E,F=this._root,C,P,H;for(F&&N.push(new m.Z(F,this._x0,this._x1));E=N.pop();)if(!V(F=E.node,P=E.x0,H=E.x1)&&F.length){var D=(P+H)/2;(C=F[1])&&N.push(new m.Z(C,D,H)),(C=F[0])&&N.push(new m.Z(C,P,D))}return this}},78017:function(Be,Me,b){"use strict";b.d(Me,{Z:function(){return Z}});var m=b(10253);function Z(V){var N=[],E=[],F;for(this._root&&N.push(new m.Z(this._root,this._x0,this._x1));F=N.pop();){var C=F.node;if(C.length){var P,H=F.x0,D=F.x1,X=(H+D)/2;(P=C[0])&&N.push(new m.Z(P,H,X)),(P=C[1])&&N.push(new m.Z(P,X,D))}E.push(F)}for(;F=E.pop();)V(F.node,F.x0,F.x1);return this}},79387:function(Be,Me,b){"use strict";b.d(Me,{P:function(){return m},Z:function(){return Z}});function m(V){return V[0]}function Z(V){return arguments.length?(this._x=V,this):this._x}},38192:function(Be,Me,b){"use strict";b.d(Me,{Z:function(){return m}});function m(Z,V,N){var E,F=1;Z==null&&(Z=0),V==null&&(V=0),N==null&&(N=0);function C(){var P,H=E.length,D,X=0,j=0,de=0;for(P=0;P<H;++P)D=E[P],X+=D.x||0,j+=D.y||0,de+=D.z||0;for(X=(X/H-Z)*F,j=(j/H-V)*F,de=(de/H-N)*F,P=0;P<H;++P)D=E[P],X&&(D.x-=X),j&&(D.y-=j),de&&(D.z-=de)}return C.initialize=function(P){E=P},C.x=function(P){return arguments.length?(Z=+P,C):Z},C.y=function(P){return arguments.length?(V=+P,C):V},C.z=function(P){return arguments.length?(N=+P,C):N},C.strength=function(P){return arguments.length?(F=+P,C):F},C}},85320:function(Be,Me,b){"use strict";b.d(Me,{Z:function(){return m}});function m(Z){return function(){return Z}}},31276:function(Be,Me,b){"use strict";b.d(Me,{Z:function(){return m}});function m(Z){return(Z()-.5)*1e-6}},1076:function(Be,Me,b){"use strict";b.d(Me,{Z:function(){return N}});const m=1664525,Z=1013904223,V=4294967296;function N(){let E=1;return()=>(E=(m*E+Z)%V)/V}},76633:function(Be,Me,b){"use strict";b.d(Me,{Z:function(){return E}});var m=b(85320),Z=b(31276);function V(F){return F.index}function N(F,C){var P=F.get(C);if(!P)throw new Error("node not found: "+C);return P}function E(F){var C=V,P=$e,H,D=(0,m.Z)(30),X,j,de,he,we,ve,Ee=1;F==null&&(F=[]);function $e(kt){return 1/Math.min(he[kt.source.index],he[kt.target.index])}function Fe(kt){for(var It=0,Bn=F.length;It<Ee;++It)for(var Lt=0,Wn,Xn,In,zn=0,dr=0,vn=0,_r,Ge;Lt<Bn;++Lt)Wn=F[Lt],Xn=Wn.source,In=Wn.target,zn=In.x+In.vx-Xn.x-Xn.vx||(0,Z.Z)(ve),de>1&&(dr=In.y+In.vy-Xn.y-Xn.vy||(0,Z.Z)(ve)),de>2&&(vn=In.z+In.vz-Xn.z-Xn.vz||(0,Z.Z)(ve)),_r=Math.sqrt(zn*zn+dr*dr+vn*vn),_r=(_r-X[Lt])/_r*kt*H[Lt],zn*=_r,dr*=_r,vn*=_r,In.vx-=zn*(Ge=we[Lt]),de>1&&(In.vy-=dr*Ge),de>2&&(In.vz-=vn*Ge),Xn.vx+=zn*(Ge=1-Ge),de>1&&(Xn.vy+=dr*Ge),de>2&&(Xn.vz+=vn*Ge)}function ct(){if(j){var kt,It=j.length,Bn=F.length,Lt=new Map(j.map((Xn,In)=>[C(Xn,In,j),Xn])),Wn;for(kt=0,he=new Array(It);kt<Bn;++kt)Wn=F[kt],Wn.index=kt,typeof Wn.source!="object"&&(Wn.source=N(Lt,Wn.source)),typeof Wn.target!="object"&&(Wn.target=N(Lt,Wn.target)),he[Wn.source.index]=(he[Wn.source.index]||0)+1,he[Wn.target.index]=(he[Wn.target.index]||0)+1;for(kt=0,we=new Array(Bn);kt<Bn;++kt)Wn=F[kt],we[kt]=he[Wn.source.index]/(he[Wn.source.index]+he[Wn.target.index]);H=new Array(Bn),vt(),X=new Array(Bn),at()}}function vt(){if(j)for(var kt=0,It=F.length;kt<It;++kt)H[kt]=+P(F[kt],kt,F)}function at(){if(j)for(var kt=0,It=F.length;kt<It;++kt)X[kt]=+D(F[kt],kt,F)}return Fe.initialize=function(kt,...It){j=kt,ve=It.find(Bn=>typeof Bn=="function")||Math.random,de=It.find(Bn=>[1,2,3].includes(Bn))||2,ct()},Fe.links=function(kt){return arguments.length?(F=kt,ct(),Fe):F},Fe.id=function(kt){return arguments.length?(C=kt,Fe):C},Fe.iterations=function(kt){return arguments.length?(Ee=+kt,Fe):Ee},Fe.strength=function(kt){return arguments.length?(P=typeof kt=="function"?kt:(0,m.Z)(+kt),vt(),Fe):P},Fe.distance=function(kt){return arguments.length?(D=typeof kt=="function"?kt:(0,m.Z)(+kt),at(),Fe):D},Fe}},61147:function(Be,Me,b){"use strict";b.d(Me,{Z:function(){return C}});var m=b(33662),Z=b(14301),V=b(7695),N=b(85320),E=b(31276),F=b(21668);function C(){var P,H,D,X,j,de=(0,N.Z)(-30),he,we=1,ve=1/0,Ee=.81;function $e(at){var kt,It=P.length,Bn=(H===1?(0,m.Z)(P,F.x):H===2?(0,Z.Z)(P,F.x,F.y):H===3?(0,V.Z)(P,F.x,F.y,F.z):null).visitAfter(ct);for(j=at,kt=0;kt<It;++kt)D=P[kt],Bn.visit(vt)}function Fe(){if(P){var at,kt=P.length,It;for(he=new Array(kt),at=0;at<kt;++at)It=P[at],he[It.index]=+de(It,at,P)}}function ct(at){var kt=0,It,Bn,Lt=0,Wn,Xn,In,zn,dr=at.length;if(dr){for(Wn=Xn=In=zn=0;zn<dr;++zn)(It=at[zn])&&(Bn=Math.abs(It.value))&&(kt+=It.value,Lt+=Bn,Wn+=Bn*(It.x||0),Xn+=Bn*(It.y||0),In+=Bn*(It.z||0));kt*=Math.sqrt(4/dr),at.x=Wn/Lt,H>1&&(at.y=Xn/Lt),H>2&&(at.z=In/Lt)}else{It=at,It.x=It.data.x,H>1&&(It.y=It.data.y),H>2&&(It.z=It.data.z);do kt+=he[It.data.index];while(It=It.next)}at.value=kt}function vt(at,kt,It,Bn,Lt){if(!at.value)return!0;var Wn=[It,Bn,Lt][H-1],Xn=at.x-D.x,In=H>1?at.y-D.y:0,zn=H>2?at.z-D.z:0,dr=Wn-kt,vn=Xn*Xn+In*In+zn*zn;if(dr*dr/Ee<vn)return vn<ve&&(Xn===0&&(Xn=(0,E.Z)(X),vn+=Xn*Xn),H>1&&In===0&&(In=(0,E.Z)(X),vn+=In*In),H>2&&zn===0&&(zn=(0,E.Z)(X),vn+=zn*zn),vn<we&&(vn=Math.sqrt(we*vn)),D.vx+=Xn*at.value*j/vn,H>1&&(D.vy+=In*at.value*j/vn),H>2&&(D.vz+=zn*at.value*j/vn)),!0;if(at.length||vn>=ve)return;(at.data!==D||at.next)&&(Xn===0&&(Xn=(0,E.Z)(X),vn+=Xn*Xn),H>1&&In===0&&(In=(0,E.Z)(X),vn+=In*In),H>2&&zn===0&&(zn=(0,E.Z)(X),vn+=zn*zn),vn<we&&(vn=Math.sqrt(we*vn)));do at.data!==D&&(dr=he[at.data.index]*j/vn,D.vx+=Xn*dr,H>1&&(D.vy+=In*dr),H>2&&(D.vz+=zn*dr));while(at=at.next)}return $e.initialize=function(at,...kt){P=at,X=kt.find(It=>typeof It=="function")||Math.random,H=kt.find(It=>[1,2,3].includes(It))||2,Fe()},$e.strength=function(at){return arguments.length?(de=typeof at=="function"?at:(0,N.Z)(+at),Fe(),$e):de},$e.distanceMin=function(at){return arguments.length?(we=at*at,$e):Math.sqrt(we)},$e.distanceMax=function(at){return arguments.length?(ve=at*at,$e):Math.sqrt(ve)},$e.theta=function(at){return arguments.length?(Ee=at*at,$e):Math.sqrt(Ee)},$e}},21668:function(Be,Me,b){"use strict";b.d(Me,{Z:function(){return X},x:function(){return E},y:function(){return F},z:function(){return C}});var m=b(16094),Z=b(83833),V=b(1076),N=3;function E(j){return j.x}function F(j){return j.y}function C(j){return j.z}var P=10,H=Math.PI*(3-Math.sqrt(5)),D=Math.PI*20/(9+Math.sqrt(221));function X(j,de){de=de||2;var he=Math.min(N,Math.max(1,Math.round(de))),we,ve=1,Ee=.001,$e=1-Math.pow(Ee,1/300),Fe=0,ct=.6,vt=new Map,at=(0,Z.HT)(Bn),kt=(0,m.Z)("tick","end"),It=(0,V.Z)();j==null&&(j=[]);function Bn(){Lt(),kt.call("tick",we),ve<Ee&&(at.stop(),kt.call("end",we))}function Lt(In){var zn,dr=j.length,vn;In===void 0&&(In=1);for(var _r=0;_r<In;++_r)for(ve+=(Fe-ve)*$e,vt.forEach(function(Ge){Ge(ve)}),zn=0;zn<dr;++zn)vn=j[zn],vn.fx==null?vn.x+=vn.vx*=ct:(vn.x=vn.fx,vn.vx=0),he>1&&(vn.fy==null?vn.y+=vn.vy*=ct:(vn.y=vn.fy,vn.vy=0)),he>2&&(vn.fz==null?vn.z+=vn.vz*=ct:(vn.z=vn.fz,vn.vz=0));return we}function Wn(){for(var In=0,zn=j.length,dr;In<zn;++In){if(dr=j[In],dr.index=In,dr.fx!=null&&(dr.x=dr.fx),dr.fy!=null&&(dr.y=dr.fy),dr.fz!=null&&(dr.z=dr.fz),isNaN(dr.x)||he>1&&isNaN(dr.y)||he>2&&isNaN(dr.z)){var vn=P*(he>2?Math.cbrt(.5+In):he>1?Math.sqrt(.5+In):In),_r=In*H,Ge=In*D;he===1?dr.x=vn:he===2?(dr.x=vn*Math.cos(_r),dr.y=vn*Math.sin(_r)):(dr.x=vn*Math.sin(_r)*Math.cos(Ge),dr.y=vn*Math.cos(_r),dr.z=vn*Math.sin(_r)*Math.sin(Ge))}(isNaN(dr.vx)||he>1&&isNaN(dr.vy)||he>2&&isNaN(dr.vz))&&(dr.vx=0,he>1&&(dr.vy=0),he>2&&(dr.vz=0))}}function Xn(In){return In.initialize&&In.initialize(j,It,he),In}return Wn(),we={tick:Lt,restart:function(){return at.restart(Bn),we},stop:function(){return at.stop(),we},numDimensions:function(In){return arguments.length?(he=Math.min(N,Math.max(1,Math.round(In))),vt.forEach(Xn),we):he},nodes:function(In){return arguments.length?(j=In,Wn(),vt.forEach(Xn),we):j},alpha:function(In){return arguments.length?(ve=+In,we):ve},alphaMin:function(In){return arguments.length?(Ee=+In,we):Ee},alphaDecay:function(In){return arguments.length?($e=+In,we):+$e},alphaTarget:function(In){return arguments.length?(Fe=+In,we):Fe},velocityDecay:function(In){return arguments.length?(ct=1-In,we):1-ct},randomSource:function(In){return arguments.length?(It=In,vt.forEach(Xn),we):It},force:function(In,zn){return arguments.length>1?(zn==null?vt.delete(In):vt.set(In,Xn(zn)),we):vt.get(In)},find:function(){var In=Array.prototype.slice.call(arguments),zn=In.shift()||0,dr=(he>1?In.shift():null)||0,vn=(he>2?In.shift():null)||0,_r=In.shift()||1/0,Ge=0,Tt=j.length,On,Vr,en,ln,Cn,Mt;for(_r*=_r,Ge=0;Ge<Tt;++Ge)Cn=j[Ge],On=zn-Cn.x,Vr=dr-(Cn.y||0),en=vn-(Cn.z||0),ln=On*On+Vr*Vr+en*en,ln<_r&&(Mt=Cn,_r=ln);return Mt},on:function(In,zn){return arguments.length>1?(kt.on(In,zn),we):kt.on(In)}}}},32575:function(Be,Me,b){"use strict";b.d(Me,{Z:function(){return m}});function m(Z,V){var N,E=1;Z==null&&(Z=0),V==null&&(V=0);function F(){var C,P=N.length,H,D=0,X=0;for(C=0;C<P;++C)H=N[C],D+=H.x,X+=H.y;for(D=(D/P-Z)*E,X=(X/P-V)*E,C=0;C<P;++C)H=N[C],H.x-=D,H.y-=X}return F.initialize=function(C){N=C},F.x=function(C){return arguments.length?(Z=+C,F):Z},F.y=function(C){return arguments.length?(V=+C,F):V},F.strength=function(C){return arguments.length?(E=+C,F):E},F}},33039:function(Be,Me,b){"use strict";b.d(Me,{Z:function(){return F}});var m=b(14301),Z=b(91592),V=b(12068);function N(C){return C.x+C.vx}function E(C){return C.y+C.vy}function F(C){var P,H,D,X=1,j=1;typeof C!="function"&&(C=(0,Z.Z)(C==null?1:+C));function de(){for(var ve,Ee=P.length,$e,Fe,ct,vt,at,kt,It=0;It<j;++It)for($e=(0,m.Z)(P,N,E).visitAfter(he),ve=0;ve<Ee;++ve)Fe=P[ve],at=H[Fe.index],kt=at*at,ct=Fe.x+Fe.vx,vt=Fe.y+Fe.vy,$e.visit(Bn);function Bn(Lt,Wn,Xn,In,zn){var dr=Lt.data,vn=Lt.r,_r=at+vn;if(dr){if(dr.index>Fe.index){var Ge=ct-dr.x-dr.vx,Tt=vt-dr.y-dr.vy,On=Ge*Ge+Tt*Tt;On<_r*_r&&(Ge===0&&(Ge=(0,V.Z)(D),On+=Ge*Ge),Tt===0&&(Tt=(0,V.Z)(D),On+=Tt*Tt),On=(_r-(On=Math.sqrt(On)))/On*X,Fe.vx+=(Ge*=On)*(_r=(vn*=vn)/(kt+vn)),Fe.vy+=(Tt*=On)*_r,dr.vx-=Ge*(_r=1-_r),dr.vy-=Tt*_r)}return}return Wn>ct+_r||In<ct-_r||Xn>vt+_r||zn<vt-_r}}function he(ve){if(ve.data)return ve.r=H[ve.data.index];for(var Ee=ve.r=0;Ee<4;++Ee)ve[Ee]&&ve[Ee].r>ve.r&&(ve.r=ve[Ee].r)}function we(){if(P){var ve,Ee=P.length,$e;for(H=new Array(Ee),ve=0;ve<Ee;++ve)$e=P[ve],H[$e.index]=+C($e,ve,P)}}return de.initialize=function(ve,Ee){P=ve,D=Ee,we()},de.iterations=function(ve){return arguments.length?(j=+ve,de):j},de.strength=function(ve){return arguments.length?(X=+ve,de):X},de.radius=function(ve){return arguments.length?(C=typeof ve=="function"?ve:(0,Z.Z)(+ve),we(),de):C},de}},91592:function(Be,Me,b){"use strict";b.d(Me,{Z:function(){return m}});function m(Z){return function(){return Z}}},12068:function(Be,Me,b){"use strict";b.d(Me,{Z:function(){return m}});function m(Z){return(Z()-.5)*1e-6}},42398:function(Be,Me,b){"use strict";b.d(Me,{Z:function(){return N}});const m=1664525,Z=1013904223,V=4294967296;function N(){let E=1;return()=>(E=(m*E+Z)%V)/V}},31136:function(Be,Me,b){"use strict";b.d(Me,{Z:function(){return E}});var m=b(91592),Z=b(12068);function V(F){return F.index}function N(F,C){var P=F.get(C);if(!P)throw new Error("node not found: "+C);return P}function E(F){var C=V,P=Ee,H,D=(0,m.Z)(30),X,j,de,he,we,ve=1;F==null&&(F=[]);function Ee(at){return 1/Math.min(de[at.source.index],de[at.target.index])}function $e(at){for(var kt=0,It=F.length;kt<ve;++kt)for(var Bn=0,Lt,Wn,Xn,In,zn,dr,vn;Bn<It;++Bn)Lt=F[Bn],Wn=Lt.source,Xn=Lt.target,In=Xn.x+Xn.vx-Wn.x-Wn.vx||(0,Z.Z)(we),zn=Xn.y+Xn.vy-Wn.y-Wn.vy||(0,Z.Z)(we),dr=Math.sqrt(In*In+zn*zn),dr=(dr-X[Bn])/dr*at*H[Bn],In*=dr,zn*=dr,Xn.vx-=In*(vn=he[Bn]),Xn.vy-=zn*vn,Wn.vx+=In*(vn=1-vn),Wn.vy+=zn*vn}function Fe(){if(j){var at,kt=j.length,It=F.length,Bn=new Map(j.map((Wn,Xn)=>[C(Wn,Xn,j),Wn])),Lt;for(at=0,de=new Array(kt);at<It;++at)Lt=F[at],Lt.index=at,typeof Lt.source!="object"&&(Lt.source=N(Bn,Lt.source)),typeof Lt.target!="object"&&(Lt.target=N(Bn,Lt.target)),de[Lt.source.index]=(de[Lt.source.index]||0)+1,de[Lt.target.index]=(de[Lt.target.index]||0)+1;for(at=0,he=new Array(It);at<It;++at)Lt=F[at],he[at]=de[Lt.source.index]/(de[Lt.source.index]+de[Lt.target.index]);H=new Array(It),ct(),X=new Array(It),vt()}}function ct(){if(j)for(var at=0,kt=F.length;at<kt;++at)H[at]=+P(F[at],at,F)}function vt(){if(j)for(var at=0,kt=F.length;at<kt;++at)X[at]=+D(F[at],at,F)}return $e.initialize=function(at,kt){j=at,we=kt,Fe()},$e.links=function(at){return arguments.length?(F=at,Fe(),$e):F},$e.id=function(at){return arguments.length?(C=at,$e):C},$e.iterations=function(at){return arguments.length?(ve=+at,$e):ve},$e.strength=function(at){return arguments.length?(P=typeof at=="function"?at:(0,m.Z)(+at),ct(),$e):P},$e.distance=function(at){return arguments.length?(D=typeof at=="function"?at:(0,m.Z)(+at),vt(),$e):D},$e}},84365:function(Be,Me,b){"use strict";b.d(Me,{Z:function(){return E}});var m=b(14301),Z=b(91592),V=b(12068),N=b(74515);function E(){var F,C,P,H,D=(0,Z.Z)(-30),X,j=1,de=1/0,he=.81;function we(Fe){var ct,vt=F.length,at=(0,m.Z)(F,N.x,N.y).visitAfter(Ee);for(H=Fe,ct=0;ct<vt;++ct)C=F[ct],at.visit($e)}function ve(){if(F){var Fe,ct=F.length,vt;for(X=new Array(ct),Fe=0;Fe<ct;++Fe)vt=F[Fe],X[vt.index]=+D(vt,Fe,F)}}function Ee(Fe){var ct=0,vt,at,kt=0,It,Bn,Lt;if(Fe.length){for(It=Bn=Lt=0;Lt<4;++Lt)(vt=Fe[Lt])&&(at=Math.abs(vt.value))&&(ct+=vt.value,kt+=at,It+=at*vt.x,Bn+=at*vt.y);Fe.x=It/kt,Fe.y=Bn/kt}else{vt=Fe,vt.x=vt.data.x,vt.y=vt.data.y;do ct+=X[vt.data.index];while(vt=vt.next)}Fe.value=ct}function $e(Fe,ct,vt,at){if(!Fe.value)return!0;var kt=Fe.x-C.x,It=Fe.y-C.y,Bn=at-ct,Lt=kt*kt+It*It;if(Bn*Bn/he<Lt)return Lt<de&&(kt===0&&(kt=(0,V.Z)(P),Lt+=kt*kt),It===0&&(It=(0,V.Z)(P),Lt+=It*It),Lt<j&&(Lt=Math.sqrt(j*Lt)),C.vx+=kt*Fe.value*H/Lt,C.vy+=It*Fe.value*H/Lt),!0;if(Fe.length||Lt>=de)return;(Fe.data!==C||Fe.next)&&(kt===0&&(kt=(0,V.Z)(P),Lt+=kt*kt),It===0&&(It=(0,V.Z)(P),Lt+=It*It),Lt<j&&(Lt=Math.sqrt(j*Lt)));do Fe.data!==C&&(Bn=X[Fe.data.index]*H/Lt,C.vx+=kt*Bn,C.vy+=It*Bn);while(Fe=Fe.next)}return we.initialize=function(Fe,ct){F=Fe,P=ct,ve()},we.strength=function(Fe){return arguments.length?(D=typeof Fe=="function"?Fe:(0,Z.Z)(+Fe),ve(),we):D},we.distanceMin=function(Fe){return arguments.length?(j=Fe*Fe,we):Math.sqrt(j)},we.distanceMax=function(Fe){return arguments.length?(de=Fe*Fe,we):Math.sqrt(de)},we.theta=function(Fe){return arguments.length?(he=Fe*Fe,we):Math.sqrt(he)},we}},54774:function(Be,Me,b){"use strict";b.d(Me,{Z:function(){return Z}});var m=b(91592);function Z(V,N,E){var F,C=(0,m.Z)(.1),P,H;typeof V!="function"&&(V=(0,m.Z)(+V)),N==null&&(N=0),E==null&&(E=0);function D(j){for(var de=0,he=F.length;de<he;++de){var we=F[de],ve=we.x-N||1e-6,Ee=we.y-E||1e-6,$e=Math.sqrt(ve*ve+Ee*Ee),Fe=(H[de]-$e)*P[de]*j/$e;we.vx+=ve*Fe,we.vy+=Ee*Fe}}function X(){if(F){var j,de=F.length;for(P=new Array(de),H=new Array(de),j=0;j<de;++j)H[j]=+V(F[j],j,F),P[j]=isNaN(H[j])?0:+C(F[j],j,F)}}return D.initialize=function(j){F=j,X()},D.strength=function(j){return arguments.length?(C=typeof j=="function"?j:(0,m.Z)(+j),X(),D):C},D.radius=function(j){return arguments.length?(V=typeof j=="function"?j:(0,m.Z)(+j),X(),D):V},D.x=function(j){return arguments.length?(N=+j,D):N},D.y=function(j){return arguments.length?(E=+j,D):E},D}},74515:function(Be,Me,b){"use strict";b.d(Me,{Z:function(){return P},x:function(){return N},y:function(){return E}});var m=b(16094),Z=b(83833),V=b(42398);function N(H){return H.x}function E(H){return H.y}var F=10,C=Math.PI*(3-Math.sqrt(5));function P(H){var D,X=1,j=.001,de=1-Math.pow(j,1/300),he=0,we=.6,ve=new Map,Ee=(0,Z.HT)(ct),$e=(0,m.Z)("tick","end"),Fe=(0,V.Z)();H==null&&(H=[]);function ct(){vt(),$e.call("tick",D),X<j&&(Ee.stop(),$e.call("end",D))}function vt(It){var Bn,Lt=H.length,Wn;It===void 0&&(It=1);for(var Xn=0;Xn<It;++Xn)for(X+=(he-X)*de,ve.forEach(function(In){In(X)}),Bn=0;Bn<Lt;++Bn)Wn=H[Bn],Wn.fx==null?Wn.x+=Wn.vx*=we:(Wn.x=Wn.fx,Wn.vx=0),Wn.fy==null?Wn.y+=Wn.vy*=we:(Wn.y=Wn.fy,Wn.vy=0);return D}function at(){for(var It=0,Bn=H.length,Lt;It<Bn;++It){if(Lt=H[It],Lt.index=It,Lt.fx!=null&&(Lt.x=Lt.fx),Lt.fy!=null&&(Lt.y=Lt.fy),isNaN(Lt.x)||isNaN(Lt.y)){var Wn=F*Math.sqrt(.5+It),Xn=It*C;Lt.x=Wn*Math.cos(Xn),Lt.y=Wn*Math.sin(Xn)}(isNaN(Lt.vx)||isNaN(Lt.vy))&&(Lt.vx=Lt.vy=0)}}function kt(It){return It.initialize&&It.initialize(H,Fe),It}return at(),D={tick:vt,restart:function(){return Ee.restart(ct),D},stop:function(){return Ee.stop(),D},nodes:function(It){return arguments.length?(H=It,at(),ve.forEach(kt),D):H},alpha:function(It){return arguments.length?(X=+It,D):X},alphaMin:function(It){return arguments.length?(j=+It,D):j},alphaDecay:function(It){return arguments.length?(de=+It,D):+de},alphaTarget:function(It){return arguments.length?(he=+It,D):he},velocityDecay:function(It){return arguments.length?(we=1-It,D):1-we},randomSource:function(It){return arguments.length?(Fe=It,ve.forEach(kt),D):Fe},force:function(It,Bn){return arguments.length>1?(Bn==null?ve.delete(It):ve.set(It,kt(Bn)),D):ve.get(It)},find:function(It,Bn,Lt){var Wn=0,Xn=H.length,In,zn,dr,vn,_r;for(Lt==null?Lt=1/0:Lt*=Lt,Wn=0;Wn<Xn;++Wn)vn=H[Wn],In=It-vn.x,zn=Bn-vn.y,dr=In*In+zn*zn,dr<Lt&&(_r=vn,Lt=dr);return _r},on:function(It,Bn){return arguments.length>1?($e.on(It,Bn),D):$e.on(It)}}}},34123:function(Be,Me,b){"use strict";b.d(Me,{Z:function(){return Z}});var m=b(91592);function Z(V){var N=(0,m.Z)(.1),E,F,C;typeof V!="function"&&(V=(0,m.Z)(V==null?0:+V));function P(D){for(var X=0,j=E.length,de;X<j;++X)de=E[X],de.vx+=(C[X]-de.x)*F[X]*D}function H(){if(E){var D,X=E.length;for(F=new Array(X),C=new Array(X),D=0;D<X;++D)F[D]=isNaN(C[D]=+V(E[D],D,E))?0:+N(E[D],D,E)}}return P.initialize=function(D){E=D,H()},P.strength=function(D){return arguments.length?(N=typeof D=="function"?D:(0,m.Z)(+D),H(),P):N},P.x=function(D){return arguments.length?(V=typeof D=="function"?D:(0,m.Z)(+D),H(),P):V},P}},97468:function(Be,Me,b){"use strict";b.d(Me,{Z:function(){return Z}});var m=b(91592);function Z(V){var N=(0,m.Z)(.1),E,F,C;typeof V!="function"&&(V=(0,m.Z)(V==null?0:+V));function P(D){for(var X=0,j=E.length,de;X<j;++X)de=E[X],de.vy+=(C[X]-de.y)*F[X]*D}function H(){if(E){var D,X=E.length;for(F=new Array(X),C=new Array(X),D=0;D<X;++D)F[D]=isNaN(C[D]=+V(E[D],D,E))?0:+N(E[D],D,E)}}return P.initialize=function(D){E=D,H()},P.strength=function(D){return arguments.length?(N=typeof D=="function"?D:(0,m.Z)(+D),H(),P):N},P.y=function(D){return arguments.length?(V=typeof D=="function"?D:(0,m.Z)(+D),H(),P):V},P}},12713:function(Be,Me,b){"use strict";b.d(Me,{H:function(){return V},Z:function(){return m}});function m(N){const E=+this._x.call(null,N),F=+this._y.call(null,N),C=+this._z.call(null,N);return Z(this.cover(E,F,C),E,F,C,N)}function Z(N,E,F,C,P){if(isNaN(E)||isNaN(F)||isNaN(C))return N;var H,D=N._root,X={data:P},j=N._x0,de=N._y0,he=N._z0,we=N._x1,ve=N._y1,Ee=N._z1,$e,Fe,ct,vt,at,kt,It,Bn,Lt,Wn,Xn;if(!D)return N._root=X,N;for(;D.length;)if((It=E>=($e=(j+we)/2))?j=$e:we=$e,(Bn=F>=(Fe=(de+ve)/2))?de=Fe:ve=Fe,(Lt=C>=(ct=(he+Ee)/2))?he=ct:Ee=ct,H=D,!(D=D[Wn=Lt<<2|Bn<<1|It]))return H[Wn]=X,N;if(vt=+N._x.call(null,D.data),at=+N._y.call(null,D.data),kt=+N._z.call(null,D.data),E===vt&&F===at&&C===kt)return X.next=D,H?H[Wn]=X:N._root=X,N;do H=H?H[Wn]=new Array(8):N._root=new Array(8),(It=E>=($e=(j+we)/2))?j=$e:we=$e,(Bn=F>=(Fe=(de+ve)/2))?de=Fe:ve=Fe,(Lt=C>=(ct=(he+Ee)/2))?he=ct:Ee=ct;while((Wn=Lt<<2|Bn<<1|It)===(Xn=(kt>=ct)<<2|(at>=Fe)<<1|vt>=$e));return H[Xn]=D,H[Wn]=X,N}function V(N){Array.isArray(N)||(N=Array.from(N));const E=N.length,F=new Float64Array(E),C=new Float64Array(E),P=new Float64Array(E);let H=1/0,D=1/0,X=1/0,j=-1/0,de=-1/0,he=-1/0;for(let we=0,ve,Ee,$e,Fe;we<E;++we)isNaN(Ee=+this._x.call(null,ve=N[we]))||isNaN($e=+this._y.call(null,ve))||isNaN(Fe=+this._z.call(null,ve))||(F[we]=Ee,C[we]=$e,P[we]=Fe,Ee<H&&(H=Ee),Ee>j&&(j=Ee),$e<D&&(D=$e),$e>de&&(de=$e),Fe<X&&(X=Fe),Fe>he&&(he=Fe));if(H>j||D>de||X>he)return this;this.cover(H,D,X).cover(j,de,he);for(let we=0;we<E;++we)Z(this,F[we],C[we],P[we],N[we]);return this}},17646:function(Be,Me,b){"use strict";b.d(Me,{Z:function(){return m}});function m(Z,V,N){if(isNaN(Z=+Z)||isNaN(V=+V)||isNaN(N=+N))return this;var E=this._x0,F=this._y0,C=this._z0,P=this._x1,H=this._y1,D=this._z1;if(isNaN(E))P=(E=Math.floor(Z))+1,H=(F=Math.floor(V))+1,D=(C=Math.floor(N))+1;else{for(var X=P-E||1,j=this._root,de,he;E>Z||Z>=P||F>V||V>=H||C>N||N>=D;)switch(he=(N<C)<<2|(V<F)<<1|Z<E,de=new Array(8),de[he]=j,j=de,X*=2,he){case 0:P=E+X,H=F+X,D=C+X;break;case 1:E=P-X,H=F+X,D=C+X;break;case 2:P=E+X,F=H-X,D=C+X;break;case 3:E=P-X,F=H-X,D=C+X;break;case 4:P=E+X,H=F+X,C=D-X;break;case 5:E=P-X,H=F+X,C=D-X;break;case 6:P=E+X,F=H-X,C=D-X;break;case 7:E=P-X,F=H-X,C=D-X;break}this._root&&this._root.length&&(this._root=j)}return this._x0=E,this._y0=F,this._z0=C,this._x1=P,this._y1=H,this._z1=D,this}},39894:function(Be,Me,b){"use strict";b.d(Me,{Z:function(){return m}});function m(){var Z=[];return this.visit(function(V){if(!V.length)do Z.push(V.data);while(V=V.next)}),Z}},56033:function(Be,Me,b){"use strict";b.d(Me,{Z:function(){return m}});function m(Z){return arguments.length?this.cover(+Z[0][0],+Z[0][1],+Z[0][2]).cover(+Z[1][0],+Z[1][1],+Z[1][2]):isNaN(this._x0)?void 0:[[this._x0,this._y0,this._z0],[this._x1,this._y1,this._z1]]}},77480:function(Be,Me,b){"use strict";b.d(Me,{Z:function(){return Z}});var m=b(26805);function Z(V,N,E,F){var C,P=this._x0,H=this._y0,D=this._z0,X,j,de,he,we,ve,Ee=this._x1,$e=this._y1,Fe=this._z1,ct=[],vt=this._root,at,kt;for(vt&&ct.push(new m.Z(vt,P,H,D,Ee,$e,Fe)),F==null?F=1/0:(P=V-F,H=N-F,D=E-F,Ee=V+F,$e=N+F,Fe=E+F,F*=F);at=ct.pop();)if(!(!(vt=at.node)||(X=at.x0)>Ee||(j=at.y0)>$e||(de=at.z0)>Fe||(he=at.x1)<P||(we=at.y1)<H||(ve=at.z1)<D))if(vt.length){var It=(X+he)/2,Bn=(j+we)/2,Lt=(de+ve)/2;ct.push(new m.Z(vt[7],It,Bn,Lt,he,we,ve),new m.Z(vt[6],X,Bn,Lt,It,we,ve),new m.Z(vt[5],It,j,Lt,he,Bn,ve),new m.Z(vt[4],X,j,Lt,It,Bn,ve),new m.Z(vt[3],It,Bn,de,he,we,Lt),new m.Z(vt[2],X,Bn,de,It,we,Lt),new m.Z(vt[1],It,j,de,he,Bn,Lt),new m.Z(vt[0],X,j,de,It,Bn,Lt)),(kt=(E>=Lt)<<2|(N>=Bn)<<1|V>=It)&&(at=ct[ct.length-1],ct[ct.length-1]=ct[ct.length-1-kt],ct[ct.length-1-kt]=at)}else{var Wn=V-+this._x.call(null,vt.data),Xn=N-+this._y.call(null,vt.data),In=E-+this._z.call(null,vt.data),zn=Wn*Wn+Xn*Xn+In*In;if(zn<F){var dr=Math.sqrt(F=zn);P=V-dr,H=N-dr,D=E-dr,Ee=V+dr,$e=N+dr,Fe=E+dr,C=vt.data}}return C}},72096:function(Be,Me,b){"use strict";b.d(Me,{r:function(){return Z}});const m=(V,N,E,F,C,P)=>Math.sqrt(Bp(V-F,2)+Bp(N-C,2)+Bp(E-P,2));function Z(V,N,E,F){const C=[],P=V-F,H=N-F,D=E-F,X=V+F,j=N+F,de=E+F;return this.visit((he,we,ve,Ee,$e,Fe,ct)=>{if(!he.length)do{const vt=he.data;m(V,N,E,this._x(vt),this._y(vt),this._z(vt))<=F&&C.push(vt)}while(he=he.next);return we>X||ve>j||Ee>de||$e<P||Fe<H||ct<D}),C}},26805:function(Be,Me,b){"use strict";b.d(Me,{Z:function(){return m}});function m(Z,V,N,E,F,C,P){this.node=Z,this.x0=V,this.y0=N,this.z0=E,this.x1=F,this.y1=C,this.z1=P}},7695:function(Be,Me,b){"use strict";b.d(Me,{Z:function(){return we}});var m=b(12713),Z=b(17646),V=b(39894),N=b(56033),E=b(77480),F=b(72096),C=b(36989),P=b(10325),H=b(15902),D=b(12027),X=b(66612),j=b(14763),de=b(94009),he=b(68889);function we(Fe,ct,vt,at){var kt=new ve(ct==null?j.P:ct,vt==null?de.q:vt,at==null?he.i:at,NaN,NaN,NaN,NaN,NaN,NaN);return Fe==null?kt:kt.addAll(Fe)}function ve(Fe,ct,vt,at,kt,It,Bn,Lt,Wn){this._x=Fe,this._y=ct,this._z=vt,this._x0=at,this._y0=kt,this._z0=It,this._x1=Bn,this._y1=Lt,this._z1=Wn,this._root=void 0}function Ee(Fe){for(var ct={data:Fe.data},vt=ct;Fe=Fe.next;)vt=vt.next={data:Fe.data};return ct}var $e=we.prototype=ve.prototype;$e.copy=function(){var Fe=new ve(this._x,this._y,this._z,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1),ct=this._root,vt,at;if(!ct)return Fe;if(!ct.length)return Fe._root=Ee(ct),Fe;for(vt=[{source:ct,target:Fe._root=new Array(8)}];ct=vt.pop();)for(var kt=0;kt<8;++kt)(at=ct.source[kt])&&(at.length?vt.push({source:at,target:ct.target[kt]=new Array(8)}):ct.target[kt]=Ee(at));return Fe},$e.add=m.Z,$e.addAll=m.H,$e.cover=Z.Z,$e.data=V.Z,$e.extent=N.Z,$e.find=E.Z,$e.findAllWithinRadius=F.r,$e.remove=C.Z,$e.removeAll=C.x,$e.root=P.Z,$e.size=H.Z,$e.visit=D.Z,$e.visitAfter=X.Z,$e.x=j.Z,$e.y=de.Z,$e.z=he.Z},36989:function(Be,Me,b){"use strict";b.d(Me,{Z:function(){return m},x:function(){return Z}});function m(V){if(isNaN(we=+this._x.call(null,V))||isNaN(ve=+this._y.call(null,V))||isNaN(Ee=+this._z.call(null,V)))return this;var N,E=this._root,F,C,P,H=this._x0,D=this._y0,X=this._z0,j=this._x1,de=this._y1,he=this._z1,we,ve,Ee,$e,Fe,ct,vt,at,kt,It,Bn;if(!E)return this;if(E.length)for(;;){if((vt=we>=($e=(H+j)/2))?H=$e:j=$e,(at=ve>=(Fe=(D+de)/2))?D=Fe:de=Fe,(kt=Ee>=(ct=(X+he)/2))?X=ct:he=ct,N=E,!(E=E[It=kt<<2|at<<1|vt]))return this;if(!E.length)break;(N[It+1&7]||N[It+2&7]||N[It+3&7]||N[It+4&7]||N[It+5&7]||N[It+6&7]||N[It+7&7])&&(F=N,Bn=It)}for(;E.data!==V;)if(C=E,!(E=E.next))return this;return(P=E.next)&&delete E.next,C?(P?C.next=P:delete C.next,this):N?(P?N[It]=P:delete N[It],(E=N[0]||N[1]||N[2]||N[3]||N[4]||N[5]||N[6]||N[7])&&E===(N[7]||N[6]||N[5]||N[4]||N[3]||N[2]||N[1]||N[0])&&!E.length&&(F?F[Bn]=E:this._root=E),this):(this._root=P,this)}function Z(V){for(var N=0,E=V.length;N<E;++N)this.remove(V[N]);return this}},10325:function(Be,Me,b){"use strict";b.d(Me,{Z:function(){return m}});function m(){return this._root}},15902:function(Be,Me,b){"use strict";b.d(Me,{Z:function(){return m}});function m(){var Z=0;return this.visit(function(V){if(!V.length)do++Z;while(V=V.next)}),Z}},12027:function(Be,Me,b){"use strict";b.d(Me,{Z:function(){return Z}});var m=b(26805);function Z(V){var N=[],E,F=this._root,C,P,H,D,X,j,de;for(F&&N.push(new m.Z(F,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1));E=N.pop();)if(!V(F=E.node,P=E.x0,H=E.y0,D=E.z0,X=E.x1,j=E.y1,de=E.z1)&&F.length){var he=(P+X)/2,we=(H+j)/2,ve=(D+de)/2;(C=F[7])&&N.push(new m.Z(C,he,we,ve,X,j,de)),(C=F[6])&&N.push(new m.Z(C,P,we,ve,he,j,de)),(C=F[5])&&N.push(new m.Z(C,he,H,ve,X,we,de)),(C=F[4])&&N.push(new m.Z(C,P,H,ve,he,we,de)),(C=F[3])&&N.push(new m.Z(C,he,we,D,X,j,ve)),(C=F[2])&&N.push(new m.Z(C,P,we,D,he,j,ve)),(C=F[1])&&N.push(new m.Z(C,he,H,D,X,we,ve)),(C=F[0])&&N.push(new m.Z(C,P,H,D,he,we,ve))}return this}},66612:function(Be,Me,b){"use strict";b.d(Me,{Z:function(){return Z}});var m=b(26805);function Z(V){var N=[],E=[],F;for(this._root&&N.push(new m.Z(this._root,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1));F=N.pop();){var C=F.node;if(C.length){var P,H=F.x0,D=F.y0,X=F.z0,j=F.x1,de=F.y1,he=F.z1,we=(H+j)/2,ve=(D+de)/2,Ee=(X+he)/2;(P=C[0])&&N.push(new m.Z(P,H,D,X,we,ve,Ee)),(P=C[1])&&N.push(new m.Z(P,we,D,X,j,ve,Ee)),(P=C[2])&&N.push(new m.Z(P,H,ve,X,we,de,Ee)),(P=C[3])&&N.push(new m.Z(P,we,ve,X,j,de,Ee)),(P=C[4])&&N.push(new m.Z(P,H,D,Ee,we,ve,he)),(P=C[5])&&N.push(new m.Z(P,we,D,Ee,j,ve,he)),(P=C[6])&&N.push(new m.Z(P,H,ve,Ee,we,de,he)),(P=C[7])&&N.push(new m.Z(P,we,ve,Ee,j,de,he))}E.push(F)}for(;F=E.pop();)V(F.node,F.x0,F.y0,F.z0,F.x1,F.y1,F.z1);return this}},14763:function(Be,Me,b){"use strict";b.d(Me,{P:function(){return m},Z:function(){return Z}});function m(V){return V[0]}function Z(V){return arguments.length?(this._x=V,this):this._x}},94009:function(Be,Me,b){"use strict";b.d(Me,{Z:function(){return Z},q:function(){return m}});function m(V){return V[1]}function Z(V){return arguments.length?(this._y=V,this):this._y}},68889:function(Be,Me,b){"use strict";b.d(Me,{Z:function(){return Z},i:function(){return m}});function m(V){return V[2]}function Z(V){return arguments.length?(this._z=V,this):this._z}},60272:function(Be,Me,b){"use strict";b.d(Me,{H:function(){return V},Z:function(){return m}});function m(N){const E=+this._x.call(null,N),F=+this._y.call(null,N);return Z(this.cover(E,F),E,F,N)}function Z(N,E,F,C){if(isNaN(E)||isNaN(F))return N;var P,H=N._root,D={data:C},X=N._x0,j=N._y0,de=N._x1,he=N._y1,we,ve,Ee,$e,Fe,ct,vt,at;if(!H)return N._root=D,N;for(;H.length;)if((Fe=E>=(we=(X+de)/2))?X=we:de=we,(ct=F>=(ve=(j+he)/2))?j=ve:he=ve,P=H,!(H=H[vt=ct<<1|Fe]))return P[vt]=D,N;if(Ee=+N._x.call(null,H.data),$e=+N._y.call(null,H.data),E===Ee&&F===$e)return D.next=H,P?P[vt]=D:N._root=D,N;do P=P?P[vt]=new Array(4):N._root=new Array(4),(Fe=E>=(we=(X+de)/2))?X=we:de=we,(ct=F>=(ve=(j+he)/2))?j=ve:he=ve;while((vt=ct<<1|Fe)===(at=($e>=ve)<<1|Ee>=we));return P[at]=H,P[vt]=D,N}function V(N){var E,F,C=N.length,P,H,D=new Array(C),X=new Array(C),j=1/0,de=1/0,he=-1/0,we=-1/0;for(F=0;F<C;++F)isNaN(P=+this._x.call(null,E=N[F]))||isNaN(H=+this._y.call(null,E))||(D[F]=P,X[F]=H,P<j&&(j=P),P>he&&(he=P),H<de&&(de=H),H>we&&(we=H));if(j>he||de>we)return this;for(this.cover(j,de).cover(he,we),F=0;F<C;++F)Z(this,D[F],X[F],N[F]);return this}},51097:function(Be,Me,b){"use strict";b.d(Me,{Z:function(){return m}});function m(Z,V){if(isNaN(Z=+Z)||isNaN(V=+V))return this;var N=this._x0,E=this._y0,F=this._x1,C=this._y1;if(isNaN(N))F=(N=Math.floor(Z))+1,C=(E=Math.floor(V))+1;else{for(var P=F-N||1,H=this._root,D,X;N>Z||Z>=F||E>V||V>=C;)switch(X=(V<E)<<1|Z<N,D=new Array(4),D[X]=H,H=D,P*=2,X){case 0:F=N+P,C=E+P;break;case 1:N=F-P,C=E+P;break;case 2:F=N+P,E=C-P;break;case 3:N=F-P,E=C-P;break}this._root&&this._root.length&&(this._root=H)}return this._x0=N,this._y0=E,this._x1=F,this._y1=C,this}},58007:function(Be,Me,b){"use strict";b.d(Me,{Z:function(){return m}});function m(){var Z=[];return this.visit(function(V){if(!V.length)do Z.push(V.data);while(V=V.next)}),Z}},12070:function(Be,Me,b){"use strict";b.d(Me,{Z:function(){return m}});function m(Z){return arguments.length?this.cover(+Z[0][0],+Z[0][1]).cover(+Z[1][0],+Z[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]}},47064:function(Be,Me,b){"use strict";b.d(Me,{Z:function(){return Z}});var m=b(44213);function Z(V,N,E){var F,C=this._x0,P=this._y0,H,D,X,j,de=this._x1,he=this._y1,we=[],ve=this._root,Ee,$e;for(ve&&we.push(new m.Z(ve,C,P,de,he)),E==null?E=1/0:(C=V-E,P=N-E,de=V+E,he=N+E,E*=E);Ee=we.pop();)if(!(!(ve=Ee.node)||(H=Ee.x0)>de||(D=Ee.y0)>he||(X=Ee.x1)<C||(j=Ee.y1)<P))if(ve.length){var Fe=(H+X)/2,ct=(D+j)/2;we.push(new m.Z(ve[3],Fe,ct,X,j),new m.Z(ve[2],H,ct,Fe,j),new m.Z(ve[1],Fe,D,X,ct),new m.Z(ve[0],H,D,Fe,ct)),($e=(N>=ct)<<1|V>=Fe)&&(Ee=we[we.length-1],we[we.length-1]=we[we.length-1-$e],we[we.length-1-$e]=Ee)}else{var vt=V-+this._x.call(null,ve.data),at=N-+this._y.call(null,ve.data),kt=vt*vt+at*at;if(kt<E){var It=Math.sqrt(E=kt);C=V-It,P=N-It,de=V+It,he=N+It,F=ve.data}}return F}},44213:function(Be,Me,b){"use strict";b.d(Me,{Z:function(){return m}});function m(Z,V,N,E,F){this.node=Z,this.x0=V,this.y0=N,this.x1=E,this.y1=F}},14301:function(Be,Me,b){"use strict";b.d(Me,{Z:function(){return de}});var m=b(60272),Z=b(51097),V=b(58007),N=b(12070),E=b(47064),F=b(88866),C=b(10864),P=b(68984),H=b(3715),D=b(73607),X=b(56570),j=b(30992);function de(Ee,$e,Fe){var ct=new he($e==null?X.P:$e,Fe==null?j.q:Fe,NaN,NaN,NaN,NaN);return Ee==null?ct:ct.addAll(Ee)}function he(Ee,$e,Fe,ct,vt,at){this._x=Ee,this._y=$e,this._x0=Fe,this._y0=ct,this._x1=vt,this._y1=at,this._root=void 0}function we(Ee){for(var $e={data:Ee.data},Fe=$e;Ee=Ee.next;)Fe=Fe.next={data:Ee.data};return $e}var ve=de.prototype=he.prototype;ve.copy=function(){var Ee=new he(this._x,this._y,this._x0,this._y0,this._x1,this._y1),$e=this._root,Fe,ct;if(!$e)return Ee;if(!$e.length)return Ee._root=we($e),Ee;for(Fe=[{source:$e,target:Ee._root=new Array(4)}];$e=Fe.pop();)for(var vt=0;vt<4;++vt)(ct=$e.source[vt])&&(ct.length?Fe.push({source:ct,target:$e.target[vt]=new Array(4)}):$e.target[vt]=we(ct));return Ee},ve.add=m.Z,ve.addAll=m.H,ve.cover=Z.Z,ve.data=V.Z,ve.extent=N.Z,ve.find=E.Z,ve.remove=F.Z,ve.removeAll=F.x,ve.root=C.Z,ve.size=P.Z,ve.visit=H.Z,ve.visitAfter=D.Z,ve.x=X.Z,ve.y=j.Z},88866:function(Be,Me,b){"use strict";b.d(Me,{Z:function(){return m},x:function(){return Z}});function m(V){if(isNaN(de=+this._x.call(null,V))||isNaN(he=+this._y.call(null,V)))return this;var N,E=this._root,F,C,P,H=this._x0,D=this._y0,X=this._x1,j=this._y1,de,he,we,ve,Ee,$e,Fe,ct;if(!E)return this;if(E.length)for(;;){if((Ee=de>=(we=(H+X)/2))?H=we:X=we,($e=he>=(ve=(D+j)/2))?D=ve:j=ve,N=E,!(E=E[Fe=$e<<1|Ee]))return this;if(!E.length)break;(N[Fe+1&3]||N[Fe+2&3]||N[Fe+3&3])&&(F=N,ct=Fe)}for(;E.data!==V;)if(C=E,!(E=E.next))return this;return(P=E.next)&&delete E.next,C?(P?C.next=P:delete C.next,this):N?(P?N[Fe]=P:delete N[Fe],(E=N[0]||N[1]||N[2]||N[3])&&E===(N[3]||N[2]||N[1]||N[0])&&!E.length&&(F?F[ct]=E:this._root=E),this):(this._root=P,this)}function Z(V){for(var N=0,E=V.length;N<E;++N)this.remove(V[N]);return this}},10864:function(Be,Me,b){"use strict";b.d(Me,{Z:function(){return m}});function m(){return this._root}},68984:function(Be,Me,b){"use strict";b.d(Me,{Z:function(){return m}});function m(){var Z=0;return this.visit(function(V){if(!V.length)do++Z;while(V=V.next)}),Z}},3715:function(Be,Me,b){"use strict";b.d(Me,{Z:function(){return Z}});var m=b(44213);function Z(V){var N=[],E,F=this._root,C,P,H,D,X;for(F&&N.push(new m.Z(F,this._x0,this._y0,this._x1,this._y1));E=N.pop();)if(!V(F=E.node,P=E.x0,H=E.y0,D=E.x1,X=E.y1)&&F.length){var j=(P+D)/2,de=(H+X)/2;(C=F[3])&&N.push(new m.Z(C,j,de,D,X)),(C=F[2])&&N.push(new m.Z(C,P,de,j,X)),(C=F[1])&&N.push(new m.Z(C,j,H,D,de)),(C=F[0])&&N.push(new m.Z(C,P,H,j,de))}return this}},73607:function(Be,Me,b){"use strict";b.d(Me,{Z:function(){return Z}});var m=b(44213);function Z(V){var N=[],E=[],F;for(this._root&&N.push(new m.Z(this._root,this._x0,this._y0,this._x1,this._y1));F=N.pop();){var C=F.node;if(C.length){var P,H=F.x0,D=F.y0,X=F.x1,j=F.y1,de=(H+X)/2,he=(D+j)/2;(P=C[0])&&N.push(new m.Z(P,H,D,de,he)),(P=C[1])&&N.push(new m.Z(P,de,D,X,he)),(P=C[2])&&N.push(new m.Z(P,H,he,de,j)),(P=C[3])&&N.push(new m.Z(P,de,he,X,j))}E.push(F)}for(;F=E.pop();)V(F.node,F.x0,F.y0,F.x1,F.y1);return this}},56570:function(Be,Me,b){"use strict";b.d(Me,{P:function(){return m},Z:function(){return Z}});function m(V){return V[0]}function Z(V){return arguments.length?(this._x=V,this):this._x}},30992:function(Be,Me,b){"use strict";b.d(Me,{Z:function(){return Z},q:function(){return m}});function m(V){return V[1]}function Z(V){return arguments.length?(this._y=V,this):this._y}},83833:function(Be,Me,b){"use strict";b.d(Me,{HT:function(){return we}});var m=0,Z=0,V=0,N=1e3,E,F,C=0,P=0,H=0,D=typeof performance=="object"&&performance.now?performance:Date,X=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(vt){setTimeout(vt,17)};function j(){return P||(X(de),P=D.now()+H)}function de(){P=0}function he(){this._call=this._time=this._next=null}he.prototype=we.prototype={constructor:he,restart:function(vt,at,kt){if(typeof vt!="function")throw new TypeError("callback is not a function");kt=(kt==null?j():+kt)+(at==null?0:+at),!this._next&&F!==this&&(F?F._next=this:E=this,F=this),this._call=vt,this._time=kt,ct()},stop:function(){this._call&&(this._call=null,this._time=1/0,ct())}};function we(vt,at,kt){var It=new he;return It.restart(vt,at,kt),It}function ve(){j(),++m;for(var vt=E,at;vt;)(at=P-vt._time)>=0&&vt._call.call(void 0,at),vt=vt._next;--m}function Ee(){P=(C=D.now())+H,m=Z=0;try{ve()}finally{m=0,Fe(),P=0}}function $e(){var vt=D.now(),at=vt-C;at>N&&(H-=at,C=vt)}function Fe(){for(var vt,at=E,kt,It=1/0;at;)at._call?(It>at._time&&(It=at._time),vt=at,at=at._next):(kt=at._next,at._next=null,at=vt?vt._next=kt:E=kt);F=vt,ct(It)}function ct(vt){if(!m){Z&&(Z=clearTimeout(Z));var at=vt-P;at>24?(vt<1/0&&(Z=setTimeout(Ee,vt-D.now()-H)),V&&(V=clearInterval(V))):(V||(C=D.now(),V=setInterval($e,N)),m=1,X(Ee))}}},90681:function(Be,Me,b){"use strict";b.d(Me,{Z:function(){return $e}});var m=b(12778),Z=m.Z.Symbol,V=Z,N=Object.prototype,E=N.hasOwnProperty,F=N.toString,C=V?V.toStringTag:void 0;function P(Fe){var ct=E.call(Fe,C),vt=Fe[C];try{Fe[C]=void 0;var at=!0}catch(It){}var kt=F.call(Fe);return at&&(ct?Fe[C]=vt:delete Fe[C]),kt}var H=P,D=Object.prototype,X=D.toString;function j(Fe){return X.call(Fe)}var de=j,he="[object Null]",we="[object Undefined]",ve=V?V.toStringTag:void 0;function Ee(Fe){return Fe==null?Fe===void 0?we:he:ve&&ve in Object(Fe)?H(Fe):de(Fe)}var $e=Ee},61644:function(Be,Me){"use strict";var b=typeof global=="object"&&global&&global.Object===Object&&global;Me.Z=b},12778:function(Be,Me,b){"use strict";var m=b(61644),Z=typeof self=="object"&&self&&self.Object===Object&&self,V=m.Z||Z||Function("return this")();Me.Z=V},91519:function(Be,Me){"use strict";function b(m){var Z=typeof m;return m!=null&&(Z=="object"||Z=="function")}Me.Z=b},64162:function(Be,Me){"use strict";function b(m){return m!=null&&typeof m=="object"}Me.Z=b},51910:function(Be,Me,b){"use strict";b.d(Me,{KI_:function(){return go},Kj0:function(){return zd},ROQ:function(){return D0},TlE:function(){return Ql},ZAu:function(){return xu},ehD:function(){return he},jyi:function(){return RA},u9r:function(){return Ui},vBJ:function(){return Dh},xeV:function(){return Fp},xo$:function(){return hu},xoR:function(){return Nf}});const m="181",Z={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},V={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},N=0,E=1,F=2,C=3,P=0,H=1,D=2,X=3,j=0,de=1,he=2,we=0,ve=1,Ee=2,$e=3,Fe=4,ct=5,vt=100,at=101,kt=102,It=103,Bn=104,Lt=200,Wn=201,Xn=202,In=203,zn=204,dr=205,vn=206,_r=207,Ge=208,Tt=209,On=210,Vr=211,en=212,ln=213,Cn=214,Mt=0,Et=1,pe=2,Ae=3,Pe=4,Ut=5,jt=6,ft=7,on=0,hn=1,lt=2,Ct=0,sn=1,W=2,Se=3,Ht=4,zt=5,Fn=6,Tn=7,lr="attached",je="detached",be=300,it=301,wt=302,ot=303,ut=304,_t=306,$t=1e3,Vt=1001,Qt=1002,cn=1003,Yn=1004,qn=1004,Sr=1005,Jr=1005,vr=1006,Ki=1007,Mi=1007,yi=1008,qr=1008,es=1009,Ci=1010,En=1011,rn=1012,Xt=1013,st=1014,dt=1015,Wt=1016,bn=1017,Jt=1018,ar=1020,rr=35902,Kr=35899,si=1021,Ie=1022,L=1023,Q=1026,w=1027,z=1028,ie=1029,ze=1030,Je=1031,At=1032,xt=1033,Sn=33776,Oe=33777,Qe=33778,Re=33779,Ke=35840,gt=35841,tn=35842,yt=35843,Yt=36196,Rn=37492,er=37496,Jn=37808,kr=37809,fr=37810,wr=37811,ei=37812,_n=37813,jn=37814,Hr=37815,Pr=37816,$i=37817,Zi=37818,Xi=37819,Ei=37820,ms=37821,_i=36492,Es=36494,ua=36495,Hn=36283,Pt=36284,Gt=36285,Bt=36286,yn=2200,Ln=2201,gr=2202,Rr=2300,$r=2301,Ii=2302,Di=2400,ss=2401,vs=2402,Cs=2500,Aa=2501,sa=0,ca=1,Ai=2,$a=3200,Zo=3201,Ko=3202,$o=3203,bo=0,Pl=1,il="",go="srgb",Ll="srgb-linear",Lu="linear",ao="srgb",sl=0,No=7680,Uu=7681,ws=7682,Kh=7683,dh=34055,$h=34056,Uh=5386,Ku=512,sc=513,pu=514,ou=515,Ad=516,hf=517,Xo=518,fh=519,Qf=512,pd=513,Ah=514,Vc=515,jo=516,gd=517,lu=518,gu=519,oo=35044,Ic=35048,jc=35040,ph=35045,Lo=35049,Ji=35041,$u=35046,gh=35050,mh=35042,np="100",vh="300 es",Cu=2e3,zc=2001,Ul={COMPUTE:"compute",RENDER:"render"},Xl={PERSPECTIVE:"perspective",LINEAR:"linear",FLAT:"flat"},Uo={NORMAL:"normal",CENTROID:"centroid",SAMPLE:"sample",FIRST:"first",EITHER:"either"};function Ld(ue){for(let r=ue.length-1;r>=0;--r)if(ue[r]>=65535)return!0;return!1}const Yc={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array};function gl(ue,r){return new Yc[ue](r)}function To(ue){return document.createElementNS("http://www.w3.org/1999/xhtml",ue)}function ml(){const ue=To("canvas");return ue.style.display="block",ue}const Xu={};let mu=null;function Oo(ue){mu=ue}function Bo(){return mu}function _o(...ue){const r="THREE."+ue.shift();mu?mu("log",r,...ue):console.log(r,...ue)}function na(...ue){const r="THREE."+ue.shift();mu?mu("warn",r,...ue):console.warn(r,...ue)}function Wa(...ue){const r="THREE."+ue.shift();mu?mu("error",r,...ue):console.error(r,...ue)}function yh(...ue){const r=ue.join(" ");r in Xu||(Xu[r]=!0,na(...ue))}function Yo(ue,r,l){return new Promise(function(h,p){function y(){switch(ue.clientWaitSync(r,ue.SYNC_FLUSH_COMMANDS_BIT,0)){case ue.WAIT_FAILED:p();break;case ue.TIMEOUT_EXPIRED:setTimeout(y,l);break;default:h()}}setTimeout(y,l)})}class Tu{addEventListener(r,l){this._listeners===void 0&&(this._listeners={});const h=this._listeners;h[r]===void 0&&(h[r]=[]),h[r].indexOf(l)===-1&&h[r].push(l)}hasEventListener(r,l){const h=this._listeners;return h===void 0?!1:h[r]!==void 0&&h[r].indexOf(l)!==-1}removeEventListener(r,l){const h=this._listeners;if(h===void 0)return;const p=h[r];if(p!==void 0){const y=p.indexOf(l);y!==-1&&p.splice(y,1)}}dispatchEvent(r){const l=this._listeners;if(l===void 0)return;const h=l[r.type];if(h!==void 0){r.target=this;const p=h.slice(0);for(let y=0,T=p.length;y<T;y++)p[y].call(this,r);r.target=null}}}const uu=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"];let wc=1234567;const ac=Math.PI/180,Lr=180/Math.PI;function Gr(){const ue=Math.random()*4294967295|0,r=Math.random()*4294967295|0,l=Math.random()*4294967295|0,h=Math.random()*4294967295|0;return(uu[ue&255]+uu[ue>>8&255]+uu[ue>>16&255]+uu[ue>>24&255]+"-"+uu[r&255]+uu[r>>8&255]+"-"+uu[r>>16&15|64]+uu[r>>24&255]+"-"+uu[l&63|128]+uu[l>>8&255]+"-"+uu[l>>16&255]+uu[l>>24&255]+uu[h&255]+uu[h>>8&255]+uu[h>>16&255]+uu[h>>24&255]).toLowerCase()}function ki(ue,r,l){return Math.max(r,Math.min(l,ue))}function ju(ue,r){return(ue%r+r)%r}function bl(ue,r,l,h,p){return h+(ue-r)*(p-h)/(l-r)}function qo(ue,r,l){return ue!==r?(l-ue)/(r-ue):0}function Go(ue,r,l){return(1-l)*ue+l*r}function Ou(ue,r,l,h){return Go(ue,r,1-Math.exp(-l*h))}function Oh(ue,r=1){return r-Math.abs(ju(ue,r*2)-r)}function oc(ue,r,l){return ue<=r?0:ue>=l?1:(ue=(ue-r)/(l-r),ue*ue*(3-2*ue))}function Ca(ue,r,l){return ue<=r?0:ue>=l?1:(ue=(ue-r)/(l-r),ue*ue*ue*(ue*(ue*6-15)+10))}function Ud(ue,r){return ue+Math.floor(Math.random()*(r-ue+1))}function rp(ue,r){return ue+Math.random()*(r-ue)}function Xh(ue){return ue*(.5-Math.random())}function lc(ue){ue!==void 0&&(wc=ue);let r=wc+=1831565813;return r=Math.imul(r^r>>>15,r|1),r^=r+Math.imul(r^r>>>7,r|61),((r^r>>>14)>>>0)/4294967296}function wA(ue){return ue*ac}function Od(ue){return ue*Lr}function jh(ue){return(ue&ue-1)===0&&ue!==0}function SA(ue){return Math.pow(2,Math.ceil(Math.log(ue)/Math.LN2))}function md(ue){return Math.pow(2,Math.floor(Math.log(ue)/Math.LN2))}function vd(ue,r,l,h,p){const y=Math.cos,T=Math.sin,O=y(l/2),te=T(l/2),se=y((r+h)/2),xe=T((r+h)/2),Ne=y((r-h)/2),Ve=T((r-h)/2),We=y((h-r)/2),tt=T((h-r)/2);switch(p){case"XYX":ue.set(O*xe,te*Ne,te*Ve,O*se);break;case"YZY":ue.set(te*Ve,O*xe,te*Ne,O*se);break;case"ZXZ":ue.set(te*Ne,te*Ve,O*xe,O*se);break;case"XZX":ue.set(O*xe,te*tt,te*We,O*se);break;case"YXY":ue.set(te*We,O*xe,te*tt,O*se);break;case"ZYZ":ue.set(te*tt,te*We,O*xe,O*se);break;default:na("MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+p)}}function mo(ue,r){switch(r.constructor){case Float32Array:return ue;case Uint32Array:return ue/4294967295;case Uint16Array:return ue/65535;case Uint8Array:return ue/255;case Int32Array:return Math.max(ue/2147483647,-1);case Int16Array:return Math.max(ue/32767,-1);case Int8Array:return Math.max(ue/127,-1);default:throw new Error("Invalid component type.")}}function wa(ue,r){switch(r.constructor){case Float32Array:return ue;case Uint32Array:return Math.round(ue*4294967295);case Uint16Array:return Math.round(ue*65535);case Uint8Array:return Math.round(ue*255);case Int32Array:return Math.round(ue*2147483647);case Int16Array:return Math.round(ue*32767);case Int8Array:return Math.round(ue*127);default:throw new Error("Invalid component type.")}}const Dd={DEG2RAD:ac,RAD2DEG:Lr,generateUUID:Gr,clamp:ki,euclideanModulo:ju,mapLinear:bl,inverseLerp:qo,lerp:Go,damp:Ou,pingpong:Oh,smoothstep:oc,smootherstep:Ca,randInt:Ud,randFloat:rp,randFloatSpread:Xh,seededRandom:lc,degToRad:wA,radToDeg:Od,isPowerOfTwo:jh,ceilPowerOfTwo:SA,floorPowerOfTwo:md,setQuaternionFromProperEuler:vd,normalize:wa,denormalize:mo};class qi{constructor(r=0,l=0){qi.prototype.isVector2=!0,this.x=r,this.y=l}get width(){return this.x}set width(r){this.x=r}get height(){return this.y}set height(r){this.y=r}set(r,l){return this.x=r,this.y=l,this}setScalar(r){return this.x=r,this.y=r,this}setX(r){return this.x=r,this}setY(r){return this.y=r,this}setComponent(r,l){switch(r){case 0:this.x=l;break;case 1:this.y=l;break;default:throw new Error("index is out of range: "+r)}return this}getComponent(r){switch(r){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+r)}}clone(){return new this.constructor(this.x,this.y)}copy(r){return this.x=r.x,this.y=r.y,this}add(r){return this.x+=r.x,this.y+=r.y,this}addScalar(r){return this.x+=r,this.y+=r,this}addVectors(r,l){return this.x=r.x+l.x,this.y=r.y+l.y,this}addScaledVector(r,l){return this.x+=r.x*l,this.y+=r.y*l,this}sub(r){return this.x-=r.x,this.y-=r.y,this}subScalar(r){return this.x-=r,this.y-=r,this}subVectors(r,l){return this.x=r.x-l.x,this.y=r.y-l.y,this}multiply(r){return this.x*=r.x,this.y*=r.y,this}multiplyScalar(r){return this.x*=r,this.y*=r,this}divide(r){return this.x/=r.x,this.y/=r.y,this}divideScalar(r){return this.multiplyScalar(1/r)}applyMatrix3(r){const l=this.x,h=this.y,p=r.elements;return this.x=p[0]*l+p[3]*h+p[6],this.y=p[1]*l+p[4]*h+p[7],this}min(r){return this.x=Math.min(this.x,r.x),this.y=Math.min(this.y,r.y),this}max(r){return this.x=Math.max(this.x,r.x),this.y=Math.max(this.y,r.y),this}clamp(r,l){return this.x=ki(this.x,r.x,l.x),this.y=ki(this.y,r.y,l.y),this}clampScalar(r,l){return this.x=ki(this.x,r,l),this.y=ki(this.y,r,l),this}clampLength(r,l){const h=this.length();return this.divideScalar(h||1).multiplyScalar(ki(h,r,l))}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(r){return this.x*r.x+this.y*r.y}cross(r){return this.x*r.y-this.y*r.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(r){const l=Math.sqrt(this.lengthSq()*r.lengthSq());if(l===0)return Math.PI/2;const h=this.dot(r)/l;return Math.acos(ki(h,-1,1))}distanceTo(r){return Math.sqrt(this.distanceToSquared(r))}distanceToSquared(r){const l=this.x-r.x,h=this.y-r.y;return l*l+h*h}manhattanDistanceTo(r){return Math.abs(this.x-r.x)+Math.abs(this.y-r.y)}setLength(r){return this.normalize().multiplyScalar(r)}lerp(r,l){return this.x+=(r.x-this.x)*l,this.y+=(r.y-this.y)*l,this}lerpVectors(r,l,h){return this.x=r.x+(l.x-r.x)*h,this.y=r.y+(l.y-r.y)*h,this}equals(r){return r.x===this.x&&r.y===this.y}fromArray(r,l=0){return this.x=r[l],this.y=r[l+1],this}toArray(r=[],l=0){return r[l]=this.x,r[l+1]=this.y,r}fromBufferAttribute(r,l){return this.x=r.getX(l),this.y=r.getY(l),this}rotateAround(r,l){const h=Math.cos(l),p=Math.sin(l),y=this.x-r.x,T=this.y-r.y;return this.x=y*h-T*p+r.x,this.y=y*p+T*h+r.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class Du{constructor(r=0,l=0,h=0,p=1){this.isQuaternion=!0,this._x=r,this._y=l,this._z=h,this._w=p}static slerpFlat(r,l,h,p,y,T,O){let te=h[p+0],se=h[p+1],xe=h[p+2],Ne=h[p+3],Ve=y[T+0],We=y[T+1],tt=y[T+2],Ot=y[T+3];if(O<=0){r[l+0]=te,r[l+1]=se,r[l+2]=xe,r[l+3]=Ne;return}if(O>=1){r[l+0]=Ve,r[l+1]=We,r[l+2]=tt,r[l+3]=Ot;return}if(Ne!==Ot||te!==Ve||se!==We||xe!==tt){let An=te*Ve+se*We+xe*tt+Ne*Ot;An<0&&(Ve=-Ve,We=-We,tt=-tt,Ot=-Ot,An=-An);let un=1-O;if(An<.9995){const Un=Math.acos(An),Vn=Math.sin(Un);un=Math.sin(un*Un)/Vn,O=Math.sin(O*Un)/Vn,te=te*un+Ve*O,se=se*un+We*O,xe=xe*un+tt*O,Ne=Ne*un+Ot*O}else{te=te*un+Ve*O,se=se*un+We*O,xe=xe*un+tt*O,Ne=Ne*un+Ot*O;const Un=1/Math.sqrt(te*te+se*se+xe*xe+Ne*Ne);te*=Un,se*=Un,xe*=Un,Ne*=Un}}r[l]=te,r[l+1]=se,r[l+2]=xe,r[l+3]=Ne}static multiplyQuaternionsFlat(r,l,h,p,y,T){const O=h[p],te=h[p+1],se=h[p+2],xe=h[p+3],Ne=y[T],Ve=y[T+1],We=y[T+2],tt=y[T+3];return r[l]=O*tt+xe*Ne+te*We-se*Ve,r[l+1]=te*tt+xe*Ve+se*Ne-O*We,r[l+2]=se*tt+xe*We+O*Ve-te*Ne,r[l+3]=xe*tt-O*Ne-te*Ve-se*We,r}get x(){return this._x}set x(r){this._x=r,this._onChangeCallback()}get y(){return this._y}set y(r){this._y=r,this._onChangeCallback()}get z(){return this._z}set z(r){this._z=r,this._onChangeCallback()}get w(){return this._w}set w(r){this._w=r,this._onChangeCallback()}set(r,l,h,p){return this._x=r,this._y=l,this._z=h,this._w=p,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(r){return this._x=r.x,this._y=r.y,this._z=r.z,this._w=r.w,this._onChangeCallback(),this}setFromEuler(r,l=!0){const h=r._x,p=r._y,y=r._z,T=r._order,O=Math.cos,te=Math.sin,se=O(h/2),xe=O(p/2),Ne=O(y/2),Ve=te(h/2),We=te(p/2),tt=te(y/2);switch(T){case"XYZ":this._x=Ve*xe*Ne+se*We*tt,this._y=se*We*Ne-Ve*xe*tt,this._z=se*xe*tt+Ve*We*Ne,this._w=se*xe*Ne-Ve*We*tt;break;case"YXZ":this._x=Ve*xe*Ne+se*We*tt,this._y=se*We*Ne-Ve*xe*tt,this._z=se*xe*tt-Ve*We*Ne,this._w=se*xe*Ne+Ve*We*tt;break;case"ZXY":this._x=Ve*xe*Ne-se*We*tt,this._y=se*We*Ne+Ve*xe*tt,this._z=se*xe*tt+Ve*We*Ne,this._w=se*xe*Ne-Ve*We*tt;break;case"ZYX":this._x=Ve*xe*Ne-se*We*tt,this._y=se*We*Ne+Ve*xe*tt,this._z=se*xe*tt-Ve*We*Ne,this._w=se*xe*Ne+Ve*We*tt;break;case"YZX":this._x=Ve*xe*Ne+se*We*tt,this._y=se*We*Ne+Ve*xe*tt,this._z=se*xe*tt-Ve*We*Ne,this._w=se*xe*Ne-Ve*We*tt;break;case"XZY":this._x=Ve*xe*Ne-se*We*tt,this._y=se*We*Ne-Ve*xe*tt,this._z=se*xe*tt+Ve*We*Ne,this._w=se*xe*Ne+Ve*We*tt;break;default:na("Quaternion: .setFromEuler() encountered an unknown order: "+T)}return l===!0&&this._onChangeCallback(),this}setFromAxisAngle(r,l){const h=l/2,p=Math.sin(h);return this._x=r.x*p,this._y=r.y*p,this._z=r.z*p,this._w=Math.cos(h),this._onChangeCallback(),this}setFromRotationMatrix(r){const l=r.elements,h=l[0],p=l[4],y=l[8],T=l[1],O=l[5],te=l[9],se=l[2],xe=l[6],Ne=l[10],Ve=h+O+Ne;if(Ve>0){const We=.5/Math.sqrt(Ve+1);this._w=.25/We,this._x=(xe-te)*We,this._y=(y-se)*We,this._z=(T-p)*We}else if(h>O&&h>Ne){const We=2*Math.sqrt(1+h-O-Ne);this._w=(xe-te)/We,this._x=.25*We,this._y=(p+T)/We,this._z=(y+se)/We}else if(O>Ne){const We=2*Math.sqrt(1+O-h-Ne);this._w=(y-se)/We,this._x=(p+T)/We,this._y=.25*We,this._z=(te+xe)/We}else{const We=2*Math.sqrt(1+Ne-h-O);this._w=(T-p)/We,this._x=(y+se)/We,this._y=(te+xe)/We,this._z=.25*We}return this._onChangeCallback(),this}setFromUnitVectors(r,l){let h=r.dot(l)+1;return h<1e-8?(h=0,Math.abs(r.x)>Math.abs(r.z)?(this._x=-r.y,this._y=r.x,this._z=0,this._w=h):(this._x=0,this._y=-r.z,this._z=r.y,this._w=h)):(this._x=r.y*l.z-r.z*l.y,this._y=r.z*l.x-r.x*l.z,this._z=r.x*l.y-r.y*l.x,this._w=h),this.normalize()}angleTo(r){return 2*Math.acos(Math.abs(ki(this.dot(r),-1,1)))}rotateTowards(r,l){const h=this.angleTo(r);if(h===0)return this;const p=Math.min(1,l/h);return this.slerp(r,p),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(r){return this._x*r._x+this._y*r._y+this._z*r._z+this._w*r._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 r=this.length();return r===0?(this._x=0,this._y=0,this._z=0,this._w=1):(r=1/r,this._x=this._x*r,this._y=this._y*r,this._z=this._z*r,this._w=this._w*r),this._onChangeCallback(),this}multiply(r){return this.multiplyQuaternions(this,r)}premultiply(r){return this.multiplyQuaternions(r,this)}multiplyQuaternions(r,l){const h=r._x,p=r._y,y=r._z,T=r._w,O=l._x,te=l._y,se=l._z,xe=l._w;return this._x=h*xe+T*O+p*se-y*te,this._y=p*xe+T*te+y*O-h*se,this._z=y*xe+T*se+h*te-p*O,this._w=T*xe-h*O-p*te-y*se,this._onChangeCallback(),this}slerp(r,l){if(l<=0)return this;if(l>=1)return this.copy(r);let h=r._x,p=r._y,y=r._z,T=r._w,O=this.dot(r);O<0&&(h=-h,p=-p,y=-y,T=-T,O=-O);let te=1-l;if(O<.9995){const se=Math.acos(O),xe=Math.sin(se);te=Math.sin(te*se)/xe,l=Math.sin(l*se)/xe,this._x=this._x*te+h*l,this._y=this._y*te+p*l,this._z=this._z*te+y*l,this._w=this._w*te+T*l,this._onChangeCallback()}else this._x=this._x*te+h*l,this._y=this._y*te+p*l,this._z=this._z*te+y*l,this._w=this._w*te+T*l,this.normalize();return this}slerpQuaternions(r,l,h){return this.copy(r).slerp(l,h)}random(){const r=2*Math.PI*Math.random(),l=2*Math.PI*Math.random(),h=Math.random(),p=Math.sqrt(1-h),y=Math.sqrt(h);return this.set(p*Math.sin(r),p*Math.cos(r),y*Math.sin(l),y*Math.cos(l))}equals(r){return r._x===this._x&&r._y===this._y&&r._z===this._z&&r._w===this._w}fromArray(r,l=0){return this._x=r[l],this._y=r[l+1],this._z=r[l+2],this._w=r[l+3],this._onChangeCallback(),this}toArray(r=[],l=0){return r[l]=this._x,r[l+1]=this._y,r[l+2]=this._z,r[l+3]=this._w,r}fromBufferAttribute(r,l){return this._x=r.getX(l),this._y=r.getY(l),this._z=r.getZ(l),this._w=r.getW(l),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(r){return this._onChangeCallback=r,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class kn{constructor(r=0,l=0,h=0){kn.prototype.isVector3=!0,this.x=r,this.y=l,this.z=h}set(r,l,h){return h===void 0&&(h=this.z),this.x=r,this.y=l,this.z=h,this}setScalar(r){return this.x=r,this.y=r,this.z=r,this}setX(r){return this.x=r,this}setY(r){return this.y=r,this}setZ(r){return this.z=r,this}setComponent(r,l){switch(r){case 0:this.x=l;break;case 1:this.y=l;break;case 2:this.z=l;break;default:throw new Error("index is out of range: "+r)}return this}getComponent(r){switch(r){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+r)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(r){return this.x=r.x,this.y=r.y,this.z=r.z,this}add(r){return this.x+=r.x,this.y+=r.y,this.z+=r.z,this}addScalar(r){return this.x+=r,this.y+=r,this.z+=r,this}addVectors(r,l){return this.x=r.x+l.x,this.y=r.y+l.y,this.z=r.z+l.z,this}addScaledVector(r,l){return this.x+=r.x*l,this.y+=r.y*l,this.z+=r.z*l,this}sub(r){return this.x-=r.x,this.y-=r.y,this.z-=r.z,this}subScalar(r){return this.x-=r,this.y-=r,this.z-=r,this}subVectors(r,l){return this.x=r.x-l.x,this.y=r.y-l.y,this.z=r.z-l.z,this}multiply(r){return this.x*=r.x,this.y*=r.y,this.z*=r.z,this}multiplyScalar(r){return this.x*=r,this.y*=r,this.z*=r,this}multiplyVectors(r,l){return this.x=r.x*l.x,this.y=r.y*l.y,this.z=r.z*l.z,this}applyEuler(r){return this.applyQuaternion(Yh.setFromEuler(r))}applyAxisAngle(r,l){return this.applyQuaternion(Yh.setFromAxisAngle(r,l))}applyMatrix3(r){const l=this.x,h=this.y,p=this.z,y=r.elements;return this.x=y[0]*l+y[3]*h+y[6]*p,this.y=y[1]*l+y[4]*h+y[7]*p,this.z=y[2]*l+y[5]*h+y[8]*p,this}applyNormalMatrix(r){return this.applyMatrix3(r).normalize()}applyMatrix4(r){const l=this.x,h=this.y,p=this.z,y=r.elements,T=1/(y[3]*l+y[7]*h+y[11]*p+y[15]);return this.x=(y[0]*l+y[4]*h+y[8]*p+y[12])*T,this.y=(y[1]*l+y[5]*h+y[9]*p+y[13])*T,this.z=(y[2]*l+y[6]*h+y[10]*p+y[14])*T,this}applyQuaternion(r){const l=this.x,h=this.y,p=this.z,y=r.x,T=r.y,O=r.z,te=r.w,se=2*(T*p-O*h),xe=2*(O*l-y*p),Ne=2*(y*h-T*l);return this.x=l+te*se+T*Ne-O*xe,this.y=h+te*xe+O*se-y*Ne,this.z=p+te*Ne+y*xe-T*se,this}project(r){return this.applyMatrix4(r.matrixWorldInverse).applyMatrix4(r.projectionMatrix)}unproject(r){return this.applyMatrix4(r.projectionMatrixInverse).applyMatrix4(r.matrixWorld)}transformDirection(r){const l=this.x,h=this.y,p=this.z,y=r.elements;return this.x=y[0]*l+y[4]*h+y[8]*p,this.y=y[1]*l+y[5]*h+y[9]*p,this.z=y[2]*l+y[6]*h+y[10]*p,this.normalize()}divide(r){return this.x/=r.x,this.y/=r.y,this.z/=r.z,this}divideScalar(r){return this.multiplyScalar(1/r)}min(r){return this.x=Math.min(this.x,r.x),this.y=Math.min(this.y,r.y),this.z=Math.min(this.z,r.z),this}max(r){return this.x=Math.max(this.x,r.x),this.y=Math.max(this.y,r.y),this.z=Math.max(this.z,r.z),this}clamp(r,l){return this.x=ki(this.x,r.x,l.x),this.y=ki(this.y,r.y,l.y),this.z=ki(this.z,r.z,l.z),this}clampScalar(r,l){return this.x=ki(this.x,r,l),this.y=ki(this.y,r,l),this.z=ki(this.z,r,l),this}clampLength(r,l){const h=this.length();return this.divideScalar(h||1).multiplyScalar(ki(h,r,l))}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(r){return this.x*r.x+this.y*r.y+this.z*r.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(r){return this.normalize().multiplyScalar(r)}lerp(r,l){return this.x+=(r.x-this.x)*l,this.y+=(r.y-this.y)*l,this.z+=(r.z-this.z)*l,this}lerpVectors(r,l,h){return this.x=r.x+(l.x-r.x)*h,this.y=r.y+(l.y-r.y)*h,this.z=r.z+(l.z-r.z)*h,this}cross(r){return this.crossVectors(this,r)}crossVectors(r,l){const h=r.x,p=r.y,y=r.z,T=l.x,O=l.y,te=l.z;return this.x=p*te-y*O,this.y=y*T-h*te,this.z=h*O-p*T,this}projectOnVector(r){const l=r.lengthSq();if(l===0)return this.set(0,0,0);const h=r.dot(this)/l;return this.copy(r).multiplyScalar(h)}projectOnPlane(r){return kd.copy(this).projectOnVector(r),this.sub(kd)}reflect(r){return this.sub(kd.copy(r).multiplyScalar(2*this.dot(r)))}angleTo(r){const l=Math.sqrt(this.lengthSq()*r.lengthSq());if(l===0)return Math.PI/2;const h=this.dot(r)/l;return Math.acos(ki(h,-1,1))}distanceTo(r){return Math.sqrt(this.distanceToSquared(r))}distanceToSquared(r){const l=this.x-r.x,h=this.y-r.y,p=this.z-r.z;return l*l+h*h+p*p}manhattanDistanceTo(r){return Math.abs(this.x-r.x)+Math.abs(this.y-r.y)+Math.abs(this.z-r.z)}setFromSpherical(r){return this.setFromSphericalCoords(r.radius,r.phi,r.theta)}setFromSphericalCoords(r,l,h){const p=Math.sin(l)*r;return this.x=p*Math.sin(h),this.y=Math.cos(l)*r,this.z=p*Math.cos(h),this}setFromCylindrical(r){return this.setFromCylindricalCoords(r.radius,r.theta,r.y)}setFromCylindricalCoords(r,l,h){return this.x=r*Math.sin(l),this.y=h,this.z=r*Math.cos(l),this}setFromMatrixPosition(r){const l=r.elements;return this.x=l[12],this.y=l[13],this.z=l[14],this}setFromMatrixScale(r){const l=this.setFromMatrixColumn(r,0).length(),h=this.setFromMatrixColumn(r,1).length(),p=this.setFromMatrixColumn(r,2).length();return this.x=l,this.y=h,this.z=p,this}setFromMatrixColumn(r,l){return this.fromArray(r.elements,l*4)}setFromMatrix3Column(r,l){return this.fromArray(r.elements,l*3)}setFromEuler(r){return this.x=r._x,this.y=r._y,this.z=r._z,this}setFromColor(r){return this.x=r.r,this.y=r.g,this.z=r.b,this}equals(r){return r.x===this.x&&r.y===this.y&&r.z===this.z}fromArray(r,l=0){return this.x=r[l],this.y=r[l+1],this.z=r[l+2],this}toArray(r=[],l=0){return r[l]=this.x,r[l+1]=this.y,r[l+2]=this.z,r}fromBufferAttribute(r,l){return this.x=r.getX(l),this.y=r.getY(l),this.z=r.getZ(l),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const r=Math.random()*Math.PI*2,l=Math.random()*2-1,h=Math.sqrt(1-l*l);return this.x=h*Math.cos(r),this.y=l,this.z=h*Math.sin(r),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const kd=new kn,Yh=new Du;class vl{constructor(r,l,h,p,y,T,O,te,se){vl.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],r!==void 0&&this.set(r,l,h,p,y,T,O,te,se)}set(r,l,h,p,y,T,O,te,se){const xe=this.elements;return xe[0]=r,xe[1]=p,xe[2]=O,xe[3]=l,xe[4]=y,xe[5]=te,xe[6]=h,xe[7]=T,xe[8]=se,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(r){const l=this.elements,h=r.elements;return l[0]=h[0],l[1]=h[1],l[2]=h[2],l[3]=h[3],l[4]=h[4],l[5]=h[5],l[6]=h[6],l[7]=h[7],l[8]=h[8],this}extractBasis(r,l,h){return r.setFromMatrix3Column(this,0),l.setFromMatrix3Column(this,1),h.setFromMatrix3Column(this,2),this}setFromMatrix4(r){const l=r.elements;return this.set(l[0],l[4],l[8],l[1],l[5],l[9],l[2],l[6],l[10]),this}multiply(r){return this.multiplyMatrices(this,r)}premultiply(r){return this.multiplyMatrices(r,this)}multiplyMatrices(r,l){const h=r.elements,p=l.elements,y=this.elements,T=h[0],O=h[3],te=h[6],se=h[1],xe=h[4],Ne=h[7],Ve=h[2],We=h[5],tt=h[8],Ot=p[0],An=p[3],un=p[6],Un=p[1],Vn=p[4],nr=p[7],ii=p[2],pi=p[5],Bi=p[8];return y[0]=T*Ot+O*Un+te*ii,y[3]=T*An+O*Vn+te*pi,y[6]=T*un+O*nr+te*Bi,y[1]=se*Ot+xe*Un+Ne*ii,y[4]=se*An+xe*Vn+Ne*pi,y[7]=se*un+xe*nr+Ne*Bi,y[2]=Ve*Ot+We*Un+tt*ii,y[5]=Ve*An+We*Vn+tt*pi,y[8]=Ve*un+We*nr+tt*Bi,this}multiplyScalar(r){const l=this.elements;return l[0]*=r,l[3]*=r,l[6]*=r,l[1]*=r,l[4]*=r,l[7]*=r,l[2]*=r,l[5]*=r,l[8]*=r,this}determinant(){const r=this.elements,l=r[0],h=r[1],p=r[2],y=r[3],T=r[4],O=r[5],te=r[6],se=r[7],xe=r[8];return l*T*xe-l*O*se-h*y*xe+h*O*te+p*y*se-p*T*te}invert(){const r=this.elements,l=r[0],h=r[1],p=r[2],y=r[3],T=r[4],O=r[5],te=r[6],se=r[7],xe=r[8],Ne=xe*T-O*se,Ve=O*te-xe*y,We=se*y-T*te,tt=l*Ne+h*Ve+p*We;if(tt===0)return this.set(0,0,0,0,0,0,0,0,0);const Ot=1/tt;return r[0]=Ne*Ot,r[1]=(p*se-xe*h)*Ot,r[2]=(O*h-p*T)*Ot,r[3]=Ve*Ot,r[4]=(xe*l-p*te)*Ot,r[5]=(p*y-O*l)*Ot,r[6]=We*Ot,r[7]=(h*te-se*l)*Ot,r[8]=(T*l-h*y)*Ot,this}transpose(){let r;const l=this.elements;return r=l[1],l[1]=l[3],l[3]=r,r=l[2],l[2]=l[6],l[6]=r,r=l[5],l[5]=l[7],l[7]=r,this}getNormalMatrix(r){return this.setFromMatrix4(r).invert().transpose()}transposeIntoArray(r){const l=this.elements;return r[0]=l[0],r[1]=l[3],r[2]=l[6],r[3]=l[1],r[4]=l[4],r[5]=l[7],r[6]=l[2],r[7]=l[5],r[8]=l[8],this}setUvTransform(r,l,h,p,y,T,O){const te=Math.cos(y),se=Math.sin(y);return this.set(h*te,h*se,-h*(te*T+se*O)+T+r,-p*se,p*te,-p*(-se*T+te*O)+O+l,0,0,1),this}scale(r,l){return this.premultiply(He.makeScale(r,l)),this}rotate(r){return this.premultiply(He.makeRotation(-r)),this}translate(r,l){return this.premultiply(He.makeTranslation(r,l)),this}makeTranslation(r,l){return r.isVector2?this.set(1,0,r.x,0,1,r.y,0,0,1):this.set(1,0,r,0,1,l,0,0,1),this}makeRotation(r){const l=Math.cos(r),h=Math.sin(r);return this.set(l,-h,0,h,l,0,0,0,1),this}makeScale(r,l){return this.set(r,0,0,0,l,0,0,0,1),this}equals(r){const l=this.elements,h=r.elements;for(let p=0;p<9;p++)if(l[p]!==h[p])return!1;return!0}fromArray(r,l=0){for(let h=0;h<9;h++)this.elements[h]=r[h+l];return this}toArray(r=[],l=0){const h=this.elements;return r[l]=h[0],r[l+1]=h[1],r[l+2]=h[2],r[l+3]=h[3],r[l+4]=h[4],r[l+5]=h[5],r[l+6]=h[6],r[l+7]=h[7],r[l+8]=h[8],r}clone(){return new this.constructor().fromArray(this.elements)}}const He=new vl,me=new vl().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),ce=new vl().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function Ze(){const ue={enabled:!0,workingColorSpace:Ll,spaces:{},convert:function(p,y,T){return this.enabled===!1||y===T||!y||!T||(this.spaces[y].transfer===ao&&(p.r=Nt(p.r),p.g=Nt(p.g),p.b=Nt(p.b)),this.spaces[y].primaries!==this.spaces[T].primaries&&(p.applyMatrix3(this.spaces[y].toXYZ),p.applyMatrix3(this.spaces[T].fromXYZ)),this.spaces[T].transfer===ao&&(p.r=Dt(p.r),p.g=Dt(p.g),p.b=Dt(p.b))),p},workingToColorSpace:function(p,y){return this.convert(p,this.workingColorSpace,y)},colorSpaceToWorking:function(p,y){return this.convert(p,y,this.workingColorSpace)},getPrimaries:function(p){return this.spaces[p].primaries},getTransfer:function(p){return p===il?Lu:this.spaces[p].transfer},getToneMappingMode:function(p){return this.spaces[p].outputColorSpaceConfig.toneMappingMode||"standard"},getLuminanceCoefficients:function(p,y=this.workingColorSpace){return p.fromArray(this.spaces[y].luminanceCoefficients)},define:function(p){Object.assign(this.spaces,p)},_getMatrix:function(p,y,T){return p.copy(this.spaces[y].toXYZ).multiply(this.spaces[T].fromXYZ)},_getDrawingBufferColorSpace:function(p){return this.spaces[p].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(p=this.workingColorSpace){return this.spaces[p].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(p,y){return yh("ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),ue.workingToColorSpace(p,y)},toWorkingColorSpace:function(p,y){return yh("ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),ue.colorSpaceToWorking(p,y)}},r=[.64,.33,.3,.6,.15,.06],l=[.2126,.7152,.0722],h=[.3127,.329];return ue.define({[Ll]:{primaries:r,whitePoint:h,transfer:Lu,toXYZ:me,fromXYZ:ce,luminanceCoefficients:l,workingColorSpaceConfig:{unpackColorSpace:go},outputColorSpaceConfig:{drawingBufferColorSpace:go}},[go]:{primaries:r,whitePoint:h,transfer:ao,toXYZ:me,fromXYZ:ce,luminanceCoefficients:l,outputColorSpaceConfig:{drawingBufferColorSpace:go}}}),ue}const le=Ze();function Nt(ue){return ue<.04045?ue*.0773993808:Math.pow(ue*.9478672986+.0521327014,2.4)}function Dt(ue){return ue<.0031308?ue*12.92:1.055*Math.pow(ue,.41666)-.055}let pn;class Dn{static getDataURL(r,l="image/png"){if(/^data:/i.test(r.src)||typeof HTMLCanvasElement=="undefined")return r.src;let h;if(r instanceof HTMLCanvasElement)h=r;else{pn===void 0&&(pn=To("canvas")),pn.width=r.width,pn.height=r.height;const p=pn.getContext("2d");r instanceof ImageData?p.putImageData(r,0,0):p.drawImage(r,0,0,r.width,r.height),h=pn}return h.toDataURL(l)}static sRGBToLinear(r){if(typeof HTMLImageElement!="undefined"&&r instanceof HTMLImageElement||typeof HTMLCanvasElement!="undefined"&&r instanceof HTMLCanvasElement||typeof ImageBitmap!="undefined"&&r instanceof ImageBitmap){const l=To("canvas");l.width=r.width,l.height=r.height;const h=l.getContext("2d");h.drawImage(r,0,0,r.width,r.height);const p=h.getImageData(0,0,r.width,r.height),y=p.data;for(let T=0;T<y.length;T++)y[T]=Nt(y[T]/255)*255;return h.putImageData(p,0,0),l}else if(r.data){const l=r.data.slice(0);for(let h=0;h<l.length;h++)l instanceof Uint8Array||l instanceof Uint8ClampedArray?l[h]=Math.floor(Nt(l[h]/255)*255):l[h]=Nt(l[h]);return{data:l,width:r.width,height:r.height}}else return na("ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),r}}let hr=0;class br{constructor(r=null){this.isSource=!0,Object.defineProperty(this,"id",{value:hr++}),this.uuid=Gr(),this.data=r,this.dataReady=!0,this.version=0}getSize(r){const l=this.data;return typeof HTMLVideoElement!="undefined"&&l instanceof HTMLVideoElement?r.set(l.videoWidth,l.videoHeight,0):l instanceof VideoFrame?r.set(l.displayHeight,l.displayWidth,0):l!==null?r.set(l.width,l.height,l.depth||0):r.set(0,0,0),r}set needsUpdate(r){r===!0&&this.version++}toJSON(r){const l=r===void 0||typeof r=="string";if(!l&&r.images[this.uuid]!==void 0)return r.images[this.uuid];const h={uuid:this.uuid,url:""},p=this.data;if(p!==null){let y;if(Array.isArray(p)){y=[];for(let T=0,O=p.length;T<O;T++)p[T].isDataTexture?y.push(yr(p[T].image)):y.push(yr(p[T]))}else y=yr(p);h.url=y}return l||(r.images[this.uuid]=h),h}}function yr(ue){return typeof HTMLImageElement!="undefined"&&ue instanceof HTMLImageElement||typeof HTMLCanvasElement!="undefined"&&ue instanceof HTMLCanvasElement||typeof ImageBitmap!="undefined"&&ue instanceof ImageBitmap?Dn.getDataURL(ue):ue.data?{data:Array.from(ue.data),width:ue.width,height:ue.height,type:ue.data.constructor.name}:(na("Texture: Unable to serialize Texture."),{})}let xr=0;const Fr=new kn;class ri extends Tu{constructor(r=ri.DEFAULT_IMAGE,l=ri.DEFAULT_MAPPING,h=Vt,p=Vt,y=vr,T=yi,O=L,te=es,se=ri.DEFAULT_ANISOTROPY,xe=il){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:xr++}),this.uuid=Gr(),this.name="",this.source=new br(r),this.mipmaps=[],this.mapping=l,this.channel=0,this.wrapS=h,this.wrapT=p,this.magFilter=y,this.minFilter=T,this.anisotropy=se,this.format=O,this.internalFormat=null,this.type=te,this.offset=new qi(0,0),this.repeat=new qi(1,1),this.center=new qi(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new vl,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=xe,this.userData={},this.updateRanges=[],this.version=0,this.onUpdate=null,this.renderTarget=null,this.isRenderTargetTexture=!1,this.isArrayTexture=!!(r&&r.depth&&r.depth>1),this.pmremVersion=0}get width(){return this.source.getSize(Fr).x}get height(){return this.source.getSize(Fr).y}get depth(){return this.source.getSize(Fr).z}get image(){return this.source.data}set image(r=null){this.source.data=r}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}addUpdateRange(r,l){this.updateRanges.push({start:r,count:l})}clearUpdateRanges(){this.updateRanges.length=0}clone(){return new this.constructor().copy(this)}copy(r){return this.name=r.name,this.source=r.source,this.mipmaps=r.mipmaps.slice(0),this.mapping=r.mapping,this.channel=r.channel,this.wrapS=r.wrapS,this.wrapT=r.wrapT,this.magFilter=r.magFilter,this.minFilter=r.minFilter,this.anisotropy=r.anisotropy,this.format=r.format,this.internalFormat=r.internalFormat,this.type=r.type,this.offset.copy(r.offset),this.repeat.copy(r.repeat),this.center.copy(r.center),this.rotation=r.rotation,this.matrixAutoUpdate=r.matrixAutoUpdate,this.matrix.copy(r.matrix),this.generateMipmaps=r.generateMipmaps,this.premultiplyAlpha=r.premultiplyAlpha,this.flipY=r.flipY,this.unpackAlignment=r.unpackAlignment,this.colorSpace=r.colorSpace,this.renderTarget=r.renderTarget,this.isRenderTargetTexture=r.isRenderTargetTexture,this.isArrayTexture=r.isArrayTexture,this.userData=JSON.parse(JSON.stringify(r.userData)),this.needsUpdate=!0,this}setValues(r){for(const l in r){const h=r[l];if(h===void 0){na(`Texture.setValues(): parameter '${l}' has value of undefined.`);continue}const p=this[l];if(p===void 0){na(`Texture.setValues(): property '${l}' does not exist.`);continue}p&&h&&p.isVector2&&h.isVector2||p&&h&&p.isVector3&&h.isVector3||p&&h&&p.isMatrix3&&h.isMatrix3?p.copy(h):this[l]=h}}toJSON(r){const l=r===void 0||typeof r=="string";if(!l&&r.textures[this.uuid]!==void 0)return r.textures[this.uuid];const h={metadata:{version:4.7,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(r).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(h.userData=this.userData),l||(r.textures[this.uuid]=h),h}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(r){if(this.mapping!==be)return r;if(r.applyMatrix3(this.matrix),r.x<0||r.x>1)switch(this.wrapS){case $t:r.x=r.x-Math.floor(r.x);break;case Vt:r.x=r.x<0?0:1;break;case Qt:Math.abs(Math.floor(r.x)%2)===1?r.x=Math.ceil(r.x)-r.x:r.x=r.x-Math.floor(r.x);break}if(r.y<0||r.y>1)switch(this.wrapT){case $t:r.y=r.y-Math.floor(r.y);break;case Vt:r.y=r.y<0?0:1;break;case Qt:Math.abs(Math.floor(r.y)%2)===1?r.y=Math.ceil(r.y)-r.y:r.y=r.y-Math.floor(r.y);break}return this.flipY&&(r.y=1-r.y),r}set needsUpdate(r){r===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(r){r===!0&&this.pmremVersion++}}ri.DEFAULT_IMAGE=null,ri.DEFAULT_MAPPING=be,ri.DEFAULT_ANISOTROPY=1;class ai{constructor(r=0,l=0,h=0,p=1){ai.prototype.isVector4=!0,this.x=r,this.y=l,this.z=h,this.w=p}get width(){return this.z}set width(r){this.z=r}get height(){return this.w}set height(r){this.w=r}set(r,l,h,p){return this.x=r,this.y=l,this.z=h,this.w=p,this}setScalar(r){return this.x=r,this.y=r,this.z=r,this.w=r,this}setX(r){return this.x=r,this}setY(r){return this.y=r,this}setZ(r){return this.z=r,this}setW(r){return this.w=r,this}setComponent(r,l){switch(r){case 0:this.x=l;break;case 1:this.y=l;break;case 2:this.z=l;break;case 3:this.w=l;break;default:throw new Error("index is out of range: "+r)}return this}getComponent(r){switch(r){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: "+r)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(r){return this.x=r.x,this.y=r.y,this.z=r.z,this.w=r.w!==void 0?r.w:1,this}add(r){return this.x+=r.x,this.y+=r.y,this.z+=r.z,this.w+=r.w,this}addScalar(r){return this.x+=r,this.y+=r,this.z+=r,this.w+=r,this}addVectors(r,l){return this.x=r.x+l.x,this.y=r.y+l.y,this.z=r.z+l.z,this.w=r.w+l.w,this}addScaledVector(r,l){return this.x+=r.x*l,this.y+=r.y*l,this.z+=r.z*l,this.w+=r.w*l,this}sub(r){return this.x-=r.x,this.y-=r.y,this.z-=r.z,this.w-=r.w,this}subScalar(r){return this.x-=r,this.y-=r,this.z-=r,this.w-=r,this}subVectors(r,l){return this.x=r.x-l.x,this.y=r.y-l.y,this.z=r.z-l.z,this.w=r.w-l.w,this}multiply(r){return this.x*=r.x,this.y*=r.y,this.z*=r.z,this.w*=r.w,this}multiplyScalar(r){return this.x*=r,this.y*=r,this.z*=r,this.w*=r,this}applyMatrix4(r){const l=this.x,h=this.y,p=this.z,y=this.w,T=r.elements;return this.x=T[0]*l+T[4]*h+T[8]*p+T[12]*y,this.y=T[1]*l+T[5]*h+T[9]*p+T[13]*y,this.z=T[2]*l+T[6]*h+T[10]*p+T[14]*y,this.w=T[3]*l+T[7]*h+T[11]*p+T[15]*y,this}divide(r){return this.x/=r.x,this.y/=r.y,this.z/=r.z,this.w/=r.w,this}divideScalar(r){return this.multiplyScalar(1/r)}setAxisAngleFromQuaternion(r){this.w=2*Math.acos(r.w);const l=Math.sqrt(1-r.w*r.w);return l<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=r.x/l,this.y=r.y/l,this.z=r.z/l),this}setAxisAngleFromRotationMatrix(r){let l,h,p,y;const te=r.elements,se=te[0],xe=te[4],Ne=te[8],Ve=te[1],We=te[5],tt=te[9],Ot=te[2],An=te[6],un=te[10];if(Math.abs(xe-Ve)<.01&&Math.abs(Ne-Ot)<.01&&Math.abs(tt-An)<.01){if(Math.abs(xe+Ve)<.1&&Math.abs(Ne+Ot)<.1&&Math.abs(tt+An)<.1&&Math.abs(se+We+un-3)<.1)return this.set(1,0,0,0),this;l=Math.PI;const Vn=(se+1)/2,nr=(We+1)/2,ii=(un+1)/2,pi=(xe+Ve)/4,Bi=(Ne+Ot)/4,mi=(tt+An)/4;return Vn>nr&&Vn>ii?Vn<.01?(h=0,p=.707106781,y=.707106781):(h=Math.sqrt(Vn),p=pi/h,y=Bi/h):nr>ii?nr<.01?(h=.707106781,p=0,y=.707106781):(p=Math.sqrt(nr),h=pi/p,y=mi/p):ii<.01?(h=.707106781,p=.707106781,y=0):(y=Math.sqrt(ii),h=Bi/y,p=mi/y),this.set(h,p,y,l),this}let Un=Math.sqrt((An-tt)*(An-tt)+(Ne-Ot)*(Ne-Ot)+(Ve-xe)*(Ve-xe));return Math.abs(Un)<.001&&(Un=1),this.x=(An-tt)/Un,this.y=(Ne-Ot)/Un,this.z=(Ve-xe)/Un,this.w=Math.acos((se+We+un-1)/2),this}setFromMatrixPosition(r){const l=r.elements;return this.x=l[12],this.y=l[13],this.z=l[14],this.w=l[15],this}min(r){return this.x=Math.min(this.x,r.x),this.y=Math.min(this.y,r.y),this.z=Math.min(this.z,r.z),this.w=Math.min(this.w,r.w),this}max(r){return this.x=Math.max(this.x,r.x),this.y=Math.max(this.y,r.y),this.z=Math.max(this.z,r.z),this.w=Math.max(this.w,r.w),this}clamp(r,l){return this.x=ki(this.x,r.x,l.x),this.y=ki(this.y,r.y,l.y),this.z=ki(this.z,r.z,l.z),this.w=ki(this.w,r.w,l.w),this}clampScalar(r,l){return this.x=ki(this.x,r,l),this.y=ki(this.y,r,l),this.z=ki(this.z,r,l),this.w=ki(this.w,r,l),this}clampLength(r,l){const h=this.length();return this.divideScalar(h||1).multiplyScalar(ki(h,r,l))}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(r){return this.x*r.x+this.y*r.y+this.z*r.z+this.w*r.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(r){return this.normalize().multiplyScalar(r)}lerp(r,l){return this.x+=(r.x-this.x)*l,this.y+=(r.y-this.y)*l,this.z+=(r.z-this.z)*l,this.w+=(r.w-this.w)*l,this}lerpVectors(r,l,h){return this.x=r.x+(l.x-r.x)*h,this.y=r.y+(l.y-r.y)*h,this.z=r.z+(l.z-r.z)*h,this.w=r.w+(l.w-r.w)*h,this}equals(r){return r.x===this.x&&r.y===this.y&&r.z===this.z&&r.w===this.w}fromArray(r,l=0){return this.x=r[l],this.y=r[l+1],this.z=r[l+2],this.w=r[l+3],this}toArray(r=[],l=0){return r[l]=this.x,r[l+1]=this.y,r[l+2]=this.z,r[l+3]=this.w,r}fromBufferAttribute(r,l){return this.x=r.getX(l),this.y=r.getY(l),this.z=r.getZ(l),this.w=r.getW(l),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 wi extends null{constructor(r=1,l=1,h={}){super(),h=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:vr,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1,depth:1,multiview:!1},h),this.isRenderTarget=!0,this.width=r,this.height=l,this.depth=h.depth,this.scissor=new ai(0,0,r,l),this.scissorTest=!1,this.viewport=new ai(0,0,r,l);const p={width:r,height:l,depth:h.depth},y=new ri(p);this.textures=[];const T=h.count;for(let O=0;O<T;O++)this.textures[O]=y.clone(),this.textures[O].isRenderTargetTexture=!0,this.textures[O].renderTarget=this;this._setTextureOptions(h),this.depthBuffer=h.depthBuffer,this.stencilBuffer=h.stencilBuffer,this.resolveDepthBuffer=h.resolveDepthBuffer,this.resolveStencilBuffer=h.resolveStencilBuffer,this._depthTexture=null,this.depthTexture=h.depthTexture,this.samples=h.samples,this.multiview=h.multiview}_setTextureOptions(r={}){const l={minFilter:vr,generateMipmaps:!1,flipY:!1,internalFormat:null};r.mapping!==void 0&&(l.mapping=r.mapping),r.wrapS!==void 0&&(l.wrapS=r.wrapS),r.wrapT!==void 0&&(l.wrapT=r.wrapT),r.wrapR!==void 0&&(l.wrapR=r.wrapR),r.magFilter!==void 0&&(l.magFilter=r.magFilter),r.minFilter!==void 0&&(l.minFilter=r.minFilter),r.format!==void 0&&(l.format=r.format),r.type!==void 0&&(l.type=r.type),r.anisotropy!==void 0&&(l.anisotropy=r.anisotropy),r.colorSpace!==void 0&&(l.colorSpace=r.colorSpace),r.flipY!==void 0&&(l.flipY=r.flipY),r.generateMipmaps!==void 0&&(l.generateMipmaps=r.generateMipmaps),r.internalFormat!==void 0&&(l.internalFormat=r.internalFormat);for(let h=0;h<this.textures.length;h++)this.textures[h].setValues(l)}get texture(){return this.textures[0]}set texture(r){this.textures[0]=r}set depthTexture(r){this._depthTexture!==null&&(this._depthTexture.renderTarget=null),r!==null&&(r.renderTarget=this),this._depthTexture=r}get depthTexture(){return this._depthTexture}setSize(r,l,h=1){if(this.width!==r||this.height!==l||this.depth!==h){this.width=r,this.height=l,this.depth=h;for(let p=0,y=this.textures.length;p<y;p++)this.textures[p].image.width=r,this.textures[p].image.height=l,this.textures[p].image.depth=h,this.textures[p].isData3DTexture!==!0&&(this.textures[p].isArrayTexture=this.textures[p].image.depth>1);this.dispose()}this.viewport.set(0,0,r,l),this.scissor.set(0,0,r,l)}clone(){return new this.constructor().copy(this)}copy(r){this.width=r.width,this.height=r.height,this.depth=r.depth,this.scissor.copy(r.scissor),this.scissorTest=r.scissorTest,this.viewport.copy(r.viewport),this.textures.length=0;for(let l=0,h=r.textures.length;l<h;l++){this.textures[l]=r.textures[l].clone(),this.textures[l].isRenderTargetTexture=!0,this.textures[l].renderTarget=this;const p=Object.assign({},r.textures[l].image);this.textures[l].source=new br(p)}return this.depthBuffer=r.depthBuffer,this.stencilBuffer=r.stencilBuffer,this.resolveDepthBuffer=r.resolveDepthBuffer,this.resolveStencilBuffer=r.resolveStencilBuffer,r.depthTexture!==null&&(this.depthTexture=r.depthTexture.clone()),this.samples=r.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}}class Vi extends null{constructor(r=1,l=1,h={}){super(r,l,h),this.isWebGLRenderTarget=!0}}class rs extends null{constructor(r=null,l=1,h=1,p=1){super(null),this.isDataArrayTexture=!0,this.image={data:r,width:l,height:h,depth:p},this.magFilter=cn,this.minFilter=cn,this.wrapR=Vt,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(r){this.layerUpdates.add(r)}clearLayerUpdates(){this.layerUpdates.clear()}}class as extends null{constructor(r=1,l=1,h=1,p={}){super(r,l,p),this.isWebGLArrayRenderTarget=!0,this.depth=h,this.texture=new rs(null,r,l,h),this._setTextureOptions(p),this.texture.isRenderTargetTexture=!0}}class Bs extends null{constructor(r=null,l=1,h=1,p=1){super(null),this.isData3DTexture=!0,this.image={data:r,width:l,height:h,depth:p},this.magFilter=cn,this.minFilter=cn,this.wrapR=Vt,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class Ls extends null{constructor(r=1,l=1,h=1,p={}){super(r,l,p),this.isWebGL3DRenderTarget=!0,this.depth=h,this.texture=new Bs(null,r,l,h),this._setTextureOptions(p),this.texture.isRenderTargetTexture=!0}}class zi{constructor(r=new kn(1/0,1/0,1/0),l=new kn(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=r,this.max=l}set(r,l){return this.min.copy(r),this.max.copy(l),this}setFromArray(r){this.makeEmpty();for(let l=0,h=r.length;l<h;l+=3)this.expandByPoint(Ns.fromArray(r,l));return this}setFromBufferAttribute(r){this.makeEmpty();for(let l=0,h=r.count;l<h;l++)this.expandByPoint(Ns.fromBufferAttribute(r,l));return this}setFromPoints(r){this.makeEmpty();for(let l=0,h=r.length;l<h;l++)this.expandByPoint(r[l]);return this}setFromCenterAndSize(r,l){const h=Ns.copy(l).multiplyScalar(.5);return this.min.copy(r).sub(h),this.max.copy(r).add(h),this}setFromObject(r,l=!1){return this.makeEmpty(),this.expandByObject(r,l)}clone(){return new this.constructor().copy(this)}copy(r){return this.min.copy(r.min),this.max.copy(r.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(r){return this.isEmpty()?r.set(0,0,0):r.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(r){return this.isEmpty()?r.set(0,0,0):r.subVectors(this.max,this.min)}expandByPoint(r){return this.min.min(r),this.max.max(r),this}expandByVector(r){return this.min.sub(r),this.max.add(r),this}expandByScalar(r){return this.min.addScalar(-r),this.max.addScalar(r),this}expandByObject(r,l=!1){r.updateWorldMatrix(!1,!1);const h=r.geometry;if(h!==void 0){const y=h.getAttribute("position");if(l===!0&&y!==void 0&&r.isInstancedMesh!==!0)for(let T=0,O=y.count;T<O;T++)r.isMesh===!0?r.getVertexPosition(T,Ns):Ns.fromBufferAttribute(y,T),Ns.applyMatrix4(r.matrixWorld),this.expandByPoint(Ns);else r.boundingBox!==void 0?(r.boundingBox===null&&r.computeBoundingBox(),Os.copy(r.boundingBox)):(h.boundingBox===null&&h.computeBoundingBox(),Os.copy(h.boundingBox)),Os.applyMatrix4(r.matrixWorld),this.union(Os)}const p=r.children;for(let y=0,T=p.length;y<T;y++)this.expandByObject(p[y],l);return this}containsPoint(r){return r.x>=this.min.x&&r.x<=this.max.x&&r.y>=this.min.y&&r.y<=this.max.y&&r.z>=this.min.z&&r.z<=this.max.z}containsBox(r){return this.min.x<=r.min.x&&r.max.x<=this.max.x&&this.min.y<=r.min.y&&r.max.y<=this.max.y&&this.min.z<=r.min.z&&r.max.z<=this.max.z}getParameter(r,l){return l.set((r.x-this.min.x)/(this.max.x-this.min.x),(r.y-this.min.y)/(this.max.y-this.min.y),(r.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(r){return r.max.x>=this.min.x&&r.min.x<=this.max.x&&r.max.y>=this.min.y&&r.min.y<=this.max.y&&r.max.z>=this.min.z&&r.min.z<=this.max.z}intersectsSphere(r){return this.clampPoint(r.center,Ns),Ns.distanceToSquared(r.center)<=r.radius*r.radius}intersectsPlane(r){let l,h;return r.normal.x>0?(l=r.normal.x*this.min.x,h=r.normal.x*this.max.x):(l=r.normal.x*this.max.x,h=r.normal.x*this.min.x),r.normal.y>0?(l+=r.normal.y*this.min.y,h+=r.normal.y*this.max.y):(l+=r.normal.y*this.max.y,h+=r.normal.y*this.min.y),r.normal.z>0?(l+=r.normal.z*this.min.z,h+=r.normal.z*this.max.z):(l+=r.normal.z*this.max.z,h+=r.normal.z*this.min.z),l<=-r.constant&&h>=-r.constant}intersectsTriangle(r){if(this.isEmpty())return!1;this.getCenter(fe),Te.subVectors(this.max,fe),_a.subVectors(r.a,fe),Sa.subVectors(r.b,fe),oe.subVectors(r.c,fe),re.subVectors(Sa,_a),Y.subVectors(oe,Sa),J.subVectors(_a,oe);let l=[0,-re.z,re.y,0,-Y.z,Y.y,0,-J.z,J.y,re.z,0,-re.x,Y.z,0,-Y.x,J.z,0,-J.x,-re.y,re.x,0,-Y.y,Y.x,0,-J.y,J.x,0];return!Xe(l,_a,Sa,oe,Te)||(l=[1,0,0,0,1,0,0,0,1],!Xe(l,_a,Sa,oe,Te))?!1:(De.crossVectors(re,Y),l=[De.x,De.y,De.z],Xe(l,_a,Sa,oe,Te))}clampPoint(r,l){return l.copy(r).clamp(this.min,this.max)}distanceToPoint(r){return this.clampPoint(r,Ns).distanceTo(r)}getBoundingSphere(r){return this.isEmpty()?r.makeEmpty():(this.getCenter(r.center),r.radius=this.getSize(Ns).length()*.5),r}intersect(r){return this.min.max(r.min),this.max.min(r.max),this.isEmpty()&&this.makeEmpty(),this}union(r){return this.min.min(r.min),this.max.max(r.max),this}applyMatrix4(r){return this.isEmpty()?this:(Ni[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(r),Ni[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(r),Ni[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(r),Ni[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(r),Ni[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(r),Ni[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(r),Ni[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(r),Ni[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(r),this.setFromPoints(Ni),this)}translate(r){return this.min.add(r),this.max.add(r),this}equals(r){return r.min.equals(this.min)&&r.max.equals(this.max)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(r){return this.min.fromArray(r.min),this.max.fromArray(r.max),this}}const Ni=[new kn,new kn,new kn,new kn,new kn,new kn,new kn,new kn],Ns=new kn,Os=new zi,_a=new kn,Sa=new kn,oe=new kn,re=new kn,Y=new kn,J=new kn,fe=new kn,Te=new kn,De=new kn,Le=new kn;function Xe(ue,r,l,h,p){for(let y=0,T=ue.length-3;y<=T;y+=3){Le.fromArray(ue,y);const O=p.x*Math.abs(Le.x)+p.y*Math.abs(Le.y)+p.z*Math.abs(Le.z),te=r.dot(Le),se=l.dot(Le),xe=h.dot(Le);if(Math.max(-Math.max(te,se,xe),Math.min(te,se,xe))>O)return!1}return!0}const mt=new zi,Kt=new kn,nn=new kn;class gn{constructor(r=new kn,l=-1){this.isSphere=!0,this.center=r,this.radius=l}set(r,l){return this.center.copy(r),this.radius=l,this}setFromPoints(r,l){const h=this.center;l!==void 0?h.copy(l):mt.setFromPoints(r).getCenter(h);let p=0;for(let y=0,T=r.length;y<T;y++)p=Math.max(p,h.distanceToSquared(r[y]));return this.radius=Math.sqrt(p),this}copy(r){return this.center.copy(r.center),this.radius=r.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(r){return r.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(r){return r.distanceTo(this.center)-this.radius}intersectsSphere(r){const l=this.radius+r.radius;return r.center.distanceToSquared(this.center)<=l*l}intersectsBox(r){return r.intersectsSphere(this)}intersectsPlane(r){return Math.abs(r.distanceToPoint(this.center))<=this.radius}clampPoint(r,l){const h=this.center.distanceToSquared(r);return l.copy(r),h>this.radius*this.radius&&(l.sub(this.center).normalize(),l.multiplyScalar(this.radius).add(this.center)),l}getBoundingBox(r){return this.isEmpty()?(r.makeEmpty(),r):(r.set(this.center,this.center),r.expandByScalar(this.radius),r)}applyMatrix4(r){return this.center.applyMatrix4(r),this.radius=this.radius*r.getMaxScaleOnAxis(),this}translate(r){return this.center.add(r),this}expandByPoint(r){if(this.isEmpty())return this.center.copy(r),this.radius=0,this;Kt.subVectors(r,this.center);const l=Kt.lengthSq();if(l>this.radius*this.radius){const h=Math.sqrt(l),p=(h-this.radius)*.5;this.center.addScaledVector(Kt,p/h),this.radius+=p}return this}union(r){return r.isEmpty()?this:this.isEmpty()?(this.copy(r),this):(this.center.equals(r.center)===!0?this.radius=Math.max(this.radius,r.radius):(nn.subVectors(r.center,this.center).setLength(r.radius),this.expandByPoint(Kt.copy(r.center).add(nn)),this.expandByPoint(Kt.copy(r.center).sub(nn))),this)}equals(r){return r.center.equals(this.center)&&r.radius===this.radius}clone(){return new this.constructor().copy(this)}toJSON(){return{radius:this.radius,center:this.center.toArray()}}fromJSON(r){return this.radius=r.radius,this.center.fromArray(r.center),this}}const Nn=new kn,$n=new kn,Er=new kn,mr=new kn,ti=new kn,jr=new kn,ui=new kn;class gi{constructor(r=new kn,l=new kn(0,0,-1)){this.origin=r,this.direction=l}set(r,l){return this.origin.copy(r),this.direction.copy(l),this}copy(r){return this.origin.copy(r.origin),this.direction.copy(r.direction),this}at(r,l){return l.copy(this.origin).addScaledVector(this.direction,r)}lookAt(r){return this.direction.copy(r).sub(this.origin).normalize(),this}recast(r){return this.origin.copy(this.at(r,Nn)),this}closestPointToPoint(r,l){l.subVectors(r,this.origin);const h=l.dot(this.direction);return h<0?l.copy(this.origin):l.copy(this.origin).addScaledVector(this.direction,h)}distanceToPoint(r){return Math.sqrt(this.distanceSqToPoint(r))}distanceSqToPoint(r){const l=Nn.subVectors(r,this.origin).dot(this.direction);return l<0?this.origin.distanceToSquared(r):(Nn.copy(this.origin).addScaledVector(this.direction,l),Nn.distanceToSquared(r))}distanceSqToSegment(r,l,h,p){$n.copy(r).add(l).multiplyScalar(.5),Er.copy(l).sub(r).normalize(),mr.copy(this.origin).sub($n);const y=r.distanceTo(l)*.5,T=-this.direction.dot(Er),O=mr.dot(this.direction),te=-mr.dot(Er),se=mr.lengthSq(),xe=Math.abs(1-T*T);let Ne,Ve,We,tt;if(xe>0)if(Ne=T*te-O,Ve=T*O-te,tt=y*xe,Ne>=0)if(Ve>=-tt)if(Ve<=tt){const Ot=1/xe;Ne*=Ot,Ve*=Ot,We=Ne*(Ne+T*Ve+2*O)+Ve*(T*Ne+Ve+2*te)+se}else Ve=y,Ne=Math.max(0,-(T*Ve+O)),We=-Ne*Ne+Ve*(Ve+2*te)+se;else Ve=-y,Ne=Math.max(0,-(T*Ve+O)),We=-Ne*Ne+Ve*(Ve+2*te)+se;else Ve<=-tt?(Ne=Math.max(0,-(-T*y+O)),Ve=Ne>0?-y:Math.min(Math.max(-y,-te),y),We=-Ne*Ne+Ve*(Ve+2*te)+se):Ve<=tt?(Ne=0,Ve=Math.min(Math.max(-y,-te),y),We=Ve*(Ve+2*te)+se):(Ne=Math.max(0,-(T*y+O)),Ve=Ne>0?y:Math.min(Math.max(-y,-te),y),We=-Ne*Ne+Ve*(Ve+2*te)+se);else Ve=T>0?-y:y,Ne=Math.max(0,-(T*Ve+O)),We=-Ne*Ne+Ve*(Ve+2*te)+se;return h&&h.copy(this.origin).addScaledVector(this.direction,Ne),p&&p.copy($n).addScaledVector(Er,Ve),We}intersectSphere(r,l){Nn.subVectors(r.center,this.origin);const h=Nn.dot(this.direction),p=Nn.dot(Nn)-h*h,y=r.radius*r.radius;if(p>y)return null;const T=Math.sqrt(y-p),O=h-T,te=h+T;return te<0?null:O<0?this.at(te,l):this.at(O,l)}intersectsSphere(r){return r.radius<0?!1:this.distanceSqToPoint(r.center)<=r.radius*r.radius}distanceToPlane(r){const l=r.normal.dot(this.direction);if(l===0)return r.distanceToPoint(this.origin)===0?0:null;const h=-(this.origin.dot(r.normal)+r.constant)/l;return h>=0?h:null}intersectPlane(r,l){const h=this.distanceToPlane(r);return h===null?null:this.at(h,l)}intersectsPlane(r){const l=r.distanceToPoint(this.origin);return l===0||r.normal.dot(this.direction)*l<0}intersectBox(r,l){let h,p,y,T,O,te;const se=1/this.direction.x,xe=1/this.direction.y,Ne=1/this.direction.z,Ve=this.origin;return se>=0?(h=(r.min.x-Ve.x)*se,p=(r.max.x-Ve.x)*se):(h=(r.max.x-Ve.x)*se,p=(r.min.x-Ve.x)*se),xe>=0?(y=(r.min.y-Ve.y)*xe,T=(r.max.y-Ve.y)*xe):(y=(r.max.y-Ve.y)*xe,T=(r.min.y-Ve.y)*xe),h>T||y>p||((y>h||isNaN(h))&&(h=y),(T<p||isNaN(p))&&(p=T),Ne>=0?(O=(r.min.z-Ve.z)*Ne,te=(r.max.z-Ve.z)*Ne):(O=(r.max.z-Ve.z)*Ne,te=(r.min.z-Ve.z)*Ne),h>te||O>p)||((O>h||h!==h)&&(h=O),(te<p||p!==p)&&(p=te),p<0)?null:this.at(h>=0?h:p,l)}intersectsBox(r){return this.intersectBox(r,Nn)!==null}intersectTriangle(r,l,h,p,y){ti.subVectors(l,r),jr.subVectors(h,r),ui.crossVectors(ti,jr);let T=this.direction.dot(ui),O;if(T>0){if(p)return null;O=1}else if(T<0)O=-1,T=-T;else return null;mr.subVectors(this.origin,r);const te=O*this.direction.dot(jr.crossVectors(mr,jr));if(te<0)return null;const se=O*this.direction.dot(ti.cross(mr));if(se<0||te+se>T)return null;const xe=-O*mr.dot(ui);return xe<0?null:this.at(xe/T,y)}applyMatrix4(r){return this.origin.applyMatrix4(r),this.direction.transformDirection(r),this}equals(r){return r.origin.equals(this.origin)&&r.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class oi{constructor(r,l,h,p,y,T,O,te,se,xe,Ne,Ve,We,tt,Ot,An){oi.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],r!==void 0&&this.set(r,l,h,p,y,T,O,te,se,xe,Ne,Ve,We,tt,Ot,An)}set(r,l,h,p,y,T,O,te,se,xe,Ne,Ve,We,tt,Ot,An){const un=this.elements;return un[0]=r,un[4]=l,un[8]=h,un[12]=p,un[1]=y,un[5]=T,un[9]=O,un[13]=te,un[2]=se,un[6]=xe,un[10]=Ne,un[14]=Ve,un[3]=We,un[7]=tt,un[11]=Ot,un[15]=An,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 oi().fromArray(this.elements)}copy(r){const l=this.elements,h=r.elements;return l[0]=h[0],l[1]=h[1],l[2]=h[2],l[3]=h[3],l[4]=h[4],l[5]=h[5],l[6]=h[6],l[7]=h[7],l[8]=h[8],l[9]=h[9],l[10]=h[10],l[11]=h[11],l[12]=h[12],l[13]=h[13],l[14]=h[14],l[15]=h[15],this}copyPosition(r){const l=this.elements,h=r.elements;return l[12]=h[12],l[13]=h[13],l[14]=h[14],this}setFromMatrix3(r){const l=r.elements;return this.set(l[0],l[3],l[6],0,l[1],l[4],l[7],0,l[2],l[5],l[8],0,0,0,0,1),this}extractBasis(r,l,h){return r.setFromMatrixColumn(this,0),l.setFromMatrixColumn(this,1),h.setFromMatrixColumn(this,2),this}makeBasis(r,l,h){return this.set(r.x,l.x,h.x,0,r.y,l.y,h.y,0,r.z,l.z,h.z,0,0,0,0,1),this}extractRotation(r){const l=this.elements,h=r.elements,p=1/ts.setFromMatrixColumn(r,0).length(),y=1/ts.setFromMatrixColumn(r,1).length(),T=1/ts.setFromMatrixColumn(r,2).length();return l[0]=h[0]*p,l[1]=h[1]*p,l[2]=h[2]*p,l[3]=0,l[4]=h[4]*y,l[5]=h[5]*y,l[6]=h[6]*y,l[7]=0,l[8]=h[8]*T,l[9]=h[9]*T,l[10]=h[10]*T,l[11]=0,l[12]=0,l[13]=0,l[14]=0,l[15]=1,this}makeRotationFromEuler(r){const l=this.elements,h=r.x,p=r.y,y=r.z,T=Math.cos(h),O=Math.sin(h),te=Math.cos(p),se=Math.sin(p),xe=Math.cos(y),Ne=Math.sin(y);if(r.order==="XYZ"){const Ve=T*xe,We=T*Ne,tt=O*xe,Ot=O*Ne;l[0]=te*xe,l[4]=-te*Ne,l[8]=se,l[1]=We+tt*se,l[5]=Ve-Ot*se,l[9]=-O*te,l[2]=Ot-Ve*se,l[6]=tt+We*se,l[10]=T*te}else if(r.order==="YXZ"){const Ve=te*xe,We=te*Ne,tt=se*xe,Ot=se*Ne;l[0]=Ve+Ot*O,l[4]=tt*O-We,l[8]=T*se,l[1]=T*Ne,l[5]=T*xe,l[9]=-O,l[2]=We*O-tt,l[6]=Ot+Ve*O,l[10]=T*te}else if(r.order==="ZXY"){const Ve=te*xe,We=te*Ne,tt=se*xe,Ot=se*Ne;l[0]=Ve-Ot*O,l[4]=-T*Ne,l[8]=tt+We*O,l[1]=We+tt*O,l[5]=T*xe,l[9]=Ot-Ve*O,l[2]=-T*se,l[6]=O,l[10]=T*te}else if(r.order==="ZYX"){const Ve=T*xe,We=T*Ne,tt=O*xe,Ot=O*Ne;l[0]=te*xe,l[4]=tt*se-We,l[8]=Ve*se+Ot,l[1]=te*Ne,l[5]=Ot*se+Ve,l[9]=We*se-tt,l[2]=-se,l[6]=O*te,l[10]=T*te}else if(r.order==="YZX"){const Ve=T*te,We=T*se,tt=O*te,Ot=O*se;l[0]=te*xe,l[4]=Ot-Ve*Ne,l[8]=tt*Ne+We,l[1]=Ne,l[5]=T*xe,l[9]=-O*xe,l[2]=-se*xe,l[6]=We*Ne+tt,l[10]=Ve-Ot*Ne}else if(r.order==="XZY"){const Ve=T*te,We=T*se,tt=O*te,Ot=O*se;l[0]=te*xe,l[4]=-Ne,l[8]=se*xe,l[1]=Ve*Ne+Ot,l[5]=T*xe,l[9]=We*Ne-tt,l[2]=tt*Ne-We,l[6]=O*xe,l[10]=Ot*Ne+Ve}return l[3]=0,l[7]=0,l[11]=0,l[12]=0,l[13]=0,l[14]=0,l[15]=1,this}makeRotationFromQuaternion(r){return this.compose(Ds,r,Ba)}lookAt(r,l,h){const p=this.elements;return aa.subVectors(r,l),aa.lengthSq()===0&&(aa.z=1),aa.normalize(),Ka.crossVectors(h,aa),Ka.lengthSq()===0&&(Math.abs(h.z)===1?aa.x+=1e-4:aa.z+=1e-4,aa.normalize(),Ka.crossVectors(h,aa)),Ka.normalize(),xo.crossVectors(aa,Ka),p[0]=Ka.x,p[4]=xo.x,p[8]=aa.x,p[1]=Ka.y,p[5]=xo.y,p[9]=aa.y,p[2]=Ka.z,p[6]=xo.z,p[10]=aa.z,this}multiply(r){return this.multiplyMatrices(this,r)}premultiply(r){return this.multiplyMatrices(r,this)}multiplyMatrices(r,l){const h=r.elements,p=l.elements,y=this.elements,T=h[0],O=h[4],te=h[8],se=h[12],xe=h[1],Ne=h[5],Ve=h[9],We=h[13],tt=h[2],Ot=h[6],An=h[10],un=h[14],Un=h[3],Vn=h[7],nr=h[11],ii=h[15],pi=p[0],Bi=p[4],mi=p[8],ls=p[12],ys=p[1],Da=p[5],Mo=p[9],Ro=p[13],du=p[2],ru=p[6],Zc=p[10],Ih=p[14],uA=p[3],Ac=p[7],Uc=p[11],tc=p[15];return y[0]=T*pi+O*ys+te*du+se*uA,y[4]=T*Bi+O*Da+te*ru+se*Ac,y[8]=T*mi+O*Mo+te*Zc+se*Uc,y[12]=T*ls+O*Ro+te*Ih+se*tc,y[1]=xe*pi+Ne*ys+Ve*du+We*uA,y[5]=xe*Bi+Ne*Da+Ve*ru+We*Ac,y[9]=xe*mi+Ne*Mo+Ve*Zc+We*Uc,y[13]=xe*ls+Ne*Ro+Ve*Ih+We*tc,y[2]=tt*pi+Ot*ys+An*du+un*uA,y[6]=tt*Bi+Ot*Da+An*ru+un*Ac,y[10]=tt*mi+Ot*Mo+An*Zc+un*Uc,y[14]=tt*ls+Ot*Ro+An*Ih+un*tc,y[3]=Un*pi+Vn*ys+nr*du+ii*uA,y[7]=Un*Bi+Vn*Da+nr*ru+ii*Ac,y[11]=Un*mi+Vn*Mo+nr*Zc+ii*Uc,y[15]=Un*ls+Vn*Ro+nr*Ih+ii*tc,this}multiplyScalar(r){const l=this.elements;return l[0]*=r,l[4]*=r,l[8]*=r,l[12]*=r,l[1]*=r,l[5]*=r,l[9]*=r,l[13]*=r,l[2]*=r,l[6]*=r,l[10]*=r,l[14]*=r,l[3]*=r,l[7]*=r,l[11]*=r,l[15]*=r,this}determinant(){const r=this.elements,l=r[0],h=r[4],p=r[8],y=r[12],T=r[1],O=r[5],te=r[9],se=r[13],xe=r[2],Ne=r[6],Ve=r[10],We=r[14],tt=r[3],Ot=r[7],An=r[11],un=r[15];return tt*(+y*te*Ne-p*se*Ne-y*O*Ve+h*se*Ve+p*O*We-h*te*We)+Ot*(+l*te*We-l*se*Ve+y*T*Ve-p*T*We+p*se*xe-y*te*xe)+An*(+l*se*Ne-l*O*We-y*T*Ne+h*T*We+y*O*xe-h*se*xe)+un*(-p*O*xe-l*te*Ne+l*O*Ve+p*T*Ne-h*T*Ve+h*te*xe)}transpose(){const r=this.elements;let l;return l=r[1],r[1]=r[4],r[4]=l,l=r[2],r[2]=r[8],r[8]=l,l=r[6],r[6]=r[9],r[9]=l,l=r[3],r[3]=r[12],r[12]=l,l=r[7],r[7]=r[13],r[13]=l,l=r[11],r[11]=r[14],r[14]=l,this}setPosition(r,l,h){const p=this.elements;return r.isVector3?(p[12]=r.x,p[13]=r.y,p[14]=r.z):(p[12]=r,p[13]=l,p[14]=h),this}invert(){const r=this.elements,l=r[0],h=r[1],p=r[2],y=r[3],T=r[4],O=r[5],te=r[6],se=r[7],xe=r[8],Ne=r[9],Ve=r[10],We=r[11],tt=r[12],Ot=r[13],An=r[14],un=r[15],Un=Ne*An*se-Ot*Ve*se+Ot*te*We-O*An*We-Ne*te*un+O*Ve*un,Vn=tt*Ve*se-xe*An*se-tt*te*We+T*An*We+xe*te*un-T*Ve*un,nr=xe*Ot*se-tt*Ne*se+tt*O*We-T*Ot*We-xe*O*un+T*Ne*un,ii=tt*Ne*te-xe*Ot*te-tt*O*Ve+T*Ot*Ve+xe*O*An-T*Ne*An,pi=l*Un+h*Vn+p*nr+y*ii;if(pi===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const Bi=1/pi;return r[0]=Un*Bi,r[1]=(Ot*Ve*y-Ne*An*y-Ot*p*We+h*An*We+Ne*p*un-h*Ve*un)*Bi,r[2]=(O*An*y-Ot*te*y+Ot*p*se-h*An*se-O*p*un+h*te*un)*Bi,r[3]=(Ne*te*y-O*Ve*y-Ne*p*se+h*Ve*se+O*p*We-h*te*We)*Bi,r[4]=Vn*Bi,r[5]=(xe*An*y-tt*Ve*y+tt*p*We-l*An*We-xe*p*un+l*Ve*un)*Bi,r[6]=(tt*te*y-T*An*y-tt*p*se+l*An*se+T*p*un-l*te*un)*Bi,r[7]=(T*Ve*y-xe*te*y+xe*p*se-l*Ve*se-T*p*We+l*te*We)*Bi,r[8]=nr*Bi,r[9]=(tt*Ne*y-xe*Ot*y-tt*h*We+l*Ot*We+xe*h*un-l*Ne*un)*Bi,r[10]=(T*Ot*y-tt*O*y+tt*h*se-l*Ot*se-T*h*un+l*O*un)*Bi,r[11]=(xe*O*y-T*Ne*y-xe*h*se+l*Ne*se+T*h*We-l*O*We)*Bi,r[12]=ii*Bi,r[13]=(xe*Ot*p-tt*Ne*p+tt*h*Ve-l*Ot*Ve-xe*h*An+l*Ne*An)*Bi,r[14]=(tt*O*p-T*Ot*p-tt*h*te+l*Ot*te+T*h*An-l*O*An)*Bi,r[15]=(T*Ne*p-xe*O*p+xe*h*te-l*Ne*te-T*h*Ve+l*O*Ve)*Bi,this}scale(r){const l=this.elements,h=r.x,p=r.y,y=r.z;return l[0]*=h,l[4]*=p,l[8]*=y,l[1]*=h,l[5]*=p,l[9]*=y,l[2]*=h,l[6]*=p,l[10]*=y,l[3]*=h,l[7]*=p,l[11]*=y,this}getMaxScaleOnAxis(){const r=this.elements,l=r[0]*r[0]+r[1]*r[1]+r[2]*r[2],h=r[4]*r[4]+r[5]*r[5]+r[6]*r[6],p=r[8]*r[8]+r[9]*r[9]+r[10]*r[10];return Math.sqrt(Math.max(l,h,p))}makeTranslation(r,l,h){return r.isVector3?this.set(1,0,0,r.x,0,1,0,r.y,0,0,1,r.z,0,0,0,1):this.set(1,0,0,r,0,1,0,l,0,0,1,h,0,0,0,1),this}makeRotationX(r){const l=Math.cos(r),h=Math.sin(r);return this.set(1,0,0,0,0,l,-h,0,0,h,l,0,0,0,0,1),this}makeRotationY(r){const l=Math.cos(r),h=Math.sin(r);return this.set(l,0,h,0,0,1,0,0,-h,0,l,0,0,0,0,1),this}makeRotationZ(r){const l=Math.cos(r),h=Math.sin(r);return this.set(l,-h,0,0,h,l,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(r,l){const h=Math.cos(l),p=Math.sin(l),y=1-h,T=r.x,O=r.y,te=r.z,se=y*T,xe=y*O;return this.set(se*T+h,se*O-p*te,se*te+p*O,0,se*O+p*te,xe*O+h,xe*te-p*T,0,se*te-p*O,xe*te+p*T,y*te*te+h,0,0,0,0,1),this}makeScale(r,l,h){return this.set(r,0,0,0,0,l,0,0,0,0,h,0,0,0,0,1),this}makeShear(r,l,h,p,y,T){return this.set(1,h,y,0,r,1,T,0,l,p,1,0,0,0,0,1),this}compose(r,l,h){const p=this.elements,y=l._x,T=l._y,O=l._z,te=l._w,se=y+y,xe=T+T,Ne=O+O,Ve=y*se,We=y*xe,tt=y*Ne,Ot=T*xe,An=T*Ne,un=O*Ne,Un=te*se,Vn=te*xe,nr=te*Ne,ii=h.x,pi=h.y,Bi=h.z;return p[0]=(1-(Ot+un))*ii,p[1]=(We+nr)*ii,p[2]=(tt-Vn)*ii,p[3]=0,p[4]=(We-nr)*pi,p[5]=(1-(Ve+un))*pi,p[6]=(An+Un)*pi,p[7]=0,p[8]=(tt+Vn)*Bi,p[9]=(An-Un)*Bi,p[10]=(1-(Ve+Ot))*Bi,p[11]=0,p[12]=r.x,p[13]=r.y,p[14]=r.z,p[15]=1,this}decompose(r,l,h){const p=this.elements;let y=ts.set(p[0],p[1],p[2]).length();const T=ts.set(p[4],p[5],p[6]).length(),O=ts.set(p[8],p[9],p[10]).length();this.determinant()<0&&(y=-y),r.x=p[12],r.y=p[13],r.z=p[14],fs.copy(this);const se=1/y,xe=1/T,Ne=1/O;return fs.elements[0]*=se,fs.elements[1]*=se,fs.elements[2]*=se,fs.elements[4]*=xe,fs.elements[5]*=xe,fs.elements[6]*=xe,fs.elements[8]*=Ne,fs.elements[9]*=Ne,fs.elements[10]*=Ne,l.setFromRotationMatrix(fs),h.x=y,h.y=T,h.z=O,this}makePerspective(r,l,h,p,y,T,O=Cu,te=!1){const se=this.elements,xe=2*y/(l-r),Ne=2*y/(h-p),Ve=(l+r)/(l-r),We=(h+p)/(h-p);let tt,Ot;if(te)tt=y/(T-y),Ot=T*y/(T-y);else if(O===Cu)tt=-(T+y)/(T-y),Ot=-2*T*y/(T-y);else if(O===zc)tt=-T/(T-y),Ot=-T*y/(T-y);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+O);return se[0]=xe,se[4]=0,se[8]=Ve,se[12]=0,se[1]=0,se[5]=Ne,se[9]=We,se[13]=0,se[2]=0,se[6]=0,se[10]=tt,se[14]=Ot,se[3]=0,se[7]=0,se[11]=-1,se[15]=0,this}makeOrthographic(r,l,h,p,y,T,O=Cu,te=!1){const se=this.elements,xe=2/(l-r),Ne=2/(h-p),Ve=-(l+r)/(l-r),We=-(h+p)/(h-p);let tt,Ot;if(te)tt=1/(T-y),Ot=T/(T-y);else if(O===Cu)tt=-2/(T-y),Ot=-(T+y)/(T-y);else if(O===zc)tt=-1/(T-y),Ot=-y/(T-y);else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+O);return se[0]=xe,se[4]=0,se[8]=0,se[12]=Ve,se[1]=0,se[5]=Ne,se[9]=0,se[13]=We,se[2]=0,se[6]=0,se[10]=tt,se[14]=Ot,se[3]=0,se[7]=0,se[11]=0,se[15]=1,this}equals(r){const l=this.elements,h=r.elements;for(let p=0;p<16;p++)if(l[p]!==h[p])return!1;return!0}fromArray(r,l=0){for(let h=0;h<16;h++)this.elements[h]=r[h+l];return this}toArray(r=[],l=0){const h=this.elements;return r[l]=h[0],r[l+1]=h[1],r[l+2]=h[2],r[l+3]=h[3],r[l+4]=h[4],r[l+5]=h[5],r[l+6]=h[6],r[l+7]=h[7],r[l+8]=h[8],r[l+9]=h[9],r[l+10]=h[10],r[l+11]=h[11],r[l+12]=h[12],r[l+13]=h[13],r[l+14]=h[14],r[l+15]=h[15],r}}const ts=new kn,fs=new oi,Ds=new kn(0,0,0),Ba=new kn(1,1,1),Ka=new kn,xo=new kn,aa=new kn,di=new oi,Ma=new Du;class Rs{constructor(r=0,l=0,h=0,p=Rs.DEFAULT_ORDER){this.isEuler=!0,this._x=r,this._y=l,this._z=h,this._order=p}get x(){return this._x}set x(r){this._x=r,this._onChangeCallback()}get y(){return this._y}set y(r){this._y=r,this._onChangeCallback()}get z(){return this._z}set z(r){this._z=r,this._onChangeCallback()}get order(){return this._order}set order(r){this._order=r,this._onChangeCallback()}set(r,l,h,p=this._order){return this._x=r,this._y=l,this._z=h,this._order=p,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(r){return this._x=r._x,this._y=r._y,this._z=r._z,this._order=r._order,this._onChangeCallback(),this}setFromRotationMatrix(r,l=this._order,h=!0){const p=r.elements,y=p[0],T=p[4],O=p[8],te=p[1],se=p[5],xe=p[9],Ne=p[2],Ve=p[6],We=p[10];switch(l){case"XYZ":this._y=Math.asin(ki(O,-1,1)),Math.abs(O)<.9999999?(this._x=Math.atan2(-xe,We),this._z=Math.atan2(-T,y)):(this._x=Math.atan2(Ve,se),this._z=0);break;case"YXZ":this._x=Math.asin(-ki(xe,-1,1)),Math.abs(xe)<.9999999?(this._y=Math.atan2(O,We),this._z=Math.atan2(te,se)):(this._y=Math.atan2(-Ne,y),this._z=0);break;case"ZXY":this._x=Math.asin(ki(Ve,-1,1)),Math.abs(Ve)<.9999999?(this._y=Math.atan2(-Ne,We),this._z=Math.atan2(-T,se)):(this._y=0,this._z=Math.atan2(te,y));break;case"ZYX":this._y=Math.asin(-ki(Ne,-1,1)),Math.abs(Ne)<.9999999?(this._x=Math.atan2(Ve,We),this._z=Math.atan2(te,y)):(this._x=0,this._z=Math.atan2(-T,se));break;case"YZX":this._z=Math.asin(ki(te,-1,1)),Math.abs(te)<.9999999?(this._x=Math.atan2(-xe,se),this._y=Math.atan2(-Ne,y)):(this._x=0,this._y=Math.atan2(O,We));break;case"XZY":this._z=Math.asin(-ki(T,-1,1)),Math.abs(T)<.9999999?(this._x=Math.atan2(Ve,se),this._y=Math.atan2(O,y)):(this._x=Math.atan2(-xe,We),this._y=0);break;default:na("Euler: .setFromRotationMatrix() encountered an unknown order: "+l)}return this._order=l,h===!0&&this._onChangeCallback(),this}setFromQuaternion(r,l,h){return di.makeRotationFromQuaternion(r),this.setFromRotationMatrix(di,l,h)}setFromVector3(r,l=this._order){return this.set(r.x,r.y,r.z,l)}reorder(r){return Ma.setFromEuler(this),this.setFromQuaternion(Ma,r)}equals(r){return r._x===this._x&&r._y===this._y&&r._z===this._z&&r._order===this._order}fromArray(r){return this._x=r[0],this._y=r[1],this._z=r[2],r[3]!==void 0&&(this._order=r[3]),this._onChangeCallback(),this}toArray(r=[],l=0){return r[l]=this._x,r[l+1]=this._y,r[l+2]=this._z,r[l+3]=this._order,r}_onChange(r){return this._onChangeCallback=r,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}Rs.DEFAULT_ORDER="XYZ";class lo{constructor(){this.mask=1}set(r){this.mask=(1<<r|0)>>>0}enable(r){this.mask|=1<<r|0}enableAll(){this.mask=-1}toggle(r){this.mask^=1<<r|0}disable(r){this.mask&=~(1<<r|0)}disableAll(){this.mask=0}test(r){return(this.mask&r.mask)!==0}isEnabled(r){return(this.mask&(1<<r|0))!==0}}let Jo=0;const zs=new kn,Ya=new Du,pa=new oi,al=new kn,qa=new kn,Ua=new kn,dl=new Du,Sc=new kn(1,0,0),zl=new kn(0,1,0),Gc=new kn(0,0,1),uc={type:"added"},Bu={type:"removed"},cu={type:"childadded",child:null},qc={type:"childremoved",child:null};class _l extends Tu{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:Jo++}),this.uuid=Gr(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=_l.DEFAULT_UP.clone();const r=new kn,l=new Rs,h=new Du,p=new kn(1,1,1);function y(){h.setFromEuler(l,!1)}function T(){l.setFromQuaternion(h,void 0,!1)}l._onChange(y),h._onChange(T),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:r},rotation:{configurable:!0,enumerable:!0,value:l},quaternion:{configurable:!0,enumerable:!0,value:h},scale:{configurable:!0,enumerable:!0,value:p},modelViewMatrix:{value:new oi},normalMatrix:{value:new vl}}),this.matrix=new oi,this.matrixWorld=new oi,this.matrixAutoUpdate=_l.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=_l.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new lo,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.customDepthMaterial=void 0,this.customDistanceMaterial=void 0,this.userData={}}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(r){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(r),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(r){return this.quaternion.premultiply(r),this}setRotationFromAxisAngle(r,l){this.quaternion.setFromAxisAngle(r,l)}setRotationFromEuler(r){this.quaternion.setFromEuler(r,!0)}setRotationFromMatrix(r){this.quaternion.setFromRotationMatrix(r)}setRotationFromQuaternion(r){this.quaternion.copy(r)}rotateOnAxis(r,l){return Ya.setFromAxisAngle(r,l),this.quaternion.multiply(Ya),this}rotateOnWorldAxis(r,l){return Ya.setFromAxisAngle(r,l),this.quaternion.premultiply(Ya),this}rotateX(r){return this.rotateOnAxis(Sc,r)}rotateY(r){return this.rotateOnAxis(zl,r)}rotateZ(r){return this.rotateOnAxis(Gc,r)}translateOnAxis(r,l){return zs.copy(r).applyQuaternion(this.quaternion),this.position.add(zs.multiplyScalar(l)),this}translateX(r){return this.translateOnAxis(Sc,r)}translateY(r){return this.translateOnAxis(zl,r)}translateZ(r){return this.translateOnAxis(Gc,r)}localToWorld(r){return this.updateWorldMatrix(!0,!1),r.applyMatrix4(this.matrixWorld)}worldToLocal(r){return this.updateWorldMatrix(!0,!1),r.applyMatrix4(pa.copy(this.matrixWorld).invert())}lookAt(r,l,h){r.isVector3?al.copy(r):al.set(r,l,h);const p=this.parent;this.updateWorldMatrix(!0,!1),qa.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?pa.lookAt(qa,al,this.up):pa.lookAt(al,qa,this.up),this.quaternion.setFromRotationMatrix(pa),p&&(pa.extractRotation(p.matrixWorld),Ya.setFromRotationMatrix(pa),this.quaternion.premultiply(Ya.invert()))}add(r){if(arguments.length>1){for(let l=0;l<arguments.length;l++)this.add(arguments[l]);return this}return r===this?(Wa("Object3D.add: object can't be added as a child of itself.",r),this):(r&&r.isObject3D?(r.removeFromParent(),r.parent=this,this.children.push(r),r.dispatchEvent(uc),cu.child=r,this.dispatchEvent(cu),cu.child=null):Wa("Object3D.add: object not an instance of THREE.Object3D.",r),this)}remove(r){if(arguments.length>1){for(let h=0;h<arguments.length;h++)this.remove(arguments[h]);return this}const l=this.children.indexOf(r);return l!==-1&&(r.parent=null,this.children.splice(l,1),r.dispatchEvent(Bu),qc.child=r,this.dispatchEvent(qc),qc.child=null),this}removeFromParent(){const r=this.parent;return r!==null&&r.remove(this),this}clear(){return this.remove(...this.children)}attach(r){return this.updateWorldMatrix(!0,!1),pa.copy(this.matrixWorld).invert(),r.parent!==null&&(r.parent.updateWorldMatrix(!0,!1),pa.multiply(r.parent.matrixWorld)),r.applyMatrix4(pa),r.removeFromParent(),r.parent=this,this.children.push(r),r.updateWorldMatrix(!1,!0),r.dispatchEvent(uc),cu.child=r,this.dispatchEvent(cu),cu.child=null,this}getObjectById(r){return this.getObjectByProperty("id",r)}getObjectByName(r){return this.getObjectByProperty("name",r)}getObjectByProperty(r,l){if(this[r]===l)return this;for(let h=0,p=this.children.length;h<p;h++){const T=this.children[h].getObjectByProperty(r,l);if(T!==void 0)return T}}getObjectsByProperty(r,l,h=[]){this[r]===l&&h.push(this);const p=this.children;for(let y=0,T=p.length;y<T;y++)p[y].getObjectsByProperty(r,l,h);return h}getWorldPosition(r){return this.updateWorldMatrix(!0,!1),r.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(r){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(qa,r,Ua),r}getWorldScale(r){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(qa,dl,r),r}getWorldDirection(r){this.updateWorldMatrix(!0,!1);const l=this.matrixWorld.elements;return r.set(l[8],l[9],l[10]).normalize()}raycast(){}traverse(r){r(this);const l=this.children;for(let h=0,p=l.length;h<p;h++)l[h].traverse(r)}traverseVisible(r){if(this.visible===!1)return;r(this);const l=this.children;for(let h=0,p=l.length;h<p;h++)l[h].traverseVisible(r)}traverseAncestors(r){const l=this.parent;l!==null&&(r(l),l.traverseAncestors(r))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(r){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||r)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,r=!0);const l=this.children;for(let h=0,p=l.length;h<p;h++)l[h].updateMatrixWorld(r)}updateWorldMatrix(r,l){const h=this.parent;if(r===!0&&h!==null&&h.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),l===!0){const p=this.children;for(let y=0,T=p.length;y<T;y++)p[y].updateWorldMatrix(!1,!0)}}toJSON(r){const l=r===void 0||typeof r=="string",h={};l&&(r={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},h.metadata={version:4.7,type:"Object",generator:"Object3D.toJSON"});const p={};p.uuid=this.uuid,p.type=this.type,this.name!==""&&(p.name=this.name),this.castShadow===!0&&(p.castShadow=!0),this.receiveShadow===!0&&(p.receiveShadow=!0),this.visible===!1&&(p.visible=!1),this.frustumCulled===!1&&(p.frustumCulled=!1),this.renderOrder!==0&&(p.renderOrder=this.renderOrder),Object.keys(this.userData).length>0&&(p.userData=this.userData),p.layers=this.layers.mask,p.matrix=this.matrix.toArray(),p.up=this.up.toArray(),this.matrixAutoUpdate===!1&&(p.matrixAutoUpdate=!1),this.isInstancedMesh&&(p.type="InstancedMesh",p.count=this.count,p.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(p.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(p.type="BatchedMesh",p.perObjectFrustumCulled=this.perObjectFrustumCulled,p.sortObjects=this.sortObjects,p.drawRanges=this._drawRanges,p.reservedRanges=this._reservedRanges,p.geometryInfo=this._geometryInfo.map(O=>fd(rl({},O),{boundingBox:O.boundingBox?O.boundingBox.toJSON():void 0,boundingSphere:O.boundingSphere?O.boundingSphere.toJSON():void 0})),p.instanceInfo=this._instanceInfo.map(O=>rl({},O)),p.availableInstanceIds=this._availableInstanceIds.slice(),p.availableGeometryIds=this._availableGeometryIds.slice(),p.nextIndexStart=this._nextIndexStart,p.nextVertexStart=this._nextVertexStart,p.geometryCount=this._geometryCount,p.maxInstanceCount=this._maxInstanceCount,p.maxVertexCount=this._maxVertexCount,p.maxIndexCount=this._maxIndexCount,p.geometryInitialized=this._geometryInitialized,p.matricesTexture=this._matricesTexture.toJSON(r),p.indirectTexture=this._indirectTexture.toJSON(r),this._colorsTexture!==null&&(p.colorsTexture=this._colorsTexture.toJSON(r)),this.boundingSphere!==null&&(p.boundingSphere=this.boundingSphere.toJSON()),this.boundingBox!==null&&(p.boundingBox=this.boundingBox.toJSON()));function y(O,te){return O[te.uuid]===void 0&&(O[te.uuid]=te.toJSON(r)),te.uuid}if(this.isScene)this.background&&(this.background.isColor?p.background=this.background.toJSON():this.background.isTexture&&(p.background=this.background.toJSON(r).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(p.environment=this.environment.toJSON(r).uuid);else if(this.isMesh||this.isLine||this.isPoints){p.geometry=y(r.geometries,this.geometry);const O=this.geometry.parameters;if(O!==void 0&&O.shapes!==void 0){const te=O.shapes;if(Array.isArray(te))for(let se=0,xe=te.length;se<xe;se++){const Ne=te[se];y(r.shapes,Ne)}else y(r.shapes,te)}}if(this.isSkinnedMesh&&(p.bindMode=this.bindMode,p.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(y(r.skeletons,this.skeleton),p.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){const O=[];for(let te=0,se=this.material.length;te<se;te++)O.push(y(r.materials,this.material[te]));p.material=O}else p.material=y(r.materials,this.material);if(this.children.length>0){p.children=[];for(let O=0;O<this.children.length;O++)p.children.push(this.children[O].toJSON(r).object)}if(this.animations.length>0){p.animations=[];for(let O=0;O<this.animations.length;O++){const te=this.animations[O];p.animations.push(y(r.animations,te))}}if(l){const O=T(r.geometries),te=T(r.materials),se=T(r.textures),xe=T(r.images),Ne=T(r.shapes),Ve=T(r.skeletons),We=T(r.animations),tt=T(r.nodes);O.length>0&&(h.geometries=O),te.length>0&&(h.materials=te),se.length>0&&(h.textures=se),xe.length>0&&(h.images=xe),Ne.length>0&&(h.shapes=Ne),Ve.length>0&&(h.skeletons=Ve),We.length>0&&(h.animations=We),tt.length>0&&(h.nodes=tt)}return h.object=p,h;function T(O){const te=[];for(const se in O){const xe=O[se];delete xe.metadata,te.push(xe)}return te}}clone(r){return new this.constructor().copy(this,r)}copy(r,l=!0){if(this.name=r.name,this.up.copy(r.up),this.position.copy(r.position),this.rotation.order=r.rotation.order,this.quaternion.copy(r.quaternion),this.scale.copy(r.scale),this.matrix.copy(r.matrix),this.matrixWorld.copy(r.matrixWorld),this.matrixAutoUpdate=r.matrixAutoUpdate,this.matrixWorldAutoUpdate=r.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=r.matrixWorldNeedsUpdate,this.layers.mask=r.layers.mask,this.visible=r.visible,this.castShadow=r.castShadow,this.receiveShadow=r.receiveShadow,this.frustumCulled=r.frustumCulled,this.renderOrder=r.renderOrder,this.animations=r.animations.slice(),this.userData=JSON.parse(JSON.stringify(r.userData)),l===!0)for(let h=0;h<r.children.length;h++){const p=r.children[h];this.add(p.clone())}return this}}_l.DEFAULT_UP=new kn(0,1,0),_l.DEFAULT_MATRIX_AUTO_UPDATE=!0,_l.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;const Ho=new kn,jl=new kn,Jc=new kn,eh=new kn,df=new kn,xh=new kn,MA=new kn,yl=new kn,Nc=new kn,bh=new kn,Wf=new ai,_h=new ai,ol=new ai;class Bl{constructor(r=new kn,l=new kn,h=new kn){this.a=r,this.b=l,this.c=h}static getNormal(r,l,h,p){p.subVectors(h,l),Ho.subVectors(r,l),p.cross(Ho);const y=p.lengthSq();return y>0?p.multiplyScalar(1/Math.sqrt(y)):p.set(0,0,0)}static getBarycoord(r,l,h,p,y){Ho.subVectors(p,l),jl.subVectors(h,l),Jc.subVectors(r,l);const T=Ho.dot(Ho),O=Ho.dot(jl),te=Ho.dot(Jc),se=jl.dot(jl),xe=jl.dot(Jc),Ne=T*se-O*O;if(Ne===0)return y.set(0,0,0),null;const Ve=1/Ne,We=(se*te-O*xe)*Ve,tt=(T*xe-O*te)*Ve;return y.set(1-We-tt,tt,We)}static containsPoint(r,l,h,p){return this.getBarycoord(r,l,h,p,eh)===null?!1:eh.x>=0&&eh.y>=0&&eh.x+eh.y<=1}static getInterpolation(r,l,h,p,y,T,O,te){return this.getBarycoord(r,l,h,p,eh)===null?(te.x=0,te.y=0,"z"in te&&(te.z=0),"w"in te&&(te.w=0),null):(te.setScalar(0),te.addScaledVector(y,eh.x),te.addScaledVector(T,eh.y),te.addScaledVector(O,eh.z),te)}static getInterpolatedAttribute(r,l,h,p,y,T){return Wf.setScalar(0),_h.setScalar(0),ol.setScalar(0),Wf.fromBufferAttribute(r,l),_h.fromBufferAttribute(r,h),ol.fromBufferAttribute(r,p),T.setScalar(0),T.addScaledVector(Wf,y.x),T.addScaledVector(_h,y.y),T.addScaledVector(ol,y.z),T}static isFrontFacing(r,l,h,p){return Ho.subVectors(h,l),jl.subVectors(r,l),Ho.cross(jl).dot(p)<0}set(r,l,h){return this.a.copy(r),this.b.copy(l),this.c.copy(h),this}setFromPointsAndIndices(r,l,h,p){return this.a.copy(r[l]),this.b.copy(r[h]),this.c.copy(r[p]),this}setFromAttributeAndIndices(r,l,h,p){return this.a.fromBufferAttribute(r,l),this.b.fromBufferAttribute(r,h),this.c.fromBufferAttribute(r,p),this}clone(){return new this.constructor().copy(this)}copy(r){return this.a.copy(r.a),this.b.copy(r.b),this.c.copy(r.c),this}getArea(){return Ho.subVectors(this.c,this.b),jl.subVectors(this.a,this.b),Ho.cross(jl).length()*.5}getMidpoint(r){return r.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(r){return Bl.getNormal(this.a,this.b,this.c,r)}getPlane(r){return r.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(r,l){return Bl.getBarycoord(r,this.a,this.b,this.c,l)}getInterpolation(r,l,h,p,y){return Bl.getInterpolation(r,this.a,this.b,this.c,l,h,p,y)}containsPoint(r){return Bl.containsPoint(r,this.a,this.b,this.c)}isFrontFacing(r){return Bl.isFrontFacing(this.a,this.b,this.c,r)}intersectsBox(r){return r.intersectsTriangle(this)}closestPointToPoint(r,l){const h=this.a,p=this.b,y=this.c;let T,O;df.subVectors(p,h),xh.subVectors(y,h),yl.subVectors(r,h);const te=df.dot(yl),se=xh.dot(yl);if(te<=0&&se<=0)return l.copy(h);Nc.subVectors(r,p);const xe=df.dot(Nc),Ne=xh.dot(Nc);if(xe>=0&&Ne<=xe)return l.copy(p);const Ve=te*Ne-xe*se;if(Ve<=0&&te>=0&&xe<=0)return T=te/(te-xe),l.copy(h).addScaledVector(df,T);bh.subVectors(r,y);const We=df.dot(bh),tt=xh.dot(bh);if(tt>=0&&We<=tt)return l.copy(y);const Ot=We*se-te*tt;if(Ot<=0&&se>=0&&tt<=0)return O=se/(se-tt),l.copy(h).addScaledVector(xh,O);const An=xe*tt-We*Ne;if(An<=0&&Ne-xe>=0&&We-tt>=0)return MA.subVectors(y,p),O=(Ne-xe)/(Ne-xe+(We-tt)),l.copy(p).addScaledVector(MA,O);const un=1/(An+Ot+Ve);return T=Ot*un,O=Ve*un,l.copy(h).addScaledVector(df,T).addScaledVector(xh,O)}equals(r){return r.a.equals(this.a)&&r.b.equals(this.b)&&r.c.equals(this.c)}}const yd={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},Co={h:0,s:0,l:0},vu={h:0,s:0,l:0};function Gl(ue,r,l){return l<0&&(l+=1),l>1&&(l-=1),l<1/6?ue+(r-ue)*6*l:l<1/2?r:l<2/3?ue+(r-ue)*6*(2/3-l):ue}class Ea{constructor(r,l,h){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(r,l,h)}set(r,l,h){if(l===void 0&&h===void 0){const p=r;p&&p.isColor?this.copy(p):typeof p=="number"?this.setHex(p):typeof p=="string"&&this.setStyle(p)}else this.setRGB(r,l,h);return this}setScalar(r){return this.r=r,this.g=r,this.b=r,this}setHex(r,l=go){return r=Math.floor(r),this.r=(r>>16&255)/255,this.g=(r>>8&255)/255,this.b=(r&255)/255,le.colorSpaceToWorking(this,l),this}setRGB(r,l,h,p=le.workingColorSpace){return this.r=r,this.g=l,this.b=h,le.colorSpaceToWorking(this,p),this}setHSL(r,l,h,p=le.workingColorSpace){if(r=ju(r,1),l=ki(l,0,1),h=ki(h,0,1),l===0)this.r=this.g=this.b=h;else{const y=h<=.5?h*(1+l):h+l-h*l,T=2*h-y;this.r=Gl(T,y,r+1/3),this.g=Gl(T,y,r),this.b=Gl(T,y,r-1/3)}return le.colorSpaceToWorking(this,p),this}setStyle(r,l=go){function h(y){y!==void 0&&parseFloat(y)<1&&na("Color: Alpha component of "+r+" will be ignored.")}let p;if(p=/^(\w+)\(([^\)]*)\)/.exec(r)){let y;const T=p[1],O=p[2];switch(T){case"rgb":case"rgba":if(y=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(O))return h(y[4]),this.setRGB(Math.min(255,parseInt(y[1],10))/255,Math.min(255,parseInt(y[2],10))/255,Math.min(255,parseInt(y[3],10))/255,l);if(y=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(O))return h(y[4]),this.setRGB(Math.min(100,parseInt(y[1],10))/100,Math.min(100,parseInt(y[2],10))/100,Math.min(100,parseInt(y[3],10))/100,l);break;case"hsl":case"hsla":if(y=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(O))return h(y[4]),this.setHSL(parseFloat(y[1])/360,parseFloat(y[2])/100,parseFloat(y[3])/100,l);break;default:na("Color: Unknown color model "+r)}}else if(p=/^\#([A-Fa-f\d]+)$/.exec(r)){const y=p[1],T=y.length;if(T===3)return this.setRGB(parseInt(y.charAt(0),16)/15,parseInt(y.charAt(1),16)/15,parseInt(y.charAt(2),16)/15,l);if(T===6)return this.setHex(parseInt(y,16),l);na("Color: Invalid hex color "+r)}else if(r&&r.length>0)return this.setColorName(r,l);return this}setColorName(r,l=go){const h=yd[r.toLowerCase()];return h!==void 0?this.setHex(h,l):na("Color: Unknown color "+r),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(r){return this.r=r.r,this.g=r.g,this.b=r.b,this}copySRGBToLinear(r){return this.r=Nt(r.r),this.g=Nt(r.g),this.b=Nt(r.b),this}copyLinearToSRGB(r){return this.r=Dt(r.r),this.g=Dt(r.g),this.b=Dt(r.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(r=go){return le.workingToColorSpace(Rl.copy(this),r),Math.round(ki(Rl.r*255,0,255))*65536+Math.round(ki(Rl.g*255,0,255))*256+Math.round(ki(Rl.b*255,0,255))}getHexString(r=go){return("000000"+this.getHex(r).toString(16)).slice(-6)}getHSL(r,l=le.workingColorSpace){le.workingToColorSpace(Rl.copy(this),l);const h=Rl.r,p=Rl.g,y=Rl.b,T=Math.max(h,p,y),O=Math.min(h,p,y);let te,se;const xe=(O+T)/2;if(O===T)te=0,se=0;else{const Ne=T-O;switch(se=xe<=.5?Ne/(T+O):Ne/(2-T-O),T){case h:te=(p-y)/Ne+(p<y?6:0);break;case p:te=(y-h)/Ne+2;break;case y:te=(h-p)/Ne+4;break}te/=6}return r.h=te,r.s=se,r.l=xe,r}getRGB(r,l=le.workingColorSpace){return le.workingToColorSpace(Rl.copy(this),l),r.r=Rl.r,r.g=Rl.g,r.b=Rl.b,r}getStyle(r=go){le.workingToColorSpace(Rl.copy(this),r);const l=Rl.r,h=Rl.g,p=Rl.b;return r!==go?`color(${r} ${l.toFixed(3)} ${h.toFixed(3)} ${p.toFixed(3)})`:`rgb(${Math.round(l*255)},${Math.round(h*255)},${Math.round(p*255)})`}offsetHSL(r,l,h){return this.getHSL(Co),this.setHSL(Co.h+r,Co.s+l,Co.l+h)}add(r){return this.r+=r.r,this.g+=r.g,this.b+=r.b,this}addColors(r,l){return this.r=r.r+l.r,this.g=r.g+l.g,this.b=r.b+l.b,this}addScalar(r){return this.r+=r,this.g+=r,this.b+=r,this}sub(r){return this.r=Math.max(0,this.r-r.r),this.g=Math.max(0,this.g-r.g),this.b=Math.max(0,this.b-r.b),this}multiply(r){return this.r*=r.r,this.g*=r.g,this.b*=r.b,this}multiplyScalar(r){return this.r*=r,this.g*=r,this.b*=r,this}lerp(r,l){return this.r+=(r.r-this.r)*l,this.g+=(r.g-this.g)*l,this.b+=(r.b-this.b)*l,this}lerpColors(r,l,h){return this.r=r.r+(l.r-r.r)*h,this.g=r.g+(l.g-r.g)*h,this.b=r.b+(l.b-r.b)*h,this}lerpHSL(r,l){this.getHSL(Co),r.getHSL(vu);const h=Go(Co.h,vu.h,l),p=Go(Co.s,vu.s,l),y=Go(Co.l,vu.l,l);return this.setHSL(h,p,y),this}setFromVector3(r){return this.r=r.x,this.g=r.y,this.b=r.z,this}applyMatrix3(r){const l=this.r,h=this.g,p=this.b,y=r.elements;return this.r=y[0]*l+y[3]*h+y[6]*p,this.g=y[1]*l+y[4]*h+y[7]*p,this.b=y[2]*l+y[5]*h+y[8]*p,this}equals(r){return r.r===this.r&&r.g===this.g&&r.b===this.b}fromArray(r,l=0){return this.r=r[l],this.g=r[l+1],this.b=r[l+2],this}toArray(r=[],l=0){return r[l]=this.r,r[l+1]=this.g,r[l+2]=this.b,r}fromBufferAttribute(r,l){return this.r=r.getX(l),this.g=r.getY(l),this.b=r.getZ(l),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}}const Rl=new Ea;Ea.NAMES=yd;let Zf=0;class ku extends Tu{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:Zf++}),this.uuid=Gr(),this.name="",this.type="Material",this.blending=ve,this.side=j,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=zn,this.blendDst=dr,this.blendEquation=vt,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new Ea(0,0,0),this.blendAlpha=0,this.depthFunc=Ae,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=fh,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=No,this.stencilZFail=No,this.stencilZPass=No,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.allowOverride=!0,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(r){this._alphaTest>0!=r>0&&this.version++,this._alphaTest=r}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(r){if(r!==void 0)for(const l in r){const h=r[l];if(h===void 0){na(`Material: parameter '${l}' has value of undefined.`);continue}const p=this[l];if(p===void 0){na(`Material: '${l}' is not a property of THREE.${this.type}.`);continue}p&&p.isColor?p.set(h):p&&p.isVector3&&h&&h.isVector3?p.copy(h):this[l]=h}}toJSON(r){const l=r===void 0||typeof r=="string";l&&(r={textures:{},images:{}});const h={metadata:{version:4.7,type:"Material",generator:"Material.toJSON"}};h.uuid=this.uuid,h.type=this.type,this.name!==""&&(h.name=this.name),this.color&&this.color.isColor&&(h.color=this.color.getHex()),this.roughness!==void 0&&(h.roughness=this.roughness),this.metalness!==void 0&&(h.metalness=this.metalness),this.sheen!==void 0&&(h.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(h.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(h.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(h.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(h.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(h.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(h.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(h.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(h.shininess=this.shininess),this.clearcoat!==void 0&&(h.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(h.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(h.clearcoatMap=this.clearcoatMap.toJSON(r).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(h.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(r).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(h.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(r).uuid,h.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.sheenColorMap&&this.sheenColorMap.isTexture&&(h.sheenColorMap=this.sheenColorMap.toJSON(r).uuid),this.sheenRoughnessMap&&this.sheenRoughnessMap.isTexture&&(h.sheenRoughnessMap=this.sheenRoughnessMap.toJSON(r).uuid),this.dispersion!==void 0&&(h.dispersion=this.dispersion),this.iridescence!==void 0&&(h.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(h.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(h.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(h.iridescenceMap=this.iridescenceMap.toJSON(r).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(h.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(r).uuid),this.anisotropy!==void 0&&(h.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(h.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(h.anisotropyMap=this.anisotropyMap.toJSON(r).uuid),this.map&&this.map.isTexture&&(h.map=this.map.toJSON(r).uuid),this.matcap&&this.matcap.isTexture&&(h.matcap=this.matcap.toJSON(r).uuid),this.alphaMap&&this.alphaMap.isTexture&&(h.alphaMap=this.alphaMap.toJSON(r).uuid),this.lightMap&&this.lightMap.isTexture&&(h.lightMap=this.lightMap.toJSON(r).uuid,h.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(h.aoMap=this.aoMap.toJSON(r).uuid,h.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(h.bumpMap=this.bumpMap.toJSON(r).uuid,h.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(h.normalMap=this.normalMap.toJSON(r).uuid,h.normalMapType=this.normalMapType,h.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(h.displacementMap=this.displacementMap.toJSON(r).uuid,h.displacementScale=this.displacementScale,h.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(h.roughnessMap=this.roughnessMap.toJSON(r).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(h.metalnessMap=this.metalnessMap.toJSON(r).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(h.emissiveMap=this.emissiveMap.toJSON(r).uuid),this.specularMap&&this.specularMap.isTexture&&(h.specularMap=this.specularMap.toJSON(r).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(h.specularIntensityMap=this.specularIntensityMap.toJSON(r).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(h.specularColorMap=this.specularColorMap.toJSON(r).uuid),this.envMap&&this.envMap.isTexture&&(h.envMap=this.envMap.toJSON(r).uuid,this.combine!==void 0&&(h.combine=this.combine)),this.envMapRotation!==void 0&&(h.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(h.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(h.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(h.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(h.gradientMap=this.gradientMap.toJSON(r).uuid),this.transmission!==void 0&&(h.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(h.transmissionMap=this.transmissionMap.toJSON(r).uuid),this.thickness!==void 0&&(h.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(h.thicknessMap=this.thicknessMap.toJSON(r).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(h.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(h.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(h.size=this.size),this.shadowSide!==null&&(h.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(h.sizeAttenuation=this.sizeAttenuation),this.blending!==ve&&(h.blending=this.blending),this.side!==j&&(h.side=this.side),this.vertexColors===!0&&(h.vertexColors=!0),this.opacity<1&&(h.opacity=this.opacity),this.transparent===!0&&(h.transparent=!0),this.blendSrc!==zn&&(h.blendSrc=this.blendSrc),this.blendDst!==dr&&(h.blendDst=this.blendDst),this.blendEquation!==vt&&(h.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(h.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(h.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(h.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(h.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(h.blendAlpha=this.blendAlpha),this.depthFunc!==Ae&&(h.depthFunc=this.depthFunc),this.depthTest===!1&&(h.depthTest=this.depthTest),this.depthWrite===!1&&(h.depthWrite=this.depthWrite),this.colorWrite===!1&&(h.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(h.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==fh&&(h.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(h.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(h.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==No&&(h.stencilFail=this.stencilFail),this.stencilZFail!==No&&(h.stencilZFail=this.stencilZFail),this.stencilZPass!==No&&(h.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(h.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(h.rotation=this.rotation),this.polygonOffset===!0&&(h.polygonOffset=!0),this.polygonOffsetFactor!==0&&(h.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(h.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(h.linewidth=this.linewidth),this.dashSize!==void 0&&(h.dashSize=this.dashSize),this.gapSize!==void 0&&(h.gapSize=this.gapSize),this.scale!==void 0&&(h.scale=this.scale),this.dithering===!0&&(h.dithering=!0),this.alphaTest>0&&(h.alphaTest=this.alphaTest),this.alphaHash===!0&&(h.alphaHash=!0),this.alphaToCoverage===!0&&(h.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(h.premultipliedAlpha=!0),this.forceSinglePass===!0&&(h.forceSinglePass=!0),this.wireframe===!0&&(h.wireframe=!0),this.wireframeLinewidth>1&&(h.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(h.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(h.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(h.flatShading=!0),this.visible===!1&&(h.visible=!1),this.toneMapped===!1&&(h.toneMapped=!1),this.fog===!1&&(h.fog=!1),Object.keys(this.userData).length>0&&(h.userData=this.userData);function p(y){const T=[];for(const O in y){const te=y[O];delete te.metadata,T.push(te)}return T}if(l){const y=p(r.textures),T=p(r.images);y.length>0&&(h.textures=y),T.length>0&&(h.images=T)}return h}clone(){return new this.constructor().copy(this)}copy(r){this.name=r.name,this.blending=r.blending,this.side=r.side,this.vertexColors=r.vertexColors,this.opacity=r.opacity,this.transparent=r.transparent,this.blendSrc=r.blendSrc,this.blendDst=r.blendDst,this.blendEquation=r.blendEquation,this.blendSrcAlpha=r.blendSrcAlpha,this.blendDstAlpha=r.blendDstAlpha,this.blendEquationAlpha=r.blendEquationAlpha,this.blendColor.copy(r.blendColor),this.blendAlpha=r.blendAlpha,this.depthFunc=r.depthFunc,this.depthTest=r.depthTest,this.depthWrite=r.depthWrite,this.stencilWriteMask=r.stencilWriteMask,this.stencilFunc=r.stencilFunc,this.stencilRef=r.stencilRef,this.stencilFuncMask=r.stencilFuncMask,this.stencilFail=r.stencilFail,this.stencilZFail=r.stencilZFail,this.stencilZPass=r.stencilZPass,this.stencilWrite=r.stencilWrite;const l=r.clippingPlanes;let h=null;if(l!==null){const p=l.length;h=new Array(p);for(let y=0;y!==p;++y)h[y]=l[y].clone()}return this.clippingPlanes=h,this.clipIntersection=r.clipIntersection,this.clipShadows=r.clipShadows,this.shadowSide=r.shadowSide,this.colorWrite=r.colorWrite,this.precision=r.precision,this.polygonOffset=r.polygonOffset,this.polygonOffsetFactor=r.polygonOffsetFactor,this.polygonOffsetUnits=r.polygonOffsetUnits,this.dithering=r.dithering,this.alphaTest=r.alphaTest,this.alphaHash=r.alphaHash,this.alphaToCoverage=r.alphaToCoverage,this.premultipliedAlpha=r.premultipliedAlpha,this.forceSinglePass=r.forceSinglePass,this.visible=r.visible,this.toneMapped=r.toneMapped,this.userData=JSON.parse(JSON.stringify(r.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(r){r===!0&&this.version++}}class Dh extends ku{constructor(r){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new Ea(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 Rs,this.combine=on,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(r)}copy(r){return super.copy(r),this.color.copy(r.color),this.map=r.map,this.lightMap=r.lightMap,this.lightMapIntensity=r.lightMapIntensity,this.aoMap=r.aoMap,this.aoMapIntensity=r.aoMapIntensity,this.specularMap=r.specularMap,this.alphaMap=r.alphaMap,this.envMap=r.envMap,this.envMapRotation.copy(r.envMapRotation),this.combine=r.combine,this.reflectivity=r.reflectivity,this.refractionRatio=r.refractionRatio,this.wireframe=r.wireframe,this.wireframeLinewidth=r.wireframeLinewidth,this.wireframeLinecap=r.wireframeLinecap,this.wireframeLinejoin=r.wireframeLinejoin,this.fog=r.fog,this}}const Vu=null;function EA(){const ue=new ArrayBuffer(4),r=new Float32Array(ue),l=new Uint32Array(ue),h=new Uint32Array(512),p=new Uint32Array(512);for(let te=0;te<256;++te){const se=te-127;se<-27?(h[te]=0,h[te|256]=32768,p[te]=24,p[te|256]=24):se<-14?(h[te]=1024>>-se-14,h[te|256]=1024>>-se-14|32768,p[te]=-se-1,p[te|256]=-se-1):se<=15?(h[te]=se+15<<10,h[te|256]=se+15<<10|32768,p[te]=13,p[te|256]=13):se<128?(h[te]=31744,h[te|256]=64512,p[te]=24,p[te|256]=24):(h[te]=31744,h[te|256]=64512,p[te]=13,p[te|256]=13)}const y=new Uint32Array(2048),T=new Uint32Array(64),O=new Uint32Array(64);for(let te=1;te<1024;++te){let se=te<<13,xe=0;for(;!(se&8388608);)se<<=1,xe-=8388608;se&=-8388609,xe+=947912704,y[te]=se|xe}for(let te=1024;te<2048;++te)y[te]=939524096+(te-1024<<13);for(let te=1;te<31;++te)T[te]=te<<23;T[31]=1199570944,T[32]=2147483648;for(let te=33;te<63;++te)T[te]=2147483648+(te-32<<23);T[63]=3347054592;for(let te=1;te<64;++te)te!==32&&(O[te]=1024);return{floatView:r,uint32View:l,baseTable:h,shiftTable:p,mantissaTable:y,exponentTable:T,offsetTable:O}}function zu(ue){Math.abs(ue)>65504&&na("DataUtils.toHalfFloat(): Value out of range."),ue=ki(ue,-65504,65504),Vu.floatView[0]=ue;const r=Vu.uint32View[0],l=r>>23&511;return Vu.baseTable[l]+((r&8388607)>>Vu.shiftTable[l])}function Wr(ue){const r=ue>>10;return Vu.uint32View[0]=Vu.mantissaTable[Vu.offsetTable[r]+(ue&1023)]+Vu.exponentTable[r],Vu.floatView[0]}class Hc{static toHalfFloat(r){return zu(r)}static fromHalfFloat(r){return Wr(r)}}const yu=new kn,Hl=new qi;let Yl=0;class Ql{constructor(r,l,h=!1){if(Array.isArray(r))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:Yl++}),this.name="",this.array=r,this.itemSize=l,this.count=r!==void 0?r.length/l:0,this.normalized=h,this.usage=oo,this.updateRanges=[],this.gpuType=dt,this.version=0}onUploadCallback(){}set needsUpdate(r){r===!0&&this.version++}setUsage(r){return this.usage=r,this}addUpdateRange(r,l){this.updateRanges.push({start:r,count:l})}clearUpdateRanges(){this.updateRanges.length=0}copy(r){return this.name=r.name,this.array=new r.array.constructor(r.array),this.itemSize=r.itemSize,this.count=r.count,this.normalized=r.normalized,this.usage=r.usage,this.gpuType=r.gpuType,this}copyAt(r,l,h){r*=this.itemSize,h*=l.itemSize;for(let p=0,y=this.itemSize;p<y;p++)this.array[r+p]=l.array[h+p];return this}copyArray(r){return this.array.set(r),this}applyMatrix3(r){if(this.itemSize===2)for(let l=0,h=this.count;l<h;l++)Hl.fromBufferAttribute(this,l),Hl.applyMatrix3(r),this.setXY(l,Hl.x,Hl.y);else if(this.itemSize===3)for(let l=0,h=this.count;l<h;l++)yu.fromBufferAttribute(this,l),yu.applyMatrix3(r),this.setXYZ(l,yu.x,yu.y,yu.z);return this}applyMatrix4(r){for(let l=0,h=this.count;l<h;l++)yu.fromBufferAttribute(this,l),yu.applyMatrix4(r),this.setXYZ(l,yu.x,yu.y,yu.z);return this}applyNormalMatrix(r){for(let l=0,h=this.count;l<h;l++)yu.fromBufferAttribute(this,l),yu.applyNormalMatrix(r),this.setXYZ(l,yu.x,yu.y,yu.z);return this}transformDirection(r){for(let l=0,h=this.count;l<h;l++)yu.fromBufferAttribute(this,l),yu.transformDirection(r),this.setXYZ(l,yu.x,yu.y,yu.z);return this}set(r,l=0){return this.array.set(r,l),this}getComponent(r,l){let h=this.array[r*this.itemSize+l];return this.normalized&&(h=mo(h,this.array)),h}setComponent(r,l,h){return this.normalized&&(h=wa(h,this.array)),this.array[r*this.itemSize+l]=h,this}getX(r){let l=this.array[r*this.itemSize];return this.normalized&&(l=mo(l,this.array)),l}setX(r,l){return this.normalized&&(l=wa(l,this.array)),this.array[r*this.itemSize]=l,this}getY(r){let l=this.array[r*this.itemSize+1];return this.normalized&&(l=mo(l,this.array)),l}setY(r,l){return this.normalized&&(l=wa(l,this.array)),this.array[r*this.itemSize+1]=l,this}getZ(r){let l=this.array[r*this.itemSize+2];return this.normalized&&(l=mo(l,this.array)),l}setZ(r,l){return this.normalized&&(l=wa(l,this.array)),this.array[r*this.itemSize+2]=l,this}getW(r){let l=this.array[r*this.itemSize+3];return this.normalized&&(l=mo(l,this.array)),l}setW(r,l){return this.normalized&&(l=wa(l,this.array)),this.array[r*this.itemSize+3]=l,this}setXY(r,l,h){return r*=this.itemSize,this.normalized&&(l=wa(l,this.array),h=wa(h,this.array)),this.array[r+0]=l,this.array[r+1]=h,this}setXYZ(r,l,h,p){return r*=this.itemSize,this.normalized&&(l=wa(l,this.array),h=wa(h,this.array),p=wa(p,this.array)),this.array[r+0]=l,this.array[r+1]=h,this.array[r+2]=p,this}setXYZW(r,l,h,p,y){return r*=this.itemSize,this.normalized&&(l=wa(l,this.array),h=wa(h,this.array),p=wa(p,this.array),y=wa(y,this.array)),this.array[r+0]=l,this.array[r+1]=h,this.array[r+2]=p,this.array[r+3]=y,this}onUpload(r){return this.onUploadCallback=r,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){const r={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return this.name!==""&&(r.name=this.name),this.usage!==oo&&(r.usage=this.usage),r}}class Km extends null{constructor(r,l,h){super(new Int8Array(r),l,h)}}class Ol extends null{constructor(r,l,h){super(new Uint8Array(r),l,h)}}class Kf extends null{constructor(r,l,h){super(new Uint8ClampedArray(r),l,h)}}class Zv extends null{constructor(r,l,h){super(new Int16Array(r),l,h)}}class ql extends Ql{constructor(r,l,h){super(new Uint16Array(r),l,h)}}class Rp extends null{constructor(r,l,h){super(new Int32Array(r),l,h)}}class $f extends Ql{constructor(r,l,h){super(new Uint32Array(r),l,h)}}class wl extends null{constructor(r,l,h){super(new Uint16Array(r),l,h),this.isFloat16BufferAttribute=!0}getX(r){let l=Wr(this.array[r*this.itemSize]);return this.normalized&&(l=mo(l,this.array)),l}setX(r,l){return this.normalized&&(l=wa(l,this.array)),this.array[r*this.itemSize]=zu(l),this}getY(r){let l=Wr(this.array[r*this.itemSize+1]);return this.normalized&&(l=mo(l,this.array)),l}setY(r,l){return this.normalized&&(l=wa(l,this.array)),this.array[r*this.itemSize+1]=zu(l),this}getZ(r){let l=Wr(this.array[r*this.itemSize+2]);return this.normalized&&(l=mo(l,this.array)),l}setZ(r,l){return this.normalized&&(l=wa(l,this.array)),this.array[r*this.itemSize+2]=zu(l),this}getW(r){let l=Wr(this.array[r*this.itemSize+3]);return this.normalized&&(l=mo(l,this.array)),l}setW(r,l){return this.normalized&&(l=wa(l,this.array)),this.array[r*this.itemSize+3]=zu(l),this}setXY(r,l,h){return r*=this.itemSize,this.normalized&&(l=wa(l,this.array),h=wa(h,this.array)),this.array[r+0]=zu(l),this.array[r+1]=zu(h),this}setXYZ(r,l,h,p){return r*=this.itemSize,this.normalized&&(l=wa(l,this.array),h=wa(h,this.array),p=wa(p,this.array)),this.array[r+0]=zu(l),this.array[r+1]=zu(h),this.array[r+2]=zu(p),this}setXYZW(r,l,h,p,y){return r*=this.itemSize,this.normalized&&(l=wa(l,this.array),h=wa(h,this.array),p=wa(p,this.array),y=wa(y,this.array)),this.array[r+0]=zu(l),this.array[r+1]=zu(h),this.array[r+2]=zu(p),this.array[r+3]=zu(y),this}}class ha extends Ql{constructor(r,l,h){super(new Float32Array(r),l,h)}}let $m=0;const kh=new oi,lm=new _l,qh=new kn,th=new zi,ff=new zi,Yu=new kn;class Ui extends Tu{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:$m++}),this.uuid=Gr(),this.name="",this.type="BufferGeometry",this.index=null,this.indirect=null,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(r){return Array.isArray(r)?this.index=new(Ld(r)?$f:ql)(r,1):this.index=r,this}setIndirect(r){return this.indirect=r,this}getIndirect(){return this.indirect}getAttribute(r){return this.attributes[r]}setAttribute(r,l){return this.attributes[r]=l,this}deleteAttribute(r){return delete this.attributes[r],this}hasAttribute(r){return this.attributes[r]!==void 0}addGroup(r,l,h=0){this.groups.push({start:r,count:l,materialIndex:h})}clearGroups(){this.groups=[]}setDrawRange(r,l){this.drawRange.start=r,this.drawRange.count=l}applyMatrix4(r){const l=this.attributes.position;l!==void 0&&(l.applyMatrix4(r),l.needsUpdate=!0);const h=this.attributes.normal;if(h!==void 0){const y=new vl().getNormalMatrix(r);h.applyNormalMatrix(y),h.needsUpdate=!0}const p=this.attributes.tangent;return p!==void 0&&(p.transformDirection(r),p.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(r){return kh.makeRotationFromQuaternion(r),this.applyMatrix4(kh),this}rotateX(r){return kh.makeRotationX(r),this.applyMatrix4(kh),this}rotateY(r){return kh.makeRotationY(r),this.applyMatrix4(kh),this}rotateZ(r){return kh.makeRotationZ(r),this.applyMatrix4(kh),this}translate(r,l,h){return kh.makeTranslation(r,l,h),this.applyMatrix4(kh),this}scale(r,l,h){return kh.makeScale(r,l,h),this.applyMatrix4(kh),this}lookAt(r){return lm.lookAt(r),lm.updateMatrix(),this.applyMatrix4(lm.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(qh).negate(),this.translate(qh.x,qh.y,qh.z),this}setFromPoints(r){const l=this.getAttribute("position");if(l===void 0){const h=[];for(let p=0,y=r.length;p<y;p++){const T=r[p];h.push(T.x,T.y,T.z||0)}this.setAttribute("position",new ha(h,3))}else{const h=Math.min(r.length,l.count);for(let p=0;p<h;p++){const y=r[p];l.setXYZ(p,y.x,y.y,y.z||0)}r.length>l.count&&na("BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),l.needsUpdate=!0}return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new zi);const r=this.attributes.position,l=this.morphAttributes.position;if(r&&r.isGLBufferAttribute){Wa("BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new kn(-1/0,-1/0,-1/0),new kn(1/0,1/0,1/0));return}if(r!==void 0){if(this.boundingBox.setFromBufferAttribute(r),l)for(let h=0,p=l.length;h<p;h++){const y=l[h];th.setFromBufferAttribute(y),this.morphTargetsRelative?(Yu.addVectors(this.boundingBox.min,th.min),this.boundingBox.expandByPoint(Yu),Yu.addVectors(this.boundingBox.max,th.max),this.boundingBox.expandByPoint(Yu)):(this.boundingBox.expandByPoint(th.min),this.boundingBox.expandByPoint(th.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&Wa('BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new gn);const r=this.attributes.position,l=this.morphAttributes.position;if(r&&r.isGLBufferAttribute){Wa("BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new kn,1/0);return}if(r){const h=this.boundingSphere.center;if(th.setFromBufferAttribute(r),l)for(let y=0,T=l.length;y<T;y++){const O=l[y];ff.setFromBufferAttribute(O),this.morphTargetsRelative?(Yu.addVectors(th.min,ff.min),th.expandByPoint(Yu),Yu.addVectors(th.max,ff.max),th.expandByPoint(Yu)):(th.expandByPoint(ff.min),th.expandByPoint(ff.max))}th.getCenter(h);let p=0;for(let y=0,T=r.count;y<T;y++)Yu.fromBufferAttribute(r,y),p=Math.max(p,h.distanceToSquared(Yu));if(l)for(let y=0,T=l.length;y<T;y++){const O=l[y],te=this.morphTargetsRelative;for(let se=0,xe=O.count;se<xe;se++)Yu.fromBufferAttribute(O,se),te&&(qh.fromBufferAttribute(r,se),Yu.add(qh)),p=Math.max(p,h.distanceToSquared(Yu))}this.boundingSphere.radius=Math.sqrt(p),isNaN(this.boundingSphere.radius)&&Wa('BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){const r=this.index,l=this.attributes;if(r===null||l.position===void 0||l.normal===void 0||l.uv===void 0){Wa("BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}const h=l.position,p=l.normal,y=l.uv;this.hasAttribute("tangent")===!1&&this.setAttribute("tangent",new Ql(new Float32Array(4*h.count),4));const T=this.getAttribute("tangent"),O=[],te=[];for(let mi=0;mi<h.count;mi++)O[mi]=new kn,te[mi]=new kn;const se=new kn,xe=new kn,Ne=new kn,Ve=new qi,We=new qi,tt=new qi,Ot=new kn,An=new kn;function un(mi,ls,ys){se.fromBufferAttribute(h,mi),xe.fromBufferAttribute(h,ls),Ne.fromBufferAttribute(h,ys),Ve.fromBufferAttribute(y,mi),We.fromBufferAttribute(y,ls),tt.fromBufferAttribute(y,ys),xe.sub(se),Ne.sub(se),We.sub(Ve),tt.sub(Ve);const Da=1/(We.x*tt.y-tt.x*We.y);isFinite(Da)&&(Ot.copy(xe).multiplyScalar(tt.y).addScaledVector(Ne,-We.y).multiplyScalar(Da),An.copy(Ne).multiplyScalar(We.x).addScaledVector(xe,-tt.x).multiplyScalar(Da),O[mi].add(Ot),O[ls].add(Ot),O[ys].add(Ot),te[mi].add(An),te[ls].add(An),te[ys].add(An))}let Un=this.groups;Un.length===0&&(Un=[{start:0,count:r.count}]);for(let mi=0,ls=Un.length;mi<ls;++mi){const ys=Un[mi],Da=ys.start,Mo=ys.count;for(let Ro=Da,du=Da+Mo;Ro<du;Ro+=3)un(r.getX(Ro+0),r.getX(Ro+1),r.getX(Ro+2))}const Vn=new kn,nr=new kn,ii=new kn,pi=new kn;function Bi(mi){ii.fromBufferAttribute(p,mi),pi.copy(ii);const ls=O[mi];Vn.copy(ls),Vn.sub(ii.multiplyScalar(ii.dot(ls))).normalize(),nr.crossVectors(pi,ls);const Da=nr.dot(te[mi])<0?-1:1;T.setXYZW(mi,Vn.x,Vn.y,Vn.z,Da)}for(let mi=0,ls=Un.length;mi<ls;++mi){const ys=Un[mi],Da=ys.start,Mo=ys.count;for(let Ro=Da,du=Da+Mo;Ro<du;Ro+=3)Bi(r.getX(Ro+0)),Bi(r.getX(Ro+1)),Bi(r.getX(Ro+2))}}computeVertexNormals(){const r=this.index,l=this.getAttribute("position");if(l!==void 0){let h=this.getAttribute("normal");if(h===void 0)h=new Ql(new Float32Array(l.count*3),3),this.setAttribute("normal",h);else for(let Ve=0,We=h.count;Ve<We;Ve++)h.setXYZ(Ve,0,0,0);const p=new kn,y=new kn,T=new kn,O=new kn,te=new kn,se=new kn,xe=new kn,Ne=new kn;if(r)for(let Ve=0,We=r.count;Ve<We;Ve+=3){const tt=r.getX(Ve+0),Ot=r.getX(Ve+1),An=r.getX(Ve+2);p.fromBufferAttribute(l,tt),y.fromBufferAttribute(l,Ot),T.fromBufferAttribute(l,An),xe.subVectors(T,y),Ne.subVectors(p,y),xe.cross(Ne),O.fromBufferAttribute(h,tt),te.fromBufferAttribute(h,Ot),se.fromBufferAttribute(h,An),O.add(xe),te.add(xe),se.add(xe),h.setXYZ(tt,O.x,O.y,O.z),h.setXYZ(Ot,te.x,te.y,te.z),h.setXYZ(An,se.x,se.y,se.z)}else for(let Ve=0,We=l.count;Ve<We;Ve+=3)p.fromBufferAttribute(l,Ve+0),y.fromBufferAttribute(l,Ve+1),T.fromBufferAttribute(l,Ve+2),xe.subVectors(T,y),Ne.subVectors(p,y),xe.cross(Ne),h.setXYZ(Ve+0,xe.x,xe.y,xe.z),h.setXYZ(Ve+1,xe.x,xe.y,xe.z),h.setXYZ(Ve+2,xe.x,xe.y,xe.z);this.normalizeNormals(),h.needsUpdate=!0}}normalizeNormals(){const r=this.attributes.normal;for(let l=0,h=r.count;l<h;l++)Yu.fromBufferAttribute(r,l),Yu.normalize(),r.setXYZ(l,Yu.x,Yu.y,Yu.z)}toNonIndexed(){function r(O,te){const se=O.array,xe=O.itemSize,Ne=O.normalized,Ve=new se.constructor(te.length*xe);let We=0,tt=0;for(let Ot=0,An=te.length;Ot<An;Ot++){O.isInterleavedBufferAttribute?We=te[Ot]*O.data.stride+O.offset:We=te[Ot]*xe;for(let un=0;un<xe;un++)Ve[tt++]=se[We++]}return new Ql(Ve,xe,Ne)}if(this.index===null)return na("BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const l=new Ui,h=this.index.array,p=this.attributes;for(const O in p){const te=p[O],se=r(te,h);l.setAttribute(O,se)}const y=this.morphAttributes;for(const O in y){const te=[],se=y[O];for(let xe=0,Ne=se.length;xe<Ne;xe++){const Ve=se[xe],We=r(Ve,h);te.push(We)}l.morphAttributes[O]=te}l.morphTargetsRelative=this.morphTargetsRelative;const T=this.groups;for(let O=0,te=T.length;O<te;O++){const se=T[O];l.addGroup(se.start,se.count,se.materialIndex)}return l}toJSON(){const r={metadata:{version:4.7,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(r.uuid=this.uuid,r.type=this.type,this.name!==""&&(r.name=this.name),Object.keys(this.userData).length>0&&(r.userData=this.userData),this.parameters!==void 0){const te=this.parameters;for(const se in te)te[se]!==void 0&&(r[se]=te[se]);return r}r.data={attributes:{}};const l=this.index;l!==null&&(r.data.index={type:l.array.constructor.name,array:Array.prototype.slice.call(l.array)});const h=this.attributes;for(const te in h){const se=h[te];r.data.attributes[te]=se.toJSON(r.data)}const p={};let y=!1;for(const te in this.morphAttributes){const se=this.morphAttributes[te],xe=[];for(let Ne=0,Ve=se.length;Ne<Ve;Ne++){const We=se[Ne];xe.push(We.toJSON(r.data))}xe.length>0&&(p[te]=xe,y=!0)}y&&(r.data.morphAttributes=p,r.data.morphTargetsRelative=this.morphTargetsRelative);const T=this.groups;T.length>0&&(r.data.groups=JSON.parse(JSON.stringify(T)));const O=this.boundingSphere;return O!==null&&(r.data.boundingSphere=O.toJSON()),r}clone(){return new this.constructor().copy(this)}copy(r){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const l={};this.name=r.name;const h=r.index;h!==null&&this.setIndex(h.clone());const p=r.attributes;for(const se in p){const xe=p[se];this.setAttribute(se,xe.clone(l))}const y=r.morphAttributes;for(const se in y){const xe=[],Ne=y[se];for(let Ve=0,We=Ne.length;Ve<We;Ve++)xe.push(Ne[Ve].clone(l));this.morphAttributes[se]=xe}this.morphTargetsRelative=r.morphTargetsRelative;const T=r.groups;for(let se=0,xe=T.length;se<xe;se++){const Ne=T[se];this.addGroup(Ne.start,Ne.count,Ne.materialIndex)}const O=r.boundingBox;O!==null&&(this.boundingBox=O.clone());const te=r.boundingSphere;return te!==null&&(this.boundingSphere=te.clone()),this.drawRange.start=r.drawRange.start,this.drawRange.count=r.drawRange.count,this.userData=r.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}}const Fc=new oi,Gu=new gi,CA=new gn,Xf=new kn,cc=new kn,Vd=new kn,Ru=new kn,ka=new kn,Af=new kn,Sl=new kn,xd=new kn;class zd extends _l{constructor(r=new Ui,l=new Dh){super(),this.isMesh=!0,this.type="Mesh",this.geometry=r,this.material=l,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.count=1,this.updateMorphTargets()}copy(r,l){return super.copy(r,l),r.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=r.morphTargetInfluences.slice()),r.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},r.morphTargetDictionary)),this.material=Array.isArray(r.material)?r.material.slice():r.material,this.geometry=r.geometry,this}updateMorphTargets(){const l=this.geometry.morphAttributes,h=Object.keys(l);if(h.length>0){const p=l[h[0]];if(p!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let y=0,T=p.length;y<T;y++){const O=p[y].name||String(y);this.morphTargetInfluences.push(0),this.morphTargetDictionary[O]=y}}}}getVertexPosition(r,l){const h=this.geometry,p=h.attributes.position,y=h.morphAttributes.position,T=h.morphTargetsRelative;l.fromBufferAttribute(p,r);const O=this.morphTargetInfluences;if(y&&O){Af.set(0,0,0);for(let te=0,se=y.length;te<se;te++){const xe=O[te],Ne=y[te];xe!==0&&(ka.fromBufferAttribute(Ne,r),T?Af.addScaledVector(ka,xe):Af.addScaledVector(ka.sub(l),xe))}l.add(Af)}return l}raycast(r,l){const h=this.geometry,p=this.material,y=this.matrixWorld;p!==void 0&&(h.boundingSphere===null&&h.computeBoundingSphere(),CA.copy(h.boundingSphere),CA.applyMatrix4(y),Gu.copy(r.ray).recast(r.near),!(CA.containsPoint(Gu.origin)===!1&&(Gu.intersectSphere(CA,Xf)===null||Gu.origin.distanceToSquared(Xf)>Bp(r.far-r.near,2)))&&(Fc.copy(y).invert(),Gu.copy(r.ray).applyMatrix4(Fc),!(h.boundingBox!==null&&Gu.intersectsBox(h.boundingBox)===!1)&&this._computeIntersections(r,l,Gu)))}_computeIntersections(r,l,h){let p;const y=this.geometry,T=this.material,O=y.index,te=y.attributes.position,se=y.attributes.uv,xe=y.attributes.uv1,Ne=y.attributes.normal,Ve=y.groups,We=y.drawRange;if(O!==null)if(Array.isArray(T))for(let tt=0,Ot=Ve.length;tt<Ot;tt++){const An=Ve[tt],un=T[An.materialIndex],Un=Math.max(An.start,We.start),Vn=Math.min(O.count,Math.min(An.start+An.count,We.start+We.count));for(let nr=Un,ii=Vn;nr<ii;nr+=3){const pi=O.getX(nr),Bi=O.getX(nr+1),mi=O.getX(nr+2);p=Gd(this,un,r,h,se,xe,Ne,pi,Bi,mi),p&&(p.faceIndex=Math.floor(nr/3),p.face.materialIndex=An.materialIndex,l.push(p))}}else{const tt=Math.max(0,We.start),Ot=Math.min(O.count,We.start+We.count);for(let An=tt,un=Ot;An<un;An+=3){const Un=O.getX(An),Vn=O.getX(An+1),nr=O.getX(An+2);p=Gd(this,T,r,h,se,xe,Ne,Un,Vn,nr),p&&(p.faceIndex=Math.floor(An/3),l.push(p))}}else if(te!==void 0)if(Array.isArray(T))for(let tt=0,Ot=Ve.length;tt<Ot;tt++){const An=Ve[tt],un=T[An.materialIndex],Un=Math.max(An.start,We.start),Vn=Math.min(te.count,Math.min(An.start+An.count,We.start+We.count));for(let nr=Un,ii=Vn;nr<ii;nr+=3){const pi=nr,Bi=nr+1,mi=nr+2;p=Gd(this,un,r,h,se,xe,Ne,pi,Bi,mi),p&&(p.faceIndex=Math.floor(nr/3),p.face.materialIndex=An.materialIndex,l.push(p))}}else{const tt=Math.max(0,We.start),Ot=Math.min(te.count,We.start+We.count);for(let An=tt,un=Ot;An<un;An+=3){const Un=An,Vn=An+1,nr=An+2;p=Gd(this,T,r,h,se,xe,Ne,Un,Vn,nr),p&&(p.faceIndex=Math.floor(An/3),l.push(p))}}}}function TA(ue,r,l,h,p,y,T,O){let te;if(r.side===de?te=h.intersectTriangle(T,y,p,!0,O):te=h.intersectTriangle(p,y,T,r.side===j,O),te===null)return null;xd.copy(O),xd.applyMatrix4(ue.matrixWorld);const se=l.ray.origin.distanceTo(xd);return se<l.near||se>l.far?null:{distance:se,point:xd.clone(),object:ue}}function Gd(ue,r,l,h,p,y,T,O,te,se){ue.getVertexPosition(O,cc),ue.getVertexPosition(te,Vd),ue.getVertexPosition(se,Ru);const xe=TA(ue,r,l,h,cc,Vd,Ru,Sl);if(xe){const Ne=new kn;Bl.getBarycoord(Sl,cc,Vd,Ru,Ne),p&&(xe.uv=Bl.getInterpolatedAttribute(p,O,te,se,Ne,new qi)),y&&(xe.uv1=Bl.getInterpolatedAttribute(y,O,te,se,Ne,new qi)),T&&(xe.normal=Bl.getInterpolatedAttribute(T,O,te,se,Ne,new kn),xe.normal.dot(h.direction)>0&&xe.normal.multiplyScalar(-1));const Ve={a:O,b:te,c:se,normal:new kn,materialIndex:0};Bl.getNormal(cc,Vd,Ru,Ve.normal),xe.face=Ve,xe.barycoord=Ne}return xe}class Hd extends Ui{constructor(r=1,l=1,h=1,p=1,y=1,T=1){super(),this.type="BoxGeometry",this.parameters={width:r,height:l,depth:h,widthSegments:p,heightSegments:y,depthSegments:T};const O=this;p=Math.floor(p),y=Math.floor(y),T=Math.floor(T);const te=[],se=[],xe=[],Ne=[];let Ve=0,We=0;tt("z","y","x",-1,-1,h,l,r,T,y,0),tt("z","y","x",1,-1,h,l,-r,T,y,1),tt("x","z","y",1,1,r,h,l,p,T,2),tt("x","z","y",1,-1,r,h,-l,p,T,3),tt("x","y","z",1,-1,r,l,h,p,y,4),tt("x","y","z",-1,-1,r,l,-h,p,y,5),this.setIndex(te),this.setAttribute("position",new ha(se,3)),this.setAttribute("normal",new ha(xe,3)),this.setAttribute("uv",new ha(Ne,2));function tt(Ot,An,un,Un,Vn,nr,ii,pi,Bi,mi,ls){const ys=nr/Bi,Da=ii/mi,Mo=nr/2,Ro=ii/2,du=pi/2,ru=Bi+1,Zc=mi+1;let Ih=0,uA=0;const Ac=new kn;for(let Uc=0;Uc<Zc;Uc++){const tc=Uc*Da-Ro;for(let Lf=0;Lf<ru;Lf++){const ad=Lf*ys-Mo;Ac[Ot]=ad*Un,Ac[An]=tc*Vn,Ac[un]=du,se.push(Ac.x,Ac.y,Ac.z),Ac[Ot]=0,Ac[An]=0,Ac[un]=pi>0?1:-1,xe.push(Ac.x,Ac.y,Ac.z),Ne.push(Lf/Bi),Ne.push(1-Uc/mi),Ih+=1}}for(let Uc=0;Uc<mi;Uc++)for(let tc=0;tc<Bi;tc++){const Lf=Ve+tc+ru*Uc,ad=Ve+tc+ru*(Uc+1),Tm=Ve+(tc+1)+ru*(Uc+1),Gg=Ve+(tc+1)+ru*Uc;te.push(Lf,ad,Gg),te.push(ad,Tm,Gg),uA+=6}O.addGroup(We,uA,ls),We+=uA,Ve+=Ih}}copy(r){return super.copy(r),this.parameters=Object.assign({},r.parameters),this}static fromJSON(r){return new Hd(r.width,r.height,r.depth,r.widthSegments,r.heightSegments,r.depthSegments)}}function pf(ue){const r={};for(const l in ue){r[l]={};for(const h in ue[l]){const p=ue[l][h];p&&(p.isColor||p.isMatrix3||p.isMatrix4||p.isVector2||p.isVector3||p.isVector4||p.isTexture||p.isQuaternion)?p.isRenderTargetTexture?(na("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),r[l][h]=null):r[l][h]=p.clone():Array.isArray(p)?r[l][h]=p.slice():r[l][h]=p}}return r}function Ip(ue){const r={};for(let l=0;l<ue.length;l++){const h=pf(ue[l]);for(const p in h)r[p]=h[p]}return r}function _g(ue){const r=[];for(let l=0;l<ue.length;l++)r.push(ue[l].clone());return r}function ip(ue){const r=ue.getRenderTarget();return r===null?ue.outputColorSpace:r.isXRRenderTarget===!0?r.texture.colorSpace:le.workingColorSpace}const Il={clone:pf,merge:Ip};var um=`void main() {
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
}`,sp=`void main() {
gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );
}`;class bd extends null{constructor(r){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=um,this.fragmentShader=sp,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,r!==void 0&&this.setValues(r)}copy(r){return super.copy(r),this.fragmentShader=r.fragmentShader,this.vertexShader=r.vertexShader,this.uniforms=pf(r.uniforms),this.uniformsGroups=_g(r.uniformsGroups),this.defines=Object.assign({},r.defines),this.wireframe=r.wireframe,this.wireframeLinewidth=r.wireframeLinewidth,this.fog=r.fog,this.lights=r.lights,this.clipping=r.clipping,this.extensions=Object.assign({},r.extensions),this.glslVersion=r.glslVersion,this}toJSON(r){const l=super.toJSON(r);l.glslVersion=this.glslVersion,l.uniforms={};for(const p in this.uniforms){const T=this.uniforms[p].value;T&&T.isTexture?l.uniforms[p]={type:"t",value:T.toJSON(r).uuid}:T&&T.isColor?l.uniforms[p]={type:"c",value:T.getHex()}:T&&T.isVector2?l.uniforms[p]={type:"v2",value:T.toArray()}:T&&T.isVector3?l.uniforms[p]={type:"v3",value:T.toArray()}:T&&T.isVector4?l.uniforms[p]={type:"v4",value:T.toArray()}:T&&T.isMatrix3?l.uniforms[p]={type:"m3",value:T.toArray()}:T&&T.isMatrix4?l.uniforms[p]={type:"m4",value:T.toArray()}:l.uniforms[p]={value:T}}Object.keys(this.defines).length>0&&(l.defines=this.defines),l.vertexShader=this.vertexShader,l.fragmentShader=this.fragmentShader,l.lights=this.lights,l.clipping=this.clipping;const h={};for(const p in this.extensions)this.extensions[p]===!0&&(h[p]=!0);return Object.keys(h).length>0&&(l.extensions=h),l}}class jf extends _l{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new oi,this.projectionMatrix=new oi,this.projectionMatrixInverse=new oi,this.coordinateSystem=Cu,this._reversedDepth=!1}get reversedDepth(){return this._reversedDepth}copy(r,l){return super.copy(r,l),this.matrixWorldInverse.copy(r.matrixWorldInverse),this.projectionMatrix.copy(r.projectionMatrix),this.projectionMatrixInverse.copy(r.projectionMatrixInverse),this.coordinateSystem=r.coordinateSystem,this}getWorldDirection(r){return super.getWorldDirection(r).negate()}updateMatrixWorld(r){super.updateMatrixWorld(r),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(r,l){super.updateWorldMatrix(r,l),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}}const Jl=new kn,cm=new qi,wg=new qi;class Vh extends null{constructor(r=50,l=1,h=.1,p=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=r,this.zoom=1,this.near=h,this.far=p,this.focus=10,this.aspect=l,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(r,l){return super.copy(r,l),this.fov=r.fov,this.zoom=r.zoom,this.near=r.near,this.far=r.far,this.focus=r.focus,this.aspect=r.aspect,this.view=r.view===null?null:Object.assign({},r.view),this.filmGauge=r.filmGauge,this.filmOffset=r.filmOffset,this}setFocalLength(r){const l=.5*this.getFilmHeight()/r;this.fov=Lr*2*Math.atan(l),this.updateProjectionMatrix()}getFocalLength(){const r=Math.tan(ac*.5*this.fov);return .5*this.getFilmHeight()/r}getEffectiveFOV(){return Lr*2*Math.atan(Math.tan(ac*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(r,l,h){Jl.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),l.set(Jl.x,Jl.y).multiplyScalar(-r/Jl.z),Jl.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),h.set(Jl.x,Jl.y).multiplyScalar(-r/Jl.z)}getViewSize(r,l){return this.getViewBounds(r,cm,wg),l.subVectors(wg,cm)}setViewOffset(r,l,h,p,y,T){this.aspect=r/l,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=r,this.view.fullHeight=l,this.view.offsetX=h,this.view.offsetY=p,this.view.width=y,this.view.height=T,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const r=this.near;let l=r*Math.tan(ac*.5*this.fov)/this.zoom,h=2*l,p=this.aspect*h,y=-.5*p;const T=this.view;if(this.view!==null&&this.view.enabled){const te=T.fullWidth,se=T.fullHeight;y+=T.offsetX*p/te,l-=T.offsetY*h/se,p*=T.width/te,h*=T.height/se}const O=this.filmOffset;O!==0&&(y+=r*O/this.getFilmWidth()),this.projectionMatrix.makePerspective(y,y+p,l,l-h,r,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(r){const l=super.toJSON(r);return l.object.fov=this.fov,l.object.zoom=this.zoom,l.object.near=this.near,l.object.far=this.far,l.object.focus=this.focus,l.object.aspect=this.aspect,this.view!==null&&(l.object.view=Object.assign({},this.view)),l.object.filmGauge=this.filmGauge,l.object.filmOffset=this.filmOffset,l}}const Pc=null,Jh=1;class nh extends null{constructor(r,l,h){super(),this.type="CubeCamera",this.renderTarget=h,this.coordinateSystem=null,this.activeMipmapLevel=0;const p=new Vh(Pc,Jh,r,l);p.layers=this.layers,this.add(p);const y=new Vh(Pc,Jh,r,l);y.layers=this.layers,this.add(y);const T=new Vh(Pc,Jh,r,l);T.layers=this.layers,this.add(T);const O=new Vh(Pc,Jh,r,l);O.layers=this.layers,this.add(O);const te=new Vh(Pc,Jh,r,l);te.layers=this.layers,this.add(te);const se=new Vh(Pc,Jh,r,l);se.layers=this.layers,this.add(se)}updateCoordinateSystem(){const r=this.coordinateSystem,l=this.children.concat(),[h,p,y,T,O,te]=l;for(const se of l)this.remove(se);if(r===Cu)h.up.set(0,1,0),h.lookAt(1,0,0),p.up.set(0,1,0),p.lookAt(-1,0,0),y.up.set(0,0,-1),y.lookAt(0,1,0),T.up.set(0,0,1),T.lookAt(0,-1,0),O.up.set(0,1,0),O.lookAt(0,0,1),te.up.set(0,1,0),te.lookAt(0,0,-1);else if(r===zc)h.up.set(0,-1,0),h.lookAt(-1,0,0),p.up.set(0,-1,0),p.lookAt(1,0,0),y.up.set(0,0,1),y.lookAt(0,1,0),T.up.set(0,0,-1),T.lookAt(0,-1,0),O.up.set(0,-1,0),O.lookAt(0,0,1),te.up.set(0,-1,0),te.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+r);for(const se of l)this.add(se),se.updateMatrixWorld()}update(r,l){this.parent===null&&this.updateMatrixWorld();const{renderTarget:h,activeMipmapLevel:p}=this;this.coordinateSystem!==r.coordinateSystem&&(this.coordinateSystem=r.coordinateSystem,this.updateCoordinateSystem());const[y,T,O,te,se,xe]=this.children,Ne=r.getRenderTarget(),Ve=r.getActiveCubeFace(),We=r.getActiveMipmapLevel(),tt=r.xr.enabled;r.xr.enabled=!1;const Ot=h.texture.generateMipmaps;h.texture.generateMipmaps=!1,r.setRenderTarget(h,0,p),r.render(l,y),r.setRenderTarget(h,1,p),r.render(l,T),r.setRenderTarget(h,2,p),r.render(l,O),r.setRenderTarget(h,3,p),r.render(l,te),r.setRenderTarget(h,4,p),r.render(l,se),h.texture.generateMipmaps=Ot,r.setRenderTarget(h,5,p),r.render(l,xe),r.setRenderTarget(Ne,Ve,We),r.xr.enabled=tt,h.texture.needsPMREMUpdate=!0}}class Qd extends null{constructor(r=[],l=it,h,p,y,T,O,te,se,xe){super(r,l,h,p,y,T,O,te,se,xe),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(r){this.image=r}}class Wd extends null{constructor(r=1,l={}){super(r,r,l),this.isWebGLCubeRenderTarget=!0;const h={width:r,height:r,depth:1},p=[h,h,h,h,h,h];this.texture=new Qd(p),this._setTextureOptions(l),this.texture.isRenderTargetTexture=!0}fromEquirectangularTexture(r,l){this.texture.type=l.type,this.texture.colorSpace=l.colorSpace,this.texture.generateMipmaps=l.generateMipmaps,this.texture.minFilter=l.minFilter,this.texture.magFilter=l.magFilter;const h={uniforms:{tEquirect:{value:null}},vertexShader:`
varying vec3 vWorldDirection;
vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
}
void main() {
vWorldDirection = transformDirection( position, modelMatrix );
#include <begin_vertex>
#include <project_vertex>
}
`,fragmentShader:`
uniform sampler2D tEquirect;
varying vec3 vWorldDirection;
#include <common>
void main() {
vec3 direction = normalize( vWorldDirection );
vec2 sampleUV = equirectUv( direction );
gl_FragColor = texture2D( tEquirect, sampleUV );
}
`},p=new Hd(5,5,5),y=new bd({name:"CubemapFromEquirect",uniforms:pf(h.uniforms),vertexShader:h.vertexShader,fragmentShader:h.fragmentShader,side:de,blending:we});y.uniforms.tEquirect.value=l;const T=new zd(p,y),O=l.minFilter;return l.minFilter===yi&&(l.minFilter=vr),new nh(1,10,this).update(r,T),l.minFilter=O,T.geometry.dispose(),T.material.dispose(),this}clear(r,l=!0,h=!0,p=!0){const y=r.getRenderTarget();for(let T=0;T<6;T++)r.setRenderTarget(this,T),r.clear(l,h,p);r.setRenderTarget(y)}}class xu extends _l{constructor(){super(),this.isGroup=!0,this.type="Group"}}const Sg={type:"move"};class vo{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new xu,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 xu,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new kn,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new kn),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new xu,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new kn,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new kn),this._grip}dispatchEvent(r){return this._targetRay!==null&&this._targetRay.dispatchEvent(r),this._grip!==null&&this._grip.dispatchEvent(r),this._hand!==null&&this._hand.dispatchEvent(r),this}connect(r){if(r&&r.hand){const l=this._hand;if(l)for(const h of r.hand.values())this._getHandJoint(l,h)}return this.dispatchEvent({type:"connected",data:r}),this}disconnect(r){return this.dispatchEvent({type:"disconnected",data:r}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(r,l,h){let p=null,y=null,T=null;const O=this._targetRay,te=this._grip,se=this._hand;if(r&&l.session.visibilityState!=="visible-blurred"){if(se&&r.hand){T=!0;for(const Ot of r.hand.values()){const An=l.getJointPose(Ot,h),un=this._getHandJoint(se,Ot);An!==null&&(un.matrix.fromArray(An.transform.matrix),un.matrix.decompose(un.position,un.rotation,un.scale),un.matrixWorldNeedsUpdate=!0,un.jointRadius=An.radius),un.visible=An!==null}const xe=se.joints["index-finger-tip"],Ne=se.joints["thumb-tip"],Ve=xe.position.distanceTo(Ne.position),We=.02,tt=.005;se.inputState.pinching&&Ve>We+tt?(se.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:r.handedness,target:this})):!se.inputState.pinching&&Ve<=We-tt&&(se.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:r.handedness,target:this}))}else te!==null&&r.gripSpace&&(y=l.getPose(r.gripSpace,h),y!==null&&(te.matrix.fromArray(y.transform.matrix),te.matrix.decompose(te.position,te.rotation,te.scale),te.matrixWorldNeedsUpdate=!0,y.linearVelocity?(te.hasLinearVelocity=!0,te.linearVelocity.copy(y.linearVelocity)):te.hasLinearVelocity=!1,y.angularVelocity?(te.hasAngularVelocity=!0,te.angularVelocity.copy(y.angularVelocity)):te.hasAngularVelocity=!1));O!==null&&(p=l.getPose(r.targetRaySpace,h),p===null&&y!==null&&(p=y),p!==null&&(O.matrix.fromArray(p.transform.matrix),O.matrix.decompose(O.position,O.rotation,O.scale),O.matrixWorldNeedsUpdate=!0,p.linearVelocity?(O.hasLinearVelocity=!0,O.linearVelocity.copy(p.linearVelocity)):O.hasLinearVelocity=!1,p.angularVelocity?(O.hasAngularVelocity=!0,O.angularVelocity.copy(p.angularVelocity)):O.hasAngularVelocity=!1,this.dispatchEvent(Sg)))}return O!==null&&(O.visible=p!==null),te!==null&&(te.visible=y!==null),se!==null&&(se.visible=T!==null),this}_getHandJoint(r,l){if(r.joints[l.jointName]===void 0){const h=new xu;h.matrixAutoUpdate=!1,h.visible=!1,r.joints[l.jointName]=h,r.add(h)}return r.joints[l.jointName]}}class gf{constructor(r,l=25e-5){this.isFogExp2=!0,this.name="",this.color=new Ea(r),this.density=l}clone(){return new gf(this.color,this.density)}toJSON(){return{type:"FogExp2",name:this.name,color:this.color.getHex(),density:this.density}}}class mf{constructor(r,l=1,h=1e3){this.isFog=!0,this.name="",this.color=new Ea(r),this.near=l,this.far=h}clone(){return new mf(this.color,this.near,this.far)}toJSON(){return{type:"Fog",name:this.name,color:this.color.getHex(),near:this.near,far:this.far}}}class Np extends null{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 Rs,this.environmentIntensity=1,this.environmentRotation=new Rs,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__!="undefined"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(r,l){return super.copy(r,l),r.background!==null&&(this.background=r.background.clone()),r.environment!==null&&(this.environment=r.environment.clone()),r.fog!==null&&(this.fog=r.fog.clone()),this.backgroundBlurriness=r.backgroundBlurriness,this.backgroundIntensity=r.backgroundIntensity,this.backgroundRotation.copy(r.backgroundRotation),this.environmentIntensity=r.environmentIntensity,this.environmentRotation.copy(r.environmentRotation),r.overrideMaterial!==null&&(this.overrideMaterial=r.overrideMaterial.clone()),this.matrixAutoUpdate=r.matrixAutoUpdate,this}toJSON(r){const l=super.toJSON(r);return this.fog!==null&&(l.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(l.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(l.object.backgroundIntensity=this.backgroundIntensity),l.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(l.object.environmentIntensity=this.environmentIntensity),l.object.environmentRotation=this.environmentRotation.toArray(),l}}class rh{constructor(r,l){this.isInterleavedBuffer=!0,this.array=r,this.stride=l,this.count=r!==void 0?r.length/l:0,this.usage=oo,this.updateRanges=[],this.version=0,this.uuid=Gr()}onUploadCallback(){}set needsUpdate(r){r===!0&&this.version++}setUsage(r){return this.usage=r,this}addUpdateRange(r,l){this.updateRanges.push({start:r,count:l})}clearUpdateRanges(){this.updateRanges.length=0}copy(r){return this.array=new r.array.constructor(r.array),this.count=r.count,this.stride=r.stride,this.usage=r.usage,this}copyAt(r,l,h){r*=this.stride,h*=l.stride;for(let p=0,y=this.stride;p<y;p++)this.array[r+p]=l.array[h+p];return this}set(r,l=0){return this.array.set(r,l),this}clone(r){r.arrayBuffers===void 0&&(r.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=Gr()),r.arrayBuffers[this.array.buffer._uuid]===void 0&&(r.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);const l=new this.array.constructor(r.arrayBuffers[this.array.buffer._uuid]),h=new this.constructor(l,this.stride);return h.setUsage(this.usage),h}onUpload(r){return this.onUploadCallback=r,this}toJSON(r){return r.arrayBuffers===void 0&&(r.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=Gr()),r.arrayBuffers[this.array.buffer._uuid]===void 0&&(r.arrayBuffers[this.array.buffer._uuid]=Array.from(new Uint32Array(this.array.buffer))),{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}}const Mc=new kn;class ih{constructor(r,l,h,p=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=r,this.itemSize=l,this.offset=h,this.normalized=p}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(r){this.data.needsUpdate=r}applyMatrix4(r){for(let l=0,h=this.data.count;l<h;l++)Mc.fromBufferAttribute(this,l),Mc.applyMatrix4(r),this.setXYZ(l,Mc.x,Mc.y,Mc.z);return this}applyNormalMatrix(r){for(let l=0,h=this.count;l<h;l++)Mc.fromBufferAttribute(this,l),Mc.applyNormalMatrix(r),this.setXYZ(l,Mc.x,Mc.y,Mc.z);return this}transformDirection(r){for(let l=0,h=this.count;l<h;l++)Mc.fromBufferAttribute(this,l),Mc.transformDirection(r),this.setXYZ(l,Mc.x,Mc.y,Mc.z);return this}getComponent(r,l){let h=this.array[r*this.data.stride+this.offset+l];return this.normalized&&(h=mo(h,this.array)),h}setComponent(r,l,h){return this.normalized&&(h=wa(h,this.array)),this.data.array[r*this.data.stride+this.offset+l]=h,this}setX(r,l){return this.normalized&&(l=wa(l,this.array)),this.data.array[r*this.data.stride+this.offset]=l,this}setY(r,l){return this.normalized&&(l=wa(l,this.array)),this.data.array[r*this.data.stride+this.offset+1]=l,this}setZ(r,l){return this.normalized&&(l=wa(l,this.array)),this.data.array[r*this.data.stride+this.offset+2]=l,this}setW(r,l){return this.normalized&&(l=wa(l,this.array)),this.data.array[r*this.data.stride+this.offset+3]=l,this}getX(r){let l=this.data.array[r*this.data.stride+this.offset];return this.normalized&&(l=mo(l,this.array)),l}getY(r){let l=this.data.array[r*this.data.stride+this.offset+1];return this.normalized&&(l=mo(l,this.array)),l}getZ(r){let l=this.data.array[r*this.data.stride+this.offset+2];return this.normalized&&(l=mo(l,this.array)),l}getW(r){let l=this.data.array[r*this.data.stride+this.offset+3];return this.normalized&&(l=mo(l,this.array)),l}setXY(r,l,h){return r=r*this.data.stride+this.offset,this.normalized&&(l=wa(l,this.array),h=wa(h,this.array)),this.data.array[r+0]=l,this.data.array[r+1]=h,this}setXYZ(r,l,h,p){return r=r*this.data.stride+this.offset,this.normalized&&(l=wa(l,this.array),h=wa(h,this.array),p=wa(p,this.array)),this.data.array[r+0]=l,this.data.array[r+1]=h,this.data.array[r+2]=p,this}setXYZW(r,l,h,p,y){return r=r*this.data.stride+this.offset,this.normalized&&(l=wa(l,this.array),h=wa(h,this.array),p=wa(p,this.array),y=wa(y,this.array)),this.data.array[r+0]=l,this.data.array[r+1]=h,this.data.array[r+2]=p,this.data.array[r+3]=y,this}clone(r){if(r===void 0){_o("InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.");const l=[];for(let h=0;h<this.count;h++){const p=h*this.data.stride+this.offset;for(let y=0;y<this.itemSize;y++)l.push(this.data.array[p+y])}return new Ql(new this.array.constructor(l),this.itemSize,this.normalized)}else return r.interleavedBuffers===void 0&&(r.interleavedBuffers={}),r.interleavedBuffers[this.data.uuid]===void 0&&(r.interleavedBuffers[this.data.uuid]=this.data.clone(r)),new ih(r.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(r){if(r===void 0){_o("InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.");const l=[];for(let h=0;h<this.count;h++){const p=h*this.data.stride+this.offset;for(let y=0;y<this.itemSize;y++)l.push(this.data.array[p+y])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:l,normalized:this.normalized}}else return r.interleavedBuffers===void 0&&(r.interleavedBuffers={}),r.interleavedBuffers[this.data.uuid]===void 0&&(r.interleavedBuffers[this.data.uuid]=this.data.toJSON(r)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}}class Fp extends ku{constructor(r){super(),this.isSpriteMaterial=!0,this.type="SpriteMaterial",this.color=new Ea(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.fog=!0,this.setValues(r)}copy(r){return super.copy(r),this.color.copy(r.color),this.map=r.map,this.alphaMap=r.alphaMap,this.rotation=r.rotation,this.sizeAttenuation=r.sizeAttenuation,this.fog=r.fog,this}}let Ra;const Hu=new kn,vf=new kn,_d=new kn,wh=new qi,Iu=new qi,yf=new oi,BA=new kn,Lc=new kn,xf=new kn,Sh=new qi,bf=new qi,Yf=new qi;class RA extends _l{constructor(r=new Fp){if(super(),this.isSprite=!0,this.type="Sprite",Ra===void 0){Ra=new Ui;const l=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),h=new rh(l,5);Ra.setIndex([0,1,2,0,2,3]),Ra.setAttribute("position",new ih(h,3,0,!1)),Ra.setAttribute("uv",new ih(h,2,3,!1))}this.geometry=Ra,this.material=r,this.center=new qi(.5,.5),this.count=1}raycast(r,l){r.camera===null&&Wa('Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),vf.setFromMatrixScale(this.matrixWorld),yf.copy(r.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(r.camera.matrixWorldInverse,this.matrixWorld),_d.setFromMatrixPosition(this.modelViewMatrix),r.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&vf.multiplyScalar(-_d.z);const h=this.material.rotation;let p,y;h!==0&&(y=Math.cos(h),p=Math.sin(h));const T=this.center;wd(BA.set(-.5,-.5,0),_d,T,vf,p,y),wd(Lc.set(.5,-.5,0),_d,T,vf,p,y),wd(xf.set(.5,.5,0),_d,T,vf,p,y),Sh.set(0,0),bf.set(1,0),Yf.set(1,1);let O=r.ray.intersectTriangle(BA,Lc,xf,!1,Hu);if(O===null&&(wd(Lc.set(-.5,.5,0),_d,T,vf,p,y),bf.set(0,1),O=r.ray.intersectTriangle(BA,xf,Lc,!1,Hu),O===null))return;const te=r.ray.origin.distanceTo(Hu);te<r.near||te>r.far||l.push({distance:te,point:Hu.clone(),uv:Bl.getInterpolation(Hu,BA,Lc,xf,Sh,bf,Yf,new qi),face:null,object:this})}copy(r,l){return super.copy(r,l),r.center!==void 0&&this.center.copy(r.center),this.material=r.material,this}}function wd(ue,r,l,h,p,y){wh.subVectors(ue,l).addScalar(.5).multiply(h),p!==void 0?(Iu.x=y*wh.x-p*wh.y,Iu.y=p*wh.x+y*wh.y):Iu.copy(wh),ue.copy(r),ue.x+=Iu.x,ue.y+=Iu.y,ue.applyMatrix4(yf)}const sh=new kn,Sd=new kn;class IA extends null{constructor(){super(),this.isLOD=!0,this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]}}),this.autoUpdate=!0}copy(r){super.copy(r,!1);const l=r.levels;for(let h=0,p=l.length;h<p;h++){const y=l[h];this.addLevel(y.object.clone(),y.distance,y.hysteresis)}return this.autoUpdate=r.autoUpdate,this}addLevel(r,l=0,h=0){l=Math.abs(l);const p=this.levels;let y;for(y=0;y<p.length&&!(l<p[y].distance);y++);return p.splice(y,0,{distance:l,hysteresis:h,object:r}),this.add(r),this}removeLevel(r){const l=this.levels;for(let h=0;h<l.length;h++)if(l[h].distance===r){const p=l.splice(h,1);return this.remove(p[0].object),!0}return!1}getCurrentLevel(){return this._currentLevel}getObjectForDistance(r){const l=this.levels;if(l.length>0){let h,p;for(h=1,p=l.length;h<p;h++){let y=l[h].distance;if(l[h].object.visible&&(y-=y*l[h].hysteresis),r<y)break}return l[h-1].object}return null}raycast(r,l){if(this.levels.length>0){sh.setFromMatrixPosition(this.matrixWorld);const p=r.ray.origin.distanceTo(sh);this.getObjectForDistance(p).raycast(r,l)}}update(r){const l=this.levels;if(l.length>1){sh.setFromMatrixPosition(r.matrixWorld),Sd.setFromMatrixPosition(this.matrixWorld);const h=sh.distanceTo(Sd)/r.zoom;l[0].object.visible=!0;let p,y;for(p=1,y=l.length;p<y;p++){let T=l[p].distance;if(l[p].object.visible&&(T-=T*l[p].hysteresis),h>=T)l[p-1].object.visible=!1,l[p].object.visible=!0;else break}for(this._currentLevel=p-1;p<y;p++)l[p].object.visible=!1}}toJSON(r){const l=super.toJSON(r);this.autoUpdate===!1&&(l.object.autoUpdate=!1),l.object.levels=[];const h=this.levels;for(let p=0,y=h.length;p<y;p++){const T=h[p];l.object.levels.push({object:T.object.uuid,distance:T.distance,hysteresis:T.hysteresis})}return l}}const NA=new kn,qf=new ai,Mg=new ai,hm=new kn,ed=new oi,td=new kn,Jf=new gn,dm=new oi,ap=new gi;class Pp extends null{constructor(r,l){super(r,l),this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode=lr,this.bindMatrix=new oi,this.bindMatrixInverse=new oi,this.boundingBox=null,this.boundingSphere=null}computeBoundingBox(){const r=this.geometry;this.boundingBox===null&&(this.boundingBox=new zi),this.boundingBox.makeEmpty();const l=r.getAttribute("position");for(let h=0;h<l.count;h++)this.getVertexPosition(h,td),this.boundingBox.expandByPoint(td)}computeBoundingSphere(){const r=this.geometry;this.boundingSphere===null&&(this.boundingSphere=new gn),this.boundingSphere.makeEmpty();const l=r.getAttribute("position");for(let h=0;h<l.count;h++)this.getVertexPosition(h,td),this.boundingSphere.expandByPoint(td)}copy(r,l){return super.copy(r,l),this.bindMode=r.bindMode,this.bindMatrix.copy(r.bindMatrix),this.bindMatrixInverse.copy(r.bindMatrixInverse),this.skeleton=r.skeleton,r.boundingBox!==null&&(this.boundingBox=r.boundingBox.clone()),r.boundingSphere!==null&&(this.boundingSphere=r.boundingSphere.clone()),this}raycast(r,l){const h=this.material,p=this.matrixWorld;h!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),Jf.copy(this.boundingSphere),Jf.applyMatrix4(p),r.ray.intersectsSphere(Jf)!==!1&&(dm.copy(p).invert(),ap.copy(r.ray).applyMatrix4(dm),!(this.boundingBox!==null&&ap.intersectsBox(this.boundingBox)===!1)&&this._computeIntersections(r,l,ap)))}getVertexPosition(r,l){return super.getVertexPosition(r,l),this.applyBoneTransform(r,l),l}bind(r,l){this.skeleton=r,l===void 0&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),l=this.matrixWorld),this.bindMatrix.copy(l),this.bindMatrixInverse.copy(l).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(){const r=new ai,l=this.geometry.attributes.skinWeight;for(let h=0,p=l.count;h<p;h++){r.fromBufferAttribute(l,h);const y=1/r.manhattanLength();y!==1/0?r.multiplyScalar(y):r.set(1,0,0,0),l.setXYZW(h,r.x,r.y,r.z,r.w)}}updateMatrixWorld(r){super.updateMatrixWorld(r),this.bindMode===lr?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode===je?this.bindMatrixInverse.copy(this.bindMatrix).invert():na("SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}applyBoneTransform(r,l){const h=this.skeleton,p=this.geometry;qf.fromBufferAttribute(p.attributes.skinIndex,r),Mg.fromBufferAttribute(p.attributes.skinWeight,r),NA.copy(l).applyMatrix4(this.bindMatrix),l.set(0,0,0);for(let y=0;y<4;y++){const T=Mg.getComponent(y);if(T!==0){const O=qf.getComponent(y);ed.multiplyMatrices(h.bones[O].matrixWorld,h.boneInverses[O]),l.addScaledVector(hm.copy(NA).applyMatrix4(ed),T)}}return l.applyMatrix4(this.bindMatrixInverse)}}class Lp extends null{constructor(){super(),this.isBone=!0,this.type="Bone"}}class Md extends null{constructor(r=null,l=1,h=1,p,y,T,O,te,se=cn,xe=cn,Ne,Ve){super(null,T,O,te,se,xe,p,y,Ne,Ve),this.isDataTexture=!0,this.image={data:r,width:l,height:h},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}const Up=new oi,Op=new oi;class _f{constructor(r=[],l=[]){this.uuid=Gr(),this.bones=r.slice(0),this.boneInverses=l,this.boneMatrices=null,this.boneTexture=null,this.init()}init(){const r=this.bones,l=this.boneInverses;if(this.boneMatrices=new Float32Array(r.length*16),l.length===0)this.calculateInverses();else if(r.length!==l.length){na("Skeleton: Number of inverse bone matrices does not match amount of bones."),this.boneInverses=[];for(let h=0,p=this.bones.length;h<p;h++)this.boneInverses.push(new oi)}}calculateInverses(){this.boneInverses.length=0;for(let r=0,l=this.bones.length;r<l;r++){const h=new oi;this.bones[r]&&h.copy(this.bones[r].matrixWorld).invert(),this.boneInverses.push(h)}}pose(){for(let r=0,l=this.bones.length;r<l;r++){const h=this.bones[r];h&&h.matrixWorld.copy(this.boneInverses[r]).invert()}for(let r=0,l=this.bones.length;r<l;r++){const h=this.bones[r];h&&(h.parent&&h.parent.isBone?(h.matrix.copy(h.parent.matrixWorld).invert(),h.matrix.multiply(h.matrixWorld)):h.matrix.copy(h.matrixWorld),h.matrix.decompose(h.position,h.quaternion,h.scale))}}update(){const r=this.bones,l=this.boneInverses,h=this.boneMatrices,p=this.boneTexture;for(let y=0,T=r.length;y<T;y++){const O=r[y]?r[y].matrixWorld:Op;Up.multiplyMatrices(O,l[y]),Up.toArray(h,y*16)}p!==null&&(p.needsUpdate=!0)}clone(){return new _f(this.bones,this.boneInverses)}computeBoneTexture(){let r=Math.sqrt(this.bones.length*4);r=Math.ceil(r/4)*4,r=Math.max(r,4);const l=new Float32Array(r*r*4);l.set(this.boneMatrices);const h=new Md(l,r,r,L,dt);return h.needsUpdate=!0,this.boneMatrices=l,this.boneTexture=h,this}getBoneByName(r){for(let l=0,h=this.bones.length;l<h;l++){const p=this.bones[l];if(p.name===r)return p}}dispose(){this.boneTexture!==null&&(this.boneTexture.dispose(),this.boneTexture=null)}fromJSON(r,l){this.uuid=r.uuid;for(let h=0,p=r.bones.length;h<p;h++){const y=r.bones[h];let T=l[y];T===void 0&&(na("Skeleton: No bone found with UUID:",y),T=new Lp),this.bones.push(T),this.boneInverses.push(new oi().fromArray(r.boneInverses[h]))}return this.init(),this}toJSON(){const r={metadata:{version:4.7,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};r.uuid=this.uuid;const l=this.bones,h=this.boneInverses;for(let p=0,y=l.length;p<y;p++){const T=l[p];r.bones.push(T.uuid);const O=h[p];r.boneInverses.push(O.toArray())}return r}}class eA extends null{constructor(r,l,h,p=1){super(r,l,h),this.isInstancedBufferAttribute=!0,this.meshPerAttribute=p}copy(r){return super.copy(r),this.meshPerAttribute=r.meshPerAttribute,this}toJSON(){const r=super.toJSON();return r.meshPerAttribute=this.meshPerAttribute,r.isInstancedBufferAttribute=!0,r}}const Zd=new oi,Oi=new oi,op=null,ah=new zi,tA=new oi,wf=new zd,Kd=new gn;class Mh extends null{constructor(r,l,h){super(r,l),this.isInstancedMesh=!0,this.instanceMatrix=new eA(new Float32Array(h*16),16),this.instanceColor=null,this.morphTexture=null,this.count=h,this.boundingBox=null,this.boundingSphere=null;for(let p=0;p<h;p++)this.setMatrixAt(p,tA)}computeBoundingBox(){const r=this.geometry,l=this.count;this.boundingBox===null&&(this.boundingBox=new zi),r.boundingBox===null&&r.computeBoundingBox(),this.boundingBox.makeEmpty();for(let h=0;h<l;h++)this.getMatrixAt(h,Zd),ah.copy(r.boundingBox).applyMatrix4(Zd),this.boundingBox.union(ah)}computeBoundingSphere(){const r=this.geometry,l=this.count;this.boundingSphere===null&&(this.boundingSphere=new gn),r.boundingSphere===null&&r.computeBoundingSphere(),this.boundingSphere.makeEmpty();for(let h=0;h<l;h++)this.getMatrixAt(h,Zd),Kd.copy(r.boundingSphere).applyMatrix4(Zd),this.boundingSphere.union(Kd)}copy(r,l){return super.copy(r,l),this.instanceMatrix.copy(r.instanceMatrix),r.morphTexture!==null&&(this.morphTexture=r.morphTexture.clone()),r.instanceColor!==null&&(this.instanceColor=r.instanceColor.clone()),this.count=r.count,r.boundingBox!==null&&(this.boundingBox=r.boundingBox.clone()),r.boundingSphere!==null&&(this.boundingSphere=r.boundingSphere.clone()),this}getColorAt(r,l){l.fromArray(this.instanceColor.array,r*3)}getMatrixAt(r,l){l.fromArray(this.instanceMatrix.array,r*16)}getMorphAt(r,l){const h=l.morphTargetInfluences,p=this.morphTexture.source.data.data,y=h.length+1,T=r*y+1;for(let O=0;O<h.length;O++)h[O]=p[T+O]}raycast(r,l){const h=this.matrixWorld,p=this.count;if(wf.geometry=this.geometry,wf.material=this.material,wf.material!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),Kd.copy(this.boundingSphere),Kd.applyMatrix4(h),r.ray.intersectsSphere(Kd)!==!1))for(let y=0;y<p;y++){this.getMatrixAt(y,Zd),Oi.multiplyMatrices(h,Zd),wf.matrixWorld=Oi,wf.raycast(r,op);for(let T=0,O=op.length;T<O;T++){const te=op[T];te.instanceId=y,te.object=this,l.push(te)}op.length=0}}setColorAt(r,l){this.instanceColor===null&&(this.instanceColor=new eA(new Float32Array(this.instanceMatrix.count*3).fill(1),3)),l.toArray(this.instanceColor.array,r*3)}setMatrixAt(r,l){l.toArray(this.instanceMatrix.array,r*16)}setMorphAt(r,l){const h=l.morphTargetInfluences,p=h.length+1;this.morphTexture===null&&(this.morphTexture=new Md(new Float32Array(p*this.count),p,this.count,z,dt));const y=this.morphTexture.source.data.data;let T=0;for(let se=0;se<h.length;se++)T+=h[se];const O=this.geometry.morphTargetsRelative?1:1-T,te=p*r;y[te]=O,y.set(h,te+1)}updateMorphTargets(){}dispose(){this.dispatchEvent({type:"dispose"}),this.morphTexture!==null&&(this.morphTexture.dispose(),this.morphTexture=null)}}const Ed=new kn,Eg=new kn,Dp=new vl;class Do{constructor(r=new kn(1,0,0),l=0){this.isPlane=!0,this.normal=r,this.constant=l}set(r,l){return this.normal.copy(r),this.constant=l,this}setComponents(r,l,h,p){return this.normal.set(r,l,h),this.constant=p,this}setFromNormalAndCoplanarPoint(r,l){return this.normal.copy(r),this.constant=-l.dot(this.normal),this}setFromCoplanarPoints(r,l,h){const p=Ed.subVectors(h,l).cross(Eg.subVectors(r,l)).normalize();return this.setFromNormalAndCoplanarPoint(p,r),this}copy(r){return this.normal.copy(r.normal),this.constant=r.constant,this}normalize(){const r=1/this.normal.length();return this.normal.multiplyScalar(r),this.constant*=r,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(r){return this.normal.dot(r)+this.constant}distanceToSphere(r){return this.distanceToPoint(r.center)-r.radius}projectPoint(r,l){return l.copy(r).addScaledVector(this.normal,-this.distanceToPoint(r))}intersectLine(r,l){const h=r.delta(Ed),p=this.normal.dot(h);if(p===0)return this.distanceToPoint(r.start)===0?l.copy(r.start):null;const y=-(r.start.dot(this.normal)+this.constant)/p;return y<0||y>1?null:l.copy(r.start).addScaledVector(h,y)}intersectsLine(r){const l=this.distanceToPoint(r.start),h=this.distanceToPoint(r.end);return l<0&&h>0||h<0&&l>0}intersectsBox(r){return r.intersectsPlane(this)}intersectsSphere(r){return r.intersectsPlane(this)}coplanarPoint(r){return r.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(r,l){const h=l||Dp.getNormalMatrix(r),p=this.coplanarPoint(Ed).applyMatrix4(r),y=this.normal.applyMatrix3(h).normalize();return this.constant=-p.dot(y),this}translate(r){return this.constant-=r.dot(this.normal),this}equals(r){return r.normal.equals(this.normal)&&r.constant===this.constant}clone(){return new this.constructor().copy(this)}}const $d=new gn,Qc=new qi(.5,.5),Eh=new kn;class lp{constructor(r=new Do,l=new Do,h=new Do,p=new Do,y=new Do,T=new Do){this.planes=[r,l,h,p,y,T]}set(r,l,h,p,y,T){const O=this.planes;return O[0].copy(r),O[1].copy(l),O[2].copy(h),O[3].copy(p),O[4].copy(y),O[5].copy(T),this}copy(r){const l=this.planes;for(let h=0;h<6;h++)l[h].copy(r.planes[h]);return this}setFromProjectionMatrix(r,l=Cu,h=!1){const p=this.planes,y=r.elements,T=y[0],O=y[1],te=y[2],se=y[3],xe=y[4],Ne=y[5],Ve=y[6],We=y[7],tt=y[8],Ot=y[9],An=y[10],un=y[11],Un=y[12],Vn=y[13],nr=y[14],ii=y[15];if(p[0].setComponents(se-T,We-xe,un-tt,ii-Un).normalize(),p[1].setComponents(se+T,We+xe,un+tt,ii+Un).normalize(),p[2].setComponents(se+O,We+Ne,un+Ot,ii+Vn).normalize(),p[3].setComponents(se-O,We-Ne,un-Ot,ii-Vn).normalize(),h)p[4].setComponents(te,Ve,An,nr).normalize(),p[5].setComponents(se-te,We-Ve,un-An,ii-nr).normalize();else if(p[4].setComponents(se-te,We-Ve,un-An,ii-nr).normalize(),l===Cu)p[5].setComponents(se+te,We+Ve,un+An,ii+nr).normalize();else if(l===zc)p[5].setComponents(te,Ve,An,nr).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+l);return this}intersectsObject(r){if(r.boundingSphere!==void 0)r.boundingSphere===null&&r.computeBoundingSphere(),$d.copy(r.boundingSphere).applyMatrix4(r.matrixWorld);else{const l=r.geometry;l.boundingSphere===null&&l.computeBoundingSphere(),$d.copy(l.boundingSphere).applyMatrix4(r.matrixWorld)}return this.intersectsSphere($d)}intersectsSprite(r){$d.center.set(0,0,0);const l=Qc.distanceTo(r.center);return $d.radius=.7071067811865476+l,$d.applyMatrix4(r.matrixWorld),this.intersectsSphere($d)}intersectsSphere(r){const l=this.planes,h=r.center,p=-r.radius;for(let y=0;y<6;y++)if(l[y].distanceToPoint(h)<p)return!1;return!0}intersectsBox(r){const l=this.planes;for(let h=0;h<6;h++){const p=l[h];if(Eh.x=p.normal.x>0?r.max.x:r.min.x,Eh.y=p.normal.y>0?r.max.y:r.min.y,Eh.z=p.normal.z>0?r.max.z:r.min.z,p.distanceToPoint(Eh)<0)return!1}return!0}containsPoint(r){const l=this.planes;for(let h=0;h<6;h++)if(l[h].distanceToPoint(r)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}const wo=new oi,Ch=new lp;class Cg{constructor(){this.coordinateSystem=Cu}intersectsObject(r,l){if(!l.isArrayCamera||l.cameras.length===0)return!1;for(let h=0;h<l.cameras.length;h++){const p=l.cameras[h];if(wo.multiplyMatrices(p.projectionMatrix,p.matrixWorldInverse),Ch.setFromProjectionMatrix(wo,p.coordinateSystem,p.reversedDepth),Ch.intersectsObject(r))return!0}return!1}intersectsSprite(r,l){if(!l||!l.cameras||l.cameras.length===0)return!1;for(let h=0;h<l.cameras.length;h++){const p=l.cameras[h];if(wo.multiplyMatrices(p.projectionMatrix,p.matrixWorldInverse),Ch.setFromProjectionMatrix(wo,p.coordinateSystem,p.reversedDepth),Ch.intersectsSprite(r))return!0}return!1}intersectsSphere(r,l){if(!l||!l.cameras||l.cameras.length===0)return!1;for(let h=0;h<l.cameras.length;h++){const p=l.cameras[h];if(wo.multiplyMatrices(p.projectionMatrix,p.matrixWorldInverse),Ch.setFromProjectionMatrix(wo,p.coordinateSystem,p.reversedDepth),Ch.intersectsSphere(r))return!0}return!1}intersectsBox(r,l){if(!l||!l.cameras||l.cameras.length===0)return!1;for(let h=0;h<l.cameras.length;h++){const p=l.cameras[h];if(wo.multiplyMatrices(p.projectionMatrix,p.matrixWorldInverse),Ch.setFromProjectionMatrix(wo,p.coordinateSystem,p.reversedDepth),Ch.intersectsBox(r))return!0}return!1}containsPoint(r,l){if(!l||!l.cameras||l.cameras.length===0)return!1;for(let h=0;h<l.cameras.length;h++){const p=l.cameras[h];if(wo.multiplyMatrices(p.projectionMatrix,p.matrixWorldInverse),Ch.setFromProjectionMatrix(wo,p.coordinateSystem,p.reversedDepth),Ch.containsPoint(r))return!0}return!1}clone(){return new Cg}}function Ec(ue,r){return ue-r}function zh(ue,r){return ue.z-r.z}function fm(ue,r){return r.z-ue.z}class Xd{constructor(){this.index=0,this.pool=[],this.list=[]}push(r,l,h,p){const y=this.pool,T=this.list;this.index>=y.length&&y.push({start:-1,count:-1,z:-1,index:-1});const O=y[this.index];T.push(O),this.index++,O.start=r,O.count=l,O.z=h,O.index=p}reset(){this.list.length=0,this.index=0}}const qu=new oi,Th=new Ea(1,1,1),oh=new lp,kp=new Cg,Sf=new zi,Gh=new gn,Mf=new kn,bu=new kn,eu=new kn,Ef=new Xd,Dl=new zd,Bh=null;function Cf(ue,r,l=0){const h=r.itemSize;if(ue.isInterleavedBufferAttribute||ue.array.constructor!==r.array.constructor){const p=ue.count;for(let y=0;y<p;y++)for(let T=0;T<h;T++)r.setComponent(y+l,T,ue.getComponent(y,T))}else r.array.set(ue.array,l*h);r.needsUpdate=!0}function tu(ue,r){if(ue.constructor!==r.constructor){const l=Math.min(ue.length,r.length);for(let h=0;h<l;h++)r[h]=ue[h]}else{const l=Math.min(ue.length,r.length);r.set(new ue.constructor(ue.buffer,0,l))}}class FA extends null{constructor(r,l,h=l*2,p){super(new Ui,p),this.isBatchedMesh=!0,this.perObjectFrustumCulled=!0,this.sortObjects=!0,this.boundingBox=null,this.boundingSphere=null,this.customSort=null,this._instanceInfo=[],this._geometryInfo=[],this._availableInstanceIds=[],this._availableGeometryIds=[],this._nextIndexStart=0,this._nextVertexStart=0,this._geometryCount=0,this._visibilityChanged=!0,this._geometryInitialized=!1,this._maxInstanceCount=r,this._maxVertexCount=l,this._maxIndexCount=h,this._multiDrawCounts=new Int32Array(r),this._multiDrawStarts=new Int32Array(r),this._multiDrawCount=0,this._multiDrawInstances=null,this._matricesTexture=null,this._indirectTexture=null,this._colorsTexture=null,this._initMatricesTexture(),this._initIndirectTexture()}get maxInstanceCount(){return this._maxInstanceCount}get instanceCount(){return this._instanceInfo.length-this._availableInstanceIds.length}get unusedVertexCount(){return this._maxVertexCount-this._nextVertexStart}get unusedIndexCount(){return this._maxIndexCount-this._nextIndexStart}_initMatricesTexture(){let r=Math.sqrt(this._maxInstanceCount*4);r=Math.ceil(r/4)*4,r=Math.max(r,4);const l=new Float32Array(r*r*4),h=new Md(l,r,r,L,dt);this._matricesTexture=h}_initIndirectTexture(){let r=Math.sqrt(this._maxInstanceCount);r=Math.ceil(r);const l=new Uint32Array(r*r),h=new Md(l,r,r,ie,st);this._indirectTexture=h}_initColorsTexture(){let r=Math.sqrt(this._maxInstanceCount);r=Math.ceil(r);const l=new Float32Array(r*r*4).fill(1),h=new Md(l,r,r,L,dt);h.colorSpace=le.workingColorSpace,this._colorsTexture=h}_initializeGeometry(r){const l=this.geometry,h=this._maxVertexCount,p=this._maxIndexCount;if(this._geometryInitialized===!1){for(const y in r.attributes){const T=r.getAttribute(y),{array:O,itemSize:te,normalized:se}=T,xe=new O.constructor(h*te),Ne=new Ql(xe,te,se);l.setAttribute(y,Ne)}if(r.getIndex()!==null){const y=h>65535?new Uint32Array(p):new Uint16Array(p);l.setIndex(new Ql(y,1))}this._geometryInitialized=!0}}_validateGeometry(r){const l=this.geometry;if(!!r.getIndex()!=!!l.getIndex())throw new Error('THREE.BatchedMesh: All geometries must consistently have "index".');for(const h in l.attributes){if(!r.hasAttribute(h))throw new Error(`THREE.BatchedMesh: Added geometry missing "${h}". All geometries must have consistent attributes.`);const p=r.getAttribute(h),y=l.getAttribute(h);if(p.itemSize!==y.itemSize||p.normalized!==y.normalized)throw new Error("THREE.BatchedMesh: All attributes must have a consistent itemSize and normalized value.")}}validateInstanceId(r){const l=this._instanceInfo;if(r<0||r>=l.length||l[r].active===!1)throw new Error(`THREE.BatchedMesh: Invalid instanceId ${r}. Instance is either out of range or has been deleted.`)}validateGeometryId(r){const l=this._geometryInfo;if(r<0||r>=l.length||l[r].active===!1)throw new Error(`THREE.BatchedMesh: Invalid geometryId ${r}. Geometry is either out of range or has been deleted.`)}setCustomSort(r){return this.customSort=r,this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new zi);const r=this.boundingBox,l=this._instanceInfo;r.makeEmpty();for(let h=0,p=l.length;h<p;h++){if(l[h].active===!1)continue;const y=l[h].geometryIndex;this.getMatrixAt(h,qu),this.getBoundingBoxAt(y,Sf).applyMatrix4(qu),r.union(Sf)}}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new gn);const r=this.boundingSphere,l=this._instanceInfo;r.makeEmpty();for(let h=0,p=l.length;h<p;h++){if(l[h].active===!1)continue;const y=l[h].geometryIndex;this.getMatrixAt(h,qu),this.getBoundingSphereAt(y,Gh).applyMatrix4(qu),r.union(Gh)}}addInstance(r){if(this._instanceInfo.length>=this.maxInstanceCount&&this._availableInstanceIds.length===0)throw new Error("THREE.BatchedMesh: Maximum item count reached.");const h={visible:!0,active:!0,geometryIndex:r};let p=null;this._availableInstanceIds.length>0?(this._availableInstanceIds.sort(Ec),p=this._availableInstanceIds.shift(),this._instanceInfo[p]=h):(p=this._instanceInfo.length,this._instanceInfo.push(h));const y=this._matricesTexture;qu.identity().toArray(y.image.data,p*16),y.needsUpdate=!0;const T=this._colorsTexture;return T&&(Th.toArray(T.image.data,p*4),T.needsUpdate=!0),this._visibilityChanged=!0,p}addGeometry(r,l=-1,h=-1){this._initializeGeometry(r),this._validateGeometry(r);const p={vertexStart:-1,vertexCount:-1,reservedVertexCount:-1,indexStart:-1,indexCount:-1,reservedIndexCount:-1,start:-1,count:-1,boundingBox:null,boundingSphere:null,active:!0},y=this._geometryInfo;p.vertexStart=this._nextVertexStart,p.reservedVertexCount=l===-1?r.getAttribute("position").count:l;const T=r.getIndex();if(T!==null&&(p.indexStart=this._nextIndexStart,p.reservedIndexCount=h===-1?T.count:h),p.indexStart!==-1&&p.indexStart+p.reservedIndexCount>this._maxIndexCount||p.vertexStart+p.reservedVertexCount>this._maxVertexCount)throw new Error("THREE.BatchedMesh: Reserved space request exceeds the maximum buffer size.");let te;return this._availableGeometryIds.length>0?(this._availableGeometryIds.sort(Ec),te=this._availableGeometryIds.shift(),y[te]=p):(te=this._geometryCount,this._geometryCount++,y.push(p)),this.setGeometryAt(te,r),this._nextIndexStart=p.indexStart+p.reservedIndexCount,this._nextVertexStart=p.vertexStart+p.reservedVertexCount,te}setGeometryAt(r,l){if(r>=this._geometryCount)throw new Error("THREE.BatchedMesh: Maximum geometry count reached.");this._validateGeometry(l);const h=this.geometry,p=h.getIndex()!==null,y=h.getIndex(),T=l.getIndex(),O=this._geometryInfo[r];if(p&&T.count>O.reservedIndexCount||l.attributes.position.count>O.reservedVertexCount)throw new Error("THREE.BatchedMesh: Reserved space not large enough for provided geometry.");const te=O.vertexStart,se=O.reservedVertexCount;O.vertexCount=l.getAttribute("position").count;for(const xe in h.attributes){const Ne=l.getAttribute(xe),Ve=h.getAttribute(xe);Cf(Ne,Ve,te);const We=Ne.itemSize;for(let tt=Ne.count,Ot=se;tt<Ot;tt++){const An=te+tt;for(let un=0;un<We;un++)Ve.setComponent(An,un,0)}Ve.needsUpdate=!0,Ve.addUpdateRange(te*We,se*We)}if(p){const xe=O.indexStart,Ne=O.reservedIndexCount;O.indexCount=l.getIndex().count;for(let Ve=0;Ve<T.count;Ve++)y.setX(xe+Ve,te+T.getX(Ve));for(let Ve=T.count,We=Ne;Ve<We;Ve++)y.setX(xe+Ve,te);y.needsUpdate=!0,y.addUpdateRange(xe,O.reservedIndexCount)}return O.start=p?O.indexStart:O.vertexStart,O.count=p?O.indexCount:O.vertexCount,O.boundingBox=null,l.boundingBox!==null&&(O.boundingBox=l.boundingBox.clone()),O.boundingSphere=null,l.boundingSphere!==null&&(O.boundingSphere=l.boundingSphere.clone()),this._visibilityChanged=!0,r}deleteGeometry(r){const l=this._geometryInfo;if(r>=l.length||l[r].active===!1)return this;const h=this._instanceInfo;for(let p=0,y=h.length;p<y;p++)h[p].active&&h[p].geometryIndex===r&&this.deleteInstance(p);return l[r].active=!1,this._availableGeometryIds.push(r),this._visibilityChanged=!0,this}deleteInstance(r){return this.validateInstanceId(r),this._instanceInfo[r].active=!1,this._availableInstanceIds.push(r),this._visibilityChanged=!0,this}optimize(){let r=0,l=0;const h=this._geometryInfo,p=h.map((T,O)=>O).sort((T,O)=>h[T].vertexStart-h[O].vertexStart),y=this.geometry;for(let T=0,O=h.length;T<O;T++){const te=p[T],se=h[te];if(se.active!==!1){if(y.index!==null){if(se.indexStart!==l){const{indexStart:xe,vertexStart:Ne,reservedIndexCount:Ve}=se,We=y.index,tt=We.array,Ot=r-Ne;for(let An=xe;An<xe+Ve;An++)tt[An]=tt[An]+Ot;We.array.copyWithin(l,xe,xe+Ve),We.addUpdateRange(l,Ve),se.indexStart=l}l+=se.reservedIndexCount}if(se.vertexStart!==r){const{vertexStart:xe,reservedVertexCount:Ne}=se,Ve=y.attributes;for(const We in Ve){const tt=Ve[We],{array:Ot,itemSize:An}=tt;Ot.copyWithin(r*An,xe*An,(xe+Ne)*An),tt.addUpdateRange(r*An,Ne*An)}se.vertexStart=r}r+=se.reservedVertexCount,se.start=y.index?se.indexStart:se.vertexStart,this._nextIndexStart=y.index?se.indexStart+se.reservedIndexCount:0,this._nextVertexStart=se.vertexStart+se.reservedVertexCount}}return this}getBoundingBoxAt(r,l){if(r>=this._geometryCount)return null;const h=this.geometry,p=this._geometryInfo[r];if(p.boundingBox===null){const y=new zi,T=h.index,O=h.attributes.position;for(let te=p.start,se=p.start+p.count;te<se;te++){let xe=te;T&&(xe=T.getX(xe)),y.expandByPoint(Mf.fromBufferAttribute(O,xe))}p.boundingBox=y}return l.copy(p.boundingBox),l}getBoundingSphereAt(r,l){if(r>=this._geometryCount)return null;const h=this.geometry,p=this._geometryInfo[r];if(p.boundingSphere===null){const y=new gn;this.getBoundingBoxAt(r,Sf),Sf.getCenter(y.center);const T=h.index,O=h.attributes.position;let te=0;for(let se=p.start,xe=p.start+p.count;se<xe;se++){let Ne=se;T&&(Ne=T.getX(Ne)),Mf.fromBufferAttribute(O,Ne),te=Math.max(te,y.center.distanceToSquared(Mf))}y.radius=Math.sqrt(te),p.boundingSphere=y}return l.copy(p.boundingSphere),l}setMatrixAt(r,l){this.validateInstanceId(r);const h=this._matricesTexture,p=this._matricesTexture.image.data;return l.toArray(p,r*16),h.needsUpdate=!0,this}getMatrixAt(r,l){return this.validateInstanceId(r),l.fromArray(this._matricesTexture.image.data,r*16)}setColorAt(r,l){return this.validateInstanceId(r),this._colorsTexture===null&&this._initColorsTexture(),l.toArray(this._colorsTexture.image.data,r*4),this._colorsTexture.needsUpdate=!0,this}getColorAt(r,l){return this.validateInstanceId(r),l.fromArray(this._colorsTexture.image.data,r*4)}setVisibleAt(r,l){return this.validateInstanceId(r),this._instanceInfo[r].visible===l?this:(this._instanceInfo[r].visible=l,this._visibilityChanged=!0,this)}getVisibleAt(r){return this.validateInstanceId(r),this._instanceInfo[r].visible}setGeometryIdAt(r,l){return this.validateInstanceId(r),this.validateGeometryId(l),this._instanceInfo[r].geometryIndex=l,this}getGeometryIdAt(r){return this.validateInstanceId(r),this._instanceInfo[r].geometryIndex}getGeometryRangeAt(r,l={}){this.validateGeometryId(r);const h=this._geometryInfo[r];return l.vertexStart=h.vertexStart,l.vertexCount=h.vertexCount,l.reservedVertexCount=h.reservedVertexCount,l.indexStart=h.indexStart,l.indexCount=h.indexCount,l.reservedIndexCount=h.reservedIndexCount,l.start=h.start,l.count=h.count,l}setInstanceCount(r){const l=this._availableInstanceIds,h=this._instanceInfo;for(l.sort(Ec);l[l.length-1]===h.length-1;)h.pop(),l.pop();if(r<h.length)throw new Error(`BatchedMesh: Instance ids outside the range ${r} are being used. Cannot shrink instance count.`);const p=new Int32Array(r),y=new Int32Array(r);tu(this._multiDrawCounts,p),tu(this._multiDrawStarts,y),this._multiDrawCounts=p,this._multiDrawStarts=y,this._maxInstanceCount=r;const T=this._indirectTexture,O=this._matricesTexture,te=this._colorsTexture;T.dispose(),this._initIndirectTexture(),tu(T.image.data,this._indirectTexture.image.data),O.dispose(),this._initMatricesTexture(),tu(O.image.data,this._matricesTexture.image.data),te&&(te.dispose(),this._initColorsTexture(),tu(te.image.data,this._colorsTexture.image.data))}setGeometrySize(r,l){const h=[...this._geometryInfo].filter(O=>O.active);if(Math.max(...h.map(O=>O.vertexStart+O.reservedVertexCount))>r)throw new Error(`BatchedMesh: Geometry vertex values are being used outside the range ${l}. Cannot shrink further.`);if(this.geometry.index&&Math.max(...h.map(te=>te.indexStart+te.reservedIndexCount))>l)throw new Error(`BatchedMesh: Geometry index values are being used outside the range ${l}. Cannot shrink further.`);const y=this.geometry;y.dispose(),this._maxVertexCount=r,this._maxIndexCount=l,this._geometryInitialized&&(this._geometryInitialized=!1,this.geometry=new Ui,this._initializeGeometry(y));const T=this.geometry;y.index&&tu(y.index.array,T.index.array);for(const O in y.attributes)tu(y.attributes[O].array,T.attributes[O].array)}raycast(r,l){const h=this._instanceInfo,p=this._geometryInfo,y=this.matrixWorld,T=this.geometry;Dl.material=this.material,Dl.geometry.index=T.index,Dl.geometry.attributes=T.attributes,Dl.geometry.boundingBox===null&&(Dl.geometry.boundingBox=new zi),Dl.geometry.boundingSphere===null&&(Dl.geometry.boundingSphere=new gn);for(let O=0,te=h.length;O<te;O++){if(!h[O].visible||!h[O].active)continue;const se=h[O].geometryIndex,xe=p[se];Dl.geometry.setDrawRange(xe.start,xe.count),this.getMatrixAt(O,Dl.matrixWorld).premultiply(y),this.getBoundingBoxAt(se,Dl.geometry.boundingBox),this.getBoundingSphereAt(se,Dl.geometry.boundingSphere),Dl.raycast(r,Bh);for(let Ne=0,Ve=Bh.length;Ne<Ve;Ne++){const We=Bh[Ne];We.object=this,We.batchId=O,l.push(We)}Bh.length=0}Dl.material=null,Dl.geometry.index=null,Dl.geometry.attributes={},Dl.geometry.setDrawRange(0,1/0)}copy(r){return super.copy(r),this.geometry=r.geometry.clone(),this.perObjectFrustumCulled=r.perObjectFrustumCulled,this.sortObjects=r.sortObjects,this.boundingBox=r.boundingBox!==null?r.boundingBox.clone():null,this.boundingSphere=r.boundingSphere!==null?r.boundingSphere.clone():null,this._geometryInfo=r._geometryInfo.map(l=>fd(rl({},l),{boundingBox:l.boundingBox!==null?l.boundingBox.clone():null,boundingSphere:l.boundingSphere!==null?l.boundingSphere.clone():null})),this._instanceInfo=r._instanceInfo.map(l=>rl({},l)),this._availableInstanceIds=r._availableInstanceIds.slice(),this._availableGeometryIds=r._availableGeometryIds.slice(),this._nextIndexStart=r._nextIndexStart,this._nextVertexStart=r._nextVertexStart,this._geometryCount=r._geometryCount,this._maxInstanceCount=r._maxInstanceCount,this._maxVertexCount=r._maxVertexCount,this._maxIndexCount=r._maxIndexCount,this._geometryInitialized=r._geometryInitialized,this._multiDrawCounts=r._multiDrawCounts.slice(),this._multiDrawStarts=r._multiDrawStarts.slice(),this._indirectTexture=r._indirectTexture.clone(),this._indirectTexture.image.data=this._indirectTexture.image.data.slice(),this._matricesTexture=r._matricesTexture.clone(),this._matricesTexture.image.data=this._matricesTexture.image.data.slice(),this._colorsTexture!==null&&(this._colorsTexture=r._colorsTexture.clone(),this._colorsTexture.image.data=this._colorsTexture.image.data.slice()),this}dispose(){this.geometry.dispose(),this._matricesTexture.dispose(),this._matricesTexture=null,this._indirectTexture.dispose(),this._indirectTexture=null,this._colorsTexture!==null&&(this._colorsTexture.dispose(),this._colorsTexture=null)}onBeforeRender(r,l,h,p,y){if(!this._visibilityChanged&&!this.perObjectFrustumCulled&&!this.sortObjects)return;const T=p.getIndex(),O=T===null?1:T.array.BYTES_PER_ELEMENT,te=this._instanceInfo,se=this._multiDrawStarts,xe=this._multiDrawCounts,Ne=this._geometryInfo,Ve=this.perObjectFrustumCulled,We=this._indirectTexture,tt=We.image.data,Ot=h.isArrayCamera?kp:oh;Ve&&!h.isArrayCamera&&(qu.multiplyMatrices(h.projectionMatrix,h.matrixWorldInverse).multiply(this.matrixWorld),oh.setFromProjectionMatrix(qu,h.coordinateSystem,h.reversedDepth));let An=0;if(this.sortObjects){qu.copy(this.matrixWorld).invert(),Mf.setFromMatrixPosition(h.matrixWorld).applyMatrix4(qu),bu.set(0,0,-1).transformDirection(h.matrixWorld).transformDirection(qu);for(let Vn=0,nr=te.length;Vn<nr;Vn++)if(te[Vn].visible&&te[Vn].active){const ii=te[Vn].geometryIndex;this.getMatrixAt(Vn,qu),this.getBoundingSphereAt(ii,Gh).applyMatrix4(qu);let pi=!1;if(Ve&&(pi=!Ot.intersectsSphere(Gh,h)),!pi){const Bi=Ne[ii],mi=eu.subVectors(Gh.center,Mf).dot(bu);Ef.push(Bi.start,Bi.count,mi,Vn)}}const un=Ef.list,Un=this.customSort;Un===null?un.sort(y.transparent?fm:zh):Un.call(this,un,h);for(let Vn=0,nr=un.length;Vn<nr;Vn++){const ii=un[Vn];se[An]=ii.start*O,xe[An]=ii.count,tt[An]=ii.index,An++}Ef.reset()}else for(let un=0,Un=te.length;un<Un;un++)if(te[un].visible&&te[un].active){const Vn=te[un].geometryIndex;let nr=!1;if(Ve&&(this.getMatrixAt(un,qu),this.getBoundingSphereAt(Vn,Gh).applyMatrix4(qu),nr=!Ot.intersectsSphere(Gh,h)),!nr){const ii=Ne[Vn];se[An]=ii.start*O,xe[An]=ii.count,tt[An]=un,An++}}We.needsUpdate=!0,this._multiDrawCount=An,this._visibilityChanged=!1}onBeforeShadow(r,l,h,p,y,T){this.onBeforeRender(r,null,p,y,T)}}class Wc extends null{constructor(r){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new Ea(16777215),this.map=null,this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(r)}copy(r){return super.copy(r),this.color.copy(r.color),this.map=r.map,this.linewidth=r.linewidth,this.linecap=r.linecap,this.linejoin=r.linejoin,this.fog=r.fog,this}}const PA=new kn,jd=new kn,_u=new oi,Yd=new gi,up=new gn,lh=new kn,Xm=new kn;class fl extends null{constructor(r=new Ui,l=new Wc){super(),this.isLine=!0,this.type="Line",this.geometry=r,this.material=l,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(r,l){return super.copy(r,l),this.material=Array.isArray(r.material)?r.material.slice():r.material,this.geometry=r.geometry,this}computeLineDistances(){const r=this.geometry;if(r.index===null){const l=r.attributes.position,h=[0];for(let p=1,y=l.count;p<y;p++)PA.fromBufferAttribute(l,p-1),jd.fromBufferAttribute(l,p),h[p]=h[p-1],h[p]+=PA.distanceTo(jd);r.setAttribute("lineDistance",new ha(h,1))}else na("Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(r,l){const h=this.geometry,p=this.matrixWorld,y=r.params.Line.threshold,T=h.drawRange;if(h.boundingSphere===null&&h.computeBoundingSphere(),up.copy(h.boundingSphere),up.applyMatrix4(p),up.radius+=y,r.ray.intersectsSphere(up)===!1)return;_u.copy(p).invert(),Yd.copy(r.ray).applyMatrix4(_u);const O=y/((this.scale.x+this.scale.y+this.scale.z)/3),te=O*O,se=this.isLineSegments?2:1,xe=h.index,Ve=h.attributes.position;if(xe!==null){const We=Math.max(0,T.start),tt=Math.min(xe.count,T.start+T.count);for(let Ot=We,An=tt-1;Ot<An;Ot+=se){const un=xe.getX(Ot),Un=xe.getX(Ot+1),Vn=Tf(this,r,Yd,te,un,Un,Ot);Vn&&l.push(Vn)}if(this.isLineLoop){const Ot=xe.getX(tt-1),An=xe.getX(We),un=Tf(this,r,Yd,te,Ot,An,tt-1);un&&l.push(un)}}else{const We=Math.max(0,T.start),tt=Math.min(Ve.count,T.start+T.count);for(let Ot=We,An=tt-1;Ot<An;Ot+=se){const un=Tf(this,r,Yd,te,Ot,Ot+1,Ot);un&&l.push(un)}if(this.isLineLoop){const Ot=Tf(this,r,Yd,te,tt-1,We,tt-1);Ot&&l.push(Ot)}}}updateMorphTargets(){const l=this.geometry.morphAttributes,h=Object.keys(l);if(h.length>0){const p=l[h[0]];if(p!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let y=0,T=p.length;y<T;y++){const O=p[y].name||String(y);this.morphTargetInfluences.push(0),this.morphTargetDictionary[O]=y}}}}}function Tf(ue,r,l,h,p,y,T){const O=ue.geometry.attributes.position;if(PA.fromBufferAttribute(O,p),jd.fromBufferAttribute(O,y),l.distanceSqToSegment(PA,jd,lh,Xm)>h)return;lh.applyMatrix4(ue.matrixWorld);const se=r.ray.origin.distanceTo(lh);if(!(se<r.near||se>r.far))return{distance:se,point:Xm.clone().applyMatrix4(ue.matrixWorld),index:T,face:null,faceIndex:null,barycoord:null,object:ue}}const cp=new kn,Tg=new kn;class nd extends null{constructor(r,l){super(r,l),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){const r=this.geometry;if(r.index===null){const l=r.attributes.position,h=[];for(let p=0,y=l.count;p<y;p+=2)cp.fromBufferAttribute(l,p),Tg.fromBufferAttribute(l,p+1),h[p]=p===0?0:h[p-1],h[p+1]=h[p]+cp.distanceTo(Tg);r.setAttribute("lineDistance",new ha(h,1))}else na("LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class nA extends null{constructor(r,l){super(r,l),this.isLineLoop=!0,this.type="LineLoop"}}class LA extends null{constructor(r){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new Ea(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.fog=!0,this.setValues(r)}copy(r){return super.copy(r),this.color.copy(r.color),this.map=r.map,this.alphaMap=r.alphaMap,this.size=r.size,this.sizeAttenuation=r.sizeAttenuation,this.fog=r.fog,this}}const Vp=new oi,qd=new gi,rA=new gn,UA=new kn;class hp extends null{constructor(r=new Ui,l=new LA){super(),this.isPoints=!0,this.type="Points",this.geometry=r,this.material=l,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(r,l){return super.copy(r,l),this.material=Array.isArray(r.material)?r.material.slice():r.material,this.geometry=r.geometry,this}raycast(r,l){const h=this.geometry,p=this.matrixWorld,y=r.params.Points.threshold,T=h.drawRange;if(h.boundingSphere===null&&h.computeBoundingSphere(),rA.copy(h.boundingSphere),rA.applyMatrix4(p),rA.radius+=y,r.ray.intersectsSphere(rA)===!1)return;Vp.copy(p).invert(),qd.copy(r.ray).applyMatrix4(Vp);const O=y/((this.scale.x+this.scale.y+this.scale.z)/3),te=O*O,se=h.index,Ne=h.attributes.position;if(se!==null){const Ve=Math.max(0,T.start),We=Math.min(se.count,T.start+T.count);for(let tt=Ve,Ot=We;tt<Ot;tt++){const An=se.getX(tt);UA.fromBufferAttribute(Ne,An),dp(UA,An,te,p,r,l,this)}}else{const Ve=Math.max(0,T.start),We=Math.min(Ne.count,T.start+T.count);for(let tt=Ve,Ot=We;tt<Ot;tt++)UA.fromBufferAttribute(Ne,tt),dp(UA,tt,te,p,r,l,this)}}updateMorphTargets(){const l=this.geometry.morphAttributes,h=Object.keys(l);if(h.length>0){const p=l[h[0]];if(p!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let y=0,T=p.length;y<T;y++){const O=p[y].name||String(y);this.morphTargetInfluences.push(0),this.morphTargetDictionary[O]=y}}}}}function dp(ue,r,l,h,p,y,T){const O=qd.distanceSqToPoint(ue);if(O<l){const te=new kn;qd.closestPointToPoint(ue,te),te.applyMatrix4(h);const se=p.ray.origin.distanceTo(te);if(se<p.near||se>p.far)return;y.push({distance:se,distanceToRay:Math.sqrt(O),point:te,index:r,face:null,faceIndex:null,barycoord:null,object:T})}}class Kv extends null{constructor(r,l,h,p,y=vr,T=vr,O,te,se){super(r,l,h,p,y,T,O,te,se),this.isVideoTexture=!0,this.generateMipmaps=!1,this._requestVideoFrameCallbackId=0;const xe=this;function Ne(){xe.needsUpdate=!0,xe._requestVideoFrameCallbackId=r.requestVideoFrameCallback(Ne)}"requestVideoFrameCallback"in r&&(this._requestVideoFrameCallbackId=r.requestVideoFrameCallback(Ne))}clone(){return new this.constructor(this.image).copy(this)}update(){const r=this.image;"requestVideoFrameCallback"in r===!1&&r.readyState>=r.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}dispose(){this._requestVideoFrameCallbackId!==0&&(this.source.data.cancelVideoFrameCallback(this._requestVideoFrameCallbackId),this._requestVideoFrameCallbackId=0),super.dispose()}}class jm extends null{constructor(r,l,h,p,y,T,O,te){super({},r,l,h,p,y,T,O,te),this.isVideoFrameTexture=!0}update(){}clone(){return new this.constructor().copy(this)}setFrame(r){this.image=r,this.needsUpdate=!0}}class fp extends null{constructor(r,l){super({width:r,height:l}),this.isFramebufferTexture=!0,this.magFilter=cn,this.minFilter=cn,this.generateMipmaps=!1,this.needsUpdate=!0}}class rd extends null{constructor(r,l,h,p,y,T,O,te,se,xe,Ne,Ve){super(null,T,O,te,se,xe,p,y,Ne,Ve),this.isCompressedTexture=!0,this.image={width:l,height:h},this.mipmaps=r,this.flipY=!1,this.generateMipmaps=!1}}class Am extends null{constructor(r,l,h,p,y,T){super(r,l,h,y,T),this.isCompressedArrayTexture=!0,this.image.depth=p,this.wrapR=Vt,this.layerUpdates=new Set}addLayerUpdate(r){this.layerUpdates.add(r)}clearLayerUpdates(){this.layerUpdates.clear()}}class pm extends null{constructor(r,l,h){super(void 0,r[0].width,r[0].height,l,h,it),this.isCompressedCubeTexture=!0,this.isCubeTexture=!0,this.image=r}}class D0 extends ri{constructor(r,l,h,p,y,T,O,te,se){super(r,l,h,p,y,T,O,te,se),this.isCanvasTexture=!0,this.needsUpdate=!0}}class Ym extends null{constructor(r,l,h=st,p,y,T,O=cn,te=cn,se,xe=Q,Ne=1){if(xe!==Q&&xe!==w)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");const Ve={width:r,height:l,depth:Ne};super(Ve,p,y,T,O,te,xe,h,se),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(r){return super.copy(r),this.source=new br(Object.assign({},r.image)),this.compareFunction=r.compareFunction,this}toJSON(r){const l=super.toJSON(r);return this.compareFunction!==null&&(l.compareFunction=this.compareFunction),l}}class k0 extends null{constructor(r=null){super(),this.sourceTexture=r,this.isExternalTexture=!0}copy(r){return super.copy(r),this.sourceTexture=r.sourceTexture,this}}class gm extends Ui{constructor(r=1,l=1,h=4,p=8,y=1){super(),this.type="CapsuleGeometry",this.parameters={radius:r,height:l,capSegments:h,radialSegments:p,heightSegments:y},l=Math.max(0,l),h=Math.max(1,Math.floor(h)),p=Math.max(3,Math.floor(p)),y=Math.max(1,Math.floor(y));const T=[],O=[],te=[],se=[],xe=l/2,Ne=Math.PI/2*r,Ve=l,We=2*Ne+Ve,tt=h*2+y,Ot=p+1,An=new kn,un=new kn;for(let Un=0;Un<=tt;Un++){let Vn=0,nr=0,ii=0,pi=0;if(Un<=h){const ls=Un/h,ys=ls*Math.PI/2;nr=-xe-r*Math.cos(ys),ii=r*Math.sin(ys),pi=-r*Math.cos(ys),Vn=ls*Ne}else if(Un<=h+y){const ls=(Un-h)/y;nr=-xe+ls*l,ii=r,pi=0,Vn=Ne+ls*Ve}else{const ls=(Un-h-y)/h,ys=ls*Math.PI/2;nr=xe+r*Math.sin(ys),ii=r*Math.cos(ys),pi=r*Math.sin(ys),Vn=Ne+Ve+ls*Ne}const Bi=Math.max(0,Math.min(1,Vn/We));let mi=0;Un===0?mi=.5/p:Un===tt&&(mi=-.5/p);for(let ls=0;ls<=p;ls++){const ys=ls/p,Da=ys*Math.PI*2,Mo=Math.sin(Da),Ro=Math.cos(Da);un.x=-ii*Ro,un.y=nr,un.z=ii*Mo,O.push(un.x,un.y,un.z),An.set(-ii*Ro,pi,ii*Mo),An.normalize(),te.push(An.x,An.y,An.z),se.push(ys+mi,Bi)}if(Un>0){const ls=(Un-1)*Ot;for(let ys=0;ys<p;ys++){const Da=ls+ys,Mo=ls+ys+1,Ro=Un*Ot+ys,du=Un*Ot+ys+1;T.push(Da,Mo,Ro),T.push(Mo,du,Ro)}}}this.setIndex(T),this.setAttribute("position",new ha(O,3)),this.setAttribute("normal",new ha(te,3)),this.setAttribute("uv",new ha(se,2))}copy(r){return super.copy(r),this.parameters=Object.assign({},r.parameters),this}static fromJSON(r){return new gm(r.radius,r.height,r.capSegments,r.radialSegments,r.heightSegments)}}class OA extends Ui{constructor(r=1,l=32,h=0,p=Math.PI*2){super(),this.type="CircleGeometry",this.parameters={radius:r,segments:l,thetaStart:h,thetaLength:p},l=Math.max(3,l);const y=[],T=[],O=[],te=[],se=new kn,xe=new qi;T.push(0,0,0),O.push(0,0,1),te.push(.5,.5);for(let Ne=0,Ve=3;Ne<=l;Ne++,Ve+=3){const We=h+Ne/l*p;se.x=r*Math.cos(We),se.y=r*Math.sin(We),T.push(se.x,se.y,se.z),O.push(0,0,1),xe.x=(T[Ve]/r+1)/2,xe.y=(T[Ve+1]/r+1)/2,te.push(xe.x,xe.y)}for(let Ne=1;Ne<=l;Ne++)y.push(Ne,Ne+1,0);this.setIndex(y),this.setAttribute("position",new ha(T,3)),this.setAttribute("normal",new ha(O,3)),this.setAttribute("uv",new ha(te,2))}copy(r){return super.copy(r),this.parameters=Object.assign({},r.parameters),this}static fromJSON(r){return new OA(r.radius,r.segments,r.thetaStart,r.thetaLength)}}class DA extends Ui{constructor(r=1,l=1,h=1,p=32,y=1,T=!1,O=0,te=Math.PI*2){super(),this.type="CylinderGeometry",this.parameters={radiusTop:r,radiusBottom:l,height:h,radialSegments:p,heightSegments:y,openEnded:T,thetaStart:O,thetaLength:te};const se=this;p=Math.floor(p),y=Math.floor(y);const xe=[],Ne=[],Ve=[],We=[];let tt=0;const Ot=[],An=h/2;let un=0;Un(),T===!1&&(r>0&&Vn(!0),l>0&&Vn(!1)),this.setIndex(xe),this.setAttribute("position",new ha(Ne,3)),this.setAttribute("normal",new ha(Ve,3)),this.setAttribute("uv",new ha(We,2));function Un(){const nr=new kn,ii=new kn;let pi=0;const Bi=(l-r)/h;for(let mi=0;mi<=y;mi++){const ls=[],ys=mi/y,Da=ys*(l-r)+r;for(let Mo=0;Mo<=p;Mo++){const Ro=Mo/p,du=Ro*te+O,ru=Math.sin(du),Zc=Math.cos(du);ii.x=Da*ru,ii.y=-ys*h+An,ii.z=Da*Zc,Ne.push(ii.x,ii.y,ii.z),nr.set(ru,Bi,Zc).normalize(),Ve.push(nr.x,nr.y,nr.z),We.push(Ro,1-ys),ls.push(tt++)}Ot.push(ls)}for(let mi=0;mi<p;mi++)for(let ls=0;ls<y;ls++){const ys=Ot[ls][mi],Da=Ot[ls+1][mi],Mo=Ot[ls+1][mi+1],Ro=Ot[ls][mi+1];(r>0||ls!==0)&&(xe.push(ys,Da,Ro),pi+=3),(l>0||ls!==y-1)&&(xe.push(Da,Mo,Ro),pi+=3)}se.addGroup(un,pi,0),un+=pi}function Vn(nr){const ii=tt,pi=new qi,Bi=new kn;let mi=0;const ls=nr===!0?r:l,ys=nr===!0?1:-1;for(let Mo=1;Mo<=p;Mo++)Ne.push(0,An*ys,0),Ve.push(0,ys,0),We.push(.5,.5),tt++;const Da=tt;for(let Mo=0;Mo<=p;Mo++){const du=Mo/p*te+O,ru=Math.cos(du),Zc=Math.sin(du);Bi.x=ls*Zc,Bi.y=An*ys,Bi.z=ls*ru,Ne.push(Bi.x,Bi.y,Bi.z),Ve.push(0,ys,0),pi.x=ru*.5+.5,pi.y=Zc*.5*ys+.5,We.push(pi.x,pi.y),tt++}for(let Mo=0;Mo<p;Mo++){const Ro=ii+Mo,du=Da+Mo;nr===!0?xe.push(du,du+1,Ro):xe.push(du+1,du,Ro),mi+=3}se.addGroup(un,mi,nr===!0?1:2),un+=mi}}copy(r){return super.copy(r),this.parameters=Object.assign({},r.parameters),this}static fromJSON(r){return new DA(r.radiusTop,r.radiusBottom,r.height,r.radialSegments,r.heightSegments,r.openEnded,r.thetaStart,r.thetaLength)}}class Us extends DA{constructor(r=1,l=1,h=32,p=1,y=!1,T=0,O=Math.PI*2){super(0,r,l,h,p,y,T,O),this.type="ConeGeometry",this.parameters={radius:r,height:l,radialSegments:h,heightSegments:p,openEnded:y,thetaStart:T,thetaLength:O}}static fromJSON(r){return new Us(r.radius,r.height,r.radialSegments,r.heightSegments,r.openEnded,r.thetaStart,r.thetaLength)}}class Cd extends Ui{constructor(r=[],l=[],h=1,p=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:r,indices:l,radius:h,detail:p};const y=[],T=[];O(p),se(h),xe(),this.setAttribute("position",new ha(y,3)),this.setAttribute("normal",new ha(y.slice(),3)),this.setAttribute("uv",new ha(T,2)),p===0?this.computeVertexNormals():this.normalizeNormals();function O(Un){const Vn=new kn,nr=new kn,ii=new kn;for(let pi=0;pi<l.length;pi+=3)We(l[pi+0],Vn),We(l[pi+1],nr),We(l[pi+2],ii),te(Vn,nr,ii,Un)}function te(Un,Vn,nr,ii){const pi=ii+1,Bi=[];for(let mi=0;mi<=pi;mi++){Bi[mi]=[];const ls=Un.clone().lerp(nr,mi/pi),ys=Vn.clone().lerp(nr,mi/pi),Da=pi-mi;for(let Mo=0;Mo<=Da;Mo++)Mo===0&&mi===pi?Bi[mi][Mo]=ls:Bi[mi][Mo]=ls.clone().lerp(ys,Mo/Da)}for(let mi=0;mi<pi;mi++)for(let ls=0;ls<2*(pi-mi)-1;ls++){const ys=Math.floor(ls/2);ls%2===0?(Ve(Bi[mi][ys+1]),Ve(Bi[mi+1][ys]),Ve(Bi[mi][ys])):(Ve(Bi[mi][ys+1]),Ve(Bi[mi+1][ys+1]),Ve(Bi[mi+1][ys]))}}function se(Un){const Vn=new kn;for(let nr=0;nr<y.length;nr+=3)Vn.x=y[nr+0],Vn.y=y[nr+1],Vn.z=y[nr+2],Vn.normalize().multiplyScalar(Un),y[nr+0]=Vn.x,y[nr+1]=Vn.y,y[nr+2]=Vn.z}function xe(){const Un=new kn;for(let Vn=0;Vn<y.length;Vn+=3){Un.x=y[Vn+0],Un.y=y[Vn+1],Un.z=y[Vn+2];const nr=An(Un)/2/Math.PI+.5,ii=un(Un)/Math.PI+.5;T.push(nr,1-ii)}tt(),Ne()}function Ne(){for(let Un=0;Un<T.length;Un+=6){const Vn=T[Un+0],nr=T[Un+2],ii=T[Un+4],pi=Math.max(Vn,nr,ii),Bi=Math.min(Vn,nr,ii);pi>.9&&Bi<.1&&(Vn<.2&&(T[Un+0]+=1),nr<.2&&(T[Un+2]+=1),ii<.2&&(T[Un+4]+=1))}}function Ve(Un){y.push(Un.x,Un.y,Un.z)}function We(Un,Vn){const nr=Un*3;Vn.x=r[nr+0],Vn.y=r[nr+1],Vn.z=r[nr+2]}function tt(){const Un=new kn,Vn=new kn,nr=new kn,ii=new kn,pi=new qi,Bi=new qi,mi=new qi;for(let ls=0,ys=0;ls<y.length;ls+=9,ys+=6){Un.set(y[ls+0],y[ls+1],y[ls+2]),Vn.set(y[ls+3],y[ls+4],y[ls+5]),nr.set(y[ls+6],y[ls+7],y[ls+8]),pi.set(T[ys+0],T[ys+1]),Bi.set(T[ys+2],T[ys+3]),mi.set(T[ys+4],T[ys+5]),ii.copy(Un).add(Vn).add(nr).divideScalar(3);const Da=An(ii);Ot(pi,ys+0,Un,Da),Ot(Bi,ys+2,Vn,Da),Ot(mi,ys+4,nr,Da)}}function Ot(Un,Vn,nr,ii){ii<0&&Un.x===1&&(T[Vn]=Un.x-1),nr.x===0&&nr.z===0&&(T[Vn]=ii/2/Math.PI+.5)}function An(Un){return Math.atan2(Un.z,-Un.x)}function un(Un){return Math.atan2(-Un.y,Math.sqrt(Un.x*Un.x+Un.z*Un.z))}}copy(r){return super.copy(r),this.parameters=Object.assign({},r.parameters),this}static fromJSON(r){return new Cd(r.vertices,r.indices,r.radius,r.details)}}class iA extends Cd{constructor(r=1,l=0){const h=(1+Math.sqrt(5))/2,p=1/h,y=[-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-p,-h,0,-p,h,0,p,-h,0,p,h,-p,-h,0,-p,h,0,p,-h,0,p,h,0,-h,0,-p,h,0,-p,-h,0,p,h,0,p],T=[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9];super(y,T,r,l),this.type="DodecahedronGeometry",this.parameters={radius:r,detail:l}}static fromJSON(r){return new iA(r.radius,r.detail)}}const Al=new kn,sA=new kn,Fo=new kn,ll=new Bl;class hc extends Ui{constructor(r=null,l=1){if(super(),this.type="EdgesGeometry",this.parameters={geometry:r,thresholdAngle:l},r!==null){const p=Math.pow(10,4),y=Math.cos(ac*l),T=r.getIndex(),O=r.getAttribute("position"),te=T?T.count:O.count,se=[0,0,0],xe=["a","b","c"],Ne=new Array(3),Ve={},We=[];for(let tt=0;tt<te;tt+=3){T?(se[0]=T.getX(tt),se[1]=T.getX(tt+1),se[2]=T.getX(tt+2)):(se[0]=tt,se[1]=tt+1,se[2]=tt+2);const{a:Ot,b:An,c:un}=ll;if(Ot.fromBufferAttribute(O,se[0]),An.fromBufferAttribute(O,se[1]),un.fromBufferAttribute(O,se[2]),ll.getNormal(Fo),Ne[0]=`${Math.round(Ot.x*p)},${Math.round(Ot.y*p)},${Math.round(Ot.z*p)}`,Ne[1]=`${Math.round(An.x*p)},${Math.round(An.y*p)},${Math.round(An.z*p)}`,Ne[2]=`${Math.round(un.x*p)},${Math.round(un.y*p)},${Math.round(un.z*p)}`,!(Ne[0]===Ne[1]||Ne[1]===Ne[2]||Ne[2]===Ne[0]))for(let Un=0;Un<3;Un++){const Vn=(Un+1)%3,nr=Ne[Un],ii=Ne[Vn],pi=ll[xe[Un]],Bi=ll[xe[Vn]],mi=`${nr}_${ii}`,ls=`${ii}_${nr}`;ls in Ve&&Ve[ls]?(Fo.dot(Ve[ls].normal)<=y&&(We.push(pi.x,pi.y,pi.z),We.push(Bi.x,Bi.y,Bi.z)),Ve[ls]=null):mi in Ve||(Ve[mi]={index0:se[Un],index1:se[Vn],normal:Fo.clone()})}}for(const tt in Ve)if(Ve[tt]){const{index0:Ot,index1:An}=Ve[tt];Al.fromBufferAttribute(O,Ot),sA.fromBufferAttribute(O,An),We.push(Al.x,Al.y,Al.z),We.push(sA.x,sA.y,sA.z)}this.setAttribute("position",new ha(We,3))}}copy(r){return super.copy(r),this.parameters=Object.assign({},r.parameters),this}}class Cc{constructor(){this.type="Curve",this.arcLengthDivisions=200,this.needsUpdate=!1,this.cacheArcLengths=null}getPoint(){na("Curve: .getPoint() not implemented.")}getPointAt(r,l){const h=this.getUtoTmapping(r);return this.getPoint(h,l)}getPoints(r=5){const l=[];for(let h=0;h<=r;h++)l.push(this.getPoint(h/r));return l}getSpacedPoints(r=5){const l=[];for(let h=0;h<=r;h++)l.push(this.getPointAt(h/r));return l}getLength(){const r=this.getLengths();return r[r.length-1]}getLengths(r=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===r+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const l=[];let h,p=this.getPoint(0),y=0;l.push(0);for(let T=1;T<=r;T++)h=this.getPoint(T/r),y+=h.distanceTo(p),l.push(y),p=h;return this.cacheArcLengths=l,l}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(r,l=null){const h=this.getLengths();let p=0;const y=h.length;let T;l?T=l:T=r*h[y-1];let O=0,te=y-1,se;for(;O<=te;)if(p=Math.floor(O+(te-O)/2),se=h[p]-T,se<0)O=p+1;else if(se>0)te=p-1;else{te=p;break}if(p=te,h[p]===T)return p/(y-1);const xe=h[p],Ve=h[p+1]-xe,We=(T-xe)/Ve;return(p+We)/(y-1)}getTangent(r,l){let p=r-1e-4,y=r+1e-4;p<0&&(p=0),y>1&&(y=1);const T=this.getPoint(p),O=this.getPoint(y),te=l||(T.isVector2?new qi:new kn);return te.copy(O).sub(T).normalize(),te}getTangentAt(r,l){const h=this.getUtoTmapping(r);return this.getTangent(h,l)}computeFrenetFrames(r,l=!1){const h=new kn,p=[],y=[],T=[],O=new kn,te=new oi;for(let We=0;We<=r;We++){const tt=We/r;p[We]=this.getTangentAt(tt,new kn)}y[0]=new kn,T[0]=new kn;let se=Number.MAX_VALUE;const xe=Math.abs(p[0].x),Ne=Math.abs(p[0].y),Ve=Math.abs(p[0].z);xe<=se&&(se=xe,h.set(1,0,0)),Ne<=se&&(se=Ne,h.set(0,1,0)),Ve<=se&&h.set(0,0,1),O.crossVectors(p[0],h).normalize(),y[0].crossVectors(p[0],O),T[0].crossVectors(p[0],y[0]);for(let We=1;We<=r;We++){if(y[We]=y[We-1].clone(),T[We]=T[We-1].clone(),O.crossVectors(p[We-1],p[We]),O.length()>Number.EPSILON){O.normalize();const tt=Math.acos(ki(p[We-1].dot(p[We]),-1,1));y[We].applyMatrix4(te.makeRotationAxis(O,tt))}T[We].crossVectors(p[We],y[We])}if(l===!0){let We=Math.acos(ki(y[0].dot(y[r]),-1,1));We/=r,p[0].dot(O.crossVectors(y[0],y[r]))>0&&(We=-We);for(let tt=1;tt<=r;tt++)y[tt].applyMatrix4(te.makeRotationAxis(p[tt],We*tt)),T[tt].crossVectors(p[tt],y[tt])}return{tangents:p,normals:y,binormals:T}}clone(){return new this.constructor().copy(this)}copy(r){return this.arcLengthDivisions=r.arcLengthDivisions,this}toJSON(){const r={metadata:{version:4.7,type:"Curve",generator:"Curve.toJSON"}};return r.arcLengthDivisions=this.arcLengthDivisions,r.type=this.type,r}fromJSON(r){return this.arcLengthDivisions=r.arcLengthDivisions,this}}class Rh extends Cc{constructor(r=0,l=0,h=1,p=1,y=0,T=Math.PI*2,O=!1,te=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=r,this.aY=l,this.xRadius=h,this.yRadius=p,this.aStartAngle=y,this.aEndAngle=T,this.aClockwise=O,this.aRotation=te}getPoint(r,l=new qi){const h=l,p=Math.PI*2;let y=this.aEndAngle-this.aStartAngle;const T=Math.abs(y)<Number.EPSILON;for(;y<0;)y+=p;for(;y>p;)y-=p;y<Number.EPSILON&&(T?y=0:y=p),this.aClockwise===!0&&!T&&(y===p?y=-p:y=y-p);const O=this.aStartAngle+r*y;let te=this.aX+this.xRadius*Math.cos(O),se=this.aY+this.yRadius*Math.sin(O);if(this.aRotation!==0){const xe=Math.cos(this.aRotation),Ne=Math.sin(this.aRotation),Ve=te-this.aX,We=se-this.aY;te=Ve*xe-We*Ne+this.aX,se=Ve*Ne+We*xe+this.aY}return h.set(te,se)}copy(r){return super.copy(r),this.aX=r.aX,this.aY=r.aY,this.xRadius=r.xRadius,this.yRadius=r.yRadius,this.aStartAngle=r.aStartAngle,this.aEndAngle=r.aEndAngle,this.aClockwise=r.aClockwise,this.aRotation=r.aRotation,this}toJSON(){const r=super.toJSON();return r.aX=this.aX,r.aY=this.aY,r.xRadius=this.xRadius,r.yRadius=this.yRadius,r.aStartAngle=this.aStartAngle,r.aEndAngle=this.aEndAngle,r.aClockwise=this.aClockwise,r.aRotation=this.aRotation,r}fromJSON(r){return super.fromJSON(r),this.aX=r.aX,this.aY=r.aY,this.xRadius=r.xRadius,this.yRadius=r.yRadius,this.aStartAngle=r.aStartAngle,this.aEndAngle=r.aEndAngle,this.aClockwise=r.aClockwise,this.aRotation=r.aRotation,this}}class Bf extends Rh{constructor(r,l,h,p,y,T){super(r,l,h,h,p,y,T),this.isArcCurve=!0,this.type="ArcCurve"}}function Rf(){let ue=0,r=0,l=0,h=0;function p(y,T,O,te){ue=y,r=O,l=-3*y+3*T-2*O-te,h=2*y-2*T+O+te}return{initCatmullRom:function(y,T,O,te,se){p(T,O,se*(O-y),se*(te-T))},initNonuniformCatmullRom:function(y,T,O,te,se,xe,Ne){let Ve=(T-y)/se-(O-y)/(se+xe)+(O-T)/xe,We=(O-T)/xe-(te-T)/(xe+Ne)+(te-O)/Ne;Ve*=xe,We*=xe,p(T,O,Ve,We)},calc:function(y){const T=y*y,O=T*y;return ue+r*y+l*T+h*O}}}const aA=new kn,kA=new Rf,oA=new Rf,VA=new Rf;class mm extends Cc{constructor(r=[],l=!1,h="centripetal",p=.5){super(),this.isCatmullRomCurve3=!0,this.type="CatmullRomCurve3",this.points=r,this.closed=l,this.curveType=h,this.tension=p}getPoint(r,l=new kn){const h=l,p=this.points,y=p.length,T=(y-(this.closed?0:1))*r;let O=Math.floor(T),te=T-O;this.closed?O+=O>0?0:(Math.floor(Math.abs(O)/y)+1)*y:te===0&&O===y-1&&(O=y-2,te=1);let se,xe;this.closed||O>0?se=p[(O-1)%y]:(aA.subVectors(p[0],p[1]).add(p[0]),se=aA);const Ne=p[O%y],Ve=p[(O+1)%y];if(this.closed||O+2<y?xe=p[(O+2)%y]:(aA.subVectors(p[y-1],p[y-2]).add(p[y-1]),xe=aA),this.curveType==="centripetal"||this.curveType==="chordal"){const We=this.curveType==="chordal"?.5:.25;let tt=Math.pow(se.distanceToSquared(Ne),We),Ot=Math.pow(Ne.distanceToSquared(Ve),We),An=Math.pow(Ve.distanceToSquared(xe),We);Ot<1e-4&&(Ot=1),tt<1e-4&&(tt=Ot),An<1e-4&&(An=Ot),kA.initNonuniformCatmullRom(se.x,Ne.x,Ve.x,xe.x,tt,Ot,An),oA.initNonuniformCatmullRom(se.y,Ne.y,Ve.y,xe.y,tt,Ot,An),VA.initNonuniformCatmullRom(se.z,Ne.z,Ve.z,xe.z,tt,Ot,An)}else this.curveType==="catmullrom"&&(kA.initCatmullRom(se.x,Ne.x,Ve.x,xe.x,this.tension),oA.initCatmullRom(se.y,Ne.y,Ve.y,xe.y,this.tension),VA.initCatmullRom(se.z,Ne.z,Ve.z,xe.z,this.tension));return h.set(kA.calc(te),oA.calc(te),VA.calc(te)),h}copy(r){super.copy(r),this.points=[];for(let l=0,h=r.points.length;l<h;l++){const p=r.points[l];this.points.push(p.clone())}return this.closed=r.closed,this.curveType=r.curveType,this.tension=r.tension,this}toJSON(){const r=super.toJSON();r.points=[];for(let l=0,h=this.points.length;l<h;l++){const p=this.points[l];r.points.push(p.toArray())}return r.closed=this.closed,r.curveType=this.curveType,r.tension=this.tension,r}fromJSON(r){super.fromJSON(r),this.points=[];for(let l=0,h=r.points.length;l<h;l++){const p=r.points[l];this.points.push(new kn().fromArray(p))}return this.closed=r.closed,this.curveType=r.curveType,this.tension=r.tension,this}}function Hh(ue,r,l,h,p){const y=(h-r)*.5,T=(p-l)*.5,O=ue*ue,te=ue*O;return(2*l-2*h+y+T)*te+(-3*l+3*h-2*y-T)*O+y*ue+l}function zp(ue,r){const l=1-ue;return l*l*r}function vm(ue,r){return 2*(1-ue)*ue*r}function zA(ue,r){return ue*ue*r}function Jd(ue,r,l,h){return zp(ue,r)+vm(ue,l)+zA(ue,h)}function ym(ue,r){const l=1-ue;return l*l*l*r}function x(ue,r){const l=1-ue;return 3*l*l*ue*r}function S(ue,r){return 3*(1-ue)*ue*ue*r}function f(ue,r){return ue*ue*ue*r}function A(ue,r,l,h,p){return ym(ue,r)+x(ue,l)+S(ue,h)+f(ue,p)}class _ extends Cc{constructor(r=new qi,l=new qi,h=new qi,p=new qi){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=r,this.v1=l,this.v2=h,this.v3=p}getPoint(r,l=new qi){const h=l,p=this.v0,y=this.v1,T=this.v2,O=this.v3;return h.set(A(r,p.x,y.x,T.x,O.x),A(r,p.y,y.y,T.y,O.y)),h}copy(r){return super.copy(r),this.v0.copy(r.v0),this.v1.copy(r.v1),this.v2.copy(r.v2),this.v3.copy(r.v3),this}toJSON(){const r=super.toJSON();return r.v0=this.v0.toArray(),r.v1=this.v1.toArray(),r.v2=this.v2.toArray(),r.v3=this.v3.toArray(),r}fromJSON(r){return super.fromJSON(r),this.v0.fromArray(r.v0),this.v1.fromArray(r.v1),this.v2.fromArray(r.v2),this.v3.fromArray(r.v3),this}}class k extends Cc{constructor(r=new kn,l=new kn,h=new kn,p=new kn){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=r,this.v1=l,this.v2=h,this.v3=p}getPoint(r,l=new kn){const h=l,p=this.v0,y=this.v1,T=this.v2,O=this.v3;return h.set(A(r,p.x,y.x,T.x,O.x),A(r,p.y,y.y,T.y,O.y),A(r,p.z,y.z,T.z,O.z)),h}copy(r){return super.copy(r),this.v0.copy(r.v0),this.v1.copy(r.v1),this.v2.copy(r.v2),this.v3.copy(r.v3),this}toJSON(){const r=super.toJSON();return r.v0=this.v0.toArray(),r.v1=this.v1.toArray(),r.v2=this.v2.toArray(),r.v3=this.v3.toArray(),r}fromJSON(r){return super.fromJSON(r),this.v0.fromArray(r.v0),this.v1.fromArray(r.v1),this.v2.fromArray(r.v2),this.v3.fromArray(r.v3),this}}class G extends Cc{constructor(r=new qi,l=new qi){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=r,this.v2=l}getPoint(r,l=new qi){const h=l;return r===1?h.copy(this.v2):(h.copy(this.v2).sub(this.v1),h.multiplyScalar(r).add(this.v1)),h}getPointAt(r,l){return this.getPoint(r,l)}getTangent(r,l=new qi){return l.subVectors(this.v2,this.v1).normalize()}getTangentAt(r,l){return this.getTangent(r,l)}copy(r){return super.copy(r),this.v1.copy(r.v1),this.v2.copy(r.v2),this}toJSON(){const r=super.toJSON();return r.v1=this.v1.toArray(),r.v2=this.v2.toArray(),r}fromJSON(r){return super.fromJSON(r),this.v1.fromArray(r.v1),this.v2.fromArray(r.v2),this}}class ae extends Cc{constructor(r=new kn,l=new kn){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=r,this.v2=l}getPoint(r,l=new kn){const h=l;return r===1?h.copy(this.v2):(h.copy(this.v2).sub(this.v1),h.multiplyScalar(r).add(this.v1)),h}getPointAt(r,l){return this.getPoint(r,l)}getTangent(r,l=new kn){return l.subVectors(this.v2,this.v1).normalize()}getTangentAt(r,l){return this.getTangent(r,l)}copy(r){return super.copy(r),this.v1.copy(r.v1),this.v2.copy(r.v2),this}toJSON(){const r=super.toJSON();return r.v1=this.v1.toArray(),r.v2=this.v2.toArray(),r}fromJSON(r){return super.fromJSON(r),this.v1.fromArray(r.v1),this.v2.fromArray(r.v2),this}}class ge extends Cc{constructor(r=new qi,l=new qi,h=new qi){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=r,this.v1=l,this.v2=h}getPoint(r,l=new qi){const h=l,p=this.v0,y=this.v1,T=this.v2;return h.set(Jd(r,p.x,y.x,T.x),Jd(r,p.y,y.y,T.y)),h}copy(r){return super.copy(r),this.v0.copy(r.v0),this.v1.copy(r.v1),this.v2.copy(r.v2),this}toJSON(){const r=super.toJSON();return r.v0=this.v0.toArray(),r.v1=this.v1.toArray(),r.v2=this.v2.toArray(),r}fromJSON(r){return super.fromJSON(r),this.v0.fromArray(r.v0),this.v1.fromArray(r.v1),this.v2.fromArray(r.v2),this}}class Ue extends Cc{constructor(r=new kn,l=new kn,h=new kn){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=r,this.v1=l,this.v2=h}getPoint(r,l=new kn){const h=l,p=this.v0,y=this.v1,T=this.v2;return h.set(Jd(r,p.x,y.x,T.x),Jd(r,p.y,y.y,T.y),Jd(r,p.z,y.z,T.z)),h}copy(r){return super.copy(r),this.v0.copy(r.v0),this.v1.copy(r.v1),this.v2.copy(r.v2),this}toJSON(){const r=super.toJSON();return r.v0=this.v0.toArray(),r.v1=this.v1.toArray(),r.v2=this.v2.toArray(),r}fromJSON(r){return super.fromJSON(r),this.v0.fromArray(r.v0),this.v1.fromArray(r.v1),this.v2.fromArray(r.v2),this}}class rt extends Cc{constructor(r=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=r}getPoint(r,l=new qi){const h=l,p=this.points,y=(p.length-1)*r,T=Math.floor(y),O=y-T,te=p[T===0?T:T-1],se=p[T],xe=p[T>p.length-2?p.length-1:T+1],Ne=p[T>p.length-3?p.length-1:T+2];return h.set(Hh(O,te.x,se.x,xe.x,Ne.x),Hh(O,te.y,se.y,xe.y,Ne.y)),h}copy(r){super.copy(r),this.points=[];for(let l=0,h=r.points.length;l<h;l++){const p=r.points[l];this.points.push(p.clone())}return this}toJSON(){const r=super.toJSON();r.points=[];for(let l=0,h=this.points.length;l<h;l++){const p=this.points[l];r.points.push(p.toArray())}return r}fromJSON(r){super.fromJSON(r),this.points=[];for(let l=0,h=r.points.length;l<h;l++){const p=r.points[l];this.points.push(new qi().fromArray(p))}return this}}var bt=Object.freeze({__proto__:null,ArcCurve:Bf,CatmullRomCurve3:mm,CubicBezierCurve:_,CubicBezierCurve3:k,EllipseCurve:Rh,LineCurve:G,LineCurve3:ae,QuadraticBezierCurve:ge,QuadraticBezierCurve3:Ue,SplineCurve:rt});class Zt extends Cc{constructor(){super(),this.type="CurvePath",this.curves=[],this.autoClose=!1}add(r){this.curves.push(r)}closePath(){const r=this.curves[0].getPoint(0),l=this.curves[this.curves.length-1].getPoint(1);if(!r.equals(l)){const h=r.isVector2===!0?"LineCurve":"LineCurve3";this.curves.push(new bt[h](l,r))}return this}getPoint(r,l){const h=r*this.getLength(),p=this.getCurveLengths();let y=0;for(;y<p.length;){if(p[y]>=h){const T=p[y]-h,O=this.curves[y],te=O.getLength(),se=te===0?0:1-T/te;return O.getPointAt(se,l)}y++}return null}getLength(){const r=this.getCurveLengths();return r[r.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 r=[];let l=0;for(let h=0,p=this.curves.length;h<p;h++)l+=this.curves[h].getLength(),r.push(l);return this.cacheLengths=r,r}getSpacedPoints(r=40){const l=[];for(let h=0;h<=r;h++)l.push(this.getPoint(h/r));return this.autoClose&&l.push(l[0]),l}getPoints(r=12){const l=[];let h;for(let p=0,y=this.curves;p<y.length;p++){const T=y[p],O=T.isEllipseCurve?r*2:T.isLineCurve||T.isLineCurve3?1:T.isSplineCurve?r*T.points.length:r,te=T.getPoints(O);for(let se=0;se<te.length;se++){const xe=te[se];h&&h.equals(xe)||(l.push(xe),h=xe)}}return this.autoClose&&l.length>1&&!l[l.length-1].equals(l[0])&&l.push(l[0]),l}copy(r){super.copy(r),this.curves=[];for(let l=0,h=r.curves.length;l<h;l++){const p=r.curves[l];this.curves.push(p.clone())}return this.autoClose=r.autoClose,this}toJSON(){const r=super.toJSON();r.autoClose=this.autoClose,r.curves=[];for(let l=0,h=this.curves.length;l<h;l++){const p=this.curves[l];r.curves.push(p.toJSON())}return r}fromJSON(r){super.fromJSON(r),this.autoClose=r.autoClose,this.curves=[];for(let l=0,h=r.curves.length;l<h;l++){const p=r.curves[l];this.curves.push(new bt[p.type]().fromJSON(p))}return this}}class wn extends Zt{constructor(r){super(),this.type="Path",this.currentPoint=new qi,r&&this.setFromPoints(r)}setFromPoints(r){this.moveTo(r[0].x,r[0].y);for(let l=1,h=r.length;l<h;l++)this.lineTo(r[l].x,r[l].y);return this}moveTo(r,l){return this.currentPoint.set(r,l),this}lineTo(r,l){const h=new G(this.currentPoint.clone(),new qi(r,l));return this.curves.push(h),this.currentPoint.set(r,l),this}quadraticCurveTo(r,l,h,p){const y=new ge(this.currentPoint.clone(),new qi(r,l),new qi(h,p));return this.curves.push(y),this.currentPoint.set(h,p),this}bezierCurveTo(r,l,h,p,y,T){const O=new _(this.currentPoint.clone(),new qi(r,l),new qi(h,p),new qi(y,T));return this.curves.push(O),this.currentPoint.set(y,T),this}splineThru(r){const l=[this.currentPoint.clone()].concat(r),h=new rt(l);return this.curves.push(h),this.currentPoint.copy(r[r.length-1]),this}arc(r,l,h,p,y,T){const O=this.currentPoint.x,te=this.currentPoint.y;return this.absarc(r+O,l+te,h,p,y,T),this}absarc(r,l,h,p,y,T){return this.absellipse(r,l,h,h,p,y,T),this}ellipse(r,l,h,p,y,T,O,te){const se=this.currentPoint.x,xe=this.currentPoint.y;return this.absellipse(r+se,l+xe,h,p,y,T,O,te),this}absellipse(r,l,h,p,y,T,O,te){const se=new Rh(r,l,h,p,y,T,O,te);if(this.curves.length>0){const Ne=se.getPoint(0);Ne.equals(this.currentPoint)||this.lineTo(Ne.x,Ne.y)}this.curves.push(se);const xe=se.getPoint(1);return this.currentPoint.copy(xe),this}copy(r){return super.copy(r),this.currentPoint.copy(r.currentPoint),this}toJSON(){const r=super.toJSON();return r.currentPoint=this.currentPoint.toArray(),r}fromJSON(r){return super.fromJSON(r),this.currentPoint.fromArray(r.currentPoint),this}}class mn extends wn{constructor(r){super(r),this.uuid=Gr(),this.type="Shape",this.holes=[]}getPointsHoles(r){const l=[];for(let h=0,p=this.holes.length;h<p;h++)l[h]=this.holes[h].getPoints(r);return l}extractPoints(r){return{shape:this.getPoints(r),holes:this.getPointsHoles(r)}}copy(r){super.copy(r),this.holes=[];for(let l=0,h=r.holes.length;l<h;l++){const p=r.holes[l];this.holes.push(p.clone())}return this}toJSON(){const r=super.toJSON();r.uuid=this.uuid,r.holes=[];for(let l=0,h=this.holes.length;l<h;l++){const p=this.holes[l];r.holes.push(p.toJSON())}return r}fromJSON(r){super.fromJSON(r),this.uuid=r.uuid,this.holes=[];for(let l=0,h=r.holes.length;l<h;l++){const p=r.holes[l];this.holes.push(new wn().fromJSON(p))}return this}}function Gn(ue,r,l=2){const h=r&&r.length,p=h?r[0]*l:ue.length;let y=ir(ue,0,p,l,!0);const T=[];if(!y||y.next===y.prev)return T;let O,te,se;if(h&&(y=bi(ue,r,y,l)),ue.length>80*l){O=ue[0],te=ue[1];let xe=O,Ne=te;for(let Ve=l;Ve<p;Ve+=l){const We=ue[Ve],tt=ue[Ve+1];We<O&&(O=We),tt<te&&(te=tt),We>xe&&(xe=We),tt>Ne&&(Ne=tt)}se=Math.max(xe-O,Ne-te),se=se!==0?32767/se:0}return Zn(y,T,l,O,te,se,0),T}function ir(ue,r,l,h,p){let y;if(p===Qs(ue,r,l,h)>0)for(let T=r;T<l;T+=h)y=ur(T/h|0,ue[T],ue[T+1],y);else for(let T=l-h;T>=r;T-=h)y=ur(T/h|0,ue[T],ue[T+1],y);return y&&$(y,y.next)&&(Ir(y),y=y.next),y}function tr(ue,r){if(!ue)return ue;r||(r=ue);let l=ue,h;do if(h=!1,!l.steiner&&($(l,l.next)||R(l.prev,l,l.next)===0)){if(Ir(l),l=r=l.prev,l===l.next)break;h=!0}else l=l.next;while(h||l!==r);return r}function Zn(ue,r,l,h,p,y,T){if(!ue)return;!T&&y&&Zs(ue,h,p,y);let O=ue;for(;ue.prev!==ue.next;){const te=ue.prev,se=ue.next;if(y?ni(ue,h,p,y):Tr(ue)){r.push(te.i,ue.i,se.i),Ir(ue),ue=se.next,O=se.next;continue}if(ue=se,ue===O){T?T===1?(ue=ns(tr(ue),r),Zn(ue,r,l,h,p,y,2)):T===2&&is(ue,r,l,h,p,y):Zn(tr(ue),r,l,h,p,y,1);break}}}function Tr(ue){const r=ue.prev,l=ue,h=ue.next;if(R(r,l,h)>=0)return!1;const p=r.x,y=l.x,T=h.x,O=r.y,te=l.y,se=h.y,xe=Math.min(p,y,T),Ne=Math.min(O,te,se),Ve=Math.max(p,y,T),We=Math.max(O,te,se);let tt=h.next;for(;tt!==r;){if(tt.x>=xe&&tt.x<=Ve&&tt.y>=Ne&&tt.y<=We&&Ys(p,O,y,te,T,se,tt.x,tt.y)&&R(tt.prev,tt,tt.next)>=0)return!1;tt=tt.next}return!0}function ni(ue,r,l,h){const p=ue.prev,y=ue,T=ue.next;if(R(p,y,T)>=0)return!1;const O=p.x,te=y.x,se=T.x,xe=p.y,Ne=y.y,Ve=T.y,We=Math.min(O,te,se),tt=Math.min(xe,Ne,Ve),Ot=Math.max(O,te,se),An=Math.max(xe,Ne,Ve),un=Po(We,tt,r,l,h),Un=Po(Ot,An,r,l,h);let Vn=ue.prevZ,nr=ue.nextZ;for(;Vn&&Vn.z>=un&&nr&&nr.z<=Un;){if(Vn.x>=We&&Vn.x<=Ot&&Vn.y>=tt&&Vn.y<=An&&Vn!==p&&Vn!==T&&Ys(O,xe,te,Ne,se,Ve,Vn.x,Vn.y)&&R(Vn.prev,Vn,Vn.next)>=0||(Vn=Vn.prevZ,nr.x>=We&&nr.x<=Ot&&nr.y>=tt&&nr.y<=An&&nr!==p&&nr!==T&&Ys(O,xe,te,Ne,se,Ve,nr.x,nr.y)&&R(nr.prev,nr,nr.next)>=0))return!1;nr=nr.nextZ}for(;Vn&&Vn.z>=un;){if(Vn.x>=We&&Vn.x<=Ot&&Vn.y>=tt&&Vn.y<=An&&Vn!==p&&Vn!==T&&Ys(O,xe,te,Ne,se,Ve,Vn.x,Vn.y)&&R(Vn.prev,Vn,Vn.next)>=0)return!1;Vn=Vn.prevZ}for(;nr&&nr.z<=Un;){if(nr.x>=We&&nr.x<=Ot&&nr.y>=tt&&nr.y<=An&&nr!==p&&nr!==T&&Ys(O,xe,te,Ne,se,Ve,nr.x,nr.y)&&R(nr.prev,nr,nr.next)>=0)return!1;nr=nr.nextZ}return!0}function ns(ue,r){let l=ue;do{const h=l.prev,p=l.next.next;!$(h,p)&&K(h,l,l.next,p)&&dn(h,p)&&dn(p,h)&&(r.push(h.i,l.i,p.i),Ir(l),Ir(l.next),l=ue=p),l=l.next}while(l!==ue);return tr(l)}function is(ue,r,l,h,p,y){let T=ue;do{let O=T.next.next;for(;O!==T.prev;){if(T.i!==O.i&&U(T,O)){let te=Ar(T,O);T=tr(T,T.next),te=tr(te,te.next),Zn(T,r,l,h,p,y,0),Zn(te,r,l,h,p,y,0);return}O=O.next}T=T.next}while(T!==ue)}function bi(ue,r,l,h){const p=[];for(let y=0,T=r.length;y<T;y++){const O=r[y]*h,te=y<T-1?r[y+1]*h:ue.length,se=ir(ue,O,te,h,!1);se===se.next&&(se.steiner=!0),p.push(Ml(se))}p.sort(Ri);for(let y=0;y<p.length;y++)l=Gs(p[y],l);return l}function Ri(ue,r){let l=ue.x-r.x;if(l===0&&(l=ue.y-r.y,l===0)){const h=(ue.next.y-ue.y)/(ue.next.x-ue.x),p=(r.next.y-r.y)/(r.next.x-r.x);l=h-p}return l}function Gs(ue,r){const l=_s(ue,r);if(!l)return r;const h=Ar(l,ue);return tr(h,h.next),tr(l,l.next)}function _s(ue,r){let l=r;const h=ue.x,p=ue.y;let y=-1/0,T;if($(ue,l))return l;do{if($(ue,l.next))return l.next;if(p<=l.y&&p>=l.next.y&&l.next.y!==l.y){const Ne=l.x+(p-l.y)*(l.next.x-l.x)/(l.next.y-l.y);if(Ne<=h&&Ne>y&&(y=Ne,T=l.x<l.next.x?l:l.next,Ne===h))return T}l=l.next}while(l!==r);if(!T)return null;const O=T,te=T.x,se=T.y;let xe=1/0;l=T;do{if(h>=l.x&&l.x>=te&&h!==l.x&&El(p<se?h:y,p,te,se,p<se?y:h,p,l.x,l.y)){const Ne=Math.abs(p-l.y)/(h-l.x);dn(l,ue)&&(Ne<xe||Ne===xe&&(l.x>T.x||l.x===T.x&&Hs(T,l)))&&(T=l,xe=Ne)}l=l.next}while(l!==O);return T}function Hs(ue,r){return R(ue.prev,ue,r.prev)<0&&R(r.next,ue,ue.next)<0}function Zs(ue,r,l,h){let p=ue;do p.z===0&&(p.z=Po(p.x,p.y,r,l,h)),p.prevZ=p.prev,p.nextZ=p.next,p=p.next;while(p!==ue);p.prevZ.nextZ=null,p.prevZ=null,Ia(p)}function Ia(ue){let r,l=1;do{let h=ue,p;ue=null;let y=null;for(r=0;h;){r++;let T=h,O=0;for(let se=0;se<l&&(O++,T=T.nextZ,!!T);se++);let te=l;for(;O>0||te>0&&T;)O!==0&&(te===0||!T||h.z<=T.z)?(p=h,h=h.nextZ,O--):(p=T,T=T.nextZ,te--),y?y.nextZ=p:ue=p,p.prevZ=y,y=p;h=T}y.nextZ=null,l*=2}while(r>1);return ue}function Po(ue,r,l,h,p){return ue=(ue-l)*p|0,r=(r-h)*p|0,ue=(ue|ue<<8)&16711935,ue=(ue|ue<<4)&252645135,ue=(ue|ue<<2)&858993459,ue=(ue|ue<<1)&1431655765,r=(r|r<<8)&16711935,r=(r|r<<4)&252645135,r=(r|r<<2)&858993459,r=(r|r<<1)&1431655765,ue|r<<1}function Ml(ue){let r=ue,l=ue;do(r.x<l.x||r.x===l.x&&r.y<l.y)&&(l=r),r=r.next;while(r!==ue);return l}function El(ue,r,l,h,p,y,T,O){return(p-T)*(r-O)>=(ue-T)*(y-O)&&(ue-T)*(h-O)>=(l-T)*(r-O)&&(l-T)*(y-O)>=(p-T)*(h-O)}function Ys(ue,r,l,h,p,y,T,O){return!(ue===T&&r===O)&&El(ue,r,l,h,p,y,T,O)}function U(ue,r){return ue.next.i!==r.i&&ue.prev.i!==r.i&&!Ft(ue,r)&&(dn(ue,r)&&dn(r,ue)&&fn(ue,r)&&(R(ue.prev,ue,r.prev)||R(ue,r.prev,r))||$(ue,r)&&R(ue.prev,ue,ue.next)>0&&R(r.prev,r,r.next)>0)}function R(ue,r,l){return(r.y-ue.y)*(l.x-r.x)-(r.x-ue.x)*(l.y-r.y)}function $(ue,r){return ue.x===r.x&&ue.y===r.y}function K(ue,r,l,h){const p=et(R(ue,r,l)),y=et(R(ue,r,h)),T=et(R(l,h,ue)),O=et(R(l,h,r));return!!(p!==y&&T!==O||p===0&&_e(ue,l,r)||y===0&&_e(ue,h,r)||T===0&&_e(l,ue,h)||O===0&&_e(l,r,h))}function _e(ue,r,l){return r.x<=Math.max(ue.x,l.x)&&r.x>=Math.min(ue.x,l.x)&&r.y<=Math.max(ue.y,l.y)&&r.y>=Math.min(ue.y,l.y)}function et(ue){return ue>0?1:ue<0?-1:0}function Ft(ue,r){let l=ue;do{if(l.i!==ue.i&&l.next.i!==ue.i&&l.i!==r.i&&l.next.i!==r.i&&K(l,l.next,ue,r))return!0;l=l.next}while(l!==ue);return!1}function dn(ue,r){return R(ue.prev,ue,ue.next)<0?R(ue,r,ue.next)>=0&&R(ue,ue.prev,r)>=0:R(ue,r,ue.prev)<0||R(ue,ue.next,r)<0}function fn(ue,r){let l=ue,h=!1;const p=(ue.x+r.x)/2,y=(ue.y+r.y)/2;do l.y>y!=l.next.y>y&&l.next.y!==l.y&&p<(l.next.x-l.x)*(y-l.y)/(l.next.y-l.y)+l.x&&(h=!h),l=l.next;while(l!==ue);return h}function Ar(ue,r){const l=fi(ue.i,ue.x,ue.y),h=fi(r.i,r.x,r.y),p=ue.next,y=r.prev;return ue.next=r,r.prev=ue,l.next=p,p.prev=l,h.next=l,l.prev=h,y.next=h,h.prev=y,h}function ur(ue,r,l,h){const p=fi(ue,r,l);return h?(p.next=h.next,p.prev=h,h.next.prev=p,h.next=p):(p.prev=p,p.next=p),p}function Ir(ue){ue.next.prev=ue.prev,ue.prev.next=ue.next,ue.prevZ&&(ue.prevZ.nextZ=ue.nextZ),ue.nextZ&&(ue.nextZ.prevZ=ue.prevZ)}function fi(ue,r,l){return{i:ue,x:r,y:l,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function Qs(ue,r,l,h){let p=0;for(let y=r,T=l-h;y<l;y+=h)p+=(ue[T]-ue[y])*(ue[y+1]+ue[T+1]),T=y;return p}class us{static triangulate(r,l,h=2){return Gn(r,l,h)}}class bs{static area(r){const l=r.length;let h=0;for(let p=l-1,y=0;y<l;p=y++)h+=r[p].x*r[y].y-r[y].x*r[p].y;return h*.5}static isClockWise(r){return bs.area(r)<0}static triangulateShape(r,l){const h=[],p=[],y=[];Ja(r),fa(h,r);let T=r.length;l.forEach(Ja);for(let te=0;te<l.length;te++)p.push(T),T+=l[te].length,fa(h,l[te]);const O=us.triangulate(h,p);for(let te=0;te<O.length;te+=3)y.push(O.slice(te,te+3));return y}}function Ja(ue){const r=ue.length;r>2&&ue[r-1].equals(ue[0])&&ue.pop()}function fa(ue,r){for(let l=0;l<r.length;l++)ue.push(r[l].x),ue.push(r[l].y)}class ea extends Ui{constructor(r=new mn([new qi(.5,.5),new qi(-.5,.5),new qi(-.5,-.5),new qi(.5,-.5)]),l={}){super(),this.type="ExtrudeGeometry",this.parameters={shapes:r,options:l},r=Array.isArray(r)?r:[r];const h=this,p=[],y=[];for(let O=0,te=r.length;O<te;O++){const se=r[O];T(se)}this.setAttribute("position",new ha(p,3)),this.setAttribute("uv",new ha(y,2)),this.computeVertexNormals();function T(O){const te=[],se=l.curveSegments!==void 0?l.curveSegments:12,xe=l.steps!==void 0?l.steps:1,Ne=l.depth!==void 0?l.depth:1;let Ve=l.bevelEnabled!==void 0?l.bevelEnabled:!0,We=l.bevelThickness!==void 0?l.bevelThickness:.2,tt=l.bevelSize!==void 0?l.bevelSize:We-.1,Ot=l.bevelOffset!==void 0?l.bevelOffset:0,An=l.bevelSegments!==void 0?l.bevelSegments:3;const un=l.extrudePath,Un=l.UVGenerator!==void 0?l.UVGenerator:ko;let Vn,nr=!1,ii,pi,Bi,mi;un&&(Vn=un.getSpacedPoints(xe),nr=!0,Ve=!1,ii=un.computeFrenetFrames(xe,!1),pi=new kn,Bi=new kn,mi=new kn),Ve||(An=0,We=0,tt=0,Ot=0);const ls=O.extractPoints(se);let ys=ls.shape;const Da=ls.holes;if(!bs.isClockWise(ys)){ys=ys.reverse();for(let Xs=0,ma=Da.length;Xs<ma;Xs++){const ya=Da[Xs];bs.isClockWise(ya)&&(Da[Xs]=ya.reverse())}}function Ro(Xs){const ya=10000000000000001e-36;let Za=Xs[0];for(let Ga=1;Ga<=Xs.length;Ga++){const Tl=Ga%Xs.length,Io=Xs[Tl],Qu=Io.x-Za.x,nc=Io.y-Za.y,Kc=Qu*Qu+nc*nc,nf=Math.max(Math.abs(Io.x),Math.abs(Io.y),Math.abs(Za.x),Math.abs(Za.y)),Hg=ya*nf*nf;if(Kc<=Hg){Xs.splice(Tl,1),Ga--;continue}Za=Io}}Ro(ys),Da.forEach(Ro);const du=Da.length,ru=ys;for(let Xs=0;Xs<du;Xs++){const ma=Da[Xs];ys=ys.concat(ma)}function Zc(Xs,ma,ya){return ma||Wa("ExtrudeGeometry: vec does not exist"),Xs.clone().addScaledVector(ma,ya)}const Ih=ys.length;function uA(Xs,ma,ya){let Za,Ga,Tl;const Io=Xs.x-ma.x,Qu=Xs.y-ma.y,nc=ya.x-Xs.x,Kc=ya.y-Xs.y,nf=Io*Io+Qu*Qu,Hg=Io*Kc-Qu*nc;if(Math.abs(Hg)>Number.EPSILON){const Rd=Math.sqrt(nf),qx=Math.sqrt(nc*nc+Kc*Kc),Jx=ma.x-Qu/Rd,eb=ma.y+Io/Rd,Fw=ya.x-Kc/qx,Pw=ya.y+nc/qx,vy=((Fw-Jx)*Kc-(Pw-eb)*nc)/(Io*Kc-Qu*nc);Za=Jx+Io*vy-Xs.x,Ga=eb+Qu*vy-Xs.y;const tb=Za*Za+Ga*Ga;if(tb<=2)return new qi(Za,Ga);Tl=Math.sqrt(tb/2)}else{let Rd=!1;Io>Number.EPSILON?nc>Number.EPSILON&&(Rd=!0):Io<-Number.EPSILON?nc<-Number.EPSILON&&(Rd=!0):Math.sign(Qu)===Math.sign(Kc)&&(Rd=!0),Rd?(Za=-Qu,Ga=Io,Tl=Math.sqrt(nf)):(Za=Io,Ga=Qu,Tl=Math.sqrt(nf/2))}return new qi(Za/Tl,Ga/Tl)}const Ac=[];for(let Xs=0,ma=ru.length,ya=ma-1,Za=Xs+1;Xs<ma;Xs++,ya++,Za++)ya===ma&&(ya=0),Za===ma&&(Za=0),Ac[Xs]=uA(ru[Xs],ru[ya],ru[Za]);const Uc=[];let tc,Lf=Ac.concat();for(let Xs=0,ma=du;Xs<ma;Xs++){const ya=Da[Xs];tc=[];for(let Za=0,Ga=ya.length,Tl=Ga-1,Io=Za+1;Za<Ga;Za++,Tl++,Io++)Tl===Ga&&(Tl=0),Io===Ga&&(Io=0),tc[Za]=uA(ya[Za],ya[Tl],ya[Io]);Uc.push(tc),Lf=Lf.concat(tc)}let ad;if(An===0)ad=bs.triangulateShape(ru,Da);else{const Xs=[],ma=[];for(let ya=0;ya<An;ya++){const Za=ya/An,Ga=We*Math.cos(Za*Math.PI/2),Tl=tt*Math.sin(Za*Math.PI/2)+Ot;for(let Io=0,Qu=ru.length;Io<Qu;Io++){const nc=Zc(ru[Io],Ac[Io],Tl);mp(nc.x,nc.y,-Ga),Za===0&&Xs.push(nc)}for(let Io=0,Qu=du;Io<Qu;Io++){const nc=Da[Io];tc=Uc[Io];const Kc=[];for(let nf=0,Hg=nc.length;nf<Hg;nf++){const Rd=Zc(nc[nf],tc[nf],Tl);mp(Rd.x,Rd.y,-Ga),Za===0&&Kc.push(Rd)}Za===0&&ma.push(Kc)}}ad=bs.triangulateShape(Xs,ma)}const Tm=ad.length,Gg=tt+Ot;for(let Xs=0;Xs<Ih;Xs++){const ma=Ve?Zc(ys[Xs],Lf[Xs],Gg):ys[Xs];nr?(Bi.copy(ii.normals[0]).multiplyScalar(ma.x),pi.copy(ii.binormals[0]).multiplyScalar(ma.y),mi.copy(Vn[0]).add(Bi).add(pi),mp(mi.x,mi.y,mi.z)):mp(ma.x,ma.y,0)}for(let Xs=1;Xs<=xe;Xs++)for(let ma=0;ma<Ih;ma++){const ya=Ve?Zc(ys[ma],Lf[ma],Gg):ys[ma];nr?(Bi.copy(ii.normals[Xs]).multiplyScalar(ya.x),pi.copy(ii.binormals[Xs]).multiplyScalar(ya.y),mi.copy(Vn[Xs]).add(Bi).add(pi),mp(mi.x,mi.y,mi.z)):mp(ya.x,ya.y,Ne/xe*Xs)}for(let Xs=An-1;Xs>=0;Xs--){const ma=Xs/An,ya=We*Math.cos(ma*Math.PI/2),Za=tt*Math.sin(ma*Math.PI/2)+Ot;for(let Ga=0,Tl=ru.length;Ga<Tl;Ga++){const Io=Zc(ru[Ga],Ac[Ga],Za);mp(Io.x,Io.y,Ne+ya)}for(let Ga=0,Tl=Da.length;Ga<Tl;Ga++){const Io=Da[Ga];tc=Uc[Ga];for(let Qu=0,nc=Io.length;Qu<nc;Qu++){const Kc=Zc(Io[Qu],tc[Qu],Za);nr?mp(Kc.x,Kc.y+Vn[xe-1].y,Vn[xe-1].x+ya):mp(Kc.x,Kc.y,Ne+ya)}}}Rw(),Iw();function Rw(){const Xs=p.length/3;if(Ve){let ma=0,ya=Ih*ma;for(let Za=0;Za<Tm;Za++){const Ga=ad[Za];sv(Ga[2]+ya,Ga[1]+ya,Ga[0]+ya)}ma=xe+An*2,ya=Ih*ma;for(let Za=0;Za<Tm;Za++){const Ga=ad[Za];sv(Ga[0]+ya,Ga[1]+ya,Ga[2]+ya)}}else{for(let ma=0;ma<Tm;ma++){const ya=ad[ma];sv(ya[2],ya[1],ya[0])}for(let ma=0;ma<Tm;ma++){const ya=ad[ma];sv(ya[0]+Ih*xe,ya[1]+Ih*xe,ya[2]+Ih*xe)}}h.addGroup(Xs,p.length/3-Xs,0)}function Iw(){const Xs=p.length/3;let ma=0;iv(ru,ma),ma+=ru.length;for(let ya=0,Za=Da.length;ya<Za;ya++){const Ga=Da[ya];iv(Ga,ma),ma+=Ga.length}h.addGroup(Xs,p.length/3-Xs,1)}function iv(Xs,ma){let ya=Xs.length;for(;--ya>=0;){const Za=ya;let Ga=ya-1;Ga<0&&(Ga=Xs.length-1);for(let Tl=0,Io=xe+An*2;Tl<Io;Tl++){const Qu=Ih*Tl,nc=Ih*(Tl+1),Kc=ma+Za+Qu,nf=ma+Ga+Qu,Hg=ma+Ga+nc,Rd=ma+Za+nc;Nw(Kc,nf,Hg,Rd)}}}function mp(Xs,ma,ya){te.push(Xs),te.push(ma),te.push(ya)}function sv(Xs,ma,ya){vp(Xs),vp(ma),vp(ya);const Za=p.length/3,Ga=Un.generateTopUV(h,p,Za-3,Za-2,Za-1);yp(Ga[0]),yp(Ga[1]),yp(Ga[2])}function Nw(Xs,ma,ya,Za){vp(Xs),vp(ma),vp(Za),vp(ma),vp(ya),vp(Za);const Ga=p.length/3,Tl=Un.generateSideWallUV(h,p,Ga-6,Ga-3,Ga-2,Ga-1);yp(Tl[0]),yp(Tl[1]),yp(Tl[3]),yp(Tl[1]),yp(Tl[2]),yp(Tl[3])}function vp(Xs){p.push(te[Xs*3+0]),p.push(te[Xs*3+1]),p.push(te[Xs*3+2])}function yp(Xs){y.push(Xs.x),y.push(Xs.y)}}}copy(r){return super.copy(r),this.parameters=Object.assign({},r.parameters),this}toJSON(){const r=super.toJSON(),l=this.parameters.shapes,h=this.parameters.options;return uo(l,h,r)}static fromJSON(r,l){const h=[];for(let y=0,T=r.shapes.length;y<T;y++){const O=l[r.shapes[y]];h.push(O)}const p=r.options.extrudePath;return p!==void 0&&(r.options.extrudePath=new bt[p.type]().fromJSON(p)),new ea(h,r.options)}}const ko={generateTopUV:function(ue,r,l,h,p){const y=r[l*3],T=r[l*3+1],O=r[h*3],te=r[h*3+1],se=r[p*3],xe=r[p*3+1];return[new qi(y,T),new qi(O,te),new qi(se,xe)]},generateSideWallUV:function(ue,r,l,h,p,y){const T=r[l*3],O=r[l*3+1],te=r[l*3+2],se=r[h*3],xe=r[h*3+1],Ne=r[h*3+2],Ve=r[p*3],We=r[p*3+1],tt=r[p*3+2],Ot=r[y*3],An=r[y*3+1],un=r[y*3+2];return Math.abs(O-xe)<Math.abs(T-se)?[new qi(T,1-te),new qi(se,1-Ne),new qi(Ve,1-tt),new qi(Ot,1-un)]:[new qi(O,1-te),new qi(xe,1-Ne),new qi(We,1-tt),new qi(An,1-un)]}};function uo(ue,r,l){if(l.shapes=[],Array.isArray(ue))for(let h=0,p=ue.length;h<p;h++){const y=ue[h];l.shapes.push(y.uuid)}else l.shapes.push(ue.uuid);return l.options=Object.assign({},r),r.extrudePath!==void 0&&(l.options.extrudePath=r.extrudePath.toJSON()),l}class Oa extends Cd{constructor(r=1,l=0){const h=(1+Math.sqrt(5))/2,p=[-1,h,0,1,h,0,-1,-h,0,1,-h,0,0,-1,h,0,1,h,0,-1,-h,0,1,-h,h,0,-1,h,0,1,-h,0,-1,-h,0,1],y=[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1];super(p,y,r,l),this.type="IcosahedronGeometry",this.parameters={radius:r,detail:l}}static fromJSON(r){return new Oa(r.radius,r.detail)}}class ks extends Ui{constructor(r=[new qi(0,-.5),new qi(.5,0),new qi(0,.5)],l=12,h=0,p=Math.PI*2){super(),this.type="LatheGeometry",this.parameters={points:r,segments:l,phiStart:h,phiLength:p},l=Math.floor(l),p=ki(p,0,Math.PI*2);const y=[],T=[],O=[],te=[],se=[],xe=1/l,Ne=new kn,Ve=new qi,We=new kn,tt=new kn,Ot=new kn;let An=0,un=0;for(let Un=0;Un<=r.length-1;Un++)switch(Un){case 0:An=r[Un+1].x-r[Un].x,un=r[Un+1].y-r[Un].y,We.x=un*1,We.y=-An,We.z=un*0,Ot.copy(We),We.normalize(),te.push(We.x,We.y,We.z);break;case r.length-1:te.push(Ot.x,Ot.y,Ot.z);break;default:An=r[Un+1].x-r[Un].x,un=r[Un+1].y-r[Un].y,We.x=un*1,We.y=-An,We.z=un*0,tt.copy(We),We.x+=Ot.x,We.y+=Ot.y,We.z+=Ot.z,We.normalize(),te.push(We.x,We.y,We.z),Ot.copy(tt)}for(let Un=0;Un<=l;Un++){const Vn=h+Un*xe*p,nr=Math.sin(Vn),ii=Math.cos(Vn);for(let pi=0;pi<=r.length-1;pi++){Ne.x=r[pi].x*nr,Ne.y=r[pi].y,Ne.z=r[pi].x*ii,T.push(Ne.x,Ne.y,Ne.z),Ve.x=Un/l,Ve.y=pi/(r.length-1),O.push(Ve.x,Ve.y);const Bi=te[3*pi+0]*nr,mi=te[3*pi+1],ls=te[3*pi+0]*ii;se.push(Bi,mi,ls)}}for(let Un=0;Un<l;Un++)for(let Vn=0;Vn<r.length-1;Vn++){const nr=Vn+Un*r.length,ii=nr,pi=nr+r.length,Bi=nr+r.length+1,mi=nr+1;y.push(ii,pi,mi),y.push(Bi,mi,pi)}this.setIndex(y),this.setAttribute("position",new ha(T,3)),this.setAttribute("uv",new ha(O,2)),this.setAttribute("normal",new ha(se,3))}copy(r){return super.copy(r),this.parameters=Object.assign({},r.parameters),this}static fromJSON(r){return new ks(r.points,r.segments,r.phiStart,r.phiLength)}}class So extends Cd{constructor(r=1,l=0){const h=[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],p=[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2];super(h,p,r,l),this.type="OctahedronGeometry",this.parameters={radius:r,detail:l}}static fromJSON(r){return new So(r.radius,r.detail)}}class eo extends Ui{constructor(r=1,l=1,h=1,p=1){super(),this.type="PlaneGeometry",this.parameters={width:r,height:l,widthSegments:h,heightSegments:p};const y=r/2,T=l/2,O=Math.floor(h),te=Math.floor(p),se=O+1,xe=te+1,Ne=r/O,Ve=l/te,We=[],tt=[],Ot=[],An=[];for(let un=0;un<xe;un++){const Un=un*Ve-T;for(let Vn=0;Vn<se;Vn++){const nr=Vn*Ne-y;tt.push(nr,-Un,0),Ot.push(0,0,1),An.push(Vn/O),An.push(1-un/te)}}for(let un=0;un<te;un++)for(let Un=0;Un<O;Un++){const Vn=Un+se*un,nr=Un+se*(un+1),ii=Un+1+se*(un+1),pi=Un+1+se*un;We.push(Vn,nr,pi),We.push(nr,ii,pi)}this.setIndex(We),this.setAttribute("position",new ha(tt,3)),this.setAttribute("normal",new ha(Ot,3)),this.setAttribute("uv",new ha(An,2))}copy(r){return super.copy(r),this.parameters=Object.assign({},r.parameters),this}static fromJSON(r){return new eo(r.width,r.height,r.widthSegments,r.heightSegments)}}class za extends Ui{constructor(r=.5,l=1,h=32,p=1,y=0,T=Math.PI*2){super(),this.type="RingGeometry",this.parameters={innerRadius:r,outerRadius:l,thetaSegments:h,phiSegments:p,thetaStart:y,thetaLength:T},h=Math.max(3,h),p=Math.max(1,p);const O=[],te=[],se=[],xe=[];let Ne=r;const Ve=(l-r)/p,We=new kn,tt=new qi;for(let Ot=0;Ot<=p;Ot++){for(let An=0;An<=h;An++){const un=y+An/h*T;We.x=Ne*Math.cos(un),We.y=Ne*Math.sin(un),te.push(We.x,We.y,We.z),se.push(0,0,1),tt.x=(We.x/l+1)/2,tt.y=(We.y/l+1)/2,xe.push(tt.x,tt.y)}Ne+=Ve}for(let Ot=0;Ot<p;Ot++){const An=Ot*(h+1);for(let un=0;un<h;un++){const Un=un+An,Vn=Un,nr=Un+h+1,ii=Un+h+2,pi=Un+1;O.push(Vn,nr,pi),O.push(nr,ii,pi)}}this.setIndex(O),this.setAttribute("position",new ha(te,3)),this.setAttribute("normal",new ha(se,3)),this.setAttribute("uv",new ha(xe,2))}copy(r){return super.copy(r),this.parameters=Object.assign({},r.parameters),this}static fromJSON(r){return new za(r.innerRadius,r.outerRadius,r.thetaSegments,r.phiSegments,r.thetaStart,r.thetaLength)}}class nu extends Ui{constructor(r=new mn([new qi(0,.5),new qi(-.5,-.5),new qi(.5,-.5)]),l=12){super(),this.type="ShapeGeometry",this.parameters={shapes:r,curveSegments:l};const h=[],p=[],y=[],T=[];let O=0,te=0;if(Array.isArray(r)===!1)se(r);else for(let xe=0;xe<r.length;xe++)se(r[xe]),this.addGroup(O,te,xe),O+=te,te=0;this.setIndex(h),this.setAttribute("position",new ha(p,3)),this.setAttribute("normal",new ha(y,3)),this.setAttribute("uv",new ha(T,2));function se(xe){const Ne=p.length/3,Ve=xe.extractPoints(l);let We=Ve.shape;const tt=Ve.holes;bs.isClockWise(We)===!1&&(We=We.reverse());for(let An=0,un=tt.length;An<un;An++){const Un=tt[An];bs.isClockWise(Un)===!0&&(tt[An]=Un.reverse())}const Ot=bs.triangulateShape(We,tt);for(let An=0,un=tt.length;An<un;An++){const Un=tt[An];We=We.concat(Un)}for(let An=0,un=We.length;An<un;An++){const Un=We[An];p.push(Un.x,Un.y,0),y.push(0,0,1),T.push(Un.x,Un.y)}for(let An=0,un=Ot.length;An<un;An++){const Un=Ot[An],Vn=Un[0]+Ne,nr=Un[1]+Ne,ii=Un[2]+Ne;h.push(Vn,nr,ii),te+=3}}}copy(r){return super.copy(r),this.parameters=Object.assign({},r.parameters),this}toJSON(){const r=super.toJSON(),l=this.parameters.shapes;return wu(l,r)}static fromJSON(r,l){const h=[];for(let p=0,y=r.shapes.length;p<y;p++){const T=l[r.shapes[p]];h.push(T)}return new nu(h,r.curveSegments)}}function wu(ue,r){if(r.shapes=[],Array.isArray(ue))for(let l=0,h=ue.length;l<h;l++){const p=ue[l];r.shapes.push(p.uuid)}else r.shapes.push(ue.uuid);return r}class hu extends Ui{constructor(r=1,l=32,h=16,p=0,y=Math.PI*2,T=0,O=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:r,widthSegments:l,heightSegments:h,phiStart:p,phiLength:y,thetaStart:T,thetaLength:O},l=Math.max(3,Math.floor(l)),h=Math.max(2,Math.floor(h));const te=Math.min(T+O,Math.PI);let se=0;const xe=[],Ne=new kn,Ve=new kn,We=[],tt=[],Ot=[],An=[];for(let un=0;un<=h;un++){const Un=[],Vn=un/h;let nr=0;un===0&&T===0?nr=.5/l:un===h&&te===Math.PI&&(nr=-.5/l);for(let ii=0;ii<=l;ii++){const pi=ii/l;Ne.x=-r*Math.cos(p+pi*y)*Math.sin(T+Vn*O),Ne.y=r*Math.cos(T+Vn*O),Ne.z=r*Math.sin(p+pi*y)*Math.sin(T+Vn*O),tt.push(Ne.x,Ne.y,Ne.z),Ve.copy(Ne).normalize(),Ot.push(Ve.x,Ve.y,Ve.z),An.push(pi+nr,1-Vn),Un.push(se++)}xe.push(Un)}for(let un=0;un<h;un++)for(let Un=0;Un<l;Un++){const Vn=xe[un][Un+1],nr=xe[un][Un],ii=xe[un+1][Un],pi=xe[un+1][Un+1];(un!==0||T>0)&&We.push(Vn,nr,pi),(un!==h-1||te<Math.PI)&&We.push(nr,ii,pi)}this.setIndex(We),this.setAttribute("position",new ha(tt,3)),this.setAttribute("normal",new ha(Ot,3)),this.setAttribute("uv",new ha(An,2))}copy(r){return super.copy(r),this.parameters=Object.assign({},r.parameters),this}static fromJSON(r){return new hu(r.radius,r.widthSegments,r.heightSegments,r.phiStart,r.phiLength,r.thetaStart,r.thetaLength)}}class pl extends Cd{constructor(r=1,l=0){const h=[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],p=[2,1,0,0,3,2,1,3,0,2,3,1];super(h,p,r,l),this.type="TetrahedronGeometry",this.parameters={radius:r,detail:l}}static fromJSON(r){return new pl(r.radius,r.detail)}}class Nu extends Ui{constructor(r=1,l=.4,h=12,p=48,y=Math.PI*2){super(),this.type="TorusGeometry",this.parameters={radius:r,tube:l,radialSegments:h,tubularSegments:p,arc:y},h=Math.floor(h),p=Math.floor(p);const T=[],O=[],te=[],se=[],xe=new kn,Ne=new kn,Ve=new kn;for(let We=0;We<=h;We++)for(let tt=0;tt<=p;tt++){const Ot=tt/p*y,An=We/h*Math.PI*2;Ne.x=(r+l*Math.cos(An))*Math.cos(Ot),Ne.y=(r+l*Math.cos(An))*Math.sin(Ot),Ne.z=l*Math.sin(An),O.push(Ne.x,Ne.y,Ne.z),xe.x=r*Math.cos(Ot),xe.y=r*Math.sin(Ot),Ve.subVectors(Ne,xe).normalize(),te.push(Ve.x,Ve.y,Ve.z),se.push(tt/p),se.push(We/h)}for(let We=1;We<=h;We++)for(let tt=1;tt<=p;tt++){const Ot=(p+1)*We+tt-1,An=(p+1)*(We-1)+tt-1,un=(p+1)*(We-1)+tt,Un=(p+1)*We+tt;T.push(Ot,An,Un),T.push(An,un,Un)}this.setIndex(T),this.setAttribute("position",new ha(O,3)),this.setAttribute("normal",new ha(te,3)),this.setAttribute("uv",new ha(se,2))}copy(r){return super.copy(r),this.parameters=Object.assign({},r.parameters),this}static fromJSON(r){return new Nu(r.radius,r.tube,r.radialSegments,r.tubularSegments,r.arc)}}class Qh extends Ui{constructor(r=1,l=.4,h=64,p=8,y=2,T=3){super(),this.type="TorusKnotGeometry",this.parameters={radius:r,tube:l,tubularSegments:h,radialSegments:p,p:y,q:T},h=Math.floor(h),p=Math.floor(p);const O=[],te=[],se=[],xe=[],Ne=new kn,Ve=new kn,We=new kn,tt=new kn,Ot=new kn,An=new kn,un=new kn;for(let Vn=0;Vn<=h;++Vn){const nr=Vn/h*y*Math.PI*2;Un(nr,y,T,r,We),Un(nr+.01,y,T,r,tt),An.subVectors(tt,We),un.addVectors(tt,We),Ot.crossVectors(An,un),un.crossVectors(Ot,An),Ot.normalize(),un.normalize();for(let ii=0;ii<=p;++ii){const pi=ii/p*Math.PI*2,Bi=-l*Math.cos(pi),mi=l*Math.sin(pi);Ne.x=We.x+(Bi*un.x+mi*Ot.x),Ne.y=We.y+(Bi*un.y+mi*Ot.y),Ne.z=We.z+(Bi*un.z+mi*Ot.z),te.push(Ne.x,Ne.y,Ne.z),Ve.subVectors(Ne,We).normalize(),se.push(Ve.x,Ve.y,Ve.z),xe.push(Vn/h),xe.push(ii/p)}}for(let Vn=1;Vn<=h;Vn++)for(let nr=1;nr<=p;nr++){const ii=(p+1)*(Vn-1)+(nr-1),pi=(p+1)*Vn+(nr-1),Bi=(p+1)*Vn+nr,mi=(p+1)*(Vn-1)+nr;O.push(ii,pi,mi),O.push(pi,Bi,mi)}this.setIndex(O),this.setAttribute("position",new ha(te,3)),this.setAttribute("normal",new ha(se,3)),this.setAttribute("uv",new ha(xe,2));function Un(Vn,nr,ii,pi,Bi){const mi=Math.cos(Vn),ls=Math.sin(Vn),ys=ii/nr*Vn,Da=Math.cos(ys);Bi.x=pi*(2+Da)*.5*mi,Bi.y=pi*(2+Da)*ls*.5,Bi.z=pi*Math.sin(ys)*.5}}copy(r){return super.copy(r),this.parameters=Object.assign({},r.parameters),this}static fromJSON(r){return new Qh(r.radius,r.tube,r.tubularSegments,r.radialSegments,r.p,r.q)}}class Ju extends Ui{constructor(r=new Ue(new kn(-1,-1,0),new kn(-1,1,0),new kn(1,1,0)),l=64,h=1,p=8,y=!1){super(),this.type="TubeGeometry",this.parameters={path:r,tubularSegments:l,radius:h,radialSegments:p,closed:y};const T=r.computeFrenetFrames(l,y);this.tangents=T.tangents,this.normals=T.normals,this.binormals=T.binormals;const O=new kn,te=new kn,se=new qi;let xe=new kn;const Ne=[],Ve=[],We=[],tt=[];Ot(),this.setIndex(tt),this.setAttribute("position",new ha(Ne,3)),this.setAttribute("normal",new ha(Ve,3)),this.setAttribute("uv",new ha(We,2));function Ot(){for(let Vn=0;Vn<l;Vn++)An(Vn);An(y===!1?l:0),Un(),un()}function An(Vn){xe=r.getPointAt(Vn/l,xe);const nr=T.normals[Vn],ii=T.binormals[Vn];for(let pi=0;pi<=p;pi++){const Bi=pi/p*Math.PI*2,mi=Math.sin(Bi),ls=-Math.cos(Bi);te.x=ls*nr.x+mi*ii.x,te.y=ls*nr.y+mi*ii.y,te.z=ls*nr.z+mi*ii.z,te.normalize(),Ve.push(te.x,te.y,te.z),O.x=xe.x+h*te.x,O.y=xe.y+h*te.y,O.z=xe.z+h*te.z,Ne.push(O.x,O.y,O.z)}}function un(){for(let Vn=1;Vn<=l;Vn++)for(let nr=1;nr<=p;nr++){const ii=(p+1)*(Vn-1)+(nr-1),pi=(p+1)*Vn+(nr-1),Bi=(p+1)*Vn+nr,mi=(p+1)*(Vn-1)+nr;tt.push(ii,pi,mi),tt.push(pi,Bi,mi)}}function Un(){for(let Vn=0;Vn<=l;Vn++)for(let nr=0;nr<=p;nr++)se.x=Vn/l,se.y=nr/p,We.push(se.x,se.y)}}copy(r){return super.copy(r),this.parameters=Object.assign({},r.parameters),this}toJSON(){const r=super.toJSON();return r.path=this.parameters.path.toJSON(),r}static fromJSON(r){return new Ju(new bt[r.path.type]().fromJSON(r.path),r.tubularSegments,r.radius,r.radialSegments,r.closed)}}class Tc extends Ui{constructor(r=null){if(super(),this.type="WireframeGeometry",this.parameters={geometry:r},r!==null){const l=[],h=new Set,p=new kn,y=new kn;if(r.index!==null){const T=r.attributes.position,O=r.index;let te=r.groups;te.length===0&&(te=[{start:0,count:O.count,materialIndex:0}]);for(let se=0,xe=te.length;se<xe;++se){const Ne=te[se],Ve=Ne.start,We=Ne.count;for(let tt=Ve,Ot=Ve+We;tt<Ot;tt+=3)for(let An=0;An<3;An++){const un=O.getX(tt+An),Un=O.getX(tt+(An+1)%3);p.fromBufferAttribute(T,un),y.fromBufferAttribute(T,Un),If(p,y,h)===!0&&(l.push(p.x,p.y,p.z),l.push(y.x,y.y,y.z))}}}else{const T=r.attributes.position;for(let O=0,te=T.count/3;O<te;O++)for(let se=0;se<3;se++){const xe=3*O+se,Ne=3*O+(se+1)%3;p.fromBufferAttribute(T,xe),y.fromBufferAttribute(T,Ne),If(p,y,h)===!0&&(l.push(p.x,p.y,p.z),l.push(y.x,y.y,y.z))}}this.setAttribute("position",new ha(l,3))}}copy(r){return super.copy(r),this.parameters=Object.assign({},r.parameters),this}}function If(ue,r,l){const h=`${ue.x},${ue.y},${ue.z}-${r.x},${r.y},${r.z}`,p=`${r.x},${r.y},${r.z}-${ue.x},${ue.y},${ue.z}`;return l.has(h)===!0||l.has(p)===!0?!1:(l.add(h),l.add(p),!0)}var id=Object.freeze({__proto__:null,BoxGeometry:Hd,CapsuleGeometry:gm,CircleGeometry:OA,ConeGeometry:Us,CylinderGeometry:DA,DodecahedronGeometry:iA,EdgesGeometry:hc,ExtrudeGeometry:ea,IcosahedronGeometry:Oa,LatheGeometry:ks,OctahedronGeometry:So,PlaneGeometry:eo,PolyhedronGeometry:Cd,RingGeometry:za,ShapeGeometry:nu,SphereGeometry:hu,TetrahedronGeometry:pl,TorusGeometry:Nu,TorusKnotGeometry:Qh,TubeGeometry:Ju,WireframeGeometry:Tc});class GA extends null{constructor(r){super(),this.isShadowMaterial=!0,this.type="ShadowMaterial",this.color=new Ea(0),this.transparent=!0,this.fog=!0,this.setValues(r)}copy(r){return super.copy(r),this.color.copy(r.color),this.fog=r.fog,this}}class sd extends null{constructor(r){super(r),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}}class lA extends null{constructor(r){super(),this.isMeshStandardMaterial=!0,this.type="MeshStandardMaterial",this.defines={STANDARD:""},this.color=new Ea(16777215),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Ea(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=bo,this.normalScale=new qi(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Rs,this.envMapIntensity=1,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(r)}copy(r){return super.copy(r),this.defines={STANDARD:""},this.color.copy(r.color),this.roughness=r.roughness,this.metalness=r.metalness,this.map=r.map,this.lightMap=r.lightMap,this.lightMapIntensity=r.lightMapIntensity,this.aoMap=r.aoMap,this.aoMapIntensity=r.aoMapIntensity,this.emissive.copy(r.emissive),this.emissiveMap=r.emissiveMap,this.emissiveIntensity=r.emissiveIntensity,this.bumpMap=r.bumpMap,this.bumpScale=r.bumpScale,this.normalMap=r.normalMap,this.normalMapType=r.normalMapType,this.normalScale.copy(r.normalScale),this.displacementMap=r.displacementMap,this.displacementScale=r.displacementScale,this.displacementBias=r.displacementBias,this.roughnessMap=r.roughnessMap,this.metalnessMap=r.metalnessMap,this.alphaMap=r.alphaMap,this.envMap=r.envMap,this.envMapRotation.copy(r.envMapRotation),this.envMapIntensity=r.envMapIntensity,this.wireframe=r.wireframe,this.wireframeLinewidth=r.wireframeLinewidth,this.wireframeLinecap=r.wireframeLinecap,this.wireframeLinejoin=r.wireframeLinejoin,this.flatShading=r.flatShading,this.fog=r.fog,this}}class ef extends null{constructor(r){super(),this.isMeshPhysicalMaterial=!0,this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.anisotropyRotation=0,this.anisotropyMap=null,this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new qi(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return ki(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(l){this.ior=(1+.4*l)/(1-.4*l)}}),this.iridescenceMap=null,this.iridescenceIOR=1.3,this.iridescenceThicknessRange=[100,400],this.iridescenceThicknessMap=null,this.sheenColor=new Ea(0),this.sheenColorMap=null,this.sheenRoughness=1,this.sheenRoughnessMap=null,this.transmissionMap=null,this.thickness=0,this.thicknessMap=null,this.attenuationDistance=1/0,this.attenuationColor=new Ea(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new Ea(1,1,1),this.specularColorMap=null,this._anisotropy=0,this._clearcoat=0,this._dispersion=0,this._iridescence=0,this._sheen=0,this._transmission=0,this.setValues(r)}get anisotropy(){return this._anisotropy}set anisotropy(r){this._anisotropy>0!=r>0&&this.version++,this._anisotropy=r}get clearcoat(){return this._clearcoat}set clearcoat(r){this._clearcoat>0!=r>0&&this.version++,this._clearcoat=r}get iridescence(){return this._iridescence}set iridescence(r){this._iridescence>0!=r>0&&this.version++,this._iridescence=r}get dispersion(){return this._dispersion}set dispersion(r){this._dispersion>0!=r>0&&this.version++,this._dispersion=r}get sheen(){return this._sheen}set sheen(r){this._sheen>0!=r>0&&this.version++,this._sheen=r}get transmission(){return this._transmission}set transmission(r){this._transmission>0!=r>0&&this.version++,this._transmission=r}copy(r){return super.copy(r),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy=r.anisotropy,this.anisotropyRotation=r.anisotropyRotation,this.anisotropyMap=r.anisotropyMap,this.clearcoat=r.clearcoat,this.clearcoatMap=r.clearcoatMap,this.clearcoatRoughness=r.clearcoatRoughness,this.clearcoatRoughnessMap=r.clearcoatRoughnessMap,this.clearcoatNormalMap=r.clearcoatNormalMap,this.clearcoatNormalScale.copy(r.clearcoatNormalScale),this.dispersion=r.dispersion,this.ior=r.ior,this.iridescence=r.iridescence,this.iridescenceMap=r.iridescenceMap,this.iridescenceIOR=r.iridescenceIOR,this.iridescenceThicknessRange=[...r.iridescenceThicknessRange],this.iridescenceThicknessMap=r.iridescenceThicknessMap,this.sheen=r.sheen,this.sheenColor.copy(r.sheenColor),this.sheenColorMap=r.sheenColorMap,this.sheenRoughness=r.sheenRoughness,this.sheenRoughnessMap=r.sheenRoughnessMap,this.transmission=r.transmission,this.transmissionMap=r.transmissionMap,this.thickness=r.thickness,this.thicknessMap=r.thicknessMap,this.attenuationDistance=r.attenuationDistance,this.attenuationColor.copy(r.attenuationColor),this.specularIntensity=r.specularIntensity,this.specularIntensityMap=r.specularIntensityMap,this.specularColor.copy(r.specularColor),this.specularColorMap=r.specularColorMap,this}}class Nf extends ku{constructor(r){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new Ea(16777215),this.specular=new Ea(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Ea(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=bo,this.normalScale=new qi(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Rs,this.combine=on,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(r)}copy(r){return super.copy(r),this.color.copy(r.color),this.specular.copy(r.specular),this.shininess=r.shininess,this.map=r.map,this.lightMap=r.lightMap,this.lightMapIntensity=r.lightMapIntensity,this.aoMap=r.aoMap,this.aoMapIntensity=r.aoMapIntensity,this.emissive.copy(r.emissive),this.emissiveMap=r.emissiveMap,this.emissiveIntensity=r.emissiveIntensity,this.bumpMap=r.bumpMap,this.bumpScale=r.bumpScale,this.normalMap=r.normalMap,this.normalMapType=r.normalMapType,this.normalScale.copy(r.normalScale),this.displacementMap=r.displacementMap,this.displacementScale=r.displacementScale,this.displacementBias=r.displacementBias,this.specularMap=r.specularMap,this.alphaMap=r.alphaMap,this.envMap=r.envMap,this.envMapRotation.copy(r.envMapRotation),this.combine=r.combine,this.reflectivity=r.reflectivity,this.refractionRatio=r.refractionRatio,this.wireframe=r.wireframe,this.wireframeLinewidth=r.wireframeLinewidth,this.wireframeLinecap=r.wireframeLinecap,this.wireframeLinejoin=r.wireframeLinejoin,this.flatShading=r.flatShading,this.fog=r.fog,this}}class Td extends null{constructor(r){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new Ea(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Ea(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=bo,this.normalScale=new qi(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(r)}copy(r){return super.copy(r),this.color.copy(r.color),this.map=r.map,this.gradientMap=r.gradientMap,this.lightMap=r.lightMap,this.lightMapIntensity=r.lightMapIntensity,this.aoMap=r.aoMap,this.aoMapIntensity=r.aoMapIntensity,this.emissive.copy(r.emissive),this.emissiveMap=r.emissiveMap,this.emissiveIntensity=r.emissiveIntensity,this.bumpMap=r.bumpMap,this.bumpScale=r.bumpScale,this.normalMap=r.normalMap,this.normalMapType=r.normalMapType,this.normalScale.copy(r.normalScale),this.displacementMap=r.displacementMap,this.displacementScale=r.displacementScale,this.displacementBias=r.displacementBias,this.alphaMap=r.alphaMap,this.wireframe=r.wireframe,this.wireframeLinewidth=r.wireframeLinewidth,this.wireframeLinecap=r.wireframeLinecap,this.wireframeLinejoin=r.wireframeLinejoin,this.fog=r.fog,this}}class Gp extends null{constructor(r){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=bo,this.normalScale=new qi(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.setValues(r)}copy(r){return super.copy(r),this.bumpMap=r.bumpMap,this.bumpScale=r.bumpScale,this.normalMap=r.normalMap,this.normalMapType=r.normalMapType,this.normalScale.copy(r.normalScale),this.displacementMap=r.displacementMap,this.displacementScale=r.displacementScale,this.displacementBias=r.displacementBias,this.wireframe=r.wireframe,this.wireframeLinewidth=r.wireframeLinewidth,this.flatShading=r.flatShading,this}}class Hp extends null{constructor(r){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new Ea(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Ea(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=bo,this.normalScale=new qi(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Rs,this.combine=on,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(r)}copy(r){return super.copy(r),this.color.copy(r.color),this.map=r.map,this.lightMap=r.lightMap,this.lightMapIntensity=r.lightMapIntensity,this.aoMap=r.aoMap,this.aoMapIntensity=r.aoMapIntensity,this.emissive.copy(r.emissive),this.emissiveMap=r.emissiveMap,this.emissiveIntensity=r.emissiveIntensity,this.bumpMap=r.bumpMap,this.bumpScale=r.bumpScale,this.normalMap=r.normalMap,this.normalMapType=r.normalMapType,this.normalScale.copy(r.normalScale),this.displacementMap=r.displacementMap,this.displacementScale=r.displacementScale,this.displacementBias=r.displacementBias,this.specularMap=r.specularMap,this.alphaMap=r.alphaMap,this.envMap=r.envMap,this.envMapRotation.copy(r.envMapRotation),this.combine=r.combine,this.reflectivity=r.reflectivity,this.refractionRatio=r.refractionRatio,this.wireframe=r.wireframe,this.wireframeLinewidth=r.wireframeLinewidth,this.wireframeLinecap=r.wireframeLinecap,this.wireframeLinejoin=r.wireframeLinejoin,this.flatShading=r.flatShading,this.fog=r.fog,this}}class Ex extends null{constructor(r){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=$a,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(r)}copy(r){return super.copy(r),this.depthPacking=r.depthPacking,this.map=r.map,this.alphaMap=r.alphaMap,this.displacementMap=r.displacementMap,this.displacementScale=r.displacementScale,this.displacementBias=r.displacementBias,this.wireframe=r.wireframe,this.wireframeLinewidth=r.wireframeLinewidth,this}}class Cx extends null{constructor(r){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(r)}copy(r){return super.copy(r),this.map=r.map,this.alphaMap=r.alphaMap,this.displacementMap=r.displacementMap,this.displacementScale=r.displacementScale,this.displacementBias=r.displacementBias,this}}class Tx extends null{constructor(r){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new Ea(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=bo,this.normalScale=new qi(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.fog=!0,this.setValues(r)}copy(r){return super.copy(r),this.defines={MATCAP:""},this.color.copy(r.color),this.matcap=r.matcap,this.map=r.map,this.bumpMap=r.bumpMap,this.bumpScale=r.bumpScale,this.normalMap=r.normalMap,this.normalMapType=r.normalMapType,this.normalScale.copy(r.normalScale),this.displacementMap=r.displacementMap,this.displacementScale=r.displacementScale,this.displacementBias=r.displacementBias,this.alphaMap=r.alphaMap,this.wireframe=r.wireframe,this.wireframeLinewidth=r.wireframeLinewidth,this.flatShading=r.flatShading,this.fog=r.fog,this}}class $v extends null{constructor(r){super(),this.isLineDashedMaterial=!0,this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(r)}copy(r){return super.copy(r),this.scale=r.scale,this.dashSize=r.dashSize,this.gapSize=r.gapSize,this}}function Qp(ue,r){return!ue||ue.constructor===r?ue:typeof r.BYTES_PER_ELEMENT=="number"?new r(ue):Array.prototype.slice.call(ue)}function Xv(ue){return ArrayBuffer.isView(ue)&&!(ue instanceof DataView)}function jv(ue){function r(p,y){return ue[p]-ue[y]}const l=ue.length,h=new Array(l);for(let p=0;p!==l;++p)h[p]=p;return h.sort(r),h}function V0(ue,r,l){const h=ue.length,p=new ue.constructor(h);for(let y=0,T=0;T!==h;++y){const O=l[y]*r;for(let te=0;te!==r;++te)p[T++]=ue[O+te]}return p}function qm(ue,r,l,h){let p=1,y=ue[0];for(;y!==void 0&&y[h]===void 0;)y=ue[p++];if(y===void 0)return;let T=y[h];if(T!==void 0)if(Array.isArray(T))do T=y[h],T!==void 0&&(r.push(y.time),l.push(...T)),y=ue[p++];while(y!==void 0);else if(T.toArray!==void 0)do T=y[h],T!==void 0&&(r.push(y.time),T.toArray(l,l.length)),y=ue[p++];while(y!==void 0);else do T=y[h],T!==void 0&&(r.push(y.time),l.push(T)),y=ue[p++];while(y!==void 0)}function Bx(ue,r,l,h,p=30){const y=ue.clone();y.name=r;const T=[];for(let te=0;te<y.tracks.length;++te){const se=y.tracks[te],xe=se.getValueSize(),Ne=[],Ve=[];for(let We=0;We<se.times.length;++We){const tt=se.times[We]*p;if(!(tt<l||tt>=h)){Ne.push(se.times[We]);for(let Ot=0;Ot<xe;++Ot)Ve.push(se.values[We*xe+Ot])}}Ne.length!==0&&(se.times=Qp(Ne,se.times.constructor),se.values=Qp(Ve,se.values.constructor),T.push(se))}y.tracks=T;let O=1/0;for(let te=0;te<y.tracks.length;++te)O>y.tracks[te].times[0]&&(O=y.tracks[te].times[0]);for(let te=0;te<y.tracks.length;++te)y.tracks[te].shift(-1*O);return y.resetDuration(),y}function Rx(ue,r=0,l=ue,h=30){h<=0&&(h=30);const p=l.tracks.length,y=r/h;for(let T=0;T<p;++T){const O=l.tracks[T],te=O.ValueTypeName;if(te==="bool"||te==="string")continue;const se=ue.tracks.find(function(un){return un.name===O.name&&un.ValueTypeName===te});if(se===void 0)continue;let xe=0;const Ne=O.getValueSize();O.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(xe=Ne/3);let Ve=0;const We=se.getValueSize();se.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(Ve=We/3);const tt=O.times.length-1;let Ot;if(y<=O.times[0]){const un=xe,Un=Ne-xe;Ot=O.values.slice(un,Un)}else if(y>=O.times[tt]){const un=tt*Ne+xe,Un=un+Ne-xe;Ot=O.values.slice(un,Un)}else{const un=O.createInterpolant(),Un=xe,Vn=Ne-xe;un.evaluate(y),Ot=un.resultBuffer.slice(Un,Vn)}te==="quaternion"&&new Du().fromArray(Ot).normalize().conjugate().toArray(Ot);const An=se.times.length;for(let un=0;un<An;++un){const Un=un*We+Ve;if(te==="quaternion")Du.multiplyQuaternionsFlat(se.values,Un,Ot,0,se.values,Un);else{const Vn=We-Ve*2;for(let nr=0;nr<Vn;++nr)se.values[Un+nr]-=Ot[nr]}}}return ue.blendMode=Aa,ue}class nw{static convertArray(r,l){return Qp(r,l)}static isTypedArray(r){return Xv(r)}static getKeyframeOrder(r){return jv(r)}static sortedArray(r,l,h){return V0(r,l,h)}static flattenJSON(r,l,h,p){qm(r,l,h,p)}static subclip(r,l,h,p,y=30){return Bx(r,l,h,p,y)}static makeClipAdditive(r,l=0,h=r,p=30){return Rx(r,l,h,p)}}class xm{constructor(r,l,h,p){this.parameterPositions=r,this._cachedIndex=0,this.resultBuffer=p!==void 0?p:new l.constructor(h),this.sampleValues=l,this.valueSize=h,this.settings=null,this.DefaultSettings_={}}evaluate(r){const l=this.parameterPositions;let h=this._cachedIndex,p=l[h],y=l[h-1];e:{t:{let T;n:{r:if(!(r<p)){for(let O=h+2;;){if(p===void 0){if(r<y)break r;return h=l.length,this._cachedIndex=h,this.copySampleValue_(h-1)}if(h===O)break;if(y=p,p=l[++h],r<p)break t}T=l.length;break n}if(!(r>=y)){const O=l[1];r<O&&(h=2,y=O);for(let te=h-2;;){if(y===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(h===te)break;if(p=y,y=l[--h-1],r>=y)break t}T=h,h=0;break n}break e}for(;h<T;){const O=h+T>>>1;r<l[O]?T=O:h=O+1}if(p=l[h],y=l[h-1],y===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(p===void 0)return h=l.length,this._cachedIndex=h,this.copySampleValue_(h-1)}this._cachedIndex=h,this.intervalChanged_(h,y,p)}return this.interpolate_(h,y,r,p)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(r){const l=this.resultBuffer,h=this.sampleValues,p=this.valueSize,y=r*p;for(let T=0;T!==p;++T)l[T]=h[y+T];return l}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}}class Bg extends xm{constructor(r,l,h,p){super(r,l,h,p),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:Di,endingEnd:Di}}intervalChanged_(r,l,h){const p=this.parameterPositions;let y=r-2,T=r+1,O=p[y],te=p[T];if(O===void 0)switch(this.getSettings_().endingStart){case ss:y=r,O=2*l-h;break;case vs:y=p.length-2,O=l+p[y]-p[y+1];break;default:y=r,O=h}if(te===void 0)switch(this.getSettings_().endingEnd){case ss:T=r,te=2*h-l;break;case vs:T=1,te=h+p[1]-p[0];break;default:T=r-1,te=l}const se=(h-l)*.5,xe=this.valueSize;this._weightPrev=se/(l-O),this._weightNext=se/(te-h),this._offsetPrev=y*xe,this._offsetNext=T*xe}interpolate_(r,l,h,p){const y=this.resultBuffer,T=this.sampleValues,O=this.valueSize,te=r*O,se=te-O,xe=this._offsetPrev,Ne=this._offsetNext,Ve=this._weightPrev,We=this._weightNext,tt=(h-l)/(p-l),Ot=tt*tt,An=Ot*tt,un=-Ve*An+2*Ve*Ot-Ve*tt,Un=(1+Ve)*An+(-1.5-2*Ve)*Ot+(-.5+Ve)*tt+1,Vn=(-1-We)*An+(1.5+We)*Ot+.5*tt,nr=We*An-We*Ot;for(let ii=0;ii!==O;++ii)y[ii]=un*T[xe+ii]+Un*T[se+ii]+Vn*T[te+ii]+nr*T[Ne+ii];return y}}class Yv extends xm{constructor(r,l,h,p){super(r,l,h,p)}interpolate_(r,l,h,p){const y=this.resultBuffer,T=this.sampleValues,O=this.valueSize,te=r*O,se=te-O,xe=(h-l)/(p-l),Ne=1-xe;for(let Ve=0;Ve!==O;++Ve)y[Ve]=T[se+Ve]*Ne+T[te+Ve]*xe;return y}}class qv extends xm{constructor(r,l,h,p){super(r,l,h,p)}interpolate_(r){return this.copySampleValue_(r-1)}}class tf{constructor(r,l,h,p){if(r===void 0)throw new Error("THREE.KeyframeTrack: track name is undefined");if(l===void 0||l.length===0)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+r);this.name=r,this.times=Qp(l,this.TimeBufferType),this.values=Qp(h,this.ValueBufferType),this.setInterpolation(p||this.DefaultInterpolation)}static toJSON(r){const l=r.constructor;let h;if(l.toJSON!==this.toJSON)h=l.toJSON(r);else{h={name:r.name,times:Qp(r.times,Array),values:Qp(r.values,Array)};const p=r.getInterpolation();p!==r.DefaultInterpolation&&(h.interpolation=p)}return h.type=r.ValueTypeName,h}InterpolantFactoryMethodDiscrete(r){return new qv(this.times,this.values,this.getValueSize(),r)}InterpolantFactoryMethodLinear(r){return new Yv(this.times,this.values,this.getValueSize(),r)}InterpolantFactoryMethodSmooth(r){return new Bg(this.times,this.values,this.getValueSize(),r)}setInterpolation(r){let l;switch(r){case Rr:l=this.InterpolantFactoryMethodDiscrete;break;case $r:l=this.InterpolantFactoryMethodLinear;break;case Ii:l=this.InterpolantFactoryMethodSmooth;break}if(l===void 0){const h="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(this.createInterpolant===void 0)if(r!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw new Error(h);return na("KeyframeTrack:",h),this}return this.createInterpolant=l,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return Rr;case this.InterpolantFactoryMethodLinear:return $r;case this.InterpolantFactoryMethodSmooth:return Ii}}getValueSize(){return this.values.length/this.times.length}shift(r){if(r!==0){const l=this.times;for(let h=0,p=l.length;h!==p;++h)l[h]+=r}return this}scale(r){if(r!==1){const l=this.times;for(let h=0,p=l.length;h!==p;++h)l[h]*=r}return this}trim(r,l){const h=this.times,p=h.length;let y=0,T=p-1;for(;y!==p&&h[y]<r;)++y;for(;T!==-1&&h[T]>l;)--T;if(++T,y!==0||T!==p){y>=T&&(T=Math.max(T,1),y=T-1);const O=this.getValueSize();this.times=h.slice(y,T),this.values=this.values.slice(y*O,T*O)}return this}validate(){let r=!0;const l=this.getValueSize();l-Math.floor(l)!==0&&(Wa("KeyframeTrack: Invalid value size in track.",this),r=!1);const h=this.times,p=this.values,y=h.length;y===0&&(Wa("KeyframeTrack: Track is empty.",this),r=!1);let T=null;for(let O=0;O!==y;O++){const te=h[O];if(typeof te=="number"&&isNaN(te)){Wa("KeyframeTrack: Time is not a valid number.",this,O,te),r=!1;break}if(T!==null&&T>te){Wa("KeyframeTrack: Out of order keys.",this,O,te,T),r=!1;break}T=te}if(p!==void 0&&Xv(p))for(let O=0,te=p.length;O!==te;++O){const se=p[O];if(isNaN(se)){Wa("KeyframeTrack: Value is not a valid number.",this,O,se),r=!1;break}}return r}optimize(){const r=this.times.slice(),l=this.values.slice(),h=this.getValueSize(),p=this.getInterpolation()===Ii,y=r.length-1;let T=1;for(let O=1;O<y;++O){let te=!1;const se=r[O],xe=r[O+1];if(se!==xe&&(O!==1||se!==r[0]))if(p)te=!0;else{const Ne=O*h,Ve=Ne-h,We=Ne+h;for(let tt=0;tt!==h;++tt){const Ot=l[Ne+tt];if(Ot!==l[Ve+tt]||Ot!==l[We+tt]){te=!0;break}}}if(te){if(O!==T){r[T]=r[O];const Ne=O*h,Ve=T*h;for(let We=0;We!==h;++We)l[Ve+We]=l[Ne+We]}++T}}if(y>0){r[T]=r[y];for(let O=y*h,te=T*h,se=0;se!==h;++se)l[te+se]=l[O+se];++T}return T!==r.length?(this.times=r.slice(0,T),this.values=l.slice(0,T*h)):(this.times=r,this.values=l),this}clone(){const r=this.times.slice(),l=this.values.slice(),h=this.constructor,p=new h(this.name,r,l);return p.createInterpolant=this.createInterpolant,p}}tf.prototype.ValueTypeName="",tf.prototype.TimeBufferType=Float32Array,tf.prototype.ValueBufferType=Float32Array,tf.prototype.DefaultInterpolation=$r;class bm extends tf{constructor(r,l,h){super(r,l,h)}}bm.prototype.ValueTypeName="bool",bm.prototype.ValueBufferType=Array,bm.prototype.DefaultInterpolation=Rr,bm.prototype.InterpolantFactoryMethodLinear=void 0,bm.prototype.InterpolantFactoryMethodSmooth=void 0;class Ix extends tf{constructor(r,l,h,p){super(r,l,h,p)}}Ix.prototype.ValueTypeName="color";class Jv extends tf{constructor(r,l,h,p){super(r,l,h,p)}}Jv.prototype.ValueTypeName="number";class z0 extends xm{constructor(r,l,h,p){super(r,l,h,p)}interpolate_(r,l,h,p){const y=this.resultBuffer,T=this.sampleValues,O=this.valueSize,te=(h-l)/(p-l);let se=r*O;for(let xe=se+O;se!==xe;se+=4)Du.slerpFlat(y,0,T,se-O,T,se,te);return y}}class G0 extends tf{constructor(r,l,h,p){super(r,l,h,p)}InterpolantFactoryMethodLinear(r){return new z0(this.times,this.values,this.getValueSize(),r)}}G0.prototype.ValueTypeName="quaternion",G0.prototype.InterpolantFactoryMethodSmooth=void 0;class Rg extends tf{constructor(r,l,h){super(r,l,h)}}Rg.prototype.ValueTypeName="string",Rg.prototype.ValueBufferType=Array,Rg.prototype.DefaultInterpolation=Rr,Rg.prototype.InterpolantFactoryMethodLinear=void 0,Rg.prototype.InterpolantFactoryMethodSmooth=void 0;class H0 extends tf{constructor(r,l,h,p){super(r,l,h,p)}}H0.prototype.ValueTypeName="vector";class Bd{constructor(r="",l=-1,h=[],p=Cs){this.name=r,this.tracks=h,this.duration=l,this.blendMode=p,this.uuid=Gr(),this.userData={},this.duration<0&&this.resetDuration()}static parse(r){const l=[],h=r.tracks,p=1/(r.fps||1);for(let T=0,O=h.length;T!==O;++T)l.push(Nx(h[T]).scale(p));const y=new this(r.name,r.duration,l,r.blendMode);return y.uuid=r.uuid,y.userData=JSON.parse(r.userData||"{}"),y}static toJSON(r){const l=[],h=r.tracks,p={name:r.name,duration:r.duration,tracks:l,uuid:r.uuid,blendMode:r.blendMode,userData:JSON.stringify(r.userData)};for(let y=0,T=h.length;y!==T;++y)l.push(tf.toJSON(h[y]));return p}static CreateFromMorphTargetSequence(r,l,h,p){const y=l.length,T=[];for(let O=0;O<y;O++){let te=[],se=[];te.push((O+y-1)%y,O,(O+1)%y),se.push(0,1,0);const xe=jv(te);te=V0(te,1,xe),se=V0(se,1,xe),!p&&te[0]===0&&(te.push(y),se.push(se[0])),T.push(new Jv(".morphTargetInfluences["+l[O].name+"]",te,se).scale(1/h))}return new this(r,-1,T)}static findByName(r,l){let h=r;if(!Array.isArray(r)){const p=r;h=p.geometry&&p.geometry.animations||p.animations}for(let p=0;p<h.length;p++)if(h[p].name===l)return h[p];return null}static CreateClipsFromMorphTargetSequences(r,l,h){const p={},y=/^([\w-]*?)([\d]+)$/;for(let O=0,te=r.length;O<te;O++){const se=r[O],xe=se.name.match(y);if(xe&&xe.length>1){const Ne=xe[1];let Ve=p[Ne];Ve||(p[Ne]=Ve=[]),Ve.push(se)}}const T=[];for(const O in p)T.push(this.CreateFromMorphTargetSequence(O,p[O],l,h));return T}static parseAnimation(r,l){if(na("AnimationClip: parseAnimation() is deprecated and will be removed with r185"),!r)return Wa("AnimationClip: No animation in JSONLoader data."),null;const h=function(Ne,Ve,We,tt,Ot){if(We.length!==0){const An=[],un=[];qm(We,An,un,tt),An.length!==0&&Ot.push(new Ne(Ve,An,un))}},p=[],y=r.name||"default",T=r.fps||30,O=r.blendMode;let te=r.length||-1;const se=r.hierarchy||[];for(let Ne=0;Ne<se.length;Ne++){const Ve=se[Ne].keys;if(!(!Ve||Ve.length===0))if(Ve[0].morphTargets){const We={};let tt;for(tt=0;tt<Ve.length;tt++)if(Ve[tt].morphTargets)for(let Ot=0;Ot<Ve[tt].morphTargets.length;Ot++)We[Ve[tt].morphTargets[Ot]]=-1;for(const Ot in We){const An=[],un=[];for(let Un=0;Un!==Ve[tt].morphTargets.length;++Un){const Vn=Ve[tt];An.push(Vn.time),un.push(Vn.morphTarget===Ot?1:0)}p.push(new Jv(".morphTargetInfluence["+Ot+"]",An,un))}te=We.length*T}else{const We=".bones["+l[Ne].name+"]";h(H0,We+".position",Ve,"pos",p),h(G0,We+".quaternion",Ve,"rot",p),h(H0,We+".scale",Ve,"scl",p)}}return p.length===0?null:new this(y,te,p,O)}resetDuration(){const r=this.tracks;let l=0;for(let h=0,p=r.length;h!==p;++h){const y=this.tracks[h];l=Math.max(l,y.times[y.times.length-1])}return this.duration=l,this}trim(){for(let r=0;r<this.tracks.length;r++)this.tracks[r].trim(0,this.duration);return this}validate(){let r=!0;for(let l=0;l<this.tracks.length;l++)r=r&&this.tracks[l].validate();return r}optimize(){for(let r=0;r<this.tracks.length;r++)this.tracks[r].optimize();return this}clone(){const r=[];for(let h=0;h<this.tracks.length;h++)r.push(this.tracks[h].clone());const l=new this.constructor(this.name,this.duration,r,this.blendMode);return l.userData=JSON.parse(JSON.stringify(this.userData)),l}toJSON(){return this.constructor.toJSON(this)}}function _m(ue){switch(ue.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return Jv;case"vector":case"vector2":case"vector3":case"vector4":return H0;case"color":return Ix;case"quaternion":return G0;case"bool":case"boolean":return bm;case"string":return Rg}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+ue)}function Nx(ue){if(ue.type===void 0)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");const r=_m(ue.type);if(ue.times===void 0){const l=[],h=[];qm(ue.keys,l,h,"value"),ue.times=l,ue.values=h}return r.parse!==void 0?r.parse(ue):new r(ue.name,ue.times,ue.values,ue.interpolation)}const Ff={enabled:!1,files:{},add:function(ue,r){this.enabled!==!1&&(this.files[ue]=r)},get:function(ue){if(this.enabled!==!1)return this.files[ue]},remove:function(ue){delete this.files[ue]},clear:function(){this.files={}}};class Fx{constructor(r,l,h){const p=this;let y=!1,T=0,O=0,te;const se=[];this.onStart=void 0,this.onLoad=r,this.onProgress=l,this.onError=h,this._abortController=null,this.itemStart=function(xe){O++,y===!1&&p.onStart!==void 0&&p.onStart(xe,T,O),y=!0},this.itemEnd=function(xe){T++,p.onProgress!==void 0&&p.onProgress(xe,T,O),T===O&&(y=!1,p.onLoad!==void 0&&p.onLoad())},this.itemError=function(xe){p.onError!==void 0&&p.onError(xe)},this.resolveURL=function(xe){return te?te(xe):xe},this.setURLModifier=function(xe){return te=xe,this},this.addHandler=function(xe,Ne){return se.push(xe,Ne),this},this.removeHandler=function(xe){const Ne=se.indexOf(xe);return Ne!==-1&&se.splice(Ne,2),this},this.getHandler=function(xe){for(let Ne=0,Ve=se.length;Ne<Ve;Ne+=2){const We=se[Ne],tt=se[Ne+1];if(We.global&&(We.lastIndex=0),We.test(xe))return tt}return null},this.abort=function(){return this.abortController.abort(),this._abortController=null,this}}get abortController(){return this._abortController||(this._abortController=new AbortController),this._abortController}}const Q0=new Fx;class wm{constructor(r){this.manager=r!==void 0?r:Q0,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(r,l){const h=this;return new Promise(function(p,y){h.load(r,p,l,y)})}parse(){}setCrossOrigin(r){return this.crossOrigin=r,this}setWithCredentials(r){return this.withCredentials=r,this}setPath(r){return this.path=r,this}setResourcePath(r){return this.resourcePath=r,this}setRequestHeader(r){return this.requestHeader=r,this}abort(){return this}}wm.DEFAULT_MATERIAL_NAME="__DEFAULT";const Pf={};class W0 extends null{constructor(r,l){super(r),this.response=l}}class Wp extends null{constructor(r){super(r),this.mimeType="",this.responseType="",this._abortController=new AbortController}load(r,l,h,p){r===void 0&&(r=""),this.path!==void 0&&(r=this.path+r),r=this.manager.resolveURL(r);const y=Ff.get(`file:${r}`);if(y!==void 0)return this.manager.itemStart(r),setTimeout(()=>{l&&l(y),this.manager.itemEnd(r)},0),y;if(Pf[r]!==void 0){Pf[r].push({onLoad:l,onProgress:h,onError:p});return}Pf[r]=[],Pf[r].push({onLoad:l,onProgress:h,onError:p});const T=new Request(r,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin",signal:typeof AbortSignal.any=="function"?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal}),O=this.mimeType,te=this.responseType;fetch(T).then(se=>{if(se.status===200||se.status===0){if(se.status===0&&na("FileLoader: HTTP Status 0 received."),typeof ReadableStream=="undefined"||se.body===void 0||se.body.getReader===void 0)return se;const xe=Pf[r],Ne=se.body.getReader(),Ve=se.headers.get("X-File-Size")||se.headers.get("Content-Length"),We=Ve?parseInt(Ve):0,tt=We!==0;let Ot=0;const An=new ReadableStream({start(un){Un();function Un(){Ne.read().then(({done:Vn,value:nr})=>{if(Vn)un.close();else{Ot+=nr.byteLength;const ii=new ProgressEvent("progress",{lengthComputable:tt,loaded:Ot,total:We});for(let pi=0,Bi=xe.length;pi<Bi;pi++){const mi=xe[pi];mi.onProgress&&mi.onProgress(ii)}un.enqueue(nr),Un()}},Vn=>{un.error(Vn)})}}});return new Response(An)}else throw new W0(`fetch for "${se.url}" responded with ${se.status}: ${se.statusText}`,se)}).then(se=>{switch(te){case"arraybuffer":return se.arrayBuffer();case"blob":return se.blob();case"document":return se.text().then(xe=>new DOMParser().parseFromString(xe,O));case"json":return se.json();default:if(O==="")return se.text();{const Ne=/charset="?([^;"\s]*)"?/i.exec(O),Ve=Ne&&Ne[1]?Ne[1].toLowerCase():void 0,We=new TextDecoder(Ve);return se.arrayBuffer().then(tt=>We.decode(tt))}}}).then(se=>{Ff.add(`file:${r}`,se);const xe=Pf[r];delete Pf[r];for(let Ne=0,Ve=xe.length;Ne<Ve;Ne++){const We=xe[Ne];We.onLoad&&We.onLoad(se)}}).catch(se=>{const xe=Pf[r];if(xe===void 0)throw this.manager.itemError(r),se;delete Pf[r];for(let Ne=0,Ve=xe.length;Ne<Ve;Ne++){const We=xe[Ne];We.onError&&We.onError(se)}this.manager.itemError(r)}).finally(()=>{this.manager.itemEnd(r)}),this.manager.itemStart(r)}setResponseType(r){return this.responseType=r,this}setMimeType(r){return this.mimeType=r,this}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}}class PE extends null{constructor(r){super(r)}load(r,l,h,p){const y=this,T=new Wp(this.manager);T.setPath(this.path),T.setRequestHeader(this.requestHeader),T.setWithCredentials(this.withCredentials),T.load(r,function(O){try{l(y.parse(JSON.parse(O)))}catch(te){p?p(te):Wa(te),y.manager.itemError(r)}},h,p)}parse(r){const l=[];for(let h=0;h<r.length;h++){const p=Bd.parse(r[h]);l.push(p)}return l}}class Zp extends null{constructor(r){super(r)}load(r,l,h,p){const y=this,T=[],O=new rd,te=new Wp(this.manager);te.setPath(this.path),te.setResponseType("arraybuffer"),te.setRequestHeader(this.requestHeader),te.setWithCredentials(y.withCredentials);let se=0;function xe(Ne){te.load(r[Ne],function(Ve){const We=y.parse(Ve,!0);T[Ne]={width:We.width,height:We.height,format:We.format,mipmaps:We.mipmaps},se+=1,se===6&&(We.mipmapCount===1&&(O.minFilter=vr),O.image=T,O.format=We.format,O.needsUpdate=!0,l&&l(O))},h,p)}if(Array.isArray(r))for(let Ne=0,Ve=r.length;Ne<Ve;++Ne)xe(Ne);else te.load(r,function(Ne){const Ve=y.parse(Ne,!0);if(Ve.isCubemap){const We=Ve.mipmaps.length/Ve.mipmapCount;for(let tt=0;tt<We;tt++){T[tt]={mipmaps:[]};for(let Ot=0;Ot<Ve.mipmapCount;Ot++)T[tt].mipmaps.push(Ve.mipmaps[tt*Ve.mipmapCount+Ot]),T[tt].format=Ve.format,T[tt].width=Ve.width,T[tt].height=Ve.height}O.image=T}else O.image.width=Ve.width,O.image.height=Ve.height,O.mipmaps=Ve.mipmaps;Ve.mipmapCount===1&&(O.minFilter=vr),O.format=Ve.format,O.needsUpdate=!0,l&&l(O)},h,p);return O}}const Ig=new WeakMap;class Z0 extends null{constructor(r){super(r)}load(r,l,h,p){this.path!==void 0&&(r=this.path+r),r=this.manager.resolveURL(r);const y=this,T=Ff.get(`image:${r}`);if(T!==void 0){if(T.complete===!0)y.manager.itemStart(r),setTimeout(function(){l&&l(T),y.manager.itemEnd(r)},0);else{let Ne=Ig.get(T);Ne===void 0&&(Ne=[],Ig.set(T,Ne)),Ne.push({onLoad:l,onError:p})}return T}const O=To("img");function te(){xe(),l&&l(this);const Ne=Ig.get(this)||[];for(let Ve=0;Ve<Ne.length;Ve++){const We=Ne[Ve];We.onLoad&&We.onLoad(this)}Ig.delete(this),y.manager.itemEnd(r)}function se(Ne){xe(),p&&p(Ne),Ff.remove(`image:${r}`);const Ve=Ig.get(this)||[];for(let We=0;We<Ve.length;We++){const tt=Ve[We];tt.onError&&tt.onError(Ne)}Ig.delete(this),y.manager.itemError(r),y.manager.itemEnd(r)}function xe(){O.removeEventListener("load",te,!1),O.removeEventListener("error",se,!1)}return O.addEventListener("load",te,!1),O.addEventListener("error",se,!1),r.slice(0,5)!=="data:"&&this.crossOrigin!==void 0&&(O.crossOrigin=this.crossOrigin),Ff.add(`image:${r}`,O),y.manager.itemStart(r),O.src=r,O}}class Px extends null{constructor(r){super(r)}load(r,l,h,p){const y=new Qd;y.colorSpace=go;const T=new Z0(this.manager);T.setCrossOrigin(this.crossOrigin),T.setPath(this.path);let O=0;function te(se){T.load(r[se],function(xe){y.images[se]=xe,O++,O===6&&(y.needsUpdate=!0,l&&l(y))},void 0,p)}for(let se=0;se<r.length;++se)te(se);return y}}class Kp extends null{constructor(r){super(r)}load(r,l,h,p){const y=this,T=new Md,O=new Wp(this.manager);return O.setResponseType("arraybuffer"),O.setRequestHeader(this.requestHeader),O.setPath(this.path),O.setWithCredentials(y.withCredentials),O.load(r,function(te){let se;try{se=y.parse(te)}catch(xe){if(p!==void 0)p(xe);else{xe(xe);return}}se.image!==void 0?T.image=se.image:se.data!==void 0&&(T.image.width=se.width,T.image.height=se.height,T.image.data=se.data),T.wrapS=se.wrapS!==void 0?se.wrapS:Vt,T.wrapT=se.wrapT!==void 0?se.wrapT:Vt,T.magFilter=se.magFilter!==void 0?se.magFilter:vr,T.minFilter=se.minFilter!==void 0?se.minFilter:vr,T.anisotropy=se.anisotropy!==void 0?se.anisotropy:1,se.colorSpace!==void 0&&(T.colorSpace=se.colorSpace),se.flipY!==void 0&&(T.flipY=se.flipY),se.format!==void 0&&(T.format=se.format),se.type!==void 0&&(T.type=se.type),se.mipmaps!==void 0&&(T.mipmaps=se.mipmaps,T.minFilter=yi),se.mipmapCount===1&&(T.minFilter=vr),se.generateMipmaps!==void 0&&(T.generateMipmaps=se.generateMipmaps),T.needsUpdate=!0,l&&l(T,se)},h,p),T}}class LE extends null{constructor(r){super(r)}load(r,l,h,p){const y=new ri,T=new Z0(this.manager);return T.setCrossOrigin(this.crossOrigin),T.setPath(this.path),T.load(r,function(O){y.image=O,y.needsUpdate=!0,l!==void 0&&l(y)},h,p),y}}class Ng extends null{constructor(r,l=1){super(),this.isLight=!0,this.type="Light",this.color=new Ea(r),this.intensity=l}dispose(){}copy(r,l){return super.copy(r,l),this.color.copy(r.color),this.intensity=r.intensity,this}toJSON(r){const l=super.toJSON(r);return l.object.color=this.color.getHex(),l.object.intensity=this.intensity,this.groundColor!==void 0&&(l.object.groundColor=this.groundColor.getHex()),this.distance!==void 0&&(l.object.distance=this.distance),this.angle!==void 0&&(l.object.angle=this.angle),this.decay!==void 0&&(l.object.decay=this.decay),this.penumbra!==void 0&&(l.object.penumbra=this.penumbra),this.shadow!==void 0&&(l.object.shadow=this.shadow.toJSON()),this.target!==void 0&&(l.object.target=this.target.uuid),l}}class UE extends null{constructor(r,l,h){super(r,h),this.isHemisphereLight=!0,this.type="HemisphereLight",this.position.copy(_l.DEFAULT_UP),this.updateMatrix(),this.groundColor=new Ea(l)}copy(r,l){return super.copy(r,l),this.groundColor.copy(r.groundColor),this}}const Lx=new oi,Fg=new kn,Jm=new kn;class BP{constructor(r){this.camera=r,this.intensity=1,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new qi(512,512),this.mapType=es,this.map=null,this.mapPass=null,this.matrix=new oi,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new lp,this._frameExtents=new qi(1,1),this._viewportCount=1,this._viewports=[new ai(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(r){const l=this.camera,h=this.matrix;Fg.setFromMatrixPosition(r.matrixWorld),l.position.copy(Fg),Jm.setFromMatrixPosition(r.target.matrixWorld),l.lookAt(Jm),l.updateMatrixWorld(),Lx.multiplyMatrices(l.projectionMatrix,l.matrixWorldInverse),this._frustum.setFromProjectionMatrix(Lx,l.coordinateSystem,l.reversedDepth),l.reversedDepth?h.set(.5,0,0,.5,0,.5,0,.5,0,0,1,0,0,0,0,1):h.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),h.multiply(Lx)}getViewport(r){return this._viewports[r]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(r){return this.camera=r.camera.clone(),this.intensity=r.intensity,this.bias=r.bias,this.radius=r.radius,this.autoUpdate=r.autoUpdate,this.needsUpdate=r.needsUpdate,this.normalBias=r.normalBias,this.blurSamples=r.blurSamples,this.mapSize.copy(r.mapSize),this}clone(){return new this.constructor().copy(this)}toJSON(){const r={};return this.intensity!==1&&(r.intensity=this.intensity),this.bias!==0&&(r.bias=this.bias),this.normalBias!==0&&(r.normalBias=this.normalBias),this.radius!==1&&(r.radius=this.radius),(this.mapSize.x!==512||this.mapSize.y!==512)&&(r.mapSize=this.mapSize.toArray()),r.camera=this.camera.toJSON(!1).object,delete r.camera.matrix,r}}class OE extends null{constructor(){super(new Vh(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1,this.aspect=1}updateMatrices(r){const l=this.camera,h=Lr*2*r.angle*this.focus,p=this.mapSize.width/this.mapSize.height*this.aspect,y=r.distance||l.far;(h!==l.fov||p!==l.aspect||y!==l.far)&&(l.fov=h,l.aspect=p,l.far=y,l.updateProjectionMatrix()),super.updateMatrices(r)}copy(r){return super.copy(r),this.focus=r.focus,this}}class rw extends null{constructor(r,l,h=0,p=Math.PI/3,y=0,T=2){super(r,l),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(_l.DEFAULT_UP),this.updateMatrix(),this.target=new _l,this.distance=h,this.angle=p,this.penumbra=y,this.decay=T,this.map=null,this.shadow=new OE}get power(){return this.intensity*Math.PI}set power(r){this.intensity=r/Math.PI}dispose(){this.shadow.dispose()}copy(r,l){return super.copy(r,l),this.distance=r.distance,this.angle=r.angle,this.penumbra=r.penumbra,this.decay=r.decay,this.target=r.target.clone(),this.shadow=r.shadow.clone(),this}}const $p=new oi,Sm=new kn,e0=new kn;class Ux extends null{constructor(){super(new Vh(90,1,.5,500)),this.isPointLightShadow=!0,this._frameExtents=new qi(4,2),this._viewportCount=6,this._viewports=[new ai(2,1,1,1),new ai(0,1,1,1),new ai(3,1,1,1),new ai(1,1,1,1),new ai(3,0,1,1),new ai(1,0,1,1)],this._cubeDirections=[new kn(1,0,0),new kn(-1,0,0),new kn(0,0,1),new kn(0,0,-1),new kn(0,1,0),new kn(0,-1,0)],this._cubeUps=[new kn(0,1,0),new kn(0,1,0),new kn(0,1,0),new kn(0,1,0),new kn(0,0,1),new kn(0,0,-1)]}updateMatrices(r,l=0){const h=this.camera,p=this.matrix,y=r.distance||h.far;y!==h.far&&(h.far=y,h.updateProjectionMatrix()),Sm.setFromMatrixPosition(r.matrixWorld),h.position.copy(Sm),e0.copy(h.position),e0.add(this._cubeDirections[l]),h.up.copy(this._cubeUps[l]),h.lookAt(e0),h.updateMatrixWorld(),p.makeTranslation(-Sm.x,-Sm.y,-Sm.z),$p.multiplyMatrices(h.projectionMatrix,h.matrixWorldInverse),this._frustum.setFromProjectionMatrix($p,h.coordinateSystem,h.reversedDepth)}}class Ox extends null{constructor(r,l,h=0,p=2){super(r,l),this.isPointLight=!0,this.type="PointLight",this.distance=h,this.decay=p,this.shadow=new Ux}get power(){return this.intensity*4*Math.PI}set power(r){this.intensity=r/(4*Math.PI)}dispose(){this.shadow.dispose()}copy(r,l){return super.copy(r,l),this.distance=r.distance,this.decay=r.decay,this.shadow=r.shadow.clone(),this}}class K0 extends null{constructor(r=-1,l=1,h=1,p=-1,y=.1,T=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=r,this.right=l,this.top=h,this.bottom=p,this.near=y,this.far=T,this.updateProjectionMatrix()}copy(r,l){return super.copy(r,l),this.left=r.left,this.right=r.right,this.top=r.top,this.bottom=r.bottom,this.near=r.near,this.far=r.far,this.zoom=r.zoom,this.view=r.view===null?null:Object.assign({},r.view),this}setViewOffset(r,l,h,p,y,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=r,this.view.fullHeight=l,this.view.offsetX=h,this.view.offsetY=p,this.view.width=y,this.view.height=T,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const r=(this.right-this.left)/(2*this.zoom),l=(this.top-this.bottom)/(2*this.zoom),h=(this.right+this.left)/2,p=(this.top+this.bottom)/2;let y=h-r,T=h+r,O=p+l,te=p-l;if(this.view!==null&&this.view.enabled){const se=(this.right-this.left)/this.view.fullWidth/this.zoom,xe=(this.top-this.bottom)/this.view.fullHeight/this.zoom;y+=se*this.view.offsetX,T=y+se*this.view.width,O-=xe*this.view.offsetY,te=O-xe*this.view.height}this.projectionMatrix.makeOrthographic(y,T,O,te,this.near,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(r){const l=super.toJSON(r);return l.object.zoom=this.zoom,l.object.left=this.left,l.object.right=this.right,l.object.top=this.top,l.object.bottom=this.bottom,l.object.near=this.near,l.object.far=this.far,this.view!==null&&(l.object.view=Object.assign({},this.view)),l}}class iw extends null{constructor(){super(new K0(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class $0 extends null{constructor(r,l){super(r,l),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(_l.DEFAULT_UP),this.updateMatrix(),this.target=new _l,this.shadow=new iw}dispose(){this.shadow.dispose()}copy(r){return super.copy(r),this.target=r.target.clone(),this.shadow=r.shadow.clone(),this}}class sw extends null{constructor(r,l){super(r,l),this.isAmbientLight=!0,this.type="AmbientLight"}}class Dx extends null{constructor(r,l,h=10,p=10){super(r,l),this.isRectAreaLight=!0,this.type="RectAreaLight",this.width=h,this.height=p}get power(){return this.intensity*this.width*this.height*Math.PI}set power(r){this.intensity=r/(this.width*this.height*Math.PI)}copy(r){return super.copy(r),this.width=r.width,this.height=r.height,this}toJSON(r){const l=super.toJSON(r);return l.object.width=this.width,l.object.height=this.height,l}}class Pg{constructor(){this.isSphericalHarmonics3=!0,this.coefficients=[];for(let r=0;r<9;r++)this.coefficients.push(new kn)}set(r){for(let l=0;l<9;l++)this.coefficients[l].copy(r[l]);return this}zero(){for(let r=0;r<9;r++)this.coefficients[r].set(0,0,0);return this}getAt(r,l){const h=r.x,p=r.y,y=r.z,T=this.coefficients;return l.copy(T[0]).multiplyScalar(.282095),l.addScaledVector(T[1],.488603*p),l.addScaledVector(T[2],.488603*y),l.addScaledVector(T[3],.488603*h),l.addScaledVector(T[4],1.092548*(h*p)),l.addScaledVector(T[5],1.092548*(p*y)),l.addScaledVector(T[6],.315392*(3*y*y-1)),l.addScaledVector(T[7],1.092548*(h*y)),l.addScaledVector(T[8],.546274*(h*h-p*p)),l}getIrradianceAt(r,l){const h=r.x,p=r.y,y=r.z,T=this.coefficients;return l.copy(T[0]).multiplyScalar(.886227),l.addScaledVector(T[1],2*.511664*p),l.addScaledVector(T[2],2*.511664*y),l.addScaledVector(T[3],2*.511664*h),l.addScaledVector(T[4],2*.429043*h*p),l.addScaledVector(T[5],2*.429043*p*y),l.addScaledVector(T[6],.743125*y*y-.247708),l.addScaledVector(T[7],2*.429043*h*y),l.addScaledVector(T[8],.429043*(h*h-p*p)),l}add(r){for(let l=0;l<9;l++)this.coefficients[l].add(r.coefficients[l]);return this}addScaledSH(r,l){for(let h=0;h<9;h++)this.coefficients[h].addScaledVector(r.coefficients[h],l);return this}scale(r){for(let l=0;l<9;l++)this.coefficients[l].multiplyScalar(r);return this}lerp(r,l){for(let h=0;h<9;h++)this.coefficients[h].lerp(r.coefficients[h],l);return this}equals(r){for(let l=0;l<9;l++)if(!this.coefficients[l].equals(r.coefficients[l]))return!1;return!0}copy(r){return this.set(r.coefficients)}clone(){return new this.constructor().copy(this)}fromArray(r,l=0){const h=this.coefficients;for(let p=0;p<9;p++)h[p].fromArray(r,l+p*3);return this}toArray(r=[],l=0){const h=this.coefficients;for(let p=0;p<9;p++)h[p].toArray(r,l+p*3);return r}static getBasisAt(r,l){const h=r.x,p=r.y,y=r.z;l[0]=.282095,l[1]=.488603*p,l[2]=.488603*y,l[3]=.488603*h,l[4]=1.092548*h*p,l[5]=1.092548*p*y,l[6]=.315392*(3*y*y-1),l[7]=1.092548*h*y,l[8]=.546274*(h*h-p*p)}}class aw extends null{constructor(r=new Pg,l=1){super(void 0,l),this.isLightProbe=!0,this.sh=r}copy(r){return super.copy(r),this.sh.copy(r.sh),this}fromJSON(r){return this.intensity=r.intensity,this.sh.fromArray(r.sh),this}toJSON(r){const l=super.toJSON(r);return l.object.sh=this.sh.toArray(),l}}class t0 extends null{constructor(r){super(r),this.textures={}}load(r,l,h,p){const y=this,T=new Wp(y.manager);T.setPath(y.path),T.setRequestHeader(y.requestHeader),T.setWithCredentials(y.withCredentials),T.load(r,function(O){try{l(y.parse(JSON.parse(O)))}catch(te){p?p(te):Wa(te),y.manager.itemError(r)}},h,p)}parse(r){const l=this.textures;function h(y){return l[y]===void 0&&na("MaterialLoader: Undefined texture",y),l[y]}const p=this.createMaterialFromType(r.type);if(r.uuid!==void 0&&(p.uuid=r.uuid),r.name!==void 0&&(p.name=r.name),r.color!==void 0&&p.color!==void 0&&p.color.setHex(r.color),r.roughness!==void 0&&(p.roughness=r.roughness),r.metalness!==void 0&&(p.metalness=r.metalness),r.sheen!==void 0&&(p.sheen=r.sheen),r.sheenColor!==void 0&&(p.sheenColor=new Ea().setHex(r.sheenColor)),r.sheenRoughness!==void 0&&(p.sheenRoughness=r.sheenRoughness),r.emissive!==void 0&&p.emissive!==void 0&&p.emissive.setHex(r.emissive),r.specular!==void 0&&p.specular!==void 0&&p.specular.setHex(r.specular),r.specularIntensity!==void 0&&(p.specularIntensity=r.specularIntensity),r.specularColor!==void 0&&p.specularColor!==void 0&&p.specularColor.setHex(r.specularColor),r.shininess!==void 0&&(p.shininess=r.shininess),r.clearcoat!==void 0&&(p.clearcoat=r.clearcoat),r.clearcoatRoughness!==void 0&&(p.clearcoatRoughness=r.clearcoatRoughness),r.dispersion!==void 0&&(p.dispersion=r.dispersion),r.iridescence!==void 0&&(p.iridescence=r.iridescence),r.iridescenceIOR!==void 0&&(p.iridescenceIOR=r.iridescenceIOR),r.iridescenceThicknessRange!==void 0&&(p.iridescenceThicknessRange=r.iridescenceThicknessRange),r.transmission!==void 0&&(p.transmission=r.transmission),r.thickness!==void 0&&(p.thickness=r.thickness),r.attenuationDistance!==void 0&&(p.attenuationDistance=r.attenuationDistance),r.attenuationColor!==void 0&&p.attenuationColor!==void 0&&p.attenuationColor.setHex(r.attenuationColor),r.anisotropy!==void 0&&(p.anisotropy=r.anisotropy),r.anisotropyRotation!==void 0&&(p.anisotropyRotation=r.anisotropyRotation),r.fog!==void 0&&(p.fog=r.fog),r.flatShading!==void 0&&(p.flatShading=r.flatShading),r.blending!==void 0&&(p.blending=r.blending),r.combine!==void 0&&(p.combine=r.combine),r.side!==void 0&&(p.side=r.side),r.shadowSide!==void 0&&(p.shadowSide=r.shadowSide),r.opacity!==void 0&&(p.opacity=r.opacity),r.transparent!==void 0&&(p.transparent=r.transparent),r.alphaTest!==void 0&&(p.alphaTest=r.alphaTest),r.alphaHash!==void 0&&(p.alphaHash=r.alphaHash),r.depthFunc!==void 0&&(p.depthFunc=r.depthFunc),r.depthTest!==void 0&&(p.depthTest=r.depthTest),r.depthWrite!==void 0&&(p.depthWrite=r.depthWrite),r.colorWrite!==void 0&&(p.colorWrite=r.colorWrite),r.blendSrc!==void 0&&(p.blendSrc=r.blendSrc),r.blendDst!==void 0&&(p.blendDst=r.blendDst),r.blendEquation!==void 0&&(p.blendEquation=r.blendEquation),r.blendSrcAlpha!==void 0&&(p.blendSrcAlpha=r.blendSrcAlpha),r.blendDstAlpha!==void 0&&(p.blendDstAlpha=r.blendDstAlpha),r.blendEquationAlpha!==void 0&&(p.blendEquationAlpha=r.blendEquationAlpha),r.blendColor!==void 0&&p.blendColor!==void 0&&p.blendColor.setHex(r.blendColor),r.blendAlpha!==void 0&&(p.blendAlpha=r.blendAlpha),r.stencilWriteMask!==void 0&&(p.stencilWriteMask=r.stencilWriteMask),r.stencilFunc!==void 0&&(p.stencilFunc=r.stencilFunc),r.stencilRef!==void 0&&(p.stencilRef=r.stencilRef),r.stencilFuncMask!==void 0&&(p.stencilFuncMask=r.stencilFuncMask),r.stencilFail!==void 0&&(p.stencilFail=r.stencilFail),r.stencilZFail!==void 0&&(p.stencilZFail=r.stencilZFail),r.stencilZPass!==void 0&&(p.stencilZPass=r.stencilZPass),r.stencilWrite!==void 0&&(p.stencilWrite=r.stencilWrite),r.wireframe!==void 0&&(p.wireframe=r.wireframe),r.wireframeLinewidth!==void 0&&(p.wireframeLinewidth=r.wireframeLinewidth),r.wireframeLinecap!==void 0&&(p.wireframeLinecap=r.wireframeLinecap),r.wireframeLinejoin!==void 0&&(p.wireframeLinejoin=r.wireframeLinejoin),r.rotation!==void 0&&(p.rotation=r.rotation),r.linewidth!==void 0&&(p.linewidth=r.linewidth),r.dashSize!==void 0&&(p.dashSize=r.dashSize),r.gapSize!==void 0&&(p.gapSize=r.gapSize),r.scale!==void 0&&(p.scale=r.scale),r.polygonOffset!==void 0&&(p.polygonOffset=r.polygonOffset),r.polygonOffsetFactor!==void 0&&(p.polygonOffsetFactor=r.polygonOffsetFactor),r.polygonOffsetUnits!==void 0&&(p.polygonOffsetUnits=r.polygonOffsetUnits),r.dithering!==void 0&&(p.dithering=r.dithering),r.alphaToCoverage!==void 0&&(p.alphaToCoverage=r.alphaToCoverage),r.premultipliedAlpha!==void 0&&(p.premultipliedAlpha=r.premultipliedAlpha),r.forceSinglePass!==void 0&&(p.forceSinglePass=r.forceSinglePass),r.visible!==void 0&&(p.visible=r.visible),r.toneMapped!==void 0&&(p.toneMapped=r.toneMapped),r.userData!==void 0&&(p.userData=r.userData),r.vertexColors!==void 0&&(typeof r.vertexColors=="number"?p.vertexColors=r.vertexColors>0:p.vertexColors=r.vertexColors),r.uniforms!==void 0)for(const y in r.uniforms){const T=r.uniforms[y];switch(p.uniforms[y]={},T.type){case"t":p.uniforms[y].value=h(T.value);break;case"c":p.uniforms[y].value=new Ea().setHex(T.value);break;case"v2":p.uniforms[y].value=new qi().fromArray(T.value);break;case"v3":p.uniforms[y].value=new kn().fromArray(T.value);break;case"v4":p.uniforms[y].value=new ai().fromArray(T.value);break;case"m3":p.uniforms[y].value=new vl().fromArray(T.value);break;case"m4":p.uniforms[y].value=new oi().fromArray(T.value);break;default:p.uniforms[y].value=T.value}}if(r.defines!==void 0&&(p.defines=r.defines),r.vertexShader!==void 0&&(p.vertexShader=r.vertexShader),r.fragmentShader!==void 0&&(p.fragmentShader=r.fragmentShader),r.glslVersion!==void 0&&(p.glslVersion=r.glslVersion),r.extensions!==void 0)for(const y in r.extensions)p.extensions[y]=r.extensions[y];if(r.lights!==void 0&&(p.lights=r.lights),r.clipping!==void 0&&(p.clipping=r.clipping),r.size!==void 0&&(p.size=r.size),r.sizeAttenuation!==void 0&&(p.sizeAttenuation=r.sizeAttenuation),r.map!==void 0&&(p.map=h(r.map)),r.matcap!==void 0&&(p.matcap=h(r.matcap)),r.alphaMap!==void 0&&(p.alphaMap=h(r.alphaMap)),r.bumpMap!==void 0&&(p.bumpMap=h(r.bumpMap)),r.bumpScale!==void 0&&(p.bumpScale=r.bumpScale),r.normalMap!==void 0&&(p.normalMap=h(r.normalMap)),r.normalMapType!==void 0&&(p.normalMapType=r.normalMapType),r.normalScale!==void 0){let y=r.normalScale;Array.isArray(y)===!1&&(y=[y,y]),p.normalScale=new qi().fromArray(y)}return r.displacementMap!==void 0&&(p.displacementMap=h(r.displacementMap)),r.displacementScale!==void 0&&(p.displacementScale=r.displacementScale),r.displacementBias!==void 0&&(p.displacementBias=r.displacementBias),r.roughnessMap!==void 0&&(p.roughnessMap=h(r.roughnessMap)),r.metalnessMap!==void 0&&(p.metalnessMap=h(r.metalnessMap)),r.emissiveMap!==void 0&&(p.emissiveMap=h(r.emissiveMap)),r.emissiveIntensity!==void 0&&(p.emissiveIntensity=r.emissiveIntensity),r.specularMap!==void 0&&(p.specularMap=h(r.specularMap)),r.specularIntensityMap!==void 0&&(p.specularIntensityMap=h(r.specularIntensityMap)),r.specularColorMap!==void 0&&(p.specularColorMap=h(r.specularColorMap)),r.envMap!==void 0&&(p.envMap=h(r.envMap)),r.envMapRotation!==void 0&&p.envMapRotation.fromArray(r.envMapRotation),r.envMapIntensity!==void 0&&(p.envMapIntensity=r.envMapIntensity),r.reflectivity!==void 0&&(p.reflectivity=r.reflectivity),r.refractionRatio!==void 0&&(p.refractionRatio=r.refractionRatio),r.lightMap!==void 0&&(p.lightMap=h(r.lightMap)),r.lightMapIntensity!==void 0&&(p.lightMapIntensity=r.lightMapIntensity),r.aoMap!==void 0&&(p.aoMap=h(r.aoMap)),r.aoMapIntensity!==void 0&&(p.aoMapIntensity=r.aoMapIntensity),r.gradientMap!==void 0&&(p.gradientMap=h(r.gradientMap)),r.clearcoatMap!==void 0&&(p.clearcoatMap=h(r.clearcoatMap)),r.clearcoatRoughnessMap!==void 0&&(p.clearcoatRoughnessMap=h(r.clearcoatRoughnessMap)),r.clearcoatNormalMap!==void 0&&(p.clearcoatNormalMap=h(r.clearcoatNormalMap)),r.clearcoatNormalScale!==void 0&&(p.clearcoatNormalScale=new qi().fromArray(r.clearcoatNormalScale)),r.iridescenceMap!==void 0&&(p.iridescenceMap=h(r.iridescenceMap)),r.iridescenceThicknessMap!==void 0&&(p.iridescenceThicknessMap=h(r.iridescenceThicknessMap)),r.transmissionMap!==void 0&&(p.transmissionMap=h(r.transmissionMap)),r.thicknessMap!==void 0&&(p.thicknessMap=h(r.thicknessMap)),r.anisotropyMap!==void 0&&(p.anisotropyMap=h(r.anisotropyMap)),r.sheenColorMap!==void 0&&(p.sheenColorMap=h(r.sheenColorMap)),r.sheenRoughnessMap!==void 0&&(p.sheenRoughnessMap=h(r.sheenRoughnessMap)),p}setTextures(r){return this.textures=r,this}createMaterialFromType(r){return t0.createMaterialFromType(r)}static createMaterialFromType(r){const l={ShadowMaterial:GA,SpriteMaterial:Fp,RawShaderMaterial:sd,ShaderMaterial:bd,PointsMaterial:LA,MeshPhysicalMaterial:ef,MeshStandardMaterial:lA,MeshPhongMaterial:Nf,MeshToonMaterial:Td,MeshNormalMaterial:Gp,MeshLambertMaterial:Hp,MeshDepthMaterial:Ex,MeshDistanceMaterial:Cx,MeshBasicMaterial:Dh,MeshMatcapMaterial:Tx,LineDashedMaterial:$v,LineBasicMaterial:Wc,Material:ku};return new l[r]}}class X0{static extractUrlBase(r){const l=r.lastIndexOf("/");return l===-1?"./":r.slice(0,l+1)}static resolveURL(r,l){return typeof r!="string"||r===""?"":(/^https?:\/\//i.test(l)&&/^\//.test(r)&&(l=l.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(r)||/^data:.*,.*$/i.test(r)||/^blob:.*$/i.test(r)?r:l+r)}}class kx extends null{constructor(){super(),this.isInstancedBufferGeometry=!0,this.type="InstancedBufferGeometry",this.instanceCount=1/0}copy(r){return super.copy(r),this.instanceCount=r.instanceCount,this}toJSON(){const r=super.toJSON();return r.instanceCount=this.instanceCount,r.isInstancedBufferGeometry=!0,r}}class Vx extends null{constructor(r){super(r)}load(r,l,h,p){const y=this,T=new Wp(y.manager);T.setPath(y.path),T.setRequestHeader(y.requestHeader),T.setWithCredentials(y.withCredentials),T.load(r,function(O){try{l(y.parse(JSON.parse(O)))}catch(te){p?p(te):Wa(te),y.manager.itemError(r)}},h,p)}parse(r){const l={},h={};function p(We,tt){if(l[tt]!==void 0)return l[tt];const An=We.interleavedBuffers[tt],un=y(We,An.buffer),Un=gl(An.type,un),Vn=new rh(Un,An.stride);return Vn.uuid=An.uuid,l[tt]=Vn,Vn}function y(We,tt){if(h[tt]!==void 0)return h[tt];const An=We.arrayBuffers[tt],un=new Uint32Array(An).buffer;return h[tt]=un,un}const T=r.isInstancedBufferGeometry?new kx:new Ui,O=r.data.index;if(O!==void 0){const We=gl(O.type,O.array);T.setIndex(new Ql(We,1))}const te=r.data.attributes;for(const We in te){const tt=te[We];let Ot;if(tt.isInterleavedBufferAttribute){const An=p(r.data,tt.data);Ot=new ih(An,tt.itemSize,tt.offset,tt.normalized)}else{const An=gl(tt.type,tt.array),un=tt.isInstancedBufferAttribute?eA:Ql;Ot=new un(An,tt.itemSize,tt.normalized)}tt.name!==void 0&&(Ot.name=tt.name),tt.usage!==void 0&&Ot.setUsage(tt.usage),T.setAttribute(We,Ot)}const se=r.data.morphAttributes;if(se)for(const We in se){const tt=se[We],Ot=[];for(let An=0,un=tt.length;An<un;An++){const Un=tt[An];let Vn;if(Un.isInterleavedBufferAttribute){const nr=p(r.data,Un.data);Vn=new ih(nr,Un.itemSize,Un.offset,Un.normalized)}else{const nr=gl(Un.type,Un.array);Vn=new Ql(nr,Un.itemSize,Un.normalized)}Un.name!==void 0&&(Vn.name=Un.name),Ot.push(Vn)}T.morphAttributes[We]=Ot}r.data.morphTargetsRelative&&(T.morphTargetsRelative=!0);const Ne=r.data.groups||r.data.drawcalls||r.data.offsets;if(Ne!==void 0)for(let We=0,tt=Ne.length;We!==tt;++We){const Ot=Ne[We];T.addGroup(Ot.start,Ot.count,Ot.materialIndex)}const Ve=r.data.boundingSphere;return Ve!==void 0&&(T.boundingSphere=new gn().fromJSON(Ve)),r.name&&(T.name=r.name),r.userData&&(T.userData=r.userData),T}}class ow extends null{constructor(r){super(r)}load(r,l,h,p){const y=this,T=this.path===""?X0.extractUrlBase(r):this.path;this.resourcePath=this.resourcePath||T;const O=new Wp(this.manager);O.setPath(this.path),O.setRequestHeader(this.requestHeader),O.setWithCredentials(this.withCredentials),O.load(r,function(te){let se=null;try{se=JSON.parse(te)}catch(Ne){p!==void 0&&p(Ne),Ne("ObjectLoader: Can't parse "+r+".",Ne.message);return}const xe=se.metadata;if(xe===void 0||xe.type===void 0||xe.type.toLowerCase()==="geometry"){p!==void 0&&p(new Error("THREE.ObjectLoader: Can't load "+r)),Wa("ObjectLoader: Can't load "+r);return}y.parse(se,l)},h,p)}loadAsync(r,l){return Pa(this,null,function*(){const h=this,p=this.path===""?X0.extractUrlBase(r):this.path;this.resourcePath=this.resourcePath||p;const y=new Wp(this.manager);y.setPath(this.path),y.setRequestHeader(this.requestHeader),y.setWithCredentials(this.withCredentials);const T=yield y.loadAsync(r,l),O=JSON.parse(T),te=O.metadata;if(te===void 0||te.type===void 0||te.type.toLowerCase()==="geometry")throw new Error("THREE.ObjectLoader: Can't load "+r);return yield h.parseAsync(O)})}parse(r,l){const h=this.parseAnimations(r.animations),p=this.parseShapes(r.shapes),y=this.parseGeometries(r.geometries,p),T=this.parseImages(r.images,function(){l!==void 0&&l(se)}),O=this.parseTextures(r.textures,T),te=this.parseMaterials(r.materials,O),se=this.parseObject(r.object,y,te,O,h),xe=this.parseSkeletons(r.skeletons,se);if(this.bindSkeletons(se,xe),this.bindLightTargets(se),l!==void 0){let Ne=!1;for(const Ve in T)if(T[Ve].data instanceof HTMLImageElement){Ne=!0;break}Ne===!1&&l(se)}return se}parseAsync(r){return Pa(this,null,function*(){const l=this.parseAnimations(r.animations),h=this.parseShapes(r.shapes),p=this.parseGeometries(r.geometries,h),y=yield this.parseImagesAsync(r.images),T=this.parseTextures(r.textures,y),O=this.parseMaterials(r.materials,T),te=this.parseObject(r.object,p,O,T,l),se=this.parseSkeletons(r.skeletons,te);return this.bindSkeletons(te,se),this.bindLightTargets(te),te})}parseShapes(r){const l={};if(r!==void 0)for(let h=0,p=r.length;h<p;h++){const y=new mn().fromJSON(r[h]);l[y.uuid]=y}return l}parseSkeletons(r,l){const h={},p={};if(l.traverse(function(y){y.isBone&&(p[y.uuid]=y)}),r!==void 0)for(let y=0,T=r.length;y<T;y++){const O=new _f().fromJSON(r[y],p);h[O.uuid]=O}return h}parseGeometries(r,l){const h={};if(r!==void 0){const p=new Vx;for(let y=0,T=r.length;y<T;y++){let O;const te=r[y];switch(te.type){case"BufferGeometry":case"InstancedBufferGeometry":O=p.parse(te);break;default:te.type in id?O=id[te.type].fromJSON(te,l):na(`ObjectLoader: Unsupported geometry type "${te.type}"`)}O.uuid=te.uuid,te.name!==void 0&&(O.name=te.name),te.userData!==void 0&&(O.userData=te.userData),h[te.uuid]=O}}return h}parseMaterials(r,l){const h={},p={};if(r!==void 0){const y=new t0;y.setTextures(l);for(let T=0,O=r.length;T<O;T++){const te=r[T];h[te.uuid]===void 0&&(h[te.uuid]=y.parse(te)),p[te.uuid]=h[te.uuid]}}return p}parseAnimations(r){const l={};if(r!==void 0)for(let h=0;h<r.length;h++){const p=r[h],y=Bd.parse(p);l[y.uuid]=y}return l}parseImages(r,l){const h=this,p={};let y;function T(te){return h.manager.itemStart(te),y.load(te,function(){h.manager.itemEnd(te)},void 0,function(){h.manager.itemError(te),h.manager.itemEnd(te)})}function O(te){if(typeof te=="string"){const se=te,xe=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(se)?se:h.resourcePath+se;return T(xe)}else return te.data?{data:gl(te.type,te.data),width:te.width,height:te.height}:null}if(r!==void 0&&r.length>0){const te=new Fx(l);y=new Z0(te),y.setCrossOrigin(this.crossOrigin);for(let se=0,xe=r.length;se<xe;se++){const Ne=r[se],Ve=Ne.url;if(Array.isArray(Ve)){const We=[];for(let tt=0,Ot=Ve.length;tt<Ot;tt++){const An=Ve[tt],un=O(An);un!==null&&(un instanceof HTMLImageElement?We.push(un):We.push(new Md(un.data,un.width,un.height)))}p[Ne.uuid]=new br(We)}else{const We=O(Ne.url);p[Ne.uuid]=new br(We)}}}return p}parseImagesAsync(r){return Pa(this,null,function*(){const l=this,h={};let p;function y(T){return Pa(this,null,function*(){if(typeof T=="string"){const O=T,te=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(O)?O:l.resourcePath+O;return yield p.loadAsync(te)}else return T.data?{data:gl(T.type,T.data),width:T.width,height:T.height}:null})}if(r!==void 0&&r.length>0){p=new Z0(this.manager),p.setCrossOrigin(this.crossOrigin);for(let T=0,O=r.length;T<O;T++){const te=r[T],se=te.url;if(Array.isArray(se)){const xe=[];for(let Ne=0,Ve=se.length;Ne<Ve;Ne++){const We=se[Ne],tt=yield y(We);tt!==null&&(tt instanceof HTMLImageElement?xe.push(tt):xe.push(new Md(tt.data,tt.width,tt.height)))}h[te.uuid]=new br(xe)}else{const xe=yield y(te.url);h[te.uuid]=new br(xe)}}}return h})}parseTextures(r,l){function h(y,T){return typeof y=="number"?y:(na("ObjectLoader.parseTexture: Constant should be in numeric form.",y),T[y])}const p={};if(r!==void 0)for(let y=0,T=r.length;y<T;y++){const O=r[y];O.image===void 0&&na('ObjectLoader: No "image" specified for',O.uuid),l[O.image]===void 0&&na("ObjectLoader: Undefined image",O.image);const te=l[O.image],se=te.data;let xe;Array.isArray(se)?(xe=new Qd,se.length===6&&(xe.needsUpdate=!0)):(se&&se.data?xe=new Md:xe=new ri,se&&(xe.needsUpdate=!0)),xe.source=te,xe.uuid=O.uuid,O.name!==void 0&&(xe.name=O.name),O.mapping!==void 0&&(xe.mapping=h(O.mapping,ey)),O.channel!==void 0&&(xe.channel=O.channel),O.offset!==void 0&&xe.offset.fromArray(O.offset),O.repeat!==void 0&&xe.repeat.fromArray(O.repeat),O.center!==void 0&&xe.center.fromArray(O.center),O.rotation!==void 0&&(xe.rotation=O.rotation),O.wrap!==void 0&&(xe.wrapS=h(O.wrap[0],ty),xe.wrapT=h(O.wrap[1],ty)),O.format!==void 0&&(xe.format=O.format),O.internalFormat!==void 0&&(xe.internalFormat=O.internalFormat),O.type!==void 0&&(xe.type=O.type),O.colorSpace!==void 0&&(xe.colorSpace=O.colorSpace),O.minFilter!==void 0&&(xe.minFilter=h(O.minFilter,zx)),O.magFilter!==void 0&&(xe.magFilter=h(O.magFilter,zx)),O.anisotropy!==void 0&&(xe.anisotropy=O.anisotropy),O.flipY!==void 0&&(xe.flipY=O.flipY),O.generateMipmaps!==void 0&&(xe.generateMipmaps=O.generateMipmaps),O.premultiplyAlpha!==void 0&&(xe.premultiplyAlpha=O.premultiplyAlpha),O.unpackAlignment!==void 0&&(xe.unpackAlignment=O.unpackAlignment),O.compareFunction!==void 0&&(xe.compareFunction=O.compareFunction),O.userData!==void 0&&(xe.userData=O.userData),p[O.uuid]=xe}return p}parseObject(r,l,h,p,y){let T;function O(Ve){return l[Ve]===void 0&&na("ObjectLoader: Undefined geometry",Ve),l[Ve]}function te(Ve){if(Ve!==void 0){if(Array.isArray(Ve)){const We=[];for(let tt=0,Ot=Ve.length;tt<Ot;tt++){const An=Ve[tt];h[An]===void 0&&na("ObjectLoader: Undefined material",An),We.push(h[An])}return We}return h[Ve]===void 0&&na("ObjectLoader: Undefined material",Ve),h[Ve]}}function se(Ve){return p[Ve]===void 0&&na("ObjectLoader: Undefined texture",Ve),p[Ve]}let xe,Ne;switch(r.type){case"Scene":T=new Np,r.background!==void 0&&(Number.isInteger(r.background)?T.background=new Ea(r.background):T.background=se(r.background)),r.environment!==void 0&&(T.environment=se(r.environment)),r.fog!==void 0&&(r.fog.type==="Fog"?T.fog=new mf(r.fog.color,r.fog.near,r.fog.far):r.fog.type==="FogExp2"&&(T.fog=new gf(r.fog.color,r.fog.density)),r.fog.name!==""&&(T.fog.name=r.fog.name)),r.backgroundBlurriness!==void 0&&(T.backgroundBlurriness=r.backgroundBlurriness),r.backgroundIntensity!==void 0&&(T.backgroundIntensity=r.backgroundIntensity),r.backgroundRotation!==void 0&&T.backgroundRotation.fromArray(r.backgroundRotation),r.environmentIntensity!==void 0&&(T.environmentIntensity=r.environmentIntensity),r.environmentRotation!==void 0&&T.environmentRotation.fromArray(r.environmentRotation);break;case"PerspectiveCamera":T=new Vh(r.fov,r.aspect,r.near,r.far),r.focus!==void 0&&(T.focus=r.focus),r.zoom!==void 0&&(T.zoom=r.zoom),r.filmGauge!==void 0&&(T.filmGauge=r.filmGauge),r.filmOffset!==void 0&&(T.filmOffset=r.filmOffset),r.view!==void 0&&(T.view=Object.assign({},r.view));break;case"OrthographicCamera":T=new K0(r.left,r.right,r.top,r.bottom,r.near,r.far),r.zoom!==void 0&&(T.zoom=r.zoom),r.view!==void 0&&(T.view=Object.assign({},r.view));break;case"AmbientLight":T=new sw(r.color,r.intensity);break;case"DirectionalLight":T=new $0(r.color,r.intensity),T.target=r.target||"";break;case"PointLight":T=new Ox(r.color,r.intensity,r.distance,r.decay);break;case"RectAreaLight":T=new Dx(r.color,r.intensity,r.width,r.height);break;case"SpotLight":T=new rw(r.color,r.intensity,r.distance,r.angle,r.penumbra,r.decay),T.target=r.target||"";break;case"HemisphereLight":T=new UE(r.color,r.groundColor,r.intensity);break;case"LightProbe":T=new aw().fromJSON(r);break;case"SkinnedMesh":xe=O(r.geometry),Ne=te(r.material),T=new Pp(xe,Ne),r.bindMode!==void 0&&(T.bindMode=r.bindMode),r.bindMatrix!==void 0&&T.bindMatrix.fromArray(r.bindMatrix),r.skeleton!==void 0&&(T.skeleton=r.skeleton);break;case"Mesh":xe=O(r.geometry),Ne=te(r.material),T=new zd(xe,Ne);break;case"InstancedMesh":xe=O(r.geometry),Ne=te(r.material);const Ve=r.count,We=r.instanceMatrix,tt=r.instanceColor;T=new Mh(xe,Ne,Ve),T.instanceMatrix=new eA(new Float32Array(We.array),16),tt!==void 0&&(T.instanceColor=new eA(new Float32Array(tt.array),tt.itemSize));break;case"BatchedMesh":xe=O(r.geometry),Ne=te(r.material),T=new FA(r.maxInstanceCount,r.maxVertexCount,r.maxIndexCount,Ne),T.geometry=xe,T.perObjectFrustumCulled=r.perObjectFrustumCulled,T.sortObjects=r.sortObjects,T._drawRanges=r.drawRanges,T._reservedRanges=r.reservedRanges,T._geometryInfo=r.geometryInfo.map(Ot=>{let An=null,un=null;return Ot.boundingBox!==void 0&&(An=new zi().fromJSON(Ot.boundingBox)),Ot.boundingSphere!==void 0&&(un=new gn().fromJSON(Ot.boundingSphere)),fd(rl({},Ot),{boundingBox:An,boundingSphere:un})}),T._instanceInfo=r.instanceInfo,T._availableInstanceIds=r._availableInstanceIds,T._availableGeometryIds=r._availableGeometryIds,T._nextIndexStart=r.nextIndexStart,T._nextVertexStart=r.nextVertexStart,T._geometryCount=r.geometryCount,T._maxInstanceCount=r.maxInstanceCount,T._maxVertexCount=r.maxVertexCount,T._maxIndexCount=r.maxIndexCount,T._geometryInitialized=r.geometryInitialized,T._matricesTexture=se(r.matricesTexture.uuid),T._indirectTexture=se(r.indirectTexture.uuid),r.colorsTexture!==void 0&&(T._colorsTexture=se(r.colorsTexture.uuid)),r.boundingSphere!==void 0&&(T.boundingSphere=new gn().fromJSON(r.boundingSphere)),r.boundingBox!==void 0&&(T.boundingBox=new zi().fromJSON(r.boundingBox));break;case"LOD":T=new IA;break;case"Line":T=new fl(O(r.geometry),te(r.material));break;case"LineLoop":T=new nA(O(r.geometry),te(r.material));break;case"LineSegments":T=new nd(O(r.geometry),te(r.material));break;case"PointCloud":case"Points":T=new hp(O(r.geometry),te(r.material));break;case"Sprite":T=new RA(te(r.material));break;case"Group":T=new xu;break;case"Bone":T=new Lp;break;default:T=new _l}if(T.uuid=r.uuid,r.name!==void 0&&(T.name=r.name),r.matrix!==void 0?(T.matrix.fromArray(r.matrix),r.matrixAutoUpdate!==void 0&&(T.matrixAutoUpdate=r.matrixAutoUpdate),T.matrixAutoUpdate&&T.matrix.decompose(T.position,T.quaternion,T.scale)):(r.position!==void 0&&T.position.fromArray(r.position),r.rotation!==void 0&&T.rotation.fromArray(r.rotation),r.quaternion!==void 0&&T.quaternion.fromArray(r.quaternion),r.scale!==void 0&&T.scale.fromArray(r.scale)),r.up!==void 0&&T.up.fromArray(r.up),r.castShadow!==void 0&&(T.castShadow=r.castShadow),r.receiveShadow!==void 0&&(T.receiveShadow=r.receiveShadow),r.shadow&&(r.shadow.intensity!==void 0&&(T.shadow.intensity=r.shadow.intensity),r.shadow.bias!==void 0&&(T.shadow.bias=r.shadow.bias),r.shadow.normalBias!==void 0&&(T.shadow.normalBias=r.shadow.normalBias),r.shadow.radius!==void 0&&(T.shadow.radius=r.shadow.radius),r.shadow.mapSize!==void 0&&T.shadow.mapSize.fromArray(r.shadow.mapSize),r.shadow.camera!==void 0&&(T.shadow.camera=this.parseObject(r.shadow.camera))),r.visible!==void 0&&(T.visible=r.visible),r.frustumCulled!==void 0&&(T.frustumCulled=r.frustumCulled),r.renderOrder!==void 0&&(T.renderOrder=r.renderOrder),r.userData!==void 0&&(T.userData=r.userData),r.layers!==void 0&&(T.layers.mask=r.layers),r.children!==void 0){const Ve=r.children;for(let We=0;We<Ve.length;We++)T.add(this.parseObject(Ve[We],l,h,p,y))}if(r.animations!==void 0){const Ve=r.animations;for(let We=0;We<Ve.length;We++){const tt=Ve[We];T.animations.push(y[tt])}}if(r.type==="LOD"){r.autoUpdate!==void 0&&(T.autoUpdate=r.autoUpdate);const Ve=r.levels;for(let We=0;We<Ve.length;We++){const tt=Ve[We],Ot=T.getObjectByProperty("uuid",tt.object);Ot!==void 0&&T.addLevel(Ot,tt.distance,tt.hysteresis)}}return T}bindSkeletons(r,l){Object.keys(l).length!==0&&r.traverse(function(h){if(h.isSkinnedMesh===!0&&h.skeleton!==void 0){const p=l[h.skeleton];p===void 0?na("ObjectLoader: No skeleton found with UUID:",h.skeleton):h.bind(p,h.bindMatrix)}})}bindLightTargets(r){r.traverse(function(l){if(l.isDirectionalLight||l.isSpotLight){const h=l.target,p=r.getObjectByProperty("uuid",h);p!==void 0?l.target=p:l.target=new _l}})}}const ey={UVMapping:be,CubeReflectionMapping:it,CubeRefractionMapping:wt,EquirectangularReflectionMapping:ot,EquirectangularRefractionMapping:ut,CubeUVReflectionMapping:_t},ty={RepeatWrapping:$t,ClampToEdgeWrapping:Vt,MirroredRepeatWrapping:Qt},zx={NearestFilter:cn,NearestMipmapNearestFilter:Yn,NearestMipmapLinearFilter:Sr,LinearFilter:vr,LinearMipmapNearestFilter:Ki,LinearMipmapLinearFilter:yi},ny=new WeakMap;class RP extends null{constructor(r){super(r),this.isImageBitmapLoader=!0,typeof createImageBitmap=="undefined"&&na("ImageBitmapLoader: createImageBitmap() not supported."),typeof fetch=="undefined"&&na("ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"},this._abortController=new AbortController}setOptions(r){return this.options=r,this}load(r,l,h,p){r===void 0&&(r=""),this.path!==void 0&&(r=this.path+r),r=this.manager.resolveURL(r);const y=this,T=Ff.get(`image-bitmap:${r}`);if(T!==void 0){if(y.manager.itemStart(r),T.then){T.then(se=>{if(ny.has(T)===!0)p&&p(ny.get(T)),y.manager.itemError(r),y.manager.itemEnd(r);else return l&&l(se),y.manager.itemEnd(r),se});return}return setTimeout(function(){l&&l(T),y.manager.itemEnd(r)},0),T}const O={};O.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",O.headers=this.requestHeader,O.signal=typeof AbortSignal.any=="function"?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal;const te=fetch(r,O).then(function(se){return se.blob()}).then(function(se){return createImageBitmap(se,Object.assign(y.options,{colorSpaceConversion:"none"}))}).then(function(se){return Ff.add(`image-bitmap:${r}`,se),l&&l(se),y.manager.itemEnd(r),se}).catch(function(se){p&&p(se),ny.set(te,se),Ff.remove(`image-bitmap:${r}`),y.manager.itemError(r),y.manager.itemEnd(r)});Ff.add(`image-bitmap:${r}`,te),y.manager.itemStart(r)}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}}let j0;class ry{static getContext(){return j0===void 0&&(j0=new(window.AudioContext||window.webkitAudioContext)),j0}static setContext(r){j0=r}}class lw extends null{constructor(r){super(r)}load(r,l,h,p){const y=this,T=new Wp(this.manager);T.setResponseType("arraybuffer"),T.setPath(this.path),T.setRequestHeader(this.requestHeader),T.setWithCredentials(this.withCredentials),T.load(r,function(te){try{const se=te.slice(0);ry.getContext().decodeAudioData(se,function(Ne){l(Ne)}).catch(O)}catch(se){O(se)}},h,p);function O(te){p?p(te):Wa(te),y.manager.itemError(r)}}}const Y0=new oi,uw=new oi,HA=new oi;class cw{constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new Vh,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new Vh,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1,this._cache={focus:null,fov:null,aspect:null,near:null,far:null,zoom:null,eyeSep:null}}update(r){const l=this._cache;if(l.focus!==r.focus||l.fov!==r.fov||l.aspect!==r.aspect*this.aspect||l.near!==r.near||l.far!==r.far||l.zoom!==r.zoom||l.eyeSep!==this.eyeSep){l.focus=r.focus,l.fov=r.fov,l.aspect=r.aspect*this.aspect,l.near=r.near,l.far=r.far,l.zoom=r.zoom,l.eyeSep=this.eyeSep,HA.copy(r.projectionMatrix);const p=l.eyeSep/2,y=p*l.near/l.focus,T=l.near*Math.tan(ac*l.fov*.5)/l.zoom;let O,te;uw.elements[12]=-p,Y0.elements[12]=p,O=-T*l.aspect+y,te=T*l.aspect+y,HA.elements[0]=2*l.near/(te-O),HA.elements[8]=(te+O)/(te-O),this.cameraL.projectionMatrix.copy(HA),O=-T*l.aspect-y,te=T*l.aspect-y,HA.elements[0]=2*l.near/(te-O),HA.elements[8]=(te+O)/(te-O),this.cameraR.projectionMatrix.copy(HA)}this.cameraL.matrixWorld.copy(r.matrixWorld).multiply(uw),this.cameraR.matrixWorld.copy(r.matrixWorld).multiply(Y0)}}class IP extends null{constructor(r=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=r}}class Gx{constructor(r=!0){this.autoStart=r,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=performance.now(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}stop(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}getElapsedTime(){return this.getDelta(),this.elapsedTime}getDelta(){let r=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){const l=performance.now();r=(l-this.oldTime)/1e3,this.oldTime=l,this.elapsedTime+=r}return r}}const Xp=new kn,Ap=new Du,DE=new kn,jp=new kn,pp=new kn;class Mm extends null{constructor(){super(),this.type="AudioListener",this.context=ry.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new Gx}getInput(){return this.gain}removeFilter(){return this.filter!==null&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null),this}getFilter(){return this.filter}setFilter(r){return this.filter!==null?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=r,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this}getMasterVolume(){return this.gain.gain.value}setMasterVolume(r){return this.gain.gain.setTargetAtTime(r,this.context.currentTime,.01),this}updateMatrixWorld(r){super.updateMatrixWorld(r);const l=this.context.listener;if(this.timeDelta=this._clock.getDelta(),this.matrixWorld.decompose(Xp,Ap,DE),jp.set(0,0,-1).applyQuaternion(Ap),pp.set(0,1,0).applyQuaternion(Ap),l.positionX){const h=this.context.currentTime+this.timeDelta;l.positionX.linearRampToValueAtTime(Xp.x,h),l.positionY.linearRampToValueAtTime(Xp.y,h),l.positionZ.linearRampToValueAtTime(Xp.z,h),l.forwardX.linearRampToValueAtTime(jp.x,h),l.forwardY.linearRampToValueAtTime(jp.y,h),l.forwardZ.linearRampToValueAtTime(jp.z,h),l.upX.linearRampToValueAtTime(pp.x,h),l.upY.linearRampToValueAtTime(pp.y,h),l.upZ.linearRampToValueAtTime(pp.z,h)}else l.setPosition(Xp.x,Xp.y,Xp.z),l.setOrientation(jp.x,jp.y,jp.z,pp.x,pp.y,pp.z)}}class Hx extends null{constructor(r){super(),this.type="Audio",this.listener=r,this.context=r.context,this.gain=this.context.createGain(),this.gain.connect(r.getInput()),this.autoplay=!1,this.buffer=null,this.detune=0,this.loop=!1,this.loopStart=0,this.loopEnd=0,this.offset=0,this.duration=void 0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.source=null,this.sourceType="empty",this._startedAt=0,this._progress=0,this._connected=!1,this.filters=[]}getOutput(){return this.gain}setNodeSource(r){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=r,this.connect(),this}setMediaElementSource(r){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(r),this.connect(),this}setMediaStreamSource(r){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(r),this.connect(),this}setBuffer(r){return this.buffer=r,this.sourceType="buffer",this.autoplay&&this.play(),this}play(r=0){if(this.isPlaying===!0){na("Audio: Audio is already playing.");return}if(this.hasPlaybackControl===!1){na("Audio: this Audio has no playback control.");return}this._startedAt=this.context.currentTime+r;const l=this.context.createBufferSource();return l.buffer=this.buffer,l.loop=this.loop,l.loopStart=this.loopStart,l.loopEnd=this.loopEnd,l.onended=this.onEnded.bind(this),l.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=l,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}pause(){if(this.hasPlaybackControl===!1){na("Audio: this Audio has no playback control.");return}return this.isPlaying===!0&&(this._progress+=Math.max(this.context.currentTime-this._startedAt,0)*this.playbackRate,this.loop===!0&&(this._progress=this._progress%(this.duration||this.buffer.duration)),this.source.stop(),this.source.onended=null,this.isPlaying=!1),this}stop(r=0){if(this.hasPlaybackControl===!1){na("Audio: this Audio has no playback control.");return}return this._progress=0,this.source!==null&&(this.source.stop(this.context.currentTime+r),this.source.onended=null),this.isPlaying=!1,this}connect(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(let r=1,l=this.filters.length;r<l;r++)this.filters[r-1].connect(this.filters[r]);this.filters[this.filters.length-1].connect(this.getOutput())}else this.source.connect(this.getOutput());return this._connected=!0,this}disconnect(){if(this._connected!==!1){if(this.filters.length>0){this.source.disconnect(this.filters[0]);for(let r=1,l=this.filters.length;r<l;r++)this.filters[r-1].disconnect(this.filters[r]);this.filters[this.filters.length-1].disconnect(this.getOutput())}else this.source.disconnect(this.getOutput());return this._connected=!1,this}}getFilters(){return this.filters}setFilters(r){return r||(r=[]),this._connected===!0?(this.disconnect(),this.filters=r.slice(),this.connect()):this.filters=r.slice(),this}setDetune(r){return this.detune=r,this.isPlaying===!0&&this.source.detune!==void 0&&this.source.detune.setTargetAtTime(this.detune,this.context.currentTime,.01),this}getDetune(){return this.detune}getFilter(){return this.getFilters()[0]}setFilter(r){return this.setFilters(r?[r]:[])}setPlaybackRate(r){if(this.hasPlaybackControl===!1){na("Audio: this Audio has no playback control.");return}return this.playbackRate=r,this.isPlaying===!0&&this.source.playbackRate.setTargetAtTime(this.playbackRate,this.context.currentTime,.01),this}getPlaybackRate(){return this.playbackRate}onEnded(){this.isPlaying=!1,this._progress=0}getLoop(){return this.hasPlaybackControl===!1?(na("Audio: this Audio has no playback control."),!1):this.loop}setLoop(r){if(this.hasPlaybackControl===!1){na("Audio: this Audio has no playback control.");return}return this.loop=r,this.isPlaying===!0&&(this.source.loop=this.loop),this}setLoopStart(r){return this.loopStart=r,this}setLoopEnd(r){return this.loopEnd=r,this}getVolume(){return this.gain.gain.value}setVolume(r){return this.gain.gain.setTargetAtTime(r,this.context.currentTime,.01),this}copy(r,l){return super.copy(r,l),r.sourceType!=="buffer"?(na("Audio: Audio source type cannot be copied."),this):(this.autoplay=r.autoplay,this.buffer=r.buffer,this.detune=r.detune,this.loop=r.loop,this.loopStart=r.loopStart,this.loopEnd=r.loopEnd,this.offset=r.offset,this.duration=r.duration,this.playbackRate=r.playbackRate,this.hasPlaybackControl=r.hasPlaybackControl,this.sourceType=r.sourceType,this.filters=r.filters.slice(),this)}clone(r){return new this.constructor(this.listener).copy(this,r)}}const Lg=new kn,Yp=new Du,Ug=new kn,Em=new kn;class NP extends null{constructor(r){super(r),this.panner=this.context.createPanner(),this.panner.panningModel="HRTF",this.panner.connect(this.gain)}connect(){return super.connect(),this.panner.connect(this.gain),this}disconnect(){return super.disconnect(),this.panner.disconnect(this.gain),this}getOutput(){return this.panner}getRefDistance(){return this.panner.refDistance}setRefDistance(r){return this.panner.refDistance=r,this}getRolloffFactor(){return this.panner.rolloffFactor}setRolloffFactor(r){return this.panner.rolloffFactor=r,this}getDistanceModel(){return this.panner.distanceModel}setDistanceModel(r){return this.panner.distanceModel=r,this}getMaxDistance(){return this.panner.maxDistance}setMaxDistance(r){return this.panner.maxDistance=r,this}setDirectionalCone(r,l,h){return this.panner.coneInnerAngle=r,this.panner.coneOuterAngle=l,this.panner.coneOuterGain=h,this}updateMatrixWorld(r){if(super.updateMatrixWorld(r),this.hasPlaybackControl===!0&&this.isPlaying===!1)return;this.matrixWorld.decompose(Lg,Yp,Ug),Em.set(0,0,1).applyQuaternion(Yp);const l=this.panner;if(l.positionX){const h=this.context.currentTime+this.listener.timeDelta;l.positionX.linearRampToValueAtTime(Lg.x,h),l.positionY.linearRampToValueAtTime(Lg.y,h),l.positionZ.linearRampToValueAtTime(Lg.z,h),l.orientationX.linearRampToValueAtTime(Em.x,h),l.orientationY.linearRampToValueAtTime(Em.y,h),l.orientationZ.linearRampToValueAtTime(Em.z,h)}else l.setPosition(Lg.x,Lg.y,Lg.z),l.setOrientation(Em.x,Em.y,Em.z)}}class Cm{constructor(r,l=2048){this.analyser=r.context.createAnalyser(),this.analyser.fftSize=l,this.data=new Uint8Array(this.analyser.frequencyBinCount),r.getOutput().connect(this.analyser)}getFrequencyData(){return this.analyser.getByteFrequencyData(this.data),this.data}getAverageFrequency(){let r=0;const l=this.getFrequencyData();for(let h=0;h<l.length;h++)r+=l[h];return r/l.length}}class Qx{constructor(r,l,h){this.binding=r,this.valueSize=h;let p,y,T;switch(l){case"quaternion":p=this._slerp,y=this._slerpAdditive,T=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(h*6),this._workIndex=5;break;case"string":case"bool":p=this._select,y=this._select,T=this._setAdditiveIdentityOther,this.buffer=new Array(h*5);break;default:p=this._lerp,y=this._lerpAdditive,T=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(h*5)}this._mixBufferRegion=p,this._mixBufferRegionAdditive=y,this._setIdentity=T,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0}accumulate(r,l){const h=this.buffer,p=this.valueSize,y=r*p+p;let T=this.cumulativeWeight;if(T===0){for(let O=0;O!==p;++O)h[y+O]=h[O];T=l}else{T+=l;const O=l/T;this._mixBufferRegion(h,y,0,O,p)}this.cumulativeWeight=T}accumulateAdditive(r){const l=this.buffer,h=this.valueSize,p=h*this._addIndex;this.cumulativeWeightAdditive===0&&this._setIdentity(),this._mixBufferRegionAdditive(l,p,0,r,h),this.cumulativeWeightAdditive+=r}apply(r){const l=this.valueSize,h=this.buffer,p=r*l+l,y=this.cumulativeWeight,T=this.cumulativeWeightAdditive,O=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,y<1){const te=l*this._origIndex;this._mixBufferRegion(h,p,te,1-y,l)}T>0&&this._mixBufferRegionAdditive(h,p,this._addIndex*l,1,l);for(let te=l,se=l+l;te!==se;++te)if(h[te]!==h[te+l]){O.setValue(h,p);break}}saveOriginalState(){const r=this.binding,l=this.buffer,h=this.valueSize,p=h*this._origIndex;r.getValue(l,p);for(let y=h,T=p;y!==T;++y)l[y]=l[p+y%h];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){const r=this.valueSize*3;this.binding.setValue(this.buffer,r)}_setAdditiveIdentityNumeric(){const r=this._addIndex*this.valueSize,l=r+this.valueSize;for(let h=r;h<l;h++)this.buffer[h]=0}_setAdditiveIdentityQuaternion(){this._setAdditiveIdentityNumeric(),this.buffer[this._addIndex*this.valueSize+3]=1}_setAdditiveIdentityOther(){const r=this._origIndex*this.valueSize,l=this._addIndex*this.valueSize;for(let h=0;h<this.valueSize;h++)this.buffer[l+h]=this.buffer[r+h]}_select(r,l,h,p,y){if(p>=.5)for(let T=0;T!==y;++T)r[l+T]=r[h+T]}_slerp(r,l,h,p){Du.slerpFlat(r,l,r,l,r,h,p)}_slerpAdditive(r,l,h,p,y){const T=this._workIndex*y;Du.multiplyQuaternionsFlat(r,T,r,l,r,h),Du.slerpFlat(r,l,r,l,r,T,p)}_lerp(r,l,h,p,y){const T=1-p;for(let O=0;O!==y;++O){const te=l+O;r[te]=r[te]*T+r[h+O]*p}}_lerpAdditive(r,l,h,p,y){for(let T=0;T!==y;++T){const O=l+T;r[O]=r[O]+r[h+T]*p}}}const iy="\\[\\]\\.:\\/",Og=new RegExp("["+iy+"]","g"),Wx="[^"+iy+"]",kE="[^"+iy.replace("\\.","")+"]",hw=/((?:WC+[\/:])*)/.source.replace("WC",Wx),sy=/(WCOD+)?/.source.replace("WCOD",kE),dw=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",Wx),ay=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",Wx),fw=new RegExp("^"+hw+sy+dw+ay+"$"),Aw=["material","materials","bones","map"];class pw{constructor(r,l,h){const p=h||Cl.parseTrackName(l);this._targetGroup=r,this._bindings=r.subscribe_(l,p)}getValue(r,l){this.bind();const h=this._targetGroup.nCachedObjects_,p=this._bindings[h];p!==void 0&&p.getValue(r,l)}setValue(r,l){const h=this._bindings;for(let p=this._targetGroup.nCachedObjects_,y=h.length;p!==y;++p)h[p].setValue(r,l)}bind(){const r=this._bindings;for(let l=this._targetGroup.nCachedObjects_,h=r.length;l!==h;++l)r[l].bind()}unbind(){const r=this._bindings;for(let l=this._targetGroup.nCachedObjects_,h=r.length;l!==h;++l)r[l].unbind()}}class Cl{constructor(r,l,h){this.path=l,this.parsedPath=h||Cl.parseTrackName(l),this.node=Cl.findNode(r,this.parsedPath.nodeName),this.rootNode=r,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(r,l,h){return r&&r.isAnimationObjectGroup?new Cl.Composite(r,l,h):new Cl(r,l,h)}static sanitizeNodeName(r){return r.replace(/\s/g,"_").replace(Og,"")}static parseTrackName(r){const l=fw.exec(r);if(l===null)throw new Error("PropertyBinding: Cannot parse trackName: "+r);const h={nodeName:l[2],objectName:l[3],objectIndex:l[4],propertyName:l[5],propertyIndex:l[6]},p=h.nodeName&&h.nodeName.lastIndexOf(".");if(p!==void 0&&p!==-1){const y=h.nodeName.substring(p+1);Aw.indexOf(y)!==-1&&(h.nodeName=h.nodeName.substring(0,p),h.objectName=y)}if(h.propertyName===null||h.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+r);return h}static findNode(r,l){if(l===void 0||l===""||l==="."||l===-1||l===r.name||l===r.uuid)return r;if(r.skeleton){const h=r.skeleton.getBoneByName(l);if(h!==void 0)return h}if(r.children){const h=function(y){for(let T=0;T<y.length;T++){const O=y[T];if(O.name===l||O.uuid===l)return O;const te=h(O.children);if(te)return te}return null},p=h(r.children);if(p)return p}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(r,l){r[l]=this.targetObject[this.propertyName]}_getValue_array(r,l){const h=this.resolvedProperty;for(let p=0,y=h.length;p!==y;++p)r[l++]=h[p]}_getValue_arrayElement(r,l){r[l]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(r,l){this.resolvedProperty.toArray(r,l)}_setValue_direct(r,l){this.targetObject[this.propertyName]=r[l]}_setValue_direct_setNeedsUpdate(r,l){this.targetObject[this.propertyName]=r[l],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(r,l){this.targetObject[this.propertyName]=r[l],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(r,l){const h=this.resolvedProperty;for(let p=0,y=h.length;p!==y;++p)h[p]=r[l++]}_setValue_array_setNeedsUpdate(r,l){const h=this.resolvedProperty;for(let p=0,y=h.length;p!==y;++p)h[p]=r[l++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(r,l){const h=this.resolvedProperty;for(let p=0,y=h.length;p!==y;++p)h[p]=r[l++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(r,l){this.resolvedProperty[this.propertyIndex]=r[l]}_setValue_arrayElement_setNeedsUpdate(r,l){this.resolvedProperty[this.propertyIndex]=r[l],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(r,l){this.resolvedProperty[this.propertyIndex]=r[l],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(r,l){this.resolvedProperty.fromArray(r,l)}_setValue_fromArray_setNeedsUpdate(r,l){this.resolvedProperty.fromArray(r,l),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(r,l){this.resolvedProperty.fromArray(r,l),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(r,l){this.bind(),this.getValue(r,l)}_setValue_unbound(r,l){this.bind(),this.setValue(r,l)}bind(){let r=this.node;const l=this.parsedPath,h=l.objectName,p=l.propertyName;let y=l.propertyIndex;if(r||(r=Cl.findNode(this.rootNode,l.nodeName),this.node=r),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!r){na("PropertyBinding: No target node found for track: "+this.path+".");return}if(h){let se=l.objectIndex;switch(h){case"materials":if(!r.material){Wa("PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!r.material.materials){Wa("PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);return}r=r.material.materials;break;case"bones":if(!r.skeleton){Wa("PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);return}r=r.skeleton.bones;for(let xe=0;xe<r.length;xe++)if(r[xe].name===se){se=xe;break}break;case"map":if("map"in r){r=r.map;break}if(!r.material){Wa("PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!r.material.map){Wa("PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);return}r=r.material.map;break;default:if(r[h]===void 0){Wa("PropertyBinding: Can not bind to objectName of node undefined.",this);return}r=r[h]}if(se!==void 0){if(r[se]===void 0){Wa("PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,r);return}r=r[se]}}const T=r[p];if(T===void 0){const se=l.nodeName;Wa("PropertyBinding: Trying to update property for track: "+se+"."+p+" but it wasn't found.",r);return}let O=this.Versioning.None;this.targetObject=r,r.isMaterial===!0?O=this.Versioning.NeedsUpdate:r.isObject3D===!0&&(O=this.Versioning.MatrixWorldNeedsUpdate);let te=this.BindingType.Direct;if(y!==void 0){if(p==="morphTargetInfluences"){if(!r.geometry){Wa("PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(!r.geometry.morphAttributes){Wa("PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);return}r.morphTargetDictionary[y]!==void 0&&(y=r.morphTargetDictionary[y])}te=this.BindingType.ArrayElement,this.resolvedProperty=T,this.propertyIndex=y}else T.fromArray!==void 0&&T.toArray!==void 0?(te=this.BindingType.HasFromToArray,this.resolvedProperty=T):Array.isArray(T)?(te=this.BindingType.EntireArray,this.resolvedProperty=T):this.propertyName=p;this.getValue=this.GetterByBindingType[te],this.setValue=this.SetterByBindingTypeAndVersioning[te][O]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}Cl.Composite=pw,Cl.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},Cl.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},Cl.prototype.GetterByBindingType=[Cl.prototype._getValue_direct,Cl.prototype._getValue_array,Cl.prototype._getValue_arrayElement,Cl.prototype._getValue_toArray],Cl.prototype.SetterByBindingTypeAndVersioning=[[Cl.prototype._setValue_direct,Cl.prototype._setValue_direct_setNeedsUpdate,Cl.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[Cl.prototype._setValue_array,Cl.prototype._setValue_array_setNeedsUpdate,Cl.prototype._setValue_array_setMatrixWorldNeedsUpdate],[Cl.prototype._setValue_arrayElement,Cl.prototype._setValue_arrayElement_setNeedsUpdate,Cl.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[Cl.prototype._setValue_fromArray,Cl.prototype._setValue_fromArray_setNeedsUpdate,Cl.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];class VE{constructor(){this.isAnimationObjectGroup=!0,this.uuid=Gr(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;const r={};this._indicesByUUID=r;for(let h=0,p=arguments.length;h!==p;++h)r[arguments[h].uuid]=h;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};const l=this;this.stats={objects:{get total(){return l._objects.length},get inUse(){return this.total-l.nCachedObjects_}},get bindingsPerObject(){return l._bindings.length}}}add(){const r=this._objects,l=this._indicesByUUID,h=this._paths,p=this._parsedPaths,y=this._bindings,T=y.length;let O,te=r.length,se=this.nCachedObjects_;for(let xe=0,Ne=arguments.length;xe!==Ne;++xe){const Ve=arguments[xe],We=Ve.uuid;let tt=l[We];if(tt===void 0){tt=te++,l[We]=tt,r.push(Ve);for(let Ot=0,An=T;Ot!==An;++Ot)y[Ot].push(new Cl(Ve,h[Ot],p[Ot]))}else if(tt<se){O=r[tt];const Ot=--se,An=r[Ot];l[An.uuid]=tt,r[tt]=An,l[We]=Ot,r[Ot]=Ve;for(let un=0,Un=T;un!==Un;++un){const Vn=y[un],nr=Vn[Ot];let ii=Vn[tt];Vn[tt]=nr,ii===void 0&&(ii=new Cl(Ve,h[un],p[un])),Vn[Ot]=ii}}else r[tt]!==O&&Wa("AnimationObjectGroup: Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes.")}this.nCachedObjects_=se}remove(){const r=this._objects,l=this._indicesByUUID,h=this._bindings,p=h.length;let y=this.nCachedObjects_;for(let T=0,O=arguments.length;T!==O;++T){const te=arguments[T],se=te.uuid,xe=l[se];if(xe!==void 0&&xe>=y){const Ne=y++,Ve=r[Ne];l[Ve.uuid]=xe,r[xe]=Ve,l[se]=Ne,r[Ne]=te;for(let We=0,tt=p;We!==tt;++We){const Ot=h[We],An=Ot[Ne],un=Ot[xe];Ot[xe]=An,Ot[Ne]=un}}}this.nCachedObjects_=y}uncache(){const r=this._objects,l=this._indicesByUUID,h=this._bindings,p=h.length;let y=this.nCachedObjects_,T=r.length;for(let O=0,te=arguments.length;O!==te;++O){const se=arguments[O],xe=se.uuid,Ne=l[xe];if(Ne!==void 0)if(delete l[xe],Ne<y){const Ve=--y,We=r[Ve],tt=--T,Ot=r[tt];l[We.uuid]=Ne,r[Ne]=We,l[Ot.uuid]=Ve,r[Ve]=Ot,r.pop();for(let An=0,un=p;An!==un;++An){const Un=h[An],Vn=Un[Ve],nr=Un[tt];Un[Ne]=Vn,Un[Ve]=nr,Un.pop()}}else{const Ve=--T,We=r[Ve];Ve>0&&(l[We.uuid]=Ne),r[Ne]=We,r.pop();for(let tt=0,Ot=p;tt!==Ot;++tt){const An=h[tt];An[Ne]=An[Ve],An.pop()}}}this.nCachedObjects_=y}subscribe_(r,l){const h=this._bindingsIndicesByPath;let p=h[r];const y=this._bindings;if(p!==void 0)return y[p];const T=this._paths,O=this._parsedPaths,te=this._objects,se=te.length,xe=this.nCachedObjects_,Ne=new Array(se);p=y.length,h[r]=p,T.push(r),O.push(l),y.push(Ne);for(let Ve=xe,We=te.length;Ve!==We;++Ve){const tt=te[Ve];Ne[Ve]=new Cl(tt,r,l)}return Ne}unsubscribe_(r){const l=this._bindingsIndicesByPath,h=l[r];if(h!==void 0){const p=this._paths,y=this._parsedPaths,T=this._bindings,O=T.length-1,te=T[O],se=r[O];l[se]=h,T[h]=te,T.pop(),y[h]=y[O],y.pop(),p[h]=p[O],p.pop()}}}class gw{constructor(r,l,h=null,p=l.blendMode){this._mixer=r,this._clip=l,this._localRoot=h,this.blendMode=p;const y=l.tracks,T=y.length,O=new Array(T),te={endingStart:Di,endingEnd:Di};for(let se=0;se!==T;++se){const xe=y[se].createInterpolant(null);O[se]=xe,xe.settings=te}this._interpolantSettings=te,this._interpolants=O,this._propertyBindings=new Array(T),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=Ln,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}play(){return this._mixer._activateAction(this),this}stop(){return this._mixer._deactivateAction(this),this.reset()}reset(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}isRunning(){return this.enabled&&!this.paused&&this.timeScale!==0&&this._startTime===null&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(r){return this._startTime=r,this}setLoop(r,l){return this.loop=r,this.repetitions=l,this}setEffectiveWeight(r){return this.weight=r,this._effectiveWeight=this.enabled?r:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(r){return this._scheduleFading(r,0,1)}fadeOut(r){return this._scheduleFading(r,1,0)}crossFadeFrom(r,l,h=!1){if(r.fadeOut(l),this.fadeIn(l),h===!0){const p=this._clip.duration,y=r._clip.duration,T=y/p,O=p/y;r.warp(1,T,l),this.warp(O,1,l)}return this}crossFadeTo(r,l,h=!1){return r.crossFadeFrom(this,l,h)}stopFading(){const r=this._weightInterpolant;return r!==null&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(r)),this}setEffectiveTimeScale(r){return this.timeScale=r,this._effectiveTimeScale=this.paused?0:r,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(r){return this.timeScale=this._clip.duration/r,this.stopWarping()}syncWith(r){return this.time=r.time,this.timeScale=r.timeScale,this.stopWarping()}halt(r){return this.warp(this._effectiveTimeScale,0,r)}warp(r,l,h){const p=this._mixer,y=p.time,T=this.timeScale;let O=this._timeScaleInterpolant;O===null&&(O=p._lendControlInterpolant(),this._timeScaleInterpolant=O);const te=O.parameterPositions,se=O.sampleValues;return te[0]=y,te[1]=y+h,se[0]=r/T,se[1]=l/T,this}stopWarping(){const r=this._timeScaleInterpolant;return r!==null&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(r)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(r,l,h,p){if(!this.enabled){this._updateWeight(r);return}const y=this._startTime;if(y!==null){const te=(r-y)*h;te<0||h===0?l=0:(this._startTime=null,l=h*te)}l*=this._updateTimeScale(r);const T=this._updateTime(l),O=this._updateWeight(r);if(O>0){const te=this._interpolants,se=this._propertyBindings;switch(this.blendMode){case Aa:for(let xe=0,Ne=te.length;xe!==Ne;++xe)te[xe].evaluate(T),se[xe].accumulateAdditive(O);break;case Cs:default:for(let xe=0,Ne=te.length;xe!==Ne;++xe)te[xe].evaluate(T),se[xe].accumulate(p,O)}}}_updateWeight(r){let l=0;if(this.enabled){l=this.weight;const h=this._weightInterpolant;if(h!==null){const p=h.evaluate(r)[0];l*=p,r>h.parameterPositions[1]&&(this.stopFading(),p===0&&(this.enabled=!1))}}return this._effectiveWeight=l,l}_updateTimeScale(r){let l=0;if(!this.paused){l=this.timeScale;const h=this._timeScaleInterpolant;if(h!==null){const p=h.evaluate(r)[0];l*=p,r>h.parameterPositions[1]&&(this.stopWarping(),l===0?this.paused=!0:this.timeScale=l)}}return this._effectiveTimeScale=l,l}_updateTime(r){const l=this._clip.duration,h=this.loop;let p=this.time+r,y=this._loopCount;const T=h===gr;if(r===0)return y===-1?p:T&&(y&1)===1?l-p:p;if(h===yn){y===-1&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(p>=l)p=l;else if(p<0)p=0;else{this.time=p;break e}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=p,this._mixer.dispatchEvent({type:"finished",action:this,direction:r<0?-1:1})}}else{if(y===-1&&(r>=0?(y=0,this._setEndings(!0,this.repetitions===0,T)):this._setEndings(this.repetitions===0,!0,T)),p>=l||p<0){const O=Math.floor(p/l);p-=l*O,y+=Math.abs(O);const te=this.repetitions-y;if(te<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,p=r>0?l:0,this.time=p,this._mixer.dispatchEvent({type:"finished",action:this,direction:r>0?1:-1});else{if(te===1){const se=r<0;this._setEndings(se,!se,T)}else this._setEndings(!1,!1,T);this._loopCount=y,this.time=p,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:O})}}else this.time=p;if(T&&(y&1)===1)return l-p}return p}_setEndings(r,l,h){const p=this._interpolantSettings;h?(p.endingStart=ss,p.endingEnd=ss):(r?p.endingStart=this.zeroSlopeAtStart?ss:Di:p.endingStart=vs,l?p.endingEnd=this.zeroSlopeAtEnd?ss:Di:p.endingEnd=vs)}_scheduleFading(r,l,h){const p=this._mixer,y=p.time;let T=this._weightInterpolant;T===null&&(T=p._lendControlInterpolant(),this._weightInterpolant=T);const O=T.parameterPositions,te=T.sampleValues;return O[0]=y,te[0]=l,O[1]=y+r,te[1]=h,this}}const mw=new Float32Array(1);class zE extends null{constructor(r){super(),this._root=r,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(r,l){const h=r._localRoot||this._root,p=r._clip.tracks,y=p.length,T=r._propertyBindings,O=r._interpolants,te=h.uuid,se=this._bindingsByRootAndName;let xe=se[te];xe===void 0&&(xe={},se[te]=xe);for(let Ne=0;Ne!==y;++Ne){const Ve=p[Ne],We=Ve.name;let tt=xe[We];if(tt!==void 0)++tt.referenceCount,T[Ne]=tt;else{if(tt=T[Ne],tt!==void 0){tt._cacheIndex===null&&(++tt.referenceCount,this._addInactiveBinding(tt,te,We));continue}const Ot=l&&l._propertyBindings[Ne].binding.parsedPath;tt=new Qx(Cl.create(h,We,Ot),Ve.ValueTypeName,Ve.getValueSize()),++tt.referenceCount,this._addInactiveBinding(tt,te,We),T[Ne]=tt}O[Ne].resultBuffer=tt.buffer}}_activateAction(r){if(!this._isActiveAction(r)){if(r._cacheIndex===null){const h=(r._localRoot||this._root).uuid,p=r._clip.uuid,y=this._actionsByClip[p];this._bindAction(r,y&&y.knownActions[0]),this._addInactiveAction(r,p,h)}const l=r._propertyBindings;for(let h=0,p=l.length;h!==p;++h){const y=l[h];y.useCount++===0&&(this._lendBinding(y),y.saveOriginalState())}this._lendAction(r)}}_deactivateAction(r){if(this._isActiveAction(r)){const l=r._propertyBindings;for(let h=0,p=l.length;h!==p;++h){const y=l[h];--y.useCount===0&&(y.restoreOriginalState(),this._takeBackBinding(y))}this._takeBackAction(r)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;const r=this;this.stats={actions:{get total(){return r._actions.length},get inUse(){return r._nActiveActions}},bindings:{get total(){return r._bindings.length},get inUse(){return r._nActiveBindings}},controlInterpolants:{get total(){return r._controlInterpolants.length},get inUse(){return r._nActiveControlInterpolants}}}}_isActiveAction(r){const l=r._cacheIndex;return l!==null&&l<this._nActiveActions}_addInactiveAction(r,l,h){const p=this._actions,y=this._actionsByClip;let T=y[l];if(T===void 0)T={knownActions:[r],actionByRoot:{}},r._byClipCacheIndex=0,y[l]=T;else{const O=T.knownActions;r._byClipCacheIndex=O.length,O.push(r)}r._cacheIndex=p.length,p.push(r),T.actionByRoot[h]=r}_removeInactiveAction(r){const l=this._actions,h=l[l.length-1],p=r._cacheIndex;h._cacheIndex=p,l[p]=h,l.pop(),r._cacheIndex=null;const y=r._clip.uuid,T=this._actionsByClip,O=T[y],te=O.knownActions,se=te[te.length-1],xe=r._byClipCacheIndex;se._byClipCacheIndex=xe,te[xe]=se,te.pop(),r._byClipCacheIndex=null;const Ne=O.actionByRoot,Ve=(r._localRoot||this._root).uuid;delete Ne[Ve],te.length===0&&delete T[y],this._removeInactiveBindingsForAction(r)}_removeInactiveBindingsForAction(r){const l=r._propertyBindings;for(let h=0,p=l.length;h!==p;++h){const y=l[h];--y.referenceCount===0&&this._removeInactiveBinding(y)}}_lendAction(r){const l=this._actions,h=r._cacheIndex,p=this._nActiveActions++,y=l[p];r._cacheIndex=p,l[p]=r,y._cacheIndex=h,l[h]=y}_takeBackAction(r){const l=this._actions,h=r._cacheIndex,p=--this._nActiveActions,y=l[p];r._cacheIndex=p,l[p]=r,y._cacheIndex=h,l[h]=y}_addInactiveBinding(r,l,h){const p=this._bindingsByRootAndName,y=this._bindings;let T=p[l];T===void 0&&(T={},p[l]=T),T[h]=r,r._cacheIndex=y.length,y.push(r)}_removeInactiveBinding(r){const l=this._bindings,h=r.binding,p=h.rootNode.uuid,y=h.path,T=this._bindingsByRootAndName,O=T[p],te=l[l.length-1],se=r._cacheIndex;te._cacheIndex=se,l[se]=te,l.pop(),delete O[y],Object.keys(O).length===0&&delete T[p]}_lendBinding(r){const l=this._bindings,h=r._cacheIndex,p=this._nActiveBindings++,y=l[p];r._cacheIndex=p,l[p]=r,y._cacheIndex=h,l[h]=y}_takeBackBinding(r){const l=this._bindings,h=r._cacheIndex,p=--this._nActiveBindings,y=l[p];r._cacheIndex=p,l[p]=r,y._cacheIndex=h,l[h]=y}_lendControlInterpolant(){const r=this._controlInterpolants,l=this._nActiveControlInterpolants++;let h=r[l];return h===void 0&&(h=new Yv(new Float32Array(2),new Float32Array(2),1,mw),h.__cacheIndex=l,r[l]=h),h}_takeBackControlInterpolant(r){const l=this._controlInterpolants,h=r.__cacheIndex,p=--this._nActiveControlInterpolants,y=l[p];r.__cacheIndex=p,l[p]=r,y.__cacheIndex=h,l[h]=y}clipAction(r,l,h){const p=l||this._root,y=p.uuid;let T=typeof r=="string"?Bd.findByName(p,r):r;const O=T!==null?T.uuid:r,te=this._actionsByClip[O];let se=null;if(h===void 0&&(T!==null?h=T.blendMode:h=Cs),te!==void 0){const Ne=te.actionByRoot[y];if(Ne!==void 0&&Ne.blendMode===h)return Ne;se=te.knownActions[0],T===null&&(T=se._clip)}if(T===null)return null;const xe=new gw(this,T,l,h);return this._bindAction(xe,se),this._addInactiveAction(xe,O,y),xe}existingAction(r,l){const h=l||this._root,p=h.uuid,y=typeof r=="string"?Bd.findByName(h,r):r,T=y?y.uuid:r,O=this._actionsByClip[T];return O!==void 0&&O.actionByRoot[p]||null}stopAllAction(){const r=this._actions,l=this._nActiveActions;for(let h=l-1;h>=0;--h)r[h].stop();return this}update(r){r*=this.timeScale;const l=this._actions,h=this._nActiveActions,p=this.time+=r,y=Math.sign(r),T=this._accuIndex^=1;for(let se=0;se!==h;++se)l[se]._update(p,r,y,T);const O=this._bindings,te=this._nActiveBindings;for(let se=0;se!==te;++se)O[se].apply(T);return this}setTime(r){this.time=0;for(let l=0;l<this._actions.length;l++)this._actions[l].time=0;return this.update(r)}getRoot(){return this._root}uncacheClip(r){const l=this._actions,h=r.uuid,p=this._actionsByClip,y=p[h];if(y!==void 0){const T=y.knownActions;for(let O=0,te=T.length;O!==te;++O){const se=T[O];this._deactivateAction(se);const xe=se._cacheIndex,Ne=l[l.length-1];se._cacheIndex=null,se._byClipCacheIndex=null,Ne._cacheIndex=xe,l[xe]=Ne,l.pop(),this._removeInactiveBindingsForAction(se)}delete p[h]}}uncacheRoot(r){const l=r.uuid,h=this._actionsByClip;for(const T in h){const O=h[T].actionByRoot,te=O[l];te!==void 0&&(this._deactivateAction(te),this._removeInactiveAction(te))}const p=this._bindingsByRootAndName,y=p[l];if(y!==void 0)for(const T in y){const O=y[T];O.restoreOriginalState(),this._removeInactiveBinding(O)}}uncacheAction(r,l){const h=this.existingAction(r,l);h!==null&&(this._deactivateAction(h),this._removeInactiveAction(h))}}class Nl extends null{constructor(r=1,l=1,h=1,p={}){super(r,l,p),this.isRenderTarget3D=!0,this.depth=h,this.texture=new Bs(null,r,l,h),this._setTextureOptions(p),this.texture.isRenderTargetTexture=!0}}class vw{constructor(r){this.value=r}clone(){return new vw(this.value.clone===void 0?this.value:this.value.clone())}}let yw=0;class GE extends null{constructor(){super(),this.isUniformsGroup=!0,Object.defineProperty(this,"id",{value:yw++}),this.name="",this.usage=oo,this.uniforms=[]}add(r){return this.uniforms.push(r),this}remove(r){const l=this.uniforms.indexOf(r);return l!==-1&&this.uniforms.splice(l,1),this}setName(r){return this.name=r,this}setUsage(r){return this.usage=r,this}dispose(){this.dispatchEvent({type:"dispose"})}copy(r){this.name=r.name,this.usage=r.usage;const l=r.uniforms;this.uniforms.length=0;for(let h=0,p=l.length;h<p;h++){const y=Array.isArray(l[h])?l[h]:[l[h]];for(let T=0;T<y.length;T++)this.uniforms.push(y[T].clone())}return this}clone(){return new this.constructor().copy(this)}}class FP extends null{constructor(r,l,h=1){super(r,l),this.isInstancedInterleavedBuffer=!0,this.meshPerAttribute=h}copy(r){return super.copy(r),this.meshPerAttribute=r.meshPerAttribute,this}clone(r){const l=super.clone(r);return l.meshPerAttribute=this.meshPerAttribute,l}toJSON(r){const l=super.toJSON(r);return l.isInstancedInterleavedBuffer=!0,l.meshPerAttribute=this.meshPerAttribute,l}}class PP{constructor(r,l,h,p,y,T=!1){this.isGLBufferAttribute=!0,this.name="",this.buffer=r,this.type=l,this.itemSize=h,this.elementSize=p,this.count=y,this.normalized=T,this.version=0}set needsUpdate(r){r===!0&&this.version++}setBuffer(r){return this.buffer=r,this}setType(r,l){return this.type=r,this.elementSize=l,this}setItemSize(r){return this.itemSize=r,this}setCount(r){return this.count=r,this}}const oy=new oi;class HE{constructor(r,l,h=0,p=1/0){this.ray=new gi(r,l),this.near=h,this.far=p,this.camera=null,this.layers=new lo,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(r,l){this.ray.set(r,l)}setFromCamera(r,l){l.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(l.matrixWorld),this.ray.direction.set(r.x,r.y,.5).unproject(l).sub(this.ray.origin).normalize(),this.camera=l):l.isOrthographicCamera?(this.ray.origin.set(r.x,r.y,(l.near+l.far)/(l.near-l.far)).unproject(l),this.ray.direction.set(0,0,-1).transformDirection(l.matrixWorld),this.camera=l):Wa("Raycaster: Unsupported camera type: "+l.type)}setFromXRController(r){return oy.identity().extractRotation(r.matrixWorld),this.ray.origin.setFromMatrixPosition(r.matrixWorld),this.ray.direction.set(0,0,-1).applyMatrix4(oy),this}intersectObject(r,l=!0,h=[]){return ly(r,this,h,l),h.sort(xw),h}intersectObjects(r,l=!0,h=[]){for(let p=0,y=r.length;p<y;p++)ly(r[p],this,h,l);return h.sort(xw),h}}function xw(ue,r){return ue.distance-r.distance}function ly(ue,r,l,h){let p=!0;if(ue.layers.test(r.layers)&&ue.raycast(r,l)===!1&&(p=!1),p===!0&&h===!0){const y=ue.children;for(let T=0,O=y.length;T<O;T++)ly(y[T],r,l,!0)}}class LP{constructor(){this._previousTime=0,this._currentTime=0,this._startTime=performance.now(),this._delta=0,this._elapsed=0,this._timescale=1,this._document=null,this._pageVisibilityHandler=null}connect(r){this._document=r,r.hidden!==void 0&&(this._pageVisibilityHandler=Zx.bind(this),r.addEventListener("visibilitychange",this._pageVisibilityHandler,!1))}disconnect(){this._pageVisibilityHandler!==null&&(this._document.removeEventListener("visibilitychange",this._pageVisibilityHandler),this._pageVisibilityHandler=null),this._document=null}getDelta(){return this._delta/1e3}getElapsed(){return this._elapsed/1e3}getTimescale(){return this._timescale}setTimescale(r){return this._timescale=r,this}reset(){return this._currentTime=performance.now()-this._startTime,this}dispose(){this.disconnect()}update(r){return this._pageVisibilityHandler!==null&&this._document.hidden===!0?this._delta=0:(this._previousTime=this._currentTime,this._currentTime=(r!==void 0?r:performance.now())-this._startTime,this._delta=(this._currentTime-this._previousTime)*this._timescale,this._elapsed+=this._delta),this}}function Zx(){this._document.hidden===!1&&this.reset()}class bw{constructor(r=1,l=0,h=0){this.radius=r,this.phi=l,this.theta=h}set(r,l,h){return this.radius=r,this.phi=l,this.theta=h,this}copy(r){return this.radius=r.radius,this.phi=r.phi,this.theta=r.theta,this}makeSafe(){return this.phi=ki(this.phi,1e-6,Math.PI-1e-6),this}setFromVector3(r){return this.setFromCartesianCoords(r.x,r.y,r.z)}setFromCartesianCoords(r,l,h){return this.radius=Math.sqrt(r*r+l*l+h*h),this.radius===0?(this.theta=0,this.phi=0):(this.theta=Math.atan2(r,h),this.phi=Math.acos(ki(l/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}}class _w{constructor(r=1,l=0,h=0){this.radius=r,this.theta=l,this.y=h}set(r,l,h){return this.radius=r,this.theta=l,this.y=h,this}copy(r){return this.radius=r.radius,this.theta=r.theta,this.y=r.y,this}setFromVector3(r){return this.setFromCartesianCoords(r.x,r.y,r.z)}setFromCartesianCoords(r,l,h){return this.radius=Math.sqrt(r*r+h*h),this.theta=Math.atan2(r,h),this.y=l,this}clone(){return new this.constructor().copy(this)}}class q0{constructor(r,l,h,p){q0.prototype.isMatrix2=!0,this.elements=[1,0,0,1],r!==void 0&&this.set(r,l,h,p)}identity(){return this.set(1,0,0,1),this}fromArray(r,l=0){for(let h=0;h<4;h++)this.elements[h]=r[h+l];return this}set(r,l,h,p){const y=this.elements;return y[0]=r,y[2]=l,y[1]=h,y[3]=p,this}}const ww=new qi;class QE{constructor(r=new qi(1/0,1/0),l=new qi(-1/0,-1/0)){this.isBox2=!0,this.min=r,this.max=l}set(r,l){return this.min.copy(r),this.max.copy(l),this}setFromPoints(r){this.makeEmpty();for(let l=0,h=r.length;l<h;l++)this.expandByPoint(r[l]);return this}setFromCenterAndSize(r,l){const h=ww.copy(l).multiplyScalar(.5);return this.min.copy(r).sub(h),this.max.copy(r).add(h),this}clone(){return new this.constructor().copy(this)}copy(r){return this.min.copy(r.min),this.max.copy(r.max),this}makeEmpty(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y}getCenter(r){return this.isEmpty()?r.set(0,0):r.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(r){return this.isEmpty()?r.set(0,0):r.subVectors(this.max,this.min)}expandByPoint(r){return this.min.min(r),this.max.max(r),this}expandByVector(r){return this.min.sub(r),this.max.add(r),this}expandByScalar(r){return this.min.addScalar(-r),this.max.addScalar(r),this}containsPoint(r){return r.x>=this.min.x&&r.x<=this.max.x&&r.y>=this.min.y&&r.y<=this.max.y}containsBox(r){return this.min.x<=r.min.x&&r.max.x<=this.max.x&&this.min.y<=r.min.y&&r.max.y<=this.max.y}getParameter(r,l){return l.set((r.x-this.min.x)/(this.max.x-this.min.x),(r.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(r){return r.max.x>=this.min.x&&r.min.x<=this.max.x&&r.max.y>=this.min.y&&r.min.y<=this.max.y}clampPoint(r,l){return l.copy(r).clamp(this.min,this.max)}distanceToPoint(r){return this.clampPoint(r,ww).distanceTo(r)}intersect(r){return this.min.max(r.min),this.max.min(r.max),this.isEmpty()&&this.makeEmpty(),this}union(r){return this.min.min(r.min),this.max.max(r.max),this}translate(r){return this.min.add(r),this.max.add(r),this}equals(r){return r.min.equals(this.min)&&r.max.equals(this.max)}}const uy=new kn,cy=new kn,gp=new kn,Dg=new kn,Kx=new kn,$x=new kn,J0=new kn;class n0{constructor(r=new kn,l=new kn){this.start=r,this.end=l}set(r,l){return this.start.copy(r),this.end.copy(l),this}copy(r){return this.start.copy(r.start),this.end.copy(r.end),this}getCenter(r){return r.addVectors(this.start,this.end).multiplyScalar(.5)}delta(r){return r.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(r,l){return this.delta(l).multiplyScalar(r).add(this.start)}closestPointToPointParameter(r,l){uy.subVectors(r,this.start),cy.subVectors(this.end,this.start);const h=cy.dot(cy);let y=cy.dot(uy)/h;return l&&(y=ki(y,0,1)),y}closestPointToPoint(r,l,h){const p=this.closestPointToPointParameter(r,l);return this.delta(h).multiplyScalar(p).add(this.start)}distanceSqToLine3(r,l=$x,h=J0){const p=10000000000000001e-32;let y,T;const O=this.start,te=r.start,se=this.end,xe=r.end;gp.subVectors(se,O),Dg.subVectors(xe,te),Kx.subVectors(O,te);const Ne=gp.dot(gp),Ve=Dg.dot(Dg),We=Dg.dot(Kx);if(Ne<=p&&Ve<=p)return l.copy(O),h.copy(te),l.sub(h),l.dot(l);if(Ne<=p)y=0,T=We/Ve,T=ki(T,0,1);else{const tt=gp.dot(Kx);if(Ve<=p)T=0,y=ki(-tt/Ne,0,1);else{const Ot=gp.dot(Dg),An=Ne*Ve-Ot*Ot;An!==0?y=ki((Ot*We-tt*Ve)/An,0,1):y=0,T=(Ot*y+We)/Ve,T<0?(T=0,y=ki(-tt/Ne,0,1)):T>1&&(T=1,y=ki((Ot-tt)/Ne,0,1))}}return l.copy(O).add(gp.multiplyScalar(y)),h.copy(te).add(Dg.multiplyScalar(T)),l.sub(h),l.dot(l)}applyMatrix4(r){return this.start.applyMatrix4(r),this.end.applyMatrix4(r),this}equals(r){return r.start.equals(this.start)&&r.end.equals(this.end)}clone(){return new this.constructor().copy(this)}}const kg=new kn;class Xx extends null{constructor(r,l){super(),this.light=r,this.matrixAutoUpdate=!1,this.color=l,this.type="SpotLightHelper";const h=new Ui,p=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1];for(let T=0,O=1,te=32;T<te;T++,O++){const se=T/te*Math.PI*2,xe=O/te*Math.PI*2;p.push(Math.cos(se),Math.sin(se),1,Math.cos(xe),Math.sin(xe),1)}h.setAttribute("position",new ha(p,3));const y=new Wc({fog:!1,toneMapped:!1});this.cone=new nd(h,y),this.add(this.cone),this.update()}dispose(){this.cone.geometry.dispose(),this.cone.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.light.target.updateWorldMatrix(!0,!1),this.parent?(this.parent.updateWorldMatrix(!0),this.matrix.copy(this.parent.matrixWorld).invert().multiply(this.light.matrixWorld)):this.matrix.copy(this.light.matrixWorld),this.matrixWorld.copy(this.light.matrixWorld);const r=this.light.distance?this.light.distance:1e3,l=r*Math.tan(this.light.angle);this.cone.scale.set(l,l,r),kg.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(kg),this.color!==void 0?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)}}const qp=new kn,ev=new oi,jx=new oi;class Sw extends null{constructor(r){const l=Mw(r),h=new Ui,p=[],y=[];for(let se=0;se<l.length;se++){const xe=l[se];xe.parent&&xe.parent.isBone&&(p.push(0,0,0),p.push(0,0,0),y.push(0,0,0),y.push(0,0,0))}h.setAttribute("position",new ha(p,3)),h.setAttribute("color",new ha(y,3));const T=new Wc({vertexColors:!0,depthTest:!1,depthWrite:!1,toneMapped:!1,transparent:!0});super(h,T),this.isSkeletonHelper=!0,this.type="SkeletonHelper",this.root=r,this.bones=l,this.matrix=r.matrixWorld,this.matrixAutoUpdate=!1;const O=new Ea(255),te=new Ea(65280);this.setColors(O,te)}updateMatrixWorld(r){const l=this.bones,h=this.geometry,p=h.getAttribute("position");jx.copy(this.root.matrixWorld).invert();for(let y=0,T=0;y<l.length;y++){const O=l[y];O.parent&&O.parent.isBone&&(ev.multiplyMatrices(jx,O.matrixWorld),qp.setFromMatrixPosition(ev),p.setXYZ(T,qp.x,qp.y,qp.z),ev.multiplyMatrices(jx,O.parent.matrixWorld),qp.setFromMatrixPosition(ev),p.setXYZ(T+1,qp.x,qp.y,qp.z),T+=2)}h.getAttribute("position").needsUpdate=!0,super.updateMatrixWorld(r)}setColors(r,l){const p=this.geometry.getAttribute("color");for(let y=0;y<p.count;y+=2)p.setXYZ(y,r.r,r.g,r.b),p.setXYZ(y+1,l.r,l.g,l.b);return p.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}}function Mw(ue){const r=[];ue.isBone===!0&&r.push(ue);for(let l=0;l<ue.children.length;l++)r.push(...Mw(ue.children[l]));return r}class Vg extends null{constructor(r,l,h){const p=new hu(l,4,2),y=new Dh({wireframe:!0,fog:!1,toneMapped:!1});super(p,y),this.light=r,this.color=h,this.type="PointLightHelper",this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1,this.update()}dispose(){this.geometry.dispose(),this.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.color!==void 0?this.material.color.set(this.color):this.material.color.copy(this.light.color)}}const tv=new kn,nv=new Ea,Ew=new Ea;class Cw extends null{constructor(r,l,h){super(),this.light=r,this.matrix=r.matrixWorld,this.matrixAutoUpdate=!1,this.color=h,this.type="HemisphereLightHelper";const p=new So(l);p.rotateY(Math.PI*.5),this.material=new Dh({wireframe:!0,fog:!1,toneMapped:!1}),this.color===void 0&&(this.material.vertexColors=!0);const y=p.getAttribute("position"),T=new Float32Array(y.count*3);p.setAttribute("color",new Ql(T,3)),this.add(new zd(p,this.material)),this.update()}dispose(){this.children[0].geometry.dispose(),this.children[0].material.dispose()}update(){const r=this.children[0];if(this.color!==void 0)this.material.color.set(this.color);else{const l=r.geometry.getAttribute("color");nv.copy(this.light.color),Ew.copy(this.light.groundColor);for(let h=0,p=l.count;h<p;h++){const y=h<p/2?nv:Ew;l.setXYZ(h,y.r,y.g,y.b)}l.needsUpdate=!0}this.light.updateWorldMatrix(!0,!1),r.lookAt(tv.setFromMatrixPosition(this.light.matrixWorld).negate())}}class UP extends null{constructor(r=10,l=10,h=4473924,p=8947848){h=new Ea(h),p=new Ea(p);const y=l/2,T=r/l,O=r/2,te=[],se=[];for(let Ve=0,We=0,tt=-O;Ve<=l;Ve++,tt+=T){te.push(-O,0,tt,O,0,tt),te.push(tt,0,-O,tt,0,O);const Ot=Ve===y?h:p;Ot.toArray(se,We),We+=3,Ot.toArray(se,We),We+=3,Ot.toArray(se,We),We+=3,Ot.toArray(se,We),We+=3}const xe=new Ui;xe.setAttribute("position",new ha(te,3)),xe.setAttribute("color",new ha(se,3));const Ne=new Wc({vertexColors:!0,toneMapped:!1});super(xe,Ne),this.type="GridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}class WE extends null{constructor(r=10,l=16,h=8,p=64,y=4473924,T=8947848){y=new Ea(y),T=new Ea(T);const O=[],te=[];if(l>1)for(let Ne=0;Ne<l;Ne++){const Ve=Ne/l*(Math.PI*2),We=Math.sin(Ve)*r,tt=Math.cos(Ve)*r;O.push(0,0,0),O.push(We,0,tt);const Ot=Ne&1?y:T;te.push(Ot.r,Ot.g,Ot.b),te.push(Ot.r,Ot.g,Ot.b)}for(let Ne=0;Ne<h;Ne++){const Ve=Ne&1?y:T,We=r-r/h*Ne;for(let tt=0;tt<p;tt++){let Ot=tt/p*(Math.PI*2),An=Math.sin(Ot)*We,un=Math.cos(Ot)*We;O.push(An,0,un),te.push(Ve.r,Ve.g,Ve.b),Ot=(tt+1)/p*(Math.PI*2),An=Math.sin(Ot)*We,un=Math.cos(Ot)*We,O.push(An,0,un),te.push(Ve.r,Ve.g,Ve.b)}}const se=new Ui;se.setAttribute("position",new ha(O,3)),se.setAttribute("color",new ha(te,3));const xe=new Wc({vertexColors:!0,toneMapped:!1});super(se,xe),this.type="PolarGridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}const hy=new kn,r0=new kn,Tw=new kn;class OP extends null{constructor(r,l,h){super(),this.light=r,this.matrix=r.matrixWorld,this.matrixAutoUpdate=!1,this.color=h,this.type="DirectionalLightHelper",l===void 0&&(l=1);let p=new Ui;p.setAttribute("position",new ha([-l,l,0,l,l,0,l,-l,0,-l,-l,0,-l,l,0],3));const y=new Wc({fog:!1,toneMapped:!1});this.lightPlane=new fl(p,y),this.add(this.lightPlane),p=new Ui,p.setAttribute("position",new ha([0,0,0,0,0,1],3)),this.targetLine=new fl(p,y),this.add(this.targetLine),this.update()}dispose(){this.lightPlane.geometry.dispose(),this.lightPlane.material.dispose(),this.targetLine.geometry.dispose(),this.targetLine.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.light.target.updateWorldMatrix(!0,!1),hy.setFromMatrixPosition(this.light.matrixWorld),r0.setFromMatrixPosition(this.light.target.matrixWorld),Tw.subVectors(r0,hy),this.lightPlane.lookAt(r0),this.color!==void 0?(this.lightPlane.material.color.set(this.color),this.targetLine.material.color.set(this.color)):(this.lightPlane.material.color.copy(this.light.color),this.targetLine.material.color.copy(this.light.color)),this.targetLine.lookAt(r0),this.targetLine.scale.z=Tw.length()}}const dy=new kn,ec=new jf;class fy extends null{constructor(r){const l=new Ui,h=new Wc({color:16777215,vertexColors:!0,toneMapped:!1}),p=[],y=[],T={};O("n1","n2"),O("n2","n4"),O("n4","n3"),O("n3","n1"),O("f1","f2"),O("f2","f4"),O("f4","f3"),O("f3","f1"),O("n1","f1"),O("n2","f2"),O("n3","f3"),O("n4","f4"),O("p","n1"),O("p","n2"),O("p","n3"),O("p","n4"),O("u1","u2"),O("u2","u3"),O("u3","u1"),O("c","t"),O("p","c"),O("cn1","cn2"),O("cn3","cn4"),O("cf1","cf2"),O("cf3","cf4");function O(tt,Ot){te(tt),te(Ot)}function te(tt){p.push(0,0,0),y.push(0,0,0),T[tt]===void 0&&(T[tt]=[]),T[tt].push(p.length/3-1)}l.setAttribute("position",new ha(p,3)),l.setAttribute("color",new ha(y,3)),super(l,h),this.type="CameraHelper",this.camera=r,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=r.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=T,this.update();const se=new Ea(16755200),xe=new Ea(16711680),Ne=new Ea(43775),Ve=new Ea(16777215),We=new Ea(3355443);this.setColors(se,xe,Ne,Ve,We)}setColors(r,l,h,p,y){const O=this.geometry.getAttribute("color");return O.setXYZ(0,r.r,r.g,r.b),O.setXYZ(1,r.r,r.g,r.b),O.setXYZ(2,r.r,r.g,r.b),O.setXYZ(3,r.r,r.g,r.b),O.setXYZ(4,r.r,r.g,r.b),O.setXYZ(5,r.r,r.g,r.b),O.setXYZ(6,r.r,r.g,r.b),O.setXYZ(7,r.r,r.g,r.b),O.setXYZ(8,r.r,r.g,r.b),O.setXYZ(9,r.r,r.g,r.b),O.setXYZ(10,r.r,r.g,r.b),O.setXYZ(11,r.r,r.g,r.b),O.setXYZ(12,r.r,r.g,r.b),O.setXYZ(13,r.r,r.g,r.b),O.setXYZ(14,r.r,r.g,r.b),O.setXYZ(15,r.r,r.g,r.b),O.setXYZ(16,r.r,r.g,r.b),O.setXYZ(17,r.r,r.g,r.b),O.setXYZ(18,r.r,r.g,r.b),O.setXYZ(19,r.r,r.g,r.b),O.setXYZ(20,r.r,r.g,r.b),O.setXYZ(21,r.r,r.g,r.b),O.setXYZ(22,r.r,r.g,r.b),O.setXYZ(23,r.r,r.g,r.b),O.setXYZ(24,l.r,l.g,l.b),O.setXYZ(25,l.r,l.g,l.b),O.setXYZ(26,l.r,l.g,l.b),O.setXYZ(27,l.r,l.g,l.b),O.setXYZ(28,l.r,l.g,l.b),O.setXYZ(29,l.r,l.g,l.b),O.setXYZ(30,l.r,l.g,l.b),O.setXYZ(31,l.r,l.g,l.b),O.setXYZ(32,h.r,h.g,h.b),O.setXYZ(33,h.r,h.g,h.b),O.setXYZ(34,h.r,h.g,h.b),O.setXYZ(35,h.r,h.g,h.b),O.setXYZ(36,h.r,h.g,h.b),O.setXYZ(37,h.r,h.g,h.b),O.setXYZ(38,p.r,p.g,p.b),O.setXYZ(39,p.r,p.g,p.b),O.setXYZ(40,y.r,y.g,y.b),O.setXYZ(41,y.r,y.g,y.b),O.setXYZ(42,y.r,y.g,y.b),O.setXYZ(43,y.r,y.g,y.b),O.setXYZ(44,y.r,y.g,y.b),O.setXYZ(45,y.r,y.g,y.b),O.setXYZ(46,y.r,y.g,y.b),O.setXYZ(47,y.r,y.g,y.b),O.setXYZ(48,y.r,y.g,y.b),O.setXYZ(49,y.r,y.g,y.b),O.needsUpdate=!0,this}update(){const r=this.geometry,l=this.pointMap,h=1,p=1;let y,T;if(ec.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),this.camera.reversedDepth===!0)y=1,T=0;else if(this.camera.coordinateSystem===Cu)y=-1,T=1;else if(this.camera.coordinateSystem===zc)y=0,T=1;else throw new Error("THREE.CameraHelper.update(): Invalid coordinate system: "+this.camera.coordinateSystem);dc("c",l,r,ec,0,0,y),dc("t",l,r,ec,0,0,T),dc("n1",l,r,ec,-h,-p,y),dc("n2",l,r,ec,h,-p,y),dc("n3",l,r,ec,-h,p,y),dc("n4",l,r,ec,h,p,y),dc("f1",l,r,ec,-h,-p,T),dc("f2",l,r,ec,h,-p,T),dc("f3",l,r,ec,-h,p,T),dc("f4",l,r,ec,h,p,T),dc("u1",l,r,ec,h*.7,p*1.1,y),dc("u2",l,r,ec,-h*.7,p*1.1,y),dc("u3",l,r,ec,0,p*2,y),dc("cf1",l,r,ec,-h,0,T),dc("cf2",l,r,ec,h,0,T),dc("cf3",l,r,ec,0,-p,T),dc("cf4",l,r,ec,0,p,T),dc("cn1",l,r,ec,-h,0,y),dc("cn2",l,r,ec,h,0,y),dc("cn3",l,r,ec,0,-p,y),dc("cn4",l,r,ec,0,p,y),r.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}}function dc(ue,r,l,h,p,y,T){dy.set(p,y,T).unproject(h);const O=r[ue];if(O!==void 0){const te=l.getAttribute("position");for(let se=0,xe=O.length;se<xe;se++)te.setXYZ(O[se],dy.x,dy.y,dy.z)}}const Ay=new zi;class py extends null{constructor(r,l=16776960){const h=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),p=new Float32Array(8*3),y=new Ui;y.setIndex(new Ql(h,1)),y.setAttribute("position",new Ql(p,3)),super(y,new Wc({color:l,toneMapped:!1})),this.object=r,this.type="BoxHelper",this.matrixAutoUpdate=!1,this.update()}update(){if(this.object!==void 0&&Ay.setFromObject(this.object),Ay.isEmpty())return;const r=Ay.min,l=Ay.max,h=this.geometry.attributes.position,p=h.array;p[0]=l.x,p[1]=l.y,p[2]=l.z,p[3]=r.x,p[4]=l.y,p[5]=l.z,p[6]=r.x,p[7]=r.y,p[8]=l.z,p[9]=l.x,p[10]=r.y,p[11]=l.z,p[12]=l.x,p[13]=l.y,p[14]=r.z,p[15]=r.x,p[16]=l.y,p[17]=r.z,p[18]=r.x,p[19]=r.y,p[20]=r.z,p[21]=l.x,p[22]=r.y,p[23]=r.z,h.needsUpdate=!0,this.geometry.computeBoundingSphere()}setFromObject(r){return this.object=r,this.update(),this}copy(r,l){return super.copy(r,l),this.object=r.object,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class Bc extends null{constructor(r,l=16776960){const h=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),p=[1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1],y=new Ui;y.setIndex(new Ql(h,1)),y.setAttribute("position",new ha(p,3)),super(y,new Wc({color:l,toneMapped:!1})),this.box=r,this.type="Box3Helper",this.geometry.computeBoundingSphere()}updateMatrixWorld(r){const l=this.box;l.isEmpty()||(l.getCenter(this.position),l.getSize(this.scale),this.scale.multiplyScalar(.5),super.updateMatrixWorld(r))}dispose(){this.geometry.dispose(),this.material.dispose()}}class DP extends null{constructor(r,l=1,h=16776960){const p=h,y=[1,-1,0,-1,1,0,-1,-1,0,1,1,0,-1,1,0,-1,-1,0,1,-1,0,1,1,0],T=new Ui;T.setAttribute("position",new ha(y,3)),T.computeBoundingSphere(),super(T,new Wc({color:p,toneMapped:!1})),this.type="PlaneHelper",this.plane=r,this.size=l;const O=[1,1,0,-1,1,0,-1,-1,0,1,1,0,-1,-1,0,1,-1,0],te=new Ui;te.setAttribute("position",new ha(O,3)),te.computeBoundingSphere(),this.add(new zd(te,new Dh({color:p,opacity:.2,transparent:!0,depthWrite:!1,toneMapped:!1})))}updateMatrixWorld(r){this.position.set(0,0,0),this.scale.set(.5*this.size,.5*this.size,1),this.lookAt(this.plane.normal),this.translateZ(-this.plane.constant),super.updateMatrixWorld(r)}dispose(){this.geometry.dispose(),this.material.dispose(),this.children[0].geometry.dispose(),this.children[0].material.dispose()}}const fc=new kn;let zg,Yx;class kP extends null{constructor(r=new kn(0,0,1),l=new kn(0,0,0),h=1,p=16776960,y=h*.2,T=y*.2){super(),this.type="ArrowHelper",zg===void 0&&(zg=new Ui,zg.setAttribute("position",new ha([0,0,0,0,1,0],3)),Yx=new Us(.5,1,5,1),Yx.translate(0,-.5,0)),this.position.copy(l),this.line=new fl(zg,new Wc({color:p,toneMapped:!1})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new zd(Yx,new Dh({color:p,toneMapped:!1})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(r),this.setLength(h,y,T)}setDirection(r){if(r.y>.99999)this.quaternion.set(0,0,0,1);else if(r.y<-.99999)this.quaternion.set(1,0,0,0);else{fc.set(r.z,0,-r.x).normalize();const l=Math.acos(r.y);this.quaternion.setFromAxisAngle(fc,l)}}setLength(r,l=r*.2,h=l*.2){this.line.scale.set(1,Math.max(1e-4,r-l),1),this.line.updateMatrix(),this.cone.scale.set(h,l,h),this.cone.position.y=r,this.cone.updateMatrix()}setColor(r){this.line.material.color.set(r),this.cone.material.color.set(r)}copy(r){return super.copy(r,!1),this.line.copy(r.line),this.cone.copy(r.cone),this}dispose(){this.line.geometry.dispose(),this.line.material.dispose(),this.cone.geometry.dispose(),this.cone.material.dispose()}}class VP extends null{constructor(r=1){const l=[0,0,0,r,0,0,0,0,0,0,r,0,0,0,0,0,0,r],h=[1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],p=new Ui;p.setAttribute("position",new ha(l,3)),p.setAttribute("color",new ha(h,3));const y=new Wc({vertexColors:!0,toneMapped:!1});super(p,y),this.type="AxesHelper"}setColors(r,l,h){const p=new Ea,y=this.geometry.attributes.color.array;return p.set(r),p.toArray(y,0),p.toArray(y,3),p.set(l),p.toArray(y,6),p.toArray(y,9),p.set(h),p.toArray(y,12),p.toArray(y,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class Bw{constructor(){this.type="ShapePath",this.color=new Ea,this.subPaths=[],this.currentPath=null}moveTo(r,l){return this.currentPath=new wn,this.subPaths.push(this.currentPath),this.currentPath.moveTo(r,l),this}lineTo(r,l){return this.currentPath.lineTo(r,l),this}quadraticCurveTo(r,l,h,p){return this.currentPath.quadraticCurveTo(r,l,h,p),this}bezierCurveTo(r,l,h,p,y,T){return this.currentPath.bezierCurveTo(r,l,h,p,y,T),this}splineThru(r){return this.currentPath.splineThru(r),this}toShapes(r){function l(un){const Un=[];for(let Vn=0,nr=un.length;Vn<nr;Vn++){const ii=un[Vn],pi=new mn;pi.curves=ii.curves,Un.push(pi)}return Un}function h(un,Un){const Vn=Un.length;let nr=!1;for(let ii=Vn-1,pi=0;pi<Vn;ii=pi++){let Bi=Un[ii],mi=Un[pi],ls=mi.x-Bi.x,ys=mi.y-Bi.y;if(Math.abs(ys)>Number.EPSILON){if(ys<0&&(Bi=Un[pi],ls=-ls,mi=Un[ii],ys=-ys),un.y<Bi.y||un.y>mi.y)continue;if(un.y===Bi.y){if(un.x===Bi.x)return!0}else{const Da=ys*(un.x-Bi.x)-ls*(un.y-Bi.y);if(Da===0)return!0;if(Da<0)continue;nr=!nr}}else{if(un.y!==Bi.y)continue;if(mi.x<=un.x&&un.x<=Bi.x||Bi.x<=un.x&&un.x<=mi.x)return!0}}return nr}const p=bs.isClockWise,y=this.subPaths;if(y.length===0)return[];let T,O,te;const se=[];if(y.length===1)return O=y[0],te=new mn,te.curves=O.curves,se.push(te),se;let xe=!p(y[0].getPoints());xe=r?!xe:xe;const Ne=[],Ve=[];let We=[],tt=0,Ot;Ve[tt]=void 0,We[tt]=[];for(let un=0,Un=y.length;un<Un;un++)O=y[un],Ot=O.getPoints(),T=p(Ot),T=r?!T:T,T?(!xe&&Ve[tt]&&tt++,Ve[tt]={s:new mn,p:Ot},Ve[tt].s.curves=O.curves,xe&&tt++,We[tt]=[]):We[tt].push({h:O,p:Ot[0]});if(!Ve[0])return l(y);if(Ve.length>1){let un=!1,Un=0;for(let Vn=0,nr=Ve.length;Vn<nr;Vn++)Ne[Vn]=[];for(let Vn=0,nr=Ve.length;Vn<nr;Vn++){const ii=We[Vn];for(let pi=0;pi<ii.length;pi++){const Bi=ii[pi];let mi=!0;for(let ls=0;ls<Ve.length;ls++)h(Bi.p,Ve[ls].p)&&(Vn!==ls&&Un++,mi?(mi=!1,Ne[ls].push(Bi)):un=!0);mi&&Ne[Vn].push(Bi)}}Un>0&&un===!1&&(We=Ne)}let An;for(let un=0,Un=Ve.length;un<Un;un++){te=Ve[un].s,se.push(te),An=We[un];for(let Vn=0,nr=An.length;Vn<nr;Vn++)te.holes.push(An[Vn].h)}return se}}class gy extends null{constructor(r,l=null){super(),this.object=r,this.domElement=l,this.enabled=!0,this.state=-1,this.keys={},this.mouseButtons={LEFT:null,MIDDLE:null,RIGHT:null},this.touches={ONE:null,TWO:null}}connect(r){if(r===void 0){na("Controls: connect() now requires an element.");return}this.domElement!==null&&this.disconnect(),this.domElement=r}disconnect(){}dispose(){}update(){}}function my(ue,r){const l=ue.image&&ue.image.width?ue.image.width/ue.image.height:1;return l>r?(ue.repeat.x=1,ue.repeat.y=l/r,ue.offset.x=0,ue.offset.y=(1-ue.repeat.y)/2):(ue.repeat.x=r/l,ue.repeat.y=1,ue.offset.x=(1-ue.repeat.x)/2,ue.offset.y=0),ue}function ZE(ue,r){const l=ue.image&&ue.image.width?ue.image.width/ue.image.height:1;return l>r?(ue.repeat.x=r/l,ue.repeat.y=1,ue.offset.x=(1-ue.repeat.x)/2,ue.offset.y=0):(ue.repeat.x=1,ue.repeat.y=l/r,ue.offset.x=0,ue.offset.y=(1-ue.repeat.y)/2),ue}function KE(ue){return ue.repeat.x=1,ue.repeat.y=1,ue.offset.x=0,ue.offset.y=0,ue}function $E(ue,r,l,h){const p=rv(h);switch(l){case si:return ue*r;case z:return ue*r/p.components*p.byteLength;case ie:return ue*r/p.components*p.byteLength;case ze:return ue*r*2/p.components*p.byteLength;case Je:return ue*r*2/p.components*p.byteLength;case Ie:return ue*r*3/p.components*p.byteLength;case L:return ue*r*4/p.components*p.byteLength;case xt:return ue*r*4/p.components*p.byteLength;case Sn:case Oe:return Math.floor((ue+3)/4)*Math.floor((r+3)/4)*8;case Qe:case Re:return Math.floor((ue+3)/4)*Math.floor((r+3)/4)*16;case gt:case yt:return Math.max(ue,16)*Math.max(r,8)/4;case Ke:case tn:return Math.max(ue,8)*Math.max(r,8)/2;case Yt:case Rn:return Math.floor((ue+3)/4)*Math.floor((r+3)/4)*8;case er:return Math.floor((ue+3)/4)*Math.floor((r+3)/4)*16;case Jn:return Math.floor((ue+3)/4)*Math.floor((r+3)/4)*16;case kr:return Math.floor((ue+4)/5)*Math.floor((r+3)/4)*16;case fr:return Math.floor((ue+4)/5)*Math.floor((r+4)/5)*16;case wr:return Math.floor((ue+5)/6)*Math.floor((r+4)/5)*16;case ei:return Math.floor((ue+5)/6)*Math.floor((r+5)/6)*16;case _n:return Math.floor((ue+7)/8)*Math.floor((r+4)/5)*16;case jn:return Math.floor((ue+7)/8)*Math.floor((r+5)/6)*16;case Hr:return Math.floor((ue+7)/8)*Math.floor((r+7)/8)*16;case Pr:return Math.floor((ue+9)/10)*Math.floor((r+4)/5)*16;case $i:return Math.floor((ue+9)/10)*Math.floor((r+5)/6)*16;case Zi:return Math.floor((ue+9)/10)*Math.floor((r+7)/8)*16;case Xi:return Math.floor((ue+9)/10)*Math.floor((r+9)/10)*16;case Ei:return Math.floor((ue+11)/12)*Math.floor((r+9)/10)*16;case ms:return Math.floor((ue+11)/12)*Math.floor((r+11)/12)*16;case _i:case Es:case ua:return Math.ceil(ue/4)*Math.ceil(r/4)*16;case Hn:case Pt:return Math.ceil(ue/4)*Math.ceil(r/4)*8;case Gt:case Bt:return Math.ceil(ue/4)*Math.ceil(r/4)*16}throw new Error(`Unable to determine texture byte length for ${l} format.`)}function rv(ue){switch(ue){case es:case Ci:return{byteLength:1,components:1};case rn:case En:case Wt:return{byteLength:2,components:1};case bn:case Jt:return{byteLength:2,components:4};case st:case Xt:case dt:return{byteLength:4,components:1};case rr:case Kr:return{byteLength:4,components:3}}throw new Error(`Unknown texture type ${ue}.`)}class XE{static contain(r,l){return my(r,l)}static cover(r,l){return ZE(r,l)}static fill(r){return KE(r)}static getByteLength(r,l,h,p){return $E(r,l,h,p)}}typeof __THREE_DEVTOOLS__!="undefined"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:m}})),typeof window!="undefined"&&(window.__THREE__?na("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=m)},23097:function(Be,Me,b){"use strict";b.d(Me,{Z:function(){return N}});function m(pe){"@babel/helpers - typeof";return m=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(Ae){return typeof Ae}:function(Ae){return Ae&&typeof Symbol=="function"&&Ae.constructor===Symbol&&Ae!==Symbol.prototype?"symbol":typeof Ae},m(pe)}var Z=/^\s+/,V=/\s+$/;function N(pe,Ae){if(pe=pe||"",Ae=Ae||{},pe instanceof N)return pe;if(!(this instanceof N))return new N(pe,Ae);var Pe=E(pe);this._originalInput=pe,this._r=Pe.r,this._g=Pe.g,this._b=Pe.b,this._a=Pe.a,this._roundA=Math.round(100*this._a)/100,this._format=Ae.format||Pe.format,this._gradientType=Ae.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=Pe.ok}N.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 Ae=this.toRgb();return(Ae.r*299+Ae.g*587+Ae.b*114)/1e3},getLuminance:function(){var Ae=this.toRgb(),Pe,Ut,jt,ft,on,hn;return Pe=Ae.r/255,Ut=Ae.g/255,jt=Ae.b/255,Pe<=.03928?ft=Pe/12.92:ft=Math.pow((Pe+.055)/1.055,2.4),Ut<=.03928?on=Ut/12.92:on=Math.pow((Ut+.055)/1.055,2.4),jt<=.03928?hn=jt/12.92:hn=Math.pow((jt+.055)/1.055,2.4),.2126*ft+.7152*on+.0722*hn},setAlpha:function(Ae){return this._a=In(Ae),this._roundA=Math.round(100*this._a)/100,this},toHsv:function(){var Ae=H(this._r,this._g,this._b);return{h:Ae.h*360,s:Ae.s,v:Ae.v,a:this._a}},toHsvString:function(){var Ae=H(this._r,this._g,this._b),Pe=Math.round(Ae.h*360),Ut=Math.round(Ae.s*100),jt=Math.round(Ae.v*100);return this._a==1?"hsv("+Pe+", "+Ut+"%, "+jt+"%)":"hsva("+Pe+", "+Ut+"%, "+jt+"%, "+this._roundA+")"},toHsl:function(){var Ae=C(this._r,this._g,this._b);return{h:Ae.h*360,s:Ae.s,l:Ae.l,a:this._a}},toHslString:function(){var Ae=C(this._r,this._g,this._b),Pe=Math.round(Ae.h*360),Ut=Math.round(Ae.s*100),jt=Math.round(Ae.l*100);return this._a==1?"hsl("+Pe+", "+Ut+"%, "+jt+"%)":"hsla("+Pe+", "+Ut+"%, "+jt+"%, "+this._roundA+")"},toHex:function(Ae){return X(this._r,this._g,this._b,Ae)},toHexString:function(Ae){return"#"+this.toHex(Ae)},toHex8:function(Ae){return j(this._r,this._g,this._b,this._a,Ae)},toHex8String:function(Ae){return"#"+this.toHex8(Ae)},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(zn(this._r,255)*100)+"%",g:Math.round(zn(this._g,255)*100)+"%",b:Math.round(zn(this._b,255)*100)+"%",a:this._a}},toPercentageRgbString:function(){return this._a==1?"rgb("+Math.round(zn(this._r,255)*100)+"%, "+Math.round(zn(this._g,255)*100)+"%, "+Math.round(zn(this._b,255)*100)+"%)":"rgba("+Math.round(zn(this._r,255)*100)+"%, "+Math.round(zn(this._g,255)*100)+"%, "+Math.round(zn(this._b,255)*100)+"%, "+this._roundA+")"},toName:function(){return this._a===0?"transparent":this._a<1?!1:Wn[X(this._r,this._g,this._b,!0)]||!1},toFilter:function(Ae){var Pe="#"+de(this._r,this._g,this._b,this._a),Ut=Pe,jt=this._gradientType?"GradientType = 1, ":"";if(Ae){var ft=N(Ae);Ut="#"+de(ft._r,ft._g,ft._b,ft._a)}return"progid:DXImageTransform.Microsoft.gradient("+jt+"startColorstr="+Pe+",endColorstr="+Ut+")"},toString:function(Ae){var Pe=!!Ae;Ae=Ae||this._format;var Ut=!1,jt=this._a<1&&this._a>=0,ft=!Pe&&jt&&(Ae==="hex"||Ae==="hex6"||Ae==="hex3"||Ae==="hex4"||Ae==="hex8"||Ae==="name");return ft?Ae==="name"&&this._a===0?this.toName():this.toRgbString():(Ae==="rgb"&&(Ut=this.toRgbString()),Ae==="prgb"&&(Ut=this.toPercentageRgbString()),(Ae==="hex"||Ae==="hex6")&&(Ut=this.toHexString()),Ae==="hex3"&&(Ut=this.toHexString(!0)),Ae==="hex4"&&(Ut=this.toHex8String(!0)),Ae==="hex8"&&(Ut=this.toHex8String()),Ae==="name"&&(Ut=this.toName()),Ae==="hsl"&&(Ut=this.toHslString()),Ae==="hsv"&&(Ut=this.toHsvString()),Ut||this.toHexString())},clone:function(){return N(this.toString())},_applyModification:function(Ae,Pe){var Ut=Ae.apply(null,[this].concat([].slice.call(Pe)));return this._r=Ut._r,this._g=Ut._g,this._b=Ut._b,this.setAlpha(Ut._a),this},lighten:function(){return this._applyModification(Ee,arguments)},brighten:function(){return this._applyModification($e,arguments)},darken:function(){return this._applyModification(Fe,arguments)},desaturate:function(){return this._applyModification(he,arguments)},saturate:function(){return this._applyModification(we,arguments)},greyscale:function(){return this._applyModification(ve,arguments)},spin:function(){return this._applyModification(ct,arguments)},_applyCombination:function(Ae,Pe){return Ae.apply(null,[this].concat([].slice.call(Pe)))},analogous:function(){return this._applyCombination(It,arguments)},complement:function(){return this._applyCombination(vt,arguments)},monochromatic:function(){return this._applyCombination(Bn,arguments)},splitcomplement:function(){return this._applyCombination(kt,arguments)},triad:function(){return this._applyCombination(at,[3])},tetrad:function(){return this._applyCombination(at,[4])}},N.fromRatio=function(pe,Ae){if(m(pe)=="object"){var Pe={};for(var Ut in pe)pe.hasOwnProperty(Ut)&&(Ut==="a"?Pe[Ut]=pe[Ut]:Pe[Ut]=On(pe[Ut]));pe=Pe}return N(pe,Ae)};function E(pe){var Ae={r:0,g:0,b:0},Pe=1,Ut=null,jt=null,ft=null,on=!1,hn=!1;return typeof pe=="string"&&(pe=Mt(pe)),m(pe)=="object"&&(Cn(pe.r)&&Cn(pe.g)&&Cn(pe.b)?(Ae=F(pe.r,pe.g,pe.b),on=!0,hn=String(pe.r).substr(-1)==="%"?"prgb":"rgb"):Cn(pe.h)&&Cn(pe.s)&&Cn(pe.v)?(Ut=On(pe.s),jt=On(pe.v),Ae=D(pe.h,Ut,jt),on=!0,hn="hsv"):Cn(pe.h)&&Cn(pe.s)&&Cn(pe.l)&&(Ut=On(pe.s),ft=On(pe.l),Ae=P(pe.h,Ut,ft),on=!0,hn="hsl"),pe.hasOwnProperty("a")&&(Pe=pe.a)),Pe=In(Pe),{ok:on,format:pe.format||hn,r:Math.min(255,Math.max(Ae.r,0)),g:Math.min(255,Math.max(Ae.g,0)),b:Math.min(255,Math.max(Ae.b,0)),a:Pe}}function F(pe,Ae,Pe){return{r:zn(pe,255)*255,g:zn(Ae,255)*255,b:zn(Pe,255)*255}}function C(pe,Ae,Pe){pe=zn(pe,255),Ae=zn(Ae,255),Pe=zn(Pe,255);var Ut=Math.max(pe,Ae,Pe),jt=Math.min(pe,Ae,Pe),ft,on,hn=(Ut+jt)/2;if(Ut==jt)ft=on=0;else{var lt=Ut-jt;switch(on=hn>.5?lt/(2-Ut-jt):lt/(Ut+jt),Ut){case pe:ft=(Ae-Pe)/lt+(Ae<Pe?6:0);break;case Ae:ft=(Pe-pe)/lt+2;break;case Pe:ft=(pe-Ae)/lt+4;break}ft/=6}return{h:ft,s:on,l:hn}}function P(pe,Ae,Pe){var Ut,jt,ft;pe=zn(pe,360),Ae=zn(Ae,100),Pe=zn(Pe,100);function on(Ct,sn,W){return W<0&&(W+=1),W>1&&(W-=1),W<1/6?Ct+(sn-Ct)*6*W:W<1/2?sn:W<2/3?Ct+(sn-Ct)*(2/3-W)*6:Ct}if(Ae===0)Ut=jt=ft=Pe;else{var hn=Pe<.5?Pe*(1+Ae):Pe+Ae-Pe*Ae,lt=2*Pe-hn;Ut=on(lt,hn,pe+1/3),jt=on(lt,hn,pe),ft=on(lt,hn,pe-1/3)}return{r:Ut*255,g:jt*255,b:ft*255}}function H(pe,Ae,Pe){pe=zn(pe,255),Ae=zn(Ae,255),Pe=zn(Pe,255);var Ut=Math.max(pe,Ae,Pe),jt=Math.min(pe,Ae,Pe),ft,on,hn=Ut,lt=Ut-jt;if(on=Ut===0?0:lt/Ut,Ut==jt)ft=0;else{switch(Ut){case pe:ft=(Ae-Pe)/lt+(Ae<Pe?6:0);break;case Ae:ft=(Pe-pe)/lt+2;break;case Pe:ft=(pe-Ae)/lt+4;break}ft/=6}return{h:ft,s:on,v:hn}}function D(pe,Ae,Pe){pe=zn(pe,360)*6,Ae=zn(Ae,100),Pe=zn(Pe,100);var Ut=Math.floor(pe),jt=pe-Ut,ft=Pe*(1-Ae),on=Pe*(1-jt*Ae),hn=Pe*(1-(1-jt)*Ae),lt=Ut%6,Ct=[Pe,on,ft,ft,hn,Pe][lt],sn=[hn,Pe,Pe,on,ft,ft][lt],W=[ft,ft,hn,Pe,Pe,on][lt];return{r:Ct*255,g:sn*255,b:W*255}}function X(pe,Ae,Pe,Ut){var jt=[Tt(Math.round(pe).toString(16)),Tt(Math.round(Ae).toString(16)),Tt(Math.round(Pe).toString(16))];return Ut&&jt[0].charAt(0)==jt[0].charAt(1)&&jt[1].charAt(0)==jt[1].charAt(1)&&jt[2].charAt(0)==jt[2].charAt(1)?jt[0].charAt(0)+jt[1].charAt(0)+jt[2].charAt(0):jt.join("")}function j(pe,Ae,Pe,Ut,jt){var ft=[Tt(Math.round(pe).toString(16)),Tt(Math.round(Ae).toString(16)),Tt(Math.round(Pe).toString(16)),Tt(Vr(Ut))];return jt&&ft[0].charAt(0)==ft[0].charAt(1)&&ft[1].charAt(0)==ft[1].charAt(1)&&ft[2].charAt(0)==ft[2].charAt(1)&&ft[3].charAt(0)==ft[3].charAt(1)?ft[0].charAt(0)+ft[1].charAt(0)+ft[2].charAt(0)+ft[3].charAt(0):ft.join("")}function de(pe,Ae,Pe,Ut){var jt=[Tt(Vr(Ut)),Tt(Math.round(pe).toString(16)),Tt(Math.round(Ae).toString(16)),Tt(Math.round(Pe).toString(16))];return jt.join("")}N.equals=function(pe,Ae){return!pe||!Ae?!1:N(pe).toRgbString()==N(Ae).toRgbString()},N.random=function(){return N.fromRatio({r:Math.random(),g:Math.random(),b:Math.random()})};function he(pe,Ae){Ae=Ae===0?0:Ae||10;var Pe=N(pe).toHsl();return Pe.s-=Ae/100,Pe.s=dr(Pe.s),N(Pe)}function we(pe,Ae){Ae=Ae===0?0:Ae||10;var Pe=N(pe).toHsl();return Pe.s+=Ae/100,Pe.s=dr(Pe.s),N(Pe)}function ve(pe){return N(pe).desaturate(100)}function Ee(pe,Ae){Ae=Ae===0?0:Ae||10;var Pe=N(pe).toHsl();return Pe.l+=Ae/100,Pe.l=dr(Pe.l),N(Pe)}function $e(pe,Ae){Ae=Ae===0?0:Ae||10;var Pe=N(pe).toRgb();return Pe.r=Math.max(0,Math.min(255,Pe.r-Math.round(255*-(Ae/100)))),Pe.g=Math.max(0,Math.min(255,Pe.g-Math.round(255*-(Ae/100)))),Pe.b=Math.max(0,Math.min(255,Pe.b-Math.round(255*-(Ae/100)))),N(Pe)}function Fe(pe,Ae){Ae=Ae===0?0:Ae||10;var Pe=N(pe).toHsl();return Pe.l-=Ae/100,Pe.l=dr(Pe.l),N(Pe)}function ct(pe,Ae){var Pe=N(pe).toHsl(),Ut=(Pe.h+Ae)%360;return Pe.h=Ut<0?360+Ut:Ut,N(Pe)}function vt(pe){var Ae=N(pe).toHsl();return Ae.h=(Ae.h+180)%360,N(Ae)}function at(pe,Ae){if(isNaN(Ae)||Ae<=0)throw new Error("Argument to polyad must be a positive number");for(var Pe=N(pe).toHsl(),Ut=[N(pe)],jt=360/Ae,ft=1;ft<Ae;ft++)Ut.push(N({h:(Pe.h+ft*jt)%360,s:Pe.s,l:Pe.l}));return Ut}function kt(pe){var Ae=N(pe).toHsl(),Pe=Ae.h;return[N(pe),N({h:(Pe+72)%360,s:Ae.s,l:Ae.l}),N({h:(Pe+216)%360,s:Ae.s,l:Ae.l})]}function It(pe,Ae,Pe){Ae=Ae||6,Pe=Pe||30;var Ut=N(pe).toHsl(),jt=360/Pe,ft=[N(pe)];for(Ut.h=(Ut.h-(jt*Ae>>1)+720)%360;--Ae;)Ut.h=(Ut.h+jt)%360,ft.push(N(Ut));return ft}function Bn(pe,Ae){Ae=Ae||6;for(var Pe=N(pe).toHsv(),Ut=Pe.h,jt=Pe.s,ft=Pe.v,on=[],hn=1/Ae;Ae--;)on.push(N({h:Ut,s:jt,v:ft})),ft=(ft+hn)%1;return on}N.mix=function(pe,Ae,Pe){Pe=Pe===0?0:Pe||50;var Ut=N(pe).toRgb(),jt=N(Ae).toRgb(),ft=Pe/100,on={r:(jt.r-Ut.r)*ft+Ut.r,g:(jt.g-Ut.g)*ft+Ut.g,b:(jt.b-Ut.b)*ft+Ut.b,a:(jt.a-Ut.a)*ft+Ut.a};return N(on)},N.readability=function(pe,Ae){var Pe=N(pe),Ut=N(Ae);return(Math.max(Pe.getLuminance(),Ut.getLuminance())+.05)/(Math.min(Pe.getLuminance(),Ut.getLuminance())+.05)},N.isReadable=function(pe,Ae,Pe){var Ut=N.readability(pe,Ae),jt,ft;switch(ft=!1,jt=Et(Pe),jt.level+jt.size){case"AAsmall":case"AAAlarge":ft=Ut>=4.5;break;case"AAlarge":ft=Ut>=3;break;case"AAAsmall":ft=Ut>=7;break}return ft},N.mostReadable=function(pe,Ae,Pe){var Ut=null,jt=0,ft,on,hn,lt;Pe=Pe||{},on=Pe.includeFallbackColors,hn=Pe.level,lt=Pe.size;for(var Ct=0;Ct<Ae.length;Ct++)ft=N.readability(pe,Ae[Ct]),ft>jt&&(jt=ft,Ut=N(Ae[Ct]));return N.isReadable(pe,Ut,{level:hn,size:lt})||!on?Ut:(Pe.includeFallbackColors=!1,N.mostReadable(pe,["#fff","#000"],Pe))};var Lt=N.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"},Wn=N.hexNames=Xn(Lt);function Xn(pe){var Ae={};for(var Pe in pe)pe.hasOwnProperty(Pe)&&(Ae[pe[Pe]]=Pe);return Ae}function In(pe){return pe=parseFloat(pe),(isNaN(pe)||pe<0||pe>1)&&(pe=1),pe}function zn(pe,Ae){_r(pe)&&(pe="100%");var Pe=Ge(pe);return pe=Math.min(Ae,Math.max(0,parseFloat(pe))),Pe&&(pe=parseInt(pe*Ae,10)/100),Math.abs(pe-Ae)<1e-6?1:pe%Ae/parseFloat(Ae)}function dr(pe){return Math.min(1,Math.max(0,pe))}function vn(pe){return parseInt(pe,16)}function _r(pe){return typeof pe=="string"&&pe.indexOf(".")!=-1&&parseFloat(pe)===1}function Ge(pe){return typeof pe=="string"&&pe.indexOf("%")!=-1}function Tt(pe){return pe.length==1?"0"+pe:""+pe}function On(pe){return pe<=1&&(pe=pe*100+"%"),pe}function Vr(pe){return Math.round(parseFloat(pe)*255).toString(16)}function en(pe){return vn(pe)/255}var ln=function(){var pe="[-\\+]?\\d+%?",Ae="[-\\+]?\\d*\\.\\d+%?",Pe="(?:"+Ae+")|(?:"+pe+")",Ut="[\\s|\\(]+("+Pe+")[,|\\s]+("+Pe+")[,|\\s]+("+Pe+")\\s*\\)?",jt="[\\s|\\(]+("+Pe+")[,|\\s]+("+Pe+")[,|\\s]+("+Pe+")[,|\\s]+("+Pe+")\\s*\\)?";return{CSS_UNIT:new RegExp(Pe),rgb:new RegExp("rgb"+Ut),rgba:new RegExp("rgba"+jt),hsl:new RegExp("hsl"+Ut),hsla:new RegExp("hsla"+jt),hsv:new RegExp("hsv"+Ut),hsva:new RegExp("hsva"+jt),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 Cn(pe){return!!ln.CSS_UNIT.exec(pe)}function Mt(pe){pe=pe.replace(Z,"").replace(V,"").toLowerCase();var Ae=!1;if(Lt[pe])pe=Lt[pe],Ae=!0;else if(pe=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var Pe;return(Pe=ln.rgb.exec(pe))?{r:Pe[1],g:Pe[2],b:Pe[3]}:(Pe=ln.rgba.exec(pe))?{r:Pe[1],g:Pe[2],b:Pe[3],a:Pe[4]}:(Pe=ln.hsl.exec(pe))?{h:Pe[1],s:Pe[2],l:Pe[3]}:(Pe=ln.hsla.exec(pe))?{h:Pe[1],s:Pe[2],l:Pe[3],a:Pe[4]}:(Pe=ln.hsv.exec(pe))?{h:Pe[1],s:Pe[2],v:Pe[3]}:(Pe=ln.hsva.exec(pe))?{h:Pe[1],s:Pe[2],v:Pe[3],a:Pe[4]}:(Pe=ln.hex8.exec(pe))?{r:vn(Pe[1]),g:vn(Pe[2]),b:vn(Pe[3]),a:en(Pe[4]),format:Ae?"name":"hex8"}:(Pe=ln.hex6.exec(pe))?{r:vn(Pe[1]),g:vn(Pe[2]),b:vn(Pe[3]),format:Ae?"name":"hex"}:(Pe=ln.hex4.exec(pe))?{r:vn(Pe[1]+""+Pe[1]),g:vn(Pe[2]+""+Pe[2]),b:vn(Pe[3]+""+Pe[3]),a:en(Pe[4]+""+Pe[4]),format:Ae?"name":"hex8"}:(Pe=ln.hex3.exec(pe))?{r:vn(Pe[1]+""+Pe[1]),g:vn(Pe[2]+""+Pe[2]),b:vn(Pe[3]+""+Pe[3]),format:Ae?"name":"hex"}:!1}function Et(pe){var Ae,Pe;return pe=pe||{level:"AA",size:"small"},Ae=(pe.level||"AA").toUpperCase(),Pe=(pe.size||"small").toLowerCase(),Ae!=="AA"&&Ae!=="AAA"&&(Ae="AA"),Pe!=="small"&&Pe!=="large"&&(Pe="small"),{level:Ae,size:Pe}}},80813:function(Be,Me,b){"use strict";b.d(Me,{CR:function(){return Ee},Jh:function(){return de},Q_:function(){return zn},XA:function(){return ve},ZT:function(){return Z},_T:function(){return N},ev:function(){return ct},mG:function(){return j},pi:function(){return V},pr:function(){return Fe}});var m=function(en,ln){return m=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(Cn,Mt){Cn.__proto__=Mt}||function(Cn,Mt){for(var Et in Mt)Object.prototype.hasOwnProperty.call(Mt,Et)&&(Cn[Et]=Mt[Et])},m(en,ln)};function Z(en,ln){if(typeof ln!="function"&&ln!==null)throw new TypeError("Class extends value "+String(ln)+" is not a constructor or null");m(en,ln);function Cn(){this.constructor=en}en.prototype=ln===null?Object.create(ln):(Cn.prototype=ln.prototype,new Cn)}var V=function(){return V=Object.assign||function(ln){for(var Cn,Mt=1,Et=arguments.length;Mt<Et;Mt++){Cn=arguments[Mt];for(var pe in Cn)Object.prototype.hasOwnProperty.call(Cn,pe)&&(ln[pe]=Cn[pe])}return ln},V.apply(this,arguments)};function N(en,ln){var Cn={};for(var Mt in en)Object.prototype.hasOwnProperty.call(en,Mt)&&ln.indexOf(Mt)<0&&(Cn[Mt]=en[Mt]);if(en!=null&&typeof Object.getOwnPropertySymbols=="function")for(var Et=0,Mt=Object.getOwnPropertySymbols(en);Et<Mt.length;Et++)ln.indexOf(Mt[Et])<0&&Object.prototype.propertyIsEnumerable.call(en,Mt[Et])&&(Cn[Mt[Et]]=en[Mt[Et]]);return Cn}function E(en,ln,Cn,Mt){var Et=arguments.length,pe=Et<3?ln:Mt===null?Mt=Object.getOwnPropertyDescriptor(ln,Cn):Mt,Ae;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")pe=Reflect.decorate(en,ln,Cn,Mt);else for(var Pe=en.length-1;Pe>=0;Pe--)(Ae=en[Pe])&&(pe=(Et<3?Ae(pe):Et>3?Ae(ln,Cn,pe):Ae(ln,Cn))||pe);return Et>3&&pe&&Object.defineProperty(ln,Cn,pe),pe}function F(en,ln){return function(Cn,Mt){ln(Cn,Mt,en)}}function C(en,ln,Cn,Mt,Et,pe){function Ae(Se){if(Se!==void 0&&typeof Se!="function")throw new TypeError("Function expected");return Se}for(var Pe=Mt.kind,Ut=Pe==="getter"?"get":Pe==="setter"?"set":"value",jt=!ln&&en?Mt.static?en:en.prototype:null,ft=ln||(jt?Object.getOwnPropertyDescriptor(jt,Mt.name):{}),on,hn=!1,lt=Cn.length-1;lt>=0;lt--){var Ct={};for(var sn in Mt)Ct[sn]=sn==="access"?{}:Mt[sn];for(var sn in Mt.access)Ct.access[sn]=Mt.access[sn];Ct.addInitializer=function(Se){if(hn)throw new TypeError("Cannot add initializers after decoration has completed");pe.push(Ae(Se||null))};var W=(0,Cn[lt])(Pe==="accessor"?{get:ft.get,set:ft.set}:ft[Ut],Ct);if(Pe==="accessor"){if(W===void 0)continue;if(W===null||typeof W!="object")throw new TypeError("Object expected");(on=Ae(W.get))&&(ft.get=on),(on=Ae(W.set))&&(ft.set=on),(on=Ae(W.init))&&Et.unshift(on)}else(on=Ae(W))&&(Pe==="field"?Et.unshift(on):ft[Ut]=on)}jt&&Object.defineProperty(jt,Mt.name,ft),hn=!0}function P(en,ln,Cn){for(var Mt=arguments.length>2,Et=0;Et<ln.length;Et++)Cn=Mt?ln[Et].call(en,Cn):ln[Et].call(en);return Mt?Cn:void 0}function H(en){return typeof en=="symbol"?en:"".concat(en)}function D(en,ln,Cn){return typeof ln=="symbol"&&(ln=ln.description?"[".concat(ln.description,"]"):""),Object.defineProperty(en,"name",{configurable:!0,value:Cn?"".concat(Cn," ",ln):ln})}function X(en,ln){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(en,ln)}function j(en,ln,Cn,Mt){function Et(pe){return pe instanceof Cn?pe:new Cn(function(Ae){Ae(pe)})}return new(Cn||(Cn=Promise))(function(pe,Ae){function Pe(ft){try{jt(Mt.next(ft))}catch(on){Ae(on)}}function Ut(ft){try{jt(Mt.throw(ft))}catch(on){Ae(on)}}function jt(ft){ft.done?pe(ft.value):Et(ft.value).then(Pe,Ut)}jt((Mt=Mt.apply(en,ln||[])).next())})}function de(en,ln){var Cn={label:0,sent:function(){if(pe[0]&1)throw pe[1];return pe[1]},trys:[],ops:[]},Mt,Et,pe,Ae=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return Ae.next=Pe(0),Ae.throw=Pe(1),Ae.return=Pe(2),typeof Symbol=="function"&&(Ae[Symbol.iterator]=function(){return this}),Ae;function Pe(jt){return function(ft){return Ut([jt,ft])}}function Ut(jt){if(Mt)throw new TypeError("Generator is already executing.");for(;Ae&&(Ae=0,jt[0]&&(Cn=0)),Cn;)try{if(Mt=1,Et&&(pe=jt[0]&2?Et.return:jt[0]?Et.throw||((pe=Et.return)&&pe.call(Et),0):Et.next)&&!(pe=pe.call(Et,jt[1])).done)return pe;switch(Et=0,pe&&(jt=[jt[0]&2,pe.value]),jt[0]){case 0:case 1:pe=jt;break;case 4:return Cn.label++,{value:jt[1],done:!1};case 5:Cn.label++,Et=jt[1],jt=[0];continue;case 7:jt=Cn.ops.pop(),Cn.trys.pop();continue;default:if(pe=Cn.trys,!(pe=pe.length>0&&pe[pe.length-1])&&(jt[0]===6||jt[0]===2)){Cn=0;continue}if(jt[0]===3&&(!pe||jt[1]>pe[0]&&jt[1]<pe[3])){Cn.label=jt[1];break}if(jt[0]===6&&Cn.label<pe[1]){Cn.label=pe[1],pe=jt;break}if(pe&&Cn.label<pe[2]){Cn.label=pe[2],Cn.ops.push(jt);break}pe[2]&&Cn.ops.pop(),Cn.trys.pop();continue}jt=ln.call(en,Cn)}catch(ft){jt=[6,ft],Et=0}finally{Mt=pe=0}if(jt[0]&5)throw jt[1];return{value:jt[0]?jt[1]:void 0,done:!0}}}var he=Object.create?function(en,ln,Cn,Mt){Mt===void 0&&(Mt=Cn);var Et=Object.getOwnPropertyDescriptor(ln,Cn);(!Et||("get"in Et?!ln.__esModule:Et.writable||Et.configurable))&&(Et={enumerable:!0,get:function(){return ln[Cn]}}),Object.defineProperty(en,Mt,Et)}:function(en,ln,Cn,Mt){Mt===void 0&&(Mt=Cn),en[Mt]=ln[Cn]};function we(en,ln){for(var Cn in en)Cn!=="default"&&!Object.prototype.hasOwnProperty.call(ln,Cn)&&he(ln,en,Cn)}function ve(en){var ln=typeof Symbol=="function"&&Symbol.iterator,Cn=ln&&en[ln],Mt=0;if(Cn)return Cn.call(en);if(en&&typeof en.length=="number")return{next:function(){return en&&Mt>=en.length&&(en=void 0),{value:en&&en[Mt++],done:!en}}};throw new TypeError(ln?"Object is not iterable.":"Symbol.iterator is not defined.")}function Ee(en,ln){var Cn=typeof Symbol=="function"&&en[Symbol.iterator];if(!Cn)return en;var Mt=Cn.call(en),Et,pe=[],Ae;try{for(;(ln===void 0||ln-- >0)&&!(Et=Mt.next()).done;)pe.push(Et.value)}catch(Pe){Ae={error:Pe}}finally{try{Et&&!Et.done&&(Cn=Mt.return)&&Cn.call(Mt)}finally{if(Ae)throw Ae.error}}return pe}function $e(){for(var en=[],ln=0;ln<arguments.length;ln++)en=en.concat(Ee(arguments[ln]));return en}function Fe(){for(var en=0,ln=0,Cn=arguments.length;ln<Cn;ln++)en+=arguments[ln].length;for(var Mt=Array(en),Et=0,ln=0;ln<Cn;ln++)for(var pe=arguments[ln],Ae=0,Pe=pe.length;Ae<Pe;Ae++,Et++)Mt[Et]=pe[Ae];return Mt}function ct(en,ln,Cn){if(Cn||arguments.length===2)for(var Mt=0,Et=ln.length,pe;Mt<Et;Mt++)(pe||!(Mt in ln))&&(pe||(pe=Array.prototype.slice.call(ln,0,Mt)),pe[Mt]=ln[Mt]);return en.concat(pe||Array.prototype.slice.call(ln))}function vt(en){return this instanceof vt?(this.v=en,this):new vt(en)}function at(en,ln,Cn){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var Mt=Cn.apply(en,ln||[]),Et,pe=[];return Et=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),Pe("next"),Pe("throw"),Pe("return",Ae),Et[Symbol.asyncIterator]=function(){return this},Et;function Ae(lt){return function(Ct){return Promise.resolve(Ct).then(lt,on)}}function Pe(lt,Ct){Mt[lt]&&(Et[lt]=function(sn){return new Promise(function(W,Se){pe.push([lt,sn,W,Se])>1||Ut(lt,sn)})},Ct&&(Et[lt]=Ct(Et[lt])))}function Ut(lt,Ct){try{jt(Mt[lt](Ct))}catch(sn){hn(pe[0][3],sn)}}function jt(lt){lt.value instanceof vt?Promise.resolve(lt.value.v).then(ft,on):hn(pe[0][2],lt)}function ft(lt){Ut("next",lt)}function on(lt){Ut("throw",lt)}function hn(lt,Ct){lt(Ct),pe.shift(),pe.length&&Ut(pe[0][0],pe[0][1])}}function kt(en){var ln,Cn;return ln={},Mt("next"),Mt("throw",function(Et){throw Et}),Mt("return"),ln[Symbol.iterator]=function(){return this},ln;function Mt(Et,pe){ln[Et]=en[Et]?function(Ae){return(Cn=!Cn)?{value:vt(en[Et](Ae)),done:!1}:pe?pe(Ae):Ae}:pe}}function It(en){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var ln=en[Symbol.asyncIterator],Cn;return ln?ln.call(en):(en=typeof ve=="function"?ve(en):en[Symbol.iterator](),Cn={},Mt("next"),Mt("throw"),Mt("return"),Cn[Symbol.asyncIterator]=function(){return this},Cn);function Mt(pe){Cn[pe]=en[pe]&&function(Ae){return new Promise(function(Pe,Ut){Ae=en[pe](Ae),Et(Pe,Ut,Ae.done,Ae.value)})}}function Et(pe,Ae,Pe,Ut){Promise.resolve(Ut).then(function(jt){pe({value:jt,done:Pe})},Ae)}}function Bn(en,ln){return Object.defineProperty?Object.defineProperty(en,"raw",{value:ln}):en.raw=ln,en}var Lt=Object.create?function(en,ln){Object.defineProperty(en,"default",{enumerable:!0,value:ln})}:function(en,ln){en.default=ln},Wn=function(en){return Wn=Object.getOwnPropertyNames||function(ln){var Cn=[];for(var Mt in ln)Object.prototype.hasOwnProperty.call(ln,Mt)&&(Cn[Cn.length]=Mt);return Cn},Wn(en)};function Xn(en){if(en&&en.__esModule)return en;var ln={};if(en!=null)for(var Cn=Wn(en),Mt=0;Mt<Cn.length;Mt++)Cn[Mt]!=="default"&&he(ln,en,Cn[Mt]);return Lt(ln,en),ln}function In(en){return en&&en.__esModule?en:{default:en}}function zn(en,ln,Cn,Mt){if(Cn==="a"&&!Mt)throw new TypeError("Private accessor was defined without a getter");if(typeof ln=="function"?en!==ln||!Mt:!ln.has(en))throw new TypeError("Cannot read private member from an object whose class did not declare it");return Cn==="m"?Mt:Cn==="a"?Mt.call(en):Mt?Mt.value:ln.get(en)}function dr(en,ln,Cn,Mt,Et){if(Mt==="m")throw new TypeError("Private method is not writable");if(Mt==="a"&&!Et)throw new TypeError("Private accessor was defined without a setter");if(typeof ln=="function"?en!==ln||!Et:!ln.has(en))throw new TypeError("Cannot write private member to an object whose class did not declare it");return Mt==="a"?Et.call(en,Cn):Et?Et.value=Cn:ln.set(en,Cn),Cn}function vn(en,ln){if(ln===null||typeof ln!="object"&&typeof ln!="function")throw new TypeError("Cannot use 'in' operator on non-object");return typeof en=="function"?ln===en:en.has(ln)}function _r(en,ln,Cn){if(ln!=null){if(typeof ln!="object"&&typeof ln!="function")throw new TypeError("Object expected.");var Mt,Et;if(Cn){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");Mt=ln[Symbol.asyncDispose]}if(Mt===void 0){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");Mt=ln[Symbol.dispose],Cn&&(Et=Mt)}if(typeof Mt!="function")throw new TypeError("Object not disposable.");Et&&(Mt=function(){try{Et.call(this)}catch(pe){return Promise.reject(pe)}}),en.stack.push({value:ln,dispose:Mt,async:Cn})}else Cn&&en.stack.push({async:!0});return ln}var Ge=typeof SuppressedError=="function"?SuppressedError:function(en,ln,Cn){var Mt=new Error(Cn);return Mt.name="SuppressedError",Mt.error=en,Mt.suppressed=ln,Mt};function Tt(en){function ln(pe){en.error=en.hasError?new Ge(pe,en.error,"An error was suppressed during disposal."):pe,en.hasError=!0}var Cn,Mt=0;function Et(){for(;Cn=en.stack.pop();)try{if(!Cn.async&&Mt===1)return Mt=0,en.stack.push(Cn),Promise.resolve().then(Et);if(Cn.dispose){var pe=Cn.dispose.call(Cn.value);if(Cn.async)return Mt|=2,Promise.resolve(pe).then(Et,function(Ae){return ln(Ae),Et()})}else Mt|=1}catch(Ae){ln(Ae)}if(Mt===1)return en.hasError?Promise.reject(en.error):Promise.resolve();if(en.hasError)throw en.error}return Et()}function On(en,ln){return typeof en=="string"&&/^\.\.?\//.test(en)?en.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i,function(Cn,Mt,Et,pe,Ae){return Mt?ln?".jsx":".js":Et&&(!pe||!Ae)?Cn:Et+pe+"."+Ae.toLowerCase()+"js"}):en}var Vr={__extends:Z,__assign:V,__rest:N,__decorate:E,__param:F,__esDecorate:C,__runInitializers:P,__propKey:H,__setFunctionName:D,__metadata:X,__awaiter:j,__generator:de,__createBinding:he,__exportStar:we,__values:ve,__read:Ee,__spread:$e,__spreadArrays:Fe,__spreadArray:ct,__await:vt,__asyncGenerator:at,__asyncDelegator:kt,__asyncValues:It,__makeTemplateObject:Bn,__importStar:Xn,__importDefault:In,__classPrivateFieldGet:zn,__classPrivateFieldSet:dr,__classPrivateFieldIn:vn,__addDisposableResource:_r,__disposeResources:Tt,__rewriteRelativeImportExtension:On}}}]);
}());