@aibee/crc-bmap 0.0.99 → 0.0.100
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/bmap.cjs.min.js +169 -169
- package/lib/bmap.cjs.min.js.map +2 -2
- package/lib/bmap.esm.js +1 -1
- package/lib/bmap.esm.js.map +2 -2
- package/lib/bmap.esm.min.js +1 -1
- package/lib/bmap.esm.min.js.map +2 -2
- package/lib/bmap.min.js +168 -168
- package/lib/bmap.min.js.map +2 -2
- package/package.json +1 -1
package/lib/bmap.esm.min.js
CHANGED
|
@@ -4274,7 +4274,7 @@ function inlineWorker(scriptText) {
|
|
|
4274
4274
|
|
|
4275
4275
|
// src/plugins/navigation/path.worker.ts
|
|
4276
4276
|
function Worker2() {
|
|
4277
|
-
return inlineWorker('var E1=Object.create;var am=Object.defineProperty;var M1=Object.getOwnPropertyDescriptor;var S1=Object.getOwnPropertyNames;var w1=Object.getPrototypeOf,b1=Object.prototype.hasOwnProperty;var Kt=(r,t)=>()=>(t||r((t={exports:{}}).exports,t),t.exports);var T1=(r,t,e,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of S1(t))!b1.call(r,a)&&a!==e&&am(r,a,{get:()=>t[a],enumerable:!(o=M1(t,a))||o.enumerable});return r};var Un=(r,t,e)=>(e=r!=null?E1(w1(r)):{},T1(t||!r||!r.__esModule?am(e,"default",{value:r,enumerable:!0}):e,r));var lm=Kt((eR,um)=>{var Af=class{constructor(){this.keys=new Set,this.queue=[]}sort(){this.queue.sort((t,e)=>t.priority-e.priority)}set(t,e){let o=Number(e);if(isNaN(o))throw new TypeError(\'"priority" must be a number\');return this.keys.has(t)?this.queue.map(a=>(a.key===t&&Object.assign(a,{priority:o}),a)):(this.keys.add(t),this.queue.push({key:t,priority:o})),this.sort(),this.queue.length}next(){let t=this.queue.shift();return this.keys.delete(t.key),t}isEmpty(){return this.queue.length===0}has(t){return this.keys.has(t)}get(t){return this.queue.find(e=>e.key===t)}};um.exports=Af});var hm=Kt((nR,fm)=>{function cm(r,t){let e=new Map;for(let[o,a]of r)o!==t&&a instanceof Map?e.set(o,cm(a,t)):o!==t&&e.set(o,a);return e}fm.exports=cm});var mm=Kt((rR,dm)=>{function A1(r){let t=Number(r);return!(isNaN(t)||t<=0)}function pm(r){let t=new Map;return Object.keys(r).forEach(o=>{let a=r[o];if(a!==null&&typeof a=="object"&&!Array.isArray(a))return t.set(o,pm(a));if(!A1(a))throw new Error(`Could not add node at key "${o}", make sure it\'s a valid node`,a);return t.set(o,Number(a))}),t}dm.exports=pm});var vm=Kt((iR,ym)=>{function gm(r){if(!(r instanceof Map))throw new Error(`Invalid graph: Expected Map instead found ${typeof r}`);r.forEach((t,e)=>{if(typeof t=="object"&&t instanceof Map){gm(t);return}if(typeof t!="number"||t<=0)throw new Error(`Values must be numbers greater than 0. Found value ${t} at ${e}`)})}ym.exports=gm});var Mm=Kt((oR,Em)=>{var C1=lm(),P1=hm(),_m=mm(),xm=vm(),Cf=class{constructor(t){t instanceof Map?(xm(t),this.graph=t):t?this.graph=_m(t):this.graph=new Map}addNode(t,e){let o;return e instanceof Map?(xm(e),o=e):o=_m(e),this.graph.set(t,o),this}addVertex(t,e){return this.addNode(t,e)}removeNode(t){return this.graph=P1(this.graph,t),this}path(t,e,o={}){if(!this.graph.size)return o.cost?{path:null,cost:0}:null;let a=new Set,l=new C1,f=new Map,h=[],p=0,d=[];if(o.avoid&&(d=[].concat(o.avoid)),d.includes(t))throw new Error(`Starting node (${t}) cannot be avoided`);if(d.includes(e))throw new Error(`Ending node (${e}) cannot be avoided`);for(l.set(t,0);!l.isEmpty();){let g=l.next();if(g.key===e){p=g.priority;let y=g.key;for(;f.has(y);)h.push(y),y=f.get(y);break}a.add(g.key),(this.graph.get(g.key)||new Map).forEach((y,M)=>{if(a.has(M)||d.includes(M))return null;if(!l.has(M))return f.set(M,g.key),l.set(M,g.priority+y);let w=l.get(M).priority,T=g.priority+y;return T<w?(f.set(M,g.key),l.set(M,T)):null})}return h.length?(o.trim?h.shift():h=h.concat([t]),o.reverse||(h=h.reverse()),o.cost?{path:h,cost:p}:h):o.cost?{path:null,cost:0}:null}shortestPath(...t){return this.path(...t)}};Em.exports=Cf});var mc=Kt((mR,p0)=>{"use strict";var h0=Object.getOwnPropertySymbols,Ib=Object.prototype.hasOwnProperty,Rb=Object.prototype.propertyIsEnumerable;function Lb(r){if(r==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(r)}function Nb(){try{if(!Object.assign)return!1;var r=new String("abc");if(r[5]="de",Object.getOwnPropertyNames(r)[0]==="5")return!1;for(var t={},e=0;e<10;e++)t["_"+String.fromCharCode(e)]=e;var o=Object.getOwnPropertyNames(t).map(function(l){return t[l]});if(o.join("")!=="0123456789")return!1;var a={};return"abcdefghijklmnopqrst".split("").forEach(function(l){a[l]=l}),Object.keys(Object.assign({},a)).join("")==="abcdefghijklmnopqrst"}catch(l){return!1}}p0.exports=Nb()?Object.assign:function(r,t){for(var e,o=Lb(r),a,l=1;l<arguments.length;l++){e=Object(arguments[l]);for(var f in e)Ib.call(e,f)&&(o[f]=e[f]);if(h0){a=h0(e);for(var h=0;h<a.length;h++)Rb.call(e,a[h])&&(o[a[h]]=e[a[h]])}}return o}});var tp=Kt((jh,Qh)=>{(function(r,t){typeof jh=="object"&&typeof Qh!="undefined"?Qh.exports=t():typeof define=="function"&&define.amd?define(t):(r=r||self).RBush=t()})(jh,function(){"use strict";function r(x,v,C,S,O){(function F(G,z,L,D,q){for(;D>L;){if(D-L>600){var nt=D-L+1,k=z-L+1,xt=Math.log(nt),X=.5*Math.exp(2*xt/3),it=.5*Math.sqrt(xt*X*(nt-X)/nt)*(k-nt/2<0?-1:1),vt=Math.max(L,Math.floor(z-k*X/nt+it)),pt=Math.min(D,Math.floor(z+(nt-k)*X/nt+it));F(G,z,vt,pt,q)}var et=G[z],ot=L,V=D;for(t(G,L,z),q(G[D],et)>0&&t(G,L,D);ot<V;){for(t(G,ot,V),ot++,V--;q(G[ot],et)<0;)ot++;for(;q(G[V],et)>0;)V--}q(G[L],et)===0?t(G,L,V):t(G,++V,D),V<=z&&(L=V+1),z<=V&&(D=V-1)}})(x,v,C||0,S||x.length-1,O||e)}function t(x,v,C){var S=x[v];x[v]=x[C],x[C]=S}function e(x,v){return x<v?-1:x>v?1:0}var o=function(x){x===void 0&&(x=9),this._maxEntries=Math.max(4,x),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()};function a(x,v,C){if(!C)return v.indexOf(x);for(var S=0;S<v.length;S++)if(C(x,v[S]))return S;return-1}function l(x,v){f(x,0,x.children.length,v,x)}function f(x,v,C,S,O){O||(O=w(null)),O.minX=1/0,O.minY=1/0,O.maxX=-1/0,O.maxY=-1/0;for(var F=v;F<C;F++){var G=x.children[F];h(O,x.leaf?S(G):G)}return O}function h(x,v){return x.minX=Math.min(x.minX,v.minX),x.minY=Math.min(x.minY,v.minY),x.maxX=Math.max(x.maxX,v.maxX),x.maxY=Math.max(x.maxY,v.maxY),x}function p(x,v){return x.minX-v.minX}function d(x,v){return x.minY-v.minY}function g(x){return(x.maxX-x.minX)*(x.maxY-x.minY)}function _(x){return x.maxX-x.minX+(x.maxY-x.minY)}function y(x,v){return x.minX<=v.minX&&x.minY<=v.minY&&v.maxX<=x.maxX&&v.maxY<=x.maxY}function M(x,v){return v.minX<=x.maxX&&v.minY<=x.maxY&&v.maxX>=x.minX&&v.maxY>=x.minY}function w(x){return{children:x,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function T(x,v,C,S,O){for(var F=[v,C];F.length;)if(!((C=F.pop())-(v=F.pop())<=S)){var G=v+Math.ceil((C-v)/S/2)*S;r(x,G,v,C,O),F.push(v,G,G,C)}}return o.prototype.all=function(){return this._all(this.data,[])},o.prototype.search=function(x){var v=this.data,C=[];if(!M(x,v))return C;for(var S=this.toBBox,O=[];v;){for(var F=0;F<v.children.length;F++){var G=v.children[F],z=v.leaf?S(G):G;M(x,z)&&(v.leaf?C.push(G):y(x,z)?this._all(G,C):O.push(G))}v=O.pop()}return C},o.prototype.collides=function(x){var v=this.data;if(!M(x,v))return!1;for(var C=[];v;){for(var S=0;S<v.children.length;S++){var O=v.children[S],F=v.leaf?this.toBBox(O):O;if(M(x,F)){if(v.leaf||y(x,F))return!0;C.push(O)}}v=C.pop()}return!1},o.prototype.load=function(x){if(!x||!x.length)return this;if(x.length<this._minEntries){for(var v=0;v<x.length;v++)this.insert(x[v]);return this}var C=this._build(x.slice(),0,x.length-1,0);if(this.data.children.length)if(this.data.height===C.height)this._splitRoot(this.data,C);else{if(this.data.height<C.height){var S=this.data;this.data=C,C=S}this._insert(C,this.data.height-C.height-1,!0)}else this.data=C;return this},o.prototype.insert=function(x){return x&&this._insert(x,this.data.height-1),this},o.prototype.clear=function(){return this.data=w([]),this},o.prototype.remove=function(x,v){if(!x)return this;for(var C,S,O,F=this.data,G=this.toBBox(x),z=[],L=[];F||z.length;){if(F||(F=z.pop(),S=z[z.length-1],C=L.pop(),O=!0),F.leaf){var D=a(x,F.children,v);if(D!==-1)return F.children.splice(D,1),z.push(F),this._condense(z),this}O||F.leaf||!y(F,G)?S?(C++,F=S.children[C],O=!1):F=null:(z.push(F),L.push(C),C=0,S=F,F=F.children[0])}return this},o.prototype.toBBox=function(x){return x},o.prototype.compareMinX=function(x,v){return x.minX-v.minX},o.prototype.compareMinY=function(x,v){return x.minY-v.minY},o.prototype.toJSON=function(){return this.data},o.prototype.fromJSON=function(x){return this.data=x,this},o.prototype._all=function(x,v){for(var C=[];x;)x.leaf?v.push.apply(v,x.children):C.push.apply(C,x.children),x=C.pop();return v},o.prototype._build=function(x,v,C,S){var O,F=C-v+1,G=this._maxEntries;if(F<=G)return l(O=w(x.slice(v,C+1)),this.toBBox),O;S||(S=Math.ceil(Math.log(F)/Math.log(G)),G=Math.ceil(F/Math.pow(G,S-1))),(O=w([])).leaf=!1,O.height=S;var z=Math.ceil(F/G),L=z*Math.ceil(Math.sqrt(G));T(x,v,C,L,this.compareMinX);for(var D=v;D<=C;D+=L){var q=Math.min(D+L-1,C);T(x,D,q,z,this.compareMinY);for(var nt=D;nt<=q;nt+=z){var k=Math.min(nt+z-1,q);O.children.push(this._build(x,nt,k,S-1))}}return l(O,this.toBBox),O},o.prototype._chooseSubtree=function(x,v,C,S){for(;S.push(v),!v.leaf&&S.length-1!==C;){for(var O=1/0,F=1/0,G=void 0,z=0;z<v.children.length;z++){var L=v.children[z],D=g(L),q=(nt=x,k=L,(Math.max(k.maxX,nt.maxX)-Math.min(k.minX,nt.minX))*(Math.max(k.maxY,nt.maxY)-Math.min(k.minY,nt.minY))-D);q<F?(F=q,O=D<O?D:O,G=L):q===F&&D<O&&(O=D,G=L)}v=G||v.children[0]}var nt,k;return v},o.prototype._insert=function(x,v,C){var S=C?x:this.toBBox(x),O=[],F=this._chooseSubtree(S,this.data,v,O);for(F.children.push(x),h(F,S);v>=0&&O[v].children.length>this._maxEntries;)this._split(O,v),v--;this._adjustParentBBoxes(S,O,v)},o.prototype._split=function(x,v){var C=x[v],S=C.children.length,O=this._minEntries;this._chooseSplitAxis(C,O,S);var F=this._chooseSplitIndex(C,O,S),G=w(C.children.splice(F,C.children.length-F));G.height=C.height,G.leaf=C.leaf,l(C,this.toBBox),l(G,this.toBBox),v?x[v-1].children.push(G):this._splitRoot(C,G)},o.prototype._splitRoot=function(x,v){this.data=w([x,v]),this.data.height=x.height+1,this.data.leaf=!1,l(this.data,this.toBBox)},o.prototype._chooseSplitIndex=function(x,v,C){for(var S,O,F,G,z,L,D,q=1/0,nt=1/0,k=v;k<=C-v;k++){var xt=f(x,0,k,this.toBBox),X=f(x,k,C,this.toBBox),it=(O=xt,F=X,G=void 0,z=void 0,L=void 0,D=void 0,G=Math.max(O.minX,F.minX),z=Math.max(O.minY,F.minY),L=Math.min(O.maxX,F.maxX),D=Math.min(O.maxY,F.maxY),Math.max(0,L-G)*Math.max(0,D-z)),vt=g(xt)+g(X);it<q?(q=it,S=k,nt=vt<nt?vt:nt):it===q&&vt<nt&&(nt=vt,S=k)}return S||C-v},o.prototype._chooseSplitAxis=function(x,v,C){var S=x.leaf?this.compareMinX:p,O=x.leaf?this.compareMinY:d;this._allDistMargin(x,v,C,S)<this._allDistMargin(x,v,C,O)&&x.children.sort(S)},o.prototype._allDistMargin=function(x,v,C,S){x.children.sort(S);for(var O=this.toBBox,F=f(x,0,v,O),G=f(x,C-v,C,O),z=_(F)+_(G),L=v;L<C-v;L++){var D=x.children[L];h(F,x.leaf?O(D):D),z+=_(F)}for(var q=C-v-1;q>=v;q--){var nt=x.children[q];h(G,x.leaf?O(nt):nt),z+=_(G)}return z},o.prototype._adjustParentBBoxes=function(x,v,C){for(var S=C;S>=0;S--)h(v[S],x)},o.prototype._condense=function(x){for(var v=x.length-1,C=void 0;v>=0;v--)x[v].children.length===0?v>0?(C=x[v-1].children).splice(C.indexOf(x[v]),1):this.clear():l(x[v],this.toBBox)},o})});var d0=Kt((ep,np)=>{(function(r,t){typeof ep=="object"&&typeof np!="undefined"?np.exports=t():typeof define=="function"&&define.amd?define(t):(r=r||self,r.TinyQueue=t())})(ep,function(){"use strict";var r=function(o,a){if(o===void 0&&(o=[]),a===void 0&&(a=t),this.data=o,this.length=this.data.length,this.compare=a,this.length>0)for(var l=(this.length>>1)-1;l>=0;l--)this._down(l)};r.prototype.push=function(o){this.data.push(o),this.length++,this._up(this.length-1)},r.prototype.pop=function(){if(this.length!==0){var o=this.data[0],a=this.data.pop();return this.length--,this.length>0&&(this.data[0]=a,this._down(0)),o}},r.prototype.peek=function(){return this.data[0]},r.prototype._up=function(o){for(var a=this,l=a.data,f=a.compare,h=l[o];o>0;){var p=o-1>>1,d=l[p];if(f(h,d)>=0)break;l[o]=d,o=p}l[o]=h},r.prototype._down=function(o){for(var a=this,l=a.data,f=a.compare,h=this.length>>1,p=l[o];o<h;){var d=(o<<1)+1,g=l[d],_=d+1;if(_<this.length&&f(l[_],g)<0&&(d=_,g=l[_]),f(g,p)>=0)break;l[o]=g,o=d}l[o]=p};function t(e,o){return e<o?-1:e>o?1:0}return r})});var g0=Kt((ER,m0)=>{m0.exports=function(t,e,o,a){var l=t[0],f=t[1],h=!1;o===void 0&&(o=0),a===void 0&&(a=e.length);for(var p=(a-o)/2,d=0,g=p-1;d<p;g=d++){var _=e[o+d*2+0],y=e[o+d*2+1],M=e[o+g*2+0],w=e[o+g*2+1],T=y>f!=w>f&&l<(M-_)*(f-y)/(w-y)+_;T&&(h=!h)}return h}});var v0=Kt((MR,y0)=>{y0.exports=function(t,e,o,a){var l=t[0],f=t[1],h=!1;o===void 0&&(o=0),a===void 0&&(a=e.length);for(var p=a-o,d=0,g=p-1;d<p;g=d++){var _=e[d+o][0],y=e[d+o][1],M=e[g+o][0],w=e[g+o][1],T=y>f!=w>f&&l<(M-_)*(f-y)/(w-y)+_;T&&(h=!h)}return h}});var E0=Kt((SR,vc)=>{var _0=g0(),x0=v0();vc.exports=function(t,e,o,a){return e.length>0&&Array.isArray(e[0])?x0(t,e,o,a):_0(t,e,o,a)};vc.exports.nested=x0;vc.exports.flat=_0});var S0=Kt((_c,M0)=>{(function(r,t){typeof _c=="object"&&typeof M0!="undefined"?t(_c):typeof define=="function"&&define.amd?define(["exports"],t):t((r=r||self).predicates={})})(_c,function(r){"use strict";let e=33306690738754706e-32;function o(M,w,T,x,v){let C,S,O,F,G=w[0],z=x[0],L=0,D=0;z>G==z>-G?(C=G,G=w[++L]):(C=z,z=x[++D]);let q=0;if(L<M&&D<T)for(z>G==z>-G?(O=C-((S=G+C)-G),G=w[++L]):(O=C-((S=z+C)-z),z=x[++D]),C=S,O!==0&&(v[q++]=O);L<M&&D<T;)z>G==z>-G?(O=C-((S=C+G)-(F=S-C))+(G-F),G=w[++L]):(O=C-((S=C+z)-(F=S-C))+(z-F),z=x[++D]),C=S,O!==0&&(v[q++]=O);for(;L<M;)O=C-((S=C+G)-(F=S-C))+(G-F),G=w[++L],C=S,O!==0&&(v[q++]=O);for(;D<T;)O=C-((S=C+z)-(F=S-C))+(z-F),z=x[++D],C=S,O!==0&&(v[q++]=O);return C===0&&q!==0||(v[q++]=C),q}function a(M){return new Float64Array(M)}let l=33306690738754716e-32,f=22204460492503146e-32,h=11093356479670487e-47,p=a(4),d=a(8),g=a(12),_=a(16),y=a(4);r.orient2d=function(M,w,T,x,v,C){let S=(w-C)*(T-v),O=(M-v)*(x-C),F=S-O;if(S===0||O===0||S>0!=O>0)return F;let G=Math.abs(S+O);return Math.abs(F)>=l*G?F:-function(z,L,D,q,nt,k,xt){let X,it,vt,pt,et,ot,V,K,at,Tt,dt,Ct,Yt,Wt,Nt,ne,Pt,Xt,tt=z-nt,nn=D-nt,Gt=L-k,te=q-k;et=(Nt=(K=tt-(V=(ot=134217729*tt)-(ot-tt)))*(Tt=te-(at=(ot=134217729*te)-(ot-te)))-((Wt=tt*te)-V*at-K*at-V*Tt))-(dt=Nt-(Pt=(K=Gt-(V=(ot=134217729*Gt)-(ot-Gt)))*(Tt=nn-(at=(ot=134217729*nn)-(ot-nn)))-((ne=Gt*nn)-V*at-K*at-V*Tt))),p[0]=Nt-(dt+et)+(et-Pt),et=(Yt=Wt-((Ct=Wt+dt)-(et=Ct-Wt))+(dt-et))-(dt=Yt-ne),p[1]=Yt-(dt+et)+(et-ne),et=(Xt=Ct+dt)-Ct,p[2]=Ct-(Xt-et)+(dt-et),p[3]=Xt;let qt=function(W,J){let I=J[0];for(let P=1;P<W;P++)I+=J[P];return I}(4,p),$=f*xt;if(qt>=$||-qt>=$||(X=z-(tt+(et=z-tt))+(et-nt),vt=D-(nn+(et=D-nn))+(et-nt),it=L-(Gt+(et=L-Gt))+(et-k),pt=q-(te+(et=q-te))+(et-k),X===0&&it===0&&vt===0&&pt===0)||($=h*xt+e*Math.abs(qt),(qt+=tt*pt+te*X-(Gt*vt+nn*it))>=$||-qt>=$))return qt;et=(Nt=(K=X-(V=(ot=134217729*X)-(ot-X)))*(Tt=te-(at=(ot=134217729*te)-(ot-te)))-((Wt=X*te)-V*at-K*at-V*Tt))-(dt=Nt-(Pt=(K=it-(V=(ot=134217729*it)-(ot-it)))*(Tt=nn-(at=(ot=134217729*nn)-(ot-nn)))-((ne=it*nn)-V*at-K*at-V*Tt))),y[0]=Nt-(dt+et)+(et-Pt),et=(Yt=Wt-((Ct=Wt+dt)-(et=Ct-Wt))+(dt-et))-(dt=Yt-ne),y[1]=Yt-(dt+et)+(et-ne),et=(Xt=Ct+dt)-Ct,y[2]=Ct-(Xt-et)+(dt-et),y[3]=Xt;let N=o(4,p,4,y,d);et=(Nt=(K=tt-(V=(ot=134217729*tt)-(ot-tt)))*(Tt=pt-(at=(ot=134217729*pt)-(ot-pt)))-((Wt=tt*pt)-V*at-K*at-V*Tt))-(dt=Nt-(Pt=(K=Gt-(V=(ot=134217729*Gt)-(ot-Gt)))*(Tt=vt-(at=(ot=134217729*vt)-(ot-vt)))-((ne=Gt*vt)-V*at-K*at-V*Tt))),y[0]=Nt-(dt+et)+(et-Pt),et=(Yt=Wt-((Ct=Wt+dt)-(et=Ct-Wt))+(dt-et))-(dt=Yt-ne),y[1]=Yt-(dt+et)+(et-ne),et=(Xt=Ct+dt)-Ct,y[2]=Ct-(Xt-et)+(dt-et),y[3]=Xt;let b=o(N,d,4,y,g);et=(Nt=(K=X-(V=(ot=134217729*X)-(ot-X)))*(Tt=pt-(at=(ot=134217729*pt)-(ot-pt)))-((Wt=X*pt)-V*at-K*at-V*Tt))-(dt=Nt-(Pt=(K=it-(V=(ot=134217729*it)-(ot-it)))*(Tt=vt-(at=(ot=134217729*vt)-(ot-vt)))-((ne=it*vt)-V*at-K*at-V*Tt))),y[0]=Nt-(dt+et)+(et-Pt),et=(Yt=Wt-((Ct=Wt+dt)-(et=Ct-Wt))+(dt-et))-(dt=Yt-ne),y[1]=Yt-(dt+et)+(et-ne),et=(Xt=Ct+dt)-Ct,y[2]=Ct-(Xt-et)+(dt-et),y[3]=Xt;let R=o(b,g,4,y,_);return _[R-1]}(M,w,T,x,v,C,G)},r.orient2dfast=function(M,w,T,x,v,C){return(w-C)*(T-v)-(M-v)*(x-C)},Object.defineProperty(r,"__esModule",{value:!0})})});var P0=Kt((wR,sp)=>{"use strict";var w0=tp(),Ec=d0(),Db=E0(),Fb=S0().orient2d;Ec.default&&(Ec=Ec.default);sp.exports=C0;sp.exports.default=C0;function C0(r,t,e){t=Math.max(0,t===void 0?2:t),e=e||0;var o=Gb(r),a=new w0(16);a.toBBox=function(C){return{minX:C[0],minY:C[1],maxX:C[0],maxY:C[1]}},a.compareMinX=function(C,S){return C[0]-S[0]},a.compareMinY=function(C,S){return C[1]-S[1]},a.load(r);for(var l=[],f=0,h;f<o.length;f++){var p=o[f];a.remove(p),h=A0(p,h),l.push(h)}var d=new w0(16);for(f=0;f<l.length;f++)d.insert(rp(l[f]));for(var g=t*t,_=e*e;l.length;){var y=l.shift(),M=y.p,w=y.next.p,T=ip(M,w);if(!(T<_)){var x=T/g;p=Ub(a,y.prev.p,M,w,y.next.next.p,x,d),p&&Math.min(ip(p,M),ip(p,w))<=x&&(l.push(y),l.push(A0(p,y)),a.remove(p),d.remove(y),d.insert(rp(y)),d.insert(rp(y.next)))}}y=h;var v=[];do v.push(y.p),y=y.next;while(y!==h);return v.push(y.p),v}function Ub(r,t,e,o,a,l,f){for(var h=new Ec([],Bb),p=r.data;p;){for(var d=0;d<p.children.length;d++){var g=p.children[d],_=p.leaf?op(g,e,o):zb(e,o,g);_>l||h.push({node:g,dist:_})}for(;h.length&&!h.peek().node.children;){var y=h.pop(),M=y.node,w=op(M,t,e),T=op(M,o,a);if(y.dist<w&&y.dist<T&&T0(e,M,f)&&T0(o,M,f))return M}p=h.pop(),p&&(p=p.node)}return null}function Bb(r,t){return r.dist-t.dist}function zb(r,t,e){if(b0(r,e)||b0(t,e))return 0;var o=xc(r[0],r[1],t[0],t[1],e.minX,e.minY,e.maxX,e.minY);if(o===0)return 0;var a=xc(r[0],r[1],t[0],t[1],e.minX,e.minY,e.minX,e.maxY);if(a===0)return 0;var l=xc(r[0],r[1],t[0],t[1],e.maxX,e.minY,e.maxX,e.maxY);if(l===0)return 0;var f=xc(r[0],r[1],t[0],t[1],e.minX,e.maxY,e.maxX,e.maxY);return f===0?0:Math.min(o,a,l,f)}function b0(r,t){return r[0]>=t.minX&&r[0]<=t.maxX&&r[1]>=t.minY&&r[1]<=t.maxY}function T0(r,t,e){for(var o=Math.min(r[0],t[0]),a=Math.min(r[1],t[1]),l=Math.max(r[0],t[0]),f=Math.max(r[1],t[1]),h=e.search({minX:o,minY:a,maxX:l,maxY:f}),p=0;p<h.length;p++)if(kb(h[p].p,h[p].next.p,r,t))return!1;return!0}function Ya(r,t,e){return Fb(r[0],r[1],t[0],t[1],e[0],e[1])}function kb(r,t,e,o){return r!==o&&t!==e&&Ya(r,t,e)>0!=Ya(r,t,o)>0&&Ya(e,o,r)>0!=Ya(e,o,t)>0}function rp(r){var t=r.p,e=r.next.p;return r.minX=Math.min(t[0],e[0]),r.minY=Math.min(t[1],e[1]),r.maxX=Math.max(t[0],e[0]),r.maxY=Math.max(t[1],e[1]),r}function Gb(r){for(var t=r[0],e=r[0],o=r[0],a=r[0],l=0;l<r.length;l++){var f=r[l];f[0]<t[0]&&(t=f),f[0]>o[0]&&(o=f),f[1]<e[1]&&(e=f),f[1]>a[1]&&(a=f)}var h=[t,e,o,a],p=h.slice();for(l=0;l<r.length;l++)Db(r[l],h)||p.push(r[l]);return Hb(p)}function A0(r,t){var e={p:r,prev:null,next:null,minX:0,minY:0,maxX:0,maxY:0};return t?(e.next=t.next,e.prev=t,t.next.prev=e,t.next=e):(e.prev=e,e.next=e),e}function ip(r,t){var e=r[0]-t[0],o=r[1]-t[1];return e*e+o*o}function op(r,t,e){var o=t[0],a=t[1],l=e[0]-o,f=e[1]-a;if(l!==0||f!==0){var h=((r[0]-o)*l+(r[1]-a)*f)/(l*l+f*f);h>1?(o=e[0],a=e[1]):h>0&&(o+=l*h,a+=f*h)}return l=r[0]-o,f=r[1]-a,l*l+f*f}function xc(r,t,e,o,a,l,f,h){var p=e-r,d=o-t,g=f-a,_=h-l,y=r-a,M=t-l,w=p*p+d*d,T=p*g+d*_,x=g*g+_*_,v=p*y+d*M,C=g*y+_*M,S=w*x-T*T,O,F,G,z,L=S,D=S;S===0?(F=0,L=1,z=C,D=x):(F=T*C-x*v,z=w*C-T*v,F<0?(F=0,z=C,D=x):F>L&&(F=L,z=C+T,D=x)),z<0?(z=0,-v<0?F=0:-v>w?F=L:(F=-v,L=w)):z>D&&(z=D,-v+T<0?F=0:-v+T>w?F=L:(F=-v+T,L=w)),O=F===0?0:F/L,G=z===0?0:z/D;var q=(1-O)*r+O*e,nt=(1-O)*t+O*o,k=(1-G)*a+G*f,xt=(1-G)*l+G*h,X=k-q,it=xt-nt;return X*X+it*it}function Vb(r,t){return r[0]===t[0]?r[1]-t[1]:r[0]-t[0]}function Hb(r){r.sort(Vb);for(var t=[],e=0;e<r.length;e++){for(;t.length>=2&&Ya(t[t.length-2],t[t.length-1],r[e])<=0;)t.pop();t.push(r[e])}for(var o=[],a=r.length-1;a>=0;a--){for(;o.length>=2&&Ya(o[o.length-2],o[o.length-1],r[a])<=0;)o.pop();o.push(r[a])}return o.pop(),t.pop(),t.concat(o)}});var D0=Kt((up,lp)=>{(function(r,t){typeof up=="object"&&typeof lp!="undefined"?lp.exports=t():typeof define=="function"&&define.amd?define(t):r.quickselect=t()})(up,function(){"use strict";function r(a,l,f,h,p){t(a,l,f||0,h||a.length-1,p||o)}function t(a,l,f,h,p){for(;h>f;){if(h-f>600){var d=h-f+1,g=l-f+1,_=Math.log(d),y=.5*Math.exp(2*_/3),M=.5*Math.sqrt(_*y*(d-y)/d)*(g-d/2<0?-1:1),w=Math.max(f,Math.floor(l-g*y/d+M)),T=Math.min(h,Math.floor(l+(d-g)*y/d+M));t(a,l,w,T,p)}var x=a[l],v=f,C=h;for(e(a,f,l),p(a[h],x)>0&&e(a,f,h);v<C;){for(e(a,v,C),v++,C--;p(a[v],x)<0;)v++;for(;p(a[C],x)>0;)C--}p(a[f],x)===0?e(a,f,C):(C++,e(a,C,h)),C<=l&&(f=C+1),l<=C&&(h=C-1)}}function e(a,l,f){var h=a[l];a[l]=a[f],a[f]=h}function o(a,l){return a<l?-1:a>l?1:0}return r})});var pp=Kt(($N,hp)=>{"use strict";hp.exports=Hu;hp.exports.default=Hu;var nT=D0();function Hu(r,t){if(!(this instanceof Hu))return new Hu(r,t);this._maxEntries=Math.max(4,r||9),this._minEntries=Math.max(2,Math.ceil(this._maxEntries*.4)),t&&this._initFormat(t),this.clear()}Hu.prototype={all:function(){return this._all(this.data,[])},search:function(r){var t=this.data,e=[],o=this.toBBox;if(!Sc(r,t))return e;for(var a=[],l,f,h,p;t;){for(l=0,f=t.children.length;l<f;l++)h=t.children[l],p=t.leaf?o(h):h,Sc(r,p)&&(t.leaf?e.push(h):fp(r,p)?this._all(h,e):a.push(h));t=a.pop()}return e},collides:function(r){var t=this.data,e=this.toBBox;if(!Sc(r,t))return!1;for(var o=[],a,l,f,h;t;){for(a=0,l=t.children.length;a<l;a++)if(f=t.children[a],h=t.leaf?e(f):f,Sc(r,h)){if(t.leaf||fp(r,h))return!0;o.push(f)}t=o.pop()}return!1},load:function(r){if(!(r&&r.length))return this;if(r.length<this._minEntries){for(var t=0,e=r.length;t<e;t++)this.insert(r[t]);return this}var o=this._build(r.slice(),0,r.length-1,0);if(!this.data.children.length)this.data=o;else if(this.data.height===o.height)this._splitRoot(this.data,o);else{if(this.data.height<o.height){var a=this.data;this.data=o,o=a}this._insert(o,this.data.height-o.height-1,!0)}return this},insert:function(r){return r&&this._insert(r,this.data.height-1),this},clear:function(){return this.data=$a([]),this},remove:function(r,t){if(!r)return this;for(var e=this.data,o=this.toBBox(r),a=[],l=[],f,h,p,d;e||a.length;){if(e||(e=a.pop(),h=a[a.length-1],f=l.pop(),d=!0),e.leaf&&(p=rT(r,e.children,t),p!==-1))return e.children.splice(p,1),a.push(e),this._condense(a),this;!d&&!e.leaf&&fp(e,o)?(a.push(e),l.push(f),f=0,h=e,e=e.children[0]):h?(f++,e=h.children[f],d=!1):e=null}return this},toBBox:function(r){return r},compareMinX:F0,compareMinY:U0,toJSON:function(){return this.data},fromJSON:function(r){return this.data=r,this},_all:function(r,t){for(var e=[];r;)r.leaf?t.push.apply(t,r.children):e.push.apply(e,r.children),r=e.pop();return t},_build:function(r,t,e,o){var a=e-t+1,l=this._maxEntries,f;if(a<=l)return f=$a(r.slice(t,e+1)),Ja(f,this.toBBox),f;o||(o=Math.ceil(Math.log(a)/Math.log(l)),l=Math.ceil(a/Math.pow(l,o-1))),f=$a([]),f.leaf=!1,f.height=o;var h=Math.ceil(a/l),p=h*Math.ceil(Math.sqrt(l)),d,g,_,y;for(B0(r,t,e,p,this.compareMinX),d=t;d<=e;d+=p)for(_=Math.min(d+p-1,e),B0(r,d,_,h,this.compareMinY),g=d;g<=_;g+=h)y=Math.min(g+h-1,_),f.children.push(this._build(r,g,y,o-1));return Ja(f,this.toBBox),f},_chooseSubtree:function(r,t,e,o){for(var a,l,f,h,p,d,g,_;o.push(t),!(t.leaf||o.length-1===e);){for(g=_=1/0,a=0,l=t.children.length;a<l;a++)f=t.children[a],p=cp(f),d=iT(r,f)-p,d<_?(_=d,g=p<g?p:g,h=f):d===_&&p<g&&(g=p,h=f);t=h||t.children[0]}return t},_insert:function(r,t,e){var o=this.toBBox,a=e?r:o(r),l=[],f=this._chooseSubtree(a,this.data,t,l);for(f.children.push(r),Vu(f,a);t>=0&&l[t].children.length>this._maxEntries;)this._split(l,t),t--;this._adjustParentBBoxes(a,l,t)},_split:function(r,t){var e=r[t],o=e.children.length,a=this._minEntries;this._chooseSplitAxis(e,a,o);var l=this._chooseSplitIndex(e,a,o),f=$a(e.children.splice(l,e.children.length-l));f.height=e.height,f.leaf=e.leaf,Ja(e,this.toBBox),Ja(f,this.toBBox),t?r[t-1].children.push(f):this._splitRoot(e,f)},_splitRoot:function(r,t){this.data=$a([r,t]),this.data.height=r.height+1,this.data.leaf=!1,Ja(this.data,this.toBBox)},_chooseSplitIndex:function(r,t,e){var o,a,l,f,h,p,d,g;for(p=d=1/0,o=t;o<=e-t;o++)a=Gu(r,0,o,this.toBBox),l=Gu(r,o,e,this.toBBox),f=oT(a,l),h=cp(a)+cp(l),f<p?(p=f,g=o,d=h<d?h:d):f===p&&h<d&&(d=h,g=o);return g},_chooseSplitAxis:function(r,t,e){var o=r.leaf?this.compareMinX:F0,a=r.leaf?this.compareMinY:U0,l=this._allDistMargin(r,t,e,o),f=this._allDistMargin(r,t,e,a);l<f&&r.children.sort(o)},_allDistMargin:function(r,t,e,o){r.children.sort(o);var a=this.toBBox,l=Gu(r,0,t,a),f=Gu(r,e-t,e,a),h=Mc(l)+Mc(f),p,d;for(p=t;p<e-t;p++)d=r.children[p],Vu(l,r.leaf?a(d):d),h+=Mc(l);for(p=e-t-1;p>=t;p--)d=r.children[p],Vu(f,r.leaf?a(d):d),h+=Mc(f);return h},_adjustParentBBoxes:function(r,t,e){for(var o=e;o>=0;o--)Vu(t[o],r)},_condense:function(r){for(var t=r.length-1,e;t>=0;t--)r[t].children.length===0?t>0?(e=r[t-1].children,e.splice(e.indexOf(r[t]),1)):this.clear():Ja(r[t],this.toBBox)},_initFormat:function(r){var t=["return a"," - b",";"];this.compareMinX=new Function("a","b",t.join(r[0])),this.compareMinY=new Function("a","b",t.join(r[1])),this.toBBox=new Function("a","return {minX: a"+r[0]+", minY: a"+r[1]+", maxX: a"+r[2]+", maxY: a"+r[3]+"};")}};function rT(r,t,e){if(!e)return t.indexOf(r);for(var o=0;o<t.length;o++)if(e(r,t[o]))return o;return-1}function Ja(r,t){Gu(r,0,r.children.length,t,r)}function Gu(r,t,e,o,a){a||(a=$a(null)),a.minX=1/0,a.minY=1/0,a.maxX=-1/0,a.maxY=-1/0;for(var l=t,f;l<e;l++)f=r.children[l],Vu(a,r.leaf?o(f):f);return a}function Vu(r,t){return r.minX=Math.min(r.minX,t.minX),r.minY=Math.min(r.minY,t.minY),r.maxX=Math.max(r.maxX,t.maxX),r.maxY=Math.max(r.maxY,t.maxY),r}function F0(r,t){return r.minX-t.minX}function U0(r,t){return r.minY-t.minY}function cp(r){return(r.maxX-r.minX)*(r.maxY-r.minY)}function Mc(r){return r.maxX-r.minX+(r.maxY-r.minY)}function iT(r,t){return(Math.max(t.maxX,r.maxX)-Math.min(t.minX,r.minX))*(Math.max(t.maxY,r.maxY)-Math.min(t.minY,r.minY))}function oT(r,t){var e=Math.max(r.minX,t.minX),o=Math.max(r.minY,t.minY),a=Math.min(r.maxX,t.maxX),l=Math.min(r.maxY,t.maxY);return Math.max(0,a-e)*Math.max(0,l-o)}function fp(r,t){return r.minX<=t.minX&&r.minY<=t.minY&&t.maxX<=r.maxX&&t.maxY<=r.maxY}function Sc(r,t){return t.minX<=r.maxX&&t.minY<=r.maxY&&t.maxX>=r.minX&&t.maxY>=r.minY}function $a(r){return{children:r,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function B0(r,t,e,o,a){for(var l=[t,e],f;l.length;)e=l.pop(),t=l.pop(),!(e-t<=o)&&(f=t+Math.ceil((e-t)/o/2)*o,nT(r,f,t,e,a),l.push(t,f,f,e))}});var W0=Kt((lO,_p)=>{"use strict";_p.exports=Ac;_p.exports.default=Ac;function Ac(r,t,e){e=e||2;var o=t&&t.length,a=o?t[0]*e:r.length,l=G0(r,0,a,e,!0),f=[];if(!l||l.next===l.prev)return f;var h,p,d,g,_,y,M;if(o&&(l=mT(r,t,l,e)),r.length>80*e){h=d=r[0],p=g=r[1];for(var w=e;w<a;w+=e)_=r[w],y=r[w+1],_<h&&(h=_),y<p&&(p=y),_>d&&(d=_),y>g&&(g=y);M=Math.max(d-h,g-p),M=M!==0?32767/M:0}return Xu(l,f,e,h,p,M,0),f}function G0(r,t,e,o,a){var l,f;if(a===vp(r,t,e,o)>0)for(l=t;l<e;l+=o)f=k0(l,r[l],r[l+1],f);else for(l=e-o;l>=t;l-=o)f=k0(l,r[l],r[l+1],f);return f&&Cc(f,f.next)&&(Zu(f),f=f.next),f}function $s(r,t){if(!r)return r;t||(t=r);var e=r,o;do if(o=!1,!e.steiner&&(Cc(e,e.next)||Fn(e.prev,e,e.next)===0)){if(Zu(e),e=t=e.prev,e===e.next)break;o=!0}else e=e.next;while(o||e!==t);return t}function Xu(r,t,e,o,a,l,f){if(r){!f&&l&&xT(r,o,a,l);for(var h=r,p,d;r.prev!==r.next;){if(p=r.prev,d=r.next,l?hT(r,o,a,l):fT(r)){t.push(p.i/e|0),t.push(r.i/e|0),t.push(d.i/e|0),Zu(r),r=d.next,h=d.next;continue}if(r=d,r===h){f?f===1?(r=pT($s(r),t,e),Xu(r,t,e,o,a,l,2)):f===2&&dT(r,t,e,o,a,l):Xu($s(r),t,e,o,a,l,1);break}}}}function fT(r){var t=r.prev,e=r,o=r.next;if(Fn(t,e,o)>=0)return!1;for(var a=t.x,l=e.x,f=o.x,h=t.y,p=e.y,d=o.y,g=a<l?a<f?a:f:l<f?l:f,_=h<p?h<d?h:d:p<d?p:d,y=a>l?a>f?a:f:l>f?l:f,M=h>p?h>d?h:d:p>d?p:d,w=o.next;w!==t;){if(w.x>=g&&w.x<=y&&w.y>=_&&w.y<=M&&Qa(a,h,l,p,f,d,w.x,w.y)&&Fn(w.prev,w,w.next)>=0)return!1;w=w.next}return!0}function hT(r,t,e,o){var a=r.prev,l=r,f=r.next;if(Fn(a,l,f)>=0)return!1;for(var h=a.x,p=l.x,d=f.x,g=a.y,_=l.y,y=f.y,M=h<p?h<d?h:d:p<d?p:d,w=g<_?g<y?g:y:_<y?_:y,T=h>p?h>d?h:d:p>d?p:d,x=g>_?g>y?g:y:_>y?_:y,v=gp(M,w,t,e,o),C=gp(T,x,t,e,o),S=r.prevZ,O=r.nextZ;S&&S.z>=v&&O&&O.z<=C;){if(S.x>=M&&S.x<=T&&S.y>=w&&S.y<=x&&S!==a&&S!==f&&Qa(h,g,p,_,d,y,S.x,S.y)&&Fn(S.prev,S,S.next)>=0||(S=S.prevZ,O.x>=M&&O.x<=T&&O.y>=w&&O.y<=x&&O!==a&&O!==f&&Qa(h,g,p,_,d,y,O.x,O.y)&&Fn(O.prev,O,O.next)>=0))return!1;O=O.nextZ}for(;S&&S.z>=v;){if(S.x>=M&&S.x<=T&&S.y>=w&&S.y<=x&&S!==a&&S!==f&&Qa(h,g,p,_,d,y,S.x,S.y)&&Fn(S.prev,S,S.next)>=0)return!1;S=S.prevZ}for(;O&&O.z<=C;){if(O.x>=M&&O.x<=T&&O.y>=w&&O.y<=x&&O!==a&&O!==f&&Qa(h,g,p,_,d,y,O.x,O.y)&&Fn(O.prev,O,O.next)>=0)return!1;O=O.nextZ}return!0}function pT(r,t,e){var o=r;do{var a=o.prev,l=o.next.next;!Cc(a,l)&&V0(a,o,o.next,l)&&Yu(a,l)&&Yu(l,a)&&(t.push(a.i/e|0),t.push(o.i/e|0),t.push(l.i/e|0),Zu(o),Zu(o.next),o=r=l),o=o.next}while(o!==r);return $s(o)}function dT(r,t,e,o,a,l){var f=r;do{for(var h=f.next.next;h!==f.prev;){if(f.i!==h.i&&ST(f,h)){var p=H0(f,h);f=$s(f,f.next),p=$s(p,p.next),Xu(f,t,e,o,a,l,0),Xu(p,t,e,o,a,l,0);return}h=h.next}f=f.next}while(f!==r)}function mT(r,t,e,o){var a=[],l,f,h,p,d;for(l=0,f=t.length;l<f;l++)h=t[l]*o,p=l<f-1?t[l+1]*o:r.length,d=G0(r,h,p,o,!1),d===d.next&&(d.steiner=!0),a.push(MT(d));for(a.sort(gT),l=0;l<a.length;l++)e=yT(a[l],e);return e}function gT(r,t){return r.x-t.x}function yT(r,t){var e=vT(r,t);if(!e)return t;var o=H0(e,r);return $s(o,o.next),$s(e,e.next)}function vT(r,t){var e=t,o=r.x,a=r.y,l=-1/0,f;do{if(a<=e.y&&a>=e.next.y&&e.next.y!==e.y){var h=e.x+(a-e.y)*(e.next.x-e.x)/(e.next.y-e.y);if(h<=o&&h>l&&(l=h,f=e.x<e.next.x?e:e.next,h===o))return f}e=e.next}while(e!==t);if(!f)return null;var p=f,d=f.x,g=f.y,_=1/0,y;e=f;do o>=e.x&&e.x>=d&&o!==e.x&&Qa(a<g?o:l,a,d,g,a<g?l:o,a,e.x,e.y)&&(y=Math.abs(a-e.y)/(o-e.x),Yu(e,r)&&(y<_||y===_&&(e.x>f.x||e.x===f.x&&_T(f,e)))&&(f=e,_=y)),e=e.next;while(e!==p);return f}function _T(r,t){return Fn(r.prev,r,t.prev)<0&&Fn(t.next,r,r.next)<0}function xT(r,t,e,o){var a=r;do a.z===0&&(a.z=gp(a.x,a.y,t,e,o)),a.prevZ=a.prev,a.nextZ=a.next,a=a.next;while(a!==r);a.prevZ.nextZ=null,a.prevZ=null,ET(a)}function ET(r){var t,e,o,a,l,f,h,p,d=1;do{for(e=r,r=null,l=null,f=0;e;){for(f++,o=e,h=0,t=0;t<d&&(h++,o=o.nextZ,!!o);t++);for(p=d;h>0||p>0&&o;)h!==0&&(p===0||!o||e.z<=o.z)?(a=e,e=e.nextZ,h--):(a=o,o=o.nextZ,p--),l?l.nextZ=a:r=a,a.prevZ=l,l=a;e=o}l.nextZ=null,d*=2}while(f>1);return r}function gp(r,t,e,o,a){return r=(r-e)*a|0,t=(t-o)*a|0,r=(r|r<<8)&16711935,r=(r|r<<4)&252645135,r=(r|r<<2)&858993459,r=(r|r<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,r|t<<1}function MT(r){var t=r,e=r;do(t.x<e.x||t.x===e.x&&t.y<e.y)&&(e=t),t=t.next;while(t!==r);return e}function Qa(r,t,e,o,a,l,f,h){return(a-f)*(t-h)>=(r-f)*(l-h)&&(r-f)*(o-h)>=(e-f)*(t-h)&&(e-f)*(l-h)>=(a-f)*(o-h)}function ST(r,t){return r.next.i!==t.i&&r.prev.i!==t.i&&!wT(r,t)&&(Yu(r,t)&&Yu(t,r)&&bT(r,t)&&(Fn(r.prev,r,t.prev)||Fn(r,t.prev,t))||Cc(r,t)&&Fn(r.prev,r,r.next)>0&&Fn(t.prev,t,t.next)>0)}function Fn(r,t,e){return(t.y-r.y)*(e.x-t.x)-(t.x-r.x)*(e.y-t.y)}function Cc(r,t){return r.x===t.x&&r.y===t.y}function V0(r,t,e,o){var a=Tc(Fn(r,t,e)),l=Tc(Fn(r,t,o)),f=Tc(Fn(e,o,r)),h=Tc(Fn(e,o,t));return!!(a!==l&&f!==h||a===0&&bc(r,e,t)||l===0&&bc(r,o,t)||f===0&&bc(e,r,o)||h===0&&bc(e,t,o))}function bc(r,t,e){return t.x<=Math.max(r.x,e.x)&&t.x>=Math.min(r.x,e.x)&&t.y<=Math.max(r.y,e.y)&&t.y>=Math.min(r.y,e.y)}function Tc(r){return r>0?1:r<0?-1:0}function wT(r,t){var e=r;do{if(e.i!==r.i&&e.next.i!==r.i&&e.i!==t.i&&e.next.i!==t.i&&V0(e,e.next,r,t))return!0;e=e.next}while(e!==r);return!1}function Yu(r,t){return Fn(r.prev,r,r.next)<0?Fn(r,t,r.next)>=0&&Fn(r,r.prev,t)>=0:Fn(r,t,r.prev)<0||Fn(r,r.next,t)<0}function bT(r,t){var e=r,o=!1,a=(r.x+t.x)/2,l=(r.y+t.y)/2;do e.y>l!=e.next.y>l&&e.next.y!==e.y&&a<(e.next.x-e.x)*(l-e.y)/(e.next.y-e.y)+e.x&&(o=!o),e=e.next;while(e!==r);return o}function H0(r,t){var e=new yp(r.i,r.x,r.y),o=new yp(t.i,t.x,t.y),a=r.next,l=t.prev;return r.next=t,t.prev=r,e.next=a,a.prev=e,o.next=e,e.prev=o,l.next=o,o.prev=l,o}function k0(r,t,e,o){var a=new yp(r,t,e);return o?(a.next=o.next,a.prev=o,o.next.prev=a,o.next=a):(a.prev=a,a.next=a),a}function Zu(r){r.next.prev=r.prev,r.prev.next=r.next,r.prevZ&&(r.prevZ.nextZ=r.nextZ),r.nextZ&&(r.nextZ.prevZ=r.prevZ)}function yp(r,t,e){this.i=r,this.x=t,this.y=e,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}Ac.deviation=function(r,t,e,o){var a=t&&t.length,l=a?t[0]*e:r.length,f=Math.abs(vp(r,0,l,e));if(a)for(var h=0,p=t.length;h<p;h++){var d=t[h]*e,g=h<p-1?t[h+1]*e:r.length;f-=Math.abs(vp(r,d,g,e))}var _=0;for(h=0;h<o.length;h+=3){var y=o[h]*e,M=o[h+1]*e,w=o[h+2]*e;_+=Math.abs((r[y]-r[w])*(r[M+1]-r[y+1])-(r[y]-r[M])*(r[w+1]-r[y+1]))}return f===0&&_===0?0:Math.abs((_-f)/f)};function vp(r,t,e,o){for(var a=0,l=t,f=e-o;l<e;l+=o)a+=(r[f]-r[l])*(r[l+1]+r[f+1]),f=l;return a}Ac.flatten=function(r){for(var t=r[0][0].length,e={vertices:[],holes:[],dimensions:t},o=0,a=0;a<r.length;a++){for(var l=0;l<r[a].length;l++)for(var f=0;f<t;f++)e.vertices.push(r[a][l][f]);a>0&&(o+=r[a-1].length,e.holes.push(o))}return e}});var wp=Kt(ue=>{"use strict";Object.defineProperty(ue,"__esModule",{value:!0});ue.earthRadius=63710088e-1;ue.factors={centimeters:ue.earthRadius*100,centimetres:ue.earthRadius*100,degrees:ue.earthRadius/111325,feet:ue.earthRadius*3.28084,inches:ue.earthRadius*39.37,kilometers:ue.earthRadius/1e3,kilometres:ue.earthRadius/1e3,meters:ue.earthRadius,metres:ue.earthRadius,miles:ue.earthRadius/1609.344,millimeters:ue.earthRadius*1e3,millimetres:ue.earthRadius*1e3,nauticalmiles:ue.earthRadius/1852,radians:1,yards:ue.earthRadius*1.0936};ue.unitsFactors={centimeters:100,centimetres:100,degrees:1/111325,feet:3.28084,inches:39.37,kilometers:1/1e3,kilometres:1/1e3,meters:1,metres:1,miles:1/1609.344,millimeters:1e3,millimetres:1e3,nauticalmiles:1/1852,radians:1/ue.earthRadius,yards:1.0936133};ue.areaFactors={acres:247105e-9,centimeters:1e4,centimetres:1e4,feet:10.763910417,hectares:1e-4,inches:1550.003100006,kilometers:1e-6,kilometres:1e-6,meters:1,metres:1,miles:386e-9,millimeters:1e6,millimetres:1e6,yards:1.195990046};function vs(r,t,e){e===void 0&&(e={});var o={type:"Feature"};return(e.id===0||e.id)&&(o.id=e.id),e.bbox&&(o.bbox=e.bbox),o.properties=t||{},o.geometry=r,o}ue.feature=vs;function AT(r,t,e){switch(e===void 0&&(e={}),r){case"Point":return xp(t).geometry;case"LineString":return Mp(t).geometry;case"Polygon":return Ep(t).geometry;case"MultiPoint":return X0(t).geometry;case"MultiLineString":return q0(t).geometry;case"MultiPolygon":return Y0(t).geometry;default:throw new Error(r+" is invalid")}}ue.geometry=AT;function xp(r,t,e){if(e===void 0&&(e={}),!r)throw new Error("coordinates is required");if(!Array.isArray(r))throw new Error("coordinates must be an Array");if(r.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!Pc(r[0])||!Pc(r[1]))throw new Error("coordinates must contain numbers");var o={type:"Point",coordinates:r};return vs(o,t,e)}ue.point=xp;function CT(r,t,e){return e===void 0&&(e={}),Ic(r.map(function(o){return xp(o,t)}),e)}ue.points=CT;function Ep(r,t,e){e===void 0&&(e={});for(var o=0,a=r;o<a.length;o++){var l=a[o];if(l.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");for(var f=0;f<l[l.length-1].length;f++)if(l[l.length-1][f]!==l[0][f])throw new Error("First and last Position are not equivalent.")}var h={type:"Polygon",coordinates:r};return vs(h,t,e)}ue.polygon=Ep;function PT(r,t,e){return e===void 0&&(e={}),Ic(r.map(function(o){return Ep(o,t)}),e)}ue.polygons=PT;function Mp(r,t,e){if(e===void 0&&(e={}),r.length<2)throw new Error("coordinates must be an array of two or more positions");var o={type:"LineString",coordinates:r};return vs(o,t,e)}ue.lineString=Mp;function IT(r,t,e){return e===void 0&&(e={}),Ic(r.map(function(o){return Mp(o,t)}),e)}ue.lineStrings=IT;function Ic(r,t){t===void 0&&(t={});var e={type:"FeatureCollection"};return t.id&&(e.id=t.id),t.bbox&&(e.bbox=t.bbox),e.features=r,e}ue.featureCollection=Ic;function q0(r,t,e){e===void 0&&(e={});var o={type:"MultiLineString",coordinates:r};return vs(o,t,e)}ue.multiLineString=q0;function X0(r,t,e){e===void 0&&(e={});var o={type:"MultiPoint",coordinates:r};return vs(o,t,e)}ue.multiPoint=X0;function Y0(r,t,e){e===void 0&&(e={});var o={type:"MultiPolygon",coordinates:r};return vs(o,t,e)}ue.multiPolygon=Y0;function RT(r,t,e){e===void 0&&(e={});var o={type:"GeometryCollection",geometries:r};return vs(o,t,e)}ue.geometryCollection=RT;function LT(r,t){if(t===void 0&&(t=0),t&&!(t>=0))throw new Error("precision must be a positive number");var e=Math.pow(10,t||0);return Math.round(r*e)/e}ue.round=LT;function Z0(r,t){t===void 0&&(t="kilometers");var e=ue.factors[t];if(!e)throw new Error(t+" units is invalid");return r*e}ue.radiansToLength=Z0;function Sp(r,t){t===void 0&&(t="kilometers");var e=ue.factors[t];if(!e)throw new Error(t+" units is invalid");return r/e}ue.lengthToRadians=Sp;function NT(r,t){return J0(Sp(r,t))}ue.lengthToDegrees=NT;function OT(r){var t=r%360;return t<0&&(t+=360),t}ue.bearingToAzimuth=OT;function J0(r){var t=r%(2*Math.PI);return t*180/Math.PI}ue.radiansToDegrees=J0;function DT(r){var t=r%360;return t*Math.PI/180}ue.degreesToRadians=DT;function FT(r,t,e){if(t===void 0&&(t="kilometers"),e===void 0&&(e="kilometers"),!(r>=0))throw new Error("length must be a positive number");return Z0(Sp(r,t),e)}ue.convertLength=FT;function UT(r,t,e){if(t===void 0&&(t="meters"),e===void 0&&(e="kilometers"),!(r>=0))throw new Error("area must be a positive number");var o=ue.areaFactors[t];if(!o)throw new Error("invalid original units");var a=ue.areaFactors[e];if(!a)throw new Error("invalid final units");return r/o*a}ue.convertArea=UT;function Pc(r){return!isNaN(r)&&r!==null&&!Array.isArray(r)}ue.isNumber=Pc;function BT(r){return!!r&&r.constructor===Object}ue.isObject=BT;function zT(r){if(!r)throw new Error("bbox is required");if(!Array.isArray(r))throw new Error("bbox must be an Array");if(r.length!==4&&r.length!==6)throw new Error("bbox must be an Array of 4 or 6 numbers");r.forEach(function(t){if(!Pc(t))throw new Error("bbox must only contain numbers")})}ue.validateBBox=zT;function kT(r){if(!r)throw new Error("id is required");if(["string","number"].indexOf(typeof r)===-1)throw new Error("id must be a number or a string")}ue.validateId=kT});var Tp=Kt(ir=>{"use strict";Object.defineProperty(ir,"__esModule",{value:!0});var Gr=wp();function Ju(r,t,e){if(r!==null)for(var o,a,l,f,h,p,d,g=0,_=0,y,M=r.type,w=M==="FeatureCollection",T=M==="Feature",x=w?r.features.length:1,v=0;v<x;v++){d=w?r.features[v].geometry:T?r.geometry:r,y=d?d.type==="GeometryCollection":!1,h=y?d.geometries.length:1;for(var C=0;C<h;C++){var S=0,O=0;if(f=y?d.geometries[C]:d,f!==null){p=f.coordinates;var F=f.type;switch(g=e&&(F==="Polygon"||F==="MultiPolygon")?1:0,F){case null:break;case"Point":if(t(p,_,v,S,O)===!1)return!1;_++,S++;break;case"LineString":case"MultiPoint":for(o=0;o<p.length;o++){if(t(p[o],_,v,S,O)===!1)return!1;_++,F==="MultiPoint"&&S++}F==="LineString"&&S++;break;case"Polygon":case"MultiLineString":for(o=0;o<p.length;o++){for(a=0;a<p[o].length-g;a++){if(t(p[o][a],_,v,S,O)===!1)return!1;_++}F==="MultiLineString"&&S++,F==="Polygon"&&O++}F==="Polygon"&&S++;break;case"MultiPolygon":for(o=0;o<p.length;o++){for(O=0,a=0;a<p[o].length;a++){for(l=0;l<p[o][a].length-g;l++){if(t(p[o][a][l],_,v,S,O)===!1)return!1;_++}O++}S++}break;case"GeometryCollection":for(o=0;o<f.geometries.length;o++)if(Ju(f.geometries[o],t,e)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function GT(r,t,e,o){var a=e;return Ju(r,function(l,f,h,p,d){f===0&&e===void 0?a=l:a=t(a,l,f,h,p,d)},o),a}function $0(r,t){var e;switch(r.type){case"FeatureCollection":for(e=0;e<r.features.length&&t(r.features[e].properties,e)!==!1;e++);break;case"Feature":t(r.properties,0);break}}function VT(r,t,e){var o=e;return $0(r,function(a,l){l===0&&e===void 0?o=a:o=t(o,a,l)}),o}function K0(r,t){if(r.type==="Feature")t(r,0);else if(r.type==="FeatureCollection")for(var e=0;e<r.features.length&&t(r.features[e],e)!==!1;e++);}function HT(r,t,e){var o=e;return K0(r,function(a,l){l===0&&e===void 0?o=a:o=t(o,a,l)}),o}function WT(r){var t=[];return Ju(r,function(e){t.push(e)}),t}function bp(r,t){var e,o,a,l,f,h,p,d,g,_,y=0,M=r.type==="FeatureCollection",w=r.type==="Feature",T=M?r.features.length:1;for(e=0;e<T;e++){for(h=M?r.features[e].geometry:w?r.geometry:r,d=M?r.features[e].properties:w?r.properties:{},g=M?r.features[e].bbox:w?r.bbox:void 0,_=M?r.features[e].id:w?r.id:void 0,p=h?h.type==="GeometryCollection":!1,f=p?h.geometries.length:1,a=0;a<f;a++){if(l=p?h.geometries[a]:h,l===null){if(t(null,y,d,g,_)===!1)return!1;continue}switch(l.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":{if(t(l,y,d,g,_)===!1)return!1;break}case"GeometryCollection":{for(o=0;o<l.geometries.length;o++)if(t(l.geometries[o],y,d,g,_)===!1)return!1;break}default:throw new Error("Unknown Geometry Type")}}y++}}function qT(r,t,e){var o=e;return bp(r,function(a,l,f,h,p){l===0&&e===void 0?o=a:o=t(o,a,l,f,h,p)}),o}function Rc(r,t){bp(r,function(e,o,a,l,f){var h=e===null?null:e.type;switch(h){case null:case"Point":case"LineString":case"Polygon":return t(Gr.feature(e,a,{bbox:l,id:f}),o,0)===!1?!1:void 0}var p;switch(h){case"MultiPoint":p="Point";break;case"MultiLineString":p="LineString";break;case"MultiPolygon":p="Polygon";break}for(var d=0;d<e.coordinates.length;d++){var g=e.coordinates[d],_={type:p,coordinates:g};if(t(Gr.feature(_,a),o,d)===!1)return!1}})}function XT(r,t,e){var o=e;return Rc(r,function(a,l,f){l===0&&f===0&&e===void 0?o=a:o=t(o,a,l,f)}),o}function j0(r,t){Rc(r,function(e,o,a){var l=0;if(e.geometry){var f=e.geometry.type;if(!(f==="Point"||f==="MultiPoint")){var h,p=0,d=0,g=0;if(Ju(e,function(_,y,M,w,T){if(h===void 0||o>p||w>d||T>g){h=_,p=o,d=w,g=T,l=0;return}var x=Gr.lineString([h,_],e.properties);if(t(x,o,a,T,l)===!1)return!1;l++,h=_})===!1)return!1}}})}function YT(r,t,e){var o=e,a=!1;return j0(r,function(l,f,h,p,d){a===!1&&e===void 0?o=l:o=t(o,l,f,h,p,d),a=!0}),o}function Q0(r,t){if(!r)throw new Error("geojson is required");Rc(r,function(e,o,a){if(e.geometry!==null){var l=e.geometry.type,f=e.geometry.coordinates;switch(l){case"LineString":if(t(e,o,a,0,0)===!1)return!1;break;case"Polygon":for(var h=0;h<f.length;h++)if(t(Gr.lineString(f[h],e.properties),o,a,h)===!1)return!1;break}}})}function ZT(r,t,e){var o=e;return Q0(r,function(a,l,f,h){l===0&&e===void 0?o=a:o=t(o,a,l,f,h)}),o}function JT(r,t){if(t=t||{},!Gr.isObject(t))throw new Error("options is invalid");var e=t.featureIndex||0,o=t.multiFeatureIndex||0,a=t.geometryIndex||0,l=t.segmentIndex||0,f=t.properties,h;switch(r.type){case"FeatureCollection":e<0&&(e=r.features.length+e),f=f||r.features[e].properties,h=r.features[e].geometry;break;case"Feature":f=f||r.properties,h=r.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":h=r;break;default:throw new Error("geojson is invalid")}if(h===null)return null;var p=h.coordinates;switch(h.type){case"Point":case"MultiPoint":return null;case"LineString":return l<0&&(l=p.length+l-1),Gr.lineString([p[l],p[l+1]],f,t);case"Polygon":return a<0&&(a=p.length+a),l<0&&(l=p[a].length+l-1),Gr.lineString([p[a][l],p[a][l+1]],f,t);case"MultiLineString":return o<0&&(o=p.length+o),l<0&&(l=p[o].length+l-1),Gr.lineString([p[o][l],p[o][l+1]],f,t);case"MultiPolygon":return o<0&&(o=p.length+o),a<0&&(a=p[o].length+a),l<0&&(l=p[o][a].length-l-1),Gr.lineString([p[o][a][l],p[o][a][l+1]],f,t)}throw new Error("geojson is invalid")}function $T(r,t){if(t=t||{},!Gr.isObject(t))throw new Error("options is invalid");var e=t.featureIndex||0,o=t.multiFeatureIndex||0,a=t.geometryIndex||0,l=t.coordIndex||0,f=t.properties,h;switch(r.type){case"FeatureCollection":e<0&&(e=r.features.length+e),f=f||r.features[e].properties,h=r.features[e].geometry;break;case"Feature":f=f||r.properties,h=r.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":h=r;break;default:throw new Error("geojson is invalid")}if(h===null)return null;var p=h.coordinates;switch(h.type){case"Point":return Gr.point(p,f,t);case"MultiPoint":return o<0&&(o=p.length+o),Gr.point(p[o],f,t);case"LineString":return l<0&&(l=p.length+l),Gr.point(p[l],f,t);case"Polygon":return a<0&&(a=p.length+a),l<0&&(l=p[a].length+l),Gr.point(p[a][l],f,t);case"MultiLineString":return o<0&&(o=p.length+o),l<0&&(l=p[o].length+l),Gr.point(p[o][l],f,t);case"MultiPolygon":return o<0&&(o=p.length+o),a<0&&(a=p[o].length+a),l<0&&(l=p[o][a].length-l),Gr.point(p[o][a][l],f,t)}throw new Error("geojson is invalid")}ir.coordAll=WT;ir.coordEach=Ju;ir.coordReduce=GT;ir.featureEach=K0;ir.featureReduce=HT;ir.findPoint=$T;ir.findSegment=JT;ir.flattenEach=Rc;ir.flattenReduce=XT;ir.geomEach=bp;ir.geomReduce=qT;ir.lineEach=Q0;ir.lineReduce=ZT;ir.propEach=$0;ir.propReduce=VT;ir.segmentEach=j0;ir.segmentReduce=YT});var ty=Kt(Cp=>{"use strict";Object.defineProperty(Cp,"__esModule",{value:!0});var KT=Tp();function Ap(r){var t=[1/0,1/0,-1/0,-1/0];return KT.coordEach(r,function(e){t[0]>e[0]&&(t[0]=e[0]),t[1]>e[1]&&(t[1]=e[1]),t[2]<e[0]&&(t[2]=e[0]),t[3]<e[1]&&(t[3]=e[1])}),t}Ap.default=Ap;Cp.default=Ap});var Lc=Kt((bO,Pp)=>{var po=tp(),ny=wp(),ry=Tp(),tu=ty().default,jT=ry.featureEach,SO=ry.coordEach,wO=ny.polygon,ey=ny.featureCollection;function iy(r){var t=new po(r);return t.insert=function(e){if(e.type!=="Feature")throw new Error("invalid feature");return e.bbox=e.bbox?e.bbox:tu(e),po.prototype.insert.call(this,e)},t.load=function(e){var o=[];return Array.isArray(e)?e.forEach(function(a){if(a.type!=="Feature")throw new Error("invalid features");a.bbox=a.bbox?a.bbox:tu(a),o.push(a)}):jT(e,function(a){if(a.type!=="Feature")throw new Error("invalid features");a.bbox=a.bbox?a.bbox:tu(a),o.push(a)}),po.prototype.load.call(this,o)},t.remove=function(e,o){if(e.type!=="Feature")throw new Error("invalid feature");return e.bbox=e.bbox?e.bbox:tu(e),po.prototype.remove.call(this,e,o)},t.clear=function(){return po.prototype.clear.call(this)},t.search=function(e){var o=po.prototype.search.call(this,this.toBBox(e));return ey(o)},t.collides=function(e){return po.prototype.collides.call(this,this.toBBox(e))},t.all=function(){var e=po.prototype.all.call(this);return ey(e)},t.toJSON=function(){return po.prototype.toJSON.call(this)},t.fromJSON=function(e){return po.prototype.fromJSON.call(this,e)},t.toBBox=function(e){var o;if(e.bbox)o=e.bbox;else if(Array.isArray(e)&&e.length===4)o=e;else if(Array.isArray(e)&&e.length===6)o=[e[0],e[1],e[3],e[4]];else if(e.type==="Feature")o=tu(e);else if(e.type==="FeatureCollection")o=tu(e);else throw new Error("invalid geojson");return{minX:o[0],minY:o[1],maxX:o[2],maxY:o[3]}},t}Pp.exports=iy;Pp.exports.default=iy});var Dp=Kt((O3,dy)=>{"use strict";var py=Object.prototype.toString;dy.exports=function(t){var e=py.call(t),o=e==="[object Arguments]";return o||(o=e!=="[object Array]"&&t!==null&&typeof t=="object"&&typeof t.length=="number"&&t.length>=0&&py.call(t.callee)==="[object Function]"),o}});var Sy=Kt((D3,My)=>{"use strict";var Ey;Object.keys||(ju=Object.prototype.hasOwnProperty,Fp=Object.prototype.toString,my=Dp(),Up=Object.prototype.propertyIsEnumerable,gy=!Up.call({toString:null},"toString"),yy=Up.call(function(){},"prototype"),Qu=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],Uc=function(r){var t=r.constructor;return t&&t.prototype===r},vy={$applicationCache:!0,$console:!0,$external:!0,$frame:!0,$frameElement:!0,$frames:!0,$innerHeight:!0,$innerWidth:!0,$onmozfullscreenchange:!0,$onmozfullscreenerror:!0,$outerHeight:!0,$outerWidth:!0,$pageXOffset:!0,$pageYOffset:!0,$parent:!0,$scrollLeft:!0,$scrollTop:!0,$scrollX:!0,$scrollY:!0,$self:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0,$window:!0},_y=function(){if(typeof window=="undefined")return!1;for(var r in window)try{if(!vy["$"+r]&&ju.call(window,r)&&window[r]!==null&&typeof window[r]=="object")try{Uc(window[r])}catch(t){return!0}}catch(t){return!0}return!1}(),xy=function(r){if(typeof window=="undefined"||!_y)return Uc(r);try{return Uc(r)}catch(t){return!1}},Ey=function(t){var e=t!==null&&typeof t=="object",o=Fp.call(t)==="[object Function]",a=my(t),l=e&&Fp.call(t)==="[object String]",f=[];if(!e&&!o&&!a)throw new TypeError("Object.keys called on a non-object");var h=yy&&o;if(l&&t.length>0&&!ju.call(t,0))for(var p=0;p<t.length;++p)f.push(String(p));if(a&&t.length>0)for(var d=0;d<t.length;++d)f.push(String(d));else for(var g in t)!(h&&g==="prototype")&&ju.call(t,g)&&f.push(String(g));if(gy)for(var _=xy(t),y=0;y<Qu.length;++y)!(_&&Qu[y]==="constructor")&&ju.call(t,Qu[y])&&f.push(Qu[y]);return f});var ju,Fp,my,Up,gy,yy,Qu,Uc,vy,_y,xy;My.exports=Ey});var Bp=Kt((F3,Ty)=>{"use strict";var uA=Array.prototype.slice,lA=Dp(),wy=Object.keys,Bc=wy?function(t){return wy(t)}:Sy(),by=Object.keys;Bc.shim=function(){if(Object.keys){var t=function(){var e=Object.keys(arguments);return e&&e.length===arguments.length}(1,2);t||(Object.keys=function(o){return lA(o)?by(uA.call(o)):by(o)})}else Object.keys=Bc;return Object.keys||Bc};Ty.exports=Bc});var zp=Kt((U3,Ay)=>{"use strict";Ay.exports=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var t={},e=Symbol("test"),o=Object(e);if(typeof e=="string"||Object.prototype.toString.call(e)!=="[object Symbol]"||Object.prototype.toString.call(o)!=="[object Symbol]")return!1;var a=42;t[e]=a;for(e in t)return!1;if(typeof Object.keys=="function"&&Object.keys(t).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(t).length!==0)return!1;var l=Object.getOwnPropertySymbols(t);if(l.length!==1||l[0]!==e||!Object.prototype.propertyIsEnumerable.call(t,e))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var f=Object.getOwnPropertyDescriptor(t,e);if(f.value!==a||f.enumerable!==!0)return!1}return!0}});var zc=Kt((B3,Cy)=>{"use strict";var cA=zp();Cy.exports=function(){return cA()&&!!Symbol.toStringTag}});var Ry=Kt((z3,Iy)=>{"use strict";var Py=typeof Symbol!="undefined"&&Symbol,fA=zp();Iy.exports=function(){return typeof Py!="function"||typeof Symbol!="function"||typeof Py("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:fA()}});var Oy=Kt((k3,Ny)=>{"use strict";var Ly={foo:{}},hA=Object;Ny.exports=function(){return{__proto__:Ly}.foo===Ly.foo&&!({__proto__:null}instanceof hA)}});var Uy=Kt((G3,Fy)=>{"use strict";var pA="Function.prototype.bind called on incompatible ",dA=Object.prototype.toString,mA=Math.max,gA="[object Function]",Dy=function(t,e){for(var o=[],a=0;a<t.length;a+=1)o[a]=t[a];for(var l=0;l<e.length;l+=1)o[l+t.length]=e[l];return o},yA=function(t,e){for(var o=[],a=e||0,l=0;a<t.length;a+=1,l+=1)o[l]=t[a];return o},vA=function(r,t){for(var e="",o=0;o<r.length;o+=1)e+=r[o],o+1<r.length&&(e+=t);return e};Fy.exports=function(t){var e=this;if(typeof e!="function"||dA.apply(e)!==gA)throw new TypeError(pA+e);for(var o=yA(arguments,1),a,l=function(){if(this instanceof a){var g=e.apply(this,Dy(o,arguments));return Object(g)===g?g:this}return e.apply(t,Dy(o,arguments))},f=mA(0,e.length-o.length),h=[],p=0;p<f;p++)h[p]="$"+p;if(a=Function("binder","return function ("+vA(h,",")+"){ return binder.apply(this,arguments); }")(l),e.prototype){var d=function(){};d.prototype=e.prototype,a.prototype=new d,d.prototype=null}return a}});var kc=Kt((V3,By)=>{"use strict";var _A=Uy();By.exports=Function.prototype.bind||_A});var ky=Kt((H3,zy)=>{"use strict";var xA=Function.prototype.call,EA=Object.prototype.hasOwnProperty,MA=kc();zy.exports=MA.call(xA,EA)});var Qs=Kt((W3,qy)=>{"use strict";var tn,iu=SyntaxError,Wy=Function,ru=TypeError,kp=function(r){try{return Wy(\'"use strict"; return (\'+r+").constructor;")()}catch(t){}},Ks=Object.getOwnPropertyDescriptor;if(Ks)try{Ks({},"")}catch(r){Ks=null}var Gp=function(){throw new ru},SA=Ks?function(){try{return arguments.callee,Gp}catch(r){try{return Ks(arguments,"callee").get}catch(t){return Gp}}}():Gp,eu=Ry()(),wA=Oy()(),vr=Object.getPrototypeOf||(wA?function(r){return r.__proto__}:null),nu={},bA=typeof Uint8Array=="undefined"||!vr?tn:vr(Uint8Array),js={"%AggregateError%":typeof AggregateError=="undefined"?tn:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer=="undefined"?tn:ArrayBuffer,"%ArrayIteratorPrototype%":eu&&vr?vr([][Symbol.iterator]()):tn,"%AsyncFromSyncIteratorPrototype%":tn,"%AsyncFunction%":nu,"%AsyncGenerator%":nu,"%AsyncGeneratorFunction%":nu,"%AsyncIteratorPrototype%":nu,"%Atomics%":typeof Atomics=="undefined"?tn:Atomics,"%BigInt%":typeof BigInt=="undefined"?tn:BigInt,"%BigInt64Array%":typeof BigInt64Array=="undefined"?tn:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array=="undefined"?tn:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView=="undefined"?tn:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":typeof Float32Array=="undefined"?tn:Float32Array,"%Float64Array%":typeof Float64Array=="undefined"?tn:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry=="undefined"?tn:FinalizationRegistry,"%Function%":Wy,"%GeneratorFunction%":nu,"%Int8Array%":typeof Int8Array=="undefined"?tn:Int8Array,"%Int16Array%":typeof Int16Array=="undefined"?tn:Int16Array,"%Int32Array%":typeof Int32Array=="undefined"?tn:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":eu&&vr?vr(vr([][Symbol.iterator]())):tn,"%JSON%":typeof JSON=="object"?JSON:tn,"%Map%":typeof Map=="undefined"?tn:Map,"%MapIteratorPrototype%":typeof Map=="undefined"||!eu||!vr?tn:vr(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise=="undefined"?tn:Promise,"%Proxy%":typeof Proxy=="undefined"?tn:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":typeof Reflect=="undefined"?tn:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set=="undefined"?tn:Set,"%SetIteratorPrototype%":typeof Set=="undefined"||!eu||!vr?tn:vr(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer=="undefined"?tn:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":eu&&vr?vr(""[Symbol.iterator]()):tn,"%Symbol%":eu?Symbol:tn,"%SyntaxError%":iu,"%ThrowTypeError%":SA,"%TypedArray%":bA,"%TypeError%":ru,"%Uint8Array%":typeof Uint8Array=="undefined"?tn:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray=="undefined"?tn:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array=="undefined"?tn:Uint16Array,"%Uint32Array%":typeof Uint32Array=="undefined"?tn:Uint32Array,"%URIError%":URIError,"%WeakMap%":typeof WeakMap=="undefined"?tn:WeakMap,"%WeakRef%":typeof WeakRef=="undefined"?tn:WeakRef,"%WeakSet%":typeof WeakSet=="undefined"?tn:WeakSet};if(vr)try{null.error}catch(r){Gy=vr(vr(r)),js["%Error.prototype%"]=Gy}var Gy,TA=function r(t){var e;if(t==="%AsyncFunction%")e=kp("async function () {}");else if(t==="%GeneratorFunction%")e=kp("function* () {}");else if(t==="%AsyncGeneratorFunction%")e=kp("async function* () {}");else if(t==="%AsyncGenerator%"){var o=r("%AsyncGeneratorFunction%");o&&(e=o.prototype)}else if(t==="%AsyncIteratorPrototype%"){var a=r("%AsyncGenerator%");a&&vr&&(e=vr(a.prototype))}return js[t]=e,e},Vy={"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},tl=kc(),Gc=ky(),AA=tl.call(Function.call,Array.prototype.concat),CA=tl.call(Function.apply,Array.prototype.splice),Hy=tl.call(Function.call,String.prototype.replace),Vc=tl.call(Function.call,String.prototype.slice),PA=tl.call(Function.call,RegExp.prototype.exec),IA=/[^%.[\\]]+|\\[(?:(-?\\d+(?:\\.\\d+)?)|(["\'])((?:(?!\\2)[^\\\\]|\\\\.)*?)\\2)\\]|(?=(?:\\.|\\[\\])(?:\\.|\\[\\]|%$))/g,RA=/\\\\(\\\\)?/g,LA=function(t){var e=Vc(t,0,1),o=Vc(t,-1);if(e==="%"&&o!=="%")throw new iu("invalid intrinsic syntax, expected closing `%`");if(o==="%"&&e!=="%")throw new iu("invalid intrinsic syntax, expected opening `%`");var a=[];return Hy(t,IA,function(l,f,h,p){a[a.length]=h?Hy(p,RA,"$1"):f||l}),a},NA=function(t,e){var o=t,a;if(Gc(Vy,o)&&(a=Vy[o],o="%"+a[0]+"%"),Gc(js,o)){var l=js[o];if(l===nu&&(l=TA(o)),typeof l=="undefined"&&!e)throw new ru("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:a,name:o,value:l}}throw new iu("intrinsic "+t+" does not exist!")};qy.exports=function(t,e){if(typeof t!="string"||t.length===0)throw new ru("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof e!="boolean")throw new ru(\'"allowMissing" argument must be a boolean\');if(PA(/^%?[^%]*%?$/,t)===null)throw new iu("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var o=LA(t),a=o.length>0?o[0]:"",l=NA("%"+a+"%",e),f=l.name,h=l.value,p=!1,d=l.alias;d&&(a=d[0],CA(o,AA([0,1],d)));for(var g=1,_=!0;g<o.length;g+=1){var y=o[g],M=Vc(y,0,1),w=Vc(y,-1);if((M===\'"\'||M==="\'"||M==="`"||w===\'"\'||w==="\'"||w==="`")&&M!==w)throw new iu("property names with quotes must have matching quotes");if((y==="constructor"||!_)&&(p=!0),a+="."+y,f="%"+a+"%",Gc(js,f))h=js[f];else if(h!=null){if(!(y in h)){if(!e)throw new ru("base intrinsic for "+t+" exists, but the property is not available.");return}if(Ks&&g+1>=o.length){var T=Ks(h,y);_=!!T,_&&"get"in T&&!("originalValue"in T.get)?h=T.get:h=h[y]}else _=Gc(h,y),h=h[y];_&&!p&&(js[f]=h)}}return h}});var el=Kt((q3,Xy)=>{"use strict";var OA=Qs(),Vp=OA("%Object.defineProperty%",!0),Hp=function(){if(Vp)try{return Vp({},"a",{value:1}),!0}catch(t){return!1}return!1};Hp.hasArrayLengthDefineBug=function(){if(!Hp())return null;try{return Vp([],"length",{value:1}).length!==1}catch(t){return!0}};Xy.exports=Hp});var Wp=Kt((X3,Yy)=>{"use strict";var DA=Qs(),Hc=DA("%Object.getOwnPropertyDescriptor%",!0);if(Hc)try{Hc([],"length")}catch(r){Hc=null}Yy.exports=Hc});var Wc=Kt((Y3,Jy)=>{"use strict";var FA=el()(),qp=Qs(),nl=FA&&qp("%Object.defineProperty%",!0);if(nl)try{nl({},"a",{value:1})}catch(r){nl=!1}var UA=qp("%SyntaxError%"),ou=qp("%TypeError%"),Zy=Wp();Jy.exports=function(t,e,o){if(!t||typeof t!="object"&&typeof t!="function")throw new ou("`obj` must be an object or a function`");if(typeof e!="string"&&typeof e!="symbol")throw new ou("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new ou("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new ou("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new ou("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new ou("`loose`, if provided, must be a boolean");var a=arguments.length>3?arguments[3]:null,l=arguments.length>4?arguments[4]:null,f=arguments.length>5?arguments[5]:null,h=arguments.length>6?arguments[6]:!1,p=!!Zy&&Zy(t,e);if(nl)nl(t,e,{configurable:f===null&&p?p.configurable:!f,enumerable:a===null&&p?p.enumerable:!a,value:o,writable:l===null&&p?p.writable:!l});else if(h||!a&&!l&&!f)t[e]=o;else throw new UA("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")}});var ev=Kt((Z3,tv)=>{"use strict";var Qy=Qs(),$y=Wc(),BA=el()(),Ky=Wp(),jy=Qy("%TypeError%"),zA=Qy("%Math.floor%");tv.exports=function(t,e){if(typeof t!="function")throw new jy("`fn` is not a function");if(typeof e!="number"||e<0||e>4294967295||zA(e)!==e)throw new jy("`length` must be a positive 32-bit integer");var o=arguments.length>2&&!!arguments[2],a=!0,l=!0;if("length"in t&&Ky){var f=Ky(t,"length");f&&!f.configurable&&(a=!1),f&&!f.writable&&(l=!1)}return(a||l||!o)&&(BA?$y(t,"length",e,!0,!0):$y(t,"length",e)),t}});var Xc=Kt((J3,qc)=>{"use strict";var Xp=kc(),su=Qs(),kA=ev(),GA=su("%TypeError%"),rv=su("%Function.prototype.apply%"),iv=su("%Function.prototype.call%"),ov=su("%Reflect.apply%",!0)||Xp.call(iv,rv),rl=su("%Object.defineProperty%",!0),VA=su("%Math.max%");if(rl)try{rl({},"a",{value:1})}catch(r){rl=null}qc.exports=function(t){if(typeof t!="function")throw new GA("a function is required");var e=ov(Xp,iv,arguments);return kA(e,1+VA(0,t.length-(arguments.length-1)),!0)};var nv=function(){return ov(Xp,rv,arguments)};rl?rl(qc.exports,"apply",{value:nv}):qc.exports.apply=nv});var Yp=Kt(($3,uv)=>{"use strict";var sv=Qs(),av=Xc(),HA=av(sv("String.prototype.indexOf"));uv.exports=function(t,e){var o=sv(t,!!e);return typeof o=="function"&&HA(t,".prototype.")>-1?av(o):o}});var fv=Kt((K3,cv)=>{"use strict";var WA=zc()(),qA=Yp(),Zp=qA("Object.prototype.toString"),Yc=function(t){return WA&&t&&typeof t=="object"&&Symbol.toStringTag in t?!1:Zp(t)==="[object Arguments]"},lv=function(t){return Yc(t)?!0:t!==null&&typeof t=="object"&&typeof t.length=="number"&&t.length>=0&&Zp(t)!=="[object Array]"&&Zp(t.callee)==="[object Function]"},XA=function(){return Yc(arguments)}();Yc.isLegacyArguments=lv;cv.exports=XA?Yc:lv});var au=Kt((j3,mv)=>{"use strict";var YA=Bp(),ZA=typeof Symbol=="function"&&typeof Symbol("foo")=="symbol",JA=Object.prototype.toString,$A=Array.prototype.concat,hv=Wc(),KA=function(r){return typeof r=="function"&&JA.call(r)==="[object Function]"},pv=el()(),jA=function(r,t,e,o){if(t in r){if(o===!0){if(r[t]===e)return}else if(!KA(o)||!o())return}pv?hv(r,t,e,!0):hv(r,t,e)},dv=function(r,t){var e=arguments.length>2?arguments[2]:{},o=YA(t);ZA&&(o=$A.call(o,Object.getOwnPropertySymbols(t)));for(var a=0;a<o.length;a+=1)jA(r,o[a],t[o[a]],e[o[a]])};dv.supportsDescriptors=!!pv;mv.exports=dv});var Jp=Kt((Q3,yv)=>{"use strict";var gv=function(r){return r!==r};yv.exports=function(t,e){return t===0&&e===0?1/t===1/e:!!(t===e||gv(t)&&gv(e))}});var $p=Kt((tF,vv)=>{"use strict";var QA=Jp();vv.exports=function(){return typeof Object.is=="function"?Object.is:QA}});var xv=Kt((eF,_v)=>{"use strict";var tC=$p(),eC=au();_v.exports=function(){var t=tC();return eC(Object,{is:t},{is:function(){return Object.is!==t}}),t}});var wv=Kt((nF,Sv)=>{"use strict";var nC=au(),rC=Xc(),iC=Jp(),Ev=$p(),oC=xv(),Mv=rC(Ev(),Object);nC(Mv,{getPolyfill:Ev,implementation:iC,shim:oC});Sv.exports=Mv});var Pv=Kt((rF,Cv)=>{"use strict";var Kp=Yp(),bv=zc()(),Tv,Av,jp,Qp;bv&&(Tv=Kp("Object.prototype.hasOwnProperty"),Av=Kp("RegExp.prototype.exec"),jp={},Zc=function(){throw jp},Qp={toString:Zc,valueOf:Zc},typeof Symbol.toPrimitive=="symbol"&&(Qp[Symbol.toPrimitive]=Zc));var Zc,sC=Kp("Object.prototype.toString"),aC=Object.getOwnPropertyDescriptor,uC="[object RegExp]";Cv.exports=bv?function(t){if(!t||typeof t!="object")return!1;var e=aC(t,"lastIndex"),o=e&&Tv(e,"value");if(!o)return!1;try{Av(t,Qp)}catch(a){return a===jp}}:function(t){return!t||typeof t!="object"&&typeof t!="function"?!1:sC(t)===uC}});var Rv=Kt((iF,Iv)=>{"use strict";var ol=function(){return typeof function(){}.name=="string"},il=Object.getOwnPropertyDescriptor;if(il)try{il([],"length")}catch(r){il=null}ol.functionsHaveConfigurableNames=function(){if(!ol()||!il)return!1;var t=il(function(){},"name");return!!t&&!!t.configurable};var lC=Function.prototype.bind;ol.boundFunctionsHaveNames=function(){return ol()&&typeof lC=="function"&&function(){}.bind().name!==""};Iv.exports=ol});var Ov=Kt((oF,Nv)=>{"use strict";var Lv=Wc(),cC=el()(),fC=Rv().functionsHaveConfigurableNames(),hC=TypeError;Nv.exports=function(t,e){if(typeof t!="function")throw new hC("`fn` is not a function");var o=arguments.length>2&&!!arguments[2];return(!o||fC)&&(cC?Lv(t,"name",e,!0,!0):Lv(t,"name",e)),t}});var td=Kt((sF,Dv)=>{"use strict";var pC=Ov(),dC=Object,mC=TypeError;Dv.exports=pC(function(){if(this!=null&&this!==dC(this))throw new mC("RegExp.prototype.flags getter called on non-object");var t="";return this.hasIndices&&(t+="d"),this.global&&(t+="g"),this.ignoreCase&&(t+="i"),this.multiline&&(t+="m"),this.dotAll&&(t+="s"),this.unicode&&(t+="u"),this.unicodeSets&&(t+="v"),this.sticky&&(t+="y"),t},"get flags",!0)});var ed=Kt((aF,Fv)=>{"use strict";var gC=td(),yC=au().supportsDescriptors,vC=Object.getOwnPropertyDescriptor;Fv.exports=function(){if(yC&&/a/mig.flags==="gim"){var t=vC(RegExp.prototype,"flags");if(t&&typeof t.get=="function"&&typeof RegExp.prototype.dotAll=="boolean"&&typeof RegExp.prototype.hasIndices=="boolean"){var e="",o={};if(Object.defineProperty(o,"hasIndices",{get:function(){e+="d"}}),Object.defineProperty(o,"sticky",{get:function(){e+="y"}}),e==="dy")return t.get}}return gC}});var zv=Kt((uF,Bv)=>{"use strict";var _C=au().supportsDescriptors,xC=ed(),EC=Object.getOwnPropertyDescriptor,MC=Object.defineProperty,SC=TypeError,Uv=Object.getPrototypeOf,wC=/a/;Bv.exports=function(){if(!_C||!Uv)throw new SC("RegExp.prototype.flags requires a true ES5 environment that supports property descriptors");var t=xC(),e=Uv(wC),o=EC(e,"flags");return(!o||o.get!==t)&&MC(e,"flags",{configurable:!0,enumerable:!1,get:t}),t}});var Hv=Kt((lF,Vv)=>{"use strict";var bC=au(),TC=Xc(),AC=td(),kv=ed(),CC=zv(),Gv=TC(kv());bC(Gv,{getPolyfill:kv,implementation:AC,shim:CC});Vv.exports=Gv});var qv=Kt((cF,Wv)=>{"use strict";var PC=Date.prototype.getDay,IC=function(t){try{return PC.call(t),!0}catch(e){return!1}},RC=Object.prototype.toString,LC="[object Date]",NC=zc()();Wv.exports=function(t){return typeof t!="object"||t===null?!1:NC?IC(t):RC.call(t)===LC}});var nd=Kt((fF,n_)=>{var Xv=Bp(),Yv=fv(),Zv=wv(),Jv=Pv(),$v=Hv(),Kv=qv(),jv=Date.prototype.getTime;function e_(r,t,e){var o=e||{};return(o.strict?Zv(r,t):r===t)?!0:!r||!t||typeof r!="object"&&typeof t!="object"?o.strict?Zv(r,t):r==t:OC(r,t,o)}function Qv(r){return r==null}function t_(r){return!(!r||typeof r!="object"||typeof r.length!="number"||typeof r.copy!="function"||typeof r.slice!="function"||r.length>0&&typeof r[0]!="number")}function OC(r,t,e){var o,a;if(typeof r!=typeof t||Qv(r)||Qv(t)||r.prototype!==t.prototype||Yv(r)!==Yv(t))return!1;var l=Jv(r),f=Jv(t);if(l!==f)return!1;if(l||f)return r.source===t.source&&$v(r)===$v(t);if(Kv(r)&&Kv(t))return jv.call(r)===jv.call(t);var h=t_(r),p=t_(t);if(h!==p)return!1;if(h||p){if(r.length!==t.length)return!1;for(o=0;o<r.length;o++)if(r[o]!==t[o])return!1;return!0}if(typeof r!=typeof t)return!1;try{var d=Xv(r),g=Xv(t)}catch(_){return!1}if(d.length!==g.length)return!1;for(d.sort(),g.sort(),o=d.length-1;o>=0;o--)if(d[o]!=g[o])return!1;for(o=d.length-1;o>=0;o--)if(a=d[o],!e_(r[a],t[a],e))return!1;return!0}n_.exports=e_});var dd=Kt((yB,l_)=>{var wP=nd(),mo=function(r){this.precision=r&&r.precision?r.precision:17,this.direction=r&&r.direction?r.direction:!1,this.pseudoNode=r&&r.pseudoNode?r.pseudoNode:!1,this.objectComparator=r&&r.objectComparator?r.objectComparator:bP};mo.prototype.compare=function(r,t){if(r.type!==t.type||!u_(r,t))return!1;switch(r.type){case"Point":return this.compareCoord(r.coordinates,t.coordinates);case"LineString":return this.compareLine(r.coordinates,t.coordinates,0,!1);case"Polygon":return this.comparePolygon(r,t);case"Feature":return this.compareFeature(r,t);default:if(r.type.indexOf("Multi")===0){var e=this,o=a_(r),a=a_(t);return o.every(function(l){return this.some(function(f){return e.compare(l,f)})},a)}}return!1};function a_(r){return r.coordinates.map(function(t){return{type:r.type.replace("Multi",""),coordinates:t}})}function u_(r,t){return r.hasOwnProperty("coordinates")?r.coordinates.length===t.coordinates.length:r.length===t.length}mo.prototype.compareCoord=function(r,t){if(r.length!==t.length)return!1;for(var e=0;e<r.length;e++)if(r[e].toFixed(this.precision)!==t[e].toFixed(this.precision))return!1;return!0};mo.prototype.compareLine=function(r,t,e,o){if(!u_(r,t))return!1;var a=this.pseudoNode?r:this.removePseudo(r),l=this.pseudoNode?t:this.removePseudo(t);if(!(o&&!this.compareCoord(a[0],l[0])&&(l=this.fixStartIndex(l,a),!l))){var f=this.compareCoord(a[e],l[e]);return this.direction||f?this.comparePath(a,l):this.compareCoord(a[e],l[l.length-(1+e)])?this.comparePath(a.slice().reverse(),l):!1}};mo.prototype.fixStartIndex=function(r,t){for(var e,o=-1,a=0;a<r.length;a++)if(this.compareCoord(r[a],t[0])){o=a;break}return o>=0&&(e=[].concat(r.slice(o,r.length),r.slice(1,o+1))),e};mo.prototype.comparePath=function(r,t){var e=this;return r.every(function(o,a){return e.compareCoord(o,this[a])},t)};mo.prototype.comparePolygon=function(r,t){if(this.compareLine(r.coordinates[0],t.coordinates[0],1,!0)){var e=r.coordinates.slice(1,r.coordinates.length),o=t.coordinates.slice(1,t.coordinates.length),a=this;return e.every(function(l){return this.some(function(f){return a.compareLine(l,f,1,!0)})},o)}else return!1};mo.prototype.compareFeature=function(r,t){return r.id!==t.id||!this.objectComparator(r.properties,t.properties)||!this.compareBBox(r,t)?!1:this.compare(r.geometry,t.geometry)};mo.prototype.compareBBox=function(r,t){return!!(!r.bbox&&!t.bbox||r.bbox&&t.bbox&&this.compareCoord(r.bbox,t.bbox))};mo.prototype.removePseudo=function(r){return r};function bP(r,t){return wP(r,t,{strict:!0})}l_.exports=mo});var c_=Kt((PB,Kc)=>{function xs(r,t,e,o){this.dataset=[],this.epsilon=1,this.minPts=2,this.distance=this._euclideanDistance,this.clusters=[],this.noise=[],this._visited=[],this._assigned=[],this._datasetLength=0,this._init(r,t,e,o)}xs.prototype.run=function(r,t,e,o){this._init(r,t,e,o);for(var a=0;a<this._datasetLength;a++)if(this._visited[a]!==1){this._visited[a]=1;var l=this._regionQuery(a);if(l.length<this.minPts)this.noise.push(a);else{var f=this.clusters.length;this.clusters.push([]),this._addToCluster(a,f),this._expandCluster(f,l)}}return this.clusters};xs.prototype._init=function(r,t,e,o){if(r){if(!(r instanceof Array))throw Error("Dataset must be of type array, "+typeof r+" given");this.dataset=r,this.clusters=[],this.noise=[],this._datasetLength=r.length,this._visited=new Array(this._datasetLength),this._assigned=new Array(this._datasetLength)}t&&(this.epsilon=t),e&&(this.minPts=e),o&&(this.distance=o)};xs.prototype._expandCluster=function(r,t){for(var e=0;e<t.length;e++){var o=t[e];if(this._visited[o]!==1){this._visited[o]=1;var a=this._regionQuery(o);a.length>=this.minPts&&(t=this._mergeArrays(t,a))}this._assigned[o]!==1&&this._addToCluster(o,r)}};xs.prototype._addToCluster=function(r,t){this.clusters[t].push(r),this._assigned[r]=1};xs.prototype._regionQuery=function(r){for(var t=[],e=0;e<this._datasetLength;e++){var o=this.distance(this.dataset[r],this.dataset[e]);o<this.epsilon&&t.push(e)}return t};xs.prototype._mergeArrays=function(r,t){for(var e=t.length,o=0;o<e;o++){var a=t[o];r.indexOf(a)<0&&r.push(a)}return r};xs.prototype._euclideanDistance=function(r,t){for(var e=0,o=Math.min(r.length,t.length);o--;)e+=(r[o]-t[o])*(r[o]-t[o]);return Math.sqrt(e)};typeof Kc!="undefined"&&Kc.exports&&(Kc.exports=xs)});var f_=Kt((IB,jc)=>{function Es(r,t,e){this.k=3,this.dataset=[],this.assignments=[],this.centroids=[],this.init(r,t,e)}Es.prototype.init=function(r,t,e){this.assignments=[],this.centroids=[],typeof r!="undefined"&&(this.dataset=r),typeof t!="undefined"&&(this.k=t),typeof e!="undefined"&&(this.distance=e)};Es.prototype.run=function(r,t){this.init(r,t);for(var e=this.dataset.length,o=0;o<this.k;o++)this.centroids[o]=this.randomCentroid();for(var a=!0;a;){a=this.assign();for(var l=0;l<this.k;l++){for(var f=new Array(g),h=0,p=0;p<g;p++)f[p]=0;for(var d=0;d<e;d++){var g=this.dataset[d].length;if(l===this.assignments[d]){for(var p=0;p<g;p++)f[p]+=this.dataset[d][p];h++}}if(h>0){for(var p=0;p<g;p++)f[p]/=h;this.centroids[l]=f}else this.centroids[l]=this.randomCentroid(),a=!0}}return this.getClusters()};Es.prototype.randomCentroid=function(){var r=this.dataset.length-1,t,e;do e=Math.round(Math.random()*r),t=this.dataset[e];while(this.centroids.indexOf(t)>=0);return t};Es.prototype.assign=function(){for(var r=!1,t=this.dataset.length,e,o=0;o<t;o++)e=this.argmin(this.dataset[o],this.centroids,this.distance),e!=this.assignments[o]&&(this.assignments[o]=e,r=!0);return r};Es.prototype.getClusters=function(){for(var r=new Array(this.k),t,e=0;e<this.assignments.length;e++)t=this.assignments[e],typeof r[t]=="undefined"&&(r[t]=[]),r[t].push(e);return r};Es.prototype.argmin=function(r,t,e){for(var o=Number.MAX_VALUE,a=0,l=t.length,f,h=0;h<l;h++)f=e(r,t[h]),f<o&&(o=f,a=h);return a};Es.prototype.distance=function(r,t){for(var e=0,o=Math.min(r.length,t.length);o--;){var a=r[o]-t[o];e+=a*a}return Math.sqrt(e)};typeof jc!="undefined"&&jc.exports&&(jc.exports=Es)});var md=Kt((RB,Qc)=>{function go(r,t,e){this._queue=[],this._priorities=[],this._sorting="desc",this._init(r,t,e)}go.prototype.insert=function(r,t){for(var e=this._queue.length,o=e;o--;){var a=this._priorities[o];this._sorting==="desc"?t>a&&(e=o):t<a&&(e=o)}this._insertAt(r,t,e)};go.prototype.remove=function(r){for(var t=this._queue.length;t--;){var e=this._queue[t];if(r===e){this._queue.splice(t,1),this._priorities.splice(t,1);break}}};go.prototype.forEach=function(r){this._queue.forEach(r)};go.prototype.getElements=function(){return this._queue};go.prototype.getElementPriority=function(r){return this._priorities[r]};go.prototype.getPriorities=function(){return this._priorities};go.prototype.getElementsWithPriorities=function(){for(var r=[],t=0,e=this._queue.length;t<e;t++)r.push([this._queue[t],this._priorities[t]]);return r};go.prototype._init=function(r,t,e){if(r&&t){if(this._queue=[],this._priorities=[],r.length!==t.length)throw new Error("Arrays must have the same length");for(var o=0;o<r.length;o++)this.insert(r[o],t[o])}e&&(this._sorting=e)};go.prototype._insertAt=function(r,t,e){this._queue.length===e?(this._queue.push(r),this._priorities.push(t)):(this._queue.splice(e,0,r),this._priorities.splice(e,0,t))};typeof Qc!="undefined"&&Qc.exports&&(Qc.exports=go)});var p_=Kt((LB,lu)=>{typeof lu!="undefined"&&lu.exports&&(h_=md());var h_;function Yo(r,t,e,o){this.epsilon=1,this.minPts=1,this.distance=this._euclideanDistance,this._reachability=[],this._processed=[],this._coreDistance=0,this._orderedList=[],this._init(r,t,e,o)}Yo.prototype.run=function(r,t,e,o){this._init(r,t,e,o);for(var a=0,l=this.dataset.length;a<l;a++)if(this._processed[a]!==1){this._processed[a]=1,this.clusters.push([a]);var f=this.clusters.length-1;this._orderedList.push(a);var h=new h_(null,null,"asc"),p=this._regionQuery(a);this._distanceToCore(a)!==void 0&&(this._updateQueue(a,p,h),this._expandCluster(f,h))}return this.clusters};Yo.prototype.getReachabilityPlot=function(){for(var r=[],t=0,e=this._orderedList.length;t<e;t++){var o=this._orderedList[t],a=this._reachability[o];r.push([o,a])}return r};Yo.prototype._init=function(r,t,e,o){if(r){if(!(r instanceof Array))throw Error("Dataset must be of type array, "+typeof r+" given");this.dataset=r,this.clusters=[],this._reachability=new Array(this.dataset.length),this._processed=new Array(this.dataset.length),this._coreDistance=0,this._orderedList=[]}t&&(this.epsilon=t),e&&(this.minPts=e),o&&(this.distance=o)};Yo.prototype._updateQueue=function(r,t,e){var o=this;this._coreDistance=this._distanceToCore(r),t.forEach(function(a){if(o._processed[a]===void 0){var l=o.distance(o.dataset[r],o.dataset[a]),f=Math.max(o._coreDistance,l);o._reachability[a]===void 0?(o._reachability[a]=f,e.insert(a,f)):f<o._reachability[a]&&(o._reachability[a]=f,e.remove(a),e.insert(a,f))}})};Yo.prototype._expandCluster=function(r,t){for(var e=t.getElements(),o=0,a=e.length;o<a;o++){var l=e[o];if(this._processed[l]===void 0){var f=this._regionQuery(l);this._processed[l]=1,this.clusters[r].push(l),this._orderedList.push(l),this._distanceToCore(l)!==void 0&&(this._updateQueue(l,f,t),this._expandCluster(r,t))}}};Yo.prototype._distanceToCore=function(r){for(var t=this.epsilon,e=0;e<t;e++){var o=this._regionQuery(r,e);if(o.length>=this.minPts)return e}};Yo.prototype._regionQuery=function(r,t){t=t||this.epsilon;for(var e=[],o=0,a=this.dataset.length;o<a;o++)this.distance(this.dataset[r],this.dataset[o])<t&&e.push(o);return e};Yo.prototype._euclideanDistance=function(r,t){for(var e=0,o=Math.min(r.length,t.length);o--;)e+=(r[o]-t[o])*(r[o]-t[o]);return Math.sqrt(e)};typeof lu!="undefined"&&lu.exports&&(lu.exports=Yo)});var d_=Kt((NB,tf)=>{typeof tf!="undefined"&&tf.exports&&(tf.exports={DBSCAN:c_(),KMEANS:f_(),OPTICS:p_(),PriorityQueue:md()})});var gd=Kt((zB,g_)=>{"use strict";g_.exports={eudist:function(t,e,o){for(var a=t.length,l=0,f=0;f<a;f++){var h=(t[f]||0)-(e[f]||0);l+=h*h}return o?Math.sqrt(l):l},mandist:function(t,e,o){for(var a=t.length,l=0,f=0;f<a;f++)l+=Math.abs((t[f]||0)-(e[f]||0));return o?Math.sqrt(l):l},dist:function(t,e,o){var a=Math.abs(t-e);return o?a:a*a}}});var __=Kt((kB,v_)=>{"use strict";var y_=gd(),RP=y_.eudist,LP=y_.dist;v_.exports={kmrand:function(t,e){for(var o={},a=[],l=e<<2,f=t.length,h=t[0].length>0;a.length<e&&l-- >0;){var p=t[Math.floor(Math.random()*f)],d=h?p.join("_"):""+p;o[d]||(o[d]=!0,a.push(p))}if(a.length<e)throw new Error("Error initializating clusters");return a},kmpp:function(t,e){var o=t[0].length?RP:LP,a=[],l=t.length,f=t[0].length>0,h={},p=t[Math.floor(Math.random()*l)],d=f?p.join("_"):""+p;for(a.push(p),h[d]=!0;a.length<e;){for(var g=[],_=a.length,y=0,M=[],w=0;w<l;w++){for(var T=1/0,x=0;x<_;x++){var v=o(t[w],a[x]);v<=T&&(T=v)}g[w]=T}for(var C=0;C<l;C++)y+=g[C];for(var S=0;S<l;S++)M[S]={i:S,v:t[S],pr:g[S]/y,cs:0};M.sort(function(z,L){return z.pr-L.pr}),M[0].cs=M[0].pr;for(var O=1;O<l;O++)M[O].cs=M[O-1].cs+M[O].pr;for(var F=Math.random(),G=0;G<l-1&&M[G++].cs<F;);a.push(M[G-1].v)}return a}}});var w_=Kt((HB,S_)=>{"use strict";var yd=gd(),M_=__(),NP=yd.eudist,GB=yd.mandist,VB=yd.dist,OP=M_.kmrand,DP=M_.kmpp,x_=1e4;function E_(r,t,e){e=e||[];for(var o=0;o<r;o++)e[o]=t;return e}function FP(r,t,e,o){var a=[],l=[],f=[],h=[],p=!1,d=o||x_,g=r.length,_=r[0].length,y=_>0,M=[];if(e)e=="kmrand"?a=OP(r,t):e=="kmpp"?a=DP(r,t):a=e;else for(var w={};a.length<t;){var T=Math.floor(Math.random()*g);w[T]||(w[T]=!0,a.push(r[T]))}do{E_(t,0,M);for(var x=0;x<g;x++){for(var v=1/0,C=0,S=0;S<t;S++){var h=y?NP(r[x],a[S]):Math.abs(r[x]-a[S]);h<=v&&(v=h,C=S)}f[x]=C,M[C]++}for(var O=[],l=[],F=0,G=0;G<t;G++)O[G]=y?E_(_,0,O[G]):0,l[G]=a[G];if(y){for(var z=0;z<t;z++)a[z]=[];for(var L=0;L<g;L++)for(var D=f[L],q=O[D],nt=r[L],k=0;k<_;k++)q[k]+=nt[k];p=!0;for(var xt=0;xt<t;xt++){for(var X=a[xt],it=O[xt],vt=l[xt],pt=M[xt],et=0;et<_;et++)X[et]=it[et]/pt||0;if(p){for(var ot=0;ot<_;ot++)if(vt[ot]!=X[ot]){p=!1;break}}}}else{for(var V=0;V<g;V++){var K=f[V];O[K]+=r[V]}for(var at=0;at<t;at++)a[at]=O[at]/M[at]||0;p=!0;for(var Tt=0;Tt<t;Tt++)if(l[Tt]!=a[Tt]){p=!1;break}}p=p||--d<=0}while(!p);return{it:x_-d,k:t,idxs:f,centroids:a}}S_.exports=FP});var du=Kt((Sd,wd)=>{(function(r,t){typeof Sd=="object"&&typeof wd!="undefined"?wd.exports=t():typeof define=="function"&&define.amd?define(t):(r=typeof globalThis!="undefined"?globalThis:r||self,r.polygonClipping=t())})(Sd,function(){"use strict";function r($,N){if(!($ instanceof N))throw new TypeError("Cannot call a class as a function")}function t($,N){for(var b=0;b<N.length;b++){var R=N[b];R.enumerable=R.enumerable||!1,R.configurable=!0,"value"in R&&(R.writable=!0),Object.defineProperty($,R.key,R)}}function e($,N,b){return N&&t($.prototype,N),b&&t($,b),$}var o=function(){function $(N,b){this.next=null,this.key=N,this.data=b,this.left=null,this.right=null}return $}();function a($,N){return $>N?1:$<N?-1:0}function l($,N,b){for(var R=new o(null,null),W=R,J=R;;){var I=b($,N.key);if(I<0){if(N.left===null)break;if(b($,N.left.key)<0){var P=N.left;if(N.left=P.right,P.right=N,N=P,N.left===null)break}J.left=N,J=N,N=N.left}else if(I>0){if(N.right===null)break;if(b($,N.right.key)>0){var P=N.right;if(N.right=P.left,P.left=N,N=P,N.right===null)break}W.right=N,W=N,N=N.right}else break}return W.right=N.left,J.left=N.right,N.left=R.right,N.right=R.left,N}function f($,N,b,R){var W=new o($,N);if(b===null)return W.left=W.right=null,W;b=l($,b,R);var J=R($,b.key);return J<0?(W.left=b.left,W.right=b,b.left=null):J>=0&&(W.right=b.right,W.left=b,b.right=null),W}function h($,N,b){var R=null,W=null;if(N){N=l($,N,b);var J=b(N.key,$);J===0?(R=N.left,W=N.right):J<0?(W=N.right,N.right=null,R=N):(R=N.left,N.left=null,W=N)}return{left:R,right:W}}function p($,N,b){return N===null?$:($===null||(N=l($.key,N,b),N.left=$),N)}function d($,N,b,R,W){if($){R(""+N+(b?"\\u2514\\u2500\\u2500 ":"\\u251C\\u2500\\u2500 ")+W($)+`\n`);var J=N+(b?" ":"\\u2502 ");$.left&&d($.left,J,!1,R,W),$.right&&d($.right,J,!0,R,W)}}var g=function(){function $(N){N===void 0&&(N=a),this._root=null,this._size=0,this._comparator=N}return $.prototype.insert=function(N,b){return this._size++,this._root=f(N,b,this._root,this._comparator)},$.prototype.add=function(N,b){var R=new o(N,b);this._root===null&&(R.left=R.right=null,this._size++,this._root=R);var W=this._comparator,J=l(N,this._root,W),I=W(N,J.key);return I===0?this._root=J:(I<0?(R.left=J.left,R.right=J,J.left=null):I>0&&(R.right=J.right,R.left=J,J.right=null),this._size++,this._root=R),this._root},$.prototype.remove=function(N){this._root=this._remove(N,this._root,this._comparator)},$.prototype._remove=function(N,b,R){var W;if(b===null)return null;b=l(N,b,R);var J=R(N,b.key);return J===0?(b.left===null?W=b.right:(W=l(N,b.left,R),W.right=b.right),this._size--,W):b},$.prototype.pop=function(){var N=this._root;if(N){for(;N.left;)N=N.left;return this._root=l(N.key,this._root,this._comparator),this._root=this._remove(N.key,this._root,this._comparator),{key:N.key,data:N.data}}return null},$.prototype.findStatic=function(N){for(var b=this._root,R=this._comparator;b;){var W=R(N,b.key);if(W===0)return b;W<0?b=b.left:b=b.right}return null},$.prototype.find=function(N){return this._root&&(this._root=l(N,this._root,this._comparator),this._comparator(N,this._root.key)!==0)?null:this._root},$.prototype.contains=function(N){for(var b=this._root,R=this._comparator;b;){var W=R(N,b.key);if(W===0)return!0;W<0?b=b.left:b=b.right}return!1},$.prototype.forEach=function(N,b){for(var R=this._root,W=[],J=!1;!J;)R!==null?(W.push(R),R=R.left):W.length!==0?(R=W.pop(),N.call(b,R),R=R.right):J=!0;return this},$.prototype.range=function(N,b,R,W){for(var J=[],I=this._comparator,P=this._root,B;J.length!==0||P;)if(P)J.push(P),P=P.left;else{if(P=J.pop(),B=I(P.key,b),B>0)break;if(I(P.key,N)>=0&&R.call(W,P))return this;P=P.right}return this},$.prototype.keys=function(){var N=[];return this.forEach(function(b){var R=b.key;return N.push(R)}),N},$.prototype.values=function(){var N=[];return this.forEach(function(b){var R=b.data;return N.push(R)}),N},$.prototype.min=function(){return this._root?this.minNode(this._root).key:null},$.prototype.max=function(){return this._root?this.maxNode(this._root).key:null},$.prototype.minNode=function(N){if(N===void 0&&(N=this._root),N)for(;N.left;)N=N.left;return N},$.prototype.maxNode=function(N){if(N===void 0&&(N=this._root),N)for(;N.right;)N=N.right;return N},$.prototype.at=function(N){for(var b=this._root,R=!1,W=0,J=[];!R;)if(b)J.push(b),b=b.left;else if(J.length>0){if(b=J.pop(),W===N)return b;W++,b=b.right}else R=!0;return null},$.prototype.next=function(N){var b=this._root,R=null;if(N.right){for(R=N.right;R.left;)R=R.left;return R}for(var W=this._comparator;b;){var J=W(N.key,b.key);if(J===0)break;J<0?(R=b,b=b.left):b=b.right}return R},$.prototype.prev=function(N){var b=this._root,R=null;if(N.left!==null){for(R=N.left;R.right;)R=R.right;return R}for(var W=this._comparator;b;){var J=W(N.key,b.key);if(J===0)break;J<0?b=b.left:(R=b,b=b.right)}return R},$.prototype.clear=function(){return this._root=null,this._size=0,this},$.prototype.toList=function(){return M(this._root)},$.prototype.load=function(N,b,R){b===void 0&&(b=[]),R===void 0&&(R=!1);var W=N.length,J=this._comparator;if(R&&x(N,b,0,W-1,J),this._root===null)this._root=_(N,b,0,W),this._size=W;else{var I=T(this.toList(),y(N,b),J);W=this._size+W,this._root=w({head:I},0,W)}return this},$.prototype.isEmpty=function(){return this._root===null},Object.defineProperty($.prototype,"size",{get:function(){return this._size},enumerable:!0,configurable:!0}),Object.defineProperty($.prototype,"root",{get:function(){return this._root},enumerable:!0,configurable:!0}),$.prototype.toString=function(N){N===void 0&&(N=function(W){return String(W.key)});var b=[];return d(this._root,"",!0,function(R){return b.push(R)},N),b.join("")},$.prototype.update=function(N,b,R){var W=this._comparator,J=h(N,this._root,W),I=J.left,P=J.right;W(N,b)<0?P=f(b,R,P,W):I=f(b,R,I,W),this._root=p(I,P,W)},$.prototype.split=function(N){return h(N,this._root,this._comparator)},$}();function _($,N,b,R){var W=R-b;if(W>0){var J=b+Math.floor(W/2),I=$[J],P=N[J],B=new o(I,P);return B.left=_($,N,b,J),B.right=_($,N,J+1,R),B}return null}function y($,N){for(var b=new o(null,null),R=b,W=0;W<$.length;W++)R=R.next=new o($[W],N[W]);return R.next=null,b.next}function M($){for(var N=$,b=[],R=!1,W=new o(null,null),J=W;!R;)N?(b.push(N),N=N.left):b.length>0?(N=J=J.next=b.pop(),N=N.right):R=!0;return J.next=null,W.next}function w($,N,b){var R=b-N;if(R>0){var W=N+Math.floor(R/2),J=w($,N,W),I=$.head;return I.left=J,$.head=$.head.next,I.right=w($,W+1,b),I}return null}function T($,N,b){for(var R=new o(null,null),W=R,J=$,I=N;J!==null&&I!==null;)b(J.key,I.key)<0?(W.next=J,J=J.next):(W.next=I,I=I.next),W=W.next;return J!==null?W.next=J:I!==null&&(W.next=I),R.next}function x($,N,b,R,W){if(!(b>=R)){for(var J=$[b+R>>1],I=b-1,P=R+1;;){do I++;while(W($[I],J)<0);do P--;while(W($[P],J)>0);if(I>=P)break;var B=$[I];$[I]=$[P],$[P]=B,B=N[I],N[I]=N[P],N[P]=B}x($,N,b,P,W),x($,N,P+1,R,W)}}var v=function(N,b){return N.ll.x<=b.x&&b.x<=N.ur.x&&N.ll.y<=b.y&&b.y<=N.ur.y},C=function(N,b){if(b.ur.x<N.ll.x||N.ur.x<b.ll.x||b.ur.y<N.ll.y||N.ur.y<b.ll.y)return null;var R=N.ll.x<b.ll.x?b.ll.x:N.ll.x,W=N.ur.x<b.ur.x?N.ur.x:b.ur.x,J=N.ll.y<b.ll.y?b.ll.y:N.ll.y,I=N.ur.y<b.ur.y?N.ur.y:b.ur.y;return{ll:{x:R,y:J},ur:{x:W,y:I}}},S=Number.EPSILON;S===void 0&&(S=Math.pow(2,-52));var O=S*S,F=function(N,b){if(-S<N&&N<S&&-S<b&&b<S)return 0;var R=N-b;return R*R<O*N*b?0:N<b?-1:1},G=function(){function $(){r(this,$),this.reset()}return e($,[{key:"reset",value:function(){this.xRounder=new z,this.yRounder=new z}},{key:"round",value:function(b,R){return{x:this.xRounder.round(b),y:this.yRounder.round(R)}}}]),$}(),z=function(){function $(){r(this,$),this.tree=new g,this.round(0)}return e($,[{key:"round",value:function(b){var R=this.tree.add(b),W=this.tree.prev(R);if(W!==null&&F(R.key,W.key)===0)return this.tree.remove(b),W.key;var J=this.tree.next(R);return J!==null&&F(R.key,J.key)===0?(this.tree.remove(b),J.key):b}}]),$}(),L=new G,D=function(N,b){return N.x*b.y-N.y*b.x},q=function(N,b){return N.x*b.x+N.y*b.y},nt=function(N,b,R){var W={x:b.x-N.x,y:b.y-N.y},J={x:R.x-N.x,y:R.y-N.y},I=D(W,J);return F(I,0)},k=function(N){return Math.sqrt(q(N,N))},xt=function(N,b,R){var W={x:b.x-N.x,y:b.y-N.y},J={x:R.x-N.x,y:R.y-N.y};return D(J,W)/k(J)/k(W)},X=function(N,b,R){var W={x:b.x-N.x,y:b.y-N.y},J={x:R.x-N.x,y:R.y-N.y};return q(J,W)/k(J)/k(W)},it=function(N,b,R){return b.y===0?null:{x:N.x+b.x/b.y*(R-N.y),y:R}},vt=function(N,b,R){return b.x===0?null:{x:R,y:N.y+b.y/b.x*(R-N.x)}},pt=function(N,b,R,W){if(b.x===0)return vt(R,W,N.x);if(W.x===0)return vt(N,b,R.x);if(b.y===0)return it(R,W,N.y);if(W.y===0)return it(N,b,R.y);var J=D(b,W);if(J==0)return null;var I={x:R.x-N.x,y:R.y-N.y},P=D(I,b)/J,B=D(I,W)/J,lt=N.x+B*b.x,ct=R.x+P*W.x,Q=N.y+B*b.y,St=R.y+P*W.y,_t=(lt+ct)/2,Mt=(Q+St)/2;return{x:_t,y:Mt}},et=function(){e($,null,[{key:"compare",value:function(b,R){var W=$.comparePoints(b.point,R.point);return W!==0?W:(b.point!==R.point&&b.link(R),b.isLeft!==R.isLeft?b.isLeft?1:-1:V.compare(b.segment,R.segment))}},{key:"comparePoints",value:function(b,R){return b.x<R.x?-1:b.x>R.x?1:b.y<R.y?-1:b.y>R.y?1:0}}]);function $(N,b){r(this,$),N.events===void 0?N.events=[this]:N.events.push(this),this.point=N,this.isLeft=b}return e($,[{key:"link",value:function(b){if(b.point===this.point)throw new Error("Tried to link already linked events");for(var R=b.point.events,W=0,J=R.length;W<J;W++){var I=R[W];this.point.events.push(I),I.point=this.point}this.checkForConsuming()}},{key:"checkForConsuming",value:function(){for(var b=this.point.events.length,R=0;R<b;R++){var W=this.point.events[R];if(W.segment.consumedBy===void 0)for(var J=R+1;J<b;J++){var I=this.point.events[J];I.consumedBy===void 0&&W.otherSE.point.events===I.otherSE.point.events&&W.segment.consume(I.segment)}}}},{key:"getAvailableLinkedEvents",value:function(){for(var b=[],R=0,W=this.point.events.length;R<W;R++){var J=this.point.events[R];J!==this&&!J.segment.ringOut&&J.segment.isInResult()&&b.push(J)}return b}},{key:"getLeftmostComparator",value:function(b){var R=this,W=new Map,J=function(P){var B=P.otherSE;W.set(P,{sine:xt(R.point,b.point,B.point),cosine:X(R.point,b.point,B.point)})};return function(I,P){W.has(I)||J(I),W.has(P)||J(P);var B=W.get(I),lt=B.sine,ct=B.cosine,Q=W.get(P),St=Q.sine,_t=Q.cosine;return lt>=0&&St>=0?ct<_t?1:ct>_t?-1:0:lt<0&&St<0?ct<_t?-1:ct>_t?1:0:St<lt?-1:St>lt?1:0}}}]),$}(),ot=0,V=function(){e($,null,[{key:"compare",value:function(b,R){var W=b.leftSE.point.x,J=R.leftSE.point.x,I=b.rightSE.point.x,P=R.rightSE.point.x;if(P<W)return 1;if(I<J)return-1;var B=b.leftSE.point.y,lt=R.leftSE.point.y,ct=b.rightSE.point.y,Q=R.rightSE.point.y;if(W<J){if(lt<B&<<ct)return 1;if(lt>B&<>ct)return-1;var St=b.comparePoint(R.leftSE.point);if(St<0)return 1;if(St>0)return-1;var _t=R.comparePoint(b.rightSE.point);return _t!==0?_t:-1}if(W>J){if(B<lt&&B<Q)return-1;if(B>lt&&B>Q)return 1;var Mt=R.comparePoint(b.leftSE.point);if(Mt!==0)return Mt;var Lt=b.comparePoint(R.rightSE.point);return Lt<0?1:Lt>0?-1:1}if(B<lt)return-1;if(B>lt)return 1;if(I<P){var Jt=R.comparePoint(b.rightSE.point);if(Jt!==0)return Jt}if(I>P){var Et=b.comparePoint(R.rightSE.point);if(Et<0)return 1;if(Et>0)return-1}if(I!==P){var oe=ct-B,jt=I-W,Ht=Q-lt,Ot=P-J;if(oe>jt&&Ht<Ot)return 1;if(oe<jt&&Ht>Ot)return-1}return I>P?1:I<P||ct<Q?-1:ct>Q?1:b.id<R.id?-1:b.id>R.id?1:0}}]);function $(N,b,R,W){r(this,$),this.id=++ot,this.leftSE=N,N.segment=this,N.otherSE=b,this.rightSE=b,b.segment=this,b.otherSE=N,this.rings=R,this.windings=W}return e($,[{key:"replaceRightSE",value:function(b){this.rightSE=b,this.rightSE.segment=this,this.rightSE.otherSE=this.leftSE,this.leftSE.otherSE=this.rightSE}},{key:"bbox",value:function(){var b=this.leftSE.point.y,R=this.rightSE.point.y;return{ll:{x:this.leftSE.point.x,y:b<R?b:R},ur:{x:this.rightSE.point.x,y:b>R?b:R}}}},{key:"vector",value:function(){return{x:this.rightSE.point.x-this.leftSE.point.x,y:this.rightSE.point.y-this.leftSE.point.y}}},{key:"isAnEndpoint",value:function(b){return b.x===this.leftSE.point.x&&b.y===this.leftSE.point.y||b.x===this.rightSE.point.x&&b.y===this.rightSE.point.y}},{key:"comparePoint",value:function(b){if(this.isAnEndpoint(b))return 0;var R=this.leftSE.point,W=this.rightSE.point,J=this.vector();if(R.x===W.x)return b.x===R.x?0:b.x<R.x?1:-1;var I=(b.y-R.y)/J.y,P=R.x+I*J.x;if(b.x===P)return 0;var B=(b.x-R.x)/J.x,lt=R.y+B*J.y;return b.y===lt?0:b.y<lt?-1:1}},{key:"getIntersection",value:function(b){var R=this.bbox(),W=b.bbox(),J=C(R,W);if(J===null)return null;var I=this.leftSE.point,P=this.rightSE.point,B=b.leftSE.point,lt=b.rightSE.point,ct=v(R,B)&&this.comparePoint(B)===0,Q=v(W,I)&&b.comparePoint(I)===0,St=v(R,lt)&&this.comparePoint(lt)===0,_t=v(W,P)&&b.comparePoint(P)===0;if(Q&&ct)return _t&&!St?P:!_t&&St?lt:null;if(Q)return St&&I.x===lt.x&&I.y===lt.y?null:I;if(ct)return _t&&P.x===B.x&&P.y===B.y?null:B;if(_t&&St)return null;if(_t)return P;if(St)return lt;var Mt=pt(I,this.vector(),B,b.vector());return Mt===null||!v(J,Mt)?null:L.round(Mt.x,Mt.y)}},{key:"split",value:function(b){var R=[],W=b.events!==void 0,J=new et(b,!0),I=new et(b,!1),P=this.rightSE;this.replaceRightSE(I),R.push(I),R.push(J);var B=new $(J,P,this.rings.slice(),this.windings.slice());return et.comparePoints(B.leftSE.point,B.rightSE.point)>0&&B.swapEvents(),et.comparePoints(this.leftSE.point,this.rightSE.point)>0&&this.swapEvents(),W&&(J.checkForConsuming(),I.checkForConsuming()),R}},{key:"swapEvents",value:function(){var b=this.rightSE;this.rightSE=this.leftSE,this.leftSE=b,this.leftSE.isLeft=!0,this.rightSE.isLeft=!1;for(var R=0,W=this.windings.length;R<W;R++)this.windings[R]*=-1}},{key:"consume",value:function(b){for(var R=this,W=b;R.consumedBy;)R=R.consumedBy;for(;W.consumedBy;)W=W.consumedBy;var J=$.compare(R,W);if(J!==0){if(J>0){var I=R;R=W,W=I}if(R.prev===W){var P=R;R=W,W=P}for(var B=0,lt=W.rings.length;B<lt;B++){var ct=W.rings[B],Q=W.windings[B],St=R.rings.indexOf(ct);St===-1?(R.rings.push(ct),R.windings.push(Q)):R.windings[St]+=Q}W.rings=null,W.windings=null,W.consumedBy=R,W.leftSE.consumedBy=R.leftSE,W.rightSE.consumedBy=R.rightSE}}},{key:"prevInResult",value:function(){return this._prevInResult!==void 0?this._prevInResult:(this.prev?this.prev.isInResult()?this._prevInResult=this.prev:this._prevInResult=this.prev.prevInResult():this._prevInResult=null,this._prevInResult)}},{key:"beforeState",value:function(){if(this._beforeState!==void 0)return this._beforeState;if(!this.prev)this._beforeState={rings:[],windings:[],multiPolys:[]};else{var b=this.prev.consumedBy||this.prev;this._beforeState=b.afterState()}return this._beforeState}},{key:"afterState",value:function(){if(this._afterState!==void 0)return this._afterState;var b=this.beforeState();this._afterState={rings:b.rings.slice(0),windings:b.windings.slice(0),multiPolys:[]};for(var R=this._afterState.rings,W=this._afterState.windings,J=this._afterState.multiPolys,I=0,P=this.rings.length;I<P;I++){var B=this.rings[I],lt=this.windings[I],ct=R.indexOf(B);ct===-1?(R.push(B),W.push(lt)):W[ct]+=lt}for(var Q=[],St=[],_t=0,Mt=R.length;_t<Mt;_t++)if(W[_t]!==0){var Lt=R[_t],Jt=Lt.poly;if(St.indexOf(Jt)===-1)if(Lt.isExterior)Q.push(Jt);else{St.indexOf(Jt)===-1&&St.push(Jt);var Et=Q.indexOf(Lt.poly);Et!==-1&&Q.splice(Et,1)}}for(var oe=0,jt=Q.length;oe<jt;oe++){var Ht=Q[oe].multiPoly;J.indexOf(Ht)===-1&&J.push(Ht)}return this._afterState}},{key:"isInResult",value:function(){if(this.consumedBy)return!1;if(this._isInResult!==void 0)return this._isInResult;var b=this.beforeState().multiPolys,R=this.afterState().multiPolys;switch(Xt.type){case"union":{var W=b.length===0,J=R.length===0;this._isInResult=W!==J;break}case"intersection":{var I,P;b.length<R.length?(I=b.length,P=R.length):(I=R.length,P=b.length),this._isInResult=P===Xt.numMultiPolys&&I<P;break}case"xor":{var B=Math.abs(b.length-R.length);this._isInResult=B%2===1;break}case"difference":{var lt=function(Q){return Q.length===1&&Q[0].isSubject};this._isInResult=lt(b)!==lt(R);break}default:throw new Error("Unrecognized operation type found ".concat(Xt.type))}return this._isInResult}}],[{key:"fromRing",value:function(b,R,W){var J,I,P,B=et.comparePoints(b,R);if(B<0)J=b,I=R,P=1;else if(B>0)J=R,I=b,P=-1;else throw new Error("Tried to create degenerate segment at [".concat(b.x,", ").concat(b.y,"]"));var lt=new et(J,!0),ct=new et(I,!1);return new $(lt,ct,[W],[P])}}]),$}(),K=function(){function $(N,b,R){if(r(this,$),!Array.isArray(N)||N.length===0)throw new Error("Input geometry is not a valid Polygon or MultiPolygon");if(this.poly=b,this.isExterior=R,this.segments=[],typeof N[0][0]!="number"||typeof N[0][1]!="number")throw new Error("Input geometry is not a valid Polygon or MultiPolygon");var W=L.round(N[0][0],N[0][1]);this.bbox={ll:{x:W.x,y:W.y},ur:{x:W.x,y:W.y}};for(var J=W,I=1,P=N.length;I<P;I++){if(typeof N[I][0]!="number"||typeof N[I][1]!="number")throw new Error("Input geometry is not a valid Polygon or MultiPolygon");var B=L.round(N[I][0],N[I][1]);B.x===J.x&&B.y===J.y||(this.segments.push(V.fromRing(J,B,this)),B.x<this.bbox.ll.x&&(this.bbox.ll.x=B.x),B.y<this.bbox.ll.y&&(this.bbox.ll.y=B.y),B.x>this.bbox.ur.x&&(this.bbox.ur.x=B.x),B.y>this.bbox.ur.y&&(this.bbox.ur.y=B.y),J=B)}(W.x!==J.x||W.y!==J.y)&&this.segments.push(V.fromRing(J,W,this))}return e($,[{key:"getSweepEvents",value:function(){for(var b=[],R=0,W=this.segments.length;R<W;R++){var J=this.segments[R];b.push(J.leftSE),b.push(J.rightSE)}return b}}]),$}(),at=function(){function $(N,b){if(r(this,$),!Array.isArray(N))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");this.exteriorRing=new K(N[0],this,!0),this.bbox={ll:{x:this.exteriorRing.bbox.ll.x,y:this.exteriorRing.bbox.ll.y},ur:{x:this.exteriorRing.bbox.ur.x,y:this.exteriorRing.bbox.ur.y}},this.interiorRings=[];for(var R=1,W=N.length;R<W;R++){var J=new K(N[R],this,!1);J.bbox.ll.x<this.bbox.ll.x&&(this.bbox.ll.x=J.bbox.ll.x),J.bbox.ll.y<this.bbox.ll.y&&(this.bbox.ll.y=J.bbox.ll.y),J.bbox.ur.x>this.bbox.ur.x&&(this.bbox.ur.x=J.bbox.ur.x),J.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=J.bbox.ur.y),this.interiorRings.push(J)}this.multiPoly=b}return e($,[{key:"getSweepEvents",value:function(){for(var b=this.exteriorRing.getSweepEvents(),R=0,W=this.interiorRings.length;R<W;R++)for(var J=this.interiorRings[R].getSweepEvents(),I=0,P=J.length;I<P;I++)b.push(J[I]);return b}}]),$}(),Tt=function(){function $(N,b){if(r(this,$),!Array.isArray(N))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");try{typeof N[0][0][0]=="number"&&(N=[N])}catch(I){}this.polys=[],this.bbox={ll:{x:Number.POSITIVE_INFINITY,y:Number.POSITIVE_INFINITY},ur:{x:Number.NEGATIVE_INFINITY,y:Number.NEGATIVE_INFINITY}};for(var R=0,W=N.length;R<W;R++){var J=new at(N[R],this);J.bbox.ll.x<this.bbox.ll.x&&(this.bbox.ll.x=J.bbox.ll.x),J.bbox.ll.y<this.bbox.ll.y&&(this.bbox.ll.y=J.bbox.ll.y),J.bbox.ur.x>this.bbox.ur.x&&(this.bbox.ur.x=J.bbox.ur.x),J.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=J.bbox.ur.y),this.polys.push(J)}this.isSubject=b}return e($,[{key:"getSweepEvents",value:function(){for(var b=[],R=0,W=this.polys.length;R<W;R++)for(var J=this.polys[R].getSweepEvents(),I=0,P=J.length;I<P;I++)b.push(J[I]);return b}}]),$}(),dt=function(){e($,null,[{key:"factory",value:function(b){for(var R=[],W=0,J=b.length;W<J;W++){var I=b[W];if(!(!I.isInResult()||I.ringOut)){for(var P=null,B=I.leftSE,lt=I.rightSE,ct=[B],Q=B.point,St=[];P=B,B=lt,ct.push(B),B.point!==Q;)for(;;){var _t=B.getAvailableLinkedEvents();if(_t.length===0){var Mt=ct[0].point,Lt=ct[ct.length-1].point;throw new Error("Unable to complete output ring starting at [".concat(Mt.x,",")+" ".concat(Mt.y,"]. Last matching segment found ends at")+" [".concat(Lt.x,", ").concat(Lt.y,"]."))}if(_t.length===1){lt=_t[0].otherSE;break}for(var Jt=null,Et=0,oe=St.length;Et<oe;Et++)if(St[Et].point===B.point){Jt=Et;break}if(Jt!==null){var jt=St.splice(Jt)[0],Ht=ct.splice(jt.index);Ht.unshift(Ht[0].otherSE),R.push(new $(Ht.reverse()));continue}St.push({index:ct.length,point:B.point});var Ot=B.getLeftmostComparator(P);lt=_t.sort(Ot)[0].otherSE;break}R.push(new $(ct))}}return R}}]);function $(N){r(this,$),this.events=N;for(var b=0,R=N.length;b<R;b++)N[b].segment.ringOut=this;this.poly=null}return e($,[{key:"getGeom",value:function(){for(var b=this.events[0].point,R=[b],W=1,J=this.events.length-1;W<J;W++){var I=this.events[W].point,P=this.events[W+1].point;nt(I,b,P)!==0&&(R.push(I),b=I)}if(R.length===1)return null;var B=R[0],lt=R[1];nt(B,b,lt)===0&&R.shift(),R.push(R[0]);for(var ct=this.isExteriorRing()?1:-1,Q=this.isExteriorRing()?0:R.length-1,St=this.isExteriorRing()?R.length:-1,_t=[],Mt=Q;Mt!=St;Mt+=ct)_t.push([R[Mt].x,R[Mt].y]);return _t}},{key:"isExteriorRing",value:function(){if(this._isExteriorRing===void 0){var b=this.enclosingRing();this._isExteriorRing=b?!b.isExteriorRing():!0}return this._isExteriorRing}},{key:"enclosingRing",value:function(){return this._enclosingRing===void 0&&(this._enclosingRing=this._calcEnclosingRing()),this._enclosingRing}},{key:"_calcEnclosingRing",value:function(){for(var b=this.events[0],R=1,W=this.events.length;R<W;R++){var J=this.events[R];et.compare(b,J)>0&&(b=J)}for(var I=b.segment.prevInResult(),P=I?I.prevInResult():null;;){if(!I)return null;if(!P)return I.ringOut;if(P.ringOut!==I.ringOut)return P.ringOut.enclosingRing()!==I.ringOut?I.ringOut:I.ringOut.enclosingRing();I=P.prevInResult(),P=I?I.prevInResult():null}}}]),$}(),Ct=function(){function $(N){r(this,$),this.exteriorRing=N,N.poly=this,this.interiorRings=[]}return e($,[{key:"addInterior",value:function(b){this.interiorRings.push(b),b.poly=this}},{key:"getGeom",value:function(){var b=[this.exteriorRing.getGeom()];if(b[0]===null)return null;for(var R=0,W=this.interiorRings.length;R<W;R++){var J=this.interiorRings[R].getGeom();J!==null&&b.push(J)}return b}}]),$}(),Yt=function(){function $(N){r(this,$),this.rings=N,this.polys=this._composePolys(N)}return e($,[{key:"getGeom",value:function(){for(var b=[],R=0,W=this.polys.length;R<W;R++){var J=this.polys[R].getGeom();J!==null&&b.push(J)}return b}},{key:"_composePolys",value:function(b){for(var R=[],W=0,J=b.length;W<J;W++){var I=b[W];if(!I.poly)if(I.isExteriorRing())R.push(new Ct(I));else{var P=I.enclosingRing();P.poly||R.push(new Ct(P)),P.poly.addInterior(I)}}return R}}]),$}(),Wt=function(){function $(N){var b=arguments.length>1&&arguments[1]!==void 0?arguments[1]:V.compare;r(this,$),this.queue=N,this.tree=new g(b),this.segments=[]}return e($,[{key:"process",value:function(b){var R=b.segment,W=[];if(b.consumedBy)return b.isLeft?this.queue.remove(b.otherSE):this.tree.remove(R),W;var J=b.isLeft?this.tree.insert(R):this.tree.find(R);if(!J)throw new Error("Unable to find segment #".concat(R.id," ")+"[".concat(R.leftSE.point.x,", ").concat(R.leftSE.point.y,"] -> ")+"[".concat(R.rightSE.point.x,", ").concat(R.rightSE.point.y,"] ")+"in SweepLine tree. Please submit a bug report.");for(var I=J,P=J,B=void 0,lt=void 0;B===void 0;)I=this.tree.prev(I),I===null?B=null:I.key.consumedBy===void 0&&(B=I.key);for(;lt===void 0;)P=this.tree.next(P),P===null?lt=null:P.key.consumedBy===void 0&&(lt=P.key);if(b.isLeft){var ct=null;if(B){var Q=B.getIntersection(R);if(Q!==null&&(R.isAnEndpoint(Q)||(ct=Q),!B.isAnEndpoint(Q)))for(var St=this._splitSafely(B,Q),_t=0,Mt=St.length;_t<Mt;_t++)W.push(St[_t])}var Lt=null;if(lt){var Jt=lt.getIntersection(R);if(Jt!==null&&(R.isAnEndpoint(Jt)||(Lt=Jt),!lt.isAnEndpoint(Jt)))for(var Et=this._splitSafely(lt,Jt),oe=0,jt=Et.length;oe<jt;oe++)W.push(Et[oe])}if(ct!==null||Lt!==null){var Ht=null;if(ct===null)Ht=Lt;else if(Lt===null)Ht=ct;else{var Ot=et.comparePoints(ct,Lt);Ht=Ot<=0?ct:Lt}this.queue.remove(R.rightSE),W.push(R.rightSE);for(var Y=R.split(Ht),wt=0,j=Y.length;wt<j;wt++)W.push(Y[wt])}W.length>0?(this.tree.remove(R),W.push(b)):(this.segments.push(R),R.prev=B)}else{if(B&<){var Ut=B.getIntersection(lt);if(Ut!==null){if(!B.isAnEndpoint(Ut))for(var Dt=this._splitSafely(B,Ut),ft=0,$t=Dt.length;ft<$t;ft++)W.push(Dt[ft]);if(!lt.isAnEndpoint(Ut))for(var re=this._splitSafely(lt,Ut),mn=0,He=re.length;mn<He;mn++)W.push(re[mn])}}this.tree.remove(R)}return W}},{key:"_splitSafely",value:function(b,R){this.tree.remove(b);var W=b.rightSE;this.queue.remove(W);var J=b.split(R);return J.push(W),b.consumedBy===void 0&&this.tree.insert(b),J}}]),$}(),Nt=typeof process!="undefined"&&process.env.POLYGON_CLIPPING_MAX_QUEUE_SIZE||1e6,ne=typeof process!="undefined"&&process.env.POLYGON_CLIPPING_MAX_SWEEPLINE_SEGMENTS||1e6,Pt=function(){function $(){r(this,$)}return e($,[{key:"run",value:function(b,R,W){Xt.type=b,L.reset();for(var J=[new Tt(R,!0)],I=0,P=W.length;I<P;I++)J.push(new Tt(W[I],!1));if(Xt.numMultiPolys=J.length,Xt.type==="difference")for(var B=J[0],lt=1;lt<J.length;)C(J[lt].bbox,B.bbox)!==null?lt++:J.splice(lt,1);if(Xt.type==="intersection"){for(var ct=0,Q=J.length;ct<Q;ct++)for(var St=J[ct],_t=ct+1,Mt=J.length;_t<Mt;_t++)if(C(St.bbox,J[_t].bbox)===null)return[]}for(var Lt=new g(et.compare),Jt=0,Et=J.length;Jt<Et;Jt++)for(var oe=J[Jt].getSweepEvents(),jt=0,Ht=oe.length;jt<Ht;jt++)if(Lt.insert(oe[jt]),Lt.size>Nt)throw new Error("Infinite loop when putting segment endpoints in a priority queue (queue size too big). Please file a bug report.");for(var Ot=new Wt(Lt),Y=Lt.size,wt=Lt.pop();wt;){var j=wt.key;if(Lt.size===Y){var Ut=j.segment;throw new Error("Unable to pop() ".concat(j.isLeft?"left":"right"," SweepEvent ")+"[".concat(j.point.x,", ").concat(j.point.y,"] from segment #").concat(Ut.id," ")+"[".concat(Ut.leftSE.point.x,", ").concat(Ut.leftSE.point.y,"] -> ")+"[".concat(Ut.rightSE.point.x,", ").concat(Ut.rightSE.point.y,"] from queue. ")+"Please file a bug report.")}if(Lt.size>Nt)throw new Error("Infinite loop when passing sweep line over endpoints (queue size too big). Please file a bug report.");if(Ot.segments.length>ne)throw new Error("Infinite loop when passing sweep line over endpoints (too many sweep line segments). Please file a bug report.");for(var Dt=Ot.process(j),ft=0,$t=Dt.length;ft<$t;ft++){var re=Dt[ft];re.consumedBy===void 0&&Lt.insert(re)}Y=Lt.size,wt=Lt.pop()}L.reset();var mn=dt.factory(Ot.segments),He=new Yt(mn);return He.getGeom()}}]),$}(),Xt=new Pt,tt=function(N){for(var b=arguments.length,R=new Array(b>1?b-1:0),W=1;W<b;W++)R[W-1]=arguments[W];return Xt.run("union",N,R)},nn=function(N){for(var b=arguments.length,R=new Array(b>1?b-1:0),W=1;W<b;W++)R[W-1]=arguments[W];return Xt.run("intersection",N,R)},Gt=function(N){for(var b=arguments.length,R=new Array(b>1?b-1:0),W=1;W<b;W++)R[W-1]=arguments[W];return Xt.run("xor",N,R)},te=function(N){for(var b=arguments.length,R=new Array(b>1?b-1:0),W=1;W<b;W++)R[W-1]=arguments[W];return Xt.run("difference",N,R)},qt={union:tt,intersection:nn,xor:Gt,difference:te};return qt})});var H_=Kt((of,V_)=>{(function(r,t){typeof of=="object"&&typeof V_!="undefined"?t(of):typeof define=="function"&&define.amd?define(["exports"],t):t(r.jsts={})})(of,function(r){"use strict";function t(){}function e(n){this.message=n||""}function o(n){this.message=n||""}function a(n){this.message=n||""}function l(){}function f(n){return n===null?hi:n.color}function h(n){return n===null?null:n.parent}function p(n,i){n!==null&&(n.color=i)}function d(n){return n===null?null:n.left}function g(n){return n===null?null:n.right}function _(){this.root_=null,this.size_=0}function y(){}function M(){this.array_=[],arguments[0]instanceof Ot&&this.addAll(arguments[0])}function w(){}function T(n){this.message=n||""}function x(){this.array_=[]}"fill"in Array.prototype||Object.defineProperty(Array.prototype,"fill",{configurable:!0,value:function(n){if(this===void 0||this===null)throw new TypeError(this+" is not an object");var i=Object(this),s=Math.max(Math.min(i.length,9007199254740991),0)||0,u=1 in arguments&&parseInt(Number(arguments[1]),10)||0;u=u<0?Math.max(s+u,0):Math.min(u,s);var c=2 in arguments&&arguments[2]!==void 0?parseInt(Number(arguments[2]),10)||0:s;for(c=c<0?Math.max(s+arguments[2],0):Math.min(c,s);u<c;)i[u]=n,++u;return i},writable:!0}),Number.isFinite=Number.isFinite||function(n){return typeof n=="number"&&isFinite(n)},Number.isInteger=Number.isInteger||function(n){return typeof n=="number"&&isFinite(n)&&Math.floor(n)===n},Number.parseFloat=Number.parseFloat||parseFloat,Number.isNaN=Number.isNaN||function(n){return n!=n},Math.trunc=Math.trunc||function(n){return n<0?Math.ceil(n):Math.floor(n)};var v=function(){};v.prototype.interfaces_=function(){return[]},v.prototype.getClass=function(){return v},v.prototype.equalsWithTolerance=function(n,i,s){return Math.abs(n-i)<=s};var C=function(n){function i(s){n.call(this,s),this.name="IllegalArgumentException",this.message=s,this.stack=new n().stack}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i}(Error),S=function(){},O={MAX_VALUE:{configurable:!0}};S.isNaN=function(n){return Number.isNaN(n)},S.doubleToLongBits=function(n){return n},S.longBitsToDouble=function(n){return n},S.isInfinite=function(n){return!Number.isFinite(n)},O.MAX_VALUE.get=function(){return Number.MAX_VALUE},Object.defineProperties(S,O);var F=function(){},G=function(){},z=function(){},L=function n(){if(this.x=null,this.y=null,this.z=null,arguments.length===0)this.x=0,this.y=0,this.z=n.NULL_ORDINATE;else if(arguments.length===1){var i=arguments[0];this.x=i.x,this.y=i.y,this.z=i.z}else arguments.length===2?(this.x=arguments[0],this.y=arguments[1],this.z=n.NULL_ORDINATE):arguments.length===3&&(this.x=arguments[0],this.y=arguments[1],this.z=arguments[2])},D={DimensionalComparator:{configurable:!0},serialVersionUID:{configurable:!0},NULL_ORDINATE:{configurable:!0},X:{configurable:!0},Y:{configurable:!0},Z:{configurable:!0}};L.prototype.setOrdinate=function(n,i){switch(n){case L.X:this.x=i;break;case L.Y:this.y=i;break;case L.Z:this.z=i;break;default:throw new C("Invalid ordinate index: "+n)}},L.prototype.equals2D=function(){if(arguments.length===1){var n=arguments[0];return this.x===n.x&&this.y===n.y}if(arguments.length===2){var i=arguments[0],s=arguments[1];return!!v.equalsWithTolerance(this.x,i.x,s)&&!!v.equalsWithTolerance(this.y,i.y,s)}},L.prototype.getOrdinate=function(n){switch(n){case L.X:return this.x;case L.Y:return this.y;case L.Z:return this.z}throw new C("Invalid ordinate index: "+n)},L.prototype.equals3D=function(n){return this.x===n.x&&this.y===n.y&&(this.z===n.z||S.isNaN(this.z))&&S.isNaN(n.z)},L.prototype.equals=function(n){return n instanceof L&&this.equals2D(n)},L.prototype.equalInZ=function(n,i){return v.equalsWithTolerance(this.z,n.z,i)},L.prototype.compareTo=function(n){var i=n;return this.x<i.x?-1:this.x>i.x?1:this.y<i.y?-1:this.y>i.y?1:0},L.prototype.clone=function(){},L.prototype.copy=function(){return new L(this)},L.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+")"},L.prototype.distance3D=function(n){var i=this.x-n.x,s=this.y-n.y,u=this.z-n.z;return Math.sqrt(i*i+s*s+u*u)},L.prototype.distance=function(n){var i=this.x-n.x,s=this.y-n.y;return Math.sqrt(i*i+s*s)},L.prototype.hashCode=function(){var n=17;return n=37*n+L.hashCode(this.x),n=37*n+L.hashCode(this.y)},L.prototype.setCoordinate=function(n){this.x=n.x,this.y=n.y,this.z=n.z},L.prototype.interfaces_=function(){return[F,G,t]},L.prototype.getClass=function(){return L},L.hashCode=function(){if(arguments.length===1){var n=arguments[0],i=S.doubleToLongBits(n);return Math.trunc((i^i)>>>32)}},D.DimensionalComparator.get=function(){return q},D.serialVersionUID.get=function(){return 6683108902428367e3},D.NULL_ORDINATE.get=function(){return S.NaN},D.X.get=function(){return 0},D.Y.get=function(){return 1},D.Z.get=function(){return 2},Object.defineProperties(L,D);var q=function(n){if(this._dimensionsToTest=2,arguments.length!==0){if(arguments.length===1){var i=arguments[0];if(i!==2&&i!==3)throw new C("only 2 or 3 dimensions may be specified");this._dimensionsToTest=i}}};q.prototype.compare=function(n,i){var s=n,u=i,c=q.compare(s.x,u.x);if(c!==0)return c;var m=q.compare(s.y,u.y);return m!==0?m:this._dimensionsToTest<=2?0:q.compare(s.z,u.z)},q.prototype.interfaces_=function(){return[z]},q.prototype.getClass=function(){return q},q.compare=function(n,i){return n<i?-1:n>i?1:S.isNaN(n)?S.isNaN(i)?0:-1:S.isNaN(i)?1:0};var nt=function(){};nt.prototype.create=function(){},nt.prototype.interfaces_=function(){return[]},nt.prototype.getClass=function(){return nt};var k=function(){},xt={INTERIOR:{configurable:!0},BOUNDARY:{configurable:!0},EXTERIOR:{configurable:!0},NONE:{configurable:!0}};k.prototype.interfaces_=function(){return[]},k.prototype.getClass=function(){return k},k.toLocationSymbol=function(n){switch(n){case k.EXTERIOR:return"e";case k.BOUNDARY:return"b";case k.INTERIOR:return"i";case k.NONE:return"-"}throw new C("Unknown location value: "+n)},xt.INTERIOR.get=function(){return 0},xt.BOUNDARY.get=function(){return 1},xt.EXTERIOR.get=function(){return 2},xt.NONE.get=function(){return-1},Object.defineProperties(k,xt);var X=function(n,i){return n.interfaces_&&n.interfaces_().indexOf(i)>-1},it=function(){},vt={LOG_10:{configurable:!0}};it.prototype.interfaces_=function(){return[]},it.prototype.getClass=function(){return it},it.log10=function(n){var i=Math.log(n);return S.isInfinite(i)||S.isNaN(i)?i:i/it.LOG_10},it.min=function(n,i,s,u){var c=n;return i<c&&(c=i),s<c&&(c=s),u<c&&(c=u),c},it.clamp=function(){if(typeof arguments[2]=="number"&&typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var n=arguments[0],i=arguments[1],s=arguments[2];return n<i?i:n>s?s:n}if(Number.isInteger(arguments[2])&&Number.isInteger(arguments[0])&&Number.isInteger(arguments[1])){var u=arguments[0],c=arguments[1],m=arguments[2];return u<c?c:u>m?m:u}},it.wrap=function(n,i){return n<0?i- -n%i:n%i},it.max=function(){if(arguments.length===3){var n=arguments[0],i=arguments[1],s=arguments[2],u=n;return i>u&&(u=i),s>u&&(u=s),u}if(arguments.length===4){var c=arguments[0],m=arguments[1],E=arguments[2],A=arguments[3],U=c;return m>U&&(U=m),E>U&&(U=E),A>U&&(U=A),U}},it.average=function(n,i){return(n+i)/2},vt.LOG_10.get=function(){return Math.log(10)},Object.defineProperties(it,vt);var pt=function(n){this.str=n};pt.prototype.append=function(n){this.str+=n},pt.prototype.setCharAt=function(n,i){this.str=this.str.substr(0,n)+i+this.str.substr(n+1)},pt.prototype.toString=function(n){return this.str};var et=function(n){this.value=n};et.prototype.intValue=function(){return this.value},et.prototype.compareTo=function(n){return this.value<n?-1:this.value>n?1:0},et.isNaN=function(n){return Number.isNaN(n)};var ot=function(){};ot.isWhitespace=function(n){return n<=32&&n>=0||n===127},ot.toUpperCase=function(n){return n.toUpperCase()};var V=function n(){if(this._hi=0,this._lo=0,arguments.length===0)this.init(0);else if(arguments.length===1){if(typeof arguments[0]=="number"){var i=arguments[0];this.init(i)}else if(arguments[0]instanceof n){var s=arguments[0];this.init(s)}else if(typeof arguments[0]=="string"){var u=arguments[0];n.call(this,n.parse(u))}}else if(arguments.length===2){var c=arguments[0],m=arguments[1];this.init(c,m)}},K={PI:{configurable:!0},TWO_PI:{configurable:!0},PI_2:{configurable:!0},E:{configurable:!0},NaN:{configurable:!0},EPS:{configurable:!0},SPLIT:{configurable:!0},MAX_PRINT_DIGITS:{configurable:!0},TEN:{configurable:!0},ONE:{configurable:!0},SCI_NOT_EXPONENT_CHAR:{configurable:!0},SCI_NOT_ZERO:{configurable:!0}};V.prototype.le=function(n){return(this._hi<n._hi||this._hi===n._hi)&&this._lo<=n._lo},V.prototype.extractSignificantDigits=function(n,i){var s=this.abs(),u=V.magnitude(s._hi),c=V.TEN.pow(u);(s=s.divide(c)).gt(V.TEN)?(s=s.divide(V.TEN),u+=1):s.lt(V.ONE)&&(s=s.multiply(V.TEN),u-=1);for(var m=u+1,E=new pt,A=V.MAX_PRINT_DIGITS-1,U=0;U<=A;U++){n&&U===m&&E.append(".");var Z=Math.trunc(s._hi);if(Z<0)break;var ut=!1,ht=0;Z>9?(ut=!0,ht="9"):ht="0"+Z,E.append(ht),s=s.subtract(V.valueOf(Z)).multiply(V.TEN),ut&&s.selfAdd(V.TEN);var At=!0,Rt=V.magnitude(s._hi);if(Rt<0&&Math.abs(Rt)>=A-U&&(At=!1),!At)break}return i[0]=u,E.toString()},V.prototype.sqr=function(){return this.multiply(this)},V.prototype.doubleValue=function(){return this._hi+this._lo},V.prototype.subtract=function(){if(arguments[0]instanceof V){var n=arguments[0];return this.add(n.negate())}if(typeof arguments[0]=="number"){var i=arguments[0];return this.add(-i)}},V.prototype.equals=function(){if(arguments.length===1){var n=arguments[0];return this._hi===n._hi&&this._lo===n._lo}},V.prototype.isZero=function(){return this._hi===0&&this._lo===0},V.prototype.selfSubtract=function(){if(arguments[0]instanceof V){var n=arguments[0];return this.isNaN()?this:this.selfAdd(-n._hi,-n._lo)}if(typeof arguments[0]=="number"){var i=arguments[0];return this.isNaN()?this:this.selfAdd(-i,0)}},V.prototype.getSpecialNumberString=function(){return this.isZero()?"0.0":this.isNaN()?"NaN ":null},V.prototype.min=function(n){return this.le(n)?this:n},V.prototype.selfDivide=function(){if(arguments.length===1){if(arguments[0]instanceof V){var n=arguments[0];return this.selfDivide(n._hi,n._lo)}if(typeof arguments[0]=="number"){var i=arguments[0];return this.selfDivide(i,0)}}else if(arguments.length===2){var s=arguments[0],u=arguments[1],c=null,m=null,E=null,A=null,U=null,Z=null,ut=null,ht=null;return U=this._hi/s,Z=V.SPLIT*U,c=Z-U,ht=V.SPLIT*s,c=Z-c,m=U-c,E=ht-s,ut=U*s,E=ht-E,A=s-E,ht=c*E-ut+c*A+m*E+m*A,Z=(this._hi-ut-ht+this._lo-U*u)/s,ht=U+Z,this._hi=ht,this._lo=U-ht+Z,this}},V.prototype.dump=function(){return"DD<"+this._hi+", "+this._lo+">"},V.prototype.divide=function(){if(arguments[0]instanceof V){var n=arguments[0],i=null,s=null,u=null,c=null,m=null,E=null,A=null,U=null;return s=(m=this._hi/n._hi)-(i=(E=V.SPLIT*m)-(i=E-m)),U=i*(u=(U=V.SPLIT*n._hi)-(u=U-n._hi))-(A=m*n._hi)+i*(c=n._hi-u)+s*u+s*c,E=(this._hi-A-U+this._lo-m*n._lo)/n._hi,new V(U=m+E,m-U+E)}if(typeof arguments[0]=="number"){var Z=arguments[0];return S.isNaN(Z)?V.createNaN():V.copy(this).selfDivide(Z,0)}},V.prototype.ge=function(n){return(this._hi>n._hi||this._hi===n._hi)&&this._lo>=n._lo},V.prototype.pow=function(n){if(n===0)return V.valueOf(1);var i=new V(this),s=V.valueOf(1),u=Math.abs(n);if(u>1)for(;u>0;)u%2==1&&s.selfMultiply(i),(u/=2)>0&&(i=i.sqr());else s=i;return n<0?s.reciprocal():s},V.prototype.ceil=function(){if(this.isNaN())return V.NaN;var n=Math.ceil(this._hi),i=0;return n===this._hi&&(i=Math.ceil(this._lo)),new V(n,i)},V.prototype.compareTo=function(n){var i=n;return this._hi<i._hi?-1:this._hi>i._hi?1:this._lo<i._lo?-1:this._lo>i._lo?1:0},V.prototype.rint=function(){return this.isNaN()?this:this.add(.5).floor()},V.prototype.setValue=function(){if(arguments[0]instanceof V){var n=arguments[0];return this.init(n),this}if(typeof arguments[0]=="number"){var i=arguments[0];return this.init(i),this}},V.prototype.max=function(n){return this.ge(n)?this:n},V.prototype.sqrt=function(){if(this.isZero())return V.valueOf(0);if(this.isNegative())return V.NaN;var n=1/Math.sqrt(this._hi),i=this._hi*n,s=V.valueOf(i),u=this.subtract(s.sqr())._hi*(.5*n);return s.add(u)},V.prototype.selfAdd=function(){if(arguments.length===1){if(arguments[0]instanceof V){var n=arguments[0];return this.selfAdd(n._hi,n._lo)}if(typeof arguments[0]=="number"){var i=arguments[0],s=null,u=null,c=null,m=null,E=null,A=null;return c=this._hi+i,E=c-this._hi,m=c-E,m=i-E+(this._hi-m),A=m+this._lo,s=c+A,u=A+(c-s),this._hi=s+u,this._lo=u+(s-this._hi),this}}else if(arguments.length===2){var U=arguments[0],Z=arguments[1],ut=null,ht=null,At=null,Rt=null,kt=null,ee=null,on=null;Rt=this._hi+U,ht=this._lo+Z,kt=Rt-(ee=Rt-this._hi),At=ht-(on=ht-this._lo);var In=(ut=Rt+(ee=(kt=U-ee+(this._hi-kt))+ht))+(ee=(At=Z-on+(this._lo-At))+(ee+(Rt-ut))),pr=ee+(ut-In);return this._hi=In,this._lo=pr,this}},V.prototype.selfMultiply=function(){if(arguments.length===1){if(arguments[0]instanceof V){var n=arguments[0];return this.selfMultiply(n._hi,n._lo)}if(typeof arguments[0]=="number"){var i=arguments[0];return this.selfMultiply(i,0)}}else if(arguments.length===2){var s=arguments[0],u=arguments[1],c=null,m=null,E=null,A=null,U=null,Z=null;c=(U=V.SPLIT*this._hi)-this._hi,Z=V.SPLIT*s,c=U-c,m=this._hi-c,E=Z-s;var ut=(U=this._hi*s)+(Z=c*(E=Z-E)-U+c*(A=s-E)+m*E+m*A+(this._hi*u+this._lo*s)),ht=Z+(c=U-ut);return this._hi=ut,this._lo=ht,this}},V.prototype.selfSqr=function(){return this.selfMultiply(this)},V.prototype.floor=function(){if(this.isNaN())return V.NaN;var n=Math.floor(this._hi),i=0;return n===this._hi&&(i=Math.floor(this._lo)),new V(n,i)},V.prototype.negate=function(){return this.isNaN()?this:new V(-this._hi,-this._lo)},V.prototype.clone=function(){},V.prototype.multiply=function(){if(arguments[0]instanceof V){var n=arguments[0];return n.isNaN()?V.createNaN():V.copy(this).selfMultiply(n)}if(typeof arguments[0]=="number"){var i=arguments[0];return S.isNaN(i)?V.createNaN():V.copy(this).selfMultiply(i,0)}},V.prototype.isNaN=function(){return S.isNaN(this._hi)},V.prototype.intValue=function(){return Math.trunc(this._hi)},V.prototype.toString=function(){var n=V.magnitude(this._hi);return n>=-3&&n<=20?this.toStandardNotation():this.toSciNotation()},V.prototype.toStandardNotation=function(){var n=this.getSpecialNumberString();if(n!==null)return n;var i=new Array(1).fill(null),s=this.extractSignificantDigits(!0,i),u=i[0]+1,c=s;if(s.charAt(0)===".")c="0"+s;else if(u<0)c="0."+V.stringOfChar("0",-u)+s;else if(s.indexOf(".")===-1){var m=u-s.length;c=s+V.stringOfChar("0",m)+".0"}return this.isNegative()?"-"+c:c},V.prototype.reciprocal=function(){var n=null,i=null,s=null,u=null,c=null,m=null,E=null,A=null;i=(c=1/this._hi)-(n=(m=V.SPLIT*c)-(n=m-c)),s=(A=V.SPLIT*this._hi)-this._hi;var U=c+(m=(1-(E=c*this._hi)-(A=n*(s=A-s)-E+n*(u=this._hi-s)+i*s+i*u)-c*this._lo)/this._hi);return new V(U,c-U+m)},V.prototype.toSciNotation=function(){if(this.isZero())return V.SCI_NOT_ZERO;var n=this.getSpecialNumberString();if(n!==null)return n;var i=new Array(1).fill(null),s=this.extractSignificantDigits(!1,i),u=V.SCI_NOT_EXPONENT_CHAR+i[0];if(s.charAt(0)==="0")throw new Error("Found leading zero: "+s);var c="";s.length>1&&(c=s.substring(1));var m=s.charAt(0)+"."+c;return this.isNegative()?"-"+m+u:m+u},V.prototype.abs=function(){return this.isNaN()?V.NaN:this.isNegative()?this.negate():new V(this)},V.prototype.isPositive=function(){return(this._hi>0||this._hi===0)&&this._lo>0},V.prototype.lt=function(n){return(this._hi<n._hi||this._hi===n._hi)&&this._lo<n._lo},V.prototype.add=function(){if(arguments[0]instanceof V){var n=arguments[0];return V.copy(this).selfAdd(n)}if(typeof arguments[0]=="number"){var i=arguments[0];return V.copy(this).selfAdd(i)}},V.prototype.init=function(){if(arguments.length===1){if(typeof arguments[0]=="number"){var n=arguments[0];this._hi=n,this._lo=0}else if(arguments[0]instanceof V){var i=arguments[0];this._hi=i._hi,this._lo=i._lo}}else if(arguments.length===2){var s=arguments[0],u=arguments[1];this._hi=s,this._lo=u}},V.prototype.gt=function(n){return(this._hi>n._hi||this._hi===n._hi)&&this._lo>n._lo},V.prototype.isNegative=function(){return(this._hi<0||this._hi===0)&&this._lo<0},V.prototype.trunc=function(){return this.isNaN()?V.NaN:this.isPositive()?this.floor():this.ceil()},V.prototype.signum=function(){return this._hi>0?1:this._hi<0?-1:this._lo>0?1:this._lo<0?-1:0},V.prototype.interfaces_=function(){return[t,F,G]},V.prototype.getClass=function(){return V},V.sqr=function(n){return V.valueOf(n).selfMultiply(n)},V.valueOf=function(){if(typeof arguments[0]=="string"){var n=arguments[0];return V.parse(n)}if(typeof arguments[0]=="number"){var i=arguments[0];return new V(i)}},V.sqrt=function(n){return V.valueOf(n).sqrt()},V.parse=function(n){for(var i=0,s=n.length;ot.isWhitespace(n.charAt(i));)i++;var u=!1;if(i<s){var c=n.charAt(i);c!=="-"&&c!=="+"||(i++,c==="-"&&(u=!0))}for(var m=new V,E=0,A=0,U=0;!(i>=s);){var Z=n.charAt(i);if(i++,ot.isDigit(Z)){var ut=Z-"0";m.selfMultiply(V.TEN),m.selfAdd(ut),E++}else{if(Z!=="."){if(Z==="e"||Z==="E"){var ht=n.substring(i);try{U=et.parseInt(ht)}catch(on){throw on instanceof Error?new Error("Invalid exponent "+ht+" in string "+n):on}break}throw new Error("Unexpected character \'"+Z+"\' at position "+i+" in string "+n)}A=E}}var At=m,Rt=E-A-U;if(Rt===0)At=m;else if(Rt>0){var kt=V.TEN.pow(Rt);At=m.divide(kt)}else if(Rt<0){var ee=V.TEN.pow(-Rt);At=m.multiply(ee)}return u?At.negate():At},V.createNaN=function(){return new V(S.NaN,S.NaN)},V.copy=function(n){return new V(n)},V.magnitude=function(n){var i=Math.abs(n),s=Math.log(i)/Math.log(10),u=Math.trunc(Math.floor(s));return 10*Math.pow(10,u)<=i&&(u+=1),u},V.stringOfChar=function(n,i){for(var s=new pt,u=0;u<i;u++)s.append(n);return s.toString()},K.PI.get=function(){return new V(3.141592653589793,12246467991473532e-32)},K.TWO_PI.get=function(){return new V(6.283185307179586,24492935982947064e-32)},K.PI_2.get=function(){return new V(1.5707963267948966,6123233995736766e-32)},K.E.get=function(){return new V(2.718281828459045,14456468917292502e-32)},K.NaN.get=function(){return new V(S.NaN,S.NaN)},K.EPS.get=function(){return 123259516440783e-46},K.SPLIT.get=function(){return 134217729},K.MAX_PRINT_DIGITS.get=function(){return 32},K.TEN.get=function(){return V.valueOf(10)},K.ONE.get=function(){return V.valueOf(1)},K.SCI_NOT_EXPONENT_CHAR.get=function(){return"E"},K.SCI_NOT_ZERO.get=function(){return"0.0E0"},Object.defineProperties(V,K);var at=function(){},Tt={DP_SAFE_EPSILON:{configurable:!0}};at.prototype.interfaces_=function(){return[]},at.prototype.getClass=function(){return at},at.orientationIndex=function(n,i,s){var u=at.orientationIndexFilter(n,i,s);if(u<=1)return u;var c=V.valueOf(i.x).selfAdd(-n.x),m=V.valueOf(i.y).selfAdd(-n.y),E=V.valueOf(s.x).selfAdd(-i.x),A=V.valueOf(s.y).selfAdd(-i.y);return c.selfMultiply(A).selfSubtract(m.selfMultiply(E)).signum()},at.signOfDet2x2=function(n,i,s,u){return n.multiply(u).selfSubtract(i.multiply(s)).signum()},at.intersection=function(n,i,s,u){var c=V.valueOf(u.y).selfSubtract(s.y).selfMultiply(V.valueOf(i.x).selfSubtract(n.x)),m=V.valueOf(u.x).selfSubtract(s.x).selfMultiply(V.valueOf(i.y).selfSubtract(n.y)),E=c.subtract(m),A=V.valueOf(u.x).selfSubtract(s.x).selfMultiply(V.valueOf(n.y).selfSubtract(s.y)),U=V.valueOf(u.y).selfSubtract(s.y).selfMultiply(V.valueOf(n.x).selfSubtract(s.x)),Z=A.subtract(U).selfDivide(E).doubleValue(),ut=V.valueOf(n.x).selfAdd(V.valueOf(i.x).selfSubtract(n.x).selfMultiply(Z)).doubleValue(),ht=V.valueOf(i.x).selfSubtract(n.x).selfMultiply(V.valueOf(n.y).selfSubtract(s.y)),At=V.valueOf(i.y).selfSubtract(n.y).selfMultiply(V.valueOf(n.x).selfSubtract(s.x)),Rt=ht.subtract(At).selfDivide(E).doubleValue(),kt=V.valueOf(s.y).selfAdd(V.valueOf(u.y).selfSubtract(s.y).selfMultiply(Rt)).doubleValue();return new L(ut,kt)},at.orientationIndexFilter=function(n,i,s){var u=null,c=(n.x-s.x)*(i.y-s.y),m=(n.y-s.y)*(i.x-s.x),E=c-m;if(c>0){if(m<=0)return at.signum(E);u=c+m}else{if(!(c<0)||m>=0)return at.signum(E);u=-c-m}var A=at.DP_SAFE_EPSILON*u;return E>=A||-E>=A?at.signum(E):2},at.signum=function(n){return n>0?1:n<0?-1:0},Tt.DP_SAFE_EPSILON.get=function(){return 1e-15},Object.defineProperties(at,Tt);var dt=function(){},Ct={X:{configurable:!0},Y:{configurable:!0},Z:{configurable:!0},M:{configurable:!0}};Ct.X.get=function(){return 0},Ct.Y.get=function(){return 1},Ct.Z.get=function(){return 2},Ct.M.get=function(){return 3},dt.prototype.setOrdinate=function(n,i,s){},dt.prototype.size=function(){},dt.prototype.getOrdinate=function(n,i){},dt.prototype.getCoordinate=function(){},dt.prototype.getCoordinateCopy=function(n){},dt.prototype.getDimension=function(){},dt.prototype.getX=function(n){},dt.prototype.clone=function(){},dt.prototype.expandEnvelope=function(n){},dt.prototype.copy=function(){},dt.prototype.getY=function(n){},dt.prototype.toCoordinateArray=function(){},dt.prototype.interfaces_=function(){return[G]},dt.prototype.getClass=function(){return dt},Object.defineProperties(dt,Ct);var Yt=function(){},Wt=function(n){function i(){n.call(this,"Projective point not representable on the Cartesian plane.")}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(Yt),Nt=function(){};Nt.arraycopy=function(n,i,s,u,c){for(var m=0,E=i;E<i+c;E++)s[u+m]=n[E],m++},Nt.getProperty=function(n){return{"line.separator":`\n`}[n]};var ne=function n(){if(this.x=null,this.y=null,this.w=null,arguments.length===0)this.x=0,this.y=0,this.w=1;else if(arguments.length===1){var i=arguments[0];this.x=i.x,this.y=i.y,this.w=1}else if(arguments.length===2){if(typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var s=arguments[0],u=arguments[1];this.x=s,this.y=u,this.w=1}else if(arguments[0]instanceof n&&arguments[1]instanceof n){var c=arguments[0],m=arguments[1];this.x=c.y*m.w-m.y*c.w,this.y=m.x*c.w-c.x*m.w,this.w=c.x*m.y-m.x*c.y}else if(arguments[0]instanceof L&&arguments[1]instanceof L){var E=arguments[0],A=arguments[1];this.x=E.y-A.y,this.y=A.x-E.x,this.w=E.x*A.y-A.x*E.y}}else if(arguments.length===3){var U=arguments[0],Z=arguments[1],ut=arguments[2];this.x=U,this.y=Z,this.w=ut}else if(arguments.length===4){var ht=arguments[0],At=arguments[1],Rt=arguments[2],kt=arguments[3],ee=ht.y-At.y,on=At.x-ht.x,In=ht.x*At.y-At.x*ht.y,pr=Rt.y-kt.y,Xi=kt.x-Rt.x,Lo=Rt.x*kt.y-kt.x*Rt.y;this.x=on*Lo-Xi*In,this.y=pr*In-ee*Lo,this.w=ee*Xi-pr*on}};ne.prototype.getY=function(){var n=this.y/this.w;if(S.isNaN(n)||S.isInfinite(n))throw new Wt;return n},ne.prototype.getX=function(){var n=this.x/this.w;if(S.isNaN(n)||S.isInfinite(n))throw new Wt;return n},ne.prototype.getCoordinate=function(){var n=new L;return n.x=this.getX(),n.y=this.getY(),n},ne.prototype.interfaces_=function(){return[]},ne.prototype.getClass=function(){return ne},ne.intersection=function(n,i,s,u){var c=n.y-i.y,m=i.x-n.x,E=n.x*i.y-i.x*n.y,A=s.y-u.y,U=u.x-s.x,Z=s.x*u.y-u.x*s.y,ut=c*U-A*m,ht=(m*Z-U*E)/ut,At=(A*E-c*Z)/ut;if(S.isNaN(ht)||S.isInfinite(ht)||S.isNaN(At)||S.isInfinite(At))throw new Wt;return new L(ht,At)};var Pt=function n(){if(this._minx=null,this._maxx=null,this._miny=null,this._maxy=null,arguments.length===0)this.init();else if(arguments.length===1){if(arguments[0]instanceof L){var i=arguments[0];this.init(i.x,i.x,i.y,i.y)}else if(arguments[0]instanceof n){var s=arguments[0];this.init(s)}}else if(arguments.length===2){var u=arguments[0],c=arguments[1];this.init(u.x,c.x,u.y,c.y)}else if(arguments.length===4){var m=arguments[0],E=arguments[1],A=arguments[2],U=arguments[3];this.init(m,E,A,U)}},Xt={serialVersionUID:{configurable:!0}};Pt.prototype.getArea=function(){return this.getWidth()*this.getHeight()},Pt.prototype.equals=function(n){if(!(n instanceof Pt))return!1;var i=n;return this.isNull()?i.isNull():this._maxx===i.getMaxX()&&this._maxy===i.getMaxY()&&this._minx===i.getMinX()&&this._miny===i.getMinY()},Pt.prototype.intersection=function(n){if(this.isNull()||n.isNull()||!this.intersects(n))return new Pt;var i=this._minx>n._minx?this._minx:n._minx,s=this._miny>n._miny?this._miny:n._miny,u=this._maxx<n._maxx?this._maxx:n._maxx,c=this._maxy<n._maxy?this._maxy:n._maxy;return new Pt(i,u,s,c)},Pt.prototype.isNull=function(){return this._maxx<this._minx},Pt.prototype.getMaxX=function(){return this._maxx},Pt.prototype.covers=function(){if(arguments.length===1){if(arguments[0]instanceof L){var n=arguments[0];return this.covers(n.x,n.y)}if(arguments[0]instanceof Pt){var i=arguments[0];return!this.isNull()&&!i.isNull()&&i.getMinX()>=this._minx&&i.getMaxX()<=this._maxx&&i.getMinY()>=this._miny&&i.getMaxY()<=this._maxy}}else if(arguments.length===2){var s=arguments[0],u=arguments[1];return!this.isNull()&&s>=this._minx&&s<=this._maxx&&u>=this._miny&&u<=this._maxy}},Pt.prototype.intersects=function(){if(arguments.length===1){if(arguments[0]instanceof Pt){var n=arguments[0];return!this.isNull()&&!n.isNull()&&!(n._minx>this._maxx||n._maxx<this._minx||n._miny>this._maxy||n._maxy<this._miny)}if(arguments[0]instanceof L){var i=arguments[0];return this.intersects(i.x,i.y)}}else if(arguments.length===2){var s=arguments[0],u=arguments[1];return!this.isNull()&&!(s>this._maxx||s<this._minx||u>this._maxy||u<this._miny)}},Pt.prototype.getMinY=function(){return this._miny},Pt.prototype.getMinX=function(){return this._minx},Pt.prototype.expandToInclude=function(){if(arguments.length===1){if(arguments[0]instanceof L){var n=arguments[0];this.expandToInclude(n.x,n.y)}else if(arguments[0]instanceof Pt){var i=arguments[0];if(i.isNull())return null;this.isNull()?(this._minx=i.getMinX(),this._maxx=i.getMaxX(),this._miny=i.getMinY(),this._maxy=i.getMaxY()):(i._minx<this._minx&&(this._minx=i._minx),i._maxx>this._maxx&&(this._maxx=i._maxx),i._miny<this._miny&&(this._miny=i._miny),i._maxy>this._maxy&&(this._maxy=i._maxy))}}else if(arguments.length===2){var s=arguments[0],u=arguments[1];this.isNull()?(this._minx=s,this._maxx=s,this._miny=u,this._maxy=u):(s<this._minx&&(this._minx=s),s>this._maxx&&(this._maxx=s),u<this._miny&&(this._miny=u),u>this._maxy&&(this._maxy=u))}},Pt.prototype.minExtent=function(){if(this.isNull())return 0;var n=this.getWidth(),i=this.getHeight();return n<i?n:i},Pt.prototype.getWidth=function(){return this.isNull()?0:this._maxx-this._minx},Pt.prototype.compareTo=function(n){var i=n;return this.isNull()?i.isNull()?0:-1:i.isNull()?1:this._minx<i._minx?-1:this._minx>i._minx?1:this._miny<i._miny?-1:this._miny>i._miny?1:this._maxx<i._maxx?-1:this._maxx>i._maxx?1:this._maxy<i._maxy?-1:this._maxy>i._maxy?1:0},Pt.prototype.translate=function(n,i){if(this.isNull())return null;this.init(this.getMinX()+n,this.getMaxX()+n,this.getMinY()+i,this.getMaxY()+i)},Pt.prototype.toString=function(){return"Env["+this._minx+" : "+this._maxx+", "+this._miny+" : "+this._maxy+"]"},Pt.prototype.setToNull=function(){this._minx=0,this._maxx=-1,this._miny=0,this._maxy=-1},Pt.prototype.getHeight=function(){return this.isNull()?0:this._maxy-this._miny},Pt.prototype.maxExtent=function(){if(this.isNull())return 0;var n=this.getWidth(),i=this.getHeight();return n>i?n:i},Pt.prototype.expandBy=function(){if(arguments.length===1){var n=arguments[0];this.expandBy(n,n)}else if(arguments.length===2){var i=arguments[0],s=arguments[1];if(this.isNull())return null;this._minx-=i,this._maxx+=i,this._miny-=s,this._maxy+=s,(this._minx>this._maxx||this._miny>this._maxy)&&this.setToNull()}},Pt.prototype.contains=function(){if(arguments.length===1){if(arguments[0]instanceof Pt){var n=arguments[0];return this.covers(n)}if(arguments[0]instanceof L){var i=arguments[0];return this.covers(i)}}else if(arguments.length===2){var s=arguments[0],u=arguments[1];return this.covers(s,u)}},Pt.prototype.centre=function(){return this.isNull()?null:new L((this.getMinX()+this.getMaxX())/2,(this.getMinY()+this.getMaxY())/2)},Pt.prototype.init=function(){if(arguments.length===0)this.setToNull();else if(arguments.length===1){if(arguments[0]instanceof L){var n=arguments[0];this.init(n.x,n.x,n.y,n.y)}else if(arguments[0]instanceof Pt){var i=arguments[0];this._minx=i._minx,this._maxx=i._maxx,this._miny=i._miny,this._maxy=i._maxy}}else if(arguments.length===2){var s=arguments[0],u=arguments[1];this.init(s.x,u.x,s.y,u.y)}else if(arguments.length===4){var c=arguments[0],m=arguments[1],E=arguments[2],A=arguments[3];c<m?(this._minx=c,this._maxx=m):(this._minx=m,this._maxx=c),E<A?(this._miny=E,this._maxy=A):(this._miny=A,this._maxy=E)}},Pt.prototype.getMaxY=function(){return this._maxy},Pt.prototype.distance=function(n){if(this.intersects(n))return 0;var i=0;this._maxx<n._minx?i=n._minx-this._maxx:this._minx>n._maxx&&(i=this._minx-n._maxx);var s=0;return this._maxy<n._miny?s=n._miny-this._maxy:this._miny>n._maxy&&(s=this._miny-n._maxy),i===0?s:s===0?i:Math.sqrt(i*i+s*s)},Pt.prototype.hashCode=function(){var n=17;return n=37*n+L.hashCode(this._minx),n=37*n+L.hashCode(this._maxx),n=37*n+L.hashCode(this._miny),n=37*n+L.hashCode(this._maxy)},Pt.prototype.interfaces_=function(){return[F,t]},Pt.prototype.getClass=function(){return Pt},Pt.intersects=function(){if(arguments.length===3){var n=arguments[0],i=arguments[1],s=arguments[2];return s.x>=(n.x<i.x?n.x:i.x)&&s.x<=(n.x>i.x?n.x:i.x)&&s.y>=(n.y<i.y?n.y:i.y)&&s.y<=(n.y>i.y?n.y:i.y)}if(arguments.length===4){var u=arguments[0],c=arguments[1],m=arguments[2],E=arguments[3],A=Math.min(m.x,E.x),U=Math.max(m.x,E.x),Z=Math.min(u.x,c.x),ut=Math.max(u.x,c.x);return!(Z>U)&&!(ut<A)&&(A=Math.min(m.y,E.y),U=Math.max(m.y,E.y),Z=Math.min(u.y,c.y),ut=Math.max(u.y,c.y),!(Z>U)&&!(ut<A))}},Xt.serialVersionUID.get=function(){return 5873921885273102e3},Object.defineProperties(Pt,Xt);var tt={typeStr:/^\\s*(\\w+)\\s*\\(\\s*(.*)\\s*\\)\\s*$/,emptyTypeStr:/^\\s*(\\w+)\\s*EMPTY\\s*$/,spaces:/\\s+/,parenComma:/\\)\\s*,\\s*\\(/,doubleParenComma:/\\)\\s*\\)\\s*,\\s*\\(\\s*\\(/,trimParens:/^\\s*\\(?(.*?)\\)?\\s*$/},nn=function(n){this.geometryFactory=n||new le};nn.prototype.read=function(n){var i,s,u;n=n.replace(/[\\n\\r]/g," ");var c=tt.typeStr.exec(n);if(n.search("EMPTY")!==-1&&((c=tt.emptyTypeStr.exec(n))[2]=void 0),c&&(s=c[1].toLowerCase(),u=c[2],te[s]&&(i=te[s].apply(this,[u]))),i===void 0)throw new Error("Could not parse WKT "+n);return i},nn.prototype.write=function(n){return this.extractGeometry(n)},nn.prototype.extractGeometry=function(n){var i=n.getGeometryType().toLowerCase();if(!Gt[i])return null;var s=i.toUpperCase();return n.isEmpty()?s+" EMPTY":s+"("+Gt[i].apply(this,[n])+")"};var Gt={coordinate:function(n){return n.x+" "+n.y},point:function(n){return Gt.coordinate.call(this,n._coordinates._coordinates[0])},multipoint:function(n){for(var i=[],s=0,u=n._geometries.length;s<u;++s)i.push("("+Gt.point.apply(this,[n._geometries[s]])+")");return i.join(",")},linestring:function(n){for(var i=[],s=0,u=n._points._coordinates.length;s<u;++s)i.push(Gt.coordinate.apply(this,[n._points._coordinates[s]]));return i.join(",")},linearring:function(n){for(var i=[],s=0,u=n._points._coordinates.length;s<u;++s)i.push(Gt.coordinate.apply(this,[n._points._coordinates[s]]));return i.join(",")},multilinestring:function(n){for(var i=[],s=0,u=n._geometries.length;s<u;++s)i.push("("+Gt.linestring.apply(this,[n._geometries[s]])+")");return i.join(",")},polygon:function(n){var i=[];i.push("("+Gt.linestring.apply(this,[n._shell])+")");for(var s=0,u=n._holes.length;s<u;++s)i.push("("+Gt.linestring.apply(this,[n._holes[s]])+")");return i.join(",")},multipolygon:function(n){for(var i=[],s=0,u=n._geometries.length;s<u;++s)i.push("("+Gt.polygon.apply(this,[n._geometries[s]])+")");return i.join(",")},geometrycollection:function(n){for(var i=[],s=0,u=n._geometries.length;s<u;++s)i.push(this.extractGeometry(n._geometries[s]));return i.join(",")}},te={point:function(n){if(n===void 0)return this.geometryFactory.createPoint();var i=n.trim().split(tt.spaces);return this.geometryFactory.createPoint(new L(Number.parseFloat(i[0]),Number.parseFloat(i[1])))},multipoint:function(n){if(n===void 0)return this.geometryFactory.createMultiPoint();for(var i,s=n.trim().split(","),u=[],c=0,m=s.length;c<m;++c)i=s[c].replace(tt.trimParens,"$1"),u.push(te.point.apply(this,[i]));return this.geometryFactory.createMultiPoint(u)},linestring:function(n){if(n===void 0)return this.geometryFactory.createLineString();for(var i,s=n.trim().split(","),u=[],c=0,m=s.length;c<m;++c)i=s[c].trim().split(tt.spaces),u.push(new L(Number.parseFloat(i[0]),Number.parseFloat(i[1])));return this.geometryFactory.createLineString(u)},linearring:function(n){if(n===void 0)return this.geometryFactory.createLinearRing();for(var i,s=n.trim().split(","),u=[],c=0,m=s.length;c<m;++c)i=s[c].trim().split(tt.spaces),u.push(new L(Number.parseFloat(i[0]),Number.parseFloat(i[1])));return this.geometryFactory.createLinearRing(u)},multilinestring:function(n){if(n===void 0)return this.geometryFactory.createMultiLineString();for(var i,s=n.trim().split(tt.parenComma),u=[],c=0,m=s.length;c<m;++c)i=s[c].replace(tt.trimParens,"$1"),u.push(te.linestring.apply(this,[i]));return this.geometryFactory.createMultiLineString(u)},polygon:function(n){if(n===void 0)return this.geometryFactory.createPolygon();for(var i,s,u,c,m=n.trim().split(tt.parenComma),E=[],A=0,U=m.length;A<U;++A)i=m[A].replace(tt.trimParens,"$1"),s=te.linestring.apply(this,[i]),u=this.geometryFactory.createLinearRing(s._points),A===0?c=u:E.push(u);return this.geometryFactory.createPolygon(c,E)},multipolygon:function(n){if(n===void 0)return this.geometryFactory.createMultiPolygon();for(var i,s=n.trim().split(tt.doubleParenComma),u=[],c=0,m=s.length;c<m;++c)i=s[c].replace(tt.trimParens,"$1"),u.push(te.polygon.apply(this,[i]));return this.geometryFactory.createMultiPolygon(u)},geometrycollection:function(n){if(n===void 0)return this.geometryFactory.createGeometryCollection();for(var i=(n=n.replace(/,\\s*([A-Za-z])/g,"|$1")).trim().split("|"),s=[],u=0,c=i.length;u<c;++u)s.push(this.read(i[u]));return this.geometryFactory.createGeometryCollection(s)}},qt=function(n){this.parser=new nn(n)};qt.prototype.write=function(n){return this.parser.write(n)},qt.toLineString=function(n,i){if(arguments.length!==2)throw new Error("Not implemented");return"LINESTRING ( "+n.x+" "+n.y+", "+i.x+" "+i.y+" )"};var $=function(n){function i(s){n.call(this,s),this.name="RuntimeException",this.message=s,this.stack=new n().stack}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i}(Error),N=function(n){function i(){if(n.call(this),arguments.length===0)n.call(this);else if(arguments.length===1){var s=arguments[0];n.call(this,s)}}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}($),b=function(){};b.prototype.interfaces_=function(){return[]},b.prototype.getClass=function(){return b},b.shouldNeverReachHere=function(){if(arguments.length===0)b.shouldNeverReachHere(null);else if(arguments.length===1){var n=arguments[0];throw new N("Should never reach here"+(n!==null?": "+n:""))}},b.isTrue=function(){var n,i;if(arguments.length===1)n=arguments[0],b.isTrue(n,null);else if(arguments.length===2&&(n=arguments[0],i=arguments[1],!n))throw i===null?new N:new N(i)},b.equals=function(){var n,i,s;if(arguments.length===2)n=arguments[0],i=arguments[1],b.equals(n,i,null);else if(arguments.length===3&&(n=arguments[0],i=arguments[1],s=arguments[2],!i.equals(n)))throw new N("Expected "+n+" but encountered "+i+(s!==null?": "+s:""))};var R=function(){this._result=null,this._inputLines=Array(2).fill().map(function(){return Array(2)}),this._intPt=new Array(2).fill(null),this._intLineIndex=null,this._isProper=null,this._pa=null,this._pb=null,this._precisionModel=null,this._intPt[0]=new L,this._intPt[1]=new L,this._pa=this._intPt[0],this._pb=this._intPt[1],this._result=0},W={DONT_INTERSECT:{configurable:!0},DO_INTERSECT:{configurable:!0},COLLINEAR:{configurable:!0},NO_INTERSECTION:{configurable:!0},POINT_INTERSECTION:{configurable:!0},COLLINEAR_INTERSECTION:{configurable:!0}};R.prototype.getIndexAlongSegment=function(n,i){return this.computeIntLineIndex(),this._intLineIndex[n][i]},R.prototype.getTopologySummary=function(){var n=new pt;return this.isEndPoint()&&n.append(" endpoint"),this._isProper&&n.append(" proper"),this.isCollinear()&&n.append(" collinear"),n.toString()},R.prototype.computeIntersection=function(n,i,s,u){this._inputLines[0][0]=n,this._inputLines[0][1]=i,this._inputLines[1][0]=s,this._inputLines[1][1]=u,this._result=this.computeIntersect(n,i,s,u)},R.prototype.getIntersectionNum=function(){return this._result},R.prototype.computeIntLineIndex=function(){if(arguments.length===0)this._intLineIndex===null&&(this._intLineIndex=Array(2).fill().map(function(){return Array(2)}),this.computeIntLineIndex(0),this.computeIntLineIndex(1));else if(arguments.length===1){var n=arguments[0];this.getEdgeDistance(n,0)>this.getEdgeDistance(n,1)?(this._intLineIndex[n][0]=0,this._intLineIndex[n][1]=1):(this._intLineIndex[n][0]=1,this._intLineIndex[n][1]=0)}},R.prototype.isProper=function(){return this.hasIntersection()&&this._isProper},R.prototype.setPrecisionModel=function(n){this._precisionModel=n},R.prototype.isInteriorIntersection=function(){if(arguments.length===0)return!!this.isInteriorIntersection(0)||!!this.isInteriorIntersection(1);if(arguments.length===1){for(var n=arguments[0],i=0;i<this._result;i++)if(!this._intPt[i].equals2D(this._inputLines[n][0])&&!this._intPt[i].equals2D(this._inputLines[n][1]))return!0;return!1}},R.prototype.getIntersection=function(n){return this._intPt[n]},R.prototype.isEndPoint=function(){return this.hasIntersection()&&!this._isProper},R.prototype.hasIntersection=function(){return this._result!==R.NO_INTERSECTION},R.prototype.getEdgeDistance=function(n,i){return R.computeEdgeDistance(this._intPt[i],this._inputLines[n][0],this._inputLines[n][1])},R.prototype.isCollinear=function(){return this._result===R.COLLINEAR_INTERSECTION},R.prototype.toString=function(){return qt.toLineString(this._inputLines[0][0],this._inputLines[0][1])+" - "+qt.toLineString(this._inputLines[1][0],this._inputLines[1][1])+this.getTopologySummary()},R.prototype.getEndpoint=function(n,i){return this._inputLines[n][i]},R.prototype.isIntersection=function(n){for(var i=0;i<this._result;i++)if(this._intPt[i].equals2D(n))return!0;return!1},R.prototype.getIntersectionAlongSegment=function(n,i){return this.computeIntLineIndex(),this._intPt[this._intLineIndex[n][i]]},R.prototype.interfaces_=function(){return[]},R.prototype.getClass=function(){return R},R.computeEdgeDistance=function(n,i,s){var u=Math.abs(s.x-i.x),c=Math.abs(s.y-i.y),m=-1;if(n.equals(i))m=0;else if(n.equals(s))m=u>c?u:c;else{var E=Math.abs(n.x-i.x),A=Math.abs(n.y-i.y);(m=u>c?E:A)!==0||n.equals(i)||(m=Math.max(E,A))}return b.isTrue(!(m===0&&!n.equals(i)),"Bad distance calculation"),m},R.nonRobustComputeEdgeDistance=function(n,i,s){var u=n.x-i.x,c=n.y-i.y,m=Math.sqrt(u*u+c*c);return b.isTrue(!(m===0&&!n.equals(i)),"Invalid distance calculation"),m},W.DONT_INTERSECT.get=function(){return 0},W.DO_INTERSECT.get=function(){return 1},W.COLLINEAR.get=function(){return 2},W.NO_INTERSECTION.get=function(){return 0},W.POINT_INTERSECTION.get=function(){return 1},W.COLLINEAR_INTERSECTION.get=function(){return 2},Object.defineProperties(R,W);var J=function(n){function i(){n.apply(this,arguments)}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.isInSegmentEnvelopes=function(s){var u=new Pt(this._inputLines[0][0],this._inputLines[0][1]),c=new Pt(this._inputLines[1][0],this._inputLines[1][1]);return u.contains(s)&&c.contains(s)},i.prototype.computeIntersection=function(){if(arguments.length!==3)return n.prototype.computeIntersection.apply(this,arguments);var s=arguments[0],u=arguments[1],c=arguments[2];if(this._isProper=!1,Pt.intersects(u,c,s)&&B.orientationIndex(u,c,s)===0&&B.orientationIndex(c,u,s)===0)return this._isProper=!0,(s.equals(u)||s.equals(c))&&(this._isProper=!1),this._result=n.POINT_INTERSECTION,null;this._result=n.NO_INTERSECTION},i.prototype.normalizeToMinimum=function(s,u,c,m,E){E.x=this.smallestInAbsValue(s.x,u.x,c.x,m.x),E.y=this.smallestInAbsValue(s.y,u.y,c.y,m.y),s.x-=E.x,s.y-=E.y,u.x-=E.x,u.y-=E.y,c.x-=E.x,c.y-=E.y,m.x-=E.x,m.y-=E.y},i.prototype.safeHCoordinateIntersection=function(s,u,c,m){var E=null;try{E=ne.intersection(s,u,c,m)}catch(A){if(!(A instanceof Wt))throw A;E=i.nearestEndpoint(s,u,c,m)}return E},i.prototype.intersection=function(s,u,c,m){var E=this.intersectionWithNormalization(s,u,c,m);return this.isInSegmentEnvelopes(E)||(E=new L(i.nearestEndpoint(s,u,c,m))),this._precisionModel!==null&&this._precisionModel.makePrecise(E),E},i.prototype.smallestInAbsValue=function(s,u,c,m){var E=s,A=Math.abs(E);return Math.abs(u)<A&&(E=u,A=Math.abs(u)),Math.abs(c)<A&&(E=c,A=Math.abs(c)),Math.abs(m)<A&&(E=m),E},i.prototype.checkDD=function(s,u,c,m,E){var A=at.intersection(s,u,c,m),U=this.isInSegmentEnvelopes(A);Nt.out.println("DD in env = "+U+" --------------------- "+A),E.distance(A)>1e-4&&Nt.out.println("Distance = "+E.distance(A))},i.prototype.intersectionWithNormalization=function(s,u,c,m){var E=new L(s),A=new L(u),U=new L(c),Z=new L(m),ut=new L;this.normalizeToEnvCentre(E,A,U,Z,ut);var ht=this.safeHCoordinateIntersection(E,A,U,Z);return ht.x+=ut.x,ht.y+=ut.y,ht},i.prototype.computeCollinearIntersection=function(s,u,c,m){var E=Pt.intersects(s,u,c),A=Pt.intersects(s,u,m),U=Pt.intersects(c,m,s),Z=Pt.intersects(c,m,u);return E&&A?(this._intPt[0]=c,this._intPt[1]=m,n.COLLINEAR_INTERSECTION):U&&Z?(this._intPt[0]=s,this._intPt[1]=u,n.COLLINEAR_INTERSECTION):E&&U?(this._intPt[0]=c,this._intPt[1]=s,!c.equals(s)||A||Z?n.COLLINEAR_INTERSECTION:n.POINT_INTERSECTION):E&&Z?(this._intPt[0]=c,this._intPt[1]=u,!c.equals(u)||A||U?n.COLLINEAR_INTERSECTION:n.POINT_INTERSECTION):A&&U?(this._intPt[0]=m,this._intPt[1]=s,!m.equals(s)||E||Z?n.COLLINEAR_INTERSECTION:n.POINT_INTERSECTION):A&&Z?(this._intPt[0]=m,this._intPt[1]=u,!m.equals(u)||E||U?n.COLLINEAR_INTERSECTION:n.POINT_INTERSECTION):n.NO_INTERSECTION},i.prototype.normalizeToEnvCentre=function(s,u,c,m,E){var A=s.x<u.x?s.x:u.x,U=s.y<u.y?s.y:u.y,Z=s.x>u.x?s.x:u.x,ut=s.y>u.y?s.y:u.y,ht=c.x<m.x?c.x:m.x,At=c.y<m.y?c.y:m.y,Rt=c.x>m.x?c.x:m.x,kt=c.y>m.y?c.y:m.y,ee=((A>ht?A:ht)+(Z<Rt?Z:Rt))/2,on=((U>At?U:At)+(ut<kt?ut:kt))/2;E.x=ee,E.y=on,s.x-=E.x,s.y-=E.y,u.x-=E.x,u.y-=E.y,c.x-=E.x,c.y-=E.y,m.x-=E.x,m.y-=E.y},i.prototype.computeIntersect=function(s,u,c,m){if(this._isProper=!1,!Pt.intersects(s,u,c,m))return n.NO_INTERSECTION;var E=B.orientationIndex(s,u,c),A=B.orientationIndex(s,u,m);if(E>0&&A>0||E<0&&A<0)return n.NO_INTERSECTION;var U=B.orientationIndex(c,m,s),Z=B.orientationIndex(c,m,u);return U>0&&Z>0||U<0&&Z<0?n.NO_INTERSECTION:E===0&&A===0&&U===0&&Z===0?this.computeCollinearIntersection(s,u,c,m):(E===0||A===0||U===0||Z===0?(this._isProper=!1,s.equals2D(c)||s.equals2D(m)?this._intPt[0]=s:u.equals2D(c)||u.equals2D(m)?this._intPt[0]=u:E===0?this._intPt[0]=new L(c):A===0?this._intPt[0]=new L(m):U===0?this._intPt[0]=new L(s):Z===0&&(this._intPt[0]=new L(u))):(this._isProper=!0,this._intPt[0]=this.intersection(s,u,c,m)),n.POINT_INTERSECTION)},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i.nearestEndpoint=function(s,u,c,m){var E=s,A=B.distancePointLine(s,c,m),U=B.distancePointLine(u,c,m);return U<A&&(A=U,E=u),(U=B.distancePointLine(c,s,u))<A&&(A=U,E=c),(U=B.distancePointLine(m,s,u))<A&&(A=U,E=m),E},i}(R),I=function(){};I.prototype.interfaces_=function(){return[]},I.prototype.getClass=function(){return I},I.orientationIndex=function(n,i,s){var u=i.x-n.x,c=i.y-n.y,m=s.x-i.x,E=s.y-i.y;return I.signOfDet2x2(u,c,m,E)},I.signOfDet2x2=function(n,i,s,u){var c=null,m=null,E=null;if(c=1,n===0||u===0)return i===0||s===0?0:i>0?s>0?-c:c:s>0?c:-c;if(i===0||s===0)return u>0?n>0?c:-c:n>0?-c:c;if(i>0?u>0?i<=u||(c=-c,m=n,n=s,s=m,m=i,i=u,u=m):i<=-u?(c=-c,s=-s,u=-u):(m=n,n=-s,s=m,m=i,i=-u,u=m):u>0?-i<=u?(c=-c,n=-n,i=-i):(m=-n,n=s,s=m,m=-i,i=u,u=m):i>=u?(n=-n,i=-i,s=-s,u=-u):(c=-c,m=-n,n=-s,s=m,m=-i,i=-u,u=m),n>0){if(!(s>0)||!(n<=s))return c}else{if(s>0||!(n>=s))return-c;c=-c,n=-n,s=-s}for(;;){if(E=Math.floor(s/n),s-=E*n,(u-=E*i)<0)return-c;if(u>i)return c;if(n>s+s){if(i<u+u)return c}else{if(i>u+u)return-c;s=n-s,u=i-u,c=-c}if(u===0)return s===0?0:-c;if(s===0||(E=Math.floor(n/s),n-=E*s,(i-=E*u)<0))return c;if(i>u)return-c;if(s>n+n){if(u<i+i)return-c}else{if(u>i+i)return c;n=s-n,i=u-i,c=-c}if(i===0)return n===0?0:c;if(n===0)return-c}};var P=function(){this._p=null,this._crossingCount=0,this._isPointOnSegment=!1;var n=arguments[0];this._p=n};P.prototype.countSegment=function(n,i){if(n.x<this._p.x&&i.x<this._p.x)return null;if(this._p.x===i.x&&this._p.y===i.y)return this._isPointOnSegment=!0,null;if(n.y===this._p.y&&i.y===this._p.y){var s=n.x,u=i.x;return s>u&&(s=i.x,u=n.x),this._p.x>=s&&this._p.x<=u&&(this._isPointOnSegment=!0),null}if(n.y>this._p.y&&i.y<=this._p.y||i.y>this._p.y&&n.y<=this._p.y){var c=n.x-this._p.x,m=n.y-this._p.y,E=i.x-this._p.x,A=i.y-this._p.y,U=I.signOfDet2x2(c,m,E,A);if(U===0)return this._isPointOnSegment=!0,null;A<m&&(U=-U),U>0&&this._crossingCount++}},P.prototype.isPointInPolygon=function(){return this.getLocation()!==k.EXTERIOR},P.prototype.getLocation=function(){return this._isPointOnSegment?k.BOUNDARY:this._crossingCount%2==1?k.INTERIOR:k.EXTERIOR},P.prototype.isOnSegment=function(){return this._isPointOnSegment},P.prototype.interfaces_=function(){return[]},P.prototype.getClass=function(){return P},P.locatePointInRing=function(){if(arguments[0]instanceof L&&X(arguments[1],dt)){for(var n=arguments[0],i=arguments[1],s=new P(n),u=new L,c=new L,m=1;m<i.size();m++)if(i.getCoordinate(m,u),i.getCoordinate(m-1,c),s.countSegment(u,c),s.isOnSegment())return s.getLocation();return s.getLocation()}if(arguments[0]instanceof L&&arguments[1]instanceof Array){for(var E=arguments[0],A=arguments[1],U=new P(E),Z=1;Z<A.length;Z++){var ut=A[Z],ht=A[Z-1];if(U.countSegment(ut,ht),U.isOnSegment())return U.getLocation()}return U.getLocation()}};var B=function(){},lt={CLOCKWISE:{configurable:!0},RIGHT:{configurable:!0},COUNTERCLOCKWISE:{configurable:!0},LEFT:{configurable:!0},COLLINEAR:{configurable:!0},STRAIGHT:{configurable:!0}};B.prototype.interfaces_=function(){return[]},B.prototype.getClass=function(){return B},B.orientationIndex=function(n,i,s){return at.orientationIndex(n,i,s)},B.signedArea=function(){if(arguments[0]instanceof Array){var n=arguments[0];if(n.length<3)return 0;for(var i=0,s=n[0].x,u=1;u<n.length-1;u++){var c=n[u].x-s,m=n[u+1].y;i+=c*(n[u-1].y-m)}return i/2}if(X(arguments[0],dt)){var E=arguments[0],A=E.size();if(A<3)return 0;var U=new L,Z=new L,ut=new L;E.getCoordinate(0,Z),E.getCoordinate(1,ut);var ht=Z.x;ut.x-=ht;for(var At=0,Rt=1;Rt<A-1;Rt++)U.y=Z.y,Z.x=ut.x,Z.y=ut.y,E.getCoordinate(Rt+1,ut),ut.x-=ht,At+=Z.x*(U.y-ut.y);return At/2}},B.distanceLineLine=function(n,i,s,u){if(n.equals(i))return B.distancePointLine(n,s,u);if(s.equals(u))return B.distancePointLine(u,n,i);var c=!1;if(Pt.intersects(n,i,s,u)){var m=(i.x-n.x)*(u.y-s.y)-(i.y-n.y)*(u.x-s.x);if(m===0)c=!0;else{var E=(n.y-s.y)*(u.x-s.x)-(n.x-s.x)*(u.y-s.y),A=((n.y-s.y)*(i.x-n.x)-(n.x-s.x)*(i.y-n.y))/m,U=E/m;(U<0||U>1||A<0||A>1)&&(c=!0)}}else c=!0;return c?it.min(B.distancePointLine(n,s,u),B.distancePointLine(i,s,u),B.distancePointLine(s,n,i),B.distancePointLine(u,n,i)):0},B.isPointInRing=function(n,i){return B.locatePointInRing(n,i)!==k.EXTERIOR},B.computeLength=function(n){var i=n.size();if(i<=1)return 0;var s=0,u=new L;n.getCoordinate(0,u);for(var c=u.x,m=u.y,E=1;E<i;E++){n.getCoordinate(E,u);var A=u.x,U=u.y,Z=A-c,ut=U-m;s+=Math.sqrt(Z*Z+ut*ut),c=A,m=U}return s},B.isCCW=function(n){var i=n.length-1;if(i<3)throw new C("Ring has fewer than 4 points, so orientation cannot be determined");for(var s=n[0],u=0,c=1;c<=i;c++){var m=n[c];m.y>s.y&&(s=m,u=c)}var E=u;do(E-=1)<0&&(E=i);while(n[E].equals2D(s)&&E!==u);var A=u;do A=(A+1)%i;while(n[A].equals2D(s)&&A!==u);var U=n[E],Z=n[A];if(U.equals2D(s)||Z.equals2D(s)||U.equals2D(Z))return!1;var ut=B.computeOrientation(U,s,Z),ht=!1;return ht=ut===0?U.x>Z.x:ut>0,ht},B.locatePointInRing=function(n,i){return P.locatePointInRing(n,i)},B.distancePointLinePerpendicular=function(n,i,s){var u=(s.x-i.x)*(s.x-i.x)+(s.y-i.y)*(s.y-i.y),c=((i.y-n.y)*(s.x-i.x)-(i.x-n.x)*(s.y-i.y))/u;return Math.abs(c)*Math.sqrt(u)},B.computeOrientation=function(n,i,s){return B.orientationIndex(n,i,s)},B.distancePointLine=function(){if(arguments.length===2){var n=arguments[0],i=arguments[1];if(i.length===0)throw new C("Line array must contain at least one vertex");for(var s=n.distance(i[0]),u=0;u<i.length-1;u++){var c=B.distancePointLine(n,i[u],i[u+1]);c<s&&(s=c)}return s}if(arguments.length===3){var m=arguments[0],E=arguments[1],A=arguments[2];if(E.x===A.x&&E.y===A.y)return m.distance(E);var U=(A.x-E.x)*(A.x-E.x)+(A.y-E.y)*(A.y-E.y),Z=((m.x-E.x)*(A.x-E.x)+(m.y-E.y)*(A.y-E.y))/U;if(Z<=0)return m.distance(E);if(Z>=1)return m.distance(A);var ut=((E.y-m.y)*(A.x-E.x)-(E.x-m.x)*(A.y-E.y))/U;return Math.abs(ut)*Math.sqrt(U)}},B.isOnLine=function(n,i){for(var s=new J,u=1;u<i.length;u++){var c=i[u-1],m=i[u];if(s.computeIntersection(n,c,m),s.hasIntersection())return!0}return!1},lt.CLOCKWISE.get=function(){return-1},lt.RIGHT.get=function(){return B.CLOCKWISE},lt.COUNTERCLOCKWISE.get=function(){return 1},lt.LEFT.get=function(){return B.COUNTERCLOCKWISE},lt.COLLINEAR.get=function(){return 0},lt.STRAIGHT.get=function(){return B.COLLINEAR},Object.defineProperties(B,lt);var ct=function(){};ct.prototype.filter=function(n){},ct.prototype.interfaces_=function(){return[]},ct.prototype.getClass=function(){return ct};var Q=function(){var n=arguments[0];this._envelope=null,this._factory=null,this._SRID=null,this._userData=null,this._factory=n,this._SRID=n.getSRID()},St={serialVersionUID:{configurable:!0},SORTINDEX_POINT:{configurable:!0},SORTINDEX_MULTIPOINT:{configurable:!0},SORTINDEX_LINESTRING:{configurable:!0},SORTINDEX_LINEARRING:{configurable:!0},SORTINDEX_MULTILINESTRING:{configurable:!0},SORTINDEX_POLYGON:{configurable:!0},SORTINDEX_MULTIPOLYGON:{configurable:!0},SORTINDEX_GEOMETRYCOLLECTION:{configurable:!0},geometryChangedFilter:{configurable:!0}};Q.prototype.isGeometryCollection=function(){return this.getSortIndex()===Q.SORTINDEX_GEOMETRYCOLLECTION},Q.prototype.getFactory=function(){return this._factory},Q.prototype.getGeometryN=function(n){return this},Q.prototype.getArea=function(){return 0},Q.prototype.isRectangle=function(){return!1},Q.prototype.equals=function(){if(arguments[0]instanceof Q){var n=arguments[0];return n!==null&&this.equalsTopo(n)}if(arguments[0]instanceof Object){var i=arguments[0];if(!(i instanceof Q))return!1;var s=i;return this.equalsExact(s)}},Q.prototype.equalsExact=function(n){return this===n||this.equalsExact(n,0)},Q.prototype.geometryChanged=function(){this.apply(Q.geometryChangedFilter)},Q.prototype.geometryChangedAction=function(){this._envelope=null},Q.prototype.equalsNorm=function(n){return n!==null&&this.norm().equalsExact(n.norm())},Q.prototype.getLength=function(){return 0},Q.prototype.getNumGeometries=function(){return 1},Q.prototype.compareTo=function(){if(arguments.length===1){var n=arguments[0],i=n;return this.getSortIndex()!==i.getSortIndex()?this.getSortIndex()-i.getSortIndex():this.isEmpty()&&i.isEmpty()?0:this.isEmpty()?-1:i.isEmpty()?1:this.compareToSameClass(n)}if(arguments.length===2){var s=arguments[0],u=arguments[1];return this.getSortIndex()!==s.getSortIndex()?this.getSortIndex()-s.getSortIndex():this.isEmpty()&&s.isEmpty()?0:this.isEmpty()?-1:s.isEmpty()?1:this.compareToSameClass(s,u)}},Q.prototype.getUserData=function(){return this._userData},Q.prototype.getSRID=function(){return this._SRID},Q.prototype.getEnvelope=function(){return this.getFactory().toGeometry(this.getEnvelopeInternal())},Q.prototype.checkNotGeometryCollection=function(n){if(n.getSortIndex()===Q.SORTINDEX_GEOMETRYCOLLECTION)throw new C("This method does not support GeometryCollection arguments")},Q.prototype.equal=function(n,i,s){return s===0?n.equals(i):n.distance(i)<=s},Q.prototype.norm=function(){var n=this.copy();return n.normalize(),n},Q.prototype.getPrecisionModel=function(){return this._factory.getPrecisionModel()},Q.prototype.getEnvelopeInternal=function(){return this._envelope===null&&(this._envelope=this.computeEnvelopeInternal()),new Pt(this._envelope)},Q.prototype.setSRID=function(n){this._SRID=n},Q.prototype.setUserData=function(n){this._userData=n},Q.prototype.compare=function(n,i){for(var s=n.iterator(),u=i.iterator();s.hasNext()&&u.hasNext();){var c=s.next(),m=u.next(),E=c.compareTo(m);if(E!==0)return E}return s.hasNext()?1:u.hasNext()?-1:0},Q.prototype.hashCode=function(){return this.getEnvelopeInternal().hashCode()},Q.prototype.isGeometryCollectionOrDerived=function(){return this.getSortIndex()===Q.SORTINDEX_GEOMETRYCOLLECTION||this.getSortIndex()===Q.SORTINDEX_MULTIPOINT||this.getSortIndex()===Q.SORTINDEX_MULTILINESTRING||this.getSortIndex()===Q.SORTINDEX_MULTIPOLYGON},Q.prototype.interfaces_=function(){return[G,F,t]},Q.prototype.getClass=function(){return Q},Q.hasNonEmptyElements=function(n){for(var i=0;i<n.length;i++)if(!n[i].isEmpty())return!0;return!1},Q.hasNullElements=function(n){for(var i=0;i<n.length;i++)if(n[i]===null)return!0;return!1},St.serialVersionUID.get=function(){return 8763622679187377e3},St.SORTINDEX_POINT.get=function(){return 0},St.SORTINDEX_MULTIPOINT.get=function(){return 1},St.SORTINDEX_LINESTRING.get=function(){return 2},St.SORTINDEX_LINEARRING.get=function(){return 3},St.SORTINDEX_MULTILINESTRING.get=function(){return 4},St.SORTINDEX_POLYGON.get=function(){return 5},St.SORTINDEX_MULTIPOLYGON.get=function(){return 6},St.SORTINDEX_GEOMETRYCOLLECTION.get=function(){return 7},St.geometryChangedFilter.get=function(){return _t},Object.defineProperties(Q,St);var _t=function(){};_t.interfaces_=function(){return[ct]},_t.filter=function(n){n.geometryChangedAction()};var Mt=function(){};Mt.prototype.filter=function(n){},Mt.prototype.interfaces_=function(){return[]},Mt.prototype.getClass=function(){return Mt};var Lt=function(){},Jt={Mod2BoundaryNodeRule:{configurable:!0},EndPointBoundaryNodeRule:{configurable:!0},MultiValentEndPointBoundaryNodeRule:{configurable:!0},MonoValentEndPointBoundaryNodeRule:{configurable:!0},MOD2_BOUNDARY_RULE:{configurable:!0},ENDPOINT_BOUNDARY_RULE:{configurable:!0},MULTIVALENT_ENDPOINT_BOUNDARY_RULE:{configurable:!0},MONOVALENT_ENDPOINT_BOUNDARY_RULE:{configurable:!0},OGC_SFS_BOUNDARY_RULE:{configurable:!0}};Lt.prototype.isInBoundary=function(n){},Lt.prototype.interfaces_=function(){return[]},Lt.prototype.getClass=function(){return Lt},Jt.Mod2BoundaryNodeRule.get=function(){return Et},Jt.EndPointBoundaryNodeRule.get=function(){return oe},Jt.MultiValentEndPointBoundaryNodeRule.get=function(){return jt},Jt.MonoValentEndPointBoundaryNodeRule.get=function(){return Ht},Jt.MOD2_BOUNDARY_RULE.get=function(){return new Et},Jt.ENDPOINT_BOUNDARY_RULE.get=function(){return new oe},Jt.MULTIVALENT_ENDPOINT_BOUNDARY_RULE.get=function(){return new jt},Jt.MONOVALENT_ENDPOINT_BOUNDARY_RULE.get=function(){return new Ht},Jt.OGC_SFS_BOUNDARY_RULE.get=function(){return Lt.MOD2_BOUNDARY_RULE},Object.defineProperties(Lt,Jt);var Et=function(){};Et.prototype.isInBoundary=function(n){return n%2==1},Et.prototype.interfaces_=function(){return[Lt]},Et.prototype.getClass=function(){return Et};var oe=function(){};oe.prototype.isInBoundary=function(n){return n>0},oe.prototype.interfaces_=function(){return[Lt]},oe.prototype.getClass=function(){return oe};var jt=function(){};jt.prototype.isInBoundary=function(n){return n>1},jt.prototype.interfaces_=function(){return[Lt]},jt.prototype.getClass=function(){return jt};var Ht=function(){};Ht.prototype.isInBoundary=function(n){return n===1},Ht.prototype.interfaces_=function(){return[Lt]},Ht.prototype.getClass=function(){return Ht};var Ot=function(){};Ot.prototype.add=function(){},Ot.prototype.addAll=function(){},Ot.prototype.isEmpty=function(){},Ot.prototype.iterator=function(){},Ot.prototype.size=function(){},Ot.prototype.toArray=function(){},Ot.prototype.remove=function(){},(e.prototype=new Error).name="IndexOutOfBoundsException";var Y=function(){};Y.prototype.hasNext=function(){},Y.prototype.next=function(){},Y.prototype.remove=function(){};var wt=function(n){function i(){n.apply(this,arguments)}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.get=function(){},i.prototype.set=function(){},i.prototype.isEmpty=function(){},i}(Ot);(o.prototype=new Error).name="NoSuchElementException";var j=function(n){function i(){n.call(this),this.array_=[],arguments[0]instanceof Ot&&this.addAll(arguments[0])}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.ensureCapacity=function(){},i.prototype.interfaces_=function(){return[n,Ot]},i.prototype.add=function(s){return arguments.length===1?this.array_.push(s):this.array_.splice(arguments[0],arguments[1]),!0},i.prototype.clear=function(){this.array_=[]},i.prototype.addAll=function(s){for(var u=s.iterator();u.hasNext();)this.add(u.next());return!0},i.prototype.set=function(s,u){var c=this.array_[s];return this.array_[s]=u,c},i.prototype.iterator=function(){return new Ut(this)},i.prototype.get=function(s){if(s<0||s>=this.size())throw new e;return this.array_[s]},i.prototype.isEmpty=function(){return this.array_.length===0},i.prototype.size=function(){return this.array_.length},i.prototype.toArray=function(){for(var s=[],u=0,c=this.array_.length;u<c;u++)s.push(this.array_[u]);return s},i.prototype.remove=function(s){for(var u=!1,c=0,m=this.array_.length;c<m;c++)if(this.array_[c]===s){this.array_.splice(c,1),u=!0;break}return u},i}(wt),Ut=function(n){function i(s){n.call(this),this.arrayList_=s,this.position_=0}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.next=function(){if(this.position_===this.arrayList_.size())throw new o;return this.arrayList_.get(this.position_++)},i.prototype.hasNext=function(){return this.position_<this.arrayList_.size()},i.prototype.set=function(s){return this.arrayList_.set(this.position_-1,s)},i.prototype.remove=function(){this.arrayList_.remove(this.arrayList_.get(this.position_))},i}(Y),Dt=function(n){function i(){if(n.call(this),arguments.length!==0){if(arguments.length===1){var u=arguments[0];this.ensureCapacity(u.length),this.add(u,!0)}else if(arguments.length===2){var c=arguments[0],m=arguments[1];this.ensureCapacity(c.length),this.add(c,m)}}}n&&(i.__proto__=n),(i.prototype=Object.create(n&&n.prototype)).constructor=i;var s={coordArrayType:{configurable:!0}};return s.coordArrayType.get=function(){return new Array(0).fill(null)},i.prototype.getCoordinate=function(u){return this.get(u)},i.prototype.addAll=function(){if(arguments.length===2){for(var u=arguments[0],c=arguments[1],m=!1,E=u.iterator();E.hasNext();)this.add(E.next(),c),m=!0;return m}return n.prototype.addAll.apply(this,arguments)},i.prototype.clone=function(){for(var u=n.prototype.clone.call(this),c=0;c<this.size();c++)u.add(c,this.get(c).copy());return u},i.prototype.toCoordinateArray=function(){return this.toArray(i.coordArrayType)},i.prototype.add=function(){if(arguments.length===1){var u=arguments[0];n.prototype.add.call(this,u)}else if(arguments.length===2){if(arguments[0]instanceof Array&&typeof arguments[1]=="boolean"){var c=arguments[0],m=arguments[1];return this.add(c,m,!0),!0}if(arguments[0]instanceof L&&typeof arguments[1]=="boolean"){var E=arguments[0];if(!arguments[1]&&this.size()>=1&&this.get(this.size()-1).equals2D(E))return null;n.prototype.add.call(this,E)}else if(arguments[0]instanceof Object&&typeof arguments[1]=="boolean"){var A=arguments[0],U=arguments[1];return this.add(A,U),!0}}else if(arguments.length===3){if(typeof arguments[2]=="boolean"&&arguments[0]instanceof Array&&typeof arguments[1]=="boolean"){var Z=arguments[0],ut=arguments[1];if(arguments[2])for(var ht=0;ht<Z.length;ht++)this.add(Z[ht],ut);else for(var At=Z.length-1;At>=0;At--)this.add(Z[At],ut);return!0}if(typeof arguments[2]=="boolean"&&Number.isInteger(arguments[0])&&arguments[1]instanceof L){var Rt=arguments[0],kt=arguments[1];if(!arguments[2]){var ee=this.size();if(ee>0&&(Rt>0&&this.get(Rt-1).equals2D(kt)||Rt<ee&&this.get(Rt).equals2D(kt)))return null}n.prototype.add.call(this,Rt,kt)}}else if(arguments.length===4){var on=arguments[0],In=arguments[1],pr=arguments[2],Xi=arguments[3],Lo=1;pr>Xi&&(Lo=-1);for(var Tf=pr;Tf!==Xi;Tf+=Lo)this.add(on[Tf],In);return!0}},i.prototype.closeRing=function(){this.size()>0&&this.add(new L(this.get(0)),!1)},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},Object.defineProperties(i,s),i}(j),ft=function(){},$t={ForwardComparator:{configurable:!0},BidirectionalComparator:{configurable:!0},coordArrayType:{configurable:!0}};$t.ForwardComparator.get=function(){return re},$t.BidirectionalComparator.get=function(){return mn},$t.coordArrayType.get=function(){return new Array(0).fill(null)},ft.prototype.interfaces_=function(){return[]},ft.prototype.getClass=function(){return ft},ft.isRing=function(n){return!(n.length<4)&&!!n[0].equals2D(n[n.length-1])},ft.ptNotInList=function(n,i){for(var s=0;s<n.length;s++){var u=n[s];if(ft.indexOf(u,i)<0)return u}return null},ft.scroll=function(n,i){var s=ft.indexOf(i,n);if(s<0)return null;var u=new Array(n.length).fill(null);Nt.arraycopy(n,s,u,0,n.length-s),Nt.arraycopy(n,0,u,n.length-s,s),Nt.arraycopy(u,0,n,0,n.length)},ft.equals=function(){if(arguments.length===2){var n=arguments[0],i=arguments[1];if(n===i)return!0;if(n===null||i===null||n.length!==i.length)return!1;for(var s=0;s<n.length;s++)if(!n[s].equals(i[s]))return!1;return!0}if(arguments.length===3){var u=arguments[0],c=arguments[1],m=arguments[2];if(u===c)return!0;if(u===null||c===null||u.length!==c.length)return!1;for(var E=0;E<u.length;E++)if(m.compare(u[E],c[E])!==0)return!1;return!0}},ft.intersection=function(n,i){for(var s=new Dt,u=0;u<n.length;u++)i.intersects(n[u])&&s.add(n[u],!0);return s.toCoordinateArray()},ft.hasRepeatedPoints=function(n){for(var i=1;i<n.length;i++)if(n[i-1].equals(n[i]))return!0;return!1},ft.removeRepeatedPoints=function(n){return ft.hasRepeatedPoints(n)?new Dt(n,!1).toCoordinateArray():n},ft.reverse=function(n){for(var i=n.length-1,s=Math.trunc(i/2),u=0;u<=s;u++){var c=n[u];n[u]=n[i-u],n[i-u]=c}},ft.removeNull=function(n){for(var i=0,s=0;s<n.length;s++)n[s]!==null&&i++;var u=new Array(i).fill(null);if(i===0)return u;for(var c=0,m=0;m<n.length;m++)n[m]!==null&&(u[c++]=n[m]);return u},ft.copyDeep=function(){if(arguments.length===1){for(var n=arguments[0],i=new Array(n.length).fill(null),s=0;s<n.length;s++)i[s]=new L(n[s]);return i}if(arguments.length===5)for(var u=arguments[0],c=arguments[1],m=arguments[2],E=arguments[3],A=arguments[4],U=0;U<A;U++)m[E+U]=new L(u[c+U])},ft.isEqualReversed=function(n,i){for(var s=0;s<n.length;s++){var u=n[s],c=i[n.length-s-1];if(u.compareTo(c)!==0)return!1}return!0},ft.envelope=function(n){for(var i=new Pt,s=0;s<n.length;s++)i.expandToInclude(n[s]);return i},ft.toCoordinateArray=function(n){return n.toArray(ft.coordArrayType)},ft.atLeastNCoordinatesOrNothing=function(n,i){return i.length>=n?i:[]},ft.indexOf=function(n,i){for(var s=0;s<i.length;s++)if(n.equals(i[s]))return s;return-1},ft.increasingDirection=function(n){for(var i=0;i<Math.trunc(n.length/2);i++){var s=n.length-1-i,u=n[i].compareTo(n[s]);if(u!==0)return u}return 1},ft.compare=function(n,i){for(var s=0;s<n.length&&s<i.length;){var u=n[s].compareTo(i[s]);if(u!==0)return u;s++}return s<i.length?-1:s<n.length?1:0},ft.minCoordinate=function(n){for(var i=null,s=0;s<n.length;s++)(i===null||i.compareTo(n[s])>0)&&(i=n[s]);return i},ft.extract=function(n,i,s){i=it.clamp(i,0,n.length);var u=(s=it.clamp(s,-1,n.length))-i+1;s<0&&(u=0),i>=n.length&&(u=0),s<i&&(u=0);var c=new Array(u).fill(null);if(u===0)return c;for(var m=0,E=i;E<=s;E++)c[m++]=n[E];return c},Object.defineProperties(ft,$t);var re=function(){};re.prototype.compare=function(n,i){return ft.compare(n,i)},re.prototype.interfaces_=function(){return[z]},re.prototype.getClass=function(){return re};var mn=function(){};mn.prototype.compare=function(n,i){var s=n,u=i;if(s.length<u.length)return-1;if(s.length>u.length)return 1;if(s.length===0)return 0;var c=ft.compare(s,u);return ft.isEqualReversed(s,u)?0:c},mn.prototype.OLDcompare=function(n,i){var s=n,u=i;if(s.length<u.length)return-1;if(s.length>u.length)return 1;if(s.length===0)return 0;for(var c=ft.increasingDirection(s),m=ft.increasingDirection(u),E=c>0?0:s.length-1,A=m>0?0:s.length-1,U=0;U<s.length;U++){var Z=s[E].compareTo(u[A]);if(Z!==0)return Z;E+=c,A+=m}return 0},mn.prototype.interfaces_=function(){return[z]},mn.prototype.getClass=function(){return mn};var He=function(){};He.prototype.get=function(){},He.prototype.put=function(){},He.prototype.size=function(){},He.prototype.values=function(){},He.prototype.entrySet=function(){};var Mi=function(n){function i(){n.apply(this,arguments)}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i}(He);(a.prototype=new Error).name="OperationNotSupported",(l.prototype=new Ot).contains=function(){};var $n=function(n){function i(){n.call(this),this.array_=[],arguments[0]instanceof Ot&&this.addAll(arguments[0])}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.contains=function(s){for(var u=0,c=this.array_.length;u<c;u++)if(this.array_[u]===s)return!0;return!1},i.prototype.add=function(s){return!this.contains(s)&&(this.array_.push(s),!0)},i.prototype.addAll=function(s){for(var u=s.iterator();u.hasNext();)this.add(u.next());return!0},i.prototype.remove=function(s){throw new Error},i.prototype.size=function(){return this.array_.length},i.prototype.isEmpty=function(){return this.array_.length===0},i.prototype.toArray=function(){for(var s=[],u=0,c=this.array_.length;u<c;u++)s.push(this.array_[u]);return s},i.prototype.iterator=function(){return new ml(this)},i}(l),ml=function(n){function i(s){n.call(this),this.hashSet_=s,this.position_=0}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.next=function(){if(this.position_===this.hashSet_.size())throw new o;return this.hashSet_.array_[this.position_++]},i.prototype.hasNext=function(){return this.position_<this.hashSet_.size()},i.prototype.remove=function(){throw new a},i}(Y),hi=0;(_.prototype=new Mi).get=function(n){for(var i=this.root_;i!==null;){var s=n.compareTo(i.key);if(s<0)i=i.left;else{if(!(s>0))return i.value;i=i.right}}return null},_.prototype.put=function(n,i){if(this.root_===null)return this.root_={key:n,value:i,left:null,right:null,parent:null,color:hi,getValue:function(){return this.value},getKey:function(){return this.key}},this.size_=1,null;var s,u,c=this.root_;do if(s=c,(u=n.compareTo(c.key))<0)c=c.left;else{if(!(u>0)){var m=c.value;return c.value=i,m}c=c.right}while(c!==null);var E={key:n,left:null,right:null,value:i,parent:s,color:hi,getValue:function(){return this.value},getKey:function(){return this.key}};return u<0?s.left=E:s.right=E,this.fixAfterInsertion(E),this.size_++,null},_.prototype.fixAfterInsertion=function(n){for(n.color=1;n!=null&&n!==this.root_&&n.parent.color===1;)if(h(n)===d(h(h(n)))){var i=g(h(h(n)));f(i)===1?(p(h(n),hi),p(i,hi),p(h(h(n)),1),n=h(h(n))):(n===g(h(n))&&(n=h(n),this.rotateLeft(n)),p(h(n),hi),p(h(h(n)),1),this.rotateRight(h(h(n))))}else{var s=d(h(h(n)));f(s)===1?(p(h(n),hi),p(s,hi),p(h(h(n)),1),n=h(h(n))):(n===d(h(n))&&(n=h(n),this.rotateRight(n)),p(h(n),hi),p(h(h(n)),1),this.rotateLeft(h(h(n))))}this.root_.color=hi},_.prototype.values=function(){var n=new j,i=this.getFirstEntry();if(i!==null)for(n.add(i.value);(i=_.successor(i))!==null;)n.add(i.value);return n},_.prototype.entrySet=function(){var n=new $n,i=this.getFirstEntry();if(i!==null)for(n.add(i);(i=_.successor(i))!==null;)n.add(i);return n},_.prototype.rotateLeft=function(n){if(n!=null){var i=n.right;n.right=i.left,i.left!=null&&(i.left.parent=n),i.parent=n.parent,n.parent===null?this.root_=i:n.parent.left===n?n.parent.left=i:n.parent.right=i,i.left=n,n.parent=i}},_.prototype.rotateRight=function(n){if(n!=null){var i=n.left;n.left=i.right,i.right!=null&&(i.right.parent=n),i.parent=n.parent,n.parent===null?this.root_=i:n.parent.right===n?n.parent.right=i:n.parent.left=i,i.right=n,n.parent=i}},_.prototype.getFirstEntry=function(){var n=this.root_;if(n!=null)for(;n.left!=null;)n=n.left;return n},_.successor=function(n){if(n===null)return null;if(n.right!==null){for(var i=n.right;i.left!==null;)i=i.left;return i}for(var s=n.parent,u=n;s!==null&&u===s.right;)u=s,s=s.parent;return s},_.prototype.size=function(){return this.size_};var bs=function(){};bs.prototype.interfaces_=function(){return[]},bs.prototype.getClass=function(){return bs},y.prototype=new l,(M.prototype=new y).contains=function(n){for(var i=0,s=this.array_.length;i<s;i++)if(this.array_[i].compareTo(n)===0)return!0;return!1},M.prototype.add=function(n){if(this.contains(n))return!1;for(var i=0,s=this.array_.length;i<s;i++)if(this.array_[i].compareTo(n)===1)return this.array_.splice(i,0,n),!0;return this.array_.push(n),!0},M.prototype.addAll=function(n){for(var i=n.iterator();i.hasNext();)this.add(i.next());return!0},M.prototype.remove=function(n){throw new a},M.prototype.size=function(){return this.array_.length},M.prototype.isEmpty=function(){return this.array_.length===0},M.prototype.toArray=function(){for(var n=[],i=0,s=this.array_.length;i<s;i++)n.push(this.array_[i]);return n},M.prototype.iterator=function(){return new _o(this)};var _o=function(n){this.treeSet_=n,this.position_=0};_o.prototype.next=function(){if(this.position_===this.treeSet_.size())throw new o;return this.treeSet_.array_[this.position_++]},_o.prototype.hasNext=function(){return this.position_<this.treeSet_.size()},_o.prototype.remove=function(){throw new a};var Fi=function(){};Fi.sort=function(){var n,i,s,u,c=arguments[0];if(arguments.length===1)u=function(E,A){return E.compareTo(A)},c.sort(u);else if(arguments.length===2)s=arguments[1],u=function(E,A){return s.compare(E,A)},c.sort(u);else if(arguments.length===3){(i=c.slice(arguments[1],arguments[2])).sort();var m=c.slice(0,arguments[1]).concat(i,c.slice(arguments[2],c.length));for(c.splice(0,c.length),n=0;n<m.length;n++)c.push(m[n])}else if(arguments.length===4)for(i=c.slice(arguments[1],arguments[2]),s=arguments[3],u=function(E,A){return s.compare(E,A)},i.sort(u),m=c.slice(0,arguments[1]).concat(i,c.slice(arguments[2],c.length)),c.splice(0,c.length),n=0;n<m.length;n++)c.push(m[n])},Fi.asList=function(n){for(var i=new j,s=0,u=n.length;s<u;s++)i.add(n[s]);return i};var pe=function(){},Rr={P:{configurable:!0},L:{configurable:!0},A:{configurable:!0},FALSE:{configurable:!0},TRUE:{configurable:!0},DONTCARE:{configurable:!0},SYM_FALSE:{configurable:!0},SYM_TRUE:{configurable:!0},SYM_DONTCARE:{configurable:!0},SYM_P:{configurable:!0},SYM_L:{configurable:!0},SYM_A:{configurable:!0}};Rr.P.get=function(){return 0},Rr.L.get=function(){return 1},Rr.A.get=function(){return 2},Rr.FALSE.get=function(){return-1},Rr.TRUE.get=function(){return-2},Rr.DONTCARE.get=function(){return-3},Rr.SYM_FALSE.get=function(){return"F"},Rr.SYM_TRUE.get=function(){return"T"},Rr.SYM_DONTCARE.get=function(){return"*"},Rr.SYM_P.get=function(){return"0"},Rr.SYM_L.get=function(){return"1"},Rr.SYM_A.get=function(){return"2"},pe.prototype.interfaces_=function(){return[]},pe.prototype.getClass=function(){return pe},pe.toDimensionSymbol=function(n){switch(n){case pe.FALSE:return pe.SYM_FALSE;case pe.TRUE:return pe.SYM_TRUE;case pe.DONTCARE:return pe.SYM_DONTCARE;case pe.P:return pe.SYM_P;case pe.L:return pe.SYM_L;case pe.A:return pe.SYM_A}throw new C("Unknown dimension value: "+n)},pe.toDimensionValue=function(n){switch(ot.toUpperCase(n)){case pe.SYM_FALSE:return pe.FALSE;case pe.SYM_TRUE:return pe.TRUE;case pe.SYM_DONTCARE:return pe.DONTCARE;case pe.SYM_P:return pe.P;case pe.SYM_L:return pe.L;case pe.SYM_A:return pe.A}throw new C("Unknown dimension symbol: "+n)},Object.defineProperties(pe,Rr);var ei=function(){};ei.prototype.filter=function(n){},ei.prototype.interfaces_=function(){return[]},ei.prototype.getClass=function(){return ei};var Vr=function(){};Vr.prototype.filter=function(n,i){},Vr.prototype.isDone=function(){},Vr.prototype.isGeometryChanged=function(){},Vr.prototype.interfaces_=function(){return[]},Vr.prototype.getClass=function(){return Vr};var Vn=function(n){function i(u,c){if(n.call(this,c),this._geometries=u||[],n.hasNullElements(this._geometries))throw new C("geometries must not contain null elements")}n&&(i.__proto__=n),(i.prototype=Object.create(n&&n.prototype)).constructor=i;var s={serialVersionUID:{configurable:!0}};return i.prototype.computeEnvelopeInternal=function(){for(var u=new Pt,c=0;c<this._geometries.length;c++)u.expandToInclude(this._geometries[c].getEnvelopeInternal());return u},i.prototype.getGeometryN=function(u){return this._geometries[u]},i.prototype.getSortIndex=function(){return n.SORTINDEX_GEOMETRYCOLLECTION},i.prototype.getCoordinates=function(){for(var u=new Array(this.getNumPoints()).fill(null),c=-1,m=0;m<this._geometries.length;m++)for(var E=this._geometries[m].getCoordinates(),A=0;A<E.length;A++)u[++c]=E[A];return u},i.prototype.getArea=function(){for(var u=0,c=0;c<this._geometries.length;c++)u+=this._geometries[c].getArea();return u},i.prototype.equalsExact=function(){if(arguments.length===2){var u=arguments[0],c=arguments[1];if(!this.isEquivalentClass(u))return!1;var m=u;if(this._geometries.length!==m._geometries.length)return!1;for(var E=0;E<this._geometries.length;E++)if(!this._geometries[E].equalsExact(m._geometries[E],c))return!1;return!0}return n.prototype.equalsExact.apply(this,arguments)},i.prototype.normalize=function(){for(var u=0;u<this._geometries.length;u++)this._geometries[u].normalize();Fi.sort(this._geometries)},i.prototype.getCoordinate=function(){return this.isEmpty()?null:this._geometries[0].getCoordinate()},i.prototype.getBoundaryDimension=function(){for(var u=pe.FALSE,c=0;c<this._geometries.length;c++)u=Math.max(u,this._geometries[c].getBoundaryDimension());return u},i.prototype.getDimension=function(){for(var u=pe.FALSE,c=0;c<this._geometries.length;c++)u=Math.max(u,this._geometries[c].getDimension());return u},i.prototype.getLength=function(){for(var u=0,c=0;c<this._geometries.length;c++)u+=this._geometries[c].getLength();return u},i.prototype.getNumPoints=function(){for(var u=0,c=0;c<this._geometries.length;c++)u+=this._geometries[c].getNumPoints();return u},i.prototype.getNumGeometries=function(){return this._geometries.length},i.prototype.reverse=function(){for(var u=this._geometries.length,c=new Array(u).fill(null),m=0;m<this._geometries.length;m++)c[m]=this._geometries[m].reverse();return this.getFactory().createGeometryCollection(c)},i.prototype.compareToSameClass=function(){if(arguments.length===1){var u=arguments[0],c=new M(Fi.asList(this._geometries)),m=new M(Fi.asList(u._geometries));return this.compare(c,m)}if(arguments.length===2){for(var E=arguments[0],A=arguments[1],U=E,Z=this.getNumGeometries(),ut=U.getNumGeometries(),ht=0;ht<Z&&ht<ut;){var At=this.getGeometryN(ht),Rt=U.getGeometryN(ht),kt=At.compareToSameClass(Rt,A);if(kt!==0)return kt;ht++}return ht<Z?1:ht<ut?-1:0}},i.prototype.apply=function(){if(X(arguments[0],Mt))for(var u=arguments[0],c=0;c<this._geometries.length;c++)this._geometries[c].apply(u);else if(X(arguments[0],Vr)){var m=arguments[0];if(this._geometries.length===0)return null;for(var E=0;E<this._geometries.length&&(this._geometries[E].apply(m),!m.isDone());E++);m.isGeometryChanged()&&this.geometryChanged()}else if(X(arguments[0],ei)){var A=arguments[0];A.filter(this);for(var U=0;U<this._geometries.length;U++)this._geometries[U].apply(A)}else if(X(arguments[0],ct)){var Z=arguments[0];Z.filter(this);for(var ut=0;ut<this._geometries.length;ut++)this._geometries[ut].apply(Z)}},i.prototype.getBoundary=function(){return this.checkNotGeometryCollection(this),b.shouldNeverReachHere(),null},i.prototype.clone=function(){var u=n.prototype.clone.call(this);u._geometries=new Array(this._geometries.length).fill(null);for(var c=0;c<this._geometries.length;c++)u._geometries[c]=this._geometries[c].clone();return u},i.prototype.getGeometryType=function(){return"GeometryCollection"},i.prototype.copy=function(){for(var u=new Array(this._geometries.length).fill(null),c=0;c<u.length;c++)u[c]=this._geometries[c].copy();return new i(u,this._factory)},i.prototype.isEmpty=function(){for(var u=0;u<this._geometries.length;u++)if(!this._geometries[u].isEmpty())return!1;return!0},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},s.serialVersionUID.get=function(){return-5694727726395021e3},Object.defineProperties(i,s),i}(Q),H=function(n){function i(){n.apply(this,arguments)}n&&(i.__proto__=n),(i.prototype=Object.create(n&&n.prototype)).constructor=i;var s={serialVersionUID:{configurable:!0}};return i.prototype.getSortIndex=function(){return Q.SORTINDEX_MULTILINESTRING},i.prototype.equalsExact=function(){if(arguments.length===2){var u=arguments[0],c=arguments[1];return!!this.isEquivalentClass(u)&&n.prototype.equalsExact.call(this,u,c)}return n.prototype.equalsExact.apply(this,arguments)},i.prototype.getBoundaryDimension=function(){return this.isClosed()?pe.FALSE:0},i.prototype.isClosed=function(){if(this.isEmpty())return!1;for(var u=0;u<this._geometries.length;u++)if(!this._geometries[u].isClosed())return!1;return!0},i.prototype.getDimension=function(){return 1},i.prototype.reverse=function(){for(var u=this._geometries.length,c=new Array(u).fill(null),m=0;m<this._geometries.length;m++)c[u-1-m]=this._geometries[m].reverse();return this.getFactory().createMultiLineString(c)},i.prototype.getBoundary=function(){return new rt(this).getBoundary()},i.prototype.getGeometryType=function(){return"MultiLineString"},i.prototype.copy=function(){for(var u=new Array(this._geometries.length).fill(null),c=0;c<u.length;c++)u[c]=this._geometries[c].copy();return new i(u,this._factory)},i.prototype.interfaces_=function(){return[bs]},i.prototype.getClass=function(){return i},s.serialVersionUID.get=function(){return 8166665132445434e3},Object.defineProperties(i,s),i}(Vn),rt=function(){if(this._geom=null,this._geomFact=null,this._bnRule=null,this._endpointMap=null,arguments.length===1){var n=arguments[0],i=Lt.MOD2_BOUNDARY_RULE;this._geom=n,this._geomFact=n.getFactory(),this._bnRule=i}else if(arguments.length===2){var s=arguments[0],u=arguments[1];this._geom=s,this._geomFact=s.getFactory(),this._bnRule=u}};rt.prototype.boundaryMultiLineString=function(n){if(this._geom.isEmpty())return this.getEmptyMultiPoint();var i=this.computeBoundaryCoordinates(n);return i.length===1?this._geomFact.createPoint(i[0]):this._geomFact.createMultiPointFromCoords(i)},rt.prototype.getBoundary=function(){return this._geom instanceof Bt?this.boundaryLineString(this._geom):this._geom instanceof H?this.boundaryMultiLineString(this._geom):this._geom.getBoundary()},rt.prototype.boundaryLineString=function(n){return this._geom.isEmpty()?this.getEmptyMultiPoint():n.isClosed()?this._bnRule.isInBoundary(2)?n.getStartPoint():this._geomFact.createMultiPoint():this._geomFact.createMultiPoint([n.getStartPoint(),n.getEndPoint()])},rt.prototype.getEmptyMultiPoint=function(){return this._geomFact.createMultiPoint()},rt.prototype.computeBoundaryCoordinates=function(n){var i=new j;this._endpointMap=new _;for(var s=0;s<n.getNumGeometries();s++){var u=n.getGeometryN(s);u.getNumPoints()!==0&&(this.addEndpoint(u.getCoordinateN(0)),this.addEndpoint(u.getCoordinateN(u.getNumPoints()-1)))}for(var c=this._endpointMap.entrySet().iterator();c.hasNext();){var m=c.next(),E=m.getValue().count;this._bnRule.isInBoundary(E)&&i.add(m.getKey())}return ft.toCoordinateArray(i)},rt.prototype.addEndpoint=function(n){var i=this._endpointMap.get(n);i===null&&(i=new gt,this._endpointMap.put(n,i)),i.count++},rt.prototype.interfaces_=function(){return[]},rt.prototype.getClass=function(){return rt},rt.getBoundary=function(){if(arguments.length===1){var n=arguments[0];return new rt(n).getBoundary()}if(arguments.length===2){var i=arguments[0],s=arguments[1];return new rt(i,s).getBoundary()}};var gt=function(){this.count=null};gt.prototype.interfaces_=function(){return[]},gt.prototype.getClass=function(){return gt};var st=function(){},yt={NEWLINE:{configurable:!0},SIMPLE_ORDINATE_FORMAT:{configurable:!0}};st.prototype.interfaces_=function(){return[]},st.prototype.getClass=function(){return st},st.chars=function(n,i){for(var s=new Array(i).fill(null),u=0;u<i;u++)s[u]=n;return String(s)},st.getStackTrace=function(){if(arguments.length===1){var n=arguments[0],i=new function(){},s=new function(){}(i);return n.printStackTrace(s),i.toString()}if(arguments.length===2){for(var u=arguments[0],c=arguments[1],m="",E=new function(){}(new function(){}(st.getStackTrace(u))),A=0;A<c;A++)try{m+=E.readLine()+st.NEWLINE}catch(U){if(!(U instanceof w))throw U;b.shouldNeverReachHere()}return m}},st.split=function(n,i){for(var s=i.length,u=new j,c=""+n,m=c.indexOf(i);m>=0;){var E=c.substring(0,m);u.add(E),m=(c=c.substring(m+s)).indexOf(i)}c.length>0&&u.add(c);for(var A=new Array(u.size()).fill(null),U=0;U<A.length;U++)A[U]=u.get(U);return A},st.toString=function(){if(arguments.length===1){var n=arguments[0];return st.SIMPLE_ORDINATE_FORMAT.format(n)}},st.spaces=function(n){return st.chars(" ",n)},yt.NEWLINE.get=function(){return Nt.getProperty("line.separator")},yt.SIMPLE_ORDINATE_FORMAT.get=function(){return new function(){}("0.#")},Object.defineProperties(st,yt);var It=function(){};It.prototype.interfaces_=function(){return[]},It.prototype.getClass=function(){return It},It.copyCoord=function(n,i,s,u){for(var c=Math.min(n.getDimension(),s.getDimension()),m=0;m<c;m++)s.setOrdinate(u,m,n.getOrdinate(i,m))},It.isRing=function(n){var i=n.size();return i===0||!(i<=3)&&n.getOrdinate(0,dt.X)===n.getOrdinate(i-1,dt.X)&&n.getOrdinate(0,dt.Y)===n.getOrdinate(i-1,dt.Y)},It.isEqual=function(n,i){var s=n.size();if(s!==i.size())return!1;for(var u=Math.min(n.getDimension(),i.getDimension()),c=0;c<s;c++)for(var m=0;m<u;m++){var E=n.getOrdinate(c,m),A=i.getOrdinate(c,m);if(n.getOrdinate(c,m)!==i.getOrdinate(c,m)&&(!S.isNaN(E)||!S.isNaN(A)))return!1}return!0},It.extend=function(n,i,s){var u=n.create(s,i.getDimension()),c=i.size();if(It.copy(i,0,u,0,c),c>0)for(var m=c;m<s;m++)It.copy(i,c-1,u,m,1);return u},It.reverse=function(n){for(var i=n.size()-1,s=Math.trunc(i/2),u=0;u<=s;u++)It.swap(n,u,i-u)},It.swap=function(n,i,s){if(i===s)return null;for(var u=0;u<n.getDimension();u++){var c=n.getOrdinate(i,u);n.setOrdinate(i,u,n.getOrdinate(s,u)),n.setOrdinate(s,u,c)}},It.copy=function(n,i,s,u,c){for(var m=0;m<c;m++)It.copyCoord(n,i+m,s,u+m)},It.toString=function(){if(arguments.length===1){var n=arguments[0],i=n.size();if(i===0)return"()";var s=n.getDimension(),u=new pt;u.append("(");for(var c=0;c<i;c++){c>0&&u.append(" ");for(var m=0;m<s;m++)m>0&&u.append(","),u.append(st.toString(n.getOrdinate(c,m)))}return u.append(")"),u.toString()}},It.ensureValidRing=function(n,i){var s=i.size();return s===0?i:s<=3?It.createClosedRing(n,i,4):i.getOrdinate(0,dt.X)===i.getOrdinate(s-1,dt.X)&&i.getOrdinate(0,dt.Y)===i.getOrdinate(s-1,dt.Y)?i:It.createClosedRing(n,i,s+1)},It.createClosedRing=function(n,i,s){var u=n.create(s,i.getDimension()),c=i.size();It.copy(i,0,u,0,c);for(var m=c;m<s;m++)It.copy(i,0,u,m,1);return u};var Bt=function(n){function i(u,c){n.call(this,c),this._points=null,this.init(u)}n&&(i.__proto__=n),(i.prototype=Object.create(n&&n.prototype)).constructor=i;var s={serialVersionUID:{configurable:!0}};return i.prototype.computeEnvelopeInternal=function(){return this.isEmpty()?new Pt:this._points.expandEnvelope(new Pt)},i.prototype.isRing=function(){return this.isClosed()&&this.isSimple()},i.prototype.getSortIndex=function(){return n.SORTINDEX_LINESTRING},i.prototype.getCoordinates=function(){return this._points.toCoordinateArray()},i.prototype.equalsExact=function(){if(arguments.length===2){var u=arguments[0],c=arguments[1];if(!this.isEquivalentClass(u))return!1;var m=u;if(this._points.size()!==m._points.size())return!1;for(var E=0;E<this._points.size();E++)if(!this.equal(this._points.getCoordinate(E),m._points.getCoordinate(E),c))return!1;return!0}return n.prototype.equalsExact.apply(this,arguments)},i.prototype.normalize=function(){for(var u=0;u<Math.trunc(this._points.size()/2);u++){var c=this._points.size()-1-u;if(!this._points.getCoordinate(u).equals(this._points.getCoordinate(c)))return this._points.getCoordinate(u).compareTo(this._points.getCoordinate(c))>0&&It.reverse(this._points),null}},i.prototype.getCoordinate=function(){return this.isEmpty()?null:this._points.getCoordinate(0)},i.prototype.getBoundaryDimension=function(){return this.isClosed()?pe.FALSE:0},i.prototype.isClosed=function(){return!this.isEmpty()&&this.getCoordinateN(0).equals2D(this.getCoordinateN(this.getNumPoints()-1))},i.prototype.getEndPoint=function(){return this.isEmpty()?null:this.getPointN(this.getNumPoints()-1)},i.prototype.getDimension=function(){return 1},i.prototype.getLength=function(){return B.computeLength(this._points)},i.prototype.getNumPoints=function(){return this._points.size()},i.prototype.reverse=function(){var u=this._points.copy();return It.reverse(u),this.getFactory().createLineString(u)},i.prototype.compareToSameClass=function(){if(arguments.length===1){for(var u=arguments[0],c=0,m=0;c<this._points.size()&&m<u._points.size();){var E=this._points.getCoordinate(c).compareTo(u._points.getCoordinate(m));if(E!==0)return E;c++,m++}return c<this._points.size()?1:m<u._points.size()?-1:0}if(arguments.length===2){var A=arguments[0];return arguments[1].compare(this._points,A._points)}},i.prototype.apply=function(){if(X(arguments[0],Mt))for(var u=arguments[0],c=0;c<this._points.size();c++)u.filter(this._points.getCoordinate(c));else if(X(arguments[0],Vr)){var m=arguments[0];if(this._points.size()===0)return null;for(var E=0;E<this._points.size()&&(m.filter(this._points,E),!m.isDone());E++);m.isGeometryChanged()&&this.geometryChanged()}else X(arguments[0],ei)?arguments[0].filter(this):X(arguments[0],ct)&&arguments[0].filter(this)},i.prototype.getBoundary=function(){return new rt(this).getBoundary()},i.prototype.isEquivalentClass=function(u){return u instanceof i},i.prototype.clone=function(){var u=n.prototype.clone.call(this);return u._points=this._points.clone(),u},i.prototype.getCoordinateN=function(u){return this._points.getCoordinate(u)},i.prototype.getGeometryType=function(){return"LineString"},i.prototype.copy=function(){return new i(this._points.copy(),this._factory)},i.prototype.getCoordinateSequence=function(){return this._points},i.prototype.isEmpty=function(){return this._points.size()===0},i.prototype.init=function(u){if(u===null&&(u=this.getFactory().getCoordinateSequenceFactory().create([])),u.size()===1)throw new C("Invalid number of points in LineString (found "+u.size()+" - must be 0 or >= 2)");this._points=u},i.prototype.isCoordinate=function(u){for(var c=0;c<this._points.size();c++)if(this._points.getCoordinate(c).equals(u))return!0;return!1},i.prototype.getStartPoint=function(){return this.isEmpty()?null:this.getPointN(0)},i.prototype.getPointN=function(u){return this.getFactory().createPoint(this._points.getCoordinate(u))},i.prototype.interfaces_=function(){return[bs]},i.prototype.getClass=function(){return i},s.serialVersionUID.get=function(){return 0x2b2b51ba435c8e00},Object.defineProperties(i,s),i}(Q),se=function(){};se.prototype.interfaces_=function(){return[]},se.prototype.getClass=function(){return se};var Qt=function(n){function i(u,c){n.call(this,c),this._coordinates=u||null,this.init(this._coordinates)}n&&(i.__proto__=n),(i.prototype=Object.create(n&&n.prototype)).constructor=i;var s={serialVersionUID:{configurable:!0}};return i.prototype.computeEnvelopeInternal=function(){if(this.isEmpty())return new Pt;var u=new Pt;return u.expandToInclude(this._coordinates.getX(0),this._coordinates.getY(0)),u},i.prototype.getSortIndex=function(){return n.SORTINDEX_POINT},i.prototype.getCoordinates=function(){return this.isEmpty()?[]:[this.getCoordinate()]},i.prototype.equalsExact=function(){if(arguments.length===2){var u=arguments[0],c=arguments[1];return!!this.isEquivalentClass(u)&&(!(!this.isEmpty()||!u.isEmpty())||this.isEmpty()===u.isEmpty()&&this.equal(u.getCoordinate(),this.getCoordinate(),c))}return n.prototype.equalsExact.apply(this,arguments)},i.prototype.normalize=function(){},i.prototype.getCoordinate=function(){return this._coordinates.size()!==0?this._coordinates.getCoordinate(0):null},i.prototype.getBoundaryDimension=function(){return pe.FALSE},i.prototype.getDimension=function(){return 0},i.prototype.getNumPoints=function(){return this.isEmpty()?0:1},i.prototype.reverse=function(){return this.copy()},i.prototype.getX=function(){if(this.getCoordinate()===null)throw new Error("getX called on empty Point");return this.getCoordinate().x},i.prototype.compareToSameClass=function(){if(arguments.length===1){var u=arguments[0];return this.getCoordinate().compareTo(u.getCoordinate())}if(arguments.length===2){var c=arguments[0];return arguments[1].compare(this._coordinates,c._coordinates)}},i.prototype.apply=function(){if(X(arguments[0],Mt)){var u=arguments[0];if(this.isEmpty())return null;u.filter(this.getCoordinate())}else if(X(arguments[0],Vr)){var c=arguments[0];if(this.isEmpty())return null;c.filter(this._coordinates,0),c.isGeometryChanged()&&this.geometryChanged()}else X(arguments[0],ei)?arguments[0].filter(this):X(arguments[0],ct)&&arguments[0].filter(this)},i.prototype.getBoundary=function(){return this.getFactory().createGeometryCollection(null)},i.prototype.clone=function(){var u=n.prototype.clone.call(this);return u._coordinates=this._coordinates.clone(),u},i.prototype.getGeometryType=function(){return"Point"},i.prototype.copy=function(){return new i(this._coordinates.copy(),this._factory)},i.prototype.getCoordinateSequence=function(){return this._coordinates},i.prototype.getY=function(){if(this.getCoordinate()===null)throw new Error("getY called on empty Point");return this.getCoordinate().y},i.prototype.isEmpty=function(){return this._coordinates.size()===0},i.prototype.init=function(u){u===null&&(u=this.getFactory().getCoordinateSequenceFactory().create([])),b.isTrue(u.size()<=1),this._coordinates=u},i.prototype.isSimple=function(){return!0},i.prototype.interfaces_=function(){return[se]},i.prototype.getClass=function(){return i},s.serialVersionUID.get=function(){return 4902022702746615e3},Object.defineProperties(i,s),i}(Q),ce=function(){};ce.prototype.interfaces_=function(){return[]},ce.prototype.getClass=function(){return ce};var Vt=function(n){function i(u,c,m){if(n.call(this,m),this._shell=null,this._holes=null,u===null&&(u=this.getFactory().createLinearRing()),c===null&&(c=[]),n.hasNullElements(c))throw new C("holes must not contain null elements");if(u.isEmpty()&&n.hasNonEmptyElements(c))throw new C("shell is empty but holes are not");this._shell=u,this._holes=c}n&&(i.__proto__=n),(i.prototype=Object.create(n&&n.prototype)).constructor=i;var s={serialVersionUID:{configurable:!0}};return i.prototype.computeEnvelopeInternal=function(){return this._shell.getEnvelopeInternal()},i.prototype.getSortIndex=function(){return n.SORTINDEX_POLYGON},i.prototype.getCoordinates=function(){if(this.isEmpty())return[];for(var u=new Array(this.getNumPoints()).fill(null),c=-1,m=this._shell.getCoordinates(),E=0;E<m.length;E++)u[++c]=m[E];for(var A=0;A<this._holes.length;A++)for(var U=this._holes[A].getCoordinates(),Z=0;Z<U.length;Z++)u[++c]=U[Z];return u},i.prototype.getArea=function(){var u=0;u+=Math.abs(B.signedArea(this._shell.getCoordinateSequence()));for(var c=0;c<this._holes.length;c++)u-=Math.abs(B.signedArea(this._holes[c].getCoordinateSequence()));return u},i.prototype.isRectangle=function(){if(this.getNumInteriorRing()!==0||this._shell===null||this._shell.getNumPoints()!==5)return!1;for(var u=this._shell.getCoordinateSequence(),c=this.getEnvelopeInternal(),m=0;m<5;m++){var E=u.getX(m);if(E!==c.getMinX()&&E!==c.getMaxX())return!1;var A=u.getY(m);if(A!==c.getMinY()&&A!==c.getMaxY())return!1}for(var U=u.getX(0),Z=u.getY(0),ut=1;ut<=4;ut++){var ht=u.getX(ut),At=u.getY(ut);if(ht!==U==(At!==Z))return!1;U=ht,Z=At}return!0},i.prototype.equalsExact=function(){if(arguments.length===2){var u=arguments[0],c=arguments[1];if(!this.isEquivalentClass(u))return!1;var m=u,E=this._shell,A=m._shell;if(!E.equalsExact(A,c)||this._holes.length!==m._holes.length)return!1;for(var U=0;U<this._holes.length;U++)if(!this._holes[U].equalsExact(m._holes[U],c))return!1;return!0}return n.prototype.equalsExact.apply(this,arguments)},i.prototype.normalize=function(){if(arguments.length===0){this.normalize(this._shell,!0);for(var u=0;u<this._holes.length;u++)this.normalize(this._holes[u],!1);Fi.sort(this._holes)}else if(arguments.length===2){var c=arguments[0],m=arguments[1];if(c.isEmpty())return null;var E=new Array(c.getCoordinates().length-1).fill(null);Nt.arraycopy(c.getCoordinates(),0,E,0,E.length);var A=ft.minCoordinate(c.getCoordinates());ft.scroll(E,A),Nt.arraycopy(E,0,c.getCoordinates(),0,E.length),c.getCoordinates()[E.length]=E[0],B.isCCW(c.getCoordinates())===m&&ft.reverse(c.getCoordinates())}},i.prototype.getCoordinate=function(){return this._shell.getCoordinate()},i.prototype.getNumInteriorRing=function(){return this._holes.length},i.prototype.getBoundaryDimension=function(){return 1},i.prototype.getDimension=function(){return 2},i.prototype.getLength=function(){var u=0;u+=this._shell.getLength();for(var c=0;c<this._holes.length;c++)u+=this._holes[c].getLength();return u},i.prototype.getNumPoints=function(){for(var u=this._shell.getNumPoints(),c=0;c<this._holes.length;c++)u+=this._holes[c].getNumPoints();return u},i.prototype.reverse=function(){var u=this.copy();u._shell=this._shell.copy().reverse(),u._holes=new Array(this._holes.length).fill(null);for(var c=0;c<this._holes.length;c++)u._holes[c]=this._holes[c].copy().reverse();return u},i.prototype.convexHull=function(){return this.getExteriorRing().convexHull()},i.prototype.compareToSameClass=function(){if(arguments.length===1){var u=arguments[0],c=this._shell,m=u._shell;return c.compareToSameClass(m)}if(arguments.length===2){var E=arguments[0],A=arguments[1],U=E,Z=this._shell,ut=U._shell,ht=Z.compareToSameClass(ut,A);if(ht!==0)return ht;for(var At=this.getNumInteriorRing(),Rt=U.getNumInteriorRing(),kt=0;kt<At&&kt<Rt;){var ee=this.getInteriorRingN(kt),on=U.getInteriorRingN(kt),In=ee.compareToSameClass(on,A);if(In!==0)return In;kt++}return kt<At?1:kt<Rt?-1:0}},i.prototype.apply=function(u){if(X(u,Mt)){this._shell.apply(u);for(var c=0;c<this._holes.length;c++)this._holes[c].apply(u)}else if(X(u,Vr)){if(this._shell.apply(u),!u.isDone())for(var m=0;m<this._holes.length&&(this._holes[m].apply(u),!u.isDone());m++);u.isGeometryChanged()&&this.geometryChanged()}else if(X(u,ei))u.filter(this);else if(X(u,ct)){u.filter(this),this._shell.apply(u);for(var E=0;E<this._holes.length;E++)this._holes[E].apply(u)}},i.prototype.getBoundary=function(){if(this.isEmpty())return this.getFactory().createMultiLineString();var u=new Array(this._holes.length+1).fill(null);u[0]=this._shell;for(var c=0;c<this._holes.length;c++)u[c+1]=this._holes[c];return u.length<=1?this.getFactory().createLinearRing(u[0].getCoordinateSequence()):this.getFactory().createMultiLineString(u)},i.prototype.clone=function(){var u=n.prototype.clone.call(this);u._shell=this._shell.clone(),u._holes=new Array(this._holes.length).fill(null);for(var c=0;c<this._holes.length;c++)u._holes[c]=this._holes[c].clone();return u},i.prototype.getGeometryType=function(){return"Polygon"},i.prototype.copy=function(){for(var u=this._shell.copy(),c=new Array(this._holes.length).fill(null),m=0;m<c.length;m++)c[m]=this._holes[m].copy();return new i(u,c,this._factory)},i.prototype.getExteriorRing=function(){return this._shell},i.prototype.isEmpty=function(){return this._shell.isEmpty()},i.prototype.getInteriorRingN=function(u){return this._holes[u]},i.prototype.interfaces_=function(){return[ce]},i.prototype.getClass=function(){return i},s.serialVersionUID.get=function(){return-0x307ffefd8dc97200},Object.defineProperties(i,s),i}(Q),fe=function(n){function i(){n.apply(this,arguments)}n&&(i.__proto__=n),(i.prototype=Object.create(n&&n.prototype)).constructor=i;var s={serialVersionUID:{configurable:!0}};return i.prototype.getSortIndex=function(){return Q.SORTINDEX_MULTIPOINT},i.prototype.isValid=function(){return!0},i.prototype.equalsExact=function(){if(arguments.length===2){var u=arguments[0],c=arguments[1];return!!this.isEquivalentClass(u)&&n.prototype.equalsExact.call(this,u,c)}return n.prototype.equalsExact.apply(this,arguments)},i.prototype.getCoordinate=function(){if(arguments.length===1){var u=arguments[0];return this._geometries[u].getCoordinate()}return n.prototype.getCoordinate.apply(this,arguments)},i.prototype.getBoundaryDimension=function(){return pe.FALSE},i.prototype.getDimension=function(){return 0},i.prototype.getBoundary=function(){return this.getFactory().createGeometryCollection(null)},i.prototype.getGeometryType=function(){return"MultiPoint"},i.prototype.copy=function(){for(var u=new Array(this._geometries.length).fill(null),c=0;c<u.length;c++)u[c]=this._geometries[c].copy();return new i(u,this._factory)},i.prototype.interfaces_=function(){return[se]},i.prototype.getClass=function(){return i},s.serialVersionUID.get=function(){return-8048474874175356e3},Object.defineProperties(i,s),i}(Vn),sn=function(n){function i(u,c){u instanceof L&&c instanceof le&&(u=c.getCoordinateSequenceFactory().create(u)),n.call(this,u,c),this.validateConstruction()}n&&(i.__proto__=n),(i.prototype=Object.create(n&&n.prototype)).constructor=i;var s={MINIMUM_VALID_SIZE:{configurable:!0},serialVersionUID:{configurable:!0}};return i.prototype.getSortIndex=function(){return Q.SORTINDEX_LINEARRING},i.prototype.getBoundaryDimension=function(){return pe.FALSE},i.prototype.isClosed=function(){return!!this.isEmpty()||n.prototype.isClosed.call(this)},i.prototype.reverse=function(){var u=this._points.copy();return It.reverse(u),this.getFactory().createLinearRing(u)},i.prototype.validateConstruction=function(){if(!this.isEmpty()&&!n.prototype.isClosed.call(this))throw new C("Points of LinearRing do not form a closed linestring");if(this.getCoordinateSequence().size()>=1&&this.getCoordinateSequence().size()<i.MINIMUM_VALID_SIZE)throw new C("Invalid number of points in LinearRing (found "+this.getCoordinateSequence().size()+" - must be 0 or >= 4)")},i.prototype.getGeometryType=function(){return"LinearRing"},i.prototype.copy=function(){return new i(this._points.copy(),this._factory)},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},s.MINIMUM_VALID_SIZE.get=function(){return 4},s.serialVersionUID.get=function(){return-0x3b229e262367a600},Object.defineProperties(i,s),i}(Bt),un=function(n){function i(){n.apply(this,arguments)}n&&(i.__proto__=n),(i.prototype=Object.create(n&&n.prototype)).constructor=i;var s={serialVersionUID:{configurable:!0}};return i.prototype.getSortIndex=function(){return Q.SORTINDEX_MULTIPOLYGON},i.prototype.equalsExact=function(){if(arguments.length===2){var u=arguments[0],c=arguments[1];return!!this.isEquivalentClass(u)&&n.prototype.equalsExact.call(this,u,c)}return n.prototype.equalsExact.apply(this,arguments)},i.prototype.getBoundaryDimension=function(){return 1},i.prototype.getDimension=function(){return 2},i.prototype.reverse=function(){for(var u=this._geometries.length,c=new Array(u).fill(null),m=0;m<this._geometries.length;m++)c[m]=this._geometries[m].reverse();return this.getFactory().createMultiPolygon(c)},i.prototype.getBoundary=function(){if(this.isEmpty())return this.getFactory().createMultiLineString();for(var u=new j,c=0;c<this._geometries.length;c++)for(var m=this._geometries[c].getBoundary(),E=0;E<m.getNumGeometries();E++)u.add(m.getGeometryN(E));var A=new Array(u.size()).fill(null);return this.getFactory().createMultiLineString(u.toArray(A))},i.prototype.getGeometryType=function(){return"MultiPolygon"},i.prototype.copy=function(){for(var u=new Array(this._geometries.length).fill(null),c=0;c<u.length;c++)u[c]=this._geometries[c].copy();return new i(u,this._factory)},i.prototype.interfaces_=function(){return[ce]},i.prototype.getClass=function(){return i},s.serialVersionUID.get=function(){return-0x7a5aa1369171980},Object.defineProperties(i,s),i}(Vn),vn=function(n){this._factory=n||null,this._isUserDataCopied=!1},ni={NoOpGeometryOperation:{configurable:!0},CoordinateOperation:{configurable:!0},CoordinateSequenceOperation:{configurable:!0}};vn.prototype.setCopyUserData=function(n){this._isUserDataCopied=n},vn.prototype.edit=function(n,i){if(n===null)return null;var s=this.editInternal(n,i);return this._isUserDataCopied&&s.setUserData(n.getUserData()),s},vn.prototype.editInternal=function(n,i){return this._factory===null&&(this._factory=n.getFactory()),n instanceof Vn?this.editGeometryCollection(n,i):n instanceof Vt?this.editPolygon(n,i):n instanceof Qt?i.edit(n,this._factory):n instanceof Bt?i.edit(n,this._factory):(b.shouldNeverReachHere("Unsupported Geometry class: "+n.getClass().getName()),null)},vn.prototype.editGeometryCollection=function(n,i){for(var s=i.edit(n,this._factory),u=new j,c=0;c<s.getNumGeometries();c++){var m=this.edit(s.getGeometryN(c),i);m===null||m.isEmpty()||u.add(m)}return s.getClass()===fe?this._factory.createMultiPoint(u.toArray([])):s.getClass()===H?this._factory.createMultiLineString(u.toArray([])):s.getClass()===un?this._factory.createMultiPolygon(u.toArray([])):this._factory.createGeometryCollection(u.toArray([]))},vn.prototype.editPolygon=function(n,i){var s=i.edit(n,this._factory);if(s===null&&(s=this._factory.createPolygon(null)),s.isEmpty())return s;var u=this.edit(s.getExteriorRing(),i);if(u===null||u.isEmpty())return this._factory.createPolygon();for(var c=new j,m=0;m<s.getNumInteriorRing();m++){var E=this.edit(s.getInteriorRingN(m),i);E===null||E.isEmpty()||c.add(E)}return this._factory.createPolygon(u,c.toArray([]))},vn.prototype.interfaces_=function(){return[]},vn.prototype.getClass=function(){return vn},vn.GeometryEditorOperation=function(){},ni.NoOpGeometryOperation.get=function(){return En},ni.CoordinateOperation.get=function(){return de},ni.CoordinateSequenceOperation.get=function(){return xo},Object.defineProperties(vn,ni);var En=function(){};En.prototype.edit=function(n,i){return n},En.prototype.interfaces_=function(){return[vn.GeometryEditorOperation]},En.prototype.getClass=function(){return En};var de=function(){};de.prototype.edit=function(n,i){var s=this.editCoordinates(n.getCoordinates(),n);return s===null?n:n instanceof sn?i.createLinearRing(s):n instanceof Bt?i.createLineString(s):n instanceof Qt?s.length>0?i.createPoint(s[0]):i.createPoint():n},de.prototype.interfaces_=function(){return[vn.GeometryEditorOperation]},de.prototype.getClass=function(){return de};var xo=function(){};xo.prototype.edit=function(n,i){return n instanceof sn?i.createLinearRing(this.edit(n.getCoordinateSequence(),n)):n instanceof Bt?i.createLineString(this.edit(n.getCoordinateSequence(),n)):n instanceof Qt?i.createPoint(this.edit(n.getCoordinateSequence(),n)):n},xo.prototype.interfaces_=function(){return[vn.GeometryEditorOperation]},xo.prototype.getClass=function(){return xo};var he=function(){if(this._dimension=3,this._coordinates=null,arguments.length===1){if(arguments[0]instanceof Array)this._coordinates=arguments[0],this._dimension=3;else if(Number.isInteger(arguments[0])){var n=arguments[0];this._coordinates=new Array(n).fill(null);for(var i=0;i<n;i++)this._coordinates[i]=new L}else if(X(arguments[0],dt)){var s=arguments[0];if(s===null)return this._coordinates=new Array(0).fill(null),null;this._dimension=s.getDimension(),this._coordinates=new Array(s.size()).fill(null);for(var u=0;u<this._coordinates.length;u++)this._coordinates[u]=s.getCoordinateCopy(u)}}else if(arguments.length===2){if(arguments[0]instanceof Array&&Number.isInteger(arguments[1])){var c=arguments[0],m=arguments[1];this._coordinates=c,this._dimension=m,c===null&&(this._coordinates=new Array(0).fill(null))}else if(Number.isInteger(arguments[0])&&Number.isInteger(arguments[1])){var E=arguments[0],A=arguments[1];this._coordinates=new Array(E).fill(null),this._dimension=A;for(var U=0;U<E;U++)this._coordinates[U]=new L}}},no={serialVersionUID:{configurable:!0}};he.prototype.setOrdinate=function(n,i,s){switch(i){case dt.X:this._coordinates[n].x=s;break;case dt.Y:this._coordinates[n].y=s;break;case dt.Z:this._coordinates[n].z=s;break;default:throw new C("invalid ordinateIndex")}},he.prototype.size=function(){return this._coordinates.length},he.prototype.getOrdinate=function(n,i){switch(i){case dt.X:return this._coordinates[n].x;case dt.Y:return this._coordinates[n].y;case dt.Z:return this._coordinates[n].z}return S.NaN},he.prototype.getCoordinate=function(){if(arguments.length===1){var n=arguments[0];return this._coordinates[n]}if(arguments.length===2){var i=arguments[0],s=arguments[1];s.x=this._coordinates[i].x,s.y=this._coordinates[i].y,s.z=this._coordinates[i].z}},he.prototype.getCoordinateCopy=function(n){return new L(this._coordinates[n])},he.prototype.getDimension=function(){return this._dimension},he.prototype.getX=function(n){return this._coordinates[n].x},he.prototype.clone=function(){for(var n=new Array(this.size()).fill(null),i=0;i<this._coordinates.length;i++)n[i]=this._coordinates[i].clone();return new he(n,this._dimension)},he.prototype.expandEnvelope=function(n){for(var i=0;i<this._coordinates.length;i++)n.expandToInclude(this._coordinates[i]);return n},he.prototype.copy=function(){for(var n=new Array(this.size()).fill(null),i=0;i<this._coordinates.length;i++)n[i]=this._coordinates[i].copy();return new he(n,this._dimension)},he.prototype.toString=function(){if(this._coordinates.length>0){var n=new pt(17*this._coordinates.length);n.append("("),n.append(this._coordinates[0]);for(var i=1;i<this._coordinates.length;i++)n.append(", "),n.append(this._coordinates[i]);return n.append(")"),n.toString()}return"()"},he.prototype.getY=function(n){return this._coordinates[n].y},he.prototype.toCoordinateArray=function(){return this._coordinates},he.prototype.interfaces_=function(){return[dt,t]},he.prototype.getClass=function(){return he},no.serialVersionUID.get=function(){return-0xcb44a778db18e00},Object.defineProperties(he,no);var ri=function(){},Eo={serialVersionUID:{configurable:!0},instanceObject:{configurable:!0}};ri.prototype.readResolve=function(){return ri.instance()},ri.prototype.create=function(){if(arguments.length===1){if(arguments[0]instanceof Array){var n=arguments[0];return new he(n)}if(X(arguments[0],dt)){var i=arguments[0];return new he(i)}}else if(arguments.length===2){var s=arguments[0],u=arguments[1];return u>3&&(u=3),u<2?new he(s):new he(s,u)}},ri.prototype.interfaces_=function(){return[nt,t]},ri.prototype.getClass=function(){return ri},ri.instance=function(){return ri.instanceObject},Eo.serialVersionUID.get=function(){return-0x38e49fa6cf6f2e00},Eo.instanceObject.get=function(){return new ri},Object.defineProperties(ri,Eo);var oa=function(n){function i(){n.call(this),this.map_=new Map}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.get=function(s){return this.map_.get(s)||null},i.prototype.put=function(s,u){return this.map_.set(s,u),u},i.prototype.values=function(){for(var s=new j,u=this.map_.values(),c=u.next();!c.done;)s.add(c.value),c=u.next();return s},i.prototype.entrySet=function(){var s=new $n;return this.map_.entries().forEach(function(u){return s.add(u)}),s},i.prototype.size=function(){return this.map_.size()},i}(He),ie=function n(){if(this._modelType=null,this._scale=null,arguments.length===0)this._modelType=n.FLOATING;else if(arguments.length===1){if(arguments[0]instanceof Lr){var i=arguments[0];this._modelType=i,i===n.FIXED&&this.setScale(1)}else if(typeof arguments[0]=="number"){var s=arguments[0];this._modelType=n.FIXED,this.setScale(s)}else if(arguments[0]instanceof n){var u=arguments[0];this._modelType=u._modelType,this._scale=u._scale}}},Ui={serialVersionUID:{configurable:!0},maximumPreciseValue:{configurable:!0}};ie.prototype.equals=function(n){if(!(n instanceof ie))return!1;var i=n;return this._modelType===i._modelType&&this._scale===i._scale},ie.prototype.compareTo=function(n){var i=n,s=this.getMaximumSignificantDigits(),u=i.getMaximumSignificantDigits();return new et(s).compareTo(new et(u))},ie.prototype.getScale=function(){return this._scale},ie.prototype.isFloating=function(){return this._modelType===ie.FLOATING||this._modelType===ie.FLOATING_SINGLE},ie.prototype.getType=function(){return this._modelType},ie.prototype.toString=function(){var n="UNKNOWN";return this._modelType===ie.FLOATING?n="Floating":this._modelType===ie.FLOATING_SINGLE?n="Floating-Single":this._modelType===ie.FIXED&&(n="Fixed (Scale="+this.getScale()+")"),n},ie.prototype.makePrecise=function(){if(typeof arguments[0]=="number"){var n=arguments[0];return S.isNaN(n)||this._modelType===ie.FLOATING_SINGLE?n:this._modelType===ie.FIXED?Math.round(n*this._scale)/this._scale:n}if(arguments[0]instanceof L){var i=arguments[0];if(this._modelType===ie.FLOATING)return null;i.x=this.makePrecise(i.x),i.y=this.makePrecise(i.y)}},ie.prototype.getMaximumSignificantDigits=function(){var n=16;return this._modelType===ie.FLOATING?n=16:this._modelType===ie.FLOATING_SINGLE?n=6:this._modelType===ie.FIXED&&(n=1+Math.trunc(Math.ceil(Math.log(this.getScale())/Math.log(10)))),n},ie.prototype.setScale=function(n){this._scale=Math.abs(n)},ie.prototype.interfaces_=function(){return[t,F]},ie.prototype.getClass=function(){return ie},ie.mostPrecise=function(n,i){return n.compareTo(i)>=0?n:i},Ui.serialVersionUID.get=function(){return 7777263578777804e3},Ui.maximumPreciseValue.get=function(){return 9007199254740992},Object.defineProperties(ie,Ui);var Lr=function n(i){this._name=i||null,n.nameToTypeMap.put(i,this)},xr={serialVersionUID:{configurable:!0},nameToTypeMap:{configurable:!0}};Lr.prototype.readResolve=function(){return Lr.nameToTypeMap.get(this._name)},Lr.prototype.toString=function(){return this._name},Lr.prototype.interfaces_=function(){return[t]},Lr.prototype.getClass=function(){return Lr},xr.serialVersionUID.get=function(){return-552860263173159e4},xr.nameToTypeMap.get=function(){return new oa},Object.defineProperties(Lr,xr),ie.Type=Lr,ie.FIXED=new Lr("FIXED"),ie.FLOATING=new Lr("FLOATING"),ie.FLOATING_SINGLE=new Lr("FLOATING SINGLE");var le=function n(){this._precisionModel=new ie,this._SRID=0,this._coordinateSequenceFactory=n.getDefaultCoordinateSequenceFactory(),arguments.length===0||(arguments.length===1?X(arguments[0],nt)?this._coordinateSequenceFactory=arguments[0]:arguments[0]instanceof ie&&(this._precisionModel=arguments[0]):arguments.length===2?(this._precisionModel=arguments[0],this._SRID=arguments[1]):arguments.length===3&&(this._precisionModel=arguments[0],this._SRID=arguments[1],this._coordinateSequenceFactory=arguments[2]))},gl={serialVersionUID:{configurable:!0}};le.prototype.toGeometry=function(n){return n.isNull()?this.createPoint(null):n.getMinX()===n.getMaxX()&&n.getMinY()===n.getMaxY()?this.createPoint(new L(n.getMinX(),n.getMinY())):n.getMinX()===n.getMaxX()||n.getMinY()===n.getMaxY()?this.createLineString([new L(n.getMinX(),n.getMinY()),new L(n.getMaxX(),n.getMaxY())]):this.createPolygon(this.createLinearRing([new L(n.getMinX(),n.getMinY()),new L(n.getMinX(),n.getMaxY()),new L(n.getMaxX(),n.getMaxY()),new L(n.getMaxX(),n.getMinY()),new L(n.getMinX(),n.getMinY())]),null)},le.prototype.createLineString=function(n){return n?n instanceof Array?new Bt(this.getCoordinateSequenceFactory().create(n),this):X(n,dt)?new Bt(n,this):void 0:new Bt(this.getCoordinateSequenceFactory().create([]),this)},le.prototype.createMultiLineString=function(){if(arguments.length===0)return new H(null,this);if(arguments.length===1){var n=arguments[0];return new H(n,this)}},le.prototype.buildGeometry=function(n){for(var i=null,s=!1,u=!1,c=n.iterator();c.hasNext();){var m=c.next(),E=m.getClass();i===null&&(i=E),E!==i&&(s=!0),m.isGeometryCollectionOrDerived()&&(u=!0)}if(i===null)return this.createGeometryCollection();if(s||u)return this.createGeometryCollection(le.toGeometryArray(n));var A=n.iterator().next();if(n.size()>1){if(A instanceof Vt)return this.createMultiPolygon(le.toPolygonArray(n));if(A instanceof Bt)return this.createMultiLineString(le.toLineStringArray(n));if(A instanceof Qt)return this.createMultiPoint(le.toPointArray(n));b.shouldNeverReachHere("Unhandled class: "+A.getClass().getName())}return A},le.prototype.createMultiPointFromCoords=function(n){return this.createMultiPoint(n!==null?this.getCoordinateSequenceFactory().create(n):null)},le.prototype.createPoint=function(){if(arguments.length===0)return this.createPoint(this.getCoordinateSequenceFactory().create([]));if(arguments.length===1){if(arguments[0]instanceof L){var n=arguments[0];return this.createPoint(n!==null?this.getCoordinateSequenceFactory().create([n]):null)}if(X(arguments[0],dt)){var i=arguments[0];return new Qt(i,this)}}},le.prototype.getCoordinateSequenceFactory=function(){return this._coordinateSequenceFactory},le.prototype.createPolygon=function(){if(arguments.length===0)return new Vt(null,null,this);if(arguments.length===1){if(X(arguments[0],dt)){var n=arguments[0];return this.createPolygon(this.createLinearRing(n))}if(arguments[0]instanceof Array){var i=arguments[0];return this.createPolygon(this.createLinearRing(i))}if(arguments[0]instanceof sn){var s=arguments[0];return this.createPolygon(s,null)}}else if(arguments.length===2){var u=arguments[0],c=arguments[1];return new Vt(u,c,this)}},le.prototype.getSRID=function(){return this._SRID},le.prototype.createGeometryCollection=function(){if(arguments.length===0)return new Vn(null,this);if(arguments.length===1){var n=arguments[0];return new Vn(n,this)}},le.prototype.createGeometry=function(n){return new vn(this).edit(n,{edit:function(){if(arguments.length===2){var i=arguments[0];return this._coordinateSequenceFactory.create(i)}}})},le.prototype.getPrecisionModel=function(){return this._precisionModel},le.prototype.createLinearRing=function(){if(arguments.length===0)return this.createLinearRing(this.getCoordinateSequenceFactory().create([]));if(arguments.length===1){if(arguments[0]instanceof Array){var n=arguments[0];return this.createLinearRing(n!==null?this.getCoordinateSequenceFactory().create(n):null)}if(X(arguments[0],dt)){var i=arguments[0];return new sn(i,this)}}},le.prototype.createMultiPolygon=function(){if(arguments.length===0)return new un(null,this);if(arguments.length===1){var n=arguments[0];return new un(n,this)}},le.prototype.createMultiPoint=function(){if(arguments.length===0)return new fe(null,this);if(arguments.length===1){if(arguments[0]instanceof Array){var n=arguments[0];return new fe(n,this)}if(arguments[0]instanceof Array){var i=arguments[0];return this.createMultiPoint(i!==null?this.getCoordinateSequenceFactory().create(i):null)}if(X(arguments[0],dt)){var s=arguments[0];if(s===null)return this.createMultiPoint(new Array(0).fill(null));for(var u=new Array(s.size()).fill(null),c=0;c<s.size();c++){var m=this.getCoordinateSequenceFactory().create(1,s.getDimension());It.copy(s,c,m,0,1),u[c]=this.createPoint(m)}return this.createMultiPoint(u)}}},le.prototype.interfaces_=function(){return[t]},le.prototype.getClass=function(){return le},le.toMultiPolygonArray=function(n){var i=new Array(n.size()).fill(null);return n.toArray(i)},le.toGeometryArray=function(n){if(n===null)return null;var i=new Array(n.size()).fill(null);return n.toArray(i)},le.getDefaultCoordinateSequenceFactory=function(){return ri.instance()},le.toMultiLineStringArray=function(n){var i=new Array(n.size()).fill(null);return n.toArray(i)},le.toLineStringArray=function(n){var i=new Array(n.size()).fill(null);return n.toArray(i)},le.toMultiPointArray=function(n){var i=new Array(n.size()).fill(null);return n.toArray(i)},le.toLinearRingArray=function(n){var i=new Array(n.size()).fill(null);return n.toArray(i)},le.toPointArray=function(n){var i=new Array(n.size()).fill(null);return n.toArray(i)},le.toPolygonArray=function(n){var i=new Array(n.size()).fill(null);return n.toArray(i)},le.createPointFromInternalCoord=function(n,i){return i.getPrecisionModel().makePrecise(n),i.getFactory().createPoint(n)},gl.serialVersionUID.get=function(){return-6820524753094096e3},Object.defineProperties(le,gl);var yl=["Point","MultiPoint","LineString","MultiLineString","Polygon","MultiPolygon"],vl=function(n){this.geometryFactory=n||new le};vl.prototype.read=function(n){var i,s=(i=typeof n=="string"?JSON.parse(n):n).type;if(!Si[s])throw new Error("Unknown GeoJSON type: "+i.type);return yl.indexOf(s)!==-1?Si[s].apply(this,[i.coordinates]):s==="GeometryCollection"?Si[s].apply(this,[i.geometries]):Si[s].apply(this,[i])},vl.prototype.write=function(n){var i=n.getGeometryType();if(!ro[i])throw new Error("Geometry is not supported");return ro[i].apply(this,[n])};var Si={Feature:function(n){var i={};for(var s in n)i[s]=n[s];if(n.geometry){var u=n.geometry.type;if(!Si[u])throw new Error("Unknown GeoJSON type: "+n.type);i.geometry=this.read(n.geometry)}return n.bbox&&(i.bbox=Si.bbox.apply(this,[n.bbox])),i},FeatureCollection:function(n){var i={};if(n.features){i.features=[];for(var s=0;s<n.features.length;++s)i.features.push(this.read(n.features[s]))}return n.bbox&&(i.bbox=this.parse.bbox.apply(this,[n.bbox])),i},coordinates:function(n){for(var i=[],s=0;s<n.length;++s){var u=n[s];i.push(new L(u[0],u[1]))}return i},bbox:function(n){return this.geometryFactory.createLinearRing([new L(n[0],n[1]),new L(n[2],n[1]),new L(n[2],n[3]),new L(n[0],n[3]),new L(n[0],n[1])])},Point:function(n){var i=new L(n[0],n[1]);return this.geometryFactory.createPoint(i)},MultiPoint:function(n){for(var i=[],s=0;s<n.length;++s)i.push(Si.Point.apply(this,[n[s]]));return this.geometryFactory.createMultiPoint(i)},LineString:function(n){var i=Si.coordinates.apply(this,[n]);return this.geometryFactory.createLineString(i)},MultiLineString:function(n){for(var i=[],s=0;s<n.length;++s)i.push(Si.LineString.apply(this,[n[s]]));return this.geometryFactory.createMultiLineString(i)},Polygon:function(n){for(var i=Si.coordinates.apply(this,[n[0]]),s=this.geometryFactory.createLinearRing(i),u=[],c=1;c<n.length;++c){var m=n[c],E=Si.coordinates.apply(this,[m]),A=this.geometryFactory.createLinearRing(E);u.push(A)}return this.geometryFactory.createPolygon(s,u)},MultiPolygon:function(n){for(var i=[],s=0;s<n.length;++s){var u=n[s];i.push(Si.Polygon.apply(this,[u]))}return this.geometryFactory.createMultiPolygon(i)},GeometryCollection:function(n){for(var i=[],s=0;s<n.length;++s){var u=n[s];i.push(this.read(u))}return this.geometryFactory.createGeometryCollection(i)}},ro={coordinate:function(n){return[n.x,n.y]},Point:function(n){return{type:"Point",coordinates:ro.coordinate.apply(this,[n.getCoordinate()])}},MultiPoint:function(n){for(var i=[],s=0;s<n._geometries.length;++s){var u=n._geometries[s],c=ro.Point.apply(this,[u]);i.push(c.coordinates)}return{type:"MultiPoint",coordinates:i}},LineString:function(n){for(var i=[],s=n.getCoordinates(),u=0;u<s.length;++u){var c=s[u];i.push(ro.coordinate.apply(this,[c]))}return{type:"LineString",coordinates:i}},MultiLineString:function(n){for(var i=[],s=0;s<n._geometries.length;++s){var u=n._geometries[s],c=ro.LineString.apply(this,[u]);i.push(c.coordinates)}return{type:"MultiLineString",coordinates:i}},Polygon:function(n){var i=[],s=ro.LineString.apply(this,[n._shell]);i.push(s.coordinates);for(var u=0;u<n._holes.length;++u){var c=n._holes[u],m=ro.LineString.apply(this,[c]);i.push(m.coordinates)}return{type:"Polygon",coordinates:i}},MultiPolygon:function(n){for(var i=[],s=0;s<n._geometries.length;++s){var u=n._geometries[s],c=ro.Polygon.apply(this,[u]);i.push(c.coordinates)}return{type:"MultiPolygon",coordinates:i}},GeometryCollection:function(n){for(var i=[],s=0;s<n._geometries.length;++s){var u=n._geometries[s],c=u.getGeometryType();i.push(ro[c].apply(this,[u]))}return{type:"GeometryCollection",geometries:i}}},gf=function(n){this.geometryFactory=n||new le,this.precisionModel=this.geometryFactory.getPrecisionModel(),this.parser=new vl(this.geometryFactory)};gf.prototype.read=function(n){var i=this.parser.read(n);return this.precisionModel.getType()===ie.FIXED&&this.reducePrecision(i),i},gf.prototype.reducePrecision=function(n){var i,s;if(n.coordinate)this.precisionModel.makePrecise(n.coordinate);else if(n.points)for(i=0,s=n.points.length;i<s;i++)this.precisionModel.makePrecise(n.points[i]);else if(n.geometries)for(i=0,s=n.geometries.length;i<s;i++)this.reducePrecision(n.geometries[i])};var Gd=function(){this.parser=new vl(this.geometryFactory)};Gd.prototype.write=function(n){return this.parser.write(n)};var bt=function(){},_l={ON:{configurable:!0},LEFT:{configurable:!0},RIGHT:{configurable:!0}};bt.prototype.interfaces_=function(){return[]},bt.prototype.getClass=function(){return bt},bt.opposite=function(n){return n===bt.LEFT?bt.RIGHT:n===bt.RIGHT?bt.LEFT:n},_l.ON.get=function(){return 0},_l.LEFT.get=function(){return 1},_l.RIGHT.get=function(){return 2},Object.defineProperties(bt,_l),(T.prototype=new Error).name="EmptyStackException",(x.prototype=new wt).add=function(n){return this.array_.push(n),!0},x.prototype.get=function(n){if(n<0||n>=this.size())throw new Error;return this.array_[n]},x.prototype.push=function(n){return this.array_.push(n),n},x.prototype.pop=function(n){if(this.array_.length===0)throw new T;return this.array_.pop()},x.prototype.peek=function(){if(this.array_.length===0)throw new T;return this.array_[this.array_.length-1]},x.prototype.empty=function(){return this.array_.length===0},x.prototype.isEmpty=function(){return this.empty()},x.prototype.search=function(n){return this.array_.indexOf(n)},x.prototype.size=function(){return this.array_.length},x.prototype.toArray=function(){for(var n=[],i=0,s=this.array_.length;i<s;i++)n.push(this.array_[i]);return n};var wi=function(){this._minIndex=-1,this._minCoord=null,this._minDe=null,this._orientedDe=null};wi.prototype.getCoordinate=function(){return this._minCoord},wi.prototype.getRightmostSide=function(n,i){var s=this.getRightmostSideOfSegment(n,i);return s<0&&(s=this.getRightmostSideOfSegment(n,i-1)),s<0&&(this._minCoord=null,this.checkForRightmostCoordinate(n)),s},wi.prototype.findRightmostEdgeAtVertex=function(){var n=this._minDe.getEdge().getCoordinates();b.isTrue(this._minIndex>0&&this._minIndex<n.length,"rightmost point expected to be interior vertex of edge");var i=n[this._minIndex-1],s=n[this._minIndex+1],u=B.computeOrientation(this._minCoord,s,i),c=!1;(i.y<this._minCoord.y&&s.y<this._minCoord.y&&u===B.COUNTERCLOCKWISE||i.y>this._minCoord.y&&s.y>this._minCoord.y&&u===B.CLOCKWISE)&&(c=!0),c&&(this._minIndex=this._minIndex-1)},wi.prototype.getRightmostSideOfSegment=function(n,i){var s=n.getEdge().getCoordinates();if(i<0||i+1>=s.length||s[i].y===s[i+1].y)return-1;var u=bt.LEFT;return s[i].y<s[i+1].y&&(u=bt.RIGHT),u},wi.prototype.getEdge=function(){return this._orientedDe},wi.prototype.checkForRightmostCoordinate=function(n){for(var i=n.getEdge().getCoordinates(),s=0;s<i.length-1;s++)(this._minCoord===null||i[s].x>this._minCoord.x)&&(this._minDe=n,this._minIndex=s,this._minCoord=i[s])},wi.prototype.findRightmostEdgeAtNode=function(){var n=this._minDe.getNode().getEdges();this._minDe=n.getRightmostEdge(),this._minDe.isForward()||(this._minDe=this._minDe.getSym(),this._minIndex=this._minDe.getEdge().getCoordinates().length-1)},wi.prototype.findEdge=function(n){for(var i=n.iterator();i.hasNext();){var s=i.next();s.isForward()&&this.checkForRightmostCoordinate(s)}b.isTrue(this._minIndex!==0||this._minCoord.equals(this._minDe.getCoordinate()),"inconsistency in rightmost processing"),this._minIndex===0?this.findRightmostEdgeAtNode():this.findRightmostEdgeAtVertex(),this._orientedDe=this._minDe,this.getRightmostSide(this._minDe,this._minIndex)===bt.LEFT&&(this._orientedDe=this._minDe.getSym())},wi.prototype.interfaces_=function(){return[]},wi.prototype.getClass=function(){return wi};var io=function(n){function i(s,u){n.call(this,i.msgWithCoord(s,u)),this.pt=u?new L(u):null,this.name="TopologyException"}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.getCoordinate=function(){return this.pt},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i.msgWithCoord=function(s,u){return u?s:s+" [ "+u+" ]"},i}($),xl=function(){this.array_=[]};xl.prototype.addLast=function(n){this.array_.push(n)},xl.prototype.removeFirst=function(){return this.array_.shift()},xl.prototype.isEmpty=function(){return this.array_.length===0};var sr=function(){this._finder=null,this._dirEdgeList=new j,this._nodes=new j,this._rightMostCoord=null,this._env=null,this._finder=new wi};sr.prototype.clearVisitedEdges=function(){for(var n=this._dirEdgeList.iterator();n.hasNext();)n.next().setVisited(!1)},sr.prototype.getRightmostCoordinate=function(){return this._rightMostCoord},sr.prototype.computeNodeDepth=function(n){for(var i=null,s=n.getEdges().iterator();s.hasNext();){var u=s.next();if(u.isVisited()||u.getSym().isVisited()){i=u;break}}if(i===null)throw new io("unable to find edge to compute depths at "+n.getCoordinate());n.getEdges().computeDepths(i);for(var c=n.getEdges().iterator();c.hasNext();){var m=c.next();m.setVisited(!0),this.copySymDepths(m)}},sr.prototype.computeDepth=function(n){this.clearVisitedEdges();var i=this._finder.getEdge();i.setEdgeDepths(bt.RIGHT,n),this.copySymDepths(i),this.computeDepths(i)},sr.prototype.create=function(n){this.addReachable(n),this._finder.findEdge(this._dirEdgeList),this._rightMostCoord=this._finder.getCoordinate()},sr.prototype.findResultEdges=function(){for(var n=this._dirEdgeList.iterator();n.hasNext();){var i=n.next();i.getDepth(bt.RIGHT)>=1&&i.getDepth(bt.LEFT)<=0&&!i.isInteriorAreaEdge()&&i.setInResult(!0)}},sr.prototype.computeDepths=function(n){var i=new $n,s=new xl,u=n.getNode();for(s.addLast(u),i.add(u),n.setVisited(!0);!s.isEmpty();){var c=s.removeFirst();i.add(c),this.computeNodeDepth(c);for(var m=c.getEdges().iterator();m.hasNext();){var E=m.next().getSym();if(!E.isVisited()){var A=E.getNode();i.contains(A)||(s.addLast(A),i.add(A))}}}},sr.prototype.compareTo=function(n){var i=n;return this._rightMostCoord.x<i._rightMostCoord.x?-1:this._rightMostCoord.x>i._rightMostCoord.x?1:0},sr.prototype.getEnvelope=function(){if(this._env===null){for(var n=new Pt,i=this._dirEdgeList.iterator();i.hasNext();)for(var s=i.next().getEdge().getCoordinates(),u=0;u<s.length-1;u++)n.expandToInclude(s[u]);this._env=n}return this._env},sr.prototype.addReachable=function(n){var i=new x;for(i.add(n);!i.empty();){var s=i.pop();this.add(s,i)}},sr.prototype.copySymDepths=function(n){var i=n.getSym();i.setDepth(bt.LEFT,n.getDepth(bt.RIGHT)),i.setDepth(bt.RIGHT,n.getDepth(bt.LEFT))},sr.prototype.add=function(n,i){n.setVisited(!0),this._nodes.add(n);for(var s=n.getEdges().iterator();s.hasNext();){var u=s.next();this._dirEdgeList.add(u);var c=u.getSym().getNode();c.isVisited()||i.push(c)}},sr.prototype.getNodes=function(){return this._nodes},sr.prototype.getDirectedEdges=function(){return this._dirEdgeList},sr.prototype.interfaces_=function(){return[F]},sr.prototype.getClass=function(){return sr};var hn=function n(){if(this.location=null,arguments.length===1){if(arguments[0]instanceof Array){var i=arguments[0];this.init(i.length)}else if(Number.isInteger(arguments[0])){var s=arguments[0];this.init(1),this.location[bt.ON]=s}else if(arguments[0]instanceof n){var u=arguments[0];if(this.init(u.location.length),u!==null)for(var c=0;c<this.location.length;c++)this.location[c]=u.location[c]}}else if(arguments.length===3){var m=arguments[0],E=arguments[1],A=arguments[2];this.init(3),this.location[bt.ON]=m,this.location[bt.LEFT]=E,this.location[bt.RIGHT]=A}};hn.prototype.setAllLocations=function(n){for(var i=0;i<this.location.length;i++)this.location[i]=n},hn.prototype.isNull=function(){for(var n=0;n<this.location.length;n++)if(this.location[n]!==k.NONE)return!1;return!0},hn.prototype.setAllLocationsIfNull=function(n){for(var i=0;i<this.location.length;i++)this.location[i]===k.NONE&&(this.location[i]=n)},hn.prototype.isLine=function(){return this.location.length===1},hn.prototype.merge=function(n){if(n.location.length>this.location.length){var i=new Array(3).fill(null);i[bt.ON]=this.location[bt.ON],i[bt.LEFT]=k.NONE,i[bt.RIGHT]=k.NONE,this.location=i}for(var s=0;s<this.location.length;s++)this.location[s]===k.NONE&&s<n.location.length&&(this.location[s]=n.location[s])},hn.prototype.getLocations=function(){return this.location},hn.prototype.flip=function(){if(this.location.length<=1)return null;var n=this.location[bt.LEFT];this.location[bt.LEFT]=this.location[bt.RIGHT],this.location[bt.RIGHT]=n},hn.prototype.toString=function(){var n=new pt;return this.location.length>1&&n.append(k.toLocationSymbol(this.location[bt.LEFT])),n.append(k.toLocationSymbol(this.location[bt.ON])),this.location.length>1&&n.append(k.toLocationSymbol(this.location[bt.RIGHT])),n.toString()},hn.prototype.setLocations=function(n,i,s){this.location[bt.ON]=n,this.location[bt.LEFT]=i,this.location[bt.RIGHT]=s},hn.prototype.get=function(n){return n<this.location.length?this.location[n]:k.NONE},hn.prototype.isArea=function(){return this.location.length>1},hn.prototype.isAnyNull=function(){for(var n=0;n<this.location.length;n++)if(this.location[n]===k.NONE)return!0;return!1},hn.prototype.setLocation=function(){if(arguments.length===1){var n=arguments[0];this.setLocation(bt.ON,n)}else if(arguments.length===2){var i=arguments[0],s=arguments[1];this.location[i]=s}},hn.prototype.init=function(n){this.location=new Array(n).fill(null),this.setAllLocations(k.NONE)},hn.prototype.isEqualOnSide=function(n,i){return this.location[i]===n.location[i]},hn.prototype.allPositionsEqual=function(n){for(var i=0;i<this.location.length;i++)if(this.location[i]!==n)return!1;return!0},hn.prototype.interfaces_=function(){return[]},hn.prototype.getClass=function(){return hn};var rn=function n(){if(this.elt=new Array(2).fill(null),arguments.length===1){if(Number.isInteger(arguments[0])){var i=arguments[0];this.elt[0]=new hn(i),this.elt[1]=new hn(i)}else if(arguments[0]instanceof n){var s=arguments[0];this.elt[0]=new hn(s.elt[0]),this.elt[1]=new hn(s.elt[1])}}else if(arguments.length===2){var u=arguments[0],c=arguments[1];this.elt[0]=new hn(k.NONE),this.elt[1]=new hn(k.NONE),this.elt[u].setLocation(c)}else if(arguments.length===3){var m=arguments[0],E=arguments[1],A=arguments[2];this.elt[0]=new hn(m,E,A),this.elt[1]=new hn(m,E,A)}else if(arguments.length===4){var U=arguments[0],Z=arguments[1],ut=arguments[2],ht=arguments[3];this.elt[0]=new hn(k.NONE,k.NONE,k.NONE),this.elt[1]=new hn(k.NONE,k.NONE,k.NONE),this.elt[U].setLocations(Z,ut,ht)}};rn.prototype.getGeometryCount=function(){var n=0;return this.elt[0].isNull()||n++,this.elt[1].isNull()||n++,n},rn.prototype.setAllLocations=function(n,i){this.elt[n].setAllLocations(i)},rn.prototype.isNull=function(n){return this.elt[n].isNull()},rn.prototype.setAllLocationsIfNull=function(){if(arguments.length===1){var n=arguments[0];this.setAllLocationsIfNull(0,n),this.setAllLocationsIfNull(1,n)}else if(arguments.length===2){var i=arguments[0],s=arguments[1];this.elt[i].setAllLocationsIfNull(s)}},rn.prototype.isLine=function(n){return this.elt[n].isLine()},rn.prototype.merge=function(n){for(var i=0;i<2;i++)this.elt[i]===null&&n.elt[i]!==null?this.elt[i]=new hn(n.elt[i]):this.elt[i].merge(n.elt[i])},rn.prototype.flip=function(){this.elt[0].flip(),this.elt[1].flip()},rn.prototype.getLocation=function(){if(arguments.length===1){var n=arguments[0];return this.elt[n].get(bt.ON)}if(arguments.length===2){var i=arguments[0],s=arguments[1];return this.elt[i].get(s)}},rn.prototype.toString=function(){var n=new pt;return this.elt[0]!==null&&(n.append("A:"),n.append(this.elt[0].toString())),this.elt[1]!==null&&(n.append(" B:"),n.append(this.elt[1].toString())),n.toString()},rn.prototype.isArea=function(){if(arguments.length===0)return this.elt[0].isArea()||this.elt[1].isArea();if(arguments.length===1){var n=arguments[0];return this.elt[n].isArea()}},rn.prototype.isAnyNull=function(n){return this.elt[n].isAnyNull()},rn.prototype.setLocation=function(){if(arguments.length===2){var n=arguments[0],i=arguments[1];this.elt[n].setLocation(bt.ON,i)}else if(arguments.length===3){var s=arguments[0],u=arguments[1],c=arguments[2];this.elt[s].setLocation(u,c)}},rn.prototype.isEqualOnSide=function(n,i){return this.elt[0].isEqualOnSide(n.elt[0],i)&&this.elt[1].isEqualOnSide(n.elt[1],i)},rn.prototype.allPositionsEqual=function(n,i){return this.elt[n].allPositionsEqual(i)},rn.prototype.toLine=function(n){this.elt[n].isArea()&&(this.elt[n]=new hn(this.elt[n].location[0]))},rn.prototype.interfaces_=function(){return[]},rn.prototype.getClass=function(){return rn},rn.toLineLabel=function(n){for(var i=new rn(k.NONE),s=0;s<2;s++)i.setLocation(s,n.getLocation(s));return i};var An=function(){this._startDe=null,this._maxNodeDegree=-1,this._edges=new j,this._pts=new j,this._label=new rn(k.NONE),this._ring=null,this._isHole=null,this._shell=null,this._holes=new j,this._geometryFactory=null;var n=arguments[0],i=arguments[1];this._geometryFactory=i,this.computePoints(n),this.computeRing()};An.prototype.computeRing=function(){if(this._ring!==null)return null;for(var n=new Array(this._pts.size()).fill(null),i=0;i<this._pts.size();i++)n[i]=this._pts.get(i);this._ring=this._geometryFactory.createLinearRing(n),this._isHole=B.isCCW(this._ring.getCoordinates())},An.prototype.isIsolated=function(){return this._label.getGeometryCount()===1},An.prototype.computePoints=function(n){this._startDe=n;var i=n,s=!0;do{if(i===null)throw new io("Found null DirectedEdge");if(i.getEdgeRing()===this)throw new io("Directed Edge visited twice during ring-building at "+i.getCoordinate());this._edges.add(i);var u=i.getLabel();b.isTrue(u.isArea()),this.mergeLabel(u),this.addPoints(i.getEdge(),i.isForward(),s),s=!1,this.setEdgeRing(i,this),i=this.getNext(i)}while(i!==this._startDe)},An.prototype.getLinearRing=function(){return this._ring},An.prototype.getCoordinate=function(n){return this._pts.get(n)},An.prototype.computeMaxNodeDegree=function(){this._maxNodeDegree=0;var n=this._startDe;do{var i=n.getNode().getEdges().getOutgoingDegree(this);i>this._maxNodeDegree&&(this._maxNodeDegree=i),n=this.getNext(n)}while(n!==this._startDe);this._maxNodeDegree*=2},An.prototype.addPoints=function(n,i,s){var u=n.getCoordinates();if(i){var c=1;s&&(c=0);for(var m=c;m<u.length;m++)this._pts.add(u[m])}else{var E=u.length-2;s&&(E=u.length-1);for(var A=E;A>=0;A--)this._pts.add(u[A])}},An.prototype.isHole=function(){return this._isHole},An.prototype.setInResult=function(){var n=this._startDe;do n.getEdge().setInResult(!0),n=n.getNext();while(n!==this._startDe)},An.prototype.containsPoint=function(n){var i=this.getLinearRing();if(!i.getEnvelopeInternal().contains(n)||!B.isPointInRing(n,i.getCoordinates()))return!1;for(var s=this._holes.iterator();s.hasNext();)if(s.next().containsPoint(n))return!1;return!0},An.prototype.addHole=function(n){this._holes.add(n)},An.prototype.isShell=function(){return this._shell===null},An.prototype.getLabel=function(){return this._label},An.prototype.getEdges=function(){return this._edges},An.prototype.getMaxNodeDegree=function(){return this._maxNodeDegree<0&&this.computeMaxNodeDegree(),this._maxNodeDegree},An.prototype.getShell=function(){return this._shell},An.prototype.mergeLabel=function(){if(arguments.length===1){var n=arguments[0];this.mergeLabel(n,0),this.mergeLabel(n,1)}else if(arguments.length===2){var i=arguments[0],s=arguments[1],u=i.getLocation(s,bt.RIGHT);if(u===k.NONE)return null;if(this._label.getLocation(s)===k.NONE)return this._label.setLocation(s,u),null}},An.prototype.setShell=function(n){this._shell=n,n!==null&&n.addHole(this)},An.prototype.toPolygon=function(n){for(var i=new Array(this._holes.size()).fill(null),s=0;s<this._holes.size();s++)i[s]=this._holes.get(s).getLinearRing();return n.createPolygon(this.getLinearRing(),i)},An.prototype.interfaces_=function(){return[]},An.prototype.getClass=function(){return An};var d1=function(n){function i(){var s=arguments[0],u=arguments[1];n.call(this,s,u)}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.setEdgeRing=function(s,u){s.setMinEdgeRing(u)},i.prototype.getNext=function(s){return s.getNextMin()},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(An),m1=function(n){function i(){var s=arguments[0],u=arguments[1];n.call(this,s,u)}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.buildMinimalRings=function(){var s=new j,u=this._startDe;do{if(u.getMinEdgeRing()===null){var c=new d1(u,this._geometryFactory);s.add(c)}u=u.getNext()}while(u!==this._startDe);return s},i.prototype.setEdgeRing=function(s,u){s.setEdgeRing(u)},i.prototype.linkDirectedEdgesForMinimalEdgeRings=function(){var s=this._startDe;do s.getNode().getEdges().linkMinimalDirectedEdges(this),s=s.getNext();while(s!==this._startDe)},i.prototype.getNext=function(s){return s.getNext()},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(An),Hr=function(){if(this._label=null,this._isInResult=!1,this._isCovered=!1,this._isCoveredSet=!1,this._isVisited=!1,arguments.length!==0){if(arguments.length===1){var n=arguments[0];this._label=n}}};Hr.prototype.setVisited=function(n){this._isVisited=n},Hr.prototype.setInResult=function(n){this._isInResult=n},Hr.prototype.isCovered=function(){return this._isCovered},Hr.prototype.isCoveredSet=function(){return this._isCoveredSet},Hr.prototype.setLabel=function(n){this._label=n},Hr.prototype.getLabel=function(){return this._label},Hr.prototype.setCovered=function(n){this._isCovered=n,this._isCoveredSet=!0},Hr.prototype.updateIM=function(n){b.isTrue(this._label.getGeometryCount()>=2,"found partial label"),this.computeIM(n)},Hr.prototype.isInResult=function(){return this._isInResult},Hr.prototype.isVisited=function(){return this._isVisited},Hr.prototype.interfaces_=function(){return[]},Hr.prototype.getClass=function(){return Hr};var El=function(n){function i(){n.call(this),this._coord=null,this._edges=null;var s=arguments[0],u=arguments[1];this._coord=s,this._edges=u,this._label=new rn(0,k.NONE)}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.isIncidentEdgeInResult=function(){for(var s=this.getEdges().getEdges().iterator();s.hasNext();)if(s.next().getEdge().isInResult())return!0;return!1},i.prototype.isIsolated=function(){return this._label.getGeometryCount()===1},i.prototype.getCoordinate=function(){return this._coord},i.prototype.print=function(s){s.println("node "+this._coord+" lbl: "+this._label)},i.prototype.computeIM=function(s){},i.prototype.computeMergedLocation=function(s,u){var c=k.NONE;if(c=this._label.getLocation(u),!s.isNull(u)){var m=s.getLocation(u);c!==k.BOUNDARY&&(c=m)}return c},i.prototype.setLabel=function(){if(arguments.length!==2)return n.prototype.setLabel.apply(this,arguments);var s=arguments[0],u=arguments[1];this._label===null?this._label=new rn(s,u):this._label.setLocation(s,u)},i.prototype.getEdges=function(){return this._edges},i.prototype.mergeLabel=function(){if(arguments[0]instanceof i){var s=arguments[0];this.mergeLabel(s._label)}else if(arguments[0]instanceof rn)for(var u=arguments[0],c=0;c<2;c++){var m=this.computeMergedLocation(u,c);this._label.getLocation(c)===k.NONE&&this._label.setLocation(c,m)}},i.prototype.add=function(s){this._edges.insert(s),s.setNode(this)},i.prototype.setLabelBoundary=function(s){if(this._label===null)return null;var u=k.NONE;this._label!==null&&(u=this._label.getLocation(s));var c=null;switch(u){case k.BOUNDARY:c=k.INTERIOR;break;case k.INTERIOR:default:c=k.BOUNDARY}this._label.setLocation(s,c)},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(Hr),bi=function(){this.nodeMap=new _,this.nodeFact=null;var n=arguments[0];this.nodeFact=n};bi.prototype.find=function(n){return this.nodeMap.get(n)},bi.prototype.addNode=function(){if(arguments[0]instanceof L){var n=arguments[0],i=this.nodeMap.get(n);return i===null&&(i=this.nodeFact.createNode(n),this.nodeMap.put(n,i)),i}if(arguments[0]instanceof El){var s=arguments[0],u=this.nodeMap.get(s.getCoordinate());return u===null?(this.nodeMap.put(s.getCoordinate(),s),s):(u.mergeLabel(s),u)}},bi.prototype.print=function(n){for(var i=this.iterator();i.hasNext();)i.next().print(n)},bi.prototype.iterator=function(){return this.nodeMap.values().iterator()},bi.prototype.values=function(){return this.nodeMap.values()},bi.prototype.getBoundaryNodes=function(n){for(var i=new j,s=this.iterator();s.hasNext();){var u=s.next();u.getLabel().getLocation(n)===k.BOUNDARY&&i.add(u)}return i},bi.prototype.add=function(n){var i=n.getCoordinate();this.addNode(i).add(n)},bi.prototype.interfaces_=function(){return[]},bi.prototype.getClass=function(){return bi};var ln=function(){},gu={NE:{configurable:!0},NW:{configurable:!0},SW:{configurable:!0},SE:{configurable:!0}};ln.prototype.interfaces_=function(){return[]},ln.prototype.getClass=function(){return ln},ln.isNorthern=function(n){return n===ln.NE||n===ln.NW},ln.isOpposite=function(n,i){return n===i?!1:(n-i+4)%4===2},ln.commonHalfPlane=function(n,i){if(n===i)return n;if((n-i+4)%4===2)return-1;var s=n<i?n:i;return s===0&&(n>i?n:i)===3?3:s},ln.isInHalfPlane=function(n,i){return i===ln.SE?n===ln.SE||n===ln.SW:n===i||n===i+1},ln.quadrant=function(){if(typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var n=arguments[0],i=arguments[1];if(n===0&&i===0)throw new C("Cannot compute the quadrant for point ( "+n+", "+i+" )");return n>=0?i>=0?ln.NE:ln.SE:i>=0?ln.NW:ln.SW}if(arguments[0]instanceof L&&arguments[1]instanceof L){var s=arguments[0],u=arguments[1];if(u.x===s.x&&u.y===s.y)throw new C("Cannot compute the quadrant for two identical points "+s);return u.x>=s.x?u.y>=s.y?ln.NE:ln.SE:u.y>=s.y?ln.NW:ln.SW}},gu.NE.get=function(){return 0},gu.NW.get=function(){return 1},gu.SW.get=function(){return 2},gu.SE.get=function(){return 3},Object.defineProperties(ln,gu);var Kn=function(){if(this._edge=null,this._label=null,this._node=null,this._p0=null,this._p1=null,this._dx=null,this._dy=null,this._quadrant=null,arguments.length===1){var n=arguments[0];this._edge=n}else if(arguments.length===3){var i=arguments[0],s=arguments[1],u=arguments[2];this._edge=i,this.init(s,u),this._label=null}else if(arguments.length===4){var c=arguments[0],m=arguments[1],E=arguments[2],A=arguments[3];this._edge=c,this.init(m,E),this._label=A}};Kn.prototype.compareDirection=function(n){return this._dx===n._dx&&this._dy===n._dy?0:this._quadrant>n._quadrant?1:this._quadrant<n._quadrant?-1:B.computeOrientation(n._p0,n._p1,this._p1)},Kn.prototype.getDy=function(){return this._dy},Kn.prototype.getCoordinate=function(){return this._p0},Kn.prototype.setNode=function(n){this._node=n},Kn.prototype.print=function(n){var i=Math.atan2(this._dy,this._dx),s=this.getClass().getName(),u=s.lastIndexOf("."),c=s.substring(u+1);n.print(" "+c+": "+this._p0+" - "+this._p1+" "+this._quadrant+":"+i+" "+this._label)},Kn.prototype.compareTo=function(n){var i=n;return this.compareDirection(i)},Kn.prototype.getDirectedCoordinate=function(){return this._p1},Kn.prototype.getDx=function(){return this._dx},Kn.prototype.getLabel=function(){return this._label},Kn.prototype.getEdge=function(){return this._edge},Kn.prototype.getQuadrant=function(){return this._quadrant},Kn.prototype.getNode=function(){return this._node},Kn.prototype.toString=function(){var n=Math.atan2(this._dy,this._dx),i=this.getClass().getName(),s=i.lastIndexOf(".");return" "+i.substring(s+1)+": "+this._p0+" - "+this._p1+" "+this._quadrant+":"+n+" "+this._label},Kn.prototype.computeLabel=function(n){},Kn.prototype.init=function(n,i){this._p0=n,this._p1=i,this._dx=i.x-n.x,this._dy=i.y-n.y,this._quadrant=ln.quadrant(this._dx,this._dy),b.isTrue(!(this._dx===0&&this._dy===0),"EdgeEnd with identical endpoints found")},Kn.prototype.interfaces_=function(){return[F]},Kn.prototype.getClass=function(){return Kn};var yf=function(n){function i(){var s=arguments[0],u=arguments[1];if(n.call(this,s),this._isForward=null,this._isInResult=!1,this._isVisited=!1,this._sym=null,this._next=null,this._nextMin=null,this._edgeRing=null,this._minEdgeRing=null,this._depth=[0,-999,-999],this._isForward=u,u)this.init(s.getCoordinate(0),s.getCoordinate(1));else{var c=s.getNumPoints()-1;this.init(s.getCoordinate(c),s.getCoordinate(c-1))}this.computeDirectedLabel()}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.getNextMin=function(){return this._nextMin},i.prototype.getDepth=function(s){return this._depth[s]},i.prototype.setVisited=function(s){this._isVisited=s},i.prototype.computeDirectedLabel=function(){this._label=new rn(this._edge.getLabel()),this._isForward||this._label.flip()},i.prototype.getNext=function(){return this._next},i.prototype.setDepth=function(s,u){if(this._depth[s]!==-999&&this._depth[s]!==u)throw new io("assigned depths do not match",this.getCoordinate());this._depth[s]=u},i.prototype.isInteriorAreaEdge=function(){for(var s=!0,u=0;u<2;u++)this._label.isArea(u)&&this._label.getLocation(u,bt.LEFT)===k.INTERIOR&&this._label.getLocation(u,bt.RIGHT)===k.INTERIOR||(s=!1);return s},i.prototype.setNextMin=function(s){this._nextMin=s},i.prototype.print=function(s){n.prototype.print.call(this,s),s.print(" "+this._depth[bt.LEFT]+"/"+this._depth[bt.RIGHT]),s.print(" ("+this.getDepthDelta()+")"),this._isInResult&&s.print(" inResult")},i.prototype.setMinEdgeRing=function(s){this._minEdgeRing=s},i.prototype.isLineEdge=function(){var s=this._label.isLine(0)||this._label.isLine(1),u=!this._label.isArea(0)||this._label.allPositionsEqual(0,k.EXTERIOR),c=!this._label.isArea(1)||this._label.allPositionsEqual(1,k.EXTERIOR);return s&&u&&c},i.prototype.setEdgeRing=function(s){this._edgeRing=s},i.prototype.getMinEdgeRing=function(){return this._minEdgeRing},i.prototype.getDepthDelta=function(){var s=this._edge.getDepthDelta();return this._isForward||(s=-s),s},i.prototype.setInResult=function(s){this._isInResult=s},i.prototype.getSym=function(){return this._sym},i.prototype.isForward=function(){return this._isForward},i.prototype.getEdge=function(){return this._edge},i.prototype.printEdge=function(s){this.print(s),s.print(" "),this._isForward?this._edge.print(s):this._edge.printReverse(s)},i.prototype.setSym=function(s){this._sym=s},i.prototype.setVisitedEdge=function(s){this.setVisited(s),this._sym.setVisited(s)},i.prototype.setEdgeDepths=function(s,u){var c=this.getEdge().getDepthDelta();this._isForward||(c=-c);var m=1;s===bt.LEFT&&(m=-1);var E=bt.opposite(s),A=u+c*m;this.setDepth(s,u),this.setDepth(E,A)},i.prototype.getEdgeRing=function(){return this._edgeRing},i.prototype.isInResult=function(){return this._isInResult},i.prototype.setNext=function(s){this._next=s},i.prototype.isVisited=function(){return this._isVisited},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i.depthFactor=function(s,u){return s===k.EXTERIOR&&u===k.INTERIOR?1:s===k.INTERIOR&&u===k.EXTERIOR?-1:0},i}(Kn),sa=function(){};sa.prototype.createNode=function(n){return new El(n,null)},sa.prototype.interfaces_=function(){return[]},sa.prototype.getClass=function(){return sa};var _n=function(){if(this._edges=new j,this._nodes=null,this._edgeEndList=new j,arguments.length===0)this._nodes=new bi(new sa);else if(arguments.length===1){var n=arguments[0];this._nodes=new bi(n)}};_n.prototype.printEdges=function(n){n.println("Edges:");for(var i=0;i<this._edges.size();i++){n.println("edge "+i+":");var s=this._edges.get(i);s.print(n),s.eiList.print(n)}},_n.prototype.find=function(n){return this._nodes.find(n)},_n.prototype.addNode=function(){if(arguments[0]instanceof El){var n=arguments[0];return this._nodes.addNode(n)}if(arguments[0]instanceof L){var i=arguments[0];return this._nodes.addNode(i)}},_n.prototype.getNodeIterator=function(){return this._nodes.iterator()},_n.prototype.linkResultDirectedEdges=function(){for(var n=this._nodes.iterator();n.hasNext();)n.next().getEdges().linkResultDirectedEdges()},_n.prototype.debugPrintln=function(n){Nt.out.println(n)},_n.prototype.isBoundaryNode=function(n,i){var s=this._nodes.find(i);if(s===null)return!1;var u=s.getLabel();return u!==null&&u.getLocation(n)===k.BOUNDARY},_n.prototype.linkAllDirectedEdges=function(){for(var n=this._nodes.iterator();n.hasNext();)n.next().getEdges().linkAllDirectedEdges()},_n.prototype.matchInSameDirection=function(n,i,s,u){return!!n.equals(s)&&B.computeOrientation(n,i,u)===B.COLLINEAR&&ln.quadrant(n,i)===ln.quadrant(s,u)},_n.prototype.getEdgeEnds=function(){return this._edgeEndList},_n.prototype.debugPrint=function(n){Nt.out.print(n)},_n.prototype.getEdgeIterator=function(){return this._edges.iterator()},_n.prototype.findEdgeInSameDirection=function(n,i){for(var s=0;s<this._edges.size();s++){var u=this._edges.get(s),c=u.getCoordinates();if(this.matchInSameDirection(n,i,c[0],c[1])||this.matchInSameDirection(n,i,c[c.length-1],c[c.length-2]))return u}return null},_n.prototype.insertEdge=function(n){this._edges.add(n)},_n.prototype.findEdgeEnd=function(n){for(var i=this.getEdgeEnds().iterator();i.hasNext();){var s=i.next();if(s.getEdge()===n)return s}return null},_n.prototype.addEdges=function(n){for(var i=n.iterator();i.hasNext();){var s=i.next();this._edges.add(s);var u=new yf(s,!0),c=new yf(s,!1);u.setSym(c),c.setSym(u),this.add(u),this.add(c)}},_n.prototype.add=function(n){this._nodes.add(n),this._edgeEndList.add(n)},_n.prototype.getNodes=function(){return this._nodes.values()},_n.prototype.findEdge=function(n,i){for(var s=0;s<this._edges.size();s++){var u=this._edges.get(s),c=u.getCoordinates();if(n.equals(c[0])&&i.equals(c[1]))return u}return null},_n.prototype.interfaces_=function(){return[]},_n.prototype.getClass=function(){return _n},_n.linkResultDirectedEdges=function(n){for(var i=n.iterator();i.hasNext();)i.next().getEdges().linkResultDirectedEdges()};var Nr=function(){this._geometryFactory=null,this._shellList=new j;var n=arguments[0];this._geometryFactory=n};Nr.prototype.sortShellsAndHoles=function(n,i,s){for(var u=n.iterator();u.hasNext();){var c=u.next();c.isHole()?s.add(c):i.add(c)}},Nr.prototype.computePolygons=function(n){for(var i=new j,s=n.iterator();s.hasNext();){var u=s.next().toPolygon(this._geometryFactory);i.add(u)}return i},Nr.prototype.placeFreeHoles=function(n,i){for(var s=i.iterator();s.hasNext();){var u=s.next();if(u.getShell()===null){var c=this.findEdgeRingContaining(u,n);if(c===null)throw new io("unable to assign hole to a shell",u.getCoordinate(0));u.setShell(c)}}},Nr.prototype.buildMinimalEdgeRings=function(n,i,s){for(var u=new j,c=n.iterator();c.hasNext();){var m=c.next();if(m.getMaxNodeDegree()>2){m.linkDirectedEdgesForMinimalEdgeRings();var E=m.buildMinimalRings(),A=this.findShell(E);A!==null?(this.placePolygonHoles(A,E),i.add(A)):s.addAll(E)}else u.add(m)}return u},Nr.prototype.containsPoint=function(n){for(var i=this._shellList.iterator();i.hasNext();)if(i.next().containsPoint(n))return!0;return!1},Nr.prototype.buildMaximalEdgeRings=function(n){for(var i=new j,s=n.iterator();s.hasNext();){var u=s.next();if(u.isInResult()&&u.getLabel().isArea()&&u.getEdgeRing()===null){var c=new m1(u,this._geometryFactory);i.add(c),c.setInResult()}}return i},Nr.prototype.placePolygonHoles=function(n,i){for(var s=i.iterator();s.hasNext();){var u=s.next();u.isHole()&&u.setShell(n)}},Nr.prototype.getPolygons=function(){return this.computePolygons(this._shellList)},Nr.prototype.findEdgeRingContaining=function(n,i){for(var s=n.getLinearRing(),u=s.getEnvelopeInternal(),c=s.getCoordinateN(0),m=null,E=null,A=i.iterator();A.hasNext();){var U=A.next(),Z=U.getLinearRing(),ut=Z.getEnvelopeInternal();m!==null&&(E=m.getLinearRing().getEnvelopeInternal());var ht=!1;ut.contains(u)&&B.isPointInRing(c,Z.getCoordinates())&&(ht=!0),ht&&(m===null||E.contains(ut))&&(m=U)}return m},Nr.prototype.findShell=function(n){for(var i=0,s=null,u=n.iterator();u.hasNext();){var c=u.next();c.isHole()||(s=c,i++)}return b.isTrue(i<=1,"found two shells in MinimalEdgeRing list"),s},Nr.prototype.add=function(){if(arguments.length===1){var n=arguments[0];this.add(n.getEdgeEnds(),n.getNodes())}else if(arguments.length===2){var i=arguments[0],s=arguments[1];_n.linkResultDirectedEdges(s);var u=this.buildMaximalEdgeRings(i),c=new j,m=this.buildMinimalEdgeRings(u,this._shellList,c);this.sortShellsAndHoles(m,this._shellList,c),this.placeFreeHoles(this._shellList,c)}},Nr.prototype.interfaces_=function(){return[]},Nr.prototype.getClass=function(){return Nr};var aa=function(){};aa.prototype.getBounds=function(){},aa.prototype.interfaces_=function(){return[]},aa.prototype.getClass=function(){return aa};var pi=function(){this._bounds=null,this._item=null;var n=arguments[0],i=arguments[1];this._bounds=n,this._item=i};pi.prototype.getItem=function(){return this._item},pi.prototype.getBounds=function(){return this._bounds},pi.prototype.interfaces_=function(){return[aa,t]},pi.prototype.getClass=function(){return pi};var oo=function(){this._size=null,this._items=null,this._size=0,this._items=new j,this._items.add(null)};oo.prototype.poll=function(){if(this.isEmpty())return null;var n=this._items.get(1);return this._items.set(1,this._items.get(this._size)),this._size-=1,this.reorder(1),n},oo.prototype.size=function(){return this._size},oo.prototype.reorder=function(n){for(var i=null,s=this._items.get(n);2*n<=this._size&&((i=2*n)!==this._size&&this._items.get(i+1).compareTo(this._items.get(i))<0&&i++,this._items.get(i).compareTo(s)<0);n=i)this._items.set(n,this._items.get(i));this._items.set(n,s)},oo.prototype.clear=function(){this._size=0,this._items.clear()},oo.prototype.isEmpty=function(){return this._size===0},oo.prototype.add=function(n){this._items.add(null),this._size+=1;var i=this._size;for(this._items.set(0,n);n.compareTo(this._items.get(Math.trunc(i/2)))<0;i/=2)this._items.set(i,this._items.get(Math.trunc(i/2)));this._items.set(i,n)},oo.prototype.interfaces_=function(){return[]},oo.prototype.getClass=function(){return oo};var Mo=function(){};Mo.prototype.visitItem=function(n){},Mo.prototype.interfaces_=function(){return[]},Mo.prototype.getClass=function(){return Mo};var Ts=function(){};Ts.prototype.insert=function(n,i){},Ts.prototype.remove=function(n,i){},Ts.prototype.query=function(){},Ts.prototype.interfaces_=function(){return[]},Ts.prototype.getClass=function(){return Ts};var Nn=function(){if(this._childBoundables=new j,this._bounds=null,this._level=null,arguments.length!==0){if(arguments.length===1){var n=arguments[0];this._level=n}}},Vd={serialVersionUID:{configurable:!0}};Nn.prototype.getLevel=function(){return this._level},Nn.prototype.size=function(){return this._childBoundables.size()},Nn.prototype.getChildBoundables=function(){return this._childBoundables},Nn.prototype.addChildBoundable=function(n){b.isTrue(this._bounds===null),this._childBoundables.add(n)},Nn.prototype.isEmpty=function(){return this._childBoundables.isEmpty()},Nn.prototype.getBounds=function(){return this._bounds===null&&(this._bounds=this.computeBounds()),this._bounds},Nn.prototype.interfaces_=function(){return[aa,t]},Nn.prototype.getClass=function(){return Nn},Vd.serialVersionUID.get=function(){return 6493722185909574e3},Object.defineProperties(Nn,Vd);var di=function(){};di.reverseOrder=function(){return{compare:function(n,i){return i.compareTo(n)}}},di.min=function(n){return di.sort(n),n.get(0)},di.sort=function(n,i){var s=n.toArray();i?Fi.sort(s,i):Fi.sort(s);for(var u=n.iterator(),c=0,m=s.length;c<m;c++)u.next(),u.set(s[c])},di.singletonList=function(n){var i=new j;return i.add(n),i};var Cn=function(){this._boundable1=null,this._boundable2=null,this._distance=null,this._itemDistance=null;var n=arguments[0],i=arguments[1],s=arguments[2];this._boundable1=n,this._boundable2=i,this._itemDistance=s,this._distance=this.distance()};Cn.prototype.expandToQueue=function(n,i){var s=Cn.isComposite(this._boundable1),u=Cn.isComposite(this._boundable2);if(s&&u)return Cn.area(this._boundable1)>Cn.area(this._boundable2)?(this.expand(this._boundable1,this._boundable2,n,i),null):(this.expand(this._boundable2,this._boundable1,n,i),null);if(s)return this.expand(this._boundable1,this._boundable2,n,i),null;if(u)return this.expand(this._boundable2,this._boundable1,n,i),null;throw new C("neither boundable is composite")},Cn.prototype.isLeaves=function(){return!(Cn.isComposite(this._boundable1)||Cn.isComposite(this._boundable2))},Cn.prototype.compareTo=function(n){var i=n;return this._distance<i._distance?-1:this._distance>i._distance?1:0},Cn.prototype.expand=function(n,i,s,u){for(var c=n.getChildBoundables().iterator();c.hasNext();){var m=c.next(),E=new Cn(m,i,this._itemDistance);E.getDistance()<u&&s.add(E)}},Cn.prototype.getBoundable=function(n){return n===0?this._boundable1:this._boundable2},Cn.prototype.getDistance=function(){return this._distance},Cn.prototype.distance=function(){return this.isLeaves()?this._itemDistance.distance(this._boundable1,this._boundable2):this._boundable1.getBounds().distance(this._boundable2.getBounds())},Cn.prototype.interfaces_=function(){return[F]},Cn.prototype.getClass=function(){return Cn},Cn.area=function(n){return n.getBounds().getArea()},Cn.isComposite=function(n){return n instanceof Nn};var zn=function n(){if(this._root=null,this._built=!1,this._itemBoundables=new j,this._nodeCapacity=null,arguments.length===0){var i=n.DEFAULT_NODE_CAPACITY;this._nodeCapacity=i}else if(arguments.length===1){var s=arguments[0];b.isTrue(s>1,"Node capacity must be greater than 1"),this._nodeCapacity=s}},Ml={IntersectsOp:{configurable:!0},serialVersionUID:{configurable:!0},DEFAULT_NODE_CAPACITY:{configurable:!0}};zn.prototype.getNodeCapacity=function(){return this._nodeCapacity},zn.prototype.lastNode=function(n){return n.get(n.size()-1)},zn.prototype.size=function(){if(arguments.length===0)return this.isEmpty()?0:(this.build(),this.size(this._root));if(arguments.length===1){for(var n=0,i=arguments[0].getChildBoundables().iterator();i.hasNext();){var s=i.next();s instanceof Nn?n+=this.size(s):s instanceof pi&&(n+=1)}return n}},zn.prototype.removeItem=function(n,i){for(var s=null,u=n.getChildBoundables().iterator();u.hasNext();){var c=u.next();c instanceof pi&&c.getItem()===i&&(s=c)}return s!==null&&(n.getChildBoundables().remove(s),!0)},zn.prototype.itemsTree=function(){if(arguments.length===0){this.build();var n=this.itemsTree(this._root);return n===null?new j:n}if(arguments.length===1){for(var i=arguments[0],s=new j,u=i.getChildBoundables().iterator();u.hasNext();){var c=u.next();if(c instanceof Nn){var m=this.itemsTree(c);m!==null&&s.add(m)}else c instanceof pi?s.add(c.getItem()):b.shouldNeverReachHere()}return s.size()<=0?null:s}},zn.prototype.insert=function(n,i){b.isTrue(!this._built,"Cannot insert items into an STR packed R-tree after it has been built."),this._itemBoundables.add(new pi(n,i))},zn.prototype.boundablesAtLevel=function(){if(arguments.length===1){var n=arguments[0],i=new j;return this.boundablesAtLevel(n,this._root,i),i}if(arguments.length===3){var s=arguments[0],u=arguments[1],c=arguments[2];if(b.isTrue(s>-2),u.getLevel()===s)return c.add(u),null;for(var m=u.getChildBoundables().iterator();m.hasNext();){var E=m.next();E instanceof Nn?this.boundablesAtLevel(s,E,c):(b.isTrue(E instanceof pi),s===-1&&c.add(E))}return null}},zn.prototype.query=function(){if(arguments.length===1){var n=arguments[0];this.build();var i=new j;return this.isEmpty()||this.getIntersectsOp().intersects(this._root.getBounds(),n)&&this.query(n,this._root,i),i}if(arguments.length===2){var s=arguments[0],u=arguments[1];if(this.build(),this.isEmpty())return null;this.getIntersectsOp().intersects(this._root.getBounds(),s)&&this.query(s,this._root,u)}else if(arguments.length===3){if(X(arguments[2],Mo)&&arguments[0]instanceof Object&&arguments[1]instanceof Nn)for(var c=arguments[0],m=arguments[1],E=arguments[2],A=m.getChildBoundables(),U=0;U<A.size();U++){var Z=A.get(U);this.getIntersectsOp().intersects(Z.getBounds(),c)&&(Z instanceof Nn?this.query(c,Z,E):Z instanceof pi?E.visitItem(Z.getItem()):b.shouldNeverReachHere())}else if(X(arguments[2],wt)&&arguments[0]instanceof Object&&arguments[1]instanceof Nn)for(var ut=arguments[0],ht=arguments[1],At=arguments[2],Rt=ht.getChildBoundables(),kt=0;kt<Rt.size();kt++){var ee=Rt.get(kt);this.getIntersectsOp().intersects(ee.getBounds(),ut)&&(ee instanceof Nn?this.query(ut,ee,At):ee instanceof pi?At.add(ee.getItem()):b.shouldNeverReachHere())}}},zn.prototype.build=function(){if(this._built)return null;this._root=this._itemBoundables.isEmpty()?this.createNode(0):this.createHigherLevels(this._itemBoundables,-1),this._itemBoundables=null,this._built=!0},zn.prototype.getRoot=function(){return this.build(),this._root},zn.prototype.remove=function(){if(arguments.length===2){var n=arguments[0],i=arguments[1];return this.build(),!!this.getIntersectsOp().intersects(this._root.getBounds(),n)&&this.remove(n,this._root,i)}if(arguments.length===3){var s=arguments[0],u=arguments[1],c=arguments[2],m=this.removeItem(u,c);if(m)return!0;for(var E=null,A=u.getChildBoundables().iterator();A.hasNext();){var U=A.next();if(this.getIntersectsOp().intersects(U.getBounds(),s)&&U instanceof Nn&&(m=this.remove(s,U,c))){E=U;break}}return E!==null&&E.getChildBoundables().isEmpty()&&u.getChildBoundables().remove(E),m}},zn.prototype.createHigherLevels=function(n,i){b.isTrue(!n.isEmpty());var s=this.createParentBoundables(n,i+1);return s.size()===1?s.get(0):this.createHigherLevels(s,i+1)},zn.prototype.depth=function(){if(arguments.length===0)return this.isEmpty()?0:(this.build(),this.depth(this._root));if(arguments.length===1){for(var n=0,i=arguments[0].getChildBoundables().iterator();i.hasNext();){var s=i.next();if(s instanceof Nn){var u=this.depth(s);u>n&&(n=u)}}return n+1}},zn.prototype.createParentBoundables=function(n,i){b.isTrue(!n.isEmpty());var s=new j;s.add(this.createNode(i));var u=new j(n);di.sort(u,this.getComparator());for(var c=u.iterator();c.hasNext();){var m=c.next();this.lastNode(s).getChildBoundables().size()===this.getNodeCapacity()&&s.add(this.createNode(i)),this.lastNode(s).addChildBoundable(m)}return s},zn.prototype.isEmpty=function(){return this._built?this._root.isEmpty():this._itemBoundables.isEmpty()},zn.prototype.interfaces_=function(){return[t]},zn.prototype.getClass=function(){return zn},zn.compareDoubles=function(n,i){return n>i?1:n<i?-1:0},Ml.IntersectsOp.get=function(){return g1},Ml.serialVersionUID.get=function(){return-3886435814360241e3},Ml.DEFAULT_NODE_CAPACITY.get=function(){return 10},Object.defineProperties(zn,Ml);var g1=function(){},ua=function(){};ua.prototype.distance=function(n,i){},ua.prototype.interfaces_=function(){return[]},ua.prototype.getClass=function(){return ua};var Hd=function(n){function i(u){u=u||i.DEFAULT_NODE_CAPACITY,n.call(this,u)}n&&(i.__proto__=n),(i.prototype=Object.create(n&&n.prototype)).constructor=i;var s={STRtreeNode:{configurable:!0},serialVersionUID:{configurable:!0},xComparator:{configurable:!0},yComparator:{configurable:!0},intersectsOp:{configurable:!0},DEFAULT_NODE_CAPACITY:{configurable:!0}};return i.prototype.createParentBoundablesFromVerticalSlices=function(u,c){b.isTrue(u.length>0);for(var m=new j,E=0;E<u.length;E++)m.addAll(this.createParentBoundablesFromVerticalSlice(u[E],c));return m},i.prototype.createNode=function(u){return new Wd(u)},i.prototype.size=function(){return arguments.length===0?n.prototype.size.call(this):n.prototype.size.apply(this,arguments)},i.prototype.insert=function(){if(arguments.length!==2)return n.prototype.insert.apply(this,arguments);var u=arguments[0],c=arguments[1];if(u.isNull())return null;n.prototype.insert.call(this,u,c)},i.prototype.getIntersectsOp=function(){return i.intersectsOp},i.prototype.verticalSlices=function(u,c){for(var m=Math.trunc(Math.ceil(u.size()/c)),E=new Array(c).fill(null),A=u.iterator(),U=0;U<c;U++){E[U]=new j;for(var Z=0;A.hasNext()&&Z<m;){var ut=A.next();E[U].add(ut),Z++}}return E},i.prototype.query=function(){if(arguments.length===1){var u=arguments[0];return n.prototype.query.call(this,u)}if(arguments.length===2){var c=arguments[0],m=arguments[1];n.prototype.query.call(this,c,m)}else if(arguments.length===3){if(X(arguments[2],Mo)&&arguments[0]instanceof Object&&arguments[1]instanceof Nn){var E=arguments[0],A=arguments[1],U=arguments[2];n.prototype.query.call(this,E,A,U)}else if(X(arguments[2],wt)&&arguments[0]instanceof Object&&arguments[1]instanceof Nn){var Z=arguments[0],ut=arguments[1],ht=arguments[2];n.prototype.query.call(this,Z,ut,ht)}}},i.prototype.getComparator=function(){return i.yComparator},i.prototype.createParentBoundablesFromVerticalSlice=function(u,c){return n.prototype.createParentBoundables.call(this,u,c)},i.prototype.remove=function(){if(arguments.length===2){var u=arguments[0],c=arguments[1];return n.prototype.remove.call(this,u,c)}return n.prototype.remove.apply(this,arguments)},i.prototype.depth=function(){return arguments.length===0?n.prototype.depth.call(this):n.prototype.depth.apply(this,arguments)},i.prototype.createParentBoundables=function(u,c){b.isTrue(!u.isEmpty());var m=Math.trunc(Math.ceil(u.size()/this.getNodeCapacity())),E=new j(u);di.sort(E,i.xComparator);var A=this.verticalSlices(E,Math.trunc(Math.ceil(Math.sqrt(m))));return this.createParentBoundablesFromVerticalSlices(A,c)},i.prototype.nearestNeighbour=function(){if(arguments.length===1){if(X(arguments[0],ua)){var u=arguments[0],c=new Cn(this.getRoot(),this.getRoot(),u);return this.nearestNeighbour(c)}if(arguments[0]instanceof Cn){var m=arguments[0];return this.nearestNeighbour(m,S.POSITIVE_INFINITY)}}else if(arguments.length===2){if(arguments[0]instanceof i&&X(arguments[1],ua)){var E=arguments[0],A=arguments[1],U=new Cn(this.getRoot(),E.getRoot(),A);return this.nearestNeighbour(U)}if(arguments[0]instanceof Cn&&typeof arguments[1]=="number"){var Z=arguments[0],ut=arguments[1],ht=null,At=new oo;for(At.add(Z);!At.isEmpty()&&ut>0;){var Rt=At.poll(),kt=Rt.getDistance();if(kt>=ut)break;Rt.isLeaves()?(ut=kt,ht=Rt):Rt.expandToQueue(At,ut)}return[ht.getBoundable(0).getItem(),ht.getBoundable(1).getItem()]}}else if(arguments.length===3){var ee=arguments[0],on=arguments[1],In=arguments[2],pr=new pi(ee,on),Xi=new Cn(this.getRoot(),pr,In);return this.nearestNeighbour(Xi)[0]}},i.prototype.interfaces_=function(){return[Ts,t]},i.prototype.getClass=function(){return i},i.centreX=function(u){return i.avg(u.getMinX(),u.getMaxX())},i.avg=function(u,c){return(u+c)/2},i.centreY=function(u){return i.avg(u.getMinY(),u.getMaxY())},s.STRtreeNode.get=function(){return Wd},s.serialVersionUID.get=function(){return 0x39920f7d5f261e0},s.xComparator.get=function(){return{interfaces_:function(){return[z]},compare:function(u,c){return n.compareDoubles(i.centreX(u.getBounds()),i.centreX(c.getBounds()))}}},s.yComparator.get=function(){return{interfaces_:function(){return[z]},compare:function(u,c){return n.compareDoubles(i.centreY(u.getBounds()),i.centreY(c.getBounds()))}}},s.intersectsOp.get=function(){return{interfaces_:function(){return[n.IntersectsOp]},intersects:function(u,c){return u.intersects(c)}}},s.DEFAULT_NODE_CAPACITY.get=function(){return 10},Object.defineProperties(i,s),i}(zn),Wd=function(n){function i(){var s=arguments[0];n.call(this,s)}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.computeBounds=function(){for(var s=null,u=this.getChildBoundables().iterator();u.hasNext();){var c=u.next();s===null?s=new Pt(c.getBounds()):s.expandToInclude(c.getBounds())}return s},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(Nn),Er=function(){};Er.prototype.interfaces_=function(){return[]},Er.prototype.getClass=function(){return Er},Er.relativeSign=function(n,i){return n<i?-1:n>i?1:0},Er.compare=function(n,i,s){if(i.equals2D(s))return 0;var u=Er.relativeSign(i.x,s.x),c=Er.relativeSign(i.y,s.y);switch(n){case 0:return Er.compareValue(u,c);case 1:return Er.compareValue(c,u);case 2:return Er.compareValue(c,-u);case 3:return Er.compareValue(-u,c);case 4:return Er.compareValue(-u,-c);case 5:return Er.compareValue(-c,-u);case 6:return Er.compareValue(-c,u);case 7:return Er.compareValue(u,-c)}return b.shouldNeverReachHere("invalid octant value"),0},Er.compareValue=function(n,i){return n<0?-1:n>0?1:i<0?-1:i>0?1:0};var So=function(){this._segString=null,this.coord=null,this.segmentIndex=null,this._segmentOctant=null,this._isInterior=null;var n=arguments[0],i=arguments[1],s=arguments[2],u=arguments[3];this._segString=n,this.coord=new L(i),this.segmentIndex=s,this._segmentOctant=u,this._isInterior=!i.equals2D(n.getCoordinate(s))};So.prototype.getCoordinate=function(){return this.coord},So.prototype.print=function(n){n.print(this.coord),n.print(" seg # = "+this.segmentIndex)},So.prototype.compareTo=function(n){var i=n;return this.segmentIndex<i.segmentIndex?-1:this.segmentIndex>i.segmentIndex?1:this.coord.equals2D(i.coord)?0:Er.compare(this._segmentOctant,this.coord,i.coord)},So.prototype.isEndPoint=function(n){return this.segmentIndex===0&&!this._isInterior||this.segmentIndex===n},So.prototype.isInterior=function(){return this._isInterior},So.prototype.interfaces_=function(){return[F]},So.prototype.getClass=function(){return So};var ar=function(){this._nodeMap=new _,this._edge=null;var n=arguments[0];this._edge=n};ar.prototype.getSplitCoordinates=function(){var n=new Dt;this.addEndpoints();for(var i=this.iterator(),s=i.next();i.hasNext();){var u=i.next();this.addEdgeCoordinates(s,u,n),s=u}return n.toCoordinateArray()},ar.prototype.addCollapsedNodes=function(){var n=new j;this.findCollapsesFromInsertedNodes(n),this.findCollapsesFromExistingVertices(n);for(var i=n.iterator();i.hasNext();){var s=i.next().intValue();this.add(this._edge.getCoordinate(s),s)}},ar.prototype.print=function(n){n.println("Intersections:");for(var i=this.iterator();i.hasNext();)i.next().print(n)},ar.prototype.findCollapsesFromExistingVertices=function(n){for(var i=0;i<this._edge.size()-2;i++){var s=this._edge.getCoordinate(i),u=this._edge.getCoordinate(i+2);s.equals2D(u)&&n.add(new et(i+1))}},ar.prototype.addEdgeCoordinates=function(n,i,s){var u=this._edge.getCoordinate(i.segmentIndex),c=i.isInterior()||!i.coord.equals2D(u);s.add(new L(n.coord),!1);for(var m=n.segmentIndex+1;m<=i.segmentIndex;m++)s.add(this._edge.getCoordinate(m));c&&s.add(new L(i.coord))},ar.prototype.iterator=function(){return this._nodeMap.values().iterator()},ar.prototype.addSplitEdges=function(n){this.addEndpoints(),this.addCollapsedNodes();for(var i=this.iterator(),s=i.next();i.hasNext();){var u=i.next(),c=this.createSplitEdge(s,u);n.add(c),s=u}},ar.prototype.findCollapseIndex=function(n,i,s){if(!n.coord.equals2D(i.coord))return!1;var u=i.segmentIndex-n.segmentIndex;return i.isInterior()||u--,u===1&&(s[0]=n.segmentIndex+1,!0)},ar.prototype.findCollapsesFromInsertedNodes=function(n){for(var i=new Array(1).fill(null),s=this.iterator(),u=s.next();s.hasNext();){var c=s.next();this.findCollapseIndex(u,c,i)&&n.add(new et(i[0])),u=c}},ar.prototype.getEdge=function(){return this._edge},ar.prototype.addEndpoints=function(){var n=this._edge.size()-1;this.add(this._edge.getCoordinate(0),0),this.add(this._edge.getCoordinate(n),n)},ar.prototype.createSplitEdge=function(n,i){var s=i.segmentIndex-n.segmentIndex+2,u=this._edge.getCoordinate(i.segmentIndex),c=i.isInterior()||!i.coord.equals2D(u);c||s--;var m=new Array(s).fill(null),E=0;m[E++]=new L(n.coord);for(var A=n.segmentIndex+1;A<=i.segmentIndex;A++)m[E++]=this._edge.getCoordinate(A);return c&&(m[E]=new L(i.coord)),new wn(m,this._edge.getData())},ar.prototype.add=function(n,i){var s=new So(this._edge,n,i,this._edge.getSegmentOctant(i)),u=this._nodeMap.get(s);return u!==null?(b.isTrue(u.coord.equals2D(n),"Found equal nodes with different coordinates"),u):(this._nodeMap.put(s,s),s)},ar.prototype.checkSplitEdgesCorrectness=function(n){var i=this._edge.getCoordinates(),s=n.get(0).getCoordinate(0);if(!s.equals2D(i[0]))throw new $("bad split edge start point at "+s);var u=n.get(n.size()-1).getCoordinates(),c=u[u.length-1];if(!c.equals2D(i[i.length-1]))throw new $("bad split edge end point at "+c)},ar.prototype.interfaces_=function(){return[]},ar.prototype.getClass=function(){return ar};var As=function(){};As.prototype.interfaces_=function(){return[]},As.prototype.getClass=function(){return As},As.octant=function(){if(typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var n=arguments[0],i=arguments[1];if(n===0&&i===0)throw new C("Cannot compute the octant for point ( "+n+", "+i+" )");var s=Math.abs(n),u=Math.abs(i);return n>=0?i>=0?s>=u?0:1:s>=u?7:6:i>=0?s>=u?3:2:s>=u?4:5}if(arguments[0]instanceof L&&arguments[1]instanceof L){var c=arguments[0],m=arguments[1],E=m.x-c.x,A=m.y-c.y;if(E===0&&A===0)throw new C("Cannot compute the octant for two identical points "+c);return As.octant(E,A)}};var Bi=function(){};Bi.prototype.getCoordinates=function(){},Bi.prototype.size=function(){},Bi.prototype.getCoordinate=function(n){},Bi.prototype.isClosed=function(){},Bi.prototype.setData=function(n){},Bi.prototype.getData=function(){},Bi.prototype.interfaces_=function(){return[]},Bi.prototype.getClass=function(){return Bi};var yu=function(){};yu.prototype.addIntersection=function(n,i){},yu.prototype.interfaces_=function(){return[Bi]},yu.prototype.getClass=function(){return yu};var wn=function(){this._nodeList=new ar(this),this._pts=null,this._data=null;var n=arguments[0],i=arguments[1];this._pts=n,this._data=i};wn.prototype.getCoordinates=function(){return this._pts},wn.prototype.size=function(){return this._pts.length},wn.prototype.getCoordinate=function(n){return this._pts[n]},wn.prototype.isClosed=function(){return this._pts[0].equals(this._pts[this._pts.length-1])},wn.prototype.getSegmentOctant=function(n){return n===this._pts.length-1?-1:this.safeOctant(this.getCoordinate(n),this.getCoordinate(n+1))},wn.prototype.setData=function(n){this._data=n},wn.prototype.safeOctant=function(n,i){return n.equals2D(i)?0:As.octant(n,i)},wn.prototype.getData=function(){return this._data},wn.prototype.addIntersection=function(){if(arguments.length===2){var n=arguments[0],i=arguments[1];this.addIntersectionNode(n,i)}else if(arguments.length===4){var s=arguments[0],u=arguments[1],c=arguments[3],m=new L(s.getIntersection(c));this.addIntersection(m,u)}},wn.prototype.toString=function(){return qt.toLineString(new he(this._pts))},wn.prototype.getNodeList=function(){return this._nodeList},wn.prototype.addIntersectionNode=function(n,i){var s=i,u=s+1;if(u<this._pts.length){var c=this._pts[u];n.equals2D(c)&&(s=u)}return this._nodeList.add(n,s)},wn.prototype.addIntersections=function(n,i,s){for(var u=0;u<n.getIntersectionNum();u++)this.addIntersection(n,i,s,u)},wn.prototype.interfaces_=function(){return[yu]},wn.prototype.getClass=function(){return wn},wn.getNodedSubstrings=function(){if(arguments.length===1){var n=arguments[0],i=new j;return wn.getNodedSubstrings(n,i),i}if(arguments.length===2)for(var s=arguments[0],u=arguments[1],c=s.iterator();c.hasNext();)c.next().getNodeList().addSplitEdges(u)};var Zt=function(){if(this.p0=null,this.p1=null,arguments.length===0)this.p0=new L,this.p1=new L;else if(arguments.length===1){var n=arguments[0];this.p0=new L(n.p0),this.p1=new L(n.p1)}else if(arguments.length===2)this.p0=arguments[0],this.p1=arguments[1];else if(arguments.length===4){var i=arguments[0],s=arguments[1],u=arguments[2],c=arguments[3];this.p0=new L(i,s),this.p1=new L(u,c)}},qd={serialVersionUID:{configurable:!0}};Zt.prototype.minX=function(){return Math.min(this.p0.x,this.p1.x)},Zt.prototype.orientationIndex=function(){if(arguments[0]instanceof Zt){var n=arguments[0],i=B.orientationIndex(this.p0,this.p1,n.p0),s=B.orientationIndex(this.p0,this.p1,n.p1);return i>=0&&s>=0||i<=0&&s<=0?Math.max(i,s):0}if(arguments[0]instanceof L){var u=arguments[0];return B.orientationIndex(this.p0,this.p1,u)}},Zt.prototype.toGeometry=function(n){return n.createLineString([this.p0,this.p1])},Zt.prototype.isVertical=function(){return this.p0.x===this.p1.x},Zt.prototype.equals=function(n){if(!(n instanceof Zt))return!1;var i=n;return this.p0.equals(i.p0)&&this.p1.equals(i.p1)},Zt.prototype.intersection=function(n){var i=new J;return i.computeIntersection(this.p0,this.p1,n.p0,n.p1),i.hasIntersection()?i.getIntersection(0):null},Zt.prototype.project=function(){if(arguments[0]instanceof L){var n=arguments[0];if(n.equals(this.p0)||n.equals(this.p1))return new L(n);var i=this.projectionFactor(n),s=new L;return s.x=this.p0.x+i*(this.p1.x-this.p0.x),s.y=this.p0.y+i*(this.p1.y-this.p0.y),s}if(arguments[0]instanceof Zt){var u=arguments[0],c=this.projectionFactor(u.p0),m=this.projectionFactor(u.p1);if(c>=1&&m>=1||c<=0&&m<=0)return null;var E=this.project(u.p0);c<0&&(E=this.p0),c>1&&(E=this.p1);var A=this.project(u.p1);return m<0&&(A=this.p0),m>1&&(A=this.p1),new Zt(E,A)}},Zt.prototype.normalize=function(){this.p1.compareTo(this.p0)<0&&this.reverse()},Zt.prototype.angle=function(){return Math.atan2(this.p1.y-this.p0.y,this.p1.x-this.p0.x)},Zt.prototype.getCoordinate=function(n){return n===0?this.p0:this.p1},Zt.prototype.distancePerpendicular=function(n){return B.distancePointLinePerpendicular(n,this.p0,this.p1)},Zt.prototype.minY=function(){return Math.min(this.p0.y,this.p1.y)},Zt.prototype.midPoint=function(){return Zt.midPoint(this.p0,this.p1)},Zt.prototype.projectionFactor=function(n){if(n.equals(this.p0))return 0;if(n.equals(this.p1))return 1;var i=this.p1.x-this.p0.x,s=this.p1.y-this.p0.y,u=i*i+s*s;return u<=0?S.NaN:((n.x-this.p0.x)*i+(n.y-this.p0.y)*s)/u},Zt.prototype.closestPoints=function(n){var i=this.intersection(n);if(i!==null)return[i,i];var s=new Array(2).fill(null),u=S.MAX_VALUE,c=null,m=this.closestPoint(n.p0);u=m.distance(n.p0),s[0]=m,s[1]=n.p0;var E=this.closestPoint(n.p1);(c=E.distance(n.p1))<u&&(u=c,s[0]=E,s[1]=n.p1);var A=n.closestPoint(this.p0);(c=A.distance(this.p0))<u&&(u=c,s[0]=this.p0,s[1]=A);var U=n.closestPoint(this.p1);return(c=U.distance(this.p1))<u&&(u=c,s[0]=this.p1,s[1]=U),s},Zt.prototype.closestPoint=function(n){var i=this.projectionFactor(n);return i>0&&i<1?this.project(n):this.p0.distance(n)<this.p1.distance(n)?this.p0:this.p1},Zt.prototype.maxX=function(){return Math.max(this.p0.x,this.p1.x)},Zt.prototype.getLength=function(){return this.p0.distance(this.p1)},Zt.prototype.compareTo=function(n){var i=n,s=this.p0.compareTo(i.p0);return s!==0?s:this.p1.compareTo(i.p1)},Zt.prototype.reverse=function(){var n=this.p0;this.p0=this.p1,this.p1=n},Zt.prototype.equalsTopo=function(n){return this.p0.equals(n.p0)&&(this.p1.equals(n.p1)||this.p0.equals(n.p1))&&this.p1.equals(n.p0)},Zt.prototype.lineIntersection=function(n){try{return ne.intersection(this.p0,this.p1,n.p0,n.p1)}catch(i){if(!(i instanceof Wt))throw i}return null},Zt.prototype.maxY=function(){return Math.max(this.p0.y,this.p1.y)},Zt.prototype.pointAlongOffset=function(n,i){var s=this.p0.x+n*(this.p1.x-this.p0.x),u=this.p0.y+n*(this.p1.y-this.p0.y),c=this.p1.x-this.p0.x,m=this.p1.y-this.p0.y,E=Math.sqrt(c*c+m*m),A=0,U=0;if(i!==0){if(E<=0)throw new Error("Cannot compute offset from zero-length line segment");A=i*c/E,U=i*m/E}return new L(s-U,u+A)},Zt.prototype.setCoordinates=function(){if(arguments.length===1){var n=arguments[0];this.setCoordinates(n.p0,n.p1)}else if(arguments.length===2){var i=arguments[0],s=arguments[1];this.p0.x=i.x,this.p0.y=i.y,this.p1.x=s.x,this.p1.y=s.y}},Zt.prototype.segmentFraction=function(n){var i=this.projectionFactor(n);return i<0?i=0:(i>1||S.isNaN(i))&&(i=1),i},Zt.prototype.toString=function(){return"LINESTRING( "+this.p0.x+" "+this.p0.y+", "+this.p1.x+" "+this.p1.y+")"},Zt.prototype.isHorizontal=function(){return this.p0.y===this.p1.y},Zt.prototype.distance=function(){if(arguments[0]instanceof Zt){var n=arguments[0];return B.distanceLineLine(this.p0,this.p1,n.p0,n.p1)}if(arguments[0]instanceof L){var i=arguments[0];return B.distancePointLine(i,this.p0,this.p1)}},Zt.prototype.pointAlong=function(n){var i=new L;return i.x=this.p0.x+n*(this.p1.x-this.p0.x),i.y=this.p0.y+n*(this.p1.y-this.p0.y),i},Zt.prototype.hashCode=function(){var n=S.doubleToLongBits(this.p0.x);n^=31*S.doubleToLongBits(this.p0.y);var i=Math.trunc(n)^Math.trunc(n>>32),s=S.doubleToLongBits(this.p1.x);return s^=31*S.doubleToLongBits(this.p1.y),i^(Math.trunc(s)^Math.trunc(s>>32))},Zt.prototype.interfaces_=function(){return[F,t]},Zt.prototype.getClass=function(){return Zt},Zt.midPoint=function(n,i){return new L((n.x+i.x)/2,(n.y+i.y)/2)},qd.serialVersionUID.get=function(){return 0x2d2172135f411c00},Object.defineProperties(Zt,qd);var vu=function(){this.tempEnv1=new Pt,this.tempEnv2=new Pt,this._overlapSeg1=new Zt,this._overlapSeg2=new Zt};vu.prototype.overlap=function(){if(arguments.length!==2){if(arguments.length===4){var n=arguments[0],i=arguments[1],s=arguments[2],u=arguments[3];n.getLineSegment(i,this._overlapSeg1),s.getLineSegment(u,this._overlapSeg2),this.overlap(this._overlapSeg1,this._overlapSeg2)}}},vu.prototype.interfaces_=function(){return[]},vu.prototype.getClass=function(){return vu};var Or=function(){this._pts=null,this._start=null,this._end=null,this._env=null,this._context=null,this._id=null;var n=arguments[0],i=arguments[1],s=arguments[2],u=arguments[3];this._pts=n,this._start=i,this._end=s,this._context=u};Or.prototype.getLineSegment=function(n,i){i.p0=this._pts[n],i.p1=this._pts[n+1]},Or.prototype.computeSelect=function(n,i,s,u){var c=this._pts[i],m=this._pts[s];if(u.tempEnv1.init(c,m),s-i==1)return u.select(this,i),null;if(!n.intersects(u.tempEnv1))return null;var E=Math.trunc((i+s)/2);i<E&&this.computeSelect(n,i,E,u),E<s&&this.computeSelect(n,E,s,u)},Or.prototype.getCoordinates=function(){for(var n=new Array(this._end-this._start+1).fill(null),i=0,s=this._start;s<=this._end;s++)n[i++]=this._pts[s];return n},Or.prototype.computeOverlaps=function(n,i){this.computeOverlapsInternal(this._start,this._end,n,n._start,n._end,i)},Or.prototype.setId=function(n){this._id=n},Or.prototype.select=function(n,i){this.computeSelect(n,this._start,this._end,i)},Or.prototype.getEnvelope=function(){if(this._env===null){var n=this._pts[this._start],i=this._pts[this._end];this._env=new Pt(n,i)}return this._env},Or.prototype.getEndIndex=function(){return this._end},Or.prototype.getStartIndex=function(){return this._start},Or.prototype.getContext=function(){return this._context},Or.prototype.getId=function(){return this._id},Or.prototype.computeOverlapsInternal=function(n,i,s,u,c,m){var E=this._pts[n],A=this._pts[i],U=s._pts[u],Z=s._pts[c];if(i-n==1&&c-u==1)return m.overlap(this,n,s,u),null;if(m.tempEnv1.init(E,A),m.tempEnv2.init(U,Z),!m.tempEnv1.intersects(m.tempEnv2))return null;var ut=Math.trunc((n+i)/2),ht=Math.trunc((u+c)/2);n<ut&&(u<ht&&this.computeOverlapsInternal(n,ut,s,u,ht,m),ht<c&&this.computeOverlapsInternal(n,ut,s,ht,c,m)),ut<i&&(u<ht&&this.computeOverlapsInternal(ut,i,s,u,ht,m),ht<c&&this.computeOverlapsInternal(ut,i,s,ht,c,m))},Or.prototype.interfaces_=function(){return[]},Or.prototype.getClass=function(){return Or};var Ti=function(){};Ti.prototype.interfaces_=function(){return[]},Ti.prototype.getClass=function(){return Ti},Ti.getChainStartIndices=function(n){var i=0,s=new j;s.add(new et(i));do{var u=Ti.findChainEnd(n,i);s.add(new et(u)),i=u}while(i<n.length-1);return Ti.toIntArray(s)},Ti.findChainEnd=function(n,i){for(var s=i;s<n.length-1&&n[s].equals2D(n[s+1]);)s++;if(s>=n.length-1)return n.length-1;for(var u=ln.quadrant(n[s],n[s+1]),c=i+1;c<n.length&&!(!n[c-1].equals2D(n[c])&&ln.quadrant(n[c-1],n[c])!==u);)c++;return c-1},Ti.getChains=function(){if(arguments.length===1){var n=arguments[0];return Ti.getChains(n,null)}if(arguments.length===2){for(var i=arguments[0],s=arguments[1],u=new j,c=Ti.getChainStartIndices(i),m=0;m<c.length-1;m++){var E=new Or(i,c[m],c[m+1],s);u.add(E)}return u}},Ti.toIntArray=function(n){for(var i=new Array(n.size()).fill(null),s=0;s<i.length;s++)i[s]=n.get(s).intValue();return i};var Jo=function(){};Jo.prototype.computeNodes=function(n){},Jo.prototype.getNodedSubstrings=function(){},Jo.prototype.interfaces_=function(){return[]},Jo.prototype.getClass=function(){return Jo};var _u=function(){if(this._segInt=null,arguments.length!==0){if(arguments.length===1){var n=arguments[0];this.setSegmentIntersector(n)}}};_u.prototype.setSegmentIntersector=function(n){this._segInt=n},_u.prototype.interfaces_=function(){return[Jo]},_u.prototype.getClass=function(){return _u};var vf=function(n){function i(u){u?n.call(this,u):n.call(this),this._monoChains=new j,this._index=new Hd,this._idCounter=0,this._nodedSegStrings=null,this._nOverlaps=0}n&&(i.__proto__=n),(i.prototype=Object.create(n&&n.prototype)).constructor=i;var s={SegmentOverlapAction:{configurable:!0}};return i.prototype.getMonotoneChains=function(){return this._monoChains},i.prototype.getNodedSubstrings=function(){return wn.getNodedSubstrings(this._nodedSegStrings)},i.prototype.getIndex=function(){return this._index},i.prototype.add=function(u){for(var c=Ti.getChains(u.getCoordinates(),u).iterator();c.hasNext();){var m=c.next();m.setId(this._idCounter++),this._index.insert(m.getEnvelope(),m),this._monoChains.add(m)}},i.prototype.computeNodes=function(u){this._nodedSegStrings=u;for(var c=u.iterator();c.hasNext();)this.add(c.next());this.intersectChains()},i.prototype.intersectChains=function(){for(var u=new Xd(this._segInt),c=this._monoChains.iterator();c.hasNext();)for(var m=c.next(),E=this._index.query(m.getEnvelope()).iterator();E.hasNext();){var A=E.next();if(A.getId()>m.getId()&&(m.computeOverlaps(A,u),this._nOverlaps++),this._segInt.isDone())return null}},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},s.SegmentOverlapAction.get=function(){return Xd},Object.defineProperties(i,s),i}(_u),Xd=function(n){function i(){n.call(this),this._si=null;var s=arguments[0];this._si=s}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.overlap=function(){if(arguments.length!==4)return n.prototype.overlap.apply(this,arguments);var s=arguments[0],u=arguments[1],c=arguments[2],m=arguments[3],E=s.getContext(),A=c.getContext();this._si.processIntersections(E,u,A,m)},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(vu),We=function n(){if(this._quadrantSegments=n.DEFAULT_QUADRANT_SEGMENTS,this._endCapStyle=n.CAP_ROUND,this._joinStyle=n.JOIN_ROUND,this._mitreLimit=n.DEFAULT_MITRE_LIMIT,this._isSingleSided=!1,this._simplifyFactor=n.DEFAULT_SIMPLIFY_FACTOR,arguments.length!==0){if(arguments.length===1){var i=arguments[0];this.setQuadrantSegments(i)}else if(arguments.length===2){var s=arguments[0],u=arguments[1];this.setQuadrantSegments(s),this.setEndCapStyle(u)}else if(arguments.length===4){var c=arguments[0],m=arguments[1],E=arguments[2],A=arguments[3];this.setQuadrantSegments(c),this.setEndCapStyle(m),this.setJoinStyle(E),this.setMitreLimit(A)}}},so={CAP_ROUND:{configurable:!0},CAP_FLAT:{configurable:!0},CAP_SQUARE:{configurable:!0},JOIN_ROUND:{configurable:!0},JOIN_MITRE:{configurable:!0},JOIN_BEVEL:{configurable:!0},DEFAULT_QUADRANT_SEGMENTS:{configurable:!0},DEFAULT_MITRE_LIMIT:{configurable:!0},DEFAULT_SIMPLIFY_FACTOR:{configurable:!0}};We.prototype.getEndCapStyle=function(){return this._endCapStyle},We.prototype.isSingleSided=function(){return this._isSingleSided},We.prototype.setQuadrantSegments=function(n){this._quadrantSegments=n,this._quadrantSegments===0&&(this._joinStyle=We.JOIN_BEVEL),this._quadrantSegments<0&&(this._joinStyle=We.JOIN_MITRE,this._mitreLimit=Math.abs(this._quadrantSegments)),n<=0&&(this._quadrantSegments=1),this._joinStyle!==We.JOIN_ROUND&&(this._quadrantSegments=We.DEFAULT_QUADRANT_SEGMENTS)},We.prototype.getJoinStyle=function(){return this._joinStyle},We.prototype.setJoinStyle=function(n){this._joinStyle=n},We.prototype.setSimplifyFactor=function(n){this._simplifyFactor=n<0?0:n},We.prototype.getSimplifyFactor=function(){return this._simplifyFactor},We.prototype.getQuadrantSegments=function(){return this._quadrantSegments},We.prototype.setEndCapStyle=function(n){this._endCapStyle=n},We.prototype.getMitreLimit=function(){return this._mitreLimit},We.prototype.setMitreLimit=function(n){this._mitreLimit=n},We.prototype.setSingleSided=function(n){this._isSingleSided=n},We.prototype.interfaces_=function(){return[]},We.prototype.getClass=function(){return We},We.bufferDistanceError=function(n){var i=Math.PI/2/n;return 1-Math.cos(i/2)},so.CAP_ROUND.get=function(){return 1},so.CAP_FLAT.get=function(){return 2},so.CAP_SQUARE.get=function(){return 3},so.JOIN_ROUND.get=function(){return 1},so.JOIN_MITRE.get=function(){return 2},so.JOIN_BEVEL.get=function(){return 3},so.DEFAULT_QUADRANT_SEGMENTS.get=function(){return 8},so.DEFAULT_MITRE_LIMIT.get=function(){return 5},so.DEFAULT_SIMPLIFY_FACTOR.get=function(){return .01},Object.defineProperties(We,so);var Mn=function(n){this._distanceTol=null,this._isDeleted=null,this._angleOrientation=B.COUNTERCLOCKWISE,this._inputLine=n||null},xu={INIT:{configurable:!0},DELETE:{configurable:!0},KEEP:{configurable:!0},NUM_PTS_TO_CHECK:{configurable:!0}};Mn.prototype.isDeletable=function(n,i,s,u){var c=this._inputLine[n],m=this._inputLine[i],E=this._inputLine[s];return!!this.isConcave(c,m,E)&&!!this.isShallow(c,m,E,u)&&this.isShallowSampled(c,m,n,s,u)},Mn.prototype.deleteShallowConcavities=function(){for(var n=1,i=this.findNextNonDeletedIndex(n),s=this.findNextNonDeletedIndex(i),u=!1;s<this._inputLine.length;){var c=!1;this.isDeletable(n,i,s,this._distanceTol)&&(this._isDeleted[i]=Mn.DELETE,c=!0,u=!0),n=c?s:i,i=this.findNextNonDeletedIndex(n),s=this.findNextNonDeletedIndex(i)}return u},Mn.prototype.isShallowConcavity=function(n,i,s,u){return B.computeOrientation(n,i,s)!==this._angleOrientation?!1:B.distancePointLine(i,n,s)<u},Mn.prototype.isShallowSampled=function(n,i,s,u,c){var m=Math.trunc((u-s)/Mn.NUM_PTS_TO_CHECK);m<=0&&(m=1);for(var E=s;E<u;E+=m)if(!this.isShallow(n,i,this._inputLine[E],c))return!1;return!0},Mn.prototype.isConcave=function(n,i,s){var u=B.computeOrientation(n,i,s)===this._angleOrientation;return u},Mn.prototype.simplify=function(n){this._distanceTol=Math.abs(n),n<0&&(this._angleOrientation=B.CLOCKWISE),this._isDeleted=new Array(this._inputLine.length).fill(null);var i=!1;do i=this.deleteShallowConcavities();while(i);return this.collapseLine()},Mn.prototype.findNextNonDeletedIndex=function(n){for(var i=n+1;i<this._inputLine.length&&this._isDeleted[i]===Mn.DELETE;)i++;return i},Mn.prototype.isShallow=function(n,i,s,u){return B.distancePointLine(i,n,s)<u},Mn.prototype.collapseLine=function(){for(var n=new Dt,i=0;i<this._inputLine.length;i++)this._isDeleted[i]!==Mn.DELETE&&n.add(this._inputLine[i]);return n.toCoordinateArray()},Mn.prototype.interfaces_=function(){return[]},Mn.prototype.getClass=function(){return Mn},Mn.simplify=function(n,i){return new Mn(n).simplify(i)},xu.INIT.get=function(){return 0},xu.DELETE.get=function(){return 1},xu.KEEP.get=function(){return 1},xu.NUM_PTS_TO_CHECK.get=function(){return 10},Object.defineProperties(Mn,xu);var Wr=function(){this._ptList=null,this._precisionModel=null,this._minimimVertexDistance=0,this._ptList=new j},Yd={COORDINATE_ARRAY_TYPE:{configurable:!0}};Wr.prototype.getCoordinates=function(){return this._ptList.toArray(Wr.COORDINATE_ARRAY_TYPE)},Wr.prototype.setPrecisionModel=function(n){this._precisionModel=n},Wr.prototype.addPt=function(n){var i=new L(n);if(this._precisionModel.makePrecise(i),this.isRedundant(i))return null;this._ptList.add(i)},Wr.prototype.revere=function(){},Wr.prototype.addPts=function(n,i){if(i)for(var s=0;s<n.length;s++)this.addPt(n[s]);else for(var u=n.length-1;u>=0;u--)this.addPt(n[u])},Wr.prototype.isRedundant=function(n){if(this._ptList.size()<1)return!1;var i=this._ptList.get(this._ptList.size()-1);return n.distance(i)<this._minimimVertexDistance},Wr.prototype.toString=function(){return new le().createLineString(this.getCoordinates()).toString()},Wr.prototype.closeRing=function(){if(this._ptList.size()<1)return null;var n=new L(this._ptList.get(0)),i=this._ptList.get(this._ptList.size()-1);if(n.equals(i))return null;this._ptList.add(n)},Wr.prototype.setMinimumVertexDistance=function(n){this._minimimVertexDistance=n},Wr.prototype.interfaces_=function(){return[]},Wr.prototype.getClass=function(){return Wr},Yd.COORDINATE_ARRAY_TYPE.get=function(){return new Array(0).fill(null)},Object.defineProperties(Wr,Yd);var me=function(){},Cs={PI_TIMES_2:{configurable:!0},PI_OVER_2:{configurable:!0},PI_OVER_4:{configurable:!0},COUNTERCLOCKWISE:{configurable:!0},CLOCKWISE:{configurable:!0},NONE:{configurable:!0}};me.prototype.interfaces_=function(){return[]},me.prototype.getClass=function(){return me},me.toDegrees=function(n){return 180*n/Math.PI},me.normalize=function(n){for(;n>Math.PI;)n-=me.PI_TIMES_2;for(;n<=-Math.PI;)n+=me.PI_TIMES_2;return n},me.angle=function(){if(arguments.length===1){var n=arguments[0];return Math.atan2(n.y,n.x)}if(arguments.length===2){var i=arguments[0],s=arguments[1],u=s.x-i.x,c=s.y-i.y;return Math.atan2(c,u)}},me.isAcute=function(n,i,s){var u=n.x-i.x,c=n.y-i.y;return u*(s.x-i.x)+c*(s.y-i.y)>0},me.isObtuse=function(n,i,s){var u=n.x-i.x,c=n.y-i.y;return u*(s.x-i.x)+c*(s.y-i.y)<0},me.interiorAngle=function(n,i,s){var u=me.angle(i,n),c=me.angle(i,s);return Math.abs(c-u)},me.normalizePositive=function(n){if(n<0){for(;n<0;)n+=me.PI_TIMES_2;n>=me.PI_TIMES_2&&(n=0)}else{for(;n>=me.PI_TIMES_2;)n-=me.PI_TIMES_2;n<0&&(n=0)}return n},me.angleBetween=function(n,i,s){var u=me.angle(i,n),c=me.angle(i,s);return me.diff(u,c)},me.diff=function(n,i){var s=null;return(s=n<i?i-n:n-i)>Math.PI&&(s=2*Math.PI-s),s},me.toRadians=function(n){return n*Math.PI/180},me.getTurn=function(n,i){var s=Math.sin(i-n);return s>0?me.COUNTERCLOCKWISE:s<0?me.CLOCKWISE:me.NONE},me.angleBetweenOriented=function(n,i,s){var u=me.angle(i,n),c=me.angle(i,s)-u;return c<=-Math.PI?c+me.PI_TIMES_2:c>Math.PI?c-me.PI_TIMES_2:c},Cs.PI_TIMES_2.get=function(){return 2*Math.PI},Cs.PI_OVER_2.get=function(){return Math.PI/2},Cs.PI_OVER_4.get=function(){return Math.PI/4},Cs.COUNTERCLOCKWISE.get=function(){return B.COUNTERCLOCKWISE},Cs.CLOCKWISE.get=function(){return B.CLOCKWISE},Cs.NONE.get=function(){return B.COLLINEAR},Object.defineProperties(me,Cs);var pn=function n(){this._maxCurveSegmentError=0,this._filletAngleQuantum=null,this._closingSegLengthFactor=1,this._segList=null,this._distance=0,this._precisionModel=null,this._bufParams=null,this._li=null,this._s0=null,this._s1=null,this._s2=null,this._seg0=new Zt,this._seg1=new Zt,this._offset0=new Zt,this._offset1=new Zt,this._side=0,this._hasNarrowConcaveAngle=!1;var i=arguments[0],s=arguments[1],u=arguments[2];this._precisionModel=i,this._bufParams=s,this._li=new J,this._filletAngleQuantum=Math.PI/2/s.getQuadrantSegments(),s.getQuadrantSegments()>=8&&s.getJoinStyle()===We.JOIN_ROUND&&(this._closingSegLengthFactor=n.MAX_CLOSING_SEG_LEN_FACTOR),this.init(u)},Eu={OFFSET_SEGMENT_SEPARATION_FACTOR:{configurable:!0},INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR:{configurable:!0},CURVE_VERTEX_SNAP_DISTANCE_FACTOR:{configurable:!0},MAX_CLOSING_SEG_LEN_FACTOR:{configurable:!0}};pn.prototype.addNextSegment=function(n,i){if(this._s0=this._s1,this._s1=this._s2,this._s2=n,this._seg0.setCoordinates(this._s0,this._s1),this.computeOffsetSegment(this._seg0,this._side,this._distance,this._offset0),this._seg1.setCoordinates(this._s1,this._s2),this.computeOffsetSegment(this._seg1,this._side,this._distance,this._offset1),this._s1.equals(this._s2))return null;var s=B.computeOrientation(this._s0,this._s1,this._s2),u=s===B.CLOCKWISE&&this._side===bt.LEFT||s===B.COUNTERCLOCKWISE&&this._side===bt.RIGHT;s===0?this.addCollinear(i):u?this.addOutsideTurn(s,i):this.addInsideTurn(s,i)},pn.prototype.addLineEndCap=function(n,i){var s=new Zt(n,i),u=new Zt;this.computeOffsetSegment(s,bt.LEFT,this._distance,u);var c=new Zt;this.computeOffsetSegment(s,bt.RIGHT,this._distance,c);var m=i.x-n.x,E=i.y-n.y,A=Math.atan2(E,m);switch(this._bufParams.getEndCapStyle()){case We.CAP_ROUND:this._segList.addPt(u.p1),this.addFilletArc(i,A+Math.PI/2,A-Math.PI/2,B.CLOCKWISE,this._distance),this._segList.addPt(c.p1);break;case We.CAP_FLAT:this._segList.addPt(u.p1),this._segList.addPt(c.p1);break;case We.CAP_SQUARE:var U=new L;U.x=Math.abs(this._distance)*Math.cos(A),U.y=Math.abs(this._distance)*Math.sin(A);var Z=new L(u.p1.x+U.x,u.p1.y+U.y),ut=new L(c.p1.x+U.x,c.p1.y+U.y);this._segList.addPt(Z),this._segList.addPt(ut)}},pn.prototype.getCoordinates=function(){return this._segList.getCoordinates()},pn.prototype.addMitreJoin=function(n,i,s,u){var c=!0,m=null;try{m=ne.intersection(i.p0,i.p1,s.p0,s.p1),(u<=0?1:m.distance(n)/Math.abs(u))>this._bufParams.getMitreLimit()&&(c=!1)}catch(E){if(!(E instanceof Wt))throw E;m=new L(0,0),c=!1}c?this._segList.addPt(m):this.addLimitedMitreJoin(i,s,u,this._bufParams.getMitreLimit())},pn.prototype.addFilletCorner=function(n,i,s,u,c){var m=i.x-n.x,E=i.y-n.y,A=Math.atan2(E,m),U=s.x-n.x,Z=s.y-n.y,ut=Math.atan2(Z,U);u===B.CLOCKWISE?A<=ut&&(A+=2*Math.PI):A>=ut&&(A-=2*Math.PI),this._segList.addPt(i),this.addFilletArc(n,A,ut,u,c),this._segList.addPt(s)},pn.prototype.addOutsideTurn=function(n,i){if(this._offset0.p1.distance(this._offset1.p0)<this._distance*pn.OFFSET_SEGMENT_SEPARATION_FACTOR)return this._segList.addPt(this._offset0.p1),null;this._bufParams.getJoinStyle()===We.JOIN_MITRE?this.addMitreJoin(this._s1,this._offset0,this._offset1,this._distance):this._bufParams.getJoinStyle()===We.JOIN_BEVEL?this.addBevelJoin(this._offset0,this._offset1):(i&&this._segList.addPt(this._offset0.p1),this.addFilletCorner(this._s1,this._offset0.p1,this._offset1.p0,n,this._distance),this._segList.addPt(this._offset1.p0))},pn.prototype.createSquare=function(n){this._segList.addPt(new L(n.x+this._distance,n.y+this._distance)),this._segList.addPt(new L(n.x+this._distance,n.y-this._distance)),this._segList.addPt(new L(n.x-this._distance,n.y-this._distance)),this._segList.addPt(new L(n.x-this._distance,n.y+this._distance)),this._segList.closeRing()},pn.prototype.addSegments=function(n,i){this._segList.addPts(n,i)},pn.prototype.addFirstSegment=function(){this._segList.addPt(this._offset1.p0)},pn.prototype.addLastSegment=function(){this._segList.addPt(this._offset1.p1)},pn.prototype.initSideSegments=function(n,i,s){this._s1=n,this._s2=i,this._side=s,this._seg1.setCoordinates(n,i),this.computeOffsetSegment(this._seg1,s,this._distance,this._offset1)},pn.prototype.addLimitedMitreJoin=function(n,i,s,u){var c=this._seg0.p1,m=me.angle(c,this._seg0.p0),E=me.angleBetweenOriented(this._seg0.p0,c,this._seg1.p1)/2,A=me.normalize(m+E),U=me.normalize(A+Math.PI),Z=u*s,ut=s-Z*Math.abs(Math.sin(E)),ht=c.x+Z*Math.cos(U),At=c.y+Z*Math.sin(U),Rt=new L(ht,At),kt=new Zt(c,Rt),ee=kt.pointAlongOffset(1,ut),on=kt.pointAlongOffset(1,-ut);this._side===bt.LEFT?(this._segList.addPt(ee),this._segList.addPt(on)):(this._segList.addPt(on),this._segList.addPt(ee))},pn.prototype.computeOffsetSegment=function(n,i,s,u){var c=i===bt.LEFT?1:-1,m=n.p1.x-n.p0.x,E=n.p1.y-n.p0.y,A=Math.sqrt(m*m+E*E),U=c*s*m/A,Z=c*s*E/A;u.p0.x=n.p0.x-Z,u.p0.y=n.p0.y+U,u.p1.x=n.p1.x-Z,u.p1.y=n.p1.y+U},pn.prototype.addFilletArc=function(n,i,s,u,c){var m=u===B.CLOCKWISE?-1:1,E=Math.abs(i-s),A=Math.trunc(E/this._filletAngleQuantum+.5);if(A<1)return null;for(var U=E/A,Z=0,ut=new L;Z<E;){var ht=i+m*Z;ut.x=n.x+c*Math.cos(ht),ut.y=n.y+c*Math.sin(ht),this._segList.addPt(ut),Z+=U}},pn.prototype.addInsideTurn=function(n,i){if(this._li.computeIntersection(this._offset0.p0,this._offset0.p1,this._offset1.p0,this._offset1.p1),this._li.hasIntersection())this._segList.addPt(this._li.getIntersection(0));else if(this._hasNarrowConcaveAngle=!0,this._offset0.p1.distance(this._offset1.p0)<this._distance*pn.INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR)this._segList.addPt(this._offset0.p1);else{if(this._segList.addPt(this._offset0.p1),this._closingSegLengthFactor>0){var s=new L((this._closingSegLengthFactor*this._offset0.p1.x+this._s1.x)/(this._closingSegLengthFactor+1),(this._closingSegLengthFactor*this._offset0.p1.y+this._s1.y)/(this._closingSegLengthFactor+1));this._segList.addPt(s);var u=new L((this._closingSegLengthFactor*this._offset1.p0.x+this._s1.x)/(this._closingSegLengthFactor+1),(this._closingSegLengthFactor*this._offset1.p0.y+this._s1.y)/(this._closingSegLengthFactor+1));this._segList.addPt(u)}else this._segList.addPt(this._s1);this._segList.addPt(this._offset1.p0)}},pn.prototype.createCircle=function(n){var i=new L(n.x+this._distance,n.y);this._segList.addPt(i),this.addFilletArc(n,0,2*Math.PI,-1,this._distance),this._segList.closeRing()},pn.prototype.addBevelJoin=function(n,i){this._segList.addPt(n.p1),this._segList.addPt(i.p0)},pn.prototype.init=function(n){this._distance=n,this._maxCurveSegmentError=n*(1-Math.cos(this._filletAngleQuantum/2)),this._segList=new Wr,this._segList.setPrecisionModel(this._precisionModel),this._segList.setMinimumVertexDistance(n*pn.CURVE_VERTEX_SNAP_DISTANCE_FACTOR)},pn.prototype.addCollinear=function(n){this._li.computeIntersection(this._s0,this._s1,this._s1,this._s2),this._li.getIntersectionNum()>=2&&(this._bufParams.getJoinStyle()===We.JOIN_BEVEL||this._bufParams.getJoinStyle()===We.JOIN_MITRE?(n&&this._segList.addPt(this._offset0.p1),this._segList.addPt(this._offset1.p0)):this.addFilletCorner(this._s1,this._offset0.p1,this._offset1.p0,B.CLOCKWISE,this._distance))},pn.prototype.closeRing=function(){this._segList.closeRing()},pn.prototype.hasNarrowConcaveAngle=function(){return this._hasNarrowConcaveAngle},pn.prototype.interfaces_=function(){return[]},pn.prototype.getClass=function(){return pn},Eu.OFFSET_SEGMENT_SEPARATION_FACTOR.get=function(){return .001},Eu.INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR.get=function(){return .001},Eu.CURVE_VERTEX_SNAP_DISTANCE_FACTOR.get=function(){return 1e-6},Eu.MAX_CLOSING_SEG_LEN_FACTOR.get=function(){return 80},Object.defineProperties(pn,Eu);var Mr=function(){this._distance=0,this._precisionModel=null,this._bufParams=null;var n=arguments[0],i=arguments[1];this._precisionModel=n,this._bufParams=i};Mr.prototype.getOffsetCurve=function(n,i){if(this._distance=i,i===0)return null;var s=i<0,u=Math.abs(i),c=this.getSegGen(u);n.length<=1?this.computePointCurve(n[0],c):this.computeOffsetCurve(n,s,c);var m=c.getCoordinates();return s&&ft.reverse(m),m},Mr.prototype.computeSingleSidedBufferCurve=function(n,i,s){var u=this.simplifyTolerance(this._distance);if(i){s.addSegments(n,!0);var c=Mn.simplify(n,-u),m=c.length-1;s.initSideSegments(c[m],c[m-1],bt.LEFT),s.addFirstSegment();for(var E=m-2;E>=0;E--)s.addNextSegment(c[E],!0)}else{s.addSegments(n,!1);var A=Mn.simplify(n,u),U=A.length-1;s.initSideSegments(A[0],A[1],bt.LEFT),s.addFirstSegment();for(var Z=2;Z<=U;Z++)s.addNextSegment(A[Z],!0)}s.addLastSegment(),s.closeRing()},Mr.prototype.computeRingBufferCurve=function(n,i,s){var u=this.simplifyTolerance(this._distance);i===bt.RIGHT&&(u=-u);var c=Mn.simplify(n,u),m=c.length-1;s.initSideSegments(c[m-1],c[0],i);for(var E=1;E<=m;E++){var A=E!==1;s.addNextSegment(c[E],A)}s.closeRing()},Mr.prototype.computeLineBufferCurve=function(n,i){var s=this.simplifyTolerance(this._distance),u=Mn.simplify(n,s),c=u.length-1;i.initSideSegments(u[0],u[1],bt.LEFT);for(var m=2;m<=c;m++)i.addNextSegment(u[m],!0);i.addLastSegment(),i.addLineEndCap(u[c-1],u[c]);var E=Mn.simplify(n,-s),A=E.length-1;i.initSideSegments(E[A],E[A-1],bt.LEFT);for(var U=A-2;U>=0;U--)i.addNextSegment(E[U],!0);i.addLastSegment(),i.addLineEndCap(E[1],E[0]),i.closeRing()},Mr.prototype.computePointCurve=function(n,i){switch(this._bufParams.getEndCapStyle()){case We.CAP_ROUND:i.createCircle(n);break;case We.CAP_SQUARE:i.createSquare(n)}},Mr.prototype.getLineCurve=function(n,i){if(this._distance=i,i<0&&!this._bufParams.isSingleSided()||i===0)return null;var s=Math.abs(i),u=this.getSegGen(s);if(n.length<=1)this.computePointCurve(n[0],u);else if(this._bufParams.isSingleSided()){var c=i<0;this.computeSingleSidedBufferCurve(n,c,u)}else this.computeLineBufferCurve(n,u);return u.getCoordinates()},Mr.prototype.getBufferParameters=function(){return this._bufParams},Mr.prototype.simplifyTolerance=function(n){return n*this._bufParams.getSimplifyFactor()},Mr.prototype.getRingCurve=function(n,i,s){if(this._distance=s,n.length<=2)return this.getLineCurve(n,s);if(s===0)return Mr.copyCoordinates(n);var u=this.getSegGen(s);return this.computeRingBufferCurve(n,i,u),u.getCoordinates()},Mr.prototype.computeOffsetCurve=function(n,i,s){var u=this.simplifyTolerance(this._distance);if(i){var c=Mn.simplify(n,-u),m=c.length-1;s.initSideSegments(c[m],c[m-1],bt.LEFT),s.addFirstSegment();for(var E=m-2;E>=0;E--)s.addNextSegment(c[E],!0)}else{var A=Mn.simplify(n,u),U=A.length-1;s.initSideSegments(A[0],A[1],bt.LEFT),s.addFirstSegment();for(var Z=2;Z<=U;Z++)s.addNextSegment(A[Z],!0)}s.addLastSegment()},Mr.prototype.getSegGen=function(n){return new pn(this._precisionModel,this._bufParams,n)},Mr.prototype.interfaces_=function(){return[]},Mr.prototype.getClass=function(){return Mr},Mr.copyCoordinates=function(n){for(var i=new Array(n.length).fill(null),s=0;s<i.length;s++)i[s]=new L(n[s]);return i};var Ps=function(){this._subgraphs=null,this._seg=new Zt,this._cga=new B;var n=arguments[0];this._subgraphs=n},Zd={DepthSegment:{configurable:!0}};Ps.prototype.findStabbedSegments=function(){if(arguments.length===1){for(var n=arguments[0],i=new j,s=this._subgraphs.iterator();s.hasNext();){var u=s.next(),c=u.getEnvelope();n.y<c.getMinY()||n.y>c.getMaxY()||this.findStabbedSegments(n,u.getDirectedEdges(),i)}return i}if(arguments.length===3){if(X(arguments[2],wt)&&arguments[0]instanceof L&&arguments[1]instanceof yf){for(var m=arguments[0],E=arguments[1],A=arguments[2],U=E.getEdge().getCoordinates(),Z=0;Z<U.length-1;Z++)if(this._seg.p0=U[Z],this._seg.p1=U[Z+1],this._seg.p0.y>this._seg.p1.y&&this._seg.reverse(),!(Math.max(this._seg.p0.x,this._seg.p1.x)<m.x)&&!(this._seg.isHorizontal()||m.y<this._seg.p0.y||m.y>this._seg.p1.y||B.computeOrientation(this._seg.p0,this._seg.p1,m)===B.RIGHT)){var ut=E.getDepth(bt.LEFT);this._seg.p0.equals(U[Z])||(ut=E.getDepth(bt.RIGHT));var ht=new $o(this._seg,ut);A.add(ht)}}else if(X(arguments[2],wt)&&arguments[0]instanceof L&&X(arguments[1],wt))for(var At=arguments[0],Rt=arguments[1],kt=arguments[2],ee=Rt.iterator();ee.hasNext();){var on=ee.next();on.isForward()&&this.findStabbedSegments(At,on,kt)}}},Ps.prototype.getDepth=function(n){var i=this.findStabbedSegments(n);return i.size()===0?0:di.min(i)._leftDepth},Ps.prototype.interfaces_=function(){return[]},Ps.prototype.getClass=function(){return Ps},Zd.DepthSegment.get=function(){return $o},Object.defineProperties(Ps,Zd);var $o=function(){this._upwardSeg=null,this._leftDepth=null;var n=arguments[0],i=arguments[1];this._upwardSeg=new Zt(n),this._leftDepth=i};$o.prototype.compareTo=function(n){var i=n;if(this._upwardSeg.minX()>=i._upwardSeg.maxX())return 1;if(this._upwardSeg.maxX()<=i._upwardSeg.minX())return-1;var s=this._upwardSeg.orientationIndex(i._upwardSeg);return s!==0||(s=-1*i._upwardSeg.orientationIndex(this._upwardSeg))!=0?s:this._upwardSeg.compareTo(i._upwardSeg)},$o.prototype.compareX=function(n,i){var s=n.p0.compareTo(i.p0);return s!==0?s:n.p1.compareTo(i.p1)},$o.prototype.toString=function(){return this._upwardSeg.toString()},$o.prototype.interfaces_=function(){return[F]},$o.prototype.getClass=function(){return $o};var qe=function(n,i,s){this.p0=n||null,this.p1=i||null,this.p2=s||null};qe.prototype.area=function(){return qe.area(this.p0,this.p1,this.p2)},qe.prototype.signedArea=function(){return qe.signedArea(this.p0,this.p1,this.p2)},qe.prototype.interpolateZ=function(n){if(n===null)throw new C("Supplied point is null.");return qe.interpolateZ(n,this.p0,this.p1,this.p2)},qe.prototype.longestSideLength=function(){return qe.longestSideLength(this.p0,this.p1,this.p2)},qe.prototype.isAcute=function(){return qe.isAcute(this.p0,this.p1,this.p2)},qe.prototype.circumcentre=function(){return qe.circumcentre(this.p0,this.p1,this.p2)},qe.prototype.area3D=function(){return qe.area3D(this.p0,this.p1,this.p2)},qe.prototype.centroid=function(){return qe.centroid(this.p0,this.p1,this.p2)},qe.prototype.inCentre=function(){return qe.inCentre(this.p0,this.p1,this.p2)},qe.prototype.interfaces_=function(){return[]},qe.prototype.getClass=function(){return qe},qe.area=function(n,i,s){return Math.abs(((s.x-n.x)*(i.y-n.y)-(i.x-n.x)*(s.y-n.y))/2)},qe.signedArea=function(n,i,s){return((s.x-n.x)*(i.y-n.y)-(i.x-n.x)*(s.y-n.y))/2},qe.det=function(n,i,s,u){return n*u-i*s},qe.interpolateZ=function(n,i,s,u){var c=i.x,m=i.y,E=s.x-c,A=u.x-c,U=s.y-m,Z=u.y-m,ut=E*Z-A*U,ht=n.x-c,At=n.y-m,Rt=(Z*ht-A*At)/ut,kt=(-U*ht+E*At)/ut;return i.z+Rt*(s.z-i.z)+kt*(u.z-i.z)},qe.longestSideLength=function(n,i,s){var u=n.distance(i),c=i.distance(s),m=s.distance(n),E=u;return c>E&&(E=c),m>E&&(E=m),E},qe.isAcute=function(n,i,s){return!!me.isAcute(n,i,s)&&!!me.isAcute(i,s,n)&&!!me.isAcute(s,n,i)},qe.circumcentre=function(n,i,s){var u=s.x,c=s.y,m=n.x-u,E=n.y-c,A=i.x-u,U=i.y-c,Z=2*qe.det(m,E,A,U),ut=qe.det(E,m*m+E*E,U,A*A+U*U),ht=qe.det(m,m*m+E*E,A,A*A+U*U);return new L(u-ut/Z,c+ht/Z)},qe.perpendicularBisector=function(n,i){var s=i.x-n.x,u=i.y-n.y,c=new ne(n.x+s/2,n.y+u/2,1),m=new ne(n.x-u+s/2,n.y+s+u/2,1);return new ne(c,m)},qe.angleBisector=function(n,i,s){var u=i.distance(n),c=u/(u+i.distance(s)),m=s.x-n.x,E=s.y-n.y;return new L(n.x+c*m,n.y+c*E)},qe.area3D=function(n,i,s){var u=i.x-n.x,c=i.y-n.y,m=i.z-n.z,E=s.x-n.x,A=s.y-n.y,U=s.z-n.z,Z=c*U-m*A,ut=m*E-u*U,ht=u*A-c*E,At=Z*Z+ut*ut+ht*ht,Rt=Math.sqrt(At)/2;return Rt},qe.centroid=function(n,i,s){var u=(n.x+i.x+s.x)/3,c=(n.y+i.y+s.y)/3;return new L(u,c)},qe.inCentre=function(n,i,s){var u=i.distance(s),c=n.distance(s),m=n.distance(i),E=u+c+m,A=(u*n.x+c*i.x+m*s.x)/E,U=(u*n.y+c*i.y+m*s.y)/E;return new L(A,U)};var ii=function(){this._inputGeom=null,this._distance=null,this._curveBuilder=null,this._curveList=new j;var n=arguments[0],i=arguments[1],s=arguments[2];this._inputGeom=n,this._distance=i,this._curveBuilder=s};ii.prototype.addPoint=function(n){if(this._distance<=0)return null;var i=n.getCoordinates(),s=this._curveBuilder.getLineCurve(i,this._distance);this.addCurve(s,k.EXTERIOR,k.INTERIOR)},ii.prototype.addPolygon=function(n){var i=this._distance,s=bt.LEFT;this._distance<0&&(i=-this._distance,s=bt.RIGHT);var u=n.getExteriorRing(),c=ft.removeRepeatedPoints(u.getCoordinates());if(this._distance<0&&this.isErodedCompletely(u,this._distance)||this._distance<=0&&c.length<3)return null;this.addPolygonRing(c,i,s,k.EXTERIOR,k.INTERIOR);for(var m=0;m<n.getNumInteriorRing();m++){var E=n.getInteriorRingN(m),A=ft.removeRepeatedPoints(E.getCoordinates());this._distance>0&&this.isErodedCompletely(E,-this._distance)||this.addPolygonRing(A,i,bt.opposite(s),k.INTERIOR,k.EXTERIOR)}},ii.prototype.isTriangleErodedCompletely=function(n,i){var s=new qe(n[0],n[1],n[2]),u=s.inCentre();return B.distancePointLine(u,s.p0,s.p1)<Math.abs(i)},ii.prototype.addLineString=function(n){if(this._distance<=0&&!this._curveBuilder.getBufferParameters().isSingleSided())return null;var i=ft.removeRepeatedPoints(n.getCoordinates()),s=this._curveBuilder.getLineCurve(i,this._distance);this.addCurve(s,k.EXTERIOR,k.INTERIOR)},ii.prototype.addCurve=function(n,i,s){if(n===null||n.length<2)return null;var u=new wn(n,new rn(0,k.BOUNDARY,i,s));this._curveList.add(u)},ii.prototype.getCurves=function(){return this.add(this._inputGeom),this._curveList},ii.prototype.addPolygonRing=function(n,i,s,u,c){if(i===0&&n.length<sn.MINIMUM_VALID_SIZE)return null;var m=u,E=c;n.length>=sn.MINIMUM_VALID_SIZE&&B.isCCW(n)&&(m=c,E=u,s=bt.opposite(s));var A=this._curveBuilder.getRingCurve(n,s,i);this.addCurve(A,m,E)},ii.prototype.add=function(n){if(n.isEmpty())return null;n instanceof Vt?this.addPolygon(n):n instanceof Bt?this.addLineString(n):n instanceof Qt?this.addPoint(n):n instanceof fe?this.addCollection(n):n instanceof H?this.addCollection(n):n instanceof un?this.addCollection(n):n instanceof Vn&&this.addCollection(n)},ii.prototype.isErodedCompletely=function(n,i){var s=n.getCoordinates();if(s.length<4)return i<0;if(s.length===4)return this.isTriangleErodedCompletely(s,i);var u=n.getEnvelopeInternal(),c=Math.min(u.getHeight(),u.getWidth());return i<0&&2*Math.abs(i)>c},ii.prototype.addCollection=function(n){for(var i=0;i<n.getNumGeometries();i++){var s=n.getGeometryN(i);this.add(s)}},ii.prototype.interfaces_=function(){return[]},ii.prototype.getClass=function(){return ii};var la=function(){};la.prototype.locate=function(n){},la.prototype.interfaces_=function(){return[]},la.prototype.getClass=function(){return la};var zi=function(){this._parent=null,this._atStart=null,this._max=null,this._index=null,this._subcollectionIterator=null;var n=arguments[0];this._parent=n,this._atStart=!0,this._index=0,this._max=n.getNumGeometries()};zi.prototype.next=function(){if(this._atStart)return this._atStart=!1,zi.isAtomic(this._parent)&&this._index++,this._parent;if(this._subcollectionIterator!==null){if(this._subcollectionIterator.hasNext())return this._subcollectionIterator.next();this._subcollectionIterator=null}if(this._index>=this._max)throw new o;var n=this._parent.getGeometryN(this._index++);return n instanceof Vn?(this._subcollectionIterator=new zi(n),this._subcollectionIterator.next()):n},zi.prototype.remove=function(){throw new Error(this.getClass().getName())},zi.prototype.hasNext=function(){if(this._atStart)return!0;if(this._subcollectionIterator!==null){if(this._subcollectionIterator.hasNext())return!0;this._subcollectionIterator=null}return!(this._index>=this._max)},zi.prototype.interfaces_=function(){return[Y]},zi.prototype.getClass=function(){return zi},zi.isAtomic=function(n){return!(n instanceof Vn)};var qr=function(){this._geom=null;var n=arguments[0];this._geom=n};qr.prototype.locate=function(n){return qr.locate(n,this._geom)},qr.prototype.interfaces_=function(){return[la]},qr.prototype.getClass=function(){return qr},qr.isPointInRing=function(n,i){return!!i.getEnvelopeInternal().intersects(n)&&B.isPointInRing(n,i.getCoordinates())},qr.containsPointInPolygon=function(n,i){if(i.isEmpty())return!1;var s=i.getExteriorRing();if(!qr.isPointInRing(n,s))return!1;for(var u=0;u<i.getNumInteriorRing();u++){var c=i.getInteriorRingN(u);if(qr.isPointInRing(n,c))return!1}return!0},qr.containsPoint=function(n,i){if(i instanceof Vt)return qr.containsPointInPolygon(n,i);if(i instanceof Vn)for(var s=new zi(i);s.hasNext();){var u=s.next();if(u!==i&&qr.containsPoint(n,u))return!0}return!1},qr.locate=function(n,i){return i.isEmpty()?k.EXTERIOR:qr.containsPoint(n,i)?k.INTERIOR:k.EXTERIOR};var jn=function(){this._edgeMap=new _,this._edgeList=null,this._ptInAreaLocation=[k.NONE,k.NONE]};jn.prototype.getNextCW=function(n){this.getEdges();var i=this._edgeList.indexOf(n),s=i-1;return i===0&&(s=this._edgeList.size()-1),this._edgeList.get(s)},jn.prototype.propagateSideLabels=function(n){for(var i=k.NONE,s=this.iterator();s.hasNext();){var u=s.next().getLabel();u.isArea(n)&&u.getLocation(n,bt.LEFT)!==k.NONE&&(i=u.getLocation(n,bt.LEFT))}if(i===k.NONE)return null;for(var c=i,m=this.iterator();m.hasNext();){var E=m.next(),A=E.getLabel();if(A.getLocation(n,bt.ON)===k.NONE&&A.setLocation(n,bt.ON,c),A.isArea(n)){var U=A.getLocation(n,bt.LEFT),Z=A.getLocation(n,bt.RIGHT);if(Z!==k.NONE){if(Z!==c)throw new io("side location conflict",E.getCoordinate());U===k.NONE&&b.shouldNeverReachHere("found single null side (at "+E.getCoordinate()+")"),c=U}else b.isTrue(A.getLocation(n,bt.LEFT)===k.NONE,"found single null side"),A.setLocation(n,bt.RIGHT,c),A.setLocation(n,bt.LEFT,c)}}},jn.prototype.getCoordinate=function(){var n=this.iterator();return n.hasNext()?n.next().getCoordinate():null},jn.prototype.print=function(n){Nt.out.println("EdgeEndStar: "+this.getCoordinate());for(var i=this.iterator();i.hasNext();)i.next().print(n)},jn.prototype.isAreaLabelsConsistent=function(n){return this.computeEdgeEndLabels(n.getBoundaryNodeRule()),this.checkAreaLabelsConsistent(0)},jn.prototype.checkAreaLabelsConsistent=function(n){var i=this.getEdges();if(i.size()<=0)return!0;var s=i.size()-1,u=i.get(s).getLabel().getLocation(n,bt.LEFT);b.isTrue(u!==k.NONE,"Found unlabelled area edge");for(var c=u,m=this.iterator();m.hasNext();){var E=m.next().getLabel();b.isTrue(E.isArea(n),"Found non-area edge");var A=E.getLocation(n,bt.LEFT),U=E.getLocation(n,bt.RIGHT);if(A===U||U!==c)return!1;c=A}return!0},jn.prototype.findIndex=function(n){this.iterator();for(var i=0;i<this._edgeList.size();i++)if(this._edgeList.get(i)===n)return i;return-1},jn.prototype.iterator=function(){return this.getEdges().iterator()},jn.prototype.getEdges=function(){return this._edgeList===null&&(this._edgeList=new j(this._edgeMap.values())),this._edgeList},jn.prototype.getLocation=function(n,i,s){return this._ptInAreaLocation[n]===k.NONE&&(this._ptInAreaLocation[n]=qr.locate(i,s[n].getGeometry())),this._ptInAreaLocation[n]},jn.prototype.toString=function(){var n=new pt;n.append("EdgeEndStar: "+this.getCoordinate()),n.append(`\n`);for(var i=this.iterator();i.hasNext();){var s=i.next();n.append(s),n.append(`\n`)}return n.toString()},jn.prototype.computeEdgeEndLabels=function(n){for(var i=this.iterator();i.hasNext();)i.next().computeLabel(n)},jn.prototype.computeLabelling=function(n){this.computeEdgeEndLabels(n[0].getBoundaryNodeRule()),this.propagateSideLabels(0),this.propagateSideLabels(1);for(var i=[!1,!1],s=this.iterator();s.hasNext();)for(var u=s.next().getLabel(),c=0;c<2;c++)u.isLine(c)&&u.getLocation(c)===k.BOUNDARY&&(i[c]=!0);for(var m=this.iterator();m.hasNext();)for(var E=m.next(),A=E.getLabel(),U=0;U<2;U++)if(A.isAnyNull(U)){var Z=k.NONE;if(i[U])Z=k.EXTERIOR;else{var ut=E.getCoordinate();Z=this.getLocation(U,ut,n)}A.setAllLocationsIfNull(U,Z)}},jn.prototype.getDegree=function(){return this._edgeMap.size()},jn.prototype.insertEdgeEnd=function(n,i){this._edgeMap.put(n,i),this._edgeList=null},jn.prototype.interfaces_=function(){return[]},jn.prototype.getClass=function(){return jn};var y1=function(n){function i(){n.call(this),this._resultAreaEdgeList=null,this._label=null,this._SCANNING_FOR_INCOMING=1,this._LINKING_TO_OUTGOING=2}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.linkResultDirectedEdges=function(){this.getResultAreaEdges();for(var s=null,u=null,c=this._SCANNING_FOR_INCOMING,m=0;m<this._resultAreaEdgeList.size();m++){var E=this._resultAreaEdgeList.get(m),A=E.getSym();if(E.getLabel().isArea())switch(s===null&&E.isInResult()&&(s=E),c){case this._SCANNING_FOR_INCOMING:if(!A.isInResult())continue;u=A,c=this._LINKING_TO_OUTGOING;break;case this._LINKING_TO_OUTGOING:if(!E.isInResult())continue;u.setNext(E),c=this._SCANNING_FOR_INCOMING}}if(c===this._LINKING_TO_OUTGOING){if(s===null)throw new io("no outgoing dirEdge found",this.getCoordinate());b.isTrue(s.isInResult(),"unable to link last incoming dirEdge"),u.setNext(s)}},i.prototype.insert=function(s){var u=s;this.insertEdgeEnd(u,u)},i.prototype.getRightmostEdge=function(){var s=this.getEdges(),u=s.size();if(u<1)return null;var c=s.get(0);if(u===1)return c;var m=s.get(u-1),E=c.getQuadrant(),A=m.getQuadrant();return ln.isNorthern(E)&&ln.isNorthern(A)?c:ln.isNorthern(E)||ln.isNorthern(A)?c.getDy()!==0?c:m.getDy()!==0?m:(b.shouldNeverReachHere("found two horizontal edges incident on node"),null):m},i.prototype.print=function(s){Nt.out.println("DirectedEdgeStar: "+this.getCoordinate());for(var u=this.iterator();u.hasNext();){var c=u.next();s.print("out "),c.print(s),s.println(),s.print("in "),c.getSym().print(s),s.println()}},i.prototype.getResultAreaEdges=function(){if(this._resultAreaEdgeList!==null)return this._resultAreaEdgeList;this._resultAreaEdgeList=new j;for(var s=this.iterator();s.hasNext();){var u=s.next();(u.isInResult()||u.getSym().isInResult())&&this._resultAreaEdgeList.add(u)}return this._resultAreaEdgeList},i.prototype.updateLabelling=function(s){for(var u=this.iterator();u.hasNext();){var c=u.next().getLabel();c.setAllLocationsIfNull(0,s.getLocation(0)),c.setAllLocationsIfNull(1,s.getLocation(1))}},i.prototype.linkAllDirectedEdges=function(){this.getEdges();for(var s=null,u=null,c=this._edgeList.size()-1;c>=0;c--){var m=this._edgeList.get(c),E=m.getSym();u===null&&(u=E),s!==null&&E.setNext(s),s=m}u.setNext(s)},i.prototype.computeDepths=function(){if(arguments.length===1){var s=arguments[0],u=this.findIndex(s),c=s.getDepth(bt.LEFT),m=s.getDepth(bt.RIGHT),E=this.computeDepths(u+1,this._edgeList.size(),c);if(this.computeDepths(0,u,E)!==m)throw new io("depth mismatch at "+s.getCoordinate())}else if(arguments.length===3){for(var A=arguments[0],U=arguments[1],Z=arguments[2],ut=A;ut<U;ut++){var ht=this._edgeList.get(ut);ht.setEdgeDepths(bt.RIGHT,Z),Z=ht.getDepth(bt.LEFT)}return Z}},i.prototype.mergeSymLabels=function(){for(var s=this.iterator();s.hasNext();){var u=s.next();u.getLabel().merge(u.getSym().getLabel())}},i.prototype.linkMinimalDirectedEdges=function(s){for(var u=null,c=null,m=this._SCANNING_FOR_INCOMING,E=this._resultAreaEdgeList.size()-1;E>=0;E--){var A=this._resultAreaEdgeList.get(E),U=A.getSym();switch(u===null&&A.getEdgeRing()===s&&(u=A),m){case this._SCANNING_FOR_INCOMING:if(U.getEdgeRing()!==s)continue;c=U,m=this._LINKING_TO_OUTGOING;break;case this._LINKING_TO_OUTGOING:if(A.getEdgeRing()!==s)continue;c.setNextMin(A),m=this._SCANNING_FOR_INCOMING}}m===this._LINKING_TO_OUTGOING&&(b.isTrue(u!==null,"found null for first outgoing dirEdge"),b.isTrue(u.getEdgeRing()===s,"unable to link last incoming dirEdge"),c.setNextMin(u))},i.prototype.getOutgoingDegree=function(){if(arguments.length===0){for(var s=0,u=this.iterator();u.hasNext();)u.next().isInResult()&&s++;return s}if(arguments.length===1){for(var c=arguments[0],m=0,E=this.iterator();E.hasNext();)E.next().getEdgeRing()===c&&m++;return m}},i.prototype.getLabel=function(){return this._label},i.prototype.findCoveredLineEdges=function(){for(var s=k.NONE,u=this.iterator();u.hasNext();){var c=u.next(),m=c.getSym();if(!c.isLineEdge()){if(c.isInResult()){s=k.INTERIOR;break}if(m.isInResult()){s=k.EXTERIOR;break}}}if(s===k.NONE)return null;for(var E=s,A=this.iterator();A.hasNext();){var U=A.next(),Z=U.getSym();U.isLineEdge()?U.getEdge().setCovered(E===k.INTERIOR):(U.isInResult()&&(E=k.EXTERIOR),Z.isInResult()&&(E=k.INTERIOR))}},i.prototype.computeLabelling=function(s){n.prototype.computeLabelling.call(this,s),this._label=new rn(k.NONE);for(var u=this.iterator();u.hasNext();)for(var c=u.next().getEdge().getLabel(),m=0;m<2;m++){var E=c.getLocation(m);E!==k.INTERIOR&&E!==k.BOUNDARY||this._label.setLocation(m,k.INTERIOR)}},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(jn),Jd=function(n){function i(){n.apply(this,arguments)}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.createNode=function(s){return new El(s,new y1)},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(sa),wo=function n(){this._pts=null,this._orientation=null;var i=arguments[0];this._pts=i,this._orientation=n.orientation(i)};wo.prototype.compareTo=function(n){var i=n;return wo.compareOriented(this._pts,this._orientation,i._pts,i._orientation)},wo.prototype.interfaces_=function(){return[F]},wo.prototype.getClass=function(){return wo},wo.orientation=function(n){return ft.increasingDirection(n)===1},wo.compareOriented=function(n,i,s,u){for(var c=i?1:-1,m=u?1:-1,E=i?n.length:-1,A=u?s.length:-1,U=i?0:n.length-1,Z=u?0:s.length-1;;){var ut=n[U].compareTo(s[Z]);if(ut!==0)return ut;var ht=(U+=c)===E,At=(Z+=m)===A;if(ht&&!At)return-1;if(!ht&&At)return 1;if(ht&&At)return 0}};var mi=function(){this._edges=new j,this._ocaMap=new _};mi.prototype.print=function(n){n.print("MULTILINESTRING ( ");for(var i=0;i<this._edges.size();i++){var s=this._edges.get(i);i>0&&n.print(","),n.print("(");for(var u=s.getCoordinates(),c=0;c<u.length;c++)c>0&&n.print(","),n.print(u[c].x+" "+u[c].y);n.println(")")}n.print(") ")},mi.prototype.addAll=function(n){for(var i=n.iterator();i.hasNext();)this.add(i.next())},mi.prototype.findEdgeIndex=function(n){for(var i=0;i<this._edges.size();i++)if(this._edges.get(i).equals(n))return i;return-1},mi.prototype.iterator=function(){return this._edges.iterator()},mi.prototype.getEdges=function(){return this._edges},mi.prototype.get=function(n){return this._edges.get(n)},mi.prototype.findEqualEdge=function(n){var i=new wo(n.getCoordinates());return this._ocaMap.get(i)},mi.prototype.add=function(n){this._edges.add(n);var i=new wo(n.getCoordinates());this._ocaMap.put(i,n)},mi.prototype.interfaces_=function(){return[]},mi.prototype.getClass=function(){return mi};var Ko=function(){};Ko.prototype.processIntersections=function(n,i,s,u){},Ko.prototype.isDone=function(){},Ko.prototype.interfaces_=function(){return[]},Ko.prototype.getClass=function(){return Ko};var Xr=function(){this._hasIntersection=!1,this._hasProper=!1,this._hasProperInterior=!1,this._hasInterior=!1,this._properIntersectionPoint=null,this._li=null,this._isSelfIntersection=null,this.numIntersections=0,this.numInteriorIntersections=0,this.numProperIntersections=0,this.numTests=0;var n=arguments[0];this._li=n};Xr.prototype.isTrivialIntersection=function(n,i,s,u){if(n===s&&this._li.getIntersectionNum()===1){if(Xr.isAdjacentSegments(i,u))return!0;if(n.isClosed()){var c=n.size()-1;if(i===0&&u===c||u===0&&i===c)return!0}}return!1},Xr.prototype.getProperIntersectionPoint=function(){return this._properIntersectionPoint},Xr.prototype.hasProperInteriorIntersection=function(){return this._hasProperInterior},Xr.prototype.getLineIntersector=function(){return this._li},Xr.prototype.hasProperIntersection=function(){return this._hasProper},Xr.prototype.processIntersections=function(n,i,s,u){if(n===s&&i===u)return null;this.numTests++;var c=n.getCoordinates()[i],m=n.getCoordinates()[i+1],E=s.getCoordinates()[u],A=s.getCoordinates()[u+1];this._li.computeIntersection(c,m,E,A),this._li.hasIntersection()&&(this.numIntersections++,this._li.isInteriorIntersection()&&(this.numInteriorIntersections++,this._hasInterior=!0),this.isTrivialIntersection(n,i,s,u)||(this._hasIntersection=!0,n.addIntersections(this._li,i,0),s.addIntersections(this._li,u,1),this._li.isProper()&&(this.numProperIntersections++,this._hasProper=!0,this._hasProperInterior=!0)))},Xr.prototype.hasIntersection=function(){return this._hasIntersection},Xr.prototype.isDone=function(){return!1},Xr.prototype.hasInteriorIntersection=function(){return this._hasInterior},Xr.prototype.interfaces_=function(){return[Ko]},Xr.prototype.getClass=function(){return Xr},Xr.isAdjacentSegments=function(n,i){return Math.abs(n-i)===1};var Ai=function(){this.coord=null,this.segmentIndex=null,this.dist=null;var n=arguments[0],i=arguments[1],s=arguments[2];this.coord=new L(n),this.segmentIndex=i,this.dist=s};Ai.prototype.getSegmentIndex=function(){return this.segmentIndex},Ai.prototype.getCoordinate=function(){return this.coord},Ai.prototype.print=function(n){n.print(this.coord),n.print(" seg # = "+this.segmentIndex),n.println(" dist = "+this.dist)},Ai.prototype.compareTo=function(n){var i=n;return this.compare(i.segmentIndex,i.dist)},Ai.prototype.isEndPoint=function(n){return this.segmentIndex===0&&this.dist===0||this.segmentIndex===n},Ai.prototype.toString=function(){return this.coord+" seg # = "+this.segmentIndex+" dist = "+this.dist},Ai.prototype.getDistance=function(){return this.dist},Ai.prototype.compare=function(n,i){return this.segmentIndex<n?-1:this.segmentIndex>n?1:this.dist<i?-1:this.dist>i?1:0},Ai.prototype.interfaces_=function(){return[F]},Ai.prototype.getClass=function(){return Ai};var ki=function(){this._nodeMap=new _,this.edge=null;var n=arguments[0];this.edge=n};ki.prototype.print=function(n){n.println("Intersections:");for(var i=this.iterator();i.hasNext();)i.next().print(n)},ki.prototype.iterator=function(){return this._nodeMap.values().iterator()},ki.prototype.addSplitEdges=function(n){this.addEndpoints();for(var i=this.iterator(),s=i.next();i.hasNext();){var u=i.next(),c=this.createSplitEdge(s,u);n.add(c),s=u}},ki.prototype.addEndpoints=function(){var n=this.edge.pts.length-1;this.add(this.edge.pts[0],0,0),this.add(this.edge.pts[n],n,0)},ki.prototype.createSplitEdge=function(n,i){var s=i.segmentIndex-n.segmentIndex+2,u=this.edge.pts[i.segmentIndex],c=i.dist>0||!i.coord.equals2D(u);c||s--;var m=new Array(s).fill(null),E=0;m[E++]=new L(n.coord);for(var A=n.segmentIndex+1;A<=i.segmentIndex;A++)m[E++]=this.edge.pts[A];return c&&(m[E]=i.coord),new Sl(m,new rn(this.edge._label))},ki.prototype.add=function(n,i,s){var u=new Ai(n,i,s),c=this._nodeMap.get(u);return c!==null?c:(this._nodeMap.put(u,u),u)},ki.prototype.isIntersection=function(n){for(var i=this.iterator();i.hasNext();)if(i.next().coord.equals(n))return!0;return!1},ki.prototype.interfaces_=function(){return[]},ki.prototype.getClass=function(){return ki};var jo=function(){};jo.prototype.getChainStartIndices=function(n){var i=0,s=new j;s.add(new et(i));do{var u=this.findChainEnd(n,i);s.add(new et(u)),i=u}while(i<n.length-1);return jo.toIntArray(s)},jo.prototype.findChainEnd=function(n,i){for(var s=ln.quadrant(n[i],n[i+1]),u=i+1;u<n.length&&ln.quadrant(n[u-1],n[u])===s;)u++;return u-1},jo.prototype.interfaces_=function(){return[]},jo.prototype.getClass=function(){return jo},jo.toIntArray=function(n){for(var i=new Array(n.size()).fill(null),s=0;s<i.length;s++)i[s]=n.get(s).intValue();return i};var ao=function(){this.e=null,this.pts=null,this.startIndex=null,this.env1=new Pt,this.env2=new Pt;var n=arguments[0];this.e=n,this.pts=n.getCoordinates();var i=new jo;this.startIndex=i.getChainStartIndices(this.pts)};ao.prototype.getCoordinates=function(){return this.pts},ao.prototype.getMaxX=function(n){var i=this.pts[this.startIndex[n]].x,s=this.pts[this.startIndex[n+1]].x;return i>s?i:s},ao.prototype.getMinX=function(n){var i=this.pts[this.startIndex[n]].x,s=this.pts[this.startIndex[n+1]].x;return i<s?i:s},ao.prototype.computeIntersectsForChain=function(){if(arguments.length===4){var n=arguments[0],i=arguments[1],s=arguments[2],u=arguments[3];this.computeIntersectsForChain(this.startIndex[n],this.startIndex[n+1],i,i.startIndex[s],i.startIndex[s+1],u)}else if(arguments.length===6){var c=arguments[0],m=arguments[1],E=arguments[2],A=arguments[3],U=arguments[4],Z=arguments[5],ut=this.pts[c],ht=this.pts[m],At=E.pts[A],Rt=E.pts[U];if(m-c==1&&U-A==1)return Z.addIntersections(this.e,c,E.e,A),null;if(this.env1.init(ut,ht),this.env2.init(At,Rt),!this.env1.intersects(this.env2))return null;var kt=Math.trunc((c+m)/2),ee=Math.trunc((A+U)/2);c<kt&&(A<ee&&this.computeIntersectsForChain(c,kt,E,A,ee,Z),ee<U&&this.computeIntersectsForChain(c,kt,E,ee,U,Z)),kt<m&&(A<ee&&this.computeIntersectsForChain(kt,m,E,A,ee,Z),ee<U&&this.computeIntersectsForChain(kt,m,E,ee,U,Z))}},ao.prototype.getStartIndexes=function(){return this.startIndex},ao.prototype.computeIntersects=function(n,i){for(var s=0;s<this.startIndex.length-1;s++)for(var u=0;u<n.startIndex.length-1;u++)this.computeIntersectsForChain(s,n,u,i)},ao.prototype.interfaces_=function(){return[]},ao.prototype.getClass=function(){return ao};var Hn=function n(){this._depth=Array(2).fill().map(function(){return Array(3)});for(var i=0;i<2;i++)for(var s=0;s<3;s++)this._depth[i][s]=n.NULL_VALUE},$d={NULL_VALUE:{configurable:!0}};Hn.prototype.getDepth=function(n,i){return this._depth[n][i]},Hn.prototype.setDepth=function(n,i,s){this._depth[n][i]=s},Hn.prototype.isNull=function(){if(arguments.length===0){for(var n=0;n<2;n++)for(var i=0;i<3;i++)if(this._depth[n][i]!==Hn.NULL_VALUE)return!1;return!0}if(arguments.length===1){var s=arguments[0];return this._depth[s][1]===Hn.NULL_VALUE}if(arguments.length===2){var u=arguments[0],c=arguments[1];return this._depth[u][c]===Hn.NULL_VALUE}},Hn.prototype.normalize=function(){for(var n=0;n<2;n++)if(!this.isNull(n)){var i=this._depth[n][1];this._depth[n][2]<i&&(i=this._depth[n][2]),i<0&&(i=0);for(var s=1;s<3;s++){var u=0;this._depth[n][s]>i&&(u=1),this._depth[n][s]=u}}},Hn.prototype.getDelta=function(n){return this._depth[n][bt.RIGHT]-this._depth[n][bt.LEFT]},Hn.prototype.getLocation=function(n,i){return this._depth[n][i]<=0?k.EXTERIOR:k.INTERIOR},Hn.prototype.toString=function(){return"A: "+this._depth[0][1]+","+this._depth[0][2]+" B: "+this._depth[1][1]+","+this._depth[1][2]},Hn.prototype.add=function(){if(arguments.length===1)for(var n=arguments[0],i=0;i<2;i++)for(var s=1;s<3;s++){var u=n.getLocation(i,s);u!==k.EXTERIOR&&u!==k.INTERIOR||(this.isNull(i,s)?this._depth[i][s]=Hn.depthAtLocation(u):this._depth[i][s]+=Hn.depthAtLocation(u))}else if(arguments.length===3){var c=arguments[0],m=arguments[1];arguments[2]===k.INTERIOR&&this._depth[c][m]++}},Hn.prototype.interfaces_=function(){return[]},Hn.prototype.getClass=function(){return Hn},Hn.depthAtLocation=function(n){return n===k.EXTERIOR?0:n===k.INTERIOR?1:Hn.NULL_VALUE},$d.NULL_VALUE.get=function(){return-1},Object.defineProperties(Hn,$d);var Sl=function(n){function i(){if(n.call(this),this.pts=null,this._env=null,this.eiList=new ki(this),this._name=null,this._mce=null,this._isIsolated=!0,this._depth=new Hn,this._depthDelta=0,arguments.length===1){var s=arguments[0];i.call(this,s,null)}else if(arguments.length===2){var u=arguments[0],c=arguments[1];this.pts=u,this._label=c}}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.getDepth=function(){return this._depth},i.prototype.getCollapsedEdge=function(){var s=new Array(2).fill(null);return s[0]=this.pts[0],s[1]=this.pts[1],new i(s,rn.toLineLabel(this._label))},i.prototype.isIsolated=function(){return this._isIsolated},i.prototype.getCoordinates=function(){return this.pts},i.prototype.setIsolated=function(s){this._isIsolated=s},i.prototype.setName=function(s){this._name=s},i.prototype.equals=function(s){if(!(s instanceof i))return!1;var u=s;if(this.pts.length!==u.pts.length)return!1;for(var c=!0,m=!0,E=this.pts.length,A=0;A<this.pts.length;A++)if(this.pts[A].equals2D(u.pts[A])||(c=!1),this.pts[A].equals2D(u.pts[--E])||(m=!1),!c&&!m)return!1;return!0},i.prototype.getCoordinate=function(){if(arguments.length===0)return this.pts.length>0?this.pts[0]:null;if(arguments.length===1){var s=arguments[0];return this.pts[s]}},i.prototype.print=function(s){s.print("edge "+this._name+": "),s.print("LINESTRING (");for(var u=0;u<this.pts.length;u++)u>0&&s.print(","),s.print(this.pts[u].x+" "+this.pts[u].y);s.print(") "+this._label+" "+this._depthDelta)},i.prototype.computeIM=function(s){i.updateIM(this._label,s)},i.prototype.isCollapsed=function(){return!!this._label.isArea()&&this.pts.length===3&&!!this.pts[0].equals(this.pts[2])},i.prototype.isClosed=function(){return this.pts[0].equals(this.pts[this.pts.length-1])},i.prototype.getMaximumSegmentIndex=function(){return this.pts.length-1},i.prototype.getDepthDelta=function(){return this._depthDelta},i.prototype.getNumPoints=function(){return this.pts.length},i.prototype.printReverse=function(s){s.print("edge "+this._name+": ");for(var u=this.pts.length-1;u>=0;u--)s.print(this.pts[u]+" ");s.println("")},i.prototype.getMonotoneChainEdge=function(){return this._mce===null&&(this._mce=new ao(this)),this._mce},i.prototype.getEnvelope=function(){if(this._env===null){this._env=new Pt;for(var s=0;s<this.pts.length;s++)this._env.expandToInclude(this.pts[s])}return this._env},i.prototype.addIntersection=function(s,u,c,m){var E=new L(s.getIntersection(m)),A=u,U=s.getEdgeDistance(c,m),Z=A+1;if(Z<this.pts.length){var ut=this.pts[Z];E.equals2D(ut)&&(A=Z,U=0)}this.eiList.add(E,A,U)},i.prototype.toString=function(){var s=new pt;s.append("edge "+this._name+": "),s.append("LINESTRING (");for(var u=0;u<this.pts.length;u++)u>0&&s.append(","),s.append(this.pts[u].x+" "+this.pts[u].y);return s.append(") "+this._label+" "+this._depthDelta),s.toString()},i.prototype.isPointwiseEqual=function(s){if(this.pts.length!==s.pts.length)return!1;for(var u=0;u<this.pts.length;u++)if(!this.pts[u].equals2D(s.pts[u]))return!1;return!0},i.prototype.setDepthDelta=function(s){this._depthDelta=s},i.prototype.getEdgeIntersectionList=function(){return this.eiList},i.prototype.addIntersections=function(s,u,c){for(var m=0;m<s.getIntersectionNum();m++)this.addIntersection(s,u,c,m)},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i.updateIM=function(){if(arguments.length!==2)return n.prototype.updateIM.apply(this,arguments);var s=arguments[0],u=arguments[1];u.setAtLeastIfValid(s.getLocation(0,bt.ON),s.getLocation(1,bt.ON),1),s.isArea()&&(u.setAtLeastIfValid(s.getLocation(0,bt.LEFT),s.getLocation(1,bt.LEFT),2),u.setAtLeastIfValid(s.getLocation(0,bt.RIGHT),s.getLocation(1,bt.RIGHT),2))},i}(Hr),ur=function(n){this._workingPrecisionModel=null,this._workingNoder=null,this._geomFact=null,this._graph=null,this._edgeList=new mi,this._bufParams=n||null};ur.prototype.setWorkingPrecisionModel=function(n){this._workingPrecisionModel=n},ur.prototype.insertUniqueEdge=function(n){var i=this._edgeList.findEqualEdge(n);if(i!==null){var s=i.getLabel(),u=n.getLabel();i.isPointwiseEqual(n)||(u=new rn(n.getLabel())).flip(),s.merge(u);var c=ur.depthDelta(u),m=i.getDepthDelta()+c;i.setDepthDelta(m)}else this._edgeList.add(n),n.setDepthDelta(ur.depthDelta(n.getLabel()))},ur.prototype.buildSubgraphs=function(n,i){for(var s=new j,u=n.iterator();u.hasNext();){var c=u.next(),m=c.getRightmostCoordinate(),E=new Ps(s).getDepth(m);c.computeDepth(E),c.findResultEdges(),s.add(c),i.add(c.getDirectedEdges(),c.getNodes())}},ur.prototype.createSubgraphs=function(n){for(var i=new j,s=n.getNodes().iterator();s.hasNext();){var u=s.next();if(!u.isVisited()){var c=new sr;c.create(u),i.add(c)}}return di.sort(i,di.reverseOrder()),i},ur.prototype.createEmptyResultGeometry=function(){return this._geomFact.createPolygon()},ur.prototype.getNoder=function(n){if(this._workingNoder!==null)return this._workingNoder;var i=new vf,s=new J;return s.setPrecisionModel(n),i.setSegmentIntersector(new Xr(s)),i},ur.prototype.buffer=function(n,i){var s=this._workingPrecisionModel;s===null&&(s=n.getPrecisionModel()),this._geomFact=n.getFactory();var u=new Mr(s,this._bufParams),c=new ii(n,i,u).getCurves();if(c.size()<=0)return this.createEmptyResultGeometry();this.computeNodedEdges(c,s),this._graph=new _n(new Jd),this._graph.addEdges(this._edgeList.getEdges());var m=this.createSubgraphs(this._graph),E=new Nr(this._geomFact);this.buildSubgraphs(m,E);var A=E.getPolygons();return A.size()<=0?this.createEmptyResultGeometry():this._geomFact.buildGeometry(A)},ur.prototype.computeNodedEdges=function(n,i){var s=this.getNoder(i);s.computeNodes(n);for(var u=s.getNodedSubstrings().iterator();u.hasNext();){var c=u.next(),m=c.getCoordinates();if(m.length!==2||!m[0].equals2D(m[1])){var E=c.getData(),A=new Sl(c.getCoordinates(),new rn(E));this.insertUniqueEdge(A)}}},ur.prototype.setNoder=function(n){this._workingNoder=n},ur.prototype.interfaces_=function(){return[]},ur.prototype.getClass=function(){return ur},ur.depthDelta=function(n){var i=n.getLocation(0,bt.LEFT),s=n.getLocation(0,bt.RIGHT);return i===k.INTERIOR&&s===k.EXTERIOR?1:i===k.EXTERIOR&&s===k.INTERIOR?-1:0},ur.convertSegStrings=function(n){for(var i=new le,s=new j;n.hasNext();){var u=n.next(),c=i.createLineString(u.getCoordinates());s.add(c)}return i.buildGeometry(s)};var bo=function(){if(this._noder=null,this._scaleFactor=null,this._offsetX=null,this._offsetY=null,this._isScaled=!1,arguments.length===2){var n=arguments[0],i=arguments[1];this._noder=n,this._scaleFactor=i,this._offsetX=0,this._offsetY=0,this._isScaled=!this.isIntegerPrecision()}else if(arguments.length===4){var s=arguments[0],u=arguments[1],c=arguments[2],m=arguments[3];this._noder=s,this._scaleFactor=u,this._offsetX=c,this._offsetY=m,this._isScaled=!this.isIntegerPrecision()}};bo.prototype.rescale=function(){if(X(arguments[0],Ot))for(var n=arguments[0].iterator();n.hasNext();){var i=n.next();this.rescale(i.getCoordinates())}else if(arguments[0]instanceof Array){for(var s=arguments[0],u=0;u<s.length;u++)s[u].x=s[u].x/this._scaleFactor+this._offsetX,s[u].y=s[u].y/this._scaleFactor+this._offsetY;s.length===2&&s[0].equals2D(s[1])&&Nt.out.println(s)}},bo.prototype.scale=function(){if(X(arguments[0],Ot)){for(var n=arguments[0],i=new j,s=n.iterator();s.hasNext();){var u=s.next();i.add(new wn(this.scale(u.getCoordinates()),u.getData()))}return i}if(arguments[0]instanceof Array){for(var c=arguments[0],m=new Array(c.length).fill(null),E=0;E<c.length;E++)m[E]=new L(Math.round((c[E].x-this._offsetX)*this._scaleFactor),Math.round((c[E].y-this._offsetY)*this._scaleFactor),c[E].z);return ft.removeRepeatedPoints(m)}},bo.prototype.isIntegerPrecision=function(){return this._scaleFactor===1},bo.prototype.getNodedSubstrings=function(){var n=this._noder.getNodedSubstrings();return this._isScaled&&this.rescale(n),n},bo.prototype.computeNodes=function(n){var i=n;this._isScaled&&(i=this.scale(n)),this._noder.computeNodes(i)},bo.prototype.interfaces_=function(){return[Jo]},bo.prototype.getClass=function(){return bo};var Ci=function(){this._li=new J,this._segStrings=null;var n=arguments[0];this._segStrings=n},Kd={fact:{configurable:!0}};Ci.prototype.checkEndPtVertexIntersections=function(){if(arguments.length===0)for(var n=this._segStrings.iterator();n.hasNext();){var i=n.next().getCoordinates();this.checkEndPtVertexIntersections(i[0],this._segStrings),this.checkEndPtVertexIntersections(i[i.length-1],this._segStrings)}else if(arguments.length===2){for(var s=arguments[0],u=arguments[1].iterator();u.hasNext();)for(var c=u.next().getCoordinates(),m=1;m<c.length-1;m++)if(c[m].equals(s))throw new $("found endpt/interior pt intersection at index "+m+" :pt "+s)}},Ci.prototype.checkInteriorIntersections=function(){if(arguments.length===0)for(var n=this._segStrings.iterator();n.hasNext();)for(var i=n.next(),s=this._segStrings.iterator();s.hasNext();){var u=s.next();this.checkInteriorIntersections(i,u)}else if(arguments.length===2)for(var c=arguments[0],m=arguments[1],E=c.getCoordinates(),A=m.getCoordinates(),U=0;U<E.length-1;U++)for(var Z=0;Z<A.length-1;Z++)this.checkInteriorIntersections(c,U,m,Z);else if(arguments.length===4){var ut=arguments[0],ht=arguments[1],At=arguments[2],Rt=arguments[3];if(ut===At&&ht===Rt)return null;var kt=ut.getCoordinates()[ht],ee=ut.getCoordinates()[ht+1],on=At.getCoordinates()[Rt],In=At.getCoordinates()[Rt+1];if(this._li.computeIntersection(kt,ee,on,In),this._li.hasIntersection()&&(this._li.isProper()||this.hasInteriorIntersection(this._li,kt,ee)||this.hasInteriorIntersection(this._li,on,In)))throw new $("found non-noded intersection at "+kt+"-"+ee+" and "+on+"-"+In)}},Ci.prototype.checkValid=function(){this.checkEndPtVertexIntersections(),this.checkInteriorIntersections(),this.checkCollapses()},Ci.prototype.checkCollapses=function(){if(arguments.length===0)for(var n=this._segStrings.iterator();n.hasNext();){var i=n.next();this.checkCollapses(i)}else if(arguments.length===1)for(var s=arguments[0].getCoordinates(),u=0;u<s.length-2;u++)this.checkCollapse(s[u],s[u+1],s[u+2])},Ci.prototype.hasInteriorIntersection=function(n,i,s){for(var u=0;u<n.getIntersectionNum();u++){var c=n.getIntersection(u);if(!c.equals(i)&&!c.equals(s))return!0}return!1},Ci.prototype.checkCollapse=function(n,i,s){if(n.equals(s))throw new $("found non-noded collapse at "+Ci.fact.createLineString([n,i,s]))},Ci.prototype.interfaces_=function(){return[]},Ci.prototype.getClass=function(){return Ci},Kd.fact.get=function(){return new le},Object.defineProperties(Ci,Kd);var Sr=function(){this._li=null,this._pt=null,this._originalPt=null,this._ptScaled=null,this._p0Scaled=null,this._p1Scaled=null,this._scaleFactor=null,this._minx=null,this._maxx=null,this._miny=null,this._maxy=null,this._corner=new Array(4).fill(null),this._safeEnv=null;var n=arguments[0],i=arguments[1],s=arguments[2];if(this._originalPt=n,this._pt=n,this._scaleFactor=i,this._li=s,i<=0)throw new C("Scale factor must be non-zero");i!==1&&(this._pt=new L(this.scale(n.x),this.scale(n.y)),this._p0Scaled=new L,this._p1Scaled=new L),this.initCorners(this._pt)},jd={SAFE_ENV_EXPANSION_FACTOR:{configurable:!0}};Sr.prototype.intersectsScaled=function(n,i){var s=Math.min(n.x,i.x),u=Math.max(n.x,i.x),c=Math.min(n.y,i.y),m=Math.max(n.y,i.y),E=this._maxx<s||this._minx>u||this._maxy<c||this._miny>m;if(E)return!1;var A=this.intersectsToleranceSquare(n,i);return b.isTrue(!(E&&A),"Found bad envelope test"),A},Sr.prototype.initCorners=function(n){this._minx=n.x-.5,this._maxx=n.x+.5,this._miny=n.y-.5,this._maxy=n.y+.5,this._corner[0]=new L(this._maxx,this._maxy),this._corner[1]=new L(this._minx,this._maxy),this._corner[2]=new L(this._minx,this._miny),this._corner[3]=new L(this._maxx,this._miny)},Sr.prototype.intersects=function(n,i){return this._scaleFactor===1?this.intersectsScaled(n,i):(this.copyScaled(n,this._p0Scaled),this.copyScaled(i,this._p1Scaled),this.intersectsScaled(this._p0Scaled,this._p1Scaled))},Sr.prototype.scale=function(n){return Math.round(n*this._scaleFactor)},Sr.prototype.getCoordinate=function(){return this._originalPt},Sr.prototype.copyScaled=function(n,i){i.x=this.scale(n.x),i.y=this.scale(n.y)},Sr.prototype.getSafeEnvelope=function(){if(this._safeEnv===null){var n=Sr.SAFE_ENV_EXPANSION_FACTOR/this._scaleFactor;this._safeEnv=new Pt(this._originalPt.x-n,this._originalPt.x+n,this._originalPt.y-n,this._originalPt.y+n)}return this._safeEnv},Sr.prototype.intersectsPixelClosure=function(n,i){return this._li.computeIntersection(n,i,this._corner[0],this._corner[1]),!!this._li.hasIntersection()||(this._li.computeIntersection(n,i,this._corner[1],this._corner[2]),!!this._li.hasIntersection()||(this._li.computeIntersection(n,i,this._corner[2],this._corner[3]),!!this._li.hasIntersection()||(this._li.computeIntersection(n,i,this._corner[3],this._corner[0]),!!this._li.hasIntersection())))},Sr.prototype.intersectsToleranceSquare=function(n,i){var s=!1,u=!1;return this._li.computeIntersection(n,i,this._corner[0],this._corner[1]),!!this._li.isProper()||(this._li.computeIntersection(n,i,this._corner[1],this._corner[2]),!!this._li.isProper()||(this._li.hasIntersection()&&(s=!0),this._li.computeIntersection(n,i,this._corner[2],this._corner[3]),!!this._li.isProper()||(this._li.hasIntersection()&&(u=!0),this._li.computeIntersection(n,i,this._corner[3],this._corner[0]),!!this._li.isProper()||!(!s||!u)||!!n.equals(this._pt)||!!i.equals(this._pt))))},Sr.prototype.addSnappedNode=function(n,i){var s=n.getCoordinate(i),u=n.getCoordinate(i+1);return!!this.intersects(s,u)&&(n.addIntersection(this.getCoordinate(),i),!0)},Sr.prototype.interfaces_=function(){return[]},Sr.prototype.getClass=function(){return Sr},jd.SAFE_ENV_EXPANSION_FACTOR.get=function(){return .75},Object.defineProperties(Sr,jd);var Mu=function(){this.tempEnv1=new Pt,this.selectedSegment=new Zt};Mu.prototype.select=function(){if(arguments.length!==1){if(arguments.length===2){var n=arguments[0],i=arguments[1];n.getLineSegment(i,this.selectedSegment),this.select(this.selectedSegment)}}},Mu.prototype.interfaces_=function(){return[]},Mu.prototype.getClass=function(){return Mu};var ca=function(){this._index=null;var n=arguments[0];this._index=n},Qd={HotPixelSnapAction:{configurable:!0}};ca.prototype.snap=function(){if(arguments.length===1){var n=arguments[0];return this.snap(n,null,-1)}if(arguments.length===3){var i=arguments[0],s=arguments[1],u=arguments[2],c=i.getSafeEnvelope(),m=new tm(i,s,u);return this._index.query(c,{interfaces_:function(){return[Mo]},visitItem:function(E){E.select(c,m)}}),m.isNodeAdded()}},ca.prototype.interfaces_=function(){return[]},ca.prototype.getClass=function(){return ca},Qd.HotPixelSnapAction.get=function(){return tm},Object.defineProperties(ca,Qd);var tm=function(n){function i(){n.call(this),this._hotPixel=null,this._parentEdge=null,this._hotPixelVertexIndex=null,this._isNodeAdded=!1;var s=arguments[0],u=arguments[1],c=arguments[2];this._hotPixel=s,this._parentEdge=u,this._hotPixelVertexIndex=c}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.isNodeAdded=function(){return this._isNodeAdded},i.prototype.select=function(){if(arguments.length!==2)return n.prototype.select.apply(this,arguments);var s=arguments[0],u=arguments[1],c=s.getContext();if(this._parentEdge!==null&&c===this._parentEdge&&u===this._hotPixelVertexIndex)return null;this._isNodeAdded=this._hotPixel.addSnappedNode(c,u)},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(Mu),Is=function(){this._li=null,this._interiorIntersections=null;var n=arguments[0];this._li=n,this._interiorIntersections=new j};Is.prototype.processIntersections=function(n,i,s,u){if(n===s&&i===u)return null;var c=n.getCoordinates()[i],m=n.getCoordinates()[i+1],E=s.getCoordinates()[u],A=s.getCoordinates()[u+1];if(this._li.computeIntersection(c,m,E,A),this._li.hasIntersection()&&this._li.isInteriorIntersection()){for(var U=0;U<this._li.getIntersectionNum();U++)this._interiorIntersections.add(this._li.getIntersection(U));n.addIntersections(this._li,i,0),s.addIntersections(this._li,u,1)}},Is.prototype.isDone=function(){return!1},Is.prototype.getInteriorIntersections=function(){return this._interiorIntersections},Is.prototype.interfaces_=function(){return[Ko]},Is.prototype.getClass=function(){return Is};var Gi=function(){this._pm=null,this._li=null,this._scaleFactor=null,this._noder=null,this._pointSnapper=null,this._nodedSegStrings=null;var n=arguments[0];this._pm=n,this._li=new J,this._li.setPrecisionModel(n),this._scaleFactor=n.getScale()};Gi.prototype.checkCorrectness=function(n){var i=wn.getNodedSubstrings(n),s=new Ci(i);try{s.checkValid()}catch(u){if(!(u instanceof Yt))throw u;u.printStackTrace()}},Gi.prototype.getNodedSubstrings=function(){return wn.getNodedSubstrings(this._nodedSegStrings)},Gi.prototype.snapRound=function(n,i){var s=this.findInteriorIntersections(n,i);this.computeIntersectionSnaps(s),this.computeVertexSnaps(n)},Gi.prototype.findInteriorIntersections=function(n,i){var s=new Is(i);return this._noder.setSegmentIntersector(s),this._noder.computeNodes(n),s.getInteriorIntersections()},Gi.prototype.computeVertexSnaps=function(){if(X(arguments[0],Ot))for(var n=arguments[0].iterator();n.hasNext();){var i=n.next();this.computeVertexSnaps(i)}else if(arguments[0]instanceof wn)for(var s=arguments[0],u=s.getCoordinates(),c=0;c<u.length;c++){var m=new Sr(u[c],this._scaleFactor,this._li);this._pointSnapper.snap(m,s,c)&&s.addIntersection(u[c],c)}},Gi.prototype.computeNodes=function(n){this._nodedSegStrings=n,this._noder=new vf,this._pointSnapper=new ca(this._noder.getIndex()),this.snapRound(n,this._li)},Gi.prototype.computeIntersectionSnaps=function(n){for(var i=n.iterator();i.hasNext();){var s=i.next(),u=new Sr(s,this._scaleFactor,this._li);this._pointSnapper.snap(u)}},Gi.prototype.interfaces_=function(){return[Jo]},Gi.prototype.getClass=function(){return Gi};var Wn=function(){if(this._argGeom=null,this._distance=null,this._bufParams=new We,this._resultGeometry=null,this._saveException=null,arguments.length===1){var n=arguments[0];this._argGeom=n}else if(arguments.length===2){var i=arguments[0],s=arguments[1];this._argGeom=i,this._bufParams=s}},fa={CAP_ROUND:{configurable:!0},CAP_BUTT:{configurable:!0},CAP_FLAT:{configurable:!0},CAP_SQUARE:{configurable:!0},MAX_PRECISION_DIGITS:{configurable:!0}};Wn.prototype.bufferFixedPrecision=function(n){var i=new bo(new Gi(new ie(1)),n.getScale()),s=new ur(this._bufParams);s.setWorkingPrecisionModel(n),s.setNoder(i),this._resultGeometry=s.buffer(this._argGeom,this._distance)},Wn.prototype.bufferReducedPrecision=function(){var n=this;if(arguments.length===0){for(var i=Wn.MAX_PRECISION_DIGITS;i>=0;i--){try{n.bufferReducedPrecision(i)}catch(m){if(!(m instanceof io))throw m;n._saveException=m}if(n._resultGeometry!==null)return null}throw this._saveException}if(arguments.length===1){var s=arguments[0],u=Wn.precisionScaleFactor(this._argGeom,this._distance,s),c=new ie(u);this.bufferFixedPrecision(c)}},Wn.prototype.computeGeometry=function(){if(this.bufferOriginalPrecision(),this._resultGeometry!==null)return null;var n=this._argGeom.getFactory().getPrecisionModel();n.getType()===ie.FIXED?this.bufferFixedPrecision(n):this.bufferReducedPrecision()},Wn.prototype.setQuadrantSegments=function(n){this._bufParams.setQuadrantSegments(n)},Wn.prototype.bufferOriginalPrecision=function(){try{var n=new ur(this._bufParams);this._resultGeometry=n.buffer(this._argGeom,this._distance)}catch(i){if(!(i instanceof $))throw i;this._saveException=i}},Wn.prototype.getResultGeometry=function(n){return this._distance=n,this.computeGeometry(),this._resultGeometry},Wn.prototype.setEndCapStyle=function(n){this._bufParams.setEndCapStyle(n)},Wn.prototype.interfaces_=function(){return[]},Wn.prototype.getClass=function(){return Wn},Wn.bufferOp=function(){if(arguments.length===2){var n=arguments[0],i=arguments[1];return new Wn(n).getResultGeometry(i)}if(arguments.length===3){if(Number.isInteger(arguments[2])&&arguments[0]instanceof Q&&typeof arguments[1]=="number"){var s=arguments[0],u=arguments[1],c=arguments[2],m=new Wn(s);return m.setQuadrantSegments(c),m.getResultGeometry(u)}if(arguments[2]instanceof We&&arguments[0]instanceof Q&&typeof arguments[1]=="number"){var E=arguments[0],A=arguments[1],U=arguments[2];return new Wn(E,U).getResultGeometry(A)}}else if(arguments.length===4){var Z=arguments[0],ut=arguments[1],ht=arguments[2],At=arguments[3],Rt=new Wn(Z);return Rt.setQuadrantSegments(ht),Rt.setEndCapStyle(At),Rt.getResultGeometry(ut)}},Wn.precisionScaleFactor=function(n,i,s){var u=n.getEnvelopeInternal(),c=it.max(Math.abs(u.getMaxX()),Math.abs(u.getMaxY()),Math.abs(u.getMinX()),Math.abs(u.getMinY()))+2*(i>0?i:0),m=s-Math.trunc(Math.log(c)/Math.log(10)+1);return Math.pow(10,m)},fa.CAP_ROUND.get=function(){return We.CAP_ROUND},fa.CAP_BUTT.get=function(){return We.CAP_FLAT},fa.CAP_FLAT.get=function(){return We.CAP_FLAT},fa.CAP_SQUARE.get=function(){return We.CAP_SQUARE},fa.MAX_PRECISION_DIGITS.get=function(){return 12},Object.defineProperties(Wn,fa);var lr=function(){this._pt=[new L,new L],this._distance=S.NaN,this._isNull=!0};lr.prototype.getCoordinates=function(){return this._pt},lr.prototype.getCoordinate=function(n){return this._pt[n]},lr.prototype.setMinimum=function(){if(arguments.length===1){var n=arguments[0];this.setMinimum(n._pt[0],n._pt[1])}else if(arguments.length===2){var i=arguments[0],s=arguments[1];if(this._isNull)return this.initialize(i,s),null;var u=i.distance(s);u<this._distance&&this.initialize(i,s,u)}},lr.prototype.initialize=function(){if(arguments.length===0)this._isNull=!0;else if(arguments.length===2){var n=arguments[0],i=arguments[1];this._pt[0].setCoordinate(n),this._pt[1].setCoordinate(i),this._distance=n.distance(i),this._isNull=!1}else if(arguments.length===3){var s=arguments[0],u=arguments[1],c=arguments[2];this._pt[0].setCoordinate(s),this._pt[1].setCoordinate(u),this._distance=c,this._isNull=!1}},lr.prototype.getDistance=function(){return this._distance},lr.prototype.setMaximum=function(){if(arguments.length===1){var n=arguments[0];this.setMaximum(n._pt[0],n._pt[1])}else if(arguments.length===2){var i=arguments[0],s=arguments[1];if(this._isNull)return this.initialize(i,s),null;var u=i.distance(s);u>this._distance&&this.initialize(i,s,u)}},lr.prototype.interfaces_=function(){return[]},lr.prototype.getClass=function(){return lr};var Vi=function(){};Vi.prototype.interfaces_=function(){return[]},Vi.prototype.getClass=function(){return Vi},Vi.computeDistance=function(){if(arguments[2]instanceof lr&&arguments[0]instanceof Bt&&arguments[1]instanceof L)for(var n=arguments[0],i=arguments[1],s=arguments[2],u=n.getCoordinates(),c=new Zt,m=0;m<u.length-1;m++){c.setCoordinates(u[m],u[m+1]);var E=c.closestPoint(i);s.setMinimum(E,i)}else if(arguments[2]instanceof lr&&arguments[0]instanceof Vt&&arguments[1]instanceof L){var A=arguments[0],U=arguments[1],Z=arguments[2];Vi.computeDistance(A.getExteriorRing(),U,Z);for(var ut=0;ut<A.getNumInteriorRing();ut++)Vi.computeDistance(A.getInteriorRingN(ut),U,Z)}else if(arguments[2]instanceof lr&&arguments[0]instanceof Q&&arguments[1]instanceof L){var ht=arguments[0],At=arguments[1],Rt=arguments[2];if(ht instanceof Bt)Vi.computeDistance(ht,At,Rt);else if(ht instanceof Vt)Vi.computeDistance(ht,At,Rt);else if(ht instanceof Vn)for(var kt=ht,ee=0;ee<kt.getNumGeometries();ee++){var on=kt.getGeometryN(ee);Vi.computeDistance(on,At,Rt)}else Rt.setMinimum(ht.getCoordinate(),At)}else if(arguments[2]instanceof lr&&arguments[0]instanceof Zt&&arguments[1]instanceof L){var In=arguments[0],pr=arguments[1],Xi=arguments[2],Lo=In.closestPoint(pr);Xi.setMinimum(Lo,pr)}};var Qo=function(n){this._maxPtDist=new lr,this._inputGeom=n||null},_f={MaxPointDistanceFilter:{configurable:!0},MaxMidpointDistanceFilter:{configurable:!0}};Qo.prototype.computeMaxMidpointDistance=function(n){var i=new To(this._inputGeom);n.apply(i),this._maxPtDist.setMaximum(i.getMaxPointDistance())},Qo.prototype.computeMaxVertexDistance=function(n){var i=new Rs(this._inputGeom);n.apply(i),this._maxPtDist.setMaximum(i.getMaxPointDistance())},Qo.prototype.findDistance=function(n){return this.computeMaxVertexDistance(n),this.computeMaxMidpointDistance(n),this._maxPtDist.getDistance()},Qo.prototype.getDistancePoints=function(){return this._maxPtDist},Qo.prototype.interfaces_=function(){return[]},Qo.prototype.getClass=function(){return Qo},_f.MaxPointDistanceFilter.get=function(){return Rs},_f.MaxMidpointDistanceFilter.get=function(){return To},Object.defineProperties(Qo,_f);var Rs=function(n){this._maxPtDist=new lr,this._minPtDist=new lr,this._geom=n||null};Rs.prototype.filter=function(n){this._minPtDist.initialize(),Vi.computeDistance(this._geom,n,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)},Rs.prototype.getMaxPointDistance=function(){return this._maxPtDist},Rs.prototype.interfaces_=function(){return[Mt]},Rs.prototype.getClass=function(){return Rs};var To=function(n){this._maxPtDist=new lr,this._minPtDist=new lr,this._geom=n||null};To.prototype.filter=function(n,i){if(i===0)return null;var s=n.getCoordinate(i-1),u=n.getCoordinate(i),c=new L((s.x+u.x)/2,(s.y+u.y)/2);this._minPtDist.initialize(),Vi.computeDistance(this._geom,c,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)},To.prototype.isDone=function(){return!1},To.prototype.isGeometryChanged=function(){return!1},To.prototype.getMaxPointDistance=function(){return this._maxPtDist},To.prototype.interfaces_=function(){return[Vr]},To.prototype.getClass=function(){return To};var uo=function(n){this._comps=n||null};uo.prototype.filter=function(n){n instanceof Vt&&this._comps.add(n)},uo.prototype.interfaces_=function(){return[ei]},uo.prototype.getClass=function(){return uo},uo.getPolygons=function(){if(arguments.length===1){var n=arguments[0];return uo.getPolygons(n,new j)}if(arguments.length===2){var i=arguments[0],s=arguments[1];return i instanceof Vt?s.add(i):i instanceof Vn&&i.apply(new uo(s)),s}};var qn=function(){if(this._lines=null,this._isForcedToLineString=!1,arguments.length===1){var n=arguments[0];this._lines=n}else if(arguments.length===2){var i=arguments[0],s=arguments[1];this._lines=i,this._isForcedToLineString=s}};qn.prototype.filter=function(n){if(this._isForcedToLineString&&n instanceof sn){var i=n.getFactory().createLineString(n.getCoordinateSequence());return this._lines.add(i),null}n instanceof Bt&&this._lines.add(n)},qn.prototype.setForceToLineString=function(n){this._isForcedToLineString=n},qn.prototype.interfaces_=function(){return[ct]},qn.prototype.getClass=function(){return qn},qn.getGeometry=function(){if(arguments.length===1){var n=arguments[0];return n.getFactory().buildGeometry(qn.getLines(n))}if(arguments.length===2){var i=arguments[0],s=arguments[1];return i.getFactory().buildGeometry(qn.getLines(i,s))}},qn.getLines=function(){if(arguments.length===1){var n=arguments[0];return qn.getLines(n,!1)}if(arguments.length===2){if(X(arguments[0],Ot)&&X(arguments[1],Ot)){for(var i=arguments[0],s=arguments[1],u=i.iterator();u.hasNext();){var c=u.next();qn.getLines(c,s)}return s}if(arguments[0]instanceof Q&&typeof arguments[1]=="boolean"){var m=arguments[0],E=arguments[1],A=new j;return m.apply(new qn(A,E)),A}if(arguments[0]instanceof Q&&X(arguments[1],Ot)){var U=arguments[0],Z=arguments[1];return U instanceof Bt?Z.add(U):U.apply(new qn(Z)),Z}}else if(arguments.length===3){if(typeof arguments[2]=="boolean"&&X(arguments[0],Ot)&&X(arguments[1],Ot)){for(var ut=arguments[0],ht=arguments[1],At=arguments[2],Rt=ut.iterator();Rt.hasNext();){var kt=Rt.next();qn.getLines(kt,ht,At)}return ht}if(typeof arguments[2]=="boolean"&&arguments[0]instanceof Q&&X(arguments[1],Ot)){var ee=arguments[0],on=arguments[1],In=arguments[2];return ee.apply(new qn(on,In)),on}}};var gi=function(){if(this._boundaryRule=Lt.OGC_SFS_BOUNDARY_RULE,this._isIn=null,this._numBoundaries=null,arguments.length!==0){if(arguments.length===1){var n=arguments[0];if(n===null)throw new C("Rule must be non-null");this._boundaryRule=n}}};gi.prototype.locateInternal=function(){if(arguments[0]instanceof L&&arguments[1]instanceof Vt){var n=arguments[0],i=arguments[1];if(i.isEmpty())return k.EXTERIOR;var s=i.getExteriorRing(),u=this.locateInPolygonRing(n,s);if(u===k.EXTERIOR)return k.EXTERIOR;if(u===k.BOUNDARY)return k.BOUNDARY;for(var c=0;c<i.getNumInteriorRing();c++){var m=i.getInteriorRingN(c),E=this.locateInPolygonRing(n,m);if(E===k.INTERIOR)return k.EXTERIOR;if(E===k.BOUNDARY)return k.BOUNDARY}return k.INTERIOR}if(arguments[0]instanceof L&&arguments[1]instanceof Bt){var A=arguments[0],U=arguments[1];if(!U.getEnvelopeInternal().intersects(A))return k.EXTERIOR;var Z=U.getCoordinates();return U.isClosed()||!A.equals(Z[0])&&!A.equals(Z[Z.length-1])?B.isOnLine(A,Z)?k.INTERIOR:k.EXTERIOR:k.BOUNDARY}if(arguments[0]instanceof L&&arguments[1]instanceof Qt){var ut=arguments[0];return arguments[1].getCoordinate().equals2D(ut)?k.INTERIOR:k.EXTERIOR}},gi.prototype.locateInPolygonRing=function(n,i){return i.getEnvelopeInternal().intersects(n)?B.locatePointInRing(n,i.getCoordinates()):k.EXTERIOR},gi.prototype.intersects=function(n,i){return this.locate(n,i)!==k.EXTERIOR},gi.prototype.updateLocationInfo=function(n){n===k.INTERIOR&&(this._isIn=!0),n===k.BOUNDARY&&this._numBoundaries++},gi.prototype.computeLocation=function(n,i){if(i instanceof Qt&&this.updateLocationInfo(this.locateInternal(n,i)),i instanceof Bt)this.updateLocationInfo(this.locateInternal(n,i));else if(i instanceof Vt)this.updateLocationInfo(this.locateInternal(n,i));else if(i instanceof H)for(var s=i,u=0;u<s.getNumGeometries();u++){var c=s.getGeometryN(u);this.updateLocationInfo(this.locateInternal(n,c))}else if(i instanceof un)for(var m=i,E=0;E<m.getNumGeometries();E++){var A=m.getGeometryN(E);this.updateLocationInfo(this.locateInternal(n,A))}else if(i instanceof Vn)for(var U=new zi(i);U.hasNext();){var Z=U.next();Z!==i&&this.computeLocation(n,Z)}},gi.prototype.locate=function(n,i){return i.isEmpty()?k.EXTERIOR:i instanceof Bt?this.locateInternal(n,i):i instanceof Vt?this.locateInternal(n,i):(this._isIn=!1,this._numBoundaries=0,this.computeLocation(n,i),this._boundaryRule.isInBoundary(this._numBoundaries)?k.BOUNDARY:this._numBoundaries>0||this._isIn?k.INTERIOR:k.EXTERIOR)},gi.prototype.interfaces_=function(){return[]},gi.prototype.getClass=function(){return gi};var cr=function n(){if(this._component=null,this._segIndex=null,this._pt=null,arguments.length===2){var i=arguments[0],s=arguments[1];n.call(this,i,n.INSIDE_AREA,s)}else if(arguments.length===3){var u=arguments[0],c=arguments[1],m=arguments[2];this._component=u,this._segIndex=c,this._pt=m}},em={INSIDE_AREA:{configurable:!0}};cr.prototype.isInsideArea=function(){return this._segIndex===cr.INSIDE_AREA},cr.prototype.getCoordinate=function(){return this._pt},cr.prototype.getGeometryComponent=function(){return this._component},cr.prototype.getSegmentIndex=function(){return this._segIndex},cr.prototype.interfaces_=function(){return[]},cr.prototype.getClass=function(){return cr},em.INSIDE_AREA.get=function(){return-1},Object.defineProperties(cr,em);var Ao=function(n){this._pts=n||null};Ao.prototype.filter=function(n){n instanceof Qt&&this._pts.add(n)},Ao.prototype.interfaces_=function(){return[ei]},Ao.prototype.getClass=function(){return Ao},Ao.getPoints=function(){if(arguments.length===1){var n=arguments[0];return n instanceof Qt?di.singletonList(n):Ao.getPoints(n,new j)}if(arguments.length===2){var i=arguments[0],s=arguments[1];return i instanceof Qt?s.add(i):i instanceof Vn&&i.apply(new Ao(s)),s}};var Ls=function(){this._locations=null;var n=arguments[0];this._locations=n};Ls.prototype.filter=function(n){(n instanceof Qt||n instanceof Bt||n instanceof Vt)&&this._locations.add(new cr(n,0,n.getCoordinate()))},Ls.prototype.interfaces_=function(){return[ei]},Ls.prototype.getClass=function(){return Ls},Ls.getLocations=function(n){var i=new j;return n.apply(new Ls(i)),i};var Xn=function(){if(this._geom=null,this._terminateDistance=0,this._ptLocator=new gi,this._minDistanceLocation=null,this._minDistance=S.MAX_VALUE,arguments.length===2){var n=arguments[0],i=arguments[1];this._geom=[n,i],this._terminateDistance=0}else if(arguments.length===3){var s=arguments[0],u=arguments[1],c=arguments[2];this._geom=new Array(2).fill(null),this._geom[0]=s,this._geom[1]=u,this._terminateDistance=c}};Xn.prototype.computeContainmentDistance=function(){if(arguments.length===0){var n=new Array(2).fill(null);if(this.computeContainmentDistance(0,n),this._minDistance<=this._terminateDistance)return null;this.computeContainmentDistance(1,n)}else if(arguments.length===2){var i=arguments[0],s=arguments[1],u=1-i,c=uo.getPolygons(this._geom[i]);if(c.size()>0){var m=Ls.getLocations(this._geom[u]);if(this.computeContainmentDistance(m,c,s),this._minDistance<=this._terminateDistance)return this._minDistanceLocation[u]=s[0],this._minDistanceLocation[i]=s[1],null}}else if(arguments.length===3){if(arguments[2]instanceof Array&&X(arguments[0],wt)&&X(arguments[1],wt)){for(var E=arguments[0],A=arguments[1],U=arguments[2],Z=0;Z<E.size();Z++)for(var ut=E.get(Z),ht=0;ht<A.size();ht++)if(this.computeContainmentDistance(ut,A.get(ht),U),this._minDistance<=this._terminateDistance)return null}else if(arguments[2]instanceof Array&&arguments[0]instanceof cr&&arguments[1]instanceof Vt){var At=arguments[0],Rt=arguments[1],kt=arguments[2],ee=At.getCoordinate();if(k.EXTERIOR!==this._ptLocator.locate(ee,Rt))return this._minDistance=0,kt[0]=At,kt[1]=new cr(Rt,ee),null}}},Xn.prototype.computeMinDistanceLinesPoints=function(n,i,s){for(var u=0;u<n.size();u++)for(var c=n.get(u),m=0;m<i.size();m++){var E=i.get(m);if(this.computeMinDistance(c,E,s),this._minDistance<=this._terminateDistance)return null}},Xn.prototype.computeFacetDistance=function(){var n=new Array(2).fill(null),i=qn.getLines(this._geom[0]),s=qn.getLines(this._geom[1]),u=Ao.getPoints(this._geom[0]),c=Ao.getPoints(this._geom[1]);return this.computeMinDistanceLines(i,s,n),this.updateMinDistance(n,!1),this._minDistance<=this._terminateDistance?null:(n[0]=null,n[1]=null,this.computeMinDistanceLinesPoints(i,c,n),this.updateMinDistance(n,!1),this._minDistance<=this._terminateDistance?null:(n[0]=null,n[1]=null,this.computeMinDistanceLinesPoints(s,u,n),this.updateMinDistance(n,!0),this._minDistance<=this._terminateDistance?null:(n[0]=null,n[1]=null,this.computeMinDistancePoints(u,c,n),void this.updateMinDistance(n,!1))))},Xn.prototype.nearestLocations=function(){return this.computeMinDistance(),this._minDistanceLocation},Xn.prototype.updateMinDistance=function(n,i){if(n[0]===null)return null;i?(this._minDistanceLocation[0]=n[1],this._minDistanceLocation[1]=n[0]):(this._minDistanceLocation[0]=n[0],this._minDistanceLocation[1]=n[1])},Xn.prototype.nearestPoints=function(){return this.computeMinDistance(),[this._minDistanceLocation[0].getCoordinate(),this._minDistanceLocation[1].getCoordinate()]},Xn.prototype.computeMinDistance=function(){if(arguments.length===0){if(this._minDistanceLocation!==null||(this._minDistanceLocation=new Array(2).fill(null),this.computeContainmentDistance(),this._minDistance<=this._terminateDistance))return null;this.computeFacetDistance()}else if(arguments.length===3){if(arguments[2]instanceof Array&&arguments[0]instanceof Bt&&arguments[1]instanceof Qt){var n=arguments[0],i=arguments[1],s=arguments[2];if(n.getEnvelopeInternal().distance(i.getEnvelopeInternal())>this._minDistance)return null;for(var u=n.getCoordinates(),c=i.getCoordinate(),m=0;m<u.length-1;m++){var E=B.distancePointLine(c,u[m],u[m+1]);if(E<this._minDistance){this._minDistance=E;var A=new Zt(u[m],u[m+1]).closestPoint(c);s[0]=new cr(n,m,A),s[1]=new cr(i,0,c)}if(this._minDistance<=this._terminateDistance)return null}}else if(arguments[2]instanceof Array&&arguments[0]instanceof Bt&&arguments[1]instanceof Bt){var U=arguments[0],Z=arguments[1],ut=arguments[2];if(U.getEnvelopeInternal().distance(Z.getEnvelopeInternal())>this._minDistance)return null;for(var ht=U.getCoordinates(),At=Z.getCoordinates(),Rt=0;Rt<ht.length-1;Rt++)for(var kt=0;kt<At.length-1;kt++){var ee=B.distanceLineLine(ht[Rt],ht[Rt+1],At[kt],At[kt+1]);if(ee<this._minDistance){this._minDistance=ee;var on=new Zt(ht[Rt],ht[Rt+1]),In=new Zt(At[kt],At[kt+1]),pr=on.closestPoints(In);ut[0]=new cr(U,Rt,pr[0]),ut[1]=new cr(Z,kt,pr[1])}if(this._minDistance<=this._terminateDistance)return null}}}},Xn.prototype.computeMinDistancePoints=function(n,i,s){for(var u=0;u<n.size();u++)for(var c=n.get(u),m=0;m<i.size();m++){var E=i.get(m),A=c.getCoordinate().distance(E.getCoordinate());if(A<this._minDistance&&(this._minDistance=A,s[0]=new cr(c,0,c.getCoordinate()),s[1]=new cr(E,0,E.getCoordinate())),this._minDistance<=this._terminateDistance)return null}},Xn.prototype.distance=function(){if(this._geom[0]===null||this._geom[1]===null)throw new C("null geometries are not supported");return this._geom[0].isEmpty()||this._geom[1].isEmpty()?0:(this.computeMinDistance(),this._minDistance)},Xn.prototype.computeMinDistanceLines=function(n,i,s){for(var u=0;u<n.size();u++)for(var c=n.get(u),m=0;m<i.size();m++){var E=i.get(m);if(this.computeMinDistance(c,E,s),this._minDistance<=this._terminateDistance)return null}},Xn.prototype.interfaces_=function(){return[]},Xn.prototype.getClass=function(){return Xn},Xn.distance=function(n,i){return new Xn(n,i).distance()},Xn.isWithinDistance=function(n,i,s){return new Xn(n,i,s).distance()<=s},Xn.nearestPoints=function(n,i){return new Xn(n,i).nearestPoints()};var Qn=function(){this._pt=[new L,new L],this._distance=S.NaN,this._isNull=!0};Qn.prototype.getCoordinates=function(){return this._pt},Qn.prototype.getCoordinate=function(n){return this._pt[n]},Qn.prototype.setMinimum=function(){if(arguments.length===1){var n=arguments[0];this.setMinimum(n._pt[0],n._pt[1])}else if(arguments.length===2){var i=arguments[0],s=arguments[1];if(this._isNull)return this.initialize(i,s),null;var u=i.distance(s);u<this._distance&&this.initialize(i,s,u)}},Qn.prototype.initialize=function(){if(arguments.length===0)this._isNull=!0;else if(arguments.length===2){var n=arguments[0],i=arguments[1];this._pt[0].setCoordinate(n),this._pt[1].setCoordinate(i),this._distance=n.distance(i),this._isNull=!1}else if(arguments.length===3){var s=arguments[0],u=arguments[1],c=arguments[2];this._pt[0].setCoordinate(s),this._pt[1].setCoordinate(u),this._distance=c,this._isNull=!1}},Qn.prototype.toString=function(){return qt.toLineString(this._pt[0],this._pt[1])},Qn.prototype.getDistance=function(){return this._distance},Qn.prototype.setMaximum=function(){if(arguments.length===1){var n=arguments[0];this.setMaximum(n._pt[0],n._pt[1])}else if(arguments.length===2){var i=arguments[0],s=arguments[1];if(this._isNull)return this.initialize(i,s),null;var u=i.distance(s);u>this._distance&&this.initialize(i,s,u)}},Qn.prototype.interfaces_=function(){return[]},Qn.prototype.getClass=function(){return Qn};var Pi=function(){};Pi.prototype.interfaces_=function(){return[]},Pi.prototype.getClass=function(){return Pi},Pi.computeDistance=function(){if(arguments[2]instanceof Qn&&arguments[0]instanceof Bt&&arguments[1]instanceof L)for(var n=arguments[0],i=arguments[1],s=arguments[2],u=new Zt,c=n.getCoordinates(),m=0;m<c.length-1;m++){u.setCoordinates(c[m],c[m+1]);var E=u.closestPoint(i);s.setMinimum(E,i)}else if(arguments[2]instanceof Qn&&arguments[0]instanceof Vt&&arguments[1]instanceof L){var A=arguments[0],U=arguments[1],Z=arguments[2];Pi.computeDistance(A.getExteriorRing(),U,Z);for(var ut=0;ut<A.getNumInteriorRing();ut++)Pi.computeDistance(A.getInteriorRingN(ut),U,Z)}else if(arguments[2]instanceof Qn&&arguments[0]instanceof Q&&arguments[1]instanceof L){var ht=arguments[0],At=arguments[1],Rt=arguments[2];if(ht instanceof Bt)Pi.computeDistance(ht,At,Rt);else if(ht instanceof Vt)Pi.computeDistance(ht,At,Rt);else if(ht instanceof Vn)for(var kt=ht,ee=0;ee<kt.getNumGeometries();ee++){var on=kt.getGeometryN(ee);Pi.computeDistance(on,At,Rt)}else Rt.setMinimum(ht.getCoordinate(),At)}else if(arguments[2]instanceof Qn&&arguments[0]instanceof Zt&&arguments[1]instanceof L){var In=arguments[0],pr=arguments[1],Xi=arguments[2],Lo=In.closestPoint(pr);Xi.setMinimum(Lo,pr)}};var oi=function(){this._g0=null,this._g1=null,this._ptDist=new Qn,this._densifyFrac=0;var n=arguments[0],i=arguments[1];this._g0=n,this._g1=i},xf={MaxPointDistanceFilter:{configurable:!0},MaxDensifiedByFractionDistanceFilter:{configurable:!0}};oi.prototype.getCoordinates=function(){return this._ptDist.getCoordinates()},oi.prototype.setDensifyFraction=function(n){if(n>1||n<=0)throw new C("Fraction is not in range (0.0 - 1.0]");this._densifyFrac=n},oi.prototype.compute=function(n,i){this.computeOrientedDistance(n,i,this._ptDist),this.computeOrientedDistance(i,n,this._ptDist)},oi.prototype.distance=function(){return this.compute(this._g0,this._g1),this._ptDist.getDistance()},oi.prototype.computeOrientedDistance=function(n,i,s){var u=new Ns(i);if(n.apply(u),s.setMaximum(u.getMaxPointDistance()),this._densifyFrac>0){var c=new Co(i,this._densifyFrac);n.apply(c),s.setMaximum(c.getMaxPointDistance())}},oi.prototype.orientedDistance=function(){return this.computeOrientedDistance(this._g0,this._g1,this._ptDist),this._ptDist.getDistance()},oi.prototype.interfaces_=function(){return[]},oi.prototype.getClass=function(){return oi},oi.distance=function(){if(arguments.length===2){var n=arguments[0],i=arguments[1];return new oi(n,i).distance()}if(arguments.length===3){var s=arguments[0],u=arguments[1],c=arguments[2],m=new oi(s,u);return m.setDensifyFraction(c),m.distance()}},xf.MaxPointDistanceFilter.get=function(){return Ns},xf.MaxDensifiedByFractionDistanceFilter.get=function(){return Co},Object.defineProperties(oi,xf);var Ns=function(){this._maxPtDist=new Qn,this._minPtDist=new Qn,this._euclideanDist=new Pi,this._geom=null;var n=arguments[0];this._geom=n};Ns.prototype.filter=function(n){this._minPtDist.initialize(),Pi.computeDistance(this._geom,n,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)},Ns.prototype.getMaxPointDistance=function(){return this._maxPtDist},Ns.prototype.interfaces_=function(){return[Mt]},Ns.prototype.getClass=function(){return Ns};var Co=function(){this._maxPtDist=new Qn,this._minPtDist=new Qn,this._geom=null,this._numSubSegs=0;var n=arguments[0],i=arguments[1];this._geom=n,this._numSubSegs=Math.trunc(Math.round(1/i))};Co.prototype.filter=function(n,i){if(i===0)return null;for(var s=n.getCoordinate(i-1),u=n.getCoordinate(i),c=(u.x-s.x)/this._numSubSegs,m=(u.y-s.y)/this._numSubSegs,E=0;E<this._numSubSegs;E++){var A=s.x+E*c,U=s.y+E*m,Z=new L(A,U);this._minPtDist.initialize(),Pi.computeDistance(this._geom,Z,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)}},Co.prototype.isDone=function(){return!1},Co.prototype.isGeometryChanged=function(){return!1},Co.prototype.getMaxPointDistance=function(){return this._maxPtDist},Co.prototype.interfaces_=function(){return[Vr]},Co.prototype.getClass=function(){return Co};var Dr=function(n,i,s){this._minValidDistance=null,this._maxValidDistance=null,this._minDistanceFound=null,this._maxDistanceFound=null,this._isValid=!0,this._errMsg=null,this._errorLocation=null,this._errorIndicator=null,this._input=n||null,this._bufDistance=i||null,this._result=s||null},Ef={VERBOSE:{configurable:!0},MAX_DISTANCE_DIFF_FRAC:{configurable:!0}};Dr.prototype.checkMaximumDistance=function(n,i,s){var u=new oi(i,n);if(u.setDensifyFraction(.25),this._maxDistanceFound=u.orientedDistance(),this._maxDistanceFound>s){this._isValid=!1;var c=u.getCoordinates();this._errorLocation=c[1],this._errorIndicator=n.getFactory().createLineString(c),this._errMsg="Distance between buffer curve and input is too large ("+this._maxDistanceFound+" at "+qt.toLineString(c[0],c[1])+")"}},Dr.prototype.isValid=function(){var n=Math.abs(this._bufDistance),i=Dr.MAX_DISTANCE_DIFF_FRAC*n;return this._minValidDistance=n-i,this._maxValidDistance=n+i,!(!this._input.isEmpty()&&!this._result.isEmpty())||(this._bufDistance>0?this.checkPositiveValid():this.checkNegativeValid(),Dr.VERBOSE&&Nt.out.println("Min Dist= "+this._minDistanceFound+" err= "+(1-this._minDistanceFound/this._bufDistance)+" Max Dist= "+this._maxDistanceFound+" err= "+(this._maxDistanceFound/this._bufDistance-1)),this._isValid)},Dr.prototype.checkNegativeValid=function(){if(!(this._input instanceof Vt||this._input instanceof un||this._input instanceof Vn))return null;var n=this.getPolygonLines(this._input);if(this.checkMinimumDistance(n,this._result,this._minValidDistance),!this._isValid)return null;this.checkMaximumDistance(n,this._result,this._maxValidDistance)},Dr.prototype.getErrorIndicator=function(){return this._errorIndicator},Dr.prototype.checkMinimumDistance=function(n,i,s){var u=new Xn(n,i,s);if(this._minDistanceFound=u.distance(),this._minDistanceFound<s){this._isValid=!1;var c=u.nearestPoints();this._errorLocation=u.nearestPoints()[1],this._errorIndicator=n.getFactory().createLineString(c),this._errMsg="Distance between buffer curve and input is too small ("+this._minDistanceFound+" at "+qt.toLineString(c[0],c[1])+" )"}},Dr.prototype.checkPositiveValid=function(){var n=this._result.getBoundary();if(this.checkMinimumDistance(this._input,n,this._minValidDistance),!this._isValid)return null;this.checkMaximumDistance(this._input,n,this._maxValidDistance)},Dr.prototype.getErrorLocation=function(){return this._errorLocation},Dr.prototype.getPolygonLines=function(n){for(var i=new j,s=new qn(i),u=uo.getPolygons(n).iterator();u.hasNext();)u.next().apply(s);return n.getFactory().buildGeometry(i)},Dr.prototype.getErrorMessage=function(){return this._errMsg},Dr.prototype.interfaces_=function(){return[]},Dr.prototype.getClass=function(){return Dr},Ef.VERBOSE.get=function(){return!1},Ef.MAX_DISTANCE_DIFF_FRAC.get=function(){return .012},Object.defineProperties(Dr,Ef);var Yn=function(n,i,s){this._isValid=!0,this._errorMsg=null,this._errorLocation=null,this._errorIndicator=null,this._input=n||null,this._distance=i||null,this._result=s||null},Mf={VERBOSE:{configurable:!0},MAX_ENV_DIFF_FRAC:{configurable:!0}};Yn.prototype.isValid=function(){return this.checkPolygonal(),this._isValid?(this.checkExpectedEmpty(),this._isValid?(this.checkEnvelope(),this._isValid?(this.checkArea(),this._isValid?(this.checkDistance(),this._isValid):this._isValid):this._isValid):this._isValid):this._isValid},Yn.prototype.checkEnvelope=function(){if(this._distance<0)return null;var n=this._distance*Yn.MAX_ENV_DIFF_FRAC;n===0&&(n=.001);var i=new Pt(this._input.getEnvelopeInternal());i.expandBy(this._distance);var s=new Pt(this._result.getEnvelopeInternal());s.expandBy(n),s.contains(i)||(this._isValid=!1,this._errorMsg="Buffer envelope is incorrect",this._errorIndicator=this._input.getFactory().toGeometry(s)),this.report("Envelope")},Yn.prototype.checkDistance=function(){var n=new Dr(this._input,this._distance,this._result);n.isValid()||(this._isValid=!1,this._errorMsg=n.getErrorMessage(),this._errorLocation=n.getErrorLocation(),this._errorIndicator=n.getErrorIndicator()),this.report("Distance")},Yn.prototype.checkArea=function(){var n=this._input.getArea(),i=this._result.getArea();this._distance>0&&n>i&&(this._isValid=!1,this._errorMsg="Area of positive buffer is smaller than input",this._errorIndicator=this._result),this._distance<0&&n<i&&(this._isValid=!1,this._errorMsg="Area of negative buffer is larger than input",this._errorIndicator=this._result),this.report("Area")},Yn.prototype.checkPolygonal=function(){this._result instanceof Vt||this._result instanceof un||(this._isValid=!1),this._errorMsg="Result is not polygonal",this._errorIndicator=this._result,this.report("Polygonal")},Yn.prototype.getErrorIndicator=function(){return this._errorIndicator},Yn.prototype.getErrorLocation=function(){return this._errorLocation},Yn.prototype.checkExpectedEmpty=function(){return this._input.getDimension()>=2||this._distance>0?null:(this._result.isEmpty()||(this._isValid=!1,this._errorMsg="Result is non-empty",this._errorIndicator=this._result),void this.report("ExpectedEmpty"))},Yn.prototype.report=function(n){if(!Yn.VERBOSE)return null;Nt.out.println("Check "+n+": "+(this._isValid?"passed":"FAILED"))},Yn.prototype.getErrorMessage=function(){return this._errorMsg},Yn.prototype.interfaces_=function(){return[]},Yn.prototype.getClass=function(){return Yn},Yn.isValidMsg=function(n,i,s){var u=new Yn(n,i,s);return u.isValid()?null:u.getErrorMessage()},Yn.isValid=function(n,i,s){return!!new Yn(n,i,s).isValid()},Mf.VERBOSE.get=function(){return!1},Mf.MAX_ENV_DIFF_FRAC.get=function(){return .012},Object.defineProperties(Yn,Mf);var Ii=function(){this._pts=null,this._data=null;var n=arguments[0],i=arguments[1];this._pts=n,this._data=i};Ii.prototype.getCoordinates=function(){return this._pts},Ii.prototype.size=function(){return this._pts.length},Ii.prototype.getCoordinate=function(n){return this._pts[n]},Ii.prototype.isClosed=function(){return this._pts[0].equals(this._pts[this._pts.length-1])},Ii.prototype.getSegmentOctant=function(n){return n===this._pts.length-1?-1:As.octant(this.getCoordinate(n),this.getCoordinate(n+1))},Ii.prototype.setData=function(n){this._data=n},Ii.prototype.getData=function(){return this._data},Ii.prototype.toString=function(){return qt.toLineString(new he(this._pts))},Ii.prototype.interfaces_=function(){return[Bi]},Ii.prototype.getClass=function(){return Ii};var kn=function(){this._findAllIntersections=!1,this._isCheckEndSegmentsOnly=!1,this._li=null,this._interiorIntersection=null,this._intSegments=null,this._intersections=new j,this._intersectionCount=0,this._keepIntersections=!0;var n=arguments[0];this._li=n,this._interiorIntersection=null};kn.prototype.getInteriorIntersection=function(){return this._interiorIntersection},kn.prototype.setCheckEndSegmentsOnly=function(n){this._isCheckEndSegmentsOnly=n},kn.prototype.getIntersectionSegments=function(){return this._intSegments},kn.prototype.count=function(){return this._intersectionCount},kn.prototype.getIntersections=function(){return this._intersections},kn.prototype.setFindAllIntersections=function(n){this._findAllIntersections=n},kn.prototype.setKeepIntersections=function(n){this._keepIntersections=n},kn.prototype.processIntersections=function(n,i,s,u){if(!this._findAllIntersections&&this.hasIntersection()||n===s&&i===u||this._isCheckEndSegmentsOnly&&!(this.isEndSegment(n,i)||this.isEndSegment(s,u)))return null;var c=n.getCoordinates()[i],m=n.getCoordinates()[i+1],E=s.getCoordinates()[u],A=s.getCoordinates()[u+1];this._li.computeIntersection(c,m,E,A),this._li.hasIntersection()&&this._li.isInteriorIntersection()&&(this._intSegments=new Array(4).fill(null),this._intSegments[0]=c,this._intSegments[1]=m,this._intSegments[2]=E,this._intSegments[3]=A,this._interiorIntersection=this._li.getIntersection(0),this._keepIntersections&&this._intersections.add(this._interiorIntersection),this._intersectionCount++)},kn.prototype.isEndSegment=function(n,i){return i===0||i>=n.size()-2},kn.prototype.hasIntersection=function(){return this._interiorIntersection!==null},kn.prototype.isDone=function(){return!this._findAllIntersections&&this._interiorIntersection!==null},kn.prototype.interfaces_=function(){return[Ko]},kn.prototype.getClass=function(){return kn},kn.createAllIntersectionsFinder=function(n){var i=new kn(n);return i.setFindAllIntersections(!0),i},kn.createAnyIntersectionFinder=function(n){return new kn(n)},kn.createIntersectionCounter=function(n){var i=new kn(n);return i.setFindAllIntersections(!0),i.setKeepIntersections(!1),i};var yi=function(){this._li=new J,this._segStrings=null,this._findAllIntersections=!1,this._segInt=null,this._isValid=!0;var n=arguments[0];this._segStrings=n};yi.prototype.execute=function(){if(this._segInt!==null)return null;this.checkInteriorIntersections()},yi.prototype.getIntersections=function(){return this._segInt.getIntersections()},yi.prototype.isValid=function(){return this.execute(),this._isValid},yi.prototype.setFindAllIntersections=function(n){this._findAllIntersections=n},yi.prototype.checkInteriorIntersections=function(){this._isValid=!0,this._segInt=new kn(this._li),this._segInt.setFindAllIntersections(this._findAllIntersections);var n=new vf;if(n.setSegmentIntersector(this._segInt),n.computeNodes(this._segStrings),this._segInt.hasIntersection())return this._isValid=!1,null},yi.prototype.checkValid=function(){if(this.execute(),!this._isValid)throw new io(this.getErrorMessage(),this._segInt.getInteriorIntersection())},yi.prototype.getErrorMessage=function(){if(this._isValid)return"no intersections found";var n=this._segInt.getIntersectionSegments();return"found non-noded intersection between "+qt.toLineString(n[0],n[1])+" and "+qt.toLineString(n[2],n[3])},yi.prototype.interfaces_=function(){return[]},yi.prototype.getClass=function(){return yi},yi.computeIntersections=function(n){var i=new yi(n);return i.setFindAllIntersections(!0),i.isValid(),i.getIntersections()};var ts=function n(){this._nv=null;var i=arguments[0];this._nv=new yi(n.toSegmentStrings(i))};ts.prototype.checkValid=function(){this._nv.checkValid()},ts.prototype.interfaces_=function(){return[]},ts.prototype.getClass=function(){return ts},ts.toSegmentStrings=function(n){for(var i=new j,s=n.iterator();s.hasNext();){var u=s.next();i.add(new Ii(u.getCoordinates(),u))}return i},ts.checkValid=function(n){new ts(n).checkValid()};var Os=function(n){this._mapOp=n};Os.prototype.map=function(n){for(var i=new j,s=0;s<n.getNumGeometries();s++){var u=this._mapOp.map(n.getGeometryN(s));u.isEmpty()||i.add(u)}return n.getFactory().createGeometryCollection(le.toGeometryArray(i))},Os.prototype.interfaces_=function(){return[]},Os.prototype.getClass=function(){return Os},Os.map=function(n,i){return new Os(i).map(n)};var Ri=function(){this._op=null,this._geometryFactory=null,this._ptLocator=null,this._lineEdgesList=new j,this._resultLineList=new j;var n=arguments[0],i=arguments[1],s=arguments[2];this._op=n,this._geometryFactory=i,this._ptLocator=s};Ri.prototype.collectLines=function(n){for(var i=this._op.getGraph().getEdgeEnds().iterator();i.hasNext();){var s=i.next();this.collectLineEdge(s,n,this._lineEdgesList),this.collectBoundaryTouchEdge(s,n,this._lineEdgesList)}},Ri.prototype.labelIsolatedLine=function(n,i){var s=this._ptLocator.locate(n.getCoordinate(),this._op.getArgGeometry(i));n.getLabel().setLocation(i,s)},Ri.prototype.build=function(n){return this.findCoveredLineEdges(),this.collectLines(n),this.buildLines(n),this._resultLineList},Ri.prototype.collectLineEdge=function(n,i,s){var u=n.getLabel(),c=n.getEdge();n.isLineEdge()&&(n.isVisited()||!ae.isResultOfOp(u,i)||c.isCovered()||(s.add(c),n.setVisitedEdge(!0)))},Ri.prototype.findCoveredLineEdges=function(){for(var n=this._op.getGraph().getNodes().iterator();n.hasNext();)n.next().getEdges().findCoveredLineEdges();for(var i=this._op.getGraph().getEdgeEnds().iterator();i.hasNext();){var s=i.next(),u=s.getEdge();if(s.isLineEdge()&&!u.isCoveredSet()){var c=this._op.isCoveredByA(s.getCoordinate());u.setCovered(c)}}},Ri.prototype.labelIsolatedLines=function(n){for(var i=n.iterator();i.hasNext();){var s=i.next(),u=s.getLabel();s.isIsolated()&&(u.isNull(0)?this.labelIsolatedLine(s,0):this.labelIsolatedLine(s,1))}},Ri.prototype.buildLines=function(n){for(var i=this._lineEdgesList.iterator();i.hasNext();){var s=i.next(),u=this._geometryFactory.createLineString(s.getCoordinates());this._resultLineList.add(u),s.setInResult(!0)}},Ri.prototype.collectBoundaryTouchEdge=function(n,i,s){var u=n.getLabel();return n.isLineEdge()||n.isVisited()||n.isInteriorAreaEdge()||n.getEdge().isInResult()?null:(b.isTrue(!(n.isInResult()||n.getSym().isInResult())||!n.getEdge().isInResult()),void(ae.isResultOfOp(u,i)&&i===ae.INTERSECTION&&(s.add(n.getEdge()),n.setVisitedEdge(!0))))},Ri.prototype.interfaces_=function(){return[]},Ri.prototype.getClass=function(){return Ri};var Ds=function(){this._op=null,this._geometryFactory=null,this._resultPointList=new j;var n=arguments[0],i=arguments[1];this._op=n,this._geometryFactory=i};Ds.prototype.filterCoveredNodeToPoint=function(n){var i=n.getCoordinate();if(!this._op.isCoveredByLA(i)){var s=this._geometryFactory.createPoint(i);this._resultPointList.add(s)}},Ds.prototype.extractNonCoveredResultNodes=function(n){for(var i=this._op.getGraph().getNodes().iterator();i.hasNext();){var s=i.next();if(!s.isInResult()&&!s.isIncidentEdgeInResult()&&(s.getEdges().getDegree()===0||n===ae.INTERSECTION)){var u=s.getLabel();ae.isResultOfOp(u,n)&&this.filterCoveredNodeToPoint(s)}}},Ds.prototype.build=function(n){return this.extractNonCoveredResultNodes(n),this._resultPointList},Ds.prototype.interfaces_=function(){return[]},Ds.prototype.getClass=function(){return Ds};var wr=function(){this._inputGeom=null,this._factory=null,this._pruneEmptyGeometry=!0,this._preserveGeometryCollectionType=!0,this._preserveCollections=!1,this._preserveType=!1};wr.prototype.transformPoint=function(n,i){return this._factory.createPoint(this.transformCoordinates(n.getCoordinateSequence(),n))},wr.prototype.transformPolygon=function(n,i){var s=!0,u=this.transformLinearRing(n.getExteriorRing(),n);u!==null&&u instanceof sn&&!u.isEmpty()||(s=!1);for(var c=new j,m=0;m<n.getNumInteriorRing();m++){var E=this.transformLinearRing(n.getInteriorRingN(m),n);E===null||E.isEmpty()||(E instanceof sn||(s=!1),c.add(E))}if(s)return this._factory.createPolygon(u,c.toArray([]));var A=new j;return u!==null&&A.add(u),A.addAll(c),this._factory.buildGeometry(A)},wr.prototype.createCoordinateSequence=function(n){return this._factory.getCoordinateSequenceFactory().create(n)},wr.prototype.getInputGeometry=function(){return this._inputGeom},wr.prototype.transformMultiLineString=function(n,i){for(var s=new j,u=0;u<n.getNumGeometries();u++){var c=this.transformLineString(n.getGeometryN(u),n);c!==null&&(c.isEmpty()||s.add(c))}return this._factory.buildGeometry(s)},wr.prototype.transformCoordinates=function(n,i){return this.copy(n)},wr.prototype.transformLineString=function(n,i){return this._factory.createLineString(this.transformCoordinates(n.getCoordinateSequence(),n))},wr.prototype.transformMultiPoint=function(n,i){for(var s=new j,u=0;u<n.getNumGeometries();u++){var c=this.transformPoint(n.getGeometryN(u),n);c!==null&&(c.isEmpty()||s.add(c))}return this._factory.buildGeometry(s)},wr.prototype.transformMultiPolygon=function(n,i){for(var s=new j,u=0;u<n.getNumGeometries();u++){var c=this.transformPolygon(n.getGeometryN(u),n);c!==null&&(c.isEmpty()||s.add(c))}return this._factory.buildGeometry(s)},wr.prototype.copy=function(n){return n.copy()},wr.prototype.transformGeometryCollection=function(n,i){for(var s=new j,u=0;u<n.getNumGeometries();u++){var c=this.transform(n.getGeometryN(u));c!==null&&(this._pruneEmptyGeometry&&c.isEmpty()||s.add(c))}return this._preserveGeometryCollectionType?this._factory.createGeometryCollection(le.toGeometryArray(s)):this._factory.buildGeometry(s)},wr.prototype.transform=function(n){if(this._inputGeom=n,this._factory=n.getFactory(),n instanceof Qt)return this.transformPoint(n,null);if(n instanceof fe)return this.transformMultiPoint(n,null);if(n instanceof sn)return this.transformLinearRing(n,null);if(n instanceof Bt)return this.transformLineString(n,null);if(n instanceof H)return this.transformMultiLineString(n,null);if(n instanceof Vt)return this.transformPolygon(n,null);if(n instanceof un)return this.transformMultiPolygon(n,null);if(n instanceof Vn)return this.transformGeometryCollection(n,null);throw new C("Unknown Geometry subtype: "+n.getClass().getName())},wr.prototype.transformLinearRing=function(n,i){var s=this.transformCoordinates(n.getCoordinateSequence(),n);if(s===null)return this._factory.createLinearRing(null);var u=s.size();return u>0&&u<4&&!this._preserveType?this._factory.createLineString(s):this._factory.createLinearRing(s)},wr.prototype.interfaces_=function(){return[]},wr.prototype.getClass=function(){return wr};var Hi=function n(){if(this._snapTolerance=0,this._srcPts=null,this._seg=new Zt,this._allowSnappingToSourceVertices=!1,this._isClosed=!1,arguments[0]instanceof Bt&&typeof arguments[1]=="number"){var i=arguments[0],s=arguments[1];n.call(this,i.getCoordinates(),s)}else if(arguments[0]instanceof Array&&typeof arguments[1]=="number"){var u=arguments[0],c=arguments[1];this._srcPts=u,this._isClosed=n.isClosed(u),this._snapTolerance=c}};Hi.prototype.snapVertices=function(n,i){for(var s=this._isClosed?n.size()-1:n.size(),u=0;u<s;u++){var c=n.get(u),m=this.findSnapForVertex(c,i);m!==null&&(n.set(u,new L(m)),u===0&&this._isClosed&&n.set(n.size()-1,new L(m)))}},Hi.prototype.findSnapForVertex=function(n,i){for(var s=0;s<i.length;s++){if(n.equals2D(i[s]))return null;if(n.distance(i[s])<this._snapTolerance)return i[s]}return null},Hi.prototype.snapTo=function(n){var i=new Dt(this._srcPts);return this.snapVertices(i,n),this.snapSegments(i,n),i.toCoordinateArray()},Hi.prototype.snapSegments=function(n,i){if(i.length===0)return null;var s=i.length;i[0].equals2D(i[i.length-1])&&(s=i.length-1);for(var u=0;u<s;u++){var c=i[u],m=this.findSegmentIndexToSnap(c,n);m>=0&&n.add(m+1,new L(c),!1)}},Hi.prototype.findSegmentIndexToSnap=function(n,i){for(var s=S.MAX_VALUE,u=-1,c=0;c<i.size()-1;c++){if(this._seg.p0=i.get(c),this._seg.p1=i.get(c+1),this._seg.p0.equals2D(n)||this._seg.p1.equals2D(n)){if(this._allowSnappingToSourceVertices)continue;return-1}var m=this._seg.distance(n);m<this._snapTolerance&&m<s&&(s=m,u=c)}return u},Hi.prototype.setAllowSnappingToSourceVertices=function(n){this._allowSnappingToSourceVertices=n},Hi.prototype.interfaces_=function(){return[]},Hi.prototype.getClass=function(){return Hi},Hi.isClosed=function(n){return!(n.length<=1)&&n[0].equals2D(n[n.length-1])};var bn=function(n){this._srcGeom=n||null},nm={SNAP_PRECISION_FACTOR:{configurable:!0}};bn.prototype.snapTo=function(n,i){var s=this.extractTargetCoordinates(n);return new rm(i,s).transform(this._srcGeom)},bn.prototype.snapToSelf=function(n,i){var s=this.extractTargetCoordinates(this._srcGeom),u=new rm(n,s,!0).transform(this._srcGeom),c=u;return i&&X(c,ce)&&(c=u.buffer(0)),c},bn.prototype.computeSnapTolerance=function(n){return this.computeMinimumSegmentLength(n)/10},bn.prototype.extractTargetCoordinates=function(n){for(var i=new M,s=n.getCoordinates(),u=0;u<s.length;u++)i.add(s[u]);return i.toArray(new Array(0).fill(null))},bn.prototype.computeMinimumSegmentLength=function(n){for(var i=S.MAX_VALUE,s=0;s<n.length-1;s++){var u=n[s].distance(n[s+1]);u<i&&(i=u)}return i},bn.prototype.interfaces_=function(){return[]},bn.prototype.getClass=function(){return bn},bn.snap=function(n,i,s){var u=new Array(2).fill(null),c=new bn(n);u[0]=c.snapTo(i,s);var m=new bn(i);return u[1]=m.snapTo(u[0],s),u},bn.computeOverlaySnapTolerance=function(){if(arguments.length===1){var n=arguments[0],i=bn.computeSizeBasedSnapTolerance(n),s=n.getPrecisionModel();if(s.getType()===ie.FIXED){var u=1/s.getScale()*2/1.415;u>i&&(i=u)}return i}if(arguments.length===2){var c=arguments[0],m=arguments[1];return Math.min(bn.computeOverlaySnapTolerance(c),bn.computeOverlaySnapTolerance(m))}},bn.computeSizeBasedSnapTolerance=function(n){var i=n.getEnvelopeInternal();return Math.min(i.getHeight(),i.getWidth())*bn.SNAP_PRECISION_FACTOR},bn.snapToSelf=function(n,i,s){return new bn(n).snapToSelf(i,s)},nm.SNAP_PRECISION_FACTOR.get=function(){return 1e-9},Object.defineProperties(bn,nm);var rm=function(n){function i(s,u,c){n.call(this),this._snapTolerance=s||null,this._snapPts=u||null,this._isSelfSnap=c!==void 0&&c}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.snapLine=function(s,u){var c=new Hi(s,this._snapTolerance);return c.setAllowSnappingToSourceVertices(this._isSelfSnap),c.snapTo(u)},i.prototype.transformCoordinates=function(s,u){var c=s.toCoordinateArray(),m=this.snapLine(c,this._snapPts);return this._factory.getCoordinateSequenceFactory().create(m)},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(wr),fr=function(){this._isFirst=!0,this._commonMantissaBitsCount=53,this._commonBits=0,this._commonSignExp=null};fr.prototype.getCommon=function(){return S.longBitsToDouble(this._commonBits)},fr.prototype.add=function(n){var i=S.doubleToLongBits(n);if(this._isFirst)return this._commonBits=i,this._commonSignExp=fr.signExpBits(this._commonBits),this._isFirst=!1,null;if(fr.signExpBits(i)!==this._commonSignExp)return this._commonBits=0,null;this._commonMantissaBitsCount=fr.numCommonMostSigMantissaBits(this._commonBits,i),this._commonBits=fr.zeroLowerBits(this._commonBits,64-(12+this._commonMantissaBitsCount))},fr.prototype.toString=function(){if(arguments.length===1){var n=arguments[0],i=S.longBitsToDouble(n),s="0000000000000000000000000000000000000000000000000000000000000000"+S.toBinaryString(n),u=s.substring(s.length-64);return u.substring(0,1)+" "+u.substring(1,12)+"(exp) "+u.substring(12)+" [ "+i+" ]"}},fr.prototype.interfaces_=function(){return[]},fr.prototype.getClass=function(){return fr},fr.getBit=function(n,i){return n&1<<i?1:0},fr.signExpBits=function(n){return n>>52},fr.zeroLowerBits=function(n,i){return n&~((1<<i)-1)},fr.numCommonMostSigMantissaBits=function(n,i){for(var s=0,u=52;u>=0;u--){if(fr.getBit(n,u)!==fr.getBit(i,u))return s;s++}return 52};var Po=function(){this._commonCoord=null,this._ccFilter=new Fs},Sf={CommonCoordinateFilter:{configurable:!0},Translater:{configurable:!0}};Po.prototype.addCommonBits=function(n){var i=new Io(this._commonCoord);n.apply(i),n.geometryChanged()},Po.prototype.removeCommonBits=function(n){if(this._commonCoord.x===0&&this._commonCoord.y===0)return n;var i=new L(this._commonCoord);i.x=-i.x,i.y=-i.y;var s=new Io(i);return n.apply(s),n.geometryChanged(),n},Po.prototype.getCommonCoordinate=function(){return this._commonCoord},Po.prototype.add=function(n){n.apply(this._ccFilter),this._commonCoord=this._ccFilter.getCommonCoordinate()},Po.prototype.interfaces_=function(){return[]},Po.prototype.getClass=function(){return Po},Sf.CommonCoordinateFilter.get=function(){return Fs},Sf.Translater.get=function(){return Io},Object.defineProperties(Po,Sf);var Fs=function(){this._commonBitsX=new fr,this._commonBitsY=new fr};Fs.prototype.filter=function(n){this._commonBitsX.add(n.x),this._commonBitsY.add(n.y)},Fs.prototype.getCommonCoordinate=function(){return new L(this._commonBitsX.getCommon(),this._commonBitsY.getCommon())},Fs.prototype.interfaces_=function(){return[Mt]},Fs.prototype.getClass=function(){return Fs};var Io=function(){this.trans=null;var n=arguments[0];this.trans=n};Io.prototype.filter=function(n,i){var s=n.getOrdinate(i,0)+this.trans.x,u=n.getOrdinate(i,1)+this.trans.y;n.setOrdinate(i,0,s),n.setOrdinate(i,1,u)},Io.prototype.isDone=function(){return!1},Io.prototype.isGeometryChanged=function(){return!0},Io.prototype.interfaces_=function(){return[Vr]},Io.prototype.getClass=function(){return Io};var Gn=function(n,i){this._geom=new Array(2).fill(null),this._snapTolerance=null,this._cbr=null,this._geom[0]=n,this._geom[1]=i,this.computeSnapTolerance()};Gn.prototype.selfSnap=function(n){return new bn(n).snapTo(n,this._snapTolerance)},Gn.prototype.removeCommonBits=function(n){this._cbr=new Po,this._cbr.add(n[0]),this._cbr.add(n[1]);var i=new Array(2).fill(null);return i[0]=this._cbr.removeCommonBits(n[0].copy()),i[1]=this._cbr.removeCommonBits(n[1].copy()),i},Gn.prototype.prepareResult=function(n){return this._cbr.addCommonBits(n),n},Gn.prototype.getResultGeometry=function(n){var i=this.snap(this._geom),s=ae.overlayOp(i[0],i[1],n);return this.prepareResult(s)},Gn.prototype.checkValid=function(n){n.isValid()||Nt.out.println("Snapped geometry is invalid")},Gn.prototype.computeSnapTolerance=function(){this._snapTolerance=bn.computeOverlaySnapTolerance(this._geom[0],this._geom[1])},Gn.prototype.snap=function(n){var i=this.removeCommonBits(n);return bn.snap(i[0],i[1],this._snapTolerance)},Gn.prototype.interfaces_=function(){return[]},Gn.prototype.getClass=function(){return Gn},Gn.overlayOp=function(n,i,s){return new Gn(n,i).getResultGeometry(s)},Gn.union=function(n,i){return Gn.overlayOp(n,i,ae.UNION)},Gn.intersection=function(n,i){return Gn.overlayOp(n,i,ae.INTERSECTION)},Gn.symDifference=function(n,i){return Gn.overlayOp(n,i,ae.SYMDIFFERENCE)},Gn.difference=function(n,i){return Gn.overlayOp(n,i,ae.DIFFERENCE)};var hr=function(n,i){this._geom=new Array(2).fill(null),this._geom[0]=n,this._geom[1]=i};hr.prototype.getResultGeometry=function(n){var i=null,s=!1,u=null;try{i=ae.overlayOp(this._geom[0],this._geom[1],n),s=!0}catch(c){if(!(c instanceof $))throw c;u=c}if(!s)try{i=Gn.overlayOp(this._geom[0],this._geom[1],n)}catch(c){throw c instanceof $?u:c}return i},hr.prototype.interfaces_=function(){return[]},hr.prototype.getClass=function(){return hr},hr.overlayOp=function(n,i,s){return new hr(n,i).getResultGeometry(s)},hr.union=function(n,i){return hr.overlayOp(n,i,ae.UNION)},hr.intersection=function(n,i){return hr.overlayOp(n,i,ae.INTERSECTION)},hr.symDifference=function(n,i){return hr.overlayOp(n,i,ae.SYMDIFFERENCE)},hr.difference=function(n,i){return hr.overlayOp(n,i,ae.DIFFERENCE)};var Su=function(){this.mce=null,this.chainIndex=null;var n=arguments[0],i=arguments[1];this.mce=n,this.chainIndex=i};Su.prototype.computeIntersections=function(n,i){this.mce.computeIntersectsForChain(this.chainIndex,n.mce,n.chainIndex,i)},Su.prototype.interfaces_=function(){return[]},Su.prototype.getClass=function(){return Su};var Fr=function n(){if(this._label=null,this._xValue=null,this._eventType=null,this._insertEvent=null,this._deleteEventIndex=null,this._obj=null,arguments.length===2){var i=arguments[0],s=arguments[1];this._eventType=n.DELETE,this._xValue=i,this._insertEvent=s}else if(arguments.length===3){var u=arguments[0],c=arguments[1],m=arguments[2];this._eventType=n.INSERT,this._label=u,this._xValue=c,this._obj=m}},wf={INSERT:{configurable:!0},DELETE:{configurable:!0}};Fr.prototype.isDelete=function(){return this._eventType===Fr.DELETE},Fr.prototype.setDeleteEventIndex=function(n){this._deleteEventIndex=n},Fr.prototype.getObject=function(){return this._obj},Fr.prototype.compareTo=function(n){var i=n;return this._xValue<i._xValue?-1:this._xValue>i._xValue?1:this._eventType<i._eventType?-1:this._eventType>i._eventType?1:0},Fr.prototype.getInsertEvent=function(){return this._insertEvent},Fr.prototype.isInsert=function(){return this._eventType===Fr.INSERT},Fr.prototype.isSameLabel=function(n){return this._label!==null&&this._label===n._label},Fr.prototype.getDeleteEventIndex=function(){return this._deleteEventIndex},Fr.prototype.interfaces_=function(){return[F]},Fr.prototype.getClass=function(){return Fr},wf.INSERT.get=function(){return 1},wf.DELETE.get=function(){return 2},Object.defineProperties(Fr,wf);var wl=function(){};wl.prototype.interfaces_=function(){return[]},wl.prototype.getClass=function(){return wl};var Zn=function(){this._hasIntersection=!1,this._hasProper=!1,this._hasProperInterior=!1,this._properIntersectionPoint=null,this._li=null,this._includeProper=null,this._recordIsolated=null,this._isSelfIntersection=null,this._numIntersections=0,this.numTests=0,this._bdyNodes=null,this._isDone=!1,this._isDoneWhenProperInt=!1;var n=arguments[0],i=arguments[1],s=arguments[2];this._li=n,this._includeProper=i,this._recordIsolated=s};Zn.prototype.isTrivialIntersection=function(n,i,s,u){if(n===s&&this._li.getIntersectionNum()===1){if(Zn.isAdjacentSegments(i,u))return!0;if(n.isClosed()){var c=n.getNumPoints()-1;if(i===0&&u===c||u===0&&i===c)return!0}}return!1},Zn.prototype.getProperIntersectionPoint=function(){return this._properIntersectionPoint},Zn.prototype.setIsDoneIfProperInt=function(n){this._isDoneWhenProperInt=n},Zn.prototype.hasProperInteriorIntersection=function(){return this._hasProperInterior},Zn.prototype.isBoundaryPointInternal=function(n,i){for(var s=i.iterator();s.hasNext();){var u=s.next().getCoordinate();if(n.isIntersection(u))return!0}return!1},Zn.prototype.hasProperIntersection=function(){return this._hasProper},Zn.prototype.hasIntersection=function(){return this._hasIntersection},Zn.prototype.isDone=function(){return this._isDone},Zn.prototype.isBoundaryPoint=function(n,i){return i!==null&&(!!this.isBoundaryPointInternal(n,i[0])||!!this.isBoundaryPointInternal(n,i[1]))},Zn.prototype.setBoundaryNodes=function(n,i){this._bdyNodes=new Array(2).fill(null),this._bdyNodes[0]=n,this._bdyNodes[1]=i},Zn.prototype.addIntersections=function(n,i,s,u){if(n===s&&i===u)return null;this.numTests++;var c=n.getCoordinates()[i],m=n.getCoordinates()[i+1],E=s.getCoordinates()[u],A=s.getCoordinates()[u+1];this._li.computeIntersection(c,m,E,A),this._li.hasIntersection()&&(this._recordIsolated&&(n.setIsolated(!1),s.setIsolated(!1)),this._numIntersections++,this.isTrivialIntersection(n,i,s,u)||(this._hasIntersection=!0,!this._includeProper&&this._li.isProper()||(n.addIntersections(this._li,i,0),s.addIntersections(this._li,u,1)),this._li.isProper()&&(this._properIntersectionPoint=this._li.getIntersection(0).copy(),this._hasProper=!0,this._isDoneWhenProperInt&&(this._isDone=!0),this.isBoundaryPoint(this._li,this._bdyNodes)||(this._hasProperInterior=!0))))},Zn.prototype.interfaces_=function(){return[]},Zn.prototype.getClass=function(){return Zn},Zn.isAdjacentSegments=function(n,i){return Math.abs(n-i)===1};var v1=function(n){function i(){n.call(this),this.events=new j,this.nOverlaps=null}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.prepareEvents=function(){di.sort(this.events);for(var s=0;s<this.events.size();s++){var u=this.events.get(s);u.isDelete()&&u.getInsertEvent().setDeleteEventIndex(s)}},i.prototype.computeIntersections=function(){if(arguments.length===1){var s=arguments[0];this.nOverlaps=0,this.prepareEvents();for(var u=0;u<this.events.size();u++){var c=this.events.get(u);if(c.isInsert()&&this.processOverlaps(u,c.getDeleteEventIndex(),c,s),s.isDone())break}}else if(arguments.length===3){if(arguments[2]instanceof Zn&&X(arguments[0],wt)&&X(arguments[1],wt)){var m=arguments[0],E=arguments[1],A=arguments[2];this.addEdges(m,m),this.addEdges(E,E),this.computeIntersections(A)}else if(typeof arguments[2]=="boolean"&&X(arguments[0],wt)&&arguments[1]instanceof Zn){var U=arguments[0],Z=arguments[1];arguments[2]?this.addEdges(U,null):this.addEdges(U),this.computeIntersections(Z)}}},i.prototype.addEdge=function(s,u){for(var c=s.getMonotoneChainEdge(),m=c.getStartIndexes(),E=0;E<m.length-1;E++){var A=new Su(c,E),U=new Fr(u,c.getMinX(E),A);this.events.add(U),this.events.add(new Fr(c.getMaxX(E),U))}},i.prototype.processOverlaps=function(s,u,c,m){for(var E=c.getObject(),A=s;A<u;A++){var U=this.events.get(A);if(U.isInsert()){var Z=U.getObject();c.isSameLabel(U)||(E.computeIntersections(Z,m),this.nOverlaps++)}}},i.prototype.addEdges=function(){if(arguments.length===1)for(var s=arguments[0].iterator();s.hasNext();){var u=s.next();this.addEdge(u,u)}else if(arguments.length===2)for(var c=arguments[0],m=arguments[1],E=c.iterator();E.hasNext();){var A=E.next();this.addEdge(A,m)}},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(wl),Wi=function(){this._min=S.POSITIVE_INFINITY,this._max=S.NEGATIVE_INFINITY},im={NodeComparator:{configurable:!0}};Wi.prototype.getMin=function(){return this._min},Wi.prototype.intersects=function(n,i){return!(this._min>i||this._max<n)},Wi.prototype.getMax=function(){return this._max},Wi.prototype.toString=function(){return qt.toLineString(new L(this._min,0),new L(this._max,0))},Wi.prototype.interfaces_=function(){return[]},Wi.prototype.getClass=function(){return Wi},im.NodeComparator.get=function(){return wu},Object.defineProperties(Wi,im);var wu=function(){};wu.prototype.compare=function(n,i){var s=n,u=i,c=(s._min+s._max)/2,m=(u._min+u._max)/2;return c<m?-1:c>m?1:0},wu.prototype.interfaces_=function(){return[z]},wu.prototype.getClass=function(){return wu};var _1=function(n){function i(){n.call(this),this._item=null;var s=arguments[0],u=arguments[1],c=arguments[2];this._min=s,this._max=u,this._item=c}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.query=function(s,u,c){if(!this.intersects(s,u))return null;c.visitItem(this._item)},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(Wi),x1=function(n){function i(){n.call(this),this._node1=null,this._node2=null;var s=arguments[0],u=arguments[1];this._node1=s,this._node2=u,this.buildExtent(this._node1,this._node2)}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.buildExtent=function(s,u){this._min=Math.min(s._min,u._min),this._max=Math.max(s._max,u._max)},i.prototype.query=function(s,u,c){if(!this.intersects(s,u))return null;this._node1!==null&&this._node1.query(s,u,c),this._node2!==null&&this._node2.query(s,u,c)},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(Wi),qi=function(){this._leaves=new j,this._root=null,this._level=0};qi.prototype.buildTree=function(){di.sort(this._leaves,new Wi.NodeComparator);for(var n=this._leaves,i=null,s=new j;;){if(this.buildLevel(n,s),s.size()===1)return s.get(0);i=n,n=s,s=i}},qi.prototype.insert=function(n,i,s){if(this._root!==null)throw new Error("Index cannot be added to once it has been queried");this._leaves.add(new _1(n,i,s))},qi.prototype.query=function(n,i,s){this.init(),this._root.query(n,i,s)},qi.prototype.buildRoot=function(){if(this._root!==null)return null;this._root=this.buildTree()},qi.prototype.printNode=function(n){Nt.out.println(qt.toLineString(new L(n._min,this._level),new L(n._max,this._level)))},qi.prototype.init=function(){if(this._root!==null)return null;this.buildRoot()},qi.prototype.buildLevel=function(n,i){this._level++,i.clear();for(var s=0;s<n.size();s+=2){var u=n.get(s);if((s+1<n.size()?n.get(s):null)===null)i.add(u);else{var c=new x1(n.get(s),n.get(s+1));i.add(c)}}},qi.prototype.interfaces_=function(){return[]},qi.prototype.getClass=function(){return qi};var ha=function(){this._items=new j};ha.prototype.visitItem=function(n){this._items.add(n)},ha.prototype.getItems=function(){return this._items},ha.prototype.interfaces_=function(){return[Mo]},ha.prototype.getClass=function(){return ha};var pa=function(){this._index=null;var n=arguments[0];if(!X(n,ce))throw new C("Argument must be Polygonal");this._index=new es(n)},bf={SegmentVisitor:{configurable:!0},IntervalIndexedGeometry:{configurable:!0}};pa.prototype.locate=function(n){var i=new P(n),s=new da(i);return this._index.query(n.y,n.y,s),i.getLocation()},pa.prototype.interfaces_=function(){return[la]},pa.prototype.getClass=function(){return pa},bf.SegmentVisitor.get=function(){return da},bf.IntervalIndexedGeometry.get=function(){return es},Object.defineProperties(pa,bf);var da=function(){this._counter=null;var n=arguments[0];this._counter=n};da.prototype.visitItem=function(n){var i=n;this._counter.countSegment(i.getCoordinate(0),i.getCoordinate(1))},da.prototype.interfaces_=function(){return[Mo]},da.prototype.getClass=function(){return da};var es=function(){this._index=new qi;var n=arguments[0];this.init(n)};es.prototype.init=function(n){for(var i=qn.getLines(n).iterator();i.hasNext();){var s=i.next().getCoordinates();this.addLine(s)}},es.prototype.addLine=function(n){for(var i=1;i<n.length;i++){var s=new Zt(n[i-1],n[i]),u=Math.min(s.p0.y,s.p1.y),c=Math.max(s.p0.y,s.p1.y);this._index.insert(u,c,s)}},es.prototype.query=function(){if(arguments.length===2){var n=arguments[0],i=arguments[1],s=new ha;return this._index.query(n,i,s),s.getItems()}if(arguments.length===3){var u=arguments[0],c=arguments[1],m=arguments[2];this._index.query(u,c,m)}},es.prototype.interfaces_=function(){return[]},es.prototype.getClass=function(){return es};var bu=function(n){function i(){if(n.call(this),this._parentGeom=null,this._lineEdgeMap=new oa,this._boundaryNodeRule=null,this._useBoundaryDeterminationRule=!0,this._argIndex=null,this._boundaryNodes=null,this._hasTooFewPoints=!1,this._invalidPoint=null,this._areaPtLocator=null,this._ptLocator=new gi,arguments.length===2){var s=arguments[0],u=arguments[1],c=Lt.OGC_SFS_BOUNDARY_RULE;this._argIndex=s,this._parentGeom=u,this._boundaryNodeRule=c,u!==null&&this.add(u)}else if(arguments.length===3){var m=arguments[0],E=arguments[1],A=arguments[2];this._argIndex=m,this._parentGeom=E,this._boundaryNodeRule=A,E!==null&&this.add(E)}}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.insertBoundaryPoint=function(s,u){var c=this._nodes.addNode(u).getLabel(),m=1;k.NONE,c.getLocation(s,bt.ON)===k.BOUNDARY&&m++;var E=i.determineBoundary(this._boundaryNodeRule,m);c.setLocation(s,E)},i.prototype.computeSelfNodes=function(){if(arguments.length===2){var s=arguments[0],u=arguments[1];return this.computeSelfNodes(s,u,!1)}if(arguments.length===3){var c=arguments[0],m=arguments[1],E=arguments[2],A=new Zn(c,!0,!1);A.setIsDoneIfProperInt(E);var U=this.createEdgeSetIntersector(),Z=this._parentGeom instanceof sn||this._parentGeom instanceof Vt||this._parentGeom instanceof un,ut=m||!Z;return U.computeIntersections(this._edges,A,ut),this.addSelfIntersectionNodes(this._argIndex),A}},i.prototype.computeSplitEdges=function(s){for(var u=this._edges.iterator();u.hasNext();)u.next().eiList.addSplitEdges(s)},i.prototype.computeEdgeIntersections=function(s,u,c){var m=new Zn(u,c,!0);return m.setBoundaryNodes(this.getBoundaryNodes(),s.getBoundaryNodes()),this.createEdgeSetIntersector().computeIntersections(this._edges,s._edges,m),m},i.prototype.getGeometry=function(){return this._parentGeom},i.prototype.getBoundaryNodeRule=function(){return this._boundaryNodeRule},i.prototype.hasTooFewPoints=function(){return this._hasTooFewPoints},i.prototype.addPoint=function(){if(arguments[0]instanceof Qt){var s=arguments[0].getCoordinate();this.insertPoint(this._argIndex,s,k.INTERIOR)}else if(arguments[0]instanceof L){var u=arguments[0];this.insertPoint(this._argIndex,u,k.INTERIOR)}},i.prototype.addPolygon=function(s){this.addPolygonRing(s.getExteriorRing(),k.EXTERIOR,k.INTERIOR);for(var u=0;u<s.getNumInteriorRing();u++){var c=s.getInteriorRingN(u);this.addPolygonRing(c,k.INTERIOR,k.EXTERIOR)}},i.prototype.addEdge=function(s){this.insertEdge(s);var u=s.getCoordinates();this.insertPoint(this._argIndex,u[0],k.BOUNDARY),this.insertPoint(this._argIndex,u[u.length-1],k.BOUNDARY)},i.prototype.addLineString=function(s){var u=ft.removeRepeatedPoints(s.getCoordinates());if(u.length<2)return this._hasTooFewPoints=!0,this._invalidPoint=u[0],null;var c=new Sl(u,new rn(this._argIndex,k.INTERIOR));this._lineEdgeMap.put(s,c),this.insertEdge(c),b.isTrue(u.length>=2,"found LineString with single point"),this.insertBoundaryPoint(this._argIndex,u[0]),this.insertBoundaryPoint(this._argIndex,u[u.length-1])},i.prototype.getInvalidPoint=function(){return this._invalidPoint},i.prototype.getBoundaryPoints=function(){for(var s=this.getBoundaryNodes(),u=new Array(s.size()).fill(null),c=0,m=s.iterator();m.hasNext();){var E=m.next();u[c++]=E.getCoordinate().copy()}return u},i.prototype.getBoundaryNodes=function(){return this._boundaryNodes===null&&(this._boundaryNodes=this._nodes.getBoundaryNodes(this._argIndex)),this._boundaryNodes},i.prototype.addSelfIntersectionNode=function(s,u,c){if(this.isBoundaryNode(s,u))return null;c===k.BOUNDARY&&this._useBoundaryDeterminationRule?this.insertBoundaryPoint(s,u):this.insertPoint(s,u,c)},i.prototype.addPolygonRing=function(s,u,c){if(s.isEmpty())return null;var m=ft.removeRepeatedPoints(s.getCoordinates());if(m.length<4)return this._hasTooFewPoints=!0,this._invalidPoint=m[0],null;var E=u,A=c;B.isCCW(m)&&(E=c,A=u);var U=new Sl(m,new rn(this._argIndex,k.BOUNDARY,E,A));this._lineEdgeMap.put(s,U),this.insertEdge(U),this.insertPoint(this._argIndex,m[0],k.BOUNDARY)},i.prototype.insertPoint=function(s,u,c){var m=this._nodes.addNode(u),E=m.getLabel();E===null?m._label=new rn(s,c):E.setLocation(s,c)},i.prototype.createEdgeSetIntersector=function(){return new v1},i.prototype.addSelfIntersectionNodes=function(s){for(var u=this._edges.iterator();u.hasNext();)for(var c=u.next(),m=c.getLabel().getLocation(s),E=c.eiList.iterator();E.hasNext();){var A=E.next();this.addSelfIntersectionNode(s,A.coord,m)}},i.prototype.add=function(){if(arguments.length!==1)return n.prototype.add.apply(this,arguments);var s=arguments[0];if(s.isEmpty())return null;if(s instanceof un&&(this._useBoundaryDeterminationRule=!1),s instanceof Vt)this.addPolygon(s);else if(s instanceof Bt)this.addLineString(s);else if(s instanceof Qt)this.addPoint(s);else if(s instanceof fe)this.addCollection(s);else if(s instanceof H)this.addCollection(s);else if(s instanceof un)this.addCollection(s);else{if(!(s instanceof Vn))throw new Error(s.getClass().getName());this.addCollection(s)}},i.prototype.addCollection=function(s){for(var u=0;u<s.getNumGeometries();u++){var c=s.getGeometryN(u);this.add(c)}},i.prototype.locate=function(s){return X(this._parentGeom,ce)&&this._parentGeom.getNumGeometries()>50?(this._areaPtLocator===null&&(this._areaPtLocator=new pa(this._parentGeom)),this._areaPtLocator.locate(s)):this._ptLocator.locate(s,this._parentGeom)},i.prototype.findEdge=function(){if(arguments.length===1){var s=arguments[0];return this._lineEdgeMap.get(s)}return n.prototype.findEdge.apply(this,arguments)},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i.determineBoundary=function(s,u){return s.isInBoundary(u)?k.BOUNDARY:k.INTERIOR},i}(_n),ma=function(){if(this._li=new J,this._resultPrecisionModel=null,this._arg=null,arguments.length===1){var n=arguments[0];this.setComputationPrecision(n.getPrecisionModel()),this._arg=new Array(1).fill(null),this._arg[0]=new bu(0,n)}else if(arguments.length===2){var i=arguments[0],s=arguments[1],u=Lt.OGC_SFS_BOUNDARY_RULE;i.getPrecisionModel().compareTo(s.getPrecisionModel())>=0?this.setComputationPrecision(i.getPrecisionModel()):this.setComputationPrecision(s.getPrecisionModel()),this._arg=new Array(2).fill(null),this._arg[0]=new bu(0,i,u),this._arg[1]=new bu(1,s,u)}else if(arguments.length===3){var c=arguments[0],m=arguments[1],E=arguments[2];c.getPrecisionModel().compareTo(m.getPrecisionModel())>=0?this.setComputationPrecision(c.getPrecisionModel()):this.setComputationPrecision(m.getPrecisionModel()),this._arg=new Array(2).fill(null),this._arg[0]=new bu(0,c,E),this._arg[1]=new bu(1,m,E)}};ma.prototype.getArgGeometry=function(n){return this._arg[n].getGeometry()},ma.prototype.setComputationPrecision=function(n){this._resultPrecisionModel=n,this._li.setPrecisionModel(this._resultPrecisionModel)},ma.prototype.interfaces_=function(){return[]},ma.prototype.getClass=function(){return ma};var ns=function(){};ns.prototype.interfaces_=function(){return[]},ns.prototype.getClass=function(){return ns},ns.map=function(){if(arguments[0]instanceof Q&&X(arguments[1],ns.MapOp)){for(var n=arguments[0],i=arguments[1],s=new j,u=0;u<n.getNumGeometries();u++){var c=i.map(n.getGeometryN(u));c!==null&&s.add(c)}return n.getFactory().buildGeometry(s)}if(X(arguments[0],Ot)&&X(arguments[1],ns.MapOp)){for(var m=arguments[0],E=arguments[1],A=new j,U=m.iterator();U.hasNext();){var Z=U.next(),ut=E.map(Z);ut!==null&&A.add(ut)}return A}},ns.MapOp=function(){};var ae=function(n){function i(){var s=arguments[0],u=arguments[1];n.call(this,s,u),this._ptLocator=new gi,this._geomFact=null,this._resultGeom=null,this._graph=null,this._edgeList=new mi,this._resultPolyList=new j,this._resultLineList=new j,this._resultPointList=new j,this._graph=new _n(new Jd),this._geomFact=s.getFactory()}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.insertUniqueEdge=function(s){var u=this._edgeList.findEqualEdge(s);if(u!==null){var c=u.getLabel(),m=s.getLabel();u.isPointwiseEqual(s)||(m=new rn(s.getLabel())).flip();var E=u.getDepth();E.isNull()&&E.add(c),E.add(m),c.merge(m)}else this._edgeList.add(s)},i.prototype.getGraph=function(){return this._graph},i.prototype.cancelDuplicateResultEdges=function(){for(var s=this._graph.getEdgeEnds().iterator();s.hasNext();){var u=s.next(),c=u.getSym();u.isInResult()&&c.isInResult()&&(u.setInResult(!1),c.setInResult(!1))}},i.prototype.isCoveredByLA=function(s){return!!this.isCovered(s,this._resultLineList)||!!this.isCovered(s,this._resultPolyList)},i.prototype.computeGeometry=function(s,u,c,m){var E=new j;return E.addAll(s),E.addAll(u),E.addAll(c),E.isEmpty()?i.createEmptyResult(m,this._arg[0].getGeometry(),this._arg[1].getGeometry(),this._geomFact):this._geomFact.buildGeometry(E)},i.prototype.mergeSymLabels=function(){for(var s=this._graph.getNodes().iterator();s.hasNext();)s.next().getEdges().mergeSymLabels()},i.prototype.isCovered=function(s,u){for(var c=u.iterator();c.hasNext();){var m=c.next();if(this._ptLocator.locate(s,m)!==k.EXTERIOR)return!0}return!1},i.prototype.replaceCollapsedEdges=function(){for(var s=new j,u=this._edgeList.iterator();u.hasNext();){var c=u.next();c.isCollapsed()&&(u.remove(),s.add(c.getCollapsedEdge()))}this._edgeList.addAll(s)},i.prototype.updateNodeLabelling=function(){for(var s=this._graph.getNodes().iterator();s.hasNext();){var u=s.next(),c=u.getEdges().getLabel();u.getLabel().merge(c)}},i.prototype.getResultGeometry=function(s){return this.computeOverlay(s),this._resultGeom},i.prototype.insertUniqueEdges=function(s){for(var u=s.iterator();u.hasNext();){var c=u.next();this.insertUniqueEdge(c)}},i.prototype.computeOverlay=function(s){this.copyPoints(0),this.copyPoints(1),this._arg[0].computeSelfNodes(this._li,!1),this._arg[1].computeSelfNodes(this._li,!1),this._arg[0].computeEdgeIntersections(this._arg[1],this._li,!0);var u=new j;this._arg[0].computeSplitEdges(u),this._arg[1].computeSplitEdges(u),this.insertUniqueEdges(u),this.computeLabelsFromDepths(),this.replaceCollapsedEdges(),ts.checkValid(this._edgeList.getEdges()),this._graph.addEdges(this._edgeList.getEdges()),this.computeLabelling(),this.labelIncompleteNodes(),this.findResultAreaEdges(s),this.cancelDuplicateResultEdges();var c=new Nr(this._geomFact);c.add(this._graph),this._resultPolyList=c.getPolygons();var m=new Ri(this,this._geomFact,this._ptLocator);this._resultLineList=m.build(s);var E=new Ds(this,this._geomFact,this._ptLocator);this._resultPointList=E.build(s),this._resultGeom=this.computeGeometry(this._resultPointList,this._resultLineList,this._resultPolyList,s)},i.prototype.labelIncompleteNode=function(s,u){var c=this._ptLocator.locate(s.getCoordinate(),this._arg[u].getGeometry());s.getLabel().setLocation(u,c)},i.prototype.copyPoints=function(s){for(var u=this._arg[s].getNodeIterator();u.hasNext();){var c=u.next();this._graph.addNode(c.getCoordinate()).setLabel(s,c.getLabel().getLocation(s))}},i.prototype.findResultAreaEdges=function(s){for(var u=this._graph.getEdgeEnds().iterator();u.hasNext();){var c=u.next(),m=c.getLabel();m.isArea()&&!c.isInteriorAreaEdge()&&i.isResultOfOp(m.getLocation(0,bt.RIGHT),m.getLocation(1,bt.RIGHT),s)&&c.setInResult(!0)}},i.prototype.computeLabelsFromDepths=function(){for(var s=this._edgeList.iterator();s.hasNext();){var u=s.next(),c=u.getLabel(),m=u.getDepth();if(!m.isNull()){m.normalize();for(var E=0;E<2;E++)c.isNull(E)||!c.isArea()||m.isNull(E)||(m.getDelta(E)===0?c.toLine(E):(b.isTrue(!m.isNull(E,bt.LEFT),"depth of LEFT side has not been initialized"),c.setLocation(E,bt.LEFT,m.getLocation(E,bt.LEFT)),b.isTrue(!m.isNull(E,bt.RIGHT),"depth of RIGHT side has not been initialized"),c.setLocation(E,bt.RIGHT,m.getLocation(E,bt.RIGHT))))}}},i.prototype.computeLabelling=function(){for(var s=this._graph.getNodes().iterator();s.hasNext();)s.next().getEdges().computeLabelling(this._arg);this.mergeSymLabels(),this.updateNodeLabelling()},i.prototype.labelIncompleteNodes=function(){for(var s=this._graph.getNodes().iterator();s.hasNext();){var u=s.next(),c=u.getLabel();u.isIsolated()&&(c.isNull(0)?this.labelIncompleteNode(u,0):this.labelIncompleteNode(u,1)),u.getEdges().updateLabelling(c)}},i.prototype.isCoveredByA=function(s){return!!this.isCovered(s,this._resultPolyList)},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(ma);ae.overlayOp=function(n,i,s){return new ae(n,i).getResultGeometry(s)},ae.intersection=function(n,i){if(n.isEmpty()||i.isEmpty())return ae.createEmptyResult(ae.INTERSECTION,n,i,n.getFactory());if(n.isGeometryCollection()){var s=i;return Os.map(n,{interfaces_:function(){return[ns.MapOp]},map:function(u){return u.intersection(s)}})}return n.checkNotGeometryCollection(n),n.checkNotGeometryCollection(i),hr.overlayOp(n,i,ae.INTERSECTION)},ae.symDifference=function(n,i){if(n.isEmpty()||i.isEmpty()){if(n.isEmpty()&&i.isEmpty())return ae.createEmptyResult(ae.SYMDIFFERENCE,n,i,n.getFactory());if(n.isEmpty())return i.copy();if(i.isEmpty())return n.copy()}return n.checkNotGeometryCollection(n),n.checkNotGeometryCollection(i),hr.overlayOp(n,i,ae.SYMDIFFERENCE)},ae.resultDimension=function(n,i,s){var u=i.getDimension(),c=s.getDimension(),m=-1;switch(n){case ae.INTERSECTION:m=Math.min(u,c);break;case ae.UNION:m=Math.max(u,c);break;case ae.DIFFERENCE:m=u;break;case ae.SYMDIFFERENCE:m=Math.max(u,c)}return m},ae.createEmptyResult=function(n,i,s,u){var c=null;switch(ae.resultDimension(n,i,s)){case-1:c=u.createGeometryCollection(new Array(0).fill(null));break;case 0:c=u.createPoint();break;case 1:c=u.createLineString();break;case 2:c=u.createPolygon()}return c},ae.difference=function(n,i){return n.isEmpty()?ae.createEmptyResult(ae.DIFFERENCE,n,i,n.getFactory()):i.isEmpty()?n.copy():(n.checkNotGeometryCollection(n),n.checkNotGeometryCollection(i),hr.overlayOp(n,i,ae.DIFFERENCE))},ae.isResultOfOp=function(){if(arguments.length===2){var n=arguments[0],i=arguments[1],s=n.getLocation(0),u=n.getLocation(1);return ae.isResultOfOp(s,u,i)}if(arguments.length===3){var c=arguments[0],m=arguments[1],E=arguments[2];switch(c===k.BOUNDARY&&(c=k.INTERIOR),m===k.BOUNDARY&&(m=k.INTERIOR),E){case ae.INTERSECTION:return c===k.INTERIOR&&m===k.INTERIOR;case ae.UNION:return c===k.INTERIOR||m===k.INTERIOR;case ae.DIFFERENCE:return c===k.INTERIOR&&m!==k.INTERIOR;case ae.SYMDIFFERENCE:return c===k.INTERIOR&&m!==k.INTERIOR||c!==k.INTERIOR&&m===k.INTERIOR}return!1}},ae.INTERSECTION=1,ae.UNION=2,ae.DIFFERENCE=3,ae.SYMDIFFERENCE=4;var Ro=function(){this._g=null,this._boundaryDistanceTolerance=null,this._linework=null,this._ptLocator=new gi,this._seg=new Zt;var n=arguments[0],i=arguments[1];this._g=n,this._boundaryDistanceTolerance=i,this._linework=this.extractLinework(n)};Ro.prototype.isWithinToleranceOfBoundary=function(n){for(var i=0;i<this._linework.getNumGeometries();i++)for(var s=this._linework.getGeometryN(i).getCoordinateSequence(),u=0;u<s.size()-1;u++)if(s.getCoordinate(u,this._seg.p0),s.getCoordinate(u+1,this._seg.p1),this._seg.distance(n)<=this._boundaryDistanceTolerance)return!0;return!1},Ro.prototype.getLocation=function(n){return this.isWithinToleranceOfBoundary(n)?k.BOUNDARY:this._ptLocator.locate(n,this._g)},Ro.prototype.extractLinework=function(n){var i=new ga;n.apply(i);var s=i.getLinework(),u=le.toLineStringArray(s);return n.getFactory().createMultiLineString(u)},Ro.prototype.interfaces_=function(){return[]},Ro.prototype.getClass=function(){return Ro};var ga=function(){this._linework=null,this._linework=new j};ga.prototype.getLinework=function(){return this._linework},ga.prototype.filter=function(n){if(n instanceof Vt){var i=n;this._linework.add(i.getExteriorRing());for(var s=0;s<i.getNumInteriorRing();s++)this._linework.add(i.getInteriorRingN(s))}},ga.prototype.interfaces_=function(){return[ei]},ga.prototype.getClass=function(){return ga};var rs=function(){this._g=null,this._doLeft=!0,this._doRight=!0;var n=arguments[0];this._g=n};rs.prototype.extractPoints=function(n,i,s){for(var u=n.getCoordinates(),c=0;c<u.length-1;c++)this.computeOffsetPoints(u[c],u[c+1],i,s)},rs.prototype.setSidesToGenerate=function(n,i){this._doLeft=n,this._doRight=i},rs.prototype.getPoints=function(n){for(var i=new j,s=qn.getLines(this._g).iterator();s.hasNext();){var u=s.next();this.extractPoints(u,n,i)}return i},rs.prototype.computeOffsetPoints=function(n,i,s,u){var c=i.x-n.x,m=i.y-n.y,E=Math.sqrt(c*c+m*m),A=s*c/E,U=s*m/E,Z=(i.x+n.x)/2,ut=(i.y+n.y)/2;if(this._doLeft){var ht=new L(Z-U,ut+A);u.add(ht)}if(this._doRight){var At=new L(Z+U,ut-A);u.add(At)}},rs.prototype.interfaces_=function(){return[]},rs.prototype.getClass=function(){return rs};var Yr=function n(){this._geom=null,this._locFinder=null,this._location=new Array(3).fill(null),this._invalidLocation=null,this._boundaryDistanceTolerance=n.TOLERANCE,this._testCoords=new j;var i=arguments[0],s=arguments[1],u=arguments[2];this._boundaryDistanceTolerance=n.computeBoundaryDistanceTolerance(i,s),this._geom=[i,s,u],this._locFinder=[new Ro(this._geom[0],this._boundaryDistanceTolerance),new Ro(this._geom[1],this._boundaryDistanceTolerance),new Ro(this._geom[2],this._boundaryDistanceTolerance)]},om={TOLERANCE:{configurable:!0}};Yr.prototype.reportResult=function(n,i,s){Nt.out.println("Overlay result invalid - A:"+k.toLocationSymbol(i[0])+" B:"+k.toLocationSymbol(i[1])+" expected:"+(s?"i":"e")+" actual:"+k.toLocationSymbol(i[2]))},Yr.prototype.isValid=function(n){this.addTestPts(this._geom[0]),this.addTestPts(this._geom[1]);var i=this.checkValid(n);return i},Yr.prototype.checkValid=function(){if(arguments.length===1){for(var n=arguments[0],i=0;i<this._testCoords.size();i++){var s=this._testCoords.get(i);if(!this.checkValid(n,s))return this._invalidLocation=s,!1}return!0}if(arguments.length===2){var u=arguments[0],c=arguments[1];return this._location[0]=this._locFinder[0].getLocation(c),this._location[1]=this._locFinder[1].getLocation(c),this._location[2]=this._locFinder[2].getLocation(c),!!Yr.hasLocation(this._location,k.BOUNDARY)||this.isValidResult(u,this._location)}},Yr.prototype.addTestPts=function(n){var i=new rs(n);this._testCoords.addAll(i.getPoints(5*this._boundaryDistanceTolerance))},Yr.prototype.isValidResult=function(n,i){var s=ae.isResultOfOp(i[0],i[1],n),u=!(s^i[2]===k.INTERIOR);return u||this.reportResult(n,i,s),u},Yr.prototype.getInvalidLocation=function(){return this._invalidLocation},Yr.prototype.interfaces_=function(){return[]},Yr.prototype.getClass=function(){return Yr},Yr.hasLocation=function(n,i){for(var s=0;s<3;s++)if(n[s]===i)return!0;return!1},Yr.computeBoundaryDistanceTolerance=function(n,i){return Math.min(bn.computeSizeBasedSnapTolerance(n),bn.computeSizeBasedSnapTolerance(i))},Yr.isValid=function(n,i,s,u){return new Yr(n,i,u).isValid(s)},om.TOLERANCE.get=function(){return 1e-6},Object.defineProperties(Yr,om);var Zr=function n(i){this._geomFactory=null,this._skipEmpty=!1,this._inputGeoms=null,this._geomFactory=n.extractFactory(i),this._inputGeoms=i};Zr.prototype.extractElements=function(n,i){if(n===null)return null;for(var s=0;s<n.getNumGeometries();s++){var u=n.getGeometryN(s);this._skipEmpty&&u.isEmpty()||i.add(u)}},Zr.prototype.combine=function(){for(var n=new j,i=this._inputGeoms.iterator();i.hasNext();){var s=i.next();this.extractElements(s,n)}return n.size()===0?this._geomFactory!==null?this._geomFactory.createGeometryCollection(null):null:this._geomFactory.buildGeometry(n)},Zr.prototype.interfaces_=function(){return[]},Zr.prototype.getClass=function(){return Zr},Zr.combine=function(){if(arguments.length===1){var n=arguments[0];return new Zr(n).combine()}if(arguments.length===2){var i=arguments[0],s=arguments[1];return new Zr(Zr.createList(i,s)).combine()}if(arguments.length===3){var u=arguments[0],c=arguments[1],m=arguments[2];return new Zr(Zr.createList(u,c,m)).combine()}},Zr.extractFactory=function(n){return n.isEmpty()?null:n.iterator().next().getFactory()},Zr.createList=function(){if(arguments.length===2){var n=arguments[0],i=arguments[1],s=new j;return s.add(n),s.add(i),s}if(arguments.length===3){var u=arguments[0],c=arguments[1],m=arguments[2],E=new j;return E.add(u),E.add(c),E.add(m),E}};var Pn=function(){this._inputPolys=null,this._geomFactory=null;var n=arguments[0];this._inputPolys=n,this._inputPolys===null&&(this._inputPolys=new j)},sm={STRTREE_NODE_CAPACITY:{configurable:!0}};Pn.prototype.reduceToGeometries=function(n){for(var i=new j,s=n.iterator();s.hasNext();){var u=s.next(),c=null;X(u,wt)?c=this.unionTree(u):u instanceof Q&&(c=u),i.add(c)}return i},Pn.prototype.extractByEnvelope=function(n,i,s){for(var u=new j,c=0;c<i.getNumGeometries();c++){var m=i.getGeometryN(c);m.getEnvelopeInternal().intersects(n)?u.add(m):s.add(m)}return this._geomFactory.buildGeometry(u)},Pn.prototype.unionOptimized=function(n,i){var s=n.getEnvelopeInternal(),u=i.getEnvelopeInternal();if(!s.intersects(u))return Zr.combine(n,i);if(n.getNumGeometries()<=1&&i.getNumGeometries()<=1)return this.unionActual(n,i);var c=s.intersection(u);return this.unionUsingEnvelopeIntersection(n,i,c)},Pn.prototype.union=function(){if(this._inputPolys===null)throw new Error("union() method cannot be called twice");if(this._inputPolys.isEmpty())return null;this._geomFactory=this._inputPolys.iterator().next().getFactory();for(var n=new Hd(Pn.STRTREE_NODE_CAPACITY),i=this._inputPolys.iterator();i.hasNext();){var s=i.next();n.insert(s.getEnvelopeInternal(),s)}this._inputPolys=null;var u=n.itemsTree();return this.unionTree(u)},Pn.prototype.binaryUnion=function(){if(arguments.length===1){var n=arguments[0];return this.binaryUnion(n,0,n.size())}if(arguments.length===3){var i=arguments[0],s=arguments[1],u=arguments[2];if(u-s<=1){var c=Pn.getGeometry(i,s);return this.unionSafe(c,null)}if(u-s==2)return this.unionSafe(Pn.getGeometry(i,s),Pn.getGeometry(i,s+1));var m=Math.trunc((u+s)/2),E=this.binaryUnion(i,s,m),A=this.binaryUnion(i,m,u);return this.unionSafe(E,A)}},Pn.prototype.repeatedUnion=function(n){for(var i=null,s=n.iterator();s.hasNext();){var u=s.next();i=i===null?u.copy():i.union(u)}return i},Pn.prototype.unionSafe=function(n,i){return n===null&&i===null?null:n===null?i.copy():i===null?n.copy():this.unionOptimized(n,i)},Pn.prototype.unionActual=function(n,i){return Pn.restrictToPolygons(n.union(i))},Pn.prototype.unionTree=function(n){var i=this.reduceToGeometries(n);return this.binaryUnion(i)},Pn.prototype.unionUsingEnvelopeIntersection=function(n,i,s){var u=new j,c=this.extractByEnvelope(s,n,u),m=this.extractByEnvelope(s,i,u),E=this.unionActual(c,m);return u.add(E),Zr.combine(u)},Pn.prototype.bufferUnion=function(){if(arguments.length===1){var n=arguments[0];return n.get(0).getFactory().buildGeometry(n).buffer(0)}if(arguments.length===2){var i=arguments[0],s=arguments[1];return i.getFactory().createGeometryCollection([i,s]).buffer(0)}},Pn.prototype.interfaces_=function(){return[]},Pn.prototype.getClass=function(){return Pn},Pn.restrictToPolygons=function(n){if(X(n,ce))return n;var i=uo.getPolygons(n);return i.size()===1?i.get(0):n.getFactory().createMultiPolygon(le.toPolygonArray(i))},Pn.getGeometry=function(n,i){return i>=n.size()?null:n.get(i)},Pn.union=function(n){return new Pn(n).union()},sm.STRTREE_NODE_CAPACITY.get=function(){return 4},Object.defineProperties(Pn,sm);var Tu=function(){};Tu.prototype.interfaces_=function(){return[]},Tu.prototype.getClass=function(){return Tu},Tu.union=function(n,i){if(n.isEmpty()||i.isEmpty()){if(n.isEmpty()&&i.isEmpty())return ae.createEmptyResult(ae.UNION,n,i,n.getFactory());if(n.isEmpty())return i.copy();if(i.isEmpty())return n.copy()}return n.checkNotGeometryCollection(n),n.checkNotGeometryCollection(i),hr.overlayOp(n,i,ae.UNION)},r.GeoJSONReader=gf,r.GeoJSONWriter=Gd,r.OverlayOp=ae,r.UnionOp=Tu,r.BufferOp=Wn,Object.defineProperty(r,"__esModule",{value:!0})})});var kd=Un(Mm(),1);var Hh="157";var I1=0,Sm=1,R1=2;var Wg=1,L1=2,zo=3,ds=0,ui=1,Go=2;var fs=0,Ua=1,wm=2,bm=3,Tm=4,N1=5,Na=100,O1=101,D1=102,Am=103,Cm=104,F1=200,U1=201,B1=202,z1=203,qg=204,Xg=205,k1=206,G1=207,V1=208,H1=209,W1=210,q1=0,X1=1,Y1=2,oh=3,Z1=4,J1=5,$1=6,K1=7,Yg=0,j1=1,Q1=2,hs=0,tx=1,ex=2,nx=3,rx=4,ix=5,Zg=300,ka=301,Ga=302,sh=303,ah=304,hc=306,uh=1e3,Ji=1001,lh=1002,$r=1003,Pm=1004;var Pf=1005;var Ni=1006,ox=1007;var Du=1008;var ps=1009,sx=1010,ax=1011,Wh=1012,Jg=1013,ls=1014,cs=1015,Fu=1016,$g=1017,Kg=1018,Hs=1020,ux=1021,$i=1023,lx=1024,cx=1025,Ws=1026,Va=1027,fx=1028,jg=1029,hx=1030,Qg=1031,t0=1033,If=33776,Rf=33777,Lf=33778,Nf=33779,Im=35840,Rm=35841,Lm=35842,Nm=35843,px=36196,Om=37492,Dm=37496,Fm=37808,Um=37809,Bm=37810,zm=37811,km=37812,Gm=37813,Vm=37814,Hm=37815,Wm=37816,qm=37817,Xm=37818,Ym=37819,Zm=37820,Jm=37821,Of=36492,$m=36494,Km=36495,dx=36283,jm=36284,Qm=36285,tg=36286;var Yl=2300,Zl=2301,Df=2302,eg=2400,ng=2401,rg=2402;var e0=3e3,qs=3001,mx=3200,gx=3201,yx=0,vx=1,Oi="",br="srgb",Wo="srgb-linear",qh="display-p3",pc="display-p3-linear",Jl="linear",Tn="srgb",$l="rec709",Kl="p3";var Ff=7680;var _x=519,xx=512,Ex=513,Mx=514,Sx=515,wx=516,bx=517,Tx=518,Ax=519,ig=35044;var og="300 es",ch=1035,Vo=2e3,jl=2001,ms=class{addEventListener(t,e){this._listeners===void 0&&(this._listeners={});let o=this._listeners;o[t]===void 0&&(o[t]=[]),o[t].indexOf(e)===-1&&o[t].push(e)}hasEventListener(t,e){if(this._listeners===void 0)return!1;let o=this._listeners;return o[t]!==void 0&&o[t].indexOf(e)!==-1}removeEventListener(t,e){if(this._listeners===void 0)return;let a=this._listeners[t];if(a!==void 0){let l=a.indexOf(e);l!==-1&&a.splice(l,1)}}dispatchEvent(t){if(this._listeners===void 0)return;let o=this._listeners[t.type];if(o!==void 0){t.target=this;let a=o.slice(0);for(let l=0,f=a.length;l<f;l++)a[l].call(this,t);t.target=null}}},Ur=["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"];var Uf=Math.PI/180,fh=180/Math.PI;function ku(){let r=Math.random()*4294967295|0,t=Math.random()*4294967295|0,e=Math.random()*4294967295|0,o=Math.random()*4294967295|0;return(Ur[r&255]+Ur[r>>8&255]+Ur[r>>16&255]+Ur[r>>24&255]+"-"+Ur[t&255]+Ur[t>>8&255]+"-"+Ur[t>>16&15|64]+Ur[t>>24&255]+"-"+Ur[e&63|128]+Ur[e>>8&255]+"-"+Ur[e>>16&255]+Ur[e>>24&255]+Ur[o&255]+Ur[o>>8&255]+Ur[o>>16&255]+Ur[o>>24&255]).toLowerCase()}function ai(r,t,e){return Math.max(t,Math.min(e,r))}function Cx(r,t){return(r%t+t)%t}function Bf(r,t,e){return(1-e)*r+e*t}function sg(r){return(r&r-1)===0&&r!==0}function hh(r){return Math.pow(2,Math.floor(Math.log(r)/Math.LN2))}function Au(r,t){switch(t.constructor){case Float32Array:return r;case Uint32Array:return r/4294967295;case Uint16Array:return r/65535;case Uint8Array:return r/255;case Int32Array:return Math.max(r/2147483647,-1);case Int16Array:return Math.max(r/32767,-1);case Int8Array:return Math.max(r/127,-1);default:throw new Error("Invalid component type.")}}function si(r,t){switch(t.constructor){case Float32Array:return r;case Uint32Array:return Math.round(r*4294967295);case Uint16Array:return Math.round(r*65535);case Uint8Array:return Math.round(r*255);case Int32Array:return Math.round(r*2147483647);case Int16Array:return Math.round(r*32767);case Int8Array:return Math.round(r*127);default:throw new Error("Invalid component type.")}}var fn=class r{constructor(t=0,e=0){r.prototype.isVector2=!0,this.x=t,this.y=e}get width(){return this.x}set width(t){this.x=t}get height(){return this.y}set height(t){this.y=t}set(t,e){return this.x=t,this.y=e,this}setScalar(t){return this.x=t,this.y=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y)}copy(t){return this.x=t.x,this.y=t.y,this}add(t){return this.x+=t.x,this.y+=t.y,this}addScalar(t){return this.x+=t,this.y+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this}subScalar(t){return this.x-=t,this.y-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this}multiply(t){return this.x*=t.x,this.y*=t.y,this}multiplyScalar(t){return this.x*=t,this.y*=t,this}divide(t){return this.x/=t.x,this.y/=t.y,this}divideScalar(t){return this.multiplyScalar(1/t)}applyMatrix3(t){let e=this.x,o=this.y,a=t.elements;return this.x=a[0]*e+a[3]*o+a[6],this.y=a[1]*e+a[4]*o+a[7],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this}clampLength(t,e){let o=this.length();return this.divideScalar(o||1).multiplyScalar(Math.max(t,Math.min(e,o)))}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(t){return this.x*t.x+this.y*t.y}cross(t){return this.x*t.y-this.y*t.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(t){let e=Math.sqrt(this.lengthSq()*t.lengthSq());if(e===0)return Math.PI/2;let o=this.dot(t)/e;return Math.acos(ai(o,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){let e=this.x-t.x,o=this.y-t.y;return e*e+o*o}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this}lerpVectors(t,e,o){return this.x=t.x+(e.x-t.x)*o,this.y=t.y+(e.y-t.y)*o,this}equals(t){return t.x===this.x&&t.y===this.y}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this}rotateAround(t,e){let o=Math.cos(e),a=Math.sin(e),l=this.x-t.x,f=this.y-t.y;return this.x=l*o-f*a+t.x,this.y=l*a+f*o+t.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}},ve=class r{constructor(t,e,o,a,l,f,h,p,d){r.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],t!==void 0&&this.set(t,e,o,a,l,f,h,p,d)}set(t,e,o,a,l,f,h,p,d){let g=this.elements;return g[0]=t,g[1]=a,g[2]=h,g[3]=e,g[4]=l,g[5]=p,g[6]=o,g[7]=f,g[8]=d,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(t){let e=this.elements,o=t.elements;return e[0]=o[0],e[1]=o[1],e[2]=o[2],e[3]=o[3],e[4]=o[4],e[5]=o[5],e[6]=o[6],e[7]=o[7],e[8]=o[8],this}extractBasis(t,e,o){return t.setFromMatrix3Column(this,0),e.setFromMatrix3Column(this,1),o.setFromMatrix3Column(this,2),this}setFromMatrix4(t){let e=t.elements;return this.set(e[0],e[4],e[8],e[1],e[5],e[9],e[2],e[6],e[10]),this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){let o=t.elements,a=e.elements,l=this.elements,f=o[0],h=o[3],p=o[6],d=o[1],g=o[4],_=o[7],y=o[2],M=o[5],w=o[8],T=a[0],x=a[3],v=a[6],C=a[1],S=a[4],O=a[7],F=a[2],G=a[5],z=a[8];return l[0]=f*T+h*C+p*F,l[3]=f*x+h*S+p*G,l[6]=f*v+h*O+p*z,l[1]=d*T+g*C+_*F,l[4]=d*x+g*S+_*G,l[7]=d*v+g*O+_*z,l[2]=y*T+M*C+w*F,l[5]=y*x+M*S+w*G,l[8]=y*v+M*O+w*z,this}multiplyScalar(t){let e=this.elements;return e[0]*=t,e[3]*=t,e[6]*=t,e[1]*=t,e[4]*=t,e[7]*=t,e[2]*=t,e[5]*=t,e[8]*=t,this}determinant(){let t=this.elements,e=t[0],o=t[1],a=t[2],l=t[3],f=t[4],h=t[5],p=t[6],d=t[7],g=t[8];return e*f*g-e*h*d-o*l*g+o*h*p+a*l*d-a*f*p}invert(){let t=this.elements,e=t[0],o=t[1],a=t[2],l=t[3],f=t[4],h=t[5],p=t[6],d=t[7],g=t[8],_=g*f-h*d,y=h*p-g*l,M=d*l-f*p,w=e*_+o*y+a*M;if(w===0)return this.set(0,0,0,0,0,0,0,0,0);let T=1/w;return t[0]=_*T,t[1]=(a*d-g*o)*T,t[2]=(h*o-a*f)*T,t[3]=y*T,t[4]=(g*e-a*p)*T,t[5]=(a*l-h*e)*T,t[6]=M*T,t[7]=(o*p-d*e)*T,t[8]=(f*e-o*l)*T,this}transpose(){let t,e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this}getNormalMatrix(t){return this.setFromMatrix4(t).invert().transpose()}transposeIntoArray(t){let e=this.elements;return t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8],this}setUvTransform(t,e,o,a,l,f,h){let p=Math.cos(l),d=Math.sin(l);return this.set(o*p,o*d,-o*(p*f+d*h)+f+t,-a*d,a*p,-a*(-d*f+p*h)+h+e,0,0,1),this}scale(t,e){return this.premultiply(zf.makeScale(t,e)),this}rotate(t){return this.premultiply(zf.makeRotation(-t)),this}translate(t,e){return this.premultiply(zf.makeTranslation(t,e)),this}makeTranslation(t,e){return t.isVector2?this.set(1,0,t.x,0,1,t.y,0,0,1):this.set(1,0,t,0,1,e,0,0,1),this}makeRotation(t){let e=Math.cos(t),o=Math.sin(t);return this.set(e,-o,0,o,e,0,0,0,1),this}makeScale(t,e){return this.set(t,0,0,0,e,0,0,0,1),this}equals(t){let e=this.elements,o=t.elements;for(let a=0;a<9;a++)if(e[a]!==o[a])return!1;return!0}fromArray(t,e=0){for(let o=0;o<9;o++)this.elements[o]=t[o+e];return this}toArray(t=[],e=0){let o=this.elements;return t[e]=o[0],t[e+1]=o[1],t[e+2]=o[2],t[e+3]=o[3],t[e+4]=o[4],t[e+5]=o[5],t[e+6]=o[6],t[e+7]=o[7],t[e+8]=o[8],t}clone(){return new this.constructor().fromArray(this.elements)}},zf=new ve;function n0(r){for(let t=r.length-1;t>=0;--t)if(r[t]>=65535)return!0;return!1}function Ql(r){return document.createElementNS("http://www.w3.org/1999/xhtml",r)}function Px(){let r=Ql("canvas");return r.style.display="block",r}var ag={};function Nu(r){r in ag||(ag[r]=!0,console.warn(r))}var ug=new ve().set(.8224621,.177538,0,.0331941,.9668058,0,.0170827,.0723974,.9105199),lg=new ve().set(1.2249401,-.2249404,0,-.0420569,1.0420571,0,-.0196376,-.0786361,1.0982735),bl={[Wo]:{transfer:Jl,primaries:$l,toReference:r=>r,fromReference:r=>r},[br]:{transfer:Tn,primaries:$l,toReference:r=>r.convertSRGBToLinear(),fromReference:r=>r.convertLinearToSRGB()},[pc]:{transfer:Jl,primaries:Kl,toReference:r=>r.applyMatrix3(lg),fromReference:r=>r.applyMatrix3(ug)},[qh]:{transfer:Tn,primaries:Kl,toReference:r=>r.convertSRGBToLinear().applyMatrix3(lg),fromReference:r=>r.applyMatrix3(ug).convertLinearToSRGB()}},Ix=new Set([Wo,pc]),gn={enabled:!0,_workingColorSpace:Wo,get legacyMode(){return console.warn("THREE.ColorManagement: .legacyMode=false renamed to .enabled=true in r150."),!this.enabled},set legacyMode(r){console.warn("THREE.ColorManagement: .legacyMode=false renamed to .enabled=true in r150."),this.enabled=!r},get workingColorSpace(){return this._workingColorSpace},set workingColorSpace(r){if(!Ix.has(r))throw new Error(`Unsupported working color space, "${r}".`);this._workingColorSpace=r},convert:function(r,t,e){if(this.enabled===!1||t===e||!t||!e)return r;let o=bl[t].toReference,a=bl[e].fromReference;return a(o(r))},fromWorkingColorSpace:function(r,t){return this.convert(r,this._workingColorSpace,t)},toWorkingColorSpace:function(r,t){return this.convert(r,t,this._workingColorSpace)},getPrimaries:function(r){return bl[r].primaries},getTransfer:function(r){return r===Oi?Jl:bl[r].transfer}};function Ba(r){return r<.04045?r*.0773993808:Math.pow(r*.9478672986+.0521327014,2.4)}function kf(r){return r<.0031308?r*12.92:1.055*Math.pow(r,.41666)-.055}var ya,tc=class{static getDataURL(t){if(/^data:/i.test(t.src)||typeof HTMLCanvasElement=="undefined")return t.src;let e;if(t instanceof HTMLCanvasElement)e=t;else{ya===void 0&&(ya=Ql("canvas")),ya.width=t.width,ya.height=t.height;let o=ya.getContext("2d");t instanceof ImageData?o.putImageData(t,0,0):o.drawImage(t,0,0,t.width,t.height),e=ya}return e.width>2048||e.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",t),e.toDataURL("image/jpeg",.6)):e.toDataURL("image/png")}static sRGBToLinear(t){if(typeof HTMLImageElement!="undefined"&&t instanceof HTMLImageElement||typeof HTMLCanvasElement!="undefined"&&t instanceof HTMLCanvasElement||typeof ImageBitmap!="undefined"&&t instanceof ImageBitmap){let e=Ql("canvas");e.width=t.width,e.height=t.height;let o=e.getContext("2d");o.drawImage(t,0,0,t.width,t.height);let a=o.getImageData(0,0,t.width,t.height),l=a.data;for(let f=0;f<l.length;f++)l[f]=Ba(l[f]/255)*255;return o.putImageData(a,0,0),e}else if(t.data){let e=t.data.slice(0);for(let o=0;o<e.length;o++)e instanceof Uint8Array||e instanceof Uint8ClampedArray?e[o]=Math.floor(Ba(e[o]/255)*255):e[o]=Ba(e[o]);return{data:e,width:t.width,height:t.height}}else return console.warn("THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),t}},Rx=0,ec=class{constructor(t=null){this.isSource=!0,Object.defineProperty(this,"id",{value:Rx++}),this.uuid=ku(),this.data=t,this.version=0}set needsUpdate(t){t===!0&&this.version++}toJSON(t){let e=t===void 0||typeof t=="string";if(!e&&t.images[this.uuid]!==void 0)return t.images[this.uuid];let o={uuid:this.uuid,url:""},a=this.data;if(a!==null){let l;if(Array.isArray(a)){l=[];for(let f=0,h=a.length;f<h;f++)a[f].isDataTexture?l.push(Gf(a[f].image)):l.push(Gf(a[f]))}else l=Gf(a);o.url=l}return e||(t.images[this.uuid]=o),o}};function Gf(r){return typeof HTMLImageElement!="undefined"&&r instanceof HTMLImageElement||typeof HTMLCanvasElement!="undefined"&&r instanceof HTMLCanvasElement||typeof ImageBitmap!="undefined"&&r instanceof ImageBitmap?tc.getDataURL(r):r.data?{data:Array.from(r.data),width:r.width,height:r.height,type:r.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}var Lx=0,Ki=class r extends ms{constructor(t=r.DEFAULT_IMAGE,e=r.DEFAULT_MAPPING,o=Ji,a=Ji,l=Ni,f=Du,h=$i,p=ps,d=r.DEFAULT_ANISOTROPY,g=Oi){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:Lx++}),this.uuid=ku(),this.name="",this.source=new ec(t),this.mipmaps=[],this.mapping=e,this.channel=0,this.wrapS=o,this.wrapT=a,this.magFilter=l,this.minFilter=f,this.anisotropy=d,this.format=h,this.internalFormat=null,this.type=p,this.offset=new fn(0,0),this.repeat=new fn(1,1),this.center=new fn(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new ve,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,typeof g=="string"?this.colorSpace=g:(Nu("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace=g===qs?br:Oi),this.userData={},this.version=0,this.onUpdate=null,this.isRenderTargetTexture=!1,this.needsPMREMUpdate=!1}get image(){return this.source.data}set image(t=null){this.source.data=t}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}clone(){return new this.constructor().copy(this)}copy(t){return this.name=t.name,this.source=t.source,this.mipmaps=t.mipmaps.slice(0),this.mapping=t.mapping,this.channel=t.channel,this.wrapS=t.wrapS,this.wrapT=t.wrapT,this.magFilter=t.magFilter,this.minFilter=t.minFilter,this.anisotropy=t.anisotropy,this.format=t.format,this.internalFormat=t.internalFormat,this.type=t.type,this.offset.copy(t.offset),this.repeat.copy(t.repeat),this.center.copy(t.center),this.rotation=t.rotation,this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrix.copy(t.matrix),this.generateMipmaps=t.generateMipmaps,this.premultiplyAlpha=t.premultiplyAlpha,this.flipY=t.flipY,this.unpackAlignment=t.unpackAlignment,this.colorSpace=t.colorSpace,this.userData=JSON.parse(JSON.stringify(t.userData)),this.needsUpdate=!0,this}toJSON(t){let e=t===void 0||typeof t=="string";if(!e&&t.textures[this.uuid]!==void 0)return t.textures[this.uuid];let o={metadata:{version:4.6,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(t).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&&(o.userData=this.userData),e||(t.textures[this.uuid]=o),o}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(t){if(this.mapping!==Zg)return t;if(t.applyMatrix3(this.matrix),t.x<0||t.x>1)switch(this.wrapS){case uh:t.x=t.x-Math.floor(t.x);break;case Ji:t.x=t.x<0?0:1;break;case lh:Math.abs(Math.floor(t.x)%2)===1?t.x=Math.ceil(t.x)-t.x:t.x=t.x-Math.floor(t.x);break}if(t.y<0||t.y>1)switch(this.wrapT){case uh:t.y=t.y-Math.floor(t.y);break;case Ji:t.y=t.y<0?0:1;break;case lh:Math.abs(Math.floor(t.y)%2)===1?t.y=Math.ceil(t.y)-t.y:t.y=t.y-Math.floor(t.y);break}return this.flipY&&(t.y=1-t.y),t}set needsUpdate(t){t===!0&&(this.version++,this.source.needsUpdate=!0)}get encoding(){return Nu("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace===br?qs:e0}set encoding(t){Nu("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace=t===qs?br:Oi}};Ki.DEFAULT_IMAGE=null;Ki.DEFAULT_MAPPING=Zg;Ki.DEFAULT_ANISOTROPY=1;var Tr=class r{constructor(t=0,e=0,o=0,a=1){r.prototype.isVector4=!0,this.x=t,this.y=e,this.z=o,this.w=a}get width(){return this.z}set width(t){this.z=t}get height(){return this.w}set height(t){this.w=t}set(t,e,o,a){return this.x=t,this.y=e,this.z=o,this.w=a,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this.w=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setW(t){return this.w=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;case 3:this.w=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){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: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=t.w!==void 0?t.w:1,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this.w+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.w=t.w+e.w,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this.w+=t.w*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this.w-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this.w=t.w-e.w,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this.w*=t.w,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this}applyMatrix4(t){let e=this.x,o=this.y,a=this.z,l=this.w,f=t.elements;return this.x=f[0]*e+f[4]*o+f[8]*a+f[12]*l,this.y=f[1]*e+f[5]*o+f[9]*a+f[13]*l,this.z=f[2]*e+f[6]*o+f[10]*a+f[14]*l,this.w=f[3]*e+f[7]*o+f[11]*a+f[15]*l,this}divideScalar(t){return this.multiplyScalar(1/t)}setAxisAngleFromQuaternion(t){this.w=2*Math.acos(t.w);let e=Math.sqrt(1-t.w*t.w);return e<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=t.x/e,this.y=t.y/e,this.z=t.z/e),this}setAxisAngleFromRotationMatrix(t){let e,o,a,l,p=t.elements,d=p[0],g=p[4],_=p[8],y=p[1],M=p[5],w=p[9],T=p[2],x=p[6],v=p[10];if(Math.abs(g-y)<.01&&Math.abs(_-T)<.01&&Math.abs(w-x)<.01){if(Math.abs(g+y)<.1&&Math.abs(_+T)<.1&&Math.abs(w+x)<.1&&Math.abs(d+M+v-3)<.1)return this.set(1,0,0,0),this;e=Math.PI;let S=(d+1)/2,O=(M+1)/2,F=(v+1)/2,G=(g+y)/4,z=(_+T)/4,L=(w+x)/4;return S>O&&S>F?S<.01?(o=0,a=.707106781,l=.707106781):(o=Math.sqrt(S),a=G/o,l=z/o):O>F?O<.01?(o=.707106781,a=0,l=.707106781):(a=Math.sqrt(O),o=G/a,l=L/a):F<.01?(o=.707106781,a=.707106781,l=0):(l=Math.sqrt(F),o=z/l,a=L/l),this.set(o,a,l,e),this}let C=Math.sqrt((x-w)*(x-w)+(_-T)*(_-T)+(y-g)*(y-g));return Math.abs(C)<.001&&(C=1),this.x=(x-w)/C,this.y=(_-T)/C,this.z=(y-g)/C,this.w=Math.acos((d+M+v-1)/2),this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this.w=Math.min(this.w,t.w),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this.w=Math.max(this.w,t.w),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this.w=Math.max(t.w,Math.min(e.w,this.w)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this.z=Math.max(t,Math.min(e,this.z)),this.w=Math.max(t,Math.min(e,this.w)),this}clampLength(t,e){let o=this.length();return this.divideScalar(o||1).multiplyScalar(Math.max(t,Math.min(e,o)))}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(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.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(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this.w+=(t.w-this.w)*e,this}lerpVectors(t,e,o){return this.x=t.x+(e.x-t.x)*o,this.y=t.y+(e.y-t.y)*o,this.z=t.z+(e.z-t.z)*o,this.w=t.w+(e.w-t.w)*o,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this.w=t[e+3],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t[e+3]=this.w,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this.w=t.getW(e),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}},ph=class extends ms{constructor(t=1,e=1,o={}){super(),this.isRenderTarget=!0,this.width=t,this.height=e,this.depth=1,this.scissor=new Tr(0,0,t,e),this.scissorTest=!1,this.viewport=new Tr(0,0,t,e);let a={width:t,height:e,depth:1};o.encoding!==void 0&&(Nu("THREE.WebGLRenderTarget: option.encoding has been replaced by option.colorSpace."),o.colorSpace=o.encoding===qs?br:Oi),o=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:Ni,depthBuffer:!0,stencilBuffer:!1,depthTexture:null,samples:0},o),this.texture=new Ki(a,o.mapping,o.wrapS,o.wrapT,o.magFilter,o.minFilter,o.format,o.type,o.anisotropy,o.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.flipY=!1,this.texture.generateMipmaps=o.generateMipmaps,this.texture.internalFormat=o.internalFormat,this.depthBuffer=o.depthBuffer,this.stencilBuffer=o.stencilBuffer,this.depthTexture=o.depthTexture,this.samples=o.samples}setSize(t,e,o=1){(this.width!==t||this.height!==e||this.depth!==o)&&(this.width=t,this.height=e,this.depth=o,this.texture.image.width=t,this.texture.image.height=e,this.texture.image.depth=o,this.dispose()),this.viewport.set(0,0,t,e),this.scissor.set(0,0,t,e)}clone(){return new this.constructor().copy(this)}copy(t){this.width=t.width,this.height=t.height,this.depth=t.depth,this.scissor.copy(t.scissor),this.scissorTest=t.scissorTest,this.viewport.copy(t.viewport),this.texture=t.texture.clone(),this.texture.isRenderTargetTexture=!0;let e=Object.assign({},t.texture.image);return this.texture.source=new ec(e),this.depthBuffer=t.depthBuffer,this.stencilBuffer=t.stencilBuffer,t.depthTexture!==null&&(this.depthTexture=t.depthTexture.clone()),this.samples=t.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}},qo=class extends ph{constructor(t=1,e=1,o={}){super(t,e,o),this.isWebGLRenderTarget=!0}},nc=class extends Ki{constructor(t=null,e=1,o=1,a=1){super(null),this.isDataArrayTexture=!0,this.image={data:t,width:e,height:o,depth:a},this.magFilter=$r,this.minFilter=$r,this.wrapR=Ji,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}};var dh=class extends Ki{constructor(t=null,e=1,o=1,a=1){super(null),this.isData3DTexture=!0,this.image={data:t,width:e,height:o,depth:a},this.magFilter=$r,this.minFilter=$r,this.wrapR=Ji,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}};var gs=class{constructor(t=0,e=0,o=0,a=1){this.isQuaternion=!0,this._x=t,this._y=e,this._z=o,this._w=a}static slerpFlat(t,e,o,a,l,f,h){let p=o[a+0],d=o[a+1],g=o[a+2],_=o[a+3],y=l[f+0],M=l[f+1],w=l[f+2],T=l[f+3];if(h===0){t[e+0]=p,t[e+1]=d,t[e+2]=g,t[e+3]=_;return}if(h===1){t[e+0]=y,t[e+1]=M,t[e+2]=w,t[e+3]=T;return}if(_!==T||p!==y||d!==M||g!==w){let x=1-h,v=p*y+d*M+g*w+_*T,C=v>=0?1:-1,S=1-v*v;if(S>Number.EPSILON){let F=Math.sqrt(S),G=Math.atan2(F,v*C);x=Math.sin(x*G)/F,h=Math.sin(h*G)/F}let O=h*C;if(p=p*x+y*O,d=d*x+M*O,g=g*x+w*O,_=_*x+T*O,x===1-h){let F=1/Math.sqrt(p*p+d*d+g*g+_*_);p*=F,d*=F,g*=F,_*=F}}t[e]=p,t[e+1]=d,t[e+2]=g,t[e+3]=_}static multiplyQuaternionsFlat(t,e,o,a,l,f){let h=o[a],p=o[a+1],d=o[a+2],g=o[a+3],_=l[f],y=l[f+1],M=l[f+2],w=l[f+3];return t[e]=h*w+g*_+p*M-d*y,t[e+1]=p*w+g*y+d*_-h*M,t[e+2]=d*w+g*M+h*y-p*_,t[e+3]=g*w-h*_-p*y-d*M,t}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get w(){return this._w}set w(t){this._w=t,this._onChangeCallback()}set(t,e,o,a){return this._x=t,this._y=e,this._z=o,this._w=a,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this._onChangeCallback(),this}setFromEuler(t,e){let o=t._x,a=t._y,l=t._z,f=t._order,h=Math.cos,p=Math.sin,d=h(o/2),g=h(a/2),_=h(l/2),y=p(o/2),M=p(a/2),w=p(l/2);switch(f){case"XYZ":this._x=y*g*_+d*M*w,this._y=d*M*_-y*g*w,this._z=d*g*w+y*M*_,this._w=d*g*_-y*M*w;break;case"YXZ":this._x=y*g*_+d*M*w,this._y=d*M*_-y*g*w,this._z=d*g*w-y*M*_,this._w=d*g*_+y*M*w;break;case"ZXY":this._x=y*g*_-d*M*w,this._y=d*M*_+y*g*w,this._z=d*g*w+y*M*_,this._w=d*g*_-y*M*w;break;case"ZYX":this._x=y*g*_-d*M*w,this._y=d*M*_+y*g*w,this._z=d*g*w-y*M*_,this._w=d*g*_+y*M*w;break;case"YZX":this._x=y*g*_+d*M*w,this._y=d*M*_+y*g*w,this._z=d*g*w-y*M*_,this._w=d*g*_-y*M*w;break;case"XZY":this._x=y*g*_-d*M*w,this._y=d*M*_-y*g*w,this._z=d*g*w+y*M*_,this._w=d*g*_+y*M*w;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+f)}return e!==!1&&this._onChangeCallback(),this}setFromAxisAngle(t,e){let o=e/2,a=Math.sin(o);return this._x=t.x*a,this._y=t.y*a,this._z=t.z*a,this._w=Math.cos(o),this._onChangeCallback(),this}setFromRotationMatrix(t){let e=t.elements,o=e[0],a=e[4],l=e[8],f=e[1],h=e[5],p=e[9],d=e[2],g=e[6],_=e[10],y=o+h+_;if(y>0){let M=.5/Math.sqrt(y+1);this._w=.25/M,this._x=(g-p)*M,this._y=(l-d)*M,this._z=(f-a)*M}else if(o>h&&o>_){let M=2*Math.sqrt(1+o-h-_);this._w=(g-p)/M,this._x=.25*M,this._y=(a+f)/M,this._z=(l+d)/M}else if(h>_){let M=2*Math.sqrt(1+h-o-_);this._w=(l-d)/M,this._x=(a+f)/M,this._y=.25*M,this._z=(p+g)/M}else{let M=2*Math.sqrt(1+_-o-h);this._w=(f-a)/M,this._x=(l+d)/M,this._y=(p+g)/M,this._z=.25*M}return this._onChangeCallback(),this}setFromUnitVectors(t,e){let o=t.dot(e)+1;return o<Number.EPSILON?(o=0,Math.abs(t.x)>Math.abs(t.z)?(this._x=-t.y,this._y=t.x,this._z=0,this._w=o):(this._x=0,this._y=-t.z,this._z=t.y,this._w=o)):(this._x=t.y*e.z-t.z*e.y,this._y=t.z*e.x-t.x*e.z,this._z=t.x*e.y-t.y*e.x,this._w=o),this.normalize()}angleTo(t){return 2*Math.acos(Math.abs(ai(this.dot(t),-1,1)))}rotateTowards(t,e){let o=this.angleTo(t);if(o===0)return this;let a=Math.min(1,e/o);return this.slerp(t,a),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(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._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 t=this.length();return t===0?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this._onChangeCallback(),this}multiply(t){return this.multiplyQuaternions(this,t)}premultiply(t){return this.multiplyQuaternions(t,this)}multiplyQuaternions(t,e){let o=t._x,a=t._y,l=t._z,f=t._w,h=e._x,p=e._y,d=e._z,g=e._w;return this._x=o*g+f*h+a*d-l*p,this._y=a*g+f*p+l*h-o*d,this._z=l*g+f*d+o*p-a*h,this._w=f*g-o*h-a*p-l*d,this._onChangeCallback(),this}slerp(t,e){if(e===0)return this;if(e===1)return this.copy(t);let o=this._x,a=this._y,l=this._z,f=this._w,h=f*t._w+o*t._x+a*t._y+l*t._z;if(h<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,h=-h):this.copy(t),h>=1)return this._w=f,this._x=o,this._y=a,this._z=l,this;let p=1-h*h;if(p<=Number.EPSILON){let M=1-e;return this._w=M*f+e*this._w,this._x=M*o+e*this._x,this._y=M*a+e*this._y,this._z=M*l+e*this._z,this.normalize(),this._onChangeCallback(),this}let d=Math.sqrt(p),g=Math.atan2(d,h),_=Math.sin((1-e)*g)/d,y=Math.sin(e*g)/d;return this._w=f*_+this._w*y,this._x=o*_+this._x*y,this._y=a*_+this._y*y,this._z=l*_+this._z*y,this._onChangeCallback(),this}slerpQuaternions(t,e,o){return this.copy(t).slerp(e,o)}random(){let t=Math.random(),e=Math.sqrt(1-t),o=Math.sqrt(t),a=2*Math.PI*Math.random(),l=2*Math.PI*Math.random();return this.set(e*Math.cos(a),o*Math.sin(l),o*Math.cos(l),e*Math.sin(a))}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w}fromArray(t,e=0){return this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t}fromBufferAttribute(t,e){return this._x=t.getX(e),this._y=t.getY(e),this._z=t.getZ(e),this._w=t.getW(e),this}toJSON(){return this.toArray()}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}},mt=class r{constructor(t=0,e=0,o=0){r.prototype.isVector3=!0,this.x=t,this.y=e,this.z=o}set(t,e,o){return o===void 0&&(o=this.z),this.x=t,this.y=e,this.z=o,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this}multiplyVectors(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this}applyEuler(t){return this.applyQuaternion(cg.setFromEuler(t))}applyAxisAngle(t,e){return this.applyQuaternion(cg.setFromAxisAngle(t,e))}applyMatrix3(t){let e=this.x,o=this.y,a=this.z,l=t.elements;return this.x=l[0]*e+l[3]*o+l[6]*a,this.y=l[1]*e+l[4]*o+l[7]*a,this.z=l[2]*e+l[5]*o+l[8]*a,this}applyNormalMatrix(t){return this.applyMatrix3(t).normalize()}applyMatrix4(t){let e=this.x,o=this.y,a=this.z,l=t.elements,f=1/(l[3]*e+l[7]*o+l[11]*a+l[15]);return this.x=(l[0]*e+l[4]*o+l[8]*a+l[12])*f,this.y=(l[1]*e+l[5]*o+l[9]*a+l[13])*f,this.z=(l[2]*e+l[6]*o+l[10]*a+l[14])*f,this}applyQuaternion(t){let e=this.x,o=this.y,a=this.z,l=t.x,f=t.y,h=t.z,p=t.w,d=p*e+f*a-h*o,g=p*o+h*e-l*a,_=p*a+l*o-f*e,y=-l*e-f*o-h*a;return this.x=d*p+y*-l+g*-h-_*-f,this.y=g*p+y*-f+_*-l-d*-h,this.z=_*p+y*-h+d*-f-g*-l,this}project(t){return this.applyMatrix4(t.matrixWorldInverse).applyMatrix4(t.projectionMatrix)}unproject(t){return this.applyMatrix4(t.projectionMatrixInverse).applyMatrix4(t.matrixWorld)}transformDirection(t){let e=this.x,o=this.y,a=this.z,l=t.elements;return this.x=l[0]*e+l[4]*o+l[8]*a,this.y=l[1]*e+l[5]*o+l[9]*a,this.z=l[2]*e+l[6]*o+l[10]*a,this.normalize()}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this}divideScalar(t){return this.multiplyScalar(1/t)}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this.z=Math.max(t,Math.min(e,this.z)),this}clampLength(t,e){let o=this.length();return this.divideScalar(o||1).multiplyScalar(Math.max(t,Math.min(e,o)))}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(t){return this.x*t.x+this.y*t.y+this.z*t.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(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this}lerpVectors(t,e,o){return this.x=t.x+(e.x-t.x)*o,this.y=t.y+(e.y-t.y)*o,this.z=t.z+(e.z-t.z)*o,this}cross(t){return this.crossVectors(this,t)}crossVectors(t,e){let o=t.x,a=t.y,l=t.z,f=e.x,h=e.y,p=e.z;return this.x=a*p-l*h,this.y=l*f-o*p,this.z=o*h-a*f,this}projectOnVector(t){let e=t.lengthSq();if(e===0)return this.set(0,0,0);let o=t.dot(this)/e;return this.copy(t).multiplyScalar(o)}projectOnPlane(t){return Vf.copy(this).projectOnVector(t),this.sub(Vf)}reflect(t){return this.sub(Vf.copy(t).multiplyScalar(2*this.dot(t)))}angleTo(t){let e=Math.sqrt(this.lengthSq()*t.lengthSq());if(e===0)return Math.PI/2;let o=this.dot(t)/e;return Math.acos(ai(o,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){let e=this.x-t.x,o=this.y-t.y,a=this.z-t.z;return e*e+o*o+a*a}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)}setFromSpherical(t){return this.setFromSphericalCoords(t.radius,t.phi,t.theta)}setFromSphericalCoords(t,e,o){let a=Math.sin(e)*t;return this.x=a*Math.sin(o),this.y=Math.cos(e)*t,this.z=a*Math.cos(o),this}setFromCylindrical(t){return this.setFromCylindricalCoords(t.radius,t.theta,t.y)}setFromCylindricalCoords(t,e,o){return this.x=t*Math.sin(e),this.y=o,this.z=t*Math.cos(e),this}setFromMatrixPosition(t){let e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this}setFromMatrixScale(t){let e=this.setFromMatrixColumn(t,0).length(),o=this.setFromMatrixColumn(t,1).length(),a=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=o,this.z=a,this}setFromMatrixColumn(t,e){return this.fromArray(t.elements,e*4)}setFromMatrix3Column(t,e){return this.fromArray(t.elements,e*3)}setFromEuler(t){return this.x=t._x,this.y=t._y,this.z=t._z,this}setFromColor(t){return this.x=t.r,this.y=t.g,this.z=t.b,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){let t=(Math.random()-.5)*2,e=Math.random()*Math.PI*2,o=Math.sqrt(1-t**2);return this.x=o*Math.cos(e),this.y=o*Math.sin(e),this.z=t,this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}},Vf=new mt,cg=new gs,Xs=class{constructor(t=new mt(1/0,1/0,1/0),e=new mt(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=t,this.max=e}set(t,e){return this.min.copy(t),this.max.copy(e),this}setFromArray(t){this.makeEmpty();for(let e=0,o=t.length;e<o;e+=3)this.expandByPoint(Oo.fromArray(t,e));return this}setFromBufferAttribute(t){this.makeEmpty();for(let e=0,o=t.count;e<o;e++)this.expandByPoint(Oo.fromBufferAttribute(t,e));return this}setFromPoints(t){this.makeEmpty();for(let e=0,o=t.length;e<o;e++)this.expandByPoint(t[e]);return this}setFromCenterAndSize(t,e){let o=Oo.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(o),this.max.copy(t).add(o),this}setFromObject(t,e=!1){return this.makeEmpty(),this.expandByObject(t,e)}clone(){return new this.constructor().copy(this)}copy(t){return this.min.copy(t.min),this.max.copy(t.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(t){return this.isEmpty()?t.set(0,0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(t){return this.isEmpty()?t.set(0,0,0):t.subVectors(this.max,this.min)}expandByPoint(t){return this.min.min(t),this.max.max(t),this}expandByVector(t){return this.min.sub(t),this.max.add(t),this}expandByScalar(t){return this.min.addScalar(-t),this.max.addScalar(t),this}expandByObject(t,e=!1){if(t.updateWorldMatrix(!1,!1),t.boundingBox!==void 0)t.boundingBox===null&&t.computeBoundingBox(),va.copy(t.boundingBox),va.applyMatrix4(t.matrixWorld),this.union(va);else{let a=t.geometry;if(a!==void 0)if(e&&a.attributes!==void 0&&a.attributes.position!==void 0){let l=a.attributes.position;for(let f=0,h=l.count;f<h;f++)Oo.fromBufferAttribute(l,f).applyMatrix4(t.matrixWorld),this.expandByPoint(Oo)}else a.boundingBox===null&&a.computeBoundingBox(),va.copy(a.boundingBox),va.applyMatrix4(t.matrixWorld),this.union(va)}let o=t.children;for(let a=0,l=o.length;a<l;a++)this.expandByObject(o[a],e);return this}containsPoint(t){return!(t.x<this.min.x||t.x>this.max.x||t.y<this.min.y||t.y>this.max.y||t.z<this.min.z||t.z>this.max.z)}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y&&this.min.z<=t.min.z&&t.max.z<=this.max.z}getParameter(t,e){return e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(t){return!(t.max.x<this.min.x||t.min.x>this.max.x||t.max.y<this.min.y||t.min.y>this.max.y||t.max.z<this.min.z||t.min.z>this.max.z)}intersectsSphere(t){return this.clampPoint(t.center,Oo),Oo.distanceToSquared(t.center)<=t.radius*t.radius}intersectsPlane(t){let e,o;return t.normal.x>0?(e=t.normal.x*this.min.x,o=t.normal.x*this.max.x):(e=t.normal.x*this.max.x,o=t.normal.x*this.min.x),t.normal.y>0?(e+=t.normal.y*this.min.y,o+=t.normal.y*this.max.y):(e+=t.normal.y*this.max.y,o+=t.normal.y*this.min.y),t.normal.z>0?(e+=t.normal.z*this.min.z,o+=t.normal.z*this.max.z):(e+=t.normal.z*this.max.z,o+=t.normal.z*this.min.z),e<=-t.constant&&o>=-t.constant}intersectsTriangle(t){if(this.isEmpty())return!1;this.getCenter(Cu),Tl.subVectors(this.max,Cu),_a.subVectors(t.a,Cu),xa.subVectors(t.b,Cu),Ea.subVectors(t.c,Cu),is.subVectors(xa,_a),os.subVectors(Ea,xa),Us.subVectors(_a,Ea);let e=[0,-is.z,is.y,0,-os.z,os.y,0,-Us.z,Us.y,is.z,0,-is.x,os.z,0,-os.x,Us.z,0,-Us.x,-is.y,is.x,0,-os.y,os.x,0,-Us.y,Us.x,0];return!Hf(e,_a,xa,Ea,Tl)||(e=[1,0,0,0,1,0,0,0,1],!Hf(e,_a,xa,Ea,Tl))?!1:(Al.crossVectors(is,os),e=[Al.x,Al.y,Al.z],Hf(e,_a,xa,Ea,Tl))}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return this.clampPoint(t,Oo).distanceTo(t)}getBoundingSphere(t){return this.isEmpty()?t.makeEmpty():(this.getCenter(t.center),t.radius=this.getSize(Oo).length()*.5),t}intersect(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}applyMatrix4(t){return this.isEmpty()?this:(No[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),No[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),No[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),No[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),No[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),No[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),No[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),No[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(No),this)}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}},No=[new mt,new mt,new mt,new mt,new mt,new mt,new mt,new mt],Oo=new mt,va=new Xs,_a=new mt,xa=new mt,Ea=new mt,is=new mt,os=new mt,Us=new mt,Cu=new mt,Tl=new mt,Al=new mt,Bs=new mt;function Hf(r,t,e,o,a){for(let l=0,f=r.length-3;l<=f;l+=3){Bs.fromArray(r,l);let h=a.x*Math.abs(Bs.x)+a.y*Math.abs(Bs.y)+a.z*Math.abs(Bs.z),p=t.dot(Bs),d=e.dot(Bs),g=o.dot(Bs);if(Math.max(-Math.max(p,d,g),Math.min(p,d,g))>h)return!1}return!0}var Nx=new Xs,Pu=new mt,Wf=new mt,Uu=class{constructor(t=new mt,e=-1){this.center=t,this.radius=e}set(t,e){return this.center.copy(t),this.radius=e,this}setFromPoints(t,e){let o=this.center;e!==void 0?o.copy(e):Nx.setFromPoints(t).getCenter(o);let a=0;for(let l=0,f=t.length;l<f;l++)a=Math.max(a,o.distanceToSquared(t[l]));return this.radius=Math.sqrt(a),this}copy(t){return this.center.copy(t.center),this.radius=t.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(t){return t.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(t){return t.distanceTo(this.center)-this.radius}intersectsSphere(t){let e=this.radius+t.radius;return t.center.distanceToSquared(this.center)<=e*e}intersectsBox(t){return t.intersectsSphere(this)}intersectsPlane(t){return Math.abs(t.distanceToPoint(this.center))<=this.radius}clampPoint(t,e){let o=this.center.distanceToSquared(t);return e.copy(t),o>this.radius*this.radius&&(e.sub(this.center).normalize(),e.multiplyScalar(this.radius).add(this.center)),e}getBoundingBox(t){return this.isEmpty()?(t.makeEmpty(),t):(t.set(this.center,this.center),t.expandByScalar(this.radius),t)}applyMatrix4(t){return this.center.applyMatrix4(t),this.radius=this.radius*t.getMaxScaleOnAxis(),this}translate(t){return this.center.add(t),this}expandByPoint(t){if(this.isEmpty())return this.center.copy(t),this.radius=0,this;Pu.subVectors(t,this.center);let e=Pu.lengthSq();if(e>this.radius*this.radius){let o=Math.sqrt(e),a=(o-this.radius)*.5;this.center.addScaledVector(Pu,a/o),this.radius+=a}return this}union(t){return t.isEmpty()?this:this.isEmpty()?(this.copy(t),this):(this.center.equals(t.center)===!0?this.radius=Math.max(this.radius,t.radius):(Wf.subVectors(t.center,this.center).setLength(t.radius),this.expandByPoint(Pu.copy(t.center).add(Wf)),this.expandByPoint(Pu.copy(t.center).sub(Wf))),this)}equals(t){return t.center.equals(this.center)&&t.radius===this.radius}clone(){return new this.constructor().copy(this)}},Do=new mt,qf=new mt,Cl=new mt,ss=new mt,Xf=new mt,Pl=new mt,Yf=new mt,mh=class{constructor(t=new mt,e=new mt(0,0,-1)){this.origin=t,this.direction=e}set(t,e){return this.origin.copy(t),this.direction.copy(e),this}copy(t){return this.origin.copy(t.origin),this.direction.copy(t.direction),this}at(t,e){return e.copy(this.origin).addScaledVector(this.direction,t)}lookAt(t){return this.direction.copy(t).sub(this.origin).normalize(),this}recast(t){return this.origin.copy(this.at(t,Do)),this}closestPointToPoint(t,e){e.subVectors(t,this.origin);let o=e.dot(this.direction);return o<0?e.copy(this.origin):e.copy(this.origin).addScaledVector(this.direction,o)}distanceToPoint(t){return Math.sqrt(this.distanceSqToPoint(t))}distanceSqToPoint(t){let e=Do.subVectors(t,this.origin).dot(this.direction);return e<0?this.origin.distanceToSquared(t):(Do.copy(this.origin).addScaledVector(this.direction,e),Do.distanceToSquared(t))}distanceSqToSegment(t,e,o,a){qf.copy(t).add(e).multiplyScalar(.5),Cl.copy(e).sub(t).normalize(),ss.copy(this.origin).sub(qf);let l=t.distanceTo(e)*.5,f=-this.direction.dot(Cl),h=ss.dot(this.direction),p=-ss.dot(Cl),d=ss.lengthSq(),g=Math.abs(1-f*f),_,y,M,w;if(g>0)if(_=f*p-h,y=f*h-p,w=l*g,_>=0)if(y>=-w)if(y<=w){let T=1/g;_*=T,y*=T,M=_*(_+f*y+2*h)+y*(f*_+y+2*p)+d}else y=l,_=Math.max(0,-(f*y+h)),M=-_*_+y*(y+2*p)+d;else y=-l,_=Math.max(0,-(f*y+h)),M=-_*_+y*(y+2*p)+d;else y<=-w?(_=Math.max(0,-(-f*l+h)),y=_>0?-l:Math.min(Math.max(-l,-p),l),M=-_*_+y*(y+2*p)+d):y<=w?(_=0,y=Math.min(Math.max(-l,-p),l),M=y*(y+2*p)+d):(_=Math.max(0,-(f*l+h)),y=_>0?l:Math.min(Math.max(-l,-p),l),M=-_*_+y*(y+2*p)+d);else y=f>0?-l:l,_=Math.max(0,-(f*y+h)),M=-_*_+y*(y+2*p)+d;return o&&o.copy(this.origin).addScaledVector(this.direction,_),a&&a.copy(qf).addScaledVector(Cl,y),M}intersectSphere(t,e){Do.subVectors(t.center,this.origin);let o=Do.dot(this.direction),a=Do.dot(Do)-o*o,l=t.radius*t.radius;if(a>l)return null;let f=Math.sqrt(l-a),h=o-f,p=o+f;return p<0?null:h<0?this.at(p,e):this.at(h,e)}intersectsSphere(t){return this.distanceSqToPoint(t.center)<=t.radius*t.radius}distanceToPlane(t){let e=t.normal.dot(this.direction);if(e===0)return t.distanceToPoint(this.origin)===0?0:null;let o=-(this.origin.dot(t.normal)+t.constant)/e;return o>=0?o:null}intersectPlane(t,e){let o=this.distanceToPlane(t);return o===null?null:this.at(o,e)}intersectsPlane(t){let e=t.distanceToPoint(this.origin);return e===0||t.normal.dot(this.direction)*e<0}intersectBox(t,e){let o,a,l,f,h,p,d=1/this.direction.x,g=1/this.direction.y,_=1/this.direction.z,y=this.origin;return d>=0?(o=(t.min.x-y.x)*d,a=(t.max.x-y.x)*d):(o=(t.max.x-y.x)*d,a=(t.min.x-y.x)*d),g>=0?(l=(t.min.y-y.y)*g,f=(t.max.y-y.y)*g):(l=(t.max.y-y.y)*g,f=(t.min.y-y.y)*g),o>f||l>a||((l>o||isNaN(o))&&(o=l),(f<a||isNaN(a))&&(a=f),_>=0?(h=(t.min.z-y.z)*_,p=(t.max.z-y.z)*_):(h=(t.max.z-y.z)*_,p=(t.min.z-y.z)*_),o>p||h>a)||((h>o||o!==o)&&(o=h),(p<a||a!==a)&&(a=p),a<0)?null:this.at(o>=0?o:a,e)}intersectsBox(t){return this.intersectBox(t,Do)!==null}intersectTriangle(t,e,o,a,l){Xf.subVectors(e,t),Pl.subVectors(o,t),Yf.crossVectors(Xf,Pl);let f=this.direction.dot(Yf),h;if(f>0){if(a)return null;h=1}else if(f<0)h=-1,f=-f;else return null;ss.subVectors(this.origin,t);let p=h*this.direction.dot(Pl.crossVectors(ss,Pl));if(p<0)return null;let d=h*this.direction.dot(Xf.cross(ss));if(d<0||p+d>f)return null;let g=-h*ss.dot(Yf);return g<0?null:this.at(g/f,l)}applyMatrix4(t){return this.origin.applyMatrix4(t),this.direction.transformDirection(t),this}equals(t){return t.origin.equals(this.origin)&&t.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}},zr=class r{constructor(t,e,o,a,l,f,h,p,d,g,_,y,M,w,T,x){r.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],t!==void 0&&this.set(t,e,o,a,l,f,h,p,d,g,_,y,M,w,T,x)}set(t,e,o,a,l,f,h,p,d,g,_,y,M,w,T,x){let v=this.elements;return v[0]=t,v[4]=e,v[8]=o,v[12]=a,v[1]=l,v[5]=f,v[9]=h,v[13]=p,v[2]=d,v[6]=g,v[10]=_,v[14]=y,v[3]=M,v[7]=w,v[11]=T,v[15]=x,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 r().fromArray(this.elements)}copy(t){let e=this.elements,o=t.elements;return e[0]=o[0],e[1]=o[1],e[2]=o[2],e[3]=o[3],e[4]=o[4],e[5]=o[5],e[6]=o[6],e[7]=o[7],e[8]=o[8],e[9]=o[9],e[10]=o[10],e[11]=o[11],e[12]=o[12],e[13]=o[13],e[14]=o[14],e[15]=o[15],this}copyPosition(t){let e=this.elements,o=t.elements;return e[12]=o[12],e[13]=o[13],e[14]=o[14],this}setFromMatrix3(t){let e=t.elements;return this.set(e[0],e[3],e[6],0,e[1],e[4],e[7],0,e[2],e[5],e[8],0,0,0,0,1),this}extractBasis(t,e,o){return t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),o.setFromMatrixColumn(this,2),this}makeBasis(t,e,o){return this.set(t.x,e.x,o.x,0,t.y,e.y,o.y,0,t.z,e.z,o.z,0,0,0,0,1),this}extractRotation(t){let e=this.elements,o=t.elements,a=1/Ma.setFromMatrixColumn(t,0).length(),l=1/Ma.setFromMatrixColumn(t,1).length(),f=1/Ma.setFromMatrixColumn(t,2).length();return e[0]=o[0]*a,e[1]=o[1]*a,e[2]=o[2]*a,e[3]=0,e[4]=o[4]*l,e[5]=o[5]*l,e[6]=o[6]*l,e[7]=0,e[8]=o[8]*f,e[9]=o[9]*f,e[10]=o[10]*f,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromEuler(t){let e=this.elements,o=t.x,a=t.y,l=t.z,f=Math.cos(o),h=Math.sin(o),p=Math.cos(a),d=Math.sin(a),g=Math.cos(l),_=Math.sin(l);if(t.order==="XYZ"){let y=f*g,M=f*_,w=h*g,T=h*_;e[0]=p*g,e[4]=-p*_,e[8]=d,e[1]=M+w*d,e[5]=y-T*d,e[9]=-h*p,e[2]=T-y*d,e[6]=w+M*d,e[10]=f*p}else if(t.order==="YXZ"){let y=p*g,M=p*_,w=d*g,T=d*_;e[0]=y+T*h,e[4]=w*h-M,e[8]=f*d,e[1]=f*_,e[5]=f*g,e[9]=-h,e[2]=M*h-w,e[6]=T+y*h,e[10]=f*p}else if(t.order==="ZXY"){let y=p*g,M=p*_,w=d*g,T=d*_;e[0]=y-T*h,e[4]=-f*_,e[8]=w+M*h,e[1]=M+w*h,e[5]=f*g,e[9]=T-y*h,e[2]=-f*d,e[6]=h,e[10]=f*p}else if(t.order==="ZYX"){let y=f*g,M=f*_,w=h*g,T=h*_;e[0]=p*g,e[4]=w*d-M,e[8]=y*d+T,e[1]=p*_,e[5]=T*d+y,e[9]=M*d-w,e[2]=-d,e[6]=h*p,e[10]=f*p}else if(t.order==="YZX"){let y=f*p,M=f*d,w=h*p,T=h*d;e[0]=p*g,e[4]=T-y*_,e[8]=w*_+M,e[1]=_,e[5]=f*g,e[9]=-h*g,e[2]=-d*g,e[6]=M*_+w,e[10]=y-T*_}else if(t.order==="XZY"){let y=f*p,M=f*d,w=h*p,T=h*d;e[0]=p*g,e[4]=-_,e[8]=d*g,e[1]=y*_+T,e[5]=f*g,e[9]=M*_-w,e[2]=w*_-M,e[6]=h*g,e[10]=T*_+y}return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromQuaternion(t){return this.compose(Ox,t,Dx)}lookAt(t,e,o){let a=this.elements;return vi.subVectors(t,e),vi.lengthSq()===0&&(vi.z=1),vi.normalize(),as.crossVectors(o,vi),as.lengthSq()===0&&(Math.abs(o.z)===1?vi.x+=1e-4:vi.z+=1e-4,vi.normalize(),as.crossVectors(o,vi)),as.normalize(),Il.crossVectors(vi,as),a[0]=as.x,a[4]=Il.x,a[8]=vi.x,a[1]=as.y,a[5]=Il.y,a[9]=vi.y,a[2]=as.z,a[6]=Il.z,a[10]=vi.z,this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){let o=t.elements,a=e.elements,l=this.elements,f=o[0],h=o[4],p=o[8],d=o[12],g=o[1],_=o[5],y=o[9],M=o[13],w=o[2],T=o[6],x=o[10],v=o[14],C=o[3],S=o[7],O=o[11],F=o[15],G=a[0],z=a[4],L=a[8],D=a[12],q=a[1],nt=a[5],k=a[9],xt=a[13],X=a[2],it=a[6],vt=a[10],pt=a[14],et=a[3],ot=a[7],V=a[11],K=a[15];return l[0]=f*G+h*q+p*X+d*et,l[4]=f*z+h*nt+p*it+d*ot,l[8]=f*L+h*k+p*vt+d*V,l[12]=f*D+h*xt+p*pt+d*K,l[1]=g*G+_*q+y*X+M*et,l[5]=g*z+_*nt+y*it+M*ot,l[9]=g*L+_*k+y*vt+M*V,l[13]=g*D+_*xt+y*pt+M*K,l[2]=w*G+T*q+x*X+v*et,l[6]=w*z+T*nt+x*it+v*ot,l[10]=w*L+T*k+x*vt+v*V,l[14]=w*D+T*xt+x*pt+v*K,l[3]=C*G+S*q+O*X+F*et,l[7]=C*z+S*nt+O*it+F*ot,l[11]=C*L+S*k+O*vt+F*V,l[15]=C*D+S*xt+O*pt+F*K,this}multiplyScalar(t){let e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this}determinant(){let t=this.elements,e=t[0],o=t[4],a=t[8],l=t[12],f=t[1],h=t[5],p=t[9],d=t[13],g=t[2],_=t[6],y=t[10],M=t[14],w=t[3],T=t[7],x=t[11],v=t[15];return w*(+l*p*_-a*d*_-l*h*y+o*d*y+a*h*M-o*p*M)+T*(+e*p*M-e*d*y+l*f*y-a*f*M+a*d*g-l*p*g)+x*(+e*d*_-e*h*M-l*f*_+o*f*M+l*h*g-o*d*g)+v*(-a*h*g-e*p*_+e*h*y+a*f*_-o*f*y+o*p*g)}transpose(){let t=this.elements,e;return e=t[1],t[1]=t[4],t[4]=e,e=t[2],t[2]=t[8],t[8]=e,e=t[6],t[6]=t[9],t[9]=e,e=t[3],t[3]=t[12],t[12]=e,e=t[7],t[7]=t[13],t[13]=e,e=t[11],t[11]=t[14],t[14]=e,this}setPosition(t,e,o){let a=this.elements;return t.isVector3?(a[12]=t.x,a[13]=t.y,a[14]=t.z):(a[12]=t,a[13]=e,a[14]=o),this}invert(){let t=this.elements,e=t[0],o=t[1],a=t[2],l=t[3],f=t[4],h=t[5],p=t[6],d=t[7],g=t[8],_=t[9],y=t[10],M=t[11],w=t[12],T=t[13],x=t[14],v=t[15],C=_*x*d-T*y*d+T*p*M-h*x*M-_*p*v+h*y*v,S=w*y*d-g*x*d-w*p*M+f*x*M+g*p*v-f*y*v,O=g*T*d-w*_*d+w*h*M-f*T*M-g*h*v+f*_*v,F=w*_*p-g*T*p-w*h*y+f*T*y+g*h*x-f*_*x,G=e*C+o*S+a*O+l*F;if(G===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);let z=1/G;return t[0]=C*z,t[1]=(T*y*l-_*x*l-T*a*M+o*x*M+_*a*v-o*y*v)*z,t[2]=(h*x*l-T*p*l+T*a*d-o*x*d-h*a*v+o*p*v)*z,t[3]=(_*p*l-h*y*l-_*a*d+o*y*d+h*a*M-o*p*M)*z,t[4]=S*z,t[5]=(g*x*l-w*y*l+w*a*M-e*x*M-g*a*v+e*y*v)*z,t[6]=(w*p*l-f*x*l-w*a*d+e*x*d+f*a*v-e*p*v)*z,t[7]=(f*y*l-g*p*l+g*a*d-e*y*d-f*a*M+e*p*M)*z,t[8]=O*z,t[9]=(w*_*l-g*T*l-w*o*M+e*T*M+g*o*v-e*_*v)*z,t[10]=(f*T*l-w*h*l+w*o*d-e*T*d-f*o*v+e*h*v)*z,t[11]=(g*h*l-f*_*l-g*o*d+e*_*d+f*o*M-e*h*M)*z,t[12]=F*z,t[13]=(g*T*a-w*_*a+w*o*y-e*T*y-g*o*x+e*_*x)*z,t[14]=(w*h*a-f*T*a-w*o*p+e*T*p+f*o*x-e*h*x)*z,t[15]=(f*_*a-g*h*a+g*o*p-e*_*p-f*o*y+e*h*y)*z,this}scale(t){let e=this.elements,o=t.x,a=t.y,l=t.z;return e[0]*=o,e[4]*=a,e[8]*=l,e[1]*=o,e[5]*=a,e[9]*=l,e[2]*=o,e[6]*=a,e[10]*=l,e[3]*=o,e[7]*=a,e[11]*=l,this}getMaxScaleOnAxis(){let t=this.elements,e=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],o=t[4]*t[4]+t[5]*t[5]+t[6]*t[6],a=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(e,o,a))}makeTranslation(t,e,o){return t.isVector3?this.set(1,0,0,t.x,0,1,0,t.y,0,0,1,t.z,0,0,0,1):this.set(1,0,0,t,0,1,0,e,0,0,1,o,0,0,0,1),this}makeRotationX(t){let e=Math.cos(t),o=Math.sin(t);return this.set(1,0,0,0,0,e,-o,0,0,o,e,0,0,0,0,1),this}makeRotationY(t){let e=Math.cos(t),o=Math.sin(t);return this.set(e,0,o,0,0,1,0,0,-o,0,e,0,0,0,0,1),this}makeRotationZ(t){let e=Math.cos(t),o=Math.sin(t);return this.set(e,-o,0,0,o,e,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(t,e){let o=Math.cos(e),a=Math.sin(e),l=1-o,f=t.x,h=t.y,p=t.z,d=l*f,g=l*h;return this.set(d*f+o,d*h-a*p,d*p+a*h,0,d*h+a*p,g*h+o,g*p-a*f,0,d*p-a*h,g*p+a*f,l*p*p+o,0,0,0,0,1),this}makeScale(t,e,o){return this.set(t,0,0,0,0,e,0,0,0,0,o,0,0,0,0,1),this}makeShear(t,e,o,a,l,f){return this.set(1,o,l,0,t,1,f,0,e,a,1,0,0,0,0,1),this}compose(t,e,o){let a=this.elements,l=e._x,f=e._y,h=e._z,p=e._w,d=l+l,g=f+f,_=h+h,y=l*d,M=l*g,w=l*_,T=f*g,x=f*_,v=h*_,C=p*d,S=p*g,O=p*_,F=o.x,G=o.y,z=o.z;return a[0]=(1-(T+v))*F,a[1]=(M+O)*F,a[2]=(w-S)*F,a[3]=0,a[4]=(M-O)*G,a[5]=(1-(y+v))*G,a[6]=(x+C)*G,a[7]=0,a[8]=(w+S)*z,a[9]=(x-C)*z,a[10]=(1-(y+T))*z,a[11]=0,a[12]=t.x,a[13]=t.y,a[14]=t.z,a[15]=1,this}decompose(t,e,o){let a=this.elements,l=Ma.set(a[0],a[1],a[2]).length(),f=Ma.set(a[4],a[5],a[6]).length(),h=Ma.set(a[8],a[9],a[10]).length();this.determinant()<0&&(l=-l),t.x=a[12],t.y=a[13],t.z=a[14],Yi.copy(this);let d=1/l,g=1/f,_=1/h;return Yi.elements[0]*=d,Yi.elements[1]*=d,Yi.elements[2]*=d,Yi.elements[4]*=g,Yi.elements[5]*=g,Yi.elements[6]*=g,Yi.elements[8]*=_,Yi.elements[9]*=_,Yi.elements[10]*=_,e.setFromRotationMatrix(Yi),o.x=l,o.y=f,o.z=h,this}makePerspective(t,e,o,a,l,f,h=Vo){let p=this.elements,d=2*l/(e-t),g=2*l/(o-a),_=(e+t)/(e-t),y=(o+a)/(o-a),M,w;if(h===Vo)M=-(f+l)/(f-l),w=-2*f*l/(f-l);else if(h===jl)M=-f/(f-l),w=-f*l/(f-l);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+h);return p[0]=d,p[4]=0,p[8]=_,p[12]=0,p[1]=0,p[5]=g,p[9]=y,p[13]=0,p[2]=0,p[6]=0,p[10]=M,p[14]=w,p[3]=0,p[7]=0,p[11]=-1,p[15]=0,this}makeOrthographic(t,e,o,a,l,f,h=Vo){let p=this.elements,d=1/(e-t),g=1/(o-a),_=1/(f-l),y=(e+t)*d,M=(o+a)*g,w,T;if(h===Vo)w=(f+l)*_,T=-2*_;else if(h===jl)w=l*_,T=-1*_;else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+h);return p[0]=2*d,p[4]=0,p[8]=0,p[12]=-y,p[1]=0,p[5]=2*g,p[9]=0,p[13]=-M,p[2]=0,p[6]=0,p[10]=T,p[14]=-w,p[3]=0,p[7]=0,p[11]=0,p[15]=1,this}equals(t){let e=this.elements,o=t.elements;for(let a=0;a<16;a++)if(e[a]!==o[a])return!1;return!0}fromArray(t,e=0){for(let o=0;o<16;o++)this.elements[o]=t[o+e];return this}toArray(t=[],e=0){let o=this.elements;return t[e]=o[0],t[e+1]=o[1],t[e+2]=o[2],t[e+3]=o[3],t[e+4]=o[4],t[e+5]=o[5],t[e+6]=o[6],t[e+7]=o[7],t[e+8]=o[8],t[e+9]=o[9],t[e+10]=o[10],t[e+11]=o[11],t[e+12]=o[12],t[e+13]=o[13],t[e+14]=o[14],t[e+15]=o[15],t}},Ma=new mt,Yi=new zr,Ox=new mt(0,0,0),Dx=new mt(1,1,1),as=new mt,Il=new mt,vi=new mt,fg=new zr,hg=new gs,rc=class r{constructor(t=0,e=0,o=0,a=r.DEFAULT_ORDER){this.isEuler=!0,this._x=t,this._y=e,this._z=o,this._order=a}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get order(){return this._order}set order(t){this._order=t,this._onChangeCallback()}set(t,e,o,a=this._order){return this._x=t,this._y=e,this._z=o,this._order=a,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._order=t._order,this._onChangeCallback(),this}setFromRotationMatrix(t,e=this._order,o=!0){let a=t.elements,l=a[0],f=a[4],h=a[8],p=a[1],d=a[5],g=a[9],_=a[2],y=a[6],M=a[10];switch(e){case"XYZ":this._y=Math.asin(ai(h,-1,1)),Math.abs(h)<.9999999?(this._x=Math.atan2(-g,M),this._z=Math.atan2(-f,l)):(this._x=Math.atan2(y,d),this._z=0);break;case"YXZ":this._x=Math.asin(-ai(g,-1,1)),Math.abs(g)<.9999999?(this._y=Math.atan2(h,M),this._z=Math.atan2(p,d)):(this._y=Math.atan2(-_,l),this._z=0);break;case"ZXY":this._x=Math.asin(ai(y,-1,1)),Math.abs(y)<.9999999?(this._y=Math.atan2(-_,M),this._z=Math.atan2(-f,d)):(this._y=0,this._z=Math.atan2(p,l));break;case"ZYX":this._y=Math.asin(-ai(_,-1,1)),Math.abs(_)<.9999999?(this._x=Math.atan2(y,M),this._z=Math.atan2(p,l)):(this._x=0,this._z=Math.atan2(-f,d));break;case"YZX":this._z=Math.asin(ai(p,-1,1)),Math.abs(p)<.9999999?(this._x=Math.atan2(-g,d),this._y=Math.atan2(-_,l)):(this._x=0,this._y=Math.atan2(h,M));break;case"XZY":this._z=Math.asin(-ai(f,-1,1)),Math.abs(f)<.9999999?(this._x=Math.atan2(y,d),this._y=Math.atan2(h,l)):(this._x=Math.atan2(-g,M),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+e)}return this._order=e,o===!0&&this._onChangeCallback(),this}setFromQuaternion(t,e,o){return fg.makeRotationFromQuaternion(t),this.setFromRotationMatrix(fg,e,o)}setFromVector3(t,e=this._order){return this.set(t.x,t.y,t.z,e)}reorder(t){return hg.setFromEuler(this),this.setFromQuaternion(hg,t)}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._order===this._order}fromArray(t){return this._x=t[0],this._y=t[1],this._z=t[2],t[3]!==void 0&&(this._order=t[3]),this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._order,t}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}};rc.DEFAULT_ORDER="XYZ";var ic=class{constructor(){this.mask=1}set(t){this.mask=(1<<t|0)>>>0}enable(t){this.mask|=1<<t|0}enableAll(){this.mask=-1}toggle(t){this.mask^=1<<t|0}disable(t){this.mask&=~(1<<t|0)}disableAll(){this.mask=0}test(t){return(this.mask&t.mask)!==0}isEnabled(t){return(this.mask&(1<<t|0))!==0}},Fx=0,pg=new mt,Sa=new gs,Fo=new zr,Rl=new mt,Iu=new mt,Ux=new mt,Bx=new gs,dg=new mt(1,0,0),mg=new mt(0,1,0),gg=new mt(0,0,1),zx={type:"added"},kx={type:"removed"},fo=class r extends ms{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:Fx++}),this.uuid=ku(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=r.DEFAULT_UP.clone();let t=new mt,e=new rc,o=new gs,a=new mt(1,1,1);function l(){o.setFromEuler(e,!1)}function f(){e.setFromQuaternion(o,void 0,!1)}e._onChange(l),o._onChange(f),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:t},rotation:{configurable:!0,enumerable:!0,value:e},quaternion:{configurable:!0,enumerable:!0,value:o},scale:{configurable:!0,enumerable:!0,value:a},modelViewMatrix:{value:new zr},normalMatrix:{value:new ve}}),this.matrix=new zr,this.matrixWorld=new zr,this.matrixAutoUpdate=r.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.matrixWorldAutoUpdate=r.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.layers=new ic,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.userData={}}onBeforeRender(){}onAfterRender(){}applyMatrix4(t){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(t),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(t){return this.quaternion.premultiply(t),this}setRotationFromAxisAngle(t,e){this.quaternion.setFromAxisAngle(t,e)}setRotationFromEuler(t){this.quaternion.setFromEuler(t,!0)}setRotationFromMatrix(t){this.quaternion.setFromRotationMatrix(t)}setRotationFromQuaternion(t){this.quaternion.copy(t)}rotateOnAxis(t,e){return Sa.setFromAxisAngle(t,e),this.quaternion.multiply(Sa),this}rotateOnWorldAxis(t,e){return Sa.setFromAxisAngle(t,e),this.quaternion.premultiply(Sa),this}rotateX(t){return this.rotateOnAxis(dg,t)}rotateY(t){return this.rotateOnAxis(mg,t)}rotateZ(t){return this.rotateOnAxis(gg,t)}translateOnAxis(t,e){return pg.copy(t).applyQuaternion(this.quaternion),this.position.add(pg.multiplyScalar(e)),this}translateX(t){return this.translateOnAxis(dg,t)}translateY(t){return this.translateOnAxis(mg,t)}translateZ(t){return this.translateOnAxis(gg,t)}localToWorld(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(this.matrixWorld)}worldToLocal(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(Fo.copy(this.matrixWorld).invert())}lookAt(t,e,o){t.isVector3?Rl.copy(t):Rl.set(t,e,o);let a=this.parent;this.updateWorldMatrix(!0,!1),Iu.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?Fo.lookAt(Iu,Rl,this.up):Fo.lookAt(Rl,Iu,this.up),this.quaternion.setFromRotationMatrix(Fo),a&&(Fo.extractRotation(a.matrixWorld),Sa.setFromRotationMatrix(Fo),this.quaternion.premultiply(Sa.invert()))}add(t){if(arguments.length>1){for(let e=0;e<arguments.length;e++)this.add(arguments[e]);return this}return t===this?(console.error("THREE.Object3D.add: object can\'t be added as a child of itself.",t),this):(t&&t.isObject3D?(t.parent!==null&&t.parent.remove(t),t.parent=this,this.children.push(t),t.dispatchEvent(zx)):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",t),this)}remove(t){if(arguments.length>1){for(let o=0;o<arguments.length;o++)this.remove(arguments[o]);return this}let e=this.children.indexOf(t);return e!==-1&&(t.parent=null,this.children.splice(e,1),t.dispatchEvent(kx)),this}removeFromParent(){let t=this.parent;return t!==null&&t.remove(this),this}clear(){return this.remove(...this.children)}attach(t){return this.updateWorldMatrix(!0,!1),Fo.copy(this.matrixWorld).invert(),t.parent!==null&&(t.parent.updateWorldMatrix(!0,!1),Fo.multiply(t.parent.matrixWorld)),t.applyMatrix4(Fo),this.add(t),t.updateWorldMatrix(!1,!0),this}getObjectById(t){return this.getObjectByProperty("id",t)}getObjectByName(t){return this.getObjectByProperty("name",t)}getObjectByProperty(t,e){if(this[t]===e)return this;for(let o=0,a=this.children.length;o<a;o++){let f=this.children[o].getObjectByProperty(t,e);if(f!==void 0)return f}}getObjectsByProperty(t,e){let o=[];this[t]===e&&o.push(this);for(let a=0,l=this.children.length;a<l;a++){let f=this.children[a].getObjectsByProperty(t,e);f.length>0&&(o=o.concat(f))}return o}getWorldPosition(t){return this.updateWorldMatrix(!0,!1),t.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Iu,t,Ux),t}getWorldScale(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Iu,Bx,t),t}getWorldDirection(t){this.updateWorldMatrix(!0,!1);let e=this.matrixWorld.elements;return t.set(e[8],e[9],e[10]).normalize()}raycast(){}traverse(t){t(this);let e=this.children;for(let o=0,a=e.length;o<a;o++)e[o].traverse(t)}traverseVisible(t){if(this.visible===!1)return;t(this);let e=this.children;for(let o=0,a=e.length;o<a;o++)e[o].traverseVisible(t)}traverseAncestors(t){let e=this.parent;e!==null&&(t(e),e.traverseAncestors(t))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(t){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||t)&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,t=!0);let e=this.children;for(let o=0,a=e.length;o<a;o++){let l=e[o];(l.matrixWorldAutoUpdate===!0||t===!0)&&l.updateMatrixWorld(t)}}updateWorldMatrix(t,e){let o=this.parent;if(t===!0&&o!==null&&o.matrixWorldAutoUpdate===!0&&o.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),e===!0){let a=this.children;for(let l=0,f=a.length;l<f;l++){let h=a[l];h.matrixWorldAutoUpdate===!0&&h.updateWorldMatrix(!1,!0)}}}toJSON(t){let e=t===void 0||typeof t=="string",o={};e&&(t={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},o.metadata={version:4.6,type:"Object",generator:"Object3D.toJSON"});let a={};a.uuid=this.uuid,a.type=this.type,this.name!==""&&(a.name=this.name),this.castShadow===!0&&(a.castShadow=!0),this.receiveShadow===!0&&(a.receiveShadow=!0),this.visible===!1&&(a.visible=!1),this.frustumCulled===!1&&(a.frustumCulled=!1),this.renderOrder!==0&&(a.renderOrder=this.renderOrder),Object.keys(this.userData).length>0&&(a.userData=this.userData),a.layers=this.layers.mask,a.matrix=this.matrix.toArray(),a.up=this.up.toArray(),this.matrixAutoUpdate===!1&&(a.matrixAutoUpdate=!1),this.isInstancedMesh&&(a.type="InstancedMesh",a.count=this.count,a.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(a.instanceColor=this.instanceColor.toJSON()));function l(h,p){return h[p.uuid]===void 0&&(h[p.uuid]=p.toJSON(t)),p.uuid}if(this.isScene)this.background&&(this.background.isColor?a.background=this.background.toJSON():this.background.isTexture&&(a.background=this.background.toJSON(t).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(a.environment=this.environment.toJSON(t).uuid);else if(this.isMesh||this.isLine||this.isPoints){a.geometry=l(t.geometries,this.geometry);let h=this.geometry.parameters;if(h!==void 0&&h.shapes!==void 0){let p=h.shapes;if(Array.isArray(p))for(let d=0,g=p.length;d<g;d++){let _=p[d];l(t.shapes,_)}else l(t.shapes,p)}}if(this.isSkinnedMesh&&(a.bindMode=this.bindMode,a.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(l(t.skeletons,this.skeleton),a.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){let h=[];for(let p=0,d=this.material.length;p<d;p++)h.push(l(t.materials,this.material[p]));a.material=h}else a.material=l(t.materials,this.material);if(this.children.length>0){a.children=[];for(let h=0;h<this.children.length;h++)a.children.push(this.children[h].toJSON(t).object)}if(this.animations.length>0){a.animations=[];for(let h=0;h<this.animations.length;h++){let p=this.animations[h];a.animations.push(l(t.animations,p))}}if(e){let h=f(t.geometries),p=f(t.materials),d=f(t.textures),g=f(t.images),_=f(t.shapes),y=f(t.skeletons),M=f(t.animations),w=f(t.nodes);h.length>0&&(o.geometries=h),p.length>0&&(o.materials=p),d.length>0&&(o.textures=d),g.length>0&&(o.images=g),_.length>0&&(o.shapes=_),y.length>0&&(o.skeletons=y),M.length>0&&(o.animations=M),w.length>0&&(o.nodes=w)}return o.object=a,o;function f(h){let p=[];for(let d in h){let g=h[d];delete g.metadata,p.push(g)}return p}}clone(t){return new this.constructor().copy(this,t)}copy(t,e=!0){if(this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),this.rotation.order=t.rotation.order,this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.matrixWorldAutoUpdate=t.matrixWorldAutoUpdate,this.layers.mask=t.layers.mask,this.visible=t.visible,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow,this.frustumCulled=t.frustumCulled,this.renderOrder=t.renderOrder,this.animations=t.animations.slice(),this.userData=JSON.parse(JSON.stringify(t.userData)),e===!0)for(let o=0;o<t.children.length;o++){let a=t.children[o];this.add(a.clone())}return this}};fo.DEFAULT_UP=new mt(0,1,0);fo.DEFAULT_MATRIX_AUTO_UPDATE=!0;fo.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;var Zi=new mt,Uo=new mt,Zf=new mt,Bo=new mt,wa=new mt,ba=new mt,yg=new mt,Jf=new mt,$f=new mt,Kf=new mt,Ll=!1,Oa=class r{constructor(t=new mt,e=new mt,o=new mt){this.a=t,this.b=e,this.c=o}static getNormal(t,e,o,a){a.subVectors(o,e),Zi.subVectors(t,e),a.cross(Zi);let l=a.lengthSq();return l>0?a.multiplyScalar(1/Math.sqrt(l)):a.set(0,0,0)}static getBarycoord(t,e,o,a,l){Zi.subVectors(a,e),Uo.subVectors(o,e),Zf.subVectors(t,e);let f=Zi.dot(Zi),h=Zi.dot(Uo),p=Zi.dot(Zf),d=Uo.dot(Uo),g=Uo.dot(Zf),_=f*d-h*h;if(_===0)return l.set(-2,-1,-1);let y=1/_,M=(d*p-h*g)*y,w=(f*g-h*p)*y;return l.set(1-M-w,w,M)}static containsPoint(t,e,o,a){return this.getBarycoord(t,e,o,a,Bo),Bo.x>=0&&Bo.y>=0&&Bo.x+Bo.y<=1}static getUV(t,e,o,a,l,f,h,p){return Ll===!1&&(console.warn("THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation()."),Ll=!0),this.getInterpolation(t,e,o,a,l,f,h,p)}static getInterpolation(t,e,o,a,l,f,h,p){return this.getBarycoord(t,e,o,a,Bo),p.setScalar(0),p.addScaledVector(l,Bo.x),p.addScaledVector(f,Bo.y),p.addScaledVector(h,Bo.z),p}static isFrontFacing(t,e,o,a){return Zi.subVectors(o,e),Uo.subVectors(t,e),Zi.cross(Uo).dot(a)<0}set(t,e,o){return this.a.copy(t),this.b.copy(e),this.c.copy(o),this}setFromPointsAndIndices(t,e,o,a){return this.a.copy(t[e]),this.b.copy(t[o]),this.c.copy(t[a]),this}setFromAttributeAndIndices(t,e,o,a){return this.a.fromBufferAttribute(t,e),this.b.fromBufferAttribute(t,o),this.c.fromBufferAttribute(t,a),this}clone(){return new this.constructor().copy(this)}copy(t){return this.a.copy(t.a),this.b.copy(t.b),this.c.copy(t.c),this}getArea(){return Zi.subVectors(this.c,this.b),Uo.subVectors(this.a,this.b),Zi.cross(Uo).length()*.5}getMidpoint(t){return t.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(t){return r.getNormal(this.a,this.b,this.c,t)}getPlane(t){return t.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(t,e){return r.getBarycoord(t,this.a,this.b,this.c,e)}getUV(t,e,o,a,l){return Ll===!1&&(console.warn("THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation()."),Ll=!0),r.getInterpolation(t,this.a,this.b,this.c,e,o,a,l)}getInterpolation(t,e,o,a,l){return r.getInterpolation(t,this.a,this.b,this.c,e,o,a,l)}containsPoint(t){return r.containsPoint(t,this.a,this.b,this.c)}isFrontFacing(t){return r.isFrontFacing(this.a,this.b,this.c,t)}intersectsBox(t){return t.intersectsTriangle(this)}closestPointToPoint(t,e){let o=this.a,a=this.b,l=this.c,f,h;wa.subVectors(a,o),ba.subVectors(l,o),Jf.subVectors(t,o);let p=wa.dot(Jf),d=ba.dot(Jf);if(p<=0&&d<=0)return e.copy(o);$f.subVectors(t,a);let g=wa.dot($f),_=ba.dot($f);if(g>=0&&_<=g)return e.copy(a);let y=p*_-g*d;if(y<=0&&p>=0&&g<=0)return f=p/(p-g),e.copy(o).addScaledVector(wa,f);Kf.subVectors(t,l);let M=wa.dot(Kf),w=ba.dot(Kf);if(w>=0&&M<=w)return e.copy(l);let T=M*d-p*w;if(T<=0&&d>=0&&w<=0)return h=d/(d-w),e.copy(o).addScaledVector(ba,h);let x=g*w-M*_;if(x<=0&&_-g>=0&&M-w>=0)return yg.subVectors(l,a),h=(_-g)/(_-g+(M-w)),e.copy(a).addScaledVector(yg,h);let v=1/(x+T+y);return f=T*v,h=y*v,e.copy(o).addScaledVector(wa,f).addScaledVector(ba,h)}equals(t){return t.a.equals(this.a)&&t.b.equals(this.b)&&t.c.equals(this.c)}},Gx=0,Ha=class extends ms{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:Gx++}),this.uuid=ku(),this.name="",this.type="Material",this.blending=Ua,this.side=ds,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=qg,this.blendDst=Xg,this.blendEquation=Na,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=oh,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=_x,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=Ff,this.stencilZFail=Ff,this.stencilZPass=Ff,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.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(t){this._alphaTest>0!=t>0&&this.version++,this._alphaTest=t}onBuild(){}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(t){if(t!==void 0)for(let e in t){let o=t[e];if(o===void 0){console.warn(`THREE.Material: parameter \'${e}\' has value of undefined.`);continue}let a=this[e];if(a===void 0){console.warn(`THREE.Material: \'${e}\' is not a property of THREE.${this.type}.`);continue}a&&a.isColor?a.set(o):a&&a.isVector3&&o&&o.isVector3?a.copy(o):this[e]=o}}toJSON(t){let e=t===void 0||typeof t=="string";e&&(t={textures:{},images:{}});let o={metadata:{version:4.6,type:"Material",generator:"Material.toJSON"}};o.uuid=this.uuid,o.type=this.type,this.name!==""&&(o.name=this.name),this.color&&this.color.isColor&&(o.color=this.color.getHex()),this.roughness!==void 0&&(o.roughness=this.roughness),this.metalness!==void 0&&(o.metalness=this.metalness),this.sheen!==void 0&&(o.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(o.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(o.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(o.emissive=this.emissive.getHex()),this.emissiveIntensity&&this.emissiveIntensity!==1&&(o.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(o.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(o.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(o.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(o.shininess=this.shininess),this.clearcoat!==void 0&&(o.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(o.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(o.clearcoatMap=this.clearcoatMap.toJSON(t).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(o.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(t).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(o.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(t).uuid,o.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.iridescence!==void 0&&(o.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(o.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(o.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(o.iridescenceMap=this.iridescenceMap.toJSON(t).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(o.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(t).uuid),this.anisotropy!==void 0&&(o.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(o.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(o.anisotropyMap=this.anisotropyMap.toJSON(t).uuid),this.map&&this.map.isTexture&&(o.map=this.map.toJSON(t).uuid),this.matcap&&this.matcap.isTexture&&(o.matcap=this.matcap.toJSON(t).uuid),this.alphaMap&&this.alphaMap.isTexture&&(o.alphaMap=this.alphaMap.toJSON(t).uuid),this.lightMap&&this.lightMap.isTexture&&(o.lightMap=this.lightMap.toJSON(t).uuid,o.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(o.aoMap=this.aoMap.toJSON(t).uuid,o.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(o.bumpMap=this.bumpMap.toJSON(t).uuid,o.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(o.normalMap=this.normalMap.toJSON(t).uuid,o.normalMapType=this.normalMapType,o.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(o.displacementMap=this.displacementMap.toJSON(t).uuid,o.displacementScale=this.displacementScale,o.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(o.roughnessMap=this.roughnessMap.toJSON(t).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(o.metalnessMap=this.metalnessMap.toJSON(t).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(o.emissiveMap=this.emissiveMap.toJSON(t).uuid),this.specularMap&&this.specularMap.isTexture&&(o.specularMap=this.specularMap.toJSON(t).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(o.specularIntensityMap=this.specularIntensityMap.toJSON(t).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(o.specularColorMap=this.specularColorMap.toJSON(t).uuid),this.envMap&&this.envMap.isTexture&&(o.envMap=this.envMap.toJSON(t).uuid,this.combine!==void 0&&(o.combine=this.combine)),this.envMapIntensity!==void 0&&(o.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(o.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(o.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(o.gradientMap=this.gradientMap.toJSON(t).uuid),this.transmission!==void 0&&(o.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(o.transmissionMap=this.transmissionMap.toJSON(t).uuid),this.thickness!==void 0&&(o.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(o.thicknessMap=this.thicknessMap.toJSON(t).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(o.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(o.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(o.size=this.size),this.shadowSide!==null&&(o.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(o.sizeAttenuation=this.sizeAttenuation),this.blending!==Ua&&(o.blending=this.blending),this.side!==ds&&(o.side=this.side),this.vertexColors===!0&&(o.vertexColors=!0),this.opacity<1&&(o.opacity=this.opacity),this.transparent===!0&&(o.transparent=!0),o.depthFunc=this.depthFunc,o.depthTest=this.depthTest,o.depthWrite=this.depthWrite,o.colorWrite=this.colorWrite,o.stencilWrite=this.stencilWrite,o.stencilWriteMask=this.stencilWriteMask,o.stencilFunc=this.stencilFunc,o.stencilRef=this.stencilRef,o.stencilFuncMask=this.stencilFuncMask,o.stencilFail=this.stencilFail,o.stencilZFail=this.stencilZFail,o.stencilZPass=this.stencilZPass,this.rotation!==void 0&&this.rotation!==0&&(o.rotation=this.rotation),this.polygonOffset===!0&&(o.polygonOffset=!0),this.polygonOffsetFactor!==0&&(o.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(o.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(o.linewidth=this.linewidth),this.dashSize!==void 0&&(o.dashSize=this.dashSize),this.gapSize!==void 0&&(o.gapSize=this.gapSize),this.scale!==void 0&&(o.scale=this.scale),this.dithering===!0&&(o.dithering=!0),this.alphaTest>0&&(o.alphaTest=this.alphaTest),this.alphaHash===!0&&(o.alphaHash=!0),this.alphaToCoverage===!0&&(o.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(o.premultipliedAlpha=!0),this.forceSinglePass===!0&&(o.forceSinglePass=!0),this.wireframe===!0&&(o.wireframe=!0),this.wireframeLinewidth>1&&(o.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(o.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(o.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(o.flatShading=!0),this.visible===!1&&(o.visible=!1),this.toneMapped===!1&&(o.toneMapped=!1),this.fog===!1&&(o.fog=!1),Object.keys(this.userData).length>0&&(o.userData=this.userData);function a(l){let f=[];for(let h in l){let p=l[h];delete p.metadata,f.push(p)}return f}if(e){let l=a(t.textures),f=a(t.images);l.length>0&&(o.textures=l),f.length>0&&(o.images=f)}return o}clone(){return new this.constructor().copy(this)}copy(t){this.name=t.name,this.blending=t.blending,this.side=t.side,this.vertexColors=t.vertexColors,this.opacity=t.opacity,this.transparent=t.transparent,this.blendSrc=t.blendSrc,this.blendDst=t.blendDst,this.blendEquation=t.blendEquation,this.blendSrcAlpha=t.blendSrcAlpha,this.blendDstAlpha=t.blendDstAlpha,this.blendEquationAlpha=t.blendEquationAlpha,this.depthFunc=t.depthFunc,this.depthTest=t.depthTest,this.depthWrite=t.depthWrite,this.stencilWriteMask=t.stencilWriteMask,this.stencilFunc=t.stencilFunc,this.stencilRef=t.stencilRef,this.stencilFuncMask=t.stencilFuncMask,this.stencilFail=t.stencilFail,this.stencilZFail=t.stencilZFail,this.stencilZPass=t.stencilZPass,this.stencilWrite=t.stencilWrite;let e=t.clippingPlanes,o=null;if(e!==null){let a=e.length;o=new Array(a);for(let l=0;l!==a;++l)o[l]=e[l].clone()}return this.clippingPlanes=o,this.clipIntersection=t.clipIntersection,this.clipShadows=t.clipShadows,this.shadowSide=t.shadowSide,this.colorWrite=t.colorWrite,this.precision=t.precision,this.polygonOffset=t.polygonOffset,this.polygonOffsetFactor=t.polygonOffsetFactor,this.polygonOffsetUnits=t.polygonOffsetUnits,this.dithering=t.dithering,this.alphaTest=t.alphaTest,this.alphaHash=t.alphaHash,this.alphaToCoverage=t.alphaToCoverage,this.premultipliedAlpha=t.premultipliedAlpha,this.forceSinglePass=t.forceSinglePass,this.visible=t.visible,this.toneMapped=t.toneMapped,this.userData=JSON.parse(JSON.stringify(t.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(t){t===!0&&this.version++}},r0={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},us={h:0,s:0,l:0},Nl={h:0,s:0,l:0};function jf(r,t,e){return e<0&&(e+=1),e>1&&(e-=1),e<1/6?r+(t-r)*6*e:e<1/2?t:e<2/3?r+(t-r)*6*(2/3-e):r}var xn=class{constructor(t,e,o){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(t,e,o)}set(t,e,o){if(e===void 0&&o===void 0){let a=t;a&&a.isColor?this.copy(a):typeof a=="number"?this.setHex(a):typeof a=="string"&&this.setStyle(a)}else this.setRGB(t,e,o);return this}setScalar(t){return this.r=t,this.g=t,this.b=t,this}setHex(t,e=br){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(t&255)/255,gn.toWorkingColorSpace(this,e),this}setRGB(t,e,o,a=gn.workingColorSpace){return this.r=t,this.g=e,this.b=o,gn.toWorkingColorSpace(this,a),this}setHSL(t,e,o,a=gn.workingColorSpace){if(t=Cx(t,1),e=ai(e,0,1),o=ai(o,0,1),e===0)this.r=this.g=this.b=o;else{let l=o<=.5?o*(1+e):o+e-o*e,f=2*o-l;this.r=jf(f,l,t+1/3),this.g=jf(f,l,t),this.b=jf(f,l,t-1/3)}return gn.toWorkingColorSpace(this,a),this}setStyle(t,e=br){function o(l){l!==void 0&&parseFloat(l)<1&&console.warn("THREE.Color: Alpha component of "+t+" will be ignored.")}let a;if(a=/^(\\w+)\\(([^\\)]*)\\)/.exec(t)){let l,f=a[1],h=a[2];switch(f){case"rgb":case"rgba":if(l=/^\\s*(\\d+)\\s*,\\s*(\\d+)\\s*,\\s*(\\d+)\\s*(?:,\\s*(\\d*\\.?\\d+)\\s*)?$/.exec(h))return o(l[4]),this.setRGB(Math.min(255,parseInt(l[1],10))/255,Math.min(255,parseInt(l[2],10))/255,Math.min(255,parseInt(l[3],10))/255,e);if(l=/^\\s*(\\d+)\\%\\s*,\\s*(\\d+)\\%\\s*,\\s*(\\d+)\\%\\s*(?:,\\s*(\\d*\\.?\\d+)\\s*)?$/.exec(h))return o(l[4]),this.setRGB(Math.min(100,parseInt(l[1],10))/100,Math.min(100,parseInt(l[2],10))/100,Math.min(100,parseInt(l[3],10))/100,e);break;case"hsl":case"hsla":if(l=/^\\s*(\\d*\\.?\\d+)\\s*,\\s*(\\d*\\.?\\d+)\\%\\s*,\\s*(\\d*\\.?\\d+)\\%\\s*(?:,\\s*(\\d*\\.?\\d+)\\s*)?$/.exec(h))return o(l[4]),this.setHSL(parseFloat(l[1])/360,parseFloat(l[2])/100,parseFloat(l[3])/100,e);break;default:console.warn("THREE.Color: Unknown color model "+t)}}else if(a=/^\\#([A-Fa-f\\d]+)$/.exec(t)){let l=a[1],f=l.length;if(f===3)return this.setRGB(parseInt(l.charAt(0),16)/15,parseInt(l.charAt(1),16)/15,parseInt(l.charAt(2),16)/15,e);if(f===6)return this.setHex(parseInt(l,16),e);console.warn("THREE.Color: Invalid hex color "+t)}else if(t&&t.length>0)return this.setColorName(t,e);return this}setColorName(t,e=br){let o=r0[t.toLowerCase()];return o!==void 0?this.setHex(o,e):console.warn("THREE.Color: Unknown color "+t),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(t){return this.r=t.r,this.g=t.g,this.b=t.b,this}copySRGBToLinear(t){return this.r=Ba(t.r),this.g=Ba(t.g),this.b=Ba(t.b),this}copyLinearToSRGB(t){return this.r=kf(t.r),this.g=kf(t.g),this.b=kf(t.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(t=br){return gn.fromWorkingColorSpace(Br.copy(this),t),Math.round(ai(Br.r*255,0,255))*65536+Math.round(ai(Br.g*255,0,255))*256+Math.round(ai(Br.b*255,0,255))}getHexString(t=br){return("000000"+this.getHex(t).toString(16)).slice(-6)}getHSL(t,e=gn.workingColorSpace){gn.fromWorkingColorSpace(Br.copy(this),e);let o=Br.r,a=Br.g,l=Br.b,f=Math.max(o,a,l),h=Math.min(o,a,l),p,d,g=(h+f)/2;if(h===f)p=0,d=0;else{let _=f-h;switch(d=g<=.5?_/(f+h):_/(2-f-h),f){case o:p=(a-l)/_+(a<l?6:0);break;case a:p=(l-o)/_+2;break;case l:p=(o-a)/_+4;break}p/=6}return t.h=p,t.s=d,t.l=g,t}getRGB(t,e=gn.workingColorSpace){return gn.fromWorkingColorSpace(Br.copy(this),e),t.r=Br.r,t.g=Br.g,t.b=Br.b,t}getStyle(t=br){gn.fromWorkingColorSpace(Br.copy(this),t);let e=Br.r,o=Br.g,a=Br.b;return t!==br?`color(${t} ${e.toFixed(3)} ${o.toFixed(3)} ${a.toFixed(3)})`:`rgb(${Math.round(e*255)},${Math.round(o*255)},${Math.round(a*255)})`}offsetHSL(t,e,o){return this.getHSL(us),this.setHSL(us.h+t,us.s+e,us.l+o)}add(t){return this.r+=t.r,this.g+=t.g,this.b+=t.b,this}addColors(t,e){return this.r=t.r+e.r,this.g=t.g+e.g,this.b=t.b+e.b,this}addScalar(t){return this.r+=t,this.g+=t,this.b+=t,this}sub(t){return this.r=Math.max(0,this.r-t.r),this.g=Math.max(0,this.g-t.g),this.b=Math.max(0,this.b-t.b),this}multiply(t){return this.r*=t.r,this.g*=t.g,this.b*=t.b,this}multiplyScalar(t){return this.r*=t,this.g*=t,this.b*=t,this}lerp(t,e){return this.r+=(t.r-this.r)*e,this.g+=(t.g-this.g)*e,this.b+=(t.b-this.b)*e,this}lerpColors(t,e,o){return this.r=t.r+(e.r-t.r)*o,this.g=t.g+(e.g-t.g)*o,this.b=t.b+(e.b-t.b)*o,this}lerpHSL(t,e){this.getHSL(us),t.getHSL(Nl);let o=Bf(us.h,Nl.h,e),a=Bf(us.s,Nl.s,e),l=Bf(us.l,Nl.l,e);return this.setHSL(o,a,l),this}setFromVector3(t){return this.r=t.x,this.g=t.y,this.b=t.z,this}applyMatrix3(t){let e=this.r,o=this.g,a=this.b,l=t.elements;return this.r=l[0]*e+l[3]*o+l[6]*a,this.g=l[1]*e+l[4]*o+l[7]*a,this.b=l[2]*e+l[5]*o+l[8]*a,this}equals(t){return t.r===this.r&&t.g===this.g&&t.b===this.b}fromArray(t,e=0){return this.r=t[e],this.g=t[e+1],this.b=t[e+2],this}toArray(t=[],e=0){return t[e]=this.r,t[e+1]=this.g,t[e+2]=this.b,t}fromBufferAttribute(t,e){return this.r=t.getX(e),this.g=t.getY(e),this.b=t.getZ(e),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}},Br=new xn;xn.NAMES=r0;var oc=class extends Ha{constructor(t){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new xn(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.combine=Yg,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.fog=t.fog,this}};var Jn=new mt,Ol=new fn,Di=class{constructor(t,e,o=!1){if(Array.isArray(t))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,this.name="",this.array=t,this.itemSize=e,this.count=t!==void 0?t.length/e:0,this.normalized=o,this.usage=ig,this.updateRange={offset:0,count:-1},this.gpuType=cs,this.version=0}onUploadCallback(){}set needsUpdate(t){t===!0&&this.version++}setUsage(t){return this.usage=t,this}copy(t){return this.name=t.name,this.array=new t.array.constructor(t.array),this.itemSize=t.itemSize,this.count=t.count,this.normalized=t.normalized,this.usage=t.usage,this.gpuType=t.gpuType,this}copyAt(t,e,o){t*=this.itemSize,o*=e.itemSize;for(let a=0,l=this.itemSize;a<l;a++)this.array[t+a]=e.array[o+a];return this}copyArray(t){return this.array.set(t),this}applyMatrix3(t){if(this.itemSize===2)for(let e=0,o=this.count;e<o;e++)Ol.fromBufferAttribute(this,e),Ol.applyMatrix3(t),this.setXY(e,Ol.x,Ol.y);else if(this.itemSize===3)for(let e=0,o=this.count;e<o;e++)Jn.fromBufferAttribute(this,e),Jn.applyMatrix3(t),this.setXYZ(e,Jn.x,Jn.y,Jn.z);return this}applyMatrix4(t){for(let e=0,o=this.count;e<o;e++)Jn.fromBufferAttribute(this,e),Jn.applyMatrix4(t),this.setXYZ(e,Jn.x,Jn.y,Jn.z);return this}applyNormalMatrix(t){for(let e=0,o=this.count;e<o;e++)Jn.fromBufferAttribute(this,e),Jn.applyNormalMatrix(t),this.setXYZ(e,Jn.x,Jn.y,Jn.z);return this}transformDirection(t){for(let e=0,o=this.count;e<o;e++)Jn.fromBufferAttribute(this,e),Jn.transformDirection(t),this.setXYZ(e,Jn.x,Jn.y,Jn.z);return this}set(t,e=0){return this.array.set(t,e),this}getComponent(t,e){let o=this.array[t*this.itemSize+e];return this.normalized&&(o=Au(o,this.array)),o}setComponent(t,e,o){return this.normalized&&(o=si(o,this.array)),this.array[t*this.itemSize+e]=o,this}getX(t){let e=this.array[t*this.itemSize];return this.normalized&&(e=Au(e,this.array)),e}setX(t,e){return this.normalized&&(e=si(e,this.array)),this.array[t*this.itemSize]=e,this}getY(t){let e=this.array[t*this.itemSize+1];return this.normalized&&(e=Au(e,this.array)),e}setY(t,e){return this.normalized&&(e=si(e,this.array)),this.array[t*this.itemSize+1]=e,this}getZ(t){let e=this.array[t*this.itemSize+2];return this.normalized&&(e=Au(e,this.array)),e}setZ(t,e){return this.normalized&&(e=si(e,this.array)),this.array[t*this.itemSize+2]=e,this}getW(t){let e=this.array[t*this.itemSize+3];return this.normalized&&(e=Au(e,this.array)),e}setW(t,e){return this.normalized&&(e=si(e,this.array)),this.array[t*this.itemSize+3]=e,this}setXY(t,e,o){return t*=this.itemSize,this.normalized&&(e=si(e,this.array),o=si(o,this.array)),this.array[t+0]=e,this.array[t+1]=o,this}setXYZ(t,e,o,a){return t*=this.itemSize,this.normalized&&(e=si(e,this.array),o=si(o,this.array),a=si(a,this.array)),this.array[t+0]=e,this.array[t+1]=o,this.array[t+2]=a,this}setXYZW(t,e,o,a,l){return t*=this.itemSize,this.normalized&&(e=si(e,this.array),o=si(o,this.array),a=si(a,this.array),l=si(l,this.array)),this.array[t+0]=e,this.array[t+1]=o,this.array[t+2]=a,this.array[t+3]=l,this}onUpload(t){return this.onUploadCallback=t,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){let t={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return this.name!==""&&(t.name=this.name),this.usage!==ig&&(t.usage=this.usage),(this.updateRange.offset!==0||this.updateRange.count!==-1)&&(t.updateRange=this.updateRange),t}};var sc=class extends Di{constructor(t,e,o){super(new Uint16Array(t),e,o)}};var ac=class extends Di{constructor(t,e,o){super(new Uint32Array(t),e,o)}};var Ho=class extends Di{constructor(t,e,o){super(new Float32Array(t),e,o)}};var Vx=0,Li=new zr,Qf=new fo,Ta=new mt,_i=new Xs,Ru=new Xs,dr=new mt,Ys=class r extends ms{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:Vx++}),this.uuid=ku(),this.name="",this.type="BufferGeometry",this.index=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(t){return Array.isArray(t)?this.index=new(n0(t)?ac:sc)(t,1):this.index=t,this}getAttribute(t){return this.attributes[t]}setAttribute(t,e){return this.attributes[t]=e,this}deleteAttribute(t){return delete this.attributes[t],this}hasAttribute(t){return this.attributes[t]!==void 0}addGroup(t,e,o=0){this.groups.push({start:t,count:e,materialIndex:o})}clearGroups(){this.groups=[]}setDrawRange(t,e){this.drawRange.start=t,this.drawRange.count=e}applyMatrix4(t){let e=this.attributes.position;e!==void 0&&(e.applyMatrix4(t),e.needsUpdate=!0);let o=this.attributes.normal;if(o!==void 0){let l=new ve().getNormalMatrix(t);o.applyNormalMatrix(l),o.needsUpdate=!0}let a=this.attributes.tangent;return a!==void 0&&(a.transformDirection(t),a.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(t){return Li.makeRotationFromQuaternion(t),this.applyMatrix4(Li),this}rotateX(t){return Li.makeRotationX(t),this.applyMatrix4(Li),this}rotateY(t){return Li.makeRotationY(t),this.applyMatrix4(Li),this}rotateZ(t){return Li.makeRotationZ(t),this.applyMatrix4(Li),this}translate(t,e,o){return Li.makeTranslation(t,e,o),this.applyMatrix4(Li),this}scale(t,e,o){return Li.makeScale(t,e,o),this.applyMatrix4(Li),this}lookAt(t){return Qf.lookAt(t),Qf.updateMatrix(),this.applyMatrix4(Qf.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(Ta).negate(),this.translate(Ta.x,Ta.y,Ta.z),this}setFromPoints(t){let e=[];for(let o=0,a=t.length;o<a;o++){let l=t[o];e.push(l.x,l.y,l.z||0)}return this.setAttribute("position",new Ho(e,3)),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Xs);let t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.isGLBufferAttribute){console.error(\'THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box. Alternatively set "mesh.frustumCulled" to "false".\',this),this.boundingBox.set(new mt(-1/0,-1/0,-1/0),new mt(1/0,1/0,1/0));return}if(t!==void 0){if(this.boundingBox.setFromBufferAttribute(t),e)for(let o=0,a=e.length;o<a;o++){let l=e[o];_i.setFromBufferAttribute(l),this.morphTargetsRelative?(dr.addVectors(this.boundingBox.min,_i.min),this.boundingBox.expandByPoint(dr),dr.addVectors(this.boundingBox.max,_i.max),this.boundingBox.expandByPoint(dr)):(this.boundingBox.expandByPoint(_i.min),this.boundingBox.expandByPoint(_i.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error(\'THREE.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 Uu);let t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.isGLBufferAttribute){console.error(\'THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere. Alternatively set "mesh.frustumCulled" to "false".\',this),this.boundingSphere.set(new mt,1/0);return}if(t){let o=this.boundingSphere.center;if(_i.setFromBufferAttribute(t),e)for(let l=0,f=e.length;l<f;l++){let h=e[l];Ru.setFromBufferAttribute(h),this.morphTargetsRelative?(dr.addVectors(_i.min,Ru.min),_i.expandByPoint(dr),dr.addVectors(_i.max,Ru.max),_i.expandByPoint(dr)):(_i.expandByPoint(Ru.min),_i.expandByPoint(Ru.max))}_i.getCenter(o);let a=0;for(let l=0,f=t.count;l<f;l++)dr.fromBufferAttribute(t,l),a=Math.max(a,o.distanceToSquared(dr));if(e)for(let l=0,f=e.length;l<f;l++){let h=e[l],p=this.morphTargetsRelative;for(let d=0,g=h.count;d<g;d++)dr.fromBufferAttribute(h,d),p&&(Ta.fromBufferAttribute(t,d),dr.add(Ta)),a=Math.max(a,o.distanceToSquared(dr))}this.boundingSphere.radius=Math.sqrt(a),isNaN(this.boundingSphere.radius)&&console.error(\'THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.\',this)}}computeTangents(){let t=this.index,e=this.attributes;if(t===null||e.position===void 0||e.normal===void 0||e.uv===void 0){console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}let o=t.array,a=e.position.array,l=e.normal.array,f=e.uv.array,h=a.length/3;this.hasAttribute("tangent")===!1&&this.setAttribute("tangent",new Di(new Float32Array(4*h),4));let p=this.getAttribute("tangent").array,d=[],g=[];for(let q=0;q<h;q++)d[q]=new mt,g[q]=new mt;let _=new mt,y=new mt,M=new mt,w=new fn,T=new fn,x=new fn,v=new mt,C=new mt;function S(q,nt,k){_.fromArray(a,q*3),y.fromArray(a,nt*3),M.fromArray(a,k*3),w.fromArray(f,q*2),T.fromArray(f,nt*2),x.fromArray(f,k*2),y.sub(_),M.sub(_),T.sub(w),x.sub(w);let xt=1/(T.x*x.y-x.x*T.y);isFinite(xt)&&(v.copy(y).multiplyScalar(x.y).addScaledVector(M,-T.y).multiplyScalar(xt),C.copy(M).multiplyScalar(T.x).addScaledVector(y,-x.x).multiplyScalar(xt),d[q].add(v),d[nt].add(v),d[k].add(v),g[q].add(C),g[nt].add(C),g[k].add(C))}let O=this.groups;O.length===0&&(O=[{start:0,count:o.length}]);for(let q=0,nt=O.length;q<nt;++q){let k=O[q],xt=k.start,X=k.count;for(let it=xt,vt=xt+X;it<vt;it+=3)S(o[it+0],o[it+1],o[it+2])}let F=new mt,G=new mt,z=new mt,L=new mt;function D(q){z.fromArray(l,q*3),L.copy(z);let nt=d[q];F.copy(nt),F.sub(z.multiplyScalar(z.dot(nt))).normalize(),G.crossVectors(L,nt);let xt=G.dot(g[q])<0?-1:1;p[q*4]=F.x,p[q*4+1]=F.y,p[q*4+2]=F.z,p[q*4+3]=xt}for(let q=0,nt=O.length;q<nt;++q){let k=O[q],xt=k.start,X=k.count;for(let it=xt,vt=xt+X;it<vt;it+=3)D(o[it+0]),D(o[it+1]),D(o[it+2])}}computeVertexNormals(){let t=this.index,e=this.getAttribute("position");if(e!==void 0){let o=this.getAttribute("normal");if(o===void 0)o=new Di(new Float32Array(e.count*3),3),this.setAttribute("normal",o);else for(let y=0,M=o.count;y<M;y++)o.setXYZ(y,0,0,0);let a=new mt,l=new mt,f=new mt,h=new mt,p=new mt,d=new mt,g=new mt,_=new mt;if(t)for(let y=0,M=t.count;y<M;y+=3){let w=t.getX(y+0),T=t.getX(y+1),x=t.getX(y+2);a.fromBufferAttribute(e,w),l.fromBufferAttribute(e,T),f.fromBufferAttribute(e,x),g.subVectors(f,l),_.subVectors(a,l),g.cross(_),h.fromBufferAttribute(o,w),p.fromBufferAttribute(o,T),d.fromBufferAttribute(o,x),h.add(g),p.add(g),d.add(g),o.setXYZ(w,h.x,h.y,h.z),o.setXYZ(T,p.x,p.y,p.z),o.setXYZ(x,d.x,d.y,d.z)}else for(let y=0,M=e.count;y<M;y+=3)a.fromBufferAttribute(e,y+0),l.fromBufferAttribute(e,y+1),f.fromBufferAttribute(e,y+2),g.subVectors(f,l),_.subVectors(a,l),g.cross(_),o.setXYZ(y+0,g.x,g.y,g.z),o.setXYZ(y+1,g.x,g.y,g.z),o.setXYZ(y+2,g.x,g.y,g.z);this.normalizeNormals(),o.needsUpdate=!0}}normalizeNormals(){let t=this.attributes.normal;for(let e=0,o=t.count;e<o;e++)dr.fromBufferAttribute(t,e),dr.normalize(),t.setXYZ(e,dr.x,dr.y,dr.z)}toNonIndexed(){function t(h,p){let d=h.array,g=h.itemSize,_=h.normalized,y=new d.constructor(p.length*g),M=0,w=0;for(let T=0,x=p.length;T<x;T++){h.isInterleavedBufferAttribute?M=p[T]*h.data.stride+h.offset:M=p[T]*g;for(let v=0;v<g;v++)y[w++]=d[M++]}return new Di(y,g,_)}if(this.index===null)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;let e=new r,o=this.index.array,a=this.attributes;for(let h in a){let p=a[h],d=t(p,o);e.setAttribute(h,d)}let l=this.morphAttributes;for(let h in l){let p=[],d=l[h];for(let g=0,_=d.length;g<_;g++){let y=d[g],M=t(y,o);p.push(M)}e.morphAttributes[h]=p}e.morphTargetsRelative=this.morphTargetsRelative;let f=this.groups;for(let h=0,p=f.length;h<p;h++){let d=f[h];e.addGroup(d.start,d.count,d.materialIndex)}return e}toJSON(){let t={metadata:{version:4.6,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(t.uuid=this.uuid,t.type=this.type,this.name!==""&&(t.name=this.name),Object.keys(this.userData).length>0&&(t.userData=this.userData),this.parameters!==void 0){let p=this.parameters;for(let d in p)p[d]!==void 0&&(t[d]=p[d]);return t}t.data={attributes:{}};let e=this.index;e!==null&&(t.data.index={type:e.array.constructor.name,array:Array.prototype.slice.call(e.array)});let o=this.attributes;for(let p in o){let d=o[p];t.data.attributes[p]=d.toJSON(t.data)}let a={},l=!1;for(let p in this.morphAttributes){let d=this.morphAttributes[p],g=[];for(let _=0,y=d.length;_<y;_++){let M=d[_];g.push(M.toJSON(t.data))}g.length>0&&(a[p]=g,l=!0)}l&&(t.data.morphAttributes=a,t.data.morphTargetsRelative=this.morphTargetsRelative);let f=this.groups;f.length>0&&(t.data.groups=JSON.parse(JSON.stringify(f)));let h=this.boundingSphere;return h!==null&&(t.data.boundingSphere={center:h.center.toArray(),radius:h.radius}),t}clone(){return new this.constructor().copy(this)}copy(t){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;let e={};this.name=t.name;let o=t.index;o!==null&&this.setIndex(o.clone(e));let a=t.attributes;for(let d in a){let g=a[d];this.setAttribute(d,g.clone(e))}let l=t.morphAttributes;for(let d in l){let g=[],_=l[d];for(let y=0,M=_.length;y<M;y++)g.push(_[y].clone(e));this.morphAttributes[d]=g}this.morphTargetsRelative=t.morphTargetsRelative;let f=t.groups;for(let d=0,g=f.length;d<g;d++){let _=f[d];this.addGroup(_.start,_.count,_.materialIndex)}let h=t.boundingBox;h!==null&&(this.boundingBox=h.clone());let p=t.boundingSphere;return p!==null&&(this.boundingSphere=p.clone()),this.drawRange.start=t.drawRange.start,this.drawRange.count=t.drawRange.count,this.userData=t.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}},vg=new zr,zs=new mh,Dl=new Uu,_g=new mt,Aa=new mt,Ca=new mt,Pa=new mt,th=new mt,Fl=new mt,Ul=new fn,Bl=new fn,zl=new fn,xg=new mt,Eg=new mt,Mg=new mt,kl=new mt,Gl=new mt,co=class extends fo{constructor(t=new Ys,e=new oc){super(),this.isMesh=!0,this.type="Mesh",this.geometry=t,this.material=e,this.updateMorphTargets()}copy(t,e){return super.copy(t,e),t.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=t.morphTargetInfluences.slice()),t.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},t.morphTargetDictionary)),this.material=Array.isArray(t.material)?t.material.slice():t.material,this.geometry=t.geometry,this}updateMorphTargets(){let e=this.geometry.morphAttributes,o=Object.keys(e);if(o.length>0){let a=e[o[0]];if(a!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let l=0,f=a.length;l<f;l++){let h=a[l].name||String(l);this.morphTargetInfluences.push(0),this.morphTargetDictionary[h]=l}}}}getVertexPosition(t,e){let o=this.geometry,a=o.attributes.position,l=o.morphAttributes.position,f=o.morphTargetsRelative;e.fromBufferAttribute(a,t);let h=this.morphTargetInfluences;if(l&&h){Fl.set(0,0,0);for(let p=0,d=l.length;p<d;p++){let g=h[p],_=l[p];g!==0&&(th.fromBufferAttribute(_,t),f?Fl.addScaledVector(th,g):Fl.addScaledVector(th.sub(e),g))}e.add(Fl)}return e}raycast(t,e){let o=this.geometry,a=this.material,l=this.matrixWorld;a!==void 0&&(o.boundingSphere===null&&o.computeBoundingSphere(),Dl.copy(o.boundingSphere),Dl.applyMatrix4(l),zs.copy(t.ray).recast(t.near),!(Dl.containsPoint(zs.origin)===!1&&(zs.intersectSphere(Dl,_g)===null||zs.origin.distanceToSquared(_g)>(t.far-t.near)**2))&&(vg.copy(l).invert(),zs.copy(t.ray).applyMatrix4(vg),!(o.boundingBox!==null&&zs.intersectsBox(o.boundingBox)===!1)&&this._computeIntersections(t,e,zs)))}_computeIntersections(t,e,o){let a,l=this.geometry,f=this.material,h=l.index,p=l.attributes.position,d=l.attributes.uv,g=l.attributes.uv1,_=l.attributes.normal,y=l.groups,M=l.drawRange;if(h!==null)if(Array.isArray(f))for(let w=0,T=y.length;w<T;w++){let x=y[w],v=f[x.materialIndex],C=Math.max(x.start,M.start),S=Math.min(h.count,Math.min(x.start+x.count,M.start+M.count));for(let O=C,F=S;O<F;O+=3){let G=h.getX(O),z=h.getX(O+1),L=h.getX(O+2);a=Vl(this,v,t,o,d,g,_,G,z,L),a&&(a.faceIndex=Math.floor(O/3),a.face.materialIndex=x.materialIndex,e.push(a))}}else{let w=Math.max(0,M.start),T=Math.min(h.count,M.start+M.count);for(let x=w,v=T;x<v;x+=3){let C=h.getX(x),S=h.getX(x+1),O=h.getX(x+2);a=Vl(this,f,t,o,d,g,_,C,S,O),a&&(a.faceIndex=Math.floor(x/3),e.push(a))}}else if(p!==void 0)if(Array.isArray(f))for(let w=0,T=y.length;w<T;w++){let x=y[w],v=f[x.materialIndex],C=Math.max(x.start,M.start),S=Math.min(p.count,Math.min(x.start+x.count,M.start+M.count));for(let O=C,F=S;O<F;O+=3){let G=O,z=O+1,L=O+2;a=Vl(this,v,t,o,d,g,_,G,z,L),a&&(a.faceIndex=Math.floor(O/3),a.face.materialIndex=x.materialIndex,e.push(a))}}else{let w=Math.max(0,M.start),T=Math.min(p.count,M.start+M.count);for(let x=w,v=T;x<v;x+=3){let C=x,S=x+1,O=x+2;a=Vl(this,f,t,o,d,g,_,C,S,O),a&&(a.faceIndex=Math.floor(x/3),e.push(a))}}}};function Hx(r,t,e,o,a,l,f,h){let p;if(t.side===ui?p=o.intersectTriangle(f,l,a,!0,h):p=o.intersectTriangle(a,l,f,t.side===ds,h),p===null)return null;Gl.copy(h),Gl.applyMatrix4(r.matrixWorld);let d=e.ray.origin.distanceTo(Gl);return d<e.near||d>e.far?null:{distance:d,point:Gl.clone(),object:r}}function Vl(r,t,e,o,a,l,f,h,p,d){r.getVertexPosition(h,Aa),r.getVertexPosition(p,Ca),r.getVertexPosition(d,Pa);let g=Hx(r,t,e,o,Aa,Ca,Pa,kl);if(g){a&&(Ul.fromBufferAttribute(a,h),Bl.fromBufferAttribute(a,p),zl.fromBufferAttribute(a,d),g.uv=Oa.getInterpolation(kl,Aa,Ca,Pa,Ul,Bl,zl,new fn)),l&&(Ul.fromBufferAttribute(l,h),Bl.fromBufferAttribute(l,p),zl.fromBufferAttribute(l,d),g.uv1=Oa.getInterpolation(kl,Aa,Ca,Pa,Ul,Bl,zl,new fn),g.uv2=g.uv1),f&&(xg.fromBufferAttribute(f,h),Eg.fromBufferAttribute(f,p),Mg.fromBufferAttribute(f,d),g.normal=Oa.getInterpolation(kl,Aa,Ca,Pa,xg,Eg,Mg,new mt),g.normal.dot(o.direction)>0&&g.normal.multiplyScalar(-1));let _={a:h,b:p,c:d,normal:new mt,materialIndex:0};Oa.getNormal(Aa,Ca,Pa,_.normal),g.face=_}return g}var Bu=class r extends Ys{constructor(t=1,e=1,o=1,a=1,l=1,f=1){super(),this.type="BoxGeometry",this.parameters={width:t,height:e,depth:o,widthSegments:a,heightSegments:l,depthSegments:f};let h=this;a=Math.floor(a),l=Math.floor(l),f=Math.floor(f);let p=[],d=[],g=[],_=[],y=0,M=0;w("z","y","x",-1,-1,o,e,t,f,l,0),w("z","y","x",1,-1,o,e,-t,f,l,1),w("x","z","y",1,1,t,o,e,a,f,2),w("x","z","y",1,-1,t,o,-e,a,f,3),w("x","y","z",1,-1,t,e,o,a,l,4),w("x","y","z",-1,-1,t,e,-o,a,l,5),this.setIndex(p),this.setAttribute("position",new Ho(d,3)),this.setAttribute("normal",new Ho(g,3)),this.setAttribute("uv",new Ho(_,2));function w(T,x,v,C,S,O,F,G,z,L,D){let q=O/z,nt=F/L,k=O/2,xt=F/2,X=G/2,it=z+1,vt=L+1,pt=0,et=0,ot=new mt;for(let V=0;V<vt;V++){let K=V*nt-xt;for(let at=0;at<it;at++){let Tt=at*q-k;ot[T]=Tt*C,ot[x]=K*S,ot[v]=X,d.push(ot.x,ot.y,ot.z),ot[T]=0,ot[x]=0,ot[v]=G>0?1:-1,g.push(ot.x,ot.y,ot.z),_.push(at/z),_.push(1-V/L),pt+=1}}for(let V=0;V<L;V++)for(let K=0;K<z;K++){let at=y+K+it*V,Tt=y+K+it*(V+1),dt=y+(K+1)+it*(V+1),Ct=y+(K+1)+it*V;p.push(at,Tt,Ct),p.push(Tt,dt,Ct),et+=6}h.addGroup(M,et,D),M+=et,y+=pt}}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new r(t.width,t.height,t.depth,t.widthSegments,t.heightSegments,t.depthSegments)}};function Wa(r){let t={};for(let e in r){t[e]={};for(let o in r[e]){let a=r[e][o];a&&(a.isColor||a.isMatrix3||a.isMatrix4||a.isVector2||a.isVector3||a.isVector4||a.isTexture||a.isQuaternion)?a.isRenderTargetTexture?(console.warn("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),t[e][o]=null):t[e][o]=a.clone():Array.isArray(a)?t[e][o]=a.slice():t[e][o]=a}}return t}function Jr(r){let t={};for(let e=0;e<r.length;e++){let o=Wa(r[e]);for(let a in o)t[a]=o[a]}return t}function Wx(r){let t=[];for(let e=0;e<r.length;e++)t.push(r[e].clone());return t}function i0(r){return r.getRenderTarget()===null?r.outputColorSpace:gn.workingColorSpace}var qx={clone:Wa,merge:Jr},Xx=`void main() {\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}`,Yx=`void main() {\n gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}`,Xo=class extends Ha{constructor(t){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=Xx,this.fragmentShader=Yx,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.forceSinglePass=!0,this.extensions={derivatives:!1,fragDepth:!1,drawBuffers:!1,shaderTextureLOD:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv1:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,t!==void 0&&this.setValues(t)}copy(t){return super.copy(t),this.fragmentShader=t.fragmentShader,this.vertexShader=t.vertexShader,this.uniforms=Wa(t.uniforms),this.uniformsGroups=Wx(t.uniformsGroups),this.defines=Object.assign({},t.defines),this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.fog=t.fog,this.lights=t.lights,this.clipping=t.clipping,this.extensions=Object.assign({},t.extensions),this.glslVersion=t.glslVersion,this}toJSON(t){let e=super.toJSON(t);e.glslVersion=this.glslVersion,e.uniforms={};for(let a in this.uniforms){let f=this.uniforms[a].value;f&&f.isTexture?e.uniforms[a]={type:"t",value:f.toJSON(t).uuid}:f&&f.isColor?e.uniforms[a]={type:"c",value:f.getHex()}:f&&f.isVector2?e.uniforms[a]={type:"v2",value:f.toArray()}:f&&f.isVector3?e.uniforms[a]={type:"v3",value:f.toArray()}:f&&f.isVector4?e.uniforms[a]={type:"v4",value:f.toArray()}:f&&f.isMatrix3?e.uniforms[a]={type:"m3",value:f.toArray()}:f&&f.isMatrix4?e.uniforms[a]={type:"m4",value:f.toArray()}:e.uniforms[a]={value:f}}Object.keys(this.defines).length>0&&(e.defines=this.defines),e.vertexShader=this.vertexShader,e.fragmentShader=this.fragmentShader,e.lights=this.lights,e.clipping=this.clipping;let o={};for(let a in this.extensions)this.extensions[a]===!0&&(o[a]=!0);return Object.keys(o).length>0&&(e.extensions=o),e}},uc=class extends fo{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new zr,this.projectionMatrix=new zr,this.projectionMatrixInverse=new zr,this.coordinateSystem=Vo}copy(t,e){return super.copy(t,e),this.matrixWorldInverse.copy(t.matrixWorldInverse),this.projectionMatrix.copy(t.projectionMatrix),this.projectionMatrixInverse.copy(t.projectionMatrixInverse),this.coordinateSystem=t.coordinateSystem,this}getWorldDirection(t){return super.getWorldDirection(t).negate()}updateMatrixWorld(t){super.updateMatrixWorld(t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(t,e){super.updateWorldMatrix(t,e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}},xi=class extends uc{constructor(t=50,e=1,o=.1,a=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=t,this.zoom=1,this.near=o,this.far=a,this.focus=10,this.aspect=e,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(t,e){return super.copy(t,e),this.fov=t.fov,this.zoom=t.zoom,this.near=t.near,this.far=t.far,this.focus=t.focus,this.aspect=t.aspect,this.view=t.view===null?null:Object.assign({},t.view),this.filmGauge=t.filmGauge,this.filmOffset=t.filmOffset,this}setFocalLength(t){let e=.5*this.getFilmHeight()/t;this.fov=fh*2*Math.atan(e),this.updateProjectionMatrix()}getFocalLength(){let t=Math.tan(Uf*.5*this.fov);return .5*this.getFilmHeight()/t}getEffectiveFOV(){return fh*2*Math.atan(Math.tan(Uf*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}setViewOffset(t,e,o,a,l,f){this.aspect=t/e,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=t,this.view.fullHeight=e,this.view.offsetX=o,this.view.offsetY=a,this.view.width=l,this.view.height=f,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){let t=this.near,e=t*Math.tan(Uf*.5*this.fov)/this.zoom,o=2*e,a=this.aspect*o,l=-.5*a,f=this.view;if(this.view!==null&&this.view.enabled){let p=f.fullWidth,d=f.fullHeight;l+=f.offsetX*a/p,e-=f.offsetY*o/d,a*=f.width/p,o*=f.height/d}let h=this.filmOffset;h!==0&&(l+=t*h/this.getFilmWidth()),this.projectionMatrix.makePerspective(l,l+a,e,e-o,t,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(t){let e=super.toJSON(t);return e.object.fov=this.fov,e.object.zoom=this.zoom,e.object.near=this.near,e.object.far=this.far,e.object.focus=this.focus,e.object.aspect=this.aspect,this.view!==null&&(e.object.view=Object.assign({},this.view)),e.object.filmGauge=this.filmGauge,e.object.filmOffset=this.filmOffset,e}},Ia=-90,Ra=1,gh=class extends fo{constructor(t,e,o){super(),this.type="CubeCamera",this.renderTarget=o,this.coordinateSystem=null,this.activeMipmapLevel=0;let a=new xi(Ia,Ra,t,e);a.layers=this.layers,this.add(a);let l=new xi(Ia,Ra,t,e);l.layers=this.layers,this.add(l);let f=new xi(Ia,Ra,t,e);f.layers=this.layers,this.add(f);let h=new xi(Ia,Ra,t,e);h.layers=this.layers,this.add(h);let p=new xi(Ia,Ra,t,e);p.layers=this.layers,this.add(p);let d=new xi(Ia,Ra,t,e);d.layers=this.layers,this.add(d)}updateCoordinateSystem(){let t=this.coordinateSystem,e=this.children.concat(),[o,a,l,f,h,p]=e;for(let d of e)this.remove(d);if(t===Vo)o.up.set(0,1,0),o.lookAt(1,0,0),a.up.set(0,1,0),a.lookAt(-1,0,0),l.up.set(0,0,-1),l.lookAt(0,1,0),f.up.set(0,0,1),f.lookAt(0,-1,0),h.up.set(0,1,0),h.lookAt(0,0,1),p.up.set(0,1,0),p.lookAt(0,0,-1);else if(t===jl)o.up.set(0,-1,0),o.lookAt(-1,0,0),a.up.set(0,-1,0),a.lookAt(1,0,0),l.up.set(0,0,1),l.lookAt(0,1,0),f.up.set(0,0,-1),f.lookAt(0,-1,0),h.up.set(0,-1,0),h.lookAt(0,0,1),p.up.set(0,-1,0),p.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+t);for(let d of e)this.add(d),d.updateMatrixWorld()}update(t,e){this.parent===null&&this.updateMatrixWorld();let{renderTarget:o,activeMipmapLevel:a}=this;this.coordinateSystem!==t.coordinateSystem&&(this.coordinateSystem=t.coordinateSystem,this.updateCoordinateSystem());let[l,f,h,p,d,g]=this.children,_=t.getRenderTarget(),y=t.getActiveCubeFace(),M=t.getActiveMipmapLevel(),w=t.xr.enabled;t.xr.enabled=!1;let T=o.texture.generateMipmaps;o.texture.generateMipmaps=!1,t.setRenderTarget(o,0,a),t.render(e,l),t.setRenderTarget(o,1,a),t.render(e,f),t.setRenderTarget(o,2,a),t.render(e,h),t.setRenderTarget(o,3,a),t.render(e,p),t.setRenderTarget(o,4,a),t.render(e,d),o.texture.generateMipmaps=T,t.setRenderTarget(o,5,a),t.render(e,g),t.setRenderTarget(_,y,M),t.xr.enabled=w,o.texture.needsPMREMUpdate=!0}},lc=class extends Ki{constructor(t,e,o,a,l,f,h,p,d,g){t=t!==void 0?t:[],e=e!==void 0?e:ka,super(t,e,o,a,l,f,h,p,d,g),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(t){this.image=t}},yh=class extends qo{constructor(t=1,e={}){super(t,t,e),this.isWebGLCubeRenderTarget=!0;let o={width:t,height:t,depth:1},a=[o,o,o,o,o,o];e.encoding!==void 0&&(Nu("THREE.WebGLCubeRenderTarget: option.encoding has been replaced by option.colorSpace."),e.colorSpace=e.encoding===qs?br:Oi),this.texture=new lc(a,e.mapping,e.wrapS,e.wrapT,e.magFilter,e.minFilter,e.format,e.type,e.anisotropy,e.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=e.generateMipmaps!==void 0?e.generateMipmaps:!1,this.texture.minFilter=e.minFilter!==void 0?e.minFilter:Ni}fromEquirectangularTexture(t,e){this.texture.type=e.type,this.texture.colorSpace=e.colorSpace,this.texture.generateMipmaps=e.generateMipmaps,this.texture.minFilter=e.minFilter,this.texture.magFilter=e.magFilter;let o={uniforms:{tEquirect:{value:null}},vertexShader:`\n\n varying vec3 vWorldDirection;\n\n vec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\n return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n\n }\n\n void main() {\n\n vWorldDirection = transformDirection( position, modelMatrix );\n\n #include <begin_vertex>\n #include <project_vertex>\n\n }\n `,fragmentShader:`\n\n uniform sampler2D tEquirect;\n\n varying vec3 vWorldDirection;\n\n #include <common>\n\n void main() {\n\n vec3 direction = normalize( vWorldDirection );\n\n vec2 sampleUV = equirectUv( direction );\n\n gl_FragColor = texture2D( tEquirect, sampleUV );\n\n }\n `},a=new Bu(5,5,5),l=new Xo({name:"CubemapFromEquirect",uniforms:Wa(o.uniforms),vertexShader:o.vertexShader,fragmentShader:o.fragmentShader,side:ui,blending:fs});l.uniforms.tEquirect.value=e;let f=new co(a,l),h=e.minFilter;return e.minFilter===Du&&(e.minFilter=Ni),new gh(1,10,this).update(t,f),e.minFilter=h,f.geometry.dispose(),f.material.dispose(),this}clear(t,e,o,a){let l=t.getRenderTarget();for(let f=0;f<6;f++)t.setRenderTarget(this,f),t.clear(e,o,a);t.setRenderTarget(l)}},eh=new mt,Zx=new mt,Jx=new ve,ko=class{constructor(t=new mt(1,0,0),e=0){this.isPlane=!0,this.normal=t,this.constant=e}set(t,e){return this.normal.copy(t),this.constant=e,this}setComponents(t,e,o,a){return this.normal.set(t,e,o),this.constant=a,this}setFromNormalAndCoplanarPoint(t,e){return this.normal.copy(t),this.constant=-e.dot(this.normal),this}setFromCoplanarPoints(t,e,o){let a=eh.subVectors(o,e).cross(Zx.subVectors(t,e)).normalize();return this.setFromNormalAndCoplanarPoint(a,t),this}copy(t){return this.normal.copy(t.normal),this.constant=t.constant,this}normalize(){let t=1/this.normal.length();return this.normal.multiplyScalar(t),this.constant*=t,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(t){return this.normal.dot(t)+this.constant}distanceToSphere(t){return this.distanceToPoint(t.center)-t.radius}projectPoint(t,e){return e.copy(t).addScaledVector(this.normal,-this.distanceToPoint(t))}intersectLine(t,e){let o=t.delta(eh),a=this.normal.dot(o);if(a===0)return this.distanceToPoint(t.start)===0?e.copy(t.start):null;let l=-(t.start.dot(this.normal)+this.constant)/a;return l<0||l>1?null:e.copy(t.start).addScaledVector(o,l)}intersectsLine(t){let e=this.distanceToPoint(t.start),o=this.distanceToPoint(t.end);return e<0&&o>0||o<0&&e>0}intersectsBox(t){return t.intersectsPlane(this)}intersectsSphere(t){return t.intersectsPlane(this)}coplanarPoint(t){return t.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(t,e){let o=e||Jx.getNormalMatrix(t),a=this.coplanarPoint(eh).applyMatrix4(t),l=this.normal.applyMatrix3(o).normalize();return this.constant=-a.dot(l),this}translate(t){return this.constant-=t.dot(this.normal),this}equals(t){return t.normal.equals(this.normal)&&t.constant===this.constant}clone(){return new this.constructor().copy(this)}},ks=new Uu,Hl=new mt,cc=class{constructor(t=new ko,e=new ko,o=new ko,a=new ko,l=new ko,f=new ko){this.planes=[t,e,o,a,l,f]}set(t,e,o,a,l,f){let h=this.planes;return h[0].copy(t),h[1].copy(e),h[2].copy(o),h[3].copy(a),h[4].copy(l),h[5].copy(f),this}copy(t){let e=this.planes;for(let o=0;o<6;o++)e[o].copy(t.planes[o]);return this}setFromProjectionMatrix(t,e=Vo){let o=this.planes,a=t.elements,l=a[0],f=a[1],h=a[2],p=a[3],d=a[4],g=a[5],_=a[6],y=a[7],M=a[8],w=a[9],T=a[10],x=a[11],v=a[12],C=a[13],S=a[14],O=a[15];if(o[0].setComponents(p-l,y-d,x-M,O-v).normalize(),o[1].setComponents(p+l,y+d,x+M,O+v).normalize(),o[2].setComponents(p+f,y+g,x+w,O+C).normalize(),o[3].setComponents(p-f,y-g,x-w,O-C).normalize(),o[4].setComponents(p-h,y-_,x-T,O-S).normalize(),e===Vo)o[5].setComponents(p+h,y+_,x+T,O+S).normalize();else if(e===jl)o[5].setComponents(h,_,T,S).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+e);return this}intersectsObject(t){if(t.boundingSphere!==void 0)t.boundingSphere===null&&t.computeBoundingSphere(),ks.copy(t.boundingSphere).applyMatrix4(t.matrixWorld);else{let e=t.geometry;e.boundingSphere===null&&e.computeBoundingSphere(),ks.copy(e.boundingSphere).applyMatrix4(t.matrixWorld)}return this.intersectsSphere(ks)}intersectsSprite(t){return ks.center.set(0,0,0),ks.radius=.7071067811865476,ks.applyMatrix4(t.matrixWorld),this.intersectsSphere(ks)}intersectsSphere(t){let e=this.planes,o=t.center,a=-t.radius;for(let l=0;l<6;l++)if(e[l].distanceToPoint(o)<a)return!1;return!0}intersectsBox(t){let e=this.planes;for(let o=0;o<6;o++){let a=e[o];if(Hl.x=a.normal.x>0?t.max.x:t.min.x,Hl.y=a.normal.y>0?t.max.y:t.min.y,Hl.z=a.normal.z>0?t.max.z:t.min.z,a.distanceToPoint(Hl)<0)return!1}return!0}containsPoint(t){let e=this.planes;for(let o=0;o<6;o++)if(e[o].distanceToPoint(t)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}};function o0(){let r=null,t=!1,e=null,o=null;function a(l,f){e(l,f),o=r.requestAnimationFrame(a)}return{start:function(){t!==!0&&e!==null&&(o=r.requestAnimationFrame(a),t=!0)},stop:function(){r.cancelAnimationFrame(o),t=!1},setAnimationLoop:function(l){e=l},setContext:function(l){r=l}}}function $x(r,t){let e=t.isWebGL2,o=new WeakMap;function a(d,g){let _=d.array,y=d.usage,M=r.createBuffer();r.bindBuffer(g,M),r.bufferData(g,_,y),d.onUploadCallback();let w;if(_ instanceof Float32Array)w=r.FLOAT;else if(_ instanceof Uint16Array)if(d.isFloat16BufferAttribute)if(e)w=r.HALF_FLOAT;else throw new Error("THREE.WebGLAttributes: Usage of Float16BufferAttribute requires WebGL2.");else w=r.UNSIGNED_SHORT;else if(_ instanceof Int16Array)w=r.SHORT;else if(_ instanceof Uint32Array)w=r.UNSIGNED_INT;else if(_ instanceof Int32Array)w=r.INT;else if(_ instanceof Int8Array)w=r.BYTE;else if(_ instanceof Uint8Array)w=r.UNSIGNED_BYTE;else if(_ instanceof Uint8ClampedArray)w=r.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+_);return{buffer:M,type:w,bytesPerElement:_.BYTES_PER_ELEMENT,version:d.version}}function l(d,g,_){let y=g.array,M=g.updateRange;r.bindBuffer(_,d),M.count===-1?r.bufferSubData(_,0,y):(e?r.bufferSubData(_,M.offset*y.BYTES_PER_ELEMENT,y,M.offset,M.count):r.bufferSubData(_,M.offset*y.BYTES_PER_ELEMENT,y.subarray(M.offset,M.offset+M.count)),M.count=-1),g.onUploadCallback()}function f(d){return d.isInterleavedBufferAttribute&&(d=d.data),o.get(d)}function h(d){d.isInterleavedBufferAttribute&&(d=d.data);let g=o.get(d);g&&(r.deleteBuffer(g.buffer),o.delete(d))}function p(d,g){if(d.isGLBufferAttribute){let y=o.get(d);(!y||y.version<d.version)&&o.set(d,{buffer:d.buffer,type:d.type,bytesPerElement:d.elementSize,version:d.version});return}d.isInterleavedBufferAttribute&&(d=d.data);let _=o.get(d);_===void 0?o.set(d,a(d,g)):_.version<d.version&&(l(_.buffer,d,g),_.version=d.version)}return{get:f,remove:h,update:p}}var vh=class r extends Ys{constructor(t=1,e=1,o=1,a=1){super(),this.type="PlaneGeometry",this.parameters={width:t,height:e,widthSegments:o,heightSegments:a};let l=t/2,f=e/2,h=Math.floor(o),p=Math.floor(a),d=h+1,g=p+1,_=t/h,y=e/p,M=[],w=[],T=[],x=[];for(let v=0;v<g;v++){let C=v*y-f;for(let S=0;S<d;S++){let O=S*_-l;w.push(O,-C,0),T.push(0,0,1),x.push(S/h),x.push(1-v/p)}}for(let v=0;v<p;v++)for(let C=0;C<h;C++){let S=C+d*v,O=C+d*(v+1),F=C+1+d*(v+1),G=C+1+d*v;M.push(S,O,G),M.push(O,F,G)}this.setIndex(M),this.setAttribute("position",new Ho(w,3)),this.setAttribute("normal",new Ho(T,3)),this.setAttribute("uv",new Ho(x,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new r(t.width,t.height,t.widthSegments,t.heightSegments)}},Kx=`#ifdef USE_ALPHAHASH\n if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;\n#endif`,jx=`#ifdef USE_ALPHAHASH\n const float ALPHA_HASH_SCALE = 0.05;\n float hash2D( vec2 value ) {\n return fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) );\n }\n float hash3D( vec3 value ) {\n return hash2D( vec2( hash2D( value.xy ), value.z ) );\n }\n float getAlphaHashThreshold( vec3 position ) {\n float maxDeriv = max(\n length( dFdx( position.xyz ) ),\n length( dFdy( position.xyz ) )\n );\n float pixScale = 1.0 / ( ALPHA_HASH_SCALE * maxDeriv );\n vec2 pixScales = vec2(\n exp2( floor( log2( pixScale ) ) ),\n exp2( ceil( log2( pixScale ) ) )\n );\n vec2 alpha = vec2(\n hash3D( floor( pixScales.x * position.xyz ) ),\n hash3D( floor( pixScales.y * position.xyz ) )\n );\n float lerpFactor = fract( log2( pixScale ) );\n float x = ( 1.0 - lerpFactor ) * alpha.x + lerpFactor * alpha.y;\n float a = min( lerpFactor, 1.0 - lerpFactor );\n vec3 cases = vec3(\n x * x / ( 2.0 * a * ( 1.0 - a ) ),\n ( x - 0.5 * a ) / ( 1.0 - a ),\n 1.0 - ( ( 1.0 - x ) * ( 1.0 - x ) / ( 2.0 * a * ( 1.0 - a ) ) )\n );\n float threshold = ( x < ( 1.0 - a ) )\n ? ( ( x < a ) ? cases.x : cases.y )\n : cases.z;\n return clamp( threshold , 1.0e-6, 1.0 );\n }\n#endif`,Qx=`#ifdef USE_ALPHAMAP\n diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;\n#endif`,tE=`#ifdef USE_ALPHAMAP\n uniform sampler2D alphaMap;\n#endif`,eE=`#ifdef USE_ALPHATEST\n if ( diffuseColor.a < alphaTest ) discard;\n#endif`,nE=`#ifdef USE_ALPHATEST\n uniform float alphaTest;\n#endif`,rE=`#ifdef USE_AOMAP\n float ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;\n reflectedLight.indirectDiffuse *= ambientOcclusion;\n #if defined( USE_ENVMAP ) && defined( STANDARD )\n float dotNV = saturate( dot( geometryNormal, geometryViewDir ) );\n reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );\n #endif\n#endif`,iE=`#ifdef USE_AOMAP\n uniform sampler2D aoMap;\n uniform float aoMapIntensity;\n#endif`,oE=`vec3 transformed = vec3( position );\n#ifdef USE_ALPHAHASH\n vPosition = vec3( position );\n#endif`,sE=`vec3 objectNormal = vec3( normal );\n#ifdef USE_TANGENT\n vec3 objectTangent = vec3( tangent.xyz );\n#endif`,aE=`float G_BlinnPhong_Implicit( ) {\n return 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n return RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {\n vec3 halfDir = normalize( lightDir + viewDir );\n float dotNH = saturate( dot( normal, halfDir ) );\n float dotVH = saturate( dot( viewDir, halfDir ) );\n vec3 F = F_Schlick( specularColor, 1.0, dotVH );\n float G = G_BlinnPhong_Implicit( );\n float D = D_BlinnPhong( shininess, dotNH );\n return F * ( G * D );\n} // validated`,uE=`#ifdef USE_IRIDESCENCE\n const mat3 XYZ_TO_REC709 = mat3(\n 3.2404542, -0.9692660, 0.0556434,\n -1.5371385, 1.8760108, -0.2040259,\n -0.4985314, 0.0415560, 1.0572252\n );\n vec3 Fresnel0ToIor( vec3 fresnel0 ) {\n vec3 sqrtF0 = sqrt( fresnel0 );\n return ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 );\n }\n vec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) {\n return pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) );\n }\n float IorToFresnel0( float transmittedIor, float incidentIor ) {\n return pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor ));\n }\n vec3 evalSensitivity( float OPD, vec3 shift ) {\n float phase = 2.0 * PI * OPD * 1.0e-9;\n vec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 );\n vec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 );\n vec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 );\n vec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var );\n 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 ) );\n xyz /= 1.0685e-7;\n vec3 rgb = XYZ_TO_REC709 * xyz;\n return rgb;\n }\n vec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) {\n vec3 I;\n float iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );\n float sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) );\n float cosTheta2Sq = 1.0 - sinTheta2Sq;\n if ( cosTheta2Sq < 0.0 ) {\n return vec3( 1.0 );\n }\n float cosTheta2 = sqrt( cosTheta2Sq );\n float R0 = IorToFresnel0( iridescenceIOR, outsideIOR );\n float R12 = F_Schlick( R0, 1.0, cosTheta1 );\n float T121 = 1.0 - R12;\n float phi12 = 0.0;\n if ( iridescenceIOR < outsideIOR ) phi12 = PI;\n float phi21 = PI - phi12;\n vec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) ); vec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR );\n vec3 R23 = F_Schlick( R1, 1.0, cosTheta2 );\n vec3 phi23 = vec3( 0.0 );\n if ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI;\n if ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI;\n if ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI;\n float OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2;\n vec3 phi = vec3( phi21 ) + phi23;\n vec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 );\n vec3 r123 = sqrt( R123 );\n vec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 );\n vec3 C0 = R12 + Rs;\n I = C0;\n vec3 Cm = Rs - T121;\n for ( int m = 1; m <= 2; ++ m ) {\n Cm *= r123;\n vec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi );\n I += Cm * Sm;\n }\n return max( I, vec3( 0.0 ) );\n }\n#endif`,lE=`#ifdef USE_BUMPMAP\n uniform sampler2D bumpMap;\n uniform float bumpScale;\n vec2 dHdxy_fwd() {\n vec2 dSTdx = dFdx( vBumpMapUv );\n vec2 dSTdy = dFdy( vBumpMapUv );\n float Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x;\n float dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll;\n float dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll;\n return vec2( dBx, dBy );\n }\n vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {\n vec3 vSigmaX = dFdx( surf_pos.xyz );\n vec3 vSigmaY = dFdy( surf_pos.xyz );\n vec3 vN = surf_norm;\n vec3 R1 = cross( vSigmaY, vN );\n vec3 R2 = cross( vN, vSigmaX );\n float fDet = dot( vSigmaX, R1 ) * faceDirection;\n vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n return normalize( abs( fDet ) * surf_norm - vGrad );\n }\n#endif`,cE=`#if NUM_CLIPPING_PLANES > 0\n vec4 plane;\n #pragma unroll_loop_start\n for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n plane = clippingPlanes[ i ];\n if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;\n }\n #pragma unroll_loop_end\n #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n bool clipped = true;\n #pragma unroll_loop_start\n for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n plane = clippingPlanes[ i ];\n clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;\n }\n #pragma unroll_loop_end\n if ( clipped ) discard;\n #endif\n#endif`,fE=`#if NUM_CLIPPING_PLANES > 0\n varying vec3 vClipPosition;\n uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif`,hE=`#if NUM_CLIPPING_PLANES > 0\n varying vec3 vClipPosition;\n#endif`,pE=`#if NUM_CLIPPING_PLANES > 0\n vClipPosition = - mvPosition.xyz;\n#endif`,dE=`#if defined( USE_COLOR_ALPHA )\n diffuseColor *= vColor;\n#elif defined( USE_COLOR )\n diffuseColor.rgb *= vColor;\n#endif`,mE=`#if defined( USE_COLOR_ALPHA )\n varying vec4 vColor;\n#elif defined( USE_COLOR )\n varying vec3 vColor;\n#endif`,gE=`#if defined( USE_COLOR_ALPHA )\n varying vec4 vColor;\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n varying vec3 vColor;\n#endif`,yE=`#if defined( USE_COLOR_ALPHA )\n vColor = vec4( 1.0 );\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n vColor = vec3( 1.0 );\n#endif\n#ifdef USE_COLOR\n vColor *= color;\n#endif\n#ifdef USE_INSTANCING_COLOR\n vColor.xyz *= instanceColor.xyz;\n#endif`,vE=`#define PI 3.141592653589793\n#define PI2 6.283185307179586\n#define PI_HALF 1.5707963267948966\n#define RECIPROCAL_PI 0.3183098861837907\n#define RECIPROCAL_PI2 0.15915494309189535\n#define EPSILON 1e-6\n#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement( a ) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nvec3 pow2( const in vec3 x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }\nfloat average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }\nhighp float rand( const in vec2 uv ) {\n const highp float a = 12.9898, b = 78.233, c = 43758.5453;\n highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n return fract( sin( sn ) * c );\n}\n#ifdef HIGH_PRECISION\n float precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n float precisionSafeLength( vec3 v ) {\n float maxComponent = max3( abs( v ) );\n return length( v / maxComponent ) * maxComponent;\n }\n#endif\nstruct IncidentLight {\n vec3 color;\n vec3 direction;\n bool visible;\n};\nstruct ReflectedLight {\n vec3 directDiffuse;\n vec3 directSpecular;\n vec3 indirectDiffuse;\n vec3 indirectSpecular;\n};\n#ifdef USE_ALPHAHASH\n varying vec3 vPosition;\n#endif\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nmat3 transposeMat3( const in mat3 m ) {\n mat3 tmp;\n tmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\n tmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\n tmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\n return tmp;\n}\nfloat luminance( const in vec3 rgb ) {\n const vec3 weights = vec3( 0.2126729, 0.7151522, 0.0721750 );\n return dot( weights, rgb );\n}\nbool isPerspectiveMatrix( mat4 m ) {\n return m[ 2 ][ 3 ] == - 1.0;\n}\nvec2 equirectUv( in vec3 dir ) {\n float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;\n float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n return vec2( u, v );\n}\nvec3 BRDF_Lambert( const in vec3 diffuseColor ) {\n return RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {\n float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n}\nfloat F_Schlick( const in float f0, const in float f90, const in float dotVH ) {\n float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n} // validated`,_E=`#ifdef ENVMAP_TYPE_CUBE_UV\n #define cubeUV_minMipLevel 4.0\n #define cubeUV_minTileSize 16.0\n float getFace( vec3 direction ) {\n vec3 absDirection = abs( direction );\n float face = - 1.0;\n if ( absDirection.x > absDirection.z ) {\n if ( absDirection.x > absDirection.y )\n face = direction.x > 0.0 ? 0.0 : 3.0;\n else\n face = direction.y > 0.0 ? 1.0 : 4.0;\n } else {\n if ( absDirection.z > absDirection.y )\n face = direction.z > 0.0 ? 2.0 : 5.0;\n else\n face = direction.y > 0.0 ? 1.0 : 4.0;\n }\n return face;\n }\n vec2 getUV( vec3 direction, float face ) {\n vec2 uv;\n if ( face == 0.0 ) {\n uv = vec2( direction.z, direction.y ) / abs( direction.x );\n } else if ( face == 1.0 ) {\n uv = vec2( - direction.x, - direction.z ) / abs( direction.y );\n } else if ( face == 2.0 ) {\n uv = vec2( - direction.x, direction.y ) / abs( direction.z );\n } else if ( face == 3.0 ) {\n uv = vec2( - direction.z, direction.y ) / abs( direction.x );\n } else if ( face == 4.0 ) {\n uv = vec2( - direction.x, direction.z ) / abs( direction.y );\n } else {\n uv = vec2( direction.x, direction.y ) / abs( direction.z );\n }\n return 0.5 * ( uv + 1.0 );\n }\n vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {\n float face = getFace( direction );\n float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );\n mipInt = max( mipInt, cubeUV_minMipLevel );\n float faceSize = exp2( mipInt );\n highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;\n if ( face > 2.0 ) {\n uv.y += faceSize;\n face -= 3.0;\n }\n uv.x += face * faceSize;\n uv.x += filterInt * 3.0 * cubeUV_minTileSize;\n uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );\n uv.x *= CUBEUV_TEXEL_WIDTH;\n uv.y *= CUBEUV_TEXEL_HEIGHT;\n #ifdef texture2DGradEXT\n return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;\n #else\n return texture2D( envMap, uv ).rgb;\n #endif\n }\n #define cubeUV_r0 1.0\n #define cubeUV_v0 0.339\n #define cubeUV_m0 - 2.0\n #define cubeUV_r1 0.8\n #define cubeUV_v1 0.276\n #define cubeUV_m1 - 1.0\n #define cubeUV_r4 0.4\n #define cubeUV_v4 0.046\n #define cubeUV_m4 2.0\n #define cubeUV_r5 0.305\n #define cubeUV_v5 0.016\n #define cubeUV_m5 3.0\n #define cubeUV_r6 0.21\n #define cubeUV_v6 0.0038\n #define cubeUV_m6 4.0\n float roughnessToMip( float roughness ) {\n float mip = 0.0;\n if ( roughness >= cubeUV_r1 ) {\n mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;\n } else if ( roughness >= cubeUV_r4 ) {\n mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;\n } else if ( roughness >= cubeUV_r5 ) {\n mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;\n } else if ( roughness >= cubeUV_r6 ) {\n mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;\n } else {\n mip = - 2.0 * log2( 1.16 * roughness ); }\n return mip;\n }\n vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {\n float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );\n float mipF = fract( mip );\n float mipInt = floor( mip );\n vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );\n if ( mipF == 0.0 ) {\n return vec4( color0, 1.0 );\n } else {\n vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );\n return vec4( mix( color0, color1, mipF ), 1.0 );\n }\n }\n#endif`,xE=`vec3 transformedNormal = objectNormal;\n#ifdef USE_INSTANCING\n mat3 m = mat3( instanceMatrix );\n transformedNormal /= vec3( dot( m[ 0 ], m[ 0 ] ), dot( m[ 1 ], m[ 1 ] ), dot( m[ 2 ], m[ 2 ] ) );\n transformedNormal = m * transformedNormal;\n#endif\ntransformedNormal = normalMatrix * transformedNormal;\n#ifdef FLIP_SIDED\n transformedNormal = - transformedNormal;\n#endif\n#ifdef USE_TANGENT\n vec3 transformedTangent = ( modelViewMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n #ifdef FLIP_SIDED\n transformedTangent = - transformedTangent;\n #endif\n#endif`,EE=`#ifdef USE_DISPLACEMENTMAP\n uniform sampler2D displacementMap;\n uniform float displacementScale;\n uniform float displacementBias;\n#endif`,ME=`#ifdef USE_DISPLACEMENTMAP\n transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );\n#endif`,SE=`#ifdef USE_EMISSIVEMAP\n vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );\n totalEmissiveRadiance *= emissiveColor.rgb;\n#endif`,wE=`#ifdef USE_EMISSIVEMAP\n uniform sampler2D emissiveMap;\n#endif`,bE="gl_FragColor = linearToOutputTexel( gl_FragColor );",TE=`\nconst mat3 LINEAR_SRGB_TO_LINEAR_DISPLAY_P3 = mat3(\n vec3( 0.8224621, 0.177538, 0.0 ),\n vec3( 0.0331941, 0.9668058, 0.0 ),\n vec3( 0.0170827, 0.0723974, 0.9105199 )\n);\nconst mat3 LINEAR_DISPLAY_P3_TO_LINEAR_SRGB = mat3(\n vec3( 1.2249401, - 0.2249404, 0.0 ),\n vec3( - 0.0420569, 1.0420571, 0.0 ),\n vec3( - 0.0196376, - 0.0786361, 1.0982735 )\n);\nvec4 LinearSRGBToLinearDisplayP3( in vec4 value ) {\n return vec4( value.rgb * LINEAR_SRGB_TO_LINEAR_DISPLAY_P3, value.a );\n}\nvec4 LinearDisplayP3ToLinearSRGB( in vec4 value ) {\n return vec4( value.rgb * LINEAR_DISPLAY_P3_TO_LINEAR_SRGB, value.a );\n}\nvec4 LinearTransferOETF( in vec4 value ) {\n return value;\n}\nvec4 sRGBTransferOETF( in vec4 value ) {\n 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 );\n}\nvec4 LinearToLinear( in vec4 value ) {\n return value;\n}\nvec4 LinearTosRGB( in vec4 value ) {\n return sRGBTransferOETF( value );\n}`,AE=`#ifdef USE_ENVMAP\n #ifdef ENV_WORLDPOS\n vec3 cameraToFrag;\n if ( isOrthographic ) {\n cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n } else {\n cameraToFrag = normalize( vWorldPosition - cameraPosition );\n }\n vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n #ifdef ENVMAP_MODE_REFLECTION\n vec3 reflectVec = reflect( cameraToFrag, worldNormal );\n #else\n vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\n #endif\n #else\n vec3 reflectVec = vReflect;\n #endif\n #ifdef ENVMAP_TYPE_CUBE\n vec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n #else\n vec4 envColor = vec4( 0.0 );\n #endif\n #ifdef ENVMAP_BLENDING_MULTIPLY\n outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n #elif defined( ENVMAP_BLENDING_MIX )\n outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n #elif defined( ENVMAP_BLENDING_ADD )\n outgoingLight += envColor.xyz * specularStrength * reflectivity;\n #endif\n#endif`,CE=`#ifdef USE_ENVMAP\n uniform float envMapIntensity;\n uniform float flipEnvMap;\n #ifdef ENVMAP_TYPE_CUBE\n uniform samplerCube envMap;\n #else\n uniform sampler2D envMap;\n #endif\n \n#endif`,PE=`#ifdef USE_ENVMAP\n uniform float reflectivity;\n #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n #define ENV_WORLDPOS\n #endif\n #ifdef ENV_WORLDPOS\n varying vec3 vWorldPosition;\n uniform float refractionRatio;\n #else\n varying vec3 vReflect;\n #endif\n#endif`,IE=`#ifdef USE_ENVMAP\n #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n #define ENV_WORLDPOS\n #endif\n #ifdef ENV_WORLDPOS\n \n varying vec3 vWorldPosition;\n #else\n varying vec3 vReflect;\n uniform float refractionRatio;\n #endif\n#endif`,RE=`#ifdef USE_ENVMAP\n #ifdef ENV_WORLDPOS\n vWorldPosition = worldPosition.xyz;\n #else\n vec3 cameraToVertex;\n if ( isOrthographic ) {\n cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n } else {\n cameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n }\n vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n #ifdef ENVMAP_MODE_REFLECTION\n vReflect = reflect( cameraToVertex, worldNormal );\n #else\n vReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n #endif\n #endif\n#endif`,LE=`#ifdef USE_FOG\n vFogDepth = - mvPosition.z;\n#endif`,NE=`#ifdef USE_FOG\n varying float vFogDepth;\n#endif`,OE=`#ifdef USE_FOG\n #ifdef FOG_EXP2\n float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );\n #else\n float fogFactor = smoothstep( fogNear, fogFar, vFogDepth );\n #endif\n gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif`,DE=`#ifdef USE_FOG\n uniform vec3 fogColor;\n varying float vFogDepth;\n #ifdef FOG_EXP2\n uniform float fogDensity;\n #else\n uniform float fogNear;\n uniform float fogFar;\n #endif\n#endif`,FE=`#ifdef USE_GRADIENTMAP\n uniform sampler2D gradientMap;\n#endif\nvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n float dotNL = dot( normal, lightDirection );\n vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n #ifdef USE_GRADIENTMAP\n return vec3( texture2D( gradientMap, coord ).r );\n #else\n vec2 fw = fwidth( coord ) * 0.5;\n return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );\n #endif\n}`,UE=`#ifdef USE_LIGHTMAP\n vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\n reflectedLight.indirectDiffuse += lightMapIrradiance;\n#endif`,BE=`#ifdef USE_LIGHTMAP\n uniform sampler2D lightMap;\n uniform float lightMapIntensity;\n#endif`,zE=`LambertMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularStrength = specularStrength;`,kE=`varying vec3 vViewPosition;\nstruct LambertMaterial {\n vec3 diffuseColor;\n float specularStrength;\n};\nvoid 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 ) {\n float dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n vec3 irradiance = dotNL * directLight.color;\n reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid 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 ) {\n reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct RE_Direct_Lambert\n#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,GE=`uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\n#if defined( USE_LIGHT_PROBES )\n uniform vec3 lightProbe[ 9 ];\n#endif\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n float x = normal.x, y = normal.y, z = normal.z;\n vec3 result = shCoefficients[ 0 ] * 0.886227;\n result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n return result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {\n vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n return irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n vec3 irradiance = ambientLightColor;\n return irradiance;\n}\nfloat getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n #if defined ( LEGACY_LIGHTS )\n if ( cutoffDistance > 0.0 && decayExponent > 0.0 ) {\n return pow( saturate( - lightDistance / cutoffDistance + 1.0 ), decayExponent );\n }\n return 1.0;\n #else\n float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n if ( cutoffDistance > 0.0 ) {\n distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n }\n return distanceFalloff;\n #endif\n}\nfloat getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {\n return smoothstep( coneCosine, penumbraCosine, angleCosine );\n}\n#if NUM_DIR_LIGHTS > 0\n struct DirectionalLight {\n vec3 direction;\n vec3 color;\n };\n uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n void getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) {\n light.color = directionalLight.color;\n light.direction = directionalLight.direction;\n light.visible = true;\n }\n#endif\n#if NUM_POINT_LIGHTS > 0\n struct PointLight {\n vec3 position;\n vec3 color;\n float distance;\n float decay;\n };\n uniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n void getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) {\n vec3 lVector = pointLight.position - geometryPosition;\n light.direction = normalize( lVector );\n float lightDistance = length( lVector );\n light.color = pointLight.color;\n light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );\n light.visible = ( light.color != vec3( 0.0 ) );\n }\n#endif\n#if NUM_SPOT_LIGHTS > 0\n struct SpotLight {\n vec3 position;\n vec3 direction;\n vec3 color;\n float distance;\n float decay;\n float coneCos;\n float penumbraCos;\n };\n uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n void getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) {\n vec3 lVector = spotLight.position - geometryPosition;\n light.direction = normalize( lVector );\n float angleCos = dot( light.direction, spotLight.direction );\n float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n if ( spotAttenuation > 0.0 ) {\n float lightDistance = length( lVector );\n light.color = spotLight.color * spotAttenuation;\n light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );\n light.visible = ( light.color != vec3( 0.0 ) );\n } else {\n light.color = vec3( 0.0 );\n light.visible = false;\n }\n }\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n struct RectAreaLight {\n vec3 color;\n vec3 position;\n vec3 halfWidth;\n vec3 halfHeight;\n };\n uniform sampler2D ltc_1; uniform sampler2D ltc_2;\n uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n struct HemisphereLight {\n vec3 direction;\n vec3 skyColor;\n vec3 groundColor;\n };\n uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {\n float dotNL = dot( normal, hemiLight.direction );\n float hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n return irradiance;\n }\n#endif`,VE=`#ifdef USE_ENVMAP\n vec3 getIBLIrradiance( const in vec3 normal ) {\n #ifdef ENVMAP_TYPE_CUBE_UV\n vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n vec4 envMapColor = textureCubeUV( envMap, worldNormal, 1.0 );\n return PI * envMapColor.rgb * envMapIntensity;\n #else\n return vec3( 0.0 );\n #endif\n }\n vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {\n #ifdef ENVMAP_TYPE_CUBE_UV\n vec3 reflectVec = reflect( - viewDir, normal );\n reflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );\n reflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n vec4 envMapColor = textureCubeUV( envMap, reflectVec, roughness );\n return envMapColor.rgb * envMapIntensity;\n #else\n return vec3( 0.0 );\n #endif\n }\n #ifdef USE_ANISOTROPY\n vec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {\n #ifdef ENVMAP_TYPE_CUBE_UV\n vec3 bentNormal = cross( bitangent, viewDir );\n bentNormal = normalize( cross( bentNormal, bitangent ) );\n bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );\n return getIBLRadiance( viewDir, bentNormal, roughness );\n #else\n return vec3( 0.0 );\n #endif\n }\n #endif\n#endif`,HE=`ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;`,WE=`varying vec3 vViewPosition;\nstruct ToonMaterial {\n vec3 diffuseColor;\n};\nvoid 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 ) {\n vec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color;\n reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid 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 ) {\n reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct RE_Direct_Toon\n#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,qE=`BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;`,XE=`varying vec3 vViewPosition;\nstruct BlinnPhongMaterial {\n vec3 diffuseColor;\n vec3 specularColor;\n float specularShininess;\n float specularStrength;\n};\nvoid 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 ) {\n float dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n vec3 irradiance = dotNL * directLight.color;\n reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid 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 ) {\n reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct RE_Direct_BlinnPhong\n#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,YE=`PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nvec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) );\nfloat geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );\nmaterial.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;\nmaterial.roughness = min( material.roughness, 1.0 );\n#ifdef IOR\n material.ior = ior;\n #ifdef USE_SPECULAR\n float specularIntensityFactor = specularIntensity;\n vec3 specularColorFactor = specularColor;\n #ifdef USE_SPECULAR_COLORMAP\n specularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;\n #endif\n #ifdef USE_SPECULAR_INTENSITYMAP\n specularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;\n #endif\n material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );\n #else\n float specularIntensityFactor = 1.0;\n vec3 specularColorFactor = vec3( 1.0 );\n material.specularF90 = 1.0;\n #endif\n material.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );\n#else\n material.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );\n material.specularF90 = 1.0;\n#endif\n#ifdef USE_CLEARCOAT\n material.clearcoat = clearcoat;\n material.clearcoatRoughness = clearcoatRoughness;\n material.clearcoatF0 = vec3( 0.04 );\n material.clearcoatF90 = 1.0;\n #ifdef USE_CLEARCOATMAP\n material.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x;\n #endif\n #ifdef USE_CLEARCOAT_ROUGHNESSMAP\n material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y;\n #endif\n material.clearcoat = saturate( material.clearcoat ); material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );\n material.clearcoatRoughness += geometryRoughness;\n material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\n#endif\n#ifdef USE_IRIDESCENCE\n material.iridescence = iridescence;\n material.iridescenceIOR = iridescenceIOR;\n #ifdef USE_IRIDESCENCEMAP\n material.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;\n #endif\n #ifdef USE_IRIDESCENCE_THICKNESSMAP\n material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;\n #else\n material.iridescenceThickness = iridescenceThicknessMaximum;\n #endif\n#endif\n#ifdef USE_SHEEN\n material.sheenColor = sheenColor;\n #ifdef USE_SHEEN_COLORMAP\n material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;\n #endif\n material.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );\n #ifdef USE_SHEEN_ROUGHNESSMAP\n material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;\n #endif\n#endif\n#ifdef USE_ANISOTROPY\n #ifdef USE_ANISOTROPYMAP\n mat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x );\n vec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb;\n vec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b;\n #else\n vec2 anisotropyV = anisotropyVector;\n #endif\n material.anisotropy = length( anisotropyV );\n anisotropyV /= material.anisotropy;\n material.anisotropy = saturate( material.anisotropy );\n material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );\n material.anisotropyT = tbn[ 0 ] * anisotropyV.x - tbn[ 1 ] * anisotropyV.y;\n material.anisotropyB = tbn[ 1 ] * anisotropyV.x + tbn[ 0 ] * anisotropyV.y;\n#endif`,ZE=`struct PhysicalMaterial {\n vec3 diffuseColor;\n float roughness;\n vec3 specularColor;\n float specularF90;\n #ifdef USE_CLEARCOAT\n float clearcoat;\n float clearcoatRoughness;\n vec3 clearcoatF0;\n float clearcoatF90;\n #endif\n #ifdef USE_IRIDESCENCE\n float iridescence;\n float iridescenceIOR;\n float iridescenceThickness;\n vec3 iridescenceFresnel;\n vec3 iridescenceF0;\n #endif\n #ifdef USE_SHEEN\n vec3 sheenColor;\n float sheenRoughness;\n #endif\n #ifdef IOR\n float ior;\n #endif\n #ifdef USE_TRANSMISSION\n float transmission;\n float transmissionAlpha;\n float thickness;\n float attenuationDistance;\n vec3 attenuationColor;\n #endif\n #ifdef USE_ANISOTROPY\n float anisotropy;\n float alphaT;\n vec3 anisotropyT;\n vec3 anisotropyB;\n #endif\n};\nvec3 clearcoatSpecular = vec3( 0.0 );\nvec3 sheenSpecular = vec3( 0.0 );\nvec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {\n float x = clamp( 1.0 - dotVH, 0.0, 1.0 );\n float x2 = x * x;\n float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );\n return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );\n}\nfloat V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n float a2 = pow2( alpha );\n float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n return 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n float a2 = pow2( alpha );\n float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n return RECIPROCAL_PI * a2 / pow2( denom );\n}\n#ifdef USE_ANISOTROPY\n 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 ) {\n float gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );\n float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );\n float v = 0.5 / ( gv + gl );\n return saturate(v);\n }\n float D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {\n float a2 = alphaT * alphaB;\n highp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );\n highp float v2 = dot( v, v );\n float w2 = a2 / v2;\n return RECIPROCAL_PI * a2 * pow2 ( w2 );\n }\n#endif\n#ifdef USE_CLEARCOAT\n vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {\n vec3 f0 = material.clearcoatF0;\n float f90 = material.clearcoatF90;\n float roughness = material.clearcoatRoughness;\n float alpha = pow2( roughness );\n vec3 halfDir = normalize( lightDir + viewDir );\n float dotNL = saturate( dot( normal, lightDir ) );\n float dotNV = saturate( dot( normal, viewDir ) );\n float dotNH = saturate( dot( normal, halfDir ) );\n float dotVH = saturate( dot( viewDir, halfDir ) );\n vec3 F = F_Schlick( f0, f90, dotVH );\n float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n float D = D_GGX( alpha, dotNH );\n return F * ( V * D );\n }\n#endif\nvec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {\n vec3 f0 = material.specularColor;\n float f90 = material.specularF90;\n float roughness = material.roughness;\n float alpha = pow2( roughness );\n vec3 halfDir = normalize( lightDir + viewDir );\n float dotNL = saturate( dot( normal, lightDir ) );\n float dotNV = saturate( dot( normal, viewDir ) );\n float dotNH = saturate( dot( normal, halfDir ) );\n float dotVH = saturate( dot( viewDir, halfDir ) );\n vec3 F = F_Schlick( f0, f90, dotVH );\n #ifdef USE_IRIDESCENCE\n F = mix( F, material.iridescenceFresnel, material.iridescence );\n #endif\n #ifdef USE_ANISOTROPY\n float dotTL = dot( material.anisotropyT, lightDir );\n float dotTV = dot( material.anisotropyT, viewDir );\n float dotTH = dot( material.anisotropyT, halfDir );\n float dotBL = dot( material.anisotropyB, lightDir );\n float dotBV = dot( material.anisotropyB, viewDir );\n float dotBH = dot( material.anisotropyB, halfDir );\n float V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );\n float D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );\n #else\n float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n float D = D_GGX( alpha, dotNH );\n #endif\n return F * ( V * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n const float LUT_SIZE = 64.0;\n const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n const float LUT_BIAS = 0.5 / LUT_SIZE;\n float dotNV = saturate( dot( N, V ) );\n vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n uv = uv * LUT_SCALE + LUT_BIAS;\n return uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n float l = length( f );\n return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n float x = dot( v1, v2 );\n float y = abs( x );\n float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n float b = 3.4175940 + ( 4.1616724 + y ) * y;\n float v = a / b;\n float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n return cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n vec3 lightNormal = cross( v1, v2 );\n if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n vec3 T1, T2;\n T1 = normalize( V - N * dot( V, N ) );\n T2 = - cross( N, T1 );\n mat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n vec3 coords[ 4 ];\n coords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n coords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n coords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n coords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n coords[ 0 ] = normalize( coords[ 0 ] );\n coords[ 1 ] = normalize( coords[ 1 ] );\n coords[ 2 ] = normalize( coords[ 2 ] );\n coords[ 3 ] = normalize( coords[ 3 ] );\n vec3 vectorFormFactor = vec3( 0.0 );\n vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n float result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n return vec3( result );\n}\n#if defined( USE_SHEEN )\nfloat D_Charlie( float roughness, float dotNH ) {\n float alpha = pow2( roughness );\n float invAlpha = 1.0 / alpha;\n float cos2h = dotNH * dotNH;\n float sin2h = max( 1.0 - cos2h, 0.0078125 );\n return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );\n}\nfloat V_Neubelt( float dotNV, float dotNL ) {\n return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );\n}\nvec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {\n vec3 halfDir = normalize( lightDir + viewDir );\n float dotNL = saturate( dot( normal, lightDir ) );\n float dotNV = saturate( dot( normal, viewDir ) );\n float dotNH = saturate( dot( normal, halfDir ) );\n float D = D_Charlie( sheenRoughness, dotNH );\n float V = V_Neubelt( dotNV, dotNL );\n return sheenColor * ( D * V );\n}\n#endif\nfloat IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n float dotNV = saturate( dot( normal, viewDir ) );\n float r2 = roughness * roughness;\n float a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;\n float b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;\n float DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );\n return saturate( DG * RECIPROCAL_PI );\n}\nvec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n float dotNV = saturate( dot( normal, viewDir ) );\n const vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n const vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n vec4 r = roughness * c0 + c1;\n float a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n vec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;\n return fab;\n}\nvec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {\n vec2 fab = DFGApprox( normal, viewDir, roughness );\n return specularColor * fab.x + specularF90 * fab.y;\n}\n#ifdef USE_IRIDESCENCE\nvoid 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 ) {\n#else\nvoid 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 ) {\n#endif\n vec2 fab = DFGApprox( normal, viewDir, roughness );\n #ifdef USE_IRIDESCENCE\n vec3 Fr = mix( specularColor, iridescenceF0, iridescence );\n #else\n vec3 Fr = specularColor;\n #endif\n vec3 FssEss = Fr * fab.x + specularF90 * fab.y;\n float Ess = fab.x + fab.y;\n float Ems = 1.0 - Ess;\n vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619; vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n singleScatter += FssEss;\n multiScatter += Fms * Ems;\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n 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 ) {\n vec3 normal = geometryNormal;\n vec3 viewDir = geometryViewDir;\n vec3 position = geometryPosition;\n vec3 lightPos = rectAreaLight.position;\n vec3 halfWidth = rectAreaLight.halfWidth;\n vec3 halfHeight = rectAreaLight.halfHeight;\n vec3 lightColor = rectAreaLight.color;\n float roughness = material.roughness;\n vec3 rectCoords[ 4 ];\n rectCoords[ 0 ] = lightPos + halfWidth - halfHeight; rectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n rectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n rectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n vec2 uv = LTC_Uv( normal, viewDir, roughness );\n vec4 t1 = texture2D( ltc_1, uv );\n vec4 t2 = texture2D( ltc_2, uv );\n mat3 mInv = mat3(\n vec3( t1.x, 0, t1.y ),\n vec3( 0, 1, 0 ),\n vec3( t1.z, 0, t1.w )\n );\n vec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n reflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n }\n#endif\nvoid 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 ) {\n float dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n vec3 irradiance = dotNL * directLight.color;\n #ifdef USE_CLEARCOAT\n float dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) );\n vec3 ccIrradiance = dotNLcc * directLight.color;\n clearcoatSpecular += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material );\n #endif\n #ifdef USE_SHEEN\n sheenSpecular += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness );\n #endif\n reflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometryViewDir, geometryNormal, material );\n reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid 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 ) {\n reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid 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) {\n #ifdef USE_CLEARCOAT\n clearcoatSpecular += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n #endif\n #ifdef USE_SHEEN\n sheenSpecular += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );\n #endif\n vec3 singleScattering = vec3( 0.0 );\n vec3 multiScattering = vec3( 0.0 );\n vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n #ifdef USE_IRIDESCENCE\n computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering );\n #else\n computeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );\n #endif\n vec3 totalScattering = singleScattering + multiScattering;\n vec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) );\n reflectedLight.indirectSpecular += radiance * singleScattering;\n reflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\n reflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n}\n#define RE_Direct RE_Direct_Physical\n#define RE_Direct_RectArea RE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse RE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular RE_IndirectSpecular_Physical\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}`,JE=`\nvec3 geometryPosition = - vViewPosition;\nvec3 geometryNormal = normal;\nvec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\nvec3 geometryClearcoatNormal;\n#ifdef USE_CLEARCOAT\n geometryClearcoatNormal = clearcoatNormal;\n#endif\n#ifdef USE_IRIDESCENCE\n float dotNVi = saturate( dot( normal, geometryViewDir ) );\n if ( material.iridescenceThickness == 0.0 ) {\n material.iridescence = 0.0;\n } else {\n material.iridescence = saturate( material.iridescence );\n }\n if ( material.iridescence > 0.0 ) {\n material.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );\n material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );\n }\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n PointLight pointLight;\n #if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n PointLightShadow pointLightShadow;\n #endif\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n pointLight = pointLights[ i ];\n getPointLightInfo( pointLight, geometryPosition, directLight );\n #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n pointLightShadow = pointLightShadows[ i ];\n directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n #endif\n RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n }\n #pragma unroll_loop_end\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n SpotLight spotLight;\n vec4 spotColor;\n vec3 spotLightCoord;\n bool inSpotLightMap;\n #if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n SpotLightShadow spotLightShadow;\n #endif\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n spotLight = spotLights[ i ];\n getSpotLightInfo( spotLight, geometryPosition, directLight );\n #if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n #define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX\n #elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n #define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS\n #else\n #define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n #endif\n #if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )\n spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;\n inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );\n spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );\n directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;\n #endif\n #undef SPOT_LIGHT_MAP_INDEX\n #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n spotLightShadow = spotLightShadows[ i ];\n directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n #endif\n RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n }\n #pragma unroll_loop_end\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n DirectionalLight directionalLight;\n #if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n DirectionalLightShadow directionalLightShadow;\n #endif\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n directionalLight = directionalLights[ i ];\n getDirectionalLightInfo( directionalLight, directLight );\n #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n directionalLightShadow = directionalLightShadows[ i ];\n directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n #endif\n RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n }\n #pragma unroll_loop_end\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n RectAreaLight rectAreaLight;\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n rectAreaLight = rectAreaLights[ i ];\n RE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n }\n #pragma unroll_loop_end\n#endif\n#if defined( RE_IndirectDiffuse )\n vec3 iblIrradiance = vec3( 0.0 );\n vec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n #if defined( USE_LIGHT_PROBES )\n irradiance += getLightProbeIrradiance( lightProbe, geometryNormal );\n #endif\n #if ( NUM_HEMI_LIGHTS > 0 )\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal );\n }\n #pragma unroll_loop_end\n #endif\n#endif\n#if defined( RE_IndirectSpecular )\n vec3 radiance = vec3( 0.0 );\n vec3 clearcoatRadiance = vec3( 0.0 );\n#endif`,$E=`#if defined( RE_IndirectDiffuse )\n #ifdef USE_LIGHTMAP\n vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\n irradiance += lightMapIrradiance;\n #endif\n #if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\n iblIrradiance += getIBLIrradiance( geometryNormal );\n #endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n #ifdef USE_ANISOTROPY\n radiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy );\n #else\n radiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness );\n #endif\n #ifdef USE_CLEARCOAT\n clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );\n #endif\n#endif`,KE=`#if defined( RE_IndirectDiffuse )\n RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n#endif`,jE=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n gl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif`,QE=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n uniform float logDepthBufFC;\n varying float vFragDepth;\n varying float vIsPerspective;\n#endif`,tM=`#ifdef USE_LOGDEPTHBUF\n #ifdef USE_LOGDEPTHBUF_EXT\n varying float vFragDepth;\n varying float vIsPerspective;\n #else\n uniform float logDepthBufFC;\n #endif\n#endif`,eM=`#ifdef USE_LOGDEPTHBUF\n #ifdef USE_LOGDEPTHBUF_EXT\n vFragDepth = 1.0 + gl_Position.w;\n vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n #else\n if ( isPerspectiveMatrix( projectionMatrix ) ) {\n gl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;\n gl_Position.z *= gl_Position.w;\n }\n #endif\n#endif`,nM=`#ifdef USE_MAP\n vec4 sampledDiffuseColor = texture2D( map, vMapUv );\n #ifdef DECODE_VIDEO_TEXTURE\n sampledDiffuseColor = vec4( mix( pow( sampledDiffuseColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), sampledDiffuseColor.rgb * 0.0773993808, vec3( lessThanEqual( sampledDiffuseColor.rgb, vec3( 0.04045 ) ) ) ), sampledDiffuseColor.w );\n \n #endif\n diffuseColor *= sampledDiffuseColor;\n#endif`,rM=`#ifdef USE_MAP\n uniform sampler2D map;\n#endif`,iM=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n #if defined( USE_POINTS_UV )\n vec2 uv = vUv;\n #else\n vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n #endif\n#endif\n#ifdef USE_MAP\n diffuseColor *= texture2D( map, uv );\n#endif\n#ifdef USE_ALPHAMAP\n diffuseColor.a *= texture2D( alphaMap, uv ).g;\n#endif`,oM=`#if defined( USE_POINTS_UV )\n varying vec2 vUv;\n#else\n #if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n uniform mat3 uvTransform;\n #endif\n#endif\n#ifdef USE_MAP\n uniform sampler2D map;\n#endif\n#ifdef USE_ALPHAMAP\n uniform sampler2D alphaMap;\n#endif`,sM=`float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );\n metalnessFactor *= texelMetalness.b;\n#endif`,aM=`#ifdef USE_METALNESSMAP\n uniform sampler2D metalnessMap;\n#endif`,uM=`#if defined( USE_MORPHCOLORS ) && defined( MORPHTARGETS_TEXTURE )\n vColor *= morphTargetBaseInfluence;\n for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n #if defined( USE_COLOR_ALPHA )\n if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];\n #elif defined( USE_COLOR )\n if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];\n #endif\n }\n#endif`,lM=`#ifdef USE_MORPHNORMALS\n objectNormal *= morphTargetBaseInfluence;\n #ifdef MORPHTARGETS_TEXTURE\n for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];\n }\n #else\n objectNormal += morphNormal0 * morphTargetInfluences[ 0 ];\n objectNormal += morphNormal1 * morphTargetInfluences[ 1 ];\n objectNormal += morphNormal2 * morphTargetInfluences[ 2 ];\n objectNormal += morphNormal3 * morphTargetInfluences[ 3 ];\n #endif\n#endif`,cM=`#ifdef USE_MORPHTARGETS\n uniform float morphTargetBaseInfluence;\n #ifdef MORPHTARGETS_TEXTURE\n uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];\n uniform sampler2DArray morphTargetsTexture;\n uniform ivec2 morphTargetsTextureSize;\n vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {\n int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;\n int y = texelIndex / morphTargetsTextureSize.x;\n int x = texelIndex - y * morphTargetsTextureSize.x;\n ivec3 morphUV = ivec3( x, y, morphTargetIndex );\n return texelFetch( morphTargetsTexture, morphUV, 0 );\n }\n #else\n #ifndef USE_MORPHNORMALS\n uniform float morphTargetInfluences[ 8 ];\n #else\n uniform float morphTargetInfluences[ 4 ];\n #endif\n #endif\n#endif`,fM=`#ifdef USE_MORPHTARGETS\n transformed *= morphTargetBaseInfluence;\n #ifdef MORPHTARGETS_TEXTURE\n for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];\n }\n #else\n transformed += morphTarget0 * morphTargetInfluences[ 0 ];\n transformed += morphTarget1 * morphTargetInfluences[ 1 ];\n transformed += morphTarget2 * morphTargetInfluences[ 2 ];\n transformed += morphTarget3 * morphTargetInfluences[ 3 ];\n #ifndef USE_MORPHNORMALS\n transformed += morphTarget4 * morphTargetInfluences[ 4 ];\n transformed += morphTarget5 * morphTargetInfluences[ 5 ];\n transformed += morphTarget6 * morphTargetInfluences[ 6 ];\n transformed += morphTarget7 * morphTargetInfluences[ 7 ];\n #endif\n #endif\n#endif`,hM=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;\n#ifdef FLAT_SHADED\n vec3 fdx = dFdx( vViewPosition );\n vec3 fdy = dFdy( vViewPosition );\n vec3 normal = normalize( cross( fdx, fdy ) );\n#else\n vec3 normal = normalize( vNormal );\n #ifdef DOUBLE_SIDED\n normal *= faceDirection;\n #endif\n#endif\n#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY )\n #ifdef USE_TANGENT\n mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n #else\n mat3 tbn = getTangentFrame( - vViewPosition, normal,\n #if defined( USE_NORMALMAP )\n vNormalMapUv\n #elif defined( USE_CLEARCOAT_NORMALMAP )\n vClearcoatNormalMapUv\n #else\n vUv\n #endif\n );\n #endif\n #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n tbn[0] *= faceDirection;\n tbn[1] *= faceDirection;\n #endif\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n #ifdef USE_TANGENT\n mat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n #else\n mat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );\n #endif\n #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n tbn2[0] *= faceDirection;\n tbn2[1] *= faceDirection;\n #endif\n#endif\nvec3 nonPerturbedNormal = normal;`,pM=`#ifdef USE_NORMALMAP_OBJECTSPACE\n normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n #ifdef FLIP_SIDED\n normal = - normal;\n #endif\n #ifdef DOUBLE_SIDED\n normal = normal * faceDirection;\n #endif\n normal = normalize( normalMatrix * normal );\n#elif defined( USE_NORMALMAP_TANGENTSPACE )\n vec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n mapN.xy *= normalScale;\n normal = normalize( tbn * mapN );\n#elif defined( USE_BUMPMAP )\n normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );\n#endif`,dM=`#ifndef FLAT_SHADED\n varying vec3 vNormal;\n #ifdef USE_TANGENT\n varying vec3 vTangent;\n varying vec3 vBitangent;\n #endif\n#endif`,mM=`#ifndef FLAT_SHADED\n varying vec3 vNormal;\n #ifdef USE_TANGENT\n varying vec3 vTangent;\n varying vec3 vBitangent;\n #endif\n#endif`,gM=`#ifndef FLAT_SHADED\n vNormal = normalize( transformedNormal );\n #ifdef USE_TANGENT\n vTangent = normalize( transformedTangent );\n vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n #endif\n#endif`,yM=`#ifdef USE_NORMALMAP\n uniform sampler2D normalMap;\n uniform vec2 normalScale;\n#endif\n#ifdef USE_NORMALMAP_OBJECTSPACE\n uniform mat3 normalMatrix;\n#endif\n#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) )\n mat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {\n vec3 q0 = dFdx( eye_pos.xyz );\n vec3 q1 = dFdy( eye_pos.xyz );\n vec2 st0 = dFdx( uv.st );\n vec2 st1 = dFdy( uv.st );\n vec3 N = surf_norm;\n vec3 q1perp = cross( q1, N );\n vec3 q0perp = cross( N, q0 );\n vec3 T = q1perp * st0.x + q0perp * st1.x;\n vec3 B = q1perp * st0.y + q0perp * st1.y;\n float det = max( dot( T, T ), dot( B, B ) );\n float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );\n return mat3( T * scale, B * scale, N );\n }\n#endif`,vM=`#ifdef USE_CLEARCOAT\n vec3 clearcoatNormal = nonPerturbedNormal;\n#endif`,_M=`#ifdef USE_CLEARCOAT_NORMALMAP\n vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;\n clearcoatMapN.xy *= clearcoatNormalScale;\n clearcoatNormal = normalize( tbn2 * clearcoatMapN );\n#endif`,xM=`#ifdef USE_CLEARCOATMAP\n uniform sampler2D clearcoatMap;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n uniform sampler2D clearcoatNormalMap;\n uniform vec2 clearcoatNormalScale;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n uniform sampler2D clearcoatRoughnessMap;\n#endif`,EM=`#ifdef USE_IRIDESCENCEMAP\n uniform sampler2D iridescenceMap;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n uniform sampler2D iridescenceThicknessMap;\n#endif`,MM=`#ifdef OPAQUE\ndiffuseColor.a = 1.0;\n#endif\n#ifdef USE_TRANSMISSION\ndiffuseColor.a *= material.transmissionAlpha;\n#endif\ngl_FragColor = vec4( outgoingLight, diffuseColor.a );`,SM=`vec3 packNormalToRGB( const in vec3 normal ) {\n return normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n return 2.0 * rgb.xyz - 1.0;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;\nconst vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\nconst vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );\nconst float ShiftRight8 = 1. / 256.;\nvec4 packDepthToRGBA( const in float v ) {\n vec4 r = vec4( fract( v * PackFactors ), v );\n r.yzw -= r.xyz * ShiftRight8; return r * PackUpscale;\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n return dot( v, UnpackFactors );\n}\nvec2 packDepthToRG( in highp float v ) {\n return packDepthToRGBA( v ).yx;\n}\nfloat unpackRGToDepth( const in highp vec2 v ) {\n return unpackRGBAToDepth( vec4( v.xy, 0.0, 0.0 ) );\n}\nvec4 pack2HalfToRGBA( vec2 v ) {\n vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );\n return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );\n}\nvec2 unpackRGBATo2Half( vec4 v ) {\n return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n return ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) {\n return depth * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) {\n return ( near * far ) / ( ( far - near ) * depth - far );\n}`,wM=`#ifdef PREMULTIPLIED_ALPHA\n gl_FragColor.rgb *= gl_FragColor.a;\n#endif`,bM=`vec4 mvPosition = vec4( transformed, 1.0 );\n#ifdef USE_INSTANCING\n mvPosition = instanceMatrix * mvPosition;\n#endif\nmvPosition = modelViewMatrix * mvPosition;\ngl_Position = projectionMatrix * mvPosition;`,TM=`#ifdef DITHERING\n gl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif`,AM=`#ifdef DITHERING\n vec3 dithering( vec3 color ) {\n float grid_position = rand( gl_FragCoord.xy );\n vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n return color + dither_shift_RGB;\n }\n#endif`,CM=`float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );\n roughnessFactor *= texelRoughness.g;\n#endif`,PM=`#ifdef USE_ROUGHNESSMAP\n uniform sampler2D roughnessMap;\n#endif`,IM=`#if NUM_SPOT_LIGHT_COORDS > 0\n varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#if NUM_SPOT_LIGHT_MAPS > 0\n uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];\n#endif\n#ifdef USE_SHADOWMAP\n #if NUM_DIR_LIGHT_SHADOWS > 0\n uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n struct DirectionalLightShadow {\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n };\n uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n #endif\n #if NUM_SPOT_LIGHT_SHADOWS > 0\n uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n struct SpotLightShadow {\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n };\n uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n #endif\n #if NUM_POINT_LIGHT_SHADOWS > 0\n uniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n struct PointLightShadow {\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n float shadowCameraNear;\n float shadowCameraFar;\n };\n uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n #endif\n float texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n return step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n }\n vec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {\n return unpackRGBATo2Half( texture2D( shadow, uv ) );\n }\n float VSMShadow (sampler2D shadow, vec2 uv, float compare ){\n float occlusion = 1.0;\n vec2 distribution = texture2DDistribution( shadow, uv );\n float hard_shadow = step( compare , distribution.x );\n if (hard_shadow != 1.0 ) {\n float distance = compare - distribution.x ;\n float variance = max( 0.00000, distribution.y * distribution.y );\n float softness_probability = variance / (variance + distance * distance ); softness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 ); occlusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );\n }\n return occlusion;\n }\n float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n float shadow = 1.0;\n shadowCoord.xyz /= shadowCoord.w;\n shadowCoord.z += shadowBias;\n bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\n bool frustumTest = inFrustum && shadowCoord.z <= 1.0;\n if ( frustumTest ) {\n #if defined( SHADOWMAP_TYPE_PCF )\n vec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n float dx0 = - texelSize.x * shadowRadius;\n float dy0 = - texelSize.y * shadowRadius;\n float dx1 = + texelSize.x * shadowRadius;\n float dy1 = + texelSize.y * shadowRadius;\n float dx2 = dx0 / 2.0;\n float dy2 = dy0 / 2.0;\n float dx3 = dx1 / 2.0;\n float dy3 = dy1 / 2.0;\n shadow = (\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n ) * ( 1.0 / 17.0 );\n #elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n vec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n float dx = texelSize.x;\n float dy = texelSize.y;\n vec2 uv = shadowCoord.xy;\n vec2 f = fract( uv * shadowMapSize + 0.5 );\n uv -= f * texelSize;\n shadow = (\n texture2DCompare( shadowMap, uv, shadowCoord.z ) +\n texture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +\n texture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +\n mix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ),\n texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),\n f.x ) +\n mix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ),\n texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),\n f.x ) +\n mix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ),\n texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),\n f.y ) +\n mix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ),\n texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),\n f.y ) +\n mix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ),\n texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),\n f.x ),\n mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ),\n texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),\n f.x ),\n f.y )\n ) * ( 1.0 / 9.0 );\n #elif defined( SHADOWMAP_TYPE_VSM )\n shadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );\n #else\n shadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n #endif\n }\n return shadow;\n }\n vec2 cubeToUV( vec3 v, float texelSizeY ) {\n vec3 absV = abs( v );\n float scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n absV *= scaleToCube;\n v *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n vec2 planar = v.xy;\n float almostATexel = 1.5 * texelSizeY;\n float almostOne = 1.0 - almostATexel;\n if ( absV.z >= almostOne ) {\n if ( v.z > 0.0 )\n planar.x = 4.0 - v.x;\n } else if ( absV.x >= almostOne ) {\n float signX = sign( v.x );\n planar.x = v.z * signX + 2.0 * signX;\n } else if ( absV.y >= almostOne ) {\n float signY = sign( v.y );\n planar.x = v.x + 2.0 * signY + 2.0;\n planar.y = v.z * signY - 2.0;\n }\n return vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n }\n float getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n vec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n vec3 lightToPosition = shadowCoord.xyz;\n float dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear ); dp += shadowBias;\n vec3 bd3D = normalize( lightToPosition );\n #if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )\n vec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n return (\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n ) * ( 1.0 / 9.0 );\n #else\n return texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n #endif\n }\n#endif`,RM=`#if NUM_SPOT_LIGHT_COORDS > 0\n uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];\n varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#ifdef USE_SHADOWMAP\n #if NUM_DIR_LIGHT_SHADOWS > 0\n uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n struct DirectionalLightShadow {\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n };\n uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n #endif\n #if NUM_SPOT_LIGHT_SHADOWS > 0\n struct SpotLightShadow {\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n };\n uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n #endif\n #if NUM_POINT_LIGHT_SHADOWS > 0\n uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\n varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n struct PointLightShadow {\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n float shadowCameraNear;\n float shadowCameraFar;\n };\n uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n #endif\n#endif`,LM=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )\n vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n vec4 shadowWorldPosition;\n#endif\n#if defined( USE_SHADOWMAP )\n #if NUM_DIR_LIGHT_SHADOWS > 0\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );\n vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;\n }\n #pragma unroll_loop_end\n #endif\n #if NUM_POINT_LIGHT_SHADOWS > 0\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );\n vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;\n }\n #pragma unroll_loop_end\n #endif\n#endif\n#if NUM_SPOT_LIGHT_COORDS > 0\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {\n shadowWorldPosition = worldPosition;\n #if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;\n #endif\n vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;\n }\n #pragma unroll_loop_end\n#endif`,NM=`float getShadowMask() {\n float shadow = 1.0;\n #ifdef USE_SHADOWMAP\n #if NUM_DIR_LIGHT_SHADOWS > 0\n DirectionalLightShadow directionalLight;\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n directionalLight = directionalLightShadows[ i ];\n shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n }\n #pragma unroll_loop_end\n #endif\n #if NUM_SPOT_LIGHT_SHADOWS > 0\n SpotLightShadow spotLight;\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n spotLight = spotLightShadows[ i ];\n shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n }\n #pragma unroll_loop_end\n #endif\n #if NUM_POINT_LIGHT_SHADOWS > 0\n PointLightShadow pointLight;\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n pointLight = pointLightShadows[ i ];\n shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n }\n #pragma unroll_loop_end\n #endif\n #endif\n return shadow;\n}`,OM=`#ifdef USE_SKINNING\n mat4 boneMatX = getBoneMatrix( skinIndex.x );\n mat4 boneMatY = getBoneMatrix( skinIndex.y );\n mat4 boneMatZ = getBoneMatrix( skinIndex.z );\n mat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif`,DM=`#ifdef USE_SKINNING\n uniform mat4 bindMatrix;\n uniform mat4 bindMatrixInverse;\n uniform highp sampler2D boneTexture;\n uniform int boneTextureSize;\n mat4 getBoneMatrix( const in float i ) {\n float j = i * 4.0;\n float x = mod( j, float( boneTextureSize ) );\n float y = floor( j / float( boneTextureSize ) );\n float dx = 1.0 / float( boneTextureSize );\n float dy = 1.0 / float( boneTextureSize );\n y = dy * ( y + 0.5 );\n vec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\n vec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\n vec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\n vec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\n mat4 bone = mat4( v1, v2, v3, v4 );\n return bone;\n }\n#endif`,FM=`#ifdef USE_SKINNING\n vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n vec4 skinned = vec4( 0.0 );\n skinned += boneMatX * skinVertex * skinWeight.x;\n skinned += boneMatY * skinVertex * skinWeight.y;\n skinned += boneMatZ * skinVertex * skinWeight.z;\n skinned += boneMatW * skinVertex * skinWeight.w;\n transformed = ( bindMatrixInverse * skinned ).xyz;\n#endif`,UM=`#ifdef USE_SKINNING\n mat4 skinMatrix = mat4( 0.0 );\n skinMatrix += skinWeight.x * boneMatX;\n skinMatrix += skinWeight.y * boneMatY;\n skinMatrix += skinWeight.z * boneMatZ;\n skinMatrix += skinWeight.w * boneMatW;\n skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n #ifdef USE_TANGENT\n objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n #endif\n#endif`,BM=`float specularStrength;\n#ifdef USE_SPECULARMAP\n vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );\n specularStrength = texelSpecular.r;\n#else\n specularStrength = 1.0;\n#endif`,zM=`#ifdef USE_SPECULARMAP\n uniform sampler2D specularMap;\n#endif`,kM=`#if defined( TONE_MAPPING )\n gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif`,GM=`#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nvec3 LinearToneMapping( vec3 color ) {\n return saturate( toneMappingExposure * color );\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n color *= toneMappingExposure;\n return saturate( color / ( vec3( 1.0 ) + color ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n color *= toneMappingExposure;\n color = max( vec3( 0.0 ), color - 0.004 );\n return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\nvec3 RRTAndODTFit( vec3 v ) {\n vec3 a = v * ( v + 0.0245786 ) - 0.000090537;\n vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;\n return a / b;\n}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n const mat3 ACESInputMat = mat3(\n vec3( 0.59719, 0.07600, 0.02840 ), vec3( 0.35458, 0.90834, 0.13383 ),\n vec3( 0.04823, 0.01566, 0.83777 )\n );\n const mat3 ACESOutputMat = mat3(\n vec3( 1.60475, -0.10208, -0.00327 ), vec3( -0.53108, 1.10813, -0.07276 ),\n vec3( -0.07367, -0.00605, 1.07602 )\n );\n color *= toneMappingExposure / 0.6;\n color = ACESInputMat * color;\n color = RRTAndODTFit( color );\n color = ACESOutputMat * color;\n return saturate( color );\n}\nvec3 CustomToneMapping( vec3 color ) { return color; }`,VM=`#ifdef USE_TRANSMISSION\n material.transmission = transmission;\n material.transmissionAlpha = 1.0;\n material.thickness = thickness;\n material.attenuationDistance = attenuationDistance;\n material.attenuationColor = attenuationColor;\n #ifdef USE_TRANSMISSIONMAP\n material.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;\n #endif\n #ifdef USE_THICKNESSMAP\n material.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;\n #endif\n vec3 pos = vWorldPosition;\n vec3 v = normalize( cameraPosition - pos );\n vec3 n = inverseTransformDirection( normal, viewMatrix );\n vec4 transmitted = getIBLVolumeRefraction(\n n, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90,\n pos, modelMatrix, viewMatrix, projectionMatrix, material.ior, material.thickness,\n material.attenuationColor, material.attenuationDistance );\n material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );\n totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );\n#endif`,HM=`#ifdef USE_TRANSMISSION\n uniform float transmission;\n uniform float thickness;\n uniform float attenuationDistance;\n uniform vec3 attenuationColor;\n #ifdef USE_TRANSMISSIONMAP\n uniform sampler2D transmissionMap;\n #endif\n #ifdef USE_THICKNESSMAP\n uniform sampler2D thicknessMap;\n #endif\n uniform vec2 transmissionSamplerSize;\n uniform sampler2D transmissionSamplerMap;\n uniform mat4 modelMatrix;\n uniform mat4 projectionMatrix;\n varying vec3 vWorldPosition;\n float w0( float a ) {\n return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );\n }\n float w1( float a ) {\n return ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 );\n }\n float w2( float a ){\n return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );\n }\n float w3( float a ) {\n return ( 1.0 / 6.0 ) * ( a * a * a );\n }\n float g0( float a ) {\n return w0( a ) + w1( a );\n }\n float g1( float a ) {\n return w2( a ) + w3( a );\n }\n float h0( float a ) {\n return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );\n }\n float h1( float a ) {\n return 1.0 + w3( a ) / ( w2( a ) + w3( a ) );\n }\n vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) {\n uv = uv * texelSize.zw + 0.5;\n vec2 iuv = floor( uv );\n vec2 fuv = fract( uv );\n float g0x = g0( fuv.x );\n float g1x = g1( fuv.x );\n float h0x = h0( fuv.x );\n float h1x = h1( fuv.x );\n float h0y = h0( fuv.y );\n float h1y = h1( fuv.y );\n vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) +\n g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );\n }\n vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {\n vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );\n vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );\n vec2 fLodSizeInv = 1.0 / fLodSize;\n vec2 cLodSizeInv = 1.0 / cLodSize;\n vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) );\n vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) );\n return mix( fSample, cSample, fract( lod ) );\n }\n vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {\n vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );\n vec3 modelScale;\n modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );\n modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );\n modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );\n return normalize( refractionVector ) * thickness * modelScale;\n }\n float applyIorToRoughness( const in float roughness, const in float ior ) {\n return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );\n }\n vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {\n float lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );\n return textureBicubic( transmissionSamplerMap, fragCoord.xy, lod );\n }\n vec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {\n if ( isinf( attenuationDistance ) ) {\n return vec3( 1.0 );\n } else {\n vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;\n vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance ); return transmittance;\n }\n }\n vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,\n const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,\n const in mat4 viewMatrix, const in mat4 projMatrix, const in float ior, const in float thickness,\n const in vec3 attenuationColor, const in float attenuationDistance ) {\n vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );\n vec3 refractedRayExit = position + transmissionRay;\n vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n vec2 refractionCoords = ndcPos.xy / ndcPos.w;\n refractionCoords += 1.0;\n refractionCoords /= 2.0;\n vec4 transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );\n vec3 transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance );\n vec3 attenuatedColor = transmittance * transmittedLight.rgb;\n vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );\n float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;\n return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );\n }\n#endif`,WM=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n varying vec2 vUv;\n#endif\n#ifdef USE_MAP\n varying vec2 vMapUv;\n#endif\n#ifdef USE_ALPHAMAP\n varying vec2 vAlphaMapUv;\n#endif\n#ifdef USE_LIGHTMAP\n varying vec2 vLightMapUv;\n#endif\n#ifdef USE_AOMAP\n varying vec2 vAoMapUv;\n#endif\n#ifdef USE_BUMPMAP\n varying vec2 vBumpMapUv;\n#endif\n#ifdef USE_NORMALMAP\n varying vec2 vNormalMapUv;\n#endif\n#ifdef USE_EMISSIVEMAP\n varying vec2 vEmissiveMapUv;\n#endif\n#ifdef USE_METALNESSMAP\n varying vec2 vMetalnessMapUv;\n#endif\n#ifdef USE_ROUGHNESSMAP\n varying vec2 vRoughnessMapUv;\n#endif\n#ifdef USE_ANISOTROPYMAP\n varying vec2 vAnisotropyMapUv;\n#endif\n#ifdef USE_CLEARCOATMAP\n varying vec2 vClearcoatMapUv;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n varying vec2 vClearcoatNormalMapUv;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n varying vec2 vClearcoatRoughnessMapUv;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n varying vec2 vIridescenceMapUv;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n varying vec2 vIridescenceThicknessMapUv;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n varying vec2 vSheenColorMapUv;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n varying vec2 vSheenRoughnessMapUv;\n#endif\n#ifdef USE_SPECULARMAP\n varying vec2 vSpecularMapUv;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n varying vec2 vSpecularColorMapUv;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n varying vec2 vSpecularIntensityMapUv;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n uniform mat3 transmissionMapTransform;\n varying vec2 vTransmissionMapUv;\n#endif\n#ifdef USE_THICKNESSMAP\n uniform mat3 thicknessMapTransform;\n varying vec2 vThicknessMapUv;\n#endif`,qM=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n varying vec2 vUv;\n#endif\n#ifdef USE_MAP\n uniform mat3 mapTransform;\n varying vec2 vMapUv;\n#endif\n#ifdef USE_ALPHAMAP\n uniform mat3 alphaMapTransform;\n varying vec2 vAlphaMapUv;\n#endif\n#ifdef USE_LIGHTMAP\n uniform mat3 lightMapTransform;\n varying vec2 vLightMapUv;\n#endif\n#ifdef USE_AOMAP\n uniform mat3 aoMapTransform;\n varying vec2 vAoMapUv;\n#endif\n#ifdef USE_BUMPMAP\n uniform mat3 bumpMapTransform;\n varying vec2 vBumpMapUv;\n#endif\n#ifdef USE_NORMALMAP\n uniform mat3 normalMapTransform;\n varying vec2 vNormalMapUv;\n#endif\n#ifdef USE_DISPLACEMENTMAP\n uniform mat3 displacementMapTransform;\n varying vec2 vDisplacementMapUv;\n#endif\n#ifdef USE_EMISSIVEMAP\n uniform mat3 emissiveMapTransform;\n varying vec2 vEmissiveMapUv;\n#endif\n#ifdef USE_METALNESSMAP\n uniform mat3 metalnessMapTransform;\n varying vec2 vMetalnessMapUv;\n#endif\n#ifdef USE_ROUGHNESSMAP\n uniform mat3 roughnessMapTransform;\n varying vec2 vRoughnessMapUv;\n#endif\n#ifdef USE_ANISOTROPYMAP\n uniform mat3 anisotropyMapTransform;\n varying vec2 vAnisotropyMapUv;\n#endif\n#ifdef USE_CLEARCOATMAP\n uniform mat3 clearcoatMapTransform;\n varying vec2 vClearcoatMapUv;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n uniform mat3 clearcoatNormalMapTransform;\n varying vec2 vClearcoatNormalMapUv;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n uniform mat3 clearcoatRoughnessMapTransform;\n varying vec2 vClearcoatRoughnessMapUv;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n uniform mat3 sheenColorMapTransform;\n varying vec2 vSheenColorMapUv;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n uniform mat3 sheenRoughnessMapTransform;\n varying vec2 vSheenRoughnessMapUv;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n uniform mat3 iridescenceMapTransform;\n varying vec2 vIridescenceMapUv;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n uniform mat3 iridescenceThicknessMapTransform;\n varying vec2 vIridescenceThicknessMapUv;\n#endif\n#ifdef USE_SPECULARMAP\n uniform mat3 specularMapTransform;\n varying vec2 vSpecularMapUv;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n uniform mat3 specularColorMapTransform;\n varying vec2 vSpecularColorMapUv;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n uniform mat3 specularIntensityMapTransform;\n varying vec2 vSpecularIntensityMapUv;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n uniform mat3 transmissionMapTransform;\n varying vec2 vTransmissionMapUv;\n#endif\n#ifdef USE_THICKNESSMAP\n uniform mat3 thicknessMapTransform;\n varying vec2 vThicknessMapUv;\n#endif`,XM=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n vUv = vec3( uv, 1 ).xy;\n#endif\n#ifdef USE_MAP\n vMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ALPHAMAP\n vAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_LIGHTMAP\n vLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_AOMAP\n vAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_BUMPMAP\n vBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_NORMALMAP\n vNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_DISPLACEMENTMAP\n vDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_EMISSIVEMAP\n vEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_METALNESSMAP\n vMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ROUGHNESSMAP\n vRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ANISOTROPYMAP\n vAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOATMAP\n vClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n vClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n vClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n vIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n vIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n vSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n vSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULARMAP\n vSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n vSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n vSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n vTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_THICKNESSMAP\n vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;\n#endif`,YM=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0\n vec4 worldPosition = vec4( transformed, 1.0 );\n #ifdef USE_INSTANCING\n worldPosition = instanceMatrix * worldPosition;\n #endif\n worldPosition = modelMatrix * worldPosition;\n#endif`,ZM=`varying vec2 vUv;\nuniform mat3 uvTransform;\nvoid main() {\n vUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n gl_Position = vec4( position.xy, 1.0, 1.0 );\n}`,JM=`uniform sampler2D t2D;\nuniform float backgroundIntensity;\nvarying vec2 vUv;\nvoid main() {\n vec4 texColor = texture2D( t2D, vUv );\n #ifdef DECODE_VIDEO_TEXTURE\n 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 );\n #endif\n texColor.rgb *= backgroundIntensity;\n gl_FragColor = texColor;\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n}`,$M=`varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n vWorldDirection = transformDirection( position, modelMatrix );\n #include <begin_vertex>\n #include <project_vertex>\n gl_Position.z = gl_Position.w;\n}`,KM=`#ifdef ENVMAP_TYPE_CUBE\n uniform samplerCube envMap;\n#elif defined( ENVMAP_TYPE_CUBE_UV )\n uniform sampler2D envMap;\n#endif\nuniform float flipEnvMap;\nuniform float backgroundBlurriness;\nuniform float backgroundIntensity;\nvarying vec3 vWorldDirection;\n#include <cube_uv_reflection_fragment>\nvoid main() {\n #ifdef ENVMAP_TYPE_CUBE\n vec4 texColor = textureCube( envMap, vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) );\n #elif defined( ENVMAP_TYPE_CUBE_UV )\n vec4 texColor = textureCubeUV( envMap, vWorldDirection, backgroundBlurriness );\n #else\n vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n #endif\n texColor.rgb *= backgroundIntensity;\n gl_FragColor = texColor;\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n}`,jM=`varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n vWorldDirection = transformDirection( position, modelMatrix );\n #include <begin_vertex>\n #include <project_vertex>\n gl_Position.z = gl_Position.w;\n}`,QM=`uniform samplerCube tCube;\nuniform float tFlip;\nuniform float opacity;\nvarying vec3 vWorldDirection;\nvoid main() {\n vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );\n gl_FragColor = texColor;\n gl_FragColor.a *= opacity;\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n}`,tS=`#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n #include <uv_vertex>\n #include <skinbase_vertex>\n #ifdef USE_DISPLACEMENTMAP\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinnormal_vertex>\n #endif\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n vHighPrecisionZW = gl_Position.zw;\n}`,eS=`#if DEPTH_PACKING == 3200\n uniform float opacity;\n#endif\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n #include <clipping_planes_fragment>\n vec4 diffuseColor = vec4( 1.0 );\n #if DEPTH_PACKING == 3200\n diffuseColor.a = opacity;\n #endif\n #include <map_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <alphahash_fragment>\n #include <logdepthbuf_fragment>\n float fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;\n #if DEPTH_PACKING == 3200\n gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );\n #elif DEPTH_PACKING == 3201\n gl_FragColor = packDepthToRGBA( fragCoordZ );\n #endif\n}`,nS=`#define DISTANCE\nvarying vec3 vWorldPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <skinbase_vertex>\n #ifdef USE_DISPLACEMENTMAP\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinnormal_vertex>\n #endif\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <worldpos_vertex>\n #include <clipping_planes_vertex>\n vWorldPosition = worldPosition.xyz;\n}`,rS=`#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main () {\n #include <clipping_planes_fragment>\n vec4 diffuseColor = vec4( 1.0 );\n #include <map_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <alphahash_fragment>\n float dist = length( vWorldPosition - referencePosition );\n dist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n dist = saturate( dist );\n gl_FragColor = packDepthToRGBA( dist );\n}`,iS=`varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n vWorldDirection = transformDirection( position, modelMatrix );\n #include <begin_vertex>\n #include <project_vertex>\n}`,oS=`uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n vec3 direction = normalize( vWorldDirection );\n vec2 sampleUV = equirectUv( direction );\n gl_FragColor = texture2D( tEquirect, sampleUV );\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n}`,sS=`uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include <common>\n#include <uv_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n vLineDistance = scale * lineDistance;\n #include <uv_vertex>\n #include <color_vertex>\n #include <morphcolor_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n #include <fog_vertex>\n}`,aS=`uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n #include <clipping_planes_fragment>\n if ( mod( vLineDistance, totalSize ) > dashSize ) {\n discard;\n }\n vec3 outgoingLight = vec3( 0.0 );\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n outgoingLight = diffuseColor.rgb;\n #include <opaque_fragment>\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n}`,uS=`#include <common>\n#include <uv_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <color_vertex>\n #include <morphcolor_vertex>\n #if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #endif\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n #include <worldpos_vertex>\n #include <envmap_vertex>\n #include <fog_vertex>\n}`,lS=`uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n varying vec3 vNormal;\n#endif\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n #include <clipping_planes_fragment>\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <alphahash_fragment>\n #include <specularmap_fragment>\n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n #ifdef USE_LIGHTMAP\n vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;\n #else\n reflectedLight.indirectDiffuse += vec3( 1.0 );\n #endif\n #include <aomap_fragment>\n reflectedLight.indirectDiffuse *= diffuseColor.rgb;\n vec3 outgoingLight = reflectedLight.indirectDiffuse;\n #include <envmap_fragment>\n #include <opaque_fragment>\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n #include <dithering_fragment>\n}`,cS=`#define LAMBERT\nvarying vec3 vViewPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <color_vertex>\n #include <morphcolor_vertex>\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #include <normal_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n vViewPosition = - mvPosition.xyz;\n #include <worldpos_vertex>\n #include <envmap_vertex>\n #include <shadowmap_vertex>\n #include <fog_vertex>\n}`,fS=`#define LAMBERT\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_lambert_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n #include <clipping_planes_fragment>\n vec4 diffuseColor = vec4( diffuse, opacity );\n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n vec3 totalEmissiveRadiance = emissive;\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <alphahash_fragment>\n #include <specularmap_fragment>\n #include <normal_fragment_begin>\n #include <normal_fragment_maps>\n #include <emissivemap_fragment>\n #include <lights_lambert_fragment>\n #include <lights_fragment_begin>\n #include <lights_fragment_maps>\n #include <lights_fragment_end>\n #include <aomap_fragment>\n vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n #include <envmap_fragment>\n #include <opaque_fragment>\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n #include <dithering_fragment>\n}`,hS=`#define MATCAP\nvarying vec3 vViewPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <color_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <color_vertex>\n #include <morphcolor_vertex>\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #include <normal_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n #include <fog_vertex>\n vViewPosition = - mvPosition.xyz;\n}`,pS=`#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\nvarying vec3 vViewPosition;\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <fog_pars_fragment>\n#include <normal_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n #include <clipping_planes_fragment>\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <alphahash_fragment>\n #include <normal_fragment_begin>\n #include <normal_fragment_maps>\n vec3 viewDir = normalize( vViewPosition );\n vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n vec3 y = cross( viewDir, x );\n vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\n #ifdef USE_MATCAP\n vec4 matcapColor = texture2D( matcap, uv );\n #else\n vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );\n #endif\n vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n #include <opaque_fragment>\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n #include <dithering_fragment>\n}`,dS=`#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n varying vec3 vViewPosition;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #include <normal_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n vViewPosition = - mvPosition.xyz;\n#endif\n}`,mS=`#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n varying vec3 vViewPosition;\n#endif\n#include <packing>\n#include <uv_pars_fragment>\n#include <normal_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n #include <clipping_planes_fragment>\n #include <logdepthbuf_fragment>\n #include <normal_fragment_begin>\n #include <normal_fragment_maps>\n gl_FragColor = vec4( packNormalToRGB( normal ), opacity );\n #ifdef OPAQUE\n gl_FragColor.a = 1.0;\n #endif\n}`,gS=`#define PHONG\nvarying vec3 vViewPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <color_vertex>\n #include <morphcolor_vertex>\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #include <normal_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n vViewPosition = - mvPosition.xyz;\n #include <worldpos_vertex>\n #include <envmap_vertex>\n #include <shadowmap_vertex>\n #include <fog_vertex>\n}`,yS=`#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_phong_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n #include <clipping_planes_fragment>\n vec4 diffuseColor = vec4( diffuse, opacity );\n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n vec3 totalEmissiveRadiance = emissive;\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <alphahash_fragment>\n #include <specularmap_fragment>\n #include <normal_fragment_begin>\n #include <normal_fragment_maps>\n #include <emissivemap_fragment>\n #include <lights_phong_fragment>\n #include <lights_fragment_begin>\n #include <lights_fragment_maps>\n #include <lights_fragment_end>\n #include <aomap_fragment>\n vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n #include <envmap_fragment>\n #include <opaque_fragment>\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n #include <dithering_fragment>\n}`,vS=`#define STANDARD\nvarying vec3 vViewPosition;\n#ifdef USE_TRANSMISSION\n varying vec3 vWorldPosition;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <color_vertex>\n #include <morphcolor_vertex>\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #include <normal_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n vViewPosition = - mvPosition.xyz;\n #include <worldpos_vertex>\n #include <shadowmap_vertex>\n #include <fog_vertex>\n#ifdef USE_TRANSMISSION\n vWorldPosition = worldPosition.xyz;\n#endif\n}`,_S=`#define STANDARD\n#ifdef PHYSICAL\n #define IOR\n #define USE_SPECULAR\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef IOR\n uniform float ior;\n#endif\n#ifdef USE_SPECULAR\n uniform float specularIntensity;\n uniform vec3 specularColor;\n #ifdef USE_SPECULAR_COLORMAP\n uniform sampler2D specularColorMap;\n #endif\n #ifdef USE_SPECULAR_INTENSITYMAP\n uniform sampler2D specularIntensityMap;\n #endif\n#endif\n#ifdef USE_CLEARCOAT\n uniform float clearcoat;\n uniform float clearcoatRoughness;\n#endif\n#ifdef USE_IRIDESCENCE\n uniform float iridescence;\n uniform float iridescenceIOR;\n uniform float iridescenceThicknessMinimum;\n uniform float iridescenceThicknessMaximum;\n#endif\n#ifdef USE_SHEEN\n uniform vec3 sheenColor;\n uniform float sheenRoughness;\n #ifdef USE_SHEEN_COLORMAP\n uniform sampler2D sheenColorMap;\n #endif\n #ifdef USE_SHEEN_ROUGHNESSMAP\n uniform sampler2D sheenRoughnessMap;\n #endif\n#endif\n#ifdef USE_ANISOTROPY\n uniform vec2 anisotropyVector;\n #ifdef USE_ANISOTROPYMAP\n uniform sampler2D anisotropyMap;\n #endif\n#endif\nvarying vec3 vViewPosition;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <iridescence_fragment>\n#include <cube_uv_reflection_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_physical_pars_fragment>\n#include <fog_pars_fragment>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_physical_pars_fragment>\n#include <transmission_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <clearcoat_pars_fragment>\n#include <iridescence_pars_fragment>\n#include <roughnessmap_pars_fragment>\n#include <metalnessmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n #include <clipping_planes_fragment>\n vec4 diffuseColor = vec4( diffuse, opacity );\n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n vec3 totalEmissiveRadiance = emissive;\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <alphahash_fragment>\n #include <roughnessmap_fragment>\n #include <metalnessmap_fragment>\n #include <normal_fragment_begin>\n #include <normal_fragment_maps>\n #include <clearcoat_normal_fragment_begin>\n #include <clearcoat_normal_fragment_maps>\n #include <emissivemap_fragment>\n #include <lights_physical_fragment>\n #include <lights_fragment_begin>\n #include <lights_fragment_maps>\n #include <lights_fragment_end>\n #include <aomap_fragment>\n vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\n vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n #include <transmission_fragment>\n vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;\n #ifdef USE_SHEEN\n float sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );\n outgoingLight = outgoingLight * sheenEnergyComp + sheenSpecular;\n #endif\n #ifdef USE_CLEARCOAT\n float dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) );\n vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );\n outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + clearcoatSpecular * material.clearcoat;\n #endif\n #include <opaque_fragment>\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n #include <dithering_fragment>\n}`,xS=`#define TOON\nvarying vec3 vViewPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <color_vertex>\n #include <morphcolor_vertex>\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #include <normal_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n vViewPosition = - mvPosition.xyz;\n #include <worldpos_vertex>\n #include <shadowmap_vertex>\n #include <fog_vertex>\n}`,ES=`#define TOON\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <gradientmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_toon_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n #include <clipping_planes_fragment>\n vec4 diffuseColor = vec4( diffuse, opacity );\n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n vec3 totalEmissiveRadiance = emissive;\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <alphahash_fragment>\n #include <normal_fragment_begin>\n #include <normal_fragment_maps>\n #include <emissivemap_fragment>\n #include <lights_toon_fragment>\n #include <lights_fragment_begin>\n #include <lights_fragment_maps>\n #include <lights_fragment_end>\n #include <aomap_fragment>\n vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n #include <opaque_fragment>\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n #include <dithering_fragment>\n}`,MS=`uniform float size;\nuniform float scale;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\n#ifdef USE_POINTS_UV\n varying vec2 vUv;\n uniform mat3 uvTransform;\n#endif\nvoid main() {\n #ifdef USE_POINTS_UV\n vUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n #endif\n #include <color_vertex>\n #include <morphcolor_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <project_vertex>\n gl_PointSize = size;\n #ifdef USE_SIZEATTENUATION\n bool isPerspective = isPerspectiveMatrix( projectionMatrix );\n if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\n #endif\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n #include <worldpos_vertex>\n #include <fog_vertex>\n}`,SS=`uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <color_pars_fragment>\n#include <map_particle_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n #include <clipping_planes_fragment>\n vec3 outgoingLight = vec3( 0.0 );\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include <logdepthbuf_fragment>\n #include <map_particle_fragment>\n #include <color_fragment>\n #include <alphatest_fragment>\n #include <alphahash_fragment>\n outgoingLight = diffuseColor.rgb;\n #include <opaque_fragment>\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n}`,wS=`#include <common>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <shadowmap_pars_vertex>\nvoid main() {\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <worldpos_vertex>\n #include <shadowmap_vertex>\n #include <fog_vertex>\n}`,bS=`uniform vec3 color;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <logdepthbuf_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\nvoid main() {\n #include <logdepthbuf_fragment>\n gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n #include <fog_fragment>\n}`,TS=`uniform float rotation;\nuniform vec2 center;\n#include <common>\n#include <uv_pars_vertex>\n#include <fog_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n vec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\n vec2 scale;\n scale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );\n scale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );\n #ifndef USE_SIZEATTENUATION\n bool isPerspective = isPerspectiveMatrix( projectionMatrix );\n if ( isPerspective ) scale *= - mvPosition.z;\n #endif\n vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\n vec2 rotatedPosition;\n rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n mvPosition.xy += rotatedPosition;\n gl_Position = projectionMatrix * mvPosition;\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n #include <fog_vertex>\n}`,AS=`uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n #include <clipping_planes_fragment>\n vec3 outgoingLight = vec3( 0.0 );\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <alphahash_fragment>\n outgoingLight = diffuseColor.rgb;\n #include <opaque_fragment>\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n #include <fog_fragment>\n}`,ge={alphahash_fragment:Kx,alphahash_pars_fragment:jx,alphamap_fragment:Qx,alphamap_pars_fragment:tE,alphatest_fragment:eE,alphatest_pars_fragment:nE,aomap_fragment:rE,aomap_pars_fragment:iE,begin_vertex:oE,beginnormal_vertex:sE,bsdfs:aE,iridescence_fragment:uE,bumpmap_pars_fragment:lE,clipping_planes_fragment:cE,clipping_planes_pars_fragment:fE,clipping_planes_pars_vertex:hE,clipping_planes_vertex:pE,color_fragment:dE,color_pars_fragment:mE,color_pars_vertex:gE,color_vertex:yE,common:vE,cube_uv_reflection_fragment:_E,defaultnormal_vertex:xE,displacementmap_pars_vertex:EE,displacementmap_vertex:ME,emissivemap_fragment:SE,emissivemap_pars_fragment:wE,colorspace_fragment:bE,colorspace_pars_fragment:TE,envmap_fragment:AE,envmap_common_pars_fragment:CE,envmap_pars_fragment:PE,envmap_pars_vertex:IE,envmap_physical_pars_fragment:VE,envmap_vertex:RE,fog_vertex:LE,fog_pars_vertex:NE,fog_fragment:OE,fog_pars_fragment:DE,gradientmap_pars_fragment:FE,lightmap_fragment:UE,lightmap_pars_fragment:BE,lights_lambert_fragment:zE,lights_lambert_pars_fragment:kE,lights_pars_begin:GE,lights_toon_fragment:HE,lights_toon_pars_fragment:WE,lights_phong_fragment:qE,lights_phong_pars_fragment:XE,lights_physical_fragment:YE,lights_physical_pars_fragment:ZE,lights_fragment_begin:JE,lights_fragment_maps:$E,lights_fragment_end:KE,logdepthbuf_fragment:jE,logdepthbuf_pars_fragment:QE,logdepthbuf_pars_vertex:tM,logdepthbuf_vertex:eM,map_fragment:nM,map_pars_fragment:rM,map_particle_fragment:iM,map_particle_pars_fragment:oM,metalnessmap_fragment:sM,metalnessmap_pars_fragment:aM,morphcolor_vertex:uM,morphnormal_vertex:lM,morphtarget_pars_vertex:cM,morphtarget_vertex:fM,normal_fragment_begin:hM,normal_fragment_maps:pM,normal_pars_fragment:dM,normal_pars_vertex:mM,normal_vertex:gM,normalmap_pars_fragment:yM,clearcoat_normal_fragment_begin:vM,clearcoat_normal_fragment_maps:_M,clearcoat_pars_fragment:xM,iridescence_pars_fragment:EM,opaque_fragment:MM,packing:SM,premultiplied_alpha_fragment:wM,project_vertex:bM,dithering_fragment:TM,dithering_pars_fragment:AM,roughnessmap_fragment:CM,roughnessmap_pars_fragment:PM,shadowmap_pars_fragment:IM,shadowmap_pars_vertex:RM,shadowmap_vertex:LM,shadowmask_pars_fragment:NM,skinbase_vertex:OM,skinning_pars_vertex:DM,skinning_vertex:FM,skinnormal_vertex:UM,specularmap_fragment:BM,specularmap_pars_fragment:zM,tonemapping_fragment:kM,tonemapping_pars_fragment:GM,transmission_fragment:VM,transmission_pars_fragment:HM,uv_pars_fragment:WM,uv_pars_vertex:qM,uv_vertex:XM,worldpos_vertex:YM,background_vert:ZM,background_frag:JM,backgroundCube_vert:$M,backgroundCube_frag:KM,cube_vert:jM,cube_frag:QM,depth_vert:tS,depth_frag:eS,distanceRGBA_vert:nS,distanceRGBA_frag:rS,equirect_vert:iS,equirect_frag:oS,linedashed_vert:sS,linedashed_frag:aS,meshbasic_vert:uS,meshbasic_frag:lS,meshlambert_vert:cS,meshlambert_frag:fS,meshmatcap_vert:hS,meshmatcap_frag:pS,meshnormal_vert:dS,meshnormal_frag:mS,meshphong_vert:gS,meshphong_frag:yS,meshphysical_vert:vS,meshphysical_frag:_S,meshtoon_vert:xS,meshtoon_frag:ES,points_vert:MS,points_frag:SS,shadow_vert:wS,shadow_frag:bS,sprite_vert:TS,sprite_frag:AS},zt={common:{diffuse:{value:new xn(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new ve},alphaMap:{value:null},alphaMapTransform:{value:new ve},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new ve}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new ve}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new ve}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new ve},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new ve},normalScale:{value:new fn(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new ve},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new ve}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new ve}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new ve}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new xn(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{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 xn(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new ve},alphaTest:{value:0},uvTransform:{value:new ve}},sprite:{diffuse:{value:new xn(16777215)},opacity:{value:1},center:{value:new fn(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new ve},alphaMap:{value:null},alphaMapTransform:{value:new ve},alphaTest:{value:0}}},lo={basic:{uniforms:Jr([zt.common,zt.specularmap,zt.envmap,zt.aomap,zt.lightmap,zt.fog]),vertexShader:ge.meshbasic_vert,fragmentShader:ge.meshbasic_frag},lambert:{uniforms:Jr([zt.common,zt.specularmap,zt.envmap,zt.aomap,zt.lightmap,zt.emissivemap,zt.bumpmap,zt.normalmap,zt.displacementmap,zt.fog,zt.lights,{emissive:{value:new xn(0)}}]),vertexShader:ge.meshlambert_vert,fragmentShader:ge.meshlambert_frag},phong:{uniforms:Jr([zt.common,zt.specularmap,zt.envmap,zt.aomap,zt.lightmap,zt.emissivemap,zt.bumpmap,zt.normalmap,zt.displacementmap,zt.fog,zt.lights,{emissive:{value:new xn(0)},specular:{value:new xn(1118481)},shininess:{value:30}}]),vertexShader:ge.meshphong_vert,fragmentShader:ge.meshphong_frag},standard:{uniforms:Jr([zt.common,zt.envmap,zt.aomap,zt.lightmap,zt.emissivemap,zt.bumpmap,zt.normalmap,zt.displacementmap,zt.roughnessmap,zt.metalnessmap,zt.fog,zt.lights,{emissive:{value:new xn(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:ge.meshphysical_vert,fragmentShader:ge.meshphysical_frag},toon:{uniforms:Jr([zt.common,zt.aomap,zt.lightmap,zt.emissivemap,zt.bumpmap,zt.normalmap,zt.displacementmap,zt.gradientmap,zt.fog,zt.lights,{emissive:{value:new xn(0)}}]),vertexShader:ge.meshtoon_vert,fragmentShader:ge.meshtoon_frag},matcap:{uniforms:Jr([zt.common,zt.bumpmap,zt.normalmap,zt.displacementmap,zt.fog,{matcap:{value:null}}]),vertexShader:ge.meshmatcap_vert,fragmentShader:ge.meshmatcap_frag},points:{uniforms:Jr([zt.points,zt.fog]),vertexShader:ge.points_vert,fragmentShader:ge.points_frag},dashed:{uniforms:Jr([zt.common,zt.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:ge.linedashed_vert,fragmentShader:ge.linedashed_frag},depth:{uniforms:Jr([zt.common,zt.displacementmap]),vertexShader:ge.depth_vert,fragmentShader:ge.depth_frag},normal:{uniforms:Jr([zt.common,zt.bumpmap,zt.normalmap,zt.displacementmap,{opacity:{value:1}}]),vertexShader:ge.meshnormal_vert,fragmentShader:ge.meshnormal_frag},sprite:{uniforms:Jr([zt.sprite,zt.fog]),vertexShader:ge.sprite_vert,fragmentShader:ge.sprite_frag},background:{uniforms:{uvTransform:{value:new ve},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:ge.background_vert,fragmentShader:ge.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1}},vertexShader:ge.backgroundCube_vert,fragmentShader:ge.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:ge.cube_vert,fragmentShader:ge.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:ge.equirect_vert,fragmentShader:ge.equirect_frag},distanceRGBA:{uniforms:Jr([zt.common,zt.displacementmap,{referencePosition:{value:new mt},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:ge.distanceRGBA_vert,fragmentShader:ge.distanceRGBA_frag},shadow:{uniforms:Jr([zt.lights,zt.fog,{color:{value:new xn(0)},opacity:{value:1}}]),vertexShader:ge.shadow_vert,fragmentShader:ge.shadow_frag}};lo.physical={uniforms:Jr([lo.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new ve},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new ve},clearcoatNormalScale:{value:new fn(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new ve},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new ve},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new ve},sheen:{value:0},sheenColor:{value:new xn(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new ve},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new ve},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new ve},transmissionSamplerSize:{value:new fn},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new ve},attenuationDistance:{value:0},attenuationColor:{value:new xn(0)},specularColor:{value:new xn(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new ve},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new ve},anisotropyVector:{value:new fn},anisotropyMap:{value:null},anisotropyMapTransform:{value:new ve}}]),vertexShader:ge.meshphysical_vert,fragmentShader:ge.meshphysical_frag};var Wl={r:0,b:0,g:0};function CS(r,t,e,o,a,l,f){let h=new xn(0),p=l===!0?0:1,d,g,_=null,y=0,M=null;function w(x,v){let C=!1,S=v.isScene===!0?v.background:null;S&&S.isTexture&&(S=(v.backgroundBlurriness>0?e:t).get(S)),S===null?T(h,p):S&&S.isColor&&(T(S,1),C=!0);let O=r.xr.getEnvironmentBlendMode();O==="additive"?o.buffers.color.setClear(0,0,0,1,f):O==="alpha-blend"&&o.buffers.color.setClear(0,0,0,0,f),(r.autoClear||C)&&r.clear(r.autoClearColor,r.autoClearDepth,r.autoClearStencil),S&&(S.isCubeTexture||S.mapping===hc)?(g===void 0&&(g=new co(new Bu(1,1,1),new Xo({name:"BackgroundCubeMaterial",uniforms:Wa(lo.backgroundCube.uniforms),vertexShader:lo.backgroundCube.vertexShader,fragmentShader:lo.backgroundCube.fragmentShader,side:ui,depthTest:!1,depthWrite:!1,fog:!1})),g.geometry.deleteAttribute("normal"),g.geometry.deleteAttribute("uv"),g.onBeforeRender=function(F,G,z){this.matrixWorld.copyPosition(z.matrixWorld)},Object.defineProperty(g.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),a.update(g)),g.material.uniforms.envMap.value=S,g.material.uniforms.flipEnvMap.value=S.isCubeTexture&&S.isRenderTargetTexture===!1?-1:1,g.material.uniforms.backgroundBlurriness.value=v.backgroundBlurriness,g.material.uniforms.backgroundIntensity.value=v.backgroundIntensity,g.material.toneMapped=gn.getTransfer(S.colorSpace)!==Tn,(_!==S||y!==S.version||M!==r.toneMapping)&&(g.material.needsUpdate=!0,_=S,y=S.version,M=r.toneMapping),g.layers.enableAll(),x.unshift(g,g.geometry,g.material,0,0,null)):S&&S.isTexture&&(d===void 0&&(d=new co(new vh(2,2),new Xo({name:"BackgroundMaterial",uniforms:Wa(lo.background.uniforms),vertexShader:lo.background.vertexShader,fragmentShader:lo.background.fragmentShader,side:ds,depthTest:!1,depthWrite:!1,fog:!1})),d.geometry.deleteAttribute("normal"),Object.defineProperty(d.material,"map",{get:function(){return this.uniforms.t2D.value}}),a.update(d)),d.material.uniforms.t2D.value=S,d.material.uniforms.backgroundIntensity.value=v.backgroundIntensity,d.material.toneMapped=gn.getTransfer(S.colorSpace)!==Tn,S.matrixAutoUpdate===!0&&S.updateMatrix(),d.material.uniforms.uvTransform.value.copy(S.matrix),(_!==S||y!==S.version||M!==r.toneMapping)&&(d.material.needsUpdate=!0,_=S,y=S.version,M=r.toneMapping),d.layers.enableAll(),x.unshift(d,d.geometry,d.material,0,0,null))}function T(x,v){x.getRGB(Wl,i0(r)),o.buffers.color.setClear(Wl.r,Wl.g,Wl.b,v,f)}return{getClearColor:function(){return h},setClearColor:function(x,v=1){h.set(x),p=v,T(h,p)},getClearAlpha:function(){return p},setClearAlpha:function(x){p=x,T(h,p)},render:w}}function PS(r,t,e,o){let a=r.getParameter(r.MAX_VERTEX_ATTRIBS),l=o.isWebGL2?null:t.get("OES_vertex_array_object"),f=o.isWebGL2||l!==null,h={},p=x(null),d=p,g=!1;function _(X,it,vt,pt,et){let ot=!1;if(f){let V=T(pt,vt,it);d!==V&&(d=V,M(d.object)),ot=v(X,pt,vt,et),ot&&C(X,pt,vt,et)}else{let V=it.wireframe===!0;(d.geometry!==pt.id||d.program!==vt.id||d.wireframe!==V)&&(d.geometry=pt.id,d.program=vt.id,d.wireframe=V,ot=!0)}et!==null&&e.update(et,r.ELEMENT_ARRAY_BUFFER),(ot||g)&&(g=!1,L(X,it,vt,pt),et!==null&&r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,e.get(et).buffer))}function y(){return o.isWebGL2?r.createVertexArray():l.createVertexArrayOES()}function M(X){return o.isWebGL2?r.bindVertexArray(X):l.bindVertexArrayOES(X)}function w(X){return o.isWebGL2?r.deleteVertexArray(X):l.deleteVertexArrayOES(X)}function T(X,it,vt){let pt=vt.wireframe===!0,et=h[X.id];et===void 0&&(et={},h[X.id]=et);let ot=et[it.id];ot===void 0&&(ot={},et[it.id]=ot);let V=ot[pt];return V===void 0&&(V=x(y()),ot[pt]=V),V}function x(X){let it=[],vt=[],pt=[];for(let et=0;et<a;et++)it[et]=0,vt[et]=0,pt[et]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:it,enabledAttributes:vt,attributeDivisors:pt,object:X,attributes:{},index:null}}function v(X,it,vt,pt){let et=d.attributes,ot=it.attributes,V=0,K=vt.getAttributes();for(let at in K)if(K[at].location>=0){let dt=et[at],Ct=ot[at];if(Ct===void 0&&(at==="instanceMatrix"&&X.instanceMatrix&&(Ct=X.instanceMatrix),at==="instanceColor"&&X.instanceColor&&(Ct=X.instanceColor)),dt===void 0||dt.attribute!==Ct||Ct&&dt.data!==Ct.data)return!0;V++}return d.attributesNum!==V||d.index!==pt}function C(X,it,vt,pt){let et={},ot=it.attributes,V=0,K=vt.getAttributes();for(let at in K)if(K[at].location>=0){let dt=ot[at];dt===void 0&&(at==="instanceMatrix"&&X.instanceMatrix&&(dt=X.instanceMatrix),at==="instanceColor"&&X.instanceColor&&(dt=X.instanceColor));let Ct={};Ct.attribute=dt,dt&&dt.data&&(Ct.data=dt.data),et[at]=Ct,V++}d.attributes=et,d.attributesNum=V,d.index=pt}function S(){let X=d.newAttributes;for(let it=0,vt=X.length;it<vt;it++)X[it]=0}function O(X){F(X,0)}function F(X,it){let vt=d.newAttributes,pt=d.enabledAttributes,et=d.attributeDivisors;vt[X]=1,pt[X]===0&&(r.enableVertexAttribArray(X),pt[X]=1),et[X]!==it&&((o.isWebGL2?r:t.get("ANGLE_instanced_arrays"))[o.isWebGL2?"vertexAttribDivisor":"vertexAttribDivisorANGLE"](X,it),et[X]=it)}function G(){let X=d.newAttributes,it=d.enabledAttributes;for(let vt=0,pt=it.length;vt<pt;vt++)it[vt]!==X[vt]&&(r.disableVertexAttribArray(vt),it[vt]=0)}function z(X,it,vt,pt,et,ot,V){V===!0?r.vertexAttribIPointer(X,it,vt,et,ot):r.vertexAttribPointer(X,it,vt,pt,et,ot)}function L(X,it,vt,pt){if(o.isWebGL2===!1&&(X.isInstancedMesh||pt.isInstancedBufferGeometry)&&t.get("ANGLE_instanced_arrays")===null)return;S();let et=pt.attributes,ot=vt.getAttributes(),V=it.defaultAttributeValues;for(let K in ot){let at=ot[K];if(at.location>=0){let Tt=et[K];if(Tt===void 0&&(K==="instanceMatrix"&&X.instanceMatrix&&(Tt=X.instanceMatrix),K==="instanceColor"&&X.instanceColor&&(Tt=X.instanceColor)),Tt!==void 0){let dt=Tt.normalized,Ct=Tt.itemSize,Yt=e.get(Tt);if(Yt===void 0)continue;let Wt=Yt.buffer,Nt=Yt.type,ne=Yt.bytesPerElement,Pt=o.isWebGL2===!0&&(Nt===r.INT||Nt===r.UNSIGNED_INT||Tt.gpuType===Jg);if(Tt.isInterleavedBufferAttribute){let Xt=Tt.data,tt=Xt.stride,nn=Tt.offset;if(Xt.isInstancedInterleavedBuffer){for(let Gt=0;Gt<at.locationSize;Gt++)F(at.location+Gt,Xt.meshPerAttribute);X.isInstancedMesh!==!0&&pt._maxInstanceCount===void 0&&(pt._maxInstanceCount=Xt.meshPerAttribute*Xt.count)}else for(let Gt=0;Gt<at.locationSize;Gt++)O(at.location+Gt);r.bindBuffer(r.ARRAY_BUFFER,Wt);for(let Gt=0;Gt<at.locationSize;Gt++)z(at.location+Gt,Ct/at.locationSize,Nt,dt,tt*ne,(nn+Ct/at.locationSize*Gt)*ne,Pt)}else{if(Tt.isInstancedBufferAttribute){for(let Xt=0;Xt<at.locationSize;Xt++)F(at.location+Xt,Tt.meshPerAttribute);X.isInstancedMesh!==!0&&pt._maxInstanceCount===void 0&&(pt._maxInstanceCount=Tt.meshPerAttribute*Tt.count)}else for(let Xt=0;Xt<at.locationSize;Xt++)O(at.location+Xt);r.bindBuffer(r.ARRAY_BUFFER,Wt);for(let Xt=0;Xt<at.locationSize;Xt++)z(at.location+Xt,Ct/at.locationSize,Nt,dt,Ct*ne,Ct/at.locationSize*Xt*ne,Pt)}}else if(V!==void 0){let dt=V[K];if(dt!==void 0)switch(dt.length){case 2:r.vertexAttrib2fv(at.location,dt);break;case 3:r.vertexAttrib3fv(at.location,dt);break;case 4:r.vertexAttrib4fv(at.location,dt);break;default:r.vertexAttrib1fv(at.location,dt)}}}}G()}function D(){k();for(let X in h){let it=h[X];for(let vt in it){let pt=it[vt];for(let et in pt)w(pt[et].object),delete pt[et];delete it[vt]}delete h[X]}}function q(X){if(h[X.id]===void 0)return;let it=h[X.id];for(let vt in it){let pt=it[vt];for(let et in pt)w(pt[et].object),delete pt[et];delete it[vt]}delete h[X.id]}function nt(X){for(let it in h){let vt=h[it];if(vt[X.id]===void 0)continue;let pt=vt[X.id];for(let et in pt)w(pt[et].object),delete pt[et];delete vt[X.id]}}function k(){xt(),g=!0,d!==p&&(d=p,M(d.object))}function xt(){p.geometry=null,p.program=null,p.wireframe=!1}return{setup:_,reset:k,resetDefaultState:xt,dispose:D,releaseStatesOfGeometry:q,releaseStatesOfProgram:nt,initAttributes:S,enableAttribute:O,disableUnusedAttributes:G}}function IS(r,t,e,o){let a=o.isWebGL2,l;function f(d){l=d}function h(d,g){r.drawArrays(l,d,g),e.update(g,l,1)}function p(d,g,_){if(_===0)return;let y,M;if(a)y=r,M="drawArraysInstanced";else if(y=t.get("ANGLE_instanced_arrays"),M="drawArraysInstancedANGLE",y===null){console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");return}y[M](l,d,g,_),e.update(g,l,_)}this.setMode=f,this.render=h,this.renderInstances=p}function RS(r,t,e){let o;function a(){if(o!==void 0)return o;if(t.has("EXT_texture_filter_anisotropic")===!0){let z=t.get("EXT_texture_filter_anisotropic");o=r.getParameter(z.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else o=0;return o}function l(z){if(z==="highp"){if(r.getShaderPrecisionFormat(r.VERTEX_SHADER,r.HIGH_FLOAT).precision>0&&r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.HIGH_FLOAT).precision>0)return"highp";z="mediump"}return z==="mediump"&&r.getShaderPrecisionFormat(r.VERTEX_SHADER,r.MEDIUM_FLOAT).precision>0&&r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let f=typeof WebGL2RenderingContext!="undefined"&&r.constructor.name==="WebGL2RenderingContext",h=e.precision!==void 0?e.precision:"highp",p=l(h);p!==h&&(console.warn("THREE.WebGLRenderer:",h,"not supported, using",p,"instead."),h=p);let d=f||t.has("WEBGL_draw_buffers"),g=e.logarithmicDepthBuffer===!0,_=r.getParameter(r.MAX_TEXTURE_IMAGE_UNITS),y=r.getParameter(r.MAX_VERTEX_TEXTURE_IMAGE_UNITS),M=r.getParameter(r.MAX_TEXTURE_SIZE),w=r.getParameter(r.MAX_CUBE_MAP_TEXTURE_SIZE),T=r.getParameter(r.MAX_VERTEX_ATTRIBS),x=r.getParameter(r.MAX_VERTEX_UNIFORM_VECTORS),v=r.getParameter(r.MAX_VARYING_VECTORS),C=r.getParameter(r.MAX_FRAGMENT_UNIFORM_VECTORS),S=y>0,O=f||t.has("OES_texture_float"),F=S&&O,G=f?r.getParameter(r.MAX_SAMPLES):0;return{isWebGL2:f,drawBuffers:d,getMaxAnisotropy:a,getMaxPrecision:l,precision:h,logarithmicDepthBuffer:g,maxTextures:_,maxVertexTextures:y,maxTextureSize:M,maxCubemapSize:w,maxAttributes:T,maxVertexUniforms:x,maxVaryings:v,maxFragmentUniforms:C,vertexTextures:S,floatFragmentTextures:O,floatVertexTextures:F,maxSamples:G}}function LS(r){let t=this,e=null,o=0,a=!1,l=!1,f=new ko,h=new ve,p={value:null,needsUpdate:!1};this.uniform=p,this.numPlanes=0,this.numIntersection=0,this.init=function(_,y){let M=_.length!==0||y||o!==0||a;return a=y,o=_.length,M},this.beginShadows=function(){l=!0,g(null)},this.endShadows=function(){l=!1},this.setGlobalState=function(_,y){e=g(_,y,0)},this.setState=function(_,y,M){let w=_.clippingPlanes,T=_.clipIntersection,x=_.clipShadows,v=r.get(_);if(!a||w===null||w.length===0||l&&!x)l?g(null):d();else{let C=l?0:o,S=C*4,O=v.clippingState||null;p.value=O,O=g(w,y,S,M);for(let F=0;F!==S;++F)O[F]=e[F];v.clippingState=O,this.numIntersection=T?this.numPlanes:0,this.numPlanes+=C}};function d(){p.value!==e&&(p.value=e,p.needsUpdate=o>0),t.numPlanes=o,t.numIntersection=0}function g(_,y,M,w){let T=_!==null?_.length:0,x=null;if(T!==0){if(x=p.value,w!==!0||x===null){let v=M+T*4,C=y.matrixWorldInverse;h.getNormalMatrix(C),(x===null||x.length<v)&&(x=new Float32Array(v));for(let S=0,O=M;S!==T;++S,O+=4)f.copy(_[S]).applyMatrix4(C,h),f.normal.toArray(x,O),x[O+3]=f.constant}p.value=x,p.needsUpdate=!0}return t.numPlanes=T,t.numIntersection=0,x}}function NS(r){let t=new WeakMap;function e(f,h){return h===sh?f.mapping=ka:h===ah&&(f.mapping=Ga),f}function o(f){if(f&&f.isTexture&&f.isRenderTargetTexture===!1){let h=f.mapping;if(h===sh||h===ah)if(t.has(f)){let p=t.get(f).texture;return e(p,f.mapping)}else{let p=f.image;if(p&&p.height>0){let d=new yh(p.height/2);return d.fromEquirectangularTexture(r,f),t.set(f,d),f.addEventListener("dispose",a),e(d.texture,f.mapping)}else return null}}return f}function a(f){let h=f.target;h.removeEventListener("dispose",a);let p=t.get(h);p!==void 0&&(t.delete(h),p.dispose())}function l(){t=new WeakMap}return{get:o,dispose:l}}var _h=class extends uc{constructor(t=-1,e=1,o=1,a=-1,l=.1,f=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=t,this.right=e,this.top=o,this.bottom=a,this.near=l,this.far=f,this.updateProjectionMatrix()}copy(t,e){return super.copy(t,e),this.left=t.left,this.right=t.right,this.top=t.top,this.bottom=t.bottom,this.near=t.near,this.far=t.far,this.zoom=t.zoom,this.view=t.view===null?null:Object.assign({},t.view),this}setViewOffset(t,e,o,a,l,f){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=t,this.view.fullHeight=e,this.view.offsetX=o,this.view.offsetY=a,this.view.width=l,this.view.height=f,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){let t=(this.right-this.left)/(2*this.zoom),e=(this.top-this.bottom)/(2*this.zoom),o=(this.right+this.left)/2,a=(this.top+this.bottom)/2,l=o-t,f=o+t,h=a+e,p=a-e;if(this.view!==null&&this.view.enabled){let d=(this.right-this.left)/this.view.fullWidth/this.zoom,g=(this.top-this.bottom)/this.view.fullHeight/this.zoom;l+=d*this.view.offsetX,f=l+d*this.view.width,h-=g*this.view.offsetY,p=h-g*this.view.height}this.projectionMatrix.makeOrthographic(l,f,h,p,this.near,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(t){let e=super.toJSON(t);return e.object.zoom=this.zoom,e.object.left=this.left,e.object.right=this.right,e.object.top=this.top,e.object.bottom=this.bottom,e.object.near=this.near,e.object.far=this.far,this.view!==null&&(e.object.view=Object.assign({},this.view)),e}},Da=4,Sg=[.125,.215,.35,.446,.526,.582],Vs=20,nh=new _h,wg=new xn,rh=null,Gs=(1+Math.sqrt(5))/2,La=1/Gs,bg=[new mt(1,1,1),new mt(-1,1,1),new mt(1,1,-1),new mt(-1,1,-1),new mt(0,Gs,La),new mt(0,Gs,-La),new mt(La,0,Gs),new mt(-La,0,Gs),new mt(Gs,La,0),new mt(-Gs,La,0)],fc=class{constructor(t){this._renderer=t,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}fromScene(t,e=0,o=.1,a=100){rh=this._renderer.getRenderTarget(),this._setSize(256);let l=this._allocateTargets();return l.depthBuffer=!0,this._sceneToCubeUV(t,o,a,l),e>0&&this._blur(l,0,0,e),this._applyPMREM(l),this._cleanup(l),l}fromEquirectangular(t,e=null){return this._fromTexture(t,e)}fromCubemap(t,e=null){return this._fromTexture(t,e)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=Cg(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=Ag(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose()}_setSize(t){this._lodMax=Math.floor(Math.log2(t)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let t=0;t<this._lodPlanes.length;t++)this._lodPlanes[t].dispose()}_cleanup(t){this._renderer.setRenderTarget(rh),t.scissorTest=!1,ql(t,0,0,t.width,t.height)}_fromTexture(t,e){t.mapping===ka||t.mapping===Ga?this._setSize(t.image.length===0?16:t.image[0].width||t.image[0].image.width):this._setSize(t.image.width/4),rh=this._renderer.getRenderTarget();let o=e||this._allocateTargets();return this._textureToCubeUV(t,o),this._applyPMREM(o),this._cleanup(o),o}_allocateTargets(){let t=3*Math.max(this._cubeSize,112),e=4*this._cubeSize,o={magFilter:Ni,minFilter:Ni,generateMipmaps:!1,type:Fu,format:$i,colorSpace:Wo,depthBuffer:!1},a=Tg(t,e,o);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==t||this._pingPongRenderTarget.height!==e){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=Tg(t,e,o);let{_lodMax:l}=this;({sizeLods:this._sizeLods,lodPlanes:this._lodPlanes,sigmas:this._sigmas}=OS(l)),this._blurMaterial=DS(l,t,e)}return a}_compileMaterial(t){let e=new co(this._lodPlanes[0],t);this._renderer.compile(e,nh)}_sceneToCubeUV(t,e,o,a){let h=new xi(90,1,e,o),p=[1,-1,1,1,1,1],d=[1,1,1,-1,-1,-1],g=this._renderer,_=g.autoClear,y=g.toneMapping;g.getClearColor(wg),g.toneMapping=hs,g.autoClear=!1;let M=new oc({name:"PMREM.Background",side:ui,depthWrite:!1,depthTest:!1}),w=new co(new Bu,M),T=!1,x=t.background;x?x.isColor&&(M.color.copy(x),t.background=null,T=!0):(M.color.copy(wg),T=!0);for(let v=0;v<6;v++){let C=v%3;C===0?(h.up.set(0,p[v],0),h.lookAt(d[v],0,0)):C===1?(h.up.set(0,0,p[v]),h.lookAt(0,d[v],0)):(h.up.set(0,p[v],0),h.lookAt(0,0,d[v]));let S=this._cubeSize;ql(a,C*S,v>2?S:0,S,S),g.setRenderTarget(a),T&&g.render(w,h),g.render(t,h)}w.geometry.dispose(),w.material.dispose(),g.toneMapping=y,g.autoClear=_,t.background=x}_textureToCubeUV(t,e){let o=this._renderer,a=t.mapping===ka||t.mapping===Ga;a?(this._cubemapMaterial===null&&(this._cubemapMaterial=Cg()),this._cubemapMaterial.uniforms.flipEnvMap.value=t.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=Ag());let l=a?this._cubemapMaterial:this._equirectMaterial,f=new co(this._lodPlanes[0],l),h=l.uniforms;h.envMap.value=t;let p=this._cubeSize;ql(e,0,0,3*p,2*p),o.setRenderTarget(e),o.render(f,nh)}_applyPMREM(t){let e=this._renderer,o=e.autoClear;e.autoClear=!1;for(let a=1;a<this._lodPlanes.length;a++){let l=Math.sqrt(this._sigmas[a]*this._sigmas[a]-this._sigmas[a-1]*this._sigmas[a-1]),f=bg[(a-1)%bg.length];this._blur(t,a-1,a,l,f)}e.autoClear=o}_blur(t,e,o,a,l){let f=this._pingPongRenderTarget;this._halfBlur(t,f,e,o,a,"latitudinal",l),this._halfBlur(f,t,o,o,a,"longitudinal",l)}_halfBlur(t,e,o,a,l,f,h){let p=this._renderer,d=this._blurMaterial;f!=="latitudinal"&&f!=="longitudinal"&&console.error("blur direction must be either latitudinal or longitudinal!");let g=3,_=new co(this._lodPlanes[a],d),y=d.uniforms,M=this._sizeLods[o]-1,w=isFinite(l)?Math.PI/(2*M):2*Math.PI/(2*Vs-1),T=l/w,x=isFinite(l)?1+Math.floor(g*T):Vs;x>Vs&&console.warn(`sigmaRadians, ${l}, is too large and will clip, as it requested ${x} samples when the maximum is set to ${Vs}`);let v=[],C=0;for(let z=0;z<Vs;++z){let L=z/T,D=Math.exp(-L*L/2);v.push(D),z===0?C+=D:z<x&&(C+=2*D)}for(let z=0;z<v.length;z++)v[z]=v[z]/C;y.envMap.value=t.texture,y.samples.value=x,y.weights.value=v,y.latitudinal.value=f==="latitudinal",h&&(y.poleAxis.value=h);let{_lodMax:S}=this;y.dTheta.value=w,y.mipInt.value=S-o;let O=this._sizeLods[a],F=3*O*(a>S-Da?a-S+Da:0),G=4*(this._cubeSize-O);ql(e,F,G,3*O,2*O),p.setRenderTarget(e),p.render(_,nh)}};function OS(r){let t=[],e=[],o=[],a=r,l=r-Da+1+Sg.length;for(let f=0;f<l;f++){let h=Math.pow(2,a);e.push(h);let p=1/h;f>r-Da?p=Sg[f-r+Da-1]:f===0&&(p=0),o.push(p);let d=1/(h-2),g=-d,_=1+d,y=[g,g,_,g,_,_,g,g,_,_,g,_],M=6,w=6,T=3,x=2,v=1,C=new Float32Array(T*w*M),S=new Float32Array(x*w*M),O=new Float32Array(v*w*M);for(let G=0;G<M;G++){let z=G%3*2/3-1,L=G>2?0:-1,D=[z,L,0,z+2/3,L,0,z+2/3,L+1,0,z,L,0,z+2/3,L+1,0,z,L+1,0];C.set(D,T*w*G),S.set(y,x*w*G);let q=[G,G,G,G,G,G];O.set(q,v*w*G)}let F=new Ys;F.setAttribute("position",new Di(C,T)),F.setAttribute("uv",new Di(S,x)),F.setAttribute("faceIndex",new Di(O,v)),t.push(F),a>Da&&a--}return{lodPlanes:t,sizeLods:e,sigmas:o}}function Tg(r,t,e){let o=new qo(r,t,e);return o.texture.mapping=hc,o.texture.name="PMREM.cubeUv",o.scissorTest=!0,o}function ql(r,t,e,o,a){r.viewport.set(t,e,o,a),r.scissor.set(t,e,o,a)}function DS(r,t,e){let o=new Float32Array(Vs),a=new mt(0,1,0);return new Xo({name:"SphericalGaussianBlur",defines:{n:Vs,CUBEUV_TEXEL_WIDTH:1/t,CUBEUV_TEXEL_HEIGHT:1/e,CUBEUV_MAX_MIP:`${r}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:o},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:a}},vertexShader:Xh(),fragmentShader:`\n\n precision mediump float;\n precision mediump int;\n\n varying vec3 vOutputDirection;\n\n uniform sampler2D envMap;\n uniform int samples;\n uniform float weights[ n ];\n uniform bool latitudinal;\n uniform float dTheta;\n uniform float mipInt;\n uniform vec3 poleAxis;\n\n #define ENVMAP_TYPE_CUBE_UV\n #include <cube_uv_reflection_fragment>\n\n vec3 getSample( float theta, vec3 axis ) {\n\n float cosTheta = cos( theta );\n // Rodrigues\' axis-angle rotation\n vec3 sampleDirection = vOutputDirection * cosTheta\n + cross( axis, vOutputDirection ) * sin( theta )\n + axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );\n\n return bilinearCubeUV( envMap, sampleDirection, mipInt );\n\n }\n\n void main() {\n\n vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );\n\n if ( all( equal( axis, vec3( 0.0 ) ) ) ) {\n\n axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );\n\n }\n\n axis = normalize( axis );\n\n gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );\n\n for ( int i = 1; i < n; i++ ) {\n\n if ( i >= samples ) {\n\n break;\n\n }\n\n float theta = dTheta * float( i );\n gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );\n gl_FragColor.rgb += weights[ i ] * getSample( theta, axis );\n\n }\n\n }\n `,blending:fs,depthTest:!1,depthWrite:!1})}function Ag(){return new Xo({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:Xh(),fragmentShader:`\n\n precision mediump float;\n precision mediump int;\n\n varying vec3 vOutputDirection;\n\n uniform sampler2D envMap;\n\n #include <common>\n\n void main() {\n\n vec3 outputDirection = normalize( vOutputDirection );\n vec2 uv = equirectUv( outputDirection );\n\n gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );\n\n }\n `,blending:fs,depthTest:!1,depthWrite:!1})}function Cg(){return new Xo({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:Xh(),fragmentShader:`\n\n precision mediump float;\n precision mediump int;\n\n uniform float flipEnvMap;\n\n varying vec3 vOutputDirection;\n\n uniform samplerCube envMap;\n\n void main() {\n\n gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );\n\n }\n `,blending:fs,depthTest:!1,depthWrite:!1})}function Xh(){return`\n\n precision mediump float;\n precision mediump int;\n\n attribute float faceIndex;\n\n varying vec3 vOutputDirection;\n\n // RH coordinate system; PMREM face-indexing convention\n vec3 getDirection( vec2 uv, float face ) {\n\n uv = 2.0 * uv - 1.0;\n\n vec3 direction = vec3( uv, 1.0 );\n\n if ( face == 0.0 ) {\n\n direction = direction.zyx; // ( 1, v, u ) pos x\n\n } else if ( face == 1.0 ) {\n\n direction = direction.xzy;\n direction.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n } else if ( face == 2.0 ) {\n\n direction.x *= -1.0; // ( -u, v, 1 ) pos z\n\n } else if ( face == 3.0 ) {\n\n direction = direction.zyx;\n direction.xz *= -1.0; // ( -1, v, -u ) neg x\n\n } else if ( face == 4.0 ) {\n\n direction = direction.xzy;\n direction.xy *= -1.0; // ( -u, -1, v ) neg y\n\n } else if ( face == 5.0 ) {\n\n direction.z *= -1.0; // ( u, v, -1 ) neg z\n\n }\n\n return direction;\n\n }\n\n void main() {\n\n vOutputDirection = getDirection( uv, faceIndex );\n gl_Position = vec4( position, 1.0 );\n\n }\n `}function FS(r){let t=new WeakMap,e=null;function o(h){if(h&&h.isTexture){let p=h.mapping,d=p===sh||p===ah,g=p===ka||p===Ga;if(d||g)if(h.isRenderTargetTexture&&h.needsPMREMUpdate===!0){h.needsPMREMUpdate=!1;let _=t.get(h);return e===null&&(e=new fc(r)),_=d?e.fromEquirectangular(h,_):e.fromCubemap(h,_),t.set(h,_),_.texture}else{if(t.has(h))return t.get(h).texture;{let _=h.image;if(d&&_&&_.height>0||g&&_&&a(_)){e===null&&(e=new fc(r));let y=d?e.fromEquirectangular(h):e.fromCubemap(h);return t.set(h,y),h.addEventListener("dispose",l),y.texture}else return null}}}return h}function a(h){let p=0,d=6;for(let g=0;g<d;g++)h[g]!==void 0&&p++;return p===d}function l(h){let p=h.target;p.removeEventListener("dispose",l);let d=t.get(p);d!==void 0&&(t.delete(p),d.dispose())}function f(){t=new WeakMap,e!==null&&(e.dispose(),e=null)}return{get:o,dispose:f}}function US(r){let t={};function e(o){if(t[o]!==void 0)return t[o];let a;switch(o){case"WEBGL_depth_texture":a=r.getExtension("WEBGL_depth_texture")||r.getExtension("MOZ_WEBGL_depth_texture")||r.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":a=r.getExtension("EXT_texture_filter_anisotropic")||r.getExtension("MOZ_EXT_texture_filter_anisotropic")||r.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":a=r.getExtension("WEBGL_compressed_texture_s3tc")||r.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||r.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":a=r.getExtension("WEBGL_compressed_texture_pvrtc")||r.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:a=r.getExtension(o)}return t[o]=a,a}return{has:function(o){return e(o)!==null},init:function(o){o.isWebGL2?e("EXT_color_buffer_float"):(e("WEBGL_depth_texture"),e("OES_texture_float"),e("OES_texture_half_float"),e("OES_texture_half_float_linear"),e("OES_standard_derivatives"),e("OES_element_index_uint"),e("OES_vertex_array_object"),e("ANGLE_instanced_arrays")),e("OES_texture_float_linear"),e("EXT_color_buffer_half_float"),e("WEBGL_multisampled_render_to_texture")},get:function(o){let a=e(o);return a===null&&console.warn("THREE.WebGLRenderer: "+o+" extension not supported."),a}}}function BS(r,t,e,o){let a={},l=new WeakMap;function f(_){let y=_.target;y.index!==null&&t.remove(y.index);for(let w in y.attributes)t.remove(y.attributes[w]);for(let w in y.morphAttributes){let T=y.morphAttributes[w];for(let x=0,v=T.length;x<v;x++)t.remove(T[x])}y.removeEventListener("dispose",f),delete a[y.id];let M=l.get(y);M&&(t.remove(M),l.delete(y)),o.releaseStatesOfGeometry(y),y.isInstancedBufferGeometry===!0&&delete y._maxInstanceCount,e.memory.geometries--}function h(_,y){return a[y.id]===!0||(y.addEventListener("dispose",f),a[y.id]=!0,e.memory.geometries++),y}function p(_){let y=_.attributes;for(let w in y)t.update(y[w],r.ARRAY_BUFFER);let M=_.morphAttributes;for(let w in M){let T=M[w];for(let x=0,v=T.length;x<v;x++)t.update(T[x],r.ARRAY_BUFFER)}}function d(_){let y=[],M=_.index,w=_.attributes.position,T=0;if(M!==null){let C=M.array;T=M.version;for(let S=0,O=C.length;S<O;S+=3){let F=C[S+0],G=C[S+1],z=C[S+2];y.push(F,G,G,z,z,F)}}else if(w!==void 0){let C=w.array;T=w.version;for(let S=0,O=C.length/3-1;S<O;S+=3){let F=S+0,G=S+1,z=S+2;y.push(F,G,G,z,z,F)}}else return;let x=new(n0(y)?ac:sc)(y,1);x.version=T;let v=l.get(_);v&&t.remove(v),l.set(_,x)}function g(_){let y=l.get(_);if(y){let M=_.index;M!==null&&y.version<M.version&&d(_)}else d(_);return l.get(_)}return{get:h,update:p,getWireframeAttribute:g}}function zS(r,t,e,o){let a=o.isWebGL2,l;function f(y){l=y}let h,p;function d(y){h=y.type,p=y.bytesPerElement}function g(y,M){r.drawElements(l,M,h,y*p),e.update(M,l,1)}function _(y,M,w){if(w===0)return;let T,x;if(a)T=r,x="drawElementsInstanced";else if(T=t.get("ANGLE_instanced_arrays"),x="drawElementsInstancedANGLE",T===null){console.error("THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");return}T[x](l,M,h,y*p,w),e.update(M,l,w)}this.setMode=f,this.setIndex=d,this.render=g,this.renderInstances=_}function kS(r){let t={geometries:0,textures:0},e={frame:0,calls:0,triangles:0,points:0,lines:0};function o(l,f,h){switch(e.calls++,f){case r.TRIANGLES:e.triangles+=h*(l/3);break;case r.LINES:e.lines+=h*(l/2);break;case r.LINE_STRIP:e.lines+=h*(l-1);break;case r.LINE_LOOP:e.lines+=h*l;break;case r.POINTS:e.points+=h*l;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",f);break}}function a(){e.calls=0,e.triangles=0,e.points=0,e.lines=0}return{memory:t,render:e,programs:null,autoReset:!0,reset:a,update:o}}function GS(r,t){return r[0]-t[0]}function VS(r,t){return Math.abs(t[1])-Math.abs(r[1])}function HS(r,t,e){let o={},a=new Float32Array(8),l=new WeakMap,f=new Tr,h=[];for(let d=0;d<8;d++)h[d]=[d,0];function p(d,g,_){let y=d.morphTargetInfluences;if(t.isWebGL2===!0){let M=g.morphAttributes.position||g.morphAttributes.normal||g.morphAttributes.color,w=M!==void 0?M.length:0,T=l.get(g);if(T===void 0||T.count!==w){let X=function(){k.dispose(),l.delete(g),g.removeEventListener("dispose",X)};T!==void 0&&T.texture.dispose();let C=g.morphAttributes.position!==void 0,S=g.morphAttributes.normal!==void 0,O=g.morphAttributes.color!==void 0,F=g.morphAttributes.position||[],G=g.morphAttributes.normal||[],z=g.morphAttributes.color||[],L=0;C===!0&&(L=1),S===!0&&(L=2),O===!0&&(L=3);let D=g.attributes.position.count*L,q=1;D>t.maxTextureSize&&(q=Math.ceil(D/t.maxTextureSize),D=t.maxTextureSize);let nt=new Float32Array(D*q*4*w),k=new nc(nt,D,q,w);k.type=cs,k.needsUpdate=!0;let xt=L*4;for(let it=0;it<w;it++){let vt=F[it],pt=G[it],et=z[it],ot=D*q*4*it;for(let V=0;V<vt.count;V++){let K=V*xt;C===!0&&(f.fromBufferAttribute(vt,V),nt[ot+K+0]=f.x,nt[ot+K+1]=f.y,nt[ot+K+2]=f.z,nt[ot+K+3]=0),S===!0&&(f.fromBufferAttribute(pt,V),nt[ot+K+4]=f.x,nt[ot+K+5]=f.y,nt[ot+K+6]=f.z,nt[ot+K+7]=0),O===!0&&(f.fromBufferAttribute(et,V),nt[ot+K+8]=f.x,nt[ot+K+9]=f.y,nt[ot+K+10]=f.z,nt[ot+K+11]=et.itemSize===4?f.w:1)}}T={count:w,texture:k,size:new fn(D,q)},l.set(g,T),g.addEventListener("dispose",X)}let x=0;for(let C=0;C<y.length;C++)x+=y[C];let v=g.morphTargetsRelative?1:1-x;_.getUniforms().setValue(r,"morphTargetBaseInfluence",v),_.getUniforms().setValue(r,"morphTargetInfluences",y),_.getUniforms().setValue(r,"morphTargetsTexture",T.texture,e),_.getUniforms().setValue(r,"morphTargetsTextureSize",T.size)}else{let M=y===void 0?0:y.length,w=o[g.id];if(w===void 0||w.length!==M){w=[];for(let S=0;S<M;S++)w[S]=[S,0];o[g.id]=w}for(let S=0;S<M;S++){let O=w[S];O[0]=S,O[1]=y[S]}w.sort(VS);for(let S=0;S<8;S++)S<M&&w[S][1]?(h[S][0]=w[S][0],h[S][1]=w[S][1]):(h[S][0]=Number.MAX_SAFE_INTEGER,h[S][1]=0);h.sort(GS);let T=g.morphAttributes.position,x=g.morphAttributes.normal,v=0;for(let S=0;S<8;S++){let O=h[S],F=O[0],G=O[1];F!==Number.MAX_SAFE_INTEGER&&G?(T&&g.getAttribute("morphTarget"+S)!==T[F]&&g.setAttribute("morphTarget"+S,T[F]),x&&g.getAttribute("morphNormal"+S)!==x[F]&&g.setAttribute("morphNormal"+S,x[F]),a[S]=G,v+=G):(T&&g.hasAttribute("morphTarget"+S)===!0&&g.deleteAttribute("morphTarget"+S),x&&g.hasAttribute("morphNormal"+S)===!0&&g.deleteAttribute("morphNormal"+S),a[S]=0)}let C=g.morphTargetsRelative?1:1-v;_.getUniforms().setValue(r,"morphTargetBaseInfluence",C),_.getUniforms().setValue(r,"morphTargetInfluences",a)}}return{update:p}}function WS(r,t,e,o){let a=new WeakMap;function l(p){let d=o.render.frame,g=p.geometry,_=t.get(p,g);if(a.get(_)!==d&&(t.update(_),a.set(_,d)),p.isInstancedMesh&&(p.hasEventListener("dispose",h)===!1&&p.addEventListener("dispose",h),a.get(p)!==d&&(e.update(p.instanceMatrix,r.ARRAY_BUFFER),p.instanceColor!==null&&e.update(p.instanceColor,r.ARRAY_BUFFER),a.set(p,d))),p.isSkinnedMesh){let y=p.skeleton;a.get(y)!==d&&(y.update(),a.set(y,d))}return _}function f(){a=new WeakMap}function h(p){let d=p.target;d.removeEventListener("dispose",h),e.remove(d.instanceMatrix),d.instanceColor!==null&&e.remove(d.instanceColor)}return{update:l,dispose:f}}var s0=new Ki,a0=new nc,u0=new dh,l0=new lc,Pg=[],Ig=[],Rg=new Float32Array(16),Lg=new Float32Array(9),Ng=new Float32Array(4);function Xa(r,t,e){let o=r[0];if(o<=0||o>0)return r;let a=t*e,l=Pg[a];if(l===void 0&&(l=new Float32Array(a),Pg[a]=l),t!==0){o.toArray(l,0);for(let f=1,h=0;f!==t;++f)h+=e,r[f].toArray(l,h)}return l}function tr(r,t){if(r.length!==t.length)return!1;for(let e=0,o=r.length;e<o;e++)if(r[e]!==t[e])return!1;return!0}function er(r,t){for(let e=0,o=t.length;e<o;e++)r[e]=t[e]}function dc(r,t){let e=Ig[t];e===void 0&&(e=new Int32Array(t),Ig[t]=e);for(let o=0;o!==t;++o)e[o]=r.allocateTextureUnit();return e}function qS(r,t){let e=this.cache;e[0]!==t&&(r.uniform1f(this.addr,t),e[0]=t)}function XS(r,t){let e=this.cache;if(t.x!==void 0)(e[0]!==t.x||e[1]!==t.y)&&(r.uniform2f(this.addr,t.x,t.y),e[0]=t.x,e[1]=t.y);else{if(tr(e,t))return;r.uniform2fv(this.addr,t),er(e,t)}}function YS(r,t){let e=this.cache;if(t.x!==void 0)(e[0]!==t.x||e[1]!==t.y||e[2]!==t.z)&&(r.uniform3f(this.addr,t.x,t.y,t.z),e[0]=t.x,e[1]=t.y,e[2]=t.z);else if(t.r!==void 0)(e[0]!==t.r||e[1]!==t.g||e[2]!==t.b)&&(r.uniform3f(this.addr,t.r,t.g,t.b),e[0]=t.r,e[1]=t.g,e[2]=t.b);else{if(tr(e,t))return;r.uniform3fv(this.addr,t),er(e,t)}}function ZS(r,t){let e=this.cache;if(t.x!==void 0)(e[0]!==t.x||e[1]!==t.y||e[2]!==t.z||e[3]!==t.w)&&(r.uniform4f(this.addr,t.x,t.y,t.z,t.w),e[0]=t.x,e[1]=t.y,e[2]=t.z,e[3]=t.w);else{if(tr(e,t))return;r.uniform4fv(this.addr,t),er(e,t)}}function JS(r,t){let e=this.cache,o=t.elements;if(o===void 0){if(tr(e,t))return;r.uniformMatrix2fv(this.addr,!1,t),er(e,t)}else{if(tr(e,o))return;Ng.set(o),r.uniformMatrix2fv(this.addr,!1,Ng),er(e,o)}}function $S(r,t){let e=this.cache,o=t.elements;if(o===void 0){if(tr(e,t))return;r.uniformMatrix3fv(this.addr,!1,t),er(e,t)}else{if(tr(e,o))return;Lg.set(o),r.uniformMatrix3fv(this.addr,!1,Lg),er(e,o)}}function KS(r,t){let e=this.cache,o=t.elements;if(o===void 0){if(tr(e,t))return;r.uniformMatrix4fv(this.addr,!1,t),er(e,t)}else{if(tr(e,o))return;Rg.set(o),r.uniformMatrix4fv(this.addr,!1,Rg),er(e,o)}}function jS(r,t){let e=this.cache;e[0]!==t&&(r.uniform1i(this.addr,t),e[0]=t)}function QS(r,t){let e=this.cache;if(t.x!==void 0)(e[0]!==t.x||e[1]!==t.y)&&(r.uniform2i(this.addr,t.x,t.y),e[0]=t.x,e[1]=t.y);else{if(tr(e,t))return;r.uniform2iv(this.addr,t),er(e,t)}}function tw(r,t){let e=this.cache;if(t.x!==void 0)(e[0]!==t.x||e[1]!==t.y||e[2]!==t.z)&&(r.uniform3i(this.addr,t.x,t.y,t.z),e[0]=t.x,e[1]=t.y,e[2]=t.z);else{if(tr(e,t))return;r.uniform3iv(this.addr,t),er(e,t)}}function ew(r,t){let e=this.cache;if(t.x!==void 0)(e[0]!==t.x||e[1]!==t.y||e[2]!==t.z||e[3]!==t.w)&&(r.uniform4i(this.addr,t.x,t.y,t.z,t.w),e[0]=t.x,e[1]=t.y,e[2]=t.z,e[3]=t.w);else{if(tr(e,t))return;r.uniform4iv(this.addr,t),er(e,t)}}function nw(r,t){let e=this.cache;e[0]!==t&&(r.uniform1ui(this.addr,t),e[0]=t)}function rw(r,t){let e=this.cache;if(t.x!==void 0)(e[0]!==t.x||e[1]!==t.y)&&(r.uniform2ui(this.addr,t.x,t.y),e[0]=t.x,e[1]=t.y);else{if(tr(e,t))return;r.uniform2uiv(this.addr,t),er(e,t)}}function iw(r,t){let e=this.cache;if(t.x!==void 0)(e[0]!==t.x||e[1]!==t.y||e[2]!==t.z)&&(r.uniform3ui(this.addr,t.x,t.y,t.z),e[0]=t.x,e[1]=t.y,e[2]=t.z);else{if(tr(e,t))return;r.uniform3uiv(this.addr,t),er(e,t)}}function ow(r,t){let e=this.cache;if(t.x!==void 0)(e[0]!==t.x||e[1]!==t.y||e[2]!==t.z||e[3]!==t.w)&&(r.uniform4ui(this.addr,t.x,t.y,t.z,t.w),e[0]=t.x,e[1]=t.y,e[2]=t.z,e[3]=t.w);else{if(tr(e,t))return;r.uniform4uiv(this.addr,t),er(e,t)}}function sw(r,t,e){let o=this.cache,a=e.allocateTextureUnit();o[0]!==a&&(r.uniform1i(this.addr,a),o[0]=a),e.setTexture2D(t||s0,a)}function aw(r,t,e){let o=this.cache,a=e.allocateTextureUnit();o[0]!==a&&(r.uniform1i(this.addr,a),o[0]=a),e.setTexture3D(t||u0,a)}function uw(r,t,e){let o=this.cache,a=e.allocateTextureUnit();o[0]!==a&&(r.uniform1i(this.addr,a),o[0]=a),e.setTextureCube(t||l0,a)}function lw(r,t,e){let o=this.cache,a=e.allocateTextureUnit();o[0]!==a&&(r.uniform1i(this.addr,a),o[0]=a),e.setTexture2DArray(t||a0,a)}function cw(r){switch(r){case 5126:return qS;case 35664:return XS;case 35665:return YS;case 35666:return ZS;case 35674:return JS;case 35675:return $S;case 35676:return KS;case 5124:case 35670:return jS;case 35667:case 35671:return QS;case 35668:case 35672:return tw;case 35669:case 35673:return ew;case 5125:return nw;case 36294:return rw;case 36295:return iw;case 36296:return ow;case 35678:case 36198:case 36298:case 36306:case 35682:return sw;case 35679:case 36299:case 36307:return aw;case 35680:case 36300:case 36308:case 36293:return uw;case 36289:case 36303:case 36311:case 36292:return lw}}function fw(r,t){r.uniform1fv(this.addr,t)}function hw(r,t){let e=Xa(t,this.size,2);r.uniform2fv(this.addr,e)}function pw(r,t){let e=Xa(t,this.size,3);r.uniform3fv(this.addr,e)}function dw(r,t){let e=Xa(t,this.size,4);r.uniform4fv(this.addr,e)}function mw(r,t){let e=Xa(t,this.size,4);r.uniformMatrix2fv(this.addr,!1,e)}function gw(r,t){let e=Xa(t,this.size,9);r.uniformMatrix3fv(this.addr,!1,e)}function yw(r,t){let e=Xa(t,this.size,16);r.uniformMatrix4fv(this.addr,!1,e)}function vw(r,t){r.uniform1iv(this.addr,t)}function _w(r,t){r.uniform2iv(this.addr,t)}function xw(r,t){r.uniform3iv(this.addr,t)}function Ew(r,t){r.uniform4iv(this.addr,t)}function Mw(r,t){r.uniform1uiv(this.addr,t)}function Sw(r,t){r.uniform2uiv(this.addr,t)}function ww(r,t){r.uniform3uiv(this.addr,t)}function bw(r,t){r.uniform4uiv(this.addr,t)}function Tw(r,t,e){let o=this.cache,a=t.length,l=dc(e,a);tr(o,l)||(r.uniform1iv(this.addr,l),er(o,l));for(let f=0;f!==a;++f)e.setTexture2D(t[f]||s0,l[f])}function Aw(r,t,e){let o=this.cache,a=t.length,l=dc(e,a);tr(o,l)||(r.uniform1iv(this.addr,l),er(o,l));for(let f=0;f!==a;++f)e.setTexture3D(t[f]||u0,l[f])}function Cw(r,t,e){let o=this.cache,a=t.length,l=dc(e,a);tr(o,l)||(r.uniform1iv(this.addr,l),er(o,l));for(let f=0;f!==a;++f)e.setTextureCube(t[f]||l0,l[f])}function Pw(r,t,e){let o=this.cache,a=t.length,l=dc(e,a);tr(o,l)||(r.uniform1iv(this.addr,l),er(o,l));for(let f=0;f!==a;++f)e.setTexture2DArray(t[f]||a0,l[f])}function Iw(r){switch(r){case 5126:return fw;case 35664:return hw;case 35665:return pw;case 35666:return dw;case 35674:return mw;case 35675:return gw;case 35676:return yw;case 5124:case 35670:return vw;case 35667:case 35671:return _w;case 35668:case 35672:return xw;case 35669:case 35673:return Ew;case 5125:return Mw;case 36294:return Sw;case 36295:return ww;case 36296:return bw;case 35678:case 36198:case 36298:case 36306:case 35682:return Tw;case 35679:case 36299:case 36307:return Aw;case 35680:case 36300:case 36308:case 36293:return Cw;case 36289:case 36303:case 36311:case 36292:return Pw}}var xh=class{constructor(t,e,o){this.id=t,this.addr=o,this.cache=[],this.setValue=cw(e.type)}},Eh=class{constructor(t,e,o){this.id=t,this.addr=o,this.cache=[],this.size=e.size,this.setValue=Iw(e.type)}},Mh=class{constructor(t){this.id=t,this.seq=[],this.map={}}setValue(t,e,o){let a=this.seq;for(let l=0,f=a.length;l!==f;++l){let h=a[l];h.setValue(t,e[h.id],o)}}},ih=/(\\w+)(\\])?(\\[|\\.)?/g;function Og(r,t){r.seq.push(t),r.map[t.id]=t}function Rw(r,t,e){let o=r.name,a=o.length;for(ih.lastIndex=0;;){let l=ih.exec(o),f=ih.lastIndex,h=l[1],p=l[2]==="]",d=l[3];if(p&&(h=h|0),d===void 0||d==="["&&f+2===a){Og(e,d===void 0?new xh(h,r,t):new Eh(h,r,t));break}else{let _=e.map[h];_===void 0&&(_=new Mh(h),Og(e,_)),e=_}}}var za=class{constructor(t,e){this.seq=[],this.map={};let o=t.getProgramParameter(e,t.ACTIVE_UNIFORMS);for(let a=0;a<o;++a){let l=t.getActiveUniform(e,a),f=t.getUniformLocation(e,l.name);Rw(l,f,this)}}setValue(t,e,o,a){let l=this.map[e];l!==void 0&&l.setValue(t,o,a)}setOptional(t,e,o){let a=e[o];a!==void 0&&this.setValue(t,o,a)}static upload(t,e,o,a){for(let l=0,f=e.length;l!==f;++l){let h=e[l],p=o[h.id];p.needsUpdate!==!1&&h.setValue(t,p.value,a)}}static seqWithValue(t,e){let o=[];for(let a=0,l=t.length;a!==l;++a){let f=t[a];f.id in e&&o.push(f)}return o}};function Dg(r,t,e){let o=r.createShader(t);return r.shaderSource(o,e),r.compileShader(o),o}var Lw=0;function Nw(r,t){let e=r.split(`\n`),o=[],a=Math.max(t-6,0),l=Math.min(t+6,e.length);for(let f=a;f<l;f++){let h=f+1;o.push(`${h===t?">":" "} ${h}: ${e[f]}`)}return o.join(`\n`)}function Ow(r){let t=gn.getPrimaries(gn.workingColorSpace),e=gn.getPrimaries(r),o;switch(t===e?o="":t===Kl&&e===$l?o="LinearDisplayP3ToLinearSRGB":t===$l&&e===Kl&&(o="LinearSRGBToLinearDisplayP3"),r){case Wo:case pc:return[o,"LinearTransferOETF"];case br:case qh:return[o,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space:",r),[o,"LinearTransferOETF"]}}function Fg(r,t,e){let o=r.getShaderParameter(t,r.COMPILE_STATUS),a=r.getShaderInfoLog(t).trim();if(o&&a==="")return"";let l=/ERROR: 0:(\\d+)/.exec(a);if(l){let f=parseInt(l[1]);return e.toUpperCase()+`\n\n`+a+`\n\n`+Nw(r.getShaderSource(t),f)}else return a}function Dw(r,t){let e=Ow(t);return`vec4 ${r}( vec4 value ) { return ${e[0]}( ${e[1]}( value ) ); }`}function Fw(r,t){let e;switch(t){case tx:e="Linear";break;case ex:e="Reinhard";break;case nx:e="OptimizedCineon";break;case rx:e="ACESFilmic";break;case ix:e="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",t),e="Linear"}return"vec3 "+r+"( vec3 color ) { return "+e+"ToneMapping( color ); }"}function Uw(r){return[r.extensionDerivatives||r.envMapCubeUVHeight||r.bumpMap||r.normalMapTangentSpace||r.clearcoatNormalMap||r.flatShading||r.shaderID==="physical"?"#extension GL_OES_standard_derivatives : enable":"",(r.extensionFragDepth||r.logarithmicDepthBuffer)&&r.rendererExtensionFragDepth?"#extension GL_EXT_frag_depth : enable":"",r.extensionDrawBuffers&&r.rendererExtensionDrawBuffers?"#extension GL_EXT_draw_buffers : require":"",(r.extensionShaderTextureLOD||r.envMap||r.transmission)&&r.rendererExtensionShaderTextureLod?"#extension GL_EXT_shader_texture_lod : enable":""].filter(Lu).join(`\n`)}function Bw(r){let t=[];for(let e in r){let o=r[e];o!==!1&&t.push("#define "+e+" "+o)}return t.join(`\n`)}function zw(r,t){let e={},o=r.getProgramParameter(t,r.ACTIVE_ATTRIBUTES);for(let a=0;a<o;a++){let l=r.getActiveAttrib(t,a),f=l.name,h=1;l.type===r.FLOAT_MAT2&&(h=2),l.type===r.FLOAT_MAT3&&(h=3),l.type===r.FLOAT_MAT4&&(h=4),e[f]={type:l.type,location:r.getAttribLocation(t,f),locationSize:h}}return e}function Lu(r){return r!==""}function Ug(r,t){let e=t.numSpotLightShadows+t.numSpotLightMaps-t.numSpotLightShadowsWithMaps;return r.replace(/NUM_DIR_LIGHTS/g,t.numDirLights).replace(/NUM_SPOT_LIGHTS/g,t.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,t.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,e).replace(/NUM_RECT_AREA_LIGHTS/g,t.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,t.numPointLights).replace(/NUM_HEMI_LIGHTS/g,t.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,t.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,t.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,t.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,t.numPointLightShadows)}function Bg(r,t){return r.replace(/NUM_CLIPPING_PLANES/g,t.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,t.numClippingPlanes-t.numClipIntersection)}var kw=/^[ \\t]*#include +<([\\w\\d./]+)>/gm;function Sh(r){return r.replace(kw,Vw)}var Gw=new Map([["encodings_fragment","colorspace_fragment"],["encodings_pars_fragment","colorspace_pars_fragment"],["output_fragment","opaque_fragment"]]);function Vw(r,t){let e=ge[t];if(e===void 0){let o=Gw.get(t);if(o!==void 0)e=ge[o],console.warn(\'THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.\',t,o);else throw new Error("Can not resolve #include <"+t+">")}return Sh(e)}var Hw=/#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 zg(r){return r.replace(Hw,Ww)}function Ww(r,t,e,o){let a="";for(let l=parseInt(t);l<parseInt(e);l++)a+=o.replace(/\\[\\s*i\\s*\\]/g,"[ "+l+" ]").replace(/UNROLLED_LOOP_INDEX/g,l);return a}function kg(r){let t="precision "+r.precision+` float;\nprecision `+r.precision+" int;";return r.precision==="highp"?t+=`\n#define HIGH_PRECISION`:r.precision==="mediump"?t+=`\n#define MEDIUM_PRECISION`:r.precision==="lowp"&&(t+=`\n#define LOW_PRECISION`),t}function qw(r){let t="SHADOWMAP_TYPE_BASIC";return r.shadowMapType===Wg?t="SHADOWMAP_TYPE_PCF":r.shadowMapType===L1?t="SHADOWMAP_TYPE_PCF_SOFT":r.shadowMapType===zo&&(t="SHADOWMAP_TYPE_VSM"),t}function Xw(r){let t="ENVMAP_TYPE_CUBE";if(r.envMap)switch(r.envMapMode){case ka:case Ga:t="ENVMAP_TYPE_CUBE";break;case hc:t="ENVMAP_TYPE_CUBE_UV";break}return t}function Yw(r){let t="ENVMAP_MODE_REFLECTION";if(r.envMap)switch(r.envMapMode){case Ga:t="ENVMAP_MODE_REFRACTION";break}return t}function Zw(r){let t="ENVMAP_BLENDING_NONE";if(r.envMap)switch(r.combine){case Yg:t="ENVMAP_BLENDING_MULTIPLY";break;case j1:t="ENVMAP_BLENDING_MIX";break;case Q1:t="ENVMAP_BLENDING_ADD";break}return t}function Jw(r){let t=r.envMapCubeUVHeight;if(t===null)return null;let e=Math.log2(t)-2,o=1/t;return{texelWidth:1/(3*Math.max(Math.pow(2,e),7*16)),texelHeight:o,maxMip:e}}function $w(r,t,e,o){let a=r.getContext(),l=e.defines,f=e.vertexShader,h=e.fragmentShader,p=qw(e),d=Xw(e),g=Yw(e),_=Zw(e),y=Jw(e),M=e.isWebGL2?"":Uw(e),w=Bw(l),T=a.createProgram(),x,v,C=e.glslVersion?"#version "+e.glslVersion+`\n`:"";e.isRawShaderMaterial?(x=["#define SHADER_TYPE "+e.shaderType,"#define SHADER_NAME "+e.shaderName,w].filter(Lu).join(`\n`),x.length>0&&(x+=`\n`),v=[M,"#define SHADER_TYPE "+e.shaderType,"#define SHADER_NAME "+e.shaderName,w].filter(Lu).join(`\n`),v.length>0&&(v+=`\n`)):(x=[kg(e),"#define SHADER_TYPE "+e.shaderType,"#define SHADER_NAME "+e.shaderName,w,e.instancing?"#define USE_INSTANCING":"",e.instancingColor?"#define USE_INSTANCING_COLOR":"",e.useFog&&e.fog?"#define USE_FOG":"",e.useFog&&e.fogExp2?"#define FOG_EXP2":"",e.map?"#define USE_MAP":"",e.envMap?"#define USE_ENVMAP":"",e.envMap?"#define "+g:"",e.lightMap?"#define USE_LIGHTMAP":"",e.aoMap?"#define USE_AOMAP":"",e.bumpMap?"#define USE_BUMPMAP":"",e.normalMap?"#define USE_NORMALMAP":"",e.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",e.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",e.displacementMap?"#define USE_DISPLACEMENTMAP":"",e.emissiveMap?"#define USE_EMISSIVEMAP":"",e.anisotropy?"#define USE_ANISOTROPY":"",e.anisotropyMap?"#define USE_ANISOTROPYMAP":"",e.clearcoatMap?"#define USE_CLEARCOATMAP":"",e.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",e.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",e.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",e.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",e.specularMap?"#define USE_SPECULARMAP":"",e.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",e.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",e.roughnessMap?"#define USE_ROUGHNESSMAP":"",e.metalnessMap?"#define USE_METALNESSMAP":"",e.alphaMap?"#define USE_ALPHAMAP":"",e.alphaHash?"#define USE_ALPHAHASH":"",e.transmission?"#define USE_TRANSMISSION":"",e.transmissionMap?"#define USE_TRANSMISSIONMAP":"",e.thicknessMap?"#define USE_THICKNESSMAP":"",e.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",e.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",e.mapUv?"#define MAP_UV "+e.mapUv:"",e.alphaMapUv?"#define ALPHAMAP_UV "+e.alphaMapUv:"",e.lightMapUv?"#define LIGHTMAP_UV "+e.lightMapUv:"",e.aoMapUv?"#define AOMAP_UV "+e.aoMapUv:"",e.emissiveMapUv?"#define EMISSIVEMAP_UV "+e.emissiveMapUv:"",e.bumpMapUv?"#define BUMPMAP_UV "+e.bumpMapUv:"",e.normalMapUv?"#define NORMALMAP_UV "+e.normalMapUv:"",e.displacementMapUv?"#define DISPLACEMENTMAP_UV "+e.displacementMapUv:"",e.metalnessMapUv?"#define METALNESSMAP_UV "+e.metalnessMapUv:"",e.roughnessMapUv?"#define ROUGHNESSMAP_UV "+e.roughnessMapUv:"",e.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+e.anisotropyMapUv:"",e.clearcoatMapUv?"#define CLEARCOATMAP_UV "+e.clearcoatMapUv:"",e.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+e.clearcoatNormalMapUv:"",e.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+e.clearcoatRoughnessMapUv:"",e.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+e.iridescenceMapUv:"",e.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+e.iridescenceThicknessMapUv:"",e.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+e.sheenColorMapUv:"",e.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+e.sheenRoughnessMapUv:"",e.specularMapUv?"#define SPECULARMAP_UV "+e.specularMapUv:"",e.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+e.specularColorMapUv:"",e.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+e.specularIntensityMapUv:"",e.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+e.transmissionMapUv:"",e.thicknessMapUv?"#define THICKNESSMAP_UV "+e.thicknessMapUv:"",e.vertexTangents&&e.flatShading===!1?"#define USE_TANGENT":"",e.vertexColors?"#define USE_COLOR":"",e.vertexAlphas?"#define USE_COLOR_ALPHA":"",e.vertexUv1s?"#define USE_UV1":"",e.vertexUv2s?"#define USE_UV2":"",e.vertexUv3s?"#define USE_UV3":"",e.pointsUvs?"#define USE_POINTS_UV":"",e.flatShading?"#define FLAT_SHADED":"",e.skinning?"#define USE_SKINNING":"",e.morphTargets?"#define USE_MORPHTARGETS":"",e.morphNormals&&e.flatShading===!1?"#define USE_MORPHNORMALS":"",e.morphColors&&e.isWebGL2?"#define USE_MORPHCOLORS":"",e.morphTargetsCount>0&&e.isWebGL2?"#define MORPHTARGETS_TEXTURE":"",e.morphTargetsCount>0&&e.isWebGL2?"#define MORPHTARGETS_TEXTURE_STRIDE "+e.morphTextureStride:"",e.morphTargetsCount>0&&e.isWebGL2?"#define MORPHTARGETS_COUNT "+e.morphTargetsCount:"",e.doubleSided?"#define DOUBLE_SIDED":"",e.flipSided?"#define FLIP_SIDED":"",e.shadowMapEnabled?"#define USE_SHADOWMAP":"",e.shadowMapEnabled?"#define "+p:"",e.sizeAttenuation?"#define USE_SIZEATTENUATION":"",e.numLightProbes>0?"#define USE_LIGHT_PROBES":"",e.useLegacyLights?"#define LEGACY_LIGHTS":"",e.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",e.logarithmicDepthBuffer&&e.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","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","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","#if ( defined( USE_MORPHTARGETS ) && ! defined( MORPHTARGETS_TEXTURE ) )"," attribute vec3 morphTarget0;"," attribute vec3 morphTarget1;"," attribute vec3 morphTarget2;"," attribute vec3 morphTarget3;"," #ifdef USE_MORPHNORMALS"," attribute vec3 morphNormal0;"," attribute vec3 morphNormal1;"," attribute vec3 morphNormal2;"," attribute vec3 morphNormal3;"," #else"," attribute vec3 morphTarget4;"," attribute vec3 morphTarget5;"," attribute vec3 morphTarget6;"," attribute vec3 morphTarget7;"," #endif","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif",`\n`].filter(Lu).join(`\n`),v=[M,kg(e),"#define SHADER_TYPE "+e.shaderType,"#define SHADER_NAME "+e.shaderName,w,e.useFog&&e.fog?"#define USE_FOG":"",e.useFog&&e.fogExp2?"#define FOG_EXP2":"",e.map?"#define USE_MAP":"",e.matcap?"#define USE_MATCAP":"",e.envMap?"#define USE_ENVMAP":"",e.envMap?"#define "+d:"",e.envMap?"#define "+g:"",e.envMap?"#define "+_:"",y?"#define CUBEUV_TEXEL_WIDTH "+y.texelWidth:"",y?"#define CUBEUV_TEXEL_HEIGHT "+y.texelHeight:"",y?"#define CUBEUV_MAX_MIP "+y.maxMip+".0":"",e.lightMap?"#define USE_LIGHTMAP":"",e.aoMap?"#define USE_AOMAP":"",e.bumpMap?"#define USE_BUMPMAP":"",e.normalMap?"#define USE_NORMALMAP":"",e.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",e.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",e.emissiveMap?"#define USE_EMISSIVEMAP":"",e.anisotropy?"#define USE_ANISOTROPY":"",e.anisotropyMap?"#define USE_ANISOTROPYMAP":"",e.clearcoat?"#define USE_CLEARCOAT":"",e.clearcoatMap?"#define USE_CLEARCOATMAP":"",e.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",e.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",e.iridescence?"#define USE_IRIDESCENCE":"",e.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",e.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",e.specularMap?"#define USE_SPECULARMAP":"",e.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",e.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",e.roughnessMap?"#define USE_ROUGHNESSMAP":"",e.metalnessMap?"#define USE_METALNESSMAP":"",e.alphaMap?"#define USE_ALPHAMAP":"",e.alphaTest?"#define USE_ALPHATEST":"",e.alphaHash?"#define USE_ALPHAHASH":"",e.sheen?"#define USE_SHEEN":"",e.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",e.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",e.transmission?"#define USE_TRANSMISSION":"",e.transmissionMap?"#define USE_TRANSMISSIONMAP":"",e.thicknessMap?"#define USE_THICKNESSMAP":"",e.vertexTangents&&e.flatShading===!1?"#define USE_TANGENT":"",e.vertexColors||e.instancingColor?"#define USE_COLOR":"",e.vertexAlphas?"#define USE_COLOR_ALPHA":"",e.vertexUv1s?"#define USE_UV1":"",e.vertexUv2s?"#define USE_UV2":"",e.vertexUv3s?"#define USE_UV3":"",e.pointsUvs?"#define USE_POINTS_UV":"",e.gradientMap?"#define USE_GRADIENTMAP":"",e.flatShading?"#define FLAT_SHADED":"",e.doubleSided?"#define DOUBLE_SIDED":"",e.flipSided?"#define FLIP_SIDED":"",e.shadowMapEnabled?"#define USE_SHADOWMAP":"",e.shadowMapEnabled?"#define "+p:"",e.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",e.numLightProbes>0?"#define USE_LIGHT_PROBES":"",e.useLegacyLights?"#define LEGACY_LIGHTS":"",e.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",e.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",e.logarithmicDepthBuffer&&e.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",e.toneMapping!==hs?"#define TONE_MAPPING":"",e.toneMapping!==hs?ge.tonemapping_pars_fragment:"",e.toneMapping!==hs?Fw("toneMapping",e.toneMapping):"",e.dithering?"#define DITHERING":"",e.opaque?"#define OPAQUE":"",ge.colorspace_pars_fragment,Dw("linearToOutputTexel",e.outputColorSpace),e.useDepthPacking?"#define DEPTH_PACKING "+e.depthPacking:"",`\n`].filter(Lu).join(`\n`)),f=Sh(f),f=Ug(f,e),f=Bg(f,e),h=Sh(h),h=Ug(h,e),h=Bg(h,e),f=zg(f),h=zg(h),e.isWebGL2&&e.isRawShaderMaterial!==!0&&(C=`#version 300 es\n`,x=["precision mediump sampler2DArray;","#define attribute in","#define varying out","#define texture2D texture"].join(`\n`)+`\n`+x,v=["#define varying in",e.glslVersion===og?"":"layout(location = 0) out highp vec4 pc_fragColor;",e.glslVersion===og?"":"#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(`\n`)+`\n`+v);let S=C+x+f,O=C+v+h,F=Dg(a,a.VERTEX_SHADER,S),G=Dg(a,a.FRAGMENT_SHADER,O);if(a.attachShader(T,F),a.attachShader(T,G),e.index0AttributeName!==void 0?a.bindAttribLocation(T,0,e.index0AttributeName):e.morphTargets===!0&&a.bindAttribLocation(T,0,"position"),a.linkProgram(T),r.debug.checkShaderErrors){let D=a.getProgramInfoLog(T).trim(),q=a.getShaderInfoLog(F).trim(),nt=a.getShaderInfoLog(G).trim(),k=!0,xt=!0;if(a.getProgramParameter(T,a.LINK_STATUS)===!1)if(k=!1,typeof r.debug.onShaderError=="function")r.debug.onShaderError(a,T,F,G);else{let X=Fg(a,F,"vertex"),it=Fg(a,G,"fragment");console.error("THREE.WebGLProgram: Shader Error "+a.getError()+" - VALIDATE_STATUS "+a.getProgramParameter(T,a.VALIDATE_STATUS)+`\n\nProgram Info Log: `+D+`\n`+X+`\n`+it)}else D!==""?console.warn("THREE.WebGLProgram: Program Info Log:",D):(q===""||nt==="")&&(xt=!1);xt&&(this.diagnostics={runnable:k,programLog:D,vertexShader:{log:q,prefix:x},fragmentShader:{log:nt,prefix:v}})}a.deleteShader(F),a.deleteShader(G);let z;this.getUniforms=function(){return z===void 0&&(z=new za(a,T)),z};let L;return this.getAttributes=function(){return L===void 0&&(L=zw(a,T)),L},this.destroy=function(){o.releaseStatesOfProgram(this),a.deleteProgram(T),this.program=void 0},this.type=e.shaderType,this.name=e.shaderName,this.id=Lw++,this.cacheKey=t,this.usedTimes=1,this.program=T,this.vertexShader=F,this.fragmentShader=G,this}var Kw=0,wh=class{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(t){let e=t.vertexShader,o=t.fragmentShader,a=this._getShaderStage(e),l=this._getShaderStage(o),f=this._getShaderCacheForMaterial(t);return f.has(a)===!1&&(f.add(a),a.usedTimes++),f.has(l)===!1&&(f.add(l),l.usedTimes++),this}remove(t){let e=this.materialCache.get(t);for(let o of e)o.usedTimes--,o.usedTimes===0&&this.shaderCache.delete(o.code);return this.materialCache.delete(t),this}getVertexShaderID(t){return this._getShaderStage(t.vertexShader).id}getFragmentShaderID(t){return this._getShaderStage(t.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(t){let e=this.materialCache,o=e.get(t);return o===void 0&&(o=new Set,e.set(t,o)),o}_getShaderStage(t){let e=this.shaderCache,o=e.get(t);return o===void 0&&(o=new bh(t),e.set(t,o)),o}},bh=class{constructor(t){this.id=Kw++,this.code=t,this.usedTimes=0}};function jw(r,t,e,o,a,l,f){let h=new ic,p=new wh,d=[],g=a.isWebGL2,_=a.logarithmicDepthBuffer,y=a.vertexTextures,M=a.precision,w={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function T(D){return D===0?"uv":`uv${D}`}function x(D,q,nt,k,xt){let X=k.fog,it=xt.geometry,vt=D.isMeshStandardMaterial?k.environment:null,pt=(D.isMeshStandardMaterial?e:t).get(D.envMap||vt),et=pt&&pt.mapping===hc?pt.image.height:null,ot=w[D.type];D.precision!==null&&(M=a.getMaxPrecision(D.precision),M!==D.precision&&console.warn("THREE.WebGLProgram.getParameters:",D.precision,"not supported, using",M,"instead."));let V=it.morphAttributes.position||it.morphAttributes.normal||it.morphAttributes.color,K=V!==void 0?V.length:0,at=0;it.morphAttributes.position!==void 0&&(at=1),it.morphAttributes.normal!==void 0&&(at=2),it.morphAttributes.color!==void 0&&(at=3);let Tt,dt,Ct,Yt;if(ot){let He=lo[ot];Tt=He.vertexShader,dt=He.fragmentShader}else Tt=D.vertexShader,dt=D.fragmentShader,p.update(D),Ct=p.getVertexShaderID(D),Yt=p.getFragmentShaderID(D);let Wt=r.getRenderTarget(),Nt=xt.isInstancedMesh===!0,ne=!!D.map,Pt=!!D.matcap,Xt=!!pt,tt=!!D.aoMap,nn=!!D.lightMap,Gt=!!D.bumpMap,te=!!D.normalMap,qt=!!D.displacementMap,$=!!D.emissiveMap,N=!!D.metalnessMap,b=!!D.roughnessMap,R=D.anisotropy>0,W=D.clearcoat>0,J=D.iridescence>0,I=D.sheen>0,P=D.transmission>0,B=R&&!!D.anisotropyMap,lt=W&&!!D.clearcoatMap,ct=W&&!!D.clearcoatNormalMap,Q=W&&!!D.clearcoatRoughnessMap,St=J&&!!D.iridescenceMap,_t=J&&!!D.iridescenceThicknessMap,Mt=I&&!!D.sheenColorMap,Lt=I&&!!D.sheenRoughnessMap,Jt=!!D.specularMap,Et=!!D.specularColorMap,oe=!!D.specularIntensityMap,jt=P&&!!D.transmissionMap,Ht=P&&!!D.thicknessMap,Ot=!!D.gradientMap,Y=!!D.alphaMap,wt=D.alphaTest>0,j=!!D.alphaHash,Ut=!!D.extensions,Dt=!!it.attributes.uv1,ft=!!it.attributes.uv2,$t=!!it.attributes.uv3,re=hs;return D.toneMapped&&(Wt===null||Wt.isXRRenderTarget===!0)&&(re=r.toneMapping),{isWebGL2:g,shaderID:ot,shaderType:D.type,shaderName:D.name,vertexShader:Tt,fragmentShader:dt,defines:D.defines,customVertexShaderID:Ct,customFragmentShaderID:Yt,isRawShaderMaterial:D.isRawShaderMaterial===!0,glslVersion:D.glslVersion,precision:M,instancing:Nt,instancingColor:Nt&&xt.instanceColor!==null,supportsVertexTextures:y,outputColorSpace:Wt===null?r.outputColorSpace:Wt.isXRRenderTarget===!0?Wt.texture.colorSpace:Wo,map:ne,matcap:Pt,envMap:Xt,envMapMode:Xt&&pt.mapping,envMapCubeUVHeight:et,aoMap:tt,lightMap:nn,bumpMap:Gt,normalMap:te,displacementMap:y&&qt,emissiveMap:$,normalMapObjectSpace:te&&D.normalMapType===vx,normalMapTangentSpace:te&&D.normalMapType===yx,metalnessMap:N,roughnessMap:b,anisotropy:R,anisotropyMap:B,clearcoat:W,clearcoatMap:lt,clearcoatNormalMap:ct,clearcoatRoughnessMap:Q,iridescence:J,iridescenceMap:St,iridescenceThicknessMap:_t,sheen:I,sheenColorMap:Mt,sheenRoughnessMap:Lt,specularMap:Jt,specularColorMap:Et,specularIntensityMap:oe,transmission:P,transmissionMap:jt,thicknessMap:Ht,gradientMap:Ot,opaque:D.transparent===!1&&D.blending===Ua,alphaMap:Y,alphaTest:wt,alphaHash:j,combine:D.combine,mapUv:ne&&T(D.map.channel),aoMapUv:tt&&T(D.aoMap.channel),lightMapUv:nn&&T(D.lightMap.channel),bumpMapUv:Gt&&T(D.bumpMap.channel),normalMapUv:te&&T(D.normalMap.channel),displacementMapUv:qt&&T(D.displacementMap.channel),emissiveMapUv:$&&T(D.emissiveMap.channel),metalnessMapUv:N&&T(D.metalnessMap.channel),roughnessMapUv:b&&T(D.roughnessMap.channel),anisotropyMapUv:B&&T(D.anisotropyMap.channel),clearcoatMapUv:lt&&T(D.clearcoatMap.channel),clearcoatNormalMapUv:ct&&T(D.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:Q&&T(D.clearcoatRoughnessMap.channel),iridescenceMapUv:St&&T(D.iridescenceMap.channel),iridescenceThicknessMapUv:_t&&T(D.iridescenceThicknessMap.channel),sheenColorMapUv:Mt&&T(D.sheenColorMap.channel),sheenRoughnessMapUv:Lt&&T(D.sheenRoughnessMap.channel),specularMapUv:Jt&&T(D.specularMap.channel),specularColorMapUv:Et&&T(D.specularColorMap.channel),specularIntensityMapUv:oe&&T(D.specularIntensityMap.channel),transmissionMapUv:jt&&T(D.transmissionMap.channel),thicknessMapUv:Ht&&T(D.thicknessMap.channel),alphaMapUv:Y&&T(D.alphaMap.channel),vertexTangents:!!it.attributes.tangent&&(te||R),vertexColors:D.vertexColors,vertexAlphas:D.vertexColors===!0&&!!it.attributes.color&&it.attributes.color.itemSize===4,vertexUv1s:Dt,vertexUv2s:ft,vertexUv3s:$t,pointsUvs:xt.isPoints===!0&&!!it.attributes.uv&&(ne||Y),fog:!!X,useFog:D.fog===!0,fogExp2:X&&X.isFogExp2,flatShading:D.flatShading===!0,sizeAttenuation:D.sizeAttenuation===!0,logarithmicDepthBuffer:_,skinning:xt.isSkinnedMesh===!0,morphTargets:it.morphAttributes.position!==void 0,morphNormals:it.morphAttributes.normal!==void 0,morphColors:it.morphAttributes.color!==void 0,morphTargetsCount:K,morphTextureStride:at,numDirLights:q.directional.length,numPointLights:q.point.length,numSpotLights:q.spot.length,numSpotLightMaps:q.spotLightMap.length,numRectAreaLights:q.rectArea.length,numHemiLights:q.hemi.length,numDirLightShadows:q.directionalShadowMap.length,numPointLightShadows:q.pointShadowMap.length,numSpotLightShadows:q.spotShadowMap.length,numSpotLightShadowsWithMaps:q.numSpotLightShadowsWithMaps,numLightProbes:q.numLightProbes,numClippingPlanes:f.numPlanes,numClipIntersection:f.numIntersection,dithering:D.dithering,shadowMapEnabled:r.shadowMap.enabled&&nt.length>0,shadowMapType:r.shadowMap.type,toneMapping:re,useLegacyLights:r._useLegacyLights,decodeVideoTexture:ne&&D.map.isVideoTexture===!0&&gn.getTransfer(D.map.colorSpace)===Tn,premultipliedAlpha:D.premultipliedAlpha,doubleSided:D.side===Go,flipSided:D.side===ui,useDepthPacking:D.depthPacking>=0,depthPacking:D.depthPacking||0,index0AttributeName:D.index0AttributeName,extensionDerivatives:Ut&&D.extensions.derivatives===!0,extensionFragDepth:Ut&&D.extensions.fragDepth===!0,extensionDrawBuffers:Ut&&D.extensions.drawBuffers===!0,extensionShaderTextureLOD:Ut&&D.extensions.shaderTextureLOD===!0,rendererExtensionFragDepth:g||o.has("EXT_frag_depth"),rendererExtensionDrawBuffers:g||o.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:g||o.has("EXT_shader_texture_lod"),customProgramCacheKey:D.customProgramCacheKey()}}function v(D){let q=[];if(D.shaderID?q.push(D.shaderID):(q.push(D.customVertexShaderID),q.push(D.customFragmentShaderID)),D.defines!==void 0)for(let nt in D.defines)q.push(nt),q.push(D.defines[nt]);return D.isRawShaderMaterial===!1&&(C(q,D),S(q,D),q.push(r.outputColorSpace)),q.push(D.customProgramCacheKey),q.join()}function C(D,q){D.push(q.precision),D.push(q.outputColorSpace),D.push(q.envMapMode),D.push(q.envMapCubeUVHeight),D.push(q.mapUv),D.push(q.alphaMapUv),D.push(q.lightMapUv),D.push(q.aoMapUv),D.push(q.bumpMapUv),D.push(q.normalMapUv),D.push(q.displacementMapUv),D.push(q.emissiveMapUv),D.push(q.metalnessMapUv),D.push(q.roughnessMapUv),D.push(q.anisotropyMapUv),D.push(q.clearcoatMapUv),D.push(q.clearcoatNormalMapUv),D.push(q.clearcoatRoughnessMapUv),D.push(q.iridescenceMapUv),D.push(q.iridescenceThicknessMapUv),D.push(q.sheenColorMapUv),D.push(q.sheenRoughnessMapUv),D.push(q.specularMapUv),D.push(q.specularColorMapUv),D.push(q.specularIntensityMapUv),D.push(q.transmissionMapUv),D.push(q.thicknessMapUv),D.push(q.combine),D.push(q.fogExp2),D.push(q.sizeAttenuation),D.push(q.morphTargetsCount),D.push(q.morphAttributeCount),D.push(q.numDirLights),D.push(q.numPointLights),D.push(q.numSpotLights),D.push(q.numSpotLightMaps),D.push(q.numHemiLights),D.push(q.numRectAreaLights),D.push(q.numDirLightShadows),D.push(q.numPointLightShadows),D.push(q.numSpotLightShadows),D.push(q.numSpotLightShadowsWithMaps),D.push(q.numLightProbes),D.push(q.shadowMapType),D.push(q.toneMapping),D.push(q.numClippingPlanes),D.push(q.numClipIntersection),D.push(q.depthPacking)}function S(D,q){h.disableAll(),q.isWebGL2&&h.enable(0),q.supportsVertexTextures&&h.enable(1),q.instancing&&h.enable(2),q.instancingColor&&h.enable(3),q.matcap&&h.enable(4),q.envMap&&h.enable(5),q.normalMapObjectSpace&&h.enable(6),q.normalMapTangentSpace&&h.enable(7),q.clearcoat&&h.enable(8),q.iridescence&&h.enable(9),q.alphaTest&&h.enable(10),q.vertexColors&&h.enable(11),q.vertexAlphas&&h.enable(12),q.vertexUv1s&&h.enable(13),q.vertexUv2s&&h.enable(14),q.vertexUv3s&&h.enable(15),q.vertexTangents&&h.enable(16),q.anisotropy&&h.enable(17),D.push(h.mask),h.disableAll(),q.fog&&h.enable(0),q.useFog&&h.enable(1),q.flatShading&&h.enable(2),q.logarithmicDepthBuffer&&h.enable(3),q.skinning&&h.enable(4),q.morphTargets&&h.enable(5),q.morphNormals&&h.enable(6),q.morphColors&&h.enable(7),q.premultipliedAlpha&&h.enable(8),q.shadowMapEnabled&&h.enable(9),q.useLegacyLights&&h.enable(10),q.doubleSided&&h.enable(11),q.flipSided&&h.enable(12),q.useDepthPacking&&h.enable(13),q.dithering&&h.enable(14),q.transmission&&h.enable(15),q.sheen&&h.enable(16),q.opaque&&h.enable(17),q.pointsUvs&&h.enable(18),q.decodeVideoTexture&&h.enable(19),D.push(h.mask)}function O(D){let q=w[D.type],nt;if(q){let k=lo[q];nt=qx.clone(k.uniforms)}else nt=D.uniforms;return nt}function F(D,q){let nt;for(let k=0,xt=d.length;k<xt;k++){let X=d[k];if(X.cacheKey===q){nt=X,++nt.usedTimes;break}}return nt===void 0&&(nt=new $w(r,q,D,l),d.push(nt)),nt}function G(D){if(--D.usedTimes===0){let q=d.indexOf(D);d[q]=d[d.length-1],d.pop(),D.destroy()}}function z(D){p.remove(D)}function L(){p.dispose()}return{getParameters:x,getProgramCacheKey:v,getUniforms:O,acquireProgram:F,releaseProgram:G,releaseShaderCache:z,programs:d,dispose:L}}function Qw(){let r=new WeakMap;function t(l){let f=r.get(l);return f===void 0&&(f={},r.set(l,f)),f}function e(l){r.delete(l)}function o(l,f,h){r.get(l)[f]=h}function a(){r=new WeakMap}return{get:t,remove:e,update:o,dispose:a}}function tb(r,t){return r.groupOrder!==t.groupOrder?r.groupOrder-t.groupOrder:r.renderOrder!==t.renderOrder?r.renderOrder-t.renderOrder:r.material.id!==t.material.id?r.material.id-t.material.id:r.z!==t.z?r.z-t.z:r.id-t.id}function Gg(r,t){return r.groupOrder!==t.groupOrder?r.groupOrder-t.groupOrder:r.renderOrder!==t.renderOrder?r.renderOrder-t.renderOrder:r.z!==t.z?t.z-r.z:r.id-t.id}function Vg(){let r=[],t=0,e=[],o=[],a=[];function l(){t=0,e.length=0,o.length=0,a.length=0}function f(_,y,M,w,T,x){let v=r[t];return v===void 0?(v={id:_.id,object:_,geometry:y,material:M,groupOrder:w,renderOrder:_.renderOrder,z:T,group:x},r[t]=v):(v.id=_.id,v.object=_,v.geometry=y,v.material=M,v.groupOrder=w,v.renderOrder=_.renderOrder,v.z=T,v.group=x),t++,v}function h(_,y,M,w,T,x){let v=f(_,y,M,w,T,x);M.transmission>0?o.push(v):M.transparent===!0?a.push(v):e.push(v)}function p(_,y,M,w,T,x){let v=f(_,y,M,w,T,x);M.transmission>0?o.unshift(v):M.transparent===!0?a.unshift(v):e.unshift(v)}function d(_,y){e.length>1&&e.sort(_||tb),o.length>1&&o.sort(y||Gg),a.length>1&&a.sort(y||Gg)}function g(){for(let _=t,y=r.length;_<y;_++){let M=r[_];if(M.id===null)break;M.id=null,M.object=null,M.geometry=null,M.material=null,M.group=null}}return{opaque:e,transmissive:o,transparent:a,init:l,push:h,unshift:p,finish:g,sort:d}}function eb(){let r=new WeakMap;function t(o,a){let l=r.get(o),f;return l===void 0?(f=new Vg,r.set(o,[f])):a>=l.length?(f=new Vg,l.push(f)):f=l[a],f}function e(){r=new WeakMap}return{get:t,dispose:e}}function nb(){let r={};return{get:function(t){if(r[t.id]!==void 0)return r[t.id];let e;switch(t.type){case"DirectionalLight":e={direction:new mt,color:new xn};break;case"SpotLight":e={position:new mt,direction:new mt,color:new xn,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":e={position:new mt,color:new xn,distance:0,decay:0};break;case"HemisphereLight":e={direction:new mt,skyColor:new xn,groundColor:new xn};break;case"RectAreaLight":e={color:new xn,position:new mt,halfWidth:new mt,halfHeight:new mt};break}return r[t.id]=e,e}}}function rb(){let r={};return{get:function(t){if(r[t.id]!==void 0)return r[t.id];let e;switch(t.type){case"DirectionalLight":e={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new fn};break;case"SpotLight":e={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new fn};break;case"PointLight":e={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new fn,shadowCameraNear:1,shadowCameraFar:1e3};break}return r[t.id]=e,e}}}var ib=0;function ob(r,t){return(t.castShadow?2:0)-(r.castShadow?2:0)+(t.map?1:0)-(r.map?1:0)}function sb(r,t){let e=new nb,o=rb(),a={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 g=0;g<9;g++)a.probe.push(new mt);let l=new mt,f=new zr,h=new zr;function p(g,_){let y=0,M=0,w=0;for(let k=0;k<9;k++)a.probe[k].set(0,0,0);let T=0,x=0,v=0,C=0,S=0,O=0,F=0,G=0,z=0,L=0,D=0;g.sort(ob);let q=_===!0?Math.PI:1;for(let k=0,xt=g.length;k<xt;k++){let X=g[k],it=X.color,vt=X.intensity,pt=X.distance,et=X.shadow&&X.shadow.map?X.shadow.map.texture:null;if(X.isAmbientLight)y+=it.r*vt*q,M+=it.g*vt*q,w+=it.b*vt*q;else if(X.isLightProbe){for(let ot=0;ot<9;ot++)a.probe[ot].addScaledVector(X.sh.coefficients[ot],vt);D++}else if(X.isDirectionalLight){let ot=e.get(X);if(ot.color.copy(X.color).multiplyScalar(X.intensity*q),X.castShadow){let V=X.shadow,K=o.get(X);K.shadowBias=V.bias,K.shadowNormalBias=V.normalBias,K.shadowRadius=V.radius,K.shadowMapSize=V.mapSize,a.directionalShadow[T]=K,a.directionalShadowMap[T]=et,a.directionalShadowMatrix[T]=X.shadow.matrix,O++}a.directional[T]=ot,T++}else if(X.isSpotLight){let ot=e.get(X);ot.position.setFromMatrixPosition(X.matrixWorld),ot.color.copy(it).multiplyScalar(vt*q),ot.distance=pt,ot.coneCos=Math.cos(X.angle),ot.penumbraCos=Math.cos(X.angle*(1-X.penumbra)),ot.decay=X.decay,a.spot[v]=ot;let V=X.shadow;if(X.map&&(a.spotLightMap[z]=X.map,z++,V.updateMatrices(X),X.castShadow&&L++),a.spotLightMatrix[v]=V.matrix,X.castShadow){let K=o.get(X);K.shadowBias=V.bias,K.shadowNormalBias=V.normalBias,K.shadowRadius=V.radius,K.shadowMapSize=V.mapSize,a.spotShadow[v]=K,a.spotShadowMap[v]=et,G++}v++}else if(X.isRectAreaLight){let ot=e.get(X);ot.color.copy(it).multiplyScalar(vt),ot.halfWidth.set(X.width*.5,0,0),ot.halfHeight.set(0,X.height*.5,0),a.rectArea[C]=ot,C++}else if(X.isPointLight){let ot=e.get(X);if(ot.color.copy(X.color).multiplyScalar(X.intensity*q),ot.distance=X.distance,ot.decay=X.decay,X.castShadow){let V=X.shadow,K=o.get(X);K.shadowBias=V.bias,K.shadowNormalBias=V.normalBias,K.shadowRadius=V.radius,K.shadowMapSize=V.mapSize,K.shadowCameraNear=V.camera.near,K.shadowCameraFar=V.camera.far,a.pointShadow[x]=K,a.pointShadowMap[x]=et,a.pointShadowMatrix[x]=X.shadow.matrix,F++}a.point[x]=ot,x++}else if(X.isHemisphereLight){let ot=e.get(X);ot.skyColor.copy(X.color).multiplyScalar(vt*q),ot.groundColor.copy(X.groundColor).multiplyScalar(vt*q),a.hemi[S]=ot,S++}}C>0&&(t.isWebGL2||r.has("OES_texture_float_linear")===!0?(a.rectAreaLTC1=zt.LTC_FLOAT_1,a.rectAreaLTC2=zt.LTC_FLOAT_2):r.has("OES_texture_half_float_linear")===!0?(a.rectAreaLTC1=zt.LTC_HALF_1,a.rectAreaLTC2=zt.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),a.ambient[0]=y,a.ambient[1]=M,a.ambient[2]=w;let nt=a.hash;(nt.directionalLength!==T||nt.pointLength!==x||nt.spotLength!==v||nt.rectAreaLength!==C||nt.hemiLength!==S||nt.numDirectionalShadows!==O||nt.numPointShadows!==F||nt.numSpotShadows!==G||nt.numSpotMaps!==z||nt.numLightProbes!==D)&&(a.directional.length=T,a.spot.length=v,a.rectArea.length=C,a.point.length=x,a.hemi.length=S,a.directionalShadow.length=O,a.directionalShadowMap.length=O,a.pointShadow.length=F,a.pointShadowMap.length=F,a.spotShadow.length=G,a.spotShadowMap.length=G,a.directionalShadowMatrix.length=O,a.pointShadowMatrix.length=F,a.spotLightMatrix.length=G+z-L,a.spotLightMap.length=z,a.numSpotLightShadowsWithMaps=L,a.numLightProbes=D,nt.directionalLength=T,nt.pointLength=x,nt.spotLength=v,nt.rectAreaLength=C,nt.hemiLength=S,nt.numDirectionalShadows=O,nt.numPointShadows=F,nt.numSpotShadows=G,nt.numSpotMaps=z,nt.numLightProbes=D,a.version=ib++)}function d(g,_){let y=0,M=0,w=0,T=0,x=0,v=_.matrixWorldInverse;for(let C=0,S=g.length;C<S;C++){let O=g[C];if(O.isDirectionalLight){let F=a.directional[y];F.direction.setFromMatrixPosition(O.matrixWorld),l.setFromMatrixPosition(O.target.matrixWorld),F.direction.sub(l),F.direction.transformDirection(v),y++}else if(O.isSpotLight){let F=a.spot[w];F.position.setFromMatrixPosition(O.matrixWorld),F.position.applyMatrix4(v),F.direction.setFromMatrixPosition(O.matrixWorld),l.setFromMatrixPosition(O.target.matrixWorld),F.direction.sub(l),F.direction.transformDirection(v),w++}else if(O.isRectAreaLight){let F=a.rectArea[T];F.position.setFromMatrixPosition(O.matrixWorld),F.position.applyMatrix4(v),h.identity(),f.copy(O.matrixWorld),f.premultiply(v),h.extractRotation(f),F.halfWidth.set(O.width*.5,0,0),F.halfHeight.set(0,O.height*.5,0),F.halfWidth.applyMatrix4(h),F.halfHeight.applyMatrix4(h),T++}else if(O.isPointLight){let F=a.point[M];F.position.setFromMatrixPosition(O.matrixWorld),F.position.applyMatrix4(v),M++}else if(O.isHemisphereLight){let F=a.hemi[x];F.direction.setFromMatrixPosition(O.matrixWorld),F.direction.transformDirection(v),x++}}}return{setup:p,setupView:d,state:a}}function Hg(r,t){let e=new sb(r,t),o=[],a=[];function l(){o.length=0,a.length=0}function f(_){o.push(_)}function h(_){a.push(_)}function p(_){e.setup(o,_)}function d(_){e.setupView(o,_)}return{init:l,state:{lightsArray:o,shadowsArray:a,lights:e},setupLights:p,setupLightsView:d,pushLight:f,pushShadow:h}}function ab(r,t){let e=new WeakMap;function o(l,f=0){let h=e.get(l),p;return h===void 0?(p=new Hg(r,t),e.set(l,[p])):f>=h.length?(p=new Hg(r,t),h.push(p)):p=h[f],p}function a(){e=new WeakMap}return{get:o,dispose:a}}var Th=class extends Ha{constructor(t){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=mx,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(t)}copy(t){return super.copy(t),this.depthPacking=t.depthPacking,this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this}},Ah=class extends Ha{constructor(t){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(t)}copy(t){return super.copy(t),this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this}},ub=`void main() {\n gl_Position = vec4( position, 1.0 );\n}`,lb=`uniform sampler2D shadow_pass;\nuniform vec2 resolution;\nuniform float radius;\n#include <packing>\nvoid main() {\n const float samples = float( VSM_SAMPLES );\n float mean = 0.0;\n float squared_mean = 0.0;\n float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );\n float uvStart = samples <= 1.0 ? 0.0 : - 1.0;\n for ( float i = 0.0; i < samples; i ++ ) {\n float uvOffset = uvStart + i * uvStride;\n #ifdef HORIZONTAL_PASS\n vec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) );\n mean += distribution.x;\n squared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\n #else\n float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) );\n mean += depth;\n squared_mean += depth * depth;\n #endif\n }\n mean = mean / samples;\n squared_mean = squared_mean / samples;\n float std_dev = sqrt( squared_mean - mean * mean );\n gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );\n}`;function cb(r,t,e){let o=new cc,a=new fn,l=new fn,f=new Tr,h=new Th({depthPacking:gx}),p=new Ah,d={},g=e.maxTextureSize,_={[ds]:ui,[ui]:ds,[Go]:Go},y=new Xo({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new fn},radius:{value:4}},vertexShader:ub,fragmentShader:lb}),M=y.clone();M.defines.HORIZONTAL_PASS=1;let w=new Ys;w.setAttribute("position",new Di(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));let T=new co(w,y),x=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=Wg;let v=this.type;this.render=function(F,G,z){if(x.enabled===!1||x.autoUpdate===!1&&x.needsUpdate===!1||F.length===0)return;let L=r.getRenderTarget(),D=r.getActiveCubeFace(),q=r.getActiveMipmapLevel(),nt=r.state;nt.setBlending(fs),nt.buffers.color.setClear(1,1,1,1),nt.buffers.depth.setTest(!0),nt.setScissorTest(!1);let k=v!==zo&&this.type===zo,xt=v===zo&&this.type!==zo;for(let X=0,it=F.length;X<it;X++){let vt=F[X],pt=vt.shadow;if(pt===void 0){console.warn("THREE.WebGLShadowMap:",vt,"has no shadow.");continue}if(pt.autoUpdate===!1&&pt.needsUpdate===!1)continue;a.copy(pt.mapSize);let et=pt.getFrameExtents();if(a.multiply(et),l.copy(pt.mapSize),(a.x>g||a.y>g)&&(a.x>g&&(l.x=Math.floor(g/et.x),a.x=l.x*et.x,pt.mapSize.x=l.x),a.y>g&&(l.y=Math.floor(g/et.y),a.y=l.y*et.y,pt.mapSize.y=l.y)),pt.map===null||k===!0||xt===!0){let V=this.type!==zo?{minFilter:$r,magFilter:$r}:{};pt.map!==null&&pt.map.dispose(),pt.map=new qo(a.x,a.y,V),pt.map.texture.name=vt.name+".shadowMap",pt.camera.updateProjectionMatrix()}r.setRenderTarget(pt.map),r.clear();let ot=pt.getViewportCount();for(let V=0;V<ot;V++){let K=pt.getViewport(V);f.set(l.x*K.x,l.y*K.y,l.x*K.z,l.y*K.w),nt.viewport(f),pt.updateMatrices(vt,V),o=pt.getFrustum(),O(G,z,pt.camera,vt,this.type)}pt.isPointLightShadow!==!0&&this.type===zo&&C(pt,z),pt.needsUpdate=!1}v=this.type,x.needsUpdate=!1,r.setRenderTarget(L,D,q)};function C(F,G){let z=t.update(T);y.defines.VSM_SAMPLES!==F.blurSamples&&(y.defines.VSM_SAMPLES=F.blurSamples,M.defines.VSM_SAMPLES=F.blurSamples,y.needsUpdate=!0,M.needsUpdate=!0),F.mapPass===null&&(F.mapPass=new qo(a.x,a.y)),y.uniforms.shadow_pass.value=F.map.texture,y.uniforms.resolution.value=F.mapSize,y.uniforms.radius.value=F.radius,r.setRenderTarget(F.mapPass),r.clear(),r.renderBufferDirect(G,null,z,y,T,null),M.uniforms.shadow_pass.value=F.mapPass.texture,M.uniforms.resolution.value=F.mapSize,M.uniforms.radius.value=F.radius,r.setRenderTarget(F.map),r.clear(),r.renderBufferDirect(G,null,z,M,T,null)}function S(F,G,z,L){let D=null,q=z.isPointLight===!0?F.customDistanceMaterial:F.customDepthMaterial;if(q!==void 0)D=q;else if(D=z.isPointLight===!0?p:h,r.localClippingEnabled&&G.clipShadows===!0&&Array.isArray(G.clippingPlanes)&&G.clippingPlanes.length!==0||G.displacementMap&&G.displacementScale!==0||G.alphaMap&&G.alphaTest>0||G.map&&G.alphaTest>0){let nt=D.uuid,k=G.uuid,xt=d[nt];xt===void 0&&(xt={},d[nt]=xt);let X=xt[k];X===void 0&&(X=D.clone(),xt[k]=X),D=X}if(D.visible=G.visible,D.wireframe=G.wireframe,L===zo?D.side=G.shadowSide!==null?G.shadowSide:G.side:D.side=G.shadowSide!==null?G.shadowSide:_[G.side],D.alphaMap=G.alphaMap,D.alphaTest=G.alphaTest,D.map=G.map,D.clipShadows=G.clipShadows,D.clippingPlanes=G.clippingPlanes,D.clipIntersection=G.clipIntersection,D.displacementMap=G.displacementMap,D.displacementScale=G.displacementScale,D.displacementBias=G.displacementBias,D.wireframeLinewidth=G.wireframeLinewidth,D.linewidth=G.linewidth,z.isPointLight===!0&&D.isMeshDistanceMaterial===!0){let nt=r.properties.get(D);nt.light=z}return D}function O(F,G,z,L,D){if(F.visible===!1)return;if(F.layers.test(G.layers)&&(F.isMesh||F.isLine||F.isPoints)&&(F.castShadow||F.receiveShadow&&D===zo)&&(!F.frustumCulled||o.intersectsObject(F))){F.modelViewMatrix.multiplyMatrices(z.matrixWorldInverse,F.matrixWorld);let k=t.update(F),xt=F.material;if(Array.isArray(xt)){let X=k.groups;for(let it=0,vt=X.length;it<vt;it++){let pt=X[it],et=xt[pt.materialIndex];if(et&&et.visible){let ot=S(F,et,L,D);r.renderBufferDirect(z,null,k,ot,F,pt)}}}else if(xt.visible){let X=S(F,xt,L,D);r.renderBufferDirect(z,null,k,X,F,null)}}let nt=F.children;for(let k=0,xt=nt.length;k<xt;k++)O(nt[k],G,z,L,D)}}function fb(r,t,e){let o=e.isWebGL2;function a(){let Y=!1,wt=new Tr,j=null,Ut=new Tr(0,0,0,0);return{setMask:function(Dt){j!==Dt&&!Y&&(r.colorMask(Dt,Dt,Dt,Dt),j=Dt)},setLocked:function(Dt){Y=Dt},setClear:function(Dt,ft,$t,re,mn){mn===!0&&(Dt*=re,ft*=re,$t*=re),wt.set(Dt,ft,$t,re),Ut.equals(wt)===!1&&(r.clearColor(Dt,ft,$t,re),Ut.copy(wt))},reset:function(){Y=!1,j=null,Ut.set(-1,0,0,0)}}}function l(){let Y=!1,wt=null,j=null,Ut=null;return{setTest:function(Dt){Dt?Wt(r.DEPTH_TEST):Nt(r.DEPTH_TEST)},setMask:function(Dt){wt!==Dt&&!Y&&(r.depthMask(Dt),wt=Dt)},setFunc:function(Dt){if(j!==Dt){switch(Dt){case q1:r.depthFunc(r.NEVER);break;case X1:r.depthFunc(r.ALWAYS);break;case Y1:r.depthFunc(r.LESS);break;case oh:r.depthFunc(r.LEQUAL);break;case Z1:r.depthFunc(r.EQUAL);break;case J1:r.depthFunc(r.GEQUAL);break;case $1:r.depthFunc(r.GREATER);break;case K1:r.depthFunc(r.NOTEQUAL);break;default:r.depthFunc(r.LEQUAL)}j=Dt}},setLocked:function(Dt){Y=Dt},setClear:function(Dt){Ut!==Dt&&(r.clearDepth(Dt),Ut=Dt)},reset:function(){Y=!1,wt=null,j=null,Ut=null}}}function f(){let Y=!1,wt=null,j=null,Ut=null,Dt=null,ft=null,$t=null,re=null,mn=null;return{setTest:function(He){Y||(He?Wt(r.STENCIL_TEST):Nt(r.STENCIL_TEST))},setMask:function(He){wt!==He&&!Y&&(r.stencilMask(He),wt=He)},setFunc:function(He,Mi,$n){(j!==He||Ut!==Mi||Dt!==$n)&&(r.stencilFunc(He,Mi,$n),j=He,Ut=Mi,Dt=$n)},setOp:function(He,Mi,$n){(ft!==He||$t!==Mi||re!==$n)&&(r.stencilOp(He,Mi,$n),ft=He,$t=Mi,re=$n)},setLocked:function(He){Y=He},setClear:function(He){mn!==He&&(r.clearStencil(He),mn=He)},reset:function(){Y=!1,wt=null,j=null,Ut=null,Dt=null,ft=null,$t=null,re=null,mn=null}}}let h=new a,p=new l,d=new f,g=new WeakMap,_=new WeakMap,y={},M={},w=new WeakMap,T=[],x=null,v=!1,C=null,S=null,O=null,F=null,G=null,z=null,L=null,D=!1,q=null,nt=null,k=null,xt=null,X=null,it=r.getParameter(r.MAX_COMBINED_TEXTURE_IMAGE_UNITS),vt=!1,pt=0,et=r.getParameter(r.VERSION);et.indexOf("WebGL")!==-1?(pt=parseFloat(/^WebGL (\\d)/.exec(et)[1]),vt=pt>=1):et.indexOf("OpenGL ES")!==-1&&(pt=parseFloat(/^OpenGL ES (\\d)/.exec(et)[1]),vt=pt>=2);let ot=null,V={},K=r.getParameter(r.SCISSOR_BOX),at=r.getParameter(r.VIEWPORT),Tt=new Tr().fromArray(K),dt=new Tr().fromArray(at);function Ct(Y,wt,j,Ut){let Dt=new Uint8Array(4),ft=r.createTexture();r.bindTexture(Y,ft),r.texParameteri(Y,r.TEXTURE_MIN_FILTER,r.NEAREST),r.texParameteri(Y,r.TEXTURE_MAG_FILTER,r.NEAREST);for(let $t=0;$t<j;$t++)o&&(Y===r.TEXTURE_3D||Y===r.TEXTURE_2D_ARRAY)?r.texImage3D(wt,0,r.RGBA,1,1,Ut,0,r.RGBA,r.UNSIGNED_BYTE,Dt):r.texImage2D(wt+$t,0,r.RGBA,1,1,0,r.RGBA,r.UNSIGNED_BYTE,Dt);return ft}let Yt={};Yt[r.TEXTURE_2D]=Ct(r.TEXTURE_2D,r.TEXTURE_2D,1),Yt[r.TEXTURE_CUBE_MAP]=Ct(r.TEXTURE_CUBE_MAP,r.TEXTURE_CUBE_MAP_POSITIVE_X,6),o&&(Yt[r.TEXTURE_2D_ARRAY]=Ct(r.TEXTURE_2D_ARRAY,r.TEXTURE_2D_ARRAY,1,1),Yt[r.TEXTURE_3D]=Ct(r.TEXTURE_3D,r.TEXTURE_3D,1,1)),h.setClear(0,0,0,1),p.setClear(1),d.setClear(0),Wt(r.DEPTH_TEST),p.setFunc(oh),qt(!1),$(Sm),Wt(r.CULL_FACE),Gt(fs);function Wt(Y){y[Y]!==!0&&(r.enable(Y),y[Y]=!0)}function Nt(Y){y[Y]!==!1&&(r.disable(Y),y[Y]=!1)}function ne(Y,wt){return M[Y]!==wt?(r.bindFramebuffer(Y,wt),M[Y]=wt,o&&(Y===r.DRAW_FRAMEBUFFER&&(M[r.FRAMEBUFFER]=wt),Y===r.FRAMEBUFFER&&(M[r.DRAW_FRAMEBUFFER]=wt)),!0):!1}function Pt(Y,wt){let j=T,Ut=!1;if(Y)if(j=w.get(wt),j===void 0&&(j=[],w.set(wt,j)),Y.isWebGLMultipleRenderTargets){let Dt=Y.texture;if(j.length!==Dt.length||j[0]!==r.COLOR_ATTACHMENT0){for(let ft=0,$t=Dt.length;ft<$t;ft++)j[ft]=r.COLOR_ATTACHMENT0+ft;j.length=Dt.length,Ut=!0}}else j[0]!==r.COLOR_ATTACHMENT0&&(j[0]=r.COLOR_ATTACHMENT0,Ut=!0);else j[0]!==r.BACK&&(j[0]=r.BACK,Ut=!0);Ut&&(e.isWebGL2?r.drawBuffers(j):t.get("WEBGL_draw_buffers").drawBuffersWEBGL(j))}function Xt(Y){return x!==Y?(r.useProgram(Y),x=Y,!0):!1}let tt={[Na]:r.FUNC_ADD,[O1]:r.FUNC_SUBTRACT,[D1]:r.FUNC_REVERSE_SUBTRACT};if(o)tt[Am]=r.MIN,tt[Cm]=r.MAX;else{let Y=t.get("EXT_blend_minmax");Y!==null&&(tt[Am]=Y.MIN_EXT,tt[Cm]=Y.MAX_EXT)}let nn={[F1]:r.ZERO,[U1]:r.ONE,[B1]:r.SRC_COLOR,[qg]:r.SRC_ALPHA,[W1]:r.SRC_ALPHA_SATURATE,[V1]:r.DST_COLOR,[k1]:r.DST_ALPHA,[z1]:r.ONE_MINUS_SRC_COLOR,[Xg]:r.ONE_MINUS_SRC_ALPHA,[H1]:r.ONE_MINUS_DST_COLOR,[G1]:r.ONE_MINUS_DST_ALPHA};function Gt(Y,wt,j,Ut,Dt,ft,$t,re){if(Y===fs){v===!0&&(Nt(r.BLEND),v=!1);return}if(v===!1&&(Wt(r.BLEND),v=!0),Y!==N1){if(Y!==C||re!==D){if((S!==Na||G!==Na)&&(r.blendEquation(r.FUNC_ADD),S=Na,G=Na),re)switch(Y){case Ua:r.blendFuncSeparate(r.ONE,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA);break;case wm:r.blendFunc(r.ONE,r.ONE);break;case bm:r.blendFuncSeparate(r.ZERO,r.ONE_MINUS_SRC_COLOR,r.ZERO,r.ONE);break;case Tm:r.blendFuncSeparate(r.ZERO,r.SRC_COLOR,r.ZERO,r.SRC_ALPHA);break;default:console.error("THREE.WebGLState: Invalid blending: ",Y);break}else switch(Y){case Ua:r.blendFuncSeparate(r.SRC_ALPHA,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA);break;case wm:r.blendFunc(r.SRC_ALPHA,r.ONE);break;case bm:r.blendFuncSeparate(r.ZERO,r.ONE_MINUS_SRC_COLOR,r.ZERO,r.ONE);break;case Tm:r.blendFunc(r.ZERO,r.SRC_COLOR);break;default:console.error("THREE.WebGLState: Invalid blending: ",Y);break}O=null,F=null,z=null,L=null,C=Y,D=re}return}Dt=Dt||wt,ft=ft||j,$t=$t||Ut,(wt!==S||Dt!==G)&&(r.blendEquationSeparate(tt[wt],tt[Dt]),S=wt,G=Dt),(j!==O||Ut!==F||ft!==z||$t!==L)&&(r.blendFuncSeparate(nn[j],nn[Ut],nn[ft],nn[$t]),O=j,F=Ut,z=ft,L=$t),C=Y,D=!1}function te(Y,wt){Y.side===Go?Nt(r.CULL_FACE):Wt(r.CULL_FACE);let j=Y.side===ui;wt&&(j=!j),qt(j),Y.blending===Ua&&Y.transparent===!1?Gt(fs):Gt(Y.blending,Y.blendEquation,Y.blendSrc,Y.blendDst,Y.blendEquationAlpha,Y.blendSrcAlpha,Y.blendDstAlpha,Y.premultipliedAlpha),p.setFunc(Y.depthFunc),p.setTest(Y.depthTest),p.setMask(Y.depthWrite),h.setMask(Y.colorWrite);let Ut=Y.stencilWrite;d.setTest(Ut),Ut&&(d.setMask(Y.stencilWriteMask),d.setFunc(Y.stencilFunc,Y.stencilRef,Y.stencilFuncMask),d.setOp(Y.stencilFail,Y.stencilZFail,Y.stencilZPass)),b(Y.polygonOffset,Y.polygonOffsetFactor,Y.polygonOffsetUnits),Y.alphaToCoverage===!0?Wt(r.SAMPLE_ALPHA_TO_COVERAGE):Nt(r.SAMPLE_ALPHA_TO_COVERAGE)}function qt(Y){q!==Y&&(Y?r.frontFace(r.CW):r.frontFace(r.CCW),q=Y)}function $(Y){Y!==I1?(Wt(r.CULL_FACE),Y!==nt&&(Y===Sm?r.cullFace(r.BACK):Y===R1?r.cullFace(r.FRONT):r.cullFace(r.FRONT_AND_BACK))):Nt(r.CULL_FACE),nt=Y}function N(Y){Y!==k&&(vt&&r.lineWidth(Y),k=Y)}function b(Y,wt,j){Y?(Wt(r.POLYGON_OFFSET_FILL),(xt!==wt||X!==j)&&(r.polygonOffset(wt,j),xt=wt,X=j)):Nt(r.POLYGON_OFFSET_FILL)}function R(Y){Y?Wt(r.SCISSOR_TEST):Nt(r.SCISSOR_TEST)}function W(Y){Y===void 0&&(Y=r.TEXTURE0+it-1),ot!==Y&&(r.activeTexture(Y),ot=Y)}function J(Y,wt,j){j===void 0&&(ot===null?j=r.TEXTURE0+it-1:j=ot);let Ut=V[j];Ut===void 0&&(Ut={type:void 0,texture:void 0},V[j]=Ut),(Ut.type!==Y||Ut.texture!==wt)&&(ot!==j&&(r.activeTexture(j),ot=j),r.bindTexture(Y,wt||Yt[Y]),Ut.type=Y,Ut.texture=wt)}function I(){let Y=V[ot];Y!==void 0&&Y.type!==void 0&&(r.bindTexture(Y.type,null),Y.type=void 0,Y.texture=void 0)}function P(){try{r.compressedTexImage2D.apply(r,arguments)}catch(Y){console.error("THREE.WebGLState:",Y)}}function B(){try{r.compressedTexImage3D.apply(r,arguments)}catch(Y){console.error("THREE.WebGLState:",Y)}}function lt(){try{r.texSubImage2D.apply(r,arguments)}catch(Y){console.error("THREE.WebGLState:",Y)}}function ct(){try{r.texSubImage3D.apply(r,arguments)}catch(Y){console.error("THREE.WebGLState:",Y)}}function Q(){try{r.compressedTexSubImage2D.apply(r,arguments)}catch(Y){console.error("THREE.WebGLState:",Y)}}function St(){try{r.compressedTexSubImage3D.apply(r,arguments)}catch(Y){console.error("THREE.WebGLState:",Y)}}function _t(){try{r.texStorage2D.apply(r,arguments)}catch(Y){console.error("THREE.WebGLState:",Y)}}function Mt(){try{r.texStorage3D.apply(r,arguments)}catch(Y){console.error("THREE.WebGLState:",Y)}}function Lt(){try{r.texImage2D.apply(r,arguments)}catch(Y){console.error("THREE.WebGLState:",Y)}}function Jt(){try{r.texImage3D.apply(r,arguments)}catch(Y){console.error("THREE.WebGLState:",Y)}}function Et(Y){Tt.equals(Y)===!1&&(r.scissor(Y.x,Y.y,Y.z,Y.w),Tt.copy(Y))}function oe(Y){dt.equals(Y)===!1&&(r.viewport(Y.x,Y.y,Y.z,Y.w),dt.copy(Y))}function jt(Y,wt){let j=_.get(wt);j===void 0&&(j=new WeakMap,_.set(wt,j));let Ut=j.get(Y);Ut===void 0&&(Ut=r.getUniformBlockIndex(wt,Y.name),j.set(Y,Ut))}function Ht(Y,wt){let Ut=_.get(wt).get(Y);g.get(wt)!==Ut&&(r.uniformBlockBinding(wt,Ut,Y.__bindingPointIndex),g.set(wt,Ut))}function Ot(){r.disable(r.BLEND),r.disable(r.CULL_FACE),r.disable(r.DEPTH_TEST),r.disable(r.POLYGON_OFFSET_FILL),r.disable(r.SCISSOR_TEST),r.disable(r.STENCIL_TEST),r.disable(r.SAMPLE_ALPHA_TO_COVERAGE),r.blendEquation(r.FUNC_ADD),r.blendFunc(r.ONE,r.ZERO),r.blendFuncSeparate(r.ONE,r.ZERO,r.ONE,r.ZERO),r.colorMask(!0,!0,!0,!0),r.clearColor(0,0,0,0),r.depthMask(!0),r.depthFunc(r.LESS),r.clearDepth(1),r.stencilMask(4294967295),r.stencilFunc(r.ALWAYS,0,4294967295),r.stencilOp(r.KEEP,r.KEEP,r.KEEP),r.clearStencil(0),r.cullFace(r.BACK),r.frontFace(r.CCW),r.polygonOffset(0,0),r.activeTexture(r.TEXTURE0),r.bindFramebuffer(r.FRAMEBUFFER,null),o===!0&&(r.bindFramebuffer(r.DRAW_FRAMEBUFFER,null),r.bindFramebuffer(r.READ_FRAMEBUFFER,null)),r.useProgram(null),r.lineWidth(1),r.scissor(0,0,r.canvas.width,r.canvas.height),r.viewport(0,0,r.canvas.width,r.canvas.height),y={},ot=null,V={},M={},w=new WeakMap,T=[],x=null,v=!1,C=null,S=null,O=null,F=null,G=null,z=null,L=null,D=!1,q=null,nt=null,k=null,xt=null,X=null,Tt.set(0,0,r.canvas.width,r.canvas.height),dt.set(0,0,r.canvas.width,r.canvas.height),h.reset(),p.reset(),d.reset()}return{buffers:{color:h,depth:p,stencil:d},enable:Wt,disable:Nt,bindFramebuffer:ne,drawBuffers:Pt,useProgram:Xt,setBlending:Gt,setMaterial:te,setFlipSided:qt,setCullFace:$,setLineWidth:N,setPolygonOffset:b,setScissorTest:R,activeTexture:W,bindTexture:J,unbindTexture:I,compressedTexImage2D:P,compressedTexImage3D:B,texImage2D:Lt,texImage3D:Jt,updateUBOMapping:jt,uniformBlockBinding:Ht,texStorage2D:_t,texStorage3D:Mt,texSubImage2D:lt,texSubImage3D:ct,compressedTexSubImage2D:Q,compressedTexSubImage3D:St,scissor:Et,viewport:oe,reset:Ot}}function hb(r,t,e,o,a,l,f){let h=a.isWebGL2,p=a.maxTextures,d=a.maxCubemapSize,g=a.maxTextureSize,_=a.maxSamples,y=t.has("WEBGL_multisampled_render_to_texture")?t.get("WEBGL_multisampled_render_to_texture"):null,M=typeof navigator=="undefined"?!1:/OculusBrowser/g.test(navigator.userAgent),w=new WeakMap,T,x=new WeakMap,v=!1;try{v=typeof OffscreenCanvas!="undefined"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch(I){}function C(I,P){return v?new OffscreenCanvas(I,P):Ql("canvas")}function S(I,P,B,lt){let ct=1;if((I.width>lt||I.height>lt)&&(ct=lt/Math.max(I.width,I.height)),ct<1||P===!0)if(typeof HTMLImageElement!="undefined"&&I instanceof HTMLImageElement||typeof HTMLCanvasElement!="undefined"&&I instanceof HTMLCanvasElement||typeof ImageBitmap!="undefined"&&I instanceof ImageBitmap){let Q=P?hh:Math.floor,St=Q(ct*I.width),_t=Q(ct*I.height);T===void 0&&(T=C(St,_t));let Mt=B?C(St,_t):T;return Mt.width=St,Mt.height=_t,Mt.getContext("2d").drawImage(I,0,0,St,_t),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+I.width+"x"+I.height+") to ("+St+"x"+_t+")."),Mt}else return"data"in I&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+I.width+"x"+I.height+")."),I;return I}function O(I){return sg(I.width)&&sg(I.height)}function F(I){return h?!1:I.wrapS!==Ji||I.wrapT!==Ji||I.minFilter!==$r&&I.minFilter!==Ni}function G(I,P){return I.generateMipmaps&&P&&I.minFilter!==$r&&I.minFilter!==Ni}function z(I){r.generateMipmap(I)}function L(I,P,B,lt,ct=!1){if(h===!1)return P;if(I!==null){if(r[I]!==void 0)return r[I];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format \'"+I+"\'")}let Q=P;if(P===r.RED&&(B===r.FLOAT&&(Q=r.R32F),B===r.HALF_FLOAT&&(Q=r.R16F),B===r.UNSIGNED_BYTE&&(Q=r.R8)),P===r.RED_INTEGER&&(B===r.UNSIGNED_BYTE&&(Q=r.R8UI),B===r.UNSIGNED_SHORT&&(Q=r.R16UI),B===r.UNSIGNED_INT&&(Q=r.R32UI),B===r.BYTE&&(Q=r.R8I),B===r.SHORT&&(Q=r.R16I),B===r.INT&&(Q=r.R32I)),P===r.RG&&(B===r.FLOAT&&(Q=r.RG32F),B===r.HALF_FLOAT&&(Q=r.RG16F),B===r.UNSIGNED_BYTE&&(Q=r.RG8)),P===r.RGBA){let St=ct?Jl:gn.getTransfer(lt);B===r.FLOAT&&(Q=r.RGBA32F),B===r.HALF_FLOAT&&(Q=r.RGBA16F),B===r.UNSIGNED_BYTE&&(Q=St===Tn?r.SRGB8_ALPHA8:r.RGBA8),B===r.UNSIGNED_SHORT_4_4_4_4&&(Q=r.RGBA4),B===r.UNSIGNED_SHORT_5_5_5_1&&(Q=r.RGB5_A1)}return(Q===r.R16F||Q===r.R32F||Q===r.RG16F||Q===r.RG32F||Q===r.RGBA16F||Q===r.RGBA32F)&&t.get("EXT_color_buffer_float"),Q}function D(I,P,B){return G(I,B)===!0||I.isFramebufferTexture&&I.minFilter!==$r&&I.minFilter!==Ni?Math.log2(Math.max(P.width,P.height))+1:I.mipmaps!==void 0&&I.mipmaps.length>0?I.mipmaps.length:I.isCompressedTexture&&Array.isArray(I.image)?P.mipmaps.length:1}function q(I){return I===$r||I===Pm||I===Pf?r.NEAREST:r.LINEAR}function nt(I){let P=I.target;P.removeEventListener("dispose",nt),xt(P),P.isVideoTexture&&w.delete(P)}function k(I){let P=I.target;P.removeEventListener("dispose",k),it(P)}function xt(I){let P=o.get(I);if(P.__webglInit===void 0)return;let B=I.source,lt=x.get(B);if(lt){let ct=lt[P.__cacheKey];ct.usedTimes--,ct.usedTimes===0&&X(I),Object.keys(lt).length===0&&x.delete(B)}o.remove(I)}function X(I){let P=o.get(I);r.deleteTexture(P.__webglTexture);let B=I.source,lt=x.get(B);delete lt[P.__cacheKey],f.memory.textures--}function it(I){let P=I.texture,B=o.get(I),lt=o.get(P);if(lt.__webglTexture!==void 0&&(r.deleteTexture(lt.__webglTexture),f.memory.textures--),I.depthTexture&&I.depthTexture.dispose(),I.isWebGLCubeRenderTarget)for(let ct=0;ct<6;ct++){if(Array.isArray(B.__webglFramebuffer[ct]))for(let Q=0;Q<B.__webglFramebuffer[ct].length;Q++)r.deleteFramebuffer(B.__webglFramebuffer[ct][Q]);else r.deleteFramebuffer(B.__webglFramebuffer[ct]);B.__webglDepthbuffer&&r.deleteRenderbuffer(B.__webglDepthbuffer[ct])}else{if(Array.isArray(B.__webglFramebuffer))for(let ct=0;ct<B.__webglFramebuffer.length;ct++)r.deleteFramebuffer(B.__webglFramebuffer[ct]);else r.deleteFramebuffer(B.__webglFramebuffer);if(B.__webglDepthbuffer&&r.deleteRenderbuffer(B.__webglDepthbuffer),B.__webglMultisampledFramebuffer&&r.deleteFramebuffer(B.__webglMultisampledFramebuffer),B.__webglColorRenderbuffer)for(let ct=0;ct<B.__webglColorRenderbuffer.length;ct++)B.__webglColorRenderbuffer[ct]&&r.deleteRenderbuffer(B.__webglColorRenderbuffer[ct]);B.__webglDepthRenderbuffer&&r.deleteRenderbuffer(B.__webglDepthRenderbuffer)}if(I.isWebGLMultipleRenderTargets)for(let ct=0,Q=P.length;ct<Q;ct++){let St=o.get(P[ct]);St.__webglTexture&&(r.deleteTexture(St.__webglTexture),f.memory.textures--),o.remove(P[ct])}o.remove(P),o.remove(I)}let vt=0;function pt(){vt=0}function et(){let I=vt;return I>=p&&console.warn("THREE.WebGLTextures: Trying to use "+I+" texture units while this GPU supports only "+p),vt+=1,I}function ot(I){let P=[];return P.push(I.wrapS),P.push(I.wrapT),P.push(I.wrapR||0),P.push(I.magFilter),P.push(I.minFilter),P.push(I.anisotropy),P.push(I.internalFormat),P.push(I.format),P.push(I.type),P.push(I.generateMipmaps),P.push(I.premultiplyAlpha),P.push(I.flipY),P.push(I.unpackAlignment),P.push(I.colorSpace),P.join()}function V(I,P){let B=o.get(I);if(I.isVideoTexture&&W(I),I.isRenderTargetTexture===!1&&I.version>0&&B.__version!==I.version){let lt=I.image;if(lt===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(lt.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{ne(B,I,P);return}}e.bindTexture(r.TEXTURE_2D,B.__webglTexture,r.TEXTURE0+P)}function K(I,P){let B=o.get(I);if(I.version>0&&B.__version!==I.version){ne(B,I,P);return}e.bindTexture(r.TEXTURE_2D_ARRAY,B.__webglTexture,r.TEXTURE0+P)}function at(I,P){let B=o.get(I);if(I.version>0&&B.__version!==I.version){ne(B,I,P);return}e.bindTexture(r.TEXTURE_3D,B.__webglTexture,r.TEXTURE0+P)}function Tt(I,P){let B=o.get(I);if(I.version>0&&B.__version!==I.version){Pt(B,I,P);return}e.bindTexture(r.TEXTURE_CUBE_MAP,B.__webglTexture,r.TEXTURE0+P)}let dt={[uh]:r.REPEAT,[Ji]:r.CLAMP_TO_EDGE,[lh]:r.MIRRORED_REPEAT},Ct={[$r]:r.NEAREST,[Pm]:r.NEAREST_MIPMAP_NEAREST,[Pf]:r.NEAREST_MIPMAP_LINEAR,[Ni]:r.LINEAR,[ox]:r.LINEAR_MIPMAP_NEAREST,[Du]:r.LINEAR_MIPMAP_LINEAR},Yt={[xx]:r.NEVER,[Ax]:r.ALWAYS,[Ex]:r.LESS,[Sx]:r.LEQUAL,[Mx]:r.EQUAL,[Tx]:r.GEQUAL,[wx]:r.GREATER,[bx]:r.NOTEQUAL};function Wt(I,P,B){if(B?(r.texParameteri(I,r.TEXTURE_WRAP_S,dt[P.wrapS]),r.texParameteri(I,r.TEXTURE_WRAP_T,dt[P.wrapT]),(I===r.TEXTURE_3D||I===r.TEXTURE_2D_ARRAY)&&r.texParameteri(I,r.TEXTURE_WRAP_R,dt[P.wrapR]),r.texParameteri(I,r.TEXTURE_MAG_FILTER,Ct[P.magFilter]),r.texParameteri(I,r.TEXTURE_MIN_FILTER,Ct[P.minFilter])):(r.texParameteri(I,r.TEXTURE_WRAP_S,r.CLAMP_TO_EDGE),r.texParameteri(I,r.TEXTURE_WRAP_T,r.CLAMP_TO_EDGE),(I===r.TEXTURE_3D||I===r.TEXTURE_2D_ARRAY)&&r.texParameteri(I,r.TEXTURE_WRAP_R,r.CLAMP_TO_EDGE),(P.wrapS!==Ji||P.wrapT!==Ji)&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),r.texParameteri(I,r.TEXTURE_MAG_FILTER,q(P.magFilter)),r.texParameteri(I,r.TEXTURE_MIN_FILTER,q(P.minFilter)),P.minFilter!==$r&&P.minFilter!==Ni&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),P.compareFunction&&(r.texParameteri(I,r.TEXTURE_COMPARE_MODE,r.COMPARE_REF_TO_TEXTURE),r.texParameteri(I,r.TEXTURE_COMPARE_FUNC,Yt[P.compareFunction])),t.has("EXT_texture_filter_anisotropic")===!0){let lt=t.get("EXT_texture_filter_anisotropic");if(P.magFilter===$r||P.minFilter!==Pf&&P.minFilter!==Du||P.type===cs&&t.has("OES_texture_float_linear")===!1||h===!1&&P.type===Fu&&t.has("OES_texture_half_float_linear")===!1)return;(P.anisotropy>1||o.get(P).__currentAnisotropy)&&(r.texParameterf(I,lt.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(P.anisotropy,a.getMaxAnisotropy())),o.get(P).__currentAnisotropy=P.anisotropy)}}function Nt(I,P){let B=!1;I.__webglInit===void 0&&(I.__webglInit=!0,P.addEventListener("dispose",nt));let lt=P.source,ct=x.get(lt);ct===void 0&&(ct={},x.set(lt,ct));let Q=ot(P);if(Q!==I.__cacheKey){ct[Q]===void 0&&(ct[Q]={texture:r.createTexture(),usedTimes:0},f.memory.textures++,B=!0),ct[Q].usedTimes++;let St=ct[I.__cacheKey];St!==void 0&&(ct[I.__cacheKey].usedTimes--,St.usedTimes===0&&X(P)),I.__cacheKey=Q,I.__webglTexture=ct[Q].texture}return B}function ne(I,P,B){let lt=r.TEXTURE_2D;(P.isDataArrayTexture||P.isCompressedArrayTexture)&&(lt=r.TEXTURE_2D_ARRAY),P.isData3DTexture&&(lt=r.TEXTURE_3D);let ct=Nt(I,P),Q=P.source;e.bindTexture(lt,I.__webglTexture,r.TEXTURE0+B);let St=o.get(Q);if(Q.version!==St.__version||ct===!0){e.activeTexture(r.TEXTURE0+B);let _t=gn.getPrimaries(gn.workingColorSpace),Mt=P.colorSpace===Oi?null:gn.getPrimaries(P.colorSpace),Lt=P.colorSpace===Oi||_t===Mt?r.NONE:r.BROWSER_DEFAULT_WEBGL;r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,P.flipY),r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,P.premultiplyAlpha),r.pixelStorei(r.UNPACK_ALIGNMENT,P.unpackAlignment),r.pixelStorei(r.UNPACK_COLORSPACE_CONVERSION_WEBGL,Lt);let Jt=F(P)&&O(P.image)===!1,Et=S(P.image,Jt,!1,g);Et=J(P,Et);let oe=O(Et)||h,jt=l.convert(P.format,P.colorSpace),Ht=l.convert(P.type),Ot=L(P.internalFormat,jt,Ht,P.colorSpace,P.isVideoTexture);Wt(lt,P,oe);let Y,wt=P.mipmaps,j=h&&P.isVideoTexture!==!0,Ut=St.__version===void 0||ct===!0,Dt=D(P,Et,oe);if(P.isDepthTexture)Ot=r.DEPTH_COMPONENT,h?P.type===cs?Ot=r.DEPTH_COMPONENT32F:P.type===ls?Ot=r.DEPTH_COMPONENT24:P.type===Hs?Ot=r.DEPTH24_STENCIL8:Ot=r.DEPTH_COMPONENT16:P.type===cs&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),P.format===Ws&&Ot===r.DEPTH_COMPONENT&&P.type!==Wh&&P.type!==ls&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),P.type=ls,Ht=l.convert(P.type)),P.format===Va&&Ot===r.DEPTH_COMPONENT&&(Ot=r.DEPTH_STENCIL,P.type!==Hs&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),P.type=Hs,Ht=l.convert(P.type))),Ut&&(j?e.texStorage2D(r.TEXTURE_2D,1,Ot,Et.width,Et.height):e.texImage2D(r.TEXTURE_2D,0,Ot,Et.width,Et.height,0,jt,Ht,null));else if(P.isDataTexture)if(wt.length>0&&oe){j&&Ut&&e.texStorage2D(r.TEXTURE_2D,Dt,Ot,wt[0].width,wt[0].height);for(let ft=0,$t=wt.length;ft<$t;ft++)Y=wt[ft],j?e.texSubImage2D(r.TEXTURE_2D,ft,0,0,Y.width,Y.height,jt,Ht,Y.data):e.texImage2D(r.TEXTURE_2D,ft,Ot,Y.width,Y.height,0,jt,Ht,Y.data);P.generateMipmaps=!1}else j?(Ut&&e.texStorage2D(r.TEXTURE_2D,Dt,Ot,Et.width,Et.height),e.texSubImage2D(r.TEXTURE_2D,0,0,0,Et.width,Et.height,jt,Ht,Et.data)):e.texImage2D(r.TEXTURE_2D,0,Ot,Et.width,Et.height,0,jt,Ht,Et.data);else if(P.isCompressedTexture)if(P.isCompressedArrayTexture){j&&Ut&&e.texStorage3D(r.TEXTURE_2D_ARRAY,Dt,Ot,wt[0].width,wt[0].height,Et.depth);for(let ft=0,$t=wt.length;ft<$t;ft++)Y=wt[ft],P.format!==$i?jt!==null?j?e.compressedTexSubImage3D(r.TEXTURE_2D_ARRAY,ft,0,0,0,Y.width,Y.height,Et.depth,jt,Y.data,0,0):e.compressedTexImage3D(r.TEXTURE_2D_ARRAY,ft,Ot,Y.width,Y.height,Et.depth,0,Y.data,0,0):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):j?e.texSubImage3D(r.TEXTURE_2D_ARRAY,ft,0,0,0,Y.width,Y.height,Et.depth,jt,Ht,Y.data):e.texImage3D(r.TEXTURE_2D_ARRAY,ft,Ot,Y.width,Y.height,Et.depth,0,jt,Ht,Y.data)}else{j&&Ut&&e.texStorage2D(r.TEXTURE_2D,Dt,Ot,wt[0].width,wt[0].height);for(let ft=0,$t=wt.length;ft<$t;ft++)Y=wt[ft],P.format!==$i?jt!==null?j?e.compressedTexSubImage2D(r.TEXTURE_2D,ft,0,0,Y.width,Y.height,jt,Y.data):e.compressedTexImage2D(r.TEXTURE_2D,ft,Ot,Y.width,Y.height,0,Y.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):j?e.texSubImage2D(r.TEXTURE_2D,ft,0,0,Y.width,Y.height,jt,Ht,Y.data):e.texImage2D(r.TEXTURE_2D,ft,Ot,Y.width,Y.height,0,jt,Ht,Y.data)}else if(P.isDataArrayTexture)j?(Ut&&e.texStorage3D(r.TEXTURE_2D_ARRAY,Dt,Ot,Et.width,Et.height,Et.depth),e.texSubImage3D(r.TEXTURE_2D_ARRAY,0,0,0,0,Et.width,Et.height,Et.depth,jt,Ht,Et.data)):e.texImage3D(r.TEXTURE_2D_ARRAY,0,Ot,Et.width,Et.height,Et.depth,0,jt,Ht,Et.data);else if(P.isData3DTexture)j?(Ut&&e.texStorage3D(r.TEXTURE_3D,Dt,Ot,Et.width,Et.height,Et.depth),e.texSubImage3D(r.TEXTURE_3D,0,0,0,0,Et.width,Et.height,Et.depth,jt,Ht,Et.data)):e.texImage3D(r.TEXTURE_3D,0,Ot,Et.width,Et.height,Et.depth,0,jt,Ht,Et.data);else if(P.isFramebufferTexture){if(Ut)if(j)e.texStorage2D(r.TEXTURE_2D,Dt,Ot,Et.width,Et.height);else{let ft=Et.width,$t=Et.height;for(let re=0;re<Dt;re++)e.texImage2D(r.TEXTURE_2D,re,Ot,ft,$t,0,jt,Ht,null),ft>>=1,$t>>=1}}else if(wt.length>0&&oe){j&&Ut&&e.texStorage2D(r.TEXTURE_2D,Dt,Ot,wt[0].width,wt[0].height);for(let ft=0,$t=wt.length;ft<$t;ft++)Y=wt[ft],j?e.texSubImage2D(r.TEXTURE_2D,ft,0,0,jt,Ht,Y):e.texImage2D(r.TEXTURE_2D,ft,Ot,jt,Ht,Y);P.generateMipmaps=!1}else j?(Ut&&e.texStorage2D(r.TEXTURE_2D,Dt,Ot,Et.width,Et.height),e.texSubImage2D(r.TEXTURE_2D,0,0,0,jt,Ht,Et)):e.texImage2D(r.TEXTURE_2D,0,Ot,jt,Ht,Et);G(P,oe)&&z(lt),St.__version=Q.version,P.onUpdate&&P.onUpdate(P)}I.__version=P.version}function Pt(I,P,B){if(P.image.length!==6)return;let lt=Nt(I,P),ct=P.source;e.bindTexture(r.TEXTURE_CUBE_MAP,I.__webglTexture,r.TEXTURE0+B);let Q=o.get(ct);if(ct.version!==Q.__version||lt===!0){e.activeTexture(r.TEXTURE0+B);let St=gn.getPrimaries(gn.workingColorSpace),_t=P.colorSpace===Oi?null:gn.getPrimaries(P.colorSpace),Mt=P.colorSpace===Oi||St===_t?r.NONE:r.BROWSER_DEFAULT_WEBGL;r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,P.flipY),r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,P.premultiplyAlpha),r.pixelStorei(r.UNPACK_ALIGNMENT,P.unpackAlignment),r.pixelStorei(r.UNPACK_COLORSPACE_CONVERSION_WEBGL,Mt);let Lt=P.isCompressedTexture||P.image[0].isCompressedTexture,Jt=P.image[0]&&P.image[0].isDataTexture,Et=[];for(let ft=0;ft<6;ft++)!Lt&&!Jt?Et[ft]=S(P.image[ft],!1,!0,d):Et[ft]=Jt?P.image[ft].image:P.image[ft],Et[ft]=J(P,Et[ft]);let oe=Et[0],jt=O(oe)||h,Ht=l.convert(P.format,P.colorSpace),Ot=l.convert(P.type),Y=L(P.internalFormat,Ht,Ot,P.colorSpace),wt=h&&P.isVideoTexture!==!0,j=Q.__version===void 0||lt===!0,Ut=D(P,oe,jt);Wt(r.TEXTURE_CUBE_MAP,P,jt);let Dt;if(Lt){wt&&j&&e.texStorage2D(r.TEXTURE_CUBE_MAP,Ut,Y,oe.width,oe.height);for(let ft=0;ft<6;ft++){Dt=Et[ft].mipmaps;for(let $t=0;$t<Dt.length;$t++){let re=Dt[$t];P.format!==$i?Ht!==null?wt?e.compressedTexSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+ft,$t,0,0,re.width,re.height,Ht,re.data):e.compressedTexImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+ft,$t,Y,re.width,re.height,0,re.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):wt?e.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+ft,$t,0,0,re.width,re.height,Ht,Ot,re.data):e.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+ft,$t,Y,re.width,re.height,0,Ht,Ot,re.data)}}}else{Dt=P.mipmaps,wt&&j&&(Dt.length>0&&Ut++,e.texStorage2D(r.TEXTURE_CUBE_MAP,Ut,Y,Et[0].width,Et[0].height));for(let ft=0;ft<6;ft++)if(Jt){wt?e.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+ft,0,0,0,Et[ft].width,Et[ft].height,Ht,Ot,Et[ft].data):e.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+ft,0,Y,Et[ft].width,Et[ft].height,0,Ht,Ot,Et[ft].data);for(let $t=0;$t<Dt.length;$t++){let mn=Dt[$t].image[ft].image;wt?e.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+ft,$t+1,0,0,mn.width,mn.height,Ht,Ot,mn.data):e.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+ft,$t+1,Y,mn.width,mn.height,0,Ht,Ot,mn.data)}}else{wt?e.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+ft,0,0,0,Ht,Ot,Et[ft]):e.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+ft,0,Y,Ht,Ot,Et[ft]);for(let $t=0;$t<Dt.length;$t++){let re=Dt[$t];wt?e.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+ft,$t+1,0,0,Ht,Ot,re.image[ft]):e.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+ft,$t+1,Y,Ht,Ot,re.image[ft])}}}G(P,jt)&&z(r.TEXTURE_CUBE_MAP),Q.__version=ct.version,P.onUpdate&&P.onUpdate(P)}I.__version=P.version}function Xt(I,P,B,lt,ct,Q){let St=l.convert(B.format,B.colorSpace),_t=l.convert(B.type),Mt=L(B.internalFormat,St,_t,B.colorSpace);if(!o.get(P).__hasExternalTextures){let Jt=Math.max(1,P.width>>Q),Et=Math.max(1,P.height>>Q);ct===r.TEXTURE_3D||ct===r.TEXTURE_2D_ARRAY?e.texImage3D(ct,Q,Mt,Jt,Et,P.depth,0,St,_t,null):e.texImage2D(ct,Q,Mt,Jt,Et,0,St,_t,null)}e.bindFramebuffer(r.FRAMEBUFFER,I),R(P)?y.framebufferTexture2DMultisampleEXT(r.FRAMEBUFFER,lt,ct,o.get(B).__webglTexture,0,b(P)):(ct===r.TEXTURE_2D||ct>=r.TEXTURE_CUBE_MAP_POSITIVE_X&&ct<=r.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&r.framebufferTexture2D(r.FRAMEBUFFER,lt,ct,o.get(B).__webglTexture,Q),e.bindFramebuffer(r.FRAMEBUFFER,null)}function tt(I,P,B){if(r.bindRenderbuffer(r.RENDERBUFFER,I),P.depthBuffer&&!P.stencilBuffer){let lt=h===!0?r.DEPTH_COMPONENT24:r.DEPTH_COMPONENT16;if(B||R(P)){let ct=P.depthTexture;ct&&ct.isDepthTexture&&(ct.type===cs?lt=r.DEPTH_COMPONENT32F:ct.type===ls&&(lt=r.DEPTH_COMPONENT24));let Q=b(P);R(P)?y.renderbufferStorageMultisampleEXT(r.RENDERBUFFER,Q,lt,P.width,P.height):r.renderbufferStorageMultisample(r.RENDERBUFFER,Q,lt,P.width,P.height)}else r.renderbufferStorage(r.RENDERBUFFER,lt,P.width,P.height);r.framebufferRenderbuffer(r.FRAMEBUFFER,r.DEPTH_ATTACHMENT,r.RENDERBUFFER,I)}else if(P.depthBuffer&&P.stencilBuffer){let lt=b(P);B&&R(P)===!1?r.renderbufferStorageMultisample(r.RENDERBUFFER,lt,r.DEPTH24_STENCIL8,P.width,P.height):R(P)?y.renderbufferStorageMultisampleEXT(r.RENDERBUFFER,lt,r.DEPTH24_STENCIL8,P.width,P.height):r.renderbufferStorage(r.RENDERBUFFER,r.DEPTH_STENCIL,P.width,P.height),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.DEPTH_STENCIL_ATTACHMENT,r.RENDERBUFFER,I)}else{let lt=P.isWebGLMultipleRenderTargets===!0?P.texture:[P.texture];for(let ct=0;ct<lt.length;ct++){let Q=lt[ct],St=l.convert(Q.format,Q.colorSpace),_t=l.convert(Q.type),Mt=L(Q.internalFormat,St,_t,Q.colorSpace),Lt=b(P);B&&R(P)===!1?r.renderbufferStorageMultisample(r.RENDERBUFFER,Lt,Mt,P.width,P.height):R(P)?y.renderbufferStorageMultisampleEXT(r.RENDERBUFFER,Lt,Mt,P.width,P.height):r.renderbufferStorage(r.RENDERBUFFER,Mt,P.width,P.height)}}r.bindRenderbuffer(r.RENDERBUFFER,null)}function nn(I,P){if(P&&P.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(e.bindFramebuffer(r.FRAMEBUFFER,I),!(P.depthTexture&&P.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");(!o.get(P.depthTexture).__webglTexture||P.depthTexture.image.width!==P.width||P.depthTexture.image.height!==P.height)&&(P.depthTexture.image.width=P.width,P.depthTexture.image.height=P.height,P.depthTexture.needsUpdate=!0),V(P.depthTexture,0);let lt=o.get(P.depthTexture).__webglTexture,ct=b(P);if(P.depthTexture.format===Ws)R(P)?y.framebufferTexture2DMultisampleEXT(r.FRAMEBUFFER,r.DEPTH_ATTACHMENT,r.TEXTURE_2D,lt,0,ct):r.framebufferTexture2D(r.FRAMEBUFFER,r.DEPTH_ATTACHMENT,r.TEXTURE_2D,lt,0);else if(P.depthTexture.format===Va)R(P)?y.framebufferTexture2DMultisampleEXT(r.FRAMEBUFFER,r.DEPTH_STENCIL_ATTACHMENT,r.TEXTURE_2D,lt,0,ct):r.framebufferTexture2D(r.FRAMEBUFFER,r.DEPTH_STENCIL_ATTACHMENT,r.TEXTURE_2D,lt,0);else throw new Error("Unknown depthTexture format")}function Gt(I){let P=o.get(I),B=I.isWebGLCubeRenderTarget===!0;if(I.depthTexture&&!P.__autoAllocateDepthBuffer){if(B)throw new Error("target.depthTexture not supported in Cube render targets");nn(P.__webglFramebuffer,I)}else if(B){P.__webglDepthbuffer=[];for(let lt=0;lt<6;lt++)e.bindFramebuffer(r.FRAMEBUFFER,P.__webglFramebuffer[lt]),P.__webglDepthbuffer[lt]=r.createRenderbuffer(),tt(P.__webglDepthbuffer[lt],I,!1)}else e.bindFramebuffer(r.FRAMEBUFFER,P.__webglFramebuffer),P.__webglDepthbuffer=r.createRenderbuffer(),tt(P.__webglDepthbuffer,I,!1);e.bindFramebuffer(r.FRAMEBUFFER,null)}function te(I,P,B){let lt=o.get(I);P!==void 0&&Xt(lt.__webglFramebuffer,I,I.texture,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,0),B!==void 0&&Gt(I)}function qt(I){let P=I.texture,B=o.get(I),lt=o.get(P);I.addEventListener("dispose",k),I.isWebGLMultipleRenderTargets!==!0&&(lt.__webglTexture===void 0&&(lt.__webglTexture=r.createTexture()),lt.__version=P.version,f.memory.textures++);let ct=I.isWebGLCubeRenderTarget===!0,Q=I.isWebGLMultipleRenderTargets===!0,St=O(I)||h;if(ct){B.__webglFramebuffer=[];for(let _t=0;_t<6;_t++)if(h&&P.mipmaps&&P.mipmaps.length>0){B.__webglFramebuffer[_t]=[];for(let Mt=0;Mt<P.mipmaps.length;Mt++)B.__webglFramebuffer[_t][Mt]=r.createFramebuffer()}else B.__webglFramebuffer[_t]=r.createFramebuffer()}else{if(h&&P.mipmaps&&P.mipmaps.length>0){B.__webglFramebuffer=[];for(let _t=0;_t<P.mipmaps.length;_t++)B.__webglFramebuffer[_t]=r.createFramebuffer()}else B.__webglFramebuffer=r.createFramebuffer();if(Q)if(a.drawBuffers){let _t=I.texture;for(let Mt=0,Lt=_t.length;Mt<Lt;Mt++){let Jt=o.get(_t[Mt]);Jt.__webglTexture===void 0&&(Jt.__webglTexture=r.createTexture(),f.memory.textures++)}}else console.warn("THREE.WebGLRenderer: WebGLMultipleRenderTargets can only be used with WebGL2 or WEBGL_draw_buffers extension.");if(h&&I.samples>0&&R(I)===!1){let _t=Q?P:[P];B.__webglMultisampledFramebuffer=r.createFramebuffer(),B.__webglColorRenderbuffer=[],e.bindFramebuffer(r.FRAMEBUFFER,B.__webglMultisampledFramebuffer);for(let Mt=0;Mt<_t.length;Mt++){let Lt=_t[Mt];B.__webglColorRenderbuffer[Mt]=r.createRenderbuffer(),r.bindRenderbuffer(r.RENDERBUFFER,B.__webglColorRenderbuffer[Mt]);let Jt=l.convert(Lt.format,Lt.colorSpace),Et=l.convert(Lt.type),oe=L(Lt.internalFormat,Jt,Et,Lt.colorSpace,I.isXRRenderTarget===!0),jt=b(I);r.renderbufferStorageMultisample(r.RENDERBUFFER,jt,oe,I.width,I.height),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0+Mt,r.RENDERBUFFER,B.__webglColorRenderbuffer[Mt])}r.bindRenderbuffer(r.RENDERBUFFER,null),I.depthBuffer&&(B.__webglDepthRenderbuffer=r.createRenderbuffer(),tt(B.__webglDepthRenderbuffer,I,!0)),e.bindFramebuffer(r.FRAMEBUFFER,null)}}if(ct){e.bindTexture(r.TEXTURE_CUBE_MAP,lt.__webglTexture),Wt(r.TEXTURE_CUBE_MAP,P,St);for(let _t=0;_t<6;_t++)if(h&&P.mipmaps&&P.mipmaps.length>0)for(let Mt=0;Mt<P.mipmaps.length;Mt++)Xt(B.__webglFramebuffer[_t][Mt],I,P,r.COLOR_ATTACHMENT0,r.TEXTURE_CUBE_MAP_POSITIVE_X+_t,Mt);else Xt(B.__webglFramebuffer[_t],I,P,r.COLOR_ATTACHMENT0,r.TEXTURE_CUBE_MAP_POSITIVE_X+_t,0);G(P,St)&&z(r.TEXTURE_CUBE_MAP),e.unbindTexture()}else if(Q){let _t=I.texture;for(let Mt=0,Lt=_t.length;Mt<Lt;Mt++){let Jt=_t[Mt],Et=o.get(Jt);e.bindTexture(r.TEXTURE_2D,Et.__webglTexture),Wt(r.TEXTURE_2D,Jt,St),Xt(B.__webglFramebuffer,I,Jt,r.COLOR_ATTACHMENT0+Mt,r.TEXTURE_2D,0),G(Jt,St)&&z(r.TEXTURE_2D)}e.unbindTexture()}else{let _t=r.TEXTURE_2D;if((I.isWebGL3DRenderTarget||I.isWebGLArrayRenderTarget)&&(h?_t=I.isWebGL3DRenderTarget?r.TEXTURE_3D:r.TEXTURE_2D_ARRAY:console.error("THREE.WebGLTextures: THREE.Data3DTexture and THREE.DataArrayTexture only supported with WebGL2.")),e.bindTexture(_t,lt.__webglTexture),Wt(_t,P,St),h&&P.mipmaps&&P.mipmaps.length>0)for(let Mt=0;Mt<P.mipmaps.length;Mt++)Xt(B.__webglFramebuffer[Mt],I,P,r.COLOR_ATTACHMENT0,_t,Mt);else Xt(B.__webglFramebuffer,I,P,r.COLOR_ATTACHMENT0,_t,0);G(P,St)&&z(_t),e.unbindTexture()}I.depthBuffer&&Gt(I)}function $(I){let P=O(I)||h,B=I.isWebGLMultipleRenderTargets===!0?I.texture:[I.texture];for(let lt=0,ct=B.length;lt<ct;lt++){let Q=B[lt];if(G(Q,P)){let St=I.isWebGLCubeRenderTarget?r.TEXTURE_CUBE_MAP:r.TEXTURE_2D,_t=o.get(Q).__webglTexture;e.bindTexture(St,_t),z(St),e.unbindTexture()}}}function N(I){if(h&&I.samples>0&&R(I)===!1){let P=I.isWebGLMultipleRenderTargets?I.texture:[I.texture],B=I.width,lt=I.height,ct=r.COLOR_BUFFER_BIT,Q=[],St=I.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT,_t=o.get(I),Mt=I.isWebGLMultipleRenderTargets===!0;if(Mt)for(let Lt=0;Lt<P.length;Lt++)e.bindFramebuffer(r.FRAMEBUFFER,_t.__webglMultisampledFramebuffer),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0+Lt,r.RENDERBUFFER,null),e.bindFramebuffer(r.FRAMEBUFFER,_t.__webglFramebuffer),r.framebufferTexture2D(r.DRAW_FRAMEBUFFER,r.COLOR_ATTACHMENT0+Lt,r.TEXTURE_2D,null,0);e.bindFramebuffer(r.READ_FRAMEBUFFER,_t.__webglMultisampledFramebuffer),e.bindFramebuffer(r.DRAW_FRAMEBUFFER,_t.__webglFramebuffer);for(let Lt=0;Lt<P.length;Lt++){Q.push(r.COLOR_ATTACHMENT0+Lt),I.depthBuffer&&Q.push(St);let Jt=_t.__ignoreDepthValues!==void 0?_t.__ignoreDepthValues:!1;if(Jt===!1&&(I.depthBuffer&&(ct|=r.DEPTH_BUFFER_BIT),I.stencilBuffer&&(ct|=r.STENCIL_BUFFER_BIT)),Mt&&r.framebufferRenderbuffer(r.READ_FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.RENDERBUFFER,_t.__webglColorRenderbuffer[Lt]),Jt===!0&&(r.invalidateFramebuffer(r.READ_FRAMEBUFFER,[St]),r.invalidateFramebuffer(r.DRAW_FRAMEBUFFER,[St])),Mt){let Et=o.get(P[Lt]).__webglTexture;r.framebufferTexture2D(r.DRAW_FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,Et,0)}r.blitFramebuffer(0,0,B,lt,0,0,B,lt,ct,r.NEAREST),M&&r.invalidateFramebuffer(r.READ_FRAMEBUFFER,Q)}if(e.bindFramebuffer(r.READ_FRAMEBUFFER,null),e.bindFramebuffer(r.DRAW_FRAMEBUFFER,null),Mt)for(let Lt=0;Lt<P.length;Lt++){e.bindFramebuffer(r.FRAMEBUFFER,_t.__webglMultisampledFramebuffer),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0+Lt,r.RENDERBUFFER,_t.__webglColorRenderbuffer[Lt]);let Jt=o.get(P[Lt]).__webglTexture;e.bindFramebuffer(r.FRAMEBUFFER,_t.__webglFramebuffer),r.framebufferTexture2D(r.DRAW_FRAMEBUFFER,r.COLOR_ATTACHMENT0+Lt,r.TEXTURE_2D,Jt,0)}e.bindFramebuffer(r.DRAW_FRAMEBUFFER,_t.__webglMultisampledFramebuffer)}}function b(I){return Math.min(_,I.samples)}function R(I){let P=o.get(I);return h&&I.samples>0&&t.has("WEBGL_multisampled_render_to_texture")===!0&&P.__useRenderToTexture!==!1}function W(I){let P=f.render.frame;w.get(I)!==P&&(w.set(I,P),I.update())}function J(I,P){let B=I.colorSpace,lt=I.format,ct=I.type;return I.isCompressedTexture===!0||I.isVideoTexture===!0||I.format===ch||B!==Wo&&B!==Oi&&(gn.getTransfer(B)===Tn?h===!1?t.has("EXT_sRGB")===!0&<===$i?(I.format=ch,I.minFilter=Ni,I.generateMipmaps=!1):P=tc.sRGBToLinear(P):(lt!==$i||ct!==ps)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",B)),P}this.allocateTextureUnit=et,this.resetTextureUnits=pt,this.setTexture2D=V,this.setTexture2DArray=K,this.setTexture3D=at,this.setTextureCube=Tt,this.rebindTextures=te,this.setupRenderTarget=qt,this.updateRenderTargetMipmap=$,this.updateMultisampleRenderTarget=N,this.setupDepthRenderbuffer=Gt,this.setupFrameBufferTexture=Xt,this.useMultisampledRTT=R}function pb(r,t,e){let o=e.isWebGL2;function a(l,f=Oi){let h,p=gn.getTransfer(f);if(l===ps)return r.UNSIGNED_BYTE;if(l===$g)return r.UNSIGNED_SHORT_4_4_4_4;if(l===Kg)return r.UNSIGNED_SHORT_5_5_5_1;if(l===sx)return r.BYTE;if(l===ax)return r.SHORT;if(l===Wh)return r.UNSIGNED_SHORT;if(l===Jg)return r.INT;if(l===ls)return r.UNSIGNED_INT;if(l===cs)return r.FLOAT;if(l===Fu)return o?r.HALF_FLOAT:(h=t.get("OES_texture_half_float"),h!==null?h.HALF_FLOAT_OES:null);if(l===ux)return r.ALPHA;if(l===$i)return r.RGBA;if(l===lx)return r.LUMINANCE;if(l===cx)return r.LUMINANCE_ALPHA;if(l===Ws)return r.DEPTH_COMPONENT;if(l===Va)return r.DEPTH_STENCIL;if(l===ch)return h=t.get("EXT_sRGB"),h!==null?h.SRGB_ALPHA_EXT:null;if(l===fx)return r.RED;if(l===jg)return r.RED_INTEGER;if(l===hx)return r.RG;if(l===Qg)return r.RG_INTEGER;if(l===t0)return r.RGBA_INTEGER;if(l===If||l===Rf||l===Lf||l===Nf)if(p===Tn)if(h=t.get("WEBGL_compressed_texture_s3tc_srgb"),h!==null){if(l===If)return h.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(l===Rf)return h.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(l===Lf)return h.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(l===Nf)return h.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(h=t.get("WEBGL_compressed_texture_s3tc"),h!==null){if(l===If)return h.COMPRESSED_RGB_S3TC_DXT1_EXT;if(l===Rf)return h.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(l===Lf)return h.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(l===Nf)return h.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(l===Im||l===Rm||l===Lm||l===Nm)if(h=t.get("WEBGL_compressed_texture_pvrtc"),h!==null){if(l===Im)return h.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(l===Rm)return h.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(l===Lm)return h.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(l===Nm)return h.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(l===px)return h=t.get("WEBGL_compressed_texture_etc1"),h!==null?h.COMPRESSED_RGB_ETC1_WEBGL:null;if(l===Om||l===Dm)if(h=t.get("WEBGL_compressed_texture_etc"),h!==null){if(l===Om)return p===Tn?h.COMPRESSED_SRGB8_ETC2:h.COMPRESSED_RGB8_ETC2;if(l===Dm)return p===Tn?h.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:h.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(l===Fm||l===Um||l===Bm||l===zm||l===km||l===Gm||l===Vm||l===Hm||l===Wm||l===qm||l===Xm||l===Ym||l===Zm||l===Jm)if(h=t.get("WEBGL_compressed_texture_astc"),h!==null){if(l===Fm)return p===Tn?h.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:h.COMPRESSED_RGBA_ASTC_4x4_KHR;if(l===Um)return p===Tn?h.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:h.COMPRESSED_RGBA_ASTC_5x4_KHR;if(l===Bm)return p===Tn?h.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:h.COMPRESSED_RGBA_ASTC_5x5_KHR;if(l===zm)return p===Tn?h.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:h.COMPRESSED_RGBA_ASTC_6x5_KHR;if(l===km)return p===Tn?h.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:h.COMPRESSED_RGBA_ASTC_6x6_KHR;if(l===Gm)return p===Tn?h.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:h.COMPRESSED_RGBA_ASTC_8x5_KHR;if(l===Vm)return p===Tn?h.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:h.COMPRESSED_RGBA_ASTC_8x6_KHR;if(l===Hm)return p===Tn?h.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:h.COMPRESSED_RGBA_ASTC_8x8_KHR;if(l===Wm)return p===Tn?h.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:h.COMPRESSED_RGBA_ASTC_10x5_KHR;if(l===qm)return p===Tn?h.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:h.COMPRESSED_RGBA_ASTC_10x6_KHR;if(l===Xm)return p===Tn?h.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:h.COMPRESSED_RGBA_ASTC_10x8_KHR;if(l===Ym)return p===Tn?h.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:h.COMPRESSED_RGBA_ASTC_10x10_KHR;if(l===Zm)return p===Tn?h.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:h.COMPRESSED_RGBA_ASTC_12x10_KHR;if(l===Jm)return p===Tn?h.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:h.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(l===Of||l===$m||l===Km)if(h=t.get("EXT_texture_compression_bptc"),h!==null){if(l===Of)return p===Tn?h.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:h.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(l===$m)return h.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(l===Km)return h.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(l===dx||l===jm||l===Qm||l===tg)if(h=t.get("EXT_texture_compression_rgtc"),h!==null){if(l===Of)return h.COMPRESSED_RED_RGTC1_EXT;if(l===jm)return h.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(l===Qm)return h.COMPRESSED_RED_GREEN_RGTC2_EXT;if(l===tg)return h.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return l===Hs?o?r.UNSIGNED_INT_24_8:(h=t.get("WEBGL_depth_texture"),h!==null?h.UNSIGNED_INT_24_8_WEBGL:null):r[l]!==void 0?r[l]:null}return{convert:a}}var Ch=class extends xi{constructor(t=[]){super(),this.isArrayCamera=!0,this.cameras=t}},Fa=class extends fo{constructor(){super(),this.isGroup=!0,this.type="Group"}},db={type:"move"},Ou=class{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new Fa,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 Fa,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new mt,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new mt),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new Fa,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new mt,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new mt),this._grip}dispatchEvent(t){return this._targetRay!==null&&this._targetRay.dispatchEvent(t),this._grip!==null&&this._grip.dispatchEvent(t),this._hand!==null&&this._hand.dispatchEvent(t),this}connect(t){if(t&&t.hand){let e=this._hand;if(e)for(let o of t.hand.values())this._getHandJoint(e,o)}return this.dispatchEvent({type:"connected",data:t}),this}disconnect(t){return this.dispatchEvent({type:"disconnected",data:t}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(t,e,o){let a=null,l=null,f=null,h=this._targetRay,p=this._grip,d=this._hand;if(t&&e.session.visibilityState!=="visible-blurred"){if(d&&t.hand){f=!0;for(let T of t.hand.values()){let x=e.getJointPose(T,o),v=this._getHandJoint(d,T);x!==null&&(v.matrix.fromArray(x.transform.matrix),v.matrix.decompose(v.position,v.rotation,v.scale),v.matrixWorldNeedsUpdate=!0,v.jointRadius=x.radius),v.visible=x!==null}let g=d.joints["index-finger-tip"],_=d.joints["thumb-tip"],y=g.position.distanceTo(_.position),M=.02,w=.005;d.inputState.pinching&&y>M+w?(d.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:t.handedness,target:this})):!d.inputState.pinching&&y<=M-w&&(d.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:t.handedness,target:this}))}else p!==null&&t.gripSpace&&(l=e.getPose(t.gripSpace,o),l!==null&&(p.matrix.fromArray(l.transform.matrix),p.matrix.decompose(p.position,p.rotation,p.scale),p.matrixWorldNeedsUpdate=!0,l.linearVelocity?(p.hasLinearVelocity=!0,p.linearVelocity.copy(l.linearVelocity)):p.hasLinearVelocity=!1,l.angularVelocity?(p.hasAngularVelocity=!0,p.angularVelocity.copy(l.angularVelocity)):p.hasAngularVelocity=!1));h!==null&&(a=e.getPose(t.targetRaySpace,o),a===null&&l!==null&&(a=l),a!==null&&(h.matrix.fromArray(a.transform.matrix),h.matrix.decompose(h.position,h.rotation,h.scale),h.matrixWorldNeedsUpdate=!0,a.linearVelocity?(h.hasLinearVelocity=!0,h.linearVelocity.copy(a.linearVelocity)):h.hasLinearVelocity=!1,a.angularVelocity?(h.hasAngularVelocity=!0,h.angularVelocity.copy(a.angularVelocity)):h.hasAngularVelocity=!1,this.dispatchEvent(db)))}return h!==null&&(h.visible=a!==null),p!==null&&(p.visible=l!==null),d!==null&&(d.visible=f!==null),this}_getHandJoint(t,e){if(t.joints[e.jointName]===void 0){let o=new Fa;o.matrixAutoUpdate=!1,o.visible=!1,t.joints[e.jointName]=o,t.add(o)}return t.joints[e.jointName]}},Ph=class extends Ki{constructor(t,e,o,a,l,f,h,p,d,g){if(g=g!==void 0?g:Ws,g!==Ws&&g!==Va)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");o===void 0&&g===Ws&&(o=ls),o===void 0&&g===Va&&(o=Hs),super(null,a,l,f,h,p,g,o,d),this.isDepthTexture=!0,this.image={width:t,height:e},this.magFilter=h!==void 0?h:$r,this.minFilter=p!==void 0?p:$r,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(t){return super.copy(t),this.compareFunction=t.compareFunction,this}toJSON(t){let e=super.toJSON(t);return this.compareFunction!==null&&(e.compareFunction=this.compareFunction),e}},Ih=class extends ms{constructor(t,e){super();let o=this,a=null,l=1,f=null,h="local-floor",p=1,d=null,g=null,_=null,y=null,M=null,w=null,T=e.getContextAttributes(),x=null,v=null,C=[],S=[],O=new xi;O.layers.enable(1),O.viewport=new Tr;let F=new xi;F.layers.enable(2),F.viewport=new Tr;let G=[O,F],z=new Ch;z.layers.enable(1),z.layers.enable(2);let L=null,D=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(K){let at=C[K];return at===void 0&&(at=new Ou,C[K]=at),at.getTargetRaySpace()},this.getControllerGrip=function(K){let at=C[K];return at===void 0&&(at=new Ou,C[K]=at),at.getGripSpace()},this.getHand=function(K){let at=C[K];return at===void 0&&(at=new Ou,C[K]=at),at.getHandSpace()};function q(K){let at=S.indexOf(K.inputSource);if(at===-1)return;let Tt=C[at];Tt!==void 0&&(Tt.update(K.inputSource,K.frame,d||f),Tt.dispatchEvent({type:K.type,data:K.inputSource}))}function nt(){a.removeEventListener("select",q),a.removeEventListener("selectstart",q),a.removeEventListener("selectend",q),a.removeEventListener("squeeze",q),a.removeEventListener("squeezestart",q),a.removeEventListener("squeezeend",q),a.removeEventListener("end",nt),a.removeEventListener("inputsourceschange",k);for(let K=0;K<C.length;K++){let at=S[K];at!==null&&(S[K]=null,C[K].disconnect(at))}L=null,D=null,t.setRenderTarget(x),M=null,y=null,_=null,a=null,v=null,V.stop(),o.isPresenting=!1,o.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(K){l=K,o.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(K){h=K,o.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return d||f},this.setReferenceSpace=function(K){d=K},this.getBaseLayer=function(){return y!==null?y:M},this.getBinding=function(){return _},this.getFrame=function(){return w},this.getSession=function(){return a},this.setSession=async function(K){if(a=K,a!==null){if(x=t.getRenderTarget(),a.addEventListener("select",q),a.addEventListener("selectstart",q),a.addEventListener("selectend",q),a.addEventListener("squeeze",q),a.addEventListener("squeezestart",q),a.addEventListener("squeezeend",q),a.addEventListener("end",nt),a.addEventListener("inputsourceschange",k),T.xrCompatible!==!0&&await e.makeXRCompatible(),a.renderState.layers===void 0||t.capabilities.isWebGL2===!1){let at={antialias:a.renderState.layers===void 0?T.antialias:!0,alpha:!0,depth:T.depth,stencil:T.stencil,framebufferScaleFactor:l};M=new XRWebGLLayer(a,e,at),a.updateRenderState({baseLayer:M}),v=new qo(M.framebufferWidth,M.framebufferHeight,{format:$i,type:ps,colorSpace:t.outputColorSpace,stencilBuffer:T.stencil})}else{let at=null,Tt=null,dt=null;T.depth&&(dt=T.stencil?e.DEPTH24_STENCIL8:e.DEPTH_COMPONENT24,at=T.stencil?Va:Ws,Tt=T.stencil?Hs:ls);let Ct={colorFormat:e.RGBA8,depthFormat:dt,scaleFactor:l};_=new XRWebGLBinding(a,e),y=_.createProjectionLayer(Ct),a.updateRenderState({layers:[y]}),v=new qo(y.textureWidth,y.textureHeight,{format:$i,type:ps,depthTexture:new Ph(y.textureWidth,y.textureHeight,Tt,void 0,void 0,void 0,void 0,void 0,void 0,at),stencilBuffer:T.stencil,colorSpace:t.outputColorSpace,samples:T.antialias?4:0});let Yt=t.properties.get(v);Yt.__ignoreDepthValues=y.ignoreDepthValues}v.isXRRenderTarget=!0,this.setFoveation(p),d=null,f=await a.requestReferenceSpace(h),V.setContext(a),V.start(),o.isPresenting=!0,o.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(a!==null)return a.environmentBlendMode};function k(K){for(let at=0;at<K.removed.length;at++){let Tt=K.removed[at],dt=S.indexOf(Tt);dt>=0&&(S[dt]=null,C[dt].disconnect(Tt))}for(let at=0;at<K.added.length;at++){let Tt=K.added[at],dt=S.indexOf(Tt);if(dt===-1){for(let Yt=0;Yt<C.length;Yt++)if(Yt>=S.length){S.push(Tt),dt=Yt;break}else if(S[Yt]===null){S[Yt]=Tt,dt=Yt;break}if(dt===-1)break}let Ct=C[dt];Ct&&Ct.connect(Tt)}}let xt=new mt,X=new mt;function it(K,at,Tt){xt.setFromMatrixPosition(at.matrixWorld),X.setFromMatrixPosition(Tt.matrixWorld);let dt=xt.distanceTo(X),Ct=at.projectionMatrix.elements,Yt=Tt.projectionMatrix.elements,Wt=Ct[14]/(Ct[10]-1),Nt=Ct[14]/(Ct[10]+1),ne=(Ct[9]+1)/Ct[5],Pt=(Ct[9]-1)/Ct[5],Xt=(Ct[8]-1)/Ct[0],tt=(Yt[8]+1)/Yt[0],nn=Wt*Xt,Gt=Wt*tt,te=dt/(-Xt+tt),qt=te*-Xt;at.matrixWorld.decompose(K.position,K.quaternion,K.scale),K.translateX(qt),K.translateZ(te),K.matrixWorld.compose(K.position,K.quaternion,K.scale),K.matrixWorldInverse.copy(K.matrixWorld).invert();let $=Wt+te,N=Nt+te,b=nn-qt,R=Gt+(dt-qt),W=ne*Nt/N*$,J=Pt*Nt/N*$;K.projectionMatrix.makePerspective(b,R,W,J,$,N),K.projectionMatrixInverse.copy(K.projectionMatrix).invert()}function vt(K,at){at===null?K.matrixWorld.copy(K.matrix):K.matrixWorld.multiplyMatrices(at.matrixWorld,K.matrix),K.matrixWorldInverse.copy(K.matrixWorld).invert()}this.updateCamera=function(K){if(a===null)return;z.near=F.near=O.near=K.near,z.far=F.far=O.far=K.far,(L!==z.near||D!==z.far)&&(a.updateRenderState({depthNear:z.near,depthFar:z.far}),L=z.near,D=z.far);let at=K.parent,Tt=z.cameras;vt(z,at);for(let dt=0;dt<Tt.length;dt++)vt(Tt[dt],at);Tt.length===2?it(z,O,F):z.projectionMatrix.copy(O.projectionMatrix),pt(K,z,at)};function pt(K,at,Tt){Tt===null?K.matrix.copy(at.matrixWorld):(K.matrix.copy(Tt.matrixWorld),K.matrix.invert(),K.matrix.multiply(at.matrixWorld)),K.matrix.decompose(K.position,K.quaternion,K.scale),K.updateMatrixWorld(!0),K.projectionMatrix.copy(at.projectionMatrix),K.projectionMatrixInverse.copy(at.projectionMatrixInverse),K.isPerspectiveCamera&&(K.fov=fh*2*Math.atan(1/K.projectionMatrix.elements[5]),K.zoom=1)}this.getCamera=function(){return z},this.getFoveation=function(){if(!(y===null&&M===null))return p},this.setFoveation=function(K){p=K,y!==null&&(y.fixedFoveation=K),M!==null&&M.fixedFoveation!==void 0&&(M.fixedFoveation=K)};let et=null;function ot(K,at){if(g=at.getViewerPose(d||f),w=at,g!==null){let Tt=g.views;M!==null&&(t.setRenderTargetFramebuffer(v,M.framebuffer),t.setRenderTarget(v));let dt=!1;Tt.length!==z.cameras.length&&(z.cameras.length=0,dt=!0);for(let Ct=0;Ct<Tt.length;Ct++){let Yt=Tt[Ct],Wt=null;if(M!==null)Wt=M.getViewport(Yt);else{let ne=_.getViewSubImage(y,Yt);Wt=ne.viewport,Ct===0&&(t.setRenderTargetTextures(v,ne.colorTexture,y.ignoreDepthValues?void 0:ne.depthStencilTexture),t.setRenderTarget(v))}let Nt=G[Ct];Nt===void 0&&(Nt=new xi,Nt.layers.enable(Ct),Nt.viewport=new Tr,G[Ct]=Nt),Nt.matrix.fromArray(Yt.transform.matrix),Nt.matrix.decompose(Nt.position,Nt.quaternion,Nt.scale),Nt.projectionMatrix.fromArray(Yt.projectionMatrix),Nt.projectionMatrixInverse.copy(Nt.projectionMatrix).invert(),Nt.viewport.set(Wt.x,Wt.y,Wt.width,Wt.height),Ct===0&&(z.matrix.copy(Nt.matrix),z.matrix.decompose(z.position,z.quaternion,z.scale)),dt===!0&&z.cameras.push(Nt)}}for(let Tt=0;Tt<C.length;Tt++){let dt=S[Tt],Ct=C[Tt];dt!==null&&Ct!==void 0&&Ct.update(dt,at,d||f)}et&&et(K,at),at.detectedPlanes&&o.dispatchEvent({type:"planesdetected",data:at}),w=null}let V=new o0;V.setAnimationLoop(ot),this.setAnimationLoop=function(K){et=K},this.dispose=function(){}}};function mb(r,t){function e(x,v){x.matrixAutoUpdate===!0&&x.updateMatrix(),v.value.copy(x.matrix)}function o(x,v){v.color.getRGB(x.fogColor.value,i0(r)),v.isFog?(x.fogNear.value=v.near,x.fogFar.value=v.far):v.isFogExp2&&(x.fogDensity.value=v.density)}function a(x,v,C,S,O){v.isMeshBasicMaterial||v.isMeshLambertMaterial?l(x,v):v.isMeshToonMaterial?(l(x,v),_(x,v)):v.isMeshPhongMaterial?(l(x,v),g(x,v)):v.isMeshStandardMaterial?(l(x,v),y(x,v),v.isMeshPhysicalMaterial&&M(x,v,O)):v.isMeshMatcapMaterial?(l(x,v),w(x,v)):v.isMeshDepthMaterial?l(x,v):v.isMeshDistanceMaterial?(l(x,v),T(x,v)):v.isMeshNormalMaterial?l(x,v):v.isLineBasicMaterial?(f(x,v),v.isLineDashedMaterial&&h(x,v)):v.isPointsMaterial?p(x,v,C,S):v.isSpriteMaterial?d(x,v):v.isShadowMaterial?(x.color.value.copy(v.color),x.opacity.value=v.opacity):v.isShaderMaterial&&(v.uniformsNeedUpdate=!1)}function l(x,v){x.opacity.value=v.opacity,v.color&&x.diffuse.value.copy(v.color),v.emissive&&x.emissive.value.copy(v.emissive).multiplyScalar(v.emissiveIntensity),v.map&&(x.map.value=v.map,e(v.map,x.mapTransform)),v.alphaMap&&(x.alphaMap.value=v.alphaMap,e(v.alphaMap,x.alphaMapTransform)),v.bumpMap&&(x.bumpMap.value=v.bumpMap,e(v.bumpMap,x.bumpMapTransform),x.bumpScale.value=v.bumpScale,v.side===ui&&(x.bumpScale.value*=-1)),v.normalMap&&(x.normalMap.value=v.normalMap,e(v.normalMap,x.normalMapTransform),x.normalScale.value.copy(v.normalScale),v.side===ui&&x.normalScale.value.negate()),v.displacementMap&&(x.displacementMap.value=v.displacementMap,e(v.displacementMap,x.displacementMapTransform),x.displacementScale.value=v.displacementScale,x.displacementBias.value=v.displacementBias),v.emissiveMap&&(x.emissiveMap.value=v.emissiveMap,e(v.emissiveMap,x.emissiveMapTransform)),v.specularMap&&(x.specularMap.value=v.specularMap,e(v.specularMap,x.specularMapTransform)),v.alphaTest>0&&(x.alphaTest.value=v.alphaTest);let C=t.get(v).envMap;if(C&&(x.envMap.value=C,x.flipEnvMap.value=C.isCubeTexture&&C.isRenderTargetTexture===!1?-1:1,x.reflectivity.value=v.reflectivity,x.ior.value=v.ior,x.refractionRatio.value=v.refractionRatio),v.lightMap){x.lightMap.value=v.lightMap;let S=r._useLegacyLights===!0?Math.PI:1;x.lightMapIntensity.value=v.lightMapIntensity*S,e(v.lightMap,x.lightMapTransform)}v.aoMap&&(x.aoMap.value=v.aoMap,x.aoMapIntensity.value=v.aoMapIntensity,e(v.aoMap,x.aoMapTransform))}function f(x,v){x.diffuse.value.copy(v.color),x.opacity.value=v.opacity,v.map&&(x.map.value=v.map,e(v.map,x.mapTransform))}function h(x,v){x.dashSize.value=v.dashSize,x.totalSize.value=v.dashSize+v.gapSize,x.scale.value=v.scale}function p(x,v,C,S){x.diffuse.value.copy(v.color),x.opacity.value=v.opacity,x.size.value=v.size*C,x.scale.value=S*.5,v.map&&(x.map.value=v.map,e(v.map,x.uvTransform)),v.alphaMap&&(x.alphaMap.value=v.alphaMap,e(v.alphaMap,x.alphaMapTransform)),v.alphaTest>0&&(x.alphaTest.value=v.alphaTest)}function d(x,v){x.diffuse.value.copy(v.color),x.opacity.value=v.opacity,x.rotation.value=v.rotation,v.map&&(x.map.value=v.map,e(v.map,x.mapTransform)),v.alphaMap&&(x.alphaMap.value=v.alphaMap,e(v.alphaMap,x.alphaMapTransform)),v.alphaTest>0&&(x.alphaTest.value=v.alphaTest)}function g(x,v){x.specular.value.copy(v.specular),x.shininess.value=Math.max(v.shininess,1e-4)}function _(x,v){v.gradientMap&&(x.gradientMap.value=v.gradientMap)}function y(x,v){x.metalness.value=v.metalness,v.metalnessMap&&(x.metalnessMap.value=v.metalnessMap,e(v.metalnessMap,x.metalnessMapTransform)),x.roughness.value=v.roughness,v.roughnessMap&&(x.roughnessMap.value=v.roughnessMap,e(v.roughnessMap,x.roughnessMapTransform)),t.get(v).envMap&&(x.envMapIntensity.value=v.envMapIntensity)}function M(x,v,C){x.ior.value=v.ior,v.sheen>0&&(x.sheenColor.value.copy(v.sheenColor).multiplyScalar(v.sheen),x.sheenRoughness.value=v.sheenRoughness,v.sheenColorMap&&(x.sheenColorMap.value=v.sheenColorMap,e(v.sheenColorMap,x.sheenColorMapTransform)),v.sheenRoughnessMap&&(x.sheenRoughnessMap.value=v.sheenRoughnessMap,e(v.sheenRoughnessMap,x.sheenRoughnessMapTransform))),v.clearcoat>0&&(x.clearcoat.value=v.clearcoat,x.clearcoatRoughness.value=v.clearcoatRoughness,v.clearcoatMap&&(x.clearcoatMap.value=v.clearcoatMap,e(v.clearcoatMap,x.clearcoatMapTransform)),v.clearcoatRoughnessMap&&(x.clearcoatRoughnessMap.value=v.clearcoatRoughnessMap,e(v.clearcoatRoughnessMap,x.clearcoatRoughnessMapTransform)),v.clearcoatNormalMap&&(x.clearcoatNormalMap.value=v.clearcoatNormalMap,e(v.clearcoatNormalMap,x.clearcoatNormalMapTransform),x.clearcoatNormalScale.value.copy(v.clearcoatNormalScale),v.side===ui&&x.clearcoatNormalScale.value.negate())),v.iridescence>0&&(x.iridescence.value=v.iridescence,x.iridescenceIOR.value=v.iridescenceIOR,x.iridescenceThicknessMinimum.value=v.iridescenceThicknessRange[0],x.iridescenceThicknessMaximum.value=v.iridescenceThicknessRange[1],v.iridescenceMap&&(x.iridescenceMap.value=v.iridescenceMap,e(v.iridescenceMap,x.iridescenceMapTransform)),v.iridescenceThicknessMap&&(x.iridescenceThicknessMap.value=v.iridescenceThicknessMap,e(v.iridescenceThicknessMap,x.iridescenceThicknessMapTransform))),v.transmission>0&&(x.transmission.value=v.transmission,x.transmissionSamplerMap.value=C.texture,x.transmissionSamplerSize.value.set(C.width,C.height),v.transmissionMap&&(x.transmissionMap.value=v.transmissionMap,e(v.transmissionMap,x.transmissionMapTransform)),x.thickness.value=v.thickness,v.thicknessMap&&(x.thicknessMap.value=v.thicknessMap,e(v.thicknessMap,x.thicknessMapTransform)),x.attenuationDistance.value=v.attenuationDistance,x.attenuationColor.value.copy(v.attenuationColor)),v.anisotropy>0&&(x.anisotropyVector.value.set(v.anisotropy*Math.cos(v.anisotropyRotation),v.anisotropy*Math.sin(v.anisotropyRotation)),v.anisotropyMap&&(x.anisotropyMap.value=v.anisotropyMap,e(v.anisotropyMap,x.anisotropyMapTransform))),x.specularIntensity.value=v.specularIntensity,x.specularColor.value.copy(v.specularColor),v.specularColorMap&&(x.specularColorMap.value=v.specularColorMap,e(v.specularColorMap,x.specularColorMapTransform)),v.specularIntensityMap&&(x.specularIntensityMap.value=v.specularIntensityMap,e(v.specularIntensityMap,x.specularIntensityMapTransform))}function w(x,v){v.matcap&&(x.matcap.value=v.matcap)}function T(x,v){let C=t.get(v).light;x.referencePosition.value.setFromMatrixPosition(C.matrixWorld),x.nearDistance.value=C.shadow.camera.near,x.farDistance.value=C.shadow.camera.far}return{refreshFogUniforms:o,refreshMaterialUniforms:a}}function gb(r,t,e,o){let a={},l={},f=[],h=e.isWebGL2?r.getParameter(r.MAX_UNIFORM_BUFFER_BINDINGS):0;function p(C,S){let O=S.program;o.uniformBlockBinding(C,O)}function d(C,S){let O=a[C.id];O===void 0&&(w(C),O=g(C),a[C.id]=O,C.addEventListener("dispose",x));let F=S.program;o.updateUBOMapping(C,F);let G=t.render.frame;l[C.id]!==G&&(y(C),l[C.id]=G)}function g(C){let S=_();C.__bindingPointIndex=S;let O=r.createBuffer(),F=C.__size,G=C.usage;return r.bindBuffer(r.UNIFORM_BUFFER,O),r.bufferData(r.UNIFORM_BUFFER,F,G),r.bindBuffer(r.UNIFORM_BUFFER,null),r.bindBufferBase(r.UNIFORM_BUFFER,S,O),O}function _(){for(let C=0;C<h;C++)if(f.indexOf(C)===-1)return f.push(C),C;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function y(C){let S=a[C.id],O=C.uniforms,F=C.__cache;r.bindBuffer(r.UNIFORM_BUFFER,S);for(let G=0,z=O.length;G<z;G++){let L=O[G];if(M(L,G,F)===!0){let D=L.__offset,q=Array.isArray(L.value)?L.value:[L.value],nt=0;for(let k=0;k<q.length;k++){let xt=q[k],X=T(xt);typeof xt=="number"?(L.__data[0]=xt,r.bufferSubData(r.UNIFORM_BUFFER,D+nt,L.__data)):xt.isMatrix3?(L.__data[0]=xt.elements[0],L.__data[1]=xt.elements[1],L.__data[2]=xt.elements[2],L.__data[3]=xt.elements[0],L.__data[4]=xt.elements[3],L.__data[5]=xt.elements[4],L.__data[6]=xt.elements[5],L.__data[7]=xt.elements[0],L.__data[8]=xt.elements[6],L.__data[9]=xt.elements[7],L.__data[10]=xt.elements[8],L.__data[11]=xt.elements[0]):(xt.toArray(L.__data,nt),nt+=X.storage/Float32Array.BYTES_PER_ELEMENT)}r.bufferSubData(r.UNIFORM_BUFFER,D,L.__data)}}r.bindBuffer(r.UNIFORM_BUFFER,null)}function M(C,S,O){let F=C.value;if(O[S]===void 0){if(typeof F=="number")O[S]=F;else{let G=Array.isArray(F)?F:[F],z=[];for(let L=0;L<G.length;L++)z.push(G[L].clone());O[S]=z}return!0}else if(typeof F=="number"){if(O[S]!==F)return O[S]=F,!0}else{let G=Array.isArray(O[S])?O[S]:[O[S]],z=Array.isArray(F)?F:[F];for(let L=0;L<G.length;L++){let D=G[L];if(D.equals(z[L])===!1)return D.copy(z[L]),!0}}return!1}function w(C){let S=C.uniforms,O=0,F=16,G=0;for(let z=0,L=S.length;z<L;z++){let D=S[z],q={boundary:0,storage:0},nt=Array.isArray(D.value)?D.value:[D.value];for(let k=0,xt=nt.length;k<xt;k++){let X=nt[k],it=T(X);q.boundary+=it.boundary,q.storage+=it.storage}if(D.__data=new Float32Array(q.storage/Float32Array.BYTES_PER_ELEMENT),D.__offset=O,z>0){G=O%F;let k=F-G;G!==0&&k-q.boundary<0&&(O+=F-G,D.__offset=O)}O+=q.storage}return G=O%F,G>0&&(O+=F-G),C.__size=O,C.__cache={},this}function T(C){let S={boundary:0,storage:0};return typeof C=="number"?(S.boundary=4,S.storage=4):C.isVector2?(S.boundary=8,S.storage=8):C.isVector3||C.isColor?(S.boundary=16,S.storage=12):C.isVector4?(S.boundary=16,S.storage=16):C.isMatrix3?(S.boundary=48,S.storage=48):C.isMatrix4?(S.boundary=64,S.storage=64):C.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",C),S}function x(C){let S=C.target;S.removeEventListener("dispose",x);let O=f.indexOf(S.__bindingPointIndex);f.splice(O,1),r.deleteBuffer(a[S.id]),delete a[S.id],delete l[S.id]}function v(){for(let C in a)r.deleteBuffer(a[C]);f=[],a={},l={}}return{bind:p,update:d,dispose:v}}var Rh=class{constructor(t={}){let{canvas:e=Px(),context:o=null,depth:a=!0,stencil:l=!0,alpha:f=!1,antialias:h=!1,premultipliedAlpha:p=!0,preserveDrawingBuffer:d=!1,powerPreference:g="default",failIfMajorPerformanceCaveat:_=!1}=t;this.isWebGLRenderer=!0;let y;o!==null?y=o.getContextAttributes().alpha:y=f;let M=new Uint32Array(4),w=new Int32Array(4),T=null,x=null,v=[],C=[];this.domElement=e,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this._outputColorSpace=br,this._useLegacyLights=!1,this.toneMapping=hs,this.toneMappingExposure=1;let S=this,O=!1,F=0,G=0,z=null,L=-1,D=null,q=new Tr,nt=new Tr,k=null,xt=new xn(0),X=0,it=e.width,vt=e.height,pt=1,et=null,ot=null,V=new Tr(0,0,it,vt),K=new Tr(0,0,it,vt),at=!1,Tt=new cc,dt=!1,Ct=!1,Yt=null,Wt=new zr,Nt=new fn,ne=new mt,Pt={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function Xt(){return z===null?pt:1}let tt=o;function nn(H,rt){for(let gt=0;gt<H.length;gt++){let st=H[gt],yt=e.getContext(st,rt);if(yt!==null)return yt}return null}try{let H={alpha:!0,depth:a,stencil:l,antialias:h,premultipliedAlpha:p,preserveDrawingBuffer:d,powerPreference:g,failIfMajorPerformanceCaveat:_};if("setAttribute"in e&&e.setAttribute("data-engine",`three.js r${Hh}`),e.addEventListener("webglcontextlost",wt,!1),e.addEventListener("webglcontextrestored",j,!1),e.addEventListener("webglcontextcreationerror",Ut,!1),tt===null){let rt=["webgl2","webgl","experimental-webgl"];if(S.isWebGL1Renderer===!0&&rt.shift(),tt=nn(rt,H),tt===null)throw nn(rt)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}typeof WebGLRenderingContext!="undefined"&&tt instanceof WebGLRenderingContext&&console.warn("THREE.WebGLRenderer: WebGL 1 support was deprecated in r153 and will be removed in r163."),tt.getShaderPrecisionFormat===void 0&&(tt.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(H){throw console.error("THREE.WebGLRenderer: "+H.message),H}let Gt,te,qt,$,N,b,R,W,J,I,P,B,lt,ct,Q,St,_t,Mt,Lt,Jt,Et,oe,jt,Ht;function Ot(){Gt=new US(tt),te=new RS(tt,Gt,t),Gt.init(te),oe=new pb(tt,Gt,te),qt=new fb(tt,Gt,te),$=new kS(tt),N=new Qw,b=new hb(tt,Gt,qt,N,te,oe,$),R=new NS(S),W=new FS(S),J=new $x(tt,te),jt=new PS(tt,Gt,J,te),I=new BS(tt,J,$,jt),P=new WS(tt,I,J,$),Lt=new HS(tt,te,b),St=new LS(N),B=new jw(S,R,W,Gt,te,jt,St),lt=new mb(S,N),ct=new eb,Q=new ab(Gt,te),Mt=new CS(S,R,W,qt,P,y,p),_t=new cb(S,P,te),Ht=new gb(tt,$,te,qt),Jt=new IS(tt,Gt,$,te),Et=new zS(tt,Gt,$,te),$.programs=B.programs,S.capabilities=te,S.extensions=Gt,S.properties=N,S.renderLists=ct,S.shadowMap=_t,S.state=qt,S.info=$}Ot();let Y=new Ih(S,tt);this.xr=Y,this.getContext=function(){return tt},this.getContextAttributes=function(){return tt.getContextAttributes()},this.forceContextLoss=function(){let H=Gt.get("WEBGL_lose_context");H&&H.loseContext()},this.forceContextRestore=function(){let H=Gt.get("WEBGL_lose_context");H&&H.restoreContext()},this.getPixelRatio=function(){return pt},this.setPixelRatio=function(H){H!==void 0&&(pt=H,this.setSize(it,vt,!1))},this.getSize=function(H){return H.set(it,vt)},this.setSize=function(H,rt,gt=!0){if(Y.isPresenting){console.warn("THREE.WebGLRenderer: Can\'t change size while VR device is presenting.");return}it=H,vt=rt,e.width=Math.floor(H*pt),e.height=Math.floor(rt*pt),gt===!0&&(e.style.width=H+"px",e.style.height=rt+"px"),this.setViewport(0,0,H,rt)},this.getDrawingBufferSize=function(H){return H.set(it*pt,vt*pt).floor()},this.setDrawingBufferSize=function(H,rt,gt){it=H,vt=rt,pt=gt,e.width=Math.floor(H*gt),e.height=Math.floor(rt*gt),this.setViewport(0,0,H,rt)},this.getCurrentViewport=function(H){return H.copy(q)},this.getViewport=function(H){return H.copy(V)},this.setViewport=function(H,rt,gt,st){H.isVector4?V.set(H.x,H.y,H.z,H.w):V.set(H,rt,gt,st),qt.viewport(q.copy(V).multiplyScalar(pt).floor())},this.getScissor=function(H){return H.copy(K)},this.setScissor=function(H,rt,gt,st){H.isVector4?K.set(H.x,H.y,H.z,H.w):K.set(H,rt,gt,st),qt.scissor(nt.copy(K).multiplyScalar(pt).floor())},this.getScissorTest=function(){return at},this.setScissorTest=function(H){qt.setScissorTest(at=H)},this.setOpaqueSort=function(H){et=H},this.setTransparentSort=function(H){ot=H},this.getClearColor=function(H){return H.copy(Mt.getClearColor())},this.setClearColor=function(){Mt.setClearColor.apply(Mt,arguments)},this.getClearAlpha=function(){return Mt.getClearAlpha()},this.setClearAlpha=function(){Mt.setClearAlpha.apply(Mt,arguments)},this.clear=function(H=!0,rt=!0,gt=!0){let st=0;if(H){let yt=!1;if(z!==null){let It=z.texture.format;yt=It===t0||It===Qg||It===jg}if(yt){let It=z.texture.type,Bt=It===ps||It===ls||It===Wh||It===Hs||It===$g||It===Kg,se=Mt.getClearColor(),Qt=Mt.getClearAlpha(),ce=se.r,Vt=se.g,fe=se.b;Bt?(M[0]=ce,M[1]=Vt,M[2]=fe,M[3]=Qt,tt.clearBufferuiv(tt.COLOR,0,M)):(w[0]=ce,w[1]=Vt,w[2]=fe,w[3]=Qt,tt.clearBufferiv(tt.COLOR,0,w))}else st|=tt.COLOR_BUFFER_BIT}rt&&(st|=tt.DEPTH_BUFFER_BIT),gt&&(st|=tt.STENCIL_BUFFER_BIT),tt.clear(st)},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(){e.removeEventListener("webglcontextlost",wt,!1),e.removeEventListener("webglcontextrestored",j,!1),e.removeEventListener("webglcontextcreationerror",Ut,!1),ct.dispose(),Q.dispose(),N.dispose(),R.dispose(),W.dispose(),P.dispose(),jt.dispose(),Ht.dispose(),B.dispose(),Y.dispose(),Y.removeEventListener("sessionstart",He),Y.removeEventListener("sessionend",Mi),Yt&&(Yt.dispose(),Yt=null),$n.stop()};function wt(H){H.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),O=!0}function j(){console.log("THREE.WebGLRenderer: Context Restored."),O=!1;let H=$.autoReset,rt=_t.enabled,gt=_t.autoUpdate,st=_t.needsUpdate,yt=_t.type;Ot(),$.autoReset=H,_t.enabled=rt,_t.autoUpdate=gt,_t.needsUpdate=st,_t.type=yt}function Ut(H){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",H.statusMessage)}function Dt(H){let rt=H.target;rt.removeEventListener("dispose",Dt),ft(rt)}function ft(H){$t(H),N.remove(H)}function $t(H){let rt=N.get(H).programs;rt!==void 0&&(rt.forEach(function(gt){B.releaseProgram(gt)}),H.isShaderMaterial&&B.releaseShaderCache(H))}this.renderBufferDirect=function(H,rt,gt,st,yt,It){rt===null&&(rt=Pt);let Bt=yt.isMesh&&yt.matrixWorld.determinant()<0,se=ei(H,rt,gt,st,yt);qt.setMaterial(st,Bt);let Qt=gt.index,ce=1;if(st.wireframe===!0){if(Qt=I.getWireframeAttribute(gt),Qt===void 0)return;ce=2}let Vt=gt.drawRange,fe=gt.attributes.position,sn=Vt.start*ce,un=(Vt.start+Vt.count)*ce;It!==null&&(sn=Math.max(sn,It.start*ce),un=Math.min(un,(It.start+It.count)*ce)),Qt!==null?(sn=Math.max(sn,0),un=Math.min(un,Qt.count)):fe!=null&&(sn=Math.max(sn,0),un=Math.min(un,fe.count));let vn=un-sn;if(vn<0||vn===1/0)return;jt.setup(yt,st,se,gt,Qt);let ni,En=Jt;if(Qt!==null&&(ni=J.get(Qt),En=Et,En.setIndex(ni)),yt.isMesh)st.wireframe===!0?(qt.setLineWidth(st.wireframeLinewidth*Xt()),En.setMode(tt.LINES)):En.setMode(tt.TRIANGLES);else if(yt.isLine){let de=st.linewidth;de===void 0&&(de=1),qt.setLineWidth(de*Xt()),yt.isLineSegments?En.setMode(tt.LINES):yt.isLineLoop?En.setMode(tt.LINE_LOOP):En.setMode(tt.LINE_STRIP)}else yt.isPoints?En.setMode(tt.POINTS):yt.isSprite&&En.setMode(tt.TRIANGLES);if(yt.isInstancedMesh)En.renderInstances(sn,vn,yt.count);else if(gt.isInstancedBufferGeometry){let de=gt._maxInstanceCount!==void 0?gt._maxInstanceCount:1/0,xo=Math.min(gt.instanceCount,de);En.renderInstances(sn,vn,xo)}else En.render(sn,vn)},this.compile=function(H,rt){function gt(st,yt,It){st.transparent===!0&&st.side===Go&&st.forceSinglePass===!1?(st.side=ui,st.needsUpdate=!0,pe(st,yt,It),st.side=ds,st.needsUpdate=!0,pe(st,yt,It),st.side=Go):pe(st,yt,It)}x=Q.get(H),x.init(),C.push(x),H.traverseVisible(function(st){st.isLight&&st.layers.test(rt.layers)&&(x.pushLight(st),st.castShadow&&x.pushShadow(st))}),x.setupLights(S._useLegacyLights),H.traverse(function(st){let yt=st.material;if(yt)if(Array.isArray(yt))for(let It=0;It<yt.length;It++){let Bt=yt[It];gt(Bt,H,st)}else gt(yt,H,st)}),C.pop(),x=null};let re=null;function mn(H){re&&re(H)}function He(){$n.stop()}function Mi(){$n.start()}let $n=new o0;$n.setAnimationLoop(mn),typeof self!="undefined"&&$n.setContext(self),this.setAnimationLoop=function(H){re=H,Y.setAnimationLoop(H),H===null?$n.stop():$n.start()},Y.addEventListener("sessionstart",He),Y.addEventListener("sessionend",Mi),this.render=function(H,rt){if(rt!==void 0&&rt.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(O===!0)return;H.matrixWorldAutoUpdate===!0&&H.updateMatrixWorld(),rt.parent===null&&rt.matrixWorldAutoUpdate===!0&&rt.updateMatrixWorld(),Y.enabled===!0&&Y.isPresenting===!0&&(Y.cameraAutoUpdate===!0&&Y.updateCamera(rt),rt=Y.getCamera()),H.isScene===!0&&H.onBeforeRender(S,H,rt,z),x=Q.get(H,C.length),x.init(),C.push(x),Wt.multiplyMatrices(rt.projectionMatrix,rt.matrixWorldInverse),Tt.setFromProjectionMatrix(Wt),Ct=this.localClippingEnabled,dt=St.init(this.clippingPlanes,Ct),T=ct.get(H,v.length),T.init(),v.push(T),ml(H,rt,0,S.sortObjects),T.finish(),S.sortObjects===!0&&T.sort(et,ot),this.info.render.frame++,dt===!0&&St.beginShadows();let gt=x.state.shadowsArray;if(_t.render(gt,H,rt),dt===!0&&St.endShadows(),this.info.autoReset===!0&&this.info.reset(),Mt.render(T,H),x.setupLights(S._useLegacyLights),rt.isArrayCamera){let st=rt.cameras;for(let yt=0,It=st.length;yt<It;yt++){let Bt=st[yt];hi(T,H,Bt,Bt.viewport)}}else hi(T,H,rt);z!==null&&(b.updateMultisampleRenderTarget(z),b.updateRenderTargetMipmap(z)),H.isScene===!0&&H.onAfterRender(S,H,rt),jt.resetDefaultState(),L=-1,D=null,C.pop(),C.length>0?x=C[C.length-1]:x=null,v.pop(),v.length>0?T=v[v.length-1]:T=null};function ml(H,rt,gt,st){if(H.visible===!1)return;if(H.layers.test(rt.layers)){if(H.isGroup)gt=H.renderOrder;else if(H.isLOD)H.autoUpdate===!0&&H.update(rt);else if(H.isLight)x.pushLight(H),H.castShadow&&x.pushShadow(H);else if(H.isSprite){if(!H.frustumCulled||Tt.intersectsSprite(H)){st&&ne.setFromMatrixPosition(H.matrixWorld).applyMatrix4(Wt);let Bt=P.update(H),se=H.material;se.visible&&T.push(H,Bt,se,gt,ne.z,null)}}else if((H.isMesh||H.isLine||H.isPoints)&&(!H.frustumCulled||Tt.intersectsObject(H))){let Bt=P.update(H),se=H.material;if(st&&(H.boundingSphere!==void 0?(H.boundingSphere===null&&H.computeBoundingSphere(),ne.copy(H.boundingSphere.center)):(Bt.boundingSphere===null&&Bt.computeBoundingSphere(),ne.copy(Bt.boundingSphere.center)),ne.applyMatrix4(H.matrixWorld).applyMatrix4(Wt)),Array.isArray(se)){let Qt=Bt.groups;for(let ce=0,Vt=Qt.length;ce<Vt;ce++){let fe=Qt[ce],sn=se[fe.materialIndex];sn&&sn.visible&&T.push(H,Bt,sn,gt,ne.z,fe)}}else se.visible&&T.push(H,Bt,se,gt,ne.z,null)}}let It=H.children;for(let Bt=0,se=It.length;Bt<se;Bt++)ml(It[Bt],rt,gt,st)}function hi(H,rt,gt,st){let yt=H.opaque,It=H.transmissive,Bt=H.transparent;x.setupLightsView(gt),dt===!0&&St.setGlobalState(S.clippingPlanes,gt),It.length>0&&bs(yt,It,rt,gt),st&&qt.viewport(q.copy(st)),yt.length>0&&_o(yt,rt,gt),It.length>0&&_o(It,rt,gt),Bt.length>0&&_o(Bt,rt,gt),qt.buffers.depth.setTest(!0),qt.buffers.depth.setMask(!0),qt.buffers.color.setMask(!0),qt.setPolygonOffset(!1)}function bs(H,rt,gt,st){let yt=te.isWebGL2;Yt===null&&(Yt=new qo(1,1,{generateMipmaps:!0,type:Gt.has("EXT_color_buffer_half_float")?Fu:ps,minFilter:Du,samples:yt?4:0})),S.getDrawingBufferSize(Nt),yt?Yt.setSize(Nt.x,Nt.y):Yt.setSize(hh(Nt.x),hh(Nt.y));let It=S.getRenderTarget();S.setRenderTarget(Yt),S.getClearColor(xt),X=S.getClearAlpha(),X<1&&S.setClearColor(16777215,.5),S.clear();let Bt=S.toneMapping;S.toneMapping=hs,_o(H,gt,st),b.updateMultisampleRenderTarget(Yt),b.updateRenderTargetMipmap(Yt);let se=!1;for(let Qt=0,ce=rt.length;Qt<ce;Qt++){let Vt=rt[Qt],fe=Vt.object,sn=Vt.geometry,un=Vt.material,vn=Vt.group;if(un.side===Go&&fe.layers.test(st.layers)){let ni=un.side;un.side=ui,un.needsUpdate=!0,Fi(fe,gt,st,sn,un,vn),un.side=ni,un.needsUpdate=!0,se=!0}}se===!0&&(b.updateMultisampleRenderTarget(Yt),b.updateRenderTargetMipmap(Yt)),S.setRenderTarget(It),S.setClearColor(xt,X),S.toneMapping=Bt}function _o(H,rt,gt){let st=rt.isScene===!0?rt.overrideMaterial:null;for(let yt=0,It=H.length;yt<It;yt++){let Bt=H[yt],se=Bt.object,Qt=Bt.geometry,ce=st===null?Bt.material:st,Vt=Bt.group;se.layers.test(gt.layers)&&Fi(se,rt,gt,Qt,ce,Vt)}}function Fi(H,rt,gt,st,yt,It){H.onBeforeRender(S,rt,gt,st,yt,It),H.modelViewMatrix.multiplyMatrices(gt.matrixWorldInverse,H.matrixWorld),H.normalMatrix.getNormalMatrix(H.modelViewMatrix),yt.onBeforeRender(S,rt,gt,st,H,It),yt.transparent===!0&&yt.side===Go&&yt.forceSinglePass===!1?(yt.side=ui,yt.needsUpdate=!0,S.renderBufferDirect(gt,rt,st,yt,H,It),yt.side=ds,yt.needsUpdate=!0,S.renderBufferDirect(gt,rt,st,yt,H,It),yt.side=Go):S.renderBufferDirect(gt,rt,st,yt,H,It),H.onAfterRender(S,rt,gt,st,yt,It)}function pe(H,rt,gt){rt.isScene!==!0&&(rt=Pt);let st=N.get(H),yt=x.state.lights,It=x.state.shadowsArray,Bt=yt.state.version,se=B.getParameters(H,yt.state,It,rt,gt),Qt=B.getProgramCacheKey(se),ce=st.programs;st.environment=H.isMeshStandardMaterial?rt.environment:null,st.fog=rt.fog,st.envMap=(H.isMeshStandardMaterial?W:R).get(H.envMap||st.environment),ce===void 0&&(H.addEventListener("dispose",Dt),ce=new Map,st.programs=ce);let Vt=ce.get(Qt);if(Vt!==void 0){if(st.currentProgram===Vt&&st.lightsStateVersion===Bt)return Rr(H,se),Vt}else se.uniforms=B.getUniforms(H),H.onBuild(gt,se,S),H.onBeforeCompile(se,S),Vt=B.acquireProgram(se,Qt),ce.set(Qt,Vt),st.uniforms=se.uniforms;let fe=st.uniforms;(!H.isShaderMaterial&&!H.isRawShaderMaterial||H.clipping===!0)&&(fe.clippingPlanes=St.uniform),Rr(H,se),st.needsLights=Vn(H),st.lightsStateVersion=Bt,st.needsLights&&(fe.ambientLightColor.value=yt.state.ambient,fe.lightProbe.value=yt.state.probe,fe.directionalLights.value=yt.state.directional,fe.directionalLightShadows.value=yt.state.directionalShadow,fe.spotLights.value=yt.state.spot,fe.spotLightShadows.value=yt.state.spotShadow,fe.rectAreaLights.value=yt.state.rectArea,fe.ltc_1.value=yt.state.rectAreaLTC1,fe.ltc_2.value=yt.state.rectAreaLTC2,fe.pointLights.value=yt.state.point,fe.pointLightShadows.value=yt.state.pointShadow,fe.hemisphereLights.value=yt.state.hemi,fe.directionalShadowMap.value=yt.state.directionalShadowMap,fe.directionalShadowMatrix.value=yt.state.directionalShadowMatrix,fe.spotShadowMap.value=yt.state.spotShadowMap,fe.spotLightMatrix.value=yt.state.spotLightMatrix,fe.spotLightMap.value=yt.state.spotLightMap,fe.pointShadowMap.value=yt.state.pointShadowMap,fe.pointShadowMatrix.value=yt.state.pointShadowMatrix);let sn=Vt.getUniforms(),un=za.seqWithValue(sn.seq,fe);return st.currentProgram=Vt,st.uniformsList=un,Vt}function Rr(H,rt){let gt=N.get(H);gt.outputColorSpace=rt.outputColorSpace,gt.instancing=rt.instancing,gt.instancingColor=rt.instancingColor,gt.skinning=rt.skinning,gt.morphTargets=rt.morphTargets,gt.morphNormals=rt.morphNormals,gt.morphColors=rt.morphColors,gt.morphTargetsCount=rt.morphTargetsCount,gt.numClippingPlanes=rt.numClippingPlanes,gt.numIntersection=rt.numClipIntersection,gt.vertexAlphas=rt.vertexAlphas,gt.vertexTangents=rt.vertexTangents,gt.toneMapping=rt.toneMapping}function ei(H,rt,gt,st,yt){rt.isScene!==!0&&(rt=Pt),b.resetTextureUnits();let It=rt.fog,Bt=st.isMeshStandardMaterial?rt.environment:null,se=z===null?S.outputColorSpace:z.isXRRenderTarget===!0?z.texture.colorSpace:Wo,Qt=(st.isMeshStandardMaterial?W:R).get(st.envMap||Bt),ce=st.vertexColors===!0&&!!gt.attributes.color&>.attributes.color.itemSize===4,Vt=!!gt.attributes.tangent&&(!!st.normalMap||st.anisotropy>0),fe=!!gt.morphAttributes.position,sn=!!gt.morphAttributes.normal,un=!!gt.morphAttributes.color,vn=hs;st.toneMapped&&(z===null||z.isXRRenderTarget===!0)&&(vn=S.toneMapping);let ni=gt.morphAttributes.position||gt.morphAttributes.normal||gt.morphAttributes.color,En=ni!==void 0?ni.length:0,de=N.get(st),xo=x.state.lights;if(dt===!0&&(Ct===!0||H!==D)){let xr=H===D&&st.id===L;St.setState(st,H,xr)}let he=!1;st.version===de.__version?(de.needsLights&&de.lightsStateVersion!==xo.state.version||de.outputColorSpace!==se||yt.isInstancedMesh&&de.instancing===!1||!yt.isInstancedMesh&&de.instancing===!0||yt.isSkinnedMesh&&de.skinning===!1||!yt.isSkinnedMesh&&de.skinning===!0||yt.isInstancedMesh&&de.instancingColor===!0&&yt.instanceColor===null||yt.isInstancedMesh&&de.instancingColor===!1&&yt.instanceColor!==null||de.envMap!==Qt||st.fog===!0&&de.fog!==It||de.numClippingPlanes!==void 0&&(de.numClippingPlanes!==St.numPlanes||de.numIntersection!==St.numIntersection)||de.vertexAlphas!==ce||de.vertexTangents!==Vt||de.morphTargets!==fe||de.morphNormals!==sn||de.morphColors!==un||de.toneMapping!==vn||te.isWebGL2===!0&&de.morphTargetsCount!==En)&&(he=!0):(he=!0,de.__version=st.version);let no=de.currentProgram;he===!0&&(no=pe(st,rt,yt));let ri=!1,Eo=!1,oa=!1,ie=no.getUniforms(),Ui=de.uniforms;if(qt.useProgram(no.program)&&(ri=!0,Eo=!0,oa=!0),st.id!==L&&(L=st.id,Eo=!0),ri||D!==H){ie.setValue(tt,"projectionMatrix",H.projectionMatrix),ie.setValue(tt,"viewMatrix",H.matrixWorldInverse);let xr=ie.map.cameraPosition;xr!==void 0&&xr.setValue(tt,ne.setFromMatrixPosition(H.matrixWorld)),te.logarithmicDepthBuffer&&ie.setValue(tt,"logDepthBufFC",2/(Math.log(H.far+1)/Math.LN2)),(st.isMeshPhongMaterial||st.isMeshToonMaterial||st.isMeshLambertMaterial||st.isMeshBasicMaterial||st.isMeshStandardMaterial||st.isShaderMaterial)&&ie.setValue(tt,"isOrthographic",H.isOrthographicCamera===!0),D!==H&&(D=H,Eo=!0,oa=!0)}if(yt.isSkinnedMesh){ie.setOptional(tt,yt,"bindMatrix"),ie.setOptional(tt,yt,"bindMatrixInverse");let xr=yt.skeleton;xr&&(te.floatVertexTextures?(xr.boneTexture===null&&xr.computeBoneTexture(),ie.setValue(tt,"boneTexture",xr.boneTexture,b),ie.setValue(tt,"boneTextureSize",xr.boneTextureSize)):console.warn("THREE.WebGLRenderer: SkinnedMesh can only be used with WebGL 2. With WebGL 1 OES_texture_float and vertex textures support is required."))}let Lr=gt.morphAttributes;if((Lr.position!==void 0||Lr.normal!==void 0||Lr.color!==void 0&&te.isWebGL2===!0)&&Lt.update(yt,gt,no),(Eo||de.receiveShadow!==yt.receiveShadow)&&(de.receiveShadow=yt.receiveShadow,ie.setValue(tt,"receiveShadow",yt.receiveShadow)),st.isMeshGouraudMaterial&&st.envMap!==null&&(Ui.envMap.value=Qt,Ui.flipEnvMap.value=Qt.isCubeTexture&&Qt.isRenderTargetTexture===!1?-1:1),Eo&&(ie.setValue(tt,"toneMappingExposure",S.toneMappingExposure),de.needsLights&&Vr(Ui,oa),It&&st.fog===!0&<.refreshFogUniforms(Ui,It),lt.refreshMaterialUniforms(Ui,st,pt,vt,Yt),za.upload(tt,de.uniformsList,Ui,b)),st.isShaderMaterial&&st.uniformsNeedUpdate===!0&&(za.upload(tt,de.uniformsList,Ui,b),st.uniformsNeedUpdate=!1),st.isSpriteMaterial&&ie.setValue(tt,"center",yt.center),ie.setValue(tt,"modelViewMatrix",yt.modelViewMatrix),ie.setValue(tt,"normalMatrix",yt.normalMatrix),ie.setValue(tt,"modelMatrix",yt.matrixWorld),st.isShaderMaterial||st.isRawShaderMaterial){let xr=st.uniformsGroups;for(let le=0,gl=xr.length;le<gl;le++)if(te.isWebGL2){let yl=xr[le];Ht.update(yl,no),Ht.bind(yl,no)}else console.warn("THREE.WebGLRenderer: Uniform Buffer Objects can only be used with WebGL 2.")}return no}function Vr(H,rt){H.ambientLightColor.needsUpdate=rt,H.lightProbe.needsUpdate=rt,H.directionalLights.needsUpdate=rt,H.directionalLightShadows.needsUpdate=rt,H.pointLights.needsUpdate=rt,H.pointLightShadows.needsUpdate=rt,H.spotLights.needsUpdate=rt,H.spotLightShadows.needsUpdate=rt,H.rectAreaLights.needsUpdate=rt,H.hemisphereLights.needsUpdate=rt}function Vn(H){return H.isMeshLambertMaterial||H.isMeshToonMaterial||H.isMeshPhongMaterial||H.isMeshStandardMaterial||H.isShadowMaterial||H.isShaderMaterial&&H.lights===!0}this.getActiveCubeFace=function(){return F},this.getActiveMipmapLevel=function(){return G},this.getRenderTarget=function(){return z},this.setRenderTargetTextures=function(H,rt,gt){N.get(H.texture).__webglTexture=rt,N.get(H.depthTexture).__webglTexture=gt;let st=N.get(H);st.__hasExternalTextures=!0,st.__hasExternalTextures&&(st.__autoAllocateDepthBuffer=gt===void 0,st.__autoAllocateDepthBuffer||Gt.has("WEBGL_multisampled_render_to_texture")===!0&&(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),st.__useRenderToTexture=!1))},this.setRenderTargetFramebuffer=function(H,rt){let gt=N.get(H);gt.__webglFramebuffer=rt,gt.__useDefaultFramebuffer=rt===void 0},this.setRenderTarget=function(H,rt=0,gt=0){z=H,F=rt,G=gt;let st=!0,yt=null,It=!1,Bt=!1;if(H){let Qt=N.get(H);Qt.__useDefaultFramebuffer!==void 0?(qt.bindFramebuffer(tt.FRAMEBUFFER,null),st=!1):Qt.__webglFramebuffer===void 0?b.setupRenderTarget(H):Qt.__hasExternalTextures&&b.rebindTextures(H,N.get(H.texture).__webglTexture,N.get(H.depthTexture).__webglTexture);let ce=H.texture;(ce.isData3DTexture||ce.isDataArrayTexture||ce.isCompressedArrayTexture)&&(Bt=!0);let Vt=N.get(H).__webglFramebuffer;H.isWebGLCubeRenderTarget?(Array.isArray(Vt[rt])?yt=Vt[rt][gt]:yt=Vt[rt],It=!0):te.isWebGL2&&H.samples>0&&b.useMultisampledRTT(H)===!1?yt=N.get(H).__webglMultisampledFramebuffer:Array.isArray(Vt)?yt=Vt[gt]:yt=Vt,q.copy(H.viewport),nt.copy(H.scissor),k=H.scissorTest}else q.copy(V).multiplyScalar(pt).floor(),nt.copy(K).multiplyScalar(pt).floor(),k=at;if(qt.bindFramebuffer(tt.FRAMEBUFFER,yt)&&te.drawBuffers&&st&&qt.drawBuffers(H,yt),qt.viewport(q),qt.scissor(nt),qt.setScissorTest(k),It){let Qt=N.get(H.texture);tt.framebufferTexture2D(tt.FRAMEBUFFER,tt.COLOR_ATTACHMENT0,tt.TEXTURE_CUBE_MAP_POSITIVE_X+rt,Qt.__webglTexture,gt)}else if(Bt){let Qt=N.get(H.texture),ce=rt||0;tt.framebufferTextureLayer(tt.FRAMEBUFFER,tt.COLOR_ATTACHMENT0,Qt.__webglTexture,gt||0,ce)}L=-1},this.readRenderTargetPixels=function(H,rt,gt,st,yt,It,Bt){if(!(H&&H.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let se=N.get(H).__webglFramebuffer;if(H.isWebGLCubeRenderTarget&&Bt!==void 0&&(se=se[Bt]),se){qt.bindFramebuffer(tt.FRAMEBUFFER,se);try{let Qt=H.texture,ce=Qt.format,Vt=Qt.type;if(ce!==$i&&oe.convert(ce)!==tt.getParameter(tt.IMPLEMENTATION_COLOR_READ_FORMAT)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}let fe=Vt===Fu&&(Gt.has("EXT_color_buffer_half_float")||te.isWebGL2&&Gt.has("EXT_color_buffer_float"));if(Vt!==ps&&oe.convert(Vt)!==tt.getParameter(tt.IMPLEMENTATION_COLOR_READ_TYPE)&&!(Vt===cs&&(te.isWebGL2||Gt.has("OES_texture_float")||Gt.has("WEBGL_color_buffer_float")))&&!fe){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}rt>=0&&rt<=H.width-st&>>=0&><=H.height-yt&&tt.readPixels(rt,gt,st,yt,oe.convert(ce),oe.convert(Vt),It)}finally{let Qt=z!==null?N.get(z).__webglFramebuffer:null;qt.bindFramebuffer(tt.FRAMEBUFFER,Qt)}}},this.copyFramebufferToTexture=function(H,rt,gt=0){let st=Math.pow(2,-gt),yt=Math.floor(rt.image.width*st),It=Math.floor(rt.image.height*st);b.setTexture2D(rt,0),tt.copyTexSubImage2D(tt.TEXTURE_2D,gt,0,0,H.x,H.y,yt,It),qt.unbindTexture()},this.copyTextureToTexture=function(H,rt,gt,st=0){let yt=rt.image.width,It=rt.image.height,Bt=oe.convert(gt.format),se=oe.convert(gt.type);b.setTexture2D(gt,0),tt.pixelStorei(tt.UNPACK_FLIP_Y_WEBGL,gt.flipY),tt.pixelStorei(tt.UNPACK_PREMULTIPLY_ALPHA_WEBGL,gt.premultiplyAlpha),tt.pixelStorei(tt.UNPACK_ALIGNMENT,gt.unpackAlignment),rt.isDataTexture?tt.texSubImage2D(tt.TEXTURE_2D,st,H.x,H.y,yt,It,Bt,se,rt.image.data):rt.isCompressedTexture?tt.compressedTexSubImage2D(tt.TEXTURE_2D,st,H.x,H.y,rt.mipmaps[0].width,rt.mipmaps[0].height,Bt,rt.mipmaps[0].data):tt.texSubImage2D(tt.TEXTURE_2D,st,H.x,H.y,Bt,se,rt.image),st===0&>.generateMipmaps&&tt.generateMipmap(tt.TEXTURE_2D),qt.unbindTexture()},this.copyTextureToTexture3D=function(H,rt,gt,st,yt=0){if(S.isWebGL1Renderer){console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");return}let It=H.max.x-H.min.x+1,Bt=H.max.y-H.min.y+1,se=H.max.z-H.min.z+1,Qt=oe.convert(st.format),ce=oe.convert(st.type),Vt;if(st.isData3DTexture)b.setTexture3D(st,0),Vt=tt.TEXTURE_3D;else if(st.isDataArrayTexture)b.setTexture2DArray(st,0),Vt=tt.TEXTURE_2D_ARRAY;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}tt.pixelStorei(tt.UNPACK_FLIP_Y_WEBGL,st.flipY),tt.pixelStorei(tt.UNPACK_PREMULTIPLY_ALPHA_WEBGL,st.premultiplyAlpha),tt.pixelStorei(tt.UNPACK_ALIGNMENT,st.unpackAlignment);let fe=tt.getParameter(tt.UNPACK_ROW_LENGTH),sn=tt.getParameter(tt.UNPACK_IMAGE_HEIGHT),un=tt.getParameter(tt.UNPACK_SKIP_PIXELS),vn=tt.getParameter(tt.UNPACK_SKIP_ROWS),ni=tt.getParameter(tt.UNPACK_SKIP_IMAGES),En=gt.isCompressedTexture?gt.mipmaps[0]:gt.image;tt.pixelStorei(tt.UNPACK_ROW_LENGTH,En.width),tt.pixelStorei(tt.UNPACK_IMAGE_HEIGHT,En.height),tt.pixelStorei(tt.UNPACK_SKIP_PIXELS,H.min.x),tt.pixelStorei(tt.UNPACK_SKIP_ROWS,H.min.y),tt.pixelStorei(tt.UNPACK_SKIP_IMAGES,H.min.z),gt.isDataTexture||gt.isData3DTexture?tt.texSubImage3D(Vt,yt,rt.x,rt.y,rt.z,It,Bt,se,Qt,ce,En.data):gt.isCompressedArrayTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),tt.compressedTexSubImage3D(Vt,yt,rt.x,rt.y,rt.z,It,Bt,se,Qt,En.data)):tt.texSubImage3D(Vt,yt,rt.x,rt.y,rt.z,It,Bt,se,Qt,ce,En),tt.pixelStorei(tt.UNPACK_ROW_LENGTH,fe),tt.pixelStorei(tt.UNPACK_IMAGE_HEIGHT,sn),tt.pixelStorei(tt.UNPACK_SKIP_PIXELS,un),tt.pixelStorei(tt.UNPACK_SKIP_ROWS,vn),tt.pixelStorei(tt.UNPACK_SKIP_IMAGES,ni),yt===0&&st.generateMipmaps&&tt.generateMipmap(Vt),qt.unbindTexture()},this.initTexture=function(H){H.isCubeTexture?b.setTextureCube(H,0):H.isData3DTexture?b.setTexture3D(H,0):H.isDataArrayTexture||H.isCompressedArrayTexture?b.setTexture2DArray(H,0):b.setTexture2D(H,0),qt.unbindTexture()},this.resetState=function(){F=0,G=0,z=null,qt.reset(),jt.reset()},typeof __THREE_DEVTOOLS__!="undefined"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return Vo}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(t){this._outputColorSpace=t;let e=this.getContext();e.drawingBufferColorSpace=t===qh?"display-p3":"srgb",e.unpackColorSpace=gn.workingColorSpace===pc?"display-p3":"srgb"}get physicallyCorrectLights(){return console.warn("THREE.WebGLRenderer: The property .physicallyCorrectLights has been removed. Set renderer.useLegacyLights instead."),!this.useLegacyLights}set physicallyCorrectLights(t){console.warn("THREE.WebGLRenderer: The property .physicallyCorrectLights has been removed. Set renderer.useLegacyLights instead."),this.useLegacyLights=!t}get outputEncoding(){return console.warn("THREE.WebGLRenderer: Property .outputEncoding has been removed. Use .outputColorSpace instead."),this.outputColorSpace===br?qs:e0}set outputEncoding(t){console.warn("THREE.WebGLRenderer: Property .outputEncoding has been removed. Use .outputColorSpace instead."),this.outputColorSpace=t===qs?br:Wo}get useLegacyLights(){return console.warn("THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733."),this._useLegacyLights}set useLegacyLights(t){console.warn("THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733."),this._useLegacyLights=t}},Lh=class extends Rh{};Lh.prototype.isWebGL1Renderer=!0;function Xl(r,t,e){return!r||!e&&r.constructor===t?r:typeof t.BYTES_PER_ELEMENT=="number"?new t(r):Array.prototype.slice.call(r)}function yb(r){return ArrayBuffer.isView(r)&&!(r instanceof DataView)}var qa=class{constructor(t,e,o,a){this.parameterPositions=t,this._cachedIndex=0,this.resultBuffer=a!==void 0?a:new e.constructor(o),this.sampleValues=e,this.valueSize=o,this.settings=null,this.DefaultSettings_={}}evaluate(t){let e=this.parameterPositions,o=this._cachedIndex,a=e[o],l=e[o-1];n:{t:{let f;e:{r:if(!(t<a)){for(let h=o+2;;){if(a===void 0){if(t<l)break r;return o=e.length,this._cachedIndex=o,this.copySampleValue_(o-1)}if(o===h)break;if(l=a,a=e[++o],t<a)break t}f=e.length;break e}if(!(t>=l)){let h=e[1];t<h&&(o=2,l=h);for(let p=o-2;;){if(l===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(o===p)break;if(a=l,l=e[--o-1],t>=l)break t}f=o,o=0;break e}break n}for(;o<f;){let h=o+f>>>1;t<e[h]?f=h:o=h+1}if(a=e[o],l=e[o-1],l===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(a===void 0)return o=e.length,this._cachedIndex=o,this.copySampleValue_(o-1)}this._cachedIndex=o,this.intervalChanged_(o,l,a)}return this.interpolate_(o,l,t,a)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(t){let e=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=t*a;for(let f=0;f!==a;++f)e[f]=o[l+f];return e}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}},Nh=class extends qa{constructor(t,e,o,a){super(t,e,o,a),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:eg,endingEnd:eg}}intervalChanged_(t,e,o){let a=this.parameterPositions,l=t-2,f=t+1,h=a[l],p=a[f];if(h===void 0)switch(this.getSettings_().endingStart){case ng:l=t,h=2*e-o;break;case rg:l=a.length-2,h=e+a[l]-a[l+1];break;default:l=t,h=o}if(p===void 0)switch(this.getSettings_().endingEnd){case ng:f=t,p=2*o-e;break;case rg:f=1,p=o+a[1]-a[0];break;default:f=t-1,p=e}let d=(o-e)*.5,g=this.valueSize;this._weightPrev=d/(e-h),this._weightNext=d/(p-o),this._offsetPrev=l*g,this._offsetNext=f*g}interpolate_(t,e,o,a){let l=this.resultBuffer,f=this.sampleValues,h=this.valueSize,p=t*h,d=p-h,g=this._offsetPrev,_=this._offsetNext,y=this._weightPrev,M=this._weightNext,w=(o-e)/(a-e),T=w*w,x=T*w,v=-y*x+2*y*T-y*w,C=(1+y)*x+(-1.5-2*y)*T+(-.5+y)*w+1,S=(-1-M)*x+(1.5+M)*T+.5*w,O=M*x-M*T;for(let F=0;F!==h;++F)l[F]=v*f[g+F]+C*f[d+F]+S*f[p+F]+O*f[_+F];return l}},Oh=class extends qa{constructor(t,e,o,a){super(t,e,o,a)}interpolate_(t,e,o,a){let l=this.resultBuffer,f=this.sampleValues,h=this.valueSize,p=t*h,d=p-h,g=(o-e)/(a-e),_=1-g;for(let y=0;y!==h;++y)l[y]=f[d+y]*_+f[p+y]*g;return l}},Dh=class extends qa{constructor(t,e,o,a){super(t,e,o,a)}interpolate_(t){return this.copySampleValue_(t-1)}},ji=class{constructor(t,e,o,a){if(t===void 0)throw new Error("THREE.KeyframeTrack: track name is undefined");if(e===void 0||e.length===0)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+t);this.name=t,this.times=Xl(e,this.TimeBufferType),this.values=Xl(o,this.ValueBufferType),this.setInterpolation(a||this.DefaultInterpolation)}static toJSON(t){let e=t.constructor,o;if(e.toJSON!==this.toJSON)o=e.toJSON(t);else{o={name:t.name,times:Xl(t.times,Array),values:Xl(t.values,Array)};let a=t.getInterpolation();a!==t.DefaultInterpolation&&(o.interpolation=a)}return o.type=t.ValueTypeName,o}InterpolantFactoryMethodDiscrete(t){return new Dh(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodLinear(t){return new Oh(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodSmooth(t){return new Nh(this.times,this.values,this.getValueSize(),t)}setInterpolation(t){let e;switch(t){case Yl:e=this.InterpolantFactoryMethodDiscrete;break;case Zl:e=this.InterpolantFactoryMethodLinear;break;case Df:e=this.InterpolantFactoryMethodSmooth;break}if(e===void 0){let o="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(this.createInterpolant===void 0)if(t!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw new Error(o);return console.warn("THREE.KeyframeTrack:",o),this}return this.createInterpolant=e,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return Yl;case this.InterpolantFactoryMethodLinear:return Zl;case this.InterpolantFactoryMethodSmooth:return Df}}getValueSize(){return this.values.length/this.times.length}shift(t){if(t!==0){let e=this.times;for(let o=0,a=e.length;o!==a;++o)e[o]+=t}return this}scale(t){if(t!==1){let e=this.times;for(let o=0,a=e.length;o!==a;++o)e[o]*=t}return this}trim(t,e){let o=this.times,a=o.length,l=0,f=a-1;for(;l!==a&&o[l]<t;)++l;for(;f!==-1&&o[f]>e;)--f;if(++f,l!==0||f!==a){l>=f&&(f=Math.max(f,1),l=f-1);let h=this.getValueSize();this.times=o.slice(l,f),this.values=this.values.slice(l*h,f*h)}return this}validate(){let t=!0,e=this.getValueSize();e-Math.floor(e)!==0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),t=!1);let o=this.times,a=this.values,l=o.length;l===0&&(console.error("THREE.KeyframeTrack: Track is empty.",this),t=!1);let f=null;for(let h=0;h!==l;h++){let p=o[h];if(typeof p=="number"&&isNaN(p)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,h,p),t=!1;break}if(f!==null&&f>p){console.error("THREE.KeyframeTrack: Out of order keys.",this,h,p,f),t=!1;break}f=p}if(a!==void 0&&yb(a))for(let h=0,p=a.length;h!==p;++h){let d=a[h];if(isNaN(d)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,h,d),t=!1;break}}return t}optimize(){let t=this.times.slice(),e=this.values.slice(),o=this.getValueSize(),a=this.getInterpolation()===Df,l=t.length-1,f=1;for(let h=1;h<l;++h){let p=!1,d=t[h],g=t[h+1];if(d!==g&&(h!==1||d!==t[0]))if(a)p=!0;else{let _=h*o,y=_-o,M=_+o;for(let w=0;w!==o;++w){let T=e[_+w];if(T!==e[y+w]||T!==e[M+w]){p=!0;break}}}if(p){if(h!==f){t[f]=t[h];let _=h*o,y=f*o;for(let M=0;M!==o;++M)e[y+M]=e[_+M]}++f}}if(l>0){t[f]=t[l];for(let h=l*o,p=f*o,d=0;d!==o;++d)e[p+d]=e[h+d];++f}return f!==t.length?(this.times=t.slice(0,f),this.values=e.slice(0,f*o)):(this.times=t,this.values=e),this}clone(){let t=this.times.slice(),e=this.values.slice(),o=this.constructor,a=new o(this.name,t,e);return a.createInterpolant=this.createInterpolant,a}};ji.prototype.TimeBufferType=Float32Array;ji.prototype.ValueBufferType=Float32Array;ji.prototype.DefaultInterpolation=Zl;var Zs=class extends ji{};Zs.prototype.ValueTypeName="bool";Zs.prototype.ValueBufferType=Array;Zs.prototype.DefaultInterpolation=Yl;Zs.prototype.InterpolantFactoryMethodLinear=void 0;Zs.prototype.InterpolantFactoryMethodSmooth=void 0;var Fh=class extends ji{};Fh.prototype.ValueTypeName="color";var Uh=class extends ji{};Uh.prototype.ValueTypeName="number";var Bh=class extends qa{constructor(t,e,o,a){super(t,e,o,a)}interpolate_(t,e,o,a){let l=this.resultBuffer,f=this.sampleValues,h=this.valueSize,p=(o-e)/(a-e),d=t*h;for(let g=d+h;d!==g;d+=4)gs.slerpFlat(l,0,f,d-h,f,d,p);return l}},zu=class extends ji{InterpolantFactoryMethodLinear(t){return new Bh(this.times,this.values,this.getValueSize(),t)}};zu.prototype.ValueTypeName="quaternion";zu.prototype.DefaultInterpolation=Zl;zu.prototype.InterpolantFactoryMethodSmooth=void 0;var Js=class extends ji{};Js.prototype.ValueTypeName="string";Js.prototype.ValueBufferType=Array;Js.prototype.DefaultInterpolation=Yl;Js.prototype.InterpolantFactoryMethodLinear=void 0;Js.prototype.InterpolantFactoryMethodSmooth=void 0;var zh=class extends ji{};zh.prototype.ValueTypeName="vector";var kh=class{constructor(t,e,o){let a=this,l=!1,f=0,h=0,p,d=[];this.onStart=void 0,this.onLoad=t,this.onProgress=e,this.onError=o,this.itemStart=function(g){h++,l===!1&&a.onStart!==void 0&&a.onStart(g,f,h),l=!0},this.itemEnd=function(g){f++,a.onProgress!==void 0&&a.onProgress(g,f,h),f===h&&(l=!1,a.onLoad!==void 0&&a.onLoad())},this.itemError=function(g){a.onError!==void 0&&a.onError(g)},this.resolveURL=function(g){return p?p(g):g},this.setURLModifier=function(g){return p=g,this},this.addHandler=function(g,_){return d.push(g,_),this},this.removeHandler=function(g){let _=d.indexOf(g);return _!==-1&&d.splice(_,2),this},this.getHandler=function(g){for(let _=0,y=d.length;_<y;_+=2){let M=d[_],w=d[_+1];if(M.global&&(M.lastIndex=0),M.test(g))return w}return null}}},vb=new kh,Gh=class{constructor(t){this.manager=t!==void 0?t:vb,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(t,e){let o=this;return new Promise(function(a,l){o.load(t,a,e,l)})}parse(){}setCrossOrigin(t){return this.crossOrigin=t,this}setWithCredentials(t){return this.withCredentials=t,this}setPath(t){return this.path=t,this}setResourcePath(t){return this.resourcePath=t,this}setRequestHeader(t){return this.requestHeader=t,this}};Gh.DEFAULT_MATERIAL_NAME="__DEFAULT";var Yh="\\\\[\\\\]\\\\.:\\\\/",_b=new RegExp("["+Yh+"]","g"),Zh="[^"+Yh+"]",xb="[^"+Yh.replace("\\\\.","")+"]",Eb=/((?:WC+[\\/:])*)/.source.replace("WC",Zh),Mb=/(WCOD+)?/.source.replace("WCOD",xb),Sb=/(?:\\.(WC+)(?:\\[(.+)\\])?)?/.source.replace("WC",Zh),wb=/\\.(WC+)(?:\\[(.+)\\])?/.source.replace("WC",Zh),bb=new RegExp("^"+Eb+Mb+Sb+wb+"$"),Tb=["material","materials","bones","map"],Vh=class{constructor(t,e,o){let a=o||Rn.parseTrackName(e);this._targetGroup=t,this._bindings=t.subscribe_(e,a)}getValue(t,e){this.bind();let o=this._targetGroup.nCachedObjects_,a=this._bindings[o];a!==void 0&&a.getValue(t,e)}setValue(t,e){let o=this._bindings;for(let a=this._targetGroup.nCachedObjects_,l=o.length;a!==l;++a)o[a].setValue(t,e)}bind(){let t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,o=t.length;e!==o;++e)t[e].bind()}unbind(){let t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,o=t.length;e!==o;++e)t[e].unbind()}},Rn=class r{constructor(t,e,o){this.path=e,this.parsedPath=o||r.parseTrackName(e),this.node=r.findNode(t,this.parsedPath.nodeName),this.rootNode=t,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(t,e,o){return t&&t.isAnimationObjectGroup?new r.Composite(t,e,o):new r(t,e,o)}static sanitizeNodeName(t){return t.replace(/\\s/g,"_").replace(_b,"")}static parseTrackName(t){let e=bb.exec(t);if(e===null)throw new Error("PropertyBinding: Cannot parse trackName: "+t);let o={nodeName:e[2],objectName:e[3],objectIndex:e[4],propertyName:e[5],propertyIndex:e[6]},a=o.nodeName&&o.nodeName.lastIndexOf(".");if(a!==void 0&&a!==-1){let l=o.nodeName.substring(a+1);Tb.indexOf(l)!==-1&&(o.nodeName=o.nodeName.substring(0,a),o.objectName=l)}if(o.propertyName===null||o.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+t);return o}static findNode(t,e){if(e===void 0||e===""||e==="."||e===-1||e===t.name||e===t.uuid)return t;if(t.skeleton){let o=t.skeleton.getBoneByName(e);if(o!==void 0)return o}if(t.children){let o=function(l){for(let f=0;f<l.length;f++){let h=l[f];if(h.name===e||h.uuid===e)return h;let p=o(h.children);if(p)return p}return null},a=o(t.children);if(a)return a}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(t,e){t[e]=this.targetObject[this.propertyName]}_getValue_array(t,e){let o=this.resolvedProperty;for(let a=0,l=o.length;a!==l;++a)t[e++]=o[a]}_getValue_arrayElement(t,e){t[e]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(t,e){this.resolvedProperty.toArray(t,e)}_setValue_direct(t,e){this.targetObject[this.propertyName]=t[e]}_setValue_direct_setNeedsUpdate(t,e){this.targetObject[this.propertyName]=t[e],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(t,e){this.targetObject[this.propertyName]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(t,e){let o=this.resolvedProperty;for(let a=0,l=o.length;a!==l;++a)o[a]=t[e++]}_setValue_array_setNeedsUpdate(t,e){let o=this.resolvedProperty;for(let a=0,l=o.length;a!==l;++a)o[a]=t[e++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(t,e){let o=this.resolvedProperty;for(let a=0,l=o.length;a!==l;++a)o[a]=t[e++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(t,e){this.resolvedProperty[this.propertyIndex]=t[e]}_setValue_arrayElement_setNeedsUpdate(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(t,e){this.resolvedProperty.fromArray(t,e)}_setValue_fromArray_setNeedsUpdate(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(t,e){this.bind(),this.getValue(t,e)}_setValue_unbound(t,e){this.bind(),this.setValue(t,e)}bind(){let t=this.node,e=this.parsedPath,o=e.objectName,a=e.propertyName,l=e.propertyIndex;if(t||(t=r.findNode(this.rootNode,e.nodeName),this.node=t),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!t){console.warn("THREE.PropertyBinding: No target node found for track: "+this.path+".");return}if(o){let d=e.objectIndex;switch(o){case"materials":if(!t.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!t.material.materials){console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);return}t=t.material.materials;break;case"bones":if(!t.skeleton){console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);return}t=t.skeleton.bones;for(let g=0;g<t.length;g++)if(t[g].name===d){d=g;break}break;case"map":if("map"in t){t=t.map;break}if(!t.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!t.material.map){console.error("THREE.PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);return}t=t.material.map;break;default:if(t[o]===void 0){console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);return}t=t[o]}if(d!==void 0){if(t[d]===void 0){console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,t);return}t=t[d]}}let f=t[a];if(f===void 0){let d=e.nodeName;console.error("THREE.PropertyBinding: Trying to update property for track: "+d+"."+a+" but it wasn\'t found.",t);return}let h=this.Versioning.None;this.targetObject=t,t.needsUpdate!==void 0?h=this.Versioning.NeedsUpdate:t.matrixWorldNeedsUpdate!==void 0&&(h=this.Versioning.MatrixWorldNeedsUpdate);let p=this.BindingType.Direct;if(l!==void 0){if(a==="morphTargetInfluences"){if(!t.geometry){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(!t.geometry.morphAttributes){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);return}t.morphTargetDictionary[l]!==void 0&&(l=t.morphTargetDictionary[l])}p=this.BindingType.ArrayElement,this.resolvedProperty=f,this.propertyIndex=l}else f.fromArray!==void 0&&f.toArray!==void 0?(p=this.BindingType.HasFromToArray,this.resolvedProperty=f):Array.isArray(f)?(p=this.BindingType.EntireArray,this.resolvedProperty=f):this.propertyName=a;this.getValue=this.GetterByBindingType[p],this.setValue=this.SetterByBindingTypeAndVersioning[p][h]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}};Rn.Composite=Vh;Rn.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};Rn.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};Rn.prototype.GetterByBindingType=[Rn.prototype._getValue_direct,Rn.prototype._getValue_array,Rn.prototype._getValue_arrayElement,Rn.prototype._getValue_toArray];Rn.prototype.SetterByBindingTypeAndVersioning=[[Rn.prototype._setValue_direct,Rn.prototype._setValue_direct_setNeedsUpdate,Rn.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[Rn.prototype._setValue_array,Rn.prototype._setValue_array_setNeedsUpdate,Rn.prototype._setValue_array_setMatrixWorldNeedsUpdate],[Rn.prototype._setValue_arrayElement,Rn.prototype._setValue_arrayElement_setNeedsUpdate,Rn.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[Rn.prototype._setValue_fromArray,Rn.prototype._setValue_fromArray_setNeedsUpdate,Rn.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];var sR=new Float32Array(1);typeof __THREE_DEVTOOLS__!="undefined"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:Hh}}));typeof window!="undefined"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=Hh);function c0(r,t){return new Promise((e,o)=>{let a=new XMLHttpRequest;a.open("GET",r,!0),Object.keys(t.headers||{}).forEach(l=>{a.setRequestHeader(l,t.headers[l])}),a.onload=()=>{if(a.status>=200&&a.status<300)try{let l=JSON.parse(a.responseText);e(l)}catch(l){o(l)}else o(a.statusText)},a.onerror=()=>{o(a.statusText)},a.send()})}var mr=63710088e-1,lR={centimeters:mr*100,centimetres:mr*100,degrees:mr/111325,feet:mr*3.28084,inches:mr*39.37,kilometers:mr/1e3,kilometres:mr/1e3,meters:mr,metres:mr,miles:mr/1609.344,millimeters:mr*1e3,millimetres:mr*1e3,nauticalmiles:mr/1852,radians:1,yards:mr*1.0936},cR={centimeters:100,centimetres:100,degrees:1/111325,feet:3.28084,inches:39.37,kilometers:1/1e3,kilometres:1/1e3,meters:1,metres:1,miles:1/1609.344,millimeters:1e3,millimetres:1e3,nauticalmiles:1/1852,radians:1/mr,yards:1.0936133};function Kr(r,t,e){e===void 0&&(e={});var o={type:"Feature"};return(e.id===0||e.id)&&(o.id=e.id),e.bbox&&(o.bbox=e.bbox),o.properties=t||{},o.geometry=r,o}function Sn(r,t,e){if(e===void 0&&(e={}),!r)throw new Error("coordinates is required");if(!Array.isArray(r))throw new Error("coordinates must be an Array");if(r.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!ho(r[0])||!ho(r[1]))throw new Error("coordinates must contain numbers");var o={type:"Point",coordinates:r};return Kr(o,t,e)}function Ln(r,t,e){e===void 0&&(e={});for(var o=0,a=r;o<a.length;o++){var l=a[o];if(l.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");for(var f=0;f<l[l.length-1].length;f++)if(l[l.length-1][f]!==l[0][f])throw new Error("First and last Position are not equivalent.")}var h={type:"Polygon",coordinates:r};return Kr(h,t,e)}function gr(r,t,e){if(e===void 0&&(e={}),r.length<2)throw new Error("coordinates must be an array of two or more positions");var o={type:"LineString",coordinates:r};return Kr(o,t,e)}function Jh(r,t,e){e===void 0&&(e={});var o={type:"MultiPoint",coordinates:r};return Kr(o,t,e)}function ho(r){return!isNaN(r)&&r!==null&&!Array.isArray(r)}function nr(r,t,e){if(r!==null)for(var o,a,l,f,h,p,d,g=0,_=0,y,M=r.type,w=M==="FeatureCollection",T=M==="Feature",x=w?r.features.length:1,v=0;v<x;v++){d=w?r.features[v].geometry:T?r.geometry:r,y=d?d.type==="GeometryCollection":!1,h=y?d.geometries.length:1;for(var C=0;C<h;C++){var S=0,O=0;if(f=y?d.geometries[C]:d,f!==null){p=f.coordinates;var F=f.type;switch(g=e&&(F==="Polygon"||F==="MultiPolygon")?1:0,F){case null:break;case"Point":if(t(p,_,v,S,O)===!1)return!1;_++,S++;break;case"LineString":case"MultiPoint":for(o=0;o<p.length;o++){if(t(p[o],_,v,S,O)===!1)return!1;_++,F==="MultiPoint"&&S++}F==="LineString"&&S++;break;case"Polygon":case"MultiLineString":for(o=0;o<p.length;o++){for(a=0;a<p[o].length-g;a++){if(t(p[o][a],_,v,S,O)===!1)return!1;_++}F==="MultiLineString"&&S++,F==="Polygon"&&O++}F==="Polygon"&&S++;break;case"MultiPolygon":for(o=0;o<p.length;o++){for(O=0,a=0;a<p[o].length;a++){for(l=0;l<p[o][a].length-g;l++){if(t(p[o][a][l],_,v,S,O)===!1)return!1;_++}O++}S++}break;case"GeometryCollection":for(o=0;o<f.geometries.length;o++)if(nr(f.geometries[o],t,e)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function f0(r,t,e,o){var a=e;return nr(r,function(l,f,h,p,d){f===0&&e===void 0?a=l:a=t(a,l,f,h,p,d)},o),a}function ys(r,t){var e,o,a,l,f,h,p,d,g,_,y=0,M=r.type==="FeatureCollection",w=r.type==="Feature",T=M?r.features.length:1;for(e=0;e<T;e++){for(h=M?r.features[e].geometry:w?r.geometry:r,d=M?r.features[e].properties:w?r.properties:{},g=M?r.features[e].bbox:w?r.bbox:void 0,_=M?r.features[e].id:w?r.id:void 0,p=h?h.type==="GeometryCollection":!1,f=p?h.geometries.length:1,a=0;a<f;a++){if(l=p?h.geometries[a]:h,l===null){if(t(null,y,d,g,_)===!1)return!1;continue}switch(l.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":{if(t(l,y,d,g,_)===!1)return!1;break}case"GeometryCollection":{for(o=0;o<l.geometries.length;o++)if(t(l.geometries[o],y,d,g,_)===!1)return!1;break}default:throw new Error("Unknown Geometry Type")}}y++}}function Ei(r,t){ys(r,function(e,o,a,l,f){var h=e===null?null:e.type;switch(h){case null:case"Point":case"LineString":case"Polygon":return t(Kr(e,a,{bbox:l,id:f}),o,0)===!1?!1:void 0}var p;switch(h){case"MultiPoint":p="Point";break;case"MultiLineString":p="LineString";break;case"MultiPolygon":p="Polygon";break}for(var d=0;d<e.coordinates.length;d++){var g=e.coordinates[d],_={type:p,coordinates:g};if(t(Kr(_,a),o,d)===!1)return!1}})}function $h(r){var t=[1/0,1/0,-1/0,-1/0];return nr(r,function(e){t[0]>e[0]&&(t[0]=e[0]),t[1]>e[1]&&(t[1]=e[1]),t[2]<e[0]&&(t[2]=e[0]),t[3]<e[1]&&(t[3]=e[1])}),t}$h.default=$h;var jr=$h;function Ar(r){if(!r)throw new Error("coord is required");if(!Array.isArray(r)){if(r.type==="Feature"&&r.geometry!==null&&r.geometry.type==="Point")return r.geometry.coordinates;if(r.type==="Point")return r.coordinates}if(Array.isArray(r)&&r.length>=2&&!Array.isArray(r[0])&&!Array.isArray(r[1]))return r;throw new Error("coord must be GeoJSON Point or an Array of numbers")}function Kh(r,t,e){if(!r)throw new Error("No feature passed");if(!e)throw new Error(".featureOf() requires a name");if(!r||r.type!=="Feature"||!r.geometry)throw new Error("Invalid input to "+e+", Feature with geometry required");if(!r.geometry||r.geometry.type!==t)throw new Error("Invalid input to "+e+": must be a "+t+", given "+r.geometry.type)}function Cr(r){return r.type==="Feature"?r.geometry:r}var Ob=Un(mc(),1);var Wb=Un(P0(),1);function yr(r,t,e){if(e===void 0&&(e={}),!r)throw new Error("point is required");if(!t)throw new Error("polygon is required");var o=Ar(r),a=Cr(t),l=a.type,f=t.bbox,h=a.coordinates;if(f&&qb(o,f)===!1)return!1;l==="Polygon"&&(h=[h]);for(var p=!1,d=0;d<h.length&&!p;d++)if(I0(o,h[d][0],e.ignoreBoundary)){for(var g=!1,_=1;_<h[d].length&&!g;)I0(o,h[d][_],!e.ignoreBoundary)&&(g=!0),_++;g||(p=!0)}return p}function I0(r,t,e){var o=!1;t[0][0]===t[t.length-1][0]&&t[0][1]===t[t.length-1][1]&&(t=t.slice(0,t.length-1));for(var a=0,l=t.length-1;a<t.length;l=a++){var f=t[a][0],h=t[a][1],p=t[l][0],d=t[l][1],g=r[1]*(f-p)+h*(p-r[0])+d*(r[0]-f)===0&&(f-r[0])*(p-r[0])<=0&&(h-r[1])*(d-r[1])<=0;if(g)return!e;var _=h>r[1]!=d>r[1]&&r[0]<(p-f)*(r[1]-h)/(d-h)+f;_&&(o=!o)}return o}function qb(r,t){return t[0]<=r[0]&&t[1]<=r[1]&&t[2]>=r[0]&&t[3]>=r[1]}var N0=new ArrayBuffer(16),zL=new Float64Array(N0),kL=new Uint32Array(N0);var sT=Un(pp(),1);var h2=function(){function r(t){this.points=t.points||[],this.duration=t.duration||1e4,this.sharpness=t.sharpness||.85,this.centers=[],this.controls=[],this.stepLength=t.stepLength||60,this.length=this.points.length,this.delay=0;for(var e=0;e<this.length;e++)this.points[e].z=this.points[e].z||0;for(var e=0;e<this.length-1;e++){var o=this.points[e],a=this.points[e+1];this.centers.push({x:(o.x+a.x)/2,y:(o.y+a.y)/2,z:(o.z+a.z)/2})}this.controls.push([this.points[0],this.points[0]]);for(var e=0;e<this.centers.length-1;e++){var l=this.points[e+1].x-(this.centers[e].x+this.centers[e+1].x)/2,f=this.points[e+1].y-(this.centers[e].y+this.centers[e+1].y)/2,h=this.points[e+1].z-(this.centers[e].y+this.centers[e+1].z)/2;this.controls.push([{x:(1-this.sharpness)*this.points[e+1].x+this.sharpness*(this.centers[e].x+l),y:(1-this.sharpness)*this.points[e+1].y+this.sharpness*(this.centers[e].y+f),z:(1-this.sharpness)*this.points[e+1].z+this.sharpness*(this.centers[e].z+h)},{x:(1-this.sharpness)*this.points[e+1].x+this.sharpness*(this.centers[e+1].x+l),y:(1-this.sharpness)*this.points[e+1].y+this.sharpness*(this.centers[e+1].y+f),z:(1-this.sharpness)*this.points[e+1].z+this.sharpness*(this.centers[e+1].z+h)}])}return this.controls.push([this.points[this.length-1],this.points[this.length-1]]),this.steps=this.cacheSteps(this.stepLength),this}return r.prototype.cacheSteps=function(t){var e=[],o=this.pos(0);e.push(0);for(var a=0;a<this.duration;a+=10){var l=this.pos(a),f=Math.sqrt((l.x-o.x)*(l.x-o.x)+(l.y-o.y)*(l.y-o.y)+(l.z-o.z)*(l.z-o.z));f>t&&(e.push(a),o=l)}return e},r.prototype.vector=function(t){var e=this.pos(t+10),o=this.pos(t-10);return{angle:180*Math.atan2(e.y-o.y,e.x-o.x)/3.14,speed:Math.sqrt((o.x-e.x)*(o.x-e.x)+(o.y-e.y)*(o.y-e.y)+(o.z-e.z)*(o.z-e.z))}},r.prototype.pos=function(t){var e=t-this.delay;e<0&&(e=0),e>this.duration&&(e=this.duration-1);var o=e/this.duration;if(o>=1)return this.points[this.length-1];var a=Math.floor((this.points.length-1)*o),l=(this.length-1)*o-a;return aT(l,this.points[a],this.controls[a][1],this.controls[a+1][0],this.points[a+1])},r}();function aT(r,t,e,o,a){var l=uT(r),f={x:a.x*l[0]+o.x*l[1]+e.x*l[2]+t.x*l[3],y:a.y*l[0]+o.y*l[1]+e.y*l[2]+t.y*l[3],z:a.z*l[0]+o.z*l[1]+e.z*l[2]+t.z*l[3]};return f}function uT(r){var t=r*r,e=t*r;return[e,3*t*(1-r),3*r*(1-r)*(1-r),(1-r)*(1-r)*(1-r)]}function Wu(r,t){t===void 0&&(t={});var e=Number(r[0]),o=Number(r[1]),a=Number(r[2]),l=Number(r[3]);if(r.length===6)throw new Error("@turf/bbox-polygon does not support BBox with 6 positions");var f=[e,o],h=[e,l],p=[a,l],d=[a,o];return Ln([[f,d,p,h,f]],t.properties,{bbox:r,id:t.id})}function lT(r){return Wu(jr(r))}var dp=lT;var TT=Un(W0(),1);var QT=Un(Lc(),1);var eA=Un(mc(),1);var iA=Un(pp(),1);var uy=Math.PI/180,ly=180/Math.PI,Ku=function(r,t){this.lon=r,this.lat=t,this.x=uy*r,this.y=uy*t};Ku.prototype.view=function(){return String(this.lon).slice(0,4)+","+String(this.lat).slice(0,4)};Ku.prototype.antipode=function(){var r=-1*this.lat,t=this.lon<0?180+this.lon:(180-this.lon)*-1;return new Ku(t,r)};var cy=function(){this.coords=[],this.length=0};cy.prototype.move_to=function(r){this.length++,this.coords.push(r)};var Op=function(r){this.properties=r||{},this.geometries=[]};Op.prototype.json=function(){if(this.geometries.length<=0)return{geometry:{type:"LineString",coordinates:null},type:"Feature",properties:this.properties};if(this.geometries.length===1)return{geometry:{type:"LineString",coordinates:this.geometries[0].coords},type:"Feature",properties:this.properties};for(var r=[],t=0;t<this.geometries.length;t++)r.push(this.geometries[t].coords);return{geometry:{type:"MultiLineString",coordinates:r},type:"Feature",properties:this.properties}};Op.prototype.wkt=function(){for(var r="",t="LINESTRING(",e=function(l){t+=l[0]+" "+l[1]+","},o=0;o<this.geometries.length;o++){if(this.geometries[o].coords.length===0)return"LINESTRING(empty)";var a=this.geometries[o].coords;a.forEach(e),r+=t.substring(0,t.length-1)+")"}return r};var fy=function(r,t,e){if(!r||r.x===void 0||r.y===void 0)throw new Error("GreatCircle constructor expects two args: start and end objects with x and y properties");if(!t||t.x===void 0||t.y===void 0)throw new Error("GreatCircle constructor expects two args: start and end objects with x and y properties");this.start=new Ku(r.x,r.y),this.end=new Ku(t.x,t.y),this.properties=e||{};var o=this.start.x-this.end.x,a=this.start.y-this.end.y,l=Math.pow(Math.sin(a/2),2)+Math.cos(this.start.y)*Math.cos(this.end.y)*Math.pow(Math.sin(o/2),2);if(this.g=2*Math.asin(Math.sqrt(l)),this.g===Math.PI)throw new Error("it appears "+r.view()+" and "+t.view()+" are \'antipodal\', e.g diametrically opposite, thus there is no single route but rather infinite");if(isNaN(this.g))throw new Error("could not calculate great circle between "+r+" and "+t)};fy.prototype.interpolate=function(r){var t=Math.sin((1-r)*this.g)/Math.sin(this.g),e=Math.sin(r*this.g)/Math.sin(this.g),o=t*Math.cos(this.start.y)*Math.cos(this.start.x)+e*Math.cos(this.end.y)*Math.cos(this.end.x),a=t*Math.cos(this.start.y)*Math.sin(this.start.x)+e*Math.cos(this.end.y)*Math.sin(this.end.x),l=t*Math.sin(this.start.y)+e*Math.sin(this.end.y),f=ly*Math.atan2(l,Math.sqrt(Math.pow(o,2)+Math.pow(a,2))),h=ly*Math.atan2(a,o);return[h,f]};fy.prototype.Arc=function(r,t){var e=[];if(!r||r<=2)e.push([this.start.lon,this.start.lat]),e.push([this.end.lon,this.end.lat]);else for(var o=1/(r-1),a=0;a<r;++a){var l=o*a,f=this.interpolate(l);e.push(f)}for(var h=!1,p=0,d=t&&t.offset?t.offset:10,g=180-d,_=-180+d,y=360-d,M=1;M<e.length;++M){var w=e[M-1][0],T=e[M][0],x=Math.abs(T-w);x>y&&(T>g&&w<_||w>g&&T<_)?h=!0:x>p&&(p=x)}var v=[];if(h&&p<d){var C=[];v.push(C);for(var S=0;S<e.length;++S){var O=parseFloat(e[S][0]);if(S>0&&Math.abs(O-e[S-1][0])>y){var F=parseFloat(e[S-1][0]),G=parseFloat(e[S-1][1]),z=parseFloat(e[S][0]),L=parseFloat(e[S][1]);if(F>-180&&F<_&&z===180&&S+1<e.length&&e[S-1][0]>-180&&e[S-1][0]<_){C.push([-180,e[S][1]]),S++,C.push([e[S][0],e[S][1]]);continue}else if(F>g&&F<180&&z===-180&&S+1<e.length&&e[S-1][0]>g&&e[S-1][0]<180){C.push([180,e[S][1]]),S++,C.push([e[S][0],e[S][1]]);continue}if(F<_&&z>g){var D=F;F=z,z=D;var q=G;G=L,L=q}if(F>g&&z<_&&(z+=360),F<=180&&z>=180&&F<z){var nt=(180-F)/(z-F),k=nt*L+(1-nt)*G;C.push([e[S-1][0]>g?180:-180,k]),C=[],C.push([e[S-1][0]>g?-180:180,k]),v.push(C)}else C=[],v.push(C);C.push([O,e[S][1]])}else C.push([e[S][0],e[S][1]])}}else{var xt=[];v.push(xt);for(var X=0;X<e.length;++X)xt.push([e[X][0],e[X][1]])}for(var it=new Op(this.properties),vt=0;vt<v.length;++vt){var pt=new cy;it.geometries.push(pt);for(var et=v[vt],ot=0;ot<et.length;++ot)pt.move_to(et[ot])}return it};var aA=Un(Lc(),1);var DC=Un(Lc(),1);var FC=Un(nd(),1);var zC=Un(mc(),1);var _e=[],xe=[],Ee=[],Me=[],Se=[],we=[],be=[],Te=[],Ae=[],Ce=[],Pe=[],Ie=[],Re=[],Le=[],Ne=[],Oe=[],De=[],Fe=[],Ue=[],Be=[],ze=[],ke=[],Ge=[],Ve=[];be[85]=Ce[85]=-1;Te[85]=Pe[85]=0;Ae[85]=Ie[85]=1;Ue[85]=ke[85]=1;Be[85]=Ge[85]=0;ze[85]=Ve[85]=1;_e[85]=Me[85]=0;xe[85]=Se[85]=-1;Ee[85]=Ne[85]=0;Oe[85]=Re[85]=0;De[85]=Le[85]=1;we[85]=Fe[85]=1;ke[1]=ke[169]=0;Ge[1]=Ge[169]=-1;Ve[1]=Ve[169]=0;Re[1]=Re[169]=-1;Le[1]=Le[169]=0;Ne[1]=Ne[169]=0;Ce[4]=Ce[166]=0;Pe[4]=Pe[166]=-1;Ie[4]=Ie[166]=1;Oe[4]=Oe[166]=1;De[4]=De[166]=0;Fe[4]=Fe[166]=0;be[16]=be[154]=0;Te[16]=Te[154]=1;Ae[16]=Ae[154]=1;Me[16]=Me[154]=1;Se[16]=Se[154]=0;we[16]=we[154]=1;Ue[64]=Ue[106]=0;Be[64]=Be[106]=1;ze[64]=ze[106]=0;_e[64]=_e[106]=-1;xe[64]=xe[106]=0;Ee[64]=Ee[106]=1;Ue[2]=Ue[168]=0;Be[2]=Be[168]=-1;ze[2]=ze[168]=1;ke[2]=ke[168]=0;Ge[2]=Ge[168]=-1;Ve[2]=Ve[168]=0;Re[2]=Re[168]=-1;Le[2]=Le[168]=0;Ne[2]=Ne[168]=0;Oe[2]=Oe[168]=-1;De[2]=De[168]=0;Fe[2]=Fe[168]=1;be[8]=be[162]=0;Te[8]=Te[162]=-1;Ae[8]=Ae[162]=0;Ce[8]=Ce[162]=0;Pe[8]=Pe[162]=-1;Ie[8]=Ie[162]=1;Re[8]=Re[162]=1;Le[8]=Le[162]=0;Ne[8]=Ne[162]=1;Oe[8]=Oe[162]=1;De[8]=De[162]=0;Fe[8]=Fe[162]=0;be[32]=be[138]=0;Te[32]=Te[138]=1;Ae[32]=Ae[138]=1;Ce[32]=Ce[138]=0;Pe[32]=Pe[138]=1;Ie[32]=Ie[138]=0;_e[32]=_e[138]=1;xe[32]=xe[138]=0;Ee[32]=Ee[138]=0;Me[32]=Me[138]=1;Se[32]=Se[138]=0;we[32]=we[138]=1;ke[128]=ke[42]=0;Ge[128]=Ge[42]=1;Ve[128]=Ve[42]=1;Ue[128]=Ue[42]=0;Be[128]=Be[42]=1;ze[128]=ze[42]=0;_e[128]=_e[42]=-1;xe[128]=xe[42]=0;Ee[128]=Ee[42]=1;Me[128]=Me[42]=-1;Se[128]=Se[42]=0;we[128]=we[42]=0;Ce[5]=Ce[165]=-1;Pe[5]=Pe[165]=0;Ie[5]=Ie[165]=0;ke[5]=ke[165]=1;Ge[5]=Ge[165]=0;Ve[5]=Ve[165]=0;Oe[20]=Oe[150]=0;De[20]=De[150]=1;Fe[20]=Fe[150]=1;Me[20]=Me[150]=0;Se[20]=Se[150]=-1;we[20]=we[150]=1;be[80]=be[90]=-1;Te[80]=Te[90]=0;Ae[80]=Ae[90]=1;Ue[80]=Ue[90]=1;Be[80]=Be[90]=0;ze[80]=ze[90]=1;Re[65]=Re[105]=0;Le[65]=Le[105]=1;Ne[65]=Ne[105]=0;_e[65]=_e[105]=0;xe[65]=xe[105]=-1;Ee[65]=Ee[105]=0;be[160]=be[10]=-1;Te[160]=Te[10]=0;Ae[160]=Ae[10]=1;Ce[160]=Ce[10]=-1;Pe[160]=Pe[10]=0;Ie[160]=Ie[10]=0;ke[160]=ke[10]=1;Ge[160]=Ge[10]=0;Ve[160]=Ve[10]=0;Ue[160]=Ue[10]=1;Be[160]=Be[10]=0;ze[160]=ze[10]=1;Oe[130]=Oe[40]=0;De[130]=De[40]=1;Fe[130]=Fe[40]=1;Re[130]=Re[40]=0;Le[130]=Le[40]=1;Ne[130]=Ne[40]=0;_e[130]=_e[40]=0;xe[130]=xe[40]=-1;Ee[130]=Ee[40]=0;Me[130]=Me[40]=0;Se[130]=Se[40]=-1;we[130]=we[40]=1;Ce[37]=Ce[133]=0;Pe[37]=Pe[133]=1;Ie[37]=Ie[133]=1;ke[37]=ke[133]=0;Ge[37]=Ge[133]=1;Ve[37]=Ve[133]=0;_e[37]=_e[133]=-1;xe[37]=xe[133]=0;Ee[37]=Ee[133]=0;Me[37]=Me[133]=1;Se[37]=Se[133]=0;we[37]=we[133]=0;Oe[148]=Oe[22]=-1;De[148]=De[22]=0;Fe[148]=Fe[22]=0;ke[148]=ke[22]=0;Ge[148]=Ge[22]=-1;Ve[148]=Ve[22]=1;Ue[148]=Ue[22]=0;Be[148]=Be[22]=1;ze[148]=ze[22]=1;Me[148]=Me[22]=-1;Se[148]=Se[22]=0;we[148]=we[22]=1;be[82]=be[88]=0;Te[82]=Te[88]=-1;Ae[82]=Ae[88]=1;Oe[82]=Oe[88]=1;De[82]=De[88]=0;Fe[82]=Fe[88]=1;Re[82]=Re[88]=-1;Le[82]=Le[88]=0;Ne[82]=Ne[88]=1;Ue[82]=Ue[88]=0;Be[82]=Be[88]=-1;ze[82]=ze[88]=0;be[73]=be[97]=0;Te[73]=Te[97]=1;Ae[73]=Ae[97]=0;Ce[73]=Ce[97]=0;Pe[73]=Pe[97]=-1;Ie[73]=Ie[97]=0;Re[73]=Re[97]=1;Le[73]=Le[97]=0;Ne[73]=Ne[97]=0;_e[73]=_e[97]=1;xe[73]=xe[97]=0;Ee[73]=Ee[97]=1;be[145]=be[25]=0;Te[145]=Te[25]=-1;Ae[145]=Ae[25]=0;Re[145]=Re[25]=1;Le[145]=Le[25]=0;Ne[145]=Ne[25]=1;ke[145]=ke[25]=0;Ge[145]=Ge[25]=1;Ve[145]=Ve[25]=1;Me[145]=Me[25]=-1;Se[145]=Se[25]=0;we[145]=we[25]=0;Ce[70]=Ce[100]=0;Pe[70]=Pe[100]=1;Ie[70]=Ie[100]=0;Oe[70]=Oe[100]=-1;De[70]=De[100]=0;Fe[70]=Fe[100]=1;Ue[70]=Ue[100]=0;Be[70]=Be[100]=-1;ze[70]=ze[100]=1;_e[70]=_e[100]=1;xe[70]=xe[100]=0;Ee[70]=Ee[100]=0;Ce[101]=Ce[69]=0;Pe[101]=Pe[69]=1;Ie[101]=Ie[69]=0;_e[101]=_e[69]=1;xe[101]=xe[69]=0;Ee[101]=Ee[69]=0;ke[149]=ke[21]=0;Ge[149]=Ge[21]=1;Ve[149]=Ve[21]=1;Me[149]=Me[21]=-1;Se[149]=Se[21]=0;we[149]=we[21]=0;Oe[86]=Oe[84]=-1;De[86]=De[84]=0;Fe[86]=Fe[84]=1;Ue[86]=Ue[84]=0;Be[86]=Be[84]=-1;ze[86]=ze[84]=1;be[89]=be[81]=0;Te[89]=Te[81]=-1;Ae[89]=Ae[81]=0;Re[89]=Re[81]=1;Le[89]=Le[81]=0;Ne[89]=Ne[81]=1;be[96]=be[74]=0;Te[96]=Te[74]=1;Ae[96]=Ae[74]=0;Ce[96]=Ce[74]=-1;Pe[96]=Pe[74]=0;Ie[96]=Ie[74]=1;Ue[96]=Ue[74]=1;Be[96]=Be[74]=0;ze[96]=ze[74]=0;_e[96]=_e[74]=1;xe[96]=xe[74]=0;Ee[96]=Ee[74]=1;be[24]=be[146]=0;Te[24]=Te[146]=-1;Ae[24]=Ae[146]=1;Oe[24]=Oe[146]=1;De[24]=De[146]=0;Fe[24]=Fe[146]=1;Re[24]=Re[146]=0;Le[24]=Le[146]=1;Ne[24]=Ne[146]=1;Me[24]=Me[146]=0;Se[24]=Se[146]=-1;we[24]=we[146]=0;Ce[6]=Ce[164]=-1;Pe[6]=Pe[164]=0;Ie[6]=Ie[164]=1;Oe[6]=Oe[164]=-1;De[6]=De[164]=0;Fe[6]=Fe[164]=0;ke[6]=ke[164]=0;Ge[6]=Ge[164]=-1;Ve[6]=Ve[164]=1;Ue[6]=Ue[164]=1;Be[6]=Be[164]=0;ze[6]=ze[164]=0;Re[129]=Re[41]=0;Le[129]=Le[41]=1;Ne[129]=Ne[41]=1;ke[129]=ke[41]=0;Ge[129]=Ge[41]=1;Ve[129]=Ve[41]=0;_e[129]=_e[41]=-1;xe[129]=xe[41]=0;Ee[129]=Ee[41]=0;Me[129]=Me[41]=0;Se[129]=Se[41]=-1;we[129]=we[41]=0;Oe[66]=Oe[104]=0;De[66]=De[104]=1;Fe[66]=Fe[104]=0;Re[66]=Re[104]=-1;Le[66]=Le[104]=0;Ne[66]=Ne[104]=1;Ue[66]=Ue[104]=0;Be[66]=Be[104]=-1;ze[66]=ze[104]=0;_e[66]=_e[104]=0;xe[66]=xe[104]=-1;Ee[66]=Ee[104]=1;be[144]=be[26]=-1;Te[144]=Te[26]=0;Ae[144]=Ae[26]=0;ke[144]=ke[26]=1;Ge[144]=Ge[26]=0;Ve[144]=Ve[26]=1;Ue[144]=Ue[26]=0;Be[144]=Be[26]=1;ze[144]=ze[26]=1;Me[144]=Me[26]=-1;Se[144]=Se[26]=0;we[144]=we[26]=1;Ce[36]=Ce[134]=0;Pe[36]=Pe[134]=1;Ie[36]=Ie[134]=1;Oe[36]=Oe[134]=0;De[36]=De[134]=1;Fe[36]=Fe[134]=0;_e[36]=_e[134]=0;xe[36]=xe[134]=-1;Ee[36]=Ee[134]=1;Me[36]=Me[134]=1;Se[36]=Se[134]=0;we[36]=we[134]=0;be[9]=be[161]=-1;Te[9]=Te[161]=0;Ae[9]=Ae[161]=0;Ce[9]=Ce[161]=0;Pe[9]=Pe[161]=-1;Ie[9]=Ie[161]=0;Re[9]=Re[161]=1;Le[9]=Le[161]=0;Ne[9]=Ne[161]=0;ke[9]=ke[161]=1;Ge[9]=Ge[161]=0;Ve[9]=Ve[161]=1;be[136]=0;Te[136]=1;Ae[136]=1;Ce[136]=0;Pe[136]=1;Ie[136]=0;Oe[136]=-1;De[136]=0;Fe[136]=1;Re[136]=-1;Le[136]=0;Ne[136]=0;ke[136]=0;Ge[136]=-1;Ve[136]=0;Ue[136]=0;Be[136]=-1;ze[136]=1;_e[136]=1;xe[136]=0;Ee[136]=0;Me[136]=1;Se[136]=0;we[136]=1;be[34]=0;Te[34]=-1;Ae[34]=0;Ce[34]=0;Pe[34]=-1;Ie[34]=1;Oe[34]=1;De[34]=0;Fe[34]=0;Re[34]=1;Le[34]=0;Ne[34]=1;ke[34]=0;Ge[34]=1;Ve[34]=1;Ue[34]=0;Be[34]=1;ze[34]=0;_e[34]=-1;xe[34]=0;Ee[34]=1;Me[34]=-1;Se[34]=0;we[34]=0;be[35]=0;Te[35]=1;Ae[35]=1;Ce[35]=0;Pe[35]=-1;Ie[35]=1;Oe[35]=1;De[35]=0;Fe[35]=0;Re[35]=-1;Le[35]=0;Ne[35]=0;ke[35]=0;Ge[35]=-1;Ve[35]=0;Ue[35]=0;Be[35]=1;ze[35]=0;_e[35]=-1;xe[35]=0;Ee[35]=1;Me[35]=1;Se[35]=0;we[35]=1;be[153]=0;Te[153]=1;Ae[153]=1;Re[153]=-1;Le[153]=0;Ne[153]=0;ke[153]=0;Ge[153]=-1;Ve[153]=0;Me[153]=1;Se[153]=0;we[153]=1;Ce[102]=0;Pe[102]=-1;Ie[102]=1;Oe[102]=1;De[102]=0;Fe[102]=0;Ue[102]=0;Be[102]=1;ze[102]=0;_e[102]=-1;xe[102]=0;Ee[102]=1;be[155]=0;Te[155]=-1;Ae[155]=0;Re[155]=1;Le[155]=0;Ne[155]=1;ke[155]=0;Ge[155]=1;Ve[155]=1;Me[155]=-1;Se[155]=0;we[155]=0;Ce[103]=0;Pe[103]=1;Ie[103]=0;Oe[103]=-1;De[103]=0;Fe[103]=1;Ue[103]=0;Be[103]=-1;ze[103]=1;_e[103]=1;xe[103]=0;Ee[103]=0;be[152]=0;Te[152]=1;Ae[152]=1;Oe[152]=-1;De[152]=0;Fe[152]=1;Re[152]=-1;Le[152]=0;Ne[152]=0;ke[152]=0;Ge[152]=-1;Ve[152]=0;Ue[152]=0;Be[152]=-1;ze[152]=1;Me[152]=1;Se[152]=0;we[152]=1;be[156]=0;Te[156]=-1;Ae[156]=1;Oe[156]=1;De[156]=0;Fe[156]=1;Re[156]=-1;Le[156]=0;Ne[156]=0;ke[156]=0;Ge[156]=-1;Ve[156]=0;Ue[156]=0;Be[156]=1;ze[156]=1;Me[156]=-1;Se[156]=0;we[156]=1;be[137]=0;Te[137]=1;Ae[137]=1;Ce[137]=0;Pe[137]=1;Ie[137]=0;Re[137]=-1;Le[137]=0;Ne[137]=0;ke[137]=0;Ge[137]=-1;Ve[137]=0;_e[137]=1;xe[137]=0;Ee[137]=0;Me[137]=1;Se[137]=0;we[137]=1;be[139]=0;Te[139]=1;Ae[139]=1;Ce[139]=0;Pe[139]=-1;Ie[139]=0;Re[139]=1;Le[139]=0;Ne[139]=0;ke[139]=0;Ge[139]=1;Ve[139]=0;_e[139]=-1;xe[139]=0;Ee[139]=0;Me[139]=1;Se[139]=0;we[139]=1;be[98]=0;Te[98]=-1;Ae[98]=0;Ce[98]=0;Pe[98]=-1;Ie[98]=1;Oe[98]=1;De[98]=0;Fe[98]=0;Re[98]=1;Le[98]=0;Ne[98]=1;Ue[98]=0;Be[98]=1;ze[98]=0;_e[98]=-1;xe[98]=0;Ee[98]=1;be[99]=0;Te[99]=1;Ae[99]=0;Ce[99]=0;Pe[99]=-1;Ie[99]=1;Oe[99]=1;De[99]=0;Fe[99]=0;Re[99]=-1;Le[99]=0;Ne[99]=1;Ue[99]=0;Be[99]=-1;ze[99]=0;_e[99]=1;xe[99]=0;Ee[99]=1;Ce[38]=0;Pe[38]=-1;Ie[38]=1;Oe[38]=1;De[38]=0;Fe[38]=0;ke[38]=0;Ge[38]=1;Ve[38]=1;Ue[38]=0;Be[38]=1;ze[38]=0;_e[38]=-1;xe[38]=0;Ee[38]=1;Me[38]=-1;Se[38]=0;we[38]=0;Ce[39]=0;Pe[39]=1;Ie[39]=1;Oe[39]=-1;De[39]=0;Fe[39]=0;ke[39]=0;Ge[39]=-1;Ve[39]=1;Ue[39]=0;Be[39]=1;ze[39]=0;_e[39]=-1;xe[39]=0;Ee[39]=1;Me[39]=1;Se[39]=0;we[39]=0;var rd=function(r){return[[r.bottomleft,0],[0,0],[0,r.leftbottom]]},id=function(r){return[[1,r.rightbottom],[1,0],[r.bottomright,0]]},od=function(r){return[[r.topright,1],[1,1],[1,r.righttop]]},sd=function(r){return[[0,r.lefttop],[0,1],[r.topleft,1]]},ad=function(r){return[[r.bottomright,0],[r.bottomleft,0],[0,r.leftbottom],[0,r.lefttop]]},ud=function(r){return[[r.bottomright,0],[r.bottomleft,0],[1,r.righttop],[1,r.rightbottom]]},ld=function(r){return[[1,r.righttop],[1,r.rightbottom],[r.topleft,1],[r.topright,1]]},cd=function(r){return[[0,r.leftbottom],[0,r.lefttop],[r.topleft,1],[r.topright,1]]},kC=function(r){return[[0,0],[0,r.leftbottom],[1,r.rightbottom],[1,0]]},GC=function(r){return[[1,0],[r.bottomright,0],[r.topright,1],[1,1]]},VC=function(r){return[[1,1],[1,r.righttop],[0,r.lefttop],[0,1]]},HC=function(r){return[[r.bottomleft,0],[0,0],[0,1],[r.topleft,1]]},WC=function(r){return[[1,r.righttop],[1,r.rightbottom],[0,r.leftbottom],[0,r.lefttop]]},qC=function(r){return[[r.topleft,1],[r.topright,1],[r.bottomright,0],[r.bottomleft,0]]},XC=function(){return[[0,0],[0,1],[1,1],[1,0]]},YC=function(r){return[[1,r.rightbottom],[1,0],[0,0],[0,1],[r.topleft,1]]},ZC=function(r){return[[r.topright,1],[1,1],[1,0],[0,0],[0,r.leftbottom]]},JC=function(r){return[[1,0],[r.bottomright,0],[0,r.lefttop],[0,1],[1,1]]},$C=function(r){return[[1,1],[1,r.righttop],[r.bottomleft,0],[0,0],[0,1]]},KC=function(r){return[[1,r.righttop],[1,r.rightbottom],[0,r.lefttop],[0,1],[r.topleft,1]]},jC=function(r){return[[1,1],[1,r.righttop],[r.bottomright,0],[r.bottomleft,0],[r.topright,1]]},QC=function(r){return[[1,r.rightbottom],[1,0],[r.bottomright,0],[0,r.leftbottom],[0,r.lefttop]]},tP=function(r){return[[r.topright,1],[r.bottomleft,0],[0,0],[0,r.leftbottom],[r.topleft,1]]},eP=function(r){return[[r.bottomright,0],[r.bottomleft,0],[0,r.lefttop],[0,1],[r.topleft,1]]},nP=function(r){return[[1,1],[1,r.righttop],[0,r.leftbottom],[0,r.lefttop],[r.topright,1]]},rP=function(r){return[[1,r.rightbottom],[1,0],[r.bottomright,0],[r.topleft,1],[r.topright,1]]},iP=function(r){return[[1,r.righttop],[1,r.rightbottom],[r.bottomleft,0],[0,0],[0,r.leftbottom]]},oP=function(r){return[[1,r.rightbottom],[1,0],[0,0],[0,r.leftbottom],[r.topleft,1],[r.topright,1]]},sP=function(r){return[[1,1],[1,0],[r.bottomright,0],[0,r.leftbottom],[0,r.lefttop],[r.topright,1]]},aP=function(r){return[[1,1],[1,r.righttop],[r.bottomright,0],[r.bottomleft,0],[0,r.lefttop],[0,1]]},uP=function(r){return[[1,r.righttop],[1,r.rightbottom],[r.bottomleft,0],[0,0],[0,1],[r.topleft,1]]},lP=function(r){return[[1,1],[1,r.righttop],[r.bottomleft,0],[0,0],[0,r.leftbottom],[r.topright,1]]},cP=function(r){return[[1,r.rightbottom],[1,0],[r.bottomright,0],[0,r.lefttop],[0,1],[r.topleft,1]]},fP=function(r){return[[1,r.righttop],[1,r.rightbottom],[r.bottomright,0],[r.bottomleft,0],[0,r.leftbottom],[0,r.lefttop],[r.topleft,1],[r.topright,1]]},hP=function(r){return[[1,1],[1,r.righttop],[r.bottomleft,0],[0,0],[0,r.leftbottom],[r.topright,1]]},pP=function(r){return[[1,r.rightbottom],[1,0],[r.bottomright,0],[0,r.lefttop],[0,1],[r.topleft,1]]},dP=function(r){return[[1,1],[1,r.righttop],[r.bottomright,0],[r.bottomleft,0],[0,r.leftbottom],[0,r.lefttop],[r.topright,1]]},mP=function(r){return[[1,r.righttop],[1,r.rightbottom],[r.bottomleft,0],[0,0],[0,r.leftbottom],[r.topleft,1],[r.topright,1]]},gP=function(r){return[[1,r.righttop],[1,r.rightbottom],[r.bottomright,0],[r.bottomleft,0],[0,r.lefttop],[0,1],[r.topleft,1]]},yP=function(r){return[[1,r.rightbottom],[1,0],[r.bottomright,0],[0,r.leftbottom],[0,r.lefttop],[r.topleft,1],[r.topright,1]]},Xe=[],Ye=[],Ze=[],Je=[],$e=[],Ke=[],je=[],Qe=[];Je[1]=$e[1]=18;Je[169]=$e[169]=18;Ze[4]=Ye[4]=12;Ze[166]=Ye[166]=12;Xe[16]=Qe[16]=4;Xe[154]=Qe[154]=4;Ke[64]=je[64]=22;Ke[106]=je[106]=22;Ze[2]=Ke[2]=17;Je[2]=$e[2]=18;Ze[168]=Ke[168]=17;Je[168]=$e[168]=18;Xe[8]=Je[8]=9;Ye[8]=Ze[8]=12;Xe[162]=Je[162]=9;Ye[162]=Ze[162]=12;Xe[32]=Qe[32]=4;Ye[32]=je[32]=1;Xe[138]=Qe[138]=4;Ye[138]=je[138]=1;$e[128]=Qe[128]=21;Ke[128]=je[128]=22;$e[42]=Qe[42]=21;Ke[42]=je[42]=22;Ye[5]=$e[5]=14;Ye[165]=$e[165]=14;Ze[20]=Qe[20]=6;Ze[150]=Qe[150]=6;Xe[80]=Ke[80]=11;Xe[90]=Ke[90]=11;Je[65]=je[65]=3;Je[105]=je[105]=3;Xe[160]=Ke[160]=11;Ye[160]=$e[160]=14;Xe[10]=Ke[10]=11;Ye[10]=$e[10]=14;Ze[130]=Qe[130]=6;Je[130]=je[130]=3;Ze[40]=Qe[40]=6;Je[40]=je[40]=3;Ye[101]=je[101]=1;Ye[69]=je[69]=1;$e[149]=Qe[149]=21;$e[21]=Qe[21]=21;Ze[86]=Ke[86]=17;Ze[84]=Ke[84]=17;Xe[89]=Je[89]=9;Xe[81]=Je[81]=9;Xe[96]=je[96]=0;Ye[96]=Ke[96]=15;Xe[74]=je[74]=0;Ye[74]=Ke[74]=15;Xe[24]=Ze[24]=8;Je[24]=Qe[24]=7;Xe[146]=Ze[146]=8;Je[146]=Qe[146]=7;Ye[6]=Ke[6]=15;Ze[6]=$e[6]=16;Ye[164]=Ke[164]=15;Ze[164]=$e[164]=16;Je[129]=Qe[129]=7;$e[129]=je[129]=20;Je[41]=Qe[41]=7;$e[41]=je[41]=20;Ze[66]=je[66]=2;Je[66]=Ke[66]=19;Ze[104]=je[104]=2;Je[104]=Ke[104]=19;Xe[144]=$e[144]=10;Ke[144]=Qe[144]=23;Xe[26]=$e[26]=10;Ke[26]=Qe[26]=23;Ye[36]=Qe[36]=5;Ze[36]=je[36]=2;Ye[134]=Qe[134]=5;Ze[134]=je[134]=2;Xe[9]=$e[9]=10;Ye[9]=Je[9]=13;Xe[161]=$e[161]=10;Ye[161]=Je[161]=13;Ye[37]=Qe[37]=5;$e[37]=je[37]=20;Ye[133]=Qe[133]=5;$e[133]=je[133]=20;Ze[148]=$e[148]=16;Ke[148]=Qe[148]=23;Ze[22]=$e[22]=16;Ke[22]=Qe[22]=23;Xe[82]=Ze[82]=8;Je[82]=Ke[82]=19;Xe[88]=Ze[88]=8;Je[88]=Ke[88]=19;Xe[73]=je[73]=0;Ye[73]=Je[73]=13;Xe[97]=je[97]=0;Ye[97]=Je[97]=13;Xe[145]=Je[145]=9;$e[145]=Qe[145]=21;Xe[25]=Je[25]=9;$e[25]=Qe[25]=21;Ye[70]=je[70]=1;Ze[70]=Ke[70]=17;Ye[100]=je[100]=1;Ze[100]=Ke[100]=17;Xe[34]=Je[34]=9;Ye[34]=Ze[34]=12;$e[34]=Qe[34]=21;Ke[34]=je[34]=22;Xe[136]=Qe[136]=4;Ye[136]=je[136]=1;Ze[136]=Ke[136]=17;Je[136]=$e[136]=18;Xe[35]=Qe[35]=4;Ye[35]=Ze[35]=12;Je[35]=$e[35]=18;Ke[35]=je[35]=22;Xe[153]=Qe[153]=4;Je[153]=$e[153]=18;Ye[102]=Ze[102]=12;Ke[102]=je[102]=22;Xe[155]=Je[155]=9;$e[155]=Qe[155]=23;Ye[103]=je[103]=1;Ze[103]=Ke[103]=17;Xe[152]=Qe[152]=4;Ze[152]=Ke[152]=17;Je[152]=$e[152]=18;Xe[156]=Ze[156]=8;Je[156]=$e[156]=18;Ke[156]=Qe[156]=23;Xe[137]=Qe[137]=4;Ye[137]=je[137]=1;Je[137]=$e[137]=18;Xe[139]=Qe[139]=4;Ye[139]=Je[139]=13;$e[139]=je[139]=20;Xe[98]=Je[98]=9;Ye[98]=Ze[98]=12;Ke[98]=je[98]=22;Xe[99]=je[99]=0;Ye[99]=Ze[99]=12;Je[99]=Ke[99]=19;Ye[38]=Ze[38]=12;$e[38]=Qe[38]=21;Ke[38]=je[38]=22;Ye[39]=Qe[39]=5;Ze[39]=$e[39]=16;Ke[39]=je[39]=22;var Ft=[];Ft[1]=Ft[169]=rd;Ft[4]=Ft[166]=id;Ft[16]=Ft[154]=od;Ft[64]=Ft[106]=sd;Ft[168]=Ft[2]=ad;Ft[162]=Ft[8]=ud;Ft[138]=Ft[32]=ld;Ft[42]=Ft[128]=cd;Ft[5]=Ft[165]=kC;Ft[20]=Ft[150]=GC;Ft[80]=Ft[90]=VC;Ft[65]=Ft[105]=HC;Ft[160]=Ft[10]=WC;Ft[130]=Ft[40]=qC;Ft[85]=XC;Ft[101]=Ft[69]=YC;Ft[149]=Ft[21]=ZC;Ft[86]=Ft[84]=JC;Ft[89]=Ft[81]=$C;Ft[96]=Ft[74]=KC;Ft[24]=Ft[146]=jC;Ft[6]=Ft[164]=QC;Ft[129]=Ft[41]=tP;Ft[66]=Ft[104]=eP;Ft[144]=Ft[26]=nP;Ft[36]=Ft[134]=rP;Ft[9]=Ft[161]=iP;Ft[37]=Ft[133]=oP;Ft[148]=Ft[22]=sP;Ft[82]=Ft[88]=aP;Ft[73]=Ft[97]=uP;Ft[145]=Ft[25]=lP;Ft[70]=Ft[100]=cP;Ft[34]=function(r){return[cd(r),ud(r)]};Ft[35]=fP;Ft[136]=function(r){return[ld(r),ad(r)]};Ft[153]=function(r){return[od(r),rd(r)]};Ft[102]=function(r){return[id(r),sd(r)]};Ft[155]=hP;Ft[103]=pP;Ft[152]=function(r){return[od(r),ad(r)]};Ft[156]=dP;Ft[137]=function(r){return[ld(r),rd(r)]};Ft[139]=mP;Ft[98]=function(r){return[ud(r),sd(r)]};Ft[99]=gP;Ft[38]=function(r){return[id(r),cd(r)]};Ft[39]=yP;function _P(r){return(r>0)-(r<0)||+r}function uu(r,t,e){var o=t[0]-r[0],a=t[1]-r[1],l=e[0]-t[0],f=e[1]-t[1];return _P(o*f-l*a)}function r_(r,t){var e=r.geometry.coordinates[0].map(function(f){return f[0]}),o=r.geometry.coordinates[0].map(function(f){return f[1]}),a=t.geometry.coordinates[0].map(function(f){return f[0]}),l=t.geometry.coordinates[0].map(function(f){return f[1]});return Math.max.apply(null,e)===Math.max.apply(null,a)&&Math.max.apply(null,o)===Math.max.apply(null,l)&&Math.min.apply(null,e)===Math.min.apply(null,a)&&Math.min.apply(null,o)===Math.min.apply(null,l)}function fd(r,t){return t.geometry.coordinates[0].every(function(e){return yr(Sn(e),r)})}function i_(r,t){return r[0]===t[0]&&r[1]===t[1]}var xP=function(){function r(t){this.id=r.buildId(t),this.coordinates=t,this.innerEdges=[],this.outerEdges=[],this.outerEdgesSorted=!1}return r.buildId=function(t){return t.join(",")},r.prototype.removeInnerEdge=function(t){this.innerEdges=this.innerEdges.filter(function(e){return e.from.id!==t.from.id})},r.prototype.removeOuterEdge=function(t){this.outerEdges=this.outerEdges.filter(function(e){return e.to.id!==t.to.id})},r.prototype.addOuterEdge=function(t){this.outerEdges.push(t),this.outerEdgesSorted=!1},r.prototype.sortOuterEdges=function(){var t=this;this.outerEdgesSorted||(this.outerEdges.sort(function(e,o){var a=e.to,l=o.to;if(a.coordinates[0]-t.coordinates[0]>=0&&l.coordinates[0]-t.coordinates[0]<0)return 1;if(a.coordinates[0]-t.coordinates[0]<0&&l.coordinates[0]-t.coordinates[0]>=0)return-1;if(a.coordinates[0]-t.coordinates[0]===0&&l.coordinates[0]-t.coordinates[0]===0)return a.coordinates[1]-t.coordinates[1]>=0||l.coordinates[1]-t.coordinates[1]>=0?a.coordinates[1]-l.coordinates[1]:l.coordinates[1]-a.coordinates[1];var f=uu(t.coordinates,a.coordinates,l.coordinates);if(f<0)return 1;if(f>0)return-1;var h=Math.pow(a.coordinates[0]-t.coordinates[0],2)+Math.pow(a.coordinates[1]-t.coordinates[1],2),p=Math.pow(l.coordinates[0]-t.coordinates[0],2)+Math.pow(l.coordinates[1]-t.coordinates[1],2);return h-p}),this.outerEdgesSorted=!0)},r.prototype.getOuterEdges=function(){return this.sortOuterEdges(),this.outerEdges},r.prototype.getOuterEdge=function(t){return this.sortOuterEdges(),this.outerEdges[t]},r.prototype.addInnerEdge=function(t){this.innerEdges.push(t)},r}(),hd=xP;var EP=function(){function r(t,e){this.from=t,this.to=e,this.next=void 0,this.label=void 0,this.symetric=void 0,this.ring=void 0,this.from.addOuterEdge(this),this.to.addInnerEdge(this)}return r.prototype.getSymetric=function(){return this.symetric||(this.symetric=new r(this.to,this.from),this.symetric.symetric=this),this.symetric},r.prototype.deleteEdge=function(){this.from.removeOuterEdge(this),this.to.removeInnerEdge(this)},r.prototype.isEqual=function(t){return this.from.id===t.from.id&&this.to.id===t.to.id},r.prototype.toString=function(){return"Edge { "+this.from.id+" -> "+this.to.id+" }"},r.prototype.toLineString=function(){return gr([this.from.coordinates,this.to.coordinates])},r.prototype.compareTo=function(t){return uu(t.from.coordinates,t.to.coordinates,this.to.coordinates)},r}(),o_=EP;var MP=function(){function r(){this.edges=[],this.polygon=void 0,this.envelope=void 0}return r.prototype.push=function(t){this.edges.push(t),this.polygon=this.envelope=void 0},r.prototype.get=function(t){return this.edges[t]},Object.defineProperty(r.prototype,"length",{get:function(){return this.edges.length},enumerable:!0,configurable:!0}),r.prototype.forEach=function(t){this.edges.forEach(t)},r.prototype.map=function(t){return this.edges.map(t)},r.prototype.some=function(t){return this.edges.some(t)},r.prototype.isValid=function(){return!0},r.prototype.isHole=function(){var t=this,e=this.edges.reduce(function(f,h,p){return h.from.coordinates[1]>t.edges[f].from.coordinates[1]&&(f=p),f},0),o=(e===0?this.length:e)-1,a=(e+1)%this.length,l=uu(this.edges[o].from.coordinates,this.edges[e].from.coordinates,this.edges[a].from.coordinates);return l===0?this.edges[o].from.coordinates[0]>this.edges[a].from.coordinates[0]:l>0},r.prototype.toMultiPoint=function(){return Jh(this.edges.map(function(t){return t.from.coordinates}))},r.prototype.toPolygon=function(){if(this.polygon)return this.polygon;var t=this.edges.map(function(e){return e.from.coordinates});return t.push(this.edges[0].from.coordinates),this.polygon=Ln([t])},r.prototype.getEnvelope=function(){return this.envelope?this.envelope:this.envelope=dp(this.toPolygon())},r.findEdgeRingContaining=function(t,e){var o=t.getEnvelope(),a,l;return e.forEach(function(f){var h=f.getEnvelope();if(l&&(a=l.getEnvelope()),!r_(h,o)&&fd(h,o)){for(var p=t.map(function(w){return w.from.coordinates}),d=void 0,g=function(w){f.some(function(T){return i_(w,T.from.coordinates)})||(d=w)},_=0,y=p;_<y.length;_++){var M=y[_];g(M)}d&&f.inside(Sn(d))&&(!l||fd(a,h))&&(l=f)}}),l},r.prototype.inside=function(t){return yr(t,this.toPolygon())},r}(),pd=MP;function SP(r){if(!r)throw new Error("No geojson passed");if(r.type!=="FeatureCollection"&&r.type!=="GeometryCollection"&&r.type!=="MultiLineString"&&r.type!=="LineString"&&r.type!=="Feature")throw new Error("Invalid input type \'"+r.type+"\'. Geojson must be FeatureCollection, GeometryCollection, LineString, MultiLineString or Feature")}var YU=function(){function r(){this.edges=[],this.nodes={}}return r.fromGeoJson=function(t){SP(t);var e=new r;return Ei(t,function(o){Kh(o,"LineString","Graph::fromGeoJson"),f0(o,function(a,l){if(a){var f=e.getNode(a),h=e.getNode(l);e.addEdge(f,h)}return l})}),e},r.prototype.getNode=function(t){var e=hd.buildId(t),o=this.nodes[e];return o||(o=this.nodes[e]=new hd(t)),o},r.prototype.addEdge=function(t,e){var o=new o_(t,e),a=o.getSymetric();this.edges.push(o),this.edges.push(a)},r.prototype.deleteDangles=function(){var t=this;Object.keys(this.nodes).map(function(e){return t.nodes[e]}).forEach(function(e){return t._removeIfDangle(e)})},r.prototype._removeIfDangle=function(t){var e=this;if(t.innerEdges.length<=1){var o=t.getOuterEdges().map(function(a){return a.to});this.removeNode(t),o.forEach(function(a){return e._removeIfDangle(a)})}},r.prototype.deleteCutEdges=function(){var t=this;this._computeNextCWEdges(),this._findLabeledEdgeRings(),this.edges.forEach(function(e){e.label===e.symetric.label&&(t.removeEdge(e.symetric),t.removeEdge(e))})},r.prototype._computeNextCWEdges=function(t){var e=this;typeof t=="undefined"?Object.keys(this.nodes).forEach(function(o){return e._computeNextCWEdges(e.nodes[o])}):t.getOuterEdges().forEach(function(o,a){t.getOuterEdge((a===0?t.getOuterEdges().length:a)-1).symetric.next=o})},r.prototype._computeNextCCWEdges=function(t,e){for(var o=t.getOuterEdges(),a,l,f=o.length-1;f>=0;--f){var h=o[f],p=h.symetric,d=void 0,g=void 0;h.label===e&&(d=h),p.label===e&&(g=p),!(!d||!g)&&(g&&(l=g),d&&(l&&(l.next=d,l=void 0),a||(a=d)))}l&&(l.next=a)},r.prototype._findLabeledEdgeRings=function(){var t=[],e=0;return this.edges.forEach(function(o){if(!(o.label>=0)){t.push(o);var a=o;do a.label=e,a=a.next;while(!o.isEqual(a));e++}}),t},r.prototype.getEdgeRings=function(){var t=this;this._computeNextCWEdges(),this.edges.forEach(function(o){o.label=void 0}),this._findLabeledEdgeRings().forEach(function(o){t._findIntersectionNodes(o).forEach(function(a){t._computeNextCCWEdges(a,o.label)})});var e=[];return this.edges.forEach(function(o){o.ring||e.push(t._findEdgeRing(o))}),e},r.prototype._findIntersectionNodes=function(t){var e=[],o=t,a=function(){var l=0;o.from.getOuterEdges().forEach(function(f){f.label===t.label&&++l}),l>1&&e.push(o.from),o=o.next};do a();while(!t.isEqual(o));return e},r.prototype._findEdgeRing=function(t){var e=t,o=new pd;do o.push(e),e.ring=o,e=e.next;while(!t.isEqual(e));return o},r.prototype.removeNode=function(t){var e=this;t.getOuterEdges().forEach(function(o){return e.removeEdge(o)}),t.innerEdges.forEach(function(o){return e.removeEdge(o)}),delete this.nodes[t.id]},r.prototype.removeEdge=function(t){this.edges=this.edges.filter(function(e){return!e.isEqual(t)}),t.deleteEdge()},r}();var AP=Un(dd(),1);var CP=Un(dd(),1);var IP=Un(d_(),1);var UP=Un(w_(),1);function T_(r){for(var t=r,e=[];t.parent;)e.unshift(t),t=t.parent;return e}function zP(){return new A_(function(r){return r.f})}var vd={search:function(r,t,e,o){r.cleanDirty(),o=o||{};var a=o.heuristic||vd.heuristics.manhattan,l=o.closest||!1,f=zP(),h=t;for(t.h=a(t,e),f.push(t);f.size()>0;){var p=f.pop();if(p===e)return T_(p);p.closed=!0;for(var d=r.neighbors(p),g=0,_=d.length;g<_;++g){var y=d[g];if(!(y.closed||y.isWall())){var M=p.g+y.getCost(p),w=y.visited;(!w||M<y.g)&&(y.visited=!0,y.parent=p,y.h=y.h||a(y,e),y.g=M,y.f=y.g+y.h,r.markDirty(y),l&&(y.h<h.h||y.h===h.h&&y.g<h.g)&&(h=y),w?f.rescoreElement(y):f.push(y))}}}return l?T_(h):[]},heuristics:{manhattan:function(r,t){var e=Math.abs(t.x-r.x),o=Math.abs(t.y-r.y);return e+o},diagonal:function(r,t){var e=1,o=Math.sqrt(2),a=Math.abs(t.x-r.x),l=Math.abs(t.y-r.y);return e*(a+l)+(o-2*e)*Math.min(a,l)}},cleanNode:function(r){r.f=0,r.g=0,r.h=0,r.visited=!1,r.closed=!1,r.parent=null}};function sl(r,t){t=t||{},this.nodes=[],this.diagonal=!!t.diagonal,this.grid=[];for(var e=0;e<r.length;e++){this.grid[e]=[];for(var o=0,a=r[e];o<a.length;o++){var l=new ef(e,o,a[o]);this.grid[e][o]=l,this.nodes.push(l)}}this.init()}sl.prototype.init=function(){this.dirtyNodes=[];for(var r=0;r<this.nodes.length;r++)vd.cleanNode(this.nodes[r])};sl.prototype.cleanDirty=function(){for(var r=0;r<this.dirtyNodes.length;r++)vd.cleanNode(this.dirtyNodes[r]);this.dirtyNodes=[]};sl.prototype.markDirty=function(r){this.dirtyNodes.push(r)};sl.prototype.neighbors=function(r){var t=[],e=r.x,o=r.y,a=this.grid;return a[e-1]&&a[e-1][o]&&t.push(a[e-1][o]),a[e+1]&&a[e+1][o]&&t.push(a[e+1][o]),a[e]&&a[e][o-1]&&t.push(a[e][o-1]),a[e]&&a[e][o+1]&&t.push(a[e][o+1]),this.diagonal&&(a[e-1]&&a[e-1][o-1]&&t.push(a[e-1][o-1]),a[e+1]&&a[e+1][o-1]&&t.push(a[e+1][o-1]),a[e-1]&&a[e-1][o+1]&&t.push(a[e-1][o+1]),a[e+1]&&a[e+1][o+1]&&t.push(a[e+1][o+1])),t};sl.prototype.toString=function(){for(var r=[],t=this.grid,e,o,a,l,f=0,h=t.length;f<h;f++){for(e=[],o=t[f],a=0,l=o.length;a<l;a++)e.push(o[a].weight);r.push(e.join(" "))}return r.join(`\n`)};function ef(r,t,e){this.x=r,this.y=t,this.weight=e}ef.prototype.toString=function(){return"["+this.x+" "+this.y+"]"};ef.prototype.getCost=function(r){return r&&r.x!==this.x&&r.y!==this.y?this.weight*1.41421:this.weight};ef.prototype.isWall=function(){return this.weight===0};function A_(r){this.content=[],this.scoreFunction=r}A_.prototype={push:function(r){this.content.push(r),this.sinkDown(this.content.length-1)},pop:function(){var r=this.content[0],t=this.content.pop();return this.content.length>0&&(this.content[0]=t,this.bubbleUp(0)),r},remove:function(r){var t=this.content.indexOf(r),e=this.content.pop();t!==this.content.length-1&&(this.content[t]=e,this.scoreFunction(e)<this.scoreFunction(r)?this.sinkDown(t):this.bubbleUp(t))},size:function(){return this.content.length},rescoreElement:function(r){this.sinkDown(this.content.indexOf(r))},sinkDown:function(r){for(var t=this.content[r];r>0;){var e=(r+1>>1)-1,o=this.content[e];if(this.scoreFunction(t)<this.scoreFunction(o))this.content[e]=t,this.content[r]=o,r=e;else break}},bubbleUp:function(r){for(var t=this.content.length,e=this.content[r],o=this.scoreFunction(e);;){var a=r+1<<1,l=a-1,f=null,h;if(l<t){var p=this.content[l];h=this.scoreFunction(p),h<o&&(f=l)}if(a<t){var d=this.content[a],g=this.scoreFunction(d);g<(f===null?o:h)&&(f=a)}if(f!==null)this.content[r]=this.content[f],this.content[f]=e,r=f;else break}}};function _d(){this._=null}function cu(r){r.U=r.C=r.L=r.R=r.P=r.N=null}_d.prototype={constructor:_d,insert:function(r,t){var e,o,a;if(r){if(t.P=r,t.N=r.N,r.N&&(r.N.P=t),r.N=t,r.R){for(r=r.R;r.L;)r=r.L;r.L=t}else r.R=t;e=r}else this._?(r=C_(this._),t.P=null,t.N=r,r.P=r.L=t,e=r):(t.P=t.N=null,this._=t,e=null);for(t.L=t.R=null,t.U=e,t.C=!0,r=t;e&&e.C;)o=e.U,e===o.L?(a=o.R,a&&a.C?(e.C=a.C=!1,o.C=!0,r=o):(r===e.R&&(al(this,e),r=e,e=r.U),e.C=!1,o.C=!0,ul(this,o))):(a=o.L,a&&a.C?(e.C=a.C=!1,o.C=!0,r=o):(r===e.L&&(ul(this,e),r=e,e=r.U),e.C=!1,o.C=!0,al(this,o))),e=r.U;this._.C=!1},remove:function(r){r.N&&(r.N.P=r.P),r.P&&(r.P.N=r.N),r.N=r.P=null;var t=r.U,e,o=r.L,a=r.R,l,f;if(o?a?l=C_(a):l=o:l=a,t?t.L===r?t.L=l:t.R=l:this._=l,o&&a?(f=l.C,l.C=r.C,l.L=o,o.U=l,l!==a?(t=l.U,l.U=r.U,r=l.R,t.L=r,l.R=a,a.U=l):(l.U=t,t=l,r=l.R)):(f=r.C,r=l),r&&(r.U=t),!f){if(r&&r.C){r.C=!1;return}do{if(r===this._)break;if(r===t.L){if(e=t.R,e.C&&(e.C=!1,t.C=!0,al(this,t),e=t.R),e.L&&e.L.C||e.R&&e.R.C){(!e.R||!e.R.C)&&(e.L.C=!1,e.C=!0,ul(this,e),e=t.R),e.C=t.C,t.C=e.R.C=!1,al(this,t),r=this._;break}}else if(e=t.L,e.C&&(e.C=!1,t.C=!0,ul(this,t),e=t.L),e.L&&e.L.C||e.R&&e.R.C){(!e.L||!e.L.C)&&(e.R.C=!1,e.C=!0,al(this,e),e=t.L),e.C=t.C,t.C=e.L.C=!1,ul(this,t),r=this._;break}e.C=!0,r=t,t=t.U}while(!r.C);r&&(r.C=!1)}}};function al(r,t){var e=t,o=t.R,a=e.U;a?a.L===e?a.L=o:a.R=o:r._=o,o.U=a,e.U=o,e.R=o.L,e.R&&(e.R.U=e),o.L=e}function ul(r,t){var e=t,o=t.L,a=e.U;a?a.L===e?a.L=o:a.R=o:r._=o,o.U=a,e.U=o,e.L=o.R,e.L&&(e.L.U=e),o.R=e}function C_(r){for(;r.L;)r=r.L;return r}var xd=_d;function fu(r,t,e,o){var a=[null,null],l=_r.push(a)-1;return a.left=r,a.right=t,e&&ll(a,r,t,e),o&&ll(a,t,r,o),Qr[r.index].halfedges.push(l),Qr[t.index].halfedges.push(l),a}function hu(r,t,e){var o=[t,e];return o.left=r,o}function ll(r,t,e,o){!r[0]&&!r[1]?(r[0]=o,r.left=t,r.right=e):r.left===e?r[1]=o:r[0]=o}function kP(r,t,e,o,a){var l=r[0],f=r[1],h=l[0],p=l[1],d=f[0],g=f[1],_=0,y=1,M=d-h,w=g-p,T;if(T=t-h,!(!M&&T>0)){if(T/=M,M<0){if(T<_)return;T<y&&(y=T)}else if(M>0){if(T>y)return;T>_&&(_=T)}if(T=o-h,!(!M&&T<0)){if(T/=M,M<0){if(T>y)return;T>_&&(_=T)}else if(M>0){if(T<_)return;T<y&&(y=T)}if(T=e-p,!(!w&&T>0)){if(T/=w,w<0){if(T<_)return;T<y&&(y=T)}else if(w>0){if(T>y)return;T>_&&(_=T)}if(T=a-p,!(!w&&T<0)){if(T/=w,w<0){if(T>y)return;T>_&&(_=T)}else if(w>0){if(T<_)return;T<y&&(y=T)}return!(_>0)&&!(y<1)||(_>0&&(r[0]=[h+_*M,p+_*w]),y<1&&(r[1]=[h+y*M,p+y*w])),!0}}}}}function GP(r,t,e,o,a){var l=r[1];if(l)return!0;var f=r[0],h=r.left,p=r.right,d=h[0],g=h[1],_=p[0],y=p[1],M=(d+_)/2,w=(g+y)/2,T,x;if(y===g){if(M<t||M>=o)return;if(d>_){if(!f)f=[M,e];else if(f[1]>=a)return;l=[M,a]}else{if(!f)f=[M,a];else if(f[1]<e)return;l=[M,e]}}else if(T=(d-_)/(y-g),x=w-T*M,T<-1||T>1)if(d>_){if(!f)f=[(e-x)/T,e];else if(f[1]>=a)return;l=[(a-x)/T,a]}else{if(!f)f=[(a-x)/T,a];else if(f[1]<e)return;l=[(e-x)/T,e]}else if(g<y){if(!f)f=[t,T*t+x];else if(f[0]>=o)return;l=[o,T*o+x]}else{if(!f)f=[o,T*o+x];else if(f[0]<t)return;l=[t,T*t+x]}return r[0]=f,r[1]=l,!0}function P_(r,t,e,o){for(var a=_r.length,l;a--;)(!GP(l=_r[a],r,t,e,o)||!kP(l,r,t,e,o)||!(Math.abs(l[0][0]-l[1][0])>yn||Math.abs(l[0][1]-l[1][1])>yn))&&delete _r[a]}function I_(r){return Qr[r.index]={site:r,halfedges:[]}}function VP(r,t){var e=r.site,o=t.left,a=t.right;return e===a&&(a=o,o=e),a?Math.atan2(a[1]-o[1],a[0]-o[0]):(e===o?(o=t[1],a=t[0]):(o=t[0],a=t[1]),Math.atan2(o[0]-a[0],a[1]-o[1]))}function Ed(r,t){return t[+(t.left!==r.site)]}function HP(r,t){return t[+(t.left===r.site)]}function R_(){for(var r=0,t=Qr.length,e,o,a,l;r<t;++r)if((e=Qr[r])&&(l=(o=e.halfedges).length)){var f=new Array(l),h=new Array(l);for(a=0;a<l;++a)f[a]=a,h[a]=VP(e,_r[o[a]]);for(f.sort(function(p,d){return h[d]-h[p]}),a=0;a<l;++a)h[a]=o[f[a]];for(a=0;a<l;++a)o[a]=h[a]}}function L_(r,t,e,o){var a=Qr.length,l,f,h,p,d,g,_,y,M,w,T,x,v=!0;for(l=0;l<a;++l)if(f=Qr[l]){for(h=f.site,d=f.halfedges,p=d.length;p--;)_r[d[p]]||d.splice(p,1);for(p=0,g=d.length;p<g;)w=HP(f,_r[d[p]]),T=w[0],x=w[1],_=Ed(f,_r[d[++p%g]]),y=_[0],M=_[1],(Math.abs(T-y)>yn||Math.abs(x-M)>yn)&&(d.splice(p,0,_r.push(hu(h,w,Math.abs(T-r)<yn&&o-x>yn?[r,Math.abs(y-r)<yn?M:o]:Math.abs(x-o)<yn&&e-T>yn?[Math.abs(M-o)<yn?y:e,o]:Math.abs(T-e)<yn&&x-t>yn?[e,Math.abs(y-e)<yn?M:t]:Math.abs(x-t)<yn&&T-r>yn?[Math.abs(M-t)<yn?y:r,t]:null))-1),++g);g&&(v=!1)}if(v){var C,S,O,F=1/0;for(l=0,v=null;l<a;++l)(f=Qr[l])&&(h=f.site,C=h[0]-r,S=h[1]-t,O=C*C+S*S,O<F&&(F=O,v=f));if(v){var G=[r,t],z=[r,o],L=[e,o],D=[e,t];v.halfedges.push(_r.push(hu(h=v.site,G,z))-1,_r.push(hu(h,z,L))-1,_r.push(hu(h,L,D))-1,_r.push(hu(h,D,G))-1)}}for(l=0;l<a;++l)(f=Qr[l])&&(f.halfedges.length||delete Qr[l])}var N_=[],nf;function WP(){cu(this),this.x=this.y=this.arc=this.site=this.cy=null}function ta(r){var t=r.P,e=r.N;if(!(!t||!e)){var o=t.site,a=r.site,l=e.site;if(o!==l){var f=a[0],h=a[1],p=o[0]-f,d=o[1]-h,g=l[0]-f,_=l[1]-h,y=2*(p*_-d*g);if(!(y>=-O_)){var M=p*p+d*d,w=g*g+_*_,T=(_*M-d*w)/y,x=(p*w-g*M)/y,v=N_.pop()||new WP;v.arc=r,v.site=a,v.x=T+f,v.y=(v.cy=x+h)+Math.sqrt(T*T+x*x),r.circle=v;for(var C=null,S=pu._;S;)if(v.y<S.y||v.y===S.y&&v.x<=S.x)if(S.L)S=S.L;else{C=S.P;break}else if(S.R)S=S.R;else{C=S;break}pu.insert(C,v),C||(nf=v)}}}}function ea(r){var t=r.circle;t&&(t.P||(nf=t.N),pu.remove(t),N_.push(t),cu(t),r.circle=null)}var F_=[];function qP(){cu(this),this.edge=this.site=this.circle=null}function D_(r){var t=F_.pop()||new qP;return t.site=r,t}function Md(r){ea(r),na.remove(r),F_.push(r),cu(r)}function U_(r){var t=r.circle,e=t.x,o=t.cy,a=[e,o],l=r.P,f=r.N,h=[r];Md(r);for(var p=l;p.circle&&Math.abs(e-p.circle.x)<yn&&Math.abs(o-p.circle.cy)<yn;)l=p.P,h.unshift(p),Md(p),p=l;h.unshift(p),ea(p);for(var d=f;d.circle&&Math.abs(e-d.circle.x)<yn&&Math.abs(o-d.circle.cy)<yn;)f=d.N,h.push(d),Md(d),d=f;h.push(d),ea(d);var g=h.length,_;for(_=1;_<g;++_)d=h[_],p=h[_-1],ll(d.edge,p.site,d.site,a);p=h[0],d=h[g-1],d.edge=fu(p.site,d.site,null,a),ta(p),ta(d)}function B_(r){for(var t=r[0],e=r[1],o,a,l,f,h=na._;h;)if(l=z_(h,e)-t,l>yn)h=h.L;else if(f=t-XP(h,e),f>yn){if(!h.R){o=h;break}h=h.R}else{l>-yn?(o=h.P,a=h):f>-yn?(o=h,a=h.N):o=a=h;break}I_(r);var p=D_(r);if(na.insert(o,p),!(!o&&!a)){if(o===a){ea(o),a=D_(o.site),na.insert(p,a),p.edge=a.edge=fu(o.site,p.site),ta(o),ta(a);return}if(!a){p.edge=fu(o.site,p.site);return}ea(o),ea(a);var d=o.site,g=d[0],_=d[1],y=r[0]-g,M=r[1]-_,w=a.site,T=w[0]-g,x=w[1]-_,v=2*(y*x-M*T),C=y*y+M*M,S=T*T+x*x,O=[(x*C-M*S)/v+g,(y*S-T*C)/v+_];ll(a.edge,d,w,O),p.edge=fu(d,r,null,O),a.edge=fu(r,w,null,O),ta(o),ta(a)}}function z_(r,t){var e=r.site,o=e[0],a=e[1],l=a-t;if(!l)return o;var f=r.P;if(!f)return-1/0;e=f.site;var h=e[0],p=e[1],d=p-t;if(!d)return h;var g=h-o,_=1/l-1/d,y=g/d;return _?(-y+Math.sqrt(y*y-2*_*(g*g/(-2*d)-p+d/2+a-l/2)))/_+o:(o+h)/2}function XP(r,t){var e=r.N;if(e)return z_(e,t);var o=r.site;return o[1]===t?o[0]:1/0}var yn=1e-6,O_=1e-12,na,Qr,pu,_r;function YP(r,t,e){return(r[0]-e[0])*(t[1]-r[1])-(r[0]-t[0])*(e[1]-r[1])}function ZP(r,t){return t[1]-r[1]||t[0]-r[0]}function rf(r,t){var e=r.sort(ZP).pop(),o,a,l;for(_r=[],Qr=new Array(r.length),na=new xd,pu=new xd;;)if(l=nf,e&&(!l||e[1]<l.y||e[1]===l.y&&e[0]<l.x))(e[0]!==o||e[1]!==a)&&(B_(e),o=e[0],a=e[1]),e=r.pop();else if(l)U_(l.arc);else break;if(R_(),t){var f=+t[0][0],h=+t[0][1],p=+t[1][0],d=+t[1][1];P_(f,h,p,d),L_(f,h,p,d)}this.edges=_r,this.cells=Qr,na=pu=_r=Qr=null}rf.prototype={constructor:rf,polygons:function(){var r=this.edges;return this.cells.map(function(t){var e=t.halfedges.map(function(o){return Ed(t,r[o])});return e.data=t.site.data,e})},triangles:function(){var r=[],t=this.edges;return this.cells.forEach(function(e,o){if(h=(l=e.halfedges).length)for(var a=e.site,l,f=-1,h,p,d=t[l[h-1]],g=d.left===a?d.right:d.left;++f<h;)p=g,d=t[l[f]],g=d.left===a?d.right:d.left,p&&g&&o<p.index&&o<g.index&&YP(a,p,g)<0&&r.push([a.data,p.data,g.data])}),r},links:function(){return this.edges.filter(function(r){return r.right}).map(function(r){return{source:r.left.data,target:r.right.data}})},find:function(r,t,e){for(var o=this,a,l=o._found||0,f=o.cells.length,h;!(h=o.cells[l]);)if(++l>=f)return null;var p=r-h.site[0],d=t-h.site[1],g=p*p+d*d;do h=o.cells[a=l],l=null,h.halfedges.forEach(function(_){var y=o.edges[_],M=y.left;if(!((M===h.site||!M)&&!(M=y.right))){var w=r-M[0],T=t-M[1],x=w*w+T*T;x<g&&(g=x,l=M.index)}});while(l!==null);return o._found=a,e==null||g<=e*e?h.site:null}};var nI=Un(du(),1);var Ud=Un(H_(),1);function li(){return new af}function af(){this.reset()}af.prototype={constructor:af,reset:function(){this.s=this.t=0},add:function(r){W_(sf,r,this.t),W_(this,sf.s,this.s),this.s?this.t+=sf.t:this.s=sf.t},valueOf:function(){return this.s}};var sf=new af;function W_(r,t,e){var o=r.s=t+e,a=o-t,l=o-a;r.t=t-l+(e-a)}var cn=1e-6;var dn=Math.PI,or=dn/2,uf=dn/4,yo=dn*2,ra=180/dn,ci=dn/180,Bn=Math.abs,to=Math.atan,fi=Math.atan2,en=Math.cos;var lf=Math.exp;var cl=Math.log;var ye=Math.sin;var Ir=Math.sqrt,fl=Math.tan;function bd(r){return r>1?0:r<-1?dn:Math.acos(r)}function ti(r){return r>1?or:r<-1?-or:Math.asin(r)}function eo(){}var rI=li(),Gk=li();function ia(r){var t=r[0],e=r[1],o=en(e);return[o*en(t),o*ye(t),ye(e)]}function hl(r,t){return[r[1]*t[2]-r[2]*t[1],r[2]*t[0]-r[0]*t[2],r[0]*t[1]-r[1]*t[0]]}function pl(r){var t=Ir(r[0]*r[0]+r[1]*r[1]+r[2]*r[2]);r[0]/=t,r[1]/=t,r[2]/=t}var Kk=li();function X_(r,t){return[r>dn?r-yo:r<-dn?r+yo:r,t]}X_.invert=X_;function Td(){var r=[],t;return{point:function(e,o){t.push([e,o])},lineStart:function(){r.push(t=[])},lineEnd:eo,rejoin:function(){r.length>1&&r.push(r.pop().concat(r.shift()))},result:function(){var e=r;return r=[],t=null,e}}}function Ad(r,t){return Bn(r[0]-t[0])<cn&&Bn(r[1]-t[1])<cn}function cf(r,t,e,o){this.x=r,this.z=t,this.o=e,this.e=o,this.v=!1,this.n=this.p=null}function Cd(r,t,e,o,a){var l=[],f=[],h,p;if(r.forEach(function(w){if(!((T=w.length-1)<=0)){var T,x=w[0],v=w[T],C;if(Ad(x,v)){for(a.lineStart(),h=0;h<T;++h)a.point((x=w[h])[0],x[1]);a.lineEnd();return}l.push(C=new cf(x,w,null,!0)),f.push(C.o=new cf(x,null,C,!1)),l.push(C=new cf(v,w,null,!1)),f.push(C.o=new cf(v,null,C,!0))}}),!!l.length){for(f.sort(t),Y_(l),Y_(f),h=0,p=f.length;h<p;++h)f[h].e=e=!e;for(var d=l[0],g,_;;){for(var y=d,M=!0;y.v;)if((y=y.n)===d)return;g=y.z,a.lineStart();do{if(y.v=y.o.v=!0,y.e){if(M)for(h=0,p=g.length;h<p;++h)a.point((_=g[h])[0],_[1]);else o(y.x,y.n.x,1,a);y=y.n}else{if(M)for(g=y.p.z,h=g.length-1;h>=0;--h)a.point((_=g[h])[0],_[1]);else o(y.x,y.p.x,-1,a);y=y.p}y=y.o,g=y.z,M=!M}while(!y.v);a.lineEnd()}}}function Y_(r){if(t=r.length){for(var t,e=0,o=r[0],a;++e<t;)o.n=a=r[e],a.p=o,o=a;o.n=a=r[0],a.p=o}}function Ms(r,t){return r<t?-1:r>t?1:r>=t?0:NaN}function Pd(r){return r.length===1&&(r=sI(r)),{left:function(t,e,o,a){for(o==null&&(o=0),a==null&&(a=t.length);o<a;){var l=o+a>>>1;r(t[l],e)<0?o=l+1:a=l}return o},right:function(t,e,o,a){for(o==null&&(o=0),a==null&&(a=t.length);o<a;){var l=o+a>>>1;r(t[l],e)>0?a=l:o=l+1}return o}}}function sI(r){return function(t,e){return Ms(r(t),e)}}var Z_=Pd(Ms),aI=Z_.right,uI=Z_.left;var J_=Array.prototype,cI=J_.slice,fI=J_.map;var HG=Math.sqrt(50),WG=Math.sqrt(10),qG=Math.sqrt(2);function hf(r){for(var t=r.length,e,o=-1,a=0,l,f;++o<t;)a+=r[o].length;for(l=new Array(a);--t>=0;)for(f=r[t],e=f.length;--e>=0;)l[--a]=f[e];return l}var _I=1e9,C5=-_I;var Id=li();function Rd(r,t){var e=t[0],o=t[1],a=[ye(e),-en(e),0],l=0,f=0;Id.reset();for(var h=0,p=r.length;h<p;++h)if(g=(d=r[h]).length)for(var d,g,_=d[g-1],y=_[0],M=_[1]/2+uf,w=ye(M),T=en(M),x=0;x<g;++x,y=C,w=O,T=F,_=v){var v=d[x],C=v[0],S=v[1]/2+uf,O=ye(S),F=en(S),G=C-y,z=G>=0?1:-1,L=z*G,D=L>dn,q=w*O;if(Id.add(fi(q*z*ye(L),T*F+q*en(L))),l+=D?G+z*yo:G,D^y>=e^C>=e){var nt=hl(ia(_),ia(v));pl(nt);var k=hl(a,nt);pl(k);var xt=(D^G>=0?-1:1)*ti(k[2]);(o>xt||o===xt&&(nt[0]||nt[1]))&&(f+=D^G>=0?1:-1)}}return(l<-cn||l<cn&&Id<-cn)^f&1}var B5=li();var rV=li(),iV=li();var MI=1/0;var aV=-MI;function Ld(r){this._context=r}Ld.prototype={_radius:4.5,pointRadius:function(r){return this._radius=r,this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){this._line===0&&this._context.closePath(),this._point=NaN},point:function(r,t){switch(this._point){case 0:{this._context.moveTo(r,t),this._point=1;break}case 1:{this._context.lineTo(r,t);break}default:{this._context.moveTo(r+this._radius,t),this._context.arc(r,t,this._radius,0,yo);break}}},result:eo};var yV=li();function Nd(){this._string=[]}Nd.prototype={_radius:4.5,_circle:j_(4.5),pointRadius:function(r){return(r=+r)!==this._radius&&(this._radius=r,this._circle=null),this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){this._line===0&&this._string.push("Z"),this._point=NaN},point:function(r,t){switch(this._point){case 0:{this._string.push("M",r,",",t),this._point=1;break}case 1:{this._string.push("L",r,",",t);break}default:{this._circle==null&&(this._circle=j_(this._radius)),this._string.push("M",r,",",t,this._circle);break}}},result:function(){if(this._string.length){var r=this._string.join("");return this._string=[],r}else return null}};function j_(r){return"m0,"+r+"a"+r+","+r+" 0 1,1 0,"+-2*r+"a"+r+","+r+" 0 1,1 0,"+2*r+"z"}function Od(r,t,e,o){return function(a,l){var f=t(l),h=a.invert(o[0],o[1]),p=Td(),d=t(p),g=!1,_,y,M,w={point:T,lineStart:v,lineEnd:C,polygonStart:function(){w.point=S,w.lineStart=O,w.lineEnd=F,y=[],_=[]},polygonEnd:function(){w.point=T,w.lineStart=v,w.lineEnd=C,y=hf(y);var G=Rd(_,h);y.length?(g||(l.polygonStart(),g=!0),Cd(y,bI,G,e,l)):G&&(g||(l.polygonStart(),g=!0),l.lineStart(),e(null,null,1,l),l.lineEnd()),g&&(l.polygonEnd(),g=!1),y=_=null},sphere:function(){l.polygonStart(),l.lineStart(),e(null,null,1,l),l.lineEnd(),l.polygonEnd()}};function T(G,z){var L=a(G,z);r(G=L[0],z=L[1])&&l.point(G,z)}function x(G,z){var L=a(G,z);f.point(L[0],L[1])}function v(){w.point=x,f.lineStart()}function C(){w.point=T,f.lineEnd()}function S(G,z){M.push([G,z]);var L=a(G,z);d.point(L[0],L[1])}function O(){d.lineStart(),M=[]}function F(){S(M[0][0],M[0][1]),d.lineEnd();var G=d.clean(),z=p.result(),L,D=z.length,q,nt,k;if(M.pop(),_.push(M),M=null,!!D){if(G&1){if(nt=z[0],(q=nt.length-1)>0){for(g||(l.polygonStart(),g=!0),l.lineStart(),L=0;L<q;++L)l.point((k=nt[L])[0],k[1]);l.lineEnd()}return}D>1&&G&2&&z.push(z.pop().concat(z.shift())),y.push(z.filter(wI))}}return w}}function wI(r){return r.length>1}function bI(r,t){return((r=r.x)[0]<0?r[1]-or-cn:or-r[1])-((t=t.x)[0]<0?t[1]-or-cn:or-t[1])}var TI=Od(function(){return!0},AI,PI,[-dn,-or]);function AI(r){var t=NaN,e=NaN,o=NaN,a;return{lineStart:function(){r.lineStart(),a=1},point:function(l,f){var h=l>0?dn:-dn,p=Bn(l-t);Bn(p-dn)<cn?(r.point(t,e=(e+f)/2>0?or:-or),r.point(o,e),r.lineEnd(),r.lineStart(),r.point(h,e),r.point(l,e),a=0):o!==h&&p>=dn&&(Bn(t-o)<cn&&(t-=o*cn),Bn(l-h)<cn&&(l-=h*cn),e=CI(t,e,l,f),r.point(o,e),r.lineEnd(),r.lineStart(),r.point(h,e),a=0),r.point(t=l,e=f),o=h},lineEnd:function(){r.lineEnd(),t=e=NaN},clean:function(){return 2-a}}}function CI(r,t,e,o){var a,l,f=ye(r-e);return Bn(f)>cn?to((ye(t)*(l=en(o))*ye(e)-ye(o)*(a=en(t))*ye(r))/(a*l*f)):(t+o)/2}function PI(r,t,e,o){var a;if(r==null)a=e*or,o.point(-dn,a),o.point(0,a),o.point(dn,a),o.point(dn,0),o.point(dn,-a),o.point(0,-a),o.point(-dn,-a),o.point(-dn,0),o.point(-dn,a);else if(Bn(r[0]-t[0])>cn){var l=r[0]<t[0]?dn:-dn;a=e*l/2,o.point(-l,a),o.point(0,a),o.point(l,a)}else o.point(t[0],t[1])}function pf(r){return function(t){var e=new Dd;for(var o in r)e[o]=r[o];return e.stream=t,e}}function Dd(){}Dd.prototype={constructor:Dd,point:function(r,t){this.stream.point(r,t)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};var iH=en(30*ci);var vH=pf({point:function(r,t){this.stream.point(r*ci,t*ci)}});function df(r){return function(t,e){var o=en(t),a=en(e),l=r(o*a);return[l*a*ye(t),l*ye(e)]}}function vo(r){return function(t,e){var o=Ir(t*t+e*e),a=r(o),l=ye(a),f=en(a);return[fi(t*l,o*f),ti(o&&e*l/o)]}}var o1=df(function(r){return Ir(2/(1+r))});o1.invert=vo(function(r){return 2*ti(r/2)});var s1=df(function(r){return(r=bd(r))&&r/ye(r)});s1.invert=vo(function(r){return r});function Fd(r,t){return[r,cl(fl((or+t)/2))]}Fd.invert=function(r,t){return[r,2*to(lf(t))-or]};function mf(r,t){return[r,t]}mf.invert=mf;function a1(r,t){var e=en(t),o=en(r)*e;return[e*ye(r)/o,ye(t)/o]}a1.invert=vo(to);function u1(r,t){var e=t*t,o=e*e;return[r*(.8707-.131979*e+o*(-.013791+o*(.003971*e-.001529*o))),t*(1.007226+e*(.015085+o*(-.044475+.028874*e-.005916*o)))]}u1.invert=function(r,t){var e=t,o=25,a;do{var l=e*e,f=l*l;e-=a=(e*(1.007226+l*(.015085+f*(-.044475+.028874*l-.005916*f)))-t)/(1.007226+l*(.015085*3+f*(-.044475*7+.028874*9*l-.005916*11*f)))}while(Bn(a)>cn&&--o>0);return[r/(.8707+(l=e*e)*(-.131979+l*(-.013791+l*l*l*(.003971-.001529*l)))),e]};function l1(r,t){return[en(t)*ye(r),ye(t)]}l1.invert=vo(ti);function c1(r,t){var e=en(t),o=1+en(r)*e;return[e*ye(r)/o,ye(t)/o]}c1.invert=vo(function(r){return 2*to(r)});function f1(r,t){return[cl(fl((or+t)/2)),-r]}f1.invert=function(r,t){return[-t,2*to(lf(r))-or]};var DI=Un(du(),1);var FI=Un(du(),1);var BI=Un(du(),1);var zI=Un(du(),1);function dl(r,t){return Math.sqrt((t[0]-r[0])**2+(t[1]-r[1])**2)}self.onmessage=r=>{switch(r.data.type){case"fetch_project_road":ZI(r.data.data.fetchOption);break;case"get_direction_path":let t=KI(r.data.data.points);Bd("direction_path_result",{path:t,key:r.data.data.key});break;case"get_path":let e=JI(r.data.data.start,r.data.data.end);Bd("get_path_result",{path:e,key:r.data.data.key});break}};function Bd(r,t){self.postMessage({type:r,data:t})}var ws=new Map,zd=new Map,Zo=new Map,p1=new kd.default;async function ZI(r){try{let e=(await c0(r.url,r)).data.map(l=>JSON.parse(l.road_info)),o=new Map,a=new Map;e.length&&(e.forEach(l=>{l.points.forEach(f=>{let h=`${l.floor}-${f.id}`;if(ws.set(h,f),zd.set(`${f.floor}-${f.nodeId}`,h),["straightLadder","staircase"].includes(f.type)){let p=o.get(f.name)||[];p.push({floor:f.floor,id:f.id}),o.set(f.name,p)}if(f.type==="escalator"){let p=a.get(f.name)||{};f.escalatorDirection==="exit"?p.end={floor:f.floor,id:f.id}:p.start={floor:f.floor,id:f.id},a.set(f.name,p)}}),l.lines.forEach(f=>{var _,y;let h=`${l.floor}-${f.from}`,p=`${l.floor}-${f.to}`,d=(_=ws.get(h))==null?void 0:_.cds,g=(y=ws.get(p))==null?void 0:y.cds;if(d!=null&&d.length&&(g!=null&&g.length)){let M=dl(d,g),w=Zo.get(h)||new Map;if(w.set(p,M),Zo.set(h,w),f.direction==="double"){let T=Zo.get(p)||new Map;T.set(h,M),Zo.set(p,T)}}})}),o.forEach((l,f)=>{var h,p;for(let d=0;d<l.length;d++){let g=`${l[d].floor}-${l[d].id}`;for(let _=0;_<l.length;_++)if(d!==_){let y=`${l[_].floor}-${l[_].id}`,M=(h=ws.get(g))==null?void 0:h.cds,w=(p=ws.get(y))==null?void 0:p.cds;if(M!=null&&M.length&&(w!=null&&w.length)){let x=Zo.get(g)||new Map;x.set(y,1),Zo.set(g,x)}}}}),a.forEach((l,f)=>{var h,p;if(l.start&&l.end){let d=`${l.start.floor}-${l.start.id}`,g=`${l.end.floor}-${l.end.id}`,_=(h=ws.get(d))==null?void 0:h.cds,y=(p=ws.get(g))==null?void 0:p.cds;if(_!=null&&_.length&&(y!=null&&y.length)){let w=Zo.get(d)||new Map;w.set(g,1),Zo.set(d,w)}}}),p1=new kd.default(Zo)),Bd("fetch_project_road_result",{result:!0})}catch(t){console.error("[\\u83B7\\u53D6\\u8DEF\\u7F51\\u9519\\u8BEF]",t)}}function JI(r,t){let e=`${r.floor}-${r.nodeId}`,o=`${t.floor}-${t.nodeId}`,a=zd.get(e),l=zd.get(o),f=p1.path(a,l);if(!f)return null;let h=[];return f.map(p=>{var g;let d=ws.get(p);if(d){let{floor:_}=d;if(((g=h[h.length-1])==null?void 0:g.floor)===_){let y=h[h.length-1];y.points.push(d.cds),y.endType=d.type}else h.push({floor:_,points:[d.cds],endType:d.type})}}),h}function $I(r,t,e){let o=new fn(t[0]-r[0],t[1]-r[1]),a=new fn(t[0]-e[0],t[1]-e[1]),f=o.angleTo(a)*180/Math.PI,h=new fn(t[0]-r[0],t[1]-r[1]);return new fn(e[0]-r[0],e[1]-r[1]).cross(h)>0?f:-f}function KI(r){let t=[{direction:"start",distance:dl(r[0],r[1]),points:[r[0],r[1]]}];for(let e=2;e<r.length;e++){let o=jI(r[e-2],r[e-1],r[e]);if(o==="front"){let a=t[t.length-1],l=dl(r[e-1],r[e]);a.distance+=l,e!==2&&a.points.push(r[e-1])}else t.push({direction:o,distance:dl(r[e-1],r[e]),points:[r[e-1],r[e]]})}return t.push({direction:"end",distance:0,points:[r[r.length-1]]}),t}function jI(r,t,e){let o=$I(r,t,e);return 180-Math.abs(o)<15?"front":o>135?"right_front":o<-135?"left_front":o<=135&&o>=60?"right":o>=-135&&o<=-60?"left":o<60&&o>0?"right_back":o>-60&&o<0?"left_back":"front"}\n/*! Bundled license information:\n\nobject-assign/index.js:\n (*\n object-assign\n (c) Sindre Sorhus\n @license MIT\n *)\n\npolygon-clipping/dist/polygon-clipping.umd.js:\n (**\n * splaytree v3.1.0\n * Fast Splay tree for Node and browser\n *\n * @author Alexander Milevski <info@w8r.name>\n * @license MIT\n * @preserve\n *)\n\nthree/build/three.module.js:\n (**\n * @license\n * Copyright 2010-2023 Three.js Authors\n * SPDX-License-Identifier: MIT\n *)\n\n@turf/isolines/dist/es/index.js:\n (**\n * @license GNU Affero General Public License.\n * Copyright (c) 2015, 2015 Ronny Lorenz <ronny@tbi.univie.ac.at>\n * v. 1.2.0\n * https://github.com/RaumZeit/MarchingSquares.js\n *\n * MarchingSquaresJS is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * MarchingSquaresJS is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * As additional permission under GNU Affero General Public License version 3\n * section 7, third-party projects (personal or commercial) may distribute,\n * include, or link against UNMODIFIED VERSIONS of MarchingSquaresJS without the\n * requirement that said third-party project for that reason alone becomes\n * subject to any requirement of the GNU Affero General Public License version 3.\n * Any modifications to MarchingSquaresJS, however, must be shared with the public\n * and made available.\n *\n * In summary this:\n * - allows you to use MarchingSquaresJS at no cost\n * - allows you to use MarchingSquaresJS for both personal and commercial purposes\n * - allows you to distribute UNMODIFIED VERSIONS of MarchingSquaresJS under any\n * license as long as this license notice is included\n * - enables you to keep the source code of your program that uses MarchingSquaresJS\n * undisclosed\n * - forces you to share any modifications you have made to MarchingSquaresJS,\n * e.g. bug-fixes\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with MarchingSquaresJS. If not, see <http://www.gnu.org/licenses/>.\n *)\n\n@turf/isobands/dist/es/index.js:\n (*!\n * @license GNU Affero General Public License.\n * Copyright (c) 2015, 2015 Ronny Lorenz <ronny@tbi.univie.ac.at>\n * v. 1.2.0\n * https://github.com/RaumZeit/MarchingSquares.js\n *\n * MarchingSquaresJS is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * MarchingSquaresJS is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * As additional permission under GNU Affero General Public License version 3\n * section 7, third-party projects (personal or commercial) may distribute,\n * include, or link against UNMODIFIED VERSIONS of MarchingSquaresJS without the\n * requirement that said third-party project for that reason alone becomes\n * subject to any requirement of the GNU Affero General Public License version 3.\n * Any modifications to MarchingSquaresJS, however, must be shared with the public\n * and made available.\n *\n * In summary this:\n * - allows you to use MarchingSquaresJS at no cost\n * - allows you to use MarchingSquaresJS for both personal and commercial purposes\n * - allows you to distribute UNMODIFIED VERSIONS of MarchingSquaresJS under any\n * license as long as this license notice is included\n * - enables you to keep the source code of your program that uses MarchingSquaresJS\n * undisclosed\n * - forces you to share any modifications you have made to MarchingSquaresJS,\n * e.g. bug-fixes\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with MarchingSquaresJS. If not, see <http://www.gnu.org/licenses/>.\n *)\n*/\n');
|
|
4277
|
+
return inlineWorker('var T1=Object.create;var Af=Object.defineProperty;var A1=Object.getOwnPropertyDescriptor;var C1=Object.getOwnPropertyNames,lm=Object.getOwnPropertySymbols,P1=Object.getPrototypeOf,fm=Object.prototype.hasOwnProperty,I1=Object.prototype.propertyIsEnumerable;var cm=(r,t,e)=>t in r?Af(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,hm=(r,t)=>{for(var e in t||(t={}))fm.call(t,e)&&cm(r,e,t[e]);if(lm)for(var e of lm(t))I1.call(t,e)&&cm(r,e,t[e]);return r};var Kt=(r,t)=>()=>(t||r((t={exports:{}}).exports,t),t.exports);var R1=(r,t,e,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of C1(t))!fm.call(r,a)&&a!==e&&Af(r,a,{get:()=>t[a],enumerable:!(o=A1(t,a))||o.enumerable});return r};var Un=(r,t,e)=>(e=r!=null?T1(P1(r)):{},R1(t||!r||!r.__esModule?Af(e,"default",{value:r,enumerable:!0}):e,r));var dm=Kt((sR,pm)=>{var Cf=class{constructor(){this.keys=new Set,this.queue=[]}sort(){this.queue.sort((t,e)=>t.priority-e.priority)}set(t,e){let o=Number(e);if(isNaN(o))throw new TypeError(\'"priority" must be a number\');return this.keys.has(t)?this.queue.map(a=>(a.key===t&&Object.assign(a,{priority:o}),a)):(this.keys.add(t),this.queue.push({key:t,priority:o})),this.sort(),this.queue.length}next(){let t=this.queue.shift();return this.keys.delete(t.key),t}isEmpty(){return this.queue.length===0}has(t){return this.keys.has(t)}get(t){return this.queue.find(e=>e.key===t)}};pm.exports=Cf});var ym=Kt((aR,gm)=>{function mm(r,t){let e=new Map;for(let[o,a]of r)o!==t&&a instanceof Map?e.set(o,mm(a,t)):o!==t&&e.set(o,a);return e}gm.exports=mm});var xm=Kt((uR,_m)=>{function L1(r){let t=Number(r);return!(isNaN(t)||t<=0)}function vm(r){let t=new Map;return Object.keys(r).forEach(o=>{let a=r[o];if(a!==null&&typeof a=="object"&&!Array.isArray(a))return t.set(o,vm(a));if(!L1(a))throw new Error(`Could not add node at key "${o}", make sure it\'s a valid node`,a);return t.set(o,Number(a))}),t}_m.exports=vm});var Sm=Kt((lR,Mm)=>{function Em(r){if(!(r instanceof Map))throw new Error(`Invalid graph: Expected Map instead found ${typeof r}`);r.forEach((t,e)=>{if(typeof t=="object"&&t instanceof Map){Em(t);return}if(typeof t!="number"||t<=0)throw new Error(`Values must be numbers greater than 0. Found value ${t} at ${e}`)})}Mm.exports=Em});var Am=Kt((cR,Tm)=>{var N1=dm(),O1=ym(),wm=xm(),bm=Sm(),Pf=class{constructor(t){t instanceof Map?(bm(t),this.graph=t):t?this.graph=wm(t):this.graph=new Map}addNode(t,e){let o;return e instanceof Map?(bm(e),o=e):o=wm(e),this.graph.set(t,o),this}addVertex(t,e){return this.addNode(t,e)}removeNode(t){return this.graph=O1(this.graph,t),this}path(t,e,o={}){if(!this.graph.size)return o.cost?{path:null,cost:0}:null;let a=new Set,l=new N1,f=new Map,h=[],p=0,d=[];if(o.avoid&&(d=[].concat(o.avoid)),d.includes(t))throw new Error(`Starting node (${t}) cannot be avoided`);if(d.includes(e))throw new Error(`Ending node (${e}) cannot be avoided`);for(l.set(t,0);!l.isEmpty();){let g=l.next();if(g.key===e){p=g.priority;let y=g.key;for(;f.has(y);)h.push(y),y=f.get(y);break}a.add(g.key),(this.graph.get(g.key)||new Map).forEach((y,M)=>{if(a.has(M)||d.includes(M))return null;if(!l.has(M))return f.set(M,g.key),l.set(M,g.priority+y);let w=l.get(M).priority,A=g.priority+y;return A<w?(f.set(M,g.key),l.set(M,A)):null})}return h.length?(o.trim?h.shift():h=h.concat([t]),o.reverse||(h=h.reverse()),o.cost?{path:h,cost:p}:h):o.cost?{path:null,cost:0}:null}shortestPath(...t){return this.path(...t)}};Tm.exports=Pf});var mc=Kt((xR,v0)=>{"use strict";var y0=Object.getOwnPropertySymbols,Db=Object.prototype.hasOwnProperty,Fb=Object.prototype.propertyIsEnumerable;function Ub(r){if(r==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(r)}function Bb(){try{if(!Object.assign)return!1;var r=new String("abc");if(r[5]="de",Object.getOwnPropertyNames(r)[0]==="5")return!1;for(var t={},e=0;e<10;e++)t["_"+String.fromCharCode(e)]=e;var o=Object.getOwnPropertyNames(t).map(function(l){return t[l]});if(o.join("")!=="0123456789")return!1;var a={};return"abcdefghijklmnopqrst".split("").forEach(function(l){a[l]=l}),Object.keys(Object.assign({},a)).join("")==="abcdefghijklmnopqrst"}catch(l){return!1}}v0.exports=Bb()?Object.assign:function(r,t){for(var e,o=Ub(r),a,l=1;l<arguments.length;l++){e=Object(arguments[l]);for(var f in e)Db.call(e,f)&&(o[f]=e[f]);if(y0){a=y0(e);for(var h=0;h<a.length;h++)Fb.call(e,a[h])&&(o[a[h]]=e[a[h]])}}return o}});var ep=Kt((Qh,tp)=>{(function(r,t){typeof Qh=="object"&&typeof tp!="undefined"?tp.exports=t():typeof define=="function"&&define.amd?define(t):(r=r||self).RBush=t()})(Qh,function(){"use strict";function r(x,v,C,S,O){(function F(G,z,L,D,q){for(;D>L;){if(D-L>600){var nt=D-L+1,k=z-L+1,xt=Math.log(nt),X=.5*Math.exp(2*xt/3),it=.5*Math.sqrt(xt*X*(nt-X)/nt)*(k-nt/2<0?-1:1),vt=Math.max(L,Math.floor(z-k*X/nt+it)),pt=Math.min(D,Math.floor(z+(nt-k)*X/nt+it));F(G,z,vt,pt,q)}var et=G[z],ot=L,V=D;for(t(G,L,z),q(G[D],et)>0&&t(G,L,D);ot<V;){for(t(G,ot,V),ot++,V--;q(G[ot],et)<0;)ot++;for(;q(G[V],et)>0;)V--}q(G[L],et)===0?t(G,L,V):t(G,++V,D),V<=z&&(L=V+1),z<=V&&(D=V-1)}})(x,v,C||0,S||x.length-1,O||e)}function t(x,v,C){var S=x[v];x[v]=x[C],x[C]=S}function e(x,v){return x<v?-1:x>v?1:0}var o=function(x){x===void 0&&(x=9),this._maxEntries=Math.max(4,x),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()};function a(x,v,C){if(!C)return v.indexOf(x);for(var S=0;S<v.length;S++)if(C(x,v[S]))return S;return-1}function l(x,v){f(x,0,x.children.length,v,x)}function f(x,v,C,S,O){O||(O=w(null)),O.minX=1/0,O.minY=1/0,O.maxX=-1/0,O.maxY=-1/0;for(var F=v;F<C;F++){var G=x.children[F];h(O,x.leaf?S(G):G)}return O}function h(x,v){return x.minX=Math.min(x.minX,v.minX),x.minY=Math.min(x.minY,v.minY),x.maxX=Math.max(x.maxX,v.maxX),x.maxY=Math.max(x.maxY,v.maxY),x}function p(x,v){return x.minX-v.minX}function d(x,v){return x.minY-v.minY}function g(x){return(x.maxX-x.minX)*(x.maxY-x.minY)}function _(x){return x.maxX-x.minX+(x.maxY-x.minY)}function y(x,v){return x.minX<=v.minX&&x.minY<=v.minY&&v.maxX<=x.maxX&&v.maxY<=x.maxY}function M(x,v){return v.minX<=x.maxX&&v.minY<=x.maxY&&v.maxX>=x.minX&&v.maxY>=x.minY}function w(x){return{children:x,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function A(x,v,C,S,O){for(var F=[v,C];F.length;)if(!((C=F.pop())-(v=F.pop())<=S)){var G=v+Math.ceil((C-v)/S/2)*S;r(x,G,v,C,O),F.push(v,G,G,C)}}return o.prototype.all=function(){return this._all(this.data,[])},o.prototype.search=function(x){var v=this.data,C=[];if(!M(x,v))return C;for(var S=this.toBBox,O=[];v;){for(var F=0;F<v.children.length;F++){var G=v.children[F],z=v.leaf?S(G):G;M(x,z)&&(v.leaf?C.push(G):y(x,z)?this._all(G,C):O.push(G))}v=O.pop()}return C},o.prototype.collides=function(x){var v=this.data;if(!M(x,v))return!1;for(var C=[];v;){for(var S=0;S<v.children.length;S++){var O=v.children[S],F=v.leaf?this.toBBox(O):O;if(M(x,F)){if(v.leaf||y(x,F))return!0;C.push(O)}}v=C.pop()}return!1},o.prototype.load=function(x){if(!x||!x.length)return this;if(x.length<this._minEntries){for(var v=0;v<x.length;v++)this.insert(x[v]);return this}var C=this._build(x.slice(),0,x.length-1,0);if(this.data.children.length)if(this.data.height===C.height)this._splitRoot(this.data,C);else{if(this.data.height<C.height){var S=this.data;this.data=C,C=S}this._insert(C,this.data.height-C.height-1,!0)}else this.data=C;return this},o.prototype.insert=function(x){return x&&this._insert(x,this.data.height-1),this},o.prototype.clear=function(){return this.data=w([]),this},o.prototype.remove=function(x,v){if(!x)return this;for(var C,S,O,F=this.data,G=this.toBBox(x),z=[],L=[];F||z.length;){if(F||(F=z.pop(),S=z[z.length-1],C=L.pop(),O=!0),F.leaf){var D=a(x,F.children,v);if(D!==-1)return F.children.splice(D,1),z.push(F),this._condense(z),this}O||F.leaf||!y(F,G)?S?(C++,F=S.children[C],O=!1):F=null:(z.push(F),L.push(C),C=0,S=F,F=F.children[0])}return this},o.prototype.toBBox=function(x){return x},o.prototype.compareMinX=function(x,v){return x.minX-v.minX},o.prototype.compareMinY=function(x,v){return x.minY-v.minY},o.prototype.toJSON=function(){return this.data},o.prototype.fromJSON=function(x){return this.data=x,this},o.prototype._all=function(x,v){for(var C=[];x;)x.leaf?v.push.apply(v,x.children):C.push.apply(C,x.children),x=C.pop();return v},o.prototype._build=function(x,v,C,S){var O,F=C-v+1,G=this._maxEntries;if(F<=G)return l(O=w(x.slice(v,C+1)),this.toBBox),O;S||(S=Math.ceil(Math.log(F)/Math.log(G)),G=Math.ceil(F/Math.pow(G,S-1))),(O=w([])).leaf=!1,O.height=S;var z=Math.ceil(F/G),L=z*Math.ceil(Math.sqrt(G));A(x,v,C,L,this.compareMinX);for(var D=v;D<=C;D+=L){var q=Math.min(D+L-1,C);A(x,D,q,z,this.compareMinY);for(var nt=D;nt<=q;nt+=z){var k=Math.min(nt+z-1,q);O.children.push(this._build(x,nt,k,S-1))}}return l(O,this.toBBox),O},o.prototype._chooseSubtree=function(x,v,C,S){for(;S.push(v),!v.leaf&&S.length-1!==C;){for(var O=1/0,F=1/0,G=void 0,z=0;z<v.children.length;z++){var L=v.children[z],D=g(L),q=(nt=x,k=L,(Math.max(k.maxX,nt.maxX)-Math.min(k.minX,nt.minX))*(Math.max(k.maxY,nt.maxY)-Math.min(k.minY,nt.minY))-D);q<F?(F=q,O=D<O?D:O,G=L):q===F&&D<O&&(O=D,G=L)}v=G||v.children[0]}var nt,k;return v},o.prototype._insert=function(x,v,C){var S=C?x:this.toBBox(x),O=[],F=this._chooseSubtree(S,this.data,v,O);for(F.children.push(x),h(F,S);v>=0&&O[v].children.length>this._maxEntries;)this._split(O,v),v--;this._adjustParentBBoxes(S,O,v)},o.prototype._split=function(x,v){var C=x[v],S=C.children.length,O=this._minEntries;this._chooseSplitAxis(C,O,S);var F=this._chooseSplitIndex(C,O,S),G=w(C.children.splice(F,C.children.length-F));G.height=C.height,G.leaf=C.leaf,l(C,this.toBBox),l(G,this.toBBox),v?x[v-1].children.push(G):this._splitRoot(C,G)},o.prototype._splitRoot=function(x,v){this.data=w([x,v]),this.data.height=x.height+1,this.data.leaf=!1,l(this.data,this.toBBox)},o.prototype._chooseSplitIndex=function(x,v,C){for(var S,O,F,G,z,L,D,q=1/0,nt=1/0,k=v;k<=C-v;k++){var xt=f(x,0,k,this.toBBox),X=f(x,k,C,this.toBBox),it=(O=xt,F=X,G=void 0,z=void 0,L=void 0,D=void 0,G=Math.max(O.minX,F.minX),z=Math.max(O.minY,F.minY),L=Math.min(O.maxX,F.maxX),D=Math.min(O.maxY,F.maxY),Math.max(0,L-G)*Math.max(0,D-z)),vt=g(xt)+g(X);it<q?(q=it,S=k,nt=vt<nt?vt:nt):it===q&&vt<nt&&(nt=vt,S=k)}return S||C-v},o.prototype._chooseSplitAxis=function(x,v,C){var S=x.leaf?this.compareMinX:p,O=x.leaf?this.compareMinY:d;this._allDistMargin(x,v,C,S)<this._allDistMargin(x,v,C,O)&&x.children.sort(S)},o.prototype._allDistMargin=function(x,v,C,S){x.children.sort(S);for(var O=this.toBBox,F=f(x,0,v,O),G=f(x,C-v,C,O),z=_(F)+_(G),L=v;L<C-v;L++){var D=x.children[L];h(F,x.leaf?O(D):D),z+=_(F)}for(var q=C-v-1;q>=v;q--){var nt=x.children[q];h(G,x.leaf?O(nt):nt),z+=_(G)}return z},o.prototype._adjustParentBBoxes=function(x,v,C){for(var S=C;S>=0;S--)h(v[S],x)},o.prototype._condense=function(x){for(var v=x.length-1,C=void 0;v>=0;v--)x[v].children.length===0?v>0?(C=x[v-1].children).splice(C.indexOf(x[v]),1):this.clear():l(x[v],this.toBBox)},o})});var _0=Kt((np,rp)=>{(function(r,t){typeof np=="object"&&typeof rp!="undefined"?rp.exports=t():typeof define=="function"&&define.amd?define(t):(r=r||self,r.TinyQueue=t())})(np,function(){"use strict";var r=function(o,a){if(o===void 0&&(o=[]),a===void 0&&(a=t),this.data=o,this.length=this.data.length,this.compare=a,this.length>0)for(var l=(this.length>>1)-1;l>=0;l--)this._down(l)};r.prototype.push=function(o){this.data.push(o),this.length++,this._up(this.length-1)},r.prototype.pop=function(){if(this.length!==0){var o=this.data[0],a=this.data.pop();return this.length--,this.length>0&&(this.data[0]=a,this._down(0)),o}},r.prototype.peek=function(){return this.data[0]},r.prototype._up=function(o){for(var a=this,l=a.data,f=a.compare,h=l[o];o>0;){var p=o-1>>1,d=l[p];if(f(h,d)>=0)break;l[o]=d,o=p}l[o]=h},r.prototype._down=function(o){for(var a=this,l=a.data,f=a.compare,h=this.length>>1,p=l[o];o<h;){var d=(o<<1)+1,g=l[d],_=d+1;if(_<this.length&&f(l[_],g)<0&&(d=_,g=l[_]),f(g,p)>=0)break;l[o]=g,o=d}l[o]=p};function t(e,o){return e<o?-1:e>o?1:0}return r})});var E0=Kt((TR,x0)=>{x0.exports=function(t,e,o,a){var l=t[0],f=t[1],h=!1;o===void 0&&(o=0),a===void 0&&(a=e.length);for(var p=(a-o)/2,d=0,g=p-1;d<p;g=d++){var _=e[o+d*2+0],y=e[o+d*2+1],M=e[o+g*2+0],w=e[o+g*2+1],A=y>f!=w>f&&l<(M-_)*(f-y)/(w-y)+_;A&&(h=!h)}return h}});var S0=Kt((AR,M0)=>{M0.exports=function(t,e,o,a){var l=t[0],f=t[1],h=!1;o===void 0&&(o=0),a===void 0&&(a=e.length);for(var p=a-o,d=0,g=p-1;d<p;g=d++){var _=e[d+o][0],y=e[d+o][1],M=e[g+o][0],w=e[g+o][1],A=y>f!=w>f&&l<(M-_)*(f-y)/(w-y)+_;A&&(h=!h)}return h}});var T0=Kt((CR,vc)=>{var w0=E0(),b0=S0();vc.exports=function(t,e,o,a){return e.length>0&&Array.isArray(e[0])?b0(t,e,o,a):w0(t,e,o,a)};vc.exports.nested=b0;vc.exports.flat=w0});var C0=Kt((_c,A0)=>{(function(r,t){typeof _c=="object"&&typeof A0!="undefined"?t(_c):typeof define=="function"&&define.amd?define(["exports"],t):t((r=r||self).predicates={})})(_c,function(r){"use strict";let e=33306690738754706e-32;function o(M,w,A,x,v){let C,S,O,F,G=w[0],z=x[0],L=0,D=0;z>G==z>-G?(C=G,G=w[++L]):(C=z,z=x[++D]);let q=0;if(L<M&&D<A)for(z>G==z>-G?(O=C-((S=G+C)-G),G=w[++L]):(O=C-((S=z+C)-z),z=x[++D]),C=S,O!==0&&(v[q++]=O);L<M&&D<A;)z>G==z>-G?(O=C-((S=C+G)-(F=S-C))+(G-F),G=w[++L]):(O=C-((S=C+z)-(F=S-C))+(z-F),z=x[++D]),C=S,O!==0&&(v[q++]=O);for(;L<M;)O=C-((S=C+G)-(F=S-C))+(G-F),G=w[++L],C=S,O!==0&&(v[q++]=O);for(;D<A;)O=C-((S=C+z)-(F=S-C))+(z-F),z=x[++D],C=S,O!==0&&(v[q++]=O);return C===0&&q!==0||(v[q++]=C),q}function a(M){return new Float64Array(M)}let l=33306690738754716e-32,f=22204460492503146e-32,h=11093356479670487e-47,p=a(4),d=a(8),g=a(12),_=a(16),y=a(4);r.orient2d=function(M,w,A,x,v,C){let S=(w-C)*(A-v),O=(M-v)*(x-C),F=S-O;if(S===0||O===0||S>0!=O>0)return F;let G=Math.abs(S+O);return Math.abs(F)>=l*G?F:-function(z,L,D,q,nt,k,xt){let X,it,vt,pt,et,ot,V,K,at,Tt,dt,Ct,Yt,Wt,Nt,ne,Pt,Xt,tt=z-nt,nn=D-nt,Gt=L-k,te=q-k;et=(Nt=(K=tt-(V=(ot=134217729*tt)-(ot-tt)))*(Tt=te-(at=(ot=134217729*te)-(ot-te)))-((Wt=tt*te)-V*at-K*at-V*Tt))-(dt=Nt-(Pt=(K=Gt-(V=(ot=134217729*Gt)-(ot-Gt)))*(Tt=nn-(at=(ot=134217729*nn)-(ot-nn)))-((ne=Gt*nn)-V*at-K*at-V*Tt))),p[0]=Nt-(dt+et)+(et-Pt),et=(Yt=Wt-((Ct=Wt+dt)-(et=Ct-Wt))+(dt-et))-(dt=Yt-ne),p[1]=Yt-(dt+et)+(et-ne),et=(Xt=Ct+dt)-Ct,p[2]=Ct-(Xt-et)+(dt-et),p[3]=Xt;let qt=function(W,J){let I=J[0];for(let P=1;P<W;P++)I+=J[P];return I}(4,p),$=f*xt;if(qt>=$||-qt>=$||(X=z-(tt+(et=z-tt))+(et-nt),vt=D-(nn+(et=D-nn))+(et-nt),it=L-(Gt+(et=L-Gt))+(et-k),pt=q-(te+(et=q-te))+(et-k),X===0&&it===0&&vt===0&&pt===0)||($=h*xt+e*Math.abs(qt),(qt+=tt*pt+te*X-(Gt*vt+nn*it))>=$||-qt>=$))return qt;et=(Nt=(K=X-(V=(ot=134217729*X)-(ot-X)))*(Tt=te-(at=(ot=134217729*te)-(ot-te)))-((Wt=X*te)-V*at-K*at-V*Tt))-(dt=Nt-(Pt=(K=it-(V=(ot=134217729*it)-(ot-it)))*(Tt=nn-(at=(ot=134217729*nn)-(ot-nn)))-((ne=it*nn)-V*at-K*at-V*Tt))),y[0]=Nt-(dt+et)+(et-Pt),et=(Yt=Wt-((Ct=Wt+dt)-(et=Ct-Wt))+(dt-et))-(dt=Yt-ne),y[1]=Yt-(dt+et)+(et-ne),et=(Xt=Ct+dt)-Ct,y[2]=Ct-(Xt-et)+(dt-et),y[3]=Xt;let N=o(4,p,4,y,d);et=(Nt=(K=tt-(V=(ot=134217729*tt)-(ot-tt)))*(Tt=pt-(at=(ot=134217729*pt)-(ot-pt)))-((Wt=tt*pt)-V*at-K*at-V*Tt))-(dt=Nt-(Pt=(K=Gt-(V=(ot=134217729*Gt)-(ot-Gt)))*(Tt=vt-(at=(ot=134217729*vt)-(ot-vt)))-((ne=Gt*vt)-V*at-K*at-V*Tt))),y[0]=Nt-(dt+et)+(et-Pt),et=(Yt=Wt-((Ct=Wt+dt)-(et=Ct-Wt))+(dt-et))-(dt=Yt-ne),y[1]=Yt-(dt+et)+(et-ne),et=(Xt=Ct+dt)-Ct,y[2]=Ct-(Xt-et)+(dt-et),y[3]=Xt;let b=o(N,d,4,y,g);et=(Nt=(K=X-(V=(ot=134217729*X)-(ot-X)))*(Tt=pt-(at=(ot=134217729*pt)-(ot-pt)))-((Wt=X*pt)-V*at-K*at-V*Tt))-(dt=Nt-(Pt=(K=it-(V=(ot=134217729*it)-(ot-it)))*(Tt=vt-(at=(ot=134217729*vt)-(ot-vt)))-((ne=it*vt)-V*at-K*at-V*Tt))),y[0]=Nt-(dt+et)+(et-Pt),et=(Yt=Wt-((Ct=Wt+dt)-(et=Ct-Wt))+(dt-et))-(dt=Yt-ne),y[1]=Yt-(dt+et)+(et-ne),et=(Xt=Ct+dt)-Ct,y[2]=Ct-(Xt-et)+(dt-et),y[3]=Xt;let R=o(b,g,4,y,_);return _[R-1]}(M,w,A,x,v,C,G)},r.orient2dfast=function(M,w,A,x,v,C){return(w-C)*(A-v)-(M-v)*(x-C)},Object.defineProperty(r,"__esModule",{value:!0})})});var O0=Kt((PR,ap)=>{"use strict";var P0=ep(),Ec=_0(),kb=T0(),Gb=C0().orient2d;Ec.default&&(Ec=Ec.default);ap.exports=N0;ap.exports.default=N0;function N0(r,t,e){t=Math.max(0,t===void 0?2:t),e=e||0;var o=Xb(r),a=new P0(16);a.toBBox=function(C){return{minX:C[0],minY:C[1],maxX:C[0],maxY:C[1]}},a.compareMinX=function(C,S){return C[0]-S[0]},a.compareMinY=function(C,S){return C[1]-S[1]},a.load(r);for(var l=[],f=0,h;f<o.length;f++){var p=o[f];a.remove(p),h=L0(p,h),l.push(h)}var d=new P0(16);for(f=0;f<l.length;f++)d.insert(ip(l[f]));for(var g=t*t,_=e*e;l.length;){var y=l.shift(),M=y.p,w=y.next.p,A=op(M,w);if(!(A<_)){var x=A/g;p=Vb(a,y.prev.p,M,w,y.next.next.p,x,d),p&&Math.min(op(p,M),op(p,w))<=x&&(l.push(y),l.push(L0(p,y)),a.remove(p),d.remove(y),d.insert(ip(y)),d.insert(ip(y.next)))}}y=h;var v=[];do v.push(y.p),y=y.next;while(y!==h);return v.push(y.p),v}function Vb(r,t,e,o,a,l,f){for(var h=new Ec([],Hb),p=r.data;p;){for(var d=0;d<p.children.length;d++){var g=p.children[d],_=p.leaf?sp(g,e,o):Wb(e,o,g);_>l||h.push({node:g,dist:_})}for(;h.length&&!h.peek().node.children;){var y=h.pop(),M=y.node,w=sp(M,t,e),A=sp(M,o,a);if(y.dist<w&&y.dist<A&&R0(e,M,f)&&R0(o,M,f))return M}p=h.pop(),p&&(p=p.node)}return null}function Hb(r,t){return r.dist-t.dist}function Wb(r,t,e){if(I0(r,e)||I0(t,e))return 0;var o=xc(r[0],r[1],t[0],t[1],e.minX,e.minY,e.maxX,e.minY);if(o===0)return 0;var a=xc(r[0],r[1],t[0],t[1],e.minX,e.minY,e.minX,e.maxY);if(a===0)return 0;var l=xc(r[0],r[1],t[0],t[1],e.maxX,e.minY,e.maxX,e.maxY);if(l===0)return 0;var f=xc(r[0],r[1],t[0],t[1],e.minX,e.maxY,e.maxX,e.maxY);return f===0?0:Math.min(o,a,l,f)}function I0(r,t){return r[0]>=t.minX&&r[0]<=t.maxX&&r[1]>=t.minY&&r[1]<=t.maxY}function R0(r,t,e){for(var o=Math.min(r[0],t[0]),a=Math.min(r[1],t[1]),l=Math.max(r[0],t[0]),f=Math.max(r[1],t[1]),h=e.search({minX:o,minY:a,maxX:l,maxY:f}),p=0;p<h.length;p++)if(qb(h[p].p,h[p].next.p,r,t))return!1;return!0}function Xa(r,t,e){return Gb(r[0],r[1],t[0],t[1],e[0],e[1])}function qb(r,t,e,o){return r!==o&&t!==e&&Xa(r,t,e)>0!=Xa(r,t,o)>0&&Xa(e,o,r)>0!=Xa(e,o,t)>0}function ip(r){var t=r.p,e=r.next.p;return r.minX=Math.min(t[0],e[0]),r.minY=Math.min(t[1],e[1]),r.maxX=Math.max(t[0],e[0]),r.maxY=Math.max(t[1],e[1]),r}function Xb(r){for(var t=r[0],e=r[0],o=r[0],a=r[0],l=0;l<r.length;l++){var f=r[l];f[0]<t[0]&&(t=f),f[0]>o[0]&&(o=f),f[1]<e[1]&&(e=f),f[1]>a[1]&&(a=f)}var h=[t,e,o,a],p=h.slice();for(l=0;l<r.length;l++)kb(r[l],h)||p.push(r[l]);return Zb(p)}function L0(r,t){var e={p:r,prev:null,next:null,minX:0,minY:0,maxX:0,maxY:0};return t?(e.next=t.next,e.prev=t,t.next.prev=e,t.next=e):(e.prev=e,e.next=e),e}function op(r,t){var e=r[0]-t[0],o=r[1]-t[1];return e*e+o*o}function sp(r,t,e){var o=t[0],a=t[1],l=e[0]-o,f=e[1]-a;if(l!==0||f!==0){var h=((r[0]-o)*l+(r[1]-a)*f)/(l*l+f*f);h>1?(o=e[0],a=e[1]):h>0&&(o+=l*h,a+=f*h)}return l=r[0]-o,f=r[1]-a,l*l+f*f}function xc(r,t,e,o,a,l,f,h){var p=e-r,d=o-t,g=f-a,_=h-l,y=r-a,M=t-l,w=p*p+d*d,A=p*g+d*_,x=g*g+_*_,v=p*y+d*M,C=g*y+_*M,S=w*x-A*A,O,F,G,z,L=S,D=S;S===0?(F=0,L=1,z=C,D=x):(F=A*C-x*v,z=w*C-A*v,F<0?(F=0,z=C,D=x):F>L&&(F=L,z=C+A,D=x)),z<0?(z=0,-v<0?F=0:-v>w?F=L:(F=-v,L=w)):z>D&&(z=D,-v+A<0?F=0:-v+A>w?F=L:(F=-v+A,L=w)),O=F===0?0:F/L,G=z===0?0:z/D;var q=(1-O)*r+O*e,nt=(1-O)*t+O*o,k=(1-G)*a+G*f,xt=(1-G)*l+G*h,X=k-q,it=xt-nt;return X*X+it*it}function Yb(r,t){return r[0]===t[0]?r[1]-t[1]:r[0]-t[0]}function Zb(r){r.sort(Yb);for(var t=[],e=0;e<r.length;e++){for(;t.length>=2&&Xa(t[t.length-2],t[t.length-1],r[e])<=0;)t.pop();t.push(r[e])}for(var o=[],a=r.length-1;a>=0;a--){for(;o.length>=2&&Xa(o[o.length-2],o[o.length-1],r[a])<=0;)o.pop();o.push(r[a])}return o.pop(),t.pop(),t.concat(o)}});var k0=Kt((lp,cp)=>{(function(r,t){typeof lp=="object"&&typeof cp!="undefined"?cp.exports=t():typeof define=="function"&&define.amd?define(t):r.quickselect=t()})(lp,function(){"use strict";function r(a,l,f,h,p){t(a,l,f||0,h||a.length-1,p||o)}function t(a,l,f,h,p){for(;h>f;){if(h-f>600){var d=h-f+1,g=l-f+1,_=Math.log(d),y=.5*Math.exp(2*_/3),M=.5*Math.sqrt(_*y*(d-y)/d)*(g-d/2<0?-1:1),w=Math.max(f,Math.floor(l-g*y/d+M)),A=Math.min(h,Math.floor(l+(d-g)*y/d+M));t(a,l,w,A,p)}var x=a[l],v=f,C=h;for(e(a,f,l),p(a[h],x)>0&&e(a,f,h);v<C;){for(e(a,v,C),v++,C--;p(a[v],x)<0;)v++;for(;p(a[C],x)>0;)C--}p(a[f],x)===0?e(a,f,C):(C++,e(a,C,h)),C<=l&&(f=C+1),l<=C&&(h=C-1)}}function e(a,l,f){var h=a[l];a[l]=a[f],a[f]=h}function o(a,l){return a<l?-1:a>l?1:0}return r})});var dp=Kt((e2,pp)=>{"use strict";pp.exports=Vu;pp.exports.default=Vu;var aT=k0();function Vu(r,t){if(!(this instanceof Vu))return new Vu(r,t);this._maxEntries=Math.max(4,r||9),this._minEntries=Math.max(2,Math.ceil(this._maxEntries*.4)),t&&this._initFormat(t),this.clear()}Vu.prototype={all:function(){return this._all(this.data,[])},search:function(r){var t=this.data,e=[],o=this.toBBox;if(!Sc(r,t))return e;for(var a=[],l,f,h,p;t;){for(l=0,f=t.children.length;l<f;l++)h=t.children[l],p=t.leaf?o(h):h,Sc(r,p)&&(t.leaf?e.push(h):hp(r,p)?this._all(h,e):a.push(h));t=a.pop()}return e},collides:function(r){var t=this.data,e=this.toBBox;if(!Sc(r,t))return!1;for(var o=[],a,l,f,h;t;){for(a=0,l=t.children.length;a<l;a++)if(f=t.children[a],h=t.leaf?e(f):f,Sc(r,h)){if(t.leaf||hp(r,h))return!0;o.push(f)}t=o.pop()}return!1},load:function(r){if(!(r&&r.length))return this;if(r.length<this._minEntries){for(var t=0,e=r.length;t<e;t++)this.insert(r[t]);return this}var o=this._build(r.slice(),0,r.length-1,0);if(!this.data.children.length)this.data=o;else if(this.data.height===o.height)this._splitRoot(this.data,o);else{if(this.data.height<o.height){var a=this.data;this.data=o,o=a}this._insert(o,this.data.height-o.height-1,!0)}return this},insert:function(r){return r&&this._insert(r,this.data.height-1),this},clear:function(){return this.data=Ja([]),this},remove:function(r,t){if(!r)return this;for(var e=this.data,o=this.toBBox(r),a=[],l=[],f,h,p,d;e||a.length;){if(e||(e=a.pop(),h=a[a.length-1],f=l.pop(),d=!0),e.leaf&&(p=uT(r,e.children,t),p!==-1))return e.children.splice(p,1),a.push(e),this._condense(a),this;!d&&!e.leaf&&hp(e,o)?(a.push(e),l.push(f),f=0,h=e,e=e.children[0]):h?(f++,e=h.children[f],d=!1):e=null}return this},toBBox:function(r){return r},compareMinX:G0,compareMinY:V0,toJSON:function(){return this.data},fromJSON:function(r){return this.data=r,this},_all:function(r,t){for(var e=[];r;)r.leaf?t.push.apply(t,r.children):e.push.apply(e,r.children),r=e.pop();return t},_build:function(r,t,e,o){var a=e-t+1,l=this._maxEntries,f;if(a<=l)return f=Ja(r.slice(t,e+1)),Za(f,this.toBBox),f;o||(o=Math.ceil(Math.log(a)/Math.log(l)),l=Math.ceil(a/Math.pow(l,o-1))),f=Ja([]),f.leaf=!1,f.height=o;var h=Math.ceil(a/l),p=h*Math.ceil(Math.sqrt(l)),d,g,_,y;for(H0(r,t,e,p,this.compareMinX),d=t;d<=e;d+=p)for(_=Math.min(d+p-1,e),H0(r,d,_,h,this.compareMinY),g=d;g<=_;g+=h)y=Math.min(g+h-1,_),f.children.push(this._build(r,g,y,o-1));return Za(f,this.toBBox),f},_chooseSubtree:function(r,t,e,o){for(var a,l,f,h,p,d,g,_;o.push(t),!(t.leaf||o.length-1===e);){for(g=_=1/0,a=0,l=t.children.length;a<l;a++)f=t.children[a],p=fp(f),d=lT(r,f)-p,d<_?(_=d,g=p<g?p:g,h=f):d===_&&p<g&&(g=p,h=f);t=h||t.children[0]}return t},_insert:function(r,t,e){var o=this.toBBox,a=e?r:o(r),l=[],f=this._chooseSubtree(a,this.data,t,l);for(f.children.push(r),Gu(f,a);t>=0&&l[t].children.length>this._maxEntries;)this._split(l,t),t--;this._adjustParentBBoxes(a,l,t)},_split:function(r,t){var e=r[t],o=e.children.length,a=this._minEntries;this._chooseSplitAxis(e,a,o);var l=this._chooseSplitIndex(e,a,o),f=Ja(e.children.splice(l,e.children.length-l));f.height=e.height,f.leaf=e.leaf,Za(e,this.toBBox),Za(f,this.toBBox),t?r[t-1].children.push(f):this._splitRoot(e,f)},_splitRoot:function(r,t){this.data=Ja([r,t]),this.data.height=r.height+1,this.data.leaf=!1,Za(this.data,this.toBBox)},_chooseSplitIndex:function(r,t,e){var o,a,l,f,h,p,d,g;for(p=d=1/0,o=t;o<=e-t;o++)a=ku(r,0,o,this.toBBox),l=ku(r,o,e,this.toBBox),f=cT(a,l),h=fp(a)+fp(l),f<p?(p=f,g=o,d=h<d?h:d):f===p&&h<d&&(d=h,g=o);return g},_chooseSplitAxis:function(r,t,e){var o=r.leaf?this.compareMinX:G0,a=r.leaf?this.compareMinY:V0,l=this._allDistMargin(r,t,e,o),f=this._allDistMargin(r,t,e,a);l<f&&r.children.sort(o)},_allDistMargin:function(r,t,e,o){r.children.sort(o);var a=this.toBBox,l=ku(r,0,t,a),f=ku(r,e-t,e,a),h=Mc(l)+Mc(f),p,d;for(p=t;p<e-t;p++)d=r.children[p],Gu(l,r.leaf?a(d):d),h+=Mc(l);for(p=e-t-1;p>=t;p--)d=r.children[p],Gu(f,r.leaf?a(d):d),h+=Mc(f);return h},_adjustParentBBoxes:function(r,t,e){for(var o=e;o>=0;o--)Gu(t[o],r)},_condense:function(r){for(var t=r.length-1,e;t>=0;t--)r[t].children.length===0?t>0?(e=r[t-1].children,e.splice(e.indexOf(r[t]),1)):this.clear():Za(r[t],this.toBBox)},_initFormat:function(r){var t=["return a"," - b",";"];this.compareMinX=new Function("a","b",t.join(r[0])),this.compareMinY=new Function("a","b",t.join(r[1])),this.toBBox=new Function("a","return {minX: a"+r[0]+", minY: a"+r[1]+", maxX: a"+r[2]+", maxY: a"+r[3]+"};")}};function uT(r,t,e){if(!e)return t.indexOf(r);for(var o=0;o<t.length;o++)if(e(r,t[o]))return o;return-1}function Za(r,t){ku(r,0,r.children.length,t,r)}function ku(r,t,e,o,a){a||(a=Ja(null)),a.minX=1/0,a.minY=1/0,a.maxX=-1/0,a.maxY=-1/0;for(var l=t,f;l<e;l++)f=r.children[l],Gu(a,r.leaf?o(f):f);return a}function Gu(r,t){return r.minX=Math.min(r.minX,t.minX),r.minY=Math.min(r.minY,t.minY),r.maxX=Math.max(r.maxX,t.maxX),r.maxY=Math.max(r.maxY,t.maxY),r}function G0(r,t){return r.minX-t.minX}function V0(r,t){return r.minY-t.minY}function fp(r){return(r.maxX-r.minX)*(r.maxY-r.minY)}function Mc(r){return r.maxX-r.minX+(r.maxY-r.minY)}function lT(r,t){return(Math.max(t.maxX,r.maxX)-Math.min(t.minX,r.minX))*(Math.max(t.maxY,r.maxY)-Math.min(t.minY,r.minY))}function cT(r,t){var e=Math.max(r.minX,t.minX),o=Math.max(r.minY,t.minY),a=Math.min(r.maxX,t.maxX),l=Math.min(r.maxY,t.maxY);return Math.max(0,a-e)*Math.max(0,l-o)}function hp(r,t){return r.minX<=t.minX&&r.minY<=t.minY&&t.maxX<=r.maxX&&t.maxY<=r.maxY}function Sc(r,t){return t.minX<=r.maxX&&t.minY<=r.maxY&&t.maxX>=r.minX&&t.maxY>=r.minY}function Ja(r){return{children:r,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function H0(r,t,e,o,a){for(var l=[t,e],f;l.length;)e=l.pop(),t=l.pop(),!(e-t<=o)&&(f=t+Math.ceil((e-t)/o/2)*o,aT(r,f,t,e,a),l.push(t,f,f,e))}});var J0=Kt((dO,xp)=>{"use strict";xp.exports=Ac;xp.exports.default=Ac;function Ac(r,t,e){e=e||2;var o=t&&t.length,a=o?t[0]*e:r.length,l=X0(r,0,a,e,!0),f=[];if(!l||l.next===l.prev)return f;var h,p,d,g,_,y,M;if(o&&(l=xT(r,t,l,e)),r.length>80*e){h=d=r[0],p=g=r[1];for(var w=e;w<a;w+=e)_=r[w],y=r[w+1],_<h&&(h=_),y<p&&(p=y),_>d&&(d=_),y>g&&(g=y);M=Math.max(d-h,g-p),M=M!==0?32767/M:0}return qu(l,f,e,h,p,M,0),f}function X0(r,t,e,o,a){var l,f;if(a===_p(r,t,e,o)>0)for(l=t;l<e;l+=o)f=q0(l,r[l],r[l+1],f);else for(l=e-o;l>=t;l-=o)f=q0(l,r[l],r[l+1],f);return f&&Cc(f,f.next)&&(Yu(f),f=f.next),f}function Js(r,t){if(!r)return r;t||(t=r);var e=r,o;do if(o=!1,!e.steiner&&(Cc(e,e.next)||Fn(e.prev,e,e.next)===0)){if(Yu(e),e=t=e.prev,e===e.next)break;o=!0}else e=e.next;while(o||e!==t);return t}function qu(r,t,e,o,a,l,f){if(r){!f&&l&&bT(r,o,a,l);for(var h=r,p,d;r.prev!==r.next;){if(p=r.prev,d=r.next,l?yT(r,o,a,l):gT(r)){t.push(p.i/e|0),t.push(r.i/e|0),t.push(d.i/e|0),Yu(r),r=d.next,h=d.next;continue}if(r=d,r===h){f?f===1?(r=vT(Js(r),t,e),qu(r,t,e,o,a,l,2)):f===2&&_T(r,t,e,o,a,l):qu(Js(r),t,e,o,a,l,1);break}}}}function gT(r){var t=r.prev,e=r,o=r.next;if(Fn(t,e,o)>=0)return!1;for(var a=t.x,l=e.x,f=o.x,h=t.y,p=e.y,d=o.y,g=a<l?a<f?a:f:l<f?l:f,_=h<p?h<d?h:d:p<d?p:d,y=a>l?a>f?a:f:l>f?l:f,M=h>p?h>d?h:d:p>d?p:d,w=o.next;w!==t;){if(w.x>=g&&w.x<=y&&w.y>=_&&w.y<=M&&ja(a,h,l,p,f,d,w.x,w.y)&&Fn(w.prev,w,w.next)>=0)return!1;w=w.next}return!0}function yT(r,t,e,o){var a=r.prev,l=r,f=r.next;if(Fn(a,l,f)>=0)return!1;for(var h=a.x,p=l.x,d=f.x,g=a.y,_=l.y,y=f.y,M=h<p?h<d?h:d:p<d?p:d,w=g<_?g<y?g:y:_<y?_:y,A=h>p?h>d?h:d:p>d?p:d,x=g>_?g>y?g:y:_>y?_:y,v=yp(M,w,t,e,o),C=yp(A,x,t,e,o),S=r.prevZ,O=r.nextZ;S&&S.z>=v&&O&&O.z<=C;){if(S.x>=M&&S.x<=A&&S.y>=w&&S.y<=x&&S!==a&&S!==f&&ja(h,g,p,_,d,y,S.x,S.y)&&Fn(S.prev,S,S.next)>=0||(S=S.prevZ,O.x>=M&&O.x<=A&&O.y>=w&&O.y<=x&&O!==a&&O!==f&&ja(h,g,p,_,d,y,O.x,O.y)&&Fn(O.prev,O,O.next)>=0))return!1;O=O.nextZ}for(;S&&S.z>=v;){if(S.x>=M&&S.x<=A&&S.y>=w&&S.y<=x&&S!==a&&S!==f&&ja(h,g,p,_,d,y,S.x,S.y)&&Fn(S.prev,S,S.next)>=0)return!1;S=S.prevZ}for(;O&&O.z<=C;){if(O.x>=M&&O.x<=A&&O.y>=w&&O.y<=x&&O!==a&&O!==f&&ja(h,g,p,_,d,y,O.x,O.y)&&Fn(O.prev,O,O.next)>=0)return!1;O=O.nextZ}return!0}function vT(r,t,e){var o=r;do{var a=o.prev,l=o.next.next;!Cc(a,l)&&Y0(a,o,o.next,l)&&Xu(a,l)&&Xu(l,a)&&(t.push(a.i/e|0),t.push(o.i/e|0),t.push(l.i/e|0),Yu(o),Yu(o.next),o=r=l),o=o.next}while(o!==r);return Js(o)}function _T(r,t,e,o,a,l){var f=r;do{for(var h=f.next.next;h!==f.prev;){if(f.i!==h.i&&CT(f,h)){var p=Z0(f,h);f=Js(f,f.next),p=Js(p,p.next),qu(f,t,e,o,a,l,0),qu(p,t,e,o,a,l,0);return}h=h.next}f=f.next}while(f!==r)}function xT(r,t,e,o){var a=[],l,f,h,p,d;for(l=0,f=t.length;l<f;l++)h=t[l]*o,p=l<f-1?t[l+1]*o:r.length,d=X0(r,h,p,o,!1),d===d.next&&(d.steiner=!0),a.push(AT(d));for(a.sort(ET),l=0;l<a.length;l++)e=MT(a[l],e);return e}function ET(r,t){return r.x-t.x}function MT(r,t){var e=ST(r,t);if(!e)return t;var o=Z0(e,r);return Js(o,o.next),Js(e,e.next)}function ST(r,t){var e=t,o=r.x,a=r.y,l=-1/0,f;do{if(a<=e.y&&a>=e.next.y&&e.next.y!==e.y){var h=e.x+(a-e.y)*(e.next.x-e.x)/(e.next.y-e.y);if(h<=o&&h>l&&(l=h,f=e.x<e.next.x?e:e.next,h===o))return f}e=e.next}while(e!==t);if(!f)return null;var p=f,d=f.x,g=f.y,_=1/0,y;e=f;do o>=e.x&&e.x>=d&&o!==e.x&&ja(a<g?o:l,a,d,g,a<g?l:o,a,e.x,e.y)&&(y=Math.abs(a-e.y)/(o-e.x),Xu(e,r)&&(y<_||y===_&&(e.x>f.x||e.x===f.x&&wT(f,e)))&&(f=e,_=y)),e=e.next;while(e!==p);return f}function wT(r,t){return Fn(r.prev,r,t.prev)<0&&Fn(t.next,r,r.next)<0}function bT(r,t,e,o){var a=r;do a.z===0&&(a.z=yp(a.x,a.y,t,e,o)),a.prevZ=a.prev,a.nextZ=a.next,a=a.next;while(a!==r);a.prevZ.nextZ=null,a.prevZ=null,TT(a)}function TT(r){var t,e,o,a,l,f,h,p,d=1;do{for(e=r,r=null,l=null,f=0;e;){for(f++,o=e,h=0,t=0;t<d&&(h++,o=o.nextZ,!!o);t++);for(p=d;h>0||p>0&&o;)h!==0&&(p===0||!o||e.z<=o.z)?(a=e,e=e.nextZ,h--):(a=o,o=o.nextZ,p--),l?l.nextZ=a:r=a,a.prevZ=l,l=a;e=o}l.nextZ=null,d*=2}while(f>1);return r}function yp(r,t,e,o,a){return r=(r-e)*a|0,t=(t-o)*a|0,r=(r|r<<8)&16711935,r=(r|r<<4)&252645135,r=(r|r<<2)&858993459,r=(r|r<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,r|t<<1}function AT(r){var t=r,e=r;do(t.x<e.x||t.x===e.x&&t.y<e.y)&&(e=t),t=t.next;while(t!==r);return e}function ja(r,t,e,o,a,l,f,h){return(a-f)*(t-h)>=(r-f)*(l-h)&&(r-f)*(o-h)>=(e-f)*(t-h)&&(e-f)*(l-h)>=(a-f)*(o-h)}function CT(r,t){return r.next.i!==t.i&&r.prev.i!==t.i&&!PT(r,t)&&(Xu(r,t)&&Xu(t,r)&&IT(r,t)&&(Fn(r.prev,r,t.prev)||Fn(r,t.prev,t))||Cc(r,t)&&Fn(r.prev,r,r.next)>0&&Fn(t.prev,t,t.next)>0)}function Fn(r,t,e){return(t.y-r.y)*(e.x-t.x)-(t.x-r.x)*(e.y-t.y)}function Cc(r,t){return r.x===t.x&&r.y===t.y}function Y0(r,t,e,o){var a=Tc(Fn(r,t,e)),l=Tc(Fn(r,t,o)),f=Tc(Fn(e,o,r)),h=Tc(Fn(e,o,t));return!!(a!==l&&f!==h||a===0&&bc(r,e,t)||l===0&&bc(r,o,t)||f===0&&bc(e,r,o)||h===0&&bc(e,t,o))}function bc(r,t,e){return t.x<=Math.max(r.x,e.x)&&t.x>=Math.min(r.x,e.x)&&t.y<=Math.max(r.y,e.y)&&t.y>=Math.min(r.y,e.y)}function Tc(r){return r>0?1:r<0?-1:0}function PT(r,t){var e=r;do{if(e.i!==r.i&&e.next.i!==r.i&&e.i!==t.i&&e.next.i!==t.i&&Y0(e,e.next,r,t))return!0;e=e.next}while(e!==r);return!1}function Xu(r,t){return Fn(r.prev,r,r.next)<0?Fn(r,t,r.next)>=0&&Fn(r,r.prev,t)>=0:Fn(r,t,r.prev)<0||Fn(r,r.next,t)<0}function IT(r,t){var e=r,o=!1,a=(r.x+t.x)/2,l=(r.y+t.y)/2;do e.y>l!=e.next.y>l&&e.next.y!==e.y&&a<(e.next.x-e.x)*(l-e.y)/(e.next.y-e.y)+e.x&&(o=!o),e=e.next;while(e!==r);return o}function Z0(r,t){var e=new vp(r.i,r.x,r.y),o=new vp(t.i,t.x,t.y),a=r.next,l=t.prev;return r.next=t,t.prev=r,e.next=a,a.prev=e,o.next=e,e.prev=o,l.next=o,o.prev=l,o}function q0(r,t,e,o){var a=new vp(r,t,e);return o?(a.next=o.next,a.prev=o,o.next.prev=a,o.next=a):(a.prev=a,a.next=a),a}function Yu(r){r.next.prev=r.prev,r.prev.next=r.next,r.prevZ&&(r.prevZ.nextZ=r.nextZ),r.nextZ&&(r.nextZ.prevZ=r.prevZ)}function vp(r,t,e){this.i=r,this.x=t,this.y=e,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}Ac.deviation=function(r,t,e,o){var a=t&&t.length,l=a?t[0]*e:r.length,f=Math.abs(_p(r,0,l,e));if(a)for(var h=0,p=t.length;h<p;h++){var d=t[h]*e,g=h<p-1?t[h+1]*e:r.length;f-=Math.abs(_p(r,d,g,e))}var _=0;for(h=0;h<o.length;h+=3){var y=o[h]*e,M=o[h+1]*e,w=o[h+2]*e;_+=Math.abs((r[y]-r[w])*(r[M+1]-r[y+1])-(r[y]-r[M])*(r[w+1]-r[y+1]))}return f===0&&_===0?0:Math.abs((_-f)/f)};function _p(r,t,e,o){for(var a=0,l=t,f=e-o;l<e;l+=o)a+=(r[f]-r[l])*(r[l+1]+r[f+1]),f=l;return a}Ac.flatten=function(r){for(var t=r[0][0].length,e={vertices:[],holes:[],dimensions:t},o=0,a=0;a<r.length;a++){for(var l=0;l<r[a].length;l++)for(var f=0;f<t;f++)e.vertices.push(r[a][l][f]);a>0&&(o+=r[a-1].length,e.holes.push(o))}return e}});var bp=Kt(ue=>{"use strict";Object.defineProperty(ue,"__esModule",{value:!0});ue.earthRadius=63710088e-1;ue.factors={centimeters:ue.earthRadius*100,centimetres:ue.earthRadius*100,degrees:ue.earthRadius/111325,feet:ue.earthRadius*3.28084,inches:ue.earthRadius*39.37,kilometers:ue.earthRadius/1e3,kilometres:ue.earthRadius/1e3,meters:ue.earthRadius,metres:ue.earthRadius,miles:ue.earthRadius/1609.344,millimeters:ue.earthRadius*1e3,millimetres:ue.earthRadius*1e3,nauticalmiles:ue.earthRadius/1852,radians:1,yards:ue.earthRadius*1.0936};ue.unitsFactors={centimeters:100,centimetres:100,degrees:1/111325,feet:3.28084,inches:39.37,kilometers:1/1e3,kilometres:1/1e3,meters:1,metres:1,miles:1/1609.344,millimeters:1e3,millimetres:1e3,nauticalmiles:1/1852,radians:1/ue.earthRadius,yards:1.0936133};ue.areaFactors={acres:247105e-9,centimeters:1e4,centimetres:1e4,feet:10.763910417,hectares:1e-4,inches:1550.003100006,kilometers:1e-6,kilometres:1e-6,meters:1,metres:1,miles:386e-9,millimeters:1e6,millimetres:1e6,yards:1.195990046};function ys(r,t,e){e===void 0&&(e={});var o={type:"Feature"};return(e.id===0||e.id)&&(o.id=e.id),e.bbox&&(o.bbox=e.bbox),o.properties=t||{},o.geometry=r,o}ue.feature=ys;function LT(r,t,e){switch(e===void 0&&(e={}),r){case"Point":return Ep(t).geometry;case"LineString":return Sp(t).geometry;case"Polygon":return Mp(t).geometry;case"MultiPoint":return K0(t).geometry;case"MultiLineString":return $0(t).geometry;case"MultiPolygon":return j0(t).geometry;default:throw new Error(r+" is invalid")}}ue.geometry=LT;function Ep(r,t,e){if(e===void 0&&(e={}),!r)throw new Error("coordinates is required");if(!Array.isArray(r))throw new Error("coordinates must be an Array");if(r.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!Pc(r[0])||!Pc(r[1]))throw new Error("coordinates must contain numbers");var o={type:"Point",coordinates:r};return ys(o,t,e)}ue.point=Ep;function NT(r,t,e){return e===void 0&&(e={}),Ic(r.map(function(o){return Ep(o,t)}),e)}ue.points=NT;function Mp(r,t,e){e===void 0&&(e={});for(var o=0,a=r;o<a.length;o++){var l=a[o];if(l.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");for(var f=0;f<l[l.length-1].length;f++)if(l[l.length-1][f]!==l[0][f])throw new Error("First and last Position are not equivalent.")}var h={type:"Polygon",coordinates:r};return ys(h,t,e)}ue.polygon=Mp;function OT(r,t,e){return e===void 0&&(e={}),Ic(r.map(function(o){return Mp(o,t)}),e)}ue.polygons=OT;function Sp(r,t,e){if(e===void 0&&(e={}),r.length<2)throw new Error("coordinates must be an array of two or more positions");var o={type:"LineString",coordinates:r};return ys(o,t,e)}ue.lineString=Sp;function DT(r,t,e){return e===void 0&&(e={}),Ic(r.map(function(o){return Sp(o,t)}),e)}ue.lineStrings=DT;function Ic(r,t){t===void 0&&(t={});var e={type:"FeatureCollection"};return t.id&&(e.id=t.id),t.bbox&&(e.bbox=t.bbox),e.features=r,e}ue.featureCollection=Ic;function $0(r,t,e){e===void 0&&(e={});var o={type:"MultiLineString",coordinates:r};return ys(o,t,e)}ue.multiLineString=$0;function K0(r,t,e){e===void 0&&(e={});var o={type:"MultiPoint",coordinates:r};return ys(o,t,e)}ue.multiPoint=K0;function j0(r,t,e){e===void 0&&(e={});var o={type:"MultiPolygon",coordinates:r};return ys(o,t,e)}ue.multiPolygon=j0;function FT(r,t,e){e===void 0&&(e={});var o={type:"GeometryCollection",geometries:r};return ys(o,t,e)}ue.geometryCollection=FT;function UT(r,t){if(t===void 0&&(t=0),t&&!(t>=0))throw new Error("precision must be a positive number");var e=Math.pow(10,t||0);return Math.round(r*e)/e}ue.round=UT;function Q0(r,t){t===void 0&&(t="kilometers");var e=ue.factors[t];if(!e)throw new Error(t+" units is invalid");return r*e}ue.radiansToLength=Q0;function wp(r,t){t===void 0&&(t="kilometers");var e=ue.factors[t];if(!e)throw new Error(t+" units is invalid");return r/e}ue.lengthToRadians=wp;function BT(r,t){return ty(wp(r,t))}ue.lengthToDegrees=BT;function zT(r){var t=r%360;return t<0&&(t+=360),t}ue.bearingToAzimuth=zT;function ty(r){var t=r%(2*Math.PI);return t*180/Math.PI}ue.radiansToDegrees=ty;function kT(r){var t=r%360;return t*Math.PI/180}ue.degreesToRadians=kT;function GT(r,t,e){if(t===void 0&&(t="kilometers"),e===void 0&&(e="kilometers"),!(r>=0))throw new Error("length must be a positive number");return Q0(wp(r,t),e)}ue.convertLength=GT;function VT(r,t,e){if(t===void 0&&(t="meters"),e===void 0&&(e="kilometers"),!(r>=0))throw new Error("area must be a positive number");var o=ue.areaFactors[t];if(!o)throw new Error("invalid original units");var a=ue.areaFactors[e];if(!a)throw new Error("invalid final units");return r/o*a}ue.convertArea=VT;function Pc(r){return!isNaN(r)&&r!==null&&!Array.isArray(r)}ue.isNumber=Pc;function HT(r){return!!r&&r.constructor===Object}ue.isObject=HT;function WT(r){if(!r)throw new Error("bbox is required");if(!Array.isArray(r))throw new Error("bbox must be an Array");if(r.length!==4&&r.length!==6)throw new Error("bbox must be an Array of 4 or 6 numbers");r.forEach(function(t){if(!Pc(t))throw new Error("bbox must only contain numbers")})}ue.validateBBox=WT;function qT(r){if(!r)throw new Error("id is required");if(["string","number"].indexOf(typeof r)===-1)throw new Error("id must be a number or a string")}ue.validateId=qT});var Ap=Kt(ir=>{"use strict";Object.defineProperty(ir,"__esModule",{value:!0});var Gr=bp();function Zu(r,t,e){if(r!==null)for(var o,a,l,f,h,p,d,g=0,_=0,y,M=r.type,w=M==="FeatureCollection",A=M==="Feature",x=w?r.features.length:1,v=0;v<x;v++){d=w?r.features[v].geometry:A?r.geometry:r,y=d?d.type==="GeometryCollection":!1,h=y?d.geometries.length:1;for(var C=0;C<h;C++){var S=0,O=0;if(f=y?d.geometries[C]:d,f!==null){p=f.coordinates;var F=f.type;switch(g=e&&(F==="Polygon"||F==="MultiPolygon")?1:0,F){case null:break;case"Point":if(t(p,_,v,S,O)===!1)return!1;_++,S++;break;case"LineString":case"MultiPoint":for(o=0;o<p.length;o++){if(t(p[o],_,v,S,O)===!1)return!1;_++,F==="MultiPoint"&&S++}F==="LineString"&&S++;break;case"Polygon":case"MultiLineString":for(o=0;o<p.length;o++){for(a=0;a<p[o].length-g;a++){if(t(p[o][a],_,v,S,O)===!1)return!1;_++}F==="MultiLineString"&&S++,F==="Polygon"&&O++}F==="Polygon"&&S++;break;case"MultiPolygon":for(o=0;o<p.length;o++){for(O=0,a=0;a<p[o].length;a++){for(l=0;l<p[o][a].length-g;l++){if(t(p[o][a][l],_,v,S,O)===!1)return!1;_++}O++}S++}break;case"GeometryCollection":for(o=0;o<f.geometries.length;o++)if(Zu(f.geometries[o],t,e)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function XT(r,t,e,o){var a=e;return Zu(r,function(l,f,h,p,d){f===0&&e===void 0?a=l:a=t(a,l,f,h,p,d)},o),a}function ey(r,t){var e;switch(r.type){case"FeatureCollection":for(e=0;e<r.features.length&&t(r.features[e].properties,e)!==!1;e++);break;case"Feature":t(r.properties,0);break}}function YT(r,t,e){var o=e;return ey(r,function(a,l){l===0&&e===void 0?o=a:o=t(o,a,l)}),o}function ny(r,t){if(r.type==="Feature")t(r,0);else if(r.type==="FeatureCollection")for(var e=0;e<r.features.length&&t(r.features[e],e)!==!1;e++);}function ZT(r,t,e){var o=e;return ny(r,function(a,l){l===0&&e===void 0?o=a:o=t(o,a,l)}),o}function JT(r){var t=[];return Zu(r,function(e){t.push(e)}),t}function Tp(r,t){var e,o,a,l,f,h,p,d,g,_,y=0,M=r.type==="FeatureCollection",w=r.type==="Feature",A=M?r.features.length:1;for(e=0;e<A;e++){for(h=M?r.features[e].geometry:w?r.geometry:r,d=M?r.features[e].properties:w?r.properties:{},g=M?r.features[e].bbox:w?r.bbox:void 0,_=M?r.features[e].id:w?r.id:void 0,p=h?h.type==="GeometryCollection":!1,f=p?h.geometries.length:1,a=0;a<f;a++){if(l=p?h.geometries[a]:h,l===null){if(t(null,y,d,g,_)===!1)return!1;continue}switch(l.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":{if(t(l,y,d,g,_)===!1)return!1;break}case"GeometryCollection":{for(o=0;o<l.geometries.length;o++)if(t(l.geometries[o],y,d,g,_)===!1)return!1;break}default:throw new Error("Unknown Geometry Type")}}y++}}function $T(r,t,e){var o=e;return Tp(r,function(a,l,f,h,p){l===0&&e===void 0?o=a:o=t(o,a,l,f,h,p)}),o}function Rc(r,t){Tp(r,function(e,o,a,l,f){var h=e===null?null:e.type;switch(h){case null:case"Point":case"LineString":case"Polygon":return t(Gr.feature(e,a,{bbox:l,id:f}),o,0)===!1?!1:void 0}var p;switch(h){case"MultiPoint":p="Point";break;case"MultiLineString":p="LineString";break;case"MultiPolygon":p="Polygon";break}for(var d=0;d<e.coordinates.length;d++){var g=e.coordinates[d],_={type:p,coordinates:g};if(t(Gr.feature(_,a),o,d)===!1)return!1}})}function KT(r,t,e){var o=e;return Rc(r,function(a,l,f){l===0&&f===0&&e===void 0?o=a:o=t(o,a,l,f)}),o}function ry(r,t){Rc(r,function(e,o,a){var l=0;if(e.geometry){var f=e.geometry.type;if(!(f==="Point"||f==="MultiPoint")){var h,p=0,d=0,g=0;if(Zu(e,function(_,y,M,w,A){if(h===void 0||o>p||w>d||A>g){h=_,p=o,d=w,g=A,l=0;return}var x=Gr.lineString([h,_],e.properties);if(t(x,o,a,A,l)===!1)return!1;l++,h=_})===!1)return!1}}})}function jT(r,t,e){var o=e,a=!1;return ry(r,function(l,f,h,p,d){a===!1&&e===void 0?o=l:o=t(o,l,f,h,p,d),a=!0}),o}function iy(r,t){if(!r)throw new Error("geojson is required");Rc(r,function(e,o,a){if(e.geometry!==null){var l=e.geometry.type,f=e.geometry.coordinates;switch(l){case"LineString":if(t(e,o,a,0,0)===!1)return!1;break;case"Polygon":for(var h=0;h<f.length;h++)if(t(Gr.lineString(f[h],e.properties),o,a,h)===!1)return!1;break}}})}function QT(r,t,e){var o=e;return iy(r,function(a,l,f,h){l===0&&e===void 0?o=a:o=t(o,a,l,f,h)}),o}function tA(r,t){if(t=t||{},!Gr.isObject(t))throw new Error("options is invalid");var e=t.featureIndex||0,o=t.multiFeatureIndex||0,a=t.geometryIndex||0,l=t.segmentIndex||0,f=t.properties,h;switch(r.type){case"FeatureCollection":e<0&&(e=r.features.length+e),f=f||r.features[e].properties,h=r.features[e].geometry;break;case"Feature":f=f||r.properties,h=r.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":h=r;break;default:throw new Error("geojson is invalid")}if(h===null)return null;var p=h.coordinates;switch(h.type){case"Point":case"MultiPoint":return null;case"LineString":return l<0&&(l=p.length+l-1),Gr.lineString([p[l],p[l+1]],f,t);case"Polygon":return a<0&&(a=p.length+a),l<0&&(l=p[a].length+l-1),Gr.lineString([p[a][l],p[a][l+1]],f,t);case"MultiLineString":return o<0&&(o=p.length+o),l<0&&(l=p[o].length+l-1),Gr.lineString([p[o][l],p[o][l+1]],f,t);case"MultiPolygon":return o<0&&(o=p.length+o),a<0&&(a=p[o].length+a),l<0&&(l=p[o][a].length-l-1),Gr.lineString([p[o][a][l],p[o][a][l+1]],f,t)}throw new Error("geojson is invalid")}function eA(r,t){if(t=t||{},!Gr.isObject(t))throw new Error("options is invalid");var e=t.featureIndex||0,o=t.multiFeatureIndex||0,a=t.geometryIndex||0,l=t.coordIndex||0,f=t.properties,h;switch(r.type){case"FeatureCollection":e<0&&(e=r.features.length+e),f=f||r.features[e].properties,h=r.features[e].geometry;break;case"Feature":f=f||r.properties,h=r.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":h=r;break;default:throw new Error("geojson is invalid")}if(h===null)return null;var p=h.coordinates;switch(h.type){case"Point":return Gr.point(p,f,t);case"MultiPoint":return o<0&&(o=p.length+o),Gr.point(p[o],f,t);case"LineString":return l<0&&(l=p.length+l),Gr.point(p[l],f,t);case"Polygon":return a<0&&(a=p.length+a),l<0&&(l=p[a].length+l),Gr.point(p[a][l],f,t);case"MultiLineString":return o<0&&(o=p.length+o),l<0&&(l=p[o].length+l),Gr.point(p[o][l],f,t);case"MultiPolygon":return o<0&&(o=p.length+o),a<0&&(a=p[o].length+a),l<0&&(l=p[o][a].length-l),Gr.point(p[o][a][l],f,t)}throw new Error("geojson is invalid")}ir.coordAll=JT;ir.coordEach=Zu;ir.coordReduce=XT;ir.featureEach=ny;ir.featureReduce=ZT;ir.findPoint=eA;ir.findSegment=tA;ir.flattenEach=Rc;ir.flattenReduce=KT;ir.geomEach=Tp;ir.geomReduce=$T;ir.lineEach=iy;ir.lineReduce=QT;ir.propEach=ey;ir.propReduce=YT;ir.segmentEach=ry;ir.segmentReduce=jT});var oy=Kt(Pp=>{"use strict";Object.defineProperty(Pp,"__esModule",{value:!0});var nA=Ap();function Cp(r){var t=[1/0,1/0,-1/0,-1/0];return nA.coordEach(r,function(e){t[0]>e[0]&&(t[0]=e[0]),t[1]>e[1]&&(t[1]=e[1]),t[2]<e[0]&&(t[2]=e[0]),t[3]<e[1]&&(t[3]=e[1])}),t}Cp.default=Cp;Pp.default=Cp});var Lc=Kt((IO,Ip)=>{var po=ep(),ay=bp(),uy=Ap(),Qa=oy().default,rA=uy.featureEach,CO=uy.coordEach,PO=ay.polygon,sy=ay.featureCollection;function ly(r){var t=new po(r);return t.insert=function(e){if(e.type!=="Feature")throw new Error("invalid feature");return e.bbox=e.bbox?e.bbox:Qa(e),po.prototype.insert.call(this,e)},t.load=function(e){var o=[];return Array.isArray(e)?e.forEach(function(a){if(a.type!=="Feature")throw new Error("invalid features");a.bbox=a.bbox?a.bbox:Qa(a),o.push(a)}):rA(e,function(a){if(a.type!=="Feature")throw new Error("invalid features");a.bbox=a.bbox?a.bbox:Qa(a),o.push(a)}),po.prototype.load.call(this,o)},t.remove=function(e,o){if(e.type!=="Feature")throw new Error("invalid feature");return e.bbox=e.bbox?e.bbox:Qa(e),po.prototype.remove.call(this,e,o)},t.clear=function(){return po.prototype.clear.call(this)},t.search=function(e){var o=po.prototype.search.call(this,this.toBBox(e));return sy(o)},t.collides=function(e){return po.prototype.collides.call(this,this.toBBox(e))},t.all=function(){var e=po.prototype.all.call(this);return sy(e)},t.toJSON=function(){return po.prototype.toJSON.call(this)},t.fromJSON=function(e){return po.prototype.fromJSON.call(this,e)},t.toBBox=function(e){var o;if(e.bbox)o=e.bbox;else if(Array.isArray(e)&&e.length===4)o=e;else if(Array.isArray(e)&&e.length===6)o=[e[0],e[1],e[3],e[4]];else if(e.type==="Feature")o=Qa(e);else if(e.type==="FeatureCollection")o=Qa(e);else throw new Error("invalid geojson");return{minX:o[0],minY:o[1],maxX:o[2],maxY:o[3]}},t}Ip.exports=ly;Ip.exports.default=ly});var Fp=Kt((z3,_y)=>{"use strict";var vy=Object.prototype.toString;_y.exports=function(t){var e=vy.call(t),o=e==="[object Arguments]";return o||(o=e!=="[object Array]"&&t!==null&&typeof t=="object"&&typeof t.length=="number"&&t.length>=0&&vy.call(t.callee)==="[object Function]"),o}});var Cy=Kt((k3,Ay)=>{"use strict";var Ty;Object.keys||(Ku=Object.prototype.hasOwnProperty,Up=Object.prototype.toString,xy=Fp(),Bp=Object.prototype.propertyIsEnumerable,Ey=!Bp.call({toString:null},"toString"),My=Bp.call(function(){},"prototype"),ju=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],Uc=function(r){var t=r.constructor;return t&&t.prototype===r},Sy={$applicationCache:!0,$console:!0,$external:!0,$frame:!0,$frameElement:!0,$frames:!0,$innerHeight:!0,$innerWidth:!0,$onmozfullscreenchange:!0,$onmozfullscreenerror:!0,$outerHeight:!0,$outerWidth:!0,$pageXOffset:!0,$pageYOffset:!0,$parent:!0,$scrollLeft:!0,$scrollTop:!0,$scrollX:!0,$scrollY:!0,$self:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0,$window:!0},wy=function(){if(typeof window=="undefined")return!1;for(var r in window)try{if(!Sy["$"+r]&&Ku.call(window,r)&&window[r]!==null&&typeof window[r]=="object")try{Uc(window[r])}catch(t){return!0}}catch(t){return!0}return!1}(),by=function(r){if(typeof window=="undefined"||!wy)return Uc(r);try{return Uc(r)}catch(t){return!1}},Ty=function(t){var e=t!==null&&typeof t=="object",o=Up.call(t)==="[object Function]",a=xy(t),l=e&&Up.call(t)==="[object String]",f=[];if(!e&&!o&&!a)throw new TypeError("Object.keys called on a non-object");var h=My&&o;if(l&&t.length>0&&!Ku.call(t,0))for(var p=0;p<t.length;++p)f.push(String(p));if(a&&t.length>0)for(var d=0;d<t.length;++d)f.push(String(d));else for(var g in t)!(h&&g==="prototype")&&Ku.call(t,g)&&f.push(String(g));if(Ey)for(var _=by(t),y=0;y<ju.length;++y)!(_&&ju[y]==="constructor")&&Ku.call(t,ju[y])&&f.push(ju[y]);return f});var Ku,Up,xy,Bp,Ey,My,ju,Uc,Sy,wy,by;Ay.exports=Ty});var zp=Kt((G3,Ry)=>{"use strict";var pA=Array.prototype.slice,dA=Fp(),Py=Object.keys,Bc=Py?function(t){return Py(t)}:Cy(),Iy=Object.keys;Bc.shim=function(){if(Object.keys){var t=function(){var e=Object.keys(arguments);return e&&e.length===arguments.length}(1,2);t||(Object.keys=function(o){return dA(o)?Iy(pA.call(o)):Iy(o)})}else Object.keys=Bc;return Object.keys||Bc};Ry.exports=Bc});var kp=Kt((V3,Ly)=>{"use strict";Ly.exports=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var t={},e=Symbol("test"),o=Object(e);if(typeof e=="string"||Object.prototype.toString.call(e)!=="[object Symbol]"||Object.prototype.toString.call(o)!=="[object Symbol]")return!1;var a=42;t[e]=a;for(e in t)return!1;if(typeof Object.keys=="function"&&Object.keys(t).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(t).length!==0)return!1;var l=Object.getOwnPropertySymbols(t);if(l.length!==1||l[0]!==e||!Object.prototype.propertyIsEnumerable.call(t,e))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var f=Object.getOwnPropertyDescriptor(t,e);if(f.value!==a||f.enumerable!==!0)return!1}return!0}});var zc=Kt((H3,Ny)=>{"use strict";var mA=kp();Ny.exports=function(){return mA()&&!!Symbol.toStringTag}});var Fy=Kt((W3,Dy)=>{"use strict";var Oy=typeof Symbol!="undefined"&&Symbol,gA=kp();Dy.exports=function(){return typeof Oy!="function"||typeof Symbol!="function"||typeof Oy("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:gA()}});var zy=Kt((q3,By)=>{"use strict";var Uy={foo:{}},yA=Object;By.exports=function(){return{__proto__:Uy}.foo===Uy.foo&&!({__proto__:null}instanceof yA)}});var Vy=Kt((X3,Gy)=>{"use strict";var vA="Function.prototype.bind called on incompatible ",_A=Object.prototype.toString,xA=Math.max,EA="[object Function]",ky=function(t,e){for(var o=[],a=0;a<t.length;a+=1)o[a]=t[a];for(var l=0;l<e.length;l+=1)o[l+t.length]=e[l];return o},MA=function(t,e){for(var o=[],a=e||0,l=0;a<t.length;a+=1,l+=1)o[l]=t[a];return o},SA=function(r,t){for(var e="",o=0;o<r.length;o+=1)e+=r[o],o+1<r.length&&(e+=t);return e};Gy.exports=function(t){var e=this;if(typeof e!="function"||_A.apply(e)!==EA)throw new TypeError(vA+e);for(var o=MA(arguments,1),a,l=function(){if(this instanceof a){var g=e.apply(this,ky(o,arguments));return Object(g)===g?g:this}return e.apply(t,ky(o,arguments))},f=xA(0,e.length-o.length),h=[],p=0;p<f;p++)h[p]="$"+p;if(a=Function("binder","return function ("+SA(h,",")+"){ return binder.apply(this,arguments); }")(l),e.prototype){var d=function(){};d.prototype=e.prototype,a.prototype=new d,d.prototype=null}return a}});var kc=Kt((Y3,Hy)=>{"use strict";var wA=Vy();Hy.exports=Function.prototype.bind||wA});var qy=Kt((Z3,Wy)=>{"use strict";var bA=Function.prototype.call,TA=Object.prototype.hasOwnProperty,AA=kc();Wy.exports=AA.call(bA,TA)});var js=Kt((J3,$y)=>{"use strict";var tn,ru=SyntaxError,Jy=Function,nu=TypeError,Gp=function(r){try{return Jy(\'"use strict"; return (\'+r+").constructor;")()}catch(t){}},$s=Object.getOwnPropertyDescriptor;if($s)try{$s({},"")}catch(r){$s=null}var Vp=function(){throw new nu},CA=$s?function(){try{return arguments.callee,Vp}catch(r){try{return $s(arguments,"callee").get}catch(t){return Vp}}}():Vp,tu=Fy()(),PA=zy()(),vr=Object.getPrototypeOf||(PA?function(r){return r.__proto__}:null),eu={},IA=typeof Uint8Array=="undefined"||!vr?tn:vr(Uint8Array),Ks={"%AggregateError%":typeof AggregateError=="undefined"?tn:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer=="undefined"?tn:ArrayBuffer,"%ArrayIteratorPrototype%":tu&&vr?vr([][Symbol.iterator]()):tn,"%AsyncFromSyncIteratorPrototype%":tn,"%AsyncFunction%":eu,"%AsyncGenerator%":eu,"%AsyncGeneratorFunction%":eu,"%AsyncIteratorPrototype%":eu,"%Atomics%":typeof Atomics=="undefined"?tn:Atomics,"%BigInt%":typeof BigInt=="undefined"?tn:BigInt,"%BigInt64Array%":typeof BigInt64Array=="undefined"?tn:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array=="undefined"?tn:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView=="undefined"?tn:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":typeof Float32Array=="undefined"?tn:Float32Array,"%Float64Array%":typeof Float64Array=="undefined"?tn:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry=="undefined"?tn:FinalizationRegistry,"%Function%":Jy,"%GeneratorFunction%":eu,"%Int8Array%":typeof Int8Array=="undefined"?tn:Int8Array,"%Int16Array%":typeof Int16Array=="undefined"?tn:Int16Array,"%Int32Array%":typeof Int32Array=="undefined"?tn:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":tu&&vr?vr(vr([][Symbol.iterator]())):tn,"%JSON%":typeof JSON=="object"?JSON:tn,"%Map%":typeof Map=="undefined"?tn:Map,"%MapIteratorPrototype%":typeof Map=="undefined"||!tu||!vr?tn:vr(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise=="undefined"?tn:Promise,"%Proxy%":typeof Proxy=="undefined"?tn:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":typeof Reflect=="undefined"?tn:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set=="undefined"?tn:Set,"%SetIteratorPrototype%":typeof Set=="undefined"||!tu||!vr?tn:vr(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer=="undefined"?tn:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":tu&&vr?vr(""[Symbol.iterator]()):tn,"%Symbol%":tu?Symbol:tn,"%SyntaxError%":ru,"%ThrowTypeError%":CA,"%TypedArray%":IA,"%TypeError%":nu,"%Uint8Array%":typeof Uint8Array=="undefined"?tn:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray=="undefined"?tn:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array=="undefined"?tn:Uint16Array,"%Uint32Array%":typeof Uint32Array=="undefined"?tn:Uint32Array,"%URIError%":URIError,"%WeakMap%":typeof WeakMap=="undefined"?tn:WeakMap,"%WeakRef%":typeof WeakRef=="undefined"?tn:WeakRef,"%WeakSet%":typeof WeakSet=="undefined"?tn:WeakSet};if(vr)try{null.error}catch(r){Xy=vr(vr(r)),Ks["%Error.prototype%"]=Xy}var Xy,RA=function r(t){var e;if(t==="%AsyncFunction%")e=Gp("async function () {}");else if(t==="%GeneratorFunction%")e=Gp("function* () {}");else if(t==="%AsyncGeneratorFunction%")e=Gp("async function* () {}");else if(t==="%AsyncGenerator%"){var o=r("%AsyncGeneratorFunction%");o&&(e=o.prototype)}else if(t==="%AsyncIteratorPrototype%"){var a=r("%AsyncGenerator%");a&&vr&&(e=vr(a.prototype))}return Ks[t]=e,e},Yy={"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},Qu=kc(),Gc=qy(),LA=Qu.call(Function.call,Array.prototype.concat),NA=Qu.call(Function.apply,Array.prototype.splice),Zy=Qu.call(Function.call,String.prototype.replace),Vc=Qu.call(Function.call,String.prototype.slice),OA=Qu.call(Function.call,RegExp.prototype.exec),DA=/[^%.[\\]]+|\\[(?:(-?\\d+(?:\\.\\d+)?)|(["\'])((?:(?!\\2)[^\\\\]|\\\\.)*?)\\2)\\]|(?=(?:\\.|\\[\\])(?:\\.|\\[\\]|%$))/g,FA=/\\\\(\\\\)?/g,UA=function(t){var e=Vc(t,0,1),o=Vc(t,-1);if(e==="%"&&o!=="%")throw new ru("invalid intrinsic syntax, expected closing `%`");if(o==="%"&&e!=="%")throw new ru("invalid intrinsic syntax, expected opening `%`");var a=[];return Zy(t,DA,function(l,f,h,p){a[a.length]=h?Zy(p,FA,"$1"):f||l}),a},BA=function(t,e){var o=t,a;if(Gc(Yy,o)&&(a=Yy[o],o="%"+a[0]+"%"),Gc(Ks,o)){var l=Ks[o];if(l===eu&&(l=RA(o)),typeof l=="undefined"&&!e)throw new nu("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:a,name:o,value:l}}throw new ru("intrinsic "+t+" does not exist!")};$y.exports=function(t,e){if(typeof t!="string"||t.length===0)throw new nu("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof e!="boolean")throw new nu(\'"allowMissing" argument must be a boolean\');if(OA(/^%?[^%]*%?$/,t)===null)throw new ru("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var o=UA(t),a=o.length>0?o[0]:"",l=BA("%"+a+"%",e),f=l.name,h=l.value,p=!1,d=l.alias;d&&(a=d[0],NA(o,LA([0,1],d)));for(var g=1,_=!0;g<o.length;g+=1){var y=o[g],M=Vc(y,0,1),w=Vc(y,-1);if((M===\'"\'||M==="\'"||M==="`"||w===\'"\'||w==="\'"||w==="`")&&M!==w)throw new ru("property names with quotes must have matching quotes");if((y==="constructor"||!_)&&(p=!0),a+="."+y,f="%"+a+"%",Gc(Ks,f))h=Ks[f];else if(h!=null){if(!(y in h)){if(!e)throw new nu("base intrinsic for "+t+" exists, but the property is not available.");return}if($s&&g+1>=o.length){var A=$s(h,y);_=!!A,_&&"get"in A&&!("originalValue"in A.get)?h=A.get:h=h[y]}else _=Gc(h,y),h=h[y];_&&!p&&(Ks[f]=h)}}return h}});var tl=Kt(($3,Ky)=>{"use strict";var zA=js(),Hp=zA("%Object.defineProperty%",!0),Wp=function(){if(Hp)try{return Hp({},"a",{value:1}),!0}catch(t){return!1}return!1};Wp.hasArrayLengthDefineBug=function(){if(!Wp())return null;try{return Hp([],"length",{value:1}).length!==1}catch(t){return!0}};Ky.exports=Wp});var qp=Kt((K3,jy)=>{"use strict";var kA=js(),Hc=kA("%Object.getOwnPropertyDescriptor%",!0);if(Hc)try{Hc([],"length")}catch(r){Hc=null}jy.exports=Hc});var Wc=Kt((j3,tv)=>{"use strict";var GA=tl()(),Xp=js(),el=GA&&Xp("%Object.defineProperty%",!0);if(el)try{el({},"a",{value:1})}catch(r){el=!1}var VA=Xp("%SyntaxError%"),iu=Xp("%TypeError%"),Qy=qp();tv.exports=function(t,e,o){if(!t||typeof t!="object"&&typeof t!="function")throw new iu("`obj` must be an object or a function`");if(typeof e!="string"&&typeof e!="symbol")throw new iu("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new iu("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new iu("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new iu("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new iu("`loose`, if provided, must be a boolean");var a=arguments.length>3?arguments[3]:null,l=arguments.length>4?arguments[4]:null,f=arguments.length>5?arguments[5]:null,h=arguments.length>6?arguments[6]:!1,p=!!Qy&&Qy(t,e);if(el)el(t,e,{configurable:f===null&&p?p.configurable:!f,enumerable:a===null&&p?p.enumerable:!a,value:o,writable:l===null&&p?p.writable:!l});else if(h||!a&&!l&&!f)t[e]=o;else throw new VA("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")}});var sv=Kt((Q3,ov)=>{"use strict";var iv=js(),ev=Wc(),HA=tl()(),nv=qp(),rv=iv("%TypeError%"),WA=iv("%Math.floor%");ov.exports=function(t,e){if(typeof t!="function")throw new rv("`fn` is not a function");if(typeof e!="number"||e<0||e>4294967295||WA(e)!==e)throw new rv("`length` must be a positive 32-bit integer");var o=arguments.length>2&&!!arguments[2],a=!0,l=!0;if("length"in t&&nv){var f=nv(t,"length");f&&!f.configurable&&(a=!1),f&&!f.writable&&(l=!1)}return(a||l||!o)&&(HA?ev(t,"length",e,!0,!0):ev(t,"length",e)),t}});var Xc=Kt((tF,qc)=>{"use strict";var Yp=kc(),ou=js(),qA=sv(),XA=ou("%TypeError%"),uv=ou("%Function.prototype.apply%"),lv=ou("%Function.prototype.call%"),cv=ou("%Reflect.apply%",!0)||Yp.call(lv,uv),nl=ou("%Object.defineProperty%",!0),YA=ou("%Math.max%");if(nl)try{nl({},"a",{value:1})}catch(r){nl=null}qc.exports=function(t){if(typeof t!="function")throw new XA("a function is required");var e=cv(Yp,lv,arguments);return qA(e,1+YA(0,t.length-(arguments.length-1)),!0)};var av=function(){return cv(Yp,uv,arguments)};nl?nl(qc.exports,"apply",{value:av}):qc.exports.apply=av});var Zp=Kt((eF,pv)=>{"use strict";var fv=js(),hv=Xc(),ZA=hv(fv("String.prototype.indexOf"));pv.exports=function(t,e){var o=fv(t,!!e);return typeof o=="function"&&ZA(t,".prototype.")>-1?hv(o):o}});var gv=Kt((nF,mv)=>{"use strict";var JA=zc()(),$A=Zp(),Jp=$A("Object.prototype.toString"),Yc=function(t){return JA&&t&&typeof t=="object"&&Symbol.toStringTag in t?!1:Jp(t)==="[object Arguments]"},dv=function(t){return Yc(t)?!0:t!==null&&typeof t=="object"&&typeof t.length=="number"&&t.length>=0&&Jp(t)!=="[object Array]"&&Jp(t.callee)==="[object Function]"},KA=function(){return Yc(arguments)}();Yc.isLegacyArguments=dv;mv.exports=KA?Yc:dv});var su=Kt((rF,xv)=>{"use strict";var jA=zp(),QA=typeof Symbol=="function"&&typeof Symbol("foo")=="symbol",tC=Object.prototype.toString,eC=Array.prototype.concat,yv=Wc(),nC=function(r){return typeof r=="function"&&tC.call(r)==="[object Function]"},vv=tl()(),rC=function(r,t,e,o){if(t in r){if(o===!0){if(r[t]===e)return}else if(!nC(o)||!o())return}vv?yv(r,t,e,!0):yv(r,t,e)},_v=function(r,t){var e=arguments.length>2?arguments[2]:{},o=jA(t);QA&&(o=eC.call(o,Object.getOwnPropertySymbols(t)));for(var a=0;a<o.length;a+=1)rC(r,o[a],t[o[a]],e[o[a]])};_v.supportsDescriptors=!!vv;xv.exports=_v});var $p=Kt((iF,Mv)=>{"use strict";var Ev=function(r){return r!==r};Mv.exports=function(t,e){return t===0&&e===0?1/t===1/e:!!(t===e||Ev(t)&&Ev(e))}});var Kp=Kt((oF,Sv)=>{"use strict";var iC=$p();Sv.exports=function(){return typeof Object.is=="function"?Object.is:iC}});var bv=Kt((sF,wv)=>{"use strict";var oC=Kp(),sC=su();wv.exports=function(){var t=oC();return sC(Object,{is:t},{is:function(){return Object.is!==t}}),t}});var Pv=Kt((aF,Cv)=>{"use strict";var aC=su(),uC=Xc(),lC=$p(),Tv=Kp(),cC=bv(),Av=uC(Tv(),Object);aC(Av,{getPolyfill:Tv,implementation:lC,shim:cC});Cv.exports=Av});var Ov=Kt((uF,Nv)=>{"use strict";var jp=Zp(),Iv=zc()(),Rv,Lv,Qp,td;Iv&&(Rv=jp("Object.prototype.hasOwnProperty"),Lv=jp("RegExp.prototype.exec"),Qp={},Zc=function(){throw Qp},td={toString:Zc,valueOf:Zc},typeof Symbol.toPrimitive=="symbol"&&(td[Symbol.toPrimitive]=Zc));var Zc,fC=jp("Object.prototype.toString"),hC=Object.getOwnPropertyDescriptor,pC="[object RegExp]";Nv.exports=Iv?function(t){if(!t||typeof t!="object")return!1;var e=hC(t,"lastIndex"),o=e&&Rv(e,"value");if(!o)return!1;try{Lv(t,td)}catch(a){return a===Qp}}:function(t){return!t||typeof t!="object"&&typeof t!="function"?!1:fC(t)===pC}});var Fv=Kt((lF,Dv)=>{"use strict";var il=function(){return typeof function(){}.name=="string"},rl=Object.getOwnPropertyDescriptor;if(rl)try{rl([],"length")}catch(r){rl=null}il.functionsHaveConfigurableNames=function(){if(!il()||!rl)return!1;var t=rl(function(){},"name");return!!t&&!!t.configurable};var dC=Function.prototype.bind;il.boundFunctionsHaveNames=function(){return il()&&typeof dC=="function"&&function(){}.bind().name!==""};Dv.exports=il});var zv=Kt((cF,Bv)=>{"use strict";var Uv=Wc(),mC=tl()(),gC=Fv().functionsHaveConfigurableNames(),yC=TypeError;Bv.exports=function(t,e){if(typeof t!="function")throw new yC("`fn` is not a function");var o=arguments.length>2&&!!arguments[2];return(!o||gC)&&(mC?Uv(t,"name",e,!0,!0):Uv(t,"name",e)),t}});var ed=Kt((fF,kv)=>{"use strict";var vC=zv(),_C=Object,xC=TypeError;kv.exports=vC(function(){if(this!=null&&this!==_C(this))throw new xC("RegExp.prototype.flags getter called on non-object");var t="";return this.hasIndices&&(t+="d"),this.global&&(t+="g"),this.ignoreCase&&(t+="i"),this.multiline&&(t+="m"),this.dotAll&&(t+="s"),this.unicode&&(t+="u"),this.unicodeSets&&(t+="v"),this.sticky&&(t+="y"),t},"get flags",!0)});var nd=Kt((hF,Gv)=>{"use strict";var EC=ed(),MC=su().supportsDescriptors,SC=Object.getOwnPropertyDescriptor;Gv.exports=function(){if(MC&&/a/mig.flags==="gim"){var t=SC(RegExp.prototype,"flags");if(t&&typeof t.get=="function"&&typeof RegExp.prototype.dotAll=="boolean"&&typeof RegExp.prototype.hasIndices=="boolean"){var e="",o={};if(Object.defineProperty(o,"hasIndices",{get:function(){e+="d"}}),Object.defineProperty(o,"sticky",{get:function(){e+="y"}}),e==="dy")return t.get}}return EC}});var Wv=Kt((pF,Hv)=>{"use strict";var wC=su().supportsDescriptors,bC=nd(),TC=Object.getOwnPropertyDescriptor,AC=Object.defineProperty,CC=TypeError,Vv=Object.getPrototypeOf,PC=/a/;Hv.exports=function(){if(!wC||!Vv)throw new CC("RegExp.prototype.flags requires a true ES5 environment that supports property descriptors");var t=bC(),e=Vv(PC),o=TC(e,"flags");return(!o||o.get!==t)&&AC(e,"flags",{configurable:!0,enumerable:!1,get:t}),t}});var Zv=Kt((dF,Yv)=>{"use strict";var IC=su(),RC=Xc(),LC=ed(),qv=nd(),NC=Wv(),Xv=RC(qv());IC(Xv,{getPolyfill:qv,implementation:LC,shim:NC});Yv.exports=Xv});var $v=Kt((mF,Jv)=>{"use strict";var OC=Date.prototype.getDay,DC=function(t){try{return OC.call(t),!0}catch(e){return!1}},FC=Object.prototype.toString,UC="[object Date]",BC=zc()();Jv.exports=function(t){return typeof t!="object"||t===null?!1:BC?DC(t):FC.call(t)===UC}});var rd=Kt((gF,a_)=>{var Kv=zp(),jv=gv(),Qv=Pv(),t_=Ov(),e_=Zv(),n_=$v(),r_=Date.prototype.getTime;function s_(r,t,e){var o=e||{};return(o.strict?Qv(r,t):r===t)?!0:!r||!t||typeof r!="object"&&typeof t!="object"?o.strict?Qv(r,t):r==t:zC(r,t,o)}function i_(r){return r==null}function o_(r){return!(!r||typeof r!="object"||typeof r.length!="number"||typeof r.copy!="function"||typeof r.slice!="function"||r.length>0&&typeof r[0]!="number")}function zC(r,t,e){var o,a;if(typeof r!=typeof t||i_(r)||i_(t)||r.prototype!==t.prototype||jv(r)!==jv(t))return!1;var l=t_(r),f=t_(t);if(l!==f)return!1;if(l||f)return r.source===t.source&&e_(r)===e_(t);if(n_(r)&&n_(t))return r_.call(r)===r_.call(t);var h=o_(r),p=o_(t);if(h!==p)return!1;if(h||p){if(r.length!==t.length)return!1;for(o=0;o<r.length;o++)if(r[o]!==t[o])return!1;return!0}if(typeof r!=typeof t)return!1;try{var d=Kv(r),g=Kv(t)}catch(_){return!1}if(d.length!==g.length)return!1;for(d.sort(),g.sort(),o=d.length-1;o>=0;o--)if(d[o]!=g[o])return!1;for(o=d.length-1;o>=0;o--)if(a=d[o],!s_(r[a],t[a],e))return!1;return!0}a_.exports=s_});var md=Kt((MB,d_)=>{var PP=rd(),mo=function(r){this.precision=r&&r.precision?r.precision:17,this.direction=r&&r.direction?r.direction:!1,this.pseudoNode=r&&r.pseudoNode?r.pseudoNode:!1,this.objectComparator=r&&r.objectComparator?r.objectComparator:IP};mo.prototype.compare=function(r,t){if(r.type!==t.type||!p_(r,t))return!1;switch(r.type){case"Point":return this.compareCoord(r.coordinates,t.coordinates);case"LineString":return this.compareLine(r.coordinates,t.coordinates,0,!1);case"Polygon":return this.comparePolygon(r,t);case"Feature":return this.compareFeature(r,t);default:if(r.type.indexOf("Multi")===0){var e=this,o=h_(r),a=h_(t);return o.every(function(l){return this.some(function(f){return e.compare(l,f)})},a)}}return!1};function h_(r){return r.coordinates.map(function(t){return{type:r.type.replace("Multi",""),coordinates:t}})}function p_(r,t){return r.hasOwnProperty("coordinates")?r.coordinates.length===t.coordinates.length:r.length===t.length}mo.prototype.compareCoord=function(r,t){if(r.length!==t.length)return!1;for(var e=0;e<r.length;e++)if(r[e].toFixed(this.precision)!==t[e].toFixed(this.precision))return!1;return!0};mo.prototype.compareLine=function(r,t,e,o){if(!p_(r,t))return!1;var a=this.pseudoNode?r:this.removePseudo(r),l=this.pseudoNode?t:this.removePseudo(t);if(!(o&&!this.compareCoord(a[0],l[0])&&(l=this.fixStartIndex(l,a),!l))){var f=this.compareCoord(a[e],l[e]);return this.direction||f?this.comparePath(a,l):this.compareCoord(a[e],l[l.length-(1+e)])?this.comparePath(a.slice().reverse(),l):!1}};mo.prototype.fixStartIndex=function(r,t){for(var e,o=-1,a=0;a<r.length;a++)if(this.compareCoord(r[a],t[0])){o=a;break}return o>=0&&(e=[].concat(r.slice(o,r.length),r.slice(1,o+1))),e};mo.prototype.comparePath=function(r,t){var e=this;return r.every(function(o,a){return e.compareCoord(o,this[a])},t)};mo.prototype.comparePolygon=function(r,t){if(this.compareLine(r.coordinates[0],t.coordinates[0],1,!0)){var e=r.coordinates.slice(1,r.coordinates.length),o=t.coordinates.slice(1,t.coordinates.length),a=this;return e.every(function(l){return this.some(function(f){return a.compareLine(l,f,1,!0)})},o)}else return!1};mo.prototype.compareFeature=function(r,t){return r.id!==t.id||!this.objectComparator(r.properties,t.properties)||!this.compareBBox(r,t)?!1:this.compare(r.geometry,t.geometry)};mo.prototype.compareBBox=function(r,t){return!!(!r.bbox&&!t.bbox||r.bbox&&t.bbox&&this.compareCoord(r.bbox,t.bbox))};mo.prototype.removePseudo=function(r){return r};function IP(r,t){return PP(r,t,{strict:!0})}d_.exports=mo});var m_=Kt((OB,Kc)=>{function _s(r,t,e,o){this.dataset=[],this.epsilon=1,this.minPts=2,this.distance=this._euclideanDistance,this.clusters=[],this.noise=[],this._visited=[],this._assigned=[],this._datasetLength=0,this._init(r,t,e,o)}_s.prototype.run=function(r,t,e,o){this._init(r,t,e,o);for(var a=0;a<this._datasetLength;a++)if(this._visited[a]!==1){this._visited[a]=1;var l=this._regionQuery(a);if(l.length<this.minPts)this.noise.push(a);else{var f=this.clusters.length;this.clusters.push([]),this._addToCluster(a,f),this._expandCluster(f,l)}}return this.clusters};_s.prototype._init=function(r,t,e,o){if(r){if(!(r instanceof Array))throw Error("Dataset must be of type array, "+typeof r+" given");this.dataset=r,this.clusters=[],this.noise=[],this._datasetLength=r.length,this._visited=new Array(this._datasetLength),this._assigned=new Array(this._datasetLength)}t&&(this.epsilon=t),e&&(this.minPts=e),o&&(this.distance=o)};_s.prototype._expandCluster=function(r,t){for(var e=0;e<t.length;e++){var o=t[e];if(this._visited[o]!==1){this._visited[o]=1;var a=this._regionQuery(o);a.length>=this.minPts&&(t=this._mergeArrays(t,a))}this._assigned[o]!==1&&this._addToCluster(o,r)}};_s.prototype._addToCluster=function(r,t){this.clusters[t].push(r),this._assigned[r]=1};_s.prototype._regionQuery=function(r){for(var t=[],e=0;e<this._datasetLength;e++){var o=this.distance(this.dataset[r],this.dataset[e]);o<this.epsilon&&t.push(e)}return t};_s.prototype._mergeArrays=function(r,t){for(var e=t.length,o=0;o<e;o++){var a=t[o];r.indexOf(a)<0&&r.push(a)}return r};_s.prototype._euclideanDistance=function(r,t){for(var e=0,o=Math.min(r.length,t.length);o--;)e+=(r[o]-t[o])*(r[o]-t[o]);return Math.sqrt(e)};typeof Kc!="undefined"&&Kc.exports&&(Kc.exports=_s)});var g_=Kt((DB,jc)=>{function xs(r,t,e){this.k=3,this.dataset=[],this.assignments=[],this.centroids=[],this.init(r,t,e)}xs.prototype.init=function(r,t,e){this.assignments=[],this.centroids=[],typeof r!="undefined"&&(this.dataset=r),typeof t!="undefined"&&(this.k=t),typeof e!="undefined"&&(this.distance=e)};xs.prototype.run=function(r,t){this.init(r,t);for(var e=this.dataset.length,o=0;o<this.k;o++)this.centroids[o]=this.randomCentroid();for(var a=!0;a;){a=this.assign();for(var l=0;l<this.k;l++){for(var f=new Array(g),h=0,p=0;p<g;p++)f[p]=0;for(var d=0;d<e;d++){var g=this.dataset[d].length;if(l===this.assignments[d]){for(var p=0;p<g;p++)f[p]+=this.dataset[d][p];h++}}if(h>0){for(var p=0;p<g;p++)f[p]/=h;this.centroids[l]=f}else this.centroids[l]=this.randomCentroid(),a=!0}}return this.getClusters()};xs.prototype.randomCentroid=function(){var r=this.dataset.length-1,t,e;do e=Math.round(Math.random()*r),t=this.dataset[e];while(this.centroids.indexOf(t)>=0);return t};xs.prototype.assign=function(){for(var r=!1,t=this.dataset.length,e,o=0;o<t;o++)e=this.argmin(this.dataset[o],this.centroids,this.distance),e!=this.assignments[o]&&(this.assignments[o]=e,r=!0);return r};xs.prototype.getClusters=function(){for(var r=new Array(this.k),t,e=0;e<this.assignments.length;e++)t=this.assignments[e],typeof r[t]=="undefined"&&(r[t]=[]),r[t].push(e);return r};xs.prototype.argmin=function(r,t,e){for(var o=Number.MAX_VALUE,a=0,l=t.length,f,h=0;h<l;h++)f=e(r,t[h]),f<o&&(o=f,a=h);return a};xs.prototype.distance=function(r,t){for(var e=0,o=Math.min(r.length,t.length);o--;){var a=r[o]-t[o];e+=a*a}return Math.sqrt(e)};typeof jc!="undefined"&&jc.exports&&(jc.exports=xs)});var gd=Kt((FB,Qc)=>{function go(r,t,e){this._queue=[],this._priorities=[],this._sorting="desc",this._init(r,t,e)}go.prototype.insert=function(r,t){for(var e=this._queue.length,o=e;o--;){var a=this._priorities[o];this._sorting==="desc"?t>a&&(e=o):t<a&&(e=o)}this._insertAt(r,t,e)};go.prototype.remove=function(r){for(var t=this._queue.length;t--;){var e=this._queue[t];if(r===e){this._queue.splice(t,1),this._priorities.splice(t,1);break}}};go.prototype.forEach=function(r){this._queue.forEach(r)};go.prototype.getElements=function(){return this._queue};go.prototype.getElementPriority=function(r){return this._priorities[r]};go.prototype.getPriorities=function(){return this._priorities};go.prototype.getElementsWithPriorities=function(){for(var r=[],t=0,e=this._queue.length;t<e;t++)r.push([this._queue[t],this._priorities[t]]);return r};go.prototype._init=function(r,t,e){if(r&&t){if(this._queue=[],this._priorities=[],r.length!==t.length)throw new Error("Arrays must have the same length");for(var o=0;o<r.length;o++)this.insert(r[o],t[o])}e&&(this._sorting=e)};go.prototype._insertAt=function(r,t,e){this._queue.length===e?(this._queue.push(r),this._priorities.push(t)):(this._queue.splice(e,0,r),this._priorities.splice(e,0,t))};typeof Qc!="undefined"&&Qc.exports&&(Qc.exports=go)});var v_=Kt((UB,uu)=>{typeof uu!="undefined"&&uu.exports&&(y_=gd());var y_;function Yo(r,t,e,o){this.epsilon=1,this.minPts=1,this.distance=this._euclideanDistance,this._reachability=[],this._processed=[],this._coreDistance=0,this._orderedList=[],this._init(r,t,e,o)}Yo.prototype.run=function(r,t,e,o){this._init(r,t,e,o);for(var a=0,l=this.dataset.length;a<l;a++)if(this._processed[a]!==1){this._processed[a]=1,this.clusters.push([a]);var f=this.clusters.length-1;this._orderedList.push(a);var h=new y_(null,null,"asc"),p=this._regionQuery(a);this._distanceToCore(a)!==void 0&&(this._updateQueue(a,p,h),this._expandCluster(f,h))}return this.clusters};Yo.prototype.getReachabilityPlot=function(){for(var r=[],t=0,e=this._orderedList.length;t<e;t++){var o=this._orderedList[t],a=this._reachability[o];r.push([o,a])}return r};Yo.prototype._init=function(r,t,e,o){if(r){if(!(r instanceof Array))throw Error("Dataset must be of type array, "+typeof r+" given");this.dataset=r,this.clusters=[],this._reachability=new Array(this.dataset.length),this._processed=new Array(this.dataset.length),this._coreDistance=0,this._orderedList=[]}t&&(this.epsilon=t),e&&(this.minPts=e),o&&(this.distance=o)};Yo.prototype._updateQueue=function(r,t,e){var o=this;this._coreDistance=this._distanceToCore(r),t.forEach(function(a){if(o._processed[a]===void 0){var l=o.distance(o.dataset[r],o.dataset[a]),f=Math.max(o._coreDistance,l);o._reachability[a]===void 0?(o._reachability[a]=f,e.insert(a,f)):f<o._reachability[a]&&(o._reachability[a]=f,e.remove(a),e.insert(a,f))}})};Yo.prototype._expandCluster=function(r,t){for(var e=t.getElements(),o=0,a=e.length;o<a;o++){var l=e[o];if(this._processed[l]===void 0){var f=this._regionQuery(l);this._processed[l]=1,this.clusters[r].push(l),this._orderedList.push(l),this._distanceToCore(l)!==void 0&&(this._updateQueue(l,f,t),this._expandCluster(r,t))}}};Yo.prototype._distanceToCore=function(r){for(var t=this.epsilon,e=0;e<t;e++){var o=this._regionQuery(r,e);if(o.length>=this.minPts)return e}};Yo.prototype._regionQuery=function(r,t){t=t||this.epsilon;for(var e=[],o=0,a=this.dataset.length;o<a;o++)this.distance(this.dataset[r],this.dataset[o])<t&&e.push(o);return e};Yo.prototype._euclideanDistance=function(r,t){for(var e=0,o=Math.min(r.length,t.length);o--;)e+=(r[o]-t[o])*(r[o]-t[o]);return Math.sqrt(e)};typeof uu!="undefined"&&uu.exports&&(uu.exports=Yo)});var __=Kt((BB,tf)=>{typeof tf!="undefined"&&tf.exports&&(tf.exports={DBSCAN:m_(),KMEANS:g_(),OPTICS:v_(),PriorityQueue:gd()})});var yd=Kt((WB,E_)=>{"use strict";E_.exports={eudist:function(t,e,o){for(var a=t.length,l=0,f=0;f<a;f++){var h=(t[f]||0)-(e[f]||0);l+=h*h}return o?Math.sqrt(l):l},mandist:function(t,e,o){for(var a=t.length,l=0,f=0;f<a;f++)l+=Math.abs((t[f]||0)-(e[f]||0));return o?Math.sqrt(l):l},dist:function(t,e,o){var a=Math.abs(t-e);return o?a:a*a}}});var w_=Kt((qB,S_)=>{"use strict";var M_=yd(),FP=M_.eudist,UP=M_.dist;S_.exports={kmrand:function(t,e){for(var o={},a=[],l=e<<2,f=t.length,h=t[0].length>0;a.length<e&&l-- >0;){var p=t[Math.floor(Math.random()*f)],d=h?p.join("_"):""+p;o[d]||(o[d]=!0,a.push(p))}if(a.length<e)throw new Error("Error initializating clusters");return a},kmpp:function(t,e){var o=t[0].length?FP:UP,a=[],l=t.length,f=t[0].length>0,h={},p=t[Math.floor(Math.random()*l)],d=f?p.join("_"):""+p;for(a.push(p),h[d]=!0;a.length<e;){for(var g=[],_=a.length,y=0,M=[],w=0;w<l;w++){for(var A=1/0,x=0;x<_;x++){var v=o(t[w],a[x]);v<=A&&(A=v)}g[w]=A}for(var C=0;C<l;C++)y+=g[C];for(var S=0;S<l;S++)M[S]={i:S,v:t[S],pr:g[S]/y,cs:0};M.sort(function(z,L){return z.pr-L.pr}),M[0].cs=M[0].pr;for(var O=1;O<l;O++)M[O].cs=M[O-1].cs+M[O].pr;for(var F=Math.random(),G=0;G<l-1&&M[G++].cs<F;);a.push(M[G-1].v)}return a}}});var P_=Kt((ZB,C_)=>{"use strict";var vd=yd(),A_=w_(),BP=vd.eudist,XB=vd.mandist,YB=vd.dist,zP=A_.kmrand,kP=A_.kmpp,b_=1e4;function T_(r,t,e){e=e||[];for(var o=0;o<r;o++)e[o]=t;return e}function GP(r,t,e,o){var a=[],l=[],f=[],h=[],p=!1,d=o||b_,g=r.length,_=r[0].length,y=_>0,M=[];if(e)e=="kmrand"?a=zP(r,t):e=="kmpp"?a=kP(r,t):a=e;else for(var w={};a.length<t;){var A=Math.floor(Math.random()*g);w[A]||(w[A]=!0,a.push(r[A]))}do{T_(t,0,M);for(var x=0;x<g;x++){for(var v=1/0,C=0,S=0;S<t;S++){var h=y?BP(r[x],a[S]):Math.abs(r[x]-a[S]);h<=v&&(v=h,C=S)}f[x]=C,M[C]++}for(var O=[],l=[],F=0,G=0;G<t;G++)O[G]=y?T_(_,0,O[G]):0,l[G]=a[G];if(y){for(var z=0;z<t;z++)a[z]=[];for(var L=0;L<g;L++)for(var D=f[L],q=O[D],nt=r[L],k=0;k<_;k++)q[k]+=nt[k];p=!0;for(var xt=0;xt<t;xt++){for(var X=a[xt],it=O[xt],vt=l[xt],pt=M[xt],et=0;et<_;et++)X[et]=it[et]/pt||0;if(p){for(var ot=0;ot<_;ot++)if(vt[ot]!=X[ot]){p=!1;break}}}}else{for(var V=0;V<g;V++){var K=f[V];O[K]+=r[V]}for(var at=0;at<t;at++)a[at]=O[at]/M[at]||0;p=!0;for(var Tt=0;Tt<t;Tt++)if(l[Tt]!=a[Tt]){p=!1;break}}p=p||--d<=0}while(!p);return{it:b_-d,k:t,idxs:f,centroids:a}}C_.exports=GP});var pu=Kt((wd,bd)=>{(function(r,t){typeof wd=="object"&&typeof bd!="undefined"?bd.exports=t():typeof define=="function"&&define.amd?define(t):(r=typeof globalThis!="undefined"?globalThis:r||self,r.polygonClipping=t())})(wd,function(){"use strict";function r($,N){if(!($ instanceof N))throw new TypeError("Cannot call a class as a function")}function t($,N){for(var b=0;b<N.length;b++){var R=N[b];R.enumerable=R.enumerable||!1,R.configurable=!0,"value"in R&&(R.writable=!0),Object.defineProperty($,R.key,R)}}function e($,N,b){return N&&t($.prototype,N),b&&t($,b),$}var o=function(){function $(N,b){this.next=null,this.key=N,this.data=b,this.left=null,this.right=null}return $}();function a($,N){return $>N?1:$<N?-1:0}function l($,N,b){for(var R=new o(null,null),W=R,J=R;;){var I=b($,N.key);if(I<0){if(N.left===null)break;if(b($,N.left.key)<0){var P=N.left;if(N.left=P.right,P.right=N,N=P,N.left===null)break}J.left=N,J=N,N=N.left}else if(I>0){if(N.right===null)break;if(b($,N.right.key)>0){var P=N.right;if(N.right=P.left,P.left=N,N=P,N.right===null)break}W.right=N,W=N,N=N.right}else break}return W.right=N.left,J.left=N.right,N.left=R.right,N.right=R.left,N}function f($,N,b,R){var W=new o($,N);if(b===null)return W.left=W.right=null,W;b=l($,b,R);var J=R($,b.key);return J<0?(W.left=b.left,W.right=b,b.left=null):J>=0&&(W.right=b.right,W.left=b,b.right=null),W}function h($,N,b){var R=null,W=null;if(N){N=l($,N,b);var J=b(N.key,$);J===0?(R=N.left,W=N.right):J<0?(W=N.right,N.right=null,R=N):(R=N.left,N.left=null,W=N)}return{left:R,right:W}}function p($,N,b){return N===null?$:($===null||(N=l($.key,N,b),N.left=$),N)}function d($,N,b,R,W){if($){R(""+N+(b?"\\u2514\\u2500\\u2500 ":"\\u251C\\u2500\\u2500 ")+W($)+`\n`);var J=N+(b?" ":"\\u2502 ");$.left&&d($.left,J,!1,R,W),$.right&&d($.right,J,!0,R,W)}}var g=function(){function $(N){N===void 0&&(N=a),this._root=null,this._size=0,this._comparator=N}return $.prototype.insert=function(N,b){return this._size++,this._root=f(N,b,this._root,this._comparator)},$.prototype.add=function(N,b){var R=new o(N,b);this._root===null&&(R.left=R.right=null,this._size++,this._root=R);var W=this._comparator,J=l(N,this._root,W),I=W(N,J.key);return I===0?this._root=J:(I<0?(R.left=J.left,R.right=J,J.left=null):I>0&&(R.right=J.right,R.left=J,J.right=null),this._size++,this._root=R),this._root},$.prototype.remove=function(N){this._root=this._remove(N,this._root,this._comparator)},$.prototype._remove=function(N,b,R){var W;if(b===null)return null;b=l(N,b,R);var J=R(N,b.key);return J===0?(b.left===null?W=b.right:(W=l(N,b.left,R),W.right=b.right),this._size--,W):b},$.prototype.pop=function(){var N=this._root;if(N){for(;N.left;)N=N.left;return this._root=l(N.key,this._root,this._comparator),this._root=this._remove(N.key,this._root,this._comparator),{key:N.key,data:N.data}}return null},$.prototype.findStatic=function(N){for(var b=this._root,R=this._comparator;b;){var W=R(N,b.key);if(W===0)return b;W<0?b=b.left:b=b.right}return null},$.prototype.find=function(N){return this._root&&(this._root=l(N,this._root,this._comparator),this._comparator(N,this._root.key)!==0)?null:this._root},$.prototype.contains=function(N){for(var b=this._root,R=this._comparator;b;){var W=R(N,b.key);if(W===0)return!0;W<0?b=b.left:b=b.right}return!1},$.prototype.forEach=function(N,b){for(var R=this._root,W=[],J=!1;!J;)R!==null?(W.push(R),R=R.left):W.length!==0?(R=W.pop(),N.call(b,R),R=R.right):J=!0;return this},$.prototype.range=function(N,b,R,W){for(var J=[],I=this._comparator,P=this._root,B;J.length!==0||P;)if(P)J.push(P),P=P.left;else{if(P=J.pop(),B=I(P.key,b),B>0)break;if(I(P.key,N)>=0&&R.call(W,P))return this;P=P.right}return this},$.prototype.keys=function(){var N=[];return this.forEach(function(b){var R=b.key;return N.push(R)}),N},$.prototype.values=function(){var N=[];return this.forEach(function(b){var R=b.data;return N.push(R)}),N},$.prototype.min=function(){return this._root?this.minNode(this._root).key:null},$.prototype.max=function(){return this._root?this.maxNode(this._root).key:null},$.prototype.minNode=function(N){if(N===void 0&&(N=this._root),N)for(;N.left;)N=N.left;return N},$.prototype.maxNode=function(N){if(N===void 0&&(N=this._root),N)for(;N.right;)N=N.right;return N},$.prototype.at=function(N){for(var b=this._root,R=!1,W=0,J=[];!R;)if(b)J.push(b),b=b.left;else if(J.length>0){if(b=J.pop(),W===N)return b;W++,b=b.right}else R=!0;return null},$.prototype.next=function(N){var b=this._root,R=null;if(N.right){for(R=N.right;R.left;)R=R.left;return R}for(var W=this._comparator;b;){var J=W(N.key,b.key);if(J===0)break;J<0?(R=b,b=b.left):b=b.right}return R},$.prototype.prev=function(N){var b=this._root,R=null;if(N.left!==null){for(R=N.left;R.right;)R=R.right;return R}for(var W=this._comparator;b;){var J=W(N.key,b.key);if(J===0)break;J<0?b=b.left:(R=b,b=b.right)}return R},$.prototype.clear=function(){return this._root=null,this._size=0,this},$.prototype.toList=function(){return M(this._root)},$.prototype.load=function(N,b,R){b===void 0&&(b=[]),R===void 0&&(R=!1);var W=N.length,J=this._comparator;if(R&&x(N,b,0,W-1,J),this._root===null)this._root=_(N,b,0,W),this._size=W;else{var I=A(this.toList(),y(N,b),J);W=this._size+W,this._root=w({head:I},0,W)}return this},$.prototype.isEmpty=function(){return this._root===null},Object.defineProperty($.prototype,"size",{get:function(){return this._size},enumerable:!0,configurable:!0}),Object.defineProperty($.prototype,"root",{get:function(){return this._root},enumerable:!0,configurable:!0}),$.prototype.toString=function(N){N===void 0&&(N=function(W){return String(W.key)});var b=[];return d(this._root,"",!0,function(R){return b.push(R)},N),b.join("")},$.prototype.update=function(N,b,R){var W=this._comparator,J=h(N,this._root,W),I=J.left,P=J.right;W(N,b)<0?P=f(b,R,P,W):I=f(b,R,I,W),this._root=p(I,P,W)},$.prototype.split=function(N){return h(N,this._root,this._comparator)},$}();function _($,N,b,R){var W=R-b;if(W>0){var J=b+Math.floor(W/2),I=$[J],P=N[J],B=new o(I,P);return B.left=_($,N,b,J),B.right=_($,N,J+1,R),B}return null}function y($,N){for(var b=new o(null,null),R=b,W=0;W<$.length;W++)R=R.next=new o($[W],N[W]);return R.next=null,b.next}function M($){for(var N=$,b=[],R=!1,W=new o(null,null),J=W;!R;)N?(b.push(N),N=N.left):b.length>0?(N=J=J.next=b.pop(),N=N.right):R=!0;return J.next=null,W.next}function w($,N,b){var R=b-N;if(R>0){var W=N+Math.floor(R/2),J=w($,N,W),I=$.head;return I.left=J,$.head=$.head.next,I.right=w($,W+1,b),I}return null}function A($,N,b){for(var R=new o(null,null),W=R,J=$,I=N;J!==null&&I!==null;)b(J.key,I.key)<0?(W.next=J,J=J.next):(W.next=I,I=I.next),W=W.next;return J!==null?W.next=J:I!==null&&(W.next=I),R.next}function x($,N,b,R,W){if(!(b>=R)){for(var J=$[b+R>>1],I=b-1,P=R+1;;){do I++;while(W($[I],J)<0);do P--;while(W($[P],J)>0);if(I>=P)break;var B=$[I];$[I]=$[P],$[P]=B,B=N[I],N[I]=N[P],N[P]=B}x($,N,b,P,W),x($,N,P+1,R,W)}}var v=function(N,b){return N.ll.x<=b.x&&b.x<=N.ur.x&&N.ll.y<=b.y&&b.y<=N.ur.y},C=function(N,b){if(b.ur.x<N.ll.x||N.ur.x<b.ll.x||b.ur.y<N.ll.y||N.ur.y<b.ll.y)return null;var R=N.ll.x<b.ll.x?b.ll.x:N.ll.x,W=N.ur.x<b.ur.x?N.ur.x:b.ur.x,J=N.ll.y<b.ll.y?b.ll.y:N.ll.y,I=N.ur.y<b.ur.y?N.ur.y:b.ur.y;return{ll:{x:R,y:J},ur:{x:W,y:I}}},S=Number.EPSILON;S===void 0&&(S=Math.pow(2,-52));var O=S*S,F=function(N,b){if(-S<N&&N<S&&-S<b&&b<S)return 0;var R=N-b;return R*R<O*N*b?0:N<b?-1:1},G=function(){function $(){r(this,$),this.reset()}return e($,[{key:"reset",value:function(){this.xRounder=new z,this.yRounder=new z}},{key:"round",value:function(b,R){return{x:this.xRounder.round(b),y:this.yRounder.round(R)}}}]),$}(),z=function(){function $(){r(this,$),this.tree=new g,this.round(0)}return e($,[{key:"round",value:function(b){var R=this.tree.add(b),W=this.tree.prev(R);if(W!==null&&F(R.key,W.key)===0)return this.tree.remove(b),W.key;var J=this.tree.next(R);return J!==null&&F(R.key,J.key)===0?(this.tree.remove(b),J.key):b}}]),$}(),L=new G,D=function(N,b){return N.x*b.y-N.y*b.x},q=function(N,b){return N.x*b.x+N.y*b.y},nt=function(N,b,R){var W={x:b.x-N.x,y:b.y-N.y},J={x:R.x-N.x,y:R.y-N.y},I=D(W,J);return F(I,0)},k=function(N){return Math.sqrt(q(N,N))},xt=function(N,b,R){var W={x:b.x-N.x,y:b.y-N.y},J={x:R.x-N.x,y:R.y-N.y};return D(J,W)/k(J)/k(W)},X=function(N,b,R){var W={x:b.x-N.x,y:b.y-N.y},J={x:R.x-N.x,y:R.y-N.y};return q(J,W)/k(J)/k(W)},it=function(N,b,R){return b.y===0?null:{x:N.x+b.x/b.y*(R-N.y),y:R}},vt=function(N,b,R){return b.x===0?null:{x:R,y:N.y+b.y/b.x*(R-N.x)}},pt=function(N,b,R,W){if(b.x===0)return vt(R,W,N.x);if(W.x===0)return vt(N,b,R.x);if(b.y===0)return it(R,W,N.y);if(W.y===0)return it(N,b,R.y);var J=D(b,W);if(J==0)return null;var I={x:R.x-N.x,y:R.y-N.y},P=D(I,b)/J,B=D(I,W)/J,lt=N.x+B*b.x,ct=R.x+P*W.x,Q=N.y+B*b.y,St=R.y+P*W.y,_t=(lt+ct)/2,Mt=(Q+St)/2;return{x:_t,y:Mt}},et=function(){e($,null,[{key:"compare",value:function(b,R){var W=$.comparePoints(b.point,R.point);return W!==0?W:(b.point!==R.point&&b.link(R),b.isLeft!==R.isLeft?b.isLeft?1:-1:V.compare(b.segment,R.segment))}},{key:"comparePoints",value:function(b,R){return b.x<R.x?-1:b.x>R.x?1:b.y<R.y?-1:b.y>R.y?1:0}}]);function $(N,b){r(this,$),N.events===void 0?N.events=[this]:N.events.push(this),this.point=N,this.isLeft=b}return e($,[{key:"link",value:function(b){if(b.point===this.point)throw new Error("Tried to link already linked events");for(var R=b.point.events,W=0,J=R.length;W<J;W++){var I=R[W];this.point.events.push(I),I.point=this.point}this.checkForConsuming()}},{key:"checkForConsuming",value:function(){for(var b=this.point.events.length,R=0;R<b;R++){var W=this.point.events[R];if(W.segment.consumedBy===void 0)for(var J=R+1;J<b;J++){var I=this.point.events[J];I.consumedBy===void 0&&W.otherSE.point.events===I.otherSE.point.events&&W.segment.consume(I.segment)}}}},{key:"getAvailableLinkedEvents",value:function(){for(var b=[],R=0,W=this.point.events.length;R<W;R++){var J=this.point.events[R];J!==this&&!J.segment.ringOut&&J.segment.isInResult()&&b.push(J)}return b}},{key:"getLeftmostComparator",value:function(b){var R=this,W=new Map,J=function(P){var B=P.otherSE;W.set(P,{sine:xt(R.point,b.point,B.point),cosine:X(R.point,b.point,B.point)})};return function(I,P){W.has(I)||J(I),W.has(P)||J(P);var B=W.get(I),lt=B.sine,ct=B.cosine,Q=W.get(P),St=Q.sine,_t=Q.cosine;return lt>=0&&St>=0?ct<_t?1:ct>_t?-1:0:lt<0&&St<0?ct<_t?-1:ct>_t?1:0:St<lt?-1:St>lt?1:0}}}]),$}(),ot=0,V=function(){e($,null,[{key:"compare",value:function(b,R){var W=b.leftSE.point.x,J=R.leftSE.point.x,I=b.rightSE.point.x,P=R.rightSE.point.x;if(P<W)return 1;if(I<J)return-1;var B=b.leftSE.point.y,lt=R.leftSE.point.y,ct=b.rightSE.point.y,Q=R.rightSE.point.y;if(W<J){if(lt<B&<<ct)return 1;if(lt>B&<>ct)return-1;var St=b.comparePoint(R.leftSE.point);if(St<0)return 1;if(St>0)return-1;var _t=R.comparePoint(b.rightSE.point);return _t!==0?_t:-1}if(W>J){if(B<lt&&B<Q)return-1;if(B>lt&&B>Q)return 1;var Mt=R.comparePoint(b.leftSE.point);if(Mt!==0)return Mt;var Lt=b.comparePoint(R.rightSE.point);return Lt<0?1:Lt>0?-1:1}if(B<lt)return-1;if(B>lt)return 1;if(I<P){var Jt=R.comparePoint(b.rightSE.point);if(Jt!==0)return Jt}if(I>P){var Et=b.comparePoint(R.rightSE.point);if(Et<0)return 1;if(Et>0)return-1}if(I!==P){var oe=ct-B,jt=I-W,Ht=Q-lt,Ot=P-J;if(oe>jt&&Ht<Ot)return 1;if(oe<jt&&Ht>Ot)return-1}return I>P?1:I<P||ct<Q?-1:ct>Q?1:b.id<R.id?-1:b.id>R.id?1:0}}]);function $(N,b,R,W){r(this,$),this.id=++ot,this.leftSE=N,N.segment=this,N.otherSE=b,this.rightSE=b,b.segment=this,b.otherSE=N,this.rings=R,this.windings=W}return e($,[{key:"replaceRightSE",value:function(b){this.rightSE=b,this.rightSE.segment=this,this.rightSE.otherSE=this.leftSE,this.leftSE.otherSE=this.rightSE}},{key:"bbox",value:function(){var b=this.leftSE.point.y,R=this.rightSE.point.y;return{ll:{x:this.leftSE.point.x,y:b<R?b:R},ur:{x:this.rightSE.point.x,y:b>R?b:R}}}},{key:"vector",value:function(){return{x:this.rightSE.point.x-this.leftSE.point.x,y:this.rightSE.point.y-this.leftSE.point.y}}},{key:"isAnEndpoint",value:function(b){return b.x===this.leftSE.point.x&&b.y===this.leftSE.point.y||b.x===this.rightSE.point.x&&b.y===this.rightSE.point.y}},{key:"comparePoint",value:function(b){if(this.isAnEndpoint(b))return 0;var R=this.leftSE.point,W=this.rightSE.point,J=this.vector();if(R.x===W.x)return b.x===R.x?0:b.x<R.x?1:-1;var I=(b.y-R.y)/J.y,P=R.x+I*J.x;if(b.x===P)return 0;var B=(b.x-R.x)/J.x,lt=R.y+B*J.y;return b.y===lt?0:b.y<lt?-1:1}},{key:"getIntersection",value:function(b){var R=this.bbox(),W=b.bbox(),J=C(R,W);if(J===null)return null;var I=this.leftSE.point,P=this.rightSE.point,B=b.leftSE.point,lt=b.rightSE.point,ct=v(R,B)&&this.comparePoint(B)===0,Q=v(W,I)&&b.comparePoint(I)===0,St=v(R,lt)&&this.comparePoint(lt)===0,_t=v(W,P)&&b.comparePoint(P)===0;if(Q&&ct)return _t&&!St?P:!_t&&St?lt:null;if(Q)return St&&I.x===lt.x&&I.y===lt.y?null:I;if(ct)return _t&&P.x===B.x&&P.y===B.y?null:B;if(_t&&St)return null;if(_t)return P;if(St)return lt;var Mt=pt(I,this.vector(),B,b.vector());return Mt===null||!v(J,Mt)?null:L.round(Mt.x,Mt.y)}},{key:"split",value:function(b){var R=[],W=b.events!==void 0,J=new et(b,!0),I=new et(b,!1),P=this.rightSE;this.replaceRightSE(I),R.push(I),R.push(J);var B=new $(J,P,this.rings.slice(),this.windings.slice());return et.comparePoints(B.leftSE.point,B.rightSE.point)>0&&B.swapEvents(),et.comparePoints(this.leftSE.point,this.rightSE.point)>0&&this.swapEvents(),W&&(J.checkForConsuming(),I.checkForConsuming()),R}},{key:"swapEvents",value:function(){var b=this.rightSE;this.rightSE=this.leftSE,this.leftSE=b,this.leftSE.isLeft=!0,this.rightSE.isLeft=!1;for(var R=0,W=this.windings.length;R<W;R++)this.windings[R]*=-1}},{key:"consume",value:function(b){for(var R=this,W=b;R.consumedBy;)R=R.consumedBy;for(;W.consumedBy;)W=W.consumedBy;var J=$.compare(R,W);if(J!==0){if(J>0){var I=R;R=W,W=I}if(R.prev===W){var P=R;R=W,W=P}for(var B=0,lt=W.rings.length;B<lt;B++){var ct=W.rings[B],Q=W.windings[B],St=R.rings.indexOf(ct);St===-1?(R.rings.push(ct),R.windings.push(Q)):R.windings[St]+=Q}W.rings=null,W.windings=null,W.consumedBy=R,W.leftSE.consumedBy=R.leftSE,W.rightSE.consumedBy=R.rightSE}}},{key:"prevInResult",value:function(){return this._prevInResult!==void 0?this._prevInResult:(this.prev?this.prev.isInResult()?this._prevInResult=this.prev:this._prevInResult=this.prev.prevInResult():this._prevInResult=null,this._prevInResult)}},{key:"beforeState",value:function(){if(this._beforeState!==void 0)return this._beforeState;if(!this.prev)this._beforeState={rings:[],windings:[],multiPolys:[]};else{var b=this.prev.consumedBy||this.prev;this._beforeState=b.afterState()}return this._beforeState}},{key:"afterState",value:function(){if(this._afterState!==void 0)return this._afterState;var b=this.beforeState();this._afterState={rings:b.rings.slice(0),windings:b.windings.slice(0),multiPolys:[]};for(var R=this._afterState.rings,W=this._afterState.windings,J=this._afterState.multiPolys,I=0,P=this.rings.length;I<P;I++){var B=this.rings[I],lt=this.windings[I],ct=R.indexOf(B);ct===-1?(R.push(B),W.push(lt)):W[ct]+=lt}for(var Q=[],St=[],_t=0,Mt=R.length;_t<Mt;_t++)if(W[_t]!==0){var Lt=R[_t],Jt=Lt.poly;if(St.indexOf(Jt)===-1)if(Lt.isExterior)Q.push(Jt);else{St.indexOf(Jt)===-1&&St.push(Jt);var Et=Q.indexOf(Lt.poly);Et!==-1&&Q.splice(Et,1)}}for(var oe=0,jt=Q.length;oe<jt;oe++){var Ht=Q[oe].multiPoly;J.indexOf(Ht)===-1&&J.push(Ht)}return this._afterState}},{key:"isInResult",value:function(){if(this.consumedBy)return!1;if(this._isInResult!==void 0)return this._isInResult;var b=this.beforeState().multiPolys,R=this.afterState().multiPolys;switch(Xt.type){case"union":{var W=b.length===0,J=R.length===0;this._isInResult=W!==J;break}case"intersection":{var I,P;b.length<R.length?(I=b.length,P=R.length):(I=R.length,P=b.length),this._isInResult=P===Xt.numMultiPolys&&I<P;break}case"xor":{var B=Math.abs(b.length-R.length);this._isInResult=B%2===1;break}case"difference":{var lt=function(Q){return Q.length===1&&Q[0].isSubject};this._isInResult=lt(b)!==lt(R);break}default:throw new Error("Unrecognized operation type found ".concat(Xt.type))}return this._isInResult}}],[{key:"fromRing",value:function(b,R,W){var J,I,P,B=et.comparePoints(b,R);if(B<0)J=b,I=R,P=1;else if(B>0)J=R,I=b,P=-1;else throw new Error("Tried to create degenerate segment at [".concat(b.x,", ").concat(b.y,"]"));var lt=new et(J,!0),ct=new et(I,!1);return new $(lt,ct,[W],[P])}}]),$}(),K=function(){function $(N,b,R){if(r(this,$),!Array.isArray(N)||N.length===0)throw new Error("Input geometry is not a valid Polygon or MultiPolygon");if(this.poly=b,this.isExterior=R,this.segments=[],typeof N[0][0]!="number"||typeof N[0][1]!="number")throw new Error("Input geometry is not a valid Polygon or MultiPolygon");var W=L.round(N[0][0],N[0][1]);this.bbox={ll:{x:W.x,y:W.y},ur:{x:W.x,y:W.y}};for(var J=W,I=1,P=N.length;I<P;I++){if(typeof N[I][0]!="number"||typeof N[I][1]!="number")throw new Error("Input geometry is not a valid Polygon or MultiPolygon");var B=L.round(N[I][0],N[I][1]);B.x===J.x&&B.y===J.y||(this.segments.push(V.fromRing(J,B,this)),B.x<this.bbox.ll.x&&(this.bbox.ll.x=B.x),B.y<this.bbox.ll.y&&(this.bbox.ll.y=B.y),B.x>this.bbox.ur.x&&(this.bbox.ur.x=B.x),B.y>this.bbox.ur.y&&(this.bbox.ur.y=B.y),J=B)}(W.x!==J.x||W.y!==J.y)&&this.segments.push(V.fromRing(J,W,this))}return e($,[{key:"getSweepEvents",value:function(){for(var b=[],R=0,W=this.segments.length;R<W;R++){var J=this.segments[R];b.push(J.leftSE),b.push(J.rightSE)}return b}}]),$}(),at=function(){function $(N,b){if(r(this,$),!Array.isArray(N))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");this.exteriorRing=new K(N[0],this,!0),this.bbox={ll:{x:this.exteriorRing.bbox.ll.x,y:this.exteriorRing.bbox.ll.y},ur:{x:this.exteriorRing.bbox.ur.x,y:this.exteriorRing.bbox.ur.y}},this.interiorRings=[];for(var R=1,W=N.length;R<W;R++){var J=new K(N[R],this,!1);J.bbox.ll.x<this.bbox.ll.x&&(this.bbox.ll.x=J.bbox.ll.x),J.bbox.ll.y<this.bbox.ll.y&&(this.bbox.ll.y=J.bbox.ll.y),J.bbox.ur.x>this.bbox.ur.x&&(this.bbox.ur.x=J.bbox.ur.x),J.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=J.bbox.ur.y),this.interiorRings.push(J)}this.multiPoly=b}return e($,[{key:"getSweepEvents",value:function(){for(var b=this.exteriorRing.getSweepEvents(),R=0,W=this.interiorRings.length;R<W;R++)for(var J=this.interiorRings[R].getSweepEvents(),I=0,P=J.length;I<P;I++)b.push(J[I]);return b}}]),$}(),Tt=function(){function $(N,b){if(r(this,$),!Array.isArray(N))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");try{typeof N[0][0][0]=="number"&&(N=[N])}catch(I){}this.polys=[],this.bbox={ll:{x:Number.POSITIVE_INFINITY,y:Number.POSITIVE_INFINITY},ur:{x:Number.NEGATIVE_INFINITY,y:Number.NEGATIVE_INFINITY}};for(var R=0,W=N.length;R<W;R++){var J=new at(N[R],this);J.bbox.ll.x<this.bbox.ll.x&&(this.bbox.ll.x=J.bbox.ll.x),J.bbox.ll.y<this.bbox.ll.y&&(this.bbox.ll.y=J.bbox.ll.y),J.bbox.ur.x>this.bbox.ur.x&&(this.bbox.ur.x=J.bbox.ur.x),J.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=J.bbox.ur.y),this.polys.push(J)}this.isSubject=b}return e($,[{key:"getSweepEvents",value:function(){for(var b=[],R=0,W=this.polys.length;R<W;R++)for(var J=this.polys[R].getSweepEvents(),I=0,P=J.length;I<P;I++)b.push(J[I]);return b}}]),$}(),dt=function(){e($,null,[{key:"factory",value:function(b){for(var R=[],W=0,J=b.length;W<J;W++){var I=b[W];if(!(!I.isInResult()||I.ringOut)){for(var P=null,B=I.leftSE,lt=I.rightSE,ct=[B],Q=B.point,St=[];P=B,B=lt,ct.push(B),B.point!==Q;)for(;;){var _t=B.getAvailableLinkedEvents();if(_t.length===0){var Mt=ct[0].point,Lt=ct[ct.length-1].point;throw new Error("Unable to complete output ring starting at [".concat(Mt.x,",")+" ".concat(Mt.y,"]. Last matching segment found ends at")+" [".concat(Lt.x,", ").concat(Lt.y,"]."))}if(_t.length===1){lt=_t[0].otherSE;break}for(var Jt=null,Et=0,oe=St.length;Et<oe;Et++)if(St[Et].point===B.point){Jt=Et;break}if(Jt!==null){var jt=St.splice(Jt)[0],Ht=ct.splice(jt.index);Ht.unshift(Ht[0].otherSE),R.push(new $(Ht.reverse()));continue}St.push({index:ct.length,point:B.point});var Ot=B.getLeftmostComparator(P);lt=_t.sort(Ot)[0].otherSE;break}R.push(new $(ct))}}return R}}]);function $(N){r(this,$),this.events=N;for(var b=0,R=N.length;b<R;b++)N[b].segment.ringOut=this;this.poly=null}return e($,[{key:"getGeom",value:function(){for(var b=this.events[0].point,R=[b],W=1,J=this.events.length-1;W<J;W++){var I=this.events[W].point,P=this.events[W+1].point;nt(I,b,P)!==0&&(R.push(I),b=I)}if(R.length===1)return null;var B=R[0],lt=R[1];nt(B,b,lt)===0&&R.shift(),R.push(R[0]);for(var ct=this.isExteriorRing()?1:-1,Q=this.isExteriorRing()?0:R.length-1,St=this.isExteriorRing()?R.length:-1,_t=[],Mt=Q;Mt!=St;Mt+=ct)_t.push([R[Mt].x,R[Mt].y]);return _t}},{key:"isExteriorRing",value:function(){if(this._isExteriorRing===void 0){var b=this.enclosingRing();this._isExteriorRing=b?!b.isExteriorRing():!0}return this._isExteriorRing}},{key:"enclosingRing",value:function(){return this._enclosingRing===void 0&&(this._enclosingRing=this._calcEnclosingRing()),this._enclosingRing}},{key:"_calcEnclosingRing",value:function(){for(var b=this.events[0],R=1,W=this.events.length;R<W;R++){var J=this.events[R];et.compare(b,J)>0&&(b=J)}for(var I=b.segment.prevInResult(),P=I?I.prevInResult():null;;){if(!I)return null;if(!P)return I.ringOut;if(P.ringOut!==I.ringOut)return P.ringOut.enclosingRing()!==I.ringOut?I.ringOut:I.ringOut.enclosingRing();I=P.prevInResult(),P=I?I.prevInResult():null}}}]),$}(),Ct=function(){function $(N){r(this,$),this.exteriorRing=N,N.poly=this,this.interiorRings=[]}return e($,[{key:"addInterior",value:function(b){this.interiorRings.push(b),b.poly=this}},{key:"getGeom",value:function(){var b=[this.exteriorRing.getGeom()];if(b[0]===null)return null;for(var R=0,W=this.interiorRings.length;R<W;R++){var J=this.interiorRings[R].getGeom();J!==null&&b.push(J)}return b}}]),$}(),Yt=function(){function $(N){r(this,$),this.rings=N,this.polys=this._composePolys(N)}return e($,[{key:"getGeom",value:function(){for(var b=[],R=0,W=this.polys.length;R<W;R++){var J=this.polys[R].getGeom();J!==null&&b.push(J)}return b}},{key:"_composePolys",value:function(b){for(var R=[],W=0,J=b.length;W<J;W++){var I=b[W];if(!I.poly)if(I.isExteriorRing())R.push(new Ct(I));else{var P=I.enclosingRing();P.poly||R.push(new Ct(P)),P.poly.addInterior(I)}}return R}}]),$}(),Wt=function(){function $(N){var b=arguments.length>1&&arguments[1]!==void 0?arguments[1]:V.compare;r(this,$),this.queue=N,this.tree=new g(b),this.segments=[]}return e($,[{key:"process",value:function(b){var R=b.segment,W=[];if(b.consumedBy)return b.isLeft?this.queue.remove(b.otherSE):this.tree.remove(R),W;var J=b.isLeft?this.tree.insert(R):this.tree.find(R);if(!J)throw new Error("Unable to find segment #".concat(R.id," ")+"[".concat(R.leftSE.point.x,", ").concat(R.leftSE.point.y,"] -> ")+"[".concat(R.rightSE.point.x,", ").concat(R.rightSE.point.y,"] ")+"in SweepLine tree. Please submit a bug report.");for(var I=J,P=J,B=void 0,lt=void 0;B===void 0;)I=this.tree.prev(I),I===null?B=null:I.key.consumedBy===void 0&&(B=I.key);for(;lt===void 0;)P=this.tree.next(P),P===null?lt=null:P.key.consumedBy===void 0&&(lt=P.key);if(b.isLeft){var ct=null;if(B){var Q=B.getIntersection(R);if(Q!==null&&(R.isAnEndpoint(Q)||(ct=Q),!B.isAnEndpoint(Q)))for(var St=this._splitSafely(B,Q),_t=0,Mt=St.length;_t<Mt;_t++)W.push(St[_t])}var Lt=null;if(lt){var Jt=lt.getIntersection(R);if(Jt!==null&&(R.isAnEndpoint(Jt)||(Lt=Jt),!lt.isAnEndpoint(Jt)))for(var Et=this._splitSafely(lt,Jt),oe=0,jt=Et.length;oe<jt;oe++)W.push(Et[oe])}if(ct!==null||Lt!==null){var Ht=null;if(ct===null)Ht=Lt;else if(Lt===null)Ht=ct;else{var Ot=et.comparePoints(ct,Lt);Ht=Ot<=0?ct:Lt}this.queue.remove(R.rightSE),W.push(R.rightSE);for(var Y=R.split(Ht),wt=0,j=Y.length;wt<j;wt++)W.push(Y[wt])}W.length>0?(this.tree.remove(R),W.push(b)):(this.segments.push(R),R.prev=B)}else{if(B&<){var Ut=B.getIntersection(lt);if(Ut!==null){if(!B.isAnEndpoint(Ut))for(var Dt=this._splitSafely(B,Ut),ft=0,$t=Dt.length;ft<$t;ft++)W.push(Dt[ft]);if(!lt.isAnEndpoint(Ut))for(var re=this._splitSafely(lt,Ut),mn=0,He=re.length;mn<He;mn++)W.push(re[mn])}}this.tree.remove(R)}return W}},{key:"_splitSafely",value:function(b,R){this.tree.remove(b);var W=b.rightSE;this.queue.remove(W);var J=b.split(R);return J.push(W),b.consumedBy===void 0&&this.tree.insert(b),J}}]),$}(),Nt=typeof process!="undefined"&&process.env.POLYGON_CLIPPING_MAX_QUEUE_SIZE||1e6,ne=typeof process!="undefined"&&process.env.POLYGON_CLIPPING_MAX_SWEEPLINE_SEGMENTS||1e6,Pt=function(){function $(){r(this,$)}return e($,[{key:"run",value:function(b,R,W){Xt.type=b,L.reset();for(var J=[new Tt(R,!0)],I=0,P=W.length;I<P;I++)J.push(new Tt(W[I],!1));if(Xt.numMultiPolys=J.length,Xt.type==="difference")for(var B=J[0],lt=1;lt<J.length;)C(J[lt].bbox,B.bbox)!==null?lt++:J.splice(lt,1);if(Xt.type==="intersection"){for(var ct=0,Q=J.length;ct<Q;ct++)for(var St=J[ct],_t=ct+1,Mt=J.length;_t<Mt;_t++)if(C(St.bbox,J[_t].bbox)===null)return[]}for(var Lt=new g(et.compare),Jt=0,Et=J.length;Jt<Et;Jt++)for(var oe=J[Jt].getSweepEvents(),jt=0,Ht=oe.length;jt<Ht;jt++)if(Lt.insert(oe[jt]),Lt.size>Nt)throw new Error("Infinite loop when putting segment endpoints in a priority queue (queue size too big). Please file a bug report.");for(var Ot=new Wt(Lt),Y=Lt.size,wt=Lt.pop();wt;){var j=wt.key;if(Lt.size===Y){var Ut=j.segment;throw new Error("Unable to pop() ".concat(j.isLeft?"left":"right"," SweepEvent ")+"[".concat(j.point.x,", ").concat(j.point.y,"] from segment #").concat(Ut.id," ")+"[".concat(Ut.leftSE.point.x,", ").concat(Ut.leftSE.point.y,"] -> ")+"[".concat(Ut.rightSE.point.x,", ").concat(Ut.rightSE.point.y,"] from queue. ")+"Please file a bug report.")}if(Lt.size>Nt)throw new Error("Infinite loop when passing sweep line over endpoints (queue size too big). Please file a bug report.");if(Ot.segments.length>ne)throw new Error("Infinite loop when passing sweep line over endpoints (too many sweep line segments). Please file a bug report.");for(var Dt=Ot.process(j),ft=0,$t=Dt.length;ft<$t;ft++){var re=Dt[ft];re.consumedBy===void 0&&Lt.insert(re)}Y=Lt.size,wt=Lt.pop()}L.reset();var mn=dt.factory(Ot.segments),He=new Yt(mn);return He.getGeom()}}]),$}(),Xt=new Pt,tt=function(N){for(var b=arguments.length,R=new Array(b>1?b-1:0),W=1;W<b;W++)R[W-1]=arguments[W];return Xt.run("union",N,R)},nn=function(N){for(var b=arguments.length,R=new Array(b>1?b-1:0),W=1;W<b;W++)R[W-1]=arguments[W];return Xt.run("intersection",N,R)},Gt=function(N){for(var b=arguments.length,R=new Array(b>1?b-1:0),W=1;W<b;W++)R[W-1]=arguments[W];return Xt.run("xor",N,R)},te=function(N){for(var b=arguments.length,R=new Array(b>1?b-1:0),W=1;W<b;W++)R[W-1]=arguments[W];return Xt.run("difference",N,R)},qt={union:tt,intersection:nn,xor:Gt,difference:te};return qt})});var Z_=Kt((of,Y_)=>{(function(r,t){typeof of=="object"&&typeof Y_!="undefined"?t(of):typeof define=="function"&&define.amd?define(["exports"],t):t(r.jsts={})})(of,function(r){"use strict";function t(){}function e(n){this.message=n||""}function o(n){this.message=n||""}function a(n){this.message=n||""}function l(){}function f(n){return n===null?hi:n.color}function h(n){return n===null?null:n.parent}function p(n,i){n!==null&&(n.color=i)}function d(n){return n===null?null:n.left}function g(n){return n===null?null:n.right}function _(){this.root_=null,this.size_=0}function y(){}function M(){this.array_=[],arguments[0]instanceof Ot&&this.addAll(arguments[0])}function w(){}function A(n){this.message=n||""}function x(){this.array_=[]}"fill"in Array.prototype||Object.defineProperty(Array.prototype,"fill",{configurable:!0,value:function(n){if(this===void 0||this===null)throw new TypeError(this+" is not an object");var i=Object(this),s=Math.max(Math.min(i.length,9007199254740991),0)||0,u=1 in arguments&&parseInt(Number(arguments[1]),10)||0;u=u<0?Math.max(s+u,0):Math.min(u,s);var c=2 in arguments&&arguments[2]!==void 0?parseInt(Number(arguments[2]),10)||0:s;for(c=c<0?Math.max(s+arguments[2],0):Math.min(c,s);u<c;)i[u]=n,++u;return i},writable:!0}),Number.isFinite=Number.isFinite||function(n){return typeof n=="number"&&isFinite(n)},Number.isInteger=Number.isInteger||function(n){return typeof n=="number"&&isFinite(n)&&Math.floor(n)===n},Number.parseFloat=Number.parseFloat||parseFloat,Number.isNaN=Number.isNaN||function(n){return n!=n},Math.trunc=Math.trunc||function(n){return n<0?Math.ceil(n):Math.floor(n)};var v=function(){};v.prototype.interfaces_=function(){return[]},v.prototype.getClass=function(){return v},v.prototype.equalsWithTolerance=function(n,i,s){return Math.abs(n-i)<=s};var C=function(n){function i(s){n.call(this,s),this.name="IllegalArgumentException",this.message=s,this.stack=new n().stack}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i}(Error),S=function(){},O={MAX_VALUE:{configurable:!0}};S.isNaN=function(n){return Number.isNaN(n)},S.doubleToLongBits=function(n){return n},S.longBitsToDouble=function(n){return n},S.isInfinite=function(n){return!Number.isFinite(n)},O.MAX_VALUE.get=function(){return Number.MAX_VALUE},Object.defineProperties(S,O);var F=function(){},G=function(){},z=function(){},L=function n(){if(this.x=null,this.y=null,this.z=null,arguments.length===0)this.x=0,this.y=0,this.z=n.NULL_ORDINATE;else if(arguments.length===1){var i=arguments[0];this.x=i.x,this.y=i.y,this.z=i.z}else arguments.length===2?(this.x=arguments[0],this.y=arguments[1],this.z=n.NULL_ORDINATE):arguments.length===3&&(this.x=arguments[0],this.y=arguments[1],this.z=arguments[2])},D={DimensionalComparator:{configurable:!0},serialVersionUID:{configurable:!0},NULL_ORDINATE:{configurable:!0},X:{configurable:!0},Y:{configurable:!0},Z:{configurable:!0}};L.prototype.setOrdinate=function(n,i){switch(n){case L.X:this.x=i;break;case L.Y:this.y=i;break;case L.Z:this.z=i;break;default:throw new C("Invalid ordinate index: "+n)}},L.prototype.equals2D=function(){if(arguments.length===1){var n=arguments[0];return this.x===n.x&&this.y===n.y}if(arguments.length===2){var i=arguments[0],s=arguments[1];return!!v.equalsWithTolerance(this.x,i.x,s)&&!!v.equalsWithTolerance(this.y,i.y,s)}},L.prototype.getOrdinate=function(n){switch(n){case L.X:return this.x;case L.Y:return this.y;case L.Z:return this.z}throw new C("Invalid ordinate index: "+n)},L.prototype.equals3D=function(n){return this.x===n.x&&this.y===n.y&&(this.z===n.z||S.isNaN(this.z))&&S.isNaN(n.z)},L.prototype.equals=function(n){return n instanceof L&&this.equals2D(n)},L.prototype.equalInZ=function(n,i){return v.equalsWithTolerance(this.z,n.z,i)},L.prototype.compareTo=function(n){var i=n;return this.x<i.x?-1:this.x>i.x?1:this.y<i.y?-1:this.y>i.y?1:0},L.prototype.clone=function(){},L.prototype.copy=function(){return new L(this)},L.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+")"},L.prototype.distance3D=function(n){var i=this.x-n.x,s=this.y-n.y,u=this.z-n.z;return Math.sqrt(i*i+s*s+u*u)},L.prototype.distance=function(n){var i=this.x-n.x,s=this.y-n.y;return Math.sqrt(i*i+s*s)},L.prototype.hashCode=function(){var n=17;return n=37*n+L.hashCode(this.x),n=37*n+L.hashCode(this.y)},L.prototype.setCoordinate=function(n){this.x=n.x,this.y=n.y,this.z=n.z},L.prototype.interfaces_=function(){return[F,G,t]},L.prototype.getClass=function(){return L},L.hashCode=function(){if(arguments.length===1){var n=arguments[0],i=S.doubleToLongBits(n);return Math.trunc((i^i)>>>32)}},D.DimensionalComparator.get=function(){return q},D.serialVersionUID.get=function(){return 6683108902428367e3},D.NULL_ORDINATE.get=function(){return S.NaN},D.X.get=function(){return 0},D.Y.get=function(){return 1},D.Z.get=function(){return 2},Object.defineProperties(L,D);var q=function(n){if(this._dimensionsToTest=2,arguments.length!==0){if(arguments.length===1){var i=arguments[0];if(i!==2&&i!==3)throw new C("only 2 or 3 dimensions may be specified");this._dimensionsToTest=i}}};q.prototype.compare=function(n,i){var s=n,u=i,c=q.compare(s.x,u.x);if(c!==0)return c;var m=q.compare(s.y,u.y);return m!==0?m:this._dimensionsToTest<=2?0:q.compare(s.z,u.z)},q.prototype.interfaces_=function(){return[z]},q.prototype.getClass=function(){return q},q.compare=function(n,i){return n<i?-1:n>i?1:S.isNaN(n)?S.isNaN(i)?0:-1:S.isNaN(i)?1:0};var nt=function(){};nt.prototype.create=function(){},nt.prototype.interfaces_=function(){return[]},nt.prototype.getClass=function(){return nt};var k=function(){},xt={INTERIOR:{configurable:!0},BOUNDARY:{configurable:!0},EXTERIOR:{configurable:!0},NONE:{configurable:!0}};k.prototype.interfaces_=function(){return[]},k.prototype.getClass=function(){return k},k.toLocationSymbol=function(n){switch(n){case k.EXTERIOR:return"e";case k.BOUNDARY:return"b";case k.INTERIOR:return"i";case k.NONE:return"-"}throw new C("Unknown location value: "+n)},xt.INTERIOR.get=function(){return 0},xt.BOUNDARY.get=function(){return 1},xt.EXTERIOR.get=function(){return 2},xt.NONE.get=function(){return-1},Object.defineProperties(k,xt);var X=function(n,i){return n.interfaces_&&n.interfaces_().indexOf(i)>-1},it=function(){},vt={LOG_10:{configurable:!0}};it.prototype.interfaces_=function(){return[]},it.prototype.getClass=function(){return it},it.log10=function(n){var i=Math.log(n);return S.isInfinite(i)||S.isNaN(i)?i:i/it.LOG_10},it.min=function(n,i,s,u){var c=n;return i<c&&(c=i),s<c&&(c=s),u<c&&(c=u),c},it.clamp=function(){if(typeof arguments[2]=="number"&&typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var n=arguments[0],i=arguments[1],s=arguments[2];return n<i?i:n>s?s:n}if(Number.isInteger(arguments[2])&&Number.isInteger(arguments[0])&&Number.isInteger(arguments[1])){var u=arguments[0],c=arguments[1],m=arguments[2];return u<c?c:u>m?m:u}},it.wrap=function(n,i){return n<0?i- -n%i:n%i},it.max=function(){if(arguments.length===3){var n=arguments[0],i=arguments[1],s=arguments[2],u=n;return i>u&&(u=i),s>u&&(u=s),u}if(arguments.length===4){var c=arguments[0],m=arguments[1],E=arguments[2],T=arguments[3],U=c;return m>U&&(U=m),E>U&&(U=E),T>U&&(U=T),U}},it.average=function(n,i){return(n+i)/2},vt.LOG_10.get=function(){return Math.log(10)},Object.defineProperties(it,vt);var pt=function(n){this.str=n};pt.prototype.append=function(n){this.str+=n},pt.prototype.setCharAt=function(n,i){this.str=this.str.substr(0,n)+i+this.str.substr(n+1)},pt.prototype.toString=function(n){return this.str};var et=function(n){this.value=n};et.prototype.intValue=function(){return this.value},et.prototype.compareTo=function(n){return this.value<n?-1:this.value>n?1:0},et.isNaN=function(n){return Number.isNaN(n)};var ot=function(){};ot.isWhitespace=function(n){return n<=32&&n>=0||n===127},ot.toUpperCase=function(n){return n.toUpperCase()};var V=function n(){if(this._hi=0,this._lo=0,arguments.length===0)this.init(0);else if(arguments.length===1){if(typeof arguments[0]=="number"){var i=arguments[0];this.init(i)}else if(arguments[0]instanceof n){var s=arguments[0];this.init(s)}else if(typeof arguments[0]=="string"){var u=arguments[0];n.call(this,n.parse(u))}}else if(arguments.length===2){var c=arguments[0],m=arguments[1];this.init(c,m)}},K={PI:{configurable:!0},TWO_PI:{configurable:!0},PI_2:{configurable:!0},E:{configurable:!0},NaN:{configurable:!0},EPS:{configurable:!0},SPLIT:{configurable:!0},MAX_PRINT_DIGITS:{configurable:!0},TEN:{configurable:!0},ONE:{configurable:!0},SCI_NOT_EXPONENT_CHAR:{configurable:!0},SCI_NOT_ZERO:{configurable:!0}};V.prototype.le=function(n){return(this._hi<n._hi||this._hi===n._hi)&&this._lo<=n._lo},V.prototype.extractSignificantDigits=function(n,i){var s=this.abs(),u=V.magnitude(s._hi),c=V.TEN.pow(u);(s=s.divide(c)).gt(V.TEN)?(s=s.divide(V.TEN),u+=1):s.lt(V.ONE)&&(s=s.multiply(V.TEN),u-=1);for(var m=u+1,E=new pt,T=V.MAX_PRINT_DIGITS-1,U=0;U<=T;U++){n&&U===m&&E.append(".");var Z=Math.trunc(s._hi);if(Z<0)break;var ut=!1,ht=0;Z>9?(ut=!0,ht="9"):ht="0"+Z,E.append(ht),s=s.subtract(V.valueOf(Z)).multiply(V.TEN),ut&&s.selfAdd(V.TEN);var At=!0,Rt=V.magnitude(s._hi);if(Rt<0&&Math.abs(Rt)>=T-U&&(At=!1),!At)break}return i[0]=u,E.toString()},V.prototype.sqr=function(){return this.multiply(this)},V.prototype.doubleValue=function(){return this._hi+this._lo},V.prototype.subtract=function(){if(arguments[0]instanceof V){var n=arguments[0];return this.add(n.negate())}if(typeof arguments[0]=="number"){var i=arguments[0];return this.add(-i)}},V.prototype.equals=function(){if(arguments.length===1){var n=arguments[0];return this._hi===n._hi&&this._lo===n._lo}},V.prototype.isZero=function(){return this._hi===0&&this._lo===0},V.prototype.selfSubtract=function(){if(arguments[0]instanceof V){var n=arguments[0];return this.isNaN()?this:this.selfAdd(-n._hi,-n._lo)}if(typeof arguments[0]=="number"){var i=arguments[0];return this.isNaN()?this:this.selfAdd(-i,0)}},V.prototype.getSpecialNumberString=function(){return this.isZero()?"0.0":this.isNaN()?"NaN ":null},V.prototype.min=function(n){return this.le(n)?this:n},V.prototype.selfDivide=function(){if(arguments.length===1){if(arguments[0]instanceof V){var n=arguments[0];return this.selfDivide(n._hi,n._lo)}if(typeof arguments[0]=="number"){var i=arguments[0];return this.selfDivide(i,0)}}else if(arguments.length===2){var s=arguments[0],u=arguments[1],c=null,m=null,E=null,T=null,U=null,Z=null,ut=null,ht=null;return U=this._hi/s,Z=V.SPLIT*U,c=Z-U,ht=V.SPLIT*s,c=Z-c,m=U-c,E=ht-s,ut=U*s,E=ht-E,T=s-E,ht=c*E-ut+c*T+m*E+m*T,Z=(this._hi-ut-ht+this._lo-U*u)/s,ht=U+Z,this._hi=ht,this._lo=U-ht+Z,this}},V.prototype.dump=function(){return"DD<"+this._hi+", "+this._lo+">"},V.prototype.divide=function(){if(arguments[0]instanceof V){var n=arguments[0],i=null,s=null,u=null,c=null,m=null,E=null,T=null,U=null;return s=(m=this._hi/n._hi)-(i=(E=V.SPLIT*m)-(i=E-m)),U=i*(u=(U=V.SPLIT*n._hi)-(u=U-n._hi))-(T=m*n._hi)+i*(c=n._hi-u)+s*u+s*c,E=(this._hi-T-U+this._lo-m*n._lo)/n._hi,new V(U=m+E,m-U+E)}if(typeof arguments[0]=="number"){var Z=arguments[0];return S.isNaN(Z)?V.createNaN():V.copy(this).selfDivide(Z,0)}},V.prototype.ge=function(n){return(this._hi>n._hi||this._hi===n._hi)&&this._lo>=n._lo},V.prototype.pow=function(n){if(n===0)return V.valueOf(1);var i=new V(this),s=V.valueOf(1),u=Math.abs(n);if(u>1)for(;u>0;)u%2==1&&s.selfMultiply(i),(u/=2)>0&&(i=i.sqr());else s=i;return n<0?s.reciprocal():s},V.prototype.ceil=function(){if(this.isNaN())return V.NaN;var n=Math.ceil(this._hi),i=0;return n===this._hi&&(i=Math.ceil(this._lo)),new V(n,i)},V.prototype.compareTo=function(n){var i=n;return this._hi<i._hi?-1:this._hi>i._hi?1:this._lo<i._lo?-1:this._lo>i._lo?1:0},V.prototype.rint=function(){return this.isNaN()?this:this.add(.5).floor()},V.prototype.setValue=function(){if(arguments[0]instanceof V){var n=arguments[0];return this.init(n),this}if(typeof arguments[0]=="number"){var i=arguments[0];return this.init(i),this}},V.prototype.max=function(n){return this.ge(n)?this:n},V.prototype.sqrt=function(){if(this.isZero())return V.valueOf(0);if(this.isNegative())return V.NaN;var n=1/Math.sqrt(this._hi),i=this._hi*n,s=V.valueOf(i),u=this.subtract(s.sqr())._hi*(.5*n);return s.add(u)},V.prototype.selfAdd=function(){if(arguments.length===1){if(arguments[0]instanceof V){var n=arguments[0];return this.selfAdd(n._hi,n._lo)}if(typeof arguments[0]=="number"){var i=arguments[0],s=null,u=null,c=null,m=null,E=null,T=null;return c=this._hi+i,E=c-this._hi,m=c-E,m=i-E+(this._hi-m),T=m+this._lo,s=c+T,u=T+(c-s),this._hi=s+u,this._lo=u+(s-this._hi),this}}else if(arguments.length===2){var U=arguments[0],Z=arguments[1],ut=null,ht=null,At=null,Rt=null,kt=null,ee=null,on=null;Rt=this._hi+U,ht=this._lo+Z,kt=Rt-(ee=Rt-this._hi),At=ht-(on=ht-this._lo);var In=(ut=Rt+(ee=(kt=U-ee+(this._hi-kt))+ht))+(ee=(At=Z-on+(this._lo-At))+(ee+(Rt-ut))),pr=ee+(ut-In);return this._hi=In,this._lo=pr,this}},V.prototype.selfMultiply=function(){if(arguments.length===1){if(arguments[0]instanceof V){var n=arguments[0];return this.selfMultiply(n._hi,n._lo)}if(typeof arguments[0]=="number"){var i=arguments[0];return this.selfMultiply(i,0)}}else if(arguments.length===2){var s=arguments[0],u=arguments[1],c=null,m=null,E=null,T=null,U=null,Z=null;c=(U=V.SPLIT*this._hi)-this._hi,Z=V.SPLIT*s,c=U-c,m=this._hi-c,E=Z-s;var ut=(U=this._hi*s)+(Z=c*(E=Z-E)-U+c*(T=s-E)+m*E+m*T+(this._hi*u+this._lo*s)),ht=Z+(c=U-ut);return this._hi=ut,this._lo=ht,this}},V.prototype.selfSqr=function(){return this.selfMultiply(this)},V.prototype.floor=function(){if(this.isNaN())return V.NaN;var n=Math.floor(this._hi),i=0;return n===this._hi&&(i=Math.floor(this._lo)),new V(n,i)},V.prototype.negate=function(){return this.isNaN()?this:new V(-this._hi,-this._lo)},V.prototype.clone=function(){},V.prototype.multiply=function(){if(arguments[0]instanceof V){var n=arguments[0];return n.isNaN()?V.createNaN():V.copy(this).selfMultiply(n)}if(typeof arguments[0]=="number"){var i=arguments[0];return S.isNaN(i)?V.createNaN():V.copy(this).selfMultiply(i,0)}},V.prototype.isNaN=function(){return S.isNaN(this._hi)},V.prototype.intValue=function(){return Math.trunc(this._hi)},V.prototype.toString=function(){var n=V.magnitude(this._hi);return n>=-3&&n<=20?this.toStandardNotation():this.toSciNotation()},V.prototype.toStandardNotation=function(){var n=this.getSpecialNumberString();if(n!==null)return n;var i=new Array(1).fill(null),s=this.extractSignificantDigits(!0,i),u=i[0]+1,c=s;if(s.charAt(0)===".")c="0"+s;else if(u<0)c="0."+V.stringOfChar("0",-u)+s;else if(s.indexOf(".")===-1){var m=u-s.length;c=s+V.stringOfChar("0",m)+".0"}return this.isNegative()?"-"+c:c},V.prototype.reciprocal=function(){var n=null,i=null,s=null,u=null,c=null,m=null,E=null,T=null;i=(c=1/this._hi)-(n=(m=V.SPLIT*c)-(n=m-c)),s=(T=V.SPLIT*this._hi)-this._hi;var U=c+(m=(1-(E=c*this._hi)-(T=n*(s=T-s)-E+n*(u=this._hi-s)+i*s+i*u)-c*this._lo)/this._hi);return new V(U,c-U+m)},V.prototype.toSciNotation=function(){if(this.isZero())return V.SCI_NOT_ZERO;var n=this.getSpecialNumberString();if(n!==null)return n;var i=new Array(1).fill(null),s=this.extractSignificantDigits(!1,i),u=V.SCI_NOT_EXPONENT_CHAR+i[0];if(s.charAt(0)==="0")throw new Error("Found leading zero: "+s);var c="";s.length>1&&(c=s.substring(1));var m=s.charAt(0)+"."+c;return this.isNegative()?"-"+m+u:m+u},V.prototype.abs=function(){return this.isNaN()?V.NaN:this.isNegative()?this.negate():new V(this)},V.prototype.isPositive=function(){return(this._hi>0||this._hi===0)&&this._lo>0},V.prototype.lt=function(n){return(this._hi<n._hi||this._hi===n._hi)&&this._lo<n._lo},V.prototype.add=function(){if(arguments[0]instanceof V){var n=arguments[0];return V.copy(this).selfAdd(n)}if(typeof arguments[0]=="number"){var i=arguments[0];return V.copy(this).selfAdd(i)}},V.prototype.init=function(){if(arguments.length===1){if(typeof arguments[0]=="number"){var n=arguments[0];this._hi=n,this._lo=0}else if(arguments[0]instanceof V){var i=arguments[0];this._hi=i._hi,this._lo=i._lo}}else if(arguments.length===2){var s=arguments[0],u=arguments[1];this._hi=s,this._lo=u}},V.prototype.gt=function(n){return(this._hi>n._hi||this._hi===n._hi)&&this._lo>n._lo},V.prototype.isNegative=function(){return(this._hi<0||this._hi===0)&&this._lo<0},V.prototype.trunc=function(){return this.isNaN()?V.NaN:this.isPositive()?this.floor():this.ceil()},V.prototype.signum=function(){return this._hi>0?1:this._hi<0?-1:this._lo>0?1:this._lo<0?-1:0},V.prototype.interfaces_=function(){return[t,F,G]},V.prototype.getClass=function(){return V},V.sqr=function(n){return V.valueOf(n).selfMultiply(n)},V.valueOf=function(){if(typeof arguments[0]=="string"){var n=arguments[0];return V.parse(n)}if(typeof arguments[0]=="number"){var i=arguments[0];return new V(i)}},V.sqrt=function(n){return V.valueOf(n).sqrt()},V.parse=function(n){for(var i=0,s=n.length;ot.isWhitespace(n.charAt(i));)i++;var u=!1;if(i<s){var c=n.charAt(i);c!=="-"&&c!=="+"||(i++,c==="-"&&(u=!0))}for(var m=new V,E=0,T=0,U=0;!(i>=s);){var Z=n.charAt(i);if(i++,ot.isDigit(Z)){var ut=Z-"0";m.selfMultiply(V.TEN),m.selfAdd(ut),E++}else{if(Z!=="."){if(Z==="e"||Z==="E"){var ht=n.substring(i);try{U=et.parseInt(ht)}catch(on){throw on instanceof Error?new Error("Invalid exponent "+ht+" in string "+n):on}break}throw new Error("Unexpected character \'"+Z+"\' at position "+i+" in string "+n)}T=E}}var At=m,Rt=E-T-U;if(Rt===0)At=m;else if(Rt>0){var kt=V.TEN.pow(Rt);At=m.divide(kt)}else if(Rt<0){var ee=V.TEN.pow(-Rt);At=m.multiply(ee)}return u?At.negate():At},V.createNaN=function(){return new V(S.NaN,S.NaN)},V.copy=function(n){return new V(n)},V.magnitude=function(n){var i=Math.abs(n),s=Math.log(i)/Math.log(10),u=Math.trunc(Math.floor(s));return 10*Math.pow(10,u)<=i&&(u+=1),u},V.stringOfChar=function(n,i){for(var s=new pt,u=0;u<i;u++)s.append(n);return s.toString()},K.PI.get=function(){return new V(3.141592653589793,12246467991473532e-32)},K.TWO_PI.get=function(){return new V(6.283185307179586,24492935982947064e-32)},K.PI_2.get=function(){return new V(1.5707963267948966,6123233995736766e-32)},K.E.get=function(){return new V(2.718281828459045,14456468917292502e-32)},K.NaN.get=function(){return new V(S.NaN,S.NaN)},K.EPS.get=function(){return 123259516440783e-46},K.SPLIT.get=function(){return 134217729},K.MAX_PRINT_DIGITS.get=function(){return 32},K.TEN.get=function(){return V.valueOf(10)},K.ONE.get=function(){return V.valueOf(1)},K.SCI_NOT_EXPONENT_CHAR.get=function(){return"E"},K.SCI_NOT_ZERO.get=function(){return"0.0E0"},Object.defineProperties(V,K);var at=function(){},Tt={DP_SAFE_EPSILON:{configurable:!0}};at.prototype.interfaces_=function(){return[]},at.prototype.getClass=function(){return at},at.orientationIndex=function(n,i,s){var u=at.orientationIndexFilter(n,i,s);if(u<=1)return u;var c=V.valueOf(i.x).selfAdd(-n.x),m=V.valueOf(i.y).selfAdd(-n.y),E=V.valueOf(s.x).selfAdd(-i.x),T=V.valueOf(s.y).selfAdd(-i.y);return c.selfMultiply(T).selfSubtract(m.selfMultiply(E)).signum()},at.signOfDet2x2=function(n,i,s,u){return n.multiply(u).selfSubtract(i.multiply(s)).signum()},at.intersection=function(n,i,s,u){var c=V.valueOf(u.y).selfSubtract(s.y).selfMultiply(V.valueOf(i.x).selfSubtract(n.x)),m=V.valueOf(u.x).selfSubtract(s.x).selfMultiply(V.valueOf(i.y).selfSubtract(n.y)),E=c.subtract(m),T=V.valueOf(u.x).selfSubtract(s.x).selfMultiply(V.valueOf(n.y).selfSubtract(s.y)),U=V.valueOf(u.y).selfSubtract(s.y).selfMultiply(V.valueOf(n.x).selfSubtract(s.x)),Z=T.subtract(U).selfDivide(E).doubleValue(),ut=V.valueOf(n.x).selfAdd(V.valueOf(i.x).selfSubtract(n.x).selfMultiply(Z)).doubleValue(),ht=V.valueOf(i.x).selfSubtract(n.x).selfMultiply(V.valueOf(n.y).selfSubtract(s.y)),At=V.valueOf(i.y).selfSubtract(n.y).selfMultiply(V.valueOf(n.x).selfSubtract(s.x)),Rt=ht.subtract(At).selfDivide(E).doubleValue(),kt=V.valueOf(s.y).selfAdd(V.valueOf(u.y).selfSubtract(s.y).selfMultiply(Rt)).doubleValue();return new L(ut,kt)},at.orientationIndexFilter=function(n,i,s){var u=null,c=(n.x-s.x)*(i.y-s.y),m=(n.y-s.y)*(i.x-s.x),E=c-m;if(c>0){if(m<=0)return at.signum(E);u=c+m}else{if(!(c<0)||m>=0)return at.signum(E);u=-c-m}var T=at.DP_SAFE_EPSILON*u;return E>=T||-E>=T?at.signum(E):2},at.signum=function(n){return n>0?1:n<0?-1:0},Tt.DP_SAFE_EPSILON.get=function(){return 1e-15},Object.defineProperties(at,Tt);var dt=function(){},Ct={X:{configurable:!0},Y:{configurable:!0},Z:{configurable:!0},M:{configurable:!0}};Ct.X.get=function(){return 0},Ct.Y.get=function(){return 1},Ct.Z.get=function(){return 2},Ct.M.get=function(){return 3},dt.prototype.setOrdinate=function(n,i,s){},dt.prototype.size=function(){},dt.prototype.getOrdinate=function(n,i){},dt.prototype.getCoordinate=function(){},dt.prototype.getCoordinateCopy=function(n){},dt.prototype.getDimension=function(){},dt.prototype.getX=function(n){},dt.prototype.clone=function(){},dt.prototype.expandEnvelope=function(n){},dt.prototype.copy=function(){},dt.prototype.getY=function(n){},dt.prototype.toCoordinateArray=function(){},dt.prototype.interfaces_=function(){return[G]},dt.prototype.getClass=function(){return dt},Object.defineProperties(dt,Ct);var Yt=function(){},Wt=function(n){function i(){n.call(this,"Projective point not representable on the Cartesian plane.")}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(Yt),Nt=function(){};Nt.arraycopy=function(n,i,s,u,c){for(var m=0,E=i;E<i+c;E++)s[u+m]=n[E],m++},Nt.getProperty=function(n){return{"line.separator":`\n`}[n]};var ne=function n(){if(this.x=null,this.y=null,this.w=null,arguments.length===0)this.x=0,this.y=0,this.w=1;else if(arguments.length===1){var i=arguments[0];this.x=i.x,this.y=i.y,this.w=1}else if(arguments.length===2){if(typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var s=arguments[0],u=arguments[1];this.x=s,this.y=u,this.w=1}else if(arguments[0]instanceof n&&arguments[1]instanceof n){var c=arguments[0],m=arguments[1];this.x=c.y*m.w-m.y*c.w,this.y=m.x*c.w-c.x*m.w,this.w=c.x*m.y-m.x*c.y}else if(arguments[0]instanceof L&&arguments[1]instanceof L){var E=arguments[0],T=arguments[1];this.x=E.y-T.y,this.y=T.x-E.x,this.w=E.x*T.y-T.x*E.y}}else if(arguments.length===3){var U=arguments[0],Z=arguments[1],ut=arguments[2];this.x=U,this.y=Z,this.w=ut}else if(arguments.length===4){var ht=arguments[0],At=arguments[1],Rt=arguments[2],kt=arguments[3],ee=ht.y-At.y,on=At.x-ht.x,In=ht.x*At.y-At.x*ht.y,pr=Rt.y-kt.y,Xi=kt.x-Rt.x,Lo=Rt.x*kt.y-kt.x*Rt.y;this.x=on*Lo-Xi*In,this.y=pr*In-ee*Lo,this.w=ee*Xi-pr*on}};ne.prototype.getY=function(){var n=this.y/this.w;if(S.isNaN(n)||S.isInfinite(n))throw new Wt;return n},ne.prototype.getX=function(){var n=this.x/this.w;if(S.isNaN(n)||S.isInfinite(n))throw new Wt;return n},ne.prototype.getCoordinate=function(){var n=new L;return n.x=this.getX(),n.y=this.getY(),n},ne.prototype.interfaces_=function(){return[]},ne.prototype.getClass=function(){return ne},ne.intersection=function(n,i,s,u){var c=n.y-i.y,m=i.x-n.x,E=n.x*i.y-i.x*n.y,T=s.y-u.y,U=u.x-s.x,Z=s.x*u.y-u.x*s.y,ut=c*U-T*m,ht=(m*Z-U*E)/ut,At=(T*E-c*Z)/ut;if(S.isNaN(ht)||S.isInfinite(ht)||S.isNaN(At)||S.isInfinite(At))throw new Wt;return new L(ht,At)};var Pt=function n(){if(this._minx=null,this._maxx=null,this._miny=null,this._maxy=null,arguments.length===0)this.init();else if(arguments.length===1){if(arguments[0]instanceof L){var i=arguments[0];this.init(i.x,i.x,i.y,i.y)}else if(arguments[0]instanceof n){var s=arguments[0];this.init(s)}}else if(arguments.length===2){var u=arguments[0],c=arguments[1];this.init(u.x,c.x,u.y,c.y)}else if(arguments.length===4){var m=arguments[0],E=arguments[1],T=arguments[2],U=arguments[3];this.init(m,E,T,U)}},Xt={serialVersionUID:{configurable:!0}};Pt.prototype.getArea=function(){return this.getWidth()*this.getHeight()},Pt.prototype.equals=function(n){if(!(n instanceof Pt))return!1;var i=n;return this.isNull()?i.isNull():this._maxx===i.getMaxX()&&this._maxy===i.getMaxY()&&this._minx===i.getMinX()&&this._miny===i.getMinY()},Pt.prototype.intersection=function(n){if(this.isNull()||n.isNull()||!this.intersects(n))return new Pt;var i=this._minx>n._minx?this._minx:n._minx,s=this._miny>n._miny?this._miny:n._miny,u=this._maxx<n._maxx?this._maxx:n._maxx,c=this._maxy<n._maxy?this._maxy:n._maxy;return new Pt(i,u,s,c)},Pt.prototype.isNull=function(){return this._maxx<this._minx},Pt.prototype.getMaxX=function(){return this._maxx},Pt.prototype.covers=function(){if(arguments.length===1){if(arguments[0]instanceof L){var n=arguments[0];return this.covers(n.x,n.y)}if(arguments[0]instanceof Pt){var i=arguments[0];return!this.isNull()&&!i.isNull()&&i.getMinX()>=this._minx&&i.getMaxX()<=this._maxx&&i.getMinY()>=this._miny&&i.getMaxY()<=this._maxy}}else if(arguments.length===2){var s=arguments[0],u=arguments[1];return!this.isNull()&&s>=this._minx&&s<=this._maxx&&u>=this._miny&&u<=this._maxy}},Pt.prototype.intersects=function(){if(arguments.length===1){if(arguments[0]instanceof Pt){var n=arguments[0];return!this.isNull()&&!n.isNull()&&!(n._minx>this._maxx||n._maxx<this._minx||n._miny>this._maxy||n._maxy<this._miny)}if(arguments[0]instanceof L){var i=arguments[0];return this.intersects(i.x,i.y)}}else if(arguments.length===2){var s=arguments[0],u=arguments[1];return!this.isNull()&&!(s>this._maxx||s<this._minx||u>this._maxy||u<this._miny)}},Pt.prototype.getMinY=function(){return this._miny},Pt.prototype.getMinX=function(){return this._minx},Pt.prototype.expandToInclude=function(){if(arguments.length===1){if(arguments[0]instanceof L){var n=arguments[0];this.expandToInclude(n.x,n.y)}else if(arguments[0]instanceof Pt){var i=arguments[0];if(i.isNull())return null;this.isNull()?(this._minx=i.getMinX(),this._maxx=i.getMaxX(),this._miny=i.getMinY(),this._maxy=i.getMaxY()):(i._minx<this._minx&&(this._minx=i._minx),i._maxx>this._maxx&&(this._maxx=i._maxx),i._miny<this._miny&&(this._miny=i._miny),i._maxy>this._maxy&&(this._maxy=i._maxy))}}else if(arguments.length===2){var s=arguments[0],u=arguments[1];this.isNull()?(this._minx=s,this._maxx=s,this._miny=u,this._maxy=u):(s<this._minx&&(this._minx=s),s>this._maxx&&(this._maxx=s),u<this._miny&&(this._miny=u),u>this._maxy&&(this._maxy=u))}},Pt.prototype.minExtent=function(){if(this.isNull())return 0;var n=this.getWidth(),i=this.getHeight();return n<i?n:i},Pt.prototype.getWidth=function(){return this.isNull()?0:this._maxx-this._minx},Pt.prototype.compareTo=function(n){var i=n;return this.isNull()?i.isNull()?0:-1:i.isNull()?1:this._minx<i._minx?-1:this._minx>i._minx?1:this._miny<i._miny?-1:this._miny>i._miny?1:this._maxx<i._maxx?-1:this._maxx>i._maxx?1:this._maxy<i._maxy?-1:this._maxy>i._maxy?1:0},Pt.prototype.translate=function(n,i){if(this.isNull())return null;this.init(this.getMinX()+n,this.getMaxX()+n,this.getMinY()+i,this.getMaxY()+i)},Pt.prototype.toString=function(){return"Env["+this._minx+" : "+this._maxx+", "+this._miny+" : "+this._maxy+"]"},Pt.prototype.setToNull=function(){this._minx=0,this._maxx=-1,this._miny=0,this._maxy=-1},Pt.prototype.getHeight=function(){return this.isNull()?0:this._maxy-this._miny},Pt.prototype.maxExtent=function(){if(this.isNull())return 0;var n=this.getWidth(),i=this.getHeight();return n>i?n:i},Pt.prototype.expandBy=function(){if(arguments.length===1){var n=arguments[0];this.expandBy(n,n)}else if(arguments.length===2){var i=arguments[0],s=arguments[1];if(this.isNull())return null;this._minx-=i,this._maxx+=i,this._miny-=s,this._maxy+=s,(this._minx>this._maxx||this._miny>this._maxy)&&this.setToNull()}},Pt.prototype.contains=function(){if(arguments.length===1){if(arguments[0]instanceof Pt){var n=arguments[0];return this.covers(n)}if(arguments[0]instanceof L){var i=arguments[0];return this.covers(i)}}else if(arguments.length===2){var s=arguments[0],u=arguments[1];return this.covers(s,u)}},Pt.prototype.centre=function(){return this.isNull()?null:new L((this.getMinX()+this.getMaxX())/2,(this.getMinY()+this.getMaxY())/2)},Pt.prototype.init=function(){if(arguments.length===0)this.setToNull();else if(arguments.length===1){if(arguments[0]instanceof L){var n=arguments[0];this.init(n.x,n.x,n.y,n.y)}else if(arguments[0]instanceof Pt){var i=arguments[0];this._minx=i._minx,this._maxx=i._maxx,this._miny=i._miny,this._maxy=i._maxy}}else if(arguments.length===2){var s=arguments[0],u=arguments[1];this.init(s.x,u.x,s.y,u.y)}else if(arguments.length===4){var c=arguments[0],m=arguments[1],E=arguments[2],T=arguments[3];c<m?(this._minx=c,this._maxx=m):(this._minx=m,this._maxx=c),E<T?(this._miny=E,this._maxy=T):(this._miny=T,this._maxy=E)}},Pt.prototype.getMaxY=function(){return this._maxy},Pt.prototype.distance=function(n){if(this.intersects(n))return 0;var i=0;this._maxx<n._minx?i=n._minx-this._maxx:this._minx>n._maxx&&(i=this._minx-n._maxx);var s=0;return this._maxy<n._miny?s=n._miny-this._maxy:this._miny>n._maxy&&(s=this._miny-n._maxy),i===0?s:s===0?i:Math.sqrt(i*i+s*s)},Pt.prototype.hashCode=function(){var n=17;return n=37*n+L.hashCode(this._minx),n=37*n+L.hashCode(this._maxx),n=37*n+L.hashCode(this._miny),n=37*n+L.hashCode(this._maxy)},Pt.prototype.interfaces_=function(){return[F,t]},Pt.prototype.getClass=function(){return Pt},Pt.intersects=function(){if(arguments.length===3){var n=arguments[0],i=arguments[1],s=arguments[2];return s.x>=(n.x<i.x?n.x:i.x)&&s.x<=(n.x>i.x?n.x:i.x)&&s.y>=(n.y<i.y?n.y:i.y)&&s.y<=(n.y>i.y?n.y:i.y)}if(arguments.length===4){var u=arguments[0],c=arguments[1],m=arguments[2],E=arguments[3],T=Math.min(m.x,E.x),U=Math.max(m.x,E.x),Z=Math.min(u.x,c.x),ut=Math.max(u.x,c.x);return!(Z>U)&&!(ut<T)&&(T=Math.min(m.y,E.y),U=Math.max(m.y,E.y),Z=Math.min(u.y,c.y),ut=Math.max(u.y,c.y),!(Z>U)&&!(ut<T))}},Xt.serialVersionUID.get=function(){return 5873921885273102e3},Object.defineProperties(Pt,Xt);var tt={typeStr:/^\\s*(\\w+)\\s*\\(\\s*(.*)\\s*\\)\\s*$/,emptyTypeStr:/^\\s*(\\w+)\\s*EMPTY\\s*$/,spaces:/\\s+/,parenComma:/\\)\\s*,\\s*\\(/,doubleParenComma:/\\)\\s*\\)\\s*,\\s*\\(\\s*\\(/,trimParens:/^\\s*\\(?(.*?)\\)?\\s*$/},nn=function(n){this.geometryFactory=n||new le};nn.prototype.read=function(n){var i,s,u;n=n.replace(/[\\n\\r]/g," ");var c=tt.typeStr.exec(n);if(n.search("EMPTY")!==-1&&((c=tt.emptyTypeStr.exec(n))[2]=void 0),c&&(s=c[1].toLowerCase(),u=c[2],te[s]&&(i=te[s].apply(this,[u]))),i===void 0)throw new Error("Could not parse WKT "+n);return i},nn.prototype.write=function(n){return this.extractGeometry(n)},nn.prototype.extractGeometry=function(n){var i=n.getGeometryType().toLowerCase();if(!Gt[i])return null;var s=i.toUpperCase();return n.isEmpty()?s+" EMPTY":s+"("+Gt[i].apply(this,[n])+")"};var Gt={coordinate:function(n){return n.x+" "+n.y},point:function(n){return Gt.coordinate.call(this,n._coordinates._coordinates[0])},multipoint:function(n){for(var i=[],s=0,u=n._geometries.length;s<u;++s)i.push("("+Gt.point.apply(this,[n._geometries[s]])+")");return i.join(",")},linestring:function(n){for(var i=[],s=0,u=n._points._coordinates.length;s<u;++s)i.push(Gt.coordinate.apply(this,[n._points._coordinates[s]]));return i.join(",")},linearring:function(n){for(var i=[],s=0,u=n._points._coordinates.length;s<u;++s)i.push(Gt.coordinate.apply(this,[n._points._coordinates[s]]));return i.join(",")},multilinestring:function(n){for(var i=[],s=0,u=n._geometries.length;s<u;++s)i.push("("+Gt.linestring.apply(this,[n._geometries[s]])+")");return i.join(",")},polygon:function(n){var i=[];i.push("("+Gt.linestring.apply(this,[n._shell])+")");for(var s=0,u=n._holes.length;s<u;++s)i.push("("+Gt.linestring.apply(this,[n._holes[s]])+")");return i.join(",")},multipolygon:function(n){for(var i=[],s=0,u=n._geometries.length;s<u;++s)i.push("("+Gt.polygon.apply(this,[n._geometries[s]])+")");return i.join(",")},geometrycollection:function(n){for(var i=[],s=0,u=n._geometries.length;s<u;++s)i.push(this.extractGeometry(n._geometries[s]));return i.join(",")}},te={point:function(n){if(n===void 0)return this.geometryFactory.createPoint();var i=n.trim().split(tt.spaces);return this.geometryFactory.createPoint(new L(Number.parseFloat(i[0]),Number.parseFloat(i[1])))},multipoint:function(n){if(n===void 0)return this.geometryFactory.createMultiPoint();for(var i,s=n.trim().split(","),u=[],c=0,m=s.length;c<m;++c)i=s[c].replace(tt.trimParens,"$1"),u.push(te.point.apply(this,[i]));return this.geometryFactory.createMultiPoint(u)},linestring:function(n){if(n===void 0)return this.geometryFactory.createLineString();for(var i,s=n.trim().split(","),u=[],c=0,m=s.length;c<m;++c)i=s[c].trim().split(tt.spaces),u.push(new L(Number.parseFloat(i[0]),Number.parseFloat(i[1])));return this.geometryFactory.createLineString(u)},linearring:function(n){if(n===void 0)return this.geometryFactory.createLinearRing();for(var i,s=n.trim().split(","),u=[],c=0,m=s.length;c<m;++c)i=s[c].trim().split(tt.spaces),u.push(new L(Number.parseFloat(i[0]),Number.parseFloat(i[1])));return this.geometryFactory.createLinearRing(u)},multilinestring:function(n){if(n===void 0)return this.geometryFactory.createMultiLineString();for(var i,s=n.trim().split(tt.parenComma),u=[],c=0,m=s.length;c<m;++c)i=s[c].replace(tt.trimParens,"$1"),u.push(te.linestring.apply(this,[i]));return this.geometryFactory.createMultiLineString(u)},polygon:function(n){if(n===void 0)return this.geometryFactory.createPolygon();for(var i,s,u,c,m=n.trim().split(tt.parenComma),E=[],T=0,U=m.length;T<U;++T)i=m[T].replace(tt.trimParens,"$1"),s=te.linestring.apply(this,[i]),u=this.geometryFactory.createLinearRing(s._points),T===0?c=u:E.push(u);return this.geometryFactory.createPolygon(c,E)},multipolygon:function(n){if(n===void 0)return this.geometryFactory.createMultiPolygon();for(var i,s=n.trim().split(tt.doubleParenComma),u=[],c=0,m=s.length;c<m;++c)i=s[c].replace(tt.trimParens,"$1"),u.push(te.polygon.apply(this,[i]));return this.geometryFactory.createMultiPolygon(u)},geometrycollection:function(n){if(n===void 0)return this.geometryFactory.createGeometryCollection();for(var i=(n=n.replace(/,\\s*([A-Za-z])/g,"|$1")).trim().split("|"),s=[],u=0,c=i.length;u<c;++u)s.push(this.read(i[u]));return this.geometryFactory.createGeometryCollection(s)}},qt=function(n){this.parser=new nn(n)};qt.prototype.write=function(n){return this.parser.write(n)},qt.toLineString=function(n,i){if(arguments.length!==2)throw new Error("Not implemented");return"LINESTRING ( "+n.x+" "+n.y+", "+i.x+" "+i.y+" )"};var $=function(n){function i(s){n.call(this,s),this.name="RuntimeException",this.message=s,this.stack=new n().stack}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i}(Error),N=function(n){function i(){if(n.call(this),arguments.length===0)n.call(this);else if(arguments.length===1){var s=arguments[0];n.call(this,s)}}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}($),b=function(){};b.prototype.interfaces_=function(){return[]},b.prototype.getClass=function(){return b},b.shouldNeverReachHere=function(){if(arguments.length===0)b.shouldNeverReachHere(null);else if(arguments.length===1){var n=arguments[0];throw new N("Should never reach here"+(n!==null?": "+n:""))}},b.isTrue=function(){var n,i;if(arguments.length===1)n=arguments[0],b.isTrue(n,null);else if(arguments.length===2&&(n=arguments[0],i=arguments[1],!n))throw i===null?new N:new N(i)},b.equals=function(){var n,i,s;if(arguments.length===2)n=arguments[0],i=arguments[1],b.equals(n,i,null);else if(arguments.length===3&&(n=arguments[0],i=arguments[1],s=arguments[2],!i.equals(n)))throw new N("Expected "+n+" but encountered "+i+(s!==null?": "+s:""))};var R=function(){this._result=null,this._inputLines=Array(2).fill().map(function(){return Array(2)}),this._intPt=new Array(2).fill(null),this._intLineIndex=null,this._isProper=null,this._pa=null,this._pb=null,this._precisionModel=null,this._intPt[0]=new L,this._intPt[1]=new L,this._pa=this._intPt[0],this._pb=this._intPt[1],this._result=0},W={DONT_INTERSECT:{configurable:!0},DO_INTERSECT:{configurable:!0},COLLINEAR:{configurable:!0},NO_INTERSECTION:{configurable:!0},POINT_INTERSECTION:{configurable:!0},COLLINEAR_INTERSECTION:{configurable:!0}};R.prototype.getIndexAlongSegment=function(n,i){return this.computeIntLineIndex(),this._intLineIndex[n][i]},R.prototype.getTopologySummary=function(){var n=new pt;return this.isEndPoint()&&n.append(" endpoint"),this._isProper&&n.append(" proper"),this.isCollinear()&&n.append(" collinear"),n.toString()},R.prototype.computeIntersection=function(n,i,s,u){this._inputLines[0][0]=n,this._inputLines[0][1]=i,this._inputLines[1][0]=s,this._inputLines[1][1]=u,this._result=this.computeIntersect(n,i,s,u)},R.prototype.getIntersectionNum=function(){return this._result},R.prototype.computeIntLineIndex=function(){if(arguments.length===0)this._intLineIndex===null&&(this._intLineIndex=Array(2).fill().map(function(){return Array(2)}),this.computeIntLineIndex(0),this.computeIntLineIndex(1));else if(arguments.length===1){var n=arguments[0];this.getEdgeDistance(n,0)>this.getEdgeDistance(n,1)?(this._intLineIndex[n][0]=0,this._intLineIndex[n][1]=1):(this._intLineIndex[n][0]=1,this._intLineIndex[n][1]=0)}},R.prototype.isProper=function(){return this.hasIntersection()&&this._isProper},R.prototype.setPrecisionModel=function(n){this._precisionModel=n},R.prototype.isInteriorIntersection=function(){if(arguments.length===0)return!!this.isInteriorIntersection(0)||!!this.isInteriorIntersection(1);if(arguments.length===1){for(var n=arguments[0],i=0;i<this._result;i++)if(!this._intPt[i].equals2D(this._inputLines[n][0])&&!this._intPt[i].equals2D(this._inputLines[n][1]))return!0;return!1}},R.prototype.getIntersection=function(n){return this._intPt[n]},R.prototype.isEndPoint=function(){return this.hasIntersection()&&!this._isProper},R.prototype.hasIntersection=function(){return this._result!==R.NO_INTERSECTION},R.prototype.getEdgeDistance=function(n,i){return R.computeEdgeDistance(this._intPt[i],this._inputLines[n][0],this._inputLines[n][1])},R.prototype.isCollinear=function(){return this._result===R.COLLINEAR_INTERSECTION},R.prototype.toString=function(){return qt.toLineString(this._inputLines[0][0],this._inputLines[0][1])+" - "+qt.toLineString(this._inputLines[1][0],this._inputLines[1][1])+this.getTopologySummary()},R.prototype.getEndpoint=function(n,i){return this._inputLines[n][i]},R.prototype.isIntersection=function(n){for(var i=0;i<this._result;i++)if(this._intPt[i].equals2D(n))return!0;return!1},R.prototype.getIntersectionAlongSegment=function(n,i){return this.computeIntLineIndex(),this._intPt[this._intLineIndex[n][i]]},R.prototype.interfaces_=function(){return[]},R.prototype.getClass=function(){return R},R.computeEdgeDistance=function(n,i,s){var u=Math.abs(s.x-i.x),c=Math.abs(s.y-i.y),m=-1;if(n.equals(i))m=0;else if(n.equals(s))m=u>c?u:c;else{var E=Math.abs(n.x-i.x),T=Math.abs(n.y-i.y);(m=u>c?E:T)!==0||n.equals(i)||(m=Math.max(E,T))}return b.isTrue(!(m===0&&!n.equals(i)),"Bad distance calculation"),m},R.nonRobustComputeEdgeDistance=function(n,i,s){var u=n.x-i.x,c=n.y-i.y,m=Math.sqrt(u*u+c*c);return b.isTrue(!(m===0&&!n.equals(i)),"Invalid distance calculation"),m},W.DONT_INTERSECT.get=function(){return 0},W.DO_INTERSECT.get=function(){return 1},W.COLLINEAR.get=function(){return 2},W.NO_INTERSECTION.get=function(){return 0},W.POINT_INTERSECTION.get=function(){return 1},W.COLLINEAR_INTERSECTION.get=function(){return 2},Object.defineProperties(R,W);var J=function(n){function i(){n.apply(this,arguments)}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.isInSegmentEnvelopes=function(s){var u=new Pt(this._inputLines[0][0],this._inputLines[0][1]),c=new Pt(this._inputLines[1][0],this._inputLines[1][1]);return u.contains(s)&&c.contains(s)},i.prototype.computeIntersection=function(){if(arguments.length!==3)return n.prototype.computeIntersection.apply(this,arguments);var s=arguments[0],u=arguments[1],c=arguments[2];if(this._isProper=!1,Pt.intersects(u,c,s)&&B.orientationIndex(u,c,s)===0&&B.orientationIndex(c,u,s)===0)return this._isProper=!0,(s.equals(u)||s.equals(c))&&(this._isProper=!1),this._result=n.POINT_INTERSECTION,null;this._result=n.NO_INTERSECTION},i.prototype.normalizeToMinimum=function(s,u,c,m,E){E.x=this.smallestInAbsValue(s.x,u.x,c.x,m.x),E.y=this.smallestInAbsValue(s.y,u.y,c.y,m.y),s.x-=E.x,s.y-=E.y,u.x-=E.x,u.y-=E.y,c.x-=E.x,c.y-=E.y,m.x-=E.x,m.y-=E.y},i.prototype.safeHCoordinateIntersection=function(s,u,c,m){var E=null;try{E=ne.intersection(s,u,c,m)}catch(T){if(!(T instanceof Wt))throw T;E=i.nearestEndpoint(s,u,c,m)}return E},i.prototype.intersection=function(s,u,c,m){var E=this.intersectionWithNormalization(s,u,c,m);return this.isInSegmentEnvelopes(E)||(E=new L(i.nearestEndpoint(s,u,c,m))),this._precisionModel!==null&&this._precisionModel.makePrecise(E),E},i.prototype.smallestInAbsValue=function(s,u,c,m){var E=s,T=Math.abs(E);return Math.abs(u)<T&&(E=u,T=Math.abs(u)),Math.abs(c)<T&&(E=c,T=Math.abs(c)),Math.abs(m)<T&&(E=m),E},i.prototype.checkDD=function(s,u,c,m,E){var T=at.intersection(s,u,c,m),U=this.isInSegmentEnvelopes(T);Nt.out.println("DD in env = "+U+" --------------------- "+T),E.distance(T)>1e-4&&Nt.out.println("Distance = "+E.distance(T))},i.prototype.intersectionWithNormalization=function(s,u,c,m){var E=new L(s),T=new L(u),U=new L(c),Z=new L(m),ut=new L;this.normalizeToEnvCentre(E,T,U,Z,ut);var ht=this.safeHCoordinateIntersection(E,T,U,Z);return ht.x+=ut.x,ht.y+=ut.y,ht},i.prototype.computeCollinearIntersection=function(s,u,c,m){var E=Pt.intersects(s,u,c),T=Pt.intersects(s,u,m),U=Pt.intersects(c,m,s),Z=Pt.intersects(c,m,u);return E&&T?(this._intPt[0]=c,this._intPt[1]=m,n.COLLINEAR_INTERSECTION):U&&Z?(this._intPt[0]=s,this._intPt[1]=u,n.COLLINEAR_INTERSECTION):E&&U?(this._intPt[0]=c,this._intPt[1]=s,!c.equals(s)||T||Z?n.COLLINEAR_INTERSECTION:n.POINT_INTERSECTION):E&&Z?(this._intPt[0]=c,this._intPt[1]=u,!c.equals(u)||T||U?n.COLLINEAR_INTERSECTION:n.POINT_INTERSECTION):T&&U?(this._intPt[0]=m,this._intPt[1]=s,!m.equals(s)||E||Z?n.COLLINEAR_INTERSECTION:n.POINT_INTERSECTION):T&&Z?(this._intPt[0]=m,this._intPt[1]=u,!m.equals(u)||E||U?n.COLLINEAR_INTERSECTION:n.POINT_INTERSECTION):n.NO_INTERSECTION},i.prototype.normalizeToEnvCentre=function(s,u,c,m,E){var T=s.x<u.x?s.x:u.x,U=s.y<u.y?s.y:u.y,Z=s.x>u.x?s.x:u.x,ut=s.y>u.y?s.y:u.y,ht=c.x<m.x?c.x:m.x,At=c.y<m.y?c.y:m.y,Rt=c.x>m.x?c.x:m.x,kt=c.y>m.y?c.y:m.y,ee=((T>ht?T:ht)+(Z<Rt?Z:Rt))/2,on=((U>At?U:At)+(ut<kt?ut:kt))/2;E.x=ee,E.y=on,s.x-=E.x,s.y-=E.y,u.x-=E.x,u.y-=E.y,c.x-=E.x,c.y-=E.y,m.x-=E.x,m.y-=E.y},i.prototype.computeIntersect=function(s,u,c,m){if(this._isProper=!1,!Pt.intersects(s,u,c,m))return n.NO_INTERSECTION;var E=B.orientationIndex(s,u,c),T=B.orientationIndex(s,u,m);if(E>0&&T>0||E<0&&T<0)return n.NO_INTERSECTION;var U=B.orientationIndex(c,m,s),Z=B.orientationIndex(c,m,u);return U>0&&Z>0||U<0&&Z<0?n.NO_INTERSECTION:E===0&&T===0&&U===0&&Z===0?this.computeCollinearIntersection(s,u,c,m):(E===0||T===0||U===0||Z===0?(this._isProper=!1,s.equals2D(c)||s.equals2D(m)?this._intPt[0]=s:u.equals2D(c)||u.equals2D(m)?this._intPt[0]=u:E===0?this._intPt[0]=new L(c):T===0?this._intPt[0]=new L(m):U===0?this._intPt[0]=new L(s):Z===0&&(this._intPt[0]=new L(u))):(this._isProper=!0,this._intPt[0]=this.intersection(s,u,c,m)),n.POINT_INTERSECTION)},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i.nearestEndpoint=function(s,u,c,m){var E=s,T=B.distancePointLine(s,c,m),U=B.distancePointLine(u,c,m);return U<T&&(T=U,E=u),(U=B.distancePointLine(c,s,u))<T&&(T=U,E=c),(U=B.distancePointLine(m,s,u))<T&&(T=U,E=m),E},i}(R),I=function(){};I.prototype.interfaces_=function(){return[]},I.prototype.getClass=function(){return I},I.orientationIndex=function(n,i,s){var u=i.x-n.x,c=i.y-n.y,m=s.x-i.x,E=s.y-i.y;return I.signOfDet2x2(u,c,m,E)},I.signOfDet2x2=function(n,i,s,u){var c=null,m=null,E=null;if(c=1,n===0||u===0)return i===0||s===0?0:i>0?s>0?-c:c:s>0?c:-c;if(i===0||s===0)return u>0?n>0?c:-c:n>0?-c:c;if(i>0?u>0?i<=u||(c=-c,m=n,n=s,s=m,m=i,i=u,u=m):i<=-u?(c=-c,s=-s,u=-u):(m=n,n=-s,s=m,m=i,i=-u,u=m):u>0?-i<=u?(c=-c,n=-n,i=-i):(m=-n,n=s,s=m,m=-i,i=u,u=m):i>=u?(n=-n,i=-i,s=-s,u=-u):(c=-c,m=-n,n=-s,s=m,m=-i,i=-u,u=m),n>0){if(!(s>0)||!(n<=s))return c}else{if(s>0||!(n>=s))return-c;c=-c,n=-n,s=-s}for(;;){if(E=Math.floor(s/n),s-=E*n,(u-=E*i)<0)return-c;if(u>i)return c;if(n>s+s){if(i<u+u)return c}else{if(i>u+u)return-c;s=n-s,u=i-u,c=-c}if(u===0)return s===0?0:-c;if(s===0||(E=Math.floor(n/s),n-=E*s,(i-=E*u)<0))return c;if(i>u)return-c;if(s>n+n){if(u<i+i)return-c}else{if(u>i+i)return c;n=s-n,i=u-i,c=-c}if(i===0)return n===0?0:c;if(n===0)return-c}};var P=function(){this._p=null,this._crossingCount=0,this._isPointOnSegment=!1;var n=arguments[0];this._p=n};P.prototype.countSegment=function(n,i){if(n.x<this._p.x&&i.x<this._p.x)return null;if(this._p.x===i.x&&this._p.y===i.y)return this._isPointOnSegment=!0,null;if(n.y===this._p.y&&i.y===this._p.y){var s=n.x,u=i.x;return s>u&&(s=i.x,u=n.x),this._p.x>=s&&this._p.x<=u&&(this._isPointOnSegment=!0),null}if(n.y>this._p.y&&i.y<=this._p.y||i.y>this._p.y&&n.y<=this._p.y){var c=n.x-this._p.x,m=n.y-this._p.y,E=i.x-this._p.x,T=i.y-this._p.y,U=I.signOfDet2x2(c,m,E,T);if(U===0)return this._isPointOnSegment=!0,null;T<m&&(U=-U),U>0&&this._crossingCount++}},P.prototype.isPointInPolygon=function(){return this.getLocation()!==k.EXTERIOR},P.prototype.getLocation=function(){return this._isPointOnSegment?k.BOUNDARY:this._crossingCount%2==1?k.INTERIOR:k.EXTERIOR},P.prototype.isOnSegment=function(){return this._isPointOnSegment},P.prototype.interfaces_=function(){return[]},P.prototype.getClass=function(){return P},P.locatePointInRing=function(){if(arguments[0]instanceof L&&X(arguments[1],dt)){for(var n=arguments[0],i=arguments[1],s=new P(n),u=new L,c=new L,m=1;m<i.size();m++)if(i.getCoordinate(m,u),i.getCoordinate(m-1,c),s.countSegment(u,c),s.isOnSegment())return s.getLocation();return s.getLocation()}if(arguments[0]instanceof L&&arguments[1]instanceof Array){for(var E=arguments[0],T=arguments[1],U=new P(E),Z=1;Z<T.length;Z++){var ut=T[Z],ht=T[Z-1];if(U.countSegment(ut,ht),U.isOnSegment())return U.getLocation()}return U.getLocation()}};var B=function(){},lt={CLOCKWISE:{configurable:!0},RIGHT:{configurable:!0},COUNTERCLOCKWISE:{configurable:!0},LEFT:{configurable:!0},COLLINEAR:{configurable:!0},STRAIGHT:{configurable:!0}};B.prototype.interfaces_=function(){return[]},B.prototype.getClass=function(){return B},B.orientationIndex=function(n,i,s){return at.orientationIndex(n,i,s)},B.signedArea=function(){if(arguments[0]instanceof Array){var n=arguments[0];if(n.length<3)return 0;for(var i=0,s=n[0].x,u=1;u<n.length-1;u++){var c=n[u].x-s,m=n[u+1].y;i+=c*(n[u-1].y-m)}return i/2}if(X(arguments[0],dt)){var E=arguments[0],T=E.size();if(T<3)return 0;var U=new L,Z=new L,ut=new L;E.getCoordinate(0,Z),E.getCoordinate(1,ut);var ht=Z.x;ut.x-=ht;for(var At=0,Rt=1;Rt<T-1;Rt++)U.y=Z.y,Z.x=ut.x,Z.y=ut.y,E.getCoordinate(Rt+1,ut),ut.x-=ht,At+=Z.x*(U.y-ut.y);return At/2}},B.distanceLineLine=function(n,i,s,u){if(n.equals(i))return B.distancePointLine(n,s,u);if(s.equals(u))return B.distancePointLine(u,n,i);var c=!1;if(Pt.intersects(n,i,s,u)){var m=(i.x-n.x)*(u.y-s.y)-(i.y-n.y)*(u.x-s.x);if(m===0)c=!0;else{var E=(n.y-s.y)*(u.x-s.x)-(n.x-s.x)*(u.y-s.y),T=((n.y-s.y)*(i.x-n.x)-(n.x-s.x)*(i.y-n.y))/m,U=E/m;(U<0||U>1||T<0||T>1)&&(c=!0)}}else c=!0;return c?it.min(B.distancePointLine(n,s,u),B.distancePointLine(i,s,u),B.distancePointLine(s,n,i),B.distancePointLine(u,n,i)):0},B.isPointInRing=function(n,i){return B.locatePointInRing(n,i)!==k.EXTERIOR},B.computeLength=function(n){var i=n.size();if(i<=1)return 0;var s=0,u=new L;n.getCoordinate(0,u);for(var c=u.x,m=u.y,E=1;E<i;E++){n.getCoordinate(E,u);var T=u.x,U=u.y,Z=T-c,ut=U-m;s+=Math.sqrt(Z*Z+ut*ut),c=T,m=U}return s},B.isCCW=function(n){var i=n.length-1;if(i<3)throw new C("Ring has fewer than 4 points, so orientation cannot be determined");for(var s=n[0],u=0,c=1;c<=i;c++){var m=n[c];m.y>s.y&&(s=m,u=c)}var E=u;do(E-=1)<0&&(E=i);while(n[E].equals2D(s)&&E!==u);var T=u;do T=(T+1)%i;while(n[T].equals2D(s)&&T!==u);var U=n[E],Z=n[T];if(U.equals2D(s)||Z.equals2D(s)||U.equals2D(Z))return!1;var ut=B.computeOrientation(U,s,Z),ht=!1;return ht=ut===0?U.x>Z.x:ut>0,ht},B.locatePointInRing=function(n,i){return P.locatePointInRing(n,i)},B.distancePointLinePerpendicular=function(n,i,s){var u=(s.x-i.x)*(s.x-i.x)+(s.y-i.y)*(s.y-i.y),c=((i.y-n.y)*(s.x-i.x)-(i.x-n.x)*(s.y-i.y))/u;return Math.abs(c)*Math.sqrt(u)},B.computeOrientation=function(n,i,s){return B.orientationIndex(n,i,s)},B.distancePointLine=function(){if(arguments.length===2){var n=arguments[0],i=arguments[1];if(i.length===0)throw new C("Line array must contain at least one vertex");for(var s=n.distance(i[0]),u=0;u<i.length-1;u++){var c=B.distancePointLine(n,i[u],i[u+1]);c<s&&(s=c)}return s}if(arguments.length===3){var m=arguments[0],E=arguments[1],T=arguments[2];if(E.x===T.x&&E.y===T.y)return m.distance(E);var U=(T.x-E.x)*(T.x-E.x)+(T.y-E.y)*(T.y-E.y),Z=((m.x-E.x)*(T.x-E.x)+(m.y-E.y)*(T.y-E.y))/U;if(Z<=0)return m.distance(E);if(Z>=1)return m.distance(T);var ut=((E.y-m.y)*(T.x-E.x)-(E.x-m.x)*(T.y-E.y))/U;return Math.abs(ut)*Math.sqrt(U)}},B.isOnLine=function(n,i){for(var s=new J,u=1;u<i.length;u++){var c=i[u-1],m=i[u];if(s.computeIntersection(n,c,m),s.hasIntersection())return!0}return!1},lt.CLOCKWISE.get=function(){return-1},lt.RIGHT.get=function(){return B.CLOCKWISE},lt.COUNTERCLOCKWISE.get=function(){return 1},lt.LEFT.get=function(){return B.COUNTERCLOCKWISE},lt.COLLINEAR.get=function(){return 0},lt.STRAIGHT.get=function(){return B.COLLINEAR},Object.defineProperties(B,lt);var ct=function(){};ct.prototype.filter=function(n){},ct.prototype.interfaces_=function(){return[]},ct.prototype.getClass=function(){return ct};var Q=function(){var n=arguments[0];this._envelope=null,this._factory=null,this._SRID=null,this._userData=null,this._factory=n,this._SRID=n.getSRID()},St={serialVersionUID:{configurable:!0},SORTINDEX_POINT:{configurable:!0},SORTINDEX_MULTIPOINT:{configurable:!0},SORTINDEX_LINESTRING:{configurable:!0},SORTINDEX_LINEARRING:{configurable:!0},SORTINDEX_MULTILINESTRING:{configurable:!0},SORTINDEX_POLYGON:{configurable:!0},SORTINDEX_MULTIPOLYGON:{configurable:!0},SORTINDEX_GEOMETRYCOLLECTION:{configurable:!0},geometryChangedFilter:{configurable:!0}};Q.prototype.isGeometryCollection=function(){return this.getSortIndex()===Q.SORTINDEX_GEOMETRYCOLLECTION},Q.prototype.getFactory=function(){return this._factory},Q.prototype.getGeometryN=function(n){return this},Q.prototype.getArea=function(){return 0},Q.prototype.isRectangle=function(){return!1},Q.prototype.equals=function(){if(arguments[0]instanceof Q){var n=arguments[0];return n!==null&&this.equalsTopo(n)}if(arguments[0]instanceof Object){var i=arguments[0];if(!(i instanceof Q))return!1;var s=i;return this.equalsExact(s)}},Q.prototype.equalsExact=function(n){return this===n||this.equalsExact(n,0)},Q.prototype.geometryChanged=function(){this.apply(Q.geometryChangedFilter)},Q.prototype.geometryChangedAction=function(){this._envelope=null},Q.prototype.equalsNorm=function(n){return n!==null&&this.norm().equalsExact(n.norm())},Q.prototype.getLength=function(){return 0},Q.prototype.getNumGeometries=function(){return 1},Q.prototype.compareTo=function(){if(arguments.length===1){var n=arguments[0],i=n;return this.getSortIndex()!==i.getSortIndex()?this.getSortIndex()-i.getSortIndex():this.isEmpty()&&i.isEmpty()?0:this.isEmpty()?-1:i.isEmpty()?1:this.compareToSameClass(n)}if(arguments.length===2){var s=arguments[0],u=arguments[1];return this.getSortIndex()!==s.getSortIndex()?this.getSortIndex()-s.getSortIndex():this.isEmpty()&&s.isEmpty()?0:this.isEmpty()?-1:s.isEmpty()?1:this.compareToSameClass(s,u)}},Q.prototype.getUserData=function(){return this._userData},Q.prototype.getSRID=function(){return this._SRID},Q.prototype.getEnvelope=function(){return this.getFactory().toGeometry(this.getEnvelopeInternal())},Q.prototype.checkNotGeometryCollection=function(n){if(n.getSortIndex()===Q.SORTINDEX_GEOMETRYCOLLECTION)throw new C("This method does not support GeometryCollection arguments")},Q.prototype.equal=function(n,i,s){return s===0?n.equals(i):n.distance(i)<=s},Q.prototype.norm=function(){var n=this.copy();return n.normalize(),n},Q.prototype.getPrecisionModel=function(){return this._factory.getPrecisionModel()},Q.prototype.getEnvelopeInternal=function(){return this._envelope===null&&(this._envelope=this.computeEnvelopeInternal()),new Pt(this._envelope)},Q.prototype.setSRID=function(n){this._SRID=n},Q.prototype.setUserData=function(n){this._userData=n},Q.prototype.compare=function(n,i){for(var s=n.iterator(),u=i.iterator();s.hasNext()&&u.hasNext();){var c=s.next(),m=u.next(),E=c.compareTo(m);if(E!==0)return E}return s.hasNext()?1:u.hasNext()?-1:0},Q.prototype.hashCode=function(){return this.getEnvelopeInternal().hashCode()},Q.prototype.isGeometryCollectionOrDerived=function(){return this.getSortIndex()===Q.SORTINDEX_GEOMETRYCOLLECTION||this.getSortIndex()===Q.SORTINDEX_MULTIPOINT||this.getSortIndex()===Q.SORTINDEX_MULTILINESTRING||this.getSortIndex()===Q.SORTINDEX_MULTIPOLYGON},Q.prototype.interfaces_=function(){return[G,F,t]},Q.prototype.getClass=function(){return Q},Q.hasNonEmptyElements=function(n){for(var i=0;i<n.length;i++)if(!n[i].isEmpty())return!0;return!1},Q.hasNullElements=function(n){for(var i=0;i<n.length;i++)if(n[i]===null)return!0;return!1},St.serialVersionUID.get=function(){return 8763622679187377e3},St.SORTINDEX_POINT.get=function(){return 0},St.SORTINDEX_MULTIPOINT.get=function(){return 1},St.SORTINDEX_LINESTRING.get=function(){return 2},St.SORTINDEX_LINEARRING.get=function(){return 3},St.SORTINDEX_MULTILINESTRING.get=function(){return 4},St.SORTINDEX_POLYGON.get=function(){return 5},St.SORTINDEX_MULTIPOLYGON.get=function(){return 6},St.SORTINDEX_GEOMETRYCOLLECTION.get=function(){return 7},St.geometryChangedFilter.get=function(){return _t},Object.defineProperties(Q,St);var _t=function(){};_t.interfaces_=function(){return[ct]},_t.filter=function(n){n.geometryChangedAction()};var Mt=function(){};Mt.prototype.filter=function(n){},Mt.prototype.interfaces_=function(){return[]},Mt.prototype.getClass=function(){return Mt};var Lt=function(){},Jt={Mod2BoundaryNodeRule:{configurable:!0},EndPointBoundaryNodeRule:{configurable:!0},MultiValentEndPointBoundaryNodeRule:{configurable:!0},MonoValentEndPointBoundaryNodeRule:{configurable:!0},MOD2_BOUNDARY_RULE:{configurable:!0},ENDPOINT_BOUNDARY_RULE:{configurable:!0},MULTIVALENT_ENDPOINT_BOUNDARY_RULE:{configurable:!0},MONOVALENT_ENDPOINT_BOUNDARY_RULE:{configurable:!0},OGC_SFS_BOUNDARY_RULE:{configurable:!0}};Lt.prototype.isInBoundary=function(n){},Lt.prototype.interfaces_=function(){return[]},Lt.prototype.getClass=function(){return Lt},Jt.Mod2BoundaryNodeRule.get=function(){return Et},Jt.EndPointBoundaryNodeRule.get=function(){return oe},Jt.MultiValentEndPointBoundaryNodeRule.get=function(){return jt},Jt.MonoValentEndPointBoundaryNodeRule.get=function(){return Ht},Jt.MOD2_BOUNDARY_RULE.get=function(){return new Et},Jt.ENDPOINT_BOUNDARY_RULE.get=function(){return new oe},Jt.MULTIVALENT_ENDPOINT_BOUNDARY_RULE.get=function(){return new jt},Jt.MONOVALENT_ENDPOINT_BOUNDARY_RULE.get=function(){return new Ht},Jt.OGC_SFS_BOUNDARY_RULE.get=function(){return Lt.MOD2_BOUNDARY_RULE},Object.defineProperties(Lt,Jt);var Et=function(){};Et.prototype.isInBoundary=function(n){return n%2==1},Et.prototype.interfaces_=function(){return[Lt]},Et.prototype.getClass=function(){return Et};var oe=function(){};oe.prototype.isInBoundary=function(n){return n>0},oe.prototype.interfaces_=function(){return[Lt]},oe.prototype.getClass=function(){return oe};var jt=function(){};jt.prototype.isInBoundary=function(n){return n>1},jt.prototype.interfaces_=function(){return[Lt]},jt.prototype.getClass=function(){return jt};var Ht=function(){};Ht.prototype.isInBoundary=function(n){return n===1},Ht.prototype.interfaces_=function(){return[Lt]},Ht.prototype.getClass=function(){return Ht};var Ot=function(){};Ot.prototype.add=function(){},Ot.prototype.addAll=function(){},Ot.prototype.isEmpty=function(){},Ot.prototype.iterator=function(){},Ot.prototype.size=function(){},Ot.prototype.toArray=function(){},Ot.prototype.remove=function(){},(e.prototype=new Error).name="IndexOutOfBoundsException";var Y=function(){};Y.prototype.hasNext=function(){},Y.prototype.next=function(){},Y.prototype.remove=function(){};var wt=function(n){function i(){n.apply(this,arguments)}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.get=function(){},i.prototype.set=function(){},i.prototype.isEmpty=function(){},i}(Ot);(o.prototype=new Error).name="NoSuchElementException";var j=function(n){function i(){n.call(this),this.array_=[],arguments[0]instanceof Ot&&this.addAll(arguments[0])}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.ensureCapacity=function(){},i.prototype.interfaces_=function(){return[n,Ot]},i.prototype.add=function(s){return arguments.length===1?this.array_.push(s):this.array_.splice(arguments[0],arguments[1]),!0},i.prototype.clear=function(){this.array_=[]},i.prototype.addAll=function(s){for(var u=s.iterator();u.hasNext();)this.add(u.next());return!0},i.prototype.set=function(s,u){var c=this.array_[s];return this.array_[s]=u,c},i.prototype.iterator=function(){return new Ut(this)},i.prototype.get=function(s){if(s<0||s>=this.size())throw new e;return this.array_[s]},i.prototype.isEmpty=function(){return this.array_.length===0},i.prototype.size=function(){return this.array_.length},i.prototype.toArray=function(){for(var s=[],u=0,c=this.array_.length;u<c;u++)s.push(this.array_[u]);return s},i.prototype.remove=function(s){for(var u=!1,c=0,m=this.array_.length;c<m;c++)if(this.array_[c]===s){this.array_.splice(c,1),u=!0;break}return u},i}(wt),Ut=function(n){function i(s){n.call(this),this.arrayList_=s,this.position_=0}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.next=function(){if(this.position_===this.arrayList_.size())throw new o;return this.arrayList_.get(this.position_++)},i.prototype.hasNext=function(){return this.position_<this.arrayList_.size()},i.prototype.set=function(s){return this.arrayList_.set(this.position_-1,s)},i.prototype.remove=function(){this.arrayList_.remove(this.arrayList_.get(this.position_))},i}(Y),Dt=function(n){function i(){if(n.call(this),arguments.length!==0){if(arguments.length===1){var u=arguments[0];this.ensureCapacity(u.length),this.add(u,!0)}else if(arguments.length===2){var c=arguments[0],m=arguments[1];this.ensureCapacity(c.length),this.add(c,m)}}}n&&(i.__proto__=n),(i.prototype=Object.create(n&&n.prototype)).constructor=i;var s={coordArrayType:{configurable:!0}};return s.coordArrayType.get=function(){return new Array(0).fill(null)},i.prototype.getCoordinate=function(u){return this.get(u)},i.prototype.addAll=function(){if(arguments.length===2){for(var u=arguments[0],c=arguments[1],m=!1,E=u.iterator();E.hasNext();)this.add(E.next(),c),m=!0;return m}return n.prototype.addAll.apply(this,arguments)},i.prototype.clone=function(){for(var u=n.prototype.clone.call(this),c=0;c<this.size();c++)u.add(c,this.get(c).copy());return u},i.prototype.toCoordinateArray=function(){return this.toArray(i.coordArrayType)},i.prototype.add=function(){if(arguments.length===1){var u=arguments[0];n.prototype.add.call(this,u)}else if(arguments.length===2){if(arguments[0]instanceof Array&&typeof arguments[1]=="boolean"){var c=arguments[0],m=arguments[1];return this.add(c,m,!0),!0}if(arguments[0]instanceof L&&typeof arguments[1]=="boolean"){var E=arguments[0];if(!arguments[1]&&this.size()>=1&&this.get(this.size()-1).equals2D(E))return null;n.prototype.add.call(this,E)}else if(arguments[0]instanceof Object&&typeof arguments[1]=="boolean"){var T=arguments[0],U=arguments[1];return this.add(T,U),!0}}else if(arguments.length===3){if(typeof arguments[2]=="boolean"&&arguments[0]instanceof Array&&typeof arguments[1]=="boolean"){var Z=arguments[0],ut=arguments[1];if(arguments[2])for(var ht=0;ht<Z.length;ht++)this.add(Z[ht],ut);else for(var At=Z.length-1;At>=0;At--)this.add(Z[At],ut);return!0}if(typeof arguments[2]=="boolean"&&Number.isInteger(arguments[0])&&arguments[1]instanceof L){var Rt=arguments[0],kt=arguments[1];if(!arguments[2]){var ee=this.size();if(ee>0&&(Rt>0&&this.get(Rt-1).equals2D(kt)||Rt<ee&&this.get(Rt).equals2D(kt)))return null}n.prototype.add.call(this,Rt,kt)}}else if(arguments.length===4){var on=arguments[0],In=arguments[1],pr=arguments[2],Xi=arguments[3],Lo=1;pr>Xi&&(Lo=-1);for(var Tf=pr;Tf!==Xi;Tf+=Lo)this.add(on[Tf],In);return!0}},i.prototype.closeRing=function(){this.size()>0&&this.add(new L(this.get(0)),!1)},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},Object.defineProperties(i,s),i}(j),ft=function(){},$t={ForwardComparator:{configurable:!0},BidirectionalComparator:{configurable:!0},coordArrayType:{configurable:!0}};$t.ForwardComparator.get=function(){return re},$t.BidirectionalComparator.get=function(){return mn},$t.coordArrayType.get=function(){return new Array(0).fill(null)},ft.prototype.interfaces_=function(){return[]},ft.prototype.getClass=function(){return ft},ft.isRing=function(n){return!(n.length<4)&&!!n[0].equals2D(n[n.length-1])},ft.ptNotInList=function(n,i){for(var s=0;s<n.length;s++){var u=n[s];if(ft.indexOf(u,i)<0)return u}return null},ft.scroll=function(n,i){var s=ft.indexOf(i,n);if(s<0)return null;var u=new Array(n.length).fill(null);Nt.arraycopy(n,s,u,0,n.length-s),Nt.arraycopy(n,0,u,n.length-s,s),Nt.arraycopy(u,0,n,0,n.length)},ft.equals=function(){if(arguments.length===2){var n=arguments[0],i=arguments[1];if(n===i)return!0;if(n===null||i===null||n.length!==i.length)return!1;for(var s=0;s<n.length;s++)if(!n[s].equals(i[s]))return!1;return!0}if(arguments.length===3){var u=arguments[0],c=arguments[1],m=arguments[2];if(u===c)return!0;if(u===null||c===null||u.length!==c.length)return!1;for(var E=0;E<u.length;E++)if(m.compare(u[E],c[E])!==0)return!1;return!0}},ft.intersection=function(n,i){for(var s=new Dt,u=0;u<n.length;u++)i.intersects(n[u])&&s.add(n[u],!0);return s.toCoordinateArray()},ft.hasRepeatedPoints=function(n){for(var i=1;i<n.length;i++)if(n[i-1].equals(n[i]))return!0;return!1},ft.removeRepeatedPoints=function(n){return ft.hasRepeatedPoints(n)?new Dt(n,!1).toCoordinateArray():n},ft.reverse=function(n){for(var i=n.length-1,s=Math.trunc(i/2),u=0;u<=s;u++){var c=n[u];n[u]=n[i-u],n[i-u]=c}},ft.removeNull=function(n){for(var i=0,s=0;s<n.length;s++)n[s]!==null&&i++;var u=new Array(i).fill(null);if(i===0)return u;for(var c=0,m=0;m<n.length;m++)n[m]!==null&&(u[c++]=n[m]);return u},ft.copyDeep=function(){if(arguments.length===1){for(var n=arguments[0],i=new Array(n.length).fill(null),s=0;s<n.length;s++)i[s]=new L(n[s]);return i}if(arguments.length===5)for(var u=arguments[0],c=arguments[1],m=arguments[2],E=arguments[3],T=arguments[4],U=0;U<T;U++)m[E+U]=new L(u[c+U])},ft.isEqualReversed=function(n,i){for(var s=0;s<n.length;s++){var u=n[s],c=i[n.length-s-1];if(u.compareTo(c)!==0)return!1}return!0},ft.envelope=function(n){for(var i=new Pt,s=0;s<n.length;s++)i.expandToInclude(n[s]);return i},ft.toCoordinateArray=function(n){return n.toArray(ft.coordArrayType)},ft.atLeastNCoordinatesOrNothing=function(n,i){return i.length>=n?i:[]},ft.indexOf=function(n,i){for(var s=0;s<i.length;s++)if(n.equals(i[s]))return s;return-1},ft.increasingDirection=function(n){for(var i=0;i<Math.trunc(n.length/2);i++){var s=n.length-1-i,u=n[i].compareTo(n[s]);if(u!==0)return u}return 1},ft.compare=function(n,i){for(var s=0;s<n.length&&s<i.length;){var u=n[s].compareTo(i[s]);if(u!==0)return u;s++}return s<i.length?-1:s<n.length?1:0},ft.minCoordinate=function(n){for(var i=null,s=0;s<n.length;s++)(i===null||i.compareTo(n[s])>0)&&(i=n[s]);return i},ft.extract=function(n,i,s){i=it.clamp(i,0,n.length);var u=(s=it.clamp(s,-1,n.length))-i+1;s<0&&(u=0),i>=n.length&&(u=0),s<i&&(u=0);var c=new Array(u).fill(null);if(u===0)return c;for(var m=0,E=i;E<=s;E++)c[m++]=n[E];return c},Object.defineProperties(ft,$t);var re=function(){};re.prototype.compare=function(n,i){return ft.compare(n,i)},re.prototype.interfaces_=function(){return[z]},re.prototype.getClass=function(){return re};var mn=function(){};mn.prototype.compare=function(n,i){var s=n,u=i;if(s.length<u.length)return-1;if(s.length>u.length)return 1;if(s.length===0)return 0;var c=ft.compare(s,u);return ft.isEqualReversed(s,u)?0:c},mn.prototype.OLDcompare=function(n,i){var s=n,u=i;if(s.length<u.length)return-1;if(s.length>u.length)return 1;if(s.length===0)return 0;for(var c=ft.increasingDirection(s),m=ft.increasingDirection(u),E=c>0?0:s.length-1,T=m>0?0:s.length-1,U=0;U<s.length;U++){var Z=s[E].compareTo(u[T]);if(Z!==0)return Z;E+=c,T+=m}return 0},mn.prototype.interfaces_=function(){return[z]},mn.prototype.getClass=function(){return mn};var He=function(){};He.prototype.get=function(){},He.prototype.put=function(){},He.prototype.size=function(){},He.prototype.values=function(){},He.prototype.entrySet=function(){};var Mi=function(n){function i(){n.apply(this,arguments)}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i}(He);(a.prototype=new Error).name="OperationNotSupported",(l.prototype=new Ot).contains=function(){};var $n=function(n){function i(){n.call(this),this.array_=[],arguments[0]instanceof Ot&&this.addAll(arguments[0])}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.contains=function(s){for(var u=0,c=this.array_.length;u<c;u++)if(this.array_[u]===s)return!0;return!1},i.prototype.add=function(s){return!this.contains(s)&&(this.array_.push(s),!0)},i.prototype.addAll=function(s){for(var u=s.iterator();u.hasNext();)this.add(u.next());return!0},i.prototype.remove=function(s){throw new Error},i.prototype.size=function(){return this.array_.length},i.prototype.isEmpty=function(){return this.array_.length===0},i.prototype.toArray=function(){for(var s=[],u=0,c=this.array_.length;u<c;u++)s.push(this.array_[u]);return s},i.prototype.iterator=function(){return new ml(this)},i}(l),ml=function(n){function i(s){n.call(this),this.hashSet_=s,this.position_=0}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.next=function(){if(this.position_===this.hashSet_.size())throw new o;return this.hashSet_.array_[this.position_++]},i.prototype.hasNext=function(){return this.position_<this.hashSet_.size()},i.prototype.remove=function(){throw new a},i}(Y),hi=0;(_.prototype=new Mi).get=function(n){for(var i=this.root_;i!==null;){var s=n.compareTo(i.key);if(s<0)i=i.left;else{if(!(s>0))return i.value;i=i.right}}return null},_.prototype.put=function(n,i){if(this.root_===null)return this.root_={key:n,value:i,left:null,right:null,parent:null,color:hi,getValue:function(){return this.value},getKey:function(){return this.key}},this.size_=1,null;var s,u,c=this.root_;do if(s=c,(u=n.compareTo(c.key))<0)c=c.left;else{if(!(u>0)){var m=c.value;return c.value=i,m}c=c.right}while(c!==null);var E={key:n,left:null,right:null,value:i,parent:s,color:hi,getValue:function(){return this.value},getKey:function(){return this.key}};return u<0?s.left=E:s.right=E,this.fixAfterInsertion(E),this.size_++,null},_.prototype.fixAfterInsertion=function(n){for(n.color=1;n!=null&&n!==this.root_&&n.parent.color===1;)if(h(n)===d(h(h(n)))){var i=g(h(h(n)));f(i)===1?(p(h(n),hi),p(i,hi),p(h(h(n)),1),n=h(h(n))):(n===g(h(n))&&(n=h(n),this.rotateLeft(n)),p(h(n),hi),p(h(h(n)),1),this.rotateRight(h(h(n))))}else{var s=d(h(h(n)));f(s)===1?(p(h(n),hi),p(s,hi),p(h(h(n)),1),n=h(h(n))):(n===d(h(n))&&(n=h(n),this.rotateRight(n)),p(h(n),hi),p(h(h(n)),1),this.rotateLeft(h(h(n))))}this.root_.color=hi},_.prototype.values=function(){var n=new j,i=this.getFirstEntry();if(i!==null)for(n.add(i.value);(i=_.successor(i))!==null;)n.add(i.value);return n},_.prototype.entrySet=function(){var n=new $n,i=this.getFirstEntry();if(i!==null)for(n.add(i);(i=_.successor(i))!==null;)n.add(i);return n},_.prototype.rotateLeft=function(n){if(n!=null){var i=n.right;n.right=i.left,i.left!=null&&(i.left.parent=n),i.parent=n.parent,n.parent===null?this.root_=i:n.parent.left===n?n.parent.left=i:n.parent.right=i,i.left=n,n.parent=i}},_.prototype.rotateRight=function(n){if(n!=null){var i=n.left;n.left=i.right,i.right!=null&&(i.right.parent=n),i.parent=n.parent,n.parent===null?this.root_=i:n.parent.right===n?n.parent.right=i:n.parent.left=i,i.right=n,n.parent=i}},_.prototype.getFirstEntry=function(){var n=this.root_;if(n!=null)for(;n.left!=null;)n=n.left;return n},_.successor=function(n){if(n===null)return null;if(n.right!==null){for(var i=n.right;i.left!==null;)i=i.left;return i}for(var s=n.parent,u=n;s!==null&&u===s.right;)u=s,s=s.parent;return s},_.prototype.size=function(){return this.size_};var ws=function(){};ws.prototype.interfaces_=function(){return[]},ws.prototype.getClass=function(){return ws},y.prototype=new l,(M.prototype=new y).contains=function(n){for(var i=0,s=this.array_.length;i<s;i++)if(this.array_[i].compareTo(n)===0)return!0;return!1},M.prototype.add=function(n){if(this.contains(n))return!1;for(var i=0,s=this.array_.length;i<s;i++)if(this.array_[i].compareTo(n)===1)return this.array_.splice(i,0,n),!0;return this.array_.push(n),!0},M.prototype.addAll=function(n){for(var i=n.iterator();i.hasNext();)this.add(i.next());return!0},M.prototype.remove=function(n){throw new a},M.prototype.size=function(){return this.array_.length},M.prototype.isEmpty=function(){return this.array_.length===0},M.prototype.toArray=function(){for(var n=[],i=0,s=this.array_.length;i<s;i++)n.push(this.array_[i]);return n},M.prototype.iterator=function(){return new _o(this)};var _o=function(n){this.treeSet_=n,this.position_=0};_o.prototype.next=function(){if(this.position_===this.treeSet_.size())throw new o;return this.treeSet_.array_[this.position_++]},_o.prototype.hasNext=function(){return this.position_<this.treeSet_.size()},_o.prototype.remove=function(){throw new a};var Fi=function(){};Fi.sort=function(){var n,i,s,u,c=arguments[0];if(arguments.length===1)u=function(E,T){return E.compareTo(T)},c.sort(u);else if(arguments.length===2)s=arguments[1],u=function(E,T){return s.compare(E,T)},c.sort(u);else if(arguments.length===3){(i=c.slice(arguments[1],arguments[2])).sort();var m=c.slice(0,arguments[1]).concat(i,c.slice(arguments[2],c.length));for(c.splice(0,c.length),n=0;n<m.length;n++)c.push(m[n])}else if(arguments.length===4)for(i=c.slice(arguments[1],arguments[2]),s=arguments[3],u=function(E,T){return s.compare(E,T)},i.sort(u),m=c.slice(0,arguments[1]).concat(i,c.slice(arguments[2],c.length)),c.splice(0,c.length),n=0;n<m.length;n++)c.push(m[n])},Fi.asList=function(n){for(var i=new j,s=0,u=n.length;s<u;s++)i.add(n[s]);return i};var pe=function(){},Rr={P:{configurable:!0},L:{configurable:!0},A:{configurable:!0},FALSE:{configurable:!0},TRUE:{configurable:!0},DONTCARE:{configurable:!0},SYM_FALSE:{configurable:!0},SYM_TRUE:{configurable:!0},SYM_DONTCARE:{configurable:!0},SYM_P:{configurable:!0},SYM_L:{configurable:!0},SYM_A:{configurable:!0}};Rr.P.get=function(){return 0},Rr.L.get=function(){return 1},Rr.A.get=function(){return 2},Rr.FALSE.get=function(){return-1},Rr.TRUE.get=function(){return-2},Rr.DONTCARE.get=function(){return-3},Rr.SYM_FALSE.get=function(){return"F"},Rr.SYM_TRUE.get=function(){return"T"},Rr.SYM_DONTCARE.get=function(){return"*"},Rr.SYM_P.get=function(){return"0"},Rr.SYM_L.get=function(){return"1"},Rr.SYM_A.get=function(){return"2"},pe.prototype.interfaces_=function(){return[]},pe.prototype.getClass=function(){return pe},pe.toDimensionSymbol=function(n){switch(n){case pe.FALSE:return pe.SYM_FALSE;case pe.TRUE:return pe.SYM_TRUE;case pe.DONTCARE:return pe.SYM_DONTCARE;case pe.P:return pe.SYM_P;case pe.L:return pe.SYM_L;case pe.A:return pe.SYM_A}throw new C("Unknown dimension value: "+n)},pe.toDimensionValue=function(n){switch(ot.toUpperCase(n)){case pe.SYM_FALSE:return pe.FALSE;case pe.SYM_TRUE:return pe.TRUE;case pe.SYM_DONTCARE:return pe.DONTCARE;case pe.SYM_P:return pe.P;case pe.SYM_L:return pe.L;case pe.SYM_A:return pe.A}throw new C("Unknown dimension symbol: "+n)},Object.defineProperties(pe,Rr);var ei=function(){};ei.prototype.filter=function(n){},ei.prototype.interfaces_=function(){return[]},ei.prototype.getClass=function(){return ei};var Vr=function(){};Vr.prototype.filter=function(n,i){},Vr.prototype.isDone=function(){},Vr.prototype.isGeometryChanged=function(){},Vr.prototype.interfaces_=function(){return[]},Vr.prototype.getClass=function(){return Vr};var Vn=function(n){function i(u,c){if(n.call(this,c),this._geometries=u||[],n.hasNullElements(this._geometries))throw new C("geometries must not contain null elements")}n&&(i.__proto__=n),(i.prototype=Object.create(n&&n.prototype)).constructor=i;var s={serialVersionUID:{configurable:!0}};return i.prototype.computeEnvelopeInternal=function(){for(var u=new Pt,c=0;c<this._geometries.length;c++)u.expandToInclude(this._geometries[c].getEnvelopeInternal());return u},i.prototype.getGeometryN=function(u){return this._geometries[u]},i.prototype.getSortIndex=function(){return n.SORTINDEX_GEOMETRYCOLLECTION},i.prototype.getCoordinates=function(){for(var u=new Array(this.getNumPoints()).fill(null),c=-1,m=0;m<this._geometries.length;m++)for(var E=this._geometries[m].getCoordinates(),T=0;T<E.length;T++)u[++c]=E[T];return u},i.prototype.getArea=function(){for(var u=0,c=0;c<this._geometries.length;c++)u+=this._geometries[c].getArea();return u},i.prototype.equalsExact=function(){if(arguments.length===2){var u=arguments[0],c=arguments[1];if(!this.isEquivalentClass(u))return!1;var m=u;if(this._geometries.length!==m._geometries.length)return!1;for(var E=0;E<this._geometries.length;E++)if(!this._geometries[E].equalsExact(m._geometries[E],c))return!1;return!0}return n.prototype.equalsExact.apply(this,arguments)},i.prototype.normalize=function(){for(var u=0;u<this._geometries.length;u++)this._geometries[u].normalize();Fi.sort(this._geometries)},i.prototype.getCoordinate=function(){return this.isEmpty()?null:this._geometries[0].getCoordinate()},i.prototype.getBoundaryDimension=function(){for(var u=pe.FALSE,c=0;c<this._geometries.length;c++)u=Math.max(u,this._geometries[c].getBoundaryDimension());return u},i.prototype.getDimension=function(){for(var u=pe.FALSE,c=0;c<this._geometries.length;c++)u=Math.max(u,this._geometries[c].getDimension());return u},i.prototype.getLength=function(){for(var u=0,c=0;c<this._geometries.length;c++)u+=this._geometries[c].getLength();return u},i.prototype.getNumPoints=function(){for(var u=0,c=0;c<this._geometries.length;c++)u+=this._geometries[c].getNumPoints();return u},i.prototype.getNumGeometries=function(){return this._geometries.length},i.prototype.reverse=function(){for(var u=this._geometries.length,c=new Array(u).fill(null),m=0;m<this._geometries.length;m++)c[m]=this._geometries[m].reverse();return this.getFactory().createGeometryCollection(c)},i.prototype.compareToSameClass=function(){if(arguments.length===1){var u=arguments[0],c=new M(Fi.asList(this._geometries)),m=new M(Fi.asList(u._geometries));return this.compare(c,m)}if(arguments.length===2){for(var E=arguments[0],T=arguments[1],U=E,Z=this.getNumGeometries(),ut=U.getNumGeometries(),ht=0;ht<Z&&ht<ut;){var At=this.getGeometryN(ht),Rt=U.getGeometryN(ht),kt=At.compareToSameClass(Rt,T);if(kt!==0)return kt;ht++}return ht<Z?1:ht<ut?-1:0}},i.prototype.apply=function(){if(X(arguments[0],Mt))for(var u=arguments[0],c=0;c<this._geometries.length;c++)this._geometries[c].apply(u);else if(X(arguments[0],Vr)){var m=arguments[0];if(this._geometries.length===0)return null;for(var E=0;E<this._geometries.length&&(this._geometries[E].apply(m),!m.isDone());E++);m.isGeometryChanged()&&this.geometryChanged()}else if(X(arguments[0],ei)){var T=arguments[0];T.filter(this);for(var U=0;U<this._geometries.length;U++)this._geometries[U].apply(T)}else if(X(arguments[0],ct)){var Z=arguments[0];Z.filter(this);for(var ut=0;ut<this._geometries.length;ut++)this._geometries[ut].apply(Z)}},i.prototype.getBoundary=function(){return this.checkNotGeometryCollection(this),b.shouldNeverReachHere(),null},i.prototype.clone=function(){var u=n.prototype.clone.call(this);u._geometries=new Array(this._geometries.length).fill(null);for(var c=0;c<this._geometries.length;c++)u._geometries[c]=this._geometries[c].clone();return u},i.prototype.getGeometryType=function(){return"GeometryCollection"},i.prototype.copy=function(){for(var u=new Array(this._geometries.length).fill(null),c=0;c<u.length;c++)u[c]=this._geometries[c].copy();return new i(u,this._factory)},i.prototype.isEmpty=function(){for(var u=0;u<this._geometries.length;u++)if(!this._geometries[u].isEmpty())return!1;return!0},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},s.serialVersionUID.get=function(){return-5694727726395021e3},Object.defineProperties(i,s),i}(Q),H=function(n){function i(){n.apply(this,arguments)}n&&(i.__proto__=n),(i.prototype=Object.create(n&&n.prototype)).constructor=i;var s={serialVersionUID:{configurable:!0}};return i.prototype.getSortIndex=function(){return Q.SORTINDEX_MULTILINESTRING},i.prototype.equalsExact=function(){if(arguments.length===2){var u=arguments[0],c=arguments[1];return!!this.isEquivalentClass(u)&&n.prototype.equalsExact.call(this,u,c)}return n.prototype.equalsExact.apply(this,arguments)},i.prototype.getBoundaryDimension=function(){return this.isClosed()?pe.FALSE:0},i.prototype.isClosed=function(){if(this.isEmpty())return!1;for(var u=0;u<this._geometries.length;u++)if(!this._geometries[u].isClosed())return!1;return!0},i.prototype.getDimension=function(){return 1},i.prototype.reverse=function(){for(var u=this._geometries.length,c=new Array(u).fill(null),m=0;m<this._geometries.length;m++)c[u-1-m]=this._geometries[m].reverse();return this.getFactory().createMultiLineString(c)},i.prototype.getBoundary=function(){return new rt(this).getBoundary()},i.prototype.getGeometryType=function(){return"MultiLineString"},i.prototype.copy=function(){for(var u=new Array(this._geometries.length).fill(null),c=0;c<u.length;c++)u[c]=this._geometries[c].copy();return new i(u,this._factory)},i.prototype.interfaces_=function(){return[ws]},i.prototype.getClass=function(){return i},s.serialVersionUID.get=function(){return 8166665132445434e3},Object.defineProperties(i,s),i}(Vn),rt=function(){if(this._geom=null,this._geomFact=null,this._bnRule=null,this._endpointMap=null,arguments.length===1){var n=arguments[0],i=Lt.MOD2_BOUNDARY_RULE;this._geom=n,this._geomFact=n.getFactory(),this._bnRule=i}else if(arguments.length===2){var s=arguments[0],u=arguments[1];this._geom=s,this._geomFact=s.getFactory(),this._bnRule=u}};rt.prototype.boundaryMultiLineString=function(n){if(this._geom.isEmpty())return this.getEmptyMultiPoint();var i=this.computeBoundaryCoordinates(n);return i.length===1?this._geomFact.createPoint(i[0]):this._geomFact.createMultiPointFromCoords(i)},rt.prototype.getBoundary=function(){return this._geom instanceof Bt?this.boundaryLineString(this._geom):this._geom instanceof H?this.boundaryMultiLineString(this._geom):this._geom.getBoundary()},rt.prototype.boundaryLineString=function(n){return this._geom.isEmpty()?this.getEmptyMultiPoint():n.isClosed()?this._bnRule.isInBoundary(2)?n.getStartPoint():this._geomFact.createMultiPoint():this._geomFact.createMultiPoint([n.getStartPoint(),n.getEndPoint()])},rt.prototype.getEmptyMultiPoint=function(){return this._geomFact.createMultiPoint()},rt.prototype.computeBoundaryCoordinates=function(n){var i=new j;this._endpointMap=new _;for(var s=0;s<n.getNumGeometries();s++){var u=n.getGeometryN(s);u.getNumPoints()!==0&&(this.addEndpoint(u.getCoordinateN(0)),this.addEndpoint(u.getCoordinateN(u.getNumPoints()-1)))}for(var c=this._endpointMap.entrySet().iterator();c.hasNext();){var m=c.next(),E=m.getValue().count;this._bnRule.isInBoundary(E)&&i.add(m.getKey())}return ft.toCoordinateArray(i)},rt.prototype.addEndpoint=function(n){var i=this._endpointMap.get(n);i===null&&(i=new gt,this._endpointMap.put(n,i)),i.count++},rt.prototype.interfaces_=function(){return[]},rt.prototype.getClass=function(){return rt},rt.getBoundary=function(){if(arguments.length===1){var n=arguments[0];return new rt(n).getBoundary()}if(arguments.length===2){var i=arguments[0],s=arguments[1];return new rt(i,s).getBoundary()}};var gt=function(){this.count=null};gt.prototype.interfaces_=function(){return[]},gt.prototype.getClass=function(){return gt};var st=function(){},yt={NEWLINE:{configurable:!0},SIMPLE_ORDINATE_FORMAT:{configurable:!0}};st.prototype.interfaces_=function(){return[]},st.prototype.getClass=function(){return st},st.chars=function(n,i){for(var s=new Array(i).fill(null),u=0;u<i;u++)s[u]=n;return String(s)},st.getStackTrace=function(){if(arguments.length===1){var n=arguments[0],i=new function(){},s=new function(){}(i);return n.printStackTrace(s),i.toString()}if(arguments.length===2){for(var u=arguments[0],c=arguments[1],m="",E=new function(){}(new function(){}(st.getStackTrace(u))),T=0;T<c;T++)try{m+=E.readLine()+st.NEWLINE}catch(U){if(!(U instanceof w))throw U;b.shouldNeverReachHere()}return m}},st.split=function(n,i){for(var s=i.length,u=new j,c=""+n,m=c.indexOf(i);m>=0;){var E=c.substring(0,m);u.add(E),m=(c=c.substring(m+s)).indexOf(i)}c.length>0&&u.add(c);for(var T=new Array(u.size()).fill(null),U=0;U<T.length;U++)T[U]=u.get(U);return T},st.toString=function(){if(arguments.length===1){var n=arguments[0];return st.SIMPLE_ORDINATE_FORMAT.format(n)}},st.spaces=function(n){return st.chars(" ",n)},yt.NEWLINE.get=function(){return Nt.getProperty("line.separator")},yt.SIMPLE_ORDINATE_FORMAT.get=function(){return new function(){}("0.#")},Object.defineProperties(st,yt);var It=function(){};It.prototype.interfaces_=function(){return[]},It.prototype.getClass=function(){return It},It.copyCoord=function(n,i,s,u){for(var c=Math.min(n.getDimension(),s.getDimension()),m=0;m<c;m++)s.setOrdinate(u,m,n.getOrdinate(i,m))},It.isRing=function(n){var i=n.size();return i===0||!(i<=3)&&n.getOrdinate(0,dt.X)===n.getOrdinate(i-1,dt.X)&&n.getOrdinate(0,dt.Y)===n.getOrdinate(i-1,dt.Y)},It.isEqual=function(n,i){var s=n.size();if(s!==i.size())return!1;for(var u=Math.min(n.getDimension(),i.getDimension()),c=0;c<s;c++)for(var m=0;m<u;m++){var E=n.getOrdinate(c,m),T=i.getOrdinate(c,m);if(n.getOrdinate(c,m)!==i.getOrdinate(c,m)&&(!S.isNaN(E)||!S.isNaN(T)))return!1}return!0},It.extend=function(n,i,s){var u=n.create(s,i.getDimension()),c=i.size();if(It.copy(i,0,u,0,c),c>0)for(var m=c;m<s;m++)It.copy(i,c-1,u,m,1);return u},It.reverse=function(n){for(var i=n.size()-1,s=Math.trunc(i/2),u=0;u<=s;u++)It.swap(n,u,i-u)},It.swap=function(n,i,s){if(i===s)return null;for(var u=0;u<n.getDimension();u++){var c=n.getOrdinate(i,u);n.setOrdinate(i,u,n.getOrdinate(s,u)),n.setOrdinate(s,u,c)}},It.copy=function(n,i,s,u,c){for(var m=0;m<c;m++)It.copyCoord(n,i+m,s,u+m)},It.toString=function(){if(arguments.length===1){var n=arguments[0],i=n.size();if(i===0)return"()";var s=n.getDimension(),u=new pt;u.append("(");for(var c=0;c<i;c++){c>0&&u.append(" ");for(var m=0;m<s;m++)m>0&&u.append(","),u.append(st.toString(n.getOrdinate(c,m)))}return u.append(")"),u.toString()}},It.ensureValidRing=function(n,i){var s=i.size();return s===0?i:s<=3?It.createClosedRing(n,i,4):i.getOrdinate(0,dt.X)===i.getOrdinate(s-1,dt.X)&&i.getOrdinate(0,dt.Y)===i.getOrdinate(s-1,dt.Y)?i:It.createClosedRing(n,i,s+1)},It.createClosedRing=function(n,i,s){var u=n.create(s,i.getDimension()),c=i.size();It.copy(i,0,u,0,c);for(var m=c;m<s;m++)It.copy(i,0,u,m,1);return u};var Bt=function(n){function i(u,c){n.call(this,c),this._points=null,this.init(u)}n&&(i.__proto__=n),(i.prototype=Object.create(n&&n.prototype)).constructor=i;var s={serialVersionUID:{configurable:!0}};return i.prototype.computeEnvelopeInternal=function(){return this.isEmpty()?new Pt:this._points.expandEnvelope(new Pt)},i.prototype.isRing=function(){return this.isClosed()&&this.isSimple()},i.prototype.getSortIndex=function(){return n.SORTINDEX_LINESTRING},i.prototype.getCoordinates=function(){return this._points.toCoordinateArray()},i.prototype.equalsExact=function(){if(arguments.length===2){var u=arguments[0],c=arguments[1];if(!this.isEquivalentClass(u))return!1;var m=u;if(this._points.size()!==m._points.size())return!1;for(var E=0;E<this._points.size();E++)if(!this.equal(this._points.getCoordinate(E),m._points.getCoordinate(E),c))return!1;return!0}return n.prototype.equalsExact.apply(this,arguments)},i.prototype.normalize=function(){for(var u=0;u<Math.trunc(this._points.size()/2);u++){var c=this._points.size()-1-u;if(!this._points.getCoordinate(u).equals(this._points.getCoordinate(c)))return this._points.getCoordinate(u).compareTo(this._points.getCoordinate(c))>0&&It.reverse(this._points),null}},i.prototype.getCoordinate=function(){return this.isEmpty()?null:this._points.getCoordinate(0)},i.prototype.getBoundaryDimension=function(){return this.isClosed()?pe.FALSE:0},i.prototype.isClosed=function(){return!this.isEmpty()&&this.getCoordinateN(0).equals2D(this.getCoordinateN(this.getNumPoints()-1))},i.prototype.getEndPoint=function(){return this.isEmpty()?null:this.getPointN(this.getNumPoints()-1)},i.prototype.getDimension=function(){return 1},i.prototype.getLength=function(){return B.computeLength(this._points)},i.prototype.getNumPoints=function(){return this._points.size()},i.prototype.reverse=function(){var u=this._points.copy();return It.reverse(u),this.getFactory().createLineString(u)},i.prototype.compareToSameClass=function(){if(arguments.length===1){for(var u=arguments[0],c=0,m=0;c<this._points.size()&&m<u._points.size();){var E=this._points.getCoordinate(c).compareTo(u._points.getCoordinate(m));if(E!==0)return E;c++,m++}return c<this._points.size()?1:m<u._points.size()?-1:0}if(arguments.length===2){var T=arguments[0];return arguments[1].compare(this._points,T._points)}},i.prototype.apply=function(){if(X(arguments[0],Mt))for(var u=arguments[0],c=0;c<this._points.size();c++)u.filter(this._points.getCoordinate(c));else if(X(arguments[0],Vr)){var m=arguments[0];if(this._points.size()===0)return null;for(var E=0;E<this._points.size()&&(m.filter(this._points,E),!m.isDone());E++);m.isGeometryChanged()&&this.geometryChanged()}else X(arguments[0],ei)?arguments[0].filter(this):X(arguments[0],ct)&&arguments[0].filter(this)},i.prototype.getBoundary=function(){return new rt(this).getBoundary()},i.prototype.isEquivalentClass=function(u){return u instanceof i},i.prototype.clone=function(){var u=n.prototype.clone.call(this);return u._points=this._points.clone(),u},i.prototype.getCoordinateN=function(u){return this._points.getCoordinate(u)},i.prototype.getGeometryType=function(){return"LineString"},i.prototype.copy=function(){return new i(this._points.copy(),this._factory)},i.prototype.getCoordinateSequence=function(){return this._points},i.prototype.isEmpty=function(){return this._points.size()===0},i.prototype.init=function(u){if(u===null&&(u=this.getFactory().getCoordinateSequenceFactory().create([])),u.size()===1)throw new C("Invalid number of points in LineString (found "+u.size()+" - must be 0 or >= 2)");this._points=u},i.prototype.isCoordinate=function(u){for(var c=0;c<this._points.size();c++)if(this._points.getCoordinate(c).equals(u))return!0;return!1},i.prototype.getStartPoint=function(){return this.isEmpty()?null:this.getPointN(0)},i.prototype.getPointN=function(u){return this.getFactory().createPoint(this._points.getCoordinate(u))},i.prototype.interfaces_=function(){return[ws]},i.prototype.getClass=function(){return i},s.serialVersionUID.get=function(){return 0x2b2b51ba435c8e00},Object.defineProperties(i,s),i}(Q),se=function(){};se.prototype.interfaces_=function(){return[]},se.prototype.getClass=function(){return se};var Qt=function(n){function i(u,c){n.call(this,c),this._coordinates=u||null,this.init(this._coordinates)}n&&(i.__proto__=n),(i.prototype=Object.create(n&&n.prototype)).constructor=i;var s={serialVersionUID:{configurable:!0}};return i.prototype.computeEnvelopeInternal=function(){if(this.isEmpty())return new Pt;var u=new Pt;return u.expandToInclude(this._coordinates.getX(0),this._coordinates.getY(0)),u},i.prototype.getSortIndex=function(){return n.SORTINDEX_POINT},i.prototype.getCoordinates=function(){return this.isEmpty()?[]:[this.getCoordinate()]},i.prototype.equalsExact=function(){if(arguments.length===2){var u=arguments[0],c=arguments[1];return!!this.isEquivalentClass(u)&&(!(!this.isEmpty()||!u.isEmpty())||this.isEmpty()===u.isEmpty()&&this.equal(u.getCoordinate(),this.getCoordinate(),c))}return n.prototype.equalsExact.apply(this,arguments)},i.prototype.normalize=function(){},i.prototype.getCoordinate=function(){return this._coordinates.size()!==0?this._coordinates.getCoordinate(0):null},i.prototype.getBoundaryDimension=function(){return pe.FALSE},i.prototype.getDimension=function(){return 0},i.prototype.getNumPoints=function(){return this.isEmpty()?0:1},i.prototype.reverse=function(){return this.copy()},i.prototype.getX=function(){if(this.getCoordinate()===null)throw new Error("getX called on empty Point");return this.getCoordinate().x},i.prototype.compareToSameClass=function(){if(arguments.length===1){var u=arguments[0];return this.getCoordinate().compareTo(u.getCoordinate())}if(arguments.length===2){var c=arguments[0];return arguments[1].compare(this._coordinates,c._coordinates)}},i.prototype.apply=function(){if(X(arguments[0],Mt)){var u=arguments[0];if(this.isEmpty())return null;u.filter(this.getCoordinate())}else if(X(arguments[0],Vr)){var c=arguments[0];if(this.isEmpty())return null;c.filter(this._coordinates,0),c.isGeometryChanged()&&this.geometryChanged()}else X(arguments[0],ei)?arguments[0].filter(this):X(arguments[0],ct)&&arguments[0].filter(this)},i.prototype.getBoundary=function(){return this.getFactory().createGeometryCollection(null)},i.prototype.clone=function(){var u=n.prototype.clone.call(this);return u._coordinates=this._coordinates.clone(),u},i.prototype.getGeometryType=function(){return"Point"},i.prototype.copy=function(){return new i(this._coordinates.copy(),this._factory)},i.prototype.getCoordinateSequence=function(){return this._coordinates},i.prototype.getY=function(){if(this.getCoordinate()===null)throw new Error("getY called on empty Point");return this.getCoordinate().y},i.prototype.isEmpty=function(){return this._coordinates.size()===0},i.prototype.init=function(u){u===null&&(u=this.getFactory().getCoordinateSequenceFactory().create([])),b.isTrue(u.size()<=1),this._coordinates=u},i.prototype.isSimple=function(){return!0},i.prototype.interfaces_=function(){return[se]},i.prototype.getClass=function(){return i},s.serialVersionUID.get=function(){return 4902022702746615e3},Object.defineProperties(i,s),i}(Q),ce=function(){};ce.prototype.interfaces_=function(){return[]},ce.prototype.getClass=function(){return ce};var Vt=function(n){function i(u,c,m){if(n.call(this,m),this._shell=null,this._holes=null,u===null&&(u=this.getFactory().createLinearRing()),c===null&&(c=[]),n.hasNullElements(c))throw new C("holes must not contain null elements");if(u.isEmpty()&&n.hasNonEmptyElements(c))throw new C("shell is empty but holes are not");this._shell=u,this._holes=c}n&&(i.__proto__=n),(i.prototype=Object.create(n&&n.prototype)).constructor=i;var s={serialVersionUID:{configurable:!0}};return i.prototype.computeEnvelopeInternal=function(){return this._shell.getEnvelopeInternal()},i.prototype.getSortIndex=function(){return n.SORTINDEX_POLYGON},i.prototype.getCoordinates=function(){if(this.isEmpty())return[];for(var u=new Array(this.getNumPoints()).fill(null),c=-1,m=this._shell.getCoordinates(),E=0;E<m.length;E++)u[++c]=m[E];for(var T=0;T<this._holes.length;T++)for(var U=this._holes[T].getCoordinates(),Z=0;Z<U.length;Z++)u[++c]=U[Z];return u},i.prototype.getArea=function(){var u=0;u+=Math.abs(B.signedArea(this._shell.getCoordinateSequence()));for(var c=0;c<this._holes.length;c++)u-=Math.abs(B.signedArea(this._holes[c].getCoordinateSequence()));return u},i.prototype.isRectangle=function(){if(this.getNumInteriorRing()!==0||this._shell===null||this._shell.getNumPoints()!==5)return!1;for(var u=this._shell.getCoordinateSequence(),c=this.getEnvelopeInternal(),m=0;m<5;m++){var E=u.getX(m);if(E!==c.getMinX()&&E!==c.getMaxX())return!1;var T=u.getY(m);if(T!==c.getMinY()&&T!==c.getMaxY())return!1}for(var U=u.getX(0),Z=u.getY(0),ut=1;ut<=4;ut++){var ht=u.getX(ut),At=u.getY(ut);if(ht!==U==(At!==Z))return!1;U=ht,Z=At}return!0},i.prototype.equalsExact=function(){if(arguments.length===2){var u=arguments[0],c=arguments[1];if(!this.isEquivalentClass(u))return!1;var m=u,E=this._shell,T=m._shell;if(!E.equalsExact(T,c)||this._holes.length!==m._holes.length)return!1;for(var U=0;U<this._holes.length;U++)if(!this._holes[U].equalsExact(m._holes[U],c))return!1;return!0}return n.prototype.equalsExact.apply(this,arguments)},i.prototype.normalize=function(){if(arguments.length===0){this.normalize(this._shell,!0);for(var u=0;u<this._holes.length;u++)this.normalize(this._holes[u],!1);Fi.sort(this._holes)}else if(arguments.length===2){var c=arguments[0],m=arguments[1];if(c.isEmpty())return null;var E=new Array(c.getCoordinates().length-1).fill(null);Nt.arraycopy(c.getCoordinates(),0,E,0,E.length);var T=ft.minCoordinate(c.getCoordinates());ft.scroll(E,T),Nt.arraycopy(E,0,c.getCoordinates(),0,E.length),c.getCoordinates()[E.length]=E[0],B.isCCW(c.getCoordinates())===m&&ft.reverse(c.getCoordinates())}},i.prototype.getCoordinate=function(){return this._shell.getCoordinate()},i.prototype.getNumInteriorRing=function(){return this._holes.length},i.prototype.getBoundaryDimension=function(){return 1},i.prototype.getDimension=function(){return 2},i.prototype.getLength=function(){var u=0;u+=this._shell.getLength();for(var c=0;c<this._holes.length;c++)u+=this._holes[c].getLength();return u},i.prototype.getNumPoints=function(){for(var u=this._shell.getNumPoints(),c=0;c<this._holes.length;c++)u+=this._holes[c].getNumPoints();return u},i.prototype.reverse=function(){var u=this.copy();u._shell=this._shell.copy().reverse(),u._holes=new Array(this._holes.length).fill(null);for(var c=0;c<this._holes.length;c++)u._holes[c]=this._holes[c].copy().reverse();return u},i.prototype.convexHull=function(){return this.getExteriorRing().convexHull()},i.prototype.compareToSameClass=function(){if(arguments.length===1){var u=arguments[0],c=this._shell,m=u._shell;return c.compareToSameClass(m)}if(arguments.length===2){var E=arguments[0],T=arguments[1],U=E,Z=this._shell,ut=U._shell,ht=Z.compareToSameClass(ut,T);if(ht!==0)return ht;for(var At=this.getNumInteriorRing(),Rt=U.getNumInteriorRing(),kt=0;kt<At&&kt<Rt;){var ee=this.getInteriorRingN(kt),on=U.getInteriorRingN(kt),In=ee.compareToSameClass(on,T);if(In!==0)return In;kt++}return kt<At?1:kt<Rt?-1:0}},i.prototype.apply=function(u){if(X(u,Mt)){this._shell.apply(u);for(var c=0;c<this._holes.length;c++)this._holes[c].apply(u)}else if(X(u,Vr)){if(this._shell.apply(u),!u.isDone())for(var m=0;m<this._holes.length&&(this._holes[m].apply(u),!u.isDone());m++);u.isGeometryChanged()&&this.geometryChanged()}else if(X(u,ei))u.filter(this);else if(X(u,ct)){u.filter(this),this._shell.apply(u);for(var E=0;E<this._holes.length;E++)this._holes[E].apply(u)}},i.prototype.getBoundary=function(){if(this.isEmpty())return this.getFactory().createMultiLineString();var u=new Array(this._holes.length+1).fill(null);u[0]=this._shell;for(var c=0;c<this._holes.length;c++)u[c+1]=this._holes[c];return u.length<=1?this.getFactory().createLinearRing(u[0].getCoordinateSequence()):this.getFactory().createMultiLineString(u)},i.prototype.clone=function(){var u=n.prototype.clone.call(this);u._shell=this._shell.clone(),u._holes=new Array(this._holes.length).fill(null);for(var c=0;c<this._holes.length;c++)u._holes[c]=this._holes[c].clone();return u},i.prototype.getGeometryType=function(){return"Polygon"},i.prototype.copy=function(){for(var u=this._shell.copy(),c=new Array(this._holes.length).fill(null),m=0;m<c.length;m++)c[m]=this._holes[m].copy();return new i(u,c,this._factory)},i.prototype.getExteriorRing=function(){return this._shell},i.prototype.isEmpty=function(){return this._shell.isEmpty()},i.prototype.getInteriorRingN=function(u){return this._holes[u]},i.prototype.interfaces_=function(){return[ce]},i.prototype.getClass=function(){return i},s.serialVersionUID.get=function(){return-0x307ffefd8dc97200},Object.defineProperties(i,s),i}(Q),fe=function(n){function i(){n.apply(this,arguments)}n&&(i.__proto__=n),(i.prototype=Object.create(n&&n.prototype)).constructor=i;var s={serialVersionUID:{configurable:!0}};return i.prototype.getSortIndex=function(){return Q.SORTINDEX_MULTIPOINT},i.prototype.isValid=function(){return!0},i.prototype.equalsExact=function(){if(arguments.length===2){var u=arguments[0],c=arguments[1];return!!this.isEquivalentClass(u)&&n.prototype.equalsExact.call(this,u,c)}return n.prototype.equalsExact.apply(this,arguments)},i.prototype.getCoordinate=function(){if(arguments.length===1){var u=arguments[0];return this._geometries[u].getCoordinate()}return n.prototype.getCoordinate.apply(this,arguments)},i.prototype.getBoundaryDimension=function(){return pe.FALSE},i.prototype.getDimension=function(){return 0},i.prototype.getBoundary=function(){return this.getFactory().createGeometryCollection(null)},i.prototype.getGeometryType=function(){return"MultiPoint"},i.prototype.copy=function(){for(var u=new Array(this._geometries.length).fill(null),c=0;c<u.length;c++)u[c]=this._geometries[c].copy();return new i(u,this._factory)},i.prototype.interfaces_=function(){return[se]},i.prototype.getClass=function(){return i},s.serialVersionUID.get=function(){return-8048474874175356e3},Object.defineProperties(i,s),i}(Vn),sn=function(n){function i(u,c){u instanceof L&&c instanceof le&&(u=c.getCoordinateSequenceFactory().create(u)),n.call(this,u,c),this.validateConstruction()}n&&(i.__proto__=n),(i.prototype=Object.create(n&&n.prototype)).constructor=i;var s={MINIMUM_VALID_SIZE:{configurable:!0},serialVersionUID:{configurable:!0}};return i.prototype.getSortIndex=function(){return Q.SORTINDEX_LINEARRING},i.prototype.getBoundaryDimension=function(){return pe.FALSE},i.prototype.isClosed=function(){return!!this.isEmpty()||n.prototype.isClosed.call(this)},i.prototype.reverse=function(){var u=this._points.copy();return It.reverse(u),this.getFactory().createLinearRing(u)},i.prototype.validateConstruction=function(){if(!this.isEmpty()&&!n.prototype.isClosed.call(this))throw new C("Points of LinearRing do not form a closed linestring");if(this.getCoordinateSequence().size()>=1&&this.getCoordinateSequence().size()<i.MINIMUM_VALID_SIZE)throw new C("Invalid number of points in LinearRing (found "+this.getCoordinateSequence().size()+" - must be 0 or >= 4)")},i.prototype.getGeometryType=function(){return"LinearRing"},i.prototype.copy=function(){return new i(this._points.copy(),this._factory)},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},s.MINIMUM_VALID_SIZE.get=function(){return 4},s.serialVersionUID.get=function(){return-0x3b229e262367a600},Object.defineProperties(i,s),i}(Bt),un=function(n){function i(){n.apply(this,arguments)}n&&(i.__proto__=n),(i.prototype=Object.create(n&&n.prototype)).constructor=i;var s={serialVersionUID:{configurable:!0}};return i.prototype.getSortIndex=function(){return Q.SORTINDEX_MULTIPOLYGON},i.prototype.equalsExact=function(){if(arguments.length===2){var u=arguments[0],c=arguments[1];return!!this.isEquivalentClass(u)&&n.prototype.equalsExact.call(this,u,c)}return n.prototype.equalsExact.apply(this,arguments)},i.prototype.getBoundaryDimension=function(){return 1},i.prototype.getDimension=function(){return 2},i.prototype.reverse=function(){for(var u=this._geometries.length,c=new Array(u).fill(null),m=0;m<this._geometries.length;m++)c[m]=this._geometries[m].reverse();return this.getFactory().createMultiPolygon(c)},i.prototype.getBoundary=function(){if(this.isEmpty())return this.getFactory().createMultiLineString();for(var u=new j,c=0;c<this._geometries.length;c++)for(var m=this._geometries[c].getBoundary(),E=0;E<m.getNumGeometries();E++)u.add(m.getGeometryN(E));var T=new Array(u.size()).fill(null);return this.getFactory().createMultiLineString(u.toArray(T))},i.prototype.getGeometryType=function(){return"MultiPolygon"},i.prototype.copy=function(){for(var u=new Array(this._geometries.length).fill(null),c=0;c<u.length;c++)u[c]=this._geometries[c].copy();return new i(u,this._factory)},i.prototype.interfaces_=function(){return[ce]},i.prototype.getClass=function(){return i},s.serialVersionUID.get=function(){return-0x7a5aa1369171980},Object.defineProperties(i,s),i}(Vn),vn=function(n){this._factory=n||null,this._isUserDataCopied=!1},ni={NoOpGeometryOperation:{configurable:!0},CoordinateOperation:{configurable:!0},CoordinateSequenceOperation:{configurable:!0}};vn.prototype.setCopyUserData=function(n){this._isUserDataCopied=n},vn.prototype.edit=function(n,i){if(n===null)return null;var s=this.editInternal(n,i);return this._isUserDataCopied&&s.setUserData(n.getUserData()),s},vn.prototype.editInternal=function(n,i){return this._factory===null&&(this._factory=n.getFactory()),n instanceof Vn?this.editGeometryCollection(n,i):n instanceof Vt?this.editPolygon(n,i):n instanceof Qt?i.edit(n,this._factory):n instanceof Bt?i.edit(n,this._factory):(b.shouldNeverReachHere("Unsupported Geometry class: "+n.getClass().getName()),null)},vn.prototype.editGeometryCollection=function(n,i){for(var s=i.edit(n,this._factory),u=new j,c=0;c<s.getNumGeometries();c++){var m=this.edit(s.getGeometryN(c),i);m===null||m.isEmpty()||u.add(m)}return s.getClass()===fe?this._factory.createMultiPoint(u.toArray([])):s.getClass()===H?this._factory.createMultiLineString(u.toArray([])):s.getClass()===un?this._factory.createMultiPolygon(u.toArray([])):this._factory.createGeometryCollection(u.toArray([]))},vn.prototype.editPolygon=function(n,i){var s=i.edit(n,this._factory);if(s===null&&(s=this._factory.createPolygon(null)),s.isEmpty())return s;var u=this.edit(s.getExteriorRing(),i);if(u===null||u.isEmpty())return this._factory.createPolygon();for(var c=new j,m=0;m<s.getNumInteriorRing();m++){var E=this.edit(s.getInteriorRingN(m),i);E===null||E.isEmpty()||c.add(E)}return this._factory.createPolygon(u,c.toArray([]))},vn.prototype.interfaces_=function(){return[]},vn.prototype.getClass=function(){return vn},vn.GeometryEditorOperation=function(){},ni.NoOpGeometryOperation.get=function(){return En},ni.CoordinateOperation.get=function(){return de},ni.CoordinateSequenceOperation.get=function(){return xo},Object.defineProperties(vn,ni);var En=function(){};En.prototype.edit=function(n,i){return n},En.prototype.interfaces_=function(){return[vn.GeometryEditorOperation]},En.prototype.getClass=function(){return En};var de=function(){};de.prototype.edit=function(n,i){var s=this.editCoordinates(n.getCoordinates(),n);return s===null?n:n instanceof sn?i.createLinearRing(s):n instanceof Bt?i.createLineString(s):n instanceof Qt?s.length>0?i.createPoint(s[0]):i.createPoint():n},de.prototype.interfaces_=function(){return[vn.GeometryEditorOperation]},de.prototype.getClass=function(){return de};var xo=function(){};xo.prototype.edit=function(n,i){return n instanceof sn?i.createLinearRing(this.edit(n.getCoordinateSequence(),n)):n instanceof Bt?i.createLineString(this.edit(n.getCoordinateSequence(),n)):n instanceof Qt?i.createPoint(this.edit(n.getCoordinateSequence(),n)):n},xo.prototype.interfaces_=function(){return[vn.GeometryEditorOperation]},xo.prototype.getClass=function(){return xo};var he=function(){if(this._dimension=3,this._coordinates=null,arguments.length===1){if(arguments[0]instanceof Array)this._coordinates=arguments[0],this._dimension=3;else if(Number.isInteger(arguments[0])){var n=arguments[0];this._coordinates=new Array(n).fill(null);for(var i=0;i<n;i++)this._coordinates[i]=new L}else if(X(arguments[0],dt)){var s=arguments[0];if(s===null)return this._coordinates=new Array(0).fill(null),null;this._dimension=s.getDimension(),this._coordinates=new Array(s.size()).fill(null);for(var u=0;u<this._coordinates.length;u++)this._coordinates[u]=s.getCoordinateCopy(u)}}else if(arguments.length===2){if(arguments[0]instanceof Array&&Number.isInteger(arguments[1])){var c=arguments[0],m=arguments[1];this._coordinates=c,this._dimension=m,c===null&&(this._coordinates=new Array(0).fill(null))}else if(Number.isInteger(arguments[0])&&Number.isInteger(arguments[1])){var E=arguments[0],T=arguments[1];this._coordinates=new Array(E).fill(null),this._dimension=T;for(var U=0;U<E;U++)this._coordinates[U]=new L}}},no={serialVersionUID:{configurable:!0}};he.prototype.setOrdinate=function(n,i,s){switch(i){case dt.X:this._coordinates[n].x=s;break;case dt.Y:this._coordinates[n].y=s;break;case dt.Z:this._coordinates[n].z=s;break;default:throw new C("invalid ordinateIndex")}},he.prototype.size=function(){return this._coordinates.length},he.prototype.getOrdinate=function(n,i){switch(i){case dt.X:return this._coordinates[n].x;case dt.Y:return this._coordinates[n].y;case dt.Z:return this._coordinates[n].z}return S.NaN},he.prototype.getCoordinate=function(){if(arguments.length===1){var n=arguments[0];return this._coordinates[n]}if(arguments.length===2){var i=arguments[0],s=arguments[1];s.x=this._coordinates[i].x,s.y=this._coordinates[i].y,s.z=this._coordinates[i].z}},he.prototype.getCoordinateCopy=function(n){return new L(this._coordinates[n])},he.prototype.getDimension=function(){return this._dimension},he.prototype.getX=function(n){return this._coordinates[n].x},he.prototype.clone=function(){for(var n=new Array(this.size()).fill(null),i=0;i<this._coordinates.length;i++)n[i]=this._coordinates[i].clone();return new he(n,this._dimension)},he.prototype.expandEnvelope=function(n){for(var i=0;i<this._coordinates.length;i++)n.expandToInclude(this._coordinates[i]);return n},he.prototype.copy=function(){for(var n=new Array(this.size()).fill(null),i=0;i<this._coordinates.length;i++)n[i]=this._coordinates[i].copy();return new he(n,this._dimension)},he.prototype.toString=function(){if(this._coordinates.length>0){var n=new pt(17*this._coordinates.length);n.append("("),n.append(this._coordinates[0]);for(var i=1;i<this._coordinates.length;i++)n.append(", "),n.append(this._coordinates[i]);return n.append(")"),n.toString()}return"()"},he.prototype.getY=function(n){return this._coordinates[n].y},he.prototype.toCoordinateArray=function(){return this._coordinates},he.prototype.interfaces_=function(){return[dt,t]},he.prototype.getClass=function(){return he},no.serialVersionUID.get=function(){return-0xcb44a778db18e00},Object.defineProperties(he,no);var ri=function(){},Eo={serialVersionUID:{configurable:!0},instanceObject:{configurable:!0}};ri.prototype.readResolve=function(){return ri.instance()},ri.prototype.create=function(){if(arguments.length===1){if(arguments[0]instanceof Array){var n=arguments[0];return new he(n)}if(X(arguments[0],dt)){var i=arguments[0];return new he(i)}}else if(arguments.length===2){var s=arguments[0],u=arguments[1];return u>3&&(u=3),u<2?new he(s):new he(s,u)}},ri.prototype.interfaces_=function(){return[nt,t]},ri.prototype.getClass=function(){return ri},ri.instance=function(){return ri.instanceObject},Eo.serialVersionUID.get=function(){return-0x38e49fa6cf6f2e00},Eo.instanceObject.get=function(){return new ri},Object.defineProperties(ri,Eo);var ia=function(n){function i(){n.call(this),this.map_=new Map}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.get=function(s){return this.map_.get(s)||null},i.prototype.put=function(s,u){return this.map_.set(s,u),u},i.prototype.values=function(){for(var s=new j,u=this.map_.values(),c=u.next();!c.done;)s.add(c.value),c=u.next();return s},i.prototype.entrySet=function(){var s=new $n;return this.map_.entries().forEach(function(u){return s.add(u)}),s},i.prototype.size=function(){return this.map_.size()},i}(He),ie=function n(){if(this._modelType=null,this._scale=null,arguments.length===0)this._modelType=n.FLOATING;else if(arguments.length===1){if(arguments[0]instanceof Lr){var i=arguments[0];this._modelType=i,i===n.FIXED&&this.setScale(1)}else if(typeof arguments[0]=="number"){var s=arguments[0];this._modelType=n.FIXED,this.setScale(s)}else if(arguments[0]instanceof n){var u=arguments[0];this._modelType=u._modelType,this._scale=u._scale}}},Ui={serialVersionUID:{configurable:!0},maximumPreciseValue:{configurable:!0}};ie.prototype.equals=function(n){if(!(n instanceof ie))return!1;var i=n;return this._modelType===i._modelType&&this._scale===i._scale},ie.prototype.compareTo=function(n){var i=n,s=this.getMaximumSignificantDigits(),u=i.getMaximumSignificantDigits();return new et(s).compareTo(new et(u))},ie.prototype.getScale=function(){return this._scale},ie.prototype.isFloating=function(){return this._modelType===ie.FLOATING||this._modelType===ie.FLOATING_SINGLE},ie.prototype.getType=function(){return this._modelType},ie.prototype.toString=function(){var n="UNKNOWN";return this._modelType===ie.FLOATING?n="Floating":this._modelType===ie.FLOATING_SINGLE?n="Floating-Single":this._modelType===ie.FIXED&&(n="Fixed (Scale="+this.getScale()+")"),n},ie.prototype.makePrecise=function(){if(typeof arguments[0]=="number"){var n=arguments[0];return S.isNaN(n)||this._modelType===ie.FLOATING_SINGLE?n:this._modelType===ie.FIXED?Math.round(n*this._scale)/this._scale:n}if(arguments[0]instanceof L){var i=arguments[0];if(this._modelType===ie.FLOATING)return null;i.x=this.makePrecise(i.x),i.y=this.makePrecise(i.y)}},ie.prototype.getMaximumSignificantDigits=function(){var n=16;return this._modelType===ie.FLOATING?n=16:this._modelType===ie.FLOATING_SINGLE?n=6:this._modelType===ie.FIXED&&(n=1+Math.trunc(Math.ceil(Math.log(this.getScale())/Math.log(10)))),n},ie.prototype.setScale=function(n){this._scale=Math.abs(n)},ie.prototype.interfaces_=function(){return[t,F]},ie.prototype.getClass=function(){return ie},ie.mostPrecise=function(n,i){return n.compareTo(i)>=0?n:i},Ui.serialVersionUID.get=function(){return 7777263578777804e3},Ui.maximumPreciseValue.get=function(){return 9007199254740992},Object.defineProperties(ie,Ui);var Lr=function n(i){this._name=i||null,n.nameToTypeMap.put(i,this)},xr={serialVersionUID:{configurable:!0},nameToTypeMap:{configurable:!0}};Lr.prototype.readResolve=function(){return Lr.nameToTypeMap.get(this._name)},Lr.prototype.toString=function(){return this._name},Lr.prototype.interfaces_=function(){return[t]},Lr.prototype.getClass=function(){return Lr},xr.serialVersionUID.get=function(){return-552860263173159e4},xr.nameToTypeMap.get=function(){return new ia},Object.defineProperties(Lr,xr),ie.Type=Lr,ie.FIXED=new Lr("FIXED"),ie.FLOATING=new Lr("FLOATING"),ie.FLOATING_SINGLE=new Lr("FLOATING SINGLE");var le=function n(){this._precisionModel=new ie,this._SRID=0,this._coordinateSequenceFactory=n.getDefaultCoordinateSequenceFactory(),arguments.length===0||(arguments.length===1?X(arguments[0],nt)?this._coordinateSequenceFactory=arguments[0]:arguments[0]instanceof ie&&(this._precisionModel=arguments[0]):arguments.length===2?(this._precisionModel=arguments[0],this._SRID=arguments[1]):arguments.length===3&&(this._precisionModel=arguments[0],this._SRID=arguments[1],this._coordinateSequenceFactory=arguments[2]))},gl={serialVersionUID:{configurable:!0}};le.prototype.toGeometry=function(n){return n.isNull()?this.createPoint(null):n.getMinX()===n.getMaxX()&&n.getMinY()===n.getMaxY()?this.createPoint(new L(n.getMinX(),n.getMinY())):n.getMinX()===n.getMaxX()||n.getMinY()===n.getMaxY()?this.createLineString([new L(n.getMinX(),n.getMinY()),new L(n.getMaxX(),n.getMaxY())]):this.createPolygon(this.createLinearRing([new L(n.getMinX(),n.getMinY()),new L(n.getMinX(),n.getMaxY()),new L(n.getMaxX(),n.getMaxY()),new L(n.getMaxX(),n.getMinY()),new L(n.getMinX(),n.getMinY())]),null)},le.prototype.createLineString=function(n){return n?n instanceof Array?new Bt(this.getCoordinateSequenceFactory().create(n),this):X(n,dt)?new Bt(n,this):void 0:new Bt(this.getCoordinateSequenceFactory().create([]),this)},le.prototype.createMultiLineString=function(){if(arguments.length===0)return new H(null,this);if(arguments.length===1){var n=arguments[0];return new H(n,this)}},le.prototype.buildGeometry=function(n){for(var i=null,s=!1,u=!1,c=n.iterator();c.hasNext();){var m=c.next(),E=m.getClass();i===null&&(i=E),E!==i&&(s=!0),m.isGeometryCollectionOrDerived()&&(u=!0)}if(i===null)return this.createGeometryCollection();if(s||u)return this.createGeometryCollection(le.toGeometryArray(n));var T=n.iterator().next();if(n.size()>1){if(T instanceof Vt)return this.createMultiPolygon(le.toPolygonArray(n));if(T instanceof Bt)return this.createMultiLineString(le.toLineStringArray(n));if(T instanceof Qt)return this.createMultiPoint(le.toPointArray(n));b.shouldNeverReachHere("Unhandled class: "+T.getClass().getName())}return T},le.prototype.createMultiPointFromCoords=function(n){return this.createMultiPoint(n!==null?this.getCoordinateSequenceFactory().create(n):null)},le.prototype.createPoint=function(){if(arguments.length===0)return this.createPoint(this.getCoordinateSequenceFactory().create([]));if(arguments.length===1){if(arguments[0]instanceof L){var n=arguments[0];return this.createPoint(n!==null?this.getCoordinateSequenceFactory().create([n]):null)}if(X(arguments[0],dt)){var i=arguments[0];return new Qt(i,this)}}},le.prototype.getCoordinateSequenceFactory=function(){return this._coordinateSequenceFactory},le.prototype.createPolygon=function(){if(arguments.length===0)return new Vt(null,null,this);if(arguments.length===1){if(X(arguments[0],dt)){var n=arguments[0];return this.createPolygon(this.createLinearRing(n))}if(arguments[0]instanceof Array){var i=arguments[0];return this.createPolygon(this.createLinearRing(i))}if(arguments[0]instanceof sn){var s=arguments[0];return this.createPolygon(s,null)}}else if(arguments.length===2){var u=arguments[0],c=arguments[1];return new Vt(u,c,this)}},le.prototype.getSRID=function(){return this._SRID},le.prototype.createGeometryCollection=function(){if(arguments.length===0)return new Vn(null,this);if(arguments.length===1){var n=arguments[0];return new Vn(n,this)}},le.prototype.createGeometry=function(n){return new vn(this).edit(n,{edit:function(){if(arguments.length===2){var i=arguments[0];return this._coordinateSequenceFactory.create(i)}}})},le.prototype.getPrecisionModel=function(){return this._precisionModel},le.prototype.createLinearRing=function(){if(arguments.length===0)return this.createLinearRing(this.getCoordinateSequenceFactory().create([]));if(arguments.length===1){if(arguments[0]instanceof Array){var n=arguments[0];return this.createLinearRing(n!==null?this.getCoordinateSequenceFactory().create(n):null)}if(X(arguments[0],dt)){var i=arguments[0];return new sn(i,this)}}},le.prototype.createMultiPolygon=function(){if(arguments.length===0)return new un(null,this);if(arguments.length===1){var n=arguments[0];return new un(n,this)}},le.prototype.createMultiPoint=function(){if(arguments.length===0)return new fe(null,this);if(arguments.length===1){if(arguments[0]instanceof Array){var n=arguments[0];return new fe(n,this)}if(arguments[0]instanceof Array){var i=arguments[0];return this.createMultiPoint(i!==null?this.getCoordinateSequenceFactory().create(i):null)}if(X(arguments[0],dt)){var s=arguments[0];if(s===null)return this.createMultiPoint(new Array(0).fill(null));for(var u=new Array(s.size()).fill(null),c=0;c<s.size();c++){var m=this.getCoordinateSequenceFactory().create(1,s.getDimension());It.copy(s,c,m,0,1),u[c]=this.createPoint(m)}return this.createMultiPoint(u)}}},le.prototype.interfaces_=function(){return[t]},le.prototype.getClass=function(){return le},le.toMultiPolygonArray=function(n){var i=new Array(n.size()).fill(null);return n.toArray(i)},le.toGeometryArray=function(n){if(n===null)return null;var i=new Array(n.size()).fill(null);return n.toArray(i)},le.getDefaultCoordinateSequenceFactory=function(){return ri.instance()},le.toMultiLineStringArray=function(n){var i=new Array(n.size()).fill(null);return n.toArray(i)},le.toLineStringArray=function(n){var i=new Array(n.size()).fill(null);return n.toArray(i)},le.toMultiPointArray=function(n){var i=new Array(n.size()).fill(null);return n.toArray(i)},le.toLinearRingArray=function(n){var i=new Array(n.size()).fill(null);return n.toArray(i)},le.toPointArray=function(n){var i=new Array(n.size()).fill(null);return n.toArray(i)},le.toPolygonArray=function(n){var i=new Array(n.size()).fill(null);return n.toArray(i)},le.createPointFromInternalCoord=function(n,i){return i.getPrecisionModel().makePrecise(n),i.getFactory().createPoint(n)},gl.serialVersionUID.get=function(){return-6820524753094096e3},Object.defineProperties(le,gl);var yl=["Point","MultiPoint","LineString","MultiLineString","Polygon","MultiPolygon"],vl=function(n){this.geometryFactory=n||new le};vl.prototype.read=function(n){var i,s=(i=typeof n=="string"?JSON.parse(n):n).type;if(!Si[s])throw new Error("Unknown GeoJSON type: "+i.type);return yl.indexOf(s)!==-1?Si[s].apply(this,[i.coordinates]):s==="GeometryCollection"?Si[s].apply(this,[i.geometries]):Si[s].apply(this,[i])},vl.prototype.write=function(n){var i=n.getGeometryType();if(!ro[i])throw new Error("Geometry is not supported");return ro[i].apply(this,[n])};var Si={Feature:function(n){var i={};for(var s in n)i[s]=n[s];if(n.geometry){var u=n.geometry.type;if(!Si[u])throw new Error("Unknown GeoJSON type: "+n.type);i.geometry=this.read(n.geometry)}return n.bbox&&(i.bbox=Si.bbox.apply(this,[n.bbox])),i},FeatureCollection:function(n){var i={};if(n.features){i.features=[];for(var s=0;s<n.features.length;++s)i.features.push(this.read(n.features[s]))}return n.bbox&&(i.bbox=this.parse.bbox.apply(this,[n.bbox])),i},coordinates:function(n){for(var i=[],s=0;s<n.length;++s){var u=n[s];i.push(new L(u[0],u[1]))}return i},bbox:function(n){return this.geometryFactory.createLinearRing([new L(n[0],n[1]),new L(n[2],n[1]),new L(n[2],n[3]),new L(n[0],n[3]),new L(n[0],n[1])])},Point:function(n){var i=new L(n[0],n[1]);return this.geometryFactory.createPoint(i)},MultiPoint:function(n){for(var i=[],s=0;s<n.length;++s)i.push(Si.Point.apply(this,[n[s]]));return this.geometryFactory.createMultiPoint(i)},LineString:function(n){var i=Si.coordinates.apply(this,[n]);return this.geometryFactory.createLineString(i)},MultiLineString:function(n){for(var i=[],s=0;s<n.length;++s)i.push(Si.LineString.apply(this,[n[s]]));return this.geometryFactory.createMultiLineString(i)},Polygon:function(n){for(var i=Si.coordinates.apply(this,[n[0]]),s=this.geometryFactory.createLinearRing(i),u=[],c=1;c<n.length;++c){var m=n[c],E=Si.coordinates.apply(this,[m]),T=this.geometryFactory.createLinearRing(E);u.push(T)}return this.geometryFactory.createPolygon(s,u)},MultiPolygon:function(n){for(var i=[],s=0;s<n.length;++s){var u=n[s];i.push(Si.Polygon.apply(this,[u]))}return this.geometryFactory.createMultiPolygon(i)},GeometryCollection:function(n){for(var i=[],s=0;s<n.length;++s){var u=n[s];i.push(this.read(u))}return this.geometryFactory.createGeometryCollection(i)}},ro={coordinate:function(n){return[n.x,n.y]},Point:function(n){return{type:"Point",coordinates:ro.coordinate.apply(this,[n.getCoordinate()])}},MultiPoint:function(n){for(var i=[],s=0;s<n._geometries.length;++s){var u=n._geometries[s],c=ro.Point.apply(this,[u]);i.push(c.coordinates)}return{type:"MultiPoint",coordinates:i}},LineString:function(n){for(var i=[],s=n.getCoordinates(),u=0;u<s.length;++u){var c=s[u];i.push(ro.coordinate.apply(this,[c]))}return{type:"LineString",coordinates:i}},MultiLineString:function(n){for(var i=[],s=0;s<n._geometries.length;++s){var u=n._geometries[s],c=ro.LineString.apply(this,[u]);i.push(c.coordinates)}return{type:"MultiLineString",coordinates:i}},Polygon:function(n){var i=[],s=ro.LineString.apply(this,[n._shell]);i.push(s.coordinates);for(var u=0;u<n._holes.length;++u){var c=n._holes[u],m=ro.LineString.apply(this,[c]);i.push(m.coordinates)}return{type:"Polygon",coordinates:i}},MultiPolygon:function(n){for(var i=[],s=0;s<n._geometries.length;++s){var u=n._geometries[s],c=ro.Polygon.apply(this,[u]);i.push(c.coordinates)}return{type:"MultiPolygon",coordinates:i}},GeometryCollection:function(n){for(var i=[],s=0;s<n._geometries.length;++s){var u=n._geometries[s],c=u.getGeometryType();i.push(ro[c].apply(this,[u]))}return{type:"GeometryCollection",geometries:i}}},gf=function(n){this.geometryFactory=n||new le,this.precisionModel=this.geometryFactory.getPrecisionModel(),this.parser=new vl(this.geometryFactory)};gf.prototype.read=function(n){var i=this.parser.read(n);return this.precisionModel.getType()===ie.FIXED&&this.reducePrecision(i),i},gf.prototype.reducePrecision=function(n){var i,s;if(n.coordinate)this.precisionModel.makePrecise(n.coordinate);else if(n.points)for(i=0,s=n.points.length;i<s;i++)this.precisionModel.makePrecise(n.points[i]);else if(n.geometries)for(i=0,s=n.geometries.length;i<s;i++)this.reducePrecision(n.geometries[i])};var Hd=function(){this.parser=new vl(this.geometryFactory)};Hd.prototype.write=function(n){return this.parser.write(n)};var bt=function(){},_l={ON:{configurable:!0},LEFT:{configurable:!0},RIGHT:{configurable:!0}};bt.prototype.interfaces_=function(){return[]},bt.prototype.getClass=function(){return bt},bt.opposite=function(n){return n===bt.LEFT?bt.RIGHT:n===bt.RIGHT?bt.LEFT:n},_l.ON.get=function(){return 0},_l.LEFT.get=function(){return 1},_l.RIGHT.get=function(){return 2},Object.defineProperties(bt,_l),(A.prototype=new Error).name="EmptyStackException",(x.prototype=new wt).add=function(n){return this.array_.push(n),!0},x.prototype.get=function(n){if(n<0||n>=this.size())throw new Error;return this.array_[n]},x.prototype.push=function(n){return this.array_.push(n),n},x.prototype.pop=function(n){if(this.array_.length===0)throw new A;return this.array_.pop()},x.prototype.peek=function(){if(this.array_.length===0)throw new A;return this.array_[this.array_.length-1]},x.prototype.empty=function(){return this.array_.length===0},x.prototype.isEmpty=function(){return this.empty()},x.prototype.search=function(n){return this.array_.indexOf(n)},x.prototype.size=function(){return this.array_.length},x.prototype.toArray=function(){for(var n=[],i=0,s=this.array_.length;i<s;i++)n.push(this.array_[i]);return n};var wi=function(){this._minIndex=-1,this._minCoord=null,this._minDe=null,this._orientedDe=null};wi.prototype.getCoordinate=function(){return this._minCoord},wi.prototype.getRightmostSide=function(n,i){var s=this.getRightmostSideOfSegment(n,i);return s<0&&(s=this.getRightmostSideOfSegment(n,i-1)),s<0&&(this._minCoord=null,this.checkForRightmostCoordinate(n)),s},wi.prototype.findRightmostEdgeAtVertex=function(){var n=this._minDe.getEdge().getCoordinates();b.isTrue(this._minIndex>0&&this._minIndex<n.length,"rightmost point expected to be interior vertex of edge");var i=n[this._minIndex-1],s=n[this._minIndex+1],u=B.computeOrientation(this._minCoord,s,i),c=!1;(i.y<this._minCoord.y&&s.y<this._minCoord.y&&u===B.COUNTERCLOCKWISE||i.y>this._minCoord.y&&s.y>this._minCoord.y&&u===B.CLOCKWISE)&&(c=!0),c&&(this._minIndex=this._minIndex-1)},wi.prototype.getRightmostSideOfSegment=function(n,i){var s=n.getEdge().getCoordinates();if(i<0||i+1>=s.length||s[i].y===s[i+1].y)return-1;var u=bt.LEFT;return s[i].y<s[i+1].y&&(u=bt.RIGHT),u},wi.prototype.getEdge=function(){return this._orientedDe},wi.prototype.checkForRightmostCoordinate=function(n){for(var i=n.getEdge().getCoordinates(),s=0;s<i.length-1;s++)(this._minCoord===null||i[s].x>this._minCoord.x)&&(this._minDe=n,this._minIndex=s,this._minCoord=i[s])},wi.prototype.findRightmostEdgeAtNode=function(){var n=this._minDe.getNode().getEdges();this._minDe=n.getRightmostEdge(),this._minDe.isForward()||(this._minDe=this._minDe.getSym(),this._minIndex=this._minDe.getEdge().getCoordinates().length-1)},wi.prototype.findEdge=function(n){for(var i=n.iterator();i.hasNext();){var s=i.next();s.isForward()&&this.checkForRightmostCoordinate(s)}b.isTrue(this._minIndex!==0||this._minCoord.equals(this._minDe.getCoordinate()),"inconsistency in rightmost processing"),this._minIndex===0?this.findRightmostEdgeAtNode():this.findRightmostEdgeAtVertex(),this._orientedDe=this._minDe,this.getRightmostSide(this._minDe,this._minIndex)===bt.LEFT&&(this._orientedDe=this._minDe.getSym())},wi.prototype.interfaces_=function(){return[]},wi.prototype.getClass=function(){return wi};var io=function(n){function i(s,u){n.call(this,i.msgWithCoord(s,u)),this.pt=u?new L(u):null,this.name="TopologyException"}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.getCoordinate=function(){return this.pt},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i.msgWithCoord=function(s,u){return u?s:s+" [ "+u+" ]"},i}($),xl=function(){this.array_=[]};xl.prototype.addLast=function(n){this.array_.push(n)},xl.prototype.removeFirst=function(){return this.array_.shift()},xl.prototype.isEmpty=function(){return this.array_.length===0};var sr=function(){this._finder=null,this._dirEdgeList=new j,this._nodes=new j,this._rightMostCoord=null,this._env=null,this._finder=new wi};sr.prototype.clearVisitedEdges=function(){for(var n=this._dirEdgeList.iterator();n.hasNext();)n.next().setVisited(!1)},sr.prototype.getRightmostCoordinate=function(){return this._rightMostCoord},sr.prototype.computeNodeDepth=function(n){for(var i=null,s=n.getEdges().iterator();s.hasNext();){var u=s.next();if(u.isVisited()||u.getSym().isVisited()){i=u;break}}if(i===null)throw new io("unable to find edge to compute depths at "+n.getCoordinate());n.getEdges().computeDepths(i);for(var c=n.getEdges().iterator();c.hasNext();){var m=c.next();m.setVisited(!0),this.copySymDepths(m)}},sr.prototype.computeDepth=function(n){this.clearVisitedEdges();var i=this._finder.getEdge();i.setEdgeDepths(bt.RIGHT,n),this.copySymDepths(i),this.computeDepths(i)},sr.prototype.create=function(n){this.addReachable(n),this._finder.findEdge(this._dirEdgeList),this._rightMostCoord=this._finder.getCoordinate()},sr.prototype.findResultEdges=function(){for(var n=this._dirEdgeList.iterator();n.hasNext();){var i=n.next();i.getDepth(bt.RIGHT)>=1&&i.getDepth(bt.LEFT)<=0&&!i.isInteriorAreaEdge()&&i.setInResult(!0)}},sr.prototype.computeDepths=function(n){var i=new $n,s=new xl,u=n.getNode();for(s.addLast(u),i.add(u),n.setVisited(!0);!s.isEmpty();){var c=s.removeFirst();i.add(c),this.computeNodeDepth(c);for(var m=c.getEdges().iterator();m.hasNext();){var E=m.next().getSym();if(!E.isVisited()){var T=E.getNode();i.contains(T)||(s.addLast(T),i.add(T))}}}},sr.prototype.compareTo=function(n){var i=n;return this._rightMostCoord.x<i._rightMostCoord.x?-1:this._rightMostCoord.x>i._rightMostCoord.x?1:0},sr.prototype.getEnvelope=function(){if(this._env===null){for(var n=new Pt,i=this._dirEdgeList.iterator();i.hasNext();)for(var s=i.next().getEdge().getCoordinates(),u=0;u<s.length-1;u++)n.expandToInclude(s[u]);this._env=n}return this._env},sr.prototype.addReachable=function(n){var i=new x;for(i.add(n);!i.empty();){var s=i.pop();this.add(s,i)}},sr.prototype.copySymDepths=function(n){var i=n.getSym();i.setDepth(bt.LEFT,n.getDepth(bt.RIGHT)),i.setDepth(bt.RIGHT,n.getDepth(bt.LEFT))},sr.prototype.add=function(n,i){n.setVisited(!0),this._nodes.add(n);for(var s=n.getEdges().iterator();s.hasNext();){var u=s.next();this._dirEdgeList.add(u);var c=u.getSym().getNode();c.isVisited()||i.push(c)}},sr.prototype.getNodes=function(){return this._nodes},sr.prototype.getDirectedEdges=function(){return this._dirEdgeList},sr.prototype.interfaces_=function(){return[F]},sr.prototype.getClass=function(){return sr};var hn=function n(){if(this.location=null,arguments.length===1){if(arguments[0]instanceof Array){var i=arguments[0];this.init(i.length)}else if(Number.isInteger(arguments[0])){var s=arguments[0];this.init(1),this.location[bt.ON]=s}else if(arguments[0]instanceof n){var u=arguments[0];if(this.init(u.location.length),u!==null)for(var c=0;c<this.location.length;c++)this.location[c]=u.location[c]}}else if(arguments.length===3){var m=arguments[0],E=arguments[1],T=arguments[2];this.init(3),this.location[bt.ON]=m,this.location[bt.LEFT]=E,this.location[bt.RIGHT]=T}};hn.prototype.setAllLocations=function(n){for(var i=0;i<this.location.length;i++)this.location[i]=n},hn.prototype.isNull=function(){for(var n=0;n<this.location.length;n++)if(this.location[n]!==k.NONE)return!1;return!0},hn.prototype.setAllLocationsIfNull=function(n){for(var i=0;i<this.location.length;i++)this.location[i]===k.NONE&&(this.location[i]=n)},hn.prototype.isLine=function(){return this.location.length===1},hn.prototype.merge=function(n){if(n.location.length>this.location.length){var i=new Array(3).fill(null);i[bt.ON]=this.location[bt.ON],i[bt.LEFT]=k.NONE,i[bt.RIGHT]=k.NONE,this.location=i}for(var s=0;s<this.location.length;s++)this.location[s]===k.NONE&&s<n.location.length&&(this.location[s]=n.location[s])},hn.prototype.getLocations=function(){return this.location},hn.prototype.flip=function(){if(this.location.length<=1)return null;var n=this.location[bt.LEFT];this.location[bt.LEFT]=this.location[bt.RIGHT],this.location[bt.RIGHT]=n},hn.prototype.toString=function(){var n=new pt;return this.location.length>1&&n.append(k.toLocationSymbol(this.location[bt.LEFT])),n.append(k.toLocationSymbol(this.location[bt.ON])),this.location.length>1&&n.append(k.toLocationSymbol(this.location[bt.RIGHT])),n.toString()},hn.prototype.setLocations=function(n,i,s){this.location[bt.ON]=n,this.location[bt.LEFT]=i,this.location[bt.RIGHT]=s},hn.prototype.get=function(n){return n<this.location.length?this.location[n]:k.NONE},hn.prototype.isArea=function(){return this.location.length>1},hn.prototype.isAnyNull=function(){for(var n=0;n<this.location.length;n++)if(this.location[n]===k.NONE)return!0;return!1},hn.prototype.setLocation=function(){if(arguments.length===1){var n=arguments[0];this.setLocation(bt.ON,n)}else if(arguments.length===2){var i=arguments[0],s=arguments[1];this.location[i]=s}},hn.prototype.init=function(n){this.location=new Array(n).fill(null),this.setAllLocations(k.NONE)},hn.prototype.isEqualOnSide=function(n,i){return this.location[i]===n.location[i]},hn.prototype.allPositionsEqual=function(n){for(var i=0;i<this.location.length;i++)if(this.location[i]!==n)return!1;return!0},hn.prototype.interfaces_=function(){return[]},hn.prototype.getClass=function(){return hn};var rn=function n(){if(this.elt=new Array(2).fill(null),arguments.length===1){if(Number.isInteger(arguments[0])){var i=arguments[0];this.elt[0]=new hn(i),this.elt[1]=new hn(i)}else if(arguments[0]instanceof n){var s=arguments[0];this.elt[0]=new hn(s.elt[0]),this.elt[1]=new hn(s.elt[1])}}else if(arguments.length===2){var u=arguments[0],c=arguments[1];this.elt[0]=new hn(k.NONE),this.elt[1]=new hn(k.NONE),this.elt[u].setLocation(c)}else if(arguments.length===3){var m=arguments[0],E=arguments[1],T=arguments[2];this.elt[0]=new hn(m,E,T),this.elt[1]=new hn(m,E,T)}else if(arguments.length===4){var U=arguments[0],Z=arguments[1],ut=arguments[2],ht=arguments[3];this.elt[0]=new hn(k.NONE,k.NONE,k.NONE),this.elt[1]=new hn(k.NONE,k.NONE,k.NONE),this.elt[U].setLocations(Z,ut,ht)}};rn.prototype.getGeometryCount=function(){var n=0;return this.elt[0].isNull()||n++,this.elt[1].isNull()||n++,n},rn.prototype.setAllLocations=function(n,i){this.elt[n].setAllLocations(i)},rn.prototype.isNull=function(n){return this.elt[n].isNull()},rn.prototype.setAllLocationsIfNull=function(){if(arguments.length===1){var n=arguments[0];this.setAllLocationsIfNull(0,n),this.setAllLocationsIfNull(1,n)}else if(arguments.length===2){var i=arguments[0],s=arguments[1];this.elt[i].setAllLocationsIfNull(s)}},rn.prototype.isLine=function(n){return this.elt[n].isLine()},rn.prototype.merge=function(n){for(var i=0;i<2;i++)this.elt[i]===null&&n.elt[i]!==null?this.elt[i]=new hn(n.elt[i]):this.elt[i].merge(n.elt[i])},rn.prototype.flip=function(){this.elt[0].flip(),this.elt[1].flip()},rn.prototype.getLocation=function(){if(arguments.length===1){var n=arguments[0];return this.elt[n].get(bt.ON)}if(arguments.length===2){var i=arguments[0],s=arguments[1];return this.elt[i].get(s)}},rn.prototype.toString=function(){var n=new pt;return this.elt[0]!==null&&(n.append("A:"),n.append(this.elt[0].toString())),this.elt[1]!==null&&(n.append(" B:"),n.append(this.elt[1].toString())),n.toString()},rn.prototype.isArea=function(){if(arguments.length===0)return this.elt[0].isArea()||this.elt[1].isArea();if(arguments.length===1){var n=arguments[0];return this.elt[n].isArea()}},rn.prototype.isAnyNull=function(n){return this.elt[n].isAnyNull()},rn.prototype.setLocation=function(){if(arguments.length===2){var n=arguments[0],i=arguments[1];this.elt[n].setLocation(bt.ON,i)}else if(arguments.length===3){var s=arguments[0],u=arguments[1],c=arguments[2];this.elt[s].setLocation(u,c)}},rn.prototype.isEqualOnSide=function(n,i){return this.elt[0].isEqualOnSide(n.elt[0],i)&&this.elt[1].isEqualOnSide(n.elt[1],i)},rn.prototype.allPositionsEqual=function(n,i){return this.elt[n].allPositionsEqual(i)},rn.prototype.toLine=function(n){this.elt[n].isArea()&&(this.elt[n]=new hn(this.elt[n].location[0]))},rn.prototype.interfaces_=function(){return[]},rn.prototype.getClass=function(){return rn},rn.toLineLabel=function(n){for(var i=new rn(k.NONE),s=0;s<2;s++)i.setLocation(s,n.getLocation(s));return i};var An=function(){this._startDe=null,this._maxNodeDegree=-1,this._edges=new j,this._pts=new j,this._label=new rn(k.NONE),this._ring=null,this._isHole=null,this._shell=null,this._holes=new j,this._geometryFactory=null;var n=arguments[0],i=arguments[1];this._geometryFactory=i,this.computePoints(n),this.computeRing()};An.prototype.computeRing=function(){if(this._ring!==null)return null;for(var n=new Array(this._pts.size()).fill(null),i=0;i<this._pts.size();i++)n[i]=this._pts.get(i);this._ring=this._geometryFactory.createLinearRing(n),this._isHole=B.isCCW(this._ring.getCoordinates())},An.prototype.isIsolated=function(){return this._label.getGeometryCount()===1},An.prototype.computePoints=function(n){this._startDe=n;var i=n,s=!0;do{if(i===null)throw new io("Found null DirectedEdge");if(i.getEdgeRing()===this)throw new io("Directed Edge visited twice during ring-building at "+i.getCoordinate());this._edges.add(i);var u=i.getLabel();b.isTrue(u.isArea()),this.mergeLabel(u),this.addPoints(i.getEdge(),i.isForward(),s),s=!1,this.setEdgeRing(i,this),i=this.getNext(i)}while(i!==this._startDe)},An.prototype.getLinearRing=function(){return this._ring},An.prototype.getCoordinate=function(n){return this._pts.get(n)},An.prototype.computeMaxNodeDegree=function(){this._maxNodeDegree=0;var n=this._startDe;do{var i=n.getNode().getEdges().getOutgoingDegree(this);i>this._maxNodeDegree&&(this._maxNodeDegree=i),n=this.getNext(n)}while(n!==this._startDe);this._maxNodeDegree*=2},An.prototype.addPoints=function(n,i,s){var u=n.getCoordinates();if(i){var c=1;s&&(c=0);for(var m=c;m<u.length;m++)this._pts.add(u[m])}else{var E=u.length-2;s&&(E=u.length-1);for(var T=E;T>=0;T--)this._pts.add(u[T])}},An.prototype.isHole=function(){return this._isHole},An.prototype.setInResult=function(){var n=this._startDe;do n.getEdge().setInResult(!0),n=n.getNext();while(n!==this._startDe)},An.prototype.containsPoint=function(n){var i=this.getLinearRing();if(!i.getEnvelopeInternal().contains(n)||!B.isPointInRing(n,i.getCoordinates()))return!1;for(var s=this._holes.iterator();s.hasNext();)if(s.next().containsPoint(n))return!1;return!0},An.prototype.addHole=function(n){this._holes.add(n)},An.prototype.isShell=function(){return this._shell===null},An.prototype.getLabel=function(){return this._label},An.prototype.getEdges=function(){return this._edges},An.prototype.getMaxNodeDegree=function(){return this._maxNodeDegree<0&&this.computeMaxNodeDegree(),this._maxNodeDegree},An.prototype.getShell=function(){return this._shell},An.prototype.mergeLabel=function(){if(arguments.length===1){var n=arguments[0];this.mergeLabel(n,0),this.mergeLabel(n,1)}else if(arguments.length===2){var i=arguments[0],s=arguments[1],u=i.getLocation(s,bt.RIGHT);if(u===k.NONE)return null;if(this._label.getLocation(s)===k.NONE)return this._label.setLocation(s,u),null}},An.prototype.setShell=function(n){this._shell=n,n!==null&&n.addHole(this)},An.prototype.toPolygon=function(n){for(var i=new Array(this._holes.size()).fill(null),s=0;s<this._holes.size();s++)i[s]=this._holes.get(s).getLinearRing();return n.createPolygon(this.getLinearRing(),i)},An.prototype.interfaces_=function(){return[]},An.prototype.getClass=function(){return An};var _1=function(n){function i(){var s=arguments[0],u=arguments[1];n.call(this,s,u)}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.setEdgeRing=function(s,u){s.setMinEdgeRing(u)},i.prototype.getNext=function(s){return s.getNextMin()},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(An),x1=function(n){function i(){var s=arguments[0],u=arguments[1];n.call(this,s,u)}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.buildMinimalRings=function(){var s=new j,u=this._startDe;do{if(u.getMinEdgeRing()===null){var c=new _1(u,this._geometryFactory);s.add(c)}u=u.getNext()}while(u!==this._startDe);return s},i.prototype.setEdgeRing=function(s,u){s.setEdgeRing(u)},i.prototype.linkDirectedEdgesForMinimalEdgeRings=function(){var s=this._startDe;do s.getNode().getEdges().linkMinimalDirectedEdges(this),s=s.getNext();while(s!==this._startDe)},i.prototype.getNext=function(s){return s.getNext()},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(An),Hr=function(){if(this._label=null,this._isInResult=!1,this._isCovered=!1,this._isCoveredSet=!1,this._isVisited=!1,arguments.length!==0){if(arguments.length===1){var n=arguments[0];this._label=n}}};Hr.prototype.setVisited=function(n){this._isVisited=n},Hr.prototype.setInResult=function(n){this._isInResult=n},Hr.prototype.isCovered=function(){return this._isCovered},Hr.prototype.isCoveredSet=function(){return this._isCoveredSet},Hr.prototype.setLabel=function(n){this._label=n},Hr.prototype.getLabel=function(){return this._label},Hr.prototype.setCovered=function(n){this._isCovered=n,this._isCoveredSet=!0},Hr.prototype.updateIM=function(n){b.isTrue(this._label.getGeometryCount()>=2,"found partial label"),this.computeIM(n)},Hr.prototype.isInResult=function(){return this._isInResult},Hr.prototype.isVisited=function(){return this._isVisited},Hr.prototype.interfaces_=function(){return[]},Hr.prototype.getClass=function(){return Hr};var El=function(n){function i(){n.call(this),this._coord=null,this._edges=null;var s=arguments[0],u=arguments[1];this._coord=s,this._edges=u,this._label=new rn(0,k.NONE)}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.isIncidentEdgeInResult=function(){for(var s=this.getEdges().getEdges().iterator();s.hasNext();)if(s.next().getEdge().isInResult())return!0;return!1},i.prototype.isIsolated=function(){return this._label.getGeometryCount()===1},i.prototype.getCoordinate=function(){return this._coord},i.prototype.print=function(s){s.println("node "+this._coord+" lbl: "+this._label)},i.prototype.computeIM=function(s){},i.prototype.computeMergedLocation=function(s,u){var c=k.NONE;if(c=this._label.getLocation(u),!s.isNull(u)){var m=s.getLocation(u);c!==k.BOUNDARY&&(c=m)}return c},i.prototype.setLabel=function(){if(arguments.length!==2)return n.prototype.setLabel.apply(this,arguments);var s=arguments[0],u=arguments[1];this._label===null?this._label=new rn(s,u):this._label.setLocation(s,u)},i.prototype.getEdges=function(){return this._edges},i.prototype.mergeLabel=function(){if(arguments[0]instanceof i){var s=arguments[0];this.mergeLabel(s._label)}else if(arguments[0]instanceof rn)for(var u=arguments[0],c=0;c<2;c++){var m=this.computeMergedLocation(u,c);this._label.getLocation(c)===k.NONE&&this._label.setLocation(c,m)}},i.prototype.add=function(s){this._edges.insert(s),s.setNode(this)},i.prototype.setLabelBoundary=function(s){if(this._label===null)return null;var u=k.NONE;this._label!==null&&(u=this._label.getLocation(s));var c=null;switch(u){case k.BOUNDARY:c=k.INTERIOR;break;case k.INTERIOR:default:c=k.BOUNDARY}this._label.setLocation(s,c)},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(Hr),bi=function(){this.nodeMap=new _,this.nodeFact=null;var n=arguments[0];this.nodeFact=n};bi.prototype.find=function(n){return this.nodeMap.get(n)},bi.prototype.addNode=function(){if(arguments[0]instanceof L){var n=arguments[0],i=this.nodeMap.get(n);return i===null&&(i=this.nodeFact.createNode(n),this.nodeMap.put(n,i)),i}if(arguments[0]instanceof El){var s=arguments[0],u=this.nodeMap.get(s.getCoordinate());return u===null?(this.nodeMap.put(s.getCoordinate(),s),s):(u.mergeLabel(s),u)}},bi.prototype.print=function(n){for(var i=this.iterator();i.hasNext();)i.next().print(n)},bi.prototype.iterator=function(){return this.nodeMap.values().iterator()},bi.prototype.values=function(){return this.nodeMap.values()},bi.prototype.getBoundaryNodes=function(n){for(var i=new j,s=this.iterator();s.hasNext();){var u=s.next();u.getLabel().getLocation(n)===k.BOUNDARY&&i.add(u)}return i},bi.prototype.add=function(n){var i=n.getCoordinate();this.addNode(i).add(n)},bi.prototype.interfaces_=function(){return[]},bi.prototype.getClass=function(){return bi};var ln=function(){},mu={NE:{configurable:!0},NW:{configurable:!0},SW:{configurable:!0},SE:{configurable:!0}};ln.prototype.interfaces_=function(){return[]},ln.prototype.getClass=function(){return ln},ln.isNorthern=function(n){return n===ln.NE||n===ln.NW},ln.isOpposite=function(n,i){return n===i?!1:(n-i+4)%4===2},ln.commonHalfPlane=function(n,i){if(n===i)return n;if((n-i+4)%4===2)return-1;var s=n<i?n:i;return s===0&&(n>i?n:i)===3?3:s},ln.isInHalfPlane=function(n,i){return i===ln.SE?n===ln.SE||n===ln.SW:n===i||n===i+1},ln.quadrant=function(){if(typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var n=arguments[0],i=arguments[1];if(n===0&&i===0)throw new C("Cannot compute the quadrant for point ( "+n+", "+i+" )");return n>=0?i>=0?ln.NE:ln.SE:i>=0?ln.NW:ln.SW}if(arguments[0]instanceof L&&arguments[1]instanceof L){var s=arguments[0],u=arguments[1];if(u.x===s.x&&u.y===s.y)throw new C("Cannot compute the quadrant for two identical points "+s);return u.x>=s.x?u.y>=s.y?ln.NE:ln.SE:u.y>=s.y?ln.NW:ln.SW}},mu.NE.get=function(){return 0},mu.NW.get=function(){return 1},mu.SW.get=function(){return 2},mu.SE.get=function(){return 3},Object.defineProperties(ln,mu);var Kn=function(){if(this._edge=null,this._label=null,this._node=null,this._p0=null,this._p1=null,this._dx=null,this._dy=null,this._quadrant=null,arguments.length===1){var n=arguments[0];this._edge=n}else if(arguments.length===3){var i=arguments[0],s=arguments[1],u=arguments[2];this._edge=i,this.init(s,u),this._label=null}else if(arguments.length===4){var c=arguments[0],m=arguments[1],E=arguments[2],T=arguments[3];this._edge=c,this.init(m,E),this._label=T}};Kn.prototype.compareDirection=function(n){return this._dx===n._dx&&this._dy===n._dy?0:this._quadrant>n._quadrant?1:this._quadrant<n._quadrant?-1:B.computeOrientation(n._p0,n._p1,this._p1)},Kn.prototype.getDy=function(){return this._dy},Kn.prototype.getCoordinate=function(){return this._p0},Kn.prototype.setNode=function(n){this._node=n},Kn.prototype.print=function(n){var i=Math.atan2(this._dy,this._dx),s=this.getClass().getName(),u=s.lastIndexOf("."),c=s.substring(u+1);n.print(" "+c+": "+this._p0+" - "+this._p1+" "+this._quadrant+":"+i+" "+this._label)},Kn.prototype.compareTo=function(n){var i=n;return this.compareDirection(i)},Kn.prototype.getDirectedCoordinate=function(){return this._p1},Kn.prototype.getDx=function(){return this._dx},Kn.prototype.getLabel=function(){return this._label},Kn.prototype.getEdge=function(){return this._edge},Kn.prototype.getQuadrant=function(){return this._quadrant},Kn.prototype.getNode=function(){return this._node},Kn.prototype.toString=function(){var n=Math.atan2(this._dy,this._dx),i=this.getClass().getName(),s=i.lastIndexOf(".");return" "+i.substring(s+1)+": "+this._p0+" - "+this._p1+" "+this._quadrant+":"+n+" "+this._label},Kn.prototype.computeLabel=function(n){},Kn.prototype.init=function(n,i){this._p0=n,this._p1=i,this._dx=i.x-n.x,this._dy=i.y-n.y,this._quadrant=ln.quadrant(this._dx,this._dy),b.isTrue(!(this._dx===0&&this._dy===0),"EdgeEnd with identical endpoints found")},Kn.prototype.interfaces_=function(){return[F]},Kn.prototype.getClass=function(){return Kn};var yf=function(n){function i(){var s=arguments[0],u=arguments[1];if(n.call(this,s),this._isForward=null,this._isInResult=!1,this._isVisited=!1,this._sym=null,this._next=null,this._nextMin=null,this._edgeRing=null,this._minEdgeRing=null,this._depth=[0,-999,-999],this._isForward=u,u)this.init(s.getCoordinate(0),s.getCoordinate(1));else{var c=s.getNumPoints()-1;this.init(s.getCoordinate(c),s.getCoordinate(c-1))}this.computeDirectedLabel()}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.getNextMin=function(){return this._nextMin},i.prototype.getDepth=function(s){return this._depth[s]},i.prototype.setVisited=function(s){this._isVisited=s},i.prototype.computeDirectedLabel=function(){this._label=new rn(this._edge.getLabel()),this._isForward||this._label.flip()},i.prototype.getNext=function(){return this._next},i.prototype.setDepth=function(s,u){if(this._depth[s]!==-999&&this._depth[s]!==u)throw new io("assigned depths do not match",this.getCoordinate());this._depth[s]=u},i.prototype.isInteriorAreaEdge=function(){for(var s=!0,u=0;u<2;u++)this._label.isArea(u)&&this._label.getLocation(u,bt.LEFT)===k.INTERIOR&&this._label.getLocation(u,bt.RIGHT)===k.INTERIOR||(s=!1);return s},i.prototype.setNextMin=function(s){this._nextMin=s},i.prototype.print=function(s){n.prototype.print.call(this,s),s.print(" "+this._depth[bt.LEFT]+"/"+this._depth[bt.RIGHT]),s.print(" ("+this.getDepthDelta()+")"),this._isInResult&&s.print(" inResult")},i.prototype.setMinEdgeRing=function(s){this._minEdgeRing=s},i.prototype.isLineEdge=function(){var s=this._label.isLine(0)||this._label.isLine(1),u=!this._label.isArea(0)||this._label.allPositionsEqual(0,k.EXTERIOR),c=!this._label.isArea(1)||this._label.allPositionsEqual(1,k.EXTERIOR);return s&&u&&c},i.prototype.setEdgeRing=function(s){this._edgeRing=s},i.prototype.getMinEdgeRing=function(){return this._minEdgeRing},i.prototype.getDepthDelta=function(){var s=this._edge.getDepthDelta();return this._isForward||(s=-s),s},i.prototype.setInResult=function(s){this._isInResult=s},i.prototype.getSym=function(){return this._sym},i.prototype.isForward=function(){return this._isForward},i.prototype.getEdge=function(){return this._edge},i.prototype.printEdge=function(s){this.print(s),s.print(" "),this._isForward?this._edge.print(s):this._edge.printReverse(s)},i.prototype.setSym=function(s){this._sym=s},i.prototype.setVisitedEdge=function(s){this.setVisited(s),this._sym.setVisited(s)},i.prototype.setEdgeDepths=function(s,u){var c=this.getEdge().getDepthDelta();this._isForward||(c=-c);var m=1;s===bt.LEFT&&(m=-1);var E=bt.opposite(s),T=u+c*m;this.setDepth(s,u),this.setDepth(E,T)},i.prototype.getEdgeRing=function(){return this._edgeRing},i.prototype.isInResult=function(){return this._isInResult},i.prototype.setNext=function(s){this._next=s},i.prototype.isVisited=function(){return this._isVisited},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i.depthFactor=function(s,u){return s===k.EXTERIOR&&u===k.INTERIOR?1:s===k.INTERIOR&&u===k.EXTERIOR?-1:0},i}(Kn),oa=function(){};oa.prototype.createNode=function(n){return new El(n,null)},oa.prototype.interfaces_=function(){return[]},oa.prototype.getClass=function(){return oa};var _n=function(){if(this._edges=new j,this._nodes=null,this._edgeEndList=new j,arguments.length===0)this._nodes=new bi(new oa);else if(arguments.length===1){var n=arguments[0];this._nodes=new bi(n)}};_n.prototype.printEdges=function(n){n.println("Edges:");for(var i=0;i<this._edges.size();i++){n.println("edge "+i+":");var s=this._edges.get(i);s.print(n),s.eiList.print(n)}},_n.prototype.find=function(n){return this._nodes.find(n)},_n.prototype.addNode=function(){if(arguments[0]instanceof El){var n=arguments[0];return this._nodes.addNode(n)}if(arguments[0]instanceof L){var i=arguments[0];return this._nodes.addNode(i)}},_n.prototype.getNodeIterator=function(){return this._nodes.iterator()},_n.prototype.linkResultDirectedEdges=function(){for(var n=this._nodes.iterator();n.hasNext();)n.next().getEdges().linkResultDirectedEdges()},_n.prototype.debugPrintln=function(n){Nt.out.println(n)},_n.prototype.isBoundaryNode=function(n,i){var s=this._nodes.find(i);if(s===null)return!1;var u=s.getLabel();return u!==null&&u.getLocation(n)===k.BOUNDARY},_n.prototype.linkAllDirectedEdges=function(){for(var n=this._nodes.iterator();n.hasNext();)n.next().getEdges().linkAllDirectedEdges()},_n.prototype.matchInSameDirection=function(n,i,s,u){return!!n.equals(s)&&B.computeOrientation(n,i,u)===B.COLLINEAR&&ln.quadrant(n,i)===ln.quadrant(s,u)},_n.prototype.getEdgeEnds=function(){return this._edgeEndList},_n.prototype.debugPrint=function(n){Nt.out.print(n)},_n.prototype.getEdgeIterator=function(){return this._edges.iterator()},_n.prototype.findEdgeInSameDirection=function(n,i){for(var s=0;s<this._edges.size();s++){var u=this._edges.get(s),c=u.getCoordinates();if(this.matchInSameDirection(n,i,c[0],c[1])||this.matchInSameDirection(n,i,c[c.length-1],c[c.length-2]))return u}return null},_n.prototype.insertEdge=function(n){this._edges.add(n)},_n.prototype.findEdgeEnd=function(n){for(var i=this.getEdgeEnds().iterator();i.hasNext();){var s=i.next();if(s.getEdge()===n)return s}return null},_n.prototype.addEdges=function(n){for(var i=n.iterator();i.hasNext();){var s=i.next();this._edges.add(s);var u=new yf(s,!0),c=new yf(s,!1);u.setSym(c),c.setSym(u),this.add(u),this.add(c)}},_n.prototype.add=function(n){this._nodes.add(n),this._edgeEndList.add(n)},_n.prototype.getNodes=function(){return this._nodes.values()},_n.prototype.findEdge=function(n,i){for(var s=0;s<this._edges.size();s++){var u=this._edges.get(s),c=u.getCoordinates();if(n.equals(c[0])&&i.equals(c[1]))return u}return null},_n.prototype.interfaces_=function(){return[]},_n.prototype.getClass=function(){return _n},_n.linkResultDirectedEdges=function(n){for(var i=n.iterator();i.hasNext();)i.next().getEdges().linkResultDirectedEdges()};var Nr=function(){this._geometryFactory=null,this._shellList=new j;var n=arguments[0];this._geometryFactory=n};Nr.prototype.sortShellsAndHoles=function(n,i,s){for(var u=n.iterator();u.hasNext();){var c=u.next();c.isHole()?s.add(c):i.add(c)}},Nr.prototype.computePolygons=function(n){for(var i=new j,s=n.iterator();s.hasNext();){var u=s.next().toPolygon(this._geometryFactory);i.add(u)}return i},Nr.prototype.placeFreeHoles=function(n,i){for(var s=i.iterator();s.hasNext();){var u=s.next();if(u.getShell()===null){var c=this.findEdgeRingContaining(u,n);if(c===null)throw new io("unable to assign hole to a shell",u.getCoordinate(0));u.setShell(c)}}},Nr.prototype.buildMinimalEdgeRings=function(n,i,s){for(var u=new j,c=n.iterator();c.hasNext();){var m=c.next();if(m.getMaxNodeDegree()>2){m.linkDirectedEdgesForMinimalEdgeRings();var E=m.buildMinimalRings(),T=this.findShell(E);T!==null?(this.placePolygonHoles(T,E),i.add(T)):s.addAll(E)}else u.add(m)}return u},Nr.prototype.containsPoint=function(n){for(var i=this._shellList.iterator();i.hasNext();)if(i.next().containsPoint(n))return!0;return!1},Nr.prototype.buildMaximalEdgeRings=function(n){for(var i=new j,s=n.iterator();s.hasNext();){var u=s.next();if(u.isInResult()&&u.getLabel().isArea()&&u.getEdgeRing()===null){var c=new x1(u,this._geometryFactory);i.add(c),c.setInResult()}}return i},Nr.prototype.placePolygonHoles=function(n,i){for(var s=i.iterator();s.hasNext();){var u=s.next();u.isHole()&&u.setShell(n)}},Nr.prototype.getPolygons=function(){return this.computePolygons(this._shellList)},Nr.prototype.findEdgeRingContaining=function(n,i){for(var s=n.getLinearRing(),u=s.getEnvelopeInternal(),c=s.getCoordinateN(0),m=null,E=null,T=i.iterator();T.hasNext();){var U=T.next(),Z=U.getLinearRing(),ut=Z.getEnvelopeInternal();m!==null&&(E=m.getLinearRing().getEnvelopeInternal());var ht=!1;ut.contains(u)&&B.isPointInRing(c,Z.getCoordinates())&&(ht=!0),ht&&(m===null||E.contains(ut))&&(m=U)}return m},Nr.prototype.findShell=function(n){for(var i=0,s=null,u=n.iterator();u.hasNext();){var c=u.next();c.isHole()||(s=c,i++)}return b.isTrue(i<=1,"found two shells in MinimalEdgeRing list"),s},Nr.prototype.add=function(){if(arguments.length===1){var n=arguments[0];this.add(n.getEdgeEnds(),n.getNodes())}else if(arguments.length===2){var i=arguments[0],s=arguments[1];_n.linkResultDirectedEdges(s);var u=this.buildMaximalEdgeRings(i),c=new j,m=this.buildMinimalEdgeRings(u,this._shellList,c);this.sortShellsAndHoles(m,this._shellList,c),this.placeFreeHoles(this._shellList,c)}},Nr.prototype.interfaces_=function(){return[]},Nr.prototype.getClass=function(){return Nr};var sa=function(){};sa.prototype.getBounds=function(){},sa.prototype.interfaces_=function(){return[]},sa.prototype.getClass=function(){return sa};var pi=function(){this._bounds=null,this._item=null;var n=arguments[0],i=arguments[1];this._bounds=n,this._item=i};pi.prototype.getItem=function(){return this._item},pi.prototype.getBounds=function(){return this._bounds},pi.prototype.interfaces_=function(){return[sa,t]},pi.prototype.getClass=function(){return pi};var oo=function(){this._size=null,this._items=null,this._size=0,this._items=new j,this._items.add(null)};oo.prototype.poll=function(){if(this.isEmpty())return null;var n=this._items.get(1);return this._items.set(1,this._items.get(this._size)),this._size-=1,this.reorder(1),n},oo.prototype.size=function(){return this._size},oo.prototype.reorder=function(n){for(var i=null,s=this._items.get(n);2*n<=this._size&&((i=2*n)!==this._size&&this._items.get(i+1).compareTo(this._items.get(i))<0&&i++,this._items.get(i).compareTo(s)<0);n=i)this._items.set(n,this._items.get(i));this._items.set(n,s)},oo.prototype.clear=function(){this._size=0,this._items.clear()},oo.prototype.isEmpty=function(){return this._size===0},oo.prototype.add=function(n){this._items.add(null),this._size+=1;var i=this._size;for(this._items.set(0,n);n.compareTo(this._items.get(Math.trunc(i/2)))<0;i/=2)this._items.set(i,this._items.get(Math.trunc(i/2)));this._items.set(i,n)},oo.prototype.interfaces_=function(){return[]},oo.prototype.getClass=function(){return oo};var Mo=function(){};Mo.prototype.visitItem=function(n){},Mo.prototype.interfaces_=function(){return[]},Mo.prototype.getClass=function(){return Mo};var bs=function(){};bs.prototype.insert=function(n,i){},bs.prototype.remove=function(n,i){},bs.prototype.query=function(){},bs.prototype.interfaces_=function(){return[]},bs.prototype.getClass=function(){return bs};var Nn=function(){if(this._childBoundables=new j,this._bounds=null,this._level=null,arguments.length!==0){if(arguments.length===1){var n=arguments[0];this._level=n}}},Wd={serialVersionUID:{configurable:!0}};Nn.prototype.getLevel=function(){return this._level},Nn.prototype.size=function(){return this._childBoundables.size()},Nn.prototype.getChildBoundables=function(){return this._childBoundables},Nn.prototype.addChildBoundable=function(n){b.isTrue(this._bounds===null),this._childBoundables.add(n)},Nn.prototype.isEmpty=function(){return this._childBoundables.isEmpty()},Nn.prototype.getBounds=function(){return this._bounds===null&&(this._bounds=this.computeBounds()),this._bounds},Nn.prototype.interfaces_=function(){return[sa,t]},Nn.prototype.getClass=function(){return Nn},Wd.serialVersionUID.get=function(){return 6493722185909574e3},Object.defineProperties(Nn,Wd);var di=function(){};di.reverseOrder=function(){return{compare:function(n,i){return i.compareTo(n)}}},di.min=function(n){return di.sort(n),n.get(0)},di.sort=function(n,i){var s=n.toArray();i?Fi.sort(s,i):Fi.sort(s);for(var u=n.iterator(),c=0,m=s.length;c<m;c++)u.next(),u.set(s[c])},di.singletonList=function(n){var i=new j;return i.add(n),i};var Cn=function(){this._boundable1=null,this._boundable2=null,this._distance=null,this._itemDistance=null;var n=arguments[0],i=arguments[1],s=arguments[2];this._boundable1=n,this._boundable2=i,this._itemDistance=s,this._distance=this.distance()};Cn.prototype.expandToQueue=function(n,i){var s=Cn.isComposite(this._boundable1),u=Cn.isComposite(this._boundable2);if(s&&u)return Cn.area(this._boundable1)>Cn.area(this._boundable2)?(this.expand(this._boundable1,this._boundable2,n,i),null):(this.expand(this._boundable2,this._boundable1,n,i),null);if(s)return this.expand(this._boundable1,this._boundable2,n,i),null;if(u)return this.expand(this._boundable2,this._boundable1,n,i),null;throw new C("neither boundable is composite")},Cn.prototype.isLeaves=function(){return!(Cn.isComposite(this._boundable1)||Cn.isComposite(this._boundable2))},Cn.prototype.compareTo=function(n){var i=n;return this._distance<i._distance?-1:this._distance>i._distance?1:0},Cn.prototype.expand=function(n,i,s,u){for(var c=n.getChildBoundables().iterator();c.hasNext();){var m=c.next(),E=new Cn(m,i,this._itemDistance);E.getDistance()<u&&s.add(E)}},Cn.prototype.getBoundable=function(n){return n===0?this._boundable1:this._boundable2},Cn.prototype.getDistance=function(){return this._distance},Cn.prototype.distance=function(){return this.isLeaves()?this._itemDistance.distance(this._boundable1,this._boundable2):this._boundable1.getBounds().distance(this._boundable2.getBounds())},Cn.prototype.interfaces_=function(){return[F]},Cn.prototype.getClass=function(){return Cn},Cn.area=function(n){return n.getBounds().getArea()},Cn.isComposite=function(n){return n instanceof Nn};var zn=function n(){if(this._root=null,this._built=!1,this._itemBoundables=new j,this._nodeCapacity=null,arguments.length===0){var i=n.DEFAULT_NODE_CAPACITY;this._nodeCapacity=i}else if(arguments.length===1){var s=arguments[0];b.isTrue(s>1,"Node capacity must be greater than 1"),this._nodeCapacity=s}},Ml={IntersectsOp:{configurable:!0},serialVersionUID:{configurable:!0},DEFAULT_NODE_CAPACITY:{configurable:!0}};zn.prototype.getNodeCapacity=function(){return this._nodeCapacity},zn.prototype.lastNode=function(n){return n.get(n.size()-1)},zn.prototype.size=function(){if(arguments.length===0)return this.isEmpty()?0:(this.build(),this.size(this._root));if(arguments.length===1){for(var n=0,i=arguments[0].getChildBoundables().iterator();i.hasNext();){var s=i.next();s instanceof Nn?n+=this.size(s):s instanceof pi&&(n+=1)}return n}},zn.prototype.removeItem=function(n,i){for(var s=null,u=n.getChildBoundables().iterator();u.hasNext();){var c=u.next();c instanceof pi&&c.getItem()===i&&(s=c)}return s!==null&&(n.getChildBoundables().remove(s),!0)},zn.prototype.itemsTree=function(){if(arguments.length===0){this.build();var n=this.itemsTree(this._root);return n===null?new j:n}if(arguments.length===1){for(var i=arguments[0],s=new j,u=i.getChildBoundables().iterator();u.hasNext();){var c=u.next();if(c instanceof Nn){var m=this.itemsTree(c);m!==null&&s.add(m)}else c instanceof pi?s.add(c.getItem()):b.shouldNeverReachHere()}return s.size()<=0?null:s}},zn.prototype.insert=function(n,i){b.isTrue(!this._built,"Cannot insert items into an STR packed R-tree after it has been built."),this._itemBoundables.add(new pi(n,i))},zn.prototype.boundablesAtLevel=function(){if(arguments.length===1){var n=arguments[0],i=new j;return this.boundablesAtLevel(n,this._root,i),i}if(arguments.length===3){var s=arguments[0],u=arguments[1],c=arguments[2];if(b.isTrue(s>-2),u.getLevel()===s)return c.add(u),null;for(var m=u.getChildBoundables().iterator();m.hasNext();){var E=m.next();E instanceof Nn?this.boundablesAtLevel(s,E,c):(b.isTrue(E instanceof pi),s===-1&&c.add(E))}return null}},zn.prototype.query=function(){if(arguments.length===1){var n=arguments[0];this.build();var i=new j;return this.isEmpty()||this.getIntersectsOp().intersects(this._root.getBounds(),n)&&this.query(n,this._root,i),i}if(arguments.length===2){var s=arguments[0],u=arguments[1];if(this.build(),this.isEmpty())return null;this.getIntersectsOp().intersects(this._root.getBounds(),s)&&this.query(s,this._root,u)}else if(arguments.length===3){if(X(arguments[2],Mo)&&arguments[0]instanceof Object&&arguments[1]instanceof Nn)for(var c=arguments[0],m=arguments[1],E=arguments[2],T=m.getChildBoundables(),U=0;U<T.size();U++){var Z=T.get(U);this.getIntersectsOp().intersects(Z.getBounds(),c)&&(Z instanceof Nn?this.query(c,Z,E):Z instanceof pi?E.visitItem(Z.getItem()):b.shouldNeverReachHere())}else if(X(arguments[2],wt)&&arguments[0]instanceof Object&&arguments[1]instanceof Nn)for(var ut=arguments[0],ht=arguments[1],At=arguments[2],Rt=ht.getChildBoundables(),kt=0;kt<Rt.size();kt++){var ee=Rt.get(kt);this.getIntersectsOp().intersects(ee.getBounds(),ut)&&(ee instanceof Nn?this.query(ut,ee,At):ee instanceof pi?At.add(ee.getItem()):b.shouldNeverReachHere())}}},zn.prototype.build=function(){if(this._built)return null;this._root=this._itemBoundables.isEmpty()?this.createNode(0):this.createHigherLevels(this._itemBoundables,-1),this._itemBoundables=null,this._built=!0},zn.prototype.getRoot=function(){return this.build(),this._root},zn.prototype.remove=function(){if(arguments.length===2){var n=arguments[0],i=arguments[1];return this.build(),!!this.getIntersectsOp().intersects(this._root.getBounds(),n)&&this.remove(n,this._root,i)}if(arguments.length===3){var s=arguments[0],u=arguments[1],c=arguments[2],m=this.removeItem(u,c);if(m)return!0;for(var E=null,T=u.getChildBoundables().iterator();T.hasNext();){var U=T.next();if(this.getIntersectsOp().intersects(U.getBounds(),s)&&U instanceof Nn&&(m=this.remove(s,U,c))){E=U;break}}return E!==null&&E.getChildBoundables().isEmpty()&&u.getChildBoundables().remove(E),m}},zn.prototype.createHigherLevels=function(n,i){b.isTrue(!n.isEmpty());var s=this.createParentBoundables(n,i+1);return s.size()===1?s.get(0):this.createHigherLevels(s,i+1)},zn.prototype.depth=function(){if(arguments.length===0)return this.isEmpty()?0:(this.build(),this.depth(this._root));if(arguments.length===1){for(var n=0,i=arguments[0].getChildBoundables().iterator();i.hasNext();){var s=i.next();if(s instanceof Nn){var u=this.depth(s);u>n&&(n=u)}}return n+1}},zn.prototype.createParentBoundables=function(n,i){b.isTrue(!n.isEmpty());var s=new j;s.add(this.createNode(i));var u=new j(n);di.sort(u,this.getComparator());for(var c=u.iterator();c.hasNext();){var m=c.next();this.lastNode(s).getChildBoundables().size()===this.getNodeCapacity()&&s.add(this.createNode(i)),this.lastNode(s).addChildBoundable(m)}return s},zn.prototype.isEmpty=function(){return this._built?this._root.isEmpty():this._itemBoundables.isEmpty()},zn.prototype.interfaces_=function(){return[t]},zn.prototype.getClass=function(){return zn},zn.compareDoubles=function(n,i){return n>i?1:n<i?-1:0},Ml.IntersectsOp.get=function(){return E1},Ml.serialVersionUID.get=function(){return-3886435814360241e3},Ml.DEFAULT_NODE_CAPACITY.get=function(){return 10},Object.defineProperties(zn,Ml);var E1=function(){},aa=function(){};aa.prototype.distance=function(n,i){},aa.prototype.interfaces_=function(){return[]},aa.prototype.getClass=function(){return aa};var qd=function(n){function i(u){u=u||i.DEFAULT_NODE_CAPACITY,n.call(this,u)}n&&(i.__proto__=n),(i.prototype=Object.create(n&&n.prototype)).constructor=i;var s={STRtreeNode:{configurable:!0},serialVersionUID:{configurable:!0},xComparator:{configurable:!0},yComparator:{configurable:!0},intersectsOp:{configurable:!0},DEFAULT_NODE_CAPACITY:{configurable:!0}};return i.prototype.createParentBoundablesFromVerticalSlices=function(u,c){b.isTrue(u.length>0);for(var m=new j,E=0;E<u.length;E++)m.addAll(this.createParentBoundablesFromVerticalSlice(u[E],c));return m},i.prototype.createNode=function(u){return new Xd(u)},i.prototype.size=function(){return arguments.length===0?n.prototype.size.call(this):n.prototype.size.apply(this,arguments)},i.prototype.insert=function(){if(arguments.length!==2)return n.prototype.insert.apply(this,arguments);var u=arguments[0],c=arguments[1];if(u.isNull())return null;n.prototype.insert.call(this,u,c)},i.prototype.getIntersectsOp=function(){return i.intersectsOp},i.prototype.verticalSlices=function(u,c){for(var m=Math.trunc(Math.ceil(u.size()/c)),E=new Array(c).fill(null),T=u.iterator(),U=0;U<c;U++){E[U]=new j;for(var Z=0;T.hasNext()&&Z<m;){var ut=T.next();E[U].add(ut),Z++}}return E},i.prototype.query=function(){if(arguments.length===1){var u=arguments[0];return n.prototype.query.call(this,u)}if(arguments.length===2){var c=arguments[0],m=arguments[1];n.prototype.query.call(this,c,m)}else if(arguments.length===3){if(X(arguments[2],Mo)&&arguments[0]instanceof Object&&arguments[1]instanceof Nn){var E=arguments[0],T=arguments[1],U=arguments[2];n.prototype.query.call(this,E,T,U)}else if(X(arguments[2],wt)&&arguments[0]instanceof Object&&arguments[1]instanceof Nn){var Z=arguments[0],ut=arguments[1],ht=arguments[2];n.prototype.query.call(this,Z,ut,ht)}}},i.prototype.getComparator=function(){return i.yComparator},i.prototype.createParentBoundablesFromVerticalSlice=function(u,c){return n.prototype.createParentBoundables.call(this,u,c)},i.prototype.remove=function(){if(arguments.length===2){var u=arguments[0],c=arguments[1];return n.prototype.remove.call(this,u,c)}return n.prototype.remove.apply(this,arguments)},i.prototype.depth=function(){return arguments.length===0?n.prototype.depth.call(this):n.prototype.depth.apply(this,arguments)},i.prototype.createParentBoundables=function(u,c){b.isTrue(!u.isEmpty());var m=Math.trunc(Math.ceil(u.size()/this.getNodeCapacity())),E=new j(u);di.sort(E,i.xComparator);var T=this.verticalSlices(E,Math.trunc(Math.ceil(Math.sqrt(m))));return this.createParentBoundablesFromVerticalSlices(T,c)},i.prototype.nearestNeighbour=function(){if(arguments.length===1){if(X(arguments[0],aa)){var u=arguments[0],c=new Cn(this.getRoot(),this.getRoot(),u);return this.nearestNeighbour(c)}if(arguments[0]instanceof Cn){var m=arguments[0];return this.nearestNeighbour(m,S.POSITIVE_INFINITY)}}else if(arguments.length===2){if(arguments[0]instanceof i&&X(arguments[1],aa)){var E=arguments[0],T=arguments[1],U=new Cn(this.getRoot(),E.getRoot(),T);return this.nearestNeighbour(U)}if(arguments[0]instanceof Cn&&typeof arguments[1]=="number"){var Z=arguments[0],ut=arguments[1],ht=null,At=new oo;for(At.add(Z);!At.isEmpty()&&ut>0;){var Rt=At.poll(),kt=Rt.getDistance();if(kt>=ut)break;Rt.isLeaves()?(ut=kt,ht=Rt):Rt.expandToQueue(At,ut)}return[ht.getBoundable(0).getItem(),ht.getBoundable(1).getItem()]}}else if(arguments.length===3){var ee=arguments[0],on=arguments[1],In=arguments[2],pr=new pi(ee,on),Xi=new Cn(this.getRoot(),pr,In);return this.nearestNeighbour(Xi)[0]}},i.prototype.interfaces_=function(){return[bs,t]},i.prototype.getClass=function(){return i},i.centreX=function(u){return i.avg(u.getMinX(),u.getMaxX())},i.avg=function(u,c){return(u+c)/2},i.centreY=function(u){return i.avg(u.getMinY(),u.getMaxY())},s.STRtreeNode.get=function(){return Xd},s.serialVersionUID.get=function(){return 0x39920f7d5f261e0},s.xComparator.get=function(){return{interfaces_:function(){return[z]},compare:function(u,c){return n.compareDoubles(i.centreX(u.getBounds()),i.centreX(c.getBounds()))}}},s.yComparator.get=function(){return{interfaces_:function(){return[z]},compare:function(u,c){return n.compareDoubles(i.centreY(u.getBounds()),i.centreY(c.getBounds()))}}},s.intersectsOp.get=function(){return{interfaces_:function(){return[n.IntersectsOp]},intersects:function(u,c){return u.intersects(c)}}},s.DEFAULT_NODE_CAPACITY.get=function(){return 10},Object.defineProperties(i,s),i}(zn),Xd=function(n){function i(){var s=arguments[0];n.call(this,s)}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.computeBounds=function(){for(var s=null,u=this.getChildBoundables().iterator();u.hasNext();){var c=u.next();s===null?s=new Pt(c.getBounds()):s.expandToInclude(c.getBounds())}return s},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(Nn),Er=function(){};Er.prototype.interfaces_=function(){return[]},Er.prototype.getClass=function(){return Er},Er.relativeSign=function(n,i){return n<i?-1:n>i?1:0},Er.compare=function(n,i,s){if(i.equals2D(s))return 0;var u=Er.relativeSign(i.x,s.x),c=Er.relativeSign(i.y,s.y);switch(n){case 0:return Er.compareValue(u,c);case 1:return Er.compareValue(c,u);case 2:return Er.compareValue(c,-u);case 3:return Er.compareValue(-u,c);case 4:return Er.compareValue(-u,-c);case 5:return Er.compareValue(-c,-u);case 6:return Er.compareValue(-c,u);case 7:return Er.compareValue(u,-c)}return b.shouldNeverReachHere("invalid octant value"),0},Er.compareValue=function(n,i){return n<0?-1:n>0?1:i<0?-1:i>0?1:0};var So=function(){this._segString=null,this.coord=null,this.segmentIndex=null,this._segmentOctant=null,this._isInterior=null;var n=arguments[0],i=arguments[1],s=arguments[2],u=arguments[3];this._segString=n,this.coord=new L(i),this.segmentIndex=s,this._segmentOctant=u,this._isInterior=!i.equals2D(n.getCoordinate(s))};So.prototype.getCoordinate=function(){return this.coord},So.prototype.print=function(n){n.print(this.coord),n.print(" seg # = "+this.segmentIndex)},So.prototype.compareTo=function(n){var i=n;return this.segmentIndex<i.segmentIndex?-1:this.segmentIndex>i.segmentIndex?1:this.coord.equals2D(i.coord)?0:Er.compare(this._segmentOctant,this.coord,i.coord)},So.prototype.isEndPoint=function(n){return this.segmentIndex===0&&!this._isInterior||this.segmentIndex===n},So.prototype.isInterior=function(){return this._isInterior},So.prototype.interfaces_=function(){return[F]},So.prototype.getClass=function(){return So};var ar=function(){this._nodeMap=new _,this._edge=null;var n=arguments[0];this._edge=n};ar.prototype.getSplitCoordinates=function(){var n=new Dt;this.addEndpoints();for(var i=this.iterator(),s=i.next();i.hasNext();){var u=i.next();this.addEdgeCoordinates(s,u,n),s=u}return n.toCoordinateArray()},ar.prototype.addCollapsedNodes=function(){var n=new j;this.findCollapsesFromInsertedNodes(n),this.findCollapsesFromExistingVertices(n);for(var i=n.iterator();i.hasNext();){var s=i.next().intValue();this.add(this._edge.getCoordinate(s),s)}},ar.prototype.print=function(n){n.println("Intersections:");for(var i=this.iterator();i.hasNext();)i.next().print(n)},ar.prototype.findCollapsesFromExistingVertices=function(n){for(var i=0;i<this._edge.size()-2;i++){var s=this._edge.getCoordinate(i),u=this._edge.getCoordinate(i+2);s.equals2D(u)&&n.add(new et(i+1))}},ar.prototype.addEdgeCoordinates=function(n,i,s){var u=this._edge.getCoordinate(i.segmentIndex),c=i.isInterior()||!i.coord.equals2D(u);s.add(new L(n.coord),!1);for(var m=n.segmentIndex+1;m<=i.segmentIndex;m++)s.add(this._edge.getCoordinate(m));c&&s.add(new L(i.coord))},ar.prototype.iterator=function(){return this._nodeMap.values().iterator()},ar.prototype.addSplitEdges=function(n){this.addEndpoints(),this.addCollapsedNodes();for(var i=this.iterator(),s=i.next();i.hasNext();){var u=i.next(),c=this.createSplitEdge(s,u);n.add(c),s=u}},ar.prototype.findCollapseIndex=function(n,i,s){if(!n.coord.equals2D(i.coord))return!1;var u=i.segmentIndex-n.segmentIndex;return i.isInterior()||u--,u===1&&(s[0]=n.segmentIndex+1,!0)},ar.prototype.findCollapsesFromInsertedNodes=function(n){for(var i=new Array(1).fill(null),s=this.iterator(),u=s.next();s.hasNext();){var c=s.next();this.findCollapseIndex(u,c,i)&&n.add(new et(i[0])),u=c}},ar.prototype.getEdge=function(){return this._edge},ar.prototype.addEndpoints=function(){var n=this._edge.size()-1;this.add(this._edge.getCoordinate(0),0),this.add(this._edge.getCoordinate(n),n)},ar.prototype.createSplitEdge=function(n,i){var s=i.segmentIndex-n.segmentIndex+2,u=this._edge.getCoordinate(i.segmentIndex),c=i.isInterior()||!i.coord.equals2D(u);c||s--;var m=new Array(s).fill(null),E=0;m[E++]=new L(n.coord);for(var T=n.segmentIndex+1;T<=i.segmentIndex;T++)m[E++]=this._edge.getCoordinate(T);return c&&(m[E]=new L(i.coord)),new wn(m,this._edge.getData())},ar.prototype.add=function(n,i){var s=new So(this._edge,n,i,this._edge.getSegmentOctant(i)),u=this._nodeMap.get(s);return u!==null?(b.isTrue(u.coord.equals2D(n),"Found equal nodes with different coordinates"),u):(this._nodeMap.put(s,s),s)},ar.prototype.checkSplitEdgesCorrectness=function(n){var i=this._edge.getCoordinates(),s=n.get(0).getCoordinate(0);if(!s.equals2D(i[0]))throw new $("bad split edge start point at "+s);var u=n.get(n.size()-1).getCoordinates(),c=u[u.length-1];if(!c.equals2D(i[i.length-1]))throw new $("bad split edge end point at "+c)},ar.prototype.interfaces_=function(){return[]},ar.prototype.getClass=function(){return ar};var Ts=function(){};Ts.prototype.interfaces_=function(){return[]},Ts.prototype.getClass=function(){return Ts},Ts.octant=function(){if(typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var n=arguments[0],i=arguments[1];if(n===0&&i===0)throw new C("Cannot compute the octant for point ( "+n+", "+i+" )");var s=Math.abs(n),u=Math.abs(i);return n>=0?i>=0?s>=u?0:1:s>=u?7:6:i>=0?s>=u?3:2:s>=u?4:5}if(arguments[0]instanceof L&&arguments[1]instanceof L){var c=arguments[0],m=arguments[1],E=m.x-c.x,T=m.y-c.y;if(E===0&&T===0)throw new C("Cannot compute the octant for two identical points "+c);return Ts.octant(E,T)}};var Bi=function(){};Bi.prototype.getCoordinates=function(){},Bi.prototype.size=function(){},Bi.prototype.getCoordinate=function(n){},Bi.prototype.isClosed=function(){},Bi.prototype.setData=function(n){},Bi.prototype.getData=function(){},Bi.prototype.interfaces_=function(){return[]},Bi.prototype.getClass=function(){return Bi};var gu=function(){};gu.prototype.addIntersection=function(n,i){},gu.prototype.interfaces_=function(){return[Bi]},gu.prototype.getClass=function(){return gu};var wn=function(){this._nodeList=new ar(this),this._pts=null,this._data=null;var n=arguments[0],i=arguments[1];this._pts=n,this._data=i};wn.prototype.getCoordinates=function(){return this._pts},wn.prototype.size=function(){return this._pts.length},wn.prototype.getCoordinate=function(n){return this._pts[n]},wn.prototype.isClosed=function(){return this._pts[0].equals(this._pts[this._pts.length-1])},wn.prototype.getSegmentOctant=function(n){return n===this._pts.length-1?-1:this.safeOctant(this.getCoordinate(n),this.getCoordinate(n+1))},wn.prototype.setData=function(n){this._data=n},wn.prototype.safeOctant=function(n,i){return n.equals2D(i)?0:Ts.octant(n,i)},wn.prototype.getData=function(){return this._data},wn.prototype.addIntersection=function(){if(arguments.length===2){var n=arguments[0],i=arguments[1];this.addIntersectionNode(n,i)}else if(arguments.length===4){var s=arguments[0],u=arguments[1],c=arguments[3],m=new L(s.getIntersection(c));this.addIntersection(m,u)}},wn.prototype.toString=function(){return qt.toLineString(new he(this._pts))},wn.prototype.getNodeList=function(){return this._nodeList},wn.prototype.addIntersectionNode=function(n,i){var s=i,u=s+1;if(u<this._pts.length){var c=this._pts[u];n.equals2D(c)&&(s=u)}return this._nodeList.add(n,s)},wn.prototype.addIntersections=function(n,i,s){for(var u=0;u<n.getIntersectionNum();u++)this.addIntersection(n,i,s,u)},wn.prototype.interfaces_=function(){return[gu]},wn.prototype.getClass=function(){return wn},wn.getNodedSubstrings=function(){if(arguments.length===1){var n=arguments[0],i=new j;return wn.getNodedSubstrings(n,i),i}if(arguments.length===2)for(var s=arguments[0],u=arguments[1],c=s.iterator();c.hasNext();)c.next().getNodeList().addSplitEdges(u)};var Zt=function(){if(this.p0=null,this.p1=null,arguments.length===0)this.p0=new L,this.p1=new L;else if(arguments.length===1){var n=arguments[0];this.p0=new L(n.p0),this.p1=new L(n.p1)}else if(arguments.length===2)this.p0=arguments[0],this.p1=arguments[1];else if(arguments.length===4){var i=arguments[0],s=arguments[1],u=arguments[2],c=arguments[3];this.p0=new L(i,s),this.p1=new L(u,c)}},Yd={serialVersionUID:{configurable:!0}};Zt.prototype.minX=function(){return Math.min(this.p0.x,this.p1.x)},Zt.prototype.orientationIndex=function(){if(arguments[0]instanceof Zt){var n=arguments[0],i=B.orientationIndex(this.p0,this.p1,n.p0),s=B.orientationIndex(this.p0,this.p1,n.p1);return i>=0&&s>=0||i<=0&&s<=0?Math.max(i,s):0}if(arguments[0]instanceof L){var u=arguments[0];return B.orientationIndex(this.p0,this.p1,u)}},Zt.prototype.toGeometry=function(n){return n.createLineString([this.p0,this.p1])},Zt.prototype.isVertical=function(){return this.p0.x===this.p1.x},Zt.prototype.equals=function(n){if(!(n instanceof Zt))return!1;var i=n;return this.p0.equals(i.p0)&&this.p1.equals(i.p1)},Zt.prototype.intersection=function(n){var i=new J;return i.computeIntersection(this.p0,this.p1,n.p0,n.p1),i.hasIntersection()?i.getIntersection(0):null},Zt.prototype.project=function(){if(arguments[0]instanceof L){var n=arguments[0];if(n.equals(this.p0)||n.equals(this.p1))return new L(n);var i=this.projectionFactor(n),s=new L;return s.x=this.p0.x+i*(this.p1.x-this.p0.x),s.y=this.p0.y+i*(this.p1.y-this.p0.y),s}if(arguments[0]instanceof Zt){var u=arguments[0],c=this.projectionFactor(u.p0),m=this.projectionFactor(u.p1);if(c>=1&&m>=1||c<=0&&m<=0)return null;var E=this.project(u.p0);c<0&&(E=this.p0),c>1&&(E=this.p1);var T=this.project(u.p1);return m<0&&(T=this.p0),m>1&&(T=this.p1),new Zt(E,T)}},Zt.prototype.normalize=function(){this.p1.compareTo(this.p0)<0&&this.reverse()},Zt.prototype.angle=function(){return Math.atan2(this.p1.y-this.p0.y,this.p1.x-this.p0.x)},Zt.prototype.getCoordinate=function(n){return n===0?this.p0:this.p1},Zt.prototype.distancePerpendicular=function(n){return B.distancePointLinePerpendicular(n,this.p0,this.p1)},Zt.prototype.minY=function(){return Math.min(this.p0.y,this.p1.y)},Zt.prototype.midPoint=function(){return Zt.midPoint(this.p0,this.p1)},Zt.prototype.projectionFactor=function(n){if(n.equals(this.p0))return 0;if(n.equals(this.p1))return 1;var i=this.p1.x-this.p0.x,s=this.p1.y-this.p0.y,u=i*i+s*s;return u<=0?S.NaN:((n.x-this.p0.x)*i+(n.y-this.p0.y)*s)/u},Zt.prototype.closestPoints=function(n){var i=this.intersection(n);if(i!==null)return[i,i];var s=new Array(2).fill(null),u=S.MAX_VALUE,c=null,m=this.closestPoint(n.p0);u=m.distance(n.p0),s[0]=m,s[1]=n.p0;var E=this.closestPoint(n.p1);(c=E.distance(n.p1))<u&&(u=c,s[0]=E,s[1]=n.p1);var T=n.closestPoint(this.p0);(c=T.distance(this.p0))<u&&(u=c,s[0]=this.p0,s[1]=T);var U=n.closestPoint(this.p1);return(c=U.distance(this.p1))<u&&(u=c,s[0]=this.p1,s[1]=U),s},Zt.prototype.closestPoint=function(n){var i=this.projectionFactor(n);return i>0&&i<1?this.project(n):this.p0.distance(n)<this.p1.distance(n)?this.p0:this.p1},Zt.prototype.maxX=function(){return Math.max(this.p0.x,this.p1.x)},Zt.prototype.getLength=function(){return this.p0.distance(this.p1)},Zt.prototype.compareTo=function(n){var i=n,s=this.p0.compareTo(i.p0);return s!==0?s:this.p1.compareTo(i.p1)},Zt.prototype.reverse=function(){var n=this.p0;this.p0=this.p1,this.p1=n},Zt.prototype.equalsTopo=function(n){return this.p0.equals(n.p0)&&(this.p1.equals(n.p1)||this.p0.equals(n.p1))&&this.p1.equals(n.p0)},Zt.prototype.lineIntersection=function(n){try{return ne.intersection(this.p0,this.p1,n.p0,n.p1)}catch(i){if(!(i instanceof Wt))throw i}return null},Zt.prototype.maxY=function(){return Math.max(this.p0.y,this.p1.y)},Zt.prototype.pointAlongOffset=function(n,i){var s=this.p0.x+n*(this.p1.x-this.p0.x),u=this.p0.y+n*(this.p1.y-this.p0.y),c=this.p1.x-this.p0.x,m=this.p1.y-this.p0.y,E=Math.sqrt(c*c+m*m),T=0,U=0;if(i!==0){if(E<=0)throw new Error("Cannot compute offset from zero-length line segment");T=i*c/E,U=i*m/E}return new L(s-U,u+T)},Zt.prototype.setCoordinates=function(){if(arguments.length===1){var n=arguments[0];this.setCoordinates(n.p0,n.p1)}else if(arguments.length===2){var i=arguments[0],s=arguments[1];this.p0.x=i.x,this.p0.y=i.y,this.p1.x=s.x,this.p1.y=s.y}},Zt.prototype.segmentFraction=function(n){var i=this.projectionFactor(n);return i<0?i=0:(i>1||S.isNaN(i))&&(i=1),i},Zt.prototype.toString=function(){return"LINESTRING( "+this.p0.x+" "+this.p0.y+", "+this.p1.x+" "+this.p1.y+")"},Zt.prototype.isHorizontal=function(){return this.p0.y===this.p1.y},Zt.prototype.distance=function(){if(arguments[0]instanceof Zt){var n=arguments[0];return B.distanceLineLine(this.p0,this.p1,n.p0,n.p1)}if(arguments[0]instanceof L){var i=arguments[0];return B.distancePointLine(i,this.p0,this.p1)}},Zt.prototype.pointAlong=function(n){var i=new L;return i.x=this.p0.x+n*(this.p1.x-this.p0.x),i.y=this.p0.y+n*(this.p1.y-this.p0.y),i},Zt.prototype.hashCode=function(){var n=S.doubleToLongBits(this.p0.x);n^=31*S.doubleToLongBits(this.p0.y);var i=Math.trunc(n)^Math.trunc(n>>32),s=S.doubleToLongBits(this.p1.x);return s^=31*S.doubleToLongBits(this.p1.y),i^(Math.trunc(s)^Math.trunc(s>>32))},Zt.prototype.interfaces_=function(){return[F,t]},Zt.prototype.getClass=function(){return Zt},Zt.midPoint=function(n,i){return new L((n.x+i.x)/2,(n.y+i.y)/2)},Yd.serialVersionUID.get=function(){return 0x2d2172135f411c00},Object.defineProperties(Zt,Yd);var yu=function(){this.tempEnv1=new Pt,this.tempEnv2=new Pt,this._overlapSeg1=new Zt,this._overlapSeg2=new Zt};yu.prototype.overlap=function(){if(arguments.length!==2){if(arguments.length===4){var n=arguments[0],i=arguments[1],s=arguments[2],u=arguments[3];n.getLineSegment(i,this._overlapSeg1),s.getLineSegment(u,this._overlapSeg2),this.overlap(this._overlapSeg1,this._overlapSeg2)}}},yu.prototype.interfaces_=function(){return[]},yu.prototype.getClass=function(){return yu};var Or=function(){this._pts=null,this._start=null,this._end=null,this._env=null,this._context=null,this._id=null;var n=arguments[0],i=arguments[1],s=arguments[2],u=arguments[3];this._pts=n,this._start=i,this._end=s,this._context=u};Or.prototype.getLineSegment=function(n,i){i.p0=this._pts[n],i.p1=this._pts[n+1]},Or.prototype.computeSelect=function(n,i,s,u){var c=this._pts[i],m=this._pts[s];if(u.tempEnv1.init(c,m),s-i==1)return u.select(this,i),null;if(!n.intersects(u.tempEnv1))return null;var E=Math.trunc((i+s)/2);i<E&&this.computeSelect(n,i,E,u),E<s&&this.computeSelect(n,E,s,u)},Or.prototype.getCoordinates=function(){for(var n=new Array(this._end-this._start+1).fill(null),i=0,s=this._start;s<=this._end;s++)n[i++]=this._pts[s];return n},Or.prototype.computeOverlaps=function(n,i){this.computeOverlapsInternal(this._start,this._end,n,n._start,n._end,i)},Or.prototype.setId=function(n){this._id=n},Or.prototype.select=function(n,i){this.computeSelect(n,this._start,this._end,i)},Or.prototype.getEnvelope=function(){if(this._env===null){var n=this._pts[this._start],i=this._pts[this._end];this._env=new Pt(n,i)}return this._env},Or.prototype.getEndIndex=function(){return this._end},Or.prototype.getStartIndex=function(){return this._start},Or.prototype.getContext=function(){return this._context},Or.prototype.getId=function(){return this._id},Or.prototype.computeOverlapsInternal=function(n,i,s,u,c,m){var E=this._pts[n],T=this._pts[i],U=s._pts[u],Z=s._pts[c];if(i-n==1&&c-u==1)return m.overlap(this,n,s,u),null;if(m.tempEnv1.init(E,T),m.tempEnv2.init(U,Z),!m.tempEnv1.intersects(m.tempEnv2))return null;var ut=Math.trunc((n+i)/2),ht=Math.trunc((u+c)/2);n<ut&&(u<ht&&this.computeOverlapsInternal(n,ut,s,u,ht,m),ht<c&&this.computeOverlapsInternal(n,ut,s,ht,c,m)),ut<i&&(u<ht&&this.computeOverlapsInternal(ut,i,s,u,ht,m),ht<c&&this.computeOverlapsInternal(ut,i,s,ht,c,m))},Or.prototype.interfaces_=function(){return[]},Or.prototype.getClass=function(){return Or};var Ti=function(){};Ti.prototype.interfaces_=function(){return[]},Ti.prototype.getClass=function(){return Ti},Ti.getChainStartIndices=function(n){var i=0,s=new j;s.add(new et(i));do{var u=Ti.findChainEnd(n,i);s.add(new et(u)),i=u}while(i<n.length-1);return Ti.toIntArray(s)},Ti.findChainEnd=function(n,i){for(var s=i;s<n.length-1&&n[s].equals2D(n[s+1]);)s++;if(s>=n.length-1)return n.length-1;for(var u=ln.quadrant(n[s],n[s+1]),c=i+1;c<n.length&&!(!n[c-1].equals2D(n[c])&&ln.quadrant(n[c-1],n[c])!==u);)c++;return c-1},Ti.getChains=function(){if(arguments.length===1){var n=arguments[0];return Ti.getChains(n,null)}if(arguments.length===2){for(var i=arguments[0],s=arguments[1],u=new j,c=Ti.getChainStartIndices(i),m=0;m<c.length-1;m++){var E=new Or(i,c[m],c[m+1],s);u.add(E)}return u}},Ti.toIntArray=function(n){for(var i=new Array(n.size()).fill(null),s=0;s<i.length;s++)i[s]=n.get(s).intValue();return i};var Zo=function(){};Zo.prototype.computeNodes=function(n){},Zo.prototype.getNodedSubstrings=function(){},Zo.prototype.interfaces_=function(){return[]},Zo.prototype.getClass=function(){return Zo};var vu=function(){if(this._segInt=null,arguments.length!==0){if(arguments.length===1){var n=arguments[0];this.setSegmentIntersector(n)}}};vu.prototype.setSegmentIntersector=function(n){this._segInt=n},vu.prototype.interfaces_=function(){return[Zo]},vu.prototype.getClass=function(){return vu};var vf=function(n){function i(u){u?n.call(this,u):n.call(this),this._monoChains=new j,this._index=new qd,this._idCounter=0,this._nodedSegStrings=null,this._nOverlaps=0}n&&(i.__proto__=n),(i.prototype=Object.create(n&&n.prototype)).constructor=i;var s={SegmentOverlapAction:{configurable:!0}};return i.prototype.getMonotoneChains=function(){return this._monoChains},i.prototype.getNodedSubstrings=function(){return wn.getNodedSubstrings(this._nodedSegStrings)},i.prototype.getIndex=function(){return this._index},i.prototype.add=function(u){for(var c=Ti.getChains(u.getCoordinates(),u).iterator();c.hasNext();){var m=c.next();m.setId(this._idCounter++),this._index.insert(m.getEnvelope(),m),this._monoChains.add(m)}},i.prototype.computeNodes=function(u){this._nodedSegStrings=u;for(var c=u.iterator();c.hasNext();)this.add(c.next());this.intersectChains()},i.prototype.intersectChains=function(){for(var u=new Zd(this._segInt),c=this._monoChains.iterator();c.hasNext();)for(var m=c.next(),E=this._index.query(m.getEnvelope()).iterator();E.hasNext();){var T=E.next();if(T.getId()>m.getId()&&(m.computeOverlaps(T,u),this._nOverlaps++),this._segInt.isDone())return null}},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},s.SegmentOverlapAction.get=function(){return Zd},Object.defineProperties(i,s),i}(vu),Zd=function(n){function i(){n.call(this),this._si=null;var s=arguments[0];this._si=s}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.overlap=function(){if(arguments.length!==4)return n.prototype.overlap.apply(this,arguments);var s=arguments[0],u=arguments[1],c=arguments[2],m=arguments[3],E=s.getContext(),T=c.getContext();this._si.processIntersections(E,u,T,m)},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(yu),We=function n(){if(this._quadrantSegments=n.DEFAULT_QUADRANT_SEGMENTS,this._endCapStyle=n.CAP_ROUND,this._joinStyle=n.JOIN_ROUND,this._mitreLimit=n.DEFAULT_MITRE_LIMIT,this._isSingleSided=!1,this._simplifyFactor=n.DEFAULT_SIMPLIFY_FACTOR,arguments.length!==0){if(arguments.length===1){var i=arguments[0];this.setQuadrantSegments(i)}else if(arguments.length===2){var s=arguments[0],u=arguments[1];this.setQuadrantSegments(s),this.setEndCapStyle(u)}else if(arguments.length===4){var c=arguments[0],m=arguments[1],E=arguments[2],T=arguments[3];this.setQuadrantSegments(c),this.setEndCapStyle(m),this.setJoinStyle(E),this.setMitreLimit(T)}}},so={CAP_ROUND:{configurable:!0},CAP_FLAT:{configurable:!0},CAP_SQUARE:{configurable:!0},JOIN_ROUND:{configurable:!0},JOIN_MITRE:{configurable:!0},JOIN_BEVEL:{configurable:!0},DEFAULT_QUADRANT_SEGMENTS:{configurable:!0},DEFAULT_MITRE_LIMIT:{configurable:!0},DEFAULT_SIMPLIFY_FACTOR:{configurable:!0}};We.prototype.getEndCapStyle=function(){return this._endCapStyle},We.prototype.isSingleSided=function(){return this._isSingleSided},We.prototype.setQuadrantSegments=function(n){this._quadrantSegments=n,this._quadrantSegments===0&&(this._joinStyle=We.JOIN_BEVEL),this._quadrantSegments<0&&(this._joinStyle=We.JOIN_MITRE,this._mitreLimit=Math.abs(this._quadrantSegments)),n<=0&&(this._quadrantSegments=1),this._joinStyle!==We.JOIN_ROUND&&(this._quadrantSegments=We.DEFAULT_QUADRANT_SEGMENTS)},We.prototype.getJoinStyle=function(){return this._joinStyle},We.prototype.setJoinStyle=function(n){this._joinStyle=n},We.prototype.setSimplifyFactor=function(n){this._simplifyFactor=n<0?0:n},We.prototype.getSimplifyFactor=function(){return this._simplifyFactor},We.prototype.getQuadrantSegments=function(){return this._quadrantSegments},We.prototype.setEndCapStyle=function(n){this._endCapStyle=n},We.prototype.getMitreLimit=function(){return this._mitreLimit},We.prototype.setMitreLimit=function(n){this._mitreLimit=n},We.prototype.setSingleSided=function(n){this._isSingleSided=n},We.prototype.interfaces_=function(){return[]},We.prototype.getClass=function(){return We},We.bufferDistanceError=function(n){var i=Math.PI/2/n;return 1-Math.cos(i/2)},so.CAP_ROUND.get=function(){return 1},so.CAP_FLAT.get=function(){return 2},so.CAP_SQUARE.get=function(){return 3},so.JOIN_ROUND.get=function(){return 1},so.JOIN_MITRE.get=function(){return 2},so.JOIN_BEVEL.get=function(){return 3},so.DEFAULT_QUADRANT_SEGMENTS.get=function(){return 8},so.DEFAULT_MITRE_LIMIT.get=function(){return 5},so.DEFAULT_SIMPLIFY_FACTOR.get=function(){return .01},Object.defineProperties(We,so);var Mn=function(n){this._distanceTol=null,this._isDeleted=null,this._angleOrientation=B.COUNTERCLOCKWISE,this._inputLine=n||null},_u={INIT:{configurable:!0},DELETE:{configurable:!0},KEEP:{configurable:!0},NUM_PTS_TO_CHECK:{configurable:!0}};Mn.prototype.isDeletable=function(n,i,s,u){var c=this._inputLine[n],m=this._inputLine[i],E=this._inputLine[s];return!!this.isConcave(c,m,E)&&!!this.isShallow(c,m,E,u)&&this.isShallowSampled(c,m,n,s,u)},Mn.prototype.deleteShallowConcavities=function(){for(var n=1,i=this.findNextNonDeletedIndex(n),s=this.findNextNonDeletedIndex(i),u=!1;s<this._inputLine.length;){var c=!1;this.isDeletable(n,i,s,this._distanceTol)&&(this._isDeleted[i]=Mn.DELETE,c=!0,u=!0),n=c?s:i,i=this.findNextNonDeletedIndex(n),s=this.findNextNonDeletedIndex(i)}return u},Mn.prototype.isShallowConcavity=function(n,i,s,u){return B.computeOrientation(n,i,s)!==this._angleOrientation?!1:B.distancePointLine(i,n,s)<u},Mn.prototype.isShallowSampled=function(n,i,s,u,c){var m=Math.trunc((u-s)/Mn.NUM_PTS_TO_CHECK);m<=0&&(m=1);for(var E=s;E<u;E+=m)if(!this.isShallow(n,i,this._inputLine[E],c))return!1;return!0},Mn.prototype.isConcave=function(n,i,s){var u=B.computeOrientation(n,i,s)===this._angleOrientation;return u},Mn.prototype.simplify=function(n){this._distanceTol=Math.abs(n),n<0&&(this._angleOrientation=B.CLOCKWISE),this._isDeleted=new Array(this._inputLine.length).fill(null);var i=!1;do i=this.deleteShallowConcavities();while(i);return this.collapseLine()},Mn.prototype.findNextNonDeletedIndex=function(n){for(var i=n+1;i<this._inputLine.length&&this._isDeleted[i]===Mn.DELETE;)i++;return i},Mn.prototype.isShallow=function(n,i,s,u){return B.distancePointLine(i,n,s)<u},Mn.prototype.collapseLine=function(){for(var n=new Dt,i=0;i<this._inputLine.length;i++)this._isDeleted[i]!==Mn.DELETE&&n.add(this._inputLine[i]);return n.toCoordinateArray()},Mn.prototype.interfaces_=function(){return[]},Mn.prototype.getClass=function(){return Mn},Mn.simplify=function(n,i){return new Mn(n).simplify(i)},_u.INIT.get=function(){return 0},_u.DELETE.get=function(){return 1},_u.KEEP.get=function(){return 1},_u.NUM_PTS_TO_CHECK.get=function(){return 10},Object.defineProperties(Mn,_u);var Wr=function(){this._ptList=null,this._precisionModel=null,this._minimimVertexDistance=0,this._ptList=new j},Jd={COORDINATE_ARRAY_TYPE:{configurable:!0}};Wr.prototype.getCoordinates=function(){return this._ptList.toArray(Wr.COORDINATE_ARRAY_TYPE)},Wr.prototype.setPrecisionModel=function(n){this._precisionModel=n},Wr.prototype.addPt=function(n){var i=new L(n);if(this._precisionModel.makePrecise(i),this.isRedundant(i))return null;this._ptList.add(i)},Wr.prototype.revere=function(){},Wr.prototype.addPts=function(n,i){if(i)for(var s=0;s<n.length;s++)this.addPt(n[s]);else for(var u=n.length-1;u>=0;u--)this.addPt(n[u])},Wr.prototype.isRedundant=function(n){if(this._ptList.size()<1)return!1;var i=this._ptList.get(this._ptList.size()-1);return n.distance(i)<this._minimimVertexDistance},Wr.prototype.toString=function(){return new le().createLineString(this.getCoordinates()).toString()},Wr.prototype.closeRing=function(){if(this._ptList.size()<1)return null;var n=new L(this._ptList.get(0)),i=this._ptList.get(this._ptList.size()-1);if(n.equals(i))return null;this._ptList.add(n)},Wr.prototype.setMinimumVertexDistance=function(n){this._minimimVertexDistance=n},Wr.prototype.interfaces_=function(){return[]},Wr.prototype.getClass=function(){return Wr},Jd.COORDINATE_ARRAY_TYPE.get=function(){return new Array(0).fill(null)},Object.defineProperties(Wr,Jd);var me=function(){},As={PI_TIMES_2:{configurable:!0},PI_OVER_2:{configurable:!0},PI_OVER_4:{configurable:!0},COUNTERCLOCKWISE:{configurable:!0},CLOCKWISE:{configurable:!0},NONE:{configurable:!0}};me.prototype.interfaces_=function(){return[]},me.prototype.getClass=function(){return me},me.toDegrees=function(n){return 180*n/Math.PI},me.normalize=function(n){for(;n>Math.PI;)n-=me.PI_TIMES_2;for(;n<=-Math.PI;)n+=me.PI_TIMES_2;return n},me.angle=function(){if(arguments.length===1){var n=arguments[0];return Math.atan2(n.y,n.x)}if(arguments.length===2){var i=arguments[0],s=arguments[1],u=s.x-i.x,c=s.y-i.y;return Math.atan2(c,u)}},me.isAcute=function(n,i,s){var u=n.x-i.x,c=n.y-i.y;return u*(s.x-i.x)+c*(s.y-i.y)>0},me.isObtuse=function(n,i,s){var u=n.x-i.x,c=n.y-i.y;return u*(s.x-i.x)+c*(s.y-i.y)<0},me.interiorAngle=function(n,i,s){var u=me.angle(i,n),c=me.angle(i,s);return Math.abs(c-u)},me.normalizePositive=function(n){if(n<0){for(;n<0;)n+=me.PI_TIMES_2;n>=me.PI_TIMES_2&&(n=0)}else{for(;n>=me.PI_TIMES_2;)n-=me.PI_TIMES_2;n<0&&(n=0)}return n},me.angleBetween=function(n,i,s){var u=me.angle(i,n),c=me.angle(i,s);return me.diff(u,c)},me.diff=function(n,i){var s=null;return(s=n<i?i-n:n-i)>Math.PI&&(s=2*Math.PI-s),s},me.toRadians=function(n){return n*Math.PI/180},me.getTurn=function(n,i){var s=Math.sin(i-n);return s>0?me.COUNTERCLOCKWISE:s<0?me.CLOCKWISE:me.NONE},me.angleBetweenOriented=function(n,i,s){var u=me.angle(i,n),c=me.angle(i,s)-u;return c<=-Math.PI?c+me.PI_TIMES_2:c>Math.PI?c-me.PI_TIMES_2:c},As.PI_TIMES_2.get=function(){return 2*Math.PI},As.PI_OVER_2.get=function(){return Math.PI/2},As.PI_OVER_4.get=function(){return Math.PI/4},As.COUNTERCLOCKWISE.get=function(){return B.COUNTERCLOCKWISE},As.CLOCKWISE.get=function(){return B.CLOCKWISE},As.NONE.get=function(){return B.COLLINEAR},Object.defineProperties(me,As);var pn=function n(){this._maxCurveSegmentError=0,this._filletAngleQuantum=null,this._closingSegLengthFactor=1,this._segList=null,this._distance=0,this._precisionModel=null,this._bufParams=null,this._li=null,this._s0=null,this._s1=null,this._s2=null,this._seg0=new Zt,this._seg1=new Zt,this._offset0=new Zt,this._offset1=new Zt,this._side=0,this._hasNarrowConcaveAngle=!1;var i=arguments[0],s=arguments[1],u=arguments[2];this._precisionModel=i,this._bufParams=s,this._li=new J,this._filletAngleQuantum=Math.PI/2/s.getQuadrantSegments(),s.getQuadrantSegments()>=8&&s.getJoinStyle()===We.JOIN_ROUND&&(this._closingSegLengthFactor=n.MAX_CLOSING_SEG_LEN_FACTOR),this.init(u)},xu={OFFSET_SEGMENT_SEPARATION_FACTOR:{configurable:!0},INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR:{configurable:!0},CURVE_VERTEX_SNAP_DISTANCE_FACTOR:{configurable:!0},MAX_CLOSING_SEG_LEN_FACTOR:{configurable:!0}};pn.prototype.addNextSegment=function(n,i){if(this._s0=this._s1,this._s1=this._s2,this._s2=n,this._seg0.setCoordinates(this._s0,this._s1),this.computeOffsetSegment(this._seg0,this._side,this._distance,this._offset0),this._seg1.setCoordinates(this._s1,this._s2),this.computeOffsetSegment(this._seg1,this._side,this._distance,this._offset1),this._s1.equals(this._s2))return null;var s=B.computeOrientation(this._s0,this._s1,this._s2),u=s===B.CLOCKWISE&&this._side===bt.LEFT||s===B.COUNTERCLOCKWISE&&this._side===bt.RIGHT;s===0?this.addCollinear(i):u?this.addOutsideTurn(s,i):this.addInsideTurn(s,i)},pn.prototype.addLineEndCap=function(n,i){var s=new Zt(n,i),u=new Zt;this.computeOffsetSegment(s,bt.LEFT,this._distance,u);var c=new Zt;this.computeOffsetSegment(s,bt.RIGHT,this._distance,c);var m=i.x-n.x,E=i.y-n.y,T=Math.atan2(E,m);switch(this._bufParams.getEndCapStyle()){case We.CAP_ROUND:this._segList.addPt(u.p1),this.addFilletArc(i,T+Math.PI/2,T-Math.PI/2,B.CLOCKWISE,this._distance),this._segList.addPt(c.p1);break;case We.CAP_FLAT:this._segList.addPt(u.p1),this._segList.addPt(c.p1);break;case We.CAP_SQUARE:var U=new L;U.x=Math.abs(this._distance)*Math.cos(T),U.y=Math.abs(this._distance)*Math.sin(T);var Z=new L(u.p1.x+U.x,u.p1.y+U.y),ut=new L(c.p1.x+U.x,c.p1.y+U.y);this._segList.addPt(Z),this._segList.addPt(ut)}},pn.prototype.getCoordinates=function(){return this._segList.getCoordinates()},pn.prototype.addMitreJoin=function(n,i,s,u){var c=!0,m=null;try{m=ne.intersection(i.p0,i.p1,s.p0,s.p1),(u<=0?1:m.distance(n)/Math.abs(u))>this._bufParams.getMitreLimit()&&(c=!1)}catch(E){if(!(E instanceof Wt))throw E;m=new L(0,0),c=!1}c?this._segList.addPt(m):this.addLimitedMitreJoin(i,s,u,this._bufParams.getMitreLimit())},pn.prototype.addFilletCorner=function(n,i,s,u,c){var m=i.x-n.x,E=i.y-n.y,T=Math.atan2(E,m),U=s.x-n.x,Z=s.y-n.y,ut=Math.atan2(Z,U);u===B.CLOCKWISE?T<=ut&&(T+=2*Math.PI):T>=ut&&(T-=2*Math.PI),this._segList.addPt(i),this.addFilletArc(n,T,ut,u,c),this._segList.addPt(s)},pn.prototype.addOutsideTurn=function(n,i){if(this._offset0.p1.distance(this._offset1.p0)<this._distance*pn.OFFSET_SEGMENT_SEPARATION_FACTOR)return this._segList.addPt(this._offset0.p1),null;this._bufParams.getJoinStyle()===We.JOIN_MITRE?this.addMitreJoin(this._s1,this._offset0,this._offset1,this._distance):this._bufParams.getJoinStyle()===We.JOIN_BEVEL?this.addBevelJoin(this._offset0,this._offset1):(i&&this._segList.addPt(this._offset0.p1),this.addFilletCorner(this._s1,this._offset0.p1,this._offset1.p0,n,this._distance),this._segList.addPt(this._offset1.p0))},pn.prototype.createSquare=function(n){this._segList.addPt(new L(n.x+this._distance,n.y+this._distance)),this._segList.addPt(new L(n.x+this._distance,n.y-this._distance)),this._segList.addPt(new L(n.x-this._distance,n.y-this._distance)),this._segList.addPt(new L(n.x-this._distance,n.y+this._distance)),this._segList.closeRing()},pn.prototype.addSegments=function(n,i){this._segList.addPts(n,i)},pn.prototype.addFirstSegment=function(){this._segList.addPt(this._offset1.p0)},pn.prototype.addLastSegment=function(){this._segList.addPt(this._offset1.p1)},pn.prototype.initSideSegments=function(n,i,s){this._s1=n,this._s2=i,this._side=s,this._seg1.setCoordinates(n,i),this.computeOffsetSegment(this._seg1,s,this._distance,this._offset1)},pn.prototype.addLimitedMitreJoin=function(n,i,s,u){var c=this._seg0.p1,m=me.angle(c,this._seg0.p0),E=me.angleBetweenOriented(this._seg0.p0,c,this._seg1.p1)/2,T=me.normalize(m+E),U=me.normalize(T+Math.PI),Z=u*s,ut=s-Z*Math.abs(Math.sin(E)),ht=c.x+Z*Math.cos(U),At=c.y+Z*Math.sin(U),Rt=new L(ht,At),kt=new Zt(c,Rt),ee=kt.pointAlongOffset(1,ut),on=kt.pointAlongOffset(1,-ut);this._side===bt.LEFT?(this._segList.addPt(ee),this._segList.addPt(on)):(this._segList.addPt(on),this._segList.addPt(ee))},pn.prototype.computeOffsetSegment=function(n,i,s,u){var c=i===bt.LEFT?1:-1,m=n.p1.x-n.p0.x,E=n.p1.y-n.p0.y,T=Math.sqrt(m*m+E*E),U=c*s*m/T,Z=c*s*E/T;u.p0.x=n.p0.x-Z,u.p0.y=n.p0.y+U,u.p1.x=n.p1.x-Z,u.p1.y=n.p1.y+U},pn.prototype.addFilletArc=function(n,i,s,u,c){var m=u===B.CLOCKWISE?-1:1,E=Math.abs(i-s),T=Math.trunc(E/this._filletAngleQuantum+.5);if(T<1)return null;for(var U=E/T,Z=0,ut=new L;Z<E;){var ht=i+m*Z;ut.x=n.x+c*Math.cos(ht),ut.y=n.y+c*Math.sin(ht),this._segList.addPt(ut),Z+=U}},pn.prototype.addInsideTurn=function(n,i){if(this._li.computeIntersection(this._offset0.p0,this._offset0.p1,this._offset1.p0,this._offset1.p1),this._li.hasIntersection())this._segList.addPt(this._li.getIntersection(0));else if(this._hasNarrowConcaveAngle=!0,this._offset0.p1.distance(this._offset1.p0)<this._distance*pn.INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR)this._segList.addPt(this._offset0.p1);else{if(this._segList.addPt(this._offset0.p1),this._closingSegLengthFactor>0){var s=new L((this._closingSegLengthFactor*this._offset0.p1.x+this._s1.x)/(this._closingSegLengthFactor+1),(this._closingSegLengthFactor*this._offset0.p1.y+this._s1.y)/(this._closingSegLengthFactor+1));this._segList.addPt(s);var u=new L((this._closingSegLengthFactor*this._offset1.p0.x+this._s1.x)/(this._closingSegLengthFactor+1),(this._closingSegLengthFactor*this._offset1.p0.y+this._s1.y)/(this._closingSegLengthFactor+1));this._segList.addPt(u)}else this._segList.addPt(this._s1);this._segList.addPt(this._offset1.p0)}},pn.prototype.createCircle=function(n){var i=new L(n.x+this._distance,n.y);this._segList.addPt(i),this.addFilletArc(n,0,2*Math.PI,-1,this._distance),this._segList.closeRing()},pn.prototype.addBevelJoin=function(n,i){this._segList.addPt(n.p1),this._segList.addPt(i.p0)},pn.prototype.init=function(n){this._distance=n,this._maxCurveSegmentError=n*(1-Math.cos(this._filletAngleQuantum/2)),this._segList=new Wr,this._segList.setPrecisionModel(this._precisionModel),this._segList.setMinimumVertexDistance(n*pn.CURVE_VERTEX_SNAP_DISTANCE_FACTOR)},pn.prototype.addCollinear=function(n){this._li.computeIntersection(this._s0,this._s1,this._s1,this._s2),this._li.getIntersectionNum()>=2&&(this._bufParams.getJoinStyle()===We.JOIN_BEVEL||this._bufParams.getJoinStyle()===We.JOIN_MITRE?(n&&this._segList.addPt(this._offset0.p1),this._segList.addPt(this._offset1.p0)):this.addFilletCorner(this._s1,this._offset0.p1,this._offset1.p0,B.CLOCKWISE,this._distance))},pn.prototype.closeRing=function(){this._segList.closeRing()},pn.prototype.hasNarrowConcaveAngle=function(){return this._hasNarrowConcaveAngle},pn.prototype.interfaces_=function(){return[]},pn.prototype.getClass=function(){return pn},xu.OFFSET_SEGMENT_SEPARATION_FACTOR.get=function(){return .001},xu.INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR.get=function(){return .001},xu.CURVE_VERTEX_SNAP_DISTANCE_FACTOR.get=function(){return 1e-6},xu.MAX_CLOSING_SEG_LEN_FACTOR.get=function(){return 80},Object.defineProperties(pn,xu);var Mr=function(){this._distance=0,this._precisionModel=null,this._bufParams=null;var n=arguments[0],i=arguments[1];this._precisionModel=n,this._bufParams=i};Mr.prototype.getOffsetCurve=function(n,i){if(this._distance=i,i===0)return null;var s=i<0,u=Math.abs(i),c=this.getSegGen(u);n.length<=1?this.computePointCurve(n[0],c):this.computeOffsetCurve(n,s,c);var m=c.getCoordinates();return s&&ft.reverse(m),m},Mr.prototype.computeSingleSidedBufferCurve=function(n,i,s){var u=this.simplifyTolerance(this._distance);if(i){s.addSegments(n,!0);var c=Mn.simplify(n,-u),m=c.length-1;s.initSideSegments(c[m],c[m-1],bt.LEFT),s.addFirstSegment();for(var E=m-2;E>=0;E--)s.addNextSegment(c[E],!0)}else{s.addSegments(n,!1);var T=Mn.simplify(n,u),U=T.length-1;s.initSideSegments(T[0],T[1],bt.LEFT),s.addFirstSegment();for(var Z=2;Z<=U;Z++)s.addNextSegment(T[Z],!0)}s.addLastSegment(),s.closeRing()},Mr.prototype.computeRingBufferCurve=function(n,i,s){var u=this.simplifyTolerance(this._distance);i===bt.RIGHT&&(u=-u);var c=Mn.simplify(n,u),m=c.length-1;s.initSideSegments(c[m-1],c[0],i);for(var E=1;E<=m;E++){var T=E!==1;s.addNextSegment(c[E],T)}s.closeRing()},Mr.prototype.computeLineBufferCurve=function(n,i){var s=this.simplifyTolerance(this._distance),u=Mn.simplify(n,s),c=u.length-1;i.initSideSegments(u[0],u[1],bt.LEFT);for(var m=2;m<=c;m++)i.addNextSegment(u[m],!0);i.addLastSegment(),i.addLineEndCap(u[c-1],u[c]);var E=Mn.simplify(n,-s),T=E.length-1;i.initSideSegments(E[T],E[T-1],bt.LEFT);for(var U=T-2;U>=0;U--)i.addNextSegment(E[U],!0);i.addLastSegment(),i.addLineEndCap(E[1],E[0]),i.closeRing()},Mr.prototype.computePointCurve=function(n,i){switch(this._bufParams.getEndCapStyle()){case We.CAP_ROUND:i.createCircle(n);break;case We.CAP_SQUARE:i.createSquare(n)}},Mr.prototype.getLineCurve=function(n,i){if(this._distance=i,i<0&&!this._bufParams.isSingleSided()||i===0)return null;var s=Math.abs(i),u=this.getSegGen(s);if(n.length<=1)this.computePointCurve(n[0],u);else if(this._bufParams.isSingleSided()){var c=i<0;this.computeSingleSidedBufferCurve(n,c,u)}else this.computeLineBufferCurve(n,u);return u.getCoordinates()},Mr.prototype.getBufferParameters=function(){return this._bufParams},Mr.prototype.simplifyTolerance=function(n){return n*this._bufParams.getSimplifyFactor()},Mr.prototype.getRingCurve=function(n,i,s){if(this._distance=s,n.length<=2)return this.getLineCurve(n,s);if(s===0)return Mr.copyCoordinates(n);var u=this.getSegGen(s);return this.computeRingBufferCurve(n,i,u),u.getCoordinates()},Mr.prototype.computeOffsetCurve=function(n,i,s){var u=this.simplifyTolerance(this._distance);if(i){var c=Mn.simplify(n,-u),m=c.length-1;s.initSideSegments(c[m],c[m-1],bt.LEFT),s.addFirstSegment();for(var E=m-2;E>=0;E--)s.addNextSegment(c[E],!0)}else{var T=Mn.simplify(n,u),U=T.length-1;s.initSideSegments(T[0],T[1],bt.LEFT),s.addFirstSegment();for(var Z=2;Z<=U;Z++)s.addNextSegment(T[Z],!0)}s.addLastSegment()},Mr.prototype.getSegGen=function(n){return new pn(this._precisionModel,this._bufParams,n)},Mr.prototype.interfaces_=function(){return[]},Mr.prototype.getClass=function(){return Mr},Mr.copyCoordinates=function(n){for(var i=new Array(n.length).fill(null),s=0;s<i.length;s++)i[s]=new L(n[s]);return i};var Cs=function(){this._subgraphs=null,this._seg=new Zt,this._cga=new B;var n=arguments[0];this._subgraphs=n},$d={DepthSegment:{configurable:!0}};Cs.prototype.findStabbedSegments=function(){if(arguments.length===1){for(var n=arguments[0],i=new j,s=this._subgraphs.iterator();s.hasNext();){var u=s.next(),c=u.getEnvelope();n.y<c.getMinY()||n.y>c.getMaxY()||this.findStabbedSegments(n,u.getDirectedEdges(),i)}return i}if(arguments.length===3){if(X(arguments[2],wt)&&arguments[0]instanceof L&&arguments[1]instanceof yf){for(var m=arguments[0],E=arguments[1],T=arguments[2],U=E.getEdge().getCoordinates(),Z=0;Z<U.length-1;Z++)if(this._seg.p0=U[Z],this._seg.p1=U[Z+1],this._seg.p0.y>this._seg.p1.y&&this._seg.reverse(),!(Math.max(this._seg.p0.x,this._seg.p1.x)<m.x)&&!(this._seg.isHorizontal()||m.y<this._seg.p0.y||m.y>this._seg.p1.y||B.computeOrientation(this._seg.p0,this._seg.p1,m)===B.RIGHT)){var ut=E.getDepth(bt.LEFT);this._seg.p0.equals(U[Z])||(ut=E.getDepth(bt.RIGHT));var ht=new Jo(this._seg,ut);T.add(ht)}}else if(X(arguments[2],wt)&&arguments[0]instanceof L&&X(arguments[1],wt))for(var At=arguments[0],Rt=arguments[1],kt=arguments[2],ee=Rt.iterator();ee.hasNext();){var on=ee.next();on.isForward()&&this.findStabbedSegments(At,on,kt)}}},Cs.prototype.getDepth=function(n){var i=this.findStabbedSegments(n);return i.size()===0?0:di.min(i)._leftDepth},Cs.prototype.interfaces_=function(){return[]},Cs.prototype.getClass=function(){return Cs},$d.DepthSegment.get=function(){return Jo},Object.defineProperties(Cs,$d);var Jo=function(){this._upwardSeg=null,this._leftDepth=null;var n=arguments[0],i=arguments[1];this._upwardSeg=new Zt(n),this._leftDepth=i};Jo.prototype.compareTo=function(n){var i=n;if(this._upwardSeg.minX()>=i._upwardSeg.maxX())return 1;if(this._upwardSeg.maxX()<=i._upwardSeg.minX())return-1;var s=this._upwardSeg.orientationIndex(i._upwardSeg);return s!==0||(s=-1*i._upwardSeg.orientationIndex(this._upwardSeg))!=0?s:this._upwardSeg.compareTo(i._upwardSeg)},Jo.prototype.compareX=function(n,i){var s=n.p0.compareTo(i.p0);return s!==0?s:n.p1.compareTo(i.p1)},Jo.prototype.toString=function(){return this._upwardSeg.toString()},Jo.prototype.interfaces_=function(){return[F]},Jo.prototype.getClass=function(){return Jo};var qe=function(n,i,s){this.p0=n||null,this.p1=i||null,this.p2=s||null};qe.prototype.area=function(){return qe.area(this.p0,this.p1,this.p2)},qe.prototype.signedArea=function(){return qe.signedArea(this.p0,this.p1,this.p2)},qe.prototype.interpolateZ=function(n){if(n===null)throw new C("Supplied point is null.");return qe.interpolateZ(n,this.p0,this.p1,this.p2)},qe.prototype.longestSideLength=function(){return qe.longestSideLength(this.p0,this.p1,this.p2)},qe.prototype.isAcute=function(){return qe.isAcute(this.p0,this.p1,this.p2)},qe.prototype.circumcentre=function(){return qe.circumcentre(this.p0,this.p1,this.p2)},qe.prototype.area3D=function(){return qe.area3D(this.p0,this.p1,this.p2)},qe.prototype.centroid=function(){return qe.centroid(this.p0,this.p1,this.p2)},qe.prototype.inCentre=function(){return qe.inCentre(this.p0,this.p1,this.p2)},qe.prototype.interfaces_=function(){return[]},qe.prototype.getClass=function(){return qe},qe.area=function(n,i,s){return Math.abs(((s.x-n.x)*(i.y-n.y)-(i.x-n.x)*(s.y-n.y))/2)},qe.signedArea=function(n,i,s){return((s.x-n.x)*(i.y-n.y)-(i.x-n.x)*(s.y-n.y))/2},qe.det=function(n,i,s,u){return n*u-i*s},qe.interpolateZ=function(n,i,s,u){var c=i.x,m=i.y,E=s.x-c,T=u.x-c,U=s.y-m,Z=u.y-m,ut=E*Z-T*U,ht=n.x-c,At=n.y-m,Rt=(Z*ht-T*At)/ut,kt=(-U*ht+E*At)/ut;return i.z+Rt*(s.z-i.z)+kt*(u.z-i.z)},qe.longestSideLength=function(n,i,s){var u=n.distance(i),c=i.distance(s),m=s.distance(n),E=u;return c>E&&(E=c),m>E&&(E=m),E},qe.isAcute=function(n,i,s){return!!me.isAcute(n,i,s)&&!!me.isAcute(i,s,n)&&!!me.isAcute(s,n,i)},qe.circumcentre=function(n,i,s){var u=s.x,c=s.y,m=n.x-u,E=n.y-c,T=i.x-u,U=i.y-c,Z=2*qe.det(m,E,T,U),ut=qe.det(E,m*m+E*E,U,T*T+U*U),ht=qe.det(m,m*m+E*E,T,T*T+U*U);return new L(u-ut/Z,c+ht/Z)},qe.perpendicularBisector=function(n,i){var s=i.x-n.x,u=i.y-n.y,c=new ne(n.x+s/2,n.y+u/2,1),m=new ne(n.x-u+s/2,n.y+s+u/2,1);return new ne(c,m)},qe.angleBisector=function(n,i,s){var u=i.distance(n),c=u/(u+i.distance(s)),m=s.x-n.x,E=s.y-n.y;return new L(n.x+c*m,n.y+c*E)},qe.area3D=function(n,i,s){var u=i.x-n.x,c=i.y-n.y,m=i.z-n.z,E=s.x-n.x,T=s.y-n.y,U=s.z-n.z,Z=c*U-m*T,ut=m*E-u*U,ht=u*T-c*E,At=Z*Z+ut*ut+ht*ht,Rt=Math.sqrt(At)/2;return Rt},qe.centroid=function(n,i,s){var u=(n.x+i.x+s.x)/3,c=(n.y+i.y+s.y)/3;return new L(u,c)},qe.inCentre=function(n,i,s){var u=i.distance(s),c=n.distance(s),m=n.distance(i),E=u+c+m,T=(u*n.x+c*i.x+m*s.x)/E,U=(u*n.y+c*i.y+m*s.y)/E;return new L(T,U)};var ii=function(){this._inputGeom=null,this._distance=null,this._curveBuilder=null,this._curveList=new j;var n=arguments[0],i=arguments[1],s=arguments[2];this._inputGeom=n,this._distance=i,this._curveBuilder=s};ii.prototype.addPoint=function(n){if(this._distance<=0)return null;var i=n.getCoordinates(),s=this._curveBuilder.getLineCurve(i,this._distance);this.addCurve(s,k.EXTERIOR,k.INTERIOR)},ii.prototype.addPolygon=function(n){var i=this._distance,s=bt.LEFT;this._distance<0&&(i=-this._distance,s=bt.RIGHT);var u=n.getExteriorRing(),c=ft.removeRepeatedPoints(u.getCoordinates());if(this._distance<0&&this.isErodedCompletely(u,this._distance)||this._distance<=0&&c.length<3)return null;this.addPolygonRing(c,i,s,k.EXTERIOR,k.INTERIOR);for(var m=0;m<n.getNumInteriorRing();m++){var E=n.getInteriorRingN(m),T=ft.removeRepeatedPoints(E.getCoordinates());this._distance>0&&this.isErodedCompletely(E,-this._distance)||this.addPolygonRing(T,i,bt.opposite(s),k.INTERIOR,k.EXTERIOR)}},ii.prototype.isTriangleErodedCompletely=function(n,i){var s=new qe(n[0],n[1],n[2]),u=s.inCentre();return B.distancePointLine(u,s.p0,s.p1)<Math.abs(i)},ii.prototype.addLineString=function(n){if(this._distance<=0&&!this._curveBuilder.getBufferParameters().isSingleSided())return null;var i=ft.removeRepeatedPoints(n.getCoordinates()),s=this._curveBuilder.getLineCurve(i,this._distance);this.addCurve(s,k.EXTERIOR,k.INTERIOR)},ii.prototype.addCurve=function(n,i,s){if(n===null||n.length<2)return null;var u=new wn(n,new rn(0,k.BOUNDARY,i,s));this._curveList.add(u)},ii.prototype.getCurves=function(){return this.add(this._inputGeom),this._curveList},ii.prototype.addPolygonRing=function(n,i,s,u,c){if(i===0&&n.length<sn.MINIMUM_VALID_SIZE)return null;var m=u,E=c;n.length>=sn.MINIMUM_VALID_SIZE&&B.isCCW(n)&&(m=c,E=u,s=bt.opposite(s));var T=this._curveBuilder.getRingCurve(n,s,i);this.addCurve(T,m,E)},ii.prototype.add=function(n){if(n.isEmpty())return null;n instanceof Vt?this.addPolygon(n):n instanceof Bt?this.addLineString(n):n instanceof Qt?this.addPoint(n):n instanceof fe?this.addCollection(n):n instanceof H?this.addCollection(n):n instanceof un?this.addCollection(n):n instanceof Vn&&this.addCollection(n)},ii.prototype.isErodedCompletely=function(n,i){var s=n.getCoordinates();if(s.length<4)return i<0;if(s.length===4)return this.isTriangleErodedCompletely(s,i);var u=n.getEnvelopeInternal(),c=Math.min(u.getHeight(),u.getWidth());return i<0&&2*Math.abs(i)>c},ii.prototype.addCollection=function(n){for(var i=0;i<n.getNumGeometries();i++){var s=n.getGeometryN(i);this.add(s)}},ii.prototype.interfaces_=function(){return[]},ii.prototype.getClass=function(){return ii};var ua=function(){};ua.prototype.locate=function(n){},ua.prototype.interfaces_=function(){return[]},ua.prototype.getClass=function(){return ua};var zi=function(){this._parent=null,this._atStart=null,this._max=null,this._index=null,this._subcollectionIterator=null;var n=arguments[0];this._parent=n,this._atStart=!0,this._index=0,this._max=n.getNumGeometries()};zi.prototype.next=function(){if(this._atStart)return this._atStart=!1,zi.isAtomic(this._parent)&&this._index++,this._parent;if(this._subcollectionIterator!==null){if(this._subcollectionIterator.hasNext())return this._subcollectionIterator.next();this._subcollectionIterator=null}if(this._index>=this._max)throw new o;var n=this._parent.getGeometryN(this._index++);return n instanceof Vn?(this._subcollectionIterator=new zi(n),this._subcollectionIterator.next()):n},zi.prototype.remove=function(){throw new Error(this.getClass().getName())},zi.prototype.hasNext=function(){if(this._atStart)return!0;if(this._subcollectionIterator!==null){if(this._subcollectionIterator.hasNext())return!0;this._subcollectionIterator=null}return!(this._index>=this._max)},zi.prototype.interfaces_=function(){return[Y]},zi.prototype.getClass=function(){return zi},zi.isAtomic=function(n){return!(n instanceof Vn)};var qr=function(){this._geom=null;var n=arguments[0];this._geom=n};qr.prototype.locate=function(n){return qr.locate(n,this._geom)},qr.prototype.interfaces_=function(){return[ua]},qr.prototype.getClass=function(){return qr},qr.isPointInRing=function(n,i){return!!i.getEnvelopeInternal().intersects(n)&&B.isPointInRing(n,i.getCoordinates())},qr.containsPointInPolygon=function(n,i){if(i.isEmpty())return!1;var s=i.getExteriorRing();if(!qr.isPointInRing(n,s))return!1;for(var u=0;u<i.getNumInteriorRing();u++){var c=i.getInteriorRingN(u);if(qr.isPointInRing(n,c))return!1}return!0},qr.containsPoint=function(n,i){if(i instanceof Vt)return qr.containsPointInPolygon(n,i);if(i instanceof Vn)for(var s=new zi(i);s.hasNext();){var u=s.next();if(u!==i&&qr.containsPoint(n,u))return!0}return!1},qr.locate=function(n,i){return i.isEmpty()?k.EXTERIOR:qr.containsPoint(n,i)?k.INTERIOR:k.EXTERIOR};var jn=function(){this._edgeMap=new _,this._edgeList=null,this._ptInAreaLocation=[k.NONE,k.NONE]};jn.prototype.getNextCW=function(n){this.getEdges();var i=this._edgeList.indexOf(n),s=i-1;return i===0&&(s=this._edgeList.size()-1),this._edgeList.get(s)},jn.prototype.propagateSideLabels=function(n){for(var i=k.NONE,s=this.iterator();s.hasNext();){var u=s.next().getLabel();u.isArea(n)&&u.getLocation(n,bt.LEFT)!==k.NONE&&(i=u.getLocation(n,bt.LEFT))}if(i===k.NONE)return null;for(var c=i,m=this.iterator();m.hasNext();){var E=m.next(),T=E.getLabel();if(T.getLocation(n,bt.ON)===k.NONE&&T.setLocation(n,bt.ON,c),T.isArea(n)){var U=T.getLocation(n,bt.LEFT),Z=T.getLocation(n,bt.RIGHT);if(Z!==k.NONE){if(Z!==c)throw new io("side location conflict",E.getCoordinate());U===k.NONE&&b.shouldNeverReachHere("found single null side (at "+E.getCoordinate()+")"),c=U}else b.isTrue(T.getLocation(n,bt.LEFT)===k.NONE,"found single null side"),T.setLocation(n,bt.RIGHT,c),T.setLocation(n,bt.LEFT,c)}}},jn.prototype.getCoordinate=function(){var n=this.iterator();return n.hasNext()?n.next().getCoordinate():null},jn.prototype.print=function(n){Nt.out.println("EdgeEndStar: "+this.getCoordinate());for(var i=this.iterator();i.hasNext();)i.next().print(n)},jn.prototype.isAreaLabelsConsistent=function(n){return this.computeEdgeEndLabels(n.getBoundaryNodeRule()),this.checkAreaLabelsConsistent(0)},jn.prototype.checkAreaLabelsConsistent=function(n){var i=this.getEdges();if(i.size()<=0)return!0;var s=i.size()-1,u=i.get(s).getLabel().getLocation(n,bt.LEFT);b.isTrue(u!==k.NONE,"Found unlabelled area edge");for(var c=u,m=this.iterator();m.hasNext();){var E=m.next().getLabel();b.isTrue(E.isArea(n),"Found non-area edge");var T=E.getLocation(n,bt.LEFT),U=E.getLocation(n,bt.RIGHT);if(T===U||U!==c)return!1;c=T}return!0},jn.prototype.findIndex=function(n){this.iterator();for(var i=0;i<this._edgeList.size();i++)if(this._edgeList.get(i)===n)return i;return-1},jn.prototype.iterator=function(){return this.getEdges().iterator()},jn.prototype.getEdges=function(){return this._edgeList===null&&(this._edgeList=new j(this._edgeMap.values())),this._edgeList},jn.prototype.getLocation=function(n,i,s){return this._ptInAreaLocation[n]===k.NONE&&(this._ptInAreaLocation[n]=qr.locate(i,s[n].getGeometry())),this._ptInAreaLocation[n]},jn.prototype.toString=function(){var n=new pt;n.append("EdgeEndStar: "+this.getCoordinate()),n.append(`\n`);for(var i=this.iterator();i.hasNext();){var s=i.next();n.append(s),n.append(`\n`)}return n.toString()},jn.prototype.computeEdgeEndLabels=function(n){for(var i=this.iterator();i.hasNext();)i.next().computeLabel(n)},jn.prototype.computeLabelling=function(n){this.computeEdgeEndLabels(n[0].getBoundaryNodeRule()),this.propagateSideLabels(0),this.propagateSideLabels(1);for(var i=[!1,!1],s=this.iterator();s.hasNext();)for(var u=s.next().getLabel(),c=0;c<2;c++)u.isLine(c)&&u.getLocation(c)===k.BOUNDARY&&(i[c]=!0);for(var m=this.iterator();m.hasNext();)for(var E=m.next(),T=E.getLabel(),U=0;U<2;U++)if(T.isAnyNull(U)){var Z=k.NONE;if(i[U])Z=k.EXTERIOR;else{var ut=E.getCoordinate();Z=this.getLocation(U,ut,n)}T.setAllLocationsIfNull(U,Z)}},jn.prototype.getDegree=function(){return this._edgeMap.size()},jn.prototype.insertEdgeEnd=function(n,i){this._edgeMap.put(n,i),this._edgeList=null},jn.prototype.interfaces_=function(){return[]},jn.prototype.getClass=function(){return jn};var M1=function(n){function i(){n.call(this),this._resultAreaEdgeList=null,this._label=null,this._SCANNING_FOR_INCOMING=1,this._LINKING_TO_OUTGOING=2}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.linkResultDirectedEdges=function(){this.getResultAreaEdges();for(var s=null,u=null,c=this._SCANNING_FOR_INCOMING,m=0;m<this._resultAreaEdgeList.size();m++){var E=this._resultAreaEdgeList.get(m),T=E.getSym();if(E.getLabel().isArea())switch(s===null&&E.isInResult()&&(s=E),c){case this._SCANNING_FOR_INCOMING:if(!T.isInResult())continue;u=T,c=this._LINKING_TO_OUTGOING;break;case this._LINKING_TO_OUTGOING:if(!E.isInResult())continue;u.setNext(E),c=this._SCANNING_FOR_INCOMING}}if(c===this._LINKING_TO_OUTGOING){if(s===null)throw new io("no outgoing dirEdge found",this.getCoordinate());b.isTrue(s.isInResult(),"unable to link last incoming dirEdge"),u.setNext(s)}},i.prototype.insert=function(s){var u=s;this.insertEdgeEnd(u,u)},i.prototype.getRightmostEdge=function(){var s=this.getEdges(),u=s.size();if(u<1)return null;var c=s.get(0);if(u===1)return c;var m=s.get(u-1),E=c.getQuadrant(),T=m.getQuadrant();return ln.isNorthern(E)&&ln.isNorthern(T)?c:ln.isNorthern(E)||ln.isNorthern(T)?c.getDy()!==0?c:m.getDy()!==0?m:(b.shouldNeverReachHere("found two horizontal edges incident on node"),null):m},i.prototype.print=function(s){Nt.out.println("DirectedEdgeStar: "+this.getCoordinate());for(var u=this.iterator();u.hasNext();){var c=u.next();s.print("out "),c.print(s),s.println(),s.print("in "),c.getSym().print(s),s.println()}},i.prototype.getResultAreaEdges=function(){if(this._resultAreaEdgeList!==null)return this._resultAreaEdgeList;this._resultAreaEdgeList=new j;for(var s=this.iterator();s.hasNext();){var u=s.next();(u.isInResult()||u.getSym().isInResult())&&this._resultAreaEdgeList.add(u)}return this._resultAreaEdgeList},i.prototype.updateLabelling=function(s){for(var u=this.iterator();u.hasNext();){var c=u.next().getLabel();c.setAllLocationsIfNull(0,s.getLocation(0)),c.setAllLocationsIfNull(1,s.getLocation(1))}},i.prototype.linkAllDirectedEdges=function(){this.getEdges();for(var s=null,u=null,c=this._edgeList.size()-1;c>=0;c--){var m=this._edgeList.get(c),E=m.getSym();u===null&&(u=E),s!==null&&E.setNext(s),s=m}u.setNext(s)},i.prototype.computeDepths=function(){if(arguments.length===1){var s=arguments[0],u=this.findIndex(s),c=s.getDepth(bt.LEFT),m=s.getDepth(bt.RIGHT),E=this.computeDepths(u+1,this._edgeList.size(),c);if(this.computeDepths(0,u,E)!==m)throw new io("depth mismatch at "+s.getCoordinate())}else if(arguments.length===3){for(var T=arguments[0],U=arguments[1],Z=arguments[2],ut=T;ut<U;ut++){var ht=this._edgeList.get(ut);ht.setEdgeDepths(bt.RIGHT,Z),Z=ht.getDepth(bt.LEFT)}return Z}},i.prototype.mergeSymLabels=function(){for(var s=this.iterator();s.hasNext();){var u=s.next();u.getLabel().merge(u.getSym().getLabel())}},i.prototype.linkMinimalDirectedEdges=function(s){for(var u=null,c=null,m=this._SCANNING_FOR_INCOMING,E=this._resultAreaEdgeList.size()-1;E>=0;E--){var T=this._resultAreaEdgeList.get(E),U=T.getSym();switch(u===null&&T.getEdgeRing()===s&&(u=T),m){case this._SCANNING_FOR_INCOMING:if(U.getEdgeRing()!==s)continue;c=U,m=this._LINKING_TO_OUTGOING;break;case this._LINKING_TO_OUTGOING:if(T.getEdgeRing()!==s)continue;c.setNextMin(T),m=this._SCANNING_FOR_INCOMING}}m===this._LINKING_TO_OUTGOING&&(b.isTrue(u!==null,"found null for first outgoing dirEdge"),b.isTrue(u.getEdgeRing()===s,"unable to link last incoming dirEdge"),c.setNextMin(u))},i.prototype.getOutgoingDegree=function(){if(arguments.length===0){for(var s=0,u=this.iterator();u.hasNext();)u.next().isInResult()&&s++;return s}if(arguments.length===1){for(var c=arguments[0],m=0,E=this.iterator();E.hasNext();)E.next().getEdgeRing()===c&&m++;return m}},i.prototype.getLabel=function(){return this._label},i.prototype.findCoveredLineEdges=function(){for(var s=k.NONE,u=this.iterator();u.hasNext();){var c=u.next(),m=c.getSym();if(!c.isLineEdge()){if(c.isInResult()){s=k.INTERIOR;break}if(m.isInResult()){s=k.EXTERIOR;break}}}if(s===k.NONE)return null;for(var E=s,T=this.iterator();T.hasNext();){var U=T.next(),Z=U.getSym();U.isLineEdge()?U.getEdge().setCovered(E===k.INTERIOR):(U.isInResult()&&(E=k.EXTERIOR),Z.isInResult()&&(E=k.INTERIOR))}},i.prototype.computeLabelling=function(s){n.prototype.computeLabelling.call(this,s),this._label=new rn(k.NONE);for(var u=this.iterator();u.hasNext();)for(var c=u.next().getEdge().getLabel(),m=0;m<2;m++){var E=c.getLocation(m);E!==k.INTERIOR&&E!==k.BOUNDARY||this._label.setLocation(m,k.INTERIOR)}},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(jn),Kd=function(n){function i(){n.apply(this,arguments)}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.createNode=function(s){return new El(s,new M1)},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(oa),wo=function n(){this._pts=null,this._orientation=null;var i=arguments[0];this._pts=i,this._orientation=n.orientation(i)};wo.prototype.compareTo=function(n){var i=n;return wo.compareOriented(this._pts,this._orientation,i._pts,i._orientation)},wo.prototype.interfaces_=function(){return[F]},wo.prototype.getClass=function(){return wo},wo.orientation=function(n){return ft.increasingDirection(n)===1},wo.compareOriented=function(n,i,s,u){for(var c=i?1:-1,m=u?1:-1,E=i?n.length:-1,T=u?s.length:-1,U=i?0:n.length-1,Z=u?0:s.length-1;;){var ut=n[U].compareTo(s[Z]);if(ut!==0)return ut;var ht=(U+=c)===E,At=(Z+=m)===T;if(ht&&!At)return-1;if(!ht&&At)return 1;if(ht&&At)return 0}};var mi=function(){this._edges=new j,this._ocaMap=new _};mi.prototype.print=function(n){n.print("MULTILINESTRING ( ");for(var i=0;i<this._edges.size();i++){var s=this._edges.get(i);i>0&&n.print(","),n.print("(");for(var u=s.getCoordinates(),c=0;c<u.length;c++)c>0&&n.print(","),n.print(u[c].x+" "+u[c].y);n.println(")")}n.print(") ")},mi.prototype.addAll=function(n){for(var i=n.iterator();i.hasNext();)this.add(i.next())},mi.prototype.findEdgeIndex=function(n){for(var i=0;i<this._edges.size();i++)if(this._edges.get(i).equals(n))return i;return-1},mi.prototype.iterator=function(){return this._edges.iterator()},mi.prototype.getEdges=function(){return this._edges},mi.prototype.get=function(n){return this._edges.get(n)},mi.prototype.findEqualEdge=function(n){var i=new wo(n.getCoordinates());return this._ocaMap.get(i)},mi.prototype.add=function(n){this._edges.add(n);var i=new wo(n.getCoordinates());this._ocaMap.put(i,n)},mi.prototype.interfaces_=function(){return[]},mi.prototype.getClass=function(){return mi};var $o=function(){};$o.prototype.processIntersections=function(n,i,s,u){},$o.prototype.isDone=function(){},$o.prototype.interfaces_=function(){return[]},$o.prototype.getClass=function(){return $o};var Xr=function(){this._hasIntersection=!1,this._hasProper=!1,this._hasProperInterior=!1,this._hasInterior=!1,this._properIntersectionPoint=null,this._li=null,this._isSelfIntersection=null,this.numIntersections=0,this.numInteriorIntersections=0,this.numProperIntersections=0,this.numTests=0;var n=arguments[0];this._li=n};Xr.prototype.isTrivialIntersection=function(n,i,s,u){if(n===s&&this._li.getIntersectionNum()===1){if(Xr.isAdjacentSegments(i,u))return!0;if(n.isClosed()){var c=n.size()-1;if(i===0&&u===c||u===0&&i===c)return!0}}return!1},Xr.prototype.getProperIntersectionPoint=function(){return this._properIntersectionPoint},Xr.prototype.hasProperInteriorIntersection=function(){return this._hasProperInterior},Xr.prototype.getLineIntersector=function(){return this._li},Xr.prototype.hasProperIntersection=function(){return this._hasProper},Xr.prototype.processIntersections=function(n,i,s,u){if(n===s&&i===u)return null;this.numTests++;var c=n.getCoordinates()[i],m=n.getCoordinates()[i+1],E=s.getCoordinates()[u],T=s.getCoordinates()[u+1];this._li.computeIntersection(c,m,E,T),this._li.hasIntersection()&&(this.numIntersections++,this._li.isInteriorIntersection()&&(this.numInteriorIntersections++,this._hasInterior=!0),this.isTrivialIntersection(n,i,s,u)||(this._hasIntersection=!0,n.addIntersections(this._li,i,0),s.addIntersections(this._li,u,1),this._li.isProper()&&(this.numProperIntersections++,this._hasProper=!0,this._hasProperInterior=!0)))},Xr.prototype.hasIntersection=function(){return this._hasIntersection},Xr.prototype.isDone=function(){return!1},Xr.prototype.hasInteriorIntersection=function(){return this._hasInterior},Xr.prototype.interfaces_=function(){return[$o]},Xr.prototype.getClass=function(){return Xr},Xr.isAdjacentSegments=function(n,i){return Math.abs(n-i)===1};var Ai=function(){this.coord=null,this.segmentIndex=null,this.dist=null;var n=arguments[0],i=arguments[1],s=arguments[2];this.coord=new L(n),this.segmentIndex=i,this.dist=s};Ai.prototype.getSegmentIndex=function(){return this.segmentIndex},Ai.prototype.getCoordinate=function(){return this.coord},Ai.prototype.print=function(n){n.print(this.coord),n.print(" seg # = "+this.segmentIndex),n.println(" dist = "+this.dist)},Ai.prototype.compareTo=function(n){var i=n;return this.compare(i.segmentIndex,i.dist)},Ai.prototype.isEndPoint=function(n){return this.segmentIndex===0&&this.dist===0||this.segmentIndex===n},Ai.prototype.toString=function(){return this.coord+" seg # = "+this.segmentIndex+" dist = "+this.dist},Ai.prototype.getDistance=function(){return this.dist},Ai.prototype.compare=function(n,i){return this.segmentIndex<n?-1:this.segmentIndex>n?1:this.dist<i?-1:this.dist>i?1:0},Ai.prototype.interfaces_=function(){return[F]},Ai.prototype.getClass=function(){return Ai};var ki=function(){this._nodeMap=new _,this.edge=null;var n=arguments[0];this.edge=n};ki.prototype.print=function(n){n.println("Intersections:");for(var i=this.iterator();i.hasNext();)i.next().print(n)},ki.prototype.iterator=function(){return this._nodeMap.values().iterator()},ki.prototype.addSplitEdges=function(n){this.addEndpoints();for(var i=this.iterator(),s=i.next();i.hasNext();){var u=i.next(),c=this.createSplitEdge(s,u);n.add(c),s=u}},ki.prototype.addEndpoints=function(){var n=this.edge.pts.length-1;this.add(this.edge.pts[0],0,0),this.add(this.edge.pts[n],n,0)},ki.prototype.createSplitEdge=function(n,i){var s=i.segmentIndex-n.segmentIndex+2,u=this.edge.pts[i.segmentIndex],c=i.dist>0||!i.coord.equals2D(u);c||s--;var m=new Array(s).fill(null),E=0;m[E++]=new L(n.coord);for(var T=n.segmentIndex+1;T<=i.segmentIndex;T++)m[E++]=this.edge.pts[T];return c&&(m[E]=i.coord),new Sl(m,new rn(this.edge._label))},ki.prototype.add=function(n,i,s){var u=new Ai(n,i,s),c=this._nodeMap.get(u);return c!==null?c:(this._nodeMap.put(u,u),u)},ki.prototype.isIntersection=function(n){for(var i=this.iterator();i.hasNext();)if(i.next().coord.equals(n))return!0;return!1},ki.prototype.interfaces_=function(){return[]},ki.prototype.getClass=function(){return ki};var Ko=function(){};Ko.prototype.getChainStartIndices=function(n){var i=0,s=new j;s.add(new et(i));do{var u=this.findChainEnd(n,i);s.add(new et(u)),i=u}while(i<n.length-1);return Ko.toIntArray(s)},Ko.prototype.findChainEnd=function(n,i){for(var s=ln.quadrant(n[i],n[i+1]),u=i+1;u<n.length&&ln.quadrant(n[u-1],n[u])===s;)u++;return u-1},Ko.prototype.interfaces_=function(){return[]},Ko.prototype.getClass=function(){return Ko},Ko.toIntArray=function(n){for(var i=new Array(n.size()).fill(null),s=0;s<i.length;s++)i[s]=n.get(s).intValue();return i};var ao=function(){this.e=null,this.pts=null,this.startIndex=null,this.env1=new Pt,this.env2=new Pt;var n=arguments[0];this.e=n,this.pts=n.getCoordinates();var i=new Ko;this.startIndex=i.getChainStartIndices(this.pts)};ao.prototype.getCoordinates=function(){return this.pts},ao.prototype.getMaxX=function(n){var i=this.pts[this.startIndex[n]].x,s=this.pts[this.startIndex[n+1]].x;return i>s?i:s},ao.prototype.getMinX=function(n){var i=this.pts[this.startIndex[n]].x,s=this.pts[this.startIndex[n+1]].x;return i<s?i:s},ao.prototype.computeIntersectsForChain=function(){if(arguments.length===4){var n=arguments[0],i=arguments[1],s=arguments[2],u=arguments[3];this.computeIntersectsForChain(this.startIndex[n],this.startIndex[n+1],i,i.startIndex[s],i.startIndex[s+1],u)}else if(arguments.length===6){var c=arguments[0],m=arguments[1],E=arguments[2],T=arguments[3],U=arguments[4],Z=arguments[5],ut=this.pts[c],ht=this.pts[m],At=E.pts[T],Rt=E.pts[U];if(m-c==1&&U-T==1)return Z.addIntersections(this.e,c,E.e,T),null;if(this.env1.init(ut,ht),this.env2.init(At,Rt),!this.env1.intersects(this.env2))return null;var kt=Math.trunc((c+m)/2),ee=Math.trunc((T+U)/2);c<kt&&(T<ee&&this.computeIntersectsForChain(c,kt,E,T,ee,Z),ee<U&&this.computeIntersectsForChain(c,kt,E,ee,U,Z)),kt<m&&(T<ee&&this.computeIntersectsForChain(kt,m,E,T,ee,Z),ee<U&&this.computeIntersectsForChain(kt,m,E,ee,U,Z))}},ao.prototype.getStartIndexes=function(){return this.startIndex},ao.prototype.computeIntersects=function(n,i){for(var s=0;s<this.startIndex.length-1;s++)for(var u=0;u<n.startIndex.length-1;u++)this.computeIntersectsForChain(s,n,u,i)},ao.prototype.interfaces_=function(){return[]},ao.prototype.getClass=function(){return ao};var Hn=function n(){this._depth=Array(2).fill().map(function(){return Array(3)});for(var i=0;i<2;i++)for(var s=0;s<3;s++)this._depth[i][s]=n.NULL_VALUE},jd={NULL_VALUE:{configurable:!0}};Hn.prototype.getDepth=function(n,i){return this._depth[n][i]},Hn.prototype.setDepth=function(n,i,s){this._depth[n][i]=s},Hn.prototype.isNull=function(){if(arguments.length===0){for(var n=0;n<2;n++)for(var i=0;i<3;i++)if(this._depth[n][i]!==Hn.NULL_VALUE)return!1;return!0}if(arguments.length===1){var s=arguments[0];return this._depth[s][1]===Hn.NULL_VALUE}if(arguments.length===2){var u=arguments[0],c=arguments[1];return this._depth[u][c]===Hn.NULL_VALUE}},Hn.prototype.normalize=function(){for(var n=0;n<2;n++)if(!this.isNull(n)){var i=this._depth[n][1];this._depth[n][2]<i&&(i=this._depth[n][2]),i<0&&(i=0);for(var s=1;s<3;s++){var u=0;this._depth[n][s]>i&&(u=1),this._depth[n][s]=u}}},Hn.prototype.getDelta=function(n){return this._depth[n][bt.RIGHT]-this._depth[n][bt.LEFT]},Hn.prototype.getLocation=function(n,i){return this._depth[n][i]<=0?k.EXTERIOR:k.INTERIOR},Hn.prototype.toString=function(){return"A: "+this._depth[0][1]+","+this._depth[0][2]+" B: "+this._depth[1][1]+","+this._depth[1][2]},Hn.prototype.add=function(){if(arguments.length===1)for(var n=arguments[0],i=0;i<2;i++)for(var s=1;s<3;s++){var u=n.getLocation(i,s);u!==k.EXTERIOR&&u!==k.INTERIOR||(this.isNull(i,s)?this._depth[i][s]=Hn.depthAtLocation(u):this._depth[i][s]+=Hn.depthAtLocation(u))}else if(arguments.length===3){var c=arguments[0],m=arguments[1];arguments[2]===k.INTERIOR&&this._depth[c][m]++}},Hn.prototype.interfaces_=function(){return[]},Hn.prototype.getClass=function(){return Hn},Hn.depthAtLocation=function(n){return n===k.EXTERIOR?0:n===k.INTERIOR?1:Hn.NULL_VALUE},jd.NULL_VALUE.get=function(){return-1},Object.defineProperties(Hn,jd);var Sl=function(n){function i(){if(n.call(this),this.pts=null,this._env=null,this.eiList=new ki(this),this._name=null,this._mce=null,this._isIsolated=!0,this._depth=new Hn,this._depthDelta=0,arguments.length===1){var s=arguments[0];i.call(this,s,null)}else if(arguments.length===2){var u=arguments[0],c=arguments[1];this.pts=u,this._label=c}}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.getDepth=function(){return this._depth},i.prototype.getCollapsedEdge=function(){var s=new Array(2).fill(null);return s[0]=this.pts[0],s[1]=this.pts[1],new i(s,rn.toLineLabel(this._label))},i.prototype.isIsolated=function(){return this._isIsolated},i.prototype.getCoordinates=function(){return this.pts},i.prototype.setIsolated=function(s){this._isIsolated=s},i.prototype.setName=function(s){this._name=s},i.prototype.equals=function(s){if(!(s instanceof i))return!1;var u=s;if(this.pts.length!==u.pts.length)return!1;for(var c=!0,m=!0,E=this.pts.length,T=0;T<this.pts.length;T++)if(this.pts[T].equals2D(u.pts[T])||(c=!1),this.pts[T].equals2D(u.pts[--E])||(m=!1),!c&&!m)return!1;return!0},i.prototype.getCoordinate=function(){if(arguments.length===0)return this.pts.length>0?this.pts[0]:null;if(arguments.length===1){var s=arguments[0];return this.pts[s]}},i.prototype.print=function(s){s.print("edge "+this._name+": "),s.print("LINESTRING (");for(var u=0;u<this.pts.length;u++)u>0&&s.print(","),s.print(this.pts[u].x+" "+this.pts[u].y);s.print(") "+this._label+" "+this._depthDelta)},i.prototype.computeIM=function(s){i.updateIM(this._label,s)},i.prototype.isCollapsed=function(){return!!this._label.isArea()&&this.pts.length===3&&!!this.pts[0].equals(this.pts[2])},i.prototype.isClosed=function(){return this.pts[0].equals(this.pts[this.pts.length-1])},i.prototype.getMaximumSegmentIndex=function(){return this.pts.length-1},i.prototype.getDepthDelta=function(){return this._depthDelta},i.prototype.getNumPoints=function(){return this.pts.length},i.prototype.printReverse=function(s){s.print("edge "+this._name+": ");for(var u=this.pts.length-1;u>=0;u--)s.print(this.pts[u]+" ");s.println("")},i.prototype.getMonotoneChainEdge=function(){return this._mce===null&&(this._mce=new ao(this)),this._mce},i.prototype.getEnvelope=function(){if(this._env===null){this._env=new Pt;for(var s=0;s<this.pts.length;s++)this._env.expandToInclude(this.pts[s])}return this._env},i.prototype.addIntersection=function(s,u,c,m){var E=new L(s.getIntersection(m)),T=u,U=s.getEdgeDistance(c,m),Z=T+1;if(Z<this.pts.length){var ut=this.pts[Z];E.equals2D(ut)&&(T=Z,U=0)}this.eiList.add(E,T,U)},i.prototype.toString=function(){var s=new pt;s.append("edge "+this._name+": "),s.append("LINESTRING (");for(var u=0;u<this.pts.length;u++)u>0&&s.append(","),s.append(this.pts[u].x+" "+this.pts[u].y);return s.append(") "+this._label+" "+this._depthDelta),s.toString()},i.prototype.isPointwiseEqual=function(s){if(this.pts.length!==s.pts.length)return!1;for(var u=0;u<this.pts.length;u++)if(!this.pts[u].equals2D(s.pts[u]))return!1;return!0},i.prototype.setDepthDelta=function(s){this._depthDelta=s},i.prototype.getEdgeIntersectionList=function(){return this.eiList},i.prototype.addIntersections=function(s,u,c){for(var m=0;m<s.getIntersectionNum();m++)this.addIntersection(s,u,c,m)},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i.updateIM=function(){if(arguments.length!==2)return n.prototype.updateIM.apply(this,arguments);var s=arguments[0],u=arguments[1];u.setAtLeastIfValid(s.getLocation(0,bt.ON),s.getLocation(1,bt.ON),1),s.isArea()&&(u.setAtLeastIfValid(s.getLocation(0,bt.LEFT),s.getLocation(1,bt.LEFT),2),u.setAtLeastIfValid(s.getLocation(0,bt.RIGHT),s.getLocation(1,bt.RIGHT),2))},i}(Hr),ur=function(n){this._workingPrecisionModel=null,this._workingNoder=null,this._geomFact=null,this._graph=null,this._edgeList=new mi,this._bufParams=n||null};ur.prototype.setWorkingPrecisionModel=function(n){this._workingPrecisionModel=n},ur.prototype.insertUniqueEdge=function(n){var i=this._edgeList.findEqualEdge(n);if(i!==null){var s=i.getLabel(),u=n.getLabel();i.isPointwiseEqual(n)||(u=new rn(n.getLabel())).flip(),s.merge(u);var c=ur.depthDelta(u),m=i.getDepthDelta()+c;i.setDepthDelta(m)}else this._edgeList.add(n),n.setDepthDelta(ur.depthDelta(n.getLabel()))},ur.prototype.buildSubgraphs=function(n,i){for(var s=new j,u=n.iterator();u.hasNext();){var c=u.next(),m=c.getRightmostCoordinate(),E=new Cs(s).getDepth(m);c.computeDepth(E),c.findResultEdges(),s.add(c),i.add(c.getDirectedEdges(),c.getNodes())}},ur.prototype.createSubgraphs=function(n){for(var i=new j,s=n.getNodes().iterator();s.hasNext();){var u=s.next();if(!u.isVisited()){var c=new sr;c.create(u),i.add(c)}}return di.sort(i,di.reverseOrder()),i},ur.prototype.createEmptyResultGeometry=function(){return this._geomFact.createPolygon()},ur.prototype.getNoder=function(n){if(this._workingNoder!==null)return this._workingNoder;var i=new vf,s=new J;return s.setPrecisionModel(n),i.setSegmentIntersector(new Xr(s)),i},ur.prototype.buffer=function(n,i){var s=this._workingPrecisionModel;s===null&&(s=n.getPrecisionModel()),this._geomFact=n.getFactory();var u=new Mr(s,this._bufParams),c=new ii(n,i,u).getCurves();if(c.size()<=0)return this.createEmptyResultGeometry();this.computeNodedEdges(c,s),this._graph=new _n(new Kd),this._graph.addEdges(this._edgeList.getEdges());var m=this.createSubgraphs(this._graph),E=new Nr(this._geomFact);this.buildSubgraphs(m,E);var T=E.getPolygons();return T.size()<=0?this.createEmptyResultGeometry():this._geomFact.buildGeometry(T)},ur.prototype.computeNodedEdges=function(n,i){var s=this.getNoder(i);s.computeNodes(n);for(var u=s.getNodedSubstrings().iterator();u.hasNext();){var c=u.next(),m=c.getCoordinates();if(m.length!==2||!m[0].equals2D(m[1])){var E=c.getData(),T=new Sl(c.getCoordinates(),new rn(E));this.insertUniqueEdge(T)}}},ur.prototype.setNoder=function(n){this._workingNoder=n},ur.prototype.interfaces_=function(){return[]},ur.prototype.getClass=function(){return ur},ur.depthDelta=function(n){var i=n.getLocation(0,bt.LEFT),s=n.getLocation(0,bt.RIGHT);return i===k.INTERIOR&&s===k.EXTERIOR?1:i===k.EXTERIOR&&s===k.INTERIOR?-1:0},ur.convertSegStrings=function(n){for(var i=new le,s=new j;n.hasNext();){var u=n.next(),c=i.createLineString(u.getCoordinates());s.add(c)}return i.buildGeometry(s)};var bo=function(){if(this._noder=null,this._scaleFactor=null,this._offsetX=null,this._offsetY=null,this._isScaled=!1,arguments.length===2){var n=arguments[0],i=arguments[1];this._noder=n,this._scaleFactor=i,this._offsetX=0,this._offsetY=0,this._isScaled=!this.isIntegerPrecision()}else if(arguments.length===4){var s=arguments[0],u=arguments[1],c=arguments[2],m=arguments[3];this._noder=s,this._scaleFactor=u,this._offsetX=c,this._offsetY=m,this._isScaled=!this.isIntegerPrecision()}};bo.prototype.rescale=function(){if(X(arguments[0],Ot))for(var n=arguments[0].iterator();n.hasNext();){var i=n.next();this.rescale(i.getCoordinates())}else if(arguments[0]instanceof Array){for(var s=arguments[0],u=0;u<s.length;u++)s[u].x=s[u].x/this._scaleFactor+this._offsetX,s[u].y=s[u].y/this._scaleFactor+this._offsetY;s.length===2&&s[0].equals2D(s[1])&&Nt.out.println(s)}},bo.prototype.scale=function(){if(X(arguments[0],Ot)){for(var n=arguments[0],i=new j,s=n.iterator();s.hasNext();){var u=s.next();i.add(new wn(this.scale(u.getCoordinates()),u.getData()))}return i}if(arguments[0]instanceof Array){for(var c=arguments[0],m=new Array(c.length).fill(null),E=0;E<c.length;E++)m[E]=new L(Math.round((c[E].x-this._offsetX)*this._scaleFactor),Math.round((c[E].y-this._offsetY)*this._scaleFactor),c[E].z);return ft.removeRepeatedPoints(m)}},bo.prototype.isIntegerPrecision=function(){return this._scaleFactor===1},bo.prototype.getNodedSubstrings=function(){var n=this._noder.getNodedSubstrings();return this._isScaled&&this.rescale(n),n},bo.prototype.computeNodes=function(n){var i=n;this._isScaled&&(i=this.scale(n)),this._noder.computeNodes(i)},bo.prototype.interfaces_=function(){return[Zo]},bo.prototype.getClass=function(){return bo};var Ci=function(){this._li=new J,this._segStrings=null;var n=arguments[0];this._segStrings=n},Qd={fact:{configurable:!0}};Ci.prototype.checkEndPtVertexIntersections=function(){if(arguments.length===0)for(var n=this._segStrings.iterator();n.hasNext();){var i=n.next().getCoordinates();this.checkEndPtVertexIntersections(i[0],this._segStrings),this.checkEndPtVertexIntersections(i[i.length-1],this._segStrings)}else if(arguments.length===2){for(var s=arguments[0],u=arguments[1].iterator();u.hasNext();)for(var c=u.next().getCoordinates(),m=1;m<c.length-1;m++)if(c[m].equals(s))throw new $("found endpt/interior pt intersection at index "+m+" :pt "+s)}},Ci.prototype.checkInteriorIntersections=function(){if(arguments.length===0)for(var n=this._segStrings.iterator();n.hasNext();)for(var i=n.next(),s=this._segStrings.iterator();s.hasNext();){var u=s.next();this.checkInteriorIntersections(i,u)}else if(arguments.length===2)for(var c=arguments[0],m=arguments[1],E=c.getCoordinates(),T=m.getCoordinates(),U=0;U<E.length-1;U++)for(var Z=0;Z<T.length-1;Z++)this.checkInteriorIntersections(c,U,m,Z);else if(arguments.length===4){var ut=arguments[0],ht=arguments[1],At=arguments[2],Rt=arguments[3];if(ut===At&&ht===Rt)return null;var kt=ut.getCoordinates()[ht],ee=ut.getCoordinates()[ht+1],on=At.getCoordinates()[Rt],In=At.getCoordinates()[Rt+1];if(this._li.computeIntersection(kt,ee,on,In),this._li.hasIntersection()&&(this._li.isProper()||this.hasInteriorIntersection(this._li,kt,ee)||this.hasInteriorIntersection(this._li,on,In)))throw new $("found non-noded intersection at "+kt+"-"+ee+" and "+on+"-"+In)}},Ci.prototype.checkValid=function(){this.checkEndPtVertexIntersections(),this.checkInteriorIntersections(),this.checkCollapses()},Ci.prototype.checkCollapses=function(){if(arguments.length===0)for(var n=this._segStrings.iterator();n.hasNext();){var i=n.next();this.checkCollapses(i)}else if(arguments.length===1)for(var s=arguments[0].getCoordinates(),u=0;u<s.length-2;u++)this.checkCollapse(s[u],s[u+1],s[u+2])},Ci.prototype.hasInteriorIntersection=function(n,i,s){for(var u=0;u<n.getIntersectionNum();u++){var c=n.getIntersection(u);if(!c.equals(i)&&!c.equals(s))return!0}return!1},Ci.prototype.checkCollapse=function(n,i,s){if(n.equals(s))throw new $("found non-noded collapse at "+Ci.fact.createLineString([n,i,s]))},Ci.prototype.interfaces_=function(){return[]},Ci.prototype.getClass=function(){return Ci},Qd.fact.get=function(){return new le},Object.defineProperties(Ci,Qd);var Sr=function(){this._li=null,this._pt=null,this._originalPt=null,this._ptScaled=null,this._p0Scaled=null,this._p1Scaled=null,this._scaleFactor=null,this._minx=null,this._maxx=null,this._miny=null,this._maxy=null,this._corner=new Array(4).fill(null),this._safeEnv=null;var n=arguments[0],i=arguments[1],s=arguments[2];if(this._originalPt=n,this._pt=n,this._scaleFactor=i,this._li=s,i<=0)throw new C("Scale factor must be non-zero");i!==1&&(this._pt=new L(this.scale(n.x),this.scale(n.y)),this._p0Scaled=new L,this._p1Scaled=new L),this.initCorners(this._pt)},tm={SAFE_ENV_EXPANSION_FACTOR:{configurable:!0}};Sr.prototype.intersectsScaled=function(n,i){var s=Math.min(n.x,i.x),u=Math.max(n.x,i.x),c=Math.min(n.y,i.y),m=Math.max(n.y,i.y),E=this._maxx<s||this._minx>u||this._maxy<c||this._miny>m;if(E)return!1;var T=this.intersectsToleranceSquare(n,i);return b.isTrue(!(E&&T),"Found bad envelope test"),T},Sr.prototype.initCorners=function(n){this._minx=n.x-.5,this._maxx=n.x+.5,this._miny=n.y-.5,this._maxy=n.y+.5,this._corner[0]=new L(this._maxx,this._maxy),this._corner[1]=new L(this._minx,this._maxy),this._corner[2]=new L(this._minx,this._miny),this._corner[3]=new L(this._maxx,this._miny)},Sr.prototype.intersects=function(n,i){return this._scaleFactor===1?this.intersectsScaled(n,i):(this.copyScaled(n,this._p0Scaled),this.copyScaled(i,this._p1Scaled),this.intersectsScaled(this._p0Scaled,this._p1Scaled))},Sr.prototype.scale=function(n){return Math.round(n*this._scaleFactor)},Sr.prototype.getCoordinate=function(){return this._originalPt},Sr.prototype.copyScaled=function(n,i){i.x=this.scale(n.x),i.y=this.scale(n.y)},Sr.prototype.getSafeEnvelope=function(){if(this._safeEnv===null){var n=Sr.SAFE_ENV_EXPANSION_FACTOR/this._scaleFactor;this._safeEnv=new Pt(this._originalPt.x-n,this._originalPt.x+n,this._originalPt.y-n,this._originalPt.y+n)}return this._safeEnv},Sr.prototype.intersectsPixelClosure=function(n,i){return this._li.computeIntersection(n,i,this._corner[0],this._corner[1]),!!this._li.hasIntersection()||(this._li.computeIntersection(n,i,this._corner[1],this._corner[2]),!!this._li.hasIntersection()||(this._li.computeIntersection(n,i,this._corner[2],this._corner[3]),!!this._li.hasIntersection()||(this._li.computeIntersection(n,i,this._corner[3],this._corner[0]),!!this._li.hasIntersection())))},Sr.prototype.intersectsToleranceSquare=function(n,i){var s=!1,u=!1;return this._li.computeIntersection(n,i,this._corner[0],this._corner[1]),!!this._li.isProper()||(this._li.computeIntersection(n,i,this._corner[1],this._corner[2]),!!this._li.isProper()||(this._li.hasIntersection()&&(s=!0),this._li.computeIntersection(n,i,this._corner[2],this._corner[3]),!!this._li.isProper()||(this._li.hasIntersection()&&(u=!0),this._li.computeIntersection(n,i,this._corner[3],this._corner[0]),!!this._li.isProper()||!(!s||!u)||!!n.equals(this._pt)||!!i.equals(this._pt))))},Sr.prototype.addSnappedNode=function(n,i){var s=n.getCoordinate(i),u=n.getCoordinate(i+1);return!!this.intersects(s,u)&&(n.addIntersection(this.getCoordinate(),i),!0)},Sr.prototype.interfaces_=function(){return[]},Sr.prototype.getClass=function(){return Sr},tm.SAFE_ENV_EXPANSION_FACTOR.get=function(){return .75},Object.defineProperties(Sr,tm);var Eu=function(){this.tempEnv1=new Pt,this.selectedSegment=new Zt};Eu.prototype.select=function(){if(arguments.length!==1){if(arguments.length===2){var n=arguments[0],i=arguments[1];n.getLineSegment(i,this.selectedSegment),this.select(this.selectedSegment)}}},Eu.prototype.interfaces_=function(){return[]},Eu.prototype.getClass=function(){return Eu};var la=function(){this._index=null;var n=arguments[0];this._index=n},em={HotPixelSnapAction:{configurable:!0}};la.prototype.snap=function(){if(arguments.length===1){var n=arguments[0];return this.snap(n,null,-1)}if(arguments.length===3){var i=arguments[0],s=arguments[1],u=arguments[2],c=i.getSafeEnvelope(),m=new nm(i,s,u);return this._index.query(c,{interfaces_:function(){return[Mo]},visitItem:function(E){E.select(c,m)}}),m.isNodeAdded()}},la.prototype.interfaces_=function(){return[]},la.prototype.getClass=function(){return la},em.HotPixelSnapAction.get=function(){return nm},Object.defineProperties(la,em);var nm=function(n){function i(){n.call(this),this._hotPixel=null,this._parentEdge=null,this._hotPixelVertexIndex=null,this._isNodeAdded=!1;var s=arguments[0],u=arguments[1],c=arguments[2];this._hotPixel=s,this._parentEdge=u,this._hotPixelVertexIndex=c}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.isNodeAdded=function(){return this._isNodeAdded},i.prototype.select=function(){if(arguments.length!==2)return n.prototype.select.apply(this,arguments);var s=arguments[0],u=arguments[1],c=s.getContext();if(this._parentEdge!==null&&c===this._parentEdge&&u===this._hotPixelVertexIndex)return null;this._isNodeAdded=this._hotPixel.addSnappedNode(c,u)},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(Eu),Ps=function(){this._li=null,this._interiorIntersections=null;var n=arguments[0];this._li=n,this._interiorIntersections=new j};Ps.prototype.processIntersections=function(n,i,s,u){if(n===s&&i===u)return null;var c=n.getCoordinates()[i],m=n.getCoordinates()[i+1],E=s.getCoordinates()[u],T=s.getCoordinates()[u+1];if(this._li.computeIntersection(c,m,E,T),this._li.hasIntersection()&&this._li.isInteriorIntersection()){for(var U=0;U<this._li.getIntersectionNum();U++)this._interiorIntersections.add(this._li.getIntersection(U));n.addIntersections(this._li,i,0),s.addIntersections(this._li,u,1)}},Ps.prototype.isDone=function(){return!1},Ps.prototype.getInteriorIntersections=function(){return this._interiorIntersections},Ps.prototype.interfaces_=function(){return[$o]},Ps.prototype.getClass=function(){return Ps};var Gi=function(){this._pm=null,this._li=null,this._scaleFactor=null,this._noder=null,this._pointSnapper=null,this._nodedSegStrings=null;var n=arguments[0];this._pm=n,this._li=new J,this._li.setPrecisionModel(n),this._scaleFactor=n.getScale()};Gi.prototype.checkCorrectness=function(n){var i=wn.getNodedSubstrings(n),s=new Ci(i);try{s.checkValid()}catch(u){if(!(u instanceof Yt))throw u;u.printStackTrace()}},Gi.prototype.getNodedSubstrings=function(){return wn.getNodedSubstrings(this._nodedSegStrings)},Gi.prototype.snapRound=function(n,i){var s=this.findInteriorIntersections(n,i);this.computeIntersectionSnaps(s),this.computeVertexSnaps(n)},Gi.prototype.findInteriorIntersections=function(n,i){var s=new Ps(i);return this._noder.setSegmentIntersector(s),this._noder.computeNodes(n),s.getInteriorIntersections()},Gi.prototype.computeVertexSnaps=function(){if(X(arguments[0],Ot))for(var n=arguments[0].iterator();n.hasNext();){var i=n.next();this.computeVertexSnaps(i)}else if(arguments[0]instanceof wn)for(var s=arguments[0],u=s.getCoordinates(),c=0;c<u.length;c++){var m=new Sr(u[c],this._scaleFactor,this._li);this._pointSnapper.snap(m,s,c)&&s.addIntersection(u[c],c)}},Gi.prototype.computeNodes=function(n){this._nodedSegStrings=n,this._noder=new vf,this._pointSnapper=new la(this._noder.getIndex()),this.snapRound(n,this._li)},Gi.prototype.computeIntersectionSnaps=function(n){for(var i=n.iterator();i.hasNext();){var s=i.next(),u=new Sr(s,this._scaleFactor,this._li);this._pointSnapper.snap(u)}},Gi.prototype.interfaces_=function(){return[Zo]},Gi.prototype.getClass=function(){return Gi};var Wn=function(){if(this._argGeom=null,this._distance=null,this._bufParams=new We,this._resultGeometry=null,this._saveException=null,arguments.length===1){var n=arguments[0];this._argGeom=n}else if(arguments.length===2){var i=arguments[0],s=arguments[1];this._argGeom=i,this._bufParams=s}},ca={CAP_ROUND:{configurable:!0},CAP_BUTT:{configurable:!0},CAP_FLAT:{configurable:!0},CAP_SQUARE:{configurable:!0},MAX_PRECISION_DIGITS:{configurable:!0}};Wn.prototype.bufferFixedPrecision=function(n){var i=new bo(new Gi(new ie(1)),n.getScale()),s=new ur(this._bufParams);s.setWorkingPrecisionModel(n),s.setNoder(i),this._resultGeometry=s.buffer(this._argGeom,this._distance)},Wn.prototype.bufferReducedPrecision=function(){var n=this;if(arguments.length===0){for(var i=Wn.MAX_PRECISION_DIGITS;i>=0;i--){try{n.bufferReducedPrecision(i)}catch(m){if(!(m instanceof io))throw m;n._saveException=m}if(n._resultGeometry!==null)return null}throw this._saveException}if(arguments.length===1){var s=arguments[0],u=Wn.precisionScaleFactor(this._argGeom,this._distance,s),c=new ie(u);this.bufferFixedPrecision(c)}},Wn.prototype.computeGeometry=function(){if(this.bufferOriginalPrecision(),this._resultGeometry!==null)return null;var n=this._argGeom.getFactory().getPrecisionModel();n.getType()===ie.FIXED?this.bufferFixedPrecision(n):this.bufferReducedPrecision()},Wn.prototype.setQuadrantSegments=function(n){this._bufParams.setQuadrantSegments(n)},Wn.prototype.bufferOriginalPrecision=function(){try{var n=new ur(this._bufParams);this._resultGeometry=n.buffer(this._argGeom,this._distance)}catch(i){if(!(i instanceof $))throw i;this._saveException=i}},Wn.prototype.getResultGeometry=function(n){return this._distance=n,this.computeGeometry(),this._resultGeometry},Wn.prototype.setEndCapStyle=function(n){this._bufParams.setEndCapStyle(n)},Wn.prototype.interfaces_=function(){return[]},Wn.prototype.getClass=function(){return Wn},Wn.bufferOp=function(){if(arguments.length===2){var n=arguments[0],i=arguments[1];return new Wn(n).getResultGeometry(i)}if(arguments.length===3){if(Number.isInteger(arguments[2])&&arguments[0]instanceof Q&&typeof arguments[1]=="number"){var s=arguments[0],u=arguments[1],c=arguments[2],m=new Wn(s);return m.setQuadrantSegments(c),m.getResultGeometry(u)}if(arguments[2]instanceof We&&arguments[0]instanceof Q&&typeof arguments[1]=="number"){var E=arguments[0],T=arguments[1],U=arguments[2];return new Wn(E,U).getResultGeometry(T)}}else if(arguments.length===4){var Z=arguments[0],ut=arguments[1],ht=arguments[2],At=arguments[3],Rt=new Wn(Z);return Rt.setQuadrantSegments(ht),Rt.setEndCapStyle(At),Rt.getResultGeometry(ut)}},Wn.precisionScaleFactor=function(n,i,s){var u=n.getEnvelopeInternal(),c=it.max(Math.abs(u.getMaxX()),Math.abs(u.getMaxY()),Math.abs(u.getMinX()),Math.abs(u.getMinY()))+2*(i>0?i:0),m=s-Math.trunc(Math.log(c)/Math.log(10)+1);return Math.pow(10,m)},ca.CAP_ROUND.get=function(){return We.CAP_ROUND},ca.CAP_BUTT.get=function(){return We.CAP_FLAT},ca.CAP_FLAT.get=function(){return We.CAP_FLAT},ca.CAP_SQUARE.get=function(){return We.CAP_SQUARE},ca.MAX_PRECISION_DIGITS.get=function(){return 12},Object.defineProperties(Wn,ca);var lr=function(){this._pt=[new L,new L],this._distance=S.NaN,this._isNull=!0};lr.prototype.getCoordinates=function(){return this._pt},lr.prototype.getCoordinate=function(n){return this._pt[n]},lr.prototype.setMinimum=function(){if(arguments.length===1){var n=arguments[0];this.setMinimum(n._pt[0],n._pt[1])}else if(arguments.length===2){var i=arguments[0],s=arguments[1];if(this._isNull)return this.initialize(i,s),null;var u=i.distance(s);u<this._distance&&this.initialize(i,s,u)}},lr.prototype.initialize=function(){if(arguments.length===0)this._isNull=!0;else if(arguments.length===2){var n=arguments[0],i=arguments[1];this._pt[0].setCoordinate(n),this._pt[1].setCoordinate(i),this._distance=n.distance(i),this._isNull=!1}else if(arguments.length===3){var s=arguments[0],u=arguments[1],c=arguments[2];this._pt[0].setCoordinate(s),this._pt[1].setCoordinate(u),this._distance=c,this._isNull=!1}},lr.prototype.getDistance=function(){return this._distance},lr.prototype.setMaximum=function(){if(arguments.length===1){var n=arguments[0];this.setMaximum(n._pt[0],n._pt[1])}else if(arguments.length===2){var i=arguments[0],s=arguments[1];if(this._isNull)return this.initialize(i,s),null;var u=i.distance(s);u>this._distance&&this.initialize(i,s,u)}},lr.prototype.interfaces_=function(){return[]},lr.prototype.getClass=function(){return lr};var Vi=function(){};Vi.prototype.interfaces_=function(){return[]},Vi.prototype.getClass=function(){return Vi},Vi.computeDistance=function(){if(arguments[2]instanceof lr&&arguments[0]instanceof Bt&&arguments[1]instanceof L)for(var n=arguments[0],i=arguments[1],s=arguments[2],u=n.getCoordinates(),c=new Zt,m=0;m<u.length-1;m++){c.setCoordinates(u[m],u[m+1]);var E=c.closestPoint(i);s.setMinimum(E,i)}else if(arguments[2]instanceof lr&&arguments[0]instanceof Vt&&arguments[1]instanceof L){var T=arguments[0],U=arguments[1],Z=arguments[2];Vi.computeDistance(T.getExteriorRing(),U,Z);for(var ut=0;ut<T.getNumInteriorRing();ut++)Vi.computeDistance(T.getInteriorRingN(ut),U,Z)}else if(arguments[2]instanceof lr&&arguments[0]instanceof Q&&arguments[1]instanceof L){var ht=arguments[0],At=arguments[1],Rt=arguments[2];if(ht instanceof Bt)Vi.computeDistance(ht,At,Rt);else if(ht instanceof Vt)Vi.computeDistance(ht,At,Rt);else if(ht instanceof Vn)for(var kt=ht,ee=0;ee<kt.getNumGeometries();ee++){var on=kt.getGeometryN(ee);Vi.computeDistance(on,At,Rt)}else Rt.setMinimum(ht.getCoordinate(),At)}else if(arguments[2]instanceof lr&&arguments[0]instanceof Zt&&arguments[1]instanceof L){var In=arguments[0],pr=arguments[1],Xi=arguments[2],Lo=In.closestPoint(pr);Xi.setMinimum(Lo,pr)}};var jo=function(n){this._maxPtDist=new lr,this._inputGeom=n||null},_f={MaxPointDistanceFilter:{configurable:!0},MaxMidpointDistanceFilter:{configurable:!0}};jo.prototype.computeMaxMidpointDistance=function(n){var i=new To(this._inputGeom);n.apply(i),this._maxPtDist.setMaximum(i.getMaxPointDistance())},jo.prototype.computeMaxVertexDistance=function(n){var i=new Is(this._inputGeom);n.apply(i),this._maxPtDist.setMaximum(i.getMaxPointDistance())},jo.prototype.findDistance=function(n){return this.computeMaxVertexDistance(n),this.computeMaxMidpointDistance(n),this._maxPtDist.getDistance()},jo.prototype.getDistancePoints=function(){return this._maxPtDist},jo.prototype.interfaces_=function(){return[]},jo.prototype.getClass=function(){return jo},_f.MaxPointDistanceFilter.get=function(){return Is},_f.MaxMidpointDistanceFilter.get=function(){return To},Object.defineProperties(jo,_f);var Is=function(n){this._maxPtDist=new lr,this._minPtDist=new lr,this._geom=n||null};Is.prototype.filter=function(n){this._minPtDist.initialize(),Vi.computeDistance(this._geom,n,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)},Is.prototype.getMaxPointDistance=function(){return this._maxPtDist},Is.prototype.interfaces_=function(){return[Mt]},Is.prototype.getClass=function(){return Is};var To=function(n){this._maxPtDist=new lr,this._minPtDist=new lr,this._geom=n||null};To.prototype.filter=function(n,i){if(i===0)return null;var s=n.getCoordinate(i-1),u=n.getCoordinate(i),c=new L((s.x+u.x)/2,(s.y+u.y)/2);this._minPtDist.initialize(),Vi.computeDistance(this._geom,c,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)},To.prototype.isDone=function(){return!1},To.prototype.isGeometryChanged=function(){return!1},To.prototype.getMaxPointDistance=function(){return this._maxPtDist},To.prototype.interfaces_=function(){return[Vr]},To.prototype.getClass=function(){return To};var uo=function(n){this._comps=n||null};uo.prototype.filter=function(n){n instanceof Vt&&this._comps.add(n)},uo.prototype.interfaces_=function(){return[ei]},uo.prototype.getClass=function(){return uo},uo.getPolygons=function(){if(arguments.length===1){var n=arguments[0];return uo.getPolygons(n,new j)}if(arguments.length===2){var i=arguments[0],s=arguments[1];return i instanceof Vt?s.add(i):i instanceof Vn&&i.apply(new uo(s)),s}};var qn=function(){if(this._lines=null,this._isForcedToLineString=!1,arguments.length===1){var n=arguments[0];this._lines=n}else if(arguments.length===2){var i=arguments[0],s=arguments[1];this._lines=i,this._isForcedToLineString=s}};qn.prototype.filter=function(n){if(this._isForcedToLineString&&n instanceof sn){var i=n.getFactory().createLineString(n.getCoordinateSequence());return this._lines.add(i),null}n instanceof Bt&&this._lines.add(n)},qn.prototype.setForceToLineString=function(n){this._isForcedToLineString=n},qn.prototype.interfaces_=function(){return[ct]},qn.prototype.getClass=function(){return qn},qn.getGeometry=function(){if(arguments.length===1){var n=arguments[0];return n.getFactory().buildGeometry(qn.getLines(n))}if(arguments.length===2){var i=arguments[0],s=arguments[1];return i.getFactory().buildGeometry(qn.getLines(i,s))}},qn.getLines=function(){if(arguments.length===1){var n=arguments[0];return qn.getLines(n,!1)}if(arguments.length===2){if(X(arguments[0],Ot)&&X(arguments[1],Ot)){for(var i=arguments[0],s=arguments[1],u=i.iterator();u.hasNext();){var c=u.next();qn.getLines(c,s)}return s}if(arguments[0]instanceof Q&&typeof arguments[1]=="boolean"){var m=arguments[0],E=arguments[1],T=new j;return m.apply(new qn(T,E)),T}if(arguments[0]instanceof Q&&X(arguments[1],Ot)){var U=arguments[0],Z=arguments[1];return U instanceof Bt?Z.add(U):U.apply(new qn(Z)),Z}}else if(arguments.length===3){if(typeof arguments[2]=="boolean"&&X(arguments[0],Ot)&&X(arguments[1],Ot)){for(var ut=arguments[0],ht=arguments[1],At=arguments[2],Rt=ut.iterator();Rt.hasNext();){var kt=Rt.next();qn.getLines(kt,ht,At)}return ht}if(typeof arguments[2]=="boolean"&&arguments[0]instanceof Q&&X(arguments[1],Ot)){var ee=arguments[0],on=arguments[1],In=arguments[2];return ee.apply(new qn(on,In)),on}}};var gi=function(){if(this._boundaryRule=Lt.OGC_SFS_BOUNDARY_RULE,this._isIn=null,this._numBoundaries=null,arguments.length!==0){if(arguments.length===1){var n=arguments[0];if(n===null)throw new C("Rule must be non-null");this._boundaryRule=n}}};gi.prototype.locateInternal=function(){if(arguments[0]instanceof L&&arguments[1]instanceof Vt){var n=arguments[0],i=arguments[1];if(i.isEmpty())return k.EXTERIOR;var s=i.getExteriorRing(),u=this.locateInPolygonRing(n,s);if(u===k.EXTERIOR)return k.EXTERIOR;if(u===k.BOUNDARY)return k.BOUNDARY;for(var c=0;c<i.getNumInteriorRing();c++){var m=i.getInteriorRingN(c),E=this.locateInPolygonRing(n,m);if(E===k.INTERIOR)return k.EXTERIOR;if(E===k.BOUNDARY)return k.BOUNDARY}return k.INTERIOR}if(arguments[0]instanceof L&&arguments[1]instanceof Bt){var T=arguments[0],U=arguments[1];if(!U.getEnvelopeInternal().intersects(T))return k.EXTERIOR;var Z=U.getCoordinates();return U.isClosed()||!T.equals(Z[0])&&!T.equals(Z[Z.length-1])?B.isOnLine(T,Z)?k.INTERIOR:k.EXTERIOR:k.BOUNDARY}if(arguments[0]instanceof L&&arguments[1]instanceof Qt){var ut=arguments[0];return arguments[1].getCoordinate().equals2D(ut)?k.INTERIOR:k.EXTERIOR}},gi.prototype.locateInPolygonRing=function(n,i){return i.getEnvelopeInternal().intersects(n)?B.locatePointInRing(n,i.getCoordinates()):k.EXTERIOR},gi.prototype.intersects=function(n,i){return this.locate(n,i)!==k.EXTERIOR},gi.prototype.updateLocationInfo=function(n){n===k.INTERIOR&&(this._isIn=!0),n===k.BOUNDARY&&this._numBoundaries++},gi.prototype.computeLocation=function(n,i){if(i instanceof Qt&&this.updateLocationInfo(this.locateInternal(n,i)),i instanceof Bt)this.updateLocationInfo(this.locateInternal(n,i));else if(i instanceof Vt)this.updateLocationInfo(this.locateInternal(n,i));else if(i instanceof H)for(var s=i,u=0;u<s.getNumGeometries();u++){var c=s.getGeometryN(u);this.updateLocationInfo(this.locateInternal(n,c))}else if(i instanceof un)for(var m=i,E=0;E<m.getNumGeometries();E++){var T=m.getGeometryN(E);this.updateLocationInfo(this.locateInternal(n,T))}else if(i instanceof Vn)for(var U=new zi(i);U.hasNext();){var Z=U.next();Z!==i&&this.computeLocation(n,Z)}},gi.prototype.locate=function(n,i){return i.isEmpty()?k.EXTERIOR:i instanceof Bt?this.locateInternal(n,i):i instanceof Vt?this.locateInternal(n,i):(this._isIn=!1,this._numBoundaries=0,this.computeLocation(n,i),this._boundaryRule.isInBoundary(this._numBoundaries)?k.BOUNDARY:this._numBoundaries>0||this._isIn?k.INTERIOR:k.EXTERIOR)},gi.prototype.interfaces_=function(){return[]},gi.prototype.getClass=function(){return gi};var cr=function n(){if(this._component=null,this._segIndex=null,this._pt=null,arguments.length===2){var i=arguments[0],s=arguments[1];n.call(this,i,n.INSIDE_AREA,s)}else if(arguments.length===3){var u=arguments[0],c=arguments[1],m=arguments[2];this._component=u,this._segIndex=c,this._pt=m}},rm={INSIDE_AREA:{configurable:!0}};cr.prototype.isInsideArea=function(){return this._segIndex===cr.INSIDE_AREA},cr.prototype.getCoordinate=function(){return this._pt},cr.prototype.getGeometryComponent=function(){return this._component},cr.prototype.getSegmentIndex=function(){return this._segIndex},cr.prototype.interfaces_=function(){return[]},cr.prototype.getClass=function(){return cr},rm.INSIDE_AREA.get=function(){return-1},Object.defineProperties(cr,rm);var Ao=function(n){this._pts=n||null};Ao.prototype.filter=function(n){n instanceof Qt&&this._pts.add(n)},Ao.prototype.interfaces_=function(){return[ei]},Ao.prototype.getClass=function(){return Ao},Ao.getPoints=function(){if(arguments.length===1){var n=arguments[0];return n instanceof Qt?di.singletonList(n):Ao.getPoints(n,new j)}if(arguments.length===2){var i=arguments[0],s=arguments[1];return i instanceof Qt?s.add(i):i instanceof Vn&&i.apply(new Ao(s)),s}};var Rs=function(){this._locations=null;var n=arguments[0];this._locations=n};Rs.prototype.filter=function(n){(n instanceof Qt||n instanceof Bt||n instanceof Vt)&&this._locations.add(new cr(n,0,n.getCoordinate()))},Rs.prototype.interfaces_=function(){return[ei]},Rs.prototype.getClass=function(){return Rs},Rs.getLocations=function(n){var i=new j;return n.apply(new Rs(i)),i};var Xn=function(){if(this._geom=null,this._terminateDistance=0,this._ptLocator=new gi,this._minDistanceLocation=null,this._minDistance=S.MAX_VALUE,arguments.length===2){var n=arguments[0],i=arguments[1];this._geom=[n,i],this._terminateDistance=0}else if(arguments.length===3){var s=arguments[0],u=arguments[1],c=arguments[2];this._geom=new Array(2).fill(null),this._geom[0]=s,this._geom[1]=u,this._terminateDistance=c}};Xn.prototype.computeContainmentDistance=function(){if(arguments.length===0){var n=new Array(2).fill(null);if(this.computeContainmentDistance(0,n),this._minDistance<=this._terminateDistance)return null;this.computeContainmentDistance(1,n)}else if(arguments.length===2){var i=arguments[0],s=arguments[1],u=1-i,c=uo.getPolygons(this._geom[i]);if(c.size()>0){var m=Rs.getLocations(this._geom[u]);if(this.computeContainmentDistance(m,c,s),this._minDistance<=this._terminateDistance)return this._minDistanceLocation[u]=s[0],this._minDistanceLocation[i]=s[1],null}}else if(arguments.length===3){if(arguments[2]instanceof Array&&X(arguments[0],wt)&&X(arguments[1],wt)){for(var E=arguments[0],T=arguments[1],U=arguments[2],Z=0;Z<E.size();Z++)for(var ut=E.get(Z),ht=0;ht<T.size();ht++)if(this.computeContainmentDistance(ut,T.get(ht),U),this._minDistance<=this._terminateDistance)return null}else if(arguments[2]instanceof Array&&arguments[0]instanceof cr&&arguments[1]instanceof Vt){var At=arguments[0],Rt=arguments[1],kt=arguments[2],ee=At.getCoordinate();if(k.EXTERIOR!==this._ptLocator.locate(ee,Rt))return this._minDistance=0,kt[0]=At,kt[1]=new cr(Rt,ee),null}}},Xn.prototype.computeMinDistanceLinesPoints=function(n,i,s){for(var u=0;u<n.size();u++)for(var c=n.get(u),m=0;m<i.size();m++){var E=i.get(m);if(this.computeMinDistance(c,E,s),this._minDistance<=this._terminateDistance)return null}},Xn.prototype.computeFacetDistance=function(){var n=new Array(2).fill(null),i=qn.getLines(this._geom[0]),s=qn.getLines(this._geom[1]),u=Ao.getPoints(this._geom[0]),c=Ao.getPoints(this._geom[1]);return this.computeMinDistanceLines(i,s,n),this.updateMinDistance(n,!1),this._minDistance<=this._terminateDistance?null:(n[0]=null,n[1]=null,this.computeMinDistanceLinesPoints(i,c,n),this.updateMinDistance(n,!1),this._minDistance<=this._terminateDistance?null:(n[0]=null,n[1]=null,this.computeMinDistanceLinesPoints(s,u,n),this.updateMinDistance(n,!0),this._minDistance<=this._terminateDistance?null:(n[0]=null,n[1]=null,this.computeMinDistancePoints(u,c,n),void this.updateMinDistance(n,!1))))},Xn.prototype.nearestLocations=function(){return this.computeMinDistance(),this._minDistanceLocation},Xn.prototype.updateMinDistance=function(n,i){if(n[0]===null)return null;i?(this._minDistanceLocation[0]=n[1],this._minDistanceLocation[1]=n[0]):(this._minDistanceLocation[0]=n[0],this._minDistanceLocation[1]=n[1])},Xn.prototype.nearestPoints=function(){return this.computeMinDistance(),[this._minDistanceLocation[0].getCoordinate(),this._minDistanceLocation[1].getCoordinate()]},Xn.prototype.computeMinDistance=function(){if(arguments.length===0){if(this._minDistanceLocation!==null||(this._minDistanceLocation=new Array(2).fill(null),this.computeContainmentDistance(),this._minDistance<=this._terminateDistance))return null;this.computeFacetDistance()}else if(arguments.length===3){if(arguments[2]instanceof Array&&arguments[0]instanceof Bt&&arguments[1]instanceof Qt){var n=arguments[0],i=arguments[1],s=arguments[2];if(n.getEnvelopeInternal().distance(i.getEnvelopeInternal())>this._minDistance)return null;for(var u=n.getCoordinates(),c=i.getCoordinate(),m=0;m<u.length-1;m++){var E=B.distancePointLine(c,u[m],u[m+1]);if(E<this._minDistance){this._minDistance=E;var T=new Zt(u[m],u[m+1]).closestPoint(c);s[0]=new cr(n,m,T),s[1]=new cr(i,0,c)}if(this._minDistance<=this._terminateDistance)return null}}else if(arguments[2]instanceof Array&&arguments[0]instanceof Bt&&arguments[1]instanceof Bt){var U=arguments[0],Z=arguments[1],ut=arguments[2];if(U.getEnvelopeInternal().distance(Z.getEnvelopeInternal())>this._minDistance)return null;for(var ht=U.getCoordinates(),At=Z.getCoordinates(),Rt=0;Rt<ht.length-1;Rt++)for(var kt=0;kt<At.length-1;kt++){var ee=B.distanceLineLine(ht[Rt],ht[Rt+1],At[kt],At[kt+1]);if(ee<this._minDistance){this._minDistance=ee;var on=new Zt(ht[Rt],ht[Rt+1]),In=new Zt(At[kt],At[kt+1]),pr=on.closestPoints(In);ut[0]=new cr(U,Rt,pr[0]),ut[1]=new cr(Z,kt,pr[1])}if(this._minDistance<=this._terminateDistance)return null}}}},Xn.prototype.computeMinDistancePoints=function(n,i,s){for(var u=0;u<n.size();u++)for(var c=n.get(u),m=0;m<i.size();m++){var E=i.get(m),T=c.getCoordinate().distance(E.getCoordinate());if(T<this._minDistance&&(this._minDistance=T,s[0]=new cr(c,0,c.getCoordinate()),s[1]=new cr(E,0,E.getCoordinate())),this._minDistance<=this._terminateDistance)return null}},Xn.prototype.distance=function(){if(this._geom[0]===null||this._geom[1]===null)throw new C("null geometries are not supported");return this._geom[0].isEmpty()||this._geom[1].isEmpty()?0:(this.computeMinDistance(),this._minDistance)},Xn.prototype.computeMinDistanceLines=function(n,i,s){for(var u=0;u<n.size();u++)for(var c=n.get(u),m=0;m<i.size();m++){var E=i.get(m);if(this.computeMinDistance(c,E,s),this._minDistance<=this._terminateDistance)return null}},Xn.prototype.interfaces_=function(){return[]},Xn.prototype.getClass=function(){return Xn},Xn.distance=function(n,i){return new Xn(n,i).distance()},Xn.isWithinDistance=function(n,i,s){return new Xn(n,i,s).distance()<=s},Xn.nearestPoints=function(n,i){return new Xn(n,i).nearestPoints()};var Qn=function(){this._pt=[new L,new L],this._distance=S.NaN,this._isNull=!0};Qn.prototype.getCoordinates=function(){return this._pt},Qn.prototype.getCoordinate=function(n){return this._pt[n]},Qn.prototype.setMinimum=function(){if(arguments.length===1){var n=arguments[0];this.setMinimum(n._pt[0],n._pt[1])}else if(arguments.length===2){var i=arguments[0],s=arguments[1];if(this._isNull)return this.initialize(i,s),null;var u=i.distance(s);u<this._distance&&this.initialize(i,s,u)}},Qn.prototype.initialize=function(){if(arguments.length===0)this._isNull=!0;else if(arguments.length===2){var n=arguments[0],i=arguments[1];this._pt[0].setCoordinate(n),this._pt[1].setCoordinate(i),this._distance=n.distance(i),this._isNull=!1}else if(arguments.length===3){var s=arguments[0],u=arguments[1],c=arguments[2];this._pt[0].setCoordinate(s),this._pt[1].setCoordinate(u),this._distance=c,this._isNull=!1}},Qn.prototype.toString=function(){return qt.toLineString(this._pt[0],this._pt[1])},Qn.prototype.getDistance=function(){return this._distance},Qn.prototype.setMaximum=function(){if(arguments.length===1){var n=arguments[0];this.setMaximum(n._pt[0],n._pt[1])}else if(arguments.length===2){var i=arguments[0],s=arguments[1];if(this._isNull)return this.initialize(i,s),null;var u=i.distance(s);u>this._distance&&this.initialize(i,s,u)}},Qn.prototype.interfaces_=function(){return[]},Qn.prototype.getClass=function(){return Qn};var Pi=function(){};Pi.prototype.interfaces_=function(){return[]},Pi.prototype.getClass=function(){return Pi},Pi.computeDistance=function(){if(arguments[2]instanceof Qn&&arguments[0]instanceof Bt&&arguments[1]instanceof L)for(var n=arguments[0],i=arguments[1],s=arguments[2],u=new Zt,c=n.getCoordinates(),m=0;m<c.length-1;m++){u.setCoordinates(c[m],c[m+1]);var E=u.closestPoint(i);s.setMinimum(E,i)}else if(arguments[2]instanceof Qn&&arguments[0]instanceof Vt&&arguments[1]instanceof L){var T=arguments[0],U=arguments[1],Z=arguments[2];Pi.computeDistance(T.getExteriorRing(),U,Z);for(var ut=0;ut<T.getNumInteriorRing();ut++)Pi.computeDistance(T.getInteriorRingN(ut),U,Z)}else if(arguments[2]instanceof Qn&&arguments[0]instanceof Q&&arguments[1]instanceof L){var ht=arguments[0],At=arguments[1],Rt=arguments[2];if(ht instanceof Bt)Pi.computeDistance(ht,At,Rt);else if(ht instanceof Vt)Pi.computeDistance(ht,At,Rt);else if(ht instanceof Vn)for(var kt=ht,ee=0;ee<kt.getNumGeometries();ee++){var on=kt.getGeometryN(ee);Pi.computeDistance(on,At,Rt)}else Rt.setMinimum(ht.getCoordinate(),At)}else if(arguments[2]instanceof Qn&&arguments[0]instanceof Zt&&arguments[1]instanceof L){var In=arguments[0],pr=arguments[1],Xi=arguments[2],Lo=In.closestPoint(pr);Xi.setMinimum(Lo,pr)}};var oi=function(){this._g0=null,this._g1=null,this._ptDist=new Qn,this._densifyFrac=0;var n=arguments[0],i=arguments[1];this._g0=n,this._g1=i},xf={MaxPointDistanceFilter:{configurable:!0},MaxDensifiedByFractionDistanceFilter:{configurable:!0}};oi.prototype.getCoordinates=function(){return this._ptDist.getCoordinates()},oi.prototype.setDensifyFraction=function(n){if(n>1||n<=0)throw new C("Fraction is not in range (0.0 - 1.0]");this._densifyFrac=n},oi.prototype.compute=function(n,i){this.computeOrientedDistance(n,i,this._ptDist),this.computeOrientedDistance(i,n,this._ptDist)},oi.prototype.distance=function(){return this.compute(this._g0,this._g1),this._ptDist.getDistance()},oi.prototype.computeOrientedDistance=function(n,i,s){var u=new Ls(i);if(n.apply(u),s.setMaximum(u.getMaxPointDistance()),this._densifyFrac>0){var c=new Co(i,this._densifyFrac);n.apply(c),s.setMaximum(c.getMaxPointDistance())}},oi.prototype.orientedDistance=function(){return this.computeOrientedDistance(this._g0,this._g1,this._ptDist),this._ptDist.getDistance()},oi.prototype.interfaces_=function(){return[]},oi.prototype.getClass=function(){return oi},oi.distance=function(){if(arguments.length===2){var n=arguments[0],i=arguments[1];return new oi(n,i).distance()}if(arguments.length===3){var s=arguments[0],u=arguments[1],c=arguments[2],m=new oi(s,u);return m.setDensifyFraction(c),m.distance()}},xf.MaxPointDistanceFilter.get=function(){return Ls},xf.MaxDensifiedByFractionDistanceFilter.get=function(){return Co},Object.defineProperties(oi,xf);var Ls=function(){this._maxPtDist=new Qn,this._minPtDist=new Qn,this._euclideanDist=new Pi,this._geom=null;var n=arguments[0];this._geom=n};Ls.prototype.filter=function(n){this._minPtDist.initialize(),Pi.computeDistance(this._geom,n,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)},Ls.prototype.getMaxPointDistance=function(){return this._maxPtDist},Ls.prototype.interfaces_=function(){return[Mt]},Ls.prototype.getClass=function(){return Ls};var Co=function(){this._maxPtDist=new Qn,this._minPtDist=new Qn,this._geom=null,this._numSubSegs=0;var n=arguments[0],i=arguments[1];this._geom=n,this._numSubSegs=Math.trunc(Math.round(1/i))};Co.prototype.filter=function(n,i){if(i===0)return null;for(var s=n.getCoordinate(i-1),u=n.getCoordinate(i),c=(u.x-s.x)/this._numSubSegs,m=(u.y-s.y)/this._numSubSegs,E=0;E<this._numSubSegs;E++){var T=s.x+E*c,U=s.y+E*m,Z=new L(T,U);this._minPtDist.initialize(),Pi.computeDistance(this._geom,Z,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)}},Co.prototype.isDone=function(){return!1},Co.prototype.isGeometryChanged=function(){return!1},Co.prototype.getMaxPointDistance=function(){return this._maxPtDist},Co.prototype.interfaces_=function(){return[Vr]},Co.prototype.getClass=function(){return Co};var Dr=function(n,i,s){this._minValidDistance=null,this._maxValidDistance=null,this._minDistanceFound=null,this._maxDistanceFound=null,this._isValid=!0,this._errMsg=null,this._errorLocation=null,this._errorIndicator=null,this._input=n||null,this._bufDistance=i||null,this._result=s||null},Ef={VERBOSE:{configurable:!0},MAX_DISTANCE_DIFF_FRAC:{configurable:!0}};Dr.prototype.checkMaximumDistance=function(n,i,s){var u=new oi(i,n);if(u.setDensifyFraction(.25),this._maxDistanceFound=u.orientedDistance(),this._maxDistanceFound>s){this._isValid=!1;var c=u.getCoordinates();this._errorLocation=c[1],this._errorIndicator=n.getFactory().createLineString(c),this._errMsg="Distance between buffer curve and input is too large ("+this._maxDistanceFound+" at "+qt.toLineString(c[0],c[1])+")"}},Dr.prototype.isValid=function(){var n=Math.abs(this._bufDistance),i=Dr.MAX_DISTANCE_DIFF_FRAC*n;return this._minValidDistance=n-i,this._maxValidDistance=n+i,!(!this._input.isEmpty()&&!this._result.isEmpty())||(this._bufDistance>0?this.checkPositiveValid():this.checkNegativeValid(),Dr.VERBOSE&&Nt.out.println("Min Dist= "+this._minDistanceFound+" err= "+(1-this._minDistanceFound/this._bufDistance)+" Max Dist= "+this._maxDistanceFound+" err= "+(this._maxDistanceFound/this._bufDistance-1)),this._isValid)},Dr.prototype.checkNegativeValid=function(){if(!(this._input instanceof Vt||this._input instanceof un||this._input instanceof Vn))return null;var n=this.getPolygonLines(this._input);if(this.checkMinimumDistance(n,this._result,this._minValidDistance),!this._isValid)return null;this.checkMaximumDistance(n,this._result,this._maxValidDistance)},Dr.prototype.getErrorIndicator=function(){return this._errorIndicator},Dr.prototype.checkMinimumDistance=function(n,i,s){var u=new Xn(n,i,s);if(this._minDistanceFound=u.distance(),this._minDistanceFound<s){this._isValid=!1;var c=u.nearestPoints();this._errorLocation=u.nearestPoints()[1],this._errorIndicator=n.getFactory().createLineString(c),this._errMsg="Distance between buffer curve and input is too small ("+this._minDistanceFound+" at "+qt.toLineString(c[0],c[1])+" )"}},Dr.prototype.checkPositiveValid=function(){var n=this._result.getBoundary();if(this.checkMinimumDistance(this._input,n,this._minValidDistance),!this._isValid)return null;this.checkMaximumDistance(this._input,n,this._maxValidDistance)},Dr.prototype.getErrorLocation=function(){return this._errorLocation},Dr.prototype.getPolygonLines=function(n){for(var i=new j,s=new qn(i),u=uo.getPolygons(n).iterator();u.hasNext();)u.next().apply(s);return n.getFactory().buildGeometry(i)},Dr.prototype.getErrorMessage=function(){return this._errMsg},Dr.prototype.interfaces_=function(){return[]},Dr.prototype.getClass=function(){return Dr},Ef.VERBOSE.get=function(){return!1},Ef.MAX_DISTANCE_DIFF_FRAC.get=function(){return .012},Object.defineProperties(Dr,Ef);var Yn=function(n,i,s){this._isValid=!0,this._errorMsg=null,this._errorLocation=null,this._errorIndicator=null,this._input=n||null,this._distance=i||null,this._result=s||null},Mf={VERBOSE:{configurable:!0},MAX_ENV_DIFF_FRAC:{configurable:!0}};Yn.prototype.isValid=function(){return this.checkPolygonal(),this._isValid?(this.checkExpectedEmpty(),this._isValid?(this.checkEnvelope(),this._isValid?(this.checkArea(),this._isValid?(this.checkDistance(),this._isValid):this._isValid):this._isValid):this._isValid):this._isValid},Yn.prototype.checkEnvelope=function(){if(this._distance<0)return null;var n=this._distance*Yn.MAX_ENV_DIFF_FRAC;n===0&&(n=.001);var i=new Pt(this._input.getEnvelopeInternal());i.expandBy(this._distance);var s=new Pt(this._result.getEnvelopeInternal());s.expandBy(n),s.contains(i)||(this._isValid=!1,this._errorMsg="Buffer envelope is incorrect",this._errorIndicator=this._input.getFactory().toGeometry(s)),this.report("Envelope")},Yn.prototype.checkDistance=function(){var n=new Dr(this._input,this._distance,this._result);n.isValid()||(this._isValid=!1,this._errorMsg=n.getErrorMessage(),this._errorLocation=n.getErrorLocation(),this._errorIndicator=n.getErrorIndicator()),this.report("Distance")},Yn.prototype.checkArea=function(){var n=this._input.getArea(),i=this._result.getArea();this._distance>0&&n>i&&(this._isValid=!1,this._errorMsg="Area of positive buffer is smaller than input",this._errorIndicator=this._result),this._distance<0&&n<i&&(this._isValid=!1,this._errorMsg="Area of negative buffer is larger than input",this._errorIndicator=this._result),this.report("Area")},Yn.prototype.checkPolygonal=function(){this._result instanceof Vt||this._result instanceof un||(this._isValid=!1),this._errorMsg="Result is not polygonal",this._errorIndicator=this._result,this.report("Polygonal")},Yn.prototype.getErrorIndicator=function(){return this._errorIndicator},Yn.prototype.getErrorLocation=function(){return this._errorLocation},Yn.prototype.checkExpectedEmpty=function(){return this._input.getDimension()>=2||this._distance>0?null:(this._result.isEmpty()||(this._isValid=!1,this._errorMsg="Result is non-empty",this._errorIndicator=this._result),void this.report("ExpectedEmpty"))},Yn.prototype.report=function(n){if(!Yn.VERBOSE)return null;Nt.out.println("Check "+n+": "+(this._isValid?"passed":"FAILED"))},Yn.prototype.getErrorMessage=function(){return this._errorMsg},Yn.prototype.interfaces_=function(){return[]},Yn.prototype.getClass=function(){return Yn},Yn.isValidMsg=function(n,i,s){var u=new Yn(n,i,s);return u.isValid()?null:u.getErrorMessage()},Yn.isValid=function(n,i,s){return!!new Yn(n,i,s).isValid()},Mf.VERBOSE.get=function(){return!1},Mf.MAX_ENV_DIFF_FRAC.get=function(){return .012},Object.defineProperties(Yn,Mf);var Ii=function(){this._pts=null,this._data=null;var n=arguments[0],i=arguments[1];this._pts=n,this._data=i};Ii.prototype.getCoordinates=function(){return this._pts},Ii.prototype.size=function(){return this._pts.length},Ii.prototype.getCoordinate=function(n){return this._pts[n]},Ii.prototype.isClosed=function(){return this._pts[0].equals(this._pts[this._pts.length-1])},Ii.prototype.getSegmentOctant=function(n){return n===this._pts.length-1?-1:Ts.octant(this.getCoordinate(n),this.getCoordinate(n+1))},Ii.prototype.setData=function(n){this._data=n},Ii.prototype.getData=function(){return this._data},Ii.prototype.toString=function(){return qt.toLineString(new he(this._pts))},Ii.prototype.interfaces_=function(){return[Bi]},Ii.prototype.getClass=function(){return Ii};var kn=function(){this._findAllIntersections=!1,this._isCheckEndSegmentsOnly=!1,this._li=null,this._interiorIntersection=null,this._intSegments=null,this._intersections=new j,this._intersectionCount=0,this._keepIntersections=!0;var n=arguments[0];this._li=n,this._interiorIntersection=null};kn.prototype.getInteriorIntersection=function(){return this._interiorIntersection},kn.prototype.setCheckEndSegmentsOnly=function(n){this._isCheckEndSegmentsOnly=n},kn.prototype.getIntersectionSegments=function(){return this._intSegments},kn.prototype.count=function(){return this._intersectionCount},kn.prototype.getIntersections=function(){return this._intersections},kn.prototype.setFindAllIntersections=function(n){this._findAllIntersections=n},kn.prototype.setKeepIntersections=function(n){this._keepIntersections=n},kn.prototype.processIntersections=function(n,i,s,u){if(!this._findAllIntersections&&this.hasIntersection()||n===s&&i===u||this._isCheckEndSegmentsOnly&&!(this.isEndSegment(n,i)||this.isEndSegment(s,u)))return null;var c=n.getCoordinates()[i],m=n.getCoordinates()[i+1],E=s.getCoordinates()[u],T=s.getCoordinates()[u+1];this._li.computeIntersection(c,m,E,T),this._li.hasIntersection()&&this._li.isInteriorIntersection()&&(this._intSegments=new Array(4).fill(null),this._intSegments[0]=c,this._intSegments[1]=m,this._intSegments[2]=E,this._intSegments[3]=T,this._interiorIntersection=this._li.getIntersection(0),this._keepIntersections&&this._intersections.add(this._interiorIntersection),this._intersectionCount++)},kn.prototype.isEndSegment=function(n,i){return i===0||i>=n.size()-2},kn.prototype.hasIntersection=function(){return this._interiorIntersection!==null},kn.prototype.isDone=function(){return!this._findAllIntersections&&this._interiorIntersection!==null},kn.prototype.interfaces_=function(){return[$o]},kn.prototype.getClass=function(){return kn},kn.createAllIntersectionsFinder=function(n){var i=new kn(n);return i.setFindAllIntersections(!0),i},kn.createAnyIntersectionFinder=function(n){return new kn(n)},kn.createIntersectionCounter=function(n){var i=new kn(n);return i.setFindAllIntersections(!0),i.setKeepIntersections(!1),i};var yi=function(){this._li=new J,this._segStrings=null,this._findAllIntersections=!1,this._segInt=null,this._isValid=!0;var n=arguments[0];this._segStrings=n};yi.prototype.execute=function(){if(this._segInt!==null)return null;this.checkInteriorIntersections()},yi.prototype.getIntersections=function(){return this._segInt.getIntersections()},yi.prototype.isValid=function(){return this.execute(),this._isValid},yi.prototype.setFindAllIntersections=function(n){this._findAllIntersections=n},yi.prototype.checkInteriorIntersections=function(){this._isValid=!0,this._segInt=new kn(this._li),this._segInt.setFindAllIntersections(this._findAllIntersections);var n=new vf;if(n.setSegmentIntersector(this._segInt),n.computeNodes(this._segStrings),this._segInt.hasIntersection())return this._isValid=!1,null},yi.prototype.checkValid=function(){if(this.execute(),!this._isValid)throw new io(this.getErrorMessage(),this._segInt.getInteriorIntersection())},yi.prototype.getErrorMessage=function(){if(this._isValid)return"no intersections found";var n=this._segInt.getIntersectionSegments();return"found non-noded intersection between "+qt.toLineString(n[0],n[1])+" and "+qt.toLineString(n[2],n[3])},yi.prototype.interfaces_=function(){return[]},yi.prototype.getClass=function(){return yi},yi.computeIntersections=function(n){var i=new yi(n);return i.setFindAllIntersections(!0),i.isValid(),i.getIntersections()};var Qo=function n(){this._nv=null;var i=arguments[0];this._nv=new yi(n.toSegmentStrings(i))};Qo.prototype.checkValid=function(){this._nv.checkValid()},Qo.prototype.interfaces_=function(){return[]},Qo.prototype.getClass=function(){return Qo},Qo.toSegmentStrings=function(n){for(var i=new j,s=n.iterator();s.hasNext();){var u=s.next();i.add(new Ii(u.getCoordinates(),u))}return i},Qo.checkValid=function(n){new Qo(n).checkValid()};var Ns=function(n){this._mapOp=n};Ns.prototype.map=function(n){for(var i=new j,s=0;s<n.getNumGeometries();s++){var u=this._mapOp.map(n.getGeometryN(s));u.isEmpty()||i.add(u)}return n.getFactory().createGeometryCollection(le.toGeometryArray(i))},Ns.prototype.interfaces_=function(){return[]},Ns.prototype.getClass=function(){return Ns},Ns.map=function(n,i){return new Ns(i).map(n)};var Ri=function(){this._op=null,this._geometryFactory=null,this._ptLocator=null,this._lineEdgesList=new j,this._resultLineList=new j;var n=arguments[0],i=arguments[1],s=arguments[2];this._op=n,this._geometryFactory=i,this._ptLocator=s};Ri.prototype.collectLines=function(n){for(var i=this._op.getGraph().getEdgeEnds().iterator();i.hasNext();){var s=i.next();this.collectLineEdge(s,n,this._lineEdgesList),this.collectBoundaryTouchEdge(s,n,this._lineEdgesList)}},Ri.prototype.labelIsolatedLine=function(n,i){var s=this._ptLocator.locate(n.getCoordinate(),this._op.getArgGeometry(i));n.getLabel().setLocation(i,s)},Ri.prototype.build=function(n){return this.findCoveredLineEdges(),this.collectLines(n),this.buildLines(n),this._resultLineList},Ri.prototype.collectLineEdge=function(n,i,s){var u=n.getLabel(),c=n.getEdge();n.isLineEdge()&&(n.isVisited()||!ae.isResultOfOp(u,i)||c.isCovered()||(s.add(c),n.setVisitedEdge(!0)))},Ri.prototype.findCoveredLineEdges=function(){for(var n=this._op.getGraph().getNodes().iterator();n.hasNext();)n.next().getEdges().findCoveredLineEdges();for(var i=this._op.getGraph().getEdgeEnds().iterator();i.hasNext();){var s=i.next(),u=s.getEdge();if(s.isLineEdge()&&!u.isCoveredSet()){var c=this._op.isCoveredByA(s.getCoordinate());u.setCovered(c)}}},Ri.prototype.labelIsolatedLines=function(n){for(var i=n.iterator();i.hasNext();){var s=i.next(),u=s.getLabel();s.isIsolated()&&(u.isNull(0)?this.labelIsolatedLine(s,0):this.labelIsolatedLine(s,1))}},Ri.prototype.buildLines=function(n){for(var i=this._lineEdgesList.iterator();i.hasNext();){var s=i.next(),u=this._geometryFactory.createLineString(s.getCoordinates());this._resultLineList.add(u),s.setInResult(!0)}},Ri.prototype.collectBoundaryTouchEdge=function(n,i,s){var u=n.getLabel();return n.isLineEdge()||n.isVisited()||n.isInteriorAreaEdge()||n.getEdge().isInResult()?null:(b.isTrue(!(n.isInResult()||n.getSym().isInResult())||!n.getEdge().isInResult()),void(ae.isResultOfOp(u,i)&&i===ae.INTERSECTION&&(s.add(n.getEdge()),n.setVisitedEdge(!0))))},Ri.prototype.interfaces_=function(){return[]},Ri.prototype.getClass=function(){return Ri};var Os=function(){this._op=null,this._geometryFactory=null,this._resultPointList=new j;var n=arguments[0],i=arguments[1];this._op=n,this._geometryFactory=i};Os.prototype.filterCoveredNodeToPoint=function(n){var i=n.getCoordinate();if(!this._op.isCoveredByLA(i)){var s=this._geometryFactory.createPoint(i);this._resultPointList.add(s)}},Os.prototype.extractNonCoveredResultNodes=function(n){for(var i=this._op.getGraph().getNodes().iterator();i.hasNext();){var s=i.next();if(!s.isInResult()&&!s.isIncidentEdgeInResult()&&(s.getEdges().getDegree()===0||n===ae.INTERSECTION)){var u=s.getLabel();ae.isResultOfOp(u,n)&&this.filterCoveredNodeToPoint(s)}}},Os.prototype.build=function(n){return this.extractNonCoveredResultNodes(n),this._resultPointList},Os.prototype.interfaces_=function(){return[]},Os.prototype.getClass=function(){return Os};var wr=function(){this._inputGeom=null,this._factory=null,this._pruneEmptyGeometry=!0,this._preserveGeometryCollectionType=!0,this._preserveCollections=!1,this._preserveType=!1};wr.prototype.transformPoint=function(n,i){return this._factory.createPoint(this.transformCoordinates(n.getCoordinateSequence(),n))},wr.prototype.transformPolygon=function(n,i){var s=!0,u=this.transformLinearRing(n.getExteriorRing(),n);u!==null&&u instanceof sn&&!u.isEmpty()||(s=!1);for(var c=new j,m=0;m<n.getNumInteriorRing();m++){var E=this.transformLinearRing(n.getInteriorRingN(m),n);E===null||E.isEmpty()||(E instanceof sn||(s=!1),c.add(E))}if(s)return this._factory.createPolygon(u,c.toArray([]));var T=new j;return u!==null&&T.add(u),T.addAll(c),this._factory.buildGeometry(T)},wr.prototype.createCoordinateSequence=function(n){return this._factory.getCoordinateSequenceFactory().create(n)},wr.prototype.getInputGeometry=function(){return this._inputGeom},wr.prototype.transformMultiLineString=function(n,i){for(var s=new j,u=0;u<n.getNumGeometries();u++){var c=this.transformLineString(n.getGeometryN(u),n);c!==null&&(c.isEmpty()||s.add(c))}return this._factory.buildGeometry(s)},wr.prototype.transformCoordinates=function(n,i){return this.copy(n)},wr.prototype.transformLineString=function(n,i){return this._factory.createLineString(this.transformCoordinates(n.getCoordinateSequence(),n))},wr.prototype.transformMultiPoint=function(n,i){for(var s=new j,u=0;u<n.getNumGeometries();u++){var c=this.transformPoint(n.getGeometryN(u),n);c!==null&&(c.isEmpty()||s.add(c))}return this._factory.buildGeometry(s)},wr.prototype.transformMultiPolygon=function(n,i){for(var s=new j,u=0;u<n.getNumGeometries();u++){var c=this.transformPolygon(n.getGeometryN(u),n);c!==null&&(c.isEmpty()||s.add(c))}return this._factory.buildGeometry(s)},wr.prototype.copy=function(n){return n.copy()},wr.prototype.transformGeometryCollection=function(n,i){for(var s=new j,u=0;u<n.getNumGeometries();u++){var c=this.transform(n.getGeometryN(u));c!==null&&(this._pruneEmptyGeometry&&c.isEmpty()||s.add(c))}return this._preserveGeometryCollectionType?this._factory.createGeometryCollection(le.toGeometryArray(s)):this._factory.buildGeometry(s)},wr.prototype.transform=function(n){if(this._inputGeom=n,this._factory=n.getFactory(),n instanceof Qt)return this.transformPoint(n,null);if(n instanceof fe)return this.transformMultiPoint(n,null);if(n instanceof sn)return this.transformLinearRing(n,null);if(n instanceof Bt)return this.transformLineString(n,null);if(n instanceof H)return this.transformMultiLineString(n,null);if(n instanceof Vt)return this.transformPolygon(n,null);if(n instanceof un)return this.transformMultiPolygon(n,null);if(n instanceof Vn)return this.transformGeometryCollection(n,null);throw new C("Unknown Geometry subtype: "+n.getClass().getName())},wr.prototype.transformLinearRing=function(n,i){var s=this.transformCoordinates(n.getCoordinateSequence(),n);if(s===null)return this._factory.createLinearRing(null);var u=s.size();return u>0&&u<4&&!this._preserveType?this._factory.createLineString(s):this._factory.createLinearRing(s)},wr.prototype.interfaces_=function(){return[]},wr.prototype.getClass=function(){return wr};var Hi=function n(){if(this._snapTolerance=0,this._srcPts=null,this._seg=new Zt,this._allowSnappingToSourceVertices=!1,this._isClosed=!1,arguments[0]instanceof Bt&&typeof arguments[1]=="number"){var i=arguments[0],s=arguments[1];n.call(this,i.getCoordinates(),s)}else if(arguments[0]instanceof Array&&typeof arguments[1]=="number"){var u=arguments[0],c=arguments[1];this._srcPts=u,this._isClosed=n.isClosed(u),this._snapTolerance=c}};Hi.prototype.snapVertices=function(n,i){for(var s=this._isClosed?n.size()-1:n.size(),u=0;u<s;u++){var c=n.get(u),m=this.findSnapForVertex(c,i);m!==null&&(n.set(u,new L(m)),u===0&&this._isClosed&&n.set(n.size()-1,new L(m)))}},Hi.prototype.findSnapForVertex=function(n,i){for(var s=0;s<i.length;s++){if(n.equals2D(i[s]))return null;if(n.distance(i[s])<this._snapTolerance)return i[s]}return null},Hi.prototype.snapTo=function(n){var i=new Dt(this._srcPts);return this.snapVertices(i,n),this.snapSegments(i,n),i.toCoordinateArray()},Hi.prototype.snapSegments=function(n,i){if(i.length===0)return null;var s=i.length;i[0].equals2D(i[i.length-1])&&(s=i.length-1);for(var u=0;u<s;u++){var c=i[u],m=this.findSegmentIndexToSnap(c,n);m>=0&&n.add(m+1,new L(c),!1)}},Hi.prototype.findSegmentIndexToSnap=function(n,i){for(var s=S.MAX_VALUE,u=-1,c=0;c<i.size()-1;c++){if(this._seg.p0=i.get(c),this._seg.p1=i.get(c+1),this._seg.p0.equals2D(n)||this._seg.p1.equals2D(n)){if(this._allowSnappingToSourceVertices)continue;return-1}var m=this._seg.distance(n);m<this._snapTolerance&&m<s&&(s=m,u=c)}return u},Hi.prototype.setAllowSnappingToSourceVertices=function(n){this._allowSnappingToSourceVertices=n},Hi.prototype.interfaces_=function(){return[]},Hi.prototype.getClass=function(){return Hi},Hi.isClosed=function(n){return!(n.length<=1)&&n[0].equals2D(n[n.length-1])};var bn=function(n){this._srcGeom=n||null},im={SNAP_PRECISION_FACTOR:{configurable:!0}};bn.prototype.snapTo=function(n,i){var s=this.extractTargetCoordinates(n);return new om(i,s).transform(this._srcGeom)},bn.prototype.snapToSelf=function(n,i){var s=this.extractTargetCoordinates(this._srcGeom),u=new om(n,s,!0).transform(this._srcGeom),c=u;return i&&X(c,ce)&&(c=u.buffer(0)),c},bn.prototype.computeSnapTolerance=function(n){return this.computeMinimumSegmentLength(n)/10},bn.prototype.extractTargetCoordinates=function(n){for(var i=new M,s=n.getCoordinates(),u=0;u<s.length;u++)i.add(s[u]);return i.toArray(new Array(0).fill(null))},bn.prototype.computeMinimumSegmentLength=function(n){for(var i=S.MAX_VALUE,s=0;s<n.length-1;s++){var u=n[s].distance(n[s+1]);u<i&&(i=u)}return i},bn.prototype.interfaces_=function(){return[]},bn.prototype.getClass=function(){return bn},bn.snap=function(n,i,s){var u=new Array(2).fill(null),c=new bn(n);u[0]=c.snapTo(i,s);var m=new bn(i);return u[1]=m.snapTo(u[0],s),u},bn.computeOverlaySnapTolerance=function(){if(arguments.length===1){var n=arguments[0],i=bn.computeSizeBasedSnapTolerance(n),s=n.getPrecisionModel();if(s.getType()===ie.FIXED){var u=1/s.getScale()*2/1.415;u>i&&(i=u)}return i}if(arguments.length===2){var c=arguments[0],m=arguments[1];return Math.min(bn.computeOverlaySnapTolerance(c),bn.computeOverlaySnapTolerance(m))}},bn.computeSizeBasedSnapTolerance=function(n){var i=n.getEnvelopeInternal();return Math.min(i.getHeight(),i.getWidth())*bn.SNAP_PRECISION_FACTOR},bn.snapToSelf=function(n,i,s){return new bn(n).snapToSelf(i,s)},im.SNAP_PRECISION_FACTOR.get=function(){return 1e-9},Object.defineProperties(bn,im);var om=function(n){function i(s,u,c){n.call(this),this._snapTolerance=s||null,this._snapPts=u||null,this._isSelfSnap=c!==void 0&&c}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.snapLine=function(s,u){var c=new Hi(s,this._snapTolerance);return c.setAllowSnappingToSourceVertices(this._isSelfSnap),c.snapTo(u)},i.prototype.transformCoordinates=function(s,u){var c=s.toCoordinateArray(),m=this.snapLine(c,this._snapPts);return this._factory.getCoordinateSequenceFactory().create(m)},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(wr),fr=function(){this._isFirst=!0,this._commonMantissaBitsCount=53,this._commonBits=0,this._commonSignExp=null};fr.prototype.getCommon=function(){return S.longBitsToDouble(this._commonBits)},fr.prototype.add=function(n){var i=S.doubleToLongBits(n);if(this._isFirst)return this._commonBits=i,this._commonSignExp=fr.signExpBits(this._commonBits),this._isFirst=!1,null;if(fr.signExpBits(i)!==this._commonSignExp)return this._commonBits=0,null;this._commonMantissaBitsCount=fr.numCommonMostSigMantissaBits(this._commonBits,i),this._commonBits=fr.zeroLowerBits(this._commonBits,64-(12+this._commonMantissaBitsCount))},fr.prototype.toString=function(){if(arguments.length===1){var n=arguments[0],i=S.longBitsToDouble(n),s="0000000000000000000000000000000000000000000000000000000000000000"+S.toBinaryString(n),u=s.substring(s.length-64);return u.substring(0,1)+" "+u.substring(1,12)+"(exp) "+u.substring(12)+" [ "+i+" ]"}},fr.prototype.interfaces_=function(){return[]},fr.prototype.getClass=function(){return fr},fr.getBit=function(n,i){return n&1<<i?1:0},fr.signExpBits=function(n){return n>>52},fr.zeroLowerBits=function(n,i){return n&~((1<<i)-1)},fr.numCommonMostSigMantissaBits=function(n,i){for(var s=0,u=52;u>=0;u--){if(fr.getBit(n,u)!==fr.getBit(i,u))return s;s++}return 52};var Po=function(){this._commonCoord=null,this._ccFilter=new Ds},Sf={CommonCoordinateFilter:{configurable:!0},Translater:{configurable:!0}};Po.prototype.addCommonBits=function(n){var i=new Io(this._commonCoord);n.apply(i),n.geometryChanged()},Po.prototype.removeCommonBits=function(n){if(this._commonCoord.x===0&&this._commonCoord.y===0)return n;var i=new L(this._commonCoord);i.x=-i.x,i.y=-i.y;var s=new Io(i);return n.apply(s),n.geometryChanged(),n},Po.prototype.getCommonCoordinate=function(){return this._commonCoord},Po.prototype.add=function(n){n.apply(this._ccFilter),this._commonCoord=this._ccFilter.getCommonCoordinate()},Po.prototype.interfaces_=function(){return[]},Po.prototype.getClass=function(){return Po},Sf.CommonCoordinateFilter.get=function(){return Ds},Sf.Translater.get=function(){return Io},Object.defineProperties(Po,Sf);var Ds=function(){this._commonBitsX=new fr,this._commonBitsY=new fr};Ds.prototype.filter=function(n){this._commonBitsX.add(n.x),this._commonBitsY.add(n.y)},Ds.prototype.getCommonCoordinate=function(){return new L(this._commonBitsX.getCommon(),this._commonBitsY.getCommon())},Ds.prototype.interfaces_=function(){return[Mt]},Ds.prototype.getClass=function(){return Ds};var Io=function(){this.trans=null;var n=arguments[0];this.trans=n};Io.prototype.filter=function(n,i){var s=n.getOrdinate(i,0)+this.trans.x,u=n.getOrdinate(i,1)+this.trans.y;n.setOrdinate(i,0,s),n.setOrdinate(i,1,u)},Io.prototype.isDone=function(){return!1},Io.prototype.isGeometryChanged=function(){return!0},Io.prototype.interfaces_=function(){return[Vr]},Io.prototype.getClass=function(){return Io};var Gn=function(n,i){this._geom=new Array(2).fill(null),this._snapTolerance=null,this._cbr=null,this._geom[0]=n,this._geom[1]=i,this.computeSnapTolerance()};Gn.prototype.selfSnap=function(n){return new bn(n).snapTo(n,this._snapTolerance)},Gn.prototype.removeCommonBits=function(n){this._cbr=new Po,this._cbr.add(n[0]),this._cbr.add(n[1]);var i=new Array(2).fill(null);return i[0]=this._cbr.removeCommonBits(n[0].copy()),i[1]=this._cbr.removeCommonBits(n[1].copy()),i},Gn.prototype.prepareResult=function(n){return this._cbr.addCommonBits(n),n},Gn.prototype.getResultGeometry=function(n){var i=this.snap(this._geom),s=ae.overlayOp(i[0],i[1],n);return this.prepareResult(s)},Gn.prototype.checkValid=function(n){n.isValid()||Nt.out.println("Snapped geometry is invalid")},Gn.prototype.computeSnapTolerance=function(){this._snapTolerance=bn.computeOverlaySnapTolerance(this._geom[0],this._geom[1])},Gn.prototype.snap=function(n){var i=this.removeCommonBits(n);return bn.snap(i[0],i[1],this._snapTolerance)},Gn.prototype.interfaces_=function(){return[]},Gn.prototype.getClass=function(){return Gn},Gn.overlayOp=function(n,i,s){return new Gn(n,i).getResultGeometry(s)},Gn.union=function(n,i){return Gn.overlayOp(n,i,ae.UNION)},Gn.intersection=function(n,i){return Gn.overlayOp(n,i,ae.INTERSECTION)},Gn.symDifference=function(n,i){return Gn.overlayOp(n,i,ae.SYMDIFFERENCE)},Gn.difference=function(n,i){return Gn.overlayOp(n,i,ae.DIFFERENCE)};var hr=function(n,i){this._geom=new Array(2).fill(null),this._geom[0]=n,this._geom[1]=i};hr.prototype.getResultGeometry=function(n){var i=null,s=!1,u=null;try{i=ae.overlayOp(this._geom[0],this._geom[1],n),s=!0}catch(c){if(!(c instanceof $))throw c;u=c}if(!s)try{i=Gn.overlayOp(this._geom[0],this._geom[1],n)}catch(c){throw c instanceof $?u:c}return i},hr.prototype.interfaces_=function(){return[]},hr.prototype.getClass=function(){return hr},hr.overlayOp=function(n,i,s){return new hr(n,i).getResultGeometry(s)},hr.union=function(n,i){return hr.overlayOp(n,i,ae.UNION)},hr.intersection=function(n,i){return hr.overlayOp(n,i,ae.INTERSECTION)},hr.symDifference=function(n,i){return hr.overlayOp(n,i,ae.SYMDIFFERENCE)},hr.difference=function(n,i){return hr.overlayOp(n,i,ae.DIFFERENCE)};var Mu=function(){this.mce=null,this.chainIndex=null;var n=arguments[0],i=arguments[1];this.mce=n,this.chainIndex=i};Mu.prototype.computeIntersections=function(n,i){this.mce.computeIntersectsForChain(this.chainIndex,n.mce,n.chainIndex,i)},Mu.prototype.interfaces_=function(){return[]},Mu.prototype.getClass=function(){return Mu};var Fr=function n(){if(this._label=null,this._xValue=null,this._eventType=null,this._insertEvent=null,this._deleteEventIndex=null,this._obj=null,arguments.length===2){var i=arguments[0],s=arguments[1];this._eventType=n.DELETE,this._xValue=i,this._insertEvent=s}else if(arguments.length===3){var u=arguments[0],c=arguments[1],m=arguments[2];this._eventType=n.INSERT,this._label=u,this._xValue=c,this._obj=m}},wf={INSERT:{configurable:!0},DELETE:{configurable:!0}};Fr.prototype.isDelete=function(){return this._eventType===Fr.DELETE},Fr.prototype.setDeleteEventIndex=function(n){this._deleteEventIndex=n},Fr.prototype.getObject=function(){return this._obj},Fr.prototype.compareTo=function(n){var i=n;return this._xValue<i._xValue?-1:this._xValue>i._xValue?1:this._eventType<i._eventType?-1:this._eventType>i._eventType?1:0},Fr.prototype.getInsertEvent=function(){return this._insertEvent},Fr.prototype.isInsert=function(){return this._eventType===Fr.INSERT},Fr.prototype.isSameLabel=function(n){return this._label!==null&&this._label===n._label},Fr.prototype.getDeleteEventIndex=function(){return this._deleteEventIndex},Fr.prototype.interfaces_=function(){return[F]},Fr.prototype.getClass=function(){return Fr},wf.INSERT.get=function(){return 1},wf.DELETE.get=function(){return 2},Object.defineProperties(Fr,wf);var wl=function(){};wl.prototype.interfaces_=function(){return[]},wl.prototype.getClass=function(){return wl};var Zn=function(){this._hasIntersection=!1,this._hasProper=!1,this._hasProperInterior=!1,this._properIntersectionPoint=null,this._li=null,this._includeProper=null,this._recordIsolated=null,this._isSelfIntersection=null,this._numIntersections=0,this.numTests=0,this._bdyNodes=null,this._isDone=!1,this._isDoneWhenProperInt=!1;var n=arguments[0],i=arguments[1],s=arguments[2];this._li=n,this._includeProper=i,this._recordIsolated=s};Zn.prototype.isTrivialIntersection=function(n,i,s,u){if(n===s&&this._li.getIntersectionNum()===1){if(Zn.isAdjacentSegments(i,u))return!0;if(n.isClosed()){var c=n.getNumPoints()-1;if(i===0&&u===c||u===0&&i===c)return!0}}return!1},Zn.prototype.getProperIntersectionPoint=function(){return this._properIntersectionPoint},Zn.prototype.setIsDoneIfProperInt=function(n){this._isDoneWhenProperInt=n},Zn.prototype.hasProperInteriorIntersection=function(){return this._hasProperInterior},Zn.prototype.isBoundaryPointInternal=function(n,i){for(var s=i.iterator();s.hasNext();){var u=s.next().getCoordinate();if(n.isIntersection(u))return!0}return!1},Zn.prototype.hasProperIntersection=function(){return this._hasProper},Zn.prototype.hasIntersection=function(){return this._hasIntersection},Zn.prototype.isDone=function(){return this._isDone},Zn.prototype.isBoundaryPoint=function(n,i){return i!==null&&(!!this.isBoundaryPointInternal(n,i[0])||!!this.isBoundaryPointInternal(n,i[1]))},Zn.prototype.setBoundaryNodes=function(n,i){this._bdyNodes=new Array(2).fill(null),this._bdyNodes[0]=n,this._bdyNodes[1]=i},Zn.prototype.addIntersections=function(n,i,s,u){if(n===s&&i===u)return null;this.numTests++;var c=n.getCoordinates()[i],m=n.getCoordinates()[i+1],E=s.getCoordinates()[u],T=s.getCoordinates()[u+1];this._li.computeIntersection(c,m,E,T),this._li.hasIntersection()&&(this._recordIsolated&&(n.setIsolated(!1),s.setIsolated(!1)),this._numIntersections++,this.isTrivialIntersection(n,i,s,u)||(this._hasIntersection=!0,!this._includeProper&&this._li.isProper()||(n.addIntersections(this._li,i,0),s.addIntersections(this._li,u,1)),this._li.isProper()&&(this._properIntersectionPoint=this._li.getIntersection(0).copy(),this._hasProper=!0,this._isDoneWhenProperInt&&(this._isDone=!0),this.isBoundaryPoint(this._li,this._bdyNodes)||(this._hasProperInterior=!0))))},Zn.prototype.interfaces_=function(){return[]},Zn.prototype.getClass=function(){return Zn},Zn.isAdjacentSegments=function(n,i){return Math.abs(n-i)===1};var S1=function(n){function i(){n.call(this),this.events=new j,this.nOverlaps=null}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.prepareEvents=function(){di.sort(this.events);for(var s=0;s<this.events.size();s++){var u=this.events.get(s);u.isDelete()&&u.getInsertEvent().setDeleteEventIndex(s)}},i.prototype.computeIntersections=function(){if(arguments.length===1){var s=arguments[0];this.nOverlaps=0,this.prepareEvents();for(var u=0;u<this.events.size();u++){var c=this.events.get(u);if(c.isInsert()&&this.processOverlaps(u,c.getDeleteEventIndex(),c,s),s.isDone())break}}else if(arguments.length===3){if(arguments[2]instanceof Zn&&X(arguments[0],wt)&&X(arguments[1],wt)){var m=arguments[0],E=arguments[1],T=arguments[2];this.addEdges(m,m),this.addEdges(E,E),this.computeIntersections(T)}else if(typeof arguments[2]=="boolean"&&X(arguments[0],wt)&&arguments[1]instanceof Zn){var U=arguments[0],Z=arguments[1];arguments[2]?this.addEdges(U,null):this.addEdges(U),this.computeIntersections(Z)}}},i.prototype.addEdge=function(s,u){for(var c=s.getMonotoneChainEdge(),m=c.getStartIndexes(),E=0;E<m.length-1;E++){var T=new Mu(c,E),U=new Fr(u,c.getMinX(E),T);this.events.add(U),this.events.add(new Fr(c.getMaxX(E),U))}},i.prototype.processOverlaps=function(s,u,c,m){for(var E=c.getObject(),T=s;T<u;T++){var U=this.events.get(T);if(U.isInsert()){var Z=U.getObject();c.isSameLabel(U)||(E.computeIntersections(Z,m),this.nOverlaps++)}}},i.prototype.addEdges=function(){if(arguments.length===1)for(var s=arguments[0].iterator();s.hasNext();){var u=s.next();this.addEdge(u,u)}else if(arguments.length===2)for(var c=arguments[0],m=arguments[1],E=c.iterator();E.hasNext();){var T=E.next();this.addEdge(T,m)}},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(wl),Wi=function(){this._min=S.POSITIVE_INFINITY,this._max=S.NEGATIVE_INFINITY},sm={NodeComparator:{configurable:!0}};Wi.prototype.getMin=function(){return this._min},Wi.prototype.intersects=function(n,i){return!(this._min>i||this._max<n)},Wi.prototype.getMax=function(){return this._max},Wi.prototype.toString=function(){return qt.toLineString(new L(this._min,0),new L(this._max,0))},Wi.prototype.interfaces_=function(){return[]},Wi.prototype.getClass=function(){return Wi},sm.NodeComparator.get=function(){return Su},Object.defineProperties(Wi,sm);var Su=function(){};Su.prototype.compare=function(n,i){var s=n,u=i,c=(s._min+s._max)/2,m=(u._min+u._max)/2;return c<m?-1:c>m?1:0},Su.prototype.interfaces_=function(){return[z]},Su.prototype.getClass=function(){return Su};var w1=function(n){function i(){n.call(this),this._item=null;var s=arguments[0],u=arguments[1],c=arguments[2];this._min=s,this._max=u,this._item=c}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.query=function(s,u,c){if(!this.intersects(s,u))return null;c.visitItem(this._item)},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(Wi),b1=function(n){function i(){n.call(this),this._node1=null,this._node2=null;var s=arguments[0],u=arguments[1];this._node1=s,this._node2=u,this.buildExtent(this._node1,this._node2)}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.buildExtent=function(s,u){this._min=Math.min(s._min,u._min),this._max=Math.max(s._max,u._max)},i.prototype.query=function(s,u,c){if(!this.intersects(s,u))return null;this._node1!==null&&this._node1.query(s,u,c),this._node2!==null&&this._node2.query(s,u,c)},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(Wi),qi=function(){this._leaves=new j,this._root=null,this._level=0};qi.prototype.buildTree=function(){di.sort(this._leaves,new Wi.NodeComparator);for(var n=this._leaves,i=null,s=new j;;){if(this.buildLevel(n,s),s.size()===1)return s.get(0);i=n,n=s,s=i}},qi.prototype.insert=function(n,i,s){if(this._root!==null)throw new Error("Index cannot be added to once it has been queried");this._leaves.add(new w1(n,i,s))},qi.prototype.query=function(n,i,s){this.init(),this._root.query(n,i,s)},qi.prototype.buildRoot=function(){if(this._root!==null)return null;this._root=this.buildTree()},qi.prototype.printNode=function(n){Nt.out.println(qt.toLineString(new L(n._min,this._level),new L(n._max,this._level)))},qi.prototype.init=function(){if(this._root!==null)return null;this.buildRoot()},qi.prototype.buildLevel=function(n,i){this._level++,i.clear();for(var s=0;s<n.size();s+=2){var u=n.get(s);if((s+1<n.size()?n.get(s):null)===null)i.add(u);else{var c=new b1(n.get(s),n.get(s+1));i.add(c)}}},qi.prototype.interfaces_=function(){return[]},qi.prototype.getClass=function(){return qi};var fa=function(){this._items=new j};fa.prototype.visitItem=function(n){this._items.add(n)},fa.prototype.getItems=function(){return this._items},fa.prototype.interfaces_=function(){return[Mo]},fa.prototype.getClass=function(){return fa};var ha=function(){this._index=null;var n=arguments[0];if(!X(n,ce))throw new C("Argument must be Polygonal");this._index=new ts(n)},bf={SegmentVisitor:{configurable:!0},IntervalIndexedGeometry:{configurable:!0}};ha.prototype.locate=function(n){var i=new P(n),s=new pa(i);return this._index.query(n.y,n.y,s),i.getLocation()},ha.prototype.interfaces_=function(){return[ua]},ha.prototype.getClass=function(){return ha},bf.SegmentVisitor.get=function(){return pa},bf.IntervalIndexedGeometry.get=function(){return ts},Object.defineProperties(ha,bf);var pa=function(){this._counter=null;var n=arguments[0];this._counter=n};pa.prototype.visitItem=function(n){var i=n;this._counter.countSegment(i.getCoordinate(0),i.getCoordinate(1))},pa.prototype.interfaces_=function(){return[Mo]},pa.prototype.getClass=function(){return pa};var ts=function(){this._index=new qi;var n=arguments[0];this.init(n)};ts.prototype.init=function(n){for(var i=qn.getLines(n).iterator();i.hasNext();){var s=i.next().getCoordinates();this.addLine(s)}},ts.prototype.addLine=function(n){for(var i=1;i<n.length;i++){var s=new Zt(n[i-1],n[i]),u=Math.min(s.p0.y,s.p1.y),c=Math.max(s.p0.y,s.p1.y);this._index.insert(u,c,s)}},ts.prototype.query=function(){if(arguments.length===2){var n=arguments[0],i=arguments[1],s=new fa;return this._index.query(n,i,s),s.getItems()}if(arguments.length===3){var u=arguments[0],c=arguments[1],m=arguments[2];this._index.query(u,c,m)}},ts.prototype.interfaces_=function(){return[]},ts.prototype.getClass=function(){return ts};var wu=function(n){function i(){if(n.call(this),this._parentGeom=null,this._lineEdgeMap=new ia,this._boundaryNodeRule=null,this._useBoundaryDeterminationRule=!0,this._argIndex=null,this._boundaryNodes=null,this._hasTooFewPoints=!1,this._invalidPoint=null,this._areaPtLocator=null,this._ptLocator=new gi,arguments.length===2){var s=arguments[0],u=arguments[1],c=Lt.OGC_SFS_BOUNDARY_RULE;this._argIndex=s,this._parentGeom=u,this._boundaryNodeRule=c,u!==null&&this.add(u)}else if(arguments.length===3){var m=arguments[0],E=arguments[1],T=arguments[2];this._argIndex=m,this._parentGeom=E,this._boundaryNodeRule=T,E!==null&&this.add(E)}}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.insertBoundaryPoint=function(s,u){var c=this._nodes.addNode(u).getLabel(),m=1;k.NONE,c.getLocation(s,bt.ON)===k.BOUNDARY&&m++;var E=i.determineBoundary(this._boundaryNodeRule,m);c.setLocation(s,E)},i.prototype.computeSelfNodes=function(){if(arguments.length===2){var s=arguments[0],u=arguments[1];return this.computeSelfNodes(s,u,!1)}if(arguments.length===3){var c=arguments[0],m=arguments[1],E=arguments[2],T=new Zn(c,!0,!1);T.setIsDoneIfProperInt(E);var U=this.createEdgeSetIntersector(),Z=this._parentGeom instanceof sn||this._parentGeom instanceof Vt||this._parentGeom instanceof un,ut=m||!Z;return U.computeIntersections(this._edges,T,ut),this.addSelfIntersectionNodes(this._argIndex),T}},i.prototype.computeSplitEdges=function(s){for(var u=this._edges.iterator();u.hasNext();)u.next().eiList.addSplitEdges(s)},i.prototype.computeEdgeIntersections=function(s,u,c){var m=new Zn(u,c,!0);return m.setBoundaryNodes(this.getBoundaryNodes(),s.getBoundaryNodes()),this.createEdgeSetIntersector().computeIntersections(this._edges,s._edges,m),m},i.prototype.getGeometry=function(){return this._parentGeom},i.prototype.getBoundaryNodeRule=function(){return this._boundaryNodeRule},i.prototype.hasTooFewPoints=function(){return this._hasTooFewPoints},i.prototype.addPoint=function(){if(arguments[0]instanceof Qt){var s=arguments[0].getCoordinate();this.insertPoint(this._argIndex,s,k.INTERIOR)}else if(arguments[0]instanceof L){var u=arguments[0];this.insertPoint(this._argIndex,u,k.INTERIOR)}},i.prototype.addPolygon=function(s){this.addPolygonRing(s.getExteriorRing(),k.EXTERIOR,k.INTERIOR);for(var u=0;u<s.getNumInteriorRing();u++){var c=s.getInteriorRingN(u);this.addPolygonRing(c,k.INTERIOR,k.EXTERIOR)}},i.prototype.addEdge=function(s){this.insertEdge(s);var u=s.getCoordinates();this.insertPoint(this._argIndex,u[0],k.BOUNDARY),this.insertPoint(this._argIndex,u[u.length-1],k.BOUNDARY)},i.prototype.addLineString=function(s){var u=ft.removeRepeatedPoints(s.getCoordinates());if(u.length<2)return this._hasTooFewPoints=!0,this._invalidPoint=u[0],null;var c=new Sl(u,new rn(this._argIndex,k.INTERIOR));this._lineEdgeMap.put(s,c),this.insertEdge(c),b.isTrue(u.length>=2,"found LineString with single point"),this.insertBoundaryPoint(this._argIndex,u[0]),this.insertBoundaryPoint(this._argIndex,u[u.length-1])},i.prototype.getInvalidPoint=function(){return this._invalidPoint},i.prototype.getBoundaryPoints=function(){for(var s=this.getBoundaryNodes(),u=new Array(s.size()).fill(null),c=0,m=s.iterator();m.hasNext();){var E=m.next();u[c++]=E.getCoordinate().copy()}return u},i.prototype.getBoundaryNodes=function(){return this._boundaryNodes===null&&(this._boundaryNodes=this._nodes.getBoundaryNodes(this._argIndex)),this._boundaryNodes},i.prototype.addSelfIntersectionNode=function(s,u,c){if(this.isBoundaryNode(s,u))return null;c===k.BOUNDARY&&this._useBoundaryDeterminationRule?this.insertBoundaryPoint(s,u):this.insertPoint(s,u,c)},i.prototype.addPolygonRing=function(s,u,c){if(s.isEmpty())return null;var m=ft.removeRepeatedPoints(s.getCoordinates());if(m.length<4)return this._hasTooFewPoints=!0,this._invalidPoint=m[0],null;var E=u,T=c;B.isCCW(m)&&(E=c,T=u);var U=new Sl(m,new rn(this._argIndex,k.BOUNDARY,E,T));this._lineEdgeMap.put(s,U),this.insertEdge(U),this.insertPoint(this._argIndex,m[0],k.BOUNDARY)},i.prototype.insertPoint=function(s,u,c){var m=this._nodes.addNode(u),E=m.getLabel();E===null?m._label=new rn(s,c):E.setLocation(s,c)},i.prototype.createEdgeSetIntersector=function(){return new S1},i.prototype.addSelfIntersectionNodes=function(s){for(var u=this._edges.iterator();u.hasNext();)for(var c=u.next(),m=c.getLabel().getLocation(s),E=c.eiList.iterator();E.hasNext();){var T=E.next();this.addSelfIntersectionNode(s,T.coord,m)}},i.prototype.add=function(){if(arguments.length!==1)return n.prototype.add.apply(this,arguments);var s=arguments[0];if(s.isEmpty())return null;if(s instanceof un&&(this._useBoundaryDeterminationRule=!1),s instanceof Vt)this.addPolygon(s);else if(s instanceof Bt)this.addLineString(s);else if(s instanceof Qt)this.addPoint(s);else if(s instanceof fe)this.addCollection(s);else if(s instanceof H)this.addCollection(s);else if(s instanceof un)this.addCollection(s);else{if(!(s instanceof Vn))throw new Error(s.getClass().getName());this.addCollection(s)}},i.prototype.addCollection=function(s){for(var u=0;u<s.getNumGeometries();u++){var c=s.getGeometryN(u);this.add(c)}},i.prototype.locate=function(s){return X(this._parentGeom,ce)&&this._parentGeom.getNumGeometries()>50?(this._areaPtLocator===null&&(this._areaPtLocator=new ha(this._parentGeom)),this._areaPtLocator.locate(s)):this._ptLocator.locate(s,this._parentGeom)},i.prototype.findEdge=function(){if(arguments.length===1){var s=arguments[0];return this._lineEdgeMap.get(s)}return n.prototype.findEdge.apply(this,arguments)},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i.determineBoundary=function(s,u){return s.isInBoundary(u)?k.BOUNDARY:k.INTERIOR},i}(_n),da=function(){if(this._li=new J,this._resultPrecisionModel=null,this._arg=null,arguments.length===1){var n=arguments[0];this.setComputationPrecision(n.getPrecisionModel()),this._arg=new Array(1).fill(null),this._arg[0]=new wu(0,n)}else if(arguments.length===2){var i=arguments[0],s=arguments[1],u=Lt.OGC_SFS_BOUNDARY_RULE;i.getPrecisionModel().compareTo(s.getPrecisionModel())>=0?this.setComputationPrecision(i.getPrecisionModel()):this.setComputationPrecision(s.getPrecisionModel()),this._arg=new Array(2).fill(null),this._arg[0]=new wu(0,i,u),this._arg[1]=new wu(1,s,u)}else if(arguments.length===3){var c=arguments[0],m=arguments[1],E=arguments[2];c.getPrecisionModel().compareTo(m.getPrecisionModel())>=0?this.setComputationPrecision(c.getPrecisionModel()):this.setComputationPrecision(m.getPrecisionModel()),this._arg=new Array(2).fill(null),this._arg[0]=new wu(0,c,E),this._arg[1]=new wu(1,m,E)}};da.prototype.getArgGeometry=function(n){return this._arg[n].getGeometry()},da.prototype.setComputationPrecision=function(n){this._resultPrecisionModel=n,this._li.setPrecisionModel(this._resultPrecisionModel)},da.prototype.interfaces_=function(){return[]},da.prototype.getClass=function(){return da};var es=function(){};es.prototype.interfaces_=function(){return[]},es.prototype.getClass=function(){return es},es.map=function(){if(arguments[0]instanceof Q&&X(arguments[1],es.MapOp)){for(var n=arguments[0],i=arguments[1],s=new j,u=0;u<n.getNumGeometries();u++){var c=i.map(n.getGeometryN(u));c!==null&&s.add(c)}return n.getFactory().buildGeometry(s)}if(X(arguments[0],Ot)&&X(arguments[1],es.MapOp)){for(var m=arguments[0],E=arguments[1],T=new j,U=m.iterator();U.hasNext();){var Z=U.next(),ut=E.map(Z);ut!==null&&T.add(ut)}return T}},es.MapOp=function(){};var ae=function(n){function i(){var s=arguments[0],u=arguments[1];n.call(this,s,u),this._ptLocator=new gi,this._geomFact=null,this._resultGeom=null,this._graph=null,this._edgeList=new mi,this._resultPolyList=new j,this._resultLineList=new j,this._resultPointList=new j,this._graph=new _n(new Kd),this._geomFact=s.getFactory()}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.insertUniqueEdge=function(s){var u=this._edgeList.findEqualEdge(s);if(u!==null){var c=u.getLabel(),m=s.getLabel();u.isPointwiseEqual(s)||(m=new rn(s.getLabel())).flip();var E=u.getDepth();E.isNull()&&E.add(c),E.add(m),c.merge(m)}else this._edgeList.add(s)},i.prototype.getGraph=function(){return this._graph},i.prototype.cancelDuplicateResultEdges=function(){for(var s=this._graph.getEdgeEnds().iterator();s.hasNext();){var u=s.next(),c=u.getSym();u.isInResult()&&c.isInResult()&&(u.setInResult(!1),c.setInResult(!1))}},i.prototype.isCoveredByLA=function(s){return!!this.isCovered(s,this._resultLineList)||!!this.isCovered(s,this._resultPolyList)},i.prototype.computeGeometry=function(s,u,c,m){var E=new j;return E.addAll(s),E.addAll(u),E.addAll(c),E.isEmpty()?i.createEmptyResult(m,this._arg[0].getGeometry(),this._arg[1].getGeometry(),this._geomFact):this._geomFact.buildGeometry(E)},i.prototype.mergeSymLabels=function(){for(var s=this._graph.getNodes().iterator();s.hasNext();)s.next().getEdges().mergeSymLabels()},i.prototype.isCovered=function(s,u){for(var c=u.iterator();c.hasNext();){var m=c.next();if(this._ptLocator.locate(s,m)!==k.EXTERIOR)return!0}return!1},i.prototype.replaceCollapsedEdges=function(){for(var s=new j,u=this._edgeList.iterator();u.hasNext();){var c=u.next();c.isCollapsed()&&(u.remove(),s.add(c.getCollapsedEdge()))}this._edgeList.addAll(s)},i.prototype.updateNodeLabelling=function(){for(var s=this._graph.getNodes().iterator();s.hasNext();){var u=s.next(),c=u.getEdges().getLabel();u.getLabel().merge(c)}},i.prototype.getResultGeometry=function(s){return this.computeOverlay(s),this._resultGeom},i.prototype.insertUniqueEdges=function(s){for(var u=s.iterator();u.hasNext();){var c=u.next();this.insertUniqueEdge(c)}},i.prototype.computeOverlay=function(s){this.copyPoints(0),this.copyPoints(1),this._arg[0].computeSelfNodes(this._li,!1),this._arg[1].computeSelfNodes(this._li,!1),this._arg[0].computeEdgeIntersections(this._arg[1],this._li,!0);var u=new j;this._arg[0].computeSplitEdges(u),this._arg[1].computeSplitEdges(u),this.insertUniqueEdges(u),this.computeLabelsFromDepths(),this.replaceCollapsedEdges(),Qo.checkValid(this._edgeList.getEdges()),this._graph.addEdges(this._edgeList.getEdges()),this.computeLabelling(),this.labelIncompleteNodes(),this.findResultAreaEdges(s),this.cancelDuplicateResultEdges();var c=new Nr(this._geomFact);c.add(this._graph),this._resultPolyList=c.getPolygons();var m=new Ri(this,this._geomFact,this._ptLocator);this._resultLineList=m.build(s);var E=new Os(this,this._geomFact,this._ptLocator);this._resultPointList=E.build(s),this._resultGeom=this.computeGeometry(this._resultPointList,this._resultLineList,this._resultPolyList,s)},i.prototype.labelIncompleteNode=function(s,u){var c=this._ptLocator.locate(s.getCoordinate(),this._arg[u].getGeometry());s.getLabel().setLocation(u,c)},i.prototype.copyPoints=function(s){for(var u=this._arg[s].getNodeIterator();u.hasNext();){var c=u.next();this._graph.addNode(c.getCoordinate()).setLabel(s,c.getLabel().getLocation(s))}},i.prototype.findResultAreaEdges=function(s){for(var u=this._graph.getEdgeEnds().iterator();u.hasNext();){var c=u.next(),m=c.getLabel();m.isArea()&&!c.isInteriorAreaEdge()&&i.isResultOfOp(m.getLocation(0,bt.RIGHT),m.getLocation(1,bt.RIGHT),s)&&c.setInResult(!0)}},i.prototype.computeLabelsFromDepths=function(){for(var s=this._edgeList.iterator();s.hasNext();){var u=s.next(),c=u.getLabel(),m=u.getDepth();if(!m.isNull()){m.normalize();for(var E=0;E<2;E++)c.isNull(E)||!c.isArea()||m.isNull(E)||(m.getDelta(E)===0?c.toLine(E):(b.isTrue(!m.isNull(E,bt.LEFT),"depth of LEFT side has not been initialized"),c.setLocation(E,bt.LEFT,m.getLocation(E,bt.LEFT)),b.isTrue(!m.isNull(E,bt.RIGHT),"depth of RIGHT side has not been initialized"),c.setLocation(E,bt.RIGHT,m.getLocation(E,bt.RIGHT))))}}},i.prototype.computeLabelling=function(){for(var s=this._graph.getNodes().iterator();s.hasNext();)s.next().getEdges().computeLabelling(this._arg);this.mergeSymLabels(),this.updateNodeLabelling()},i.prototype.labelIncompleteNodes=function(){for(var s=this._graph.getNodes().iterator();s.hasNext();){var u=s.next(),c=u.getLabel();u.isIsolated()&&(c.isNull(0)?this.labelIncompleteNode(u,0):this.labelIncompleteNode(u,1)),u.getEdges().updateLabelling(c)}},i.prototype.isCoveredByA=function(s){return!!this.isCovered(s,this._resultPolyList)},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(da);ae.overlayOp=function(n,i,s){return new ae(n,i).getResultGeometry(s)},ae.intersection=function(n,i){if(n.isEmpty()||i.isEmpty())return ae.createEmptyResult(ae.INTERSECTION,n,i,n.getFactory());if(n.isGeometryCollection()){var s=i;return Ns.map(n,{interfaces_:function(){return[es.MapOp]},map:function(u){return u.intersection(s)}})}return n.checkNotGeometryCollection(n),n.checkNotGeometryCollection(i),hr.overlayOp(n,i,ae.INTERSECTION)},ae.symDifference=function(n,i){if(n.isEmpty()||i.isEmpty()){if(n.isEmpty()&&i.isEmpty())return ae.createEmptyResult(ae.SYMDIFFERENCE,n,i,n.getFactory());if(n.isEmpty())return i.copy();if(i.isEmpty())return n.copy()}return n.checkNotGeometryCollection(n),n.checkNotGeometryCollection(i),hr.overlayOp(n,i,ae.SYMDIFFERENCE)},ae.resultDimension=function(n,i,s){var u=i.getDimension(),c=s.getDimension(),m=-1;switch(n){case ae.INTERSECTION:m=Math.min(u,c);break;case ae.UNION:m=Math.max(u,c);break;case ae.DIFFERENCE:m=u;break;case ae.SYMDIFFERENCE:m=Math.max(u,c)}return m},ae.createEmptyResult=function(n,i,s,u){var c=null;switch(ae.resultDimension(n,i,s)){case-1:c=u.createGeometryCollection(new Array(0).fill(null));break;case 0:c=u.createPoint();break;case 1:c=u.createLineString();break;case 2:c=u.createPolygon()}return c},ae.difference=function(n,i){return n.isEmpty()?ae.createEmptyResult(ae.DIFFERENCE,n,i,n.getFactory()):i.isEmpty()?n.copy():(n.checkNotGeometryCollection(n),n.checkNotGeometryCollection(i),hr.overlayOp(n,i,ae.DIFFERENCE))},ae.isResultOfOp=function(){if(arguments.length===2){var n=arguments[0],i=arguments[1],s=n.getLocation(0),u=n.getLocation(1);return ae.isResultOfOp(s,u,i)}if(arguments.length===3){var c=arguments[0],m=arguments[1],E=arguments[2];switch(c===k.BOUNDARY&&(c=k.INTERIOR),m===k.BOUNDARY&&(m=k.INTERIOR),E){case ae.INTERSECTION:return c===k.INTERIOR&&m===k.INTERIOR;case ae.UNION:return c===k.INTERIOR||m===k.INTERIOR;case ae.DIFFERENCE:return c===k.INTERIOR&&m!==k.INTERIOR;case ae.SYMDIFFERENCE:return c===k.INTERIOR&&m!==k.INTERIOR||c!==k.INTERIOR&&m===k.INTERIOR}return!1}},ae.INTERSECTION=1,ae.UNION=2,ae.DIFFERENCE=3,ae.SYMDIFFERENCE=4;var Ro=function(){this._g=null,this._boundaryDistanceTolerance=null,this._linework=null,this._ptLocator=new gi,this._seg=new Zt;var n=arguments[0],i=arguments[1];this._g=n,this._boundaryDistanceTolerance=i,this._linework=this.extractLinework(n)};Ro.prototype.isWithinToleranceOfBoundary=function(n){for(var i=0;i<this._linework.getNumGeometries();i++)for(var s=this._linework.getGeometryN(i).getCoordinateSequence(),u=0;u<s.size()-1;u++)if(s.getCoordinate(u,this._seg.p0),s.getCoordinate(u+1,this._seg.p1),this._seg.distance(n)<=this._boundaryDistanceTolerance)return!0;return!1},Ro.prototype.getLocation=function(n){return this.isWithinToleranceOfBoundary(n)?k.BOUNDARY:this._ptLocator.locate(n,this._g)},Ro.prototype.extractLinework=function(n){var i=new ma;n.apply(i);var s=i.getLinework(),u=le.toLineStringArray(s);return n.getFactory().createMultiLineString(u)},Ro.prototype.interfaces_=function(){return[]},Ro.prototype.getClass=function(){return Ro};var ma=function(){this._linework=null,this._linework=new j};ma.prototype.getLinework=function(){return this._linework},ma.prototype.filter=function(n){if(n instanceof Vt){var i=n;this._linework.add(i.getExteriorRing());for(var s=0;s<i.getNumInteriorRing();s++)this._linework.add(i.getInteriorRingN(s))}},ma.prototype.interfaces_=function(){return[ei]},ma.prototype.getClass=function(){return ma};var ns=function(){this._g=null,this._doLeft=!0,this._doRight=!0;var n=arguments[0];this._g=n};ns.prototype.extractPoints=function(n,i,s){for(var u=n.getCoordinates(),c=0;c<u.length-1;c++)this.computeOffsetPoints(u[c],u[c+1],i,s)},ns.prototype.setSidesToGenerate=function(n,i){this._doLeft=n,this._doRight=i},ns.prototype.getPoints=function(n){for(var i=new j,s=qn.getLines(this._g).iterator();s.hasNext();){var u=s.next();this.extractPoints(u,n,i)}return i},ns.prototype.computeOffsetPoints=function(n,i,s,u){var c=i.x-n.x,m=i.y-n.y,E=Math.sqrt(c*c+m*m),T=s*c/E,U=s*m/E,Z=(i.x+n.x)/2,ut=(i.y+n.y)/2;if(this._doLeft){var ht=new L(Z-U,ut+T);u.add(ht)}if(this._doRight){var At=new L(Z+U,ut-T);u.add(At)}},ns.prototype.interfaces_=function(){return[]},ns.prototype.getClass=function(){return ns};var Yr=function n(){this._geom=null,this._locFinder=null,this._location=new Array(3).fill(null),this._invalidLocation=null,this._boundaryDistanceTolerance=n.TOLERANCE,this._testCoords=new j;var i=arguments[0],s=arguments[1],u=arguments[2];this._boundaryDistanceTolerance=n.computeBoundaryDistanceTolerance(i,s),this._geom=[i,s,u],this._locFinder=[new Ro(this._geom[0],this._boundaryDistanceTolerance),new Ro(this._geom[1],this._boundaryDistanceTolerance),new Ro(this._geom[2],this._boundaryDistanceTolerance)]},am={TOLERANCE:{configurable:!0}};Yr.prototype.reportResult=function(n,i,s){Nt.out.println("Overlay result invalid - A:"+k.toLocationSymbol(i[0])+" B:"+k.toLocationSymbol(i[1])+" expected:"+(s?"i":"e")+" actual:"+k.toLocationSymbol(i[2]))},Yr.prototype.isValid=function(n){this.addTestPts(this._geom[0]),this.addTestPts(this._geom[1]);var i=this.checkValid(n);return i},Yr.prototype.checkValid=function(){if(arguments.length===1){for(var n=arguments[0],i=0;i<this._testCoords.size();i++){var s=this._testCoords.get(i);if(!this.checkValid(n,s))return this._invalidLocation=s,!1}return!0}if(arguments.length===2){var u=arguments[0],c=arguments[1];return this._location[0]=this._locFinder[0].getLocation(c),this._location[1]=this._locFinder[1].getLocation(c),this._location[2]=this._locFinder[2].getLocation(c),!!Yr.hasLocation(this._location,k.BOUNDARY)||this.isValidResult(u,this._location)}},Yr.prototype.addTestPts=function(n){var i=new ns(n);this._testCoords.addAll(i.getPoints(5*this._boundaryDistanceTolerance))},Yr.prototype.isValidResult=function(n,i){var s=ae.isResultOfOp(i[0],i[1],n),u=!(s^i[2]===k.INTERIOR);return u||this.reportResult(n,i,s),u},Yr.prototype.getInvalidLocation=function(){return this._invalidLocation},Yr.prototype.interfaces_=function(){return[]},Yr.prototype.getClass=function(){return Yr},Yr.hasLocation=function(n,i){for(var s=0;s<3;s++)if(n[s]===i)return!0;return!1},Yr.computeBoundaryDistanceTolerance=function(n,i){return Math.min(bn.computeSizeBasedSnapTolerance(n),bn.computeSizeBasedSnapTolerance(i))},Yr.isValid=function(n,i,s,u){return new Yr(n,i,u).isValid(s)},am.TOLERANCE.get=function(){return 1e-6},Object.defineProperties(Yr,am);var Zr=function n(i){this._geomFactory=null,this._skipEmpty=!1,this._inputGeoms=null,this._geomFactory=n.extractFactory(i),this._inputGeoms=i};Zr.prototype.extractElements=function(n,i){if(n===null)return null;for(var s=0;s<n.getNumGeometries();s++){var u=n.getGeometryN(s);this._skipEmpty&&u.isEmpty()||i.add(u)}},Zr.prototype.combine=function(){for(var n=new j,i=this._inputGeoms.iterator();i.hasNext();){var s=i.next();this.extractElements(s,n)}return n.size()===0?this._geomFactory!==null?this._geomFactory.createGeometryCollection(null):null:this._geomFactory.buildGeometry(n)},Zr.prototype.interfaces_=function(){return[]},Zr.prototype.getClass=function(){return Zr},Zr.combine=function(){if(arguments.length===1){var n=arguments[0];return new Zr(n).combine()}if(arguments.length===2){var i=arguments[0],s=arguments[1];return new Zr(Zr.createList(i,s)).combine()}if(arguments.length===3){var u=arguments[0],c=arguments[1],m=arguments[2];return new Zr(Zr.createList(u,c,m)).combine()}},Zr.extractFactory=function(n){return n.isEmpty()?null:n.iterator().next().getFactory()},Zr.createList=function(){if(arguments.length===2){var n=arguments[0],i=arguments[1],s=new j;return s.add(n),s.add(i),s}if(arguments.length===3){var u=arguments[0],c=arguments[1],m=arguments[2],E=new j;return E.add(u),E.add(c),E.add(m),E}};var Pn=function(){this._inputPolys=null,this._geomFactory=null;var n=arguments[0];this._inputPolys=n,this._inputPolys===null&&(this._inputPolys=new j)},um={STRTREE_NODE_CAPACITY:{configurable:!0}};Pn.prototype.reduceToGeometries=function(n){for(var i=new j,s=n.iterator();s.hasNext();){var u=s.next(),c=null;X(u,wt)?c=this.unionTree(u):u instanceof Q&&(c=u),i.add(c)}return i},Pn.prototype.extractByEnvelope=function(n,i,s){for(var u=new j,c=0;c<i.getNumGeometries();c++){var m=i.getGeometryN(c);m.getEnvelopeInternal().intersects(n)?u.add(m):s.add(m)}return this._geomFactory.buildGeometry(u)},Pn.prototype.unionOptimized=function(n,i){var s=n.getEnvelopeInternal(),u=i.getEnvelopeInternal();if(!s.intersects(u))return Zr.combine(n,i);if(n.getNumGeometries()<=1&&i.getNumGeometries()<=1)return this.unionActual(n,i);var c=s.intersection(u);return this.unionUsingEnvelopeIntersection(n,i,c)},Pn.prototype.union=function(){if(this._inputPolys===null)throw new Error("union() method cannot be called twice");if(this._inputPolys.isEmpty())return null;this._geomFactory=this._inputPolys.iterator().next().getFactory();for(var n=new qd(Pn.STRTREE_NODE_CAPACITY),i=this._inputPolys.iterator();i.hasNext();){var s=i.next();n.insert(s.getEnvelopeInternal(),s)}this._inputPolys=null;var u=n.itemsTree();return this.unionTree(u)},Pn.prototype.binaryUnion=function(){if(arguments.length===1){var n=arguments[0];return this.binaryUnion(n,0,n.size())}if(arguments.length===3){var i=arguments[0],s=arguments[1],u=arguments[2];if(u-s<=1){var c=Pn.getGeometry(i,s);return this.unionSafe(c,null)}if(u-s==2)return this.unionSafe(Pn.getGeometry(i,s),Pn.getGeometry(i,s+1));var m=Math.trunc((u+s)/2),E=this.binaryUnion(i,s,m),T=this.binaryUnion(i,m,u);return this.unionSafe(E,T)}},Pn.prototype.repeatedUnion=function(n){for(var i=null,s=n.iterator();s.hasNext();){var u=s.next();i=i===null?u.copy():i.union(u)}return i},Pn.prototype.unionSafe=function(n,i){return n===null&&i===null?null:n===null?i.copy():i===null?n.copy():this.unionOptimized(n,i)},Pn.prototype.unionActual=function(n,i){return Pn.restrictToPolygons(n.union(i))},Pn.prototype.unionTree=function(n){var i=this.reduceToGeometries(n);return this.binaryUnion(i)},Pn.prototype.unionUsingEnvelopeIntersection=function(n,i,s){var u=new j,c=this.extractByEnvelope(s,n,u),m=this.extractByEnvelope(s,i,u),E=this.unionActual(c,m);return u.add(E),Zr.combine(u)},Pn.prototype.bufferUnion=function(){if(arguments.length===1){var n=arguments[0];return n.get(0).getFactory().buildGeometry(n).buffer(0)}if(arguments.length===2){var i=arguments[0],s=arguments[1];return i.getFactory().createGeometryCollection([i,s]).buffer(0)}},Pn.prototype.interfaces_=function(){return[]},Pn.prototype.getClass=function(){return Pn},Pn.restrictToPolygons=function(n){if(X(n,ce))return n;var i=uo.getPolygons(n);return i.size()===1?i.get(0):n.getFactory().createMultiPolygon(le.toPolygonArray(i))},Pn.getGeometry=function(n,i){return i>=n.size()?null:n.get(i)},Pn.union=function(n){return new Pn(n).union()},um.STRTREE_NODE_CAPACITY.get=function(){return 4},Object.defineProperties(Pn,um);var bu=function(){};bu.prototype.interfaces_=function(){return[]},bu.prototype.getClass=function(){return bu},bu.union=function(n,i){if(n.isEmpty()||i.isEmpty()){if(n.isEmpty()&&i.isEmpty())return ae.createEmptyResult(ae.UNION,n,i,n.getFactory());if(n.isEmpty())return i.copy();if(i.isEmpty())return n.copy()}return n.checkNotGeometryCollection(n),n.checkNotGeometryCollection(i),hr.overlayOp(n,i,ae.UNION)},r.GeoJSONReader=gf,r.GeoJSONWriter=Hd,r.OverlayOp=ae,r.UnionOp=bu,r.BufferOp=Wn,Object.defineProperty(r,"__esModule",{value:!0})})});var Vd=Un(Am(),1);var Wh="157";var D1=0,Cm=1,F1=2;var Jg=1,U1=2,zo=3,ps=0,ui=1,Go=2;var cs=0,Fa=1,Pm=2,Im=3,Rm=4,B1=5,La=100,z1=101,k1=102,Lm=103,Nm=104,G1=200,V1=201,H1=202,W1=203,$g=204,Kg=205,q1=206,X1=207,Y1=208,Z1=209,J1=210,$1=0,K1=1,j1=2,sh=3,Q1=4,tx=5,ex=6,nx=7,jg=0,rx=1,ix=2,fs=0,ox=1,sx=2,ax=3,ux=4,lx=5,Qg=300,za=301,ka=302,ah=303,uh=304,hc=306,lh=1e3,Ji=1001,ch=1002,$r=1003,Om=1004;var If=1005;var Ni=1006,cx=1007;var Ou=1008;var hs=1009,fx=1010,hx=1011,qh=1012,t0=1013,us=1014,ls=1015,Du=1016,e0=1017,n0=1018,Vs=1020,px=1021,$i=1023,dx=1024,mx=1025,Hs=1026,Ga=1027,gx=1028,r0=1029,yx=1030,i0=1031,o0=1033,Rf=33776,Lf=33777,Nf=33778,Of=33779,Dm=35840,Fm=35841,Um=35842,Bm=35843,vx=36196,zm=37492,km=37496,Gm=37808,Vm=37809,Hm=37810,Wm=37811,qm=37812,Xm=37813,Ym=37814,Zm=37815,Jm=37816,$m=37817,Km=37818,jm=37819,Qm=37820,tg=37821,Df=36492,eg=36494,ng=36495,_x=36283,rg=36284,ig=36285,og=36286;var Yl=2300,Zl=2301,Ff=2302,sg=2400,ag=2401,ug=2402;var s0=3e3,Ws=3001,xx=3200,Ex=3201,Mx=0,Sx=1,Oi="",br="srgb",Wo="srgb-linear",Xh="display-p3",pc="display-p3-linear",Jl="linear",Tn="srgb",$l="rec709",Kl="p3";var Uf=7680;var wx=519,bx=512,Tx=513,Ax=514,Cx=515,Px=516,Ix=517,Rx=518,Lx=519,lg=35044;var cg="300 es",fh=1035,Vo=2e3,jl=2001,ds=class{addEventListener(t,e){this._listeners===void 0&&(this._listeners={});let o=this._listeners;o[t]===void 0&&(o[t]=[]),o[t].indexOf(e)===-1&&o[t].push(e)}hasEventListener(t,e){if(this._listeners===void 0)return!1;let o=this._listeners;return o[t]!==void 0&&o[t].indexOf(e)!==-1}removeEventListener(t,e){if(this._listeners===void 0)return;let a=this._listeners[t];if(a!==void 0){let l=a.indexOf(e);l!==-1&&a.splice(l,1)}}dispatchEvent(t){if(this._listeners===void 0)return;let o=this._listeners[t.type];if(o!==void 0){t.target=this;let a=o.slice(0);for(let l=0,f=a.length;l<f;l++)a[l].call(this,t);t.target=null}}},Ur=["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"];var Bf=Math.PI/180,hh=180/Math.PI;function zu(){let r=Math.random()*4294967295|0,t=Math.random()*4294967295|0,e=Math.random()*4294967295|0,o=Math.random()*4294967295|0;return(Ur[r&255]+Ur[r>>8&255]+Ur[r>>16&255]+Ur[r>>24&255]+"-"+Ur[t&255]+Ur[t>>8&255]+"-"+Ur[t>>16&15|64]+Ur[t>>24&255]+"-"+Ur[e&63|128]+Ur[e>>8&255]+"-"+Ur[e>>16&255]+Ur[e>>24&255]+Ur[o&255]+Ur[o>>8&255]+Ur[o>>16&255]+Ur[o>>24&255]).toLowerCase()}function ai(r,t,e){return Math.max(t,Math.min(e,r))}function Nx(r,t){return(r%t+t)%t}function zf(r,t,e){return(1-e)*r+e*t}function fg(r){return(r&r-1)===0&&r!==0}function ph(r){return Math.pow(2,Math.floor(Math.log(r)/Math.LN2))}function Tu(r,t){switch(t.constructor){case Float32Array:return r;case Uint32Array:return r/4294967295;case Uint16Array:return r/65535;case Uint8Array:return r/255;case Int32Array:return Math.max(r/2147483647,-1);case Int16Array:return Math.max(r/32767,-1);case Int8Array:return Math.max(r/127,-1);default:throw new Error("Invalid component type.")}}function si(r,t){switch(t.constructor){case Float32Array:return r;case Uint32Array:return Math.round(r*4294967295);case Uint16Array:return Math.round(r*65535);case Uint8Array:return Math.round(r*255);case Int32Array:return Math.round(r*2147483647);case Int16Array:return Math.round(r*32767);case Int8Array:return Math.round(r*127);default:throw new Error("Invalid component type.")}}var fn=class r{constructor(t=0,e=0){r.prototype.isVector2=!0,this.x=t,this.y=e}get width(){return this.x}set width(t){this.x=t}get height(){return this.y}set height(t){this.y=t}set(t,e){return this.x=t,this.y=e,this}setScalar(t){return this.x=t,this.y=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y)}copy(t){return this.x=t.x,this.y=t.y,this}add(t){return this.x+=t.x,this.y+=t.y,this}addScalar(t){return this.x+=t,this.y+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this}subScalar(t){return this.x-=t,this.y-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this}multiply(t){return this.x*=t.x,this.y*=t.y,this}multiplyScalar(t){return this.x*=t,this.y*=t,this}divide(t){return this.x/=t.x,this.y/=t.y,this}divideScalar(t){return this.multiplyScalar(1/t)}applyMatrix3(t){let e=this.x,o=this.y,a=t.elements;return this.x=a[0]*e+a[3]*o+a[6],this.y=a[1]*e+a[4]*o+a[7],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this}clampLength(t,e){let o=this.length();return this.divideScalar(o||1).multiplyScalar(Math.max(t,Math.min(e,o)))}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(t){return this.x*t.x+this.y*t.y}cross(t){return this.x*t.y-this.y*t.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(t){let e=Math.sqrt(this.lengthSq()*t.lengthSq());if(e===0)return Math.PI/2;let o=this.dot(t)/e;return Math.acos(ai(o,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){let e=this.x-t.x,o=this.y-t.y;return e*e+o*o}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this}lerpVectors(t,e,o){return this.x=t.x+(e.x-t.x)*o,this.y=t.y+(e.y-t.y)*o,this}equals(t){return t.x===this.x&&t.y===this.y}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this}rotateAround(t,e){let o=Math.cos(e),a=Math.sin(e),l=this.x-t.x,f=this.y-t.y;return this.x=l*o-f*a+t.x,this.y=l*a+f*o+t.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}},ve=class r{constructor(t,e,o,a,l,f,h,p,d){r.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],t!==void 0&&this.set(t,e,o,a,l,f,h,p,d)}set(t,e,o,a,l,f,h,p,d){let g=this.elements;return g[0]=t,g[1]=a,g[2]=h,g[3]=e,g[4]=l,g[5]=p,g[6]=o,g[7]=f,g[8]=d,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(t){let e=this.elements,o=t.elements;return e[0]=o[0],e[1]=o[1],e[2]=o[2],e[3]=o[3],e[4]=o[4],e[5]=o[5],e[6]=o[6],e[7]=o[7],e[8]=o[8],this}extractBasis(t,e,o){return t.setFromMatrix3Column(this,0),e.setFromMatrix3Column(this,1),o.setFromMatrix3Column(this,2),this}setFromMatrix4(t){let e=t.elements;return this.set(e[0],e[4],e[8],e[1],e[5],e[9],e[2],e[6],e[10]),this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){let o=t.elements,a=e.elements,l=this.elements,f=o[0],h=o[3],p=o[6],d=o[1],g=o[4],_=o[7],y=o[2],M=o[5],w=o[8],A=a[0],x=a[3],v=a[6],C=a[1],S=a[4],O=a[7],F=a[2],G=a[5],z=a[8];return l[0]=f*A+h*C+p*F,l[3]=f*x+h*S+p*G,l[6]=f*v+h*O+p*z,l[1]=d*A+g*C+_*F,l[4]=d*x+g*S+_*G,l[7]=d*v+g*O+_*z,l[2]=y*A+M*C+w*F,l[5]=y*x+M*S+w*G,l[8]=y*v+M*O+w*z,this}multiplyScalar(t){let e=this.elements;return e[0]*=t,e[3]*=t,e[6]*=t,e[1]*=t,e[4]*=t,e[7]*=t,e[2]*=t,e[5]*=t,e[8]*=t,this}determinant(){let t=this.elements,e=t[0],o=t[1],a=t[2],l=t[3],f=t[4],h=t[5],p=t[6],d=t[7],g=t[8];return e*f*g-e*h*d-o*l*g+o*h*p+a*l*d-a*f*p}invert(){let t=this.elements,e=t[0],o=t[1],a=t[2],l=t[3],f=t[4],h=t[5],p=t[6],d=t[7],g=t[8],_=g*f-h*d,y=h*p-g*l,M=d*l-f*p,w=e*_+o*y+a*M;if(w===0)return this.set(0,0,0,0,0,0,0,0,0);let A=1/w;return t[0]=_*A,t[1]=(a*d-g*o)*A,t[2]=(h*o-a*f)*A,t[3]=y*A,t[4]=(g*e-a*p)*A,t[5]=(a*l-h*e)*A,t[6]=M*A,t[7]=(o*p-d*e)*A,t[8]=(f*e-o*l)*A,this}transpose(){let t,e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this}getNormalMatrix(t){return this.setFromMatrix4(t).invert().transpose()}transposeIntoArray(t){let e=this.elements;return t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8],this}setUvTransform(t,e,o,a,l,f,h){let p=Math.cos(l),d=Math.sin(l);return this.set(o*p,o*d,-o*(p*f+d*h)+f+t,-a*d,a*p,-a*(-d*f+p*h)+h+e,0,0,1),this}scale(t,e){return this.premultiply(kf.makeScale(t,e)),this}rotate(t){return this.premultiply(kf.makeRotation(-t)),this}translate(t,e){return this.premultiply(kf.makeTranslation(t,e)),this}makeTranslation(t,e){return t.isVector2?this.set(1,0,t.x,0,1,t.y,0,0,1):this.set(1,0,t,0,1,e,0,0,1),this}makeRotation(t){let e=Math.cos(t),o=Math.sin(t);return this.set(e,-o,0,o,e,0,0,0,1),this}makeScale(t,e){return this.set(t,0,0,0,e,0,0,0,1),this}equals(t){let e=this.elements,o=t.elements;for(let a=0;a<9;a++)if(e[a]!==o[a])return!1;return!0}fromArray(t,e=0){for(let o=0;o<9;o++)this.elements[o]=t[o+e];return this}toArray(t=[],e=0){let o=this.elements;return t[e]=o[0],t[e+1]=o[1],t[e+2]=o[2],t[e+3]=o[3],t[e+4]=o[4],t[e+5]=o[5],t[e+6]=o[6],t[e+7]=o[7],t[e+8]=o[8],t}clone(){return new this.constructor().fromArray(this.elements)}},kf=new ve;function a0(r){for(let t=r.length-1;t>=0;--t)if(r[t]>=65535)return!0;return!1}function Ql(r){return document.createElementNS("http://www.w3.org/1999/xhtml",r)}function Ox(){let r=Ql("canvas");return r.style.display="block",r}var hg={};function Lu(r){r in hg||(hg[r]=!0,console.warn(r))}var pg=new ve().set(.8224621,.177538,0,.0331941,.9668058,0,.0170827,.0723974,.9105199),dg=new ve().set(1.2249401,-.2249404,0,-.0420569,1.0420571,0,-.0196376,-.0786361,1.0982735),bl={[Wo]:{transfer:Jl,primaries:$l,toReference:r=>r,fromReference:r=>r},[br]:{transfer:Tn,primaries:$l,toReference:r=>r.convertSRGBToLinear(),fromReference:r=>r.convertLinearToSRGB()},[pc]:{transfer:Jl,primaries:Kl,toReference:r=>r.applyMatrix3(dg),fromReference:r=>r.applyMatrix3(pg)},[Xh]:{transfer:Tn,primaries:Kl,toReference:r=>r.convertSRGBToLinear().applyMatrix3(dg),fromReference:r=>r.applyMatrix3(pg).convertLinearToSRGB()}},Dx=new Set([Wo,pc]),gn={enabled:!0,_workingColorSpace:Wo,get legacyMode(){return console.warn("THREE.ColorManagement: .legacyMode=false renamed to .enabled=true in r150."),!this.enabled},set legacyMode(r){console.warn("THREE.ColorManagement: .legacyMode=false renamed to .enabled=true in r150."),this.enabled=!r},get workingColorSpace(){return this._workingColorSpace},set workingColorSpace(r){if(!Dx.has(r))throw new Error(`Unsupported working color space, "${r}".`);this._workingColorSpace=r},convert:function(r,t,e){if(this.enabled===!1||t===e||!t||!e)return r;let o=bl[t].toReference,a=bl[e].fromReference;return a(o(r))},fromWorkingColorSpace:function(r,t){return this.convert(r,this._workingColorSpace,t)},toWorkingColorSpace:function(r,t){return this.convert(r,t,this._workingColorSpace)},getPrimaries:function(r){return bl[r].primaries},getTransfer:function(r){return r===Oi?Jl:bl[r].transfer}};function Ua(r){return r<.04045?r*.0773993808:Math.pow(r*.9478672986+.0521327014,2.4)}function Gf(r){return r<.0031308?r*12.92:1.055*Math.pow(r,.41666)-.055}var ga,tc=class{static getDataURL(t){if(/^data:/i.test(t.src)||typeof HTMLCanvasElement=="undefined")return t.src;let e;if(t instanceof HTMLCanvasElement)e=t;else{ga===void 0&&(ga=Ql("canvas")),ga.width=t.width,ga.height=t.height;let o=ga.getContext("2d");t instanceof ImageData?o.putImageData(t,0,0):o.drawImage(t,0,0,t.width,t.height),e=ga}return e.width>2048||e.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",t),e.toDataURL("image/jpeg",.6)):e.toDataURL("image/png")}static sRGBToLinear(t){if(typeof HTMLImageElement!="undefined"&&t instanceof HTMLImageElement||typeof HTMLCanvasElement!="undefined"&&t instanceof HTMLCanvasElement||typeof ImageBitmap!="undefined"&&t instanceof ImageBitmap){let e=Ql("canvas");e.width=t.width,e.height=t.height;let o=e.getContext("2d");o.drawImage(t,0,0,t.width,t.height);let a=o.getImageData(0,0,t.width,t.height),l=a.data;for(let f=0;f<l.length;f++)l[f]=Ua(l[f]/255)*255;return o.putImageData(a,0,0),e}else if(t.data){let e=t.data.slice(0);for(let o=0;o<e.length;o++)e instanceof Uint8Array||e instanceof Uint8ClampedArray?e[o]=Math.floor(Ua(e[o]/255)*255):e[o]=Ua(e[o]);return{data:e,width:t.width,height:t.height}}else return console.warn("THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),t}},Fx=0,ec=class{constructor(t=null){this.isSource=!0,Object.defineProperty(this,"id",{value:Fx++}),this.uuid=zu(),this.data=t,this.version=0}set needsUpdate(t){t===!0&&this.version++}toJSON(t){let e=t===void 0||typeof t=="string";if(!e&&t.images[this.uuid]!==void 0)return t.images[this.uuid];let o={uuid:this.uuid,url:""},a=this.data;if(a!==null){let l;if(Array.isArray(a)){l=[];for(let f=0,h=a.length;f<h;f++)a[f].isDataTexture?l.push(Vf(a[f].image)):l.push(Vf(a[f]))}else l=Vf(a);o.url=l}return e||(t.images[this.uuid]=o),o}};function Vf(r){return typeof HTMLImageElement!="undefined"&&r instanceof HTMLImageElement||typeof HTMLCanvasElement!="undefined"&&r instanceof HTMLCanvasElement||typeof ImageBitmap!="undefined"&&r instanceof ImageBitmap?tc.getDataURL(r):r.data?{data:Array.from(r.data),width:r.width,height:r.height,type:r.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}var Ux=0,Ki=class r extends ds{constructor(t=r.DEFAULT_IMAGE,e=r.DEFAULT_MAPPING,o=Ji,a=Ji,l=Ni,f=Ou,h=$i,p=hs,d=r.DEFAULT_ANISOTROPY,g=Oi){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:Ux++}),this.uuid=zu(),this.name="",this.source=new ec(t),this.mipmaps=[],this.mapping=e,this.channel=0,this.wrapS=o,this.wrapT=a,this.magFilter=l,this.minFilter=f,this.anisotropy=d,this.format=h,this.internalFormat=null,this.type=p,this.offset=new fn(0,0),this.repeat=new fn(1,1),this.center=new fn(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new ve,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,typeof g=="string"?this.colorSpace=g:(Lu("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace=g===Ws?br:Oi),this.userData={},this.version=0,this.onUpdate=null,this.isRenderTargetTexture=!1,this.needsPMREMUpdate=!1}get image(){return this.source.data}set image(t=null){this.source.data=t}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}clone(){return new this.constructor().copy(this)}copy(t){return this.name=t.name,this.source=t.source,this.mipmaps=t.mipmaps.slice(0),this.mapping=t.mapping,this.channel=t.channel,this.wrapS=t.wrapS,this.wrapT=t.wrapT,this.magFilter=t.magFilter,this.minFilter=t.minFilter,this.anisotropy=t.anisotropy,this.format=t.format,this.internalFormat=t.internalFormat,this.type=t.type,this.offset.copy(t.offset),this.repeat.copy(t.repeat),this.center.copy(t.center),this.rotation=t.rotation,this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrix.copy(t.matrix),this.generateMipmaps=t.generateMipmaps,this.premultiplyAlpha=t.premultiplyAlpha,this.flipY=t.flipY,this.unpackAlignment=t.unpackAlignment,this.colorSpace=t.colorSpace,this.userData=JSON.parse(JSON.stringify(t.userData)),this.needsUpdate=!0,this}toJSON(t){let e=t===void 0||typeof t=="string";if(!e&&t.textures[this.uuid]!==void 0)return t.textures[this.uuid];let o={metadata:{version:4.6,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(t).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&&(o.userData=this.userData),e||(t.textures[this.uuid]=o),o}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(t){if(this.mapping!==Qg)return t;if(t.applyMatrix3(this.matrix),t.x<0||t.x>1)switch(this.wrapS){case lh:t.x=t.x-Math.floor(t.x);break;case Ji:t.x=t.x<0?0:1;break;case ch:Math.abs(Math.floor(t.x)%2)===1?t.x=Math.ceil(t.x)-t.x:t.x=t.x-Math.floor(t.x);break}if(t.y<0||t.y>1)switch(this.wrapT){case lh:t.y=t.y-Math.floor(t.y);break;case Ji:t.y=t.y<0?0:1;break;case ch:Math.abs(Math.floor(t.y)%2)===1?t.y=Math.ceil(t.y)-t.y:t.y=t.y-Math.floor(t.y);break}return this.flipY&&(t.y=1-t.y),t}set needsUpdate(t){t===!0&&(this.version++,this.source.needsUpdate=!0)}get encoding(){return Lu("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace===br?Ws:s0}set encoding(t){Lu("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace=t===Ws?br:Oi}};Ki.DEFAULT_IMAGE=null;Ki.DEFAULT_MAPPING=Qg;Ki.DEFAULT_ANISOTROPY=1;var Tr=class r{constructor(t=0,e=0,o=0,a=1){r.prototype.isVector4=!0,this.x=t,this.y=e,this.z=o,this.w=a}get width(){return this.z}set width(t){this.z=t}get height(){return this.w}set height(t){this.w=t}set(t,e,o,a){return this.x=t,this.y=e,this.z=o,this.w=a,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this.w=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setW(t){return this.w=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;case 3:this.w=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){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: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=t.w!==void 0?t.w:1,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this.w+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.w=t.w+e.w,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this.w+=t.w*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this.w-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this.w=t.w-e.w,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this.w*=t.w,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this}applyMatrix4(t){let e=this.x,o=this.y,a=this.z,l=this.w,f=t.elements;return this.x=f[0]*e+f[4]*o+f[8]*a+f[12]*l,this.y=f[1]*e+f[5]*o+f[9]*a+f[13]*l,this.z=f[2]*e+f[6]*o+f[10]*a+f[14]*l,this.w=f[3]*e+f[7]*o+f[11]*a+f[15]*l,this}divideScalar(t){return this.multiplyScalar(1/t)}setAxisAngleFromQuaternion(t){this.w=2*Math.acos(t.w);let e=Math.sqrt(1-t.w*t.w);return e<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=t.x/e,this.y=t.y/e,this.z=t.z/e),this}setAxisAngleFromRotationMatrix(t){let e,o,a,l,p=t.elements,d=p[0],g=p[4],_=p[8],y=p[1],M=p[5],w=p[9],A=p[2],x=p[6],v=p[10];if(Math.abs(g-y)<.01&&Math.abs(_-A)<.01&&Math.abs(w-x)<.01){if(Math.abs(g+y)<.1&&Math.abs(_+A)<.1&&Math.abs(w+x)<.1&&Math.abs(d+M+v-3)<.1)return this.set(1,0,0,0),this;e=Math.PI;let S=(d+1)/2,O=(M+1)/2,F=(v+1)/2,G=(g+y)/4,z=(_+A)/4,L=(w+x)/4;return S>O&&S>F?S<.01?(o=0,a=.707106781,l=.707106781):(o=Math.sqrt(S),a=G/o,l=z/o):O>F?O<.01?(o=.707106781,a=0,l=.707106781):(a=Math.sqrt(O),o=G/a,l=L/a):F<.01?(o=.707106781,a=.707106781,l=0):(l=Math.sqrt(F),o=z/l,a=L/l),this.set(o,a,l,e),this}let C=Math.sqrt((x-w)*(x-w)+(_-A)*(_-A)+(y-g)*(y-g));return Math.abs(C)<.001&&(C=1),this.x=(x-w)/C,this.y=(_-A)/C,this.z=(y-g)/C,this.w=Math.acos((d+M+v-1)/2),this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this.w=Math.min(this.w,t.w),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this.w=Math.max(this.w,t.w),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this.w=Math.max(t.w,Math.min(e.w,this.w)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this.z=Math.max(t,Math.min(e,this.z)),this.w=Math.max(t,Math.min(e,this.w)),this}clampLength(t,e){let o=this.length();return this.divideScalar(o||1).multiplyScalar(Math.max(t,Math.min(e,o)))}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(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.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(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this.w+=(t.w-this.w)*e,this}lerpVectors(t,e,o){return this.x=t.x+(e.x-t.x)*o,this.y=t.y+(e.y-t.y)*o,this.z=t.z+(e.z-t.z)*o,this.w=t.w+(e.w-t.w)*o,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this.w=t[e+3],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t[e+3]=this.w,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this.w=t.getW(e),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}},dh=class extends ds{constructor(t=1,e=1,o={}){super(),this.isRenderTarget=!0,this.width=t,this.height=e,this.depth=1,this.scissor=new Tr(0,0,t,e),this.scissorTest=!1,this.viewport=new Tr(0,0,t,e);let a={width:t,height:e,depth:1};o.encoding!==void 0&&(Lu("THREE.WebGLRenderTarget: option.encoding has been replaced by option.colorSpace."),o.colorSpace=o.encoding===Ws?br:Oi),o=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:Ni,depthBuffer:!0,stencilBuffer:!1,depthTexture:null,samples:0},o),this.texture=new Ki(a,o.mapping,o.wrapS,o.wrapT,o.magFilter,o.minFilter,o.format,o.type,o.anisotropy,o.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.flipY=!1,this.texture.generateMipmaps=o.generateMipmaps,this.texture.internalFormat=o.internalFormat,this.depthBuffer=o.depthBuffer,this.stencilBuffer=o.stencilBuffer,this.depthTexture=o.depthTexture,this.samples=o.samples}setSize(t,e,o=1){(this.width!==t||this.height!==e||this.depth!==o)&&(this.width=t,this.height=e,this.depth=o,this.texture.image.width=t,this.texture.image.height=e,this.texture.image.depth=o,this.dispose()),this.viewport.set(0,0,t,e),this.scissor.set(0,0,t,e)}clone(){return new this.constructor().copy(this)}copy(t){this.width=t.width,this.height=t.height,this.depth=t.depth,this.scissor.copy(t.scissor),this.scissorTest=t.scissorTest,this.viewport.copy(t.viewport),this.texture=t.texture.clone(),this.texture.isRenderTargetTexture=!0;let e=Object.assign({},t.texture.image);return this.texture.source=new ec(e),this.depthBuffer=t.depthBuffer,this.stencilBuffer=t.stencilBuffer,t.depthTexture!==null&&(this.depthTexture=t.depthTexture.clone()),this.samples=t.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}},qo=class extends dh{constructor(t=1,e=1,o={}){super(t,e,o),this.isWebGLRenderTarget=!0}},nc=class extends Ki{constructor(t=null,e=1,o=1,a=1){super(null),this.isDataArrayTexture=!0,this.image={data:t,width:e,height:o,depth:a},this.magFilter=$r,this.minFilter=$r,this.wrapR=Ji,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}};var mh=class extends Ki{constructor(t=null,e=1,o=1,a=1){super(null),this.isData3DTexture=!0,this.image={data:t,width:e,height:o,depth:a},this.magFilter=$r,this.minFilter=$r,this.wrapR=Ji,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}};var ms=class{constructor(t=0,e=0,o=0,a=1){this.isQuaternion=!0,this._x=t,this._y=e,this._z=o,this._w=a}static slerpFlat(t,e,o,a,l,f,h){let p=o[a+0],d=o[a+1],g=o[a+2],_=o[a+3],y=l[f+0],M=l[f+1],w=l[f+2],A=l[f+3];if(h===0){t[e+0]=p,t[e+1]=d,t[e+2]=g,t[e+3]=_;return}if(h===1){t[e+0]=y,t[e+1]=M,t[e+2]=w,t[e+3]=A;return}if(_!==A||p!==y||d!==M||g!==w){let x=1-h,v=p*y+d*M+g*w+_*A,C=v>=0?1:-1,S=1-v*v;if(S>Number.EPSILON){let F=Math.sqrt(S),G=Math.atan2(F,v*C);x=Math.sin(x*G)/F,h=Math.sin(h*G)/F}let O=h*C;if(p=p*x+y*O,d=d*x+M*O,g=g*x+w*O,_=_*x+A*O,x===1-h){let F=1/Math.sqrt(p*p+d*d+g*g+_*_);p*=F,d*=F,g*=F,_*=F}}t[e]=p,t[e+1]=d,t[e+2]=g,t[e+3]=_}static multiplyQuaternionsFlat(t,e,o,a,l,f){let h=o[a],p=o[a+1],d=o[a+2],g=o[a+3],_=l[f],y=l[f+1],M=l[f+2],w=l[f+3];return t[e]=h*w+g*_+p*M-d*y,t[e+1]=p*w+g*y+d*_-h*M,t[e+2]=d*w+g*M+h*y-p*_,t[e+3]=g*w-h*_-p*y-d*M,t}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get w(){return this._w}set w(t){this._w=t,this._onChangeCallback()}set(t,e,o,a){return this._x=t,this._y=e,this._z=o,this._w=a,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this._onChangeCallback(),this}setFromEuler(t,e){let o=t._x,a=t._y,l=t._z,f=t._order,h=Math.cos,p=Math.sin,d=h(o/2),g=h(a/2),_=h(l/2),y=p(o/2),M=p(a/2),w=p(l/2);switch(f){case"XYZ":this._x=y*g*_+d*M*w,this._y=d*M*_-y*g*w,this._z=d*g*w+y*M*_,this._w=d*g*_-y*M*w;break;case"YXZ":this._x=y*g*_+d*M*w,this._y=d*M*_-y*g*w,this._z=d*g*w-y*M*_,this._w=d*g*_+y*M*w;break;case"ZXY":this._x=y*g*_-d*M*w,this._y=d*M*_+y*g*w,this._z=d*g*w+y*M*_,this._w=d*g*_-y*M*w;break;case"ZYX":this._x=y*g*_-d*M*w,this._y=d*M*_+y*g*w,this._z=d*g*w-y*M*_,this._w=d*g*_+y*M*w;break;case"YZX":this._x=y*g*_+d*M*w,this._y=d*M*_+y*g*w,this._z=d*g*w-y*M*_,this._w=d*g*_-y*M*w;break;case"XZY":this._x=y*g*_-d*M*w,this._y=d*M*_-y*g*w,this._z=d*g*w+y*M*_,this._w=d*g*_+y*M*w;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+f)}return e!==!1&&this._onChangeCallback(),this}setFromAxisAngle(t,e){let o=e/2,a=Math.sin(o);return this._x=t.x*a,this._y=t.y*a,this._z=t.z*a,this._w=Math.cos(o),this._onChangeCallback(),this}setFromRotationMatrix(t){let e=t.elements,o=e[0],a=e[4],l=e[8],f=e[1],h=e[5],p=e[9],d=e[2],g=e[6],_=e[10],y=o+h+_;if(y>0){let M=.5/Math.sqrt(y+1);this._w=.25/M,this._x=(g-p)*M,this._y=(l-d)*M,this._z=(f-a)*M}else if(o>h&&o>_){let M=2*Math.sqrt(1+o-h-_);this._w=(g-p)/M,this._x=.25*M,this._y=(a+f)/M,this._z=(l+d)/M}else if(h>_){let M=2*Math.sqrt(1+h-o-_);this._w=(l-d)/M,this._x=(a+f)/M,this._y=.25*M,this._z=(p+g)/M}else{let M=2*Math.sqrt(1+_-o-h);this._w=(f-a)/M,this._x=(l+d)/M,this._y=(p+g)/M,this._z=.25*M}return this._onChangeCallback(),this}setFromUnitVectors(t,e){let o=t.dot(e)+1;return o<Number.EPSILON?(o=0,Math.abs(t.x)>Math.abs(t.z)?(this._x=-t.y,this._y=t.x,this._z=0,this._w=o):(this._x=0,this._y=-t.z,this._z=t.y,this._w=o)):(this._x=t.y*e.z-t.z*e.y,this._y=t.z*e.x-t.x*e.z,this._z=t.x*e.y-t.y*e.x,this._w=o),this.normalize()}angleTo(t){return 2*Math.acos(Math.abs(ai(this.dot(t),-1,1)))}rotateTowards(t,e){let o=this.angleTo(t);if(o===0)return this;let a=Math.min(1,e/o);return this.slerp(t,a),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(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._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 t=this.length();return t===0?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this._onChangeCallback(),this}multiply(t){return this.multiplyQuaternions(this,t)}premultiply(t){return this.multiplyQuaternions(t,this)}multiplyQuaternions(t,e){let o=t._x,a=t._y,l=t._z,f=t._w,h=e._x,p=e._y,d=e._z,g=e._w;return this._x=o*g+f*h+a*d-l*p,this._y=a*g+f*p+l*h-o*d,this._z=l*g+f*d+o*p-a*h,this._w=f*g-o*h-a*p-l*d,this._onChangeCallback(),this}slerp(t,e){if(e===0)return this;if(e===1)return this.copy(t);let o=this._x,a=this._y,l=this._z,f=this._w,h=f*t._w+o*t._x+a*t._y+l*t._z;if(h<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,h=-h):this.copy(t),h>=1)return this._w=f,this._x=o,this._y=a,this._z=l,this;let p=1-h*h;if(p<=Number.EPSILON){let M=1-e;return this._w=M*f+e*this._w,this._x=M*o+e*this._x,this._y=M*a+e*this._y,this._z=M*l+e*this._z,this.normalize(),this._onChangeCallback(),this}let d=Math.sqrt(p),g=Math.atan2(d,h),_=Math.sin((1-e)*g)/d,y=Math.sin(e*g)/d;return this._w=f*_+this._w*y,this._x=o*_+this._x*y,this._y=a*_+this._y*y,this._z=l*_+this._z*y,this._onChangeCallback(),this}slerpQuaternions(t,e,o){return this.copy(t).slerp(e,o)}random(){let t=Math.random(),e=Math.sqrt(1-t),o=Math.sqrt(t),a=2*Math.PI*Math.random(),l=2*Math.PI*Math.random();return this.set(e*Math.cos(a),o*Math.sin(l),o*Math.cos(l),e*Math.sin(a))}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w}fromArray(t,e=0){return this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t}fromBufferAttribute(t,e){return this._x=t.getX(e),this._y=t.getY(e),this._z=t.getZ(e),this._w=t.getW(e),this}toJSON(){return this.toArray()}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}},mt=class r{constructor(t=0,e=0,o=0){r.prototype.isVector3=!0,this.x=t,this.y=e,this.z=o}set(t,e,o){return o===void 0&&(o=this.z),this.x=t,this.y=e,this.z=o,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this}multiplyVectors(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this}applyEuler(t){return this.applyQuaternion(mg.setFromEuler(t))}applyAxisAngle(t,e){return this.applyQuaternion(mg.setFromAxisAngle(t,e))}applyMatrix3(t){let e=this.x,o=this.y,a=this.z,l=t.elements;return this.x=l[0]*e+l[3]*o+l[6]*a,this.y=l[1]*e+l[4]*o+l[7]*a,this.z=l[2]*e+l[5]*o+l[8]*a,this}applyNormalMatrix(t){return this.applyMatrix3(t).normalize()}applyMatrix4(t){let e=this.x,o=this.y,a=this.z,l=t.elements,f=1/(l[3]*e+l[7]*o+l[11]*a+l[15]);return this.x=(l[0]*e+l[4]*o+l[8]*a+l[12])*f,this.y=(l[1]*e+l[5]*o+l[9]*a+l[13])*f,this.z=(l[2]*e+l[6]*o+l[10]*a+l[14])*f,this}applyQuaternion(t){let e=this.x,o=this.y,a=this.z,l=t.x,f=t.y,h=t.z,p=t.w,d=p*e+f*a-h*o,g=p*o+h*e-l*a,_=p*a+l*o-f*e,y=-l*e-f*o-h*a;return this.x=d*p+y*-l+g*-h-_*-f,this.y=g*p+y*-f+_*-l-d*-h,this.z=_*p+y*-h+d*-f-g*-l,this}project(t){return this.applyMatrix4(t.matrixWorldInverse).applyMatrix4(t.projectionMatrix)}unproject(t){return this.applyMatrix4(t.projectionMatrixInverse).applyMatrix4(t.matrixWorld)}transformDirection(t){let e=this.x,o=this.y,a=this.z,l=t.elements;return this.x=l[0]*e+l[4]*o+l[8]*a,this.y=l[1]*e+l[5]*o+l[9]*a,this.z=l[2]*e+l[6]*o+l[10]*a,this.normalize()}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this}divideScalar(t){return this.multiplyScalar(1/t)}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this.z=Math.max(t,Math.min(e,this.z)),this}clampLength(t,e){let o=this.length();return this.divideScalar(o||1).multiplyScalar(Math.max(t,Math.min(e,o)))}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(t){return this.x*t.x+this.y*t.y+this.z*t.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(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this}lerpVectors(t,e,o){return this.x=t.x+(e.x-t.x)*o,this.y=t.y+(e.y-t.y)*o,this.z=t.z+(e.z-t.z)*o,this}cross(t){return this.crossVectors(this,t)}crossVectors(t,e){let o=t.x,a=t.y,l=t.z,f=e.x,h=e.y,p=e.z;return this.x=a*p-l*h,this.y=l*f-o*p,this.z=o*h-a*f,this}projectOnVector(t){let e=t.lengthSq();if(e===0)return this.set(0,0,0);let o=t.dot(this)/e;return this.copy(t).multiplyScalar(o)}projectOnPlane(t){return Hf.copy(this).projectOnVector(t),this.sub(Hf)}reflect(t){return this.sub(Hf.copy(t).multiplyScalar(2*this.dot(t)))}angleTo(t){let e=Math.sqrt(this.lengthSq()*t.lengthSq());if(e===0)return Math.PI/2;let o=this.dot(t)/e;return Math.acos(ai(o,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){let e=this.x-t.x,o=this.y-t.y,a=this.z-t.z;return e*e+o*o+a*a}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)}setFromSpherical(t){return this.setFromSphericalCoords(t.radius,t.phi,t.theta)}setFromSphericalCoords(t,e,o){let a=Math.sin(e)*t;return this.x=a*Math.sin(o),this.y=Math.cos(e)*t,this.z=a*Math.cos(o),this}setFromCylindrical(t){return this.setFromCylindricalCoords(t.radius,t.theta,t.y)}setFromCylindricalCoords(t,e,o){return this.x=t*Math.sin(e),this.y=o,this.z=t*Math.cos(e),this}setFromMatrixPosition(t){let e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this}setFromMatrixScale(t){let e=this.setFromMatrixColumn(t,0).length(),o=this.setFromMatrixColumn(t,1).length(),a=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=o,this.z=a,this}setFromMatrixColumn(t,e){return this.fromArray(t.elements,e*4)}setFromMatrix3Column(t,e){return this.fromArray(t.elements,e*3)}setFromEuler(t){return this.x=t._x,this.y=t._y,this.z=t._z,this}setFromColor(t){return this.x=t.r,this.y=t.g,this.z=t.b,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){let t=(Math.random()-.5)*2,e=Math.random()*Math.PI*2,o=Math.sqrt(1-t**2);return this.x=o*Math.cos(e),this.y=o*Math.sin(e),this.z=t,this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}},Hf=new mt,mg=new ms,qs=class{constructor(t=new mt(1/0,1/0,1/0),e=new mt(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=t,this.max=e}set(t,e){return this.min.copy(t),this.max.copy(e),this}setFromArray(t){this.makeEmpty();for(let e=0,o=t.length;e<o;e+=3)this.expandByPoint(Oo.fromArray(t,e));return this}setFromBufferAttribute(t){this.makeEmpty();for(let e=0,o=t.count;e<o;e++)this.expandByPoint(Oo.fromBufferAttribute(t,e));return this}setFromPoints(t){this.makeEmpty();for(let e=0,o=t.length;e<o;e++)this.expandByPoint(t[e]);return this}setFromCenterAndSize(t,e){let o=Oo.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(o),this.max.copy(t).add(o),this}setFromObject(t,e=!1){return this.makeEmpty(),this.expandByObject(t,e)}clone(){return new this.constructor().copy(this)}copy(t){return this.min.copy(t.min),this.max.copy(t.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(t){return this.isEmpty()?t.set(0,0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(t){return this.isEmpty()?t.set(0,0,0):t.subVectors(this.max,this.min)}expandByPoint(t){return this.min.min(t),this.max.max(t),this}expandByVector(t){return this.min.sub(t),this.max.add(t),this}expandByScalar(t){return this.min.addScalar(-t),this.max.addScalar(t),this}expandByObject(t,e=!1){if(t.updateWorldMatrix(!1,!1),t.boundingBox!==void 0)t.boundingBox===null&&t.computeBoundingBox(),ya.copy(t.boundingBox),ya.applyMatrix4(t.matrixWorld),this.union(ya);else{let a=t.geometry;if(a!==void 0)if(e&&a.attributes!==void 0&&a.attributes.position!==void 0){let l=a.attributes.position;for(let f=0,h=l.count;f<h;f++)Oo.fromBufferAttribute(l,f).applyMatrix4(t.matrixWorld),this.expandByPoint(Oo)}else a.boundingBox===null&&a.computeBoundingBox(),ya.copy(a.boundingBox),ya.applyMatrix4(t.matrixWorld),this.union(ya)}let o=t.children;for(let a=0,l=o.length;a<l;a++)this.expandByObject(o[a],e);return this}containsPoint(t){return!(t.x<this.min.x||t.x>this.max.x||t.y<this.min.y||t.y>this.max.y||t.z<this.min.z||t.z>this.max.z)}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y&&this.min.z<=t.min.z&&t.max.z<=this.max.z}getParameter(t,e){return e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(t){return!(t.max.x<this.min.x||t.min.x>this.max.x||t.max.y<this.min.y||t.min.y>this.max.y||t.max.z<this.min.z||t.min.z>this.max.z)}intersectsSphere(t){return this.clampPoint(t.center,Oo),Oo.distanceToSquared(t.center)<=t.radius*t.radius}intersectsPlane(t){let e,o;return t.normal.x>0?(e=t.normal.x*this.min.x,o=t.normal.x*this.max.x):(e=t.normal.x*this.max.x,o=t.normal.x*this.min.x),t.normal.y>0?(e+=t.normal.y*this.min.y,o+=t.normal.y*this.max.y):(e+=t.normal.y*this.max.y,o+=t.normal.y*this.min.y),t.normal.z>0?(e+=t.normal.z*this.min.z,o+=t.normal.z*this.max.z):(e+=t.normal.z*this.max.z,o+=t.normal.z*this.min.z),e<=-t.constant&&o>=-t.constant}intersectsTriangle(t){if(this.isEmpty())return!1;this.getCenter(Au),Tl.subVectors(this.max,Au),va.subVectors(t.a,Au),_a.subVectors(t.b,Au),xa.subVectors(t.c,Au),rs.subVectors(_a,va),is.subVectors(xa,_a),Fs.subVectors(va,xa);let e=[0,-rs.z,rs.y,0,-is.z,is.y,0,-Fs.z,Fs.y,rs.z,0,-rs.x,is.z,0,-is.x,Fs.z,0,-Fs.x,-rs.y,rs.x,0,-is.y,is.x,0,-Fs.y,Fs.x,0];return!Wf(e,va,_a,xa,Tl)||(e=[1,0,0,0,1,0,0,0,1],!Wf(e,va,_a,xa,Tl))?!1:(Al.crossVectors(rs,is),e=[Al.x,Al.y,Al.z],Wf(e,va,_a,xa,Tl))}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return this.clampPoint(t,Oo).distanceTo(t)}getBoundingSphere(t){return this.isEmpty()?t.makeEmpty():(this.getCenter(t.center),t.radius=this.getSize(Oo).length()*.5),t}intersect(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}applyMatrix4(t){return this.isEmpty()?this:(No[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),No[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),No[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),No[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),No[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),No[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),No[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),No[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(No),this)}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}},No=[new mt,new mt,new mt,new mt,new mt,new mt,new mt,new mt],Oo=new mt,ya=new qs,va=new mt,_a=new mt,xa=new mt,rs=new mt,is=new mt,Fs=new mt,Au=new mt,Tl=new mt,Al=new mt,Us=new mt;function Wf(r,t,e,o,a){for(let l=0,f=r.length-3;l<=f;l+=3){Us.fromArray(r,l);let h=a.x*Math.abs(Us.x)+a.y*Math.abs(Us.y)+a.z*Math.abs(Us.z),p=t.dot(Us),d=e.dot(Us),g=o.dot(Us);if(Math.max(-Math.max(p,d,g),Math.min(p,d,g))>h)return!1}return!0}var Bx=new qs,Cu=new mt,qf=new mt,Fu=class{constructor(t=new mt,e=-1){this.center=t,this.radius=e}set(t,e){return this.center.copy(t),this.radius=e,this}setFromPoints(t,e){let o=this.center;e!==void 0?o.copy(e):Bx.setFromPoints(t).getCenter(o);let a=0;for(let l=0,f=t.length;l<f;l++)a=Math.max(a,o.distanceToSquared(t[l]));return this.radius=Math.sqrt(a),this}copy(t){return this.center.copy(t.center),this.radius=t.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(t){return t.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(t){return t.distanceTo(this.center)-this.radius}intersectsSphere(t){let e=this.radius+t.radius;return t.center.distanceToSquared(this.center)<=e*e}intersectsBox(t){return t.intersectsSphere(this)}intersectsPlane(t){return Math.abs(t.distanceToPoint(this.center))<=this.radius}clampPoint(t,e){let o=this.center.distanceToSquared(t);return e.copy(t),o>this.radius*this.radius&&(e.sub(this.center).normalize(),e.multiplyScalar(this.radius).add(this.center)),e}getBoundingBox(t){return this.isEmpty()?(t.makeEmpty(),t):(t.set(this.center,this.center),t.expandByScalar(this.radius),t)}applyMatrix4(t){return this.center.applyMatrix4(t),this.radius=this.radius*t.getMaxScaleOnAxis(),this}translate(t){return this.center.add(t),this}expandByPoint(t){if(this.isEmpty())return this.center.copy(t),this.radius=0,this;Cu.subVectors(t,this.center);let e=Cu.lengthSq();if(e>this.radius*this.radius){let o=Math.sqrt(e),a=(o-this.radius)*.5;this.center.addScaledVector(Cu,a/o),this.radius+=a}return this}union(t){return t.isEmpty()?this:this.isEmpty()?(this.copy(t),this):(this.center.equals(t.center)===!0?this.radius=Math.max(this.radius,t.radius):(qf.subVectors(t.center,this.center).setLength(t.radius),this.expandByPoint(Cu.copy(t.center).add(qf)),this.expandByPoint(Cu.copy(t.center).sub(qf))),this)}equals(t){return t.center.equals(this.center)&&t.radius===this.radius}clone(){return new this.constructor().copy(this)}},Do=new mt,Xf=new mt,Cl=new mt,os=new mt,Yf=new mt,Pl=new mt,Zf=new mt,gh=class{constructor(t=new mt,e=new mt(0,0,-1)){this.origin=t,this.direction=e}set(t,e){return this.origin.copy(t),this.direction.copy(e),this}copy(t){return this.origin.copy(t.origin),this.direction.copy(t.direction),this}at(t,e){return e.copy(this.origin).addScaledVector(this.direction,t)}lookAt(t){return this.direction.copy(t).sub(this.origin).normalize(),this}recast(t){return this.origin.copy(this.at(t,Do)),this}closestPointToPoint(t,e){e.subVectors(t,this.origin);let o=e.dot(this.direction);return o<0?e.copy(this.origin):e.copy(this.origin).addScaledVector(this.direction,o)}distanceToPoint(t){return Math.sqrt(this.distanceSqToPoint(t))}distanceSqToPoint(t){let e=Do.subVectors(t,this.origin).dot(this.direction);return e<0?this.origin.distanceToSquared(t):(Do.copy(this.origin).addScaledVector(this.direction,e),Do.distanceToSquared(t))}distanceSqToSegment(t,e,o,a){Xf.copy(t).add(e).multiplyScalar(.5),Cl.copy(e).sub(t).normalize(),os.copy(this.origin).sub(Xf);let l=t.distanceTo(e)*.5,f=-this.direction.dot(Cl),h=os.dot(this.direction),p=-os.dot(Cl),d=os.lengthSq(),g=Math.abs(1-f*f),_,y,M,w;if(g>0)if(_=f*p-h,y=f*h-p,w=l*g,_>=0)if(y>=-w)if(y<=w){let A=1/g;_*=A,y*=A,M=_*(_+f*y+2*h)+y*(f*_+y+2*p)+d}else y=l,_=Math.max(0,-(f*y+h)),M=-_*_+y*(y+2*p)+d;else y=-l,_=Math.max(0,-(f*y+h)),M=-_*_+y*(y+2*p)+d;else y<=-w?(_=Math.max(0,-(-f*l+h)),y=_>0?-l:Math.min(Math.max(-l,-p),l),M=-_*_+y*(y+2*p)+d):y<=w?(_=0,y=Math.min(Math.max(-l,-p),l),M=y*(y+2*p)+d):(_=Math.max(0,-(f*l+h)),y=_>0?l:Math.min(Math.max(-l,-p),l),M=-_*_+y*(y+2*p)+d);else y=f>0?-l:l,_=Math.max(0,-(f*y+h)),M=-_*_+y*(y+2*p)+d;return o&&o.copy(this.origin).addScaledVector(this.direction,_),a&&a.copy(Xf).addScaledVector(Cl,y),M}intersectSphere(t,e){Do.subVectors(t.center,this.origin);let o=Do.dot(this.direction),a=Do.dot(Do)-o*o,l=t.radius*t.radius;if(a>l)return null;let f=Math.sqrt(l-a),h=o-f,p=o+f;return p<0?null:h<0?this.at(p,e):this.at(h,e)}intersectsSphere(t){return this.distanceSqToPoint(t.center)<=t.radius*t.radius}distanceToPlane(t){let e=t.normal.dot(this.direction);if(e===0)return t.distanceToPoint(this.origin)===0?0:null;let o=-(this.origin.dot(t.normal)+t.constant)/e;return o>=0?o:null}intersectPlane(t,e){let o=this.distanceToPlane(t);return o===null?null:this.at(o,e)}intersectsPlane(t){let e=t.distanceToPoint(this.origin);return e===0||t.normal.dot(this.direction)*e<0}intersectBox(t,e){let o,a,l,f,h,p,d=1/this.direction.x,g=1/this.direction.y,_=1/this.direction.z,y=this.origin;return d>=0?(o=(t.min.x-y.x)*d,a=(t.max.x-y.x)*d):(o=(t.max.x-y.x)*d,a=(t.min.x-y.x)*d),g>=0?(l=(t.min.y-y.y)*g,f=(t.max.y-y.y)*g):(l=(t.max.y-y.y)*g,f=(t.min.y-y.y)*g),o>f||l>a||((l>o||isNaN(o))&&(o=l),(f<a||isNaN(a))&&(a=f),_>=0?(h=(t.min.z-y.z)*_,p=(t.max.z-y.z)*_):(h=(t.max.z-y.z)*_,p=(t.min.z-y.z)*_),o>p||h>a)||((h>o||o!==o)&&(o=h),(p<a||a!==a)&&(a=p),a<0)?null:this.at(o>=0?o:a,e)}intersectsBox(t){return this.intersectBox(t,Do)!==null}intersectTriangle(t,e,o,a,l){Yf.subVectors(e,t),Pl.subVectors(o,t),Zf.crossVectors(Yf,Pl);let f=this.direction.dot(Zf),h;if(f>0){if(a)return null;h=1}else if(f<0)h=-1,f=-f;else return null;os.subVectors(this.origin,t);let p=h*this.direction.dot(Pl.crossVectors(os,Pl));if(p<0)return null;let d=h*this.direction.dot(Yf.cross(os));if(d<0||p+d>f)return null;let g=-h*os.dot(Zf);return g<0?null:this.at(g/f,l)}applyMatrix4(t){return this.origin.applyMatrix4(t),this.direction.transformDirection(t),this}equals(t){return t.origin.equals(this.origin)&&t.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}},zr=class r{constructor(t,e,o,a,l,f,h,p,d,g,_,y,M,w,A,x){r.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],t!==void 0&&this.set(t,e,o,a,l,f,h,p,d,g,_,y,M,w,A,x)}set(t,e,o,a,l,f,h,p,d,g,_,y,M,w,A,x){let v=this.elements;return v[0]=t,v[4]=e,v[8]=o,v[12]=a,v[1]=l,v[5]=f,v[9]=h,v[13]=p,v[2]=d,v[6]=g,v[10]=_,v[14]=y,v[3]=M,v[7]=w,v[11]=A,v[15]=x,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 r().fromArray(this.elements)}copy(t){let e=this.elements,o=t.elements;return e[0]=o[0],e[1]=o[1],e[2]=o[2],e[3]=o[3],e[4]=o[4],e[5]=o[5],e[6]=o[6],e[7]=o[7],e[8]=o[8],e[9]=o[9],e[10]=o[10],e[11]=o[11],e[12]=o[12],e[13]=o[13],e[14]=o[14],e[15]=o[15],this}copyPosition(t){let e=this.elements,o=t.elements;return e[12]=o[12],e[13]=o[13],e[14]=o[14],this}setFromMatrix3(t){let e=t.elements;return this.set(e[0],e[3],e[6],0,e[1],e[4],e[7],0,e[2],e[5],e[8],0,0,0,0,1),this}extractBasis(t,e,o){return t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),o.setFromMatrixColumn(this,2),this}makeBasis(t,e,o){return this.set(t.x,e.x,o.x,0,t.y,e.y,o.y,0,t.z,e.z,o.z,0,0,0,0,1),this}extractRotation(t){let e=this.elements,o=t.elements,a=1/Ea.setFromMatrixColumn(t,0).length(),l=1/Ea.setFromMatrixColumn(t,1).length(),f=1/Ea.setFromMatrixColumn(t,2).length();return e[0]=o[0]*a,e[1]=o[1]*a,e[2]=o[2]*a,e[3]=0,e[4]=o[4]*l,e[5]=o[5]*l,e[6]=o[6]*l,e[7]=0,e[8]=o[8]*f,e[9]=o[9]*f,e[10]=o[10]*f,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromEuler(t){let e=this.elements,o=t.x,a=t.y,l=t.z,f=Math.cos(o),h=Math.sin(o),p=Math.cos(a),d=Math.sin(a),g=Math.cos(l),_=Math.sin(l);if(t.order==="XYZ"){let y=f*g,M=f*_,w=h*g,A=h*_;e[0]=p*g,e[4]=-p*_,e[8]=d,e[1]=M+w*d,e[5]=y-A*d,e[9]=-h*p,e[2]=A-y*d,e[6]=w+M*d,e[10]=f*p}else if(t.order==="YXZ"){let y=p*g,M=p*_,w=d*g,A=d*_;e[0]=y+A*h,e[4]=w*h-M,e[8]=f*d,e[1]=f*_,e[5]=f*g,e[9]=-h,e[2]=M*h-w,e[6]=A+y*h,e[10]=f*p}else if(t.order==="ZXY"){let y=p*g,M=p*_,w=d*g,A=d*_;e[0]=y-A*h,e[4]=-f*_,e[8]=w+M*h,e[1]=M+w*h,e[5]=f*g,e[9]=A-y*h,e[2]=-f*d,e[6]=h,e[10]=f*p}else if(t.order==="ZYX"){let y=f*g,M=f*_,w=h*g,A=h*_;e[0]=p*g,e[4]=w*d-M,e[8]=y*d+A,e[1]=p*_,e[5]=A*d+y,e[9]=M*d-w,e[2]=-d,e[6]=h*p,e[10]=f*p}else if(t.order==="YZX"){let y=f*p,M=f*d,w=h*p,A=h*d;e[0]=p*g,e[4]=A-y*_,e[8]=w*_+M,e[1]=_,e[5]=f*g,e[9]=-h*g,e[2]=-d*g,e[6]=M*_+w,e[10]=y-A*_}else if(t.order==="XZY"){let y=f*p,M=f*d,w=h*p,A=h*d;e[0]=p*g,e[4]=-_,e[8]=d*g,e[1]=y*_+A,e[5]=f*g,e[9]=M*_-w,e[2]=w*_-M,e[6]=h*g,e[10]=A*_+y}return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromQuaternion(t){return this.compose(zx,t,kx)}lookAt(t,e,o){let a=this.elements;return vi.subVectors(t,e),vi.lengthSq()===0&&(vi.z=1),vi.normalize(),ss.crossVectors(o,vi),ss.lengthSq()===0&&(Math.abs(o.z)===1?vi.x+=1e-4:vi.z+=1e-4,vi.normalize(),ss.crossVectors(o,vi)),ss.normalize(),Il.crossVectors(vi,ss),a[0]=ss.x,a[4]=Il.x,a[8]=vi.x,a[1]=ss.y,a[5]=Il.y,a[9]=vi.y,a[2]=ss.z,a[6]=Il.z,a[10]=vi.z,this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){let o=t.elements,a=e.elements,l=this.elements,f=o[0],h=o[4],p=o[8],d=o[12],g=o[1],_=o[5],y=o[9],M=o[13],w=o[2],A=o[6],x=o[10],v=o[14],C=o[3],S=o[7],O=o[11],F=o[15],G=a[0],z=a[4],L=a[8],D=a[12],q=a[1],nt=a[5],k=a[9],xt=a[13],X=a[2],it=a[6],vt=a[10],pt=a[14],et=a[3],ot=a[7],V=a[11],K=a[15];return l[0]=f*G+h*q+p*X+d*et,l[4]=f*z+h*nt+p*it+d*ot,l[8]=f*L+h*k+p*vt+d*V,l[12]=f*D+h*xt+p*pt+d*K,l[1]=g*G+_*q+y*X+M*et,l[5]=g*z+_*nt+y*it+M*ot,l[9]=g*L+_*k+y*vt+M*V,l[13]=g*D+_*xt+y*pt+M*K,l[2]=w*G+A*q+x*X+v*et,l[6]=w*z+A*nt+x*it+v*ot,l[10]=w*L+A*k+x*vt+v*V,l[14]=w*D+A*xt+x*pt+v*K,l[3]=C*G+S*q+O*X+F*et,l[7]=C*z+S*nt+O*it+F*ot,l[11]=C*L+S*k+O*vt+F*V,l[15]=C*D+S*xt+O*pt+F*K,this}multiplyScalar(t){let e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this}determinant(){let t=this.elements,e=t[0],o=t[4],a=t[8],l=t[12],f=t[1],h=t[5],p=t[9],d=t[13],g=t[2],_=t[6],y=t[10],M=t[14],w=t[3],A=t[7],x=t[11],v=t[15];return w*(+l*p*_-a*d*_-l*h*y+o*d*y+a*h*M-o*p*M)+A*(+e*p*M-e*d*y+l*f*y-a*f*M+a*d*g-l*p*g)+x*(+e*d*_-e*h*M-l*f*_+o*f*M+l*h*g-o*d*g)+v*(-a*h*g-e*p*_+e*h*y+a*f*_-o*f*y+o*p*g)}transpose(){let t=this.elements,e;return e=t[1],t[1]=t[4],t[4]=e,e=t[2],t[2]=t[8],t[8]=e,e=t[6],t[6]=t[9],t[9]=e,e=t[3],t[3]=t[12],t[12]=e,e=t[7],t[7]=t[13],t[13]=e,e=t[11],t[11]=t[14],t[14]=e,this}setPosition(t,e,o){let a=this.elements;return t.isVector3?(a[12]=t.x,a[13]=t.y,a[14]=t.z):(a[12]=t,a[13]=e,a[14]=o),this}invert(){let t=this.elements,e=t[0],o=t[1],a=t[2],l=t[3],f=t[4],h=t[5],p=t[6],d=t[7],g=t[8],_=t[9],y=t[10],M=t[11],w=t[12],A=t[13],x=t[14],v=t[15],C=_*x*d-A*y*d+A*p*M-h*x*M-_*p*v+h*y*v,S=w*y*d-g*x*d-w*p*M+f*x*M+g*p*v-f*y*v,O=g*A*d-w*_*d+w*h*M-f*A*M-g*h*v+f*_*v,F=w*_*p-g*A*p-w*h*y+f*A*y+g*h*x-f*_*x,G=e*C+o*S+a*O+l*F;if(G===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);let z=1/G;return t[0]=C*z,t[1]=(A*y*l-_*x*l-A*a*M+o*x*M+_*a*v-o*y*v)*z,t[2]=(h*x*l-A*p*l+A*a*d-o*x*d-h*a*v+o*p*v)*z,t[3]=(_*p*l-h*y*l-_*a*d+o*y*d+h*a*M-o*p*M)*z,t[4]=S*z,t[5]=(g*x*l-w*y*l+w*a*M-e*x*M-g*a*v+e*y*v)*z,t[6]=(w*p*l-f*x*l-w*a*d+e*x*d+f*a*v-e*p*v)*z,t[7]=(f*y*l-g*p*l+g*a*d-e*y*d-f*a*M+e*p*M)*z,t[8]=O*z,t[9]=(w*_*l-g*A*l-w*o*M+e*A*M+g*o*v-e*_*v)*z,t[10]=(f*A*l-w*h*l+w*o*d-e*A*d-f*o*v+e*h*v)*z,t[11]=(g*h*l-f*_*l-g*o*d+e*_*d+f*o*M-e*h*M)*z,t[12]=F*z,t[13]=(g*A*a-w*_*a+w*o*y-e*A*y-g*o*x+e*_*x)*z,t[14]=(w*h*a-f*A*a-w*o*p+e*A*p+f*o*x-e*h*x)*z,t[15]=(f*_*a-g*h*a+g*o*p-e*_*p-f*o*y+e*h*y)*z,this}scale(t){let e=this.elements,o=t.x,a=t.y,l=t.z;return e[0]*=o,e[4]*=a,e[8]*=l,e[1]*=o,e[5]*=a,e[9]*=l,e[2]*=o,e[6]*=a,e[10]*=l,e[3]*=o,e[7]*=a,e[11]*=l,this}getMaxScaleOnAxis(){let t=this.elements,e=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],o=t[4]*t[4]+t[5]*t[5]+t[6]*t[6],a=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(e,o,a))}makeTranslation(t,e,o){return t.isVector3?this.set(1,0,0,t.x,0,1,0,t.y,0,0,1,t.z,0,0,0,1):this.set(1,0,0,t,0,1,0,e,0,0,1,o,0,0,0,1),this}makeRotationX(t){let e=Math.cos(t),o=Math.sin(t);return this.set(1,0,0,0,0,e,-o,0,0,o,e,0,0,0,0,1),this}makeRotationY(t){let e=Math.cos(t),o=Math.sin(t);return this.set(e,0,o,0,0,1,0,0,-o,0,e,0,0,0,0,1),this}makeRotationZ(t){let e=Math.cos(t),o=Math.sin(t);return this.set(e,-o,0,0,o,e,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(t,e){let o=Math.cos(e),a=Math.sin(e),l=1-o,f=t.x,h=t.y,p=t.z,d=l*f,g=l*h;return this.set(d*f+o,d*h-a*p,d*p+a*h,0,d*h+a*p,g*h+o,g*p-a*f,0,d*p-a*h,g*p+a*f,l*p*p+o,0,0,0,0,1),this}makeScale(t,e,o){return this.set(t,0,0,0,0,e,0,0,0,0,o,0,0,0,0,1),this}makeShear(t,e,o,a,l,f){return this.set(1,o,l,0,t,1,f,0,e,a,1,0,0,0,0,1),this}compose(t,e,o){let a=this.elements,l=e._x,f=e._y,h=e._z,p=e._w,d=l+l,g=f+f,_=h+h,y=l*d,M=l*g,w=l*_,A=f*g,x=f*_,v=h*_,C=p*d,S=p*g,O=p*_,F=o.x,G=o.y,z=o.z;return a[0]=(1-(A+v))*F,a[1]=(M+O)*F,a[2]=(w-S)*F,a[3]=0,a[4]=(M-O)*G,a[5]=(1-(y+v))*G,a[6]=(x+C)*G,a[7]=0,a[8]=(w+S)*z,a[9]=(x-C)*z,a[10]=(1-(y+A))*z,a[11]=0,a[12]=t.x,a[13]=t.y,a[14]=t.z,a[15]=1,this}decompose(t,e,o){let a=this.elements,l=Ea.set(a[0],a[1],a[2]).length(),f=Ea.set(a[4],a[5],a[6]).length(),h=Ea.set(a[8],a[9],a[10]).length();this.determinant()<0&&(l=-l),t.x=a[12],t.y=a[13],t.z=a[14],Yi.copy(this);let d=1/l,g=1/f,_=1/h;return Yi.elements[0]*=d,Yi.elements[1]*=d,Yi.elements[2]*=d,Yi.elements[4]*=g,Yi.elements[5]*=g,Yi.elements[6]*=g,Yi.elements[8]*=_,Yi.elements[9]*=_,Yi.elements[10]*=_,e.setFromRotationMatrix(Yi),o.x=l,o.y=f,o.z=h,this}makePerspective(t,e,o,a,l,f,h=Vo){let p=this.elements,d=2*l/(e-t),g=2*l/(o-a),_=(e+t)/(e-t),y=(o+a)/(o-a),M,w;if(h===Vo)M=-(f+l)/(f-l),w=-2*f*l/(f-l);else if(h===jl)M=-f/(f-l),w=-f*l/(f-l);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+h);return p[0]=d,p[4]=0,p[8]=_,p[12]=0,p[1]=0,p[5]=g,p[9]=y,p[13]=0,p[2]=0,p[6]=0,p[10]=M,p[14]=w,p[3]=0,p[7]=0,p[11]=-1,p[15]=0,this}makeOrthographic(t,e,o,a,l,f,h=Vo){let p=this.elements,d=1/(e-t),g=1/(o-a),_=1/(f-l),y=(e+t)*d,M=(o+a)*g,w,A;if(h===Vo)w=(f+l)*_,A=-2*_;else if(h===jl)w=l*_,A=-1*_;else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+h);return p[0]=2*d,p[4]=0,p[8]=0,p[12]=-y,p[1]=0,p[5]=2*g,p[9]=0,p[13]=-M,p[2]=0,p[6]=0,p[10]=A,p[14]=-w,p[3]=0,p[7]=0,p[11]=0,p[15]=1,this}equals(t){let e=this.elements,o=t.elements;for(let a=0;a<16;a++)if(e[a]!==o[a])return!1;return!0}fromArray(t,e=0){for(let o=0;o<16;o++)this.elements[o]=t[o+e];return this}toArray(t=[],e=0){let o=this.elements;return t[e]=o[0],t[e+1]=o[1],t[e+2]=o[2],t[e+3]=o[3],t[e+4]=o[4],t[e+5]=o[5],t[e+6]=o[6],t[e+7]=o[7],t[e+8]=o[8],t[e+9]=o[9],t[e+10]=o[10],t[e+11]=o[11],t[e+12]=o[12],t[e+13]=o[13],t[e+14]=o[14],t[e+15]=o[15],t}},Ea=new mt,Yi=new zr,zx=new mt(0,0,0),kx=new mt(1,1,1),ss=new mt,Il=new mt,vi=new mt,gg=new zr,yg=new ms,rc=class r{constructor(t=0,e=0,o=0,a=r.DEFAULT_ORDER){this.isEuler=!0,this._x=t,this._y=e,this._z=o,this._order=a}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get order(){return this._order}set order(t){this._order=t,this._onChangeCallback()}set(t,e,o,a=this._order){return this._x=t,this._y=e,this._z=o,this._order=a,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._order=t._order,this._onChangeCallback(),this}setFromRotationMatrix(t,e=this._order,o=!0){let a=t.elements,l=a[0],f=a[4],h=a[8],p=a[1],d=a[5],g=a[9],_=a[2],y=a[6],M=a[10];switch(e){case"XYZ":this._y=Math.asin(ai(h,-1,1)),Math.abs(h)<.9999999?(this._x=Math.atan2(-g,M),this._z=Math.atan2(-f,l)):(this._x=Math.atan2(y,d),this._z=0);break;case"YXZ":this._x=Math.asin(-ai(g,-1,1)),Math.abs(g)<.9999999?(this._y=Math.atan2(h,M),this._z=Math.atan2(p,d)):(this._y=Math.atan2(-_,l),this._z=0);break;case"ZXY":this._x=Math.asin(ai(y,-1,1)),Math.abs(y)<.9999999?(this._y=Math.atan2(-_,M),this._z=Math.atan2(-f,d)):(this._y=0,this._z=Math.atan2(p,l));break;case"ZYX":this._y=Math.asin(-ai(_,-1,1)),Math.abs(_)<.9999999?(this._x=Math.atan2(y,M),this._z=Math.atan2(p,l)):(this._x=0,this._z=Math.atan2(-f,d));break;case"YZX":this._z=Math.asin(ai(p,-1,1)),Math.abs(p)<.9999999?(this._x=Math.atan2(-g,d),this._y=Math.atan2(-_,l)):(this._x=0,this._y=Math.atan2(h,M));break;case"XZY":this._z=Math.asin(-ai(f,-1,1)),Math.abs(f)<.9999999?(this._x=Math.atan2(y,d),this._y=Math.atan2(h,l)):(this._x=Math.atan2(-g,M),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+e)}return this._order=e,o===!0&&this._onChangeCallback(),this}setFromQuaternion(t,e,o){return gg.makeRotationFromQuaternion(t),this.setFromRotationMatrix(gg,e,o)}setFromVector3(t,e=this._order){return this.set(t.x,t.y,t.z,e)}reorder(t){return yg.setFromEuler(this),this.setFromQuaternion(yg,t)}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._order===this._order}fromArray(t){return this._x=t[0],this._y=t[1],this._z=t[2],t[3]!==void 0&&(this._order=t[3]),this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._order,t}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}};rc.DEFAULT_ORDER="XYZ";var ic=class{constructor(){this.mask=1}set(t){this.mask=(1<<t|0)>>>0}enable(t){this.mask|=1<<t|0}enableAll(){this.mask=-1}toggle(t){this.mask^=1<<t|0}disable(t){this.mask&=~(1<<t|0)}disableAll(){this.mask=0}test(t){return(this.mask&t.mask)!==0}isEnabled(t){return(this.mask&(1<<t|0))!==0}},Gx=0,vg=new mt,Ma=new ms,Fo=new zr,Rl=new mt,Pu=new mt,Vx=new mt,Hx=new ms,_g=new mt(1,0,0),xg=new mt(0,1,0),Eg=new mt(0,0,1),Wx={type:"added"},qx={type:"removed"},fo=class r extends ds{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:Gx++}),this.uuid=zu(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=r.DEFAULT_UP.clone();let t=new mt,e=new rc,o=new ms,a=new mt(1,1,1);function l(){o.setFromEuler(e,!1)}function f(){e.setFromQuaternion(o,void 0,!1)}e._onChange(l),o._onChange(f),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:t},rotation:{configurable:!0,enumerable:!0,value:e},quaternion:{configurable:!0,enumerable:!0,value:o},scale:{configurable:!0,enumerable:!0,value:a},modelViewMatrix:{value:new zr},normalMatrix:{value:new ve}}),this.matrix=new zr,this.matrixWorld=new zr,this.matrixAutoUpdate=r.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.matrixWorldAutoUpdate=r.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.layers=new ic,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.userData={}}onBeforeRender(){}onAfterRender(){}applyMatrix4(t){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(t),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(t){return this.quaternion.premultiply(t),this}setRotationFromAxisAngle(t,e){this.quaternion.setFromAxisAngle(t,e)}setRotationFromEuler(t){this.quaternion.setFromEuler(t,!0)}setRotationFromMatrix(t){this.quaternion.setFromRotationMatrix(t)}setRotationFromQuaternion(t){this.quaternion.copy(t)}rotateOnAxis(t,e){return Ma.setFromAxisAngle(t,e),this.quaternion.multiply(Ma),this}rotateOnWorldAxis(t,e){return Ma.setFromAxisAngle(t,e),this.quaternion.premultiply(Ma),this}rotateX(t){return this.rotateOnAxis(_g,t)}rotateY(t){return this.rotateOnAxis(xg,t)}rotateZ(t){return this.rotateOnAxis(Eg,t)}translateOnAxis(t,e){return vg.copy(t).applyQuaternion(this.quaternion),this.position.add(vg.multiplyScalar(e)),this}translateX(t){return this.translateOnAxis(_g,t)}translateY(t){return this.translateOnAxis(xg,t)}translateZ(t){return this.translateOnAxis(Eg,t)}localToWorld(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(this.matrixWorld)}worldToLocal(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(Fo.copy(this.matrixWorld).invert())}lookAt(t,e,o){t.isVector3?Rl.copy(t):Rl.set(t,e,o);let a=this.parent;this.updateWorldMatrix(!0,!1),Pu.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?Fo.lookAt(Pu,Rl,this.up):Fo.lookAt(Rl,Pu,this.up),this.quaternion.setFromRotationMatrix(Fo),a&&(Fo.extractRotation(a.matrixWorld),Ma.setFromRotationMatrix(Fo),this.quaternion.premultiply(Ma.invert()))}add(t){if(arguments.length>1){for(let e=0;e<arguments.length;e++)this.add(arguments[e]);return this}return t===this?(console.error("THREE.Object3D.add: object can\'t be added as a child of itself.",t),this):(t&&t.isObject3D?(t.parent!==null&&t.parent.remove(t),t.parent=this,this.children.push(t),t.dispatchEvent(Wx)):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",t),this)}remove(t){if(arguments.length>1){for(let o=0;o<arguments.length;o++)this.remove(arguments[o]);return this}let e=this.children.indexOf(t);return e!==-1&&(t.parent=null,this.children.splice(e,1),t.dispatchEvent(qx)),this}removeFromParent(){let t=this.parent;return t!==null&&t.remove(this),this}clear(){return this.remove(...this.children)}attach(t){return this.updateWorldMatrix(!0,!1),Fo.copy(this.matrixWorld).invert(),t.parent!==null&&(t.parent.updateWorldMatrix(!0,!1),Fo.multiply(t.parent.matrixWorld)),t.applyMatrix4(Fo),this.add(t),t.updateWorldMatrix(!1,!0),this}getObjectById(t){return this.getObjectByProperty("id",t)}getObjectByName(t){return this.getObjectByProperty("name",t)}getObjectByProperty(t,e){if(this[t]===e)return this;for(let o=0,a=this.children.length;o<a;o++){let f=this.children[o].getObjectByProperty(t,e);if(f!==void 0)return f}}getObjectsByProperty(t,e){let o=[];this[t]===e&&o.push(this);for(let a=0,l=this.children.length;a<l;a++){let f=this.children[a].getObjectsByProperty(t,e);f.length>0&&(o=o.concat(f))}return o}getWorldPosition(t){return this.updateWorldMatrix(!0,!1),t.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Pu,t,Vx),t}getWorldScale(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Pu,Hx,t),t}getWorldDirection(t){this.updateWorldMatrix(!0,!1);let e=this.matrixWorld.elements;return t.set(e[8],e[9],e[10]).normalize()}raycast(){}traverse(t){t(this);let e=this.children;for(let o=0,a=e.length;o<a;o++)e[o].traverse(t)}traverseVisible(t){if(this.visible===!1)return;t(this);let e=this.children;for(let o=0,a=e.length;o<a;o++)e[o].traverseVisible(t)}traverseAncestors(t){let e=this.parent;e!==null&&(t(e),e.traverseAncestors(t))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(t){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||t)&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,t=!0);let e=this.children;for(let o=0,a=e.length;o<a;o++){let l=e[o];(l.matrixWorldAutoUpdate===!0||t===!0)&&l.updateMatrixWorld(t)}}updateWorldMatrix(t,e){let o=this.parent;if(t===!0&&o!==null&&o.matrixWorldAutoUpdate===!0&&o.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),e===!0){let a=this.children;for(let l=0,f=a.length;l<f;l++){let h=a[l];h.matrixWorldAutoUpdate===!0&&h.updateWorldMatrix(!1,!0)}}}toJSON(t){let e=t===void 0||typeof t=="string",o={};e&&(t={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},o.metadata={version:4.6,type:"Object",generator:"Object3D.toJSON"});let a={};a.uuid=this.uuid,a.type=this.type,this.name!==""&&(a.name=this.name),this.castShadow===!0&&(a.castShadow=!0),this.receiveShadow===!0&&(a.receiveShadow=!0),this.visible===!1&&(a.visible=!1),this.frustumCulled===!1&&(a.frustumCulled=!1),this.renderOrder!==0&&(a.renderOrder=this.renderOrder),Object.keys(this.userData).length>0&&(a.userData=this.userData),a.layers=this.layers.mask,a.matrix=this.matrix.toArray(),a.up=this.up.toArray(),this.matrixAutoUpdate===!1&&(a.matrixAutoUpdate=!1),this.isInstancedMesh&&(a.type="InstancedMesh",a.count=this.count,a.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(a.instanceColor=this.instanceColor.toJSON()));function l(h,p){return h[p.uuid]===void 0&&(h[p.uuid]=p.toJSON(t)),p.uuid}if(this.isScene)this.background&&(this.background.isColor?a.background=this.background.toJSON():this.background.isTexture&&(a.background=this.background.toJSON(t).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(a.environment=this.environment.toJSON(t).uuid);else if(this.isMesh||this.isLine||this.isPoints){a.geometry=l(t.geometries,this.geometry);let h=this.geometry.parameters;if(h!==void 0&&h.shapes!==void 0){let p=h.shapes;if(Array.isArray(p))for(let d=0,g=p.length;d<g;d++){let _=p[d];l(t.shapes,_)}else l(t.shapes,p)}}if(this.isSkinnedMesh&&(a.bindMode=this.bindMode,a.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(l(t.skeletons,this.skeleton),a.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){let h=[];for(let p=0,d=this.material.length;p<d;p++)h.push(l(t.materials,this.material[p]));a.material=h}else a.material=l(t.materials,this.material);if(this.children.length>0){a.children=[];for(let h=0;h<this.children.length;h++)a.children.push(this.children[h].toJSON(t).object)}if(this.animations.length>0){a.animations=[];for(let h=0;h<this.animations.length;h++){let p=this.animations[h];a.animations.push(l(t.animations,p))}}if(e){let h=f(t.geometries),p=f(t.materials),d=f(t.textures),g=f(t.images),_=f(t.shapes),y=f(t.skeletons),M=f(t.animations),w=f(t.nodes);h.length>0&&(o.geometries=h),p.length>0&&(o.materials=p),d.length>0&&(o.textures=d),g.length>0&&(o.images=g),_.length>0&&(o.shapes=_),y.length>0&&(o.skeletons=y),M.length>0&&(o.animations=M),w.length>0&&(o.nodes=w)}return o.object=a,o;function f(h){let p=[];for(let d in h){let g=h[d];delete g.metadata,p.push(g)}return p}}clone(t){return new this.constructor().copy(this,t)}copy(t,e=!0){if(this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),this.rotation.order=t.rotation.order,this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.matrixWorldAutoUpdate=t.matrixWorldAutoUpdate,this.layers.mask=t.layers.mask,this.visible=t.visible,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow,this.frustumCulled=t.frustumCulled,this.renderOrder=t.renderOrder,this.animations=t.animations.slice(),this.userData=JSON.parse(JSON.stringify(t.userData)),e===!0)for(let o=0;o<t.children.length;o++){let a=t.children[o];this.add(a.clone())}return this}};fo.DEFAULT_UP=new mt(0,1,0);fo.DEFAULT_MATRIX_AUTO_UPDATE=!0;fo.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;var Zi=new mt,Uo=new mt,Jf=new mt,Bo=new mt,Sa=new mt,wa=new mt,Mg=new mt,$f=new mt,Kf=new mt,jf=new mt,Ll=!1,Na=class r{constructor(t=new mt,e=new mt,o=new mt){this.a=t,this.b=e,this.c=o}static getNormal(t,e,o,a){a.subVectors(o,e),Zi.subVectors(t,e),a.cross(Zi);let l=a.lengthSq();return l>0?a.multiplyScalar(1/Math.sqrt(l)):a.set(0,0,0)}static getBarycoord(t,e,o,a,l){Zi.subVectors(a,e),Uo.subVectors(o,e),Jf.subVectors(t,e);let f=Zi.dot(Zi),h=Zi.dot(Uo),p=Zi.dot(Jf),d=Uo.dot(Uo),g=Uo.dot(Jf),_=f*d-h*h;if(_===0)return l.set(-2,-1,-1);let y=1/_,M=(d*p-h*g)*y,w=(f*g-h*p)*y;return l.set(1-M-w,w,M)}static containsPoint(t,e,o,a){return this.getBarycoord(t,e,o,a,Bo),Bo.x>=0&&Bo.y>=0&&Bo.x+Bo.y<=1}static getUV(t,e,o,a,l,f,h,p){return Ll===!1&&(console.warn("THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation()."),Ll=!0),this.getInterpolation(t,e,o,a,l,f,h,p)}static getInterpolation(t,e,o,a,l,f,h,p){return this.getBarycoord(t,e,o,a,Bo),p.setScalar(0),p.addScaledVector(l,Bo.x),p.addScaledVector(f,Bo.y),p.addScaledVector(h,Bo.z),p}static isFrontFacing(t,e,o,a){return Zi.subVectors(o,e),Uo.subVectors(t,e),Zi.cross(Uo).dot(a)<0}set(t,e,o){return this.a.copy(t),this.b.copy(e),this.c.copy(o),this}setFromPointsAndIndices(t,e,o,a){return this.a.copy(t[e]),this.b.copy(t[o]),this.c.copy(t[a]),this}setFromAttributeAndIndices(t,e,o,a){return this.a.fromBufferAttribute(t,e),this.b.fromBufferAttribute(t,o),this.c.fromBufferAttribute(t,a),this}clone(){return new this.constructor().copy(this)}copy(t){return this.a.copy(t.a),this.b.copy(t.b),this.c.copy(t.c),this}getArea(){return Zi.subVectors(this.c,this.b),Uo.subVectors(this.a,this.b),Zi.cross(Uo).length()*.5}getMidpoint(t){return t.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(t){return r.getNormal(this.a,this.b,this.c,t)}getPlane(t){return t.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(t,e){return r.getBarycoord(t,this.a,this.b,this.c,e)}getUV(t,e,o,a,l){return Ll===!1&&(console.warn("THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation()."),Ll=!0),r.getInterpolation(t,this.a,this.b,this.c,e,o,a,l)}getInterpolation(t,e,o,a,l){return r.getInterpolation(t,this.a,this.b,this.c,e,o,a,l)}containsPoint(t){return r.containsPoint(t,this.a,this.b,this.c)}isFrontFacing(t){return r.isFrontFacing(this.a,this.b,this.c,t)}intersectsBox(t){return t.intersectsTriangle(this)}closestPointToPoint(t,e){let o=this.a,a=this.b,l=this.c,f,h;Sa.subVectors(a,o),wa.subVectors(l,o),$f.subVectors(t,o);let p=Sa.dot($f),d=wa.dot($f);if(p<=0&&d<=0)return e.copy(o);Kf.subVectors(t,a);let g=Sa.dot(Kf),_=wa.dot(Kf);if(g>=0&&_<=g)return e.copy(a);let y=p*_-g*d;if(y<=0&&p>=0&&g<=0)return f=p/(p-g),e.copy(o).addScaledVector(Sa,f);jf.subVectors(t,l);let M=Sa.dot(jf),w=wa.dot(jf);if(w>=0&&M<=w)return e.copy(l);let A=M*d-p*w;if(A<=0&&d>=0&&w<=0)return h=d/(d-w),e.copy(o).addScaledVector(wa,h);let x=g*w-M*_;if(x<=0&&_-g>=0&&M-w>=0)return Mg.subVectors(l,a),h=(_-g)/(_-g+(M-w)),e.copy(a).addScaledVector(Mg,h);let v=1/(x+A+y);return f=A*v,h=y*v,e.copy(o).addScaledVector(Sa,f).addScaledVector(wa,h)}equals(t){return t.a.equals(this.a)&&t.b.equals(this.b)&&t.c.equals(this.c)}},Xx=0,Va=class extends ds{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:Xx++}),this.uuid=zu(),this.name="",this.type="Material",this.blending=Fa,this.side=ps,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=$g,this.blendDst=Kg,this.blendEquation=La,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=sh,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=wx,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=Uf,this.stencilZFail=Uf,this.stencilZPass=Uf,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.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(t){this._alphaTest>0!=t>0&&this.version++,this._alphaTest=t}onBuild(){}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(t){if(t!==void 0)for(let e in t){let o=t[e];if(o===void 0){console.warn(`THREE.Material: parameter \'${e}\' has value of undefined.`);continue}let a=this[e];if(a===void 0){console.warn(`THREE.Material: \'${e}\' is not a property of THREE.${this.type}.`);continue}a&&a.isColor?a.set(o):a&&a.isVector3&&o&&o.isVector3?a.copy(o):this[e]=o}}toJSON(t){let e=t===void 0||typeof t=="string";e&&(t={textures:{},images:{}});let o={metadata:{version:4.6,type:"Material",generator:"Material.toJSON"}};o.uuid=this.uuid,o.type=this.type,this.name!==""&&(o.name=this.name),this.color&&this.color.isColor&&(o.color=this.color.getHex()),this.roughness!==void 0&&(o.roughness=this.roughness),this.metalness!==void 0&&(o.metalness=this.metalness),this.sheen!==void 0&&(o.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(o.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(o.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(o.emissive=this.emissive.getHex()),this.emissiveIntensity&&this.emissiveIntensity!==1&&(o.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(o.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(o.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(o.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(o.shininess=this.shininess),this.clearcoat!==void 0&&(o.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(o.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(o.clearcoatMap=this.clearcoatMap.toJSON(t).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(o.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(t).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(o.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(t).uuid,o.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.iridescence!==void 0&&(o.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(o.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(o.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(o.iridescenceMap=this.iridescenceMap.toJSON(t).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(o.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(t).uuid),this.anisotropy!==void 0&&(o.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(o.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(o.anisotropyMap=this.anisotropyMap.toJSON(t).uuid),this.map&&this.map.isTexture&&(o.map=this.map.toJSON(t).uuid),this.matcap&&this.matcap.isTexture&&(o.matcap=this.matcap.toJSON(t).uuid),this.alphaMap&&this.alphaMap.isTexture&&(o.alphaMap=this.alphaMap.toJSON(t).uuid),this.lightMap&&this.lightMap.isTexture&&(o.lightMap=this.lightMap.toJSON(t).uuid,o.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(o.aoMap=this.aoMap.toJSON(t).uuid,o.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(o.bumpMap=this.bumpMap.toJSON(t).uuid,o.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(o.normalMap=this.normalMap.toJSON(t).uuid,o.normalMapType=this.normalMapType,o.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(o.displacementMap=this.displacementMap.toJSON(t).uuid,o.displacementScale=this.displacementScale,o.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(o.roughnessMap=this.roughnessMap.toJSON(t).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(o.metalnessMap=this.metalnessMap.toJSON(t).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(o.emissiveMap=this.emissiveMap.toJSON(t).uuid),this.specularMap&&this.specularMap.isTexture&&(o.specularMap=this.specularMap.toJSON(t).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(o.specularIntensityMap=this.specularIntensityMap.toJSON(t).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(o.specularColorMap=this.specularColorMap.toJSON(t).uuid),this.envMap&&this.envMap.isTexture&&(o.envMap=this.envMap.toJSON(t).uuid,this.combine!==void 0&&(o.combine=this.combine)),this.envMapIntensity!==void 0&&(o.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(o.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(o.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(o.gradientMap=this.gradientMap.toJSON(t).uuid),this.transmission!==void 0&&(o.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(o.transmissionMap=this.transmissionMap.toJSON(t).uuid),this.thickness!==void 0&&(o.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(o.thicknessMap=this.thicknessMap.toJSON(t).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(o.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(o.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(o.size=this.size),this.shadowSide!==null&&(o.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(o.sizeAttenuation=this.sizeAttenuation),this.blending!==Fa&&(o.blending=this.blending),this.side!==ps&&(o.side=this.side),this.vertexColors===!0&&(o.vertexColors=!0),this.opacity<1&&(o.opacity=this.opacity),this.transparent===!0&&(o.transparent=!0),o.depthFunc=this.depthFunc,o.depthTest=this.depthTest,o.depthWrite=this.depthWrite,o.colorWrite=this.colorWrite,o.stencilWrite=this.stencilWrite,o.stencilWriteMask=this.stencilWriteMask,o.stencilFunc=this.stencilFunc,o.stencilRef=this.stencilRef,o.stencilFuncMask=this.stencilFuncMask,o.stencilFail=this.stencilFail,o.stencilZFail=this.stencilZFail,o.stencilZPass=this.stencilZPass,this.rotation!==void 0&&this.rotation!==0&&(o.rotation=this.rotation),this.polygonOffset===!0&&(o.polygonOffset=!0),this.polygonOffsetFactor!==0&&(o.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(o.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(o.linewidth=this.linewidth),this.dashSize!==void 0&&(o.dashSize=this.dashSize),this.gapSize!==void 0&&(o.gapSize=this.gapSize),this.scale!==void 0&&(o.scale=this.scale),this.dithering===!0&&(o.dithering=!0),this.alphaTest>0&&(o.alphaTest=this.alphaTest),this.alphaHash===!0&&(o.alphaHash=!0),this.alphaToCoverage===!0&&(o.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(o.premultipliedAlpha=!0),this.forceSinglePass===!0&&(o.forceSinglePass=!0),this.wireframe===!0&&(o.wireframe=!0),this.wireframeLinewidth>1&&(o.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(o.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(o.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(o.flatShading=!0),this.visible===!1&&(o.visible=!1),this.toneMapped===!1&&(o.toneMapped=!1),this.fog===!1&&(o.fog=!1),Object.keys(this.userData).length>0&&(o.userData=this.userData);function a(l){let f=[];for(let h in l){let p=l[h];delete p.metadata,f.push(p)}return f}if(e){let l=a(t.textures),f=a(t.images);l.length>0&&(o.textures=l),f.length>0&&(o.images=f)}return o}clone(){return new this.constructor().copy(this)}copy(t){this.name=t.name,this.blending=t.blending,this.side=t.side,this.vertexColors=t.vertexColors,this.opacity=t.opacity,this.transparent=t.transparent,this.blendSrc=t.blendSrc,this.blendDst=t.blendDst,this.blendEquation=t.blendEquation,this.blendSrcAlpha=t.blendSrcAlpha,this.blendDstAlpha=t.blendDstAlpha,this.blendEquationAlpha=t.blendEquationAlpha,this.depthFunc=t.depthFunc,this.depthTest=t.depthTest,this.depthWrite=t.depthWrite,this.stencilWriteMask=t.stencilWriteMask,this.stencilFunc=t.stencilFunc,this.stencilRef=t.stencilRef,this.stencilFuncMask=t.stencilFuncMask,this.stencilFail=t.stencilFail,this.stencilZFail=t.stencilZFail,this.stencilZPass=t.stencilZPass,this.stencilWrite=t.stencilWrite;let e=t.clippingPlanes,o=null;if(e!==null){let a=e.length;o=new Array(a);for(let l=0;l!==a;++l)o[l]=e[l].clone()}return this.clippingPlanes=o,this.clipIntersection=t.clipIntersection,this.clipShadows=t.clipShadows,this.shadowSide=t.shadowSide,this.colorWrite=t.colorWrite,this.precision=t.precision,this.polygonOffset=t.polygonOffset,this.polygonOffsetFactor=t.polygonOffsetFactor,this.polygonOffsetUnits=t.polygonOffsetUnits,this.dithering=t.dithering,this.alphaTest=t.alphaTest,this.alphaHash=t.alphaHash,this.alphaToCoverage=t.alphaToCoverage,this.premultipliedAlpha=t.premultipliedAlpha,this.forceSinglePass=t.forceSinglePass,this.visible=t.visible,this.toneMapped=t.toneMapped,this.userData=JSON.parse(JSON.stringify(t.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(t){t===!0&&this.version++}},u0={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},as={h:0,s:0,l:0},Nl={h:0,s:0,l:0};function Qf(r,t,e){return e<0&&(e+=1),e>1&&(e-=1),e<1/6?r+(t-r)*6*e:e<1/2?t:e<2/3?r+(t-r)*6*(2/3-e):r}var xn=class{constructor(t,e,o){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(t,e,o)}set(t,e,o){if(e===void 0&&o===void 0){let a=t;a&&a.isColor?this.copy(a):typeof a=="number"?this.setHex(a):typeof a=="string"&&this.setStyle(a)}else this.setRGB(t,e,o);return this}setScalar(t){return this.r=t,this.g=t,this.b=t,this}setHex(t,e=br){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(t&255)/255,gn.toWorkingColorSpace(this,e),this}setRGB(t,e,o,a=gn.workingColorSpace){return this.r=t,this.g=e,this.b=o,gn.toWorkingColorSpace(this,a),this}setHSL(t,e,o,a=gn.workingColorSpace){if(t=Nx(t,1),e=ai(e,0,1),o=ai(o,0,1),e===0)this.r=this.g=this.b=o;else{let l=o<=.5?o*(1+e):o+e-o*e,f=2*o-l;this.r=Qf(f,l,t+1/3),this.g=Qf(f,l,t),this.b=Qf(f,l,t-1/3)}return gn.toWorkingColorSpace(this,a),this}setStyle(t,e=br){function o(l){l!==void 0&&parseFloat(l)<1&&console.warn("THREE.Color: Alpha component of "+t+" will be ignored.")}let a;if(a=/^(\\w+)\\(([^\\)]*)\\)/.exec(t)){let l,f=a[1],h=a[2];switch(f){case"rgb":case"rgba":if(l=/^\\s*(\\d+)\\s*,\\s*(\\d+)\\s*,\\s*(\\d+)\\s*(?:,\\s*(\\d*\\.?\\d+)\\s*)?$/.exec(h))return o(l[4]),this.setRGB(Math.min(255,parseInt(l[1],10))/255,Math.min(255,parseInt(l[2],10))/255,Math.min(255,parseInt(l[3],10))/255,e);if(l=/^\\s*(\\d+)\\%\\s*,\\s*(\\d+)\\%\\s*,\\s*(\\d+)\\%\\s*(?:,\\s*(\\d*\\.?\\d+)\\s*)?$/.exec(h))return o(l[4]),this.setRGB(Math.min(100,parseInt(l[1],10))/100,Math.min(100,parseInt(l[2],10))/100,Math.min(100,parseInt(l[3],10))/100,e);break;case"hsl":case"hsla":if(l=/^\\s*(\\d*\\.?\\d+)\\s*,\\s*(\\d*\\.?\\d+)\\%\\s*,\\s*(\\d*\\.?\\d+)\\%\\s*(?:,\\s*(\\d*\\.?\\d+)\\s*)?$/.exec(h))return o(l[4]),this.setHSL(parseFloat(l[1])/360,parseFloat(l[2])/100,parseFloat(l[3])/100,e);break;default:console.warn("THREE.Color: Unknown color model "+t)}}else if(a=/^\\#([A-Fa-f\\d]+)$/.exec(t)){let l=a[1],f=l.length;if(f===3)return this.setRGB(parseInt(l.charAt(0),16)/15,parseInt(l.charAt(1),16)/15,parseInt(l.charAt(2),16)/15,e);if(f===6)return this.setHex(parseInt(l,16),e);console.warn("THREE.Color: Invalid hex color "+t)}else if(t&&t.length>0)return this.setColorName(t,e);return this}setColorName(t,e=br){let o=u0[t.toLowerCase()];return o!==void 0?this.setHex(o,e):console.warn("THREE.Color: Unknown color "+t),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(t){return this.r=t.r,this.g=t.g,this.b=t.b,this}copySRGBToLinear(t){return this.r=Ua(t.r),this.g=Ua(t.g),this.b=Ua(t.b),this}copyLinearToSRGB(t){return this.r=Gf(t.r),this.g=Gf(t.g),this.b=Gf(t.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(t=br){return gn.fromWorkingColorSpace(Br.copy(this),t),Math.round(ai(Br.r*255,0,255))*65536+Math.round(ai(Br.g*255,0,255))*256+Math.round(ai(Br.b*255,0,255))}getHexString(t=br){return("000000"+this.getHex(t).toString(16)).slice(-6)}getHSL(t,e=gn.workingColorSpace){gn.fromWorkingColorSpace(Br.copy(this),e);let o=Br.r,a=Br.g,l=Br.b,f=Math.max(o,a,l),h=Math.min(o,a,l),p,d,g=(h+f)/2;if(h===f)p=0,d=0;else{let _=f-h;switch(d=g<=.5?_/(f+h):_/(2-f-h),f){case o:p=(a-l)/_+(a<l?6:0);break;case a:p=(l-o)/_+2;break;case l:p=(o-a)/_+4;break}p/=6}return t.h=p,t.s=d,t.l=g,t}getRGB(t,e=gn.workingColorSpace){return gn.fromWorkingColorSpace(Br.copy(this),e),t.r=Br.r,t.g=Br.g,t.b=Br.b,t}getStyle(t=br){gn.fromWorkingColorSpace(Br.copy(this),t);let e=Br.r,o=Br.g,a=Br.b;return t!==br?`color(${t} ${e.toFixed(3)} ${o.toFixed(3)} ${a.toFixed(3)})`:`rgb(${Math.round(e*255)},${Math.round(o*255)},${Math.round(a*255)})`}offsetHSL(t,e,o){return this.getHSL(as),this.setHSL(as.h+t,as.s+e,as.l+o)}add(t){return this.r+=t.r,this.g+=t.g,this.b+=t.b,this}addColors(t,e){return this.r=t.r+e.r,this.g=t.g+e.g,this.b=t.b+e.b,this}addScalar(t){return this.r+=t,this.g+=t,this.b+=t,this}sub(t){return this.r=Math.max(0,this.r-t.r),this.g=Math.max(0,this.g-t.g),this.b=Math.max(0,this.b-t.b),this}multiply(t){return this.r*=t.r,this.g*=t.g,this.b*=t.b,this}multiplyScalar(t){return this.r*=t,this.g*=t,this.b*=t,this}lerp(t,e){return this.r+=(t.r-this.r)*e,this.g+=(t.g-this.g)*e,this.b+=(t.b-this.b)*e,this}lerpColors(t,e,o){return this.r=t.r+(e.r-t.r)*o,this.g=t.g+(e.g-t.g)*o,this.b=t.b+(e.b-t.b)*o,this}lerpHSL(t,e){this.getHSL(as),t.getHSL(Nl);let o=zf(as.h,Nl.h,e),a=zf(as.s,Nl.s,e),l=zf(as.l,Nl.l,e);return this.setHSL(o,a,l),this}setFromVector3(t){return this.r=t.x,this.g=t.y,this.b=t.z,this}applyMatrix3(t){let e=this.r,o=this.g,a=this.b,l=t.elements;return this.r=l[0]*e+l[3]*o+l[6]*a,this.g=l[1]*e+l[4]*o+l[7]*a,this.b=l[2]*e+l[5]*o+l[8]*a,this}equals(t){return t.r===this.r&&t.g===this.g&&t.b===this.b}fromArray(t,e=0){return this.r=t[e],this.g=t[e+1],this.b=t[e+2],this}toArray(t=[],e=0){return t[e]=this.r,t[e+1]=this.g,t[e+2]=this.b,t}fromBufferAttribute(t,e){return this.r=t.getX(e),this.g=t.getY(e),this.b=t.getZ(e),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}},Br=new xn;xn.NAMES=u0;var oc=class extends Va{constructor(t){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new xn(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.combine=jg,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.fog=t.fog,this}};var Jn=new mt,Ol=new fn,Di=class{constructor(t,e,o=!1){if(Array.isArray(t))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,this.name="",this.array=t,this.itemSize=e,this.count=t!==void 0?t.length/e:0,this.normalized=o,this.usage=lg,this.updateRange={offset:0,count:-1},this.gpuType=ls,this.version=0}onUploadCallback(){}set needsUpdate(t){t===!0&&this.version++}setUsage(t){return this.usage=t,this}copy(t){return this.name=t.name,this.array=new t.array.constructor(t.array),this.itemSize=t.itemSize,this.count=t.count,this.normalized=t.normalized,this.usage=t.usage,this.gpuType=t.gpuType,this}copyAt(t,e,o){t*=this.itemSize,o*=e.itemSize;for(let a=0,l=this.itemSize;a<l;a++)this.array[t+a]=e.array[o+a];return this}copyArray(t){return this.array.set(t),this}applyMatrix3(t){if(this.itemSize===2)for(let e=0,o=this.count;e<o;e++)Ol.fromBufferAttribute(this,e),Ol.applyMatrix3(t),this.setXY(e,Ol.x,Ol.y);else if(this.itemSize===3)for(let e=0,o=this.count;e<o;e++)Jn.fromBufferAttribute(this,e),Jn.applyMatrix3(t),this.setXYZ(e,Jn.x,Jn.y,Jn.z);return this}applyMatrix4(t){for(let e=0,o=this.count;e<o;e++)Jn.fromBufferAttribute(this,e),Jn.applyMatrix4(t),this.setXYZ(e,Jn.x,Jn.y,Jn.z);return this}applyNormalMatrix(t){for(let e=0,o=this.count;e<o;e++)Jn.fromBufferAttribute(this,e),Jn.applyNormalMatrix(t),this.setXYZ(e,Jn.x,Jn.y,Jn.z);return this}transformDirection(t){for(let e=0,o=this.count;e<o;e++)Jn.fromBufferAttribute(this,e),Jn.transformDirection(t),this.setXYZ(e,Jn.x,Jn.y,Jn.z);return this}set(t,e=0){return this.array.set(t,e),this}getComponent(t,e){let o=this.array[t*this.itemSize+e];return this.normalized&&(o=Tu(o,this.array)),o}setComponent(t,e,o){return this.normalized&&(o=si(o,this.array)),this.array[t*this.itemSize+e]=o,this}getX(t){let e=this.array[t*this.itemSize];return this.normalized&&(e=Tu(e,this.array)),e}setX(t,e){return this.normalized&&(e=si(e,this.array)),this.array[t*this.itemSize]=e,this}getY(t){let e=this.array[t*this.itemSize+1];return this.normalized&&(e=Tu(e,this.array)),e}setY(t,e){return this.normalized&&(e=si(e,this.array)),this.array[t*this.itemSize+1]=e,this}getZ(t){let e=this.array[t*this.itemSize+2];return this.normalized&&(e=Tu(e,this.array)),e}setZ(t,e){return this.normalized&&(e=si(e,this.array)),this.array[t*this.itemSize+2]=e,this}getW(t){let e=this.array[t*this.itemSize+3];return this.normalized&&(e=Tu(e,this.array)),e}setW(t,e){return this.normalized&&(e=si(e,this.array)),this.array[t*this.itemSize+3]=e,this}setXY(t,e,o){return t*=this.itemSize,this.normalized&&(e=si(e,this.array),o=si(o,this.array)),this.array[t+0]=e,this.array[t+1]=o,this}setXYZ(t,e,o,a){return t*=this.itemSize,this.normalized&&(e=si(e,this.array),o=si(o,this.array),a=si(a,this.array)),this.array[t+0]=e,this.array[t+1]=o,this.array[t+2]=a,this}setXYZW(t,e,o,a,l){return t*=this.itemSize,this.normalized&&(e=si(e,this.array),o=si(o,this.array),a=si(a,this.array),l=si(l,this.array)),this.array[t+0]=e,this.array[t+1]=o,this.array[t+2]=a,this.array[t+3]=l,this}onUpload(t){return this.onUploadCallback=t,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){let t={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return this.name!==""&&(t.name=this.name),this.usage!==lg&&(t.usage=this.usage),(this.updateRange.offset!==0||this.updateRange.count!==-1)&&(t.updateRange=this.updateRange),t}};var sc=class extends Di{constructor(t,e,o){super(new Uint16Array(t),e,o)}};var ac=class extends Di{constructor(t,e,o){super(new Uint32Array(t),e,o)}};var Ho=class extends Di{constructor(t,e,o){super(new Float32Array(t),e,o)}};var Yx=0,Li=new zr,th=new fo,ba=new mt,_i=new qs,Iu=new qs,dr=new mt,Xs=class r extends ds{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:Yx++}),this.uuid=zu(),this.name="",this.type="BufferGeometry",this.index=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(t){return Array.isArray(t)?this.index=new(a0(t)?ac:sc)(t,1):this.index=t,this}getAttribute(t){return this.attributes[t]}setAttribute(t,e){return this.attributes[t]=e,this}deleteAttribute(t){return delete this.attributes[t],this}hasAttribute(t){return this.attributes[t]!==void 0}addGroup(t,e,o=0){this.groups.push({start:t,count:e,materialIndex:o})}clearGroups(){this.groups=[]}setDrawRange(t,e){this.drawRange.start=t,this.drawRange.count=e}applyMatrix4(t){let e=this.attributes.position;e!==void 0&&(e.applyMatrix4(t),e.needsUpdate=!0);let o=this.attributes.normal;if(o!==void 0){let l=new ve().getNormalMatrix(t);o.applyNormalMatrix(l),o.needsUpdate=!0}let a=this.attributes.tangent;return a!==void 0&&(a.transformDirection(t),a.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(t){return Li.makeRotationFromQuaternion(t),this.applyMatrix4(Li),this}rotateX(t){return Li.makeRotationX(t),this.applyMatrix4(Li),this}rotateY(t){return Li.makeRotationY(t),this.applyMatrix4(Li),this}rotateZ(t){return Li.makeRotationZ(t),this.applyMatrix4(Li),this}translate(t,e,o){return Li.makeTranslation(t,e,o),this.applyMatrix4(Li),this}scale(t,e,o){return Li.makeScale(t,e,o),this.applyMatrix4(Li),this}lookAt(t){return th.lookAt(t),th.updateMatrix(),this.applyMatrix4(th.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(ba).negate(),this.translate(ba.x,ba.y,ba.z),this}setFromPoints(t){let e=[];for(let o=0,a=t.length;o<a;o++){let l=t[o];e.push(l.x,l.y,l.z||0)}return this.setAttribute("position",new Ho(e,3)),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new qs);let t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.isGLBufferAttribute){console.error(\'THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box. Alternatively set "mesh.frustumCulled" to "false".\',this),this.boundingBox.set(new mt(-1/0,-1/0,-1/0),new mt(1/0,1/0,1/0));return}if(t!==void 0){if(this.boundingBox.setFromBufferAttribute(t),e)for(let o=0,a=e.length;o<a;o++){let l=e[o];_i.setFromBufferAttribute(l),this.morphTargetsRelative?(dr.addVectors(this.boundingBox.min,_i.min),this.boundingBox.expandByPoint(dr),dr.addVectors(this.boundingBox.max,_i.max),this.boundingBox.expandByPoint(dr)):(this.boundingBox.expandByPoint(_i.min),this.boundingBox.expandByPoint(_i.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error(\'THREE.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 Fu);let t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.isGLBufferAttribute){console.error(\'THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere. Alternatively set "mesh.frustumCulled" to "false".\',this),this.boundingSphere.set(new mt,1/0);return}if(t){let o=this.boundingSphere.center;if(_i.setFromBufferAttribute(t),e)for(let l=0,f=e.length;l<f;l++){let h=e[l];Iu.setFromBufferAttribute(h),this.morphTargetsRelative?(dr.addVectors(_i.min,Iu.min),_i.expandByPoint(dr),dr.addVectors(_i.max,Iu.max),_i.expandByPoint(dr)):(_i.expandByPoint(Iu.min),_i.expandByPoint(Iu.max))}_i.getCenter(o);let a=0;for(let l=0,f=t.count;l<f;l++)dr.fromBufferAttribute(t,l),a=Math.max(a,o.distanceToSquared(dr));if(e)for(let l=0,f=e.length;l<f;l++){let h=e[l],p=this.morphTargetsRelative;for(let d=0,g=h.count;d<g;d++)dr.fromBufferAttribute(h,d),p&&(ba.fromBufferAttribute(t,d),dr.add(ba)),a=Math.max(a,o.distanceToSquared(dr))}this.boundingSphere.radius=Math.sqrt(a),isNaN(this.boundingSphere.radius)&&console.error(\'THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.\',this)}}computeTangents(){let t=this.index,e=this.attributes;if(t===null||e.position===void 0||e.normal===void 0||e.uv===void 0){console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}let o=t.array,a=e.position.array,l=e.normal.array,f=e.uv.array,h=a.length/3;this.hasAttribute("tangent")===!1&&this.setAttribute("tangent",new Di(new Float32Array(4*h),4));let p=this.getAttribute("tangent").array,d=[],g=[];for(let q=0;q<h;q++)d[q]=new mt,g[q]=new mt;let _=new mt,y=new mt,M=new mt,w=new fn,A=new fn,x=new fn,v=new mt,C=new mt;function S(q,nt,k){_.fromArray(a,q*3),y.fromArray(a,nt*3),M.fromArray(a,k*3),w.fromArray(f,q*2),A.fromArray(f,nt*2),x.fromArray(f,k*2),y.sub(_),M.sub(_),A.sub(w),x.sub(w);let xt=1/(A.x*x.y-x.x*A.y);isFinite(xt)&&(v.copy(y).multiplyScalar(x.y).addScaledVector(M,-A.y).multiplyScalar(xt),C.copy(M).multiplyScalar(A.x).addScaledVector(y,-x.x).multiplyScalar(xt),d[q].add(v),d[nt].add(v),d[k].add(v),g[q].add(C),g[nt].add(C),g[k].add(C))}let O=this.groups;O.length===0&&(O=[{start:0,count:o.length}]);for(let q=0,nt=O.length;q<nt;++q){let k=O[q],xt=k.start,X=k.count;for(let it=xt,vt=xt+X;it<vt;it+=3)S(o[it+0],o[it+1],o[it+2])}let F=new mt,G=new mt,z=new mt,L=new mt;function D(q){z.fromArray(l,q*3),L.copy(z);let nt=d[q];F.copy(nt),F.sub(z.multiplyScalar(z.dot(nt))).normalize(),G.crossVectors(L,nt);let xt=G.dot(g[q])<0?-1:1;p[q*4]=F.x,p[q*4+1]=F.y,p[q*4+2]=F.z,p[q*4+3]=xt}for(let q=0,nt=O.length;q<nt;++q){let k=O[q],xt=k.start,X=k.count;for(let it=xt,vt=xt+X;it<vt;it+=3)D(o[it+0]),D(o[it+1]),D(o[it+2])}}computeVertexNormals(){let t=this.index,e=this.getAttribute("position");if(e!==void 0){let o=this.getAttribute("normal");if(o===void 0)o=new Di(new Float32Array(e.count*3),3),this.setAttribute("normal",o);else for(let y=0,M=o.count;y<M;y++)o.setXYZ(y,0,0,0);let a=new mt,l=new mt,f=new mt,h=new mt,p=new mt,d=new mt,g=new mt,_=new mt;if(t)for(let y=0,M=t.count;y<M;y+=3){let w=t.getX(y+0),A=t.getX(y+1),x=t.getX(y+2);a.fromBufferAttribute(e,w),l.fromBufferAttribute(e,A),f.fromBufferAttribute(e,x),g.subVectors(f,l),_.subVectors(a,l),g.cross(_),h.fromBufferAttribute(o,w),p.fromBufferAttribute(o,A),d.fromBufferAttribute(o,x),h.add(g),p.add(g),d.add(g),o.setXYZ(w,h.x,h.y,h.z),o.setXYZ(A,p.x,p.y,p.z),o.setXYZ(x,d.x,d.y,d.z)}else for(let y=0,M=e.count;y<M;y+=3)a.fromBufferAttribute(e,y+0),l.fromBufferAttribute(e,y+1),f.fromBufferAttribute(e,y+2),g.subVectors(f,l),_.subVectors(a,l),g.cross(_),o.setXYZ(y+0,g.x,g.y,g.z),o.setXYZ(y+1,g.x,g.y,g.z),o.setXYZ(y+2,g.x,g.y,g.z);this.normalizeNormals(),o.needsUpdate=!0}}normalizeNormals(){let t=this.attributes.normal;for(let e=0,o=t.count;e<o;e++)dr.fromBufferAttribute(t,e),dr.normalize(),t.setXYZ(e,dr.x,dr.y,dr.z)}toNonIndexed(){function t(h,p){let d=h.array,g=h.itemSize,_=h.normalized,y=new d.constructor(p.length*g),M=0,w=0;for(let A=0,x=p.length;A<x;A++){h.isInterleavedBufferAttribute?M=p[A]*h.data.stride+h.offset:M=p[A]*g;for(let v=0;v<g;v++)y[w++]=d[M++]}return new Di(y,g,_)}if(this.index===null)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;let e=new r,o=this.index.array,a=this.attributes;for(let h in a){let p=a[h],d=t(p,o);e.setAttribute(h,d)}let l=this.morphAttributes;for(let h in l){let p=[],d=l[h];for(let g=0,_=d.length;g<_;g++){let y=d[g],M=t(y,o);p.push(M)}e.morphAttributes[h]=p}e.morphTargetsRelative=this.morphTargetsRelative;let f=this.groups;for(let h=0,p=f.length;h<p;h++){let d=f[h];e.addGroup(d.start,d.count,d.materialIndex)}return e}toJSON(){let t={metadata:{version:4.6,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(t.uuid=this.uuid,t.type=this.type,this.name!==""&&(t.name=this.name),Object.keys(this.userData).length>0&&(t.userData=this.userData),this.parameters!==void 0){let p=this.parameters;for(let d in p)p[d]!==void 0&&(t[d]=p[d]);return t}t.data={attributes:{}};let e=this.index;e!==null&&(t.data.index={type:e.array.constructor.name,array:Array.prototype.slice.call(e.array)});let o=this.attributes;for(let p in o){let d=o[p];t.data.attributes[p]=d.toJSON(t.data)}let a={},l=!1;for(let p in this.morphAttributes){let d=this.morphAttributes[p],g=[];for(let _=0,y=d.length;_<y;_++){let M=d[_];g.push(M.toJSON(t.data))}g.length>0&&(a[p]=g,l=!0)}l&&(t.data.morphAttributes=a,t.data.morphTargetsRelative=this.morphTargetsRelative);let f=this.groups;f.length>0&&(t.data.groups=JSON.parse(JSON.stringify(f)));let h=this.boundingSphere;return h!==null&&(t.data.boundingSphere={center:h.center.toArray(),radius:h.radius}),t}clone(){return new this.constructor().copy(this)}copy(t){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;let e={};this.name=t.name;let o=t.index;o!==null&&this.setIndex(o.clone(e));let a=t.attributes;for(let d in a){let g=a[d];this.setAttribute(d,g.clone(e))}let l=t.morphAttributes;for(let d in l){let g=[],_=l[d];for(let y=0,M=_.length;y<M;y++)g.push(_[y].clone(e));this.morphAttributes[d]=g}this.morphTargetsRelative=t.morphTargetsRelative;let f=t.groups;for(let d=0,g=f.length;d<g;d++){let _=f[d];this.addGroup(_.start,_.count,_.materialIndex)}let h=t.boundingBox;h!==null&&(this.boundingBox=h.clone());let p=t.boundingSphere;return p!==null&&(this.boundingSphere=p.clone()),this.drawRange.start=t.drawRange.start,this.drawRange.count=t.drawRange.count,this.userData=t.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}},Sg=new zr,Bs=new gh,Dl=new Fu,wg=new mt,Ta=new mt,Aa=new mt,Ca=new mt,eh=new mt,Fl=new mt,Ul=new fn,Bl=new fn,zl=new fn,bg=new mt,Tg=new mt,Ag=new mt,kl=new mt,Gl=new mt,co=class extends fo{constructor(t=new Xs,e=new oc){super(),this.isMesh=!0,this.type="Mesh",this.geometry=t,this.material=e,this.updateMorphTargets()}copy(t,e){return super.copy(t,e),t.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=t.morphTargetInfluences.slice()),t.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},t.morphTargetDictionary)),this.material=Array.isArray(t.material)?t.material.slice():t.material,this.geometry=t.geometry,this}updateMorphTargets(){let e=this.geometry.morphAttributes,o=Object.keys(e);if(o.length>0){let a=e[o[0]];if(a!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let l=0,f=a.length;l<f;l++){let h=a[l].name||String(l);this.morphTargetInfluences.push(0),this.morphTargetDictionary[h]=l}}}}getVertexPosition(t,e){let o=this.geometry,a=o.attributes.position,l=o.morphAttributes.position,f=o.morphTargetsRelative;e.fromBufferAttribute(a,t);let h=this.morphTargetInfluences;if(l&&h){Fl.set(0,0,0);for(let p=0,d=l.length;p<d;p++){let g=h[p],_=l[p];g!==0&&(eh.fromBufferAttribute(_,t),f?Fl.addScaledVector(eh,g):Fl.addScaledVector(eh.sub(e),g))}e.add(Fl)}return e}raycast(t,e){let o=this.geometry,a=this.material,l=this.matrixWorld;a!==void 0&&(o.boundingSphere===null&&o.computeBoundingSphere(),Dl.copy(o.boundingSphere),Dl.applyMatrix4(l),Bs.copy(t.ray).recast(t.near),!(Dl.containsPoint(Bs.origin)===!1&&(Bs.intersectSphere(Dl,wg)===null||Bs.origin.distanceToSquared(wg)>(t.far-t.near)**2))&&(Sg.copy(l).invert(),Bs.copy(t.ray).applyMatrix4(Sg),!(o.boundingBox!==null&&Bs.intersectsBox(o.boundingBox)===!1)&&this._computeIntersections(t,e,Bs)))}_computeIntersections(t,e,o){let a,l=this.geometry,f=this.material,h=l.index,p=l.attributes.position,d=l.attributes.uv,g=l.attributes.uv1,_=l.attributes.normal,y=l.groups,M=l.drawRange;if(h!==null)if(Array.isArray(f))for(let w=0,A=y.length;w<A;w++){let x=y[w],v=f[x.materialIndex],C=Math.max(x.start,M.start),S=Math.min(h.count,Math.min(x.start+x.count,M.start+M.count));for(let O=C,F=S;O<F;O+=3){let G=h.getX(O),z=h.getX(O+1),L=h.getX(O+2);a=Vl(this,v,t,o,d,g,_,G,z,L),a&&(a.faceIndex=Math.floor(O/3),a.face.materialIndex=x.materialIndex,e.push(a))}}else{let w=Math.max(0,M.start),A=Math.min(h.count,M.start+M.count);for(let x=w,v=A;x<v;x+=3){let C=h.getX(x),S=h.getX(x+1),O=h.getX(x+2);a=Vl(this,f,t,o,d,g,_,C,S,O),a&&(a.faceIndex=Math.floor(x/3),e.push(a))}}else if(p!==void 0)if(Array.isArray(f))for(let w=0,A=y.length;w<A;w++){let x=y[w],v=f[x.materialIndex],C=Math.max(x.start,M.start),S=Math.min(p.count,Math.min(x.start+x.count,M.start+M.count));for(let O=C,F=S;O<F;O+=3){let G=O,z=O+1,L=O+2;a=Vl(this,v,t,o,d,g,_,G,z,L),a&&(a.faceIndex=Math.floor(O/3),a.face.materialIndex=x.materialIndex,e.push(a))}}else{let w=Math.max(0,M.start),A=Math.min(p.count,M.start+M.count);for(let x=w,v=A;x<v;x+=3){let C=x,S=x+1,O=x+2;a=Vl(this,f,t,o,d,g,_,C,S,O),a&&(a.faceIndex=Math.floor(x/3),e.push(a))}}}};function Zx(r,t,e,o,a,l,f,h){let p;if(t.side===ui?p=o.intersectTriangle(f,l,a,!0,h):p=o.intersectTriangle(a,l,f,t.side===ps,h),p===null)return null;Gl.copy(h),Gl.applyMatrix4(r.matrixWorld);let d=e.ray.origin.distanceTo(Gl);return d<e.near||d>e.far?null:{distance:d,point:Gl.clone(),object:r}}function Vl(r,t,e,o,a,l,f,h,p,d){r.getVertexPosition(h,Ta),r.getVertexPosition(p,Aa),r.getVertexPosition(d,Ca);let g=Zx(r,t,e,o,Ta,Aa,Ca,kl);if(g){a&&(Ul.fromBufferAttribute(a,h),Bl.fromBufferAttribute(a,p),zl.fromBufferAttribute(a,d),g.uv=Na.getInterpolation(kl,Ta,Aa,Ca,Ul,Bl,zl,new fn)),l&&(Ul.fromBufferAttribute(l,h),Bl.fromBufferAttribute(l,p),zl.fromBufferAttribute(l,d),g.uv1=Na.getInterpolation(kl,Ta,Aa,Ca,Ul,Bl,zl,new fn),g.uv2=g.uv1),f&&(bg.fromBufferAttribute(f,h),Tg.fromBufferAttribute(f,p),Ag.fromBufferAttribute(f,d),g.normal=Na.getInterpolation(kl,Ta,Aa,Ca,bg,Tg,Ag,new mt),g.normal.dot(o.direction)>0&&g.normal.multiplyScalar(-1));let _={a:h,b:p,c:d,normal:new mt,materialIndex:0};Na.getNormal(Ta,Aa,Ca,_.normal),g.face=_}return g}var Uu=class r extends Xs{constructor(t=1,e=1,o=1,a=1,l=1,f=1){super(),this.type="BoxGeometry",this.parameters={width:t,height:e,depth:o,widthSegments:a,heightSegments:l,depthSegments:f};let h=this;a=Math.floor(a),l=Math.floor(l),f=Math.floor(f);let p=[],d=[],g=[],_=[],y=0,M=0;w("z","y","x",-1,-1,o,e,t,f,l,0),w("z","y","x",1,-1,o,e,-t,f,l,1),w("x","z","y",1,1,t,o,e,a,f,2),w("x","z","y",1,-1,t,o,-e,a,f,3),w("x","y","z",1,-1,t,e,o,a,l,4),w("x","y","z",-1,-1,t,e,-o,a,l,5),this.setIndex(p),this.setAttribute("position",new Ho(d,3)),this.setAttribute("normal",new Ho(g,3)),this.setAttribute("uv",new Ho(_,2));function w(A,x,v,C,S,O,F,G,z,L,D){let q=O/z,nt=F/L,k=O/2,xt=F/2,X=G/2,it=z+1,vt=L+1,pt=0,et=0,ot=new mt;for(let V=0;V<vt;V++){let K=V*nt-xt;for(let at=0;at<it;at++){let Tt=at*q-k;ot[A]=Tt*C,ot[x]=K*S,ot[v]=X,d.push(ot.x,ot.y,ot.z),ot[A]=0,ot[x]=0,ot[v]=G>0?1:-1,g.push(ot.x,ot.y,ot.z),_.push(at/z),_.push(1-V/L),pt+=1}}for(let V=0;V<L;V++)for(let K=0;K<z;K++){let at=y+K+it*V,Tt=y+K+it*(V+1),dt=y+(K+1)+it*(V+1),Ct=y+(K+1)+it*V;p.push(at,Tt,Ct),p.push(Tt,dt,Ct),et+=6}h.addGroup(M,et,D),M+=et,y+=pt}}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new r(t.width,t.height,t.depth,t.widthSegments,t.heightSegments,t.depthSegments)}};function Ha(r){let t={};for(let e in r){t[e]={};for(let o in r[e]){let a=r[e][o];a&&(a.isColor||a.isMatrix3||a.isMatrix4||a.isVector2||a.isVector3||a.isVector4||a.isTexture||a.isQuaternion)?a.isRenderTargetTexture?(console.warn("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),t[e][o]=null):t[e][o]=a.clone():Array.isArray(a)?t[e][o]=a.slice():t[e][o]=a}}return t}function Jr(r){let t={};for(let e=0;e<r.length;e++){let o=Ha(r[e]);for(let a in o)t[a]=o[a]}return t}function Jx(r){let t=[];for(let e=0;e<r.length;e++)t.push(r[e].clone());return t}function l0(r){return r.getRenderTarget()===null?r.outputColorSpace:gn.workingColorSpace}var $x={clone:Ha,merge:Jr},Kx=`void main() {\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}`,jx=`void main() {\n gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}`,Xo=class extends Va{constructor(t){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=Kx,this.fragmentShader=jx,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.forceSinglePass=!0,this.extensions={derivatives:!1,fragDepth:!1,drawBuffers:!1,shaderTextureLOD:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv1:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,t!==void 0&&this.setValues(t)}copy(t){return super.copy(t),this.fragmentShader=t.fragmentShader,this.vertexShader=t.vertexShader,this.uniforms=Ha(t.uniforms),this.uniformsGroups=Jx(t.uniformsGroups),this.defines=Object.assign({},t.defines),this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.fog=t.fog,this.lights=t.lights,this.clipping=t.clipping,this.extensions=Object.assign({},t.extensions),this.glslVersion=t.glslVersion,this}toJSON(t){let e=super.toJSON(t);e.glslVersion=this.glslVersion,e.uniforms={};for(let a in this.uniforms){let f=this.uniforms[a].value;f&&f.isTexture?e.uniforms[a]={type:"t",value:f.toJSON(t).uuid}:f&&f.isColor?e.uniforms[a]={type:"c",value:f.getHex()}:f&&f.isVector2?e.uniforms[a]={type:"v2",value:f.toArray()}:f&&f.isVector3?e.uniforms[a]={type:"v3",value:f.toArray()}:f&&f.isVector4?e.uniforms[a]={type:"v4",value:f.toArray()}:f&&f.isMatrix3?e.uniforms[a]={type:"m3",value:f.toArray()}:f&&f.isMatrix4?e.uniforms[a]={type:"m4",value:f.toArray()}:e.uniforms[a]={value:f}}Object.keys(this.defines).length>0&&(e.defines=this.defines),e.vertexShader=this.vertexShader,e.fragmentShader=this.fragmentShader,e.lights=this.lights,e.clipping=this.clipping;let o={};for(let a in this.extensions)this.extensions[a]===!0&&(o[a]=!0);return Object.keys(o).length>0&&(e.extensions=o),e}},uc=class extends fo{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new zr,this.projectionMatrix=new zr,this.projectionMatrixInverse=new zr,this.coordinateSystem=Vo}copy(t,e){return super.copy(t,e),this.matrixWorldInverse.copy(t.matrixWorldInverse),this.projectionMatrix.copy(t.projectionMatrix),this.projectionMatrixInverse.copy(t.projectionMatrixInverse),this.coordinateSystem=t.coordinateSystem,this}getWorldDirection(t){return super.getWorldDirection(t).negate()}updateMatrixWorld(t){super.updateMatrixWorld(t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(t,e){super.updateWorldMatrix(t,e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}},xi=class extends uc{constructor(t=50,e=1,o=.1,a=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=t,this.zoom=1,this.near=o,this.far=a,this.focus=10,this.aspect=e,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(t,e){return super.copy(t,e),this.fov=t.fov,this.zoom=t.zoom,this.near=t.near,this.far=t.far,this.focus=t.focus,this.aspect=t.aspect,this.view=t.view===null?null:Object.assign({},t.view),this.filmGauge=t.filmGauge,this.filmOffset=t.filmOffset,this}setFocalLength(t){let e=.5*this.getFilmHeight()/t;this.fov=hh*2*Math.atan(e),this.updateProjectionMatrix()}getFocalLength(){let t=Math.tan(Bf*.5*this.fov);return .5*this.getFilmHeight()/t}getEffectiveFOV(){return hh*2*Math.atan(Math.tan(Bf*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}setViewOffset(t,e,o,a,l,f){this.aspect=t/e,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=t,this.view.fullHeight=e,this.view.offsetX=o,this.view.offsetY=a,this.view.width=l,this.view.height=f,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){let t=this.near,e=t*Math.tan(Bf*.5*this.fov)/this.zoom,o=2*e,a=this.aspect*o,l=-.5*a,f=this.view;if(this.view!==null&&this.view.enabled){let p=f.fullWidth,d=f.fullHeight;l+=f.offsetX*a/p,e-=f.offsetY*o/d,a*=f.width/p,o*=f.height/d}let h=this.filmOffset;h!==0&&(l+=t*h/this.getFilmWidth()),this.projectionMatrix.makePerspective(l,l+a,e,e-o,t,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(t){let e=super.toJSON(t);return e.object.fov=this.fov,e.object.zoom=this.zoom,e.object.near=this.near,e.object.far=this.far,e.object.focus=this.focus,e.object.aspect=this.aspect,this.view!==null&&(e.object.view=Object.assign({},this.view)),e.object.filmGauge=this.filmGauge,e.object.filmOffset=this.filmOffset,e}},Pa=-90,Ia=1,yh=class extends fo{constructor(t,e,o){super(),this.type="CubeCamera",this.renderTarget=o,this.coordinateSystem=null,this.activeMipmapLevel=0;let a=new xi(Pa,Ia,t,e);a.layers=this.layers,this.add(a);let l=new xi(Pa,Ia,t,e);l.layers=this.layers,this.add(l);let f=new xi(Pa,Ia,t,e);f.layers=this.layers,this.add(f);let h=new xi(Pa,Ia,t,e);h.layers=this.layers,this.add(h);let p=new xi(Pa,Ia,t,e);p.layers=this.layers,this.add(p);let d=new xi(Pa,Ia,t,e);d.layers=this.layers,this.add(d)}updateCoordinateSystem(){let t=this.coordinateSystem,e=this.children.concat(),[o,a,l,f,h,p]=e;for(let d of e)this.remove(d);if(t===Vo)o.up.set(0,1,0),o.lookAt(1,0,0),a.up.set(0,1,0),a.lookAt(-1,0,0),l.up.set(0,0,-1),l.lookAt(0,1,0),f.up.set(0,0,1),f.lookAt(0,-1,0),h.up.set(0,1,0),h.lookAt(0,0,1),p.up.set(0,1,0),p.lookAt(0,0,-1);else if(t===jl)o.up.set(0,-1,0),o.lookAt(-1,0,0),a.up.set(0,-1,0),a.lookAt(1,0,0),l.up.set(0,0,1),l.lookAt(0,1,0),f.up.set(0,0,-1),f.lookAt(0,-1,0),h.up.set(0,-1,0),h.lookAt(0,0,1),p.up.set(0,-1,0),p.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+t);for(let d of e)this.add(d),d.updateMatrixWorld()}update(t,e){this.parent===null&&this.updateMatrixWorld();let{renderTarget:o,activeMipmapLevel:a}=this;this.coordinateSystem!==t.coordinateSystem&&(this.coordinateSystem=t.coordinateSystem,this.updateCoordinateSystem());let[l,f,h,p,d,g]=this.children,_=t.getRenderTarget(),y=t.getActiveCubeFace(),M=t.getActiveMipmapLevel(),w=t.xr.enabled;t.xr.enabled=!1;let A=o.texture.generateMipmaps;o.texture.generateMipmaps=!1,t.setRenderTarget(o,0,a),t.render(e,l),t.setRenderTarget(o,1,a),t.render(e,f),t.setRenderTarget(o,2,a),t.render(e,h),t.setRenderTarget(o,3,a),t.render(e,p),t.setRenderTarget(o,4,a),t.render(e,d),o.texture.generateMipmaps=A,t.setRenderTarget(o,5,a),t.render(e,g),t.setRenderTarget(_,y,M),t.xr.enabled=w,o.texture.needsPMREMUpdate=!0}},lc=class extends Ki{constructor(t,e,o,a,l,f,h,p,d,g){t=t!==void 0?t:[],e=e!==void 0?e:za,super(t,e,o,a,l,f,h,p,d,g),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(t){this.image=t}},vh=class extends qo{constructor(t=1,e={}){super(t,t,e),this.isWebGLCubeRenderTarget=!0;let o={width:t,height:t,depth:1},a=[o,o,o,o,o,o];e.encoding!==void 0&&(Lu("THREE.WebGLCubeRenderTarget: option.encoding has been replaced by option.colorSpace."),e.colorSpace=e.encoding===Ws?br:Oi),this.texture=new lc(a,e.mapping,e.wrapS,e.wrapT,e.magFilter,e.minFilter,e.format,e.type,e.anisotropy,e.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=e.generateMipmaps!==void 0?e.generateMipmaps:!1,this.texture.minFilter=e.minFilter!==void 0?e.minFilter:Ni}fromEquirectangularTexture(t,e){this.texture.type=e.type,this.texture.colorSpace=e.colorSpace,this.texture.generateMipmaps=e.generateMipmaps,this.texture.minFilter=e.minFilter,this.texture.magFilter=e.magFilter;let o={uniforms:{tEquirect:{value:null}},vertexShader:`\n\n varying vec3 vWorldDirection;\n\n vec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\n return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n\n }\n\n void main() {\n\n vWorldDirection = transformDirection( position, modelMatrix );\n\n #include <begin_vertex>\n #include <project_vertex>\n\n }\n `,fragmentShader:`\n\n uniform sampler2D tEquirect;\n\n varying vec3 vWorldDirection;\n\n #include <common>\n\n void main() {\n\n vec3 direction = normalize( vWorldDirection );\n\n vec2 sampleUV = equirectUv( direction );\n\n gl_FragColor = texture2D( tEquirect, sampleUV );\n\n }\n `},a=new Uu(5,5,5),l=new Xo({name:"CubemapFromEquirect",uniforms:Ha(o.uniforms),vertexShader:o.vertexShader,fragmentShader:o.fragmentShader,side:ui,blending:cs});l.uniforms.tEquirect.value=e;let f=new co(a,l),h=e.minFilter;return e.minFilter===Ou&&(e.minFilter=Ni),new yh(1,10,this).update(t,f),e.minFilter=h,f.geometry.dispose(),f.material.dispose(),this}clear(t,e,o,a){let l=t.getRenderTarget();for(let f=0;f<6;f++)t.setRenderTarget(this,f),t.clear(e,o,a);t.setRenderTarget(l)}},nh=new mt,Qx=new mt,tE=new ve,ko=class{constructor(t=new mt(1,0,0),e=0){this.isPlane=!0,this.normal=t,this.constant=e}set(t,e){return this.normal.copy(t),this.constant=e,this}setComponents(t,e,o,a){return this.normal.set(t,e,o),this.constant=a,this}setFromNormalAndCoplanarPoint(t,e){return this.normal.copy(t),this.constant=-e.dot(this.normal),this}setFromCoplanarPoints(t,e,o){let a=nh.subVectors(o,e).cross(Qx.subVectors(t,e)).normalize();return this.setFromNormalAndCoplanarPoint(a,t),this}copy(t){return this.normal.copy(t.normal),this.constant=t.constant,this}normalize(){let t=1/this.normal.length();return this.normal.multiplyScalar(t),this.constant*=t,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(t){return this.normal.dot(t)+this.constant}distanceToSphere(t){return this.distanceToPoint(t.center)-t.radius}projectPoint(t,e){return e.copy(t).addScaledVector(this.normal,-this.distanceToPoint(t))}intersectLine(t,e){let o=t.delta(nh),a=this.normal.dot(o);if(a===0)return this.distanceToPoint(t.start)===0?e.copy(t.start):null;let l=-(t.start.dot(this.normal)+this.constant)/a;return l<0||l>1?null:e.copy(t.start).addScaledVector(o,l)}intersectsLine(t){let e=this.distanceToPoint(t.start),o=this.distanceToPoint(t.end);return e<0&&o>0||o<0&&e>0}intersectsBox(t){return t.intersectsPlane(this)}intersectsSphere(t){return t.intersectsPlane(this)}coplanarPoint(t){return t.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(t,e){let o=e||tE.getNormalMatrix(t),a=this.coplanarPoint(nh).applyMatrix4(t),l=this.normal.applyMatrix3(o).normalize();return this.constant=-a.dot(l),this}translate(t){return this.constant-=t.dot(this.normal),this}equals(t){return t.normal.equals(this.normal)&&t.constant===this.constant}clone(){return new this.constructor().copy(this)}},zs=new Fu,Hl=new mt,cc=class{constructor(t=new ko,e=new ko,o=new ko,a=new ko,l=new ko,f=new ko){this.planes=[t,e,o,a,l,f]}set(t,e,o,a,l,f){let h=this.planes;return h[0].copy(t),h[1].copy(e),h[2].copy(o),h[3].copy(a),h[4].copy(l),h[5].copy(f),this}copy(t){let e=this.planes;for(let o=0;o<6;o++)e[o].copy(t.planes[o]);return this}setFromProjectionMatrix(t,e=Vo){let o=this.planes,a=t.elements,l=a[0],f=a[1],h=a[2],p=a[3],d=a[4],g=a[5],_=a[6],y=a[7],M=a[8],w=a[9],A=a[10],x=a[11],v=a[12],C=a[13],S=a[14],O=a[15];if(o[0].setComponents(p-l,y-d,x-M,O-v).normalize(),o[1].setComponents(p+l,y+d,x+M,O+v).normalize(),o[2].setComponents(p+f,y+g,x+w,O+C).normalize(),o[3].setComponents(p-f,y-g,x-w,O-C).normalize(),o[4].setComponents(p-h,y-_,x-A,O-S).normalize(),e===Vo)o[5].setComponents(p+h,y+_,x+A,O+S).normalize();else if(e===jl)o[5].setComponents(h,_,A,S).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+e);return this}intersectsObject(t){if(t.boundingSphere!==void 0)t.boundingSphere===null&&t.computeBoundingSphere(),zs.copy(t.boundingSphere).applyMatrix4(t.matrixWorld);else{let e=t.geometry;e.boundingSphere===null&&e.computeBoundingSphere(),zs.copy(e.boundingSphere).applyMatrix4(t.matrixWorld)}return this.intersectsSphere(zs)}intersectsSprite(t){return zs.center.set(0,0,0),zs.radius=.7071067811865476,zs.applyMatrix4(t.matrixWorld),this.intersectsSphere(zs)}intersectsSphere(t){let e=this.planes,o=t.center,a=-t.radius;for(let l=0;l<6;l++)if(e[l].distanceToPoint(o)<a)return!1;return!0}intersectsBox(t){let e=this.planes;for(let o=0;o<6;o++){let a=e[o];if(Hl.x=a.normal.x>0?t.max.x:t.min.x,Hl.y=a.normal.y>0?t.max.y:t.min.y,Hl.z=a.normal.z>0?t.max.z:t.min.z,a.distanceToPoint(Hl)<0)return!1}return!0}containsPoint(t){let e=this.planes;for(let o=0;o<6;o++)if(e[o].distanceToPoint(t)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}};function c0(){let r=null,t=!1,e=null,o=null;function a(l,f){e(l,f),o=r.requestAnimationFrame(a)}return{start:function(){t!==!0&&e!==null&&(o=r.requestAnimationFrame(a),t=!0)},stop:function(){r.cancelAnimationFrame(o),t=!1},setAnimationLoop:function(l){e=l},setContext:function(l){r=l}}}function eE(r,t){let e=t.isWebGL2,o=new WeakMap;function a(d,g){let _=d.array,y=d.usage,M=r.createBuffer();r.bindBuffer(g,M),r.bufferData(g,_,y),d.onUploadCallback();let w;if(_ instanceof Float32Array)w=r.FLOAT;else if(_ instanceof Uint16Array)if(d.isFloat16BufferAttribute)if(e)w=r.HALF_FLOAT;else throw new Error("THREE.WebGLAttributes: Usage of Float16BufferAttribute requires WebGL2.");else w=r.UNSIGNED_SHORT;else if(_ instanceof Int16Array)w=r.SHORT;else if(_ instanceof Uint32Array)w=r.UNSIGNED_INT;else if(_ instanceof Int32Array)w=r.INT;else if(_ instanceof Int8Array)w=r.BYTE;else if(_ instanceof Uint8Array)w=r.UNSIGNED_BYTE;else if(_ instanceof Uint8ClampedArray)w=r.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+_);return{buffer:M,type:w,bytesPerElement:_.BYTES_PER_ELEMENT,version:d.version}}function l(d,g,_){let y=g.array,M=g.updateRange;r.bindBuffer(_,d),M.count===-1?r.bufferSubData(_,0,y):(e?r.bufferSubData(_,M.offset*y.BYTES_PER_ELEMENT,y,M.offset,M.count):r.bufferSubData(_,M.offset*y.BYTES_PER_ELEMENT,y.subarray(M.offset,M.offset+M.count)),M.count=-1),g.onUploadCallback()}function f(d){return d.isInterleavedBufferAttribute&&(d=d.data),o.get(d)}function h(d){d.isInterleavedBufferAttribute&&(d=d.data);let g=o.get(d);g&&(r.deleteBuffer(g.buffer),o.delete(d))}function p(d,g){if(d.isGLBufferAttribute){let y=o.get(d);(!y||y.version<d.version)&&o.set(d,{buffer:d.buffer,type:d.type,bytesPerElement:d.elementSize,version:d.version});return}d.isInterleavedBufferAttribute&&(d=d.data);let _=o.get(d);_===void 0?o.set(d,a(d,g)):_.version<d.version&&(l(_.buffer,d,g),_.version=d.version)}return{get:f,remove:h,update:p}}var _h=class r extends Xs{constructor(t=1,e=1,o=1,a=1){super(),this.type="PlaneGeometry",this.parameters={width:t,height:e,widthSegments:o,heightSegments:a};let l=t/2,f=e/2,h=Math.floor(o),p=Math.floor(a),d=h+1,g=p+1,_=t/h,y=e/p,M=[],w=[],A=[],x=[];for(let v=0;v<g;v++){let C=v*y-f;for(let S=0;S<d;S++){let O=S*_-l;w.push(O,-C,0),A.push(0,0,1),x.push(S/h),x.push(1-v/p)}}for(let v=0;v<p;v++)for(let C=0;C<h;C++){let S=C+d*v,O=C+d*(v+1),F=C+1+d*(v+1),G=C+1+d*v;M.push(S,O,G),M.push(O,F,G)}this.setIndex(M),this.setAttribute("position",new Ho(w,3)),this.setAttribute("normal",new Ho(A,3)),this.setAttribute("uv",new Ho(x,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new r(t.width,t.height,t.widthSegments,t.heightSegments)}},nE=`#ifdef USE_ALPHAHASH\n if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;\n#endif`,rE=`#ifdef USE_ALPHAHASH\n const float ALPHA_HASH_SCALE = 0.05;\n float hash2D( vec2 value ) {\n return fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) );\n }\n float hash3D( vec3 value ) {\n return hash2D( vec2( hash2D( value.xy ), value.z ) );\n }\n float getAlphaHashThreshold( vec3 position ) {\n float maxDeriv = max(\n length( dFdx( position.xyz ) ),\n length( dFdy( position.xyz ) )\n );\n float pixScale = 1.0 / ( ALPHA_HASH_SCALE * maxDeriv );\n vec2 pixScales = vec2(\n exp2( floor( log2( pixScale ) ) ),\n exp2( ceil( log2( pixScale ) ) )\n );\n vec2 alpha = vec2(\n hash3D( floor( pixScales.x * position.xyz ) ),\n hash3D( floor( pixScales.y * position.xyz ) )\n );\n float lerpFactor = fract( log2( pixScale ) );\n float x = ( 1.0 - lerpFactor ) * alpha.x + lerpFactor * alpha.y;\n float a = min( lerpFactor, 1.0 - lerpFactor );\n vec3 cases = vec3(\n x * x / ( 2.0 * a * ( 1.0 - a ) ),\n ( x - 0.5 * a ) / ( 1.0 - a ),\n 1.0 - ( ( 1.0 - x ) * ( 1.0 - x ) / ( 2.0 * a * ( 1.0 - a ) ) )\n );\n float threshold = ( x < ( 1.0 - a ) )\n ? ( ( x < a ) ? cases.x : cases.y )\n : cases.z;\n return clamp( threshold , 1.0e-6, 1.0 );\n }\n#endif`,iE=`#ifdef USE_ALPHAMAP\n diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;\n#endif`,oE=`#ifdef USE_ALPHAMAP\n uniform sampler2D alphaMap;\n#endif`,sE=`#ifdef USE_ALPHATEST\n if ( diffuseColor.a < alphaTest ) discard;\n#endif`,aE=`#ifdef USE_ALPHATEST\n uniform float alphaTest;\n#endif`,uE=`#ifdef USE_AOMAP\n float ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;\n reflectedLight.indirectDiffuse *= ambientOcclusion;\n #if defined( USE_ENVMAP ) && defined( STANDARD )\n float dotNV = saturate( dot( geometryNormal, geometryViewDir ) );\n reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );\n #endif\n#endif`,lE=`#ifdef USE_AOMAP\n uniform sampler2D aoMap;\n uniform float aoMapIntensity;\n#endif`,cE=`vec3 transformed = vec3( position );\n#ifdef USE_ALPHAHASH\n vPosition = vec3( position );\n#endif`,fE=`vec3 objectNormal = vec3( normal );\n#ifdef USE_TANGENT\n vec3 objectTangent = vec3( tangent.xyz );\n#endif`,hE=`float G_BlinnPhong_Implicit( ) {\n return 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n return RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {\n vec3 halfDir = normalize( lightDir + viewDir );\n float dotNH = saturate( dot( normal, halfDir ) );\n float dotVH = saturate( dot( viewDir, halfDir ) );\n vec3 F = F_Schlick( specularColor, 1.0, dotVH );\n float G = G_BlinnPhong_Implicit( );\n float D = D_BlinnPhong( shininess, dotNH );\n return F * ( G * D );\n} // validated`,pE=`#ifdef USE_IRIDESCENCE\n const mat3 XYZ_TO_REC709 = mat3(\n 3.2404542, -0.9692660, 0.0556434,\n -1.5371385, 1.8760108, -0.2040259,\n -0.4985314, 0.0415560, 1.0572252\n );\n vec3 Fresnel0ToIor( vec3 fresnel0 ) {\n vec3 sqrtF0 = sqrt( fresnel0 );\n return ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 );\n }\n vec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) {\n return pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) );\n }\n float IorToFresnel0( float transmittedIor, float incidentIor ) {\n return pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor ));\n }\n vec3 evalSensitivity( float OPD, vec3 shift ) {\n float phase = 2.0 * PI * OPD * 1.0e-9;\n vec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 );\n vec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 );\n vec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 );\n vec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var );\n 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 ) );\n xyz /= 1.0685e-7;\n vec3 rgb = XYZ_TO_REC709 * xyz;\n return rgb;\n }\n vec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) {\n vec3 I;\n float iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );\n float sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) );\n float cosTheta2Sq = 1.0 - sinTheta2Sq;\n if ( cosTheta2Sq < 0.0 ) {\n return vec3( 1.0 );\n }\n float cosTheta2 = sqrt( cosTheta2Sq );\n float R0 = IorToFresnel0( iridescenceIOR, outsideIOR );\n float R12 = F_Schlick( R0, 1.0, cosTheta1 );\n float T121 = 1.0 - R12;\n float phi12 = 0.0;\n if ( iridescenceIOR < outsideIOR ) phi12 = PI;\n float phi21 = PI - phi12;\n vec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) ); vec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR );\n vec3 R23 = F_Schlick( R1, 1.0, cosTheta2 );\n vec3 phi23 = vec3( 0.0 );\n if ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI;\n if ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI;\n if ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI;\n float OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2;\n vec3 phi = vec3( phi21 ) + phi23;\n vec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 );\n vec3 r123 = sqrt( R123 );\n vec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 );\n vec3 C0 = R12 + Rs;\n I = C0;\n vec3 Cm = Rs - T121;\n for ( int m = 1; m <= 2; ++ m ) {\n Cm *= r123;\n vec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi );\n I += Cm * Sm;\n }\n return max( I, vec3( 0.0 ) );\n }\n#endif`,dE=`#ifdef USE_BUMPMAP\n uniform sampler2D bumpMap;\n uniform float bumpScale;\n vec2 dHdxy_fwd() {\n vec2 dSTdx = dFdx( vBumpMapUv );\n vec2 dSTdy = dFdy( vBumpMapUv );\n float Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x;\n float dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll;\n float dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll;\n return vec2( dBx, dBy );\n }\n vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {\n vec3 vSigmaX = dFdx( surf_pos.xyz );\n vec3 vSigmaY = dFdy( surf_pos.xyz );\n vec3 vN = surf_norm;\n vec3 R1 = cross( vSigmaY, vN );\n vec3 R2 = cross( vN, vSigmaX );\n float fDet = dot( vSigmaX, R1 ) * faceDirection;\n vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n return normalize( abs( fDet ) * surf_norm - vGrad );\n }\n#endif`,mE=`#if NUM_CLIPPING_PLANES > 0\n vec4 plane;\n #pragma unroll_loop_start\n for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n plane = clippingPlanes[ i ];\n if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;\n }\n #pragma unroll_loop_end\n #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n bool clipped = true;\n #pragma unroll_loop_start\n for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n plane = clippingPlanes[ i ];\n clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;\n }\n #pragma unroll_loop_end\n if ( clipped ) discard;\n #endif\n#endif`,gE=`#if NUM_CLIPPING_PLANES > 0\n varying vec3 vClipPosition;\n uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif`,yE=`#if NUM_CLIPPING_PLANES > 0\n varying vec3 vClipPosition;\n#endif`,vE=`#if NUM_CLIPPING_PLANES > 0\n vClipPosition = - mvPosition.xyz;\n#endif`,_E=`#if defined( USE_COLOR_ALPHA )\n diffuseColor *= vColor;\n#elif defined( USE_COLOR )\n diffuseColor.rgb *= vColor;\n#endif`,xE=`#if defined( USE_COLOR_ALPHA )\n varying vec4 vColor;\n#elif defined( USE_COLOR )\n varying vec3 vColor;\n#endif`,EE=`#if defined( USE_COLOR_ALPHA )\n varying vec4 vColor;\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n varying vec3 vColor;\n#endif`,ME=`#if defined( USE_COLOR_ALPHA )\n vColor = vec4( 1.0 );\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n vColor = vec3( 1.0 );\n#endif\n#ifdef USE_COLOR\n vColor *= color;\n#endif\n#ifdef USE_INSTANCING_COLOR\n vColor.xyz *= instanceColor.xyz;\n#endif`,SE=`#define PI 3.141592653589793\n#define PI2 6.283185307179586\n#define PI_HALF 1.5707963267948966\n#define RECIPROCAL_PI 0.3183098861837907\n#define RECIPROCAL_PI2 0.15915494309189535\n#define EPSILON 1e-6\n#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement( a ) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nvec3 pow2( const in vec3 x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }\nfloat average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }\nhighp float rand( const in vec2 uv ) {\n const highp float a = 12.9898, b = 78.233, c = 43758.5453;\n highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n return fract( sin( sn ) * c );\n}\n#ifdef HIGH_PRECISION\n float precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n float precisionSafeLength( vec3 v ) {\n float maxComponent = max3( abs( v ) );\n return length( v / maxComponent ) * maxComponent;\n }\n#endif\nstruct IncidentLight {\n vec3 color;\n vec3 direction;\n bool visible;\n};\nstruct ReflectedLight {\n vec3 directDiffuse;\n vec3 directSpecular;\n vec3 indirectDiffuse;\n vec3 indirectSpecular;\n};\n#ifdef USE_ALPHAHASH\n varying vec3 vPosition;\n#endif\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nmat3 transposeMat3( const in mat3 m ) {\n mat3 tmp;\n tmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\n tmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\n tmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\n return tmp;\n}\nfloat luminance( const in vec3 rgb ) {\n const vec3 weights = vec3( 0.2126729, 0.7151522, 0.0721750 );\n return dot( weights, rgb );\n}\nbool isPerspectiveMatrix( mat4 m ) {\n return m[ 2 ][ 3 ] == - 1.0;\n}\nvec2 equirectUv( in vec3 dir ) {\n float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;\n float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n return vec2( u, v );\n}\nvec3 BRDF_Lambert( const in vec3 diffuseColor ) {\n return RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {\n float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n}\nfloat F_Schlick( const in float f0, const in float f90, const in float dotVH ) {\n float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n} // validated`,wE=`#ifdef ENVMAP_TYPE_CUBE_UV\n #define cubeUV_minMipLevel 4.0\n #define cubeUV_minTileSize 16.0\n float getFace( vec3 direction ) {\n vec3 absDirection = abs( direction );\n float face = - 1.0;\n if ( absDirection.x > absDirection.z ) {\n if ( absDirection.x > absDirection.y )\n face = direction.x > 0.0 ? 0.0 : 3.0;\n else\n face = direction.y > 0.0 ? 1.0 : 4.0;\n } else {\n if ( absDirection.z > absDirection.y )\n face = direction.z > 0.0 ? 2.0 : 5.0;\n else\n face = direction.y > 0.0 ? 1.0 : 4.0;\n }\n return face;\n }\n vec2 getUV( vec3 direction, float face ) {\n vec2 uv;\n if ( face == 0.0 ) {\n uv = vec2( direction.z, direction.y ) / abs( direction.x );\n } else if ( face == 1.0 ) {\n uv = vec2( - direction.x, - direction.z ) / abs( direction.y );\n } else if ( face == 2.0 ) {\n uv = vec2( - direction.x, direction.y ) / abs( direction.z );\n } else if ( face == 3.0 ) {\n uv = vec2( - direction.z, direction.y ) / abs( direction.x );\n } else if ( face == 4.0 ) {\n uv = vec2( - direction.x, direction.z ) / abs( direction.y );\n } else {\n uv = vec2( direction.x, direction.y ) / abs( direction.z );\n }\n return 0.5 * ( uv + 1.0 );\n }\n vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {\n float face = getFace( direction );\n float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );\n mipInt = max( mipInt, cubeUV_minMipLevel );\n float faceSize = exp2( mipInt );\n highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;\n if ( face > 2.0 ) {\n uv.y += faceSize;\n face -= 3.0;\n }\n uv.x += face * faceSize;\n uv.x += filterInt * 3.0 * cubeUV_minTileSize;\n uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );\n uv.x *= CUBEUV_TEXEL_WIDTH;\n uv.y *= CUBEUV_TEXEL_HEIGHT;\n #ifdef texture2DGradEXT\n return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;\n #else\n return texture2D( envMap, uv ).rgb;\n #endif\n }\n #define cubeUV_r0 1.0\n #define cubeUV_v0 0.339\n #define cubeUV_m0 - 2.0\n #define cubeUV_r1 0.8\n #define cubeUV_v1 0.276\n #define cubeUV_m1 - 1.0\n #define cubeUV_r4 0.4\n #define cubeUV_v4 0.046\n #define cubeUV_m4 2.0\n #define cubeUV_r5 0.305\n #define cubeUV_v5 0.016\n #define cubeUV_m5 3.0\n #define cubeUV_r6 0.21\n #define cubeUV_v6 0.0038\n #define cubeUV_m6 4.0\n float roughnessToMip( float roughness ) {\n float mip = 0.0;\n if ( roughness >= cubeUV_r1 ) {\n mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;\n } else if ( roughness >= cubeUV_r4 ) {\n mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;\n } else if ( roughness >= cubeUV_r5 ) {\n mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;\n } else if ( roughness >= cubeUV_r6 ) {\n mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;\n } else {\n mip = - 2.0 * log2( 1.16 * roughness ); }\n return mip;\n }\n vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {\n float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );\n float mipF = fract( mip );\n float mipInt = floor( mip );\n vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );\n if ( mipF == 0.0 ) {\n return vec4( color0, 1.0 );\n } else {\n vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );\n return vec4( mix( color0, color1, mipF ), 1.0 );\n }\n }\n#endif`,bE=`vec3 transformedNormal = objectNormal;\n#ifdef USE_INSTANCING\n mat3 m = mat3( instanceMatrix );\n transformedNormal /= vec3( dot( m[ 0 ], m[ 0 ] ), dot( m[ 1 ], m[ 1 ] ), dot( m[ 2 ], m[ 2 ] ) );\n transformedNormal = m * transformedNormal;\n#endif\ntransformedNormal = normalMatrix * transformedNormal;\n#ifdef FLIP_SIDED\n transformedNormal = - transformedNormal;\n#endif\n#ifdef USE_TANGENT\n vec3 transformedTangent = ( modelViewMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n #ifdef FLIP_SIDED\n transformedTangent = - transformedTangent;\n #endif\n#endif`,TE=`#ifdef USE_DISPLACEMENTMAP\n uniform sampler2D displacementMap;\n uniform float displacementScale;\n uniform float displacementBias;\n#endif`,AE=`#ifdef USE_DISPLACEMENTMAP\n transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );\n#endif`,CE=`#ifdef USE_EMISSIVEMAP\n vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );\n totalEmissiveRadiance *= emissiveColor.rgb;\n#endif`,PE=`#ifdef USE_EMISSIVEMAP\n uniform sampler2D emissiveMap;\n#endif`,IE="gl_FragColor = linearToOutputTexel( gl_FragColor );",RE=`\nconst mat3 LINEAR_SRGB_TO_LINEAR_DISPLAY_P3 = mat3(\n vec3( 0.8224621, 0.177538, 0.0 ),\n vec3( 0.0331941, 0.9668058, 0.0 ),\n vec3( 0.0170827, 0.0723974, 0.9105199 )\n);\nconst mat3 LINEAR_DISPLAY_P3_TO_LINEAR_SRGB = mat3(\n vec3( 1.2249401, - 0.2249404, 0.0 ),\n vec3( - 0.0420569, 1.0420571, 0.0 ),\n vec3( - 0.0196376, - 0.0786361, 1.0982735 )\n);\nvec4 LinearSRGBToLinearDisplayP3( in vec4 value ) {\n return vec4( value.rgb * LINEAR_SRGB_TO_LINEAR_DISPLAY_P3, value.a );\n}\nvec4 LinearDisplayP3ToLinearSRGB( in vec4 value ) {\n return vec4( value.rgb * LINEAR_DISPLAY_P3_TO_LINEAR_SRGB, value.a );\n}\nvec4 LinearTransferOETF( in vec4 value ) {\n return value;\n}\nvec4 sRGBTransferOETF( in vec4 value ) {\n 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 );\n}\nvec4 LinearToLinear( in vec4 value ) {\n return value;\n}\nvec4 LinearTosRGB( in vec4 value ) {\n return sRGBTransferOETF( value );\n}`,LE=`#ifdef USE_ENVMAP\n #ifdef ENV_WORLDPOS\n vec3 cameraToFrag;\n if ( isOrthographic ) {\n cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n } else {\n cameraToFrag = normalize( vWorldPosition - cameraPosition );\n }\n vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n #ifdef ENVMAP_MODE_REFLECTION\n vec3 reflectVec = reflect( cameraToFrag, worldNormal );\n #else\n vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\n #endif\n #else\n vec3 reflectVec = vReflect;\n #endif\n #ifdef ENVMAP_TYPE_CUBE\n vec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n #else\n vec4 envColor = vec4( 0.0 );\n #endif\n #ifdef ENVMAP_BLENDING_MULTIPLY\n outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n #elif defined( ENVMAP_BLENDING_MIX )\n outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n #elif defined( ENVMAP_BLENDING_ADD )\n outgoingLight += envColor.xyz * specularStrength * reflectivity;\n #endif\n#endif`,NE=`#ifdef USE_ENVMAP\n uniform float envMapIntensity;\n uniform float flipEnvMap;\n #ifdef ENVMAP_TYPE_CUBE\n uniform samplerCube envMap;\n #else\n uniform sampler2D envMap;\n #endif\n \n#endif`,OE=`#ifdef USE_ENVMAP\n uniform float reflectivity;\n #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n #define ENV_WORLDPOS\n #endif\n #ifdef ENV_WORLDPOS\n varying vec3 vWorldPosition;\n uniform float refractionRatio;\n #else\n varying vec3 vReflect;\n #endif\n#endif`,DE=`#ifdef USE_ENVMAP\n #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n #define ENV_WORLDPOS\n #endif\n #ifdef ENV_WORLDPOS\n \n varying vec3 vWorldPosition;\n #else\n varying vec3 vReflect;\n uniform float refractionRatio;\n #endif\n#endif`,FE=`#ifdef USE_ENVMAP\n #ifdef ENV_WORLDPOS\n vWorldPosition = worldPosition.xyz;\n #else\n vec3 cameraToVertex;\n if ( isOrthographic ) {\n cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n } else {\n cameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n }\n vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n #ifdef ENVMAP_MODE_REFLECTION\n vReflect = reflect( cameraToVertex, worldNormal );\n #else\n vReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n #endif\n #endif\n#endif`,UE=`#ifdef USE_FOG\n vFogDepth = - mvPosition.z;\n#endif`,BE=`#ifdef USE_FOG\n varying float vFogDepth;\n#endif`,zE=`#ifdef USE_FOG\n #ifdef FOG_EXP2\n float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );\n #else\n float fogFactor = smoothstep( fogNear, fogFar, vFogDepth );\n #endif\n gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif`,kE=`#ifdef USE_FOG\n uniform vec3 fogColor;\n varying float vFogDepth;\n #ifdef FOG_EXP2\n uniform float fogDensity;\n #else\n uniform float fogNear;\n uniform float fogFar;\n #endif\n#endif`,GE=`#ifdef USE_GRADIENTMAP\n uniform sampler2D gradientMap;\n#endif\nvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n float dotNL = dot( normal, lightDirection );\n vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n #ifdef USE_GRADIENTMAP\n return vec3( texture2D( gradientMap, coord ).r );\n #else\n vec2 fw = fwidth( coord ) * 0.5;\n return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );\n #endif\n}`,VE=`#ifdef USE_LIGHTMAP\n vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\n reflectedLight.indirectDiffuse += lightMapIrradiance;\n#endif`,HE=`#ifdef USE_LIGHTMAP\n uniform sampler2D lightMap;\n uniform float lightMapIntensity;\n#endif`,WE=`LambertMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularStrength = specularStrength;`,qE=`varying vec3 vViewPosition;\nstruct LambertMaterial {\n vec3 diffuseColor;\n float specularStrength;\n};\nvoid 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 ) {\n float dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n vec3 irradiance = dotNL * directLight.color;\n reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid 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 ) {\n reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct RE_Direct_Lambert\n#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,XE=`uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\n#if defined( USE_LIGHT_PROBES )\n uniform vec3 lightProbe[ 9 ];\n#endif\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n float x = normal.x, y = normal.y, z = normal.z;\n vec3 result = shCoefficients[ 0 ] * 0.886227;\n result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n return result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {\n vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n return irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n vec3 irradiance = ambientLightColor;\n return irradiance;\n}\nfloat getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n #if defined ( LEGACY_LIGHTS )\n if ( cutoffDistance > 0.0 && decayExponent > 0.0 ) {\n return pow( saturate( - lightDistance / cutoffDistance + 1.0 ), decayExponent );\n }\n return 1.0;\n #else\n float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n if ( cutoffDistance > 0.0 ) {\n distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n }\n return distanceFalloff;\n #endif\n}\nfloat getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {\n return smoothstep( coneCosine, penumbraCosine, angleCosine );\n}\n#if NUM_DIR_LIGHTS > 0\n struct DirectionalLight {\n vec3 direction;\n vec3 color;\n };\n uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n void getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) {\n light.color = directionalLight.color;\n light.direction = directionalLight.direction;\n light.visible = true;\n }\n#endif\n#if NUM_POINT_LIGHTS > 0\n struct PointLight {\n vec3 position;\n vec3 color;\n float distance;\n float decay;\n };\n uniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n void getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) {\n vec3 lVector = pointLight.position - geometryPosition;\n light.direction = normalize( lVector );\n float lightDistance = length( lVector );\n light.color = pointLight.color;\n light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );\n light.visible = ( light.color != vec3( 0.0 ) );\n }\n#endif\n#if NUM_SPOT_LIGHTS > 0\n struct SpotLight {\n vec3 position;\n vec3 direction;\n vec3 color;\n float distance;\n float decay;\n float coneCos;\n float penumbraCos;\n };\n uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n void getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) {\n vec3 lVector = spotLight.position - geometryPosition;\n light.direction = normalize( lVector );\n float angleCos = dot( light.direction, spotLight.direction );\n float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n if ( spotAttenuation > 0.0 ) {\n float lightDistance = length( lVector );\n light.color = spotLight.color * spotAttenuation;\n light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );\n light.visible = ( light.color != vec3( 0.0 ) );\n } else {\n light.color = vec3( 0.0 );\n light.visible = false;\n }\n }\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n struct RectAreaLight {\n vec3 color;\n vec3 position;\n vec3 halfWidth;\n vec3 halfHeight;\n };\n uniform sampler2D ltc_1; uniform sampler2D ltc_2;\n uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n struct HemisphereLight {\n vec3 direction;\n vec3 skyColor;\n vec3 groundColor;\n };\n uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {\n float dotNL = dot( normal, hemiLight.direction );\n float hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n return irradiance;\n }\n#endif`,YE=`#ifdef USE_ENVMAP\n vec3 getIBLIrradiance( const in vec3 normal ) {\n #ifdef ENVMAP_TYPE_CUBE_UV\n vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n vec4 envMapColor = textureCubeUV( envMap, worldNormal, 1.0 );\n return PI * envMapColor.rgb * envMapIntensity;\n #else\n return vec3( 0.0 );\n #endif\n }\n vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {\n #ifdef ENVMAP_TYPE_CUBE_UV\n vec3 reflectVec = reflect( - viewDir, normal );\n reflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );\n reflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n vec4 envMapColor = textureCubeUV( envMap, reflectVec, roughness );\n return envMapColor.rgb * envMapIntensity;\n #else\n return vec3( 0.0 );\n #endif\n }\n #ifdef USE_ANISOTROPY\n vec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {\n #ifdef ENVMAP_TYPE_CUBE_UV\n vec3 bentNormal = cross( bitangent, viewDir );\n bentNormal = normalize( cross( bentNormal, bitangent ) );\n bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );\n return getIBLRadiance( viewDir, bentNormal, roughness );\n #else\n return vec3( 0.0 );\n #endif\n }\n #endif\n#endif`,ZE=`ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;`,JE=`varying vec3 vViewPosition;\nstruct ToonMaterial {\n vec3 diffuseColor;\n};\nvoid 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 ) {\n vec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color;\n reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid 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 ) {\n reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct RE_Direct_Toon\n#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,$E=`BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;`,KE=`varying vec3 vViewPosition;\nstruct BlinnPhongMaterial {\n vec3 diffuseColor;\n vec3 specularColor;\n float specularShininess;\n float specularStrength;\n};\nvoid 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 ) {\n float dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n vec3 irradiance = dotNL * directLight.color;\n reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid 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 ) {\n reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct RE_Direct_BlinnPhong\n#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,jE=`PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nvec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) );\nfloat geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );\nmaterial.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;\nmaterial.roughness = min( material.roughness, 1.0 );\n#ifdef IOR\n material.ior = ior;\n #ifdef USE_SPECULAR\n float specularIntensityFactor = specularIntensity;\n vec3 specularColorFactor = specularColor;\n #ifdef USE_SPECULAR_COLORMAP\n specularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;\n #endif\n #ifdef USE_SPECULAR_INTENSITYMAP\n specularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;\n #endif\n material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );\n #else\n float specularIntensityFactor = 1.0;\n vec3 specularColorFactor = vec3( 1.0 );\n material.specularF90 = 1.0;\n #endif\n material.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );\n#else\n material.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );\n material.specularF90 = 1.0;\n#endif\n#ifdef USE_CLEARCOAT\n material.clearcoat = clearcoat;\n material.clearcoatRoughness = clearcoatRoughness;\n material.clearcoatF0 = vec3( 0.04 );\n material.clearcoatF90 = 1.0;\n #ifdef USE_CLEARCOATMAP\n material.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x;\n #endif\n #ifdef USE_CLEARCOAT_ROUGHNESSMAP\n material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y;\n #endif\n material.clearcoat = saturate( material.clearcoat ); material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );\n material.clearcoatRoughness += geometryRoughness;\n material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\n#endif\n#ifdef USE_IRIDESCENCE\n material.iridescence = iridescence;\n material.iridescenceIOR = iridescenceIOR;\n #ifdef USE_IRIDESCENCEMAP\n material.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;\n #endif\n #ifdef USE_IRIDESCENCE_THICKNESSMAP\n material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;\n #else\n material.iridescenceThickness = iridescenceThicknessMaximum;\n #endif\n#endif\n#ifdef USE_SHEEN\n material.sheenColor = sheenColor;\n #ifdef USE_SHEEN_COLORMAP\n material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;\n #endif\n material.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );\n #ifdef USE_SHEEN_ROUGHNESSMAP\n material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;\n #endif\n#endif\n#ifdef USE_ANISOTROPY\n #ifdef USE_ANISOTROPYMAP\n mat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x );\n vec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb;\n vec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b;\n #else\n vec2 anisotropyV = anisotropyVector;\n #endif\n material.anisotropy = length( anisotropyV );\n anisotropyV /= material.anisotropy;\n material.anisotropy = saturate( material.anisotropy );\n material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );\n material.anisotropyT = tbn[ 0 ] * anisotropyV.x - tbn[ 1 ] * anisotropyV.y;\n material.anisotropyB = tbn[ 1 ] * anisotropyV.x + tbn[ 0 ] * anisotropyV.y;\n#endif`,QE=`struct PhysicalMaterial {\n vec3 diffuseColor;\n float roughness;\n vec3 specularColor;\n float specularF90;\n #ifdef USE_CLEARCOAT\n float clearcoat;\n float clearcoatRoughness;\n vec3 clearcoatF0;\n float clearcoatF90;\n #endif\n #ifdef USE_IRIDESCENCE\n float iridescence;\n float iridescenceIOR;\n float iridescenceThickness;\n vec3 iridescenceFresnel;\n vec3 iridescenceF0;\n #endif\n #ifdef USE_SHEEN\n vec3 sheenColor;\n float sheenRoughness;\n #endif\n #ifdef IOR\n float ior;\n #endif\n #ifdef USE_TRANSMISSION\n float transmission;\n float transmissionAlpha;\n float thickness;\n float attenuationDistance;\n vec3 attenuationColor;\n #endif\n #ifdef USE_ANISOTROPY\n float anisotropy;\n float alphaT;\n vec3 anisotropyT;\n vec3 anisotropyB;\n #endif\n};\nvec3 clearcoatSpecular = vec3( 0.0 );\nvec3 sheenSpecular = vec3( 0.0 );\nvec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {\n float x = clamp( 1.0 - dotVH, 0.0, 1.0 );\n float x2 = x * x;\n float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );\n return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );\n}\nfloat V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n float a2 = pow2( alpha );\n float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n return 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n float a2 = pow2( alpha );\n float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n return RECIPROCAL_PI * a2 / pow2( denom );\n}\n#ifdef USE_ANISOTROPY\n 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 ) {\n float gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );\n float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );\n float v = 0.5 / ( gv + gl );\n return saturate(v);\n }\n float D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {\n float a2 = alphaT * alphaB;\n highp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );\n highp float v2 = dot( v, v );\n float w2 = a2 / v2;\n return RECIPROCAL_PI * a2 * pow2 ( w2 );\n }\n#endif\n#ifdef USE_CLEARCOAT\n vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {\n vec3 f0 = material.clearcoatF0;\n float f90 = material.clearcoatF90;\n float roughness = material.clearcoatRoughness;\n float alpha = pow2( roughness );\n vec3 halfDir = normalize( lightDir + viewDir );\n float dotNL = saturate( dot( normal, lightDir ) );\n float dotNV = saturate( dot( normal, viewDir ) );\n float dotNH = saturate( dot( normal, halfDir ) );\n float dotVH = saturate( dot( viewDir, halfDir ) );\n vec3 F = F_Schlick( f0, f90, dotVH );\n float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n float D = D_GGX( alpha, dotNH );\n return F * ( V * D );\n }\n#endif\nvec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {\n vec3 f0 = material.specularColor;\n float f90 = material.specularF90;\n float roughness = material.roughness;\n float alpha = pow2( roughness );\n vec3 halfDir = normalize( lightDir + viewDir );\n float dotNL = saturate( dot( normal, lightDir ) );\n float dotNV = saturate( dot( normal, viewDir ) );\n float dotNH = saturate( dot( normal, halfDir ) );\n float dotVH = saturate( dot( viewDir, halfDir ) );\n vec3 F = F_Schlick( f0, f90, dotVH );\n #ifdef USE_IRIDESCENCE\n F = mix( F, material.iridescenceFresnel, material.iridescence );\n #endif\n #ifdef USE_ANISOTROPY\n float dotTL = dot( material.anisotropyT, lightDir );\n float dotTV = dot( material.anisotropyT, viewDir );\n float dotTH = dot( material.anisotropyT, halfDir );\n float dotBL = dot( material.anisotropyB, lightDir );\n float dotBV = dot( material.anisotropyB, viewDir );\n float dotBH = dot( material.anisotropyB, halfDir );\n float V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );\n float D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );\n #else\n float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n float D = D_GGX( alpha, dotNH );\n #endif\n return F * ( V * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n const float LUT_SIZE = 64.0;\n const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n const float LUT_BIAS = 0.5 / LUT_SIZE;\n float dotNV = saturate( dot( N, V ) );\n vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n uv = uv * LUT_SCALE + LUT_BIAS;\n return uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n float l = length( f );\n return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n float x = dot( v1, v2 );\n float y = abs( x );\n float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n float b = 3.4175940 + ( 4.1616724 + y ) * y;\n float v = a / b;\n float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n return cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n vec3 lightNormal = cross( v1, v2 );\n if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n vec3 T1, T2;\n T1 = normalize( V - N * dot( V, N ) );\n T2 = - cross( N, T1 );\n mat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n vec3 coords[ 4 ];\n coords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n coords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n coords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n coords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n coords[ 0 ] = normalize( coords[ 0 ] );\n coords[ 1 ] = normalize( coords[ 1 ] );\n coords[ 2 ] = normalize( coords[ 2 ] );\n coords[ 3 ] = normalize( coords[ 3 ] );\n vec3 vectorFormFactor = vec3( 0.0 );\n vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n float result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n return vec3( result );\n}\n#if defined( USE_SHEEN )\nfloat D_Charlie( float roughness, float dotNH ) {\n float alpha = pow2( roughness );\n float invAlpha = 1.0 / alpha;\n float cos2h = dotNH * dotNH;\n float sin2h = max( 1.0 - cos2h, 0.0078125 );\n return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );\n}\nfloat V_Neubelt( float dotNV, float dotNL ) {\n return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );\n}\nvec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {\n vec3 halfDir = normalize( lightDir + viewDir );\n float dotNL = saturate( dot( normal, lightDir ) );\n float dotNV = saturate( dot( normal, viewDir ) );\n float dotNH = saturate( dot( normal, halfDir ) );\n float D = D_Charlie( sheenRoughness, dotNH );\n float V = V_Neubelt( dotNV, dotNL );\n return sheenColor * ( D * V );\n}\n#endif\nfloat IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n float dotNV = saturate( dot( normal, viewDir ) );\n float r2 = roughness * roughness;\n float a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;\n float b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;\n float DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );\n return saturate( DG * RECIPROCAL_PI );\n}\nvec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n float dotNV = saturate( dot( normal, viewDir ) );\n const vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n const vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n vec4 r = roughness * c0 + c1;\n float a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n vec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;\n return fab;\n}\nvec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {\n vec2 fab = DFGApprox( normal, viewDir, roughness );\n return specularColor * fab.x + specularF90 * fab.y;\n}\n#ifdef USE_IRIDESCENCE\nvoid 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 ) {\n#else\nvoid 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 ) {\n#endif\n vec2 fab = DFGApprox( normal, viewDir, roughness );\n #ifdef USE_IRIDESCENCE\n vec3 Fr = mix( specularColor, iridescenceF0, iridescence );\n #else\n vec3 Fr = specularColor;\n #endif\n vec3 FssEss = Fr * fab.x + specularF90 * fab.y;\n float Ess = fab.x + fab.y;\n float Ems = 1.0 - Ess;\n vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619; vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n singleScatter += FssEss;\n multiScatter += Fms * Ems;\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n 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 ) {\n vec3 normal = geometryNormal;\n vec3 viewDir = geometryViewDir;\n vec3 position = geometryPosition;\n vec3 lightPos = rectAreaLight.position;\n vec3 halfWidth = rectAreaLight.halfWidth;\n vec3 halfHeight = rectAreaLight.halfHeight;\n vec3 lightColor = rectAreaLight.color;\n float roughness = material.roughness;\n vec3 rectCoords[ 4 ];\n rectCoords[ 0 ] = lightPos + halfWidth - halfHeight; rectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n rectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n rectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n vec2 uv = LTC_Uv( normal, viewDir, roughness );\n vec4 t1 = texture2D( ltc_1, uv );\n vec4 t2 = texture2D( ltc_2, uv );\n mat3 mInv = mat3(\n vec3( t1.x, 0, t1.y ),\n vec3( 0, 1, 0 ),\n vec3( t1.z, 0, t1.w )\n );\n vec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n reflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n }\n#endif\nvoid 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 ) {\n float dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n vec3 irradiance = dotNL * directLight.color;\n #ifdef USE_CLEARCOAT\n float dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) );\n vec3 ccIrradiance = dotNLcc * directLight.color;\n clearcoatSpecular += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material );\n #endif\n #ifdef USE_SHEEN\n sheenSpecular += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness );\n #endif\n reflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometryViewDir, geometryNormal, material );\n reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid 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 ) {\n reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid 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) {\n #ifdef USE_CLEARCOAT\n clearcoatSpecular += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n #endif\n #ifdef USE_SHEEN\n sheenSpecular += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );\n #endif\n vec3 singleScattering = vec3( 0.0 );\n vec3 multiScattering = vec3( 0.0 );\n vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n #ifdef USE_IRIDESCENCE\n computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering );\n #else\n computeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );\n #endif\n vec3 totalScattering = singleScattering + multiScattering;\n vec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) );\n reflectedLight.indirectSpecular += radiance * singleScattering;\n reflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\n reflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n}\n#define RE_Direct RE_Direct_Physical\n#define RE_Direct_RectArea RE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse RE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular RE_IndirectSpecular_Physical\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}`,tM=`\nvec3 geometryPosition = - vViewPosition;\nvec3 geometryNormal = normal;\nvec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\nvec3 geometryClearcoatNormal;\n#ifdef USE_CLEARCOAT\n geometryClearcoatNormal = clearcoatNormal;\n#endif\n#ifdef USE_IRIDESCENCE\n float dotNVi = saturate( dot( normal, geometryViewDir ) );\n if ( material.iridescenceThickness == 0.0 ) {\n material.iridescence = 0.0;\n } else {\n material.iridescence = saturate( material.iridescence );\n }\n if ( material.iridescence > 0.0 ) {\n material.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );\n material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );\n }\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n PointLight pointLight;\n #if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n PointLightShadow pointLightShadow;\n #endif\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n pointLight = pointLights[ i ];\n getPointLightInfo( pointLight, geometryPosition, directLight );\n #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n pointLightShadow = pointLightShadows[ i ];\n directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n #endif\n RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n }\n #pragma unroll_loop_end\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n SpotLight spotLight;\n vec4 spotColor;\n vec3 spotLightCoord;\n bool inSpotLightMap;\n #if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n SpotLightShadow spotLightShadow;\n #endif\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n spotLight = spotLights[ i ];\n getSpotLightInfo( spotLight, geometryPosition, directLight );\n #if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n #define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX\n #elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n #define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS\n #else\n #define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n #endif\n #if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )\n spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;\n inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );\n spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );\n directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;\n #endif\n #undef SPOT_LIGHT_MAP_INDEX\n #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n spotLightShadow = spotLightShadows[ i ];\n directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n #endif\n RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n }\n #pragma unroll_loop_end\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n DirectionalLight directionalLight;\n #if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n DirectionalLightShadow directionalLightShadow;\n #endif\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n directionalLight = directionalLights[ i ];\n getDirectionalLightInfo( directionalLight, directLight );\n #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n directionalLightShadow = directionalLightShadows[ i ];\n directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n #endif\n RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n }\n #pragma unroll_loop_end\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n RectAreaLight rectAreaLight;\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n rectAreaLight = rectAreaLights[ i ];\n RE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n }\n #pragma unroll_loop_end\n#endif\n#if defined( RE_IndirectDiffuse )\n vec3 iblIrradiance = vec3( 0.0 );\n vec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n #if defined( USE_LIGHT_PROBES )\n irradiance += getLightProbeIrradiance( lightProbe, geometryNormal );\n #endif\n #if ( NUM_HEMI_LIGHTS > 0 )\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal );\n }\n #pragma unroll_loop_end\n #endif\n#endif\n#if defined( RE_IndirectSpecular )\n vec3 radiance = vec3( 0.0 );\n vec3 clearcoatRadiance = vec3( 0.0 );\n#endif`,eM=`#if defined( RE_IndirectDiffuse )\n #ifdef USE_LIGHTMAP\n vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\n irradiance += lightMapIrradiance;\n #endif\n #if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\n iblIrradiance += getIBLIrradiance( geometryNormal );\n #endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n #ifdef USE_ANISOTROPY\n radiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy );\n #else\n radiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness );\n #endif\n #ifdef USE_CLEARCOAT\n clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );\n #endif\n#endif`,nM=`#if defined( RE_IndirectDiffuse )\n RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n#endif`,rM=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n gl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif`,iM=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n uniform float logDepthBufFC;\n varying float vFragDepth;\n varying float vIsPerspective;\n#endif`,oM=`#ifdef USE_LOGDEPTHBUF\n #ifdef USE_LOGDEPTHBUF_EXT\n varying float vFragDepth;\n varying float vIsPerspective;\n #else\n uniform float logDepthBufFC;\n #endif\n#endif`,sM=`#ifdef USE_LOGDEPTHBUF\n #ifdef USE_LOGDEPTHBUF_EXT\n vFragDepth = 1.0 + gl_Position.w;\n vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n #else\n if ( isPerspectiveMatrix( projectionMatrix ) ) {\n gl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;\n gl_Position.z *= gl_Position.w;\n }\n #endif\n#endif`,aM=`#ifdef USE_MAP\n vec4 sampledDiffuseColor = texture2D( map, vMapUv );\n #ifdef DECODE_VIDEO_TEXTURE\n sampledDiffuseColor = vec4( mix( pow( sampledDiffuseColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), sampledDiffuseColor.rgb * 0.0773993808, vec3( lessThanEqual( sampledDiffuseColor.rgb, vec3( 0.04045 ) ) ) ), sampledDiffuseColor.w );\n \n #endif\n diffuseColor *= sampledDiffuseColor;\n#endif`,uM=`#ifdef USE_MAP\n uniform sampler2D map;\n#endif`,lM=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n #if defined( USE_POINTS_UV )\n vec2 uv = vUv;\n #else\n vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n #endif\n#endif\n#ifdef USE_MAP\n diffuseColor *= texture2D( map, uv );\n#endif\n#ifdef USE_ALPHAMAP\n diffuseColor.a *= texture2D( alphaMap, uv ).g;\n#endif`,cM=`#if defined( USE_POINTS_UV )\n varying vec2 vUv;\n#else\n #if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n uniform mat3 uvTransform;\n #endif\n#endif\n#ifdef USE_MAP\n uniform sampler2D map;\n#endif\n#ifdef USE_ALPHAMAP\n uniform sampler2D alphaMap;\n#endif`,fM=`float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );\n metalnessFactor *= texelMetalness.b;\n#endif`,hM=`#ifdef USE_METALNESSMAP\n uniform sampler2D metalnessMap;\n#endif`,pM=`#if defined( USE_MORPHCOLORS ) && defined( MORPHTARGETS_TEXTURE )\n vColor *= morphTargetBaseInfluence;\n for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n #if defined( USE_COLOR_ALPHA )\n if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];\n #elif defined( USE_COLOR )\n if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];\n #endif\n }\n#endif`,dM=`#ifdef USE_MORPHNORMALS\n objectNormal *= morphTargetBaseInfluence;\n #ifdef MORPHTARGETS_TEXTURE\n for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];\n }\n #else\n objectNormal += morphNormal0 * morphTargetInfluences[ 0 ];\n objectNormal += morphNormal1 * morphTargetInfluences[ 1 ];\n objectNormal += morphNormal2 * morphTargetInfluences[ 2 ];\n objectNormal += morphNormal3 * morphTargetInfluences[ 3 ];\n #endif\n#endif`,mM=`#ifdef USE_MORPHTARGETS\n uniform float morphTargetBaseInfluence;\n #ifdef MORPHTARGETS_TEXTURE\n uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];\n uniform sampler2DArray morphTargetsTexture;\n uniform ivec2 morphTargetsTextureSize;\n vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {\n int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;\n int y = texelIndex / morphTargetsTextureSize.x;\n int x = texelIndex - y * morphTargetsTextureSize.x;\n ivec3 morphUV = ivec3( x, y, morphTargetIndex );\n return texelFetch( morphTargetsTexture, morphUV, 0 );\n }\n #else\n #ifndef USE_MORPHNORMALS\n uniform float morphTargetInfluences[ 8 ];\n #else\n uniform float morphTargetInfluences[ 4 ];\n #endif\n #endif\n#endif`,gM=`#ifdef USE_MORPHTARGETS\n transformed *= morphTargetBaseInfluence;\n #ifdef MORPHTARGETS_TEXTURE\n for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];\n }\n #else\n transformed += morphTarget0 * morphTargetInfluences[ 0 ];\n transformed += morphTarget1 * morphTargetInfluences[ 1 ];\n transformed += morphTarget2 * morphTargetInfluences[ 2 ];\n transformed += morphTarget3 * morphTargetInfluences[ 3 ];\n #ifndef USE_MORPHNORMALS\n transformed += morphTarget4 * morphTargetInfluences[ 4 ];\n transformed += morphTarget5 * morphTargetInfluences[ 5 ];\n transformed += morphTarget6 * morphTargetInfluences[ 6 ];\n transformed += morphTarget7 * morphTargetInfluences[ 7 ];\n #endif\n #endif\n#endif`,yM=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;\n#ifdef FLAT_SHADED\n vec3 fdx = dFdx( vViewPosition );\n vec3 fdy = dFdy( vViewPosition );\n vec3 normal = normalize( cross( fdx, fdy ) );\n#else\n vec3 normal = normalize( vNormal );\n #ifdef DOUBLE_SIDED\n normal *= faceDirection;\n #endif\n#endif\n#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY )\n #ifdef USE_TANGENT\n mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n #else\n mat3 tbn = getTangentFrame( - vViewPosition, normal,\n #if defined( USE_NORMALMAP )\n vNormalMapUv\n #elif defined( USE_CLEARCOAT_NORMALMAP )\n vClearcoatNormalMapUv\n #else\n vUv\n #endif\n );\n #endif\n #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n tbn[0] *= faceDirection;\n tbn[1] *= faceDirection;\n #endif\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n #ifdef USE_TANGENT\n mat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n #else\n mat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );\n #endif\n #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n tbn2[0] *= faceDirection;\n tbn2[1] *= faceDirection;\n #endif\n#endif\nvec3 nonPerturbedNormal = normal;`,vM=`#ifdef USE_NORMALMAP_OBJECTSPACE\n normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n #ifdef FLIP_SIDED\n normal = - normal;\n #endif\n #ifdef DOUBLE_SIDED\n normal = normal * faceDirection;\n #endif\n normal = normalize( normalMatrix * normal );\n#elif defined( USE_NORMALMAP_TANGENTSPACE )\n vec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n mapN.xy *= normalScale;\n normal = normalize( tbn * mapN );\n#elif defined( USE_BUMPMAP )\n normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );\n#endif`,_M=`#ifndef FLAT_SHADED\n varying vec3 vNormal;\n #ifdef USE_TANGENT\n varying vec3 vTangent;\n varying vec3 vBitangent;\n #endif\n#endif`,xM=`#ifndef FLAT_SHADED\n varying vec3 vNormal;\n #ifdef USE_TANGENT\n varying vec3 vTangent;\n varying vec3 vBitangent;\n #endif\n#endif`,EM=`#ifndef FLAT_SHADED\n vNormal = normalize( transformedNormal );\n #ifdef USE_TANGENT\n vTangent = normalize( transformedTangent );\n vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n #endif\n#endif`,MM=`#ifdef USE_NORMALMAP\n uniform sampler2D normalMap;\n uniform vec2 normalScale;\n#endif\n#ifdef USE_NORMALMAP_OBJECTSPACE\n uniform mat3 normalMatrix;\n#endif\n#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) )\n mat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {\n vec3 q0 = dFdx( eye_pos.xyz );\n vec3 q1 = dFdy( eye_pos.xyz );\n vec2 st0 = dFdx( uv.st );\n vec2 st1 = dFdy( uv.st );\n vec3 N = surf_norm;\n vec3 q1perp = cross( q1, N );\n vec3 q0perp = cross( N, q0 );\n vec3 T = q1perp * st0.x + q0perp * st1.x;\n vec3 B = q1perp * st0.y + q0perp * st1.y;\n float det = max( dot( T, T ), dot( B, B ) );\n float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );\n return mat3( T * scale, B * scale, N );\n }\n#endif`,SM=`#ifdef USE_CLEARCOAT\n vec3 clearcoatNormal = nonPerturbedNormal;\n#endif`,wM=`#ifdef USE_CLEARCOAT_NORMALMAP\n vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;\n clearcoatMapN.xy *= clearcoatNormalScale;\n clearcoatNormal = normalize( tbn2 * clearcoatMapN );\n#endif`,bM=`#ifdef USE_CLEARCOATMAP\n uniform sampler2D clearcoatMap;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n uniform sampler2D clearcoatNormalMap;\n uniform vec2 clearcoatNormalScale;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n uniform sampler2D clearcoatRoughnessMap;\n#endif`,TM=`#ifdef USE_IRIDESCENCEMAP\n uniform sampler2D iridescenceMap;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n uniform sampler2D iridescenceThicknessMap;\n#endif`,AM=`#ifdef OPAQUE\ndiffuseColor.a = 1.0;\n#endif\n#ifdef USE_TRANSMISSION\ndiffuseColor.a *= material.transmissionAlpha;\n#endif\ngl_FragColor = vec4( outgoingLight, diffuseColor.a );`,CM=`vec3 packNormalToRGB( const in vec3 normal ) {\n return normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n return 2.0 * rgb.xyz - 1.0;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;\nconst vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\nconst vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );\nconst float ShiftRight8 = 1. / 256.;\nvec4 packDepthToRGBA( const in float v ) {\n vec4 r = vec4( fract( v * PackFactors ), v );\n r.yzw -= r.xyz * ShiftRight8; return r * PackUpscale;\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n return dot( v, UnpackFactors );\n}\nvec2 packDepthToRG( in highp float v ) {\n return packDepthToRGBA( v ).yx;\n}\nfloat unpackRGToDepth( const in highp vec2 v ) {\n return unpackRGBAToDepth( vec4( v.xy, 0.0, 0.0 ) );\n}\nvec4 pack2HalfToRGBA( vec2 v ) {\n vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );\n return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );\n}\nvec2 unpackRGBATo2Half( vec4 v ) {\n return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n return ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) {\n return depth * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) {\n return ( near * far ) / ( ( far - near ) * depth - far );\n}`,PM=`#ifdef PREMULTIPLIED_ALPHA\n gl_FragColor.rgb *= gl_FragColor.a;\n#endif`,IM=`vec4 mvPosition = vec4( transformed, 1.0 );\n#ifdef USE_INSTANCING\n mvPosition = instanceMatrix * mvPosition;\n#endif\nmvPosition = modelViewMatrix * mvPosition;\ngl_Position = projectionMatrix * mvPosition;`,RM=`#ifdef DITHERING\n gl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif`,LM=`#ifdef DITHERING\n vec3 dithering( vec3 color ) {\n float grid_position = rand( gl_FragCoord.xy );\n vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n return color + dither_shift_RGB;\n }\n#endif`,NM=`float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );\n roughnessFactor *= texelRoughness.g;\n#endif`,OM=`#ifdef USE_ROUGHNESSMAP\n uniform sampler2D roughnessMap;\n#endif`,DM=`#if NUM_SPOT_LIGHT_COORDS > 0\n varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#if NUM_SPOT_LIGHT_MAPS > 0\n uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];\n#endif\n#ifdef USE_SHADOWMAP\n #if NUM_DIR_LIGHT_SHADOWS > 0\n uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n struct DirectionalLightShadow {\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n };\n uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n #endif\n #if NUM_SPOT_LIGHT_SHADOWS > 0\n uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n struct SpotLightShadow {\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n };\n uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n #endif\n #if NUM_POINT_LIGHT_SHADOWS > 0\n uniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n struct PointLightShadow {\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n float shadowCameraNear;\n float shadowCameraFar;\n };\n uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n #endif\n float texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n return step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n }\n vec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {\n return unpackRGBATo2Half( texture2D( shadow, uv ) );\n }\n float VSMShadow (sampler2D shadow, vec2 uv, float compare ){\n float occlusion = 1.0;\n vec2 distribution = texture2DDistribution( shadow, uv );\n float hard_shadow = step( compare , distribution.x );\n if (hard_shadow != 1.0 ) {\n float distance = compare - distribution.x ;\n float variance = max( 0.00000, distribution.y * distribution.y );\n float softness_probability = variance / (variance + distance * distance ); softness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 ); occlusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );\n }\n return occlusion;\n }\n float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n float shadow = 1.0;\n shadowCoord.xyz /= shadowCoord.w;\n shadowCoord.z += shadowBias;\n bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\n bool frustumTest = inFrustum && shadowCoord.z <= 1.0;\n if ( frustumTest ) {\n #if defined( SHADOWMAP_TYPE_PCF )\n vec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n float dx0 = - texelSize.x * shadowRadius;\n float dy0 = - texelSize.y * shadowRadius;\n float dx1 = + texelSize.x * shadowRadius;\n float dy1 = + texelSize.y * shadowRadius;\n float dx2 = dx0 / 2.0;\n float dy2 = dy0 / 2.0;\n float dx3 = dx1 / 2.0;\n float dy3 = dy1 / 2.0;\n shadow = (\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n ) * ( 1.0 / 17.0 );\n #elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n vec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n float dx = texelSize.x;\n float dy = texelSize.y;\n vec2 uv = shadowCoord.xy;\n vec2 f = fract( uv * shadowMapSize + 0.5 );\n uv -= f * texelSize;\n shadow = (\n texture2DCompare( shadowMap, uv, shadowCoord.z ) +\n texture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +\n texture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +\n mix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ),\n texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),\n f.x ) +\n mix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ),\n texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),\n f.x ) +\n mix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ),\n texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),\n f.y ) +\n mix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ),\n texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),\n f.y ) +\n mix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ),\n texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),\n f.x ),\n mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ),\n texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),\n f.x ),\n f.y )\n ) * ( 1.0 / 9.0 );\n #elif defined( SHADOWMAP_TYPE_VSM )\n shadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );\n #else\n shadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n #endif\n }\n return shadow;\n }\n vec2 cubeToUV( vec3 v, float texelSizeY ) {\n vec3 absV = abs( v );\n float scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n absV *= scaleToCube;\n v *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n vec2 planar = v.xy;\n float almostATexel = 1.5 * texelSizeY;\n float almostOne = 1.0 - almostATexel;\n if ( absV.z >= almostOne ) {\n if ( v.z > 0.0 )\n planar.x = 4.0 - v.x;\n } else if ( absV.x >= almostOne ) {\n float signX = sign( v.x );\n planar.x = v.z * signX + 2.0 * signX;\n } else if ( absV.y >= almostOne ) {\n float signY = sign( v.y );\n planar.x = v.x + 2.0 * signY + 2.0;\n planar.y = v.z * signY - 2.0;\n }\n return vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n }\n float getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n vec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n vec3 lightToPosition = shadowCoord.xyz;\n float dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear ); dp += shadowBias;\n vec3 bd3D = normalize( lightToPosition );\n #if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )\n vec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n return (\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n ) * ( 1.0 / 9.0 );\n #else\n return texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n #endif\n }\n#endif`,FM=`#if NUM_SPOT_LIGHT_COORDS > 0\n uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];\n varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#ifdef USE_SHADOWMAP\n #if NUM_DIR_LIGHT_SHADOWS > 0\n uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n struct DirectionalLightShadow {\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n };\n uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n #endif\n #if NUM_SPOT_LIGHT_SHADOWS > 0\n struct SpotLightShadow {\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n };\n uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n #endif\n #if NUM_POINT_LIGHT_SHADOWS > 0\n uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\n varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n struct PointLightShadow {\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n float shadowCameraNear;\n float shadowCameraFar;\n };\n uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n #endif\n#endif`,UM=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )\n vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n vec4 shadowWorldPosition;\n#endif\n#if defined( USE_SHADOWMAP )\n #if NUM_DIR_LIGHT_SHADOWS > 0\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );\n vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;\n }\n #pragma unroll_loop_end\n #endif\n #if NUM_POINT_LIGHT_SHADOWS > 0\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );\n vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;\n }\n #pragma unroll_loop_end\n #endif\n#endif\n#if NUM_SPOT_LIGHT_COORDS > 0\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {\n shadowWorldPosition = worldPosition;\n #if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;\n #endif\n vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;\n }\n #pragma unroll_loop_end\n#endif`,BM=`float getShadowMask() {\n float shadow = 1.0;\n #ifdef USE_SHADOWMAP\n #if NUM_DIR_LIGHT_SHADOWS > 0\n DirectionalLightShadow directionalLight;\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n directionalLight = directionalLightShadows[ i ];\n shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n }\n #pragma unroll_loop_end\n #endif\n #if NUM_SPOT_LIGHT_SHADOWS > 0\n SpotLightShadow spotLight;\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n spotLight = spotLightShadows[ i ];\n shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n }\n #pragma unroll_loop_end\n #endif\n #if NUM_POINT_LIGHT_SHADOWS > 0\n PointLightShadow pointLight;\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n pointLight = pointLightShadows[ i ];\n shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n }\n #pragma unroll_loop_end\n #endif\n #endif\n return shadow;\n}`,zM=`#ifdef USE_SKINNING\n mat4 boneMatX = getBoneMatrix( skinIndex.x );\n mat4 boneMatY = getBoneMatrix( skinIndex.y );\n mat4 boneMatZ = getBoneMatrix( skinIndex.z );\n mat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif`,kM=`#ifdef USE_SKINNING\n uniform mat4 bindMatrix;\n uniform mat4 bindMatrixInverse;\n uniform highp sampler2D boneTexture;\n uniform int boneTextureSize;\n mat4 getBoneMatrix( const in float i ) {\n float j = i * 4.0;\n float x = mod( j, float( boneTextureSize ) );\n float y = floor( j / float( boneTextureSize ) );\n float dx = 1.0 / float( boneTextureSize );\n float dy = 1.0 / float( boneTextureSize );\n y = dy * ( y + 0.5 );\n vec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\n vec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\n vec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\n vec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\n mat4 bone = mat4( v1, v2, v3, v4 );\n return bone;\n }\n#endif`,GM=`#ifdef USE_SKINNING\n vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n vec4 skinned = vec4( 0.0 );\n skinned += boneMatX * skinVertex * skinWeight.x;\n skinned += boneMatY * skinVertex * skinWeight.y;\n skinned += boneMatZ * skinVertex * skinWeight.z;\n skinned += boneMatW * skinVertex * skinWeight.w;\n transformed = ( bindMatrixInverse * skinned ).xyz;\n#endif`,VM=`#ifdef USE_SKINNING\n mat4 skinMatrix = mat4( 0.0 );\n skinMatrix += skinWeight.x * boneMatX;\n skinMatrix += skinWeight.y * boneMatY;\n skinMatrix += skinWeight.z * boneMatZ;\n skinMatrix += skinWeight.w * boneMatW;\n skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n #ifdef USE_TANGENT\n objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n #endif\n#endif`,HM=`float specularStrength;\n#ifdef USE_SPECULARMAP\n vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );\n specularStrength = texelSpecular.r;\n#else\n specularStrength = 1.0;\n#endif`,WM=`#ifdef USE_SPECULARMAP\n uniform sampler2D specularMap;\n#endif`,qM=`#if defined( TONE_MAPPING )\n gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif`,XM=`#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nvec3 LinearToneMapping( vec3 color ) {\n return saturate( toneMappingExposure * color );\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n color *= toneMappingExposure;\n return saturate( color / ( vec3( 1.0 ) + color ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n color *= toneMappingExposure;\n color = max( vec3( 0.0 ), color - 0.004 );\n return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\nvec3 RRTAndODTFit( vec3 v ) {\n vec3 a = v * ( v + 0.0245786 ) - 0.000090537;\n vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;\n return a / b;\n}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n const mat3 ACESInputMat = mat3(\n vec3( 0.59719, 0.07600, 0.02840 ), vec3( 0.35458, 0.90834, 0.13383 ),\n vec3( 0.04823, 0.01566, 0.83777 )\n );\n const mat3 ACESOutputMat = mat3(\n vec3( 1.60475, -0.10208, -0.00327 ), vec3( -0.53108, 1.10813, -0.07276 ),\n vec3( -0.07367, -0.00605, 1.07602 )\n );\n color *= toneMappingExposure / 0.6;\n color = ACESInputMat * color;\n color = RRTAndODTFit( color );\n color = ACESOutputMat * color;\n return saturate( color );\n}\nvec3 CustomToneMapping( vec3 color ) { return color; }`,YM=`#ifdef USE_TRANSMISSION\n material.transmission = transmission;\n material.transmissionAlpha = 1.0;\n material.thickness = thickness;\n material.attenuationDistance = attenuationDistance;\n material.attenuationColor = attenuationColor;\n #ifdef USE_TRANSMISSIONMAP\n material.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;\n #endif\n #ifdef USE_THICKNESSMAP\n material.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;\n #endif\n vec3 pos = vWorldPosition;\n vec3 v = normalize( cameraPosition - pos );\n vec3 n = inverseTransformDirection( normal, viewMatrix );\n vec4 transmitted = getIBLVolumeRefraction(\n n, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90,\n pos, modelMatrix, viewMatrix, projectionMatrix, material.ior, material.thickness,\n material.attenuationColor, material.attenuationDistance );\n material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );\n totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );\n#endif`,ZM=`#ifdef USE_TRANSMISSION\n uniform float transmission;\n uniform float thickness;\n uniform float attenuationDistance;\n uniform vec3 attenuationColor;\n #ifdef USE_TRANSMISSIONMAP\n uniform sampler2D transmissionMap;\n #endif\n #ifdef USE_THICKNESSMAP\n uniform sampler2D thicknessMap;\n #endif\n uniform vec2 transmissionSamplerSize;\n uniform sampler2D transmissionSamplerMap;\n uniform mat4 modelMatrix;\n uniform mat4 projectionMatrix;\n varying vec3 vWorldPosition;\n float w0( float a ) {\n return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );\n }\n float w1( float a ) {\n return ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 );\n }\n float w2( float a ){\n return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );\n }\n float w3( float a ) {\n return ( 1.0 / 6.0 ) * ( a * a * a );\n }\n float g0( float a ) {\n return w0( a ) + w1( a );\n }\n float g1( float a ) {\n return w2( a ) + w3( a );\n }\n float h0( float a ) {\n return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );\n }\n float h1( float a ) {\n return 1.0 + w3( a ) / ( w2( a ) + w3( a ) );\n }\n vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) {\n uv = uv * texelSize.zw + 0.5;\n vec2 iuv = floor( uv );\n vec2 fuv = fract( uv );\n float g0x = g0( fuv.x );\n float g1x = g1( fuv.x );\n float h0x = h0( fuv.x );\n float h1x = h1( fuv.x );\n float h0y = h0( fuv.y );\n float h1y = h1( fuv.y );\n vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) +\n g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );\n }\n vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {\n vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );\n vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );\n vec2 fLodSizeInv = 1.0 / fLodSize;\n vec2 cLodSizeInv = 1.0 / cLodSize;\n vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) );\n vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) );\n return mix( fSample, cSample, fract( lod ) );\n }\n vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {\n vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );\n vec3 modelScale;\n modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );\n modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );\n modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );\n return normalize( refractionVector ) * thickness * modelScale;\n }\n float applyIorToRoughness( const in float roughness, const in float ior ) {\n return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );\n }\n vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {\n float lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );\n return textureBicubic( transmissionSamplerMap, fragCoord.xy, lod );\n }\n vec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {\n if ( isinf( attenuationDistance ) ) {\n return vec3( 1.0 );\n } else {\n vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;\n vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance ); return transmittance;\n }\n }\n vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,\n const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,\n const in mat4 viewMatrix, const in mat4 projMatrix, const in float ior, const in float thickness,\n const in vec3 attenuationColor, const in float attenuationDistance ) {\n vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );\n vec3 refractedRayExit = position + transmissionRay;\n vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n vec2 refractionCoords = ndcPos.xy / ndcPos.w;\n refractionCoords += 1.0;\n refractionCoords /= 2.0;\n vec4 transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );\n vec3 transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance );\n vec3 attenuatedColor = transmittance * transmittedLight.rgb;\n vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );\n float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;\n return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );\n }\n#endif`,JM=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n varying vec2 vUv;\n#endif\n#ifdef USE_MAP\n varying vec2 vMapUv;\n#endif\n#ifdef USE_ALPHAMAP\n varying vec2 vAlphaMapUv;\n#endif\n#ifdef USE_LIGHTMAP\n varying vec2 vLightMapUv;\n#endif\n#ifdef USE_AOMAP\n varying vec2 vAoMapUv;\n#endif\n#ifdef USE_BUMPMAP\n varying vec2 vBumpMapUv;\n#endif\n#ifdef USE_NORMALMAP\n varying vec2 vNormalMapUv;\n#endif\n#ifdef USE_EMISSIVEMAP\n varying vec2 vEmissiveMapUv;\n#endif\n#ifdef USE_METALNESSMAP\n varying vec2 vMetalnessMapUv;\n#endif\n#ifdef USE_ROUGHNESSMAP\n varying vec2 vRoughnessMapUv;\n#endif\n#ifdef USE_ANISOTROPYMAP\n varying vec2 vAnisotropyMapUv;\n#endif\n#ifdef USE_CLEARCOATMAP\n varying vec2 vClearcoatMapUv;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n varying vec2 vClearcoatNormalMapUv;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n varying vec2 vClearcoatRoughnessMapUv;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n varying vec2 vIridescenceMapUv;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n varying vec2 vIridescenceThicknessMapUv;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n varying vec2 vSheenColorMapUv;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n varying vec2 vSheenRoughnessMapUv;\n#endif\n#ifdef USE_SPECULARMAP\n varying vec2 vSpecularMapUv;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n varying vec2 vSpecularColorMapUv;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n varying vec2 vSpecularIntensityMapUv;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n uniform mat3 transmissionMapTransform;\n varying vec2 vTransmissionMapUv;\n#endif\n#ifdef USE_THICKNESSMAP\n uniform mat3 thicknessMapTransform;\n varying vec2 vThicknessMapUv;\n#endif`,$M=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n varying vec2 vUv;\n#endif\n#ifdef USE_MAP\n uniform mat3 mapTransform;\n varying vec2 vMapUv;\n#endif\n#ifdef USE_ALPHAMAP\n uniform mat3 alphaMapTransform;\n varying vec2 vAlphaMapUv;\n#endif\n#ifdef USE_LIGHTMAP\n uniform mat3 lightMapTransform;\n varying vec2 vLightMapUv;\n#endif\n#ifdef USE_AOMAP\n uniform mat3 aoMapTransform;\n varying vec2 vAoMapUv;\n#endif\n#ifdef USE_BUMPMAP\n uniform mat3 bumpMapTransform;\n varying vec2 vBumpMapUv;\n#endif\n#ifdef USE_NORMALMAP\n uniform mat3 normalMapTransform;\n varying vec2 vNormalMapUv;\n#endif\n#ifdef USE_DISPLACEMENTMAP\n uniform mat3 displacementMapTransform;\n varying vec2 vDisplacementMapUv;\n#endif\n#ifdef USE_EMISSIVEMAP\n uniform mat3 emissiveMapTransform;\n varying vec2 vEmissiveMapUv;\n#endif\n#ifdef USE_METALNESSMAP\n uniform mat3 metalnessMapTransform;\n varying vec2 vMetalnessMapUv;\n#endif\n#ifdef USE_ROUGHNESSMAP\n uniform mat3 roughnessMapTransform;\n varying vec2 vRoughnessMapUv;\n#endif\n#ifdef USE_ANISOTROPYMAP\n uniform mat3 anisotropyMapTransform;\n varying vec2 vAnisotropyMapUv;\n#endif\n#ifdef USE_CLEARCOATMAP\n uniform mat3 clearcoatMapTransform;\n varying vec2 vClearcoatMapUv;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n uniform mat3 clearcoatNormalMapTransform;\n varying vec2 vClearcoatNormalMapUv;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n uniform mat3 clearcoatRoughnessMapTransform;\n varying vec2 vClearcoatRoughnessMapUv;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n uniform mat3 sheenColorMapTransform;\n varying vec2 vSheenColorMapUv;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n uniform mat3 sheenRoughnessMapTransform;\n varying vec2 vSheenRoughnessMapUv;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n uniform mat3 iridescenceMapTransform;\n varying vec2 vIridescenceMapUv;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n uniform mat3 iridescenceThicknessMapTransform;\n varying vec2 vIridescenceThicknessMapUv;\n#endif\n#ifdef USE_SPECULARMAP\n uniform mat3 specularMapTransform;\n varying vec2 vSpecularMapUv;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n uniform mat3 specularColorMapTransform;\n varying vec2 vSpecularColorMapUv;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n uniform mat3 specularIntensityMapTransform;\n varying vec2 vSpecularIntensityMapUv;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n uniform mat3 transmissionMapTransform;\n varying vec2 vTransmissionMapUv;\n#endif\n#ifdef USE_THICKNESSMAP\n uniform mat3 thicknessMapTransform;\n varying vec2 vThicknessMapUv;\n#endif`,KM=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n vUv = vec3( uv, 1 ).xy;\n#endif\n#ifdef USE_MAP\n vMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ALPHAMAP\n vAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_LIGHTMAP\n vLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_AOMAP\n vAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_BUMPMAP\n vBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_NORMALMAP\n vNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_DISPLACEMENTMAP\n vDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_EMISSIVEMAP\n vEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_METALNESSMAP\n vMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ROUGHNESSMAP\n vRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ANISOTROPYMAP\n vAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOATMAP\n vClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n vClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n vClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n vIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n vIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n vSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n vSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULARMAP\n vSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n vSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n vSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n vTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_THICKNESSMAP\n vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;\n#endif`,jM=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0\n vec4 worldPosition = vec4( transformed, 1.0 );\n #ifdef USE_INSTANCING\n worldPosition = instanceMatrix * worldPosition;\n #endif\n worldPosition = modelMatrix * worldPosition;\n#endif`,QM=`varying vec2 vUv;\nuniform mat3 uvTransform;\nvoid main() {\n vUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n gl_Position = vec4( position.xy, 1.0, 1.0 );\n}`,tS=`uniform sampler2D t2D;\nuniform float backgroundIntensity;\nvarying vec2 vUv;\nvoid main() {\n vec4 texColor = texture2D( t2D, vUv );\n #ifdef DECODE_VIDEO_TEXTURE\n 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 );\n #endif\n texColor.rgb *= backgroundIntensity;\n gl_FragColor = texColor;\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n}`,eS=`varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n vWorldDirection = transformDirection( position, modelMatrix );\n #include <begin_vertex>\n #include <project_vertex>\n gl_Position.z = gl_Position.w;\n}`,nS=`#ifdef ENVMAP_TYPE_CUBE\n uniform samplerCube envMap;\n#elif defined( ENVMAP_TYPE_CUBE_UV )\n uniform sampler2D envMap;\n#endif\nuniform float flipEnvMap;\nuniform float backgroundBlurriness;\nuniform float backgroundIntensity;\nvarying vec3 vWorldDirection;\n#include <cube_uv_reflection_fragment>\nvoid main() {\n #ifdef ENVMAP_TYPE_CUBE\n vec4 texColor = textureCube( envMap, vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) );\n #elif defined( ENVMAP_TYPE_CUBE_UV )\n vec4 texColor = textureCubeUV( envMap, vWorldDirection, backgroundBlurriness );\n #else\n vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n #endif\n texColor.rgb *= backgroundIntensity;\n gl_FragColor = texColor;\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n}`,rS=`varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n vWorldDirection = transformDirection( position, modelMatrix );\n #include <begin_vertex>\n #include <project_vertex>\n gl_Position.z = gl_Position.w;\n}`,iS=`uniform samplerCube tCube;\nuniform float tFlip;\nuniform float opacity;\nvarying vec3 vWorldDirection;\nvoid main() {\n vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );\n gl_FragColor = texColor;\n gl_FragColor.a *= opacity;\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n}`,oS=`#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n #include <uv_vertex>\n #include <skinbase_vertex>\n #ifdef USE_DISPLACEMENTMAP\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinnormal_vertex>\n #endif\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n vHighPrecisionZW = gl_Position.zw;\n}`,sS=`#if DEPTH_PACKING == 3200\n uniform float opacity;\n#endif\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n #include <clipping_planes_fragment>\n vec4 diffuseColor = vec4( 1.0 );\n #if DEPTH_PACKING == 3200\n diffuseColor.a = opacity;\n #endif\n #include <map_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <alphahash_fragment>\n #include <logdepthbuf_fragment>\n float fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;\n #if DEPTH_PACKING == 3200\n gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );\n #elif DEPTH_PACKING == 3201\n gl_FragColor = packDepthToRGBA( fragCoordZ );\n #endif\n}`,aS=`#define DISTANCE\nvarying vec3 vWorldPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <skinbase_vertex>\n #ifdef USE_DISPLACEMENTMAP\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinnormal_vertex>\n #endif\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <worldpos_vertex>\n #include <clipping_planes_vertex>\n vWorldPosition = worldPosition.xyz;\n}`,uS=`#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main () {\n #include <clipping_planes_fragment>\n vec4 diffuseColor = vec4( 1.0 );\n #include <map_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <alphahash_fragment>\n float dist = length( vWorldPosition - referencePosition );\n dist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n dist = saturate( dist );\n gl_FragColor = packDepthToRGBA( dist );\n}`,lS=`varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n vWorldDirection = transformDirection( position, modelMatrix );\n #include <begin_vertex>\n #include <project_vertex>\n}`,cS=`uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n vec3 direction = normalize( vWorldDirection );\n vec2 sampleUV = equirectUv( direction );\n gl_FragColor = texture2D( tEquirect, sampleUV );\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n}`,fS=`uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include <common>\n#include <uv_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n vLineDistance = scale * lineDistance;\n #include <uv_vertex>\n #include <color_vertex>\n #include <morphcolor_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n #include <fog_vertex>\n}`,hS=`uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n #include <clipping_planes_fragment>\n if ( mod( vLineDistance, totalSize ) > dashSize ) {\n discard;\n }\n vec3 outgoingLight = vec3( 0.0 );\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n outgoingLight = diffuseColor.rgb;\n #include <opaque_fragment>\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n}`,pS=`#include <common>\n#include <uv_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <color_vertex>\n #include <morphcolor_vertex>\n #if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #endif\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n #include <worldpos_vertex>\n #include <envmap_vertex>\n #include <fog_vertex>\n}`,dS=`uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n varying vec3 vNormal;\n#endif\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n #include <clipping_planes_fragment>\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <alphahash_fragment>\n #include <specularmap_fragment>\n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n #ifdef USE_LIGHTMAP\n vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;\n #else\n reflectedLight.indirectDiffuse += vec3( 1.0 );\n #endif\n #include <aomap_fragment>\n reflectedLight.indirectDiffuse *= diffuseColor.rgb;\n vec3 outgoingLight = reflectedLight.indirectDiffuse;\n #include <envmap_fragment>\n #include <opaque_fragment>\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n #include <dithering_fragment>\n}`,mS=`#define LAMBERT\nvarying vec3 vViewPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <color_vertex>\n #include <morphcolor_vertex>\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #include <normal_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n vViewPosition = - mvPosition.xyz;\n #include <worldpos_vertex>\n #include <envmap_vertex>\n #include <shadowmap_vertex>\n #include <fog_vertex>\n}`,gS=`#define LAMBERT\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_lambert_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n #include <clipping_planes_fragment>\n vec4 diffuseColor = vec4( diffuse, opacity );\n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n vec3 totalEmissiveRadiance = emissive;\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <alphahash_fragment>\n #include <specularmap_fragment>\n #include <normal_fragment_begin>\n #include <normal_fragment_maps>\n #include <emissivemap_fragment>\n #include <lights_lambert_fragment>\n #include <lights_fragment_begin>\n #include <lights_fragment_maps>\n #include <lights_fragment_end>\n #include <aomap_fragment>\n vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n #include <envmap_fragment>\n #include <opaque_fragment>\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n #include <dithering_fragment>\n}`,yS=`#define MATCAP\nvarying vec3 vViewPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <color_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <color_vertex>\n #include <morphcolor_vertex>\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #include <normal_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n #include <fog_vertex>\n vViewPosition = - mvPosition.xyz;\n}`,vS=`#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\nvarying vec3 vViewPosition;\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <fog_pars_fragment>\n#include <normal_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n #include <clipping_planes_fragment>\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <alphahash_fragment>\n #include <normal_fragment_begin>\n #include <normal_fragment_maps>\n vec3 viewDir = normalize( vViewPosition );\n vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n vec3 y = cross( viewDir, x );\n vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\n #ifdef USE_MATCAP\n vec4 matcapColor = texture2D( matcap, uv );\n #else\n vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );\n #endif\n vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n #include <opaque_fragment>\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n #include <dithering_fragment>\n}`,_S=`#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n varying vec3 vViewPosition;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #include <normal_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n vViewPosition = - mvPosition.xyz;\n#endif\n}`,xS=`#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n varying vec3 vViewPosition;\n#endif\n#include <packing>\n#include <uv_pars_fragment>\n#include <normal_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n #include <clipping_planes_fragment>\n #include <logdepthbuf_fragment>\n #include <normal_fragment_begin>\n #include <normal_fragment_maps>\n gl_FragColor = vec4( packNormalToRGB( normal ), opacity );\n #ifdef OPAQUE\n gl_FragColor.a = 1.0;\n #endif\n}`,ES=`#define PHONG\nvarying vec3 vViewPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <color_vertex>\n #include <morphcolor_vertex>\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #include <normal_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n vViewPosition = - mvPosition.xyz;\n #include <worldpos_vertex>\n #include <envmap_vertex>\n #include <shadowmap_vertex>\n #include <fog_vertex>\n}`,MS=`#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_phong_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n #include <clipping_planes_fragment>\n vec4 diffuseColor = vec4( diffuse, opacity );\n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n vec3 totalEmissiveRadiance = emissive;\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <alphahash_fragment>\n #include <specularmap_fragment>\n #include <normal_fragment_begin>\n #include <normal_fragment_maps>\n #include <emissivemap_fragment>\n #include <lights_phong_fragment>\n #include <lights_fragment_begin>\n #include <lights_fragment_maps>\n #include <lights_fragment_end>\n #include <aomap_fragment>\n vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n #include <envmap_fragment>\n #include <opaque_fragment>\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n #include <dithering_fragment>\n}`,SS=`#define STANDARD\nvarying vec3 vViewPosition;\n#ifdef USE_TRANSMISSION\n varying vec3 vWorldPosition;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <color_vertex>\n #include <morphcolor_vertex>\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #include <normal_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n vViewPosition = - mvPosition.xyz;\n #include <worldpos_vertex>\n #include <shadowmap_vertex>\n #include <fog_vertex>\n#ifdef USE_TRANSMISSION\n vWorldPosition = worldPosition.xyz;\n#endif\n}`,wS=`#define STANDARD\n#ifdef PHYSICAL\n #define IOR\n #define USE_SPECULAR\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef IOR\n uniform float ior;\n#endif\n#ifdef USE_SPECULAR\n uniform float specularIntensity;\n uniform vec3 specularColor;\n #ifdef USE_SPECULAR_COLORMAP\n uniform sampler2D specularColorMap;\n #endif\n #ifdef USE_SPECULAR_INTENSITYMAP\n uniform sampler2D specularIntensityMap;\n #endif\n#endif\n#ifdef USE_CLEARCOAT\n uniform float clearcoat;\n uniform float clearcoatRoughness;\n#endif\n#ifdef USE_IRIDESCENCE\n uniform float iridescence;\n uniform float iridescenceIOR;\n uniform float iridescenceThicknessMinimum;\n uniform float iridescenceThicknessMaximum;\n#endif\n#ifdef USE_SHEEN\n uniform vec3 sheenColor;\n uniform float sheenRoughness;\n #ifdef USE_SHEEN_COLORMAP\n uniform sampler2D sheenColorMap;\n #endif\n #ifdef USE_SHEEN_ROUGHNESSMAP\n uniform sampler2D sheenRoughnessMap;\n #endif\n#endif\n#ifdef USE_ANISOTROPY\n uniform vec2 anisotropyVector;\n #ifdef USE_ANISOTROPYMAP\n uniform sampler2D anisotropyMap;\n #endif\n#endif\nvarying vec3 vViewPosition;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <iridescence_fragment>\n#include <cube_uv_reflection_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_physical_pars_fragment>\n#include <fog_pars_fragment>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_physical_pars_fragment>\n#include <transmission_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <clearcoat_pars_fragment>\n#include <iridescence_pars_fragment>\n#include <roughnessmap_pars_fragment>\n#include <metalnessmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n #include <clipping_planes_fragment>\n vec4 diffuseColor = vec4( diffuse, opacity );\n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n vec3 totalEmissiveRadiance = emissive;\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <alphahash_fragment>\n #include <roughnessmap_fragment>\n #include <metalnessmap_fragment>\n #include <normal_fragment_begin>\n #include <normal_fragment_maps>\n #include <clearcoat_normal_fragment_begin>\n #include <clearcoat_normal_fragment_maps>\n #include <emissivemap_fragment>\n #include <lights_physical_fragment>\n #include <lights_fragment_begin>\n #include <lights_fragment_maps>\n #include <lights_fragment_end>\n #include <aomap_fragment>\n vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\n vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n #include <transmission_fragment>\n vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;\n #ifdef USE_SHEEN\n float sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );\n outgoingLight = outgoingLight * sheenEnergyComp + sheenSpecular;\n #endif\n #ifdef USE_CLEARCOAT\n float dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) );\n vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );\n outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + clearcoatSpecular * material.clearcoat;\n #endif\n #include <opaque_fragment>\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n #include <dithering_fragment>\n}`,bS=`#define TOON\nvarying vec3 vViewPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <color_vertex>\n #include <morphcolor_vertex>\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #include <normal_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n vViewPosition = - mvPosition.xyz;\n #include <worldpos_vertex>\n #include <shadowmap_vertex>\n #include <fog_vertex>\n}`,TS=`#define TOON\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <gradientmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_toon_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n #include <clipping_planes_fragment>\n vec4 diffuseColor = vec4( diffuse, opacity );\n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n vec3 totalEmissiveRadiance = emissive;\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <alphahash_fragment>\n #include <normal_fragment_begin>\n #include <normal_fragment_maps>\n #include <emissivemap_fragment>\n #include <lights_toon_fragment>\n #include <lights_fragment_begin>\n #include <lights_fragment_maps>\n #include <lights_fragment_end>\n #include <aomap_fragment>\n vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n #include <opaque_fragment>\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n #include <dithering_fragment>\n}`,AS=`uniform float size;\nuniform float scale;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\n#ifdef USE_POINTS_UV\n varying vec2 vUv;\n uniform mat3 uvTransform;\n#endif\nvoid main() {\n #ifdef USE_POINTS_UV\n vUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n #endif\n #include <color_vertex>\n #include <morphcolor_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <project_vertex>\n gl_PointSize = size;\n #ifdef USE_SIZEATTENUATION\n bool isPerspective = isPerspectiveMatrix( projectionMatrix );\n if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\n #endif\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n #include <worldpos_vertex>\n #include <fog_vertex>\n}`,CS=`uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <color_pars_fragment>\n#include <map_particle_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n #include <clipping_planes_fragment>\n vec3 outgoingLight = vec3( 0.0 );\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include <logdepthbuf_fragment>\n #include <map_particle_fragment>\n #include <color_fragment>\n #include <alphatest_fragment>\n #include <alphahash_fragment>\n outgoingLight = diffuseColor.rgb;\n #include <opaque_fragment>\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n}`,PS=`#include <common>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <shadowmap_pars_vertex>\nvoid main() {\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <worldpos_vertex>\n #include <shadowmap_vertex>\n #include <fog_vertex>\n}`,IS=`uniform vec3 color;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <logdepthbuf_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\nvoid main() {\n #include <logdepthbuf_fragment>\n gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n #include <fog_fragment>\n}`,RS=`uniform float rotation;\nuniform vec2 center;\n#include <common>\n#include <uv_pars_vertex>\n#include <fog_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n vec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\n vec2 scale;\n scale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );\n scale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );\n #ifndef USE_SIZEATTENUATION\n bool isPerspective = isPerspectiveMatrix( projectionMatrix );\n if ( isPerspective ) scale *= - mvPosition.z;\n #endif\n vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\n vec2 rotatedPosition;\n rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n mvPosition.xy += rotatedPosition;\n gl_Position = projectionMatrix * mvPosition;\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n #include <fog_vertex>\n}`,LS=`uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n #include <clipping_planes_fragment>\n vec3 outgoingLight = vec3( 0.0 );\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <alphahash_fragment>\n outgoingLight = diffuseColor.rgb;\n #include <opaque_fragment>\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n #include <fog_fragment>\n}`,ge={alphahash_fragment:nE,alphahash_pars_fragment:rE,alphamap_fragment:iE,alphamap_pars_fragment:oE,alphatest_fragment:sE,alphatest_pars_fragment:aE,aomap_fragment:uE,aomap_pars_fragment:lE,begin_vertex:cE,beginnormal_vertex:fE,bsdfs:hE,iridescence_fragment:pE,bumpmap_pars_fragment:dE,clipping_planes_fragment:mE,clipping_planes_pars_fragment:gE,clipping_planes_pars_vertex:yE,clipping_planes_vertex:vE,color_fragment:_E,color_pars_fragment:xE,color_pars_vertex:EE,color_vertex:ME,common:SE,cube_uv_reflection_fragment:wE,defaultnormal_vertex:bE,displacementmap_pars_vertex:TE,displacementmap_vertex:AE,emissivemap_fragment:CE,emissivemap_pars_fragment:PE,colorspace_fragment:IE,colorspace_pars_fragment:RE,envmap_fragment:LE,envmap_common_pars_fragment:NE,envmap_pars_fragment:OE,envmap_pars_vertex:DE,envmap_physical_pars_fragment:YE,envmap_vertex:FE,fog_vertex:UE,fog_pars_vertex:BE,fog_fragment:zE,fog_pars_fragment:kE,gradientmap_pars_fragment:GE,lightmap_fragment:VE,lightmap_pars_fragment:HE,lights_lambert_fragment:WE,lights_lambert_pars_fragment:qE,lights_pars_begin:XE,lights_toon_fragment:ZE,lights_toon_pars_fragment:JE,lights_phong_fragment:$E,lights_phong_pars_fragment:KE,lights_physical_fragment:jE,lights_physical_pars_fragment:QE,lights_fragment_begin:tM,lights_fragment_maps:eM,lights_fragment_end:nM,logdepthbuf_fragment:rM,logdepthbuf_pars_fragment:iM,logdepthbuf_pars_vertex:oM,logdepthbuf_vertex:sM,map_fragment:aM,map_pars_fragment:uM,map_particle_fragment:lM,map_particle_pars_fragment:cM,metalnessmap_fragment:fM,metalnessmap_pars_fragment:hM,morphcolor_vertex:pM,morphnormal_vertex:dM,morphtarget_pars_vertex:mM,morphtarget_vertex:gM,normal_fragment_begin:yM,normal_fragment_maps:vM,normal_pars_fragment:_M,normal_pars_vertex:xM,normal_vertex:EM,normalmap_pars_fragment:MM,clearcoat_normal_fragment_begin:SM,clearcoat_normal_fragment_maps:wM,clearcoat_pars_fragment:bM,iridescence_pars_fragment:TM,opaque_fragment:AM,packing:CM,premultiplied_alpha_fragment:PM,project_vertex:IM,dithering_fragment:RM,dithering_pars_fragment:LM,roughnessmap_fragment:NM,roughnessmap_pars_fragment:OM,shadowmap_pars_fragment:DM,shadowmap_pars_vertex:FM,shadowmap_vertex:UM,shadowmask_pars_fragment:BM,skinbase_vertex:zM,skinning_pars_vertex:kM,skinning_vertex:GM,skinnormal_vertex:VM,specularmap_fragment:HM,specularmap_pars_fragment:WM,tonemapping_fragment:qM,tonemapping_pars_fragment:XM,transmission_fragment:YM,transmission_pars_fragment:ZM,uv_pars_fragment:JM,uv_pars_vertex:$M,uv_vertex:KM,worldpos_vertex:jM,background_vert:QM,background_frag:tS,backgroundCube_vert:eS,backgroundCube_frag:nS,cube_vert:rS,cube_frag:iS,depth_vert:oS,depth_frag:sS,distanceRGBA_vert:aS,distanceRGBA_frag:uS,equirect_vert:lS,equirect_frag:cS,linedashed_vert:fS,linedashed_frag:hS,meshbasic_vert:pS,meshbasic_frag:dS,meshlambert_vert:mS,meshlambert_frag:gS,meshmatcap_vert:yS,meshmatcap_frag:vS,meshnormal_vert:_S,meshnormal_frag:xS,meshphong_vert:ES,meshphong_frag:MS,meshphysical_vert:SS,meshphysical_frag:wS,meshtoon_vert:bS,meshtoon_frag:TS,points_vert:AS,points_frag:CS,shadow_vert:PS,shadow_frag:IS,sprite_vert:RS,sprite_frag:LS},zt={common:{diffuse:{value:new xn(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new ve},alphaMap:{value:null},alphaMapTransform:{value:new ve},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new ve}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new ve}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new ve}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new ve},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new ve},normalScale:{value:new fn(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new ve},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new ve}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new ve}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new ve}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new xn(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{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 xn(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new ve},alphaTest:{value:0},uvTransform:{value:new ve}},sprite:{diffuse:{value:new xn(16777215)},opacity:{value:1},center:{value:new fn(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new ve},alphaMap:{value:null},alphaMapTransform:{value:new ve},alphaTest:{value:0}}},lo={basic:{uniforms:Jr([zt.common,zt.specularmap,zt.envmap,zt.aomap,zt.lightmap,zt.fog]),vertexShader:ge.meshbasic_vert,fragmentShader:ge.meshbasic_frag},lambert:{uniforms:Jr([zt.common,zt.specularmap,zt.envmap,zt.aomap,zt.lightmap,zt.emissivemap,zt.bumpmap,zt.normalmap,zt.displacementmap,zt.fog,zt.lights,{emissive:{value:new xn(0)}}]),vertexShader:ge.meshlambert_vert,fragmentShader:ge.meshlambert_frag},phong:{uniforms:Jr([zt.common,zt.specularmap,zt.envmap,zt.aomap,zt.lightmap,zt.emissivemap,zt.bumpmap,zt.normalmap,zt.displacementmap,zt.fog,zt.lights,{emissive:{value:new xn(0)},specular:{value:new xn(1118481)},shininess:{value:30}}]),vertexShader:ge.meshphong_vert,fragmentShader:ge.meshphong_frag},standard:{uniforms:Jr([zt.common,zt.envmap,zt.aomap,zt.lightmap,zt.emissivemap,zt.bumpmap,zt.normalmap,zt.displacementmap,zt.roughnessmap,zt.metalnessmap,zt.fog,zt.lights,{emissive:{value:new xn(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:ge.meshphysical_vert,fragmentShader:ge.meshphysical_frag},toon:{uniforms:Jr([zt.common,zt.aomap,zt.lightmap,zt.emissivemap,zt.bumpmap,zt.normalmap,zt.displacementmap,zt.gradientmap,zt.fog,zt.lights,{emissive:{value:new xn(0)}}]),vertexShader:ge.meshtoon_vert,fragmentShader:ge.meshtoon_frag},matcap:{uniforms:Jr([zt.common,zt.bumpmap,zt.normalmap,zt.displacementmap,zt.fog,{matcap:{value:null}}]),vertexShader:ge.meshmatcap_vert,fragmentShader:ge.meshmatcap_frag},points:{uniforms:Jr([zt.points,zt.fog]),vertexShader:ge.points_vert,fragmentShader:ge.points_frag},dashed:{uniforms:Jr([zt.common,zt.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:ge.linedashed_vert,fragmentShader:ge.linedashed_frag},depth:{uniforms:Jr([zt.common,zt.displacementmap]),vertexShader:ge.depth_vert,fragmentShader:ge.depth_frag},normal:{uniforms:Jr([zt.common,zt.bumpmap,zt.normalmap,zt.displacementmap,{opacity:{value:1}}]),vertexShader:ge.meshnormal_vert,fragmentShader:ge.meshnormal_frag},sprite:{uniforms:Jr([zt.sprite,zt.fog]),vertexShader:ge.sprite_vert,fragmentShader:ge.sprite_frag},background:{uniforms:{uvTransform:{value:new ve},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:ge.background_vert,fragmentShader:ge.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1}},vertexShader:ge.backgroundCube_vert,fragmentShader:ge.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:ge.cube_vert,fragmentShader:ge.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:ge.equirect_vert,fragmentShader:ge.equirect_frag},distanceRGBA:{uniforms:Jr([zt.common,zt.displacementmap,{referencePosition:{value:new mt},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:ge.distanceRGBA_vert,fragmentShader:ge.distanceRGBA_frag},shadow:{uniforms:Jr([zt.lights,zt.fog,{color:{value:new xn(0)},opacity:{value:1}}]),vertexShader:ge.shadow_vert,fragmentShader:ge.shadow_frag}};lo.physical={uniforms:Jr([lo.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new ve},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new ve},clearcoatNormalScale:{value:new fn(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new ve},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new ve},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new ve},sheen:{value:0},sheenColor:{value:new xn(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new ve},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new ve},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new ve},transmissionSamplerSize:{value:new fn},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new ve},attenuationDistance:{value:0},attenuationColor:{value:new xn(0)},specularColor:{value:new xn(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new ve},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new ve},anisotropyVector:{value:new fn},anisotropyMap:{value:null},anisotropyMapTransform:{value:new ve}}]),vertexShader:ge.meshphysical_vert,fragmentShader:ge.meshphysical_frag};var Wl={r:0,b:0,g:0};function NS(r,t,e,o,a,l,f){let h=new xn(0),p=l===!0?0:1,d,g,_=null,y=0,M=null;function w(x,v){let C=!1,S=v.isScene===!0?v.background:null;S&&S.isTexture&&(S=(v.backgroundBlurriness>0?e:t).get(S)),S===null?A(h,p):S&&S.isColor&&(A(S,1),C=!0);let O=r.xr.getEnvironmentBlendMode();O==="additive"?o.buffers.color.setClear(0,0,0,1,f):O==="alpha-blend"&&o.buffers.color.setClear(0,0,0,0,f),(r.autoClear||C)&&r.clear(r.autoClearColor,r.autoClearDepth,r.autoClearStencil),S&&(S.isCubeTexture||S.mapping===hc)?(g===void 0&&(g=new co(new Uu(1,1,1),new Xo({name:"BackgroundCubeMaterial",uniforms:Ha(lo.backgroundCube.uniforms),vertexShader:lo.backgroundCube.vertexShader,fragmentShader:lo.backgroundCube.fragmentShader,side:ui,depthTest:!1,depthWrite:!1,fog:!1})),g.geometry.deleteAttribute("normal"),g.geometry.deleteAttribute("uv"),g.onBeforeRender=function(F,G,z){this.matrixWorld.copyPosition(z.matrixWorld)},Object.defineProperty(g.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),a.update(g)),g.material.uniforms.envMap.value=S,g.material.uniforms.flipEnvMap.value=S.isCubeTexture&&S.isRenderTargetTexture===!1?-1:1,g.material.uniforms.backgroundBlurriness.value=v.backgroundBlurriness,g.material.uniforms.backgroundIntensity.value=v.backgroundIntensity,g.material.toneMapped=gn.getTransfer(S.colorSpace)!==Tn,(_!==S||y!==S.version||M!==r.toneMapping)&&(g.material.needsUpdate=!0,_=S,y=S.version,M=r.toneMapping),g.layers.enableAll(),x.unshift(g,g.geometry,g.material,0,0,null)):S&&S.isTexture&&(d===void 0&&(d=new co(new _h(2,2),new Xo({name:"BackgroundMaterial",uniforms:Ha(lo.background.uniforms),vertexShader:lo.background.vertexShader,fragmentShader:lo.background.fragmentShader,side:ps,depthTest:!1,depthWrite:!1,fog:!1})),d.geometry.deleteAttribute("normal"),Object.defineProperty(d.material,"map",{get:function(){return this.uniforms.t2D.value}}),a.update(d)),d.material.uniforms.t2D.value=S,d.material.uniforms.backgroundIntensity.value=v.backgroundIntensity,d.material.toneMapped=gn.getTransfer(S.colorSpace)!==Tn,S.matrixAutoUpdate===!0&&S.updateMatrix(),d.material.uniforms.uvTransform.value.copy(S.matrix),(_!==S||y!==S.version||M!==r.toneMapping)&&(d.material.needsUpdate=!0,_=S,y=S.version,M=r.toneMapping),d.layers.enableAll(),x.unshift(d,d.geometry,d.material,0,0,null))}function A(x,v){x.getRGB(Wl,l0(r)),o.buffers.color.setClear(Wl.r,Wl.g,Wl.b,v,f)}return{getClearColor:function(){return h},setClearColor:function(x,v=1){h.set(x),p=v,A(h,p)},getClearAlpha:function(){return p},setClearAlpha:function(x){p=x,A(h,p)},render:w}}function OS(r,t,e,o){let a=r.getParameter(r.MAX_VERTEX_ATTRIBS),l=o.isWebGL2?null:t.get("OES_vertex_array_object"),f=o.isWebGL2||l!==null,h={},p=x(null),d=p,g=!1;function _(X,it,vt,pt,et){let ot=!1;if(f){let V=A(pt,vt,it);d!==V&&(d=V,M(d.object)),ot=v(X,pt,vt,et),ot&&C(X,pt,vt,et)}else{let V=it.wireframe===!0;(d.geometry!==pt.id||d.program!==vt.id||d.wireframe!==V)&&(d.geometry=pt.id,d.program=vt.id,d.wireframe=V,ot=!0)}et!==null&&e.update(et,r.ELEMENT_ARRAY_BUFFER),(ot||g)&&(g=!1,L(X,it,vt,pt),et!==null&&r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,e.get(et).buffer))}function y(){return o.isWebGL2?r.createVertexArray():l.createVertexArrayOES()}function M(X){return o.isWebGL2?r.bindVertexArray(X):l.bindVertexArrayOES(X)}function w(X){return o.isWebGL2?r.deleteVertexArray(X):l.deleteVertexArrayOES(X)}function A(X,it,vt){let pt=vt.wireframe===!0,et=h[X.id];et===void 0&&(et={},h[X.id]=et);let ot=et[it.id];ot===void 0&&(ot={},et[it.id]=ot);let V=ot[pt];return V===void 0&&(V=x(y()),ot[pt]=V),V}function x(X){let it=[],vt=[],pt=[];for(let et=0;et<a;et++)it[et]=0,vt[et]=0,pt[et]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:it,enabledAttributes:vt,attributeDivisors:pt,object:X,attributes:{},index:null}}function v(X,it,vt,pt){let et=d.attributes,ot=it.attributes,V=0,K=vt.getAttributes();for(let at in K)if(K[at].location>=0){let dt=et[at],Ct=ot[at];if(Ct===void 0&&(at==="instanceMatrix"&&X.instanceMatrix&&(Ct=X.instanceMatrix),at==="instanceColor"&&X.instanceColor&&(Ct=X.instanceColor)),dt===void 0||dt.attribute!==Ct||Ct&&dt.data!==Ct.data)return!0;V++}return d.attributesNum!==V||d.index!==pt}function C(X,it,vt,pt){let et={},ot=it.attributes,V=0,K=vt.getAttributes();for(let at in K)if(K[at].location>=0){let dt=ot[at];dt===void 0&&(at==="instanceMatrix"&&X.instanceMatrix&&(dt=X.instanceMatrix),at==="instanceColor"&&X.instanceColor&&(dt=X.instanceColor));let Ct={};Ct.attribute=dt,dt&&dt.data&&(Ct.data=dt.data),et[at]=Ct,V++}d.attributes=et,d.attributesNum=V,d.index=pt}function S(){let X=d.newAttributes;for(let it=0,vt=X.length;it<vt;it++)X[it]=0}function O(X){F(X,0)}function F(X,it){let vt=d.newAttributes,pt=d.enabledAttributes,et=d.attributeDivisors;vt[X]=1,pt[X]===0&&(r.enableVertexAttribArray(X),pt[X]=1),et[X]!==it&&((o.isWebGL2?r:t.get("ANGLE_instanced_arrays"))[o.isWebGL2?"vertexAttribDivisor":"vertexAttribDivisorANGLE"](X,it),et[X]=it)}function G(){let X=d.newAttributes,it=d.enabledAttributes;for(let vt=0,pt=it.length;vt<pt;vt++)it[vt]!==X[vt]&&(r.disableVertexAttribArray(vt),it[vt]=0)}function z(X,it,vt,pt,et,ot,V){V===!0?r.vertexAttribIPointer(X,it,vt,et,ot):r.vertexAttribPointer(X,it,vt,pt,et,ot)}function L(X,it,vt,pt){if(o.isWebGL2===!1&&(X.isInstancedMesh||pt.isInstancedBufferGeometry)&&t.get("ANGLE_instanced_arrays")===null)return;S();let et=pt.attributes,ot=vt.getAttributes(),V=it.defaultAttributeValues;for(let K in ot){let at=ot[K];if(at.location>=0){let Tt=et[K];if(Tt===void 0&&(K==="instanceMatrix"&&X.instanceMatrix&&(Tt=X.instanceMatrix),K==="instanceColor"&&X.instanceColor&&(Tt=X.instanceColor)),Tt!==void 0){let dt=Tt.normalized,Ct=Tt.itemSize,Yt=e.get(Tt);if(Yt===void 0)continue;let Wt=Yt.buffer,Nt=Yt.type,ne=Yt.bytesPerElement,Pt=o.isWebGL2===!0&&(Nt===r.INT||Nt===r.UNSIGNED_INT||Tt.gpuType===t0);if(Tt.isInterleavedBufferAttribute){let Xt=Tt.data,tt=Xt.stride,nn=Tt.offset;if(Xt.isInstancedInterleavedBuffer){for(let Gt=0;Gt<at.locationSize;Gt++)F(at.location+Gt,Xt.meshPerAttribute);X.isInstancedMesh!==!0&&pt._maxInstanceCount===void 0&&(pt._maxInstanceCount=Xt.meshPerAttribute*Xt.count)}else for(let Gt=0;Gt<at.locationSize;Gt++)O(at.location+Gt);r.bindBuffer(r.ARRAY_BUFFER,Wt);for(let Gt=0;Gt<at.locationSize;Gt++)z(at.location+Gt,Ct/at.locationSize,Nt,dt,tt*ne,(nn+Ct/at.locationSize*Gt)*ne,Pt)}else{if(Tt.isInstancedBufferAttribute){for(let Xt=0;Xt<at.locationSize;Xt++)F(at.location+Xt,Tt.meshPerAttribute);X.isInstancedMesh!==!0&&pt._maxInstanceCount===void 0&&(pt._maxInstanceCount=Tt.meshPerAttribute*Tt.count)}else for(let Xt=0;Xt<at.locationSize;Xt++)O(at.location+Xt);r.bindBuffer(r.ARRAY_BUFFER,Wt);for(let Xt=0;Xt<at.locationSize;Xt++)z(at.location+Xt,Ct/at.locationSize,Nt,dt,Ct*ne,Ct/at.locationSize*Xt*ne,Pt)}}else if(V!==void 0){let dt=V[K];if(dt!==void 0)switch(dt.length){case 2:r.vertexAttrib2fv(at.location,dt);break;case 3:r.vertexAttrib3fv(at.location,dt);break;case 4:r.vertexAttrib4fv(at.location,dt);break;default:r.vertexAttrib1fv(at.location,dt)}}}}G()}function D(){k();for(let X in h){let it=h[X];for(let vt in it){let pt=it[vt];for(let et in pt)w(pt[et].object),delete pt[et];delete it[vt]}delete h[X]}}function q(X){if(h[X.id]===void 0)return;let it=h[X.id];for(let vt in it){let pt=it[vt];for(let et in pt)w(pt[et].object),delete pt[et];delete it[vt]}delete h[X.id]}function nt(X){for(let it in h){let vt=h[it];if(vt[X.id]===void 0)continue;let pt=vt[X.id];for(let et in pt)w(pt[et].object),delete pt[et];delete vt[X.id]}}function k(){xt(),g=!0,d!==p&&(d=p,M(d.object))}function xt(){p.geometry=null,p.program=null,p.wireframe=!1}return{setup:_,reset:k,resetDefaultState:xt,dispose:D,releaseStatesOfGeometry:q,releaseStatesOfProgram:nt,initAttributes:S,enableAttribute:O,disableUnusedAttributes:G}}function DS(r,t,e,o){let a=o.isWebGL2,l;function f(d){l=d}function h(d,g){r.drawArrays(l,d,g),e.update(g,l,1)}function p(d,g,_){if(_===0)return;let y,M;if(a)y=r,M="drawArraysInstanced";else if(y=t.get("ANGLE_instanced_arrays"),M="drawArraysInstancedANGLE",y===null){console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");return}y[M](l,d,g,_),e.update(g,l,_)}this.setMode=f,this.render=h,this.renderInstances=p}function FS(r,t,e){let o;function a(){if(o!==void 0)return o;if(t.has("EXT_texture_filter_anisotropic")===!0){let z=t.get("EXT_texture_filter_anisotropic");o=r.getParameter(z.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else o=0;return o}function l(z){if(z==="highp"){if(r.getShaderPrecisionFormat(r.VERTEX_SHADER,r.HIGH_FLOAT).precision>0&&r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.HIGH_FLOAT).precision>0)return"highp";z="mediump"}return z==="mediump"&&r.getShaderPrecisionFormat(r.VERTEX_SHADER,r.MEDIUM_FLOAT).precision>0&&r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let f=typeof WebGL2RenderingContext!="undefined"&&r.constructor.name==="WebGL2RenderingContext",h=e.precision!==void 0?e.precision:"highp",p=l(h);p!==h&&(console.warn("THREE.WebGLRenderer:",h,"not supported, using",p,"instead."),h=p);let d=f||t.has("WEBGL_draw_buffers"),g=e.logarithmicDepthBuffer===!0,_=r.getParameter(r.MAX_TEXTURE_IMAGE_UNITS),y=r.getParameter(r.MAX_VERTEX_TEXTURE_IMAGE_UNITS),M=r.getParameter(r.MAX_TEXTURE_SIZE),w=r.getParameter(r.MAX_CUBE_MAP_TEXTURE_SIZE),A=r.getParameter(r.MAX_VERTEX_ATTRIBS),x=r.getParameter(r.MAX_VERTEX_UNIFORM_VECTORS),v=r.getParameter(r.MAX_VARYING_VECTORS),C=r.getParameter(r.MAX_FRAGMENT_UNIFORM_VECTORS),S=y>0,O=f||t.has("OES_texture_float"),F=S&&O,G=f?r.getParameter(r.MAX_SAMPLES):0;return{isWebGL2:f,drawBuffers:d,getMaxAnisotropy:a,getMaxPrecision:l,precision:h,logarithmicDepthBuffer:g,maxTextures:_,maxVertexTextures:y,maxTextureSize:M,maxCubemapSize:w,maxAttributes:A,maxVertexUniforms:x,maxVaryings:v,maxFragmentUniforms:C,vertexTextures:S,floatFragmentTextures:O,floatVertexTextures:F,maxSamples:G}}function US(r){let t=this,e=null,o=0,a=!1,l=!1,f=new ko,h=new ve,p={value:null,needsUpdate:!1};this.uniform=p,this.numPlanes=0,this.numIntersection=0,this.init=function(_,y){let M=_.length!==0||y||o!==0||a;return a=y,o=_.length,M},this.beginShadows=function(){l=!0,g(null)},this.endShadows=function(){l=!1},this.setGlobalState=function(_,y){e=g(_,y,0)},this.setState=function(_,y,M){let w=_.clippingPlanes,A=_.clipIntersection,x=_.clipShadows,v=r.get(_);if(!a||w===null||w.length===0||l&&!x)l?g(null):d();else{let C=l?0:o,S=C*4,O=v.clippingState||null;p.value=O,O=g(w,y,S,M);for(let F=0;F!==S;++F)O[F]=e[F];v.clippingState=O,this.numIntersection=A?this.numPlanes:0,this.numPlanes+=C}};function d(){p.value!==e&&(p.value=e,p.needsUpdate=o>0),t.numPlanes=o,t.numIntersection=0}function g(_,y,M,w){let A=_!==null?_.length:0,x=null;if(A!==0){if(x=p.value,w!==!0||x===null){let v=M+A*4,C=y.matrixWorldInverse;h.getNormalMatrix(C),(x===null||x.length<v)&&(x=new Float32Array(v));for(let S=0,O=M;S!==A;++S,O+=4)f.copy(_[S]).applyMatrix4(C,h),f.normal.toArray(x,O),x[O+3]=f.constant}p.value=x,p.needsUpdate=!0}return t.numPlanes=A,t.numIntersection=0,x}}function BS(r){let t=new WeakMap;function e(f,h){return h===ah?f.mapping=za:h===uh&&(f.mapping=ka),f}function o(f){if(f&&f.isTexture&&f.isRenderTargetTexture===!1){let h=f.mapping;if(h===ah||h===uh)if(t.has(f)){let p=t.get(f).texture;return e(p,f.mapping)}else{let p=f.image;if(p&&p.height>0){let d=new vh(p.height/2);return d.fromEquirectangularTexture(r,f),t.set(f,d),f.addEventListener("dispose",a),e(d.texture,f.mapping)}else return null}}return f}function a(f){let h=f.target;h.removeEventListener("dispose",a);let p=t.get(h);p!==void 0&&(t.delete(h),p.dispose())}function l(){t=new WeakMap}return{get:o,dispose:l}}var xh=class extends uc{constructor(t=-1,e=1,o=1,a=-1,l=.1,f=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=t,this.right=e,this.top=o,this.bottom=a,this.near=l,this.far=f,this.updateProjectionMatrix()}copy(t,e){return super.copy(t,e),this.left=t.left,this.right=t.right,this.top=t.top,this.bottom=t.bottom,this.near=t.near,this.far=t.far,this.zoom=t.zoom,this.view=t.view===null?null:Object.assign({},t.view),this}setViewOffset(t,e,o,a,l,f){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=t,this.view.fullHeight=e,this.view.offsetX=o,this.view.offsetY=a,this.view.width=l,this.view.height=f,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){let t=(this.right-this.left)/(2*this.zoom),e=(this.top-this.bottom)/(2*this.zoom),o=(this.right+this.left)/2,a=(this.top+this.bottom)/2,l=o-t,f=o+t,h=a+e,p=a-e;if(this.view!==null&&this.view.enabled){let d=(this.right-this.left)/this.view.fullWidth/this.zoom,g=(this.top-this.bottom)/this.view.fullHeight/this.zoom;l+=d*this.view.offsetX,f=l+d*this.view.width,h-=g*this.view.offsetY,p=h-g*this.view.height}this.projectionMatrix.makeOrthographic(l,f,h,p,this.near,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(t){let e=super.toJSON(t);return e.object.zoom=this.zoom,e.object.left=this.left,e.object.right=this.right,e.object.top=this.top,e.object.bottom=this.bottom,e.object.near=this.near,e.object.far=this.far,this.view!==null&&(e.object.view=Object.assign({},this.view)),e}},Oa=4,Cg=[.125,.215,.35,.446,.526,.582],Gs=20,rh=new xh,Pg=new xn,ih=null,ks=(1+Math.sqrt(5))/2,Ra=1/ks,Ig=[new mt(1,1,1),new mt(-1,1,1),new mt(1,1,-1),new mt(-1,1,-1),new mt(0,ks,Ra),new mt(0,ks,-Ra),new mt(Ra,0,ks),new mt(-Ra,0,ks),new mt(ks,Ra,0),new mt(-ks,Ra,0)],fc=class{constructor(t){this._renderer=t,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}fromScene(t,e=0,o=.1,a=100){ih=this._renderer.getRenderTarget(),this._setSize(256);let l=this._allocateTargets();return l.depthBuffer=!0,this._sceneToCubeUV(t,o,a,l),e>0&&this._blur(l,0,0,e),this._applyPMREM(l),this._cleanup(l),l}fromEquirectangular(t,e=null){return this._fromTexture(t,e)}fromCubemap(t,e=null){return this._fromTexture(t,e)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=Ng(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=Lg(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose()}_setSize(t){this._lodMax=Math.floor(Math.log2(t)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let t=0;t<this._lodPlanes.length;t++)this._lodPlanes[t].dispose()}_cleanup(t){this._renderer.setRenderTarget(ih),t.scissorTest=!1,ql(t,0,0,t.width,t.height)}_fromTexture(t,e){t.mapping===za||t.mapping===ka?this._setSize(t.image.length===0?16:t.image[0].width||t.image[0].image.width):this._setSize(t.image.width/4),ih=this._renderer.getRenderTarget();let o=e||this._allocateTargets();return this._textureToCubeUV(t,o),this._applyPMREM(o),this._cleanup(o),o}_allocateTargets(){let t=3*Math.max(this._cubeSize,112),e=4*this._cubeSize,o={magFilter:Ni,minFilter:Ni,generateMipmaps:!1,type:Du,format:$i,colorSpace:Wo,depthBuffer:!1},a=Rg(t,e,o);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==t||this._pingPongRenderTarget.height!==e){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=Rg(t,e,o);let{_lodMax:l}=this;({sizeLods:this._sizeLods,lodPlanes:this._lodPlanes,sigmas:this._sigmas}=zS(l)),this._blurMaterial=kS(l,t,e)}return a}_compileMaterial(t){let e=new co(this._lodPlanes[0],t);this._renderer.compile(e,rh)}_sceneToCubeUV(t,e,o,a){let h=new xi(90,1,e,o),p=[1,-1,1,1,1,1],d=[1,1,1,-1,-1,-1],g=this._renderer,_=g.autoClear,y=g.toneMapping;g.getClearColor(Pg),g.toneMapping=fs,g.autoClear=!1;let M=new oc({name:"PMREM.Background",side:ui,depthWrite:!1,depthTest:!1}),w=new co(new Uu,M),A=!1,x=t.background;x?x.isColor&&(M.color.copy(x),t.background=null,A=!0):(M.color.copy(Pg),A=!0);for(let v=0;v<6;v++){let C=v%3;C===0?(h.up.set(0,p[v],0),h.lookAt(d[v],0,0)):C===1?(h.up.set(0,0,p[v]),h.lookAt(0,d[v],0)):(h.up.set(0,p[v],0),h.lookAt(0,0,d[v]));let S=this._cubeSize;ql(a,C*S,v>2?S:0,S,S),g.setRenderTarget(a),A&&g.render(w,h),g.render(t,h)}w.geometry.dispose(),w.material.dispose(),g.toneMapping=y,g.autoClear=_,t.background=x}_textureToCubeUV(t,e){let o=this._renderer,a=t.mapping===za||t.mapping===ka;a?(this._cubemapMaterial===null&&(this._cubemapMaterial=Ng()),this._cubemapMaterial.uniforms.flipEnvMap.value=t.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=Lg());let l=a?this._cubemapMaterial:this._equirectMaterial,f=new co(this._lodPlanes[0],l),h=l.uniforms;h.envMap.value=t;let p=this._cubeSize;ql(e,0,0,3*p,2*p),o.setRenderTarget(e),o.render(f,rh)}_applyPMREM(t){let e=this._renderer,o=e.autoClear;e.autoClear=!1;for(let a=1;a<this._lodPlanes.length;a++){let l=Math.sqrt(this._sigmas[a]*this._sigmas[a]-this._sigmas[a-1]*this._sigmas[a-1]),f=Ig[(a-1)%Ig.length];this._blur(t,a-1,a,l,f)}e.autoClear=o}_blur(t,e,o,a,l){let f=this._pingPongRenderTarget;this._halfBlur(t,f,e,o,a,"latitudinal",l),this._halfBlur(f,t,o,o,a,"longitudinal",l)}_halfBlur(t,e,o,a,l,f,h){let p=this._renderer,d=this._blurMaterial;f!=="latitudinal"&&f!=="longitudinal"&&console.error("blur direction must be either latitudinal or longitudinal!");let g=3,_=new co(this._lodPlanes[a],d),y=d.uniforms,M=this._sizeLods[o]-1,w=isFinite(l)?Math.PI/(2*M):2*Math.PI/(2*Gs-1),A=l/w,x=isFinite(l)?1+Math.floor(g*A):Gs;x>Gs&&console.warn(`sigmaRadians, ${l}, is too large and will clip, as it requested ${x} samples when the maximum is set to ${Gs}`);let v=[],C=0;for(let z=0;z<Gs;++z){let L=z/A,D=Math.exp(-L*L/2);v.push(D),z===0?C+=D:z<x&&(C+=2*D)}for(let z=0;z<v.length;z++)v[z]=v[z]/C;y.envMap.value=t.texture,y.samples.value=x,y.weights.value=v,y.latitudinal.value=f==="latitudinal",h&&(y.poleAxis.value=h);let{_lodMax:S}=this;y.dTheta.value=w,y.mipInt.value=S-o;let O=this._sizeLods[a],F=3*O*(a>S-Oa?a-S+Oa:0),G=4*(this._cubeSize-O);ql(e,F,G,3*O,2*O),p.setRenderTarget(e),p.render(_,rh)}};function zS(r){let t=[],e=[],o=[],a=r,l=r-Oa+1+Cg.length;for(let f=0;f<l;f++){let h=Math.pow(2,a);e.push(h);let p=1/h;f>r-Oa?p=Cg[f-r+Oa-1]:f===0&&(p=0),o.push(p);let d=1/(h-2),g=-d,_=1+d,y=[g,g,_,g,_,_,g,g,_,_,g,_],M=6,w=6,A=3,x=2,v=1,C=new Float32Array(A*w*M),S=new Float32Array(x*w*M),O=new Float32Array(v*w*M);for(let G=0;G<M;G++){let z=G%3*2/3-1,L=G>2?0:-1,D=[z,L,0,z+2/3,L,0,z+2/3,L+1,0,z,L,0,z+2/3,L+1,0,z,L+1,0];C.set(D,A*w*G),S.set(y,x*w*G);let q=[G,G,G,G,G,G];O.set(q,v*w*G)}let F=new Xs;F.setAttribute("position",new Di(C,A)),F.setAttribute("uv",new Di(S,x)),F.setAttribute("faceIndex",new Di(O,v)),t.push(F),a>Oa&&a--}return{lodPlanes:t,sizeLods:e,sigmas:o}}function Rg(r,t,e){let o=new qo(r,t,e);return o.texture.mapping=hc,o.texture.name="PMREM.cubeUv",o.scissorTest=!0,o}function ql(r,t,e,o,a){r.viewport.set(t,e,o,a),r.scissor.set(t,e,o,a)}function kS(r,t,e){let o=new Float32Array(Gs),a=new mt(0,1,0);return new Xo({name:"SphericalGaussianBlur",defines:{n:Gs,CUBEUV_TEXEL_WIDTH:1/t,CUBEUV_TEXEL_HEIGHT:1/e,CUBEUV_MAX_MIP:`${r}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:o},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:a}},vertexShader:Yh(),fragmentShader:`\n\n precision mediump float;\n precision mediump int;\n\n varying vec3 vOutputDirection;\n\n uniform sampler2D envMap;\n uniform int samples;\n uniform float weights[ n ];\n uniform bool latitudinal;\n uniform float dTheta;\n uniform float mipInt;\n uniform vec3 poleAxis;\n\n #define ENVMAP_TYPE_CUBE_UV\n #include <cube_uv_reflection_fragment>\n\n vec3 getSample( float theta, vec3 axis ) {\n\n float cosTheta = cos( theta );\n // Rodrigues\' axis-angle rotation\n vec3 sampleDirection = vOutputDirection * cosTheta\n + cross( axis, vOutputDirection ) * sin( theta )\n + axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );\n\n return bilinearCubeUV( envMap, sampleDirection, mipInt );\n\n }\n\n void main() {\n\n vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );\n\n if ( all( equal( axis, vec3( 0.0 ) ) ) ) {\n\n axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );\n\n }\n\n axis = normalize( axis );\n\n gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );\n\n for ( int i = 1; i < n; i++ ) {\n\n if ( i >= samples ) {\n\n break;\n\n }\n\n float theta = dTheta * float( i );\n gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );\n gl_FragColor.rgb += weights[ i ] * getSample( theta, axis );\n\n }\n\n }\n `,blending:cs,depthTest:!1,depthWrite:!1})}function Lg(){return new Xo({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:Yh(),fragmentShader:`\n\n precision mediump float;\n precision mediump int;\n\n varying vec3 vOutputDirection;\n\n uniform sampler2D envMap;\n\n #include <common>\n\n void main() {\n\n vec3 outputDirection = normalize( vOutputDirection );\n vec2 uv = equirectUv( outputDirection );\n\n gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );\n\n }\n `,blending:cs,depthTest:!1,depthWrite:!1})}function Ng(){return new Xo({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:Yh(),fragmentShader:`\n\n precision mediump float;\n precision mediump int;\n\n uniform float flipEnvMap;\n\n varying vec3 vOutputDirection;\n\n uniform samplerCube envMap;\n\n void main() {\n\n gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );\n\n }\n `,blending:cs,depthTest:!1,depthWrite:!1})}function Yh(){return`\n\n precision mediump float;\n precision mediump int;\n\n attribute float faceIndex;\n\n varying vec3 vOutputDirection;\n\n // RH coordinate system; PMREM face-indexing convention\n vec3 getDirection( vec2 uv, float face ) {\n\n uv = 2.0 * uv - 1.0;\n\n vec3 direction = vec3( uv, 1.0 );\n\n if ( face == 0.0 ) {\n\n direction = direction.zyx; // ( 1, v, u ) pos x\n\n } else if ( face == 1.0 ) {\n\n direction = direction.xzy;\n direction.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n } else if ( face == 2.0 ) {\n\n direction.x *= -1.0; // ( -u, v, 1 ) pos z\n\n } else if ( face == 3.0 ) {\n\n direction = direction.zyx;\n direction.xz *= -1.0; // ( -1, v, -u ) neg x\n\n } else if ( face == 4.0 ) {\n\n direction = direction.xzy;\n direction.xy *= -1.0; // ( -u, -1, v ) neg y\n\n } else if ( face == 5.0 ) {\n\n direction.z *= -1.0; // ( u, v, -1 ) neg z\n\n }\n\n return direction;\n\n }\n\n void main() {\n\n vOutputDirection = getDirection( uv, faceIndex );\n gl_Position = vec4( position, 1.0 );\n\n }\n `}function GS(r){let t=new WeakMap,e=null;function o(h){if(h&&h.isTexture){let p=h.mapping,d=p===ah||p===uh,g=p===za||p===ka;if(d||g)if(h.isRenderTargetTexture&&h.needsPMREMUpdate===!0){h.needsPMREMUpdate=!1;let _=t.get(h);return e===null&&(e=new fc(r)),_=d?e.fromEquirectangular(h,_):e.fromCubemap(h,_),t.set(h,_),_.texture}else{if(t.has(h))return t.get(h).texture;{let _=h.image;if(d&&_&&_.height>0||g&&_&&a(_)){e===null&&(e=new fc(r));let y=d?e.fromEquirectangular(h):e.fromCubemap(h);return t.set(h,y),h.addEventListener("dispose",l),y.texture}else return null}}}return h}function a(h){let p=0,d=6;for(let g=0;g<d;g++)h[g]!==void 0&&p++;return p===d}function l(h){let p=h.target;p.removeEventListener("dispose",l);let d=t.get(p);d!==void 0&&(t.delete(p),d.dispose())}function f(){t=new WeakMap,e!==null&&(e.dispose(),e=null)}return{get:o,dispose:f}}function VS(r){let t={};function e(o){if(t[o]!==void 0)return t[o];let a;switch(o){case"WEBGL_depth_texture":a=r.getExtension("WEBGL_depth_texture")||r.getExtension("MOZ_WEBGL_depth_texture")||r.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":a=r.getExtension("EXT_texture_filter_anisotropic")||r.getExtension("MOZ_EXT_texture_filter_anisotropic")||r.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":a=r.getExtension("WEBGL_compressed_texture_s3tc")||r.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||r.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":a=r.getExtension("WEBGL_compressed_texture_pvrtc")||r.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:a=r.getExtension(o)}return t[o]=a,a}return{has:function(o){return e(o)!==null},init:function(o){o.isWebGL2?e("EXT_color_buffer_float"):(e("WEBGL_depth_texture"),e("OES_texture_float"),e("OES_texture_half_float"),e("OES_texture_half_float_linear"),e("OES_standard_derivatives"),e("OES_element_index_uint"),e("OES_vertex_array_object"),e("ANGLE_instanced_arrays")),e("OES_texture_float_linear"),e("EXT_color_buffer_half_float"),e("WEBGL_multisampled_render_to_texture")},get:function(o){let a=e(o);return a===null&&console.warn("THREE.WebGLRenderer: "+o+" extension not supported."),a}}}function HS(r,t,e,o){let a={},l=new WeakMap;function f(_){let y=_.target;y.index!==null&&t.remove(y.index);for(let w in y.attributes)t.remove(y.attributes[w]);for(let w in y.morphAttributes){let A=y.morphAttributes[w];for(let x=0,v=A.length;x<v;x++)t.remove(A[x])}y.removeEventListener("dispose",f),delete a[y.id];let M=l.get(y);M&&(t.remove(M),l.delete(y)),o.releaseStatesOfGeometry(y),y.isInstancedBufferGeometry===!0&&delete y._maxInstanceCount,e.memory.geometries--}function h(_,y){return a[y.id]===!0||(y.addEventListener("dispose",f),a[y.id]=!0,e.memory.geometries++),y}function p(_){let y=_.attributes;for(let w in y)t.update(y[w],r.ARRAY_BUFFER);let M=_.morphAttributes;for(let w in M){let A=M[w];for(let x=0,v=A.length;x<v;x++)t.update(A[x],r.ARRAY_BUFFER)}}function d(_){let y=[],M=_.index,w=_.attributes.position,A=0;if(M!==null){let C=M.array;A=M.version;for(let S=0,O=C.length;S<O;S+=3){let F=C[S+0],G=C[S+1],z=C[S+2];y.push(F,G,G,z,z,F)}}else if(w!==void 0){let C=w.array;A=w.version;for(let S=0,O=C.length/3-1;S<O;S+=3){let F=S+0,G=S+1,z=S+2;y.push(F,G,G,z,z,F)}}else return;let x=new(a0(y)?ac:sc)(y,1);x.version=A;let v=l.get(_);v&&t.remove(v),l.set(_,x)}function g(_){let y=l.get(_);if(y){let M=_.index;M!==null&&y.version<M.version&&d(_)}else d(_);return l.get(_)}return{get:h,update:p,getWireframeAttribute:g}}function WS(r,t,e,o){let a=o.isWebGL2,l;function f(y){l=y}let h,p;function d(y){h=y.type,p=y.bytesPerElement}function g(y,M){r.drawElements(l,M,h,y*p),e.update(M,l,1)}function _(y,M,w){if(w===0)return;let A,x;if(a)A=r,x="drawElementsInstanced";else if(A=t.get("ANGLE_instanced_arrays"),x="drawElementsInstancedANGLE",A===null){console.error("THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");return}A[x](l,M,h,y*p,w),e.update(M,l,w)}this.setMode=f,this.setIndex=d,this.render=g,this.renderInstances=_}function qS(r){let t={geometries:0,textures:0},e={frame:0,calls:0,triangles:0,points:0,lines:0};function o(l,f,h){switch(e.calls++,f){case r.TRIANGLES:e.triangles+=h*(l/3);break;case r.LINES:e.lines+=h*(l/2);break;case r.LINE_STRIP:e.lines+=h*(l-1);break;case r.LINE_LOOP:e.lines+=h*l;break;case r.POINTS:e.points+=h*l;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",f);break}}function a(){e.calls=0,e.triangles=0,e.points=0,e.lines=0}return{memory:t,render:e,programs:null,autoReset:!0,reset:a,update:o}}function XS(r,t){return r[0]-t[0]}function YS(r,t){return Math.abs(t[1])-Math.abs(r[1])}function ZS(r,t,e){let o={},a=new Float32Array(8),l=new WeakMap,f=new Tr,h=[];for(let d=0;d<8;d++)h[d]=[d,0];function p(d,g,_){let y=d.morphTargetInfluences;if(t.isWebGL2===!0){let M=g.morphAttributes.position||g.morphAttributes.normal||g.morphAttributes.color,w=M!==void 0?M.length:0,A=l.get(g);if(A===void 0||A.count!==w){let X=function(){k.dispose(),l.delete(g),g.removeEventListener("dispose",X)};A!==void 0&&A.texture.dispose();let C=g.morphAttributes.position!==void 0,S=g.morphAttributes.normal!==void 0,O=g.morphAttributes.color!==void 0,F=g.morphAttributes.position||[],G=g.morphAttributes.normal||[],z=g.morphAttributes.color||[],L=0;C===!0&&(L=1),S===!0&&(L=2),O===!0&&(L=3);let D=g.attributes.position.count*L,q=1;D>t.maxTextureSize&&(q=Math.ceil(D/t.maxTextureSize),D=t.maxTextureSize);let nt=new Float32Array(D*q*4*w),k=new nc(nt,D,q,w);k.type=ls,k.needsUpdate=!0;let xt=L*4;for(let it=0;it<w;it++){let vt=F[it],pt=G[it],et=z[it],ot=D*q*4*it;for(let V=0;V<vt.count;V++){let K=V*xt;C===!0&&(f.fromBufferAttribute(vt,V),nt[ot+K+0]=f.x,nt[ot+K+1]=f.y,nt[ot+K+2]=f.z,nt[ot+K+3]=0),S===!0&&(f.fromBufferAttribute(pt,V),nt[ot+K+4]=f.x,nt[ot+K+5]=f.y,nt[ot+K+6]=f.z,nt[ot+K+7]=0),O===!0&&(f.fromBufferAttribute(et,V),nt[ot+K+8]=f.x,nt[ot+K+9]=f.y,nt[ot+K+10]=f.z,nt[ot+K+11]=et.itemSize===4?f.w:1)}}A={count:w,texture:k,size:new fn(D,q)},l.set(g,A),g.addEventListener("dispose",X)}let x=0;for(let C=0;C<y.length;C++)x+=y[C];let v=g.morphTargetsRelative?1:1-x;_.getUniforms().setValue(r,"morphTargetBaseInfluence",v),_.getUniforms().setValue(r,"morphTargetInfluences",y),_.getUniforms().setValue(r,"morphTargetsTexture",A.texture,e),_.getUniforms().setValue(r,"morphTargetsTextureSize",A.size)}else{let M=y===void 0?0:y.length,w=o[g.id];if(w===void 0||w.length!==M){w=[];for(let S=0;S<M;S++)w[S]=[S,0];o[g.id]=w}for(let S=0;S<M;S++){let O=w[S];O[0]=S,O[1]=y[S]}w.sort(YS);for(let S=0;S<8;S++)S<M&&w[S][1]?(h[S][0]=w[S][0],h[S][1]=w[S][1]):(h[S][0]=Number.MAX_SAFE_INTEGER,h[S][1]=0);h.sort(XS);let A=g.morphAttributes.position,x=g.morphAttributes.normal,v=0;for(let S=0;S<8;S++){let O=h[S],F=O[0],G=O[1];F!==Number.MAX_SAFE_INTEGER&&G?(A&&g.getAttribute("morphTarget"+S)!==A[F]&&g.setAttribute("morphTarget"+S,A[F]),x&&g.getAttribute("morphNormal"+S)!==x[F]&&g.setAttribute("morphNormal"+S,x[F]),a[S]=G,v+=G):(A&&g.hasAttribute("morphTarget"+S)===!0&&g.deleteAttribute("morphTarget"+S),x&&g.hasAttribute("morphNormal"+S)===!0&&g.deleteAttribute("morphNormal"+S),a[S]=0)}let C=g.morphTargetsRelative?1:1-v;_.getUniforms().setValue(r,"morphTargetBaseInfluence",C),_.getUniforms().setValue(r,"morphTargetInfluences",a)}}return{update:p}}function JS(r,t,e,o){let a=new WeakMap;function l(p){let d=o.render.frame,g=p.geometry,_=t.get(p,g);if(a.get(_)!==d&&(t.update(_),a.set(_,d)),p.isInstancedMesh&&(p.hasEventListener("dispose",h)===!1&&p.addEventListener("dispose",h),a.get(p)!==d&&(e.update(p.instanceMatrix,r.ARRAY_BUFFER),p.instanceColor!==null&&e.update(p.instanceColor,r.ARRAY_BUFFER),a.set(p,d))),p.isSkinnedMesh){let y=p.skeleton;a.get(y)!==d&&(y.update(),a.set(y,d))}return _}function f(){a=new WeakMap}function h(p){let d=p.target;d.removeEventListener("dispose",h),e.remove(d.instanceMatrix),d.instanceColor!==null&&e.remove(d.instanceColor)}return{update:l,dispose:f}}var f0=new Ki,h0=new nc,p0=new mh,d0=new lc,Og=[],Dg=[],Fg=new Float32Array(16),Ug=new Float32Array(9),Bg=new Float32Array(4);function qa(r,t,e){let o=r[0];if(o<=0||o>0)return r;let a=t*e,l=Og[a];if(l===void 0&&(l=new Float32Array(a),Og[a]=l),t!==0){o.toArray(l,0);for(let f=1,h=0;f!==t;++f)h+=e,r[f].toArray(l,h)}return l}function tr(r,t){if(r.length!==t.length)return!1;for(let e=0,o=r.length;e<o;e++)if(r[e]!==t[e])return!1;return!0}function er(r,t){for(let e=0,o=t.length;e<o;e++)r[e]=t[e]}function dc(r,t){let e=Dg[t];e===void 0&&(e=new Int32Array(t),Dg[t]=e);for(let o=0;o!==t;++o)e[o]=r.allocateTextureUnit();return e}function $S(r,t){let e=this.cache;e[0]!==t&&(r.uniform1f(this.addr,t),e[0]=t)}function KS(r,t){let e=this.cache;if(t.x!==void 0)(e[0]!==t.x||e[1]!==t.y)&&(r.uniform2f(this.addr,t.x,t.y),e[0]=t.x,e[1]=t.y);else{if(tr(e,t))return;r.uniform2fv(this.addr,t),er(e,t)}}function jS(r,t){let e=this.cache;if(t.x!==void 0)(e[0]!==t.x||e[1]!==t.y||e[2]!==t.z)&&(r.uniform3f(this.addr,t.x,t.y,t.z),e[0]=t.x,e[1]=t.y,e[2]=t.z);else if(t.r!==void 0)(e[0]!==t.r||e[1]!==t.g||e[2]!==t.b)&&(r.uniform3f(this.addr,t.r,t.g,t.b),e[0]=t.r,e[1]=t.g,e[2]=t.b);else{if(tr(e,t))return;r.uniform3fv(this.addr,t),er(e,t)}}function QS(r,t){let e=this.cache;if(t.x!==void 0)(e[0]!==t.x||e[1]!==t.y||e[2]!==t.z||e[3]!==t.w)&&(r.uniform4f(this.addr,t.x,t.y,t.z,t.w),e[0]=t.x,e[1]=t.y,e[2]=t.z,e[3]=t.w);else{if(tr(e,t))return;r.uniform4fv(this.addr,t),er(e,t)}}function tw(r,t){let e=this.cache,o=t.elements;if(o===void 0){if(tr(e,t))return;r.uniformMatrix2fv(this.addr,!1,t),er(e,t)}else{if(tr(e,o))return;Bg.set(o),r.uniformMatrix2fv(this.addr,!1,Bg),er(e,o)}}function ew(r,t){let e=this.cache,o=t.elements;if(o===void 0){if(tr(e,t))return;r.uniformMatrix3fv(this.addr,!1,t),er(e,t)}else{if(tr(e,o))return;Ug.set(o),r.uniformMatrix3fv(this.addr,!1,Ug),er(e,o)}}function nw(r,t){let e=this.cache,o=t.elements;if(o===void 0){if(tr(e,t))return;r.uniformMatrix4fv(this.addr,!1,t),er(e,t)}else{if(tr(e,o))return;Fg.set(o),r.uniformMatrix4fv(this.addr,!1,Fg),er(e,o)}}function rw(r,t){let e=this.cache;e[0]!==t&&(r.uniform1i(this.addr,t),e[0]=t)}function iw(r,t){let e=this.cache;if(t.x!==void 0)(e[0]!==t.x||e[1]!==t.y)&&(r.uniform2i(this.addr,t.x,t.y),e[0]=t.x,e[1]=t.y);else{if(tr(e,t))return;r.uniform2iv(this.addr,t),er(e,t)}}function ow(r,t){let e=this.cache;if(t.x!==void 0)(e[0]!==t.x||e[1]!==t.y||e[2]!==t.z)&&(r.uniform3i(this.addr,t.x,t.y,t.z),e[0]=t.x,e[1]=t.y,e[2]=t.z);else{if(tr(e,t))return;r.uniform3iv(this.addr,t),er(e,t)}}function sw(r,t){let e=this.cache;if(t.x!==void 0)(e[0]!==t.x||e[1]!==t.y||e[2]!==t.z||e[3]!==t.w)&&(r.uniform4i(this.addr,t.x,t.y,t.z,t.w),e[0]=t.x,e[1]=t.y,e[2]=t.z,e[3]=t.w);else{if(tr(e,t))return;r.uniform4iv(this.addr,t),er(e,t)}}function aw(r,t){let e=this.cache;e[0]!==t&&(r.uniform1ui(this.addr,t),e[0]=t)}function uw(r,t){let e=this.cache;if(t.x!==void 0)(e[0]!==t.x||e[1]!==t.y)&&(r.uniform2ui(this.addr,t.x,t.y),e[0]=t.x,e[1]=t.y);else{if(tr(e,t))return;r.uniform2uiv(this.addr,t),er(e,t)}}function lw(r,t){let e=this.cache;if(t.x!==void 0)(e[0]!==t.x||e[1]!==t.y||e[2]!==t.z)&&(r.uniform3ui(this.addr,t.x,t.y,t.z),e[0]=t.x,e[1]=t.y,e[2]=t.z);else{if(tr(e,t))return;r.uniform3uiv(this.addr,t),er(e,t)}}function cw(r,t){let e=this.cache;if(t.x!==void 0)(e[0]!==t.x||e[1]!==t.y||e[2]!==t.z||e[3]!==t.w)&&(r.uniform4ui(this.addr,t.x,t.y,t.z,t.w),e[0]=t.x,e[1]=t.y,e[2]=t.z,e[3]=t.w);else{if(tr(e,t))return;r.uniform4uiv(this.addr,t),er(e,t)}}function fw(r,t,e){let o=this.cache,a=e.allocateTextureUnit();o[0]!==a&&(r.uniform1i(this.addr,a),o[0]=a),e.setTexture2D(t||f0,a)}function hw(r,t,e){let o=this.cache,a=e.allocateTextureUnit();o[0]!==a&&(r.uniform1i(this.addr,a),o[0]=a),e.setTexture3D(t||p0,a)}function pw(r,t,e){let o=this.cache,a=e.allocateTextureUnit();o[0]!==a&&(r.uniform1i(this.addr,a),o[0]=a),e.setTextureCube(t||d0,a)}function dw(r,t,e){let o=this.cache,a=e.allocateTextureUnit();o[0]!==a&&(r.uniform1i(this.addr,a),o[0]=a),e.setTexture2DArray(t||h0,a)}function mw(r){switch(r){case 5126:return $S;case 35664:return KS;case 35665:return jS;case 35666:return QS;case 35674:return tw;case 35675:return ew;case 35676:return nw;case 5124:case 35670:return rw;case 35667:case 35671:return iw;case 35668:case 35672:return ow;case 35669:case 35673:return sw;case 5125:return aw;case 36294:return uw;case 36295:return lw;case 36296:return cw;case 35678:case 36198:case 36298:case 36306:case 35682:return fw;case 35679:case 36299:case 36307:return hw;case 35680:case 36300:case 36308:case 36293:return pw;case 36289:case 36303:case 36311:case 36292:return dw}}function gw(r,t){r.uniform1fv(this.addr,t)}function yw(r,t){let e=qa(t,this.size,2);r.uniform2fv(this.addr,e)}function vw(r,t){let e=qa(t,this.size,3);r.uniform3fv(this.addr,e)}function _w(r,t){let e=qa(t,this.size,4);r.uniform4fv(this.addr,e)}function xw(r,t){let e=qa(t,this.size,4);r.uniformMatrix2fv(this.addr,!1,e)}function Ew(r,t){let e=qa(t,this.size,9);r.uniformMatrix3fv(this.addr,!1,e)}function Mw(r,t){let e=qa(t,this.size,16);r.uniformMatrix4fv(this.addr,!1,e)}function Sw(r,t){r.uniform1iv(this.addr,t)}function ww(r,t){r.uniform2iv(this.addr,t)}function bw(r,t){r.uniform3iv(this.addr,t)}function Tw(r,t){r.uniform4iv(this.addr,t)}function Aw(r,t){r.uniform1uiv(this.addr,t)}function Cw(r,t){r.uniform2uiv(this.addr,t)}function Pw(r,t){r.uniform3uiv(this.addr,t)}function Iw(r,t){r.uniform4uiv(this.addr,t)}function Rw(r,t,e){let o=this.cache,a=t.length,l=dc(e,a);tr(o,l)||(r.uniform1iv(this.addr,l),er(o,l));for(let f=0;f!==a;++f)e.setTexture2D(t[f]||f0,l[f])}function Lw(r,t,e){let o=this.cache,a=t.length,l=dc(e,a);tr(o,l)||(r.uniform1iv(this.addr,l),er(o,l));for(let f=0;f!==a;++f)e.setTexture3D(t[f]||p0,l[f])}function Nw(r,t,e){let o=this.cache,a=t.length,l=dc(e,a);tr(o,l)||(r.uniform1iv(this.addr,l),er(o,l));for(let f=0;f!==a;++f)e.setTextureCube(t[f]||d0,l[f])}function Ow(r,t,e){let o=this.cache,a=t.length,l=dc(e,a);tr(o,l)||(r.uniform1iv(this.addr,l),er(o,l));for(let f=0;f!==a;++f)e.setTexture2DArray(t[f]||h0,l[f])}function Dw(r){switch(r){case 5126:return gw;case 35664:return yw;case 35665:return vw;case 35666:return _w;case 35674:return xw;case 35675:return Ew;case 35676:return Mw;case 5124:case 35670:return Sw;case 35667:case 35671:return ww;case 35668:case 35672:return bw;case 35669:case 35673:return Tw;case 5125:return Aw;case 36294:return Cw;case 36295:return Pw;case 36296:return Iw;case 35678:case 36198:case 36298:case 36306:case 35682:return Rw;case 35679:case 36299:case 36307:return Lw;case 35680:case 36300:case 36308:case 36293:return Nw;case 36289:case 36303:case 36311:case 36292:return Ow}}var Eh=class{constructor(t,e,o){this.id=t,this.addr=o,this.cache=[],this.setValue=mw(e.type)}},Mh=class{constructor(t,e,o){this.id=t,this.addr=o,this.cache=[],this.size=e.size,this.setValue=Dw(e.type)}},Sh=class{constructor(t){this.id=t,this.seq=[],this.map={}}setValue(t,e,o){let a=this.seq;for(let l=0,f=a.length;l!==f;++l){let h=a[l];h.setValue(t,e[h.id],o)}}},oh=/(\\w+)(\\])?(\\[|\\.)?/g;function zg(r,t){r.seq.push(t),r.map[t.id]=t}function Fw(r,t,e){let o=r.name,a=o.length;for(oh.lastIndex=0;;){let l=oh.exec(o),f=oh.lastIndex,h=l[1],p=l[2]==="]",d=l[3];if(p&&(h=h|0),d===void 0||d==="["&&f+2===a){zg(e,d===void 0?new Eh(h,r,t):new Mh(h,r,t));break}else{let _=e.map[h];_===void 0&&(_=new Sh(h),zg(e,_)),e=_}}}var Ba=class{constructor(t,e){this.seq=[],this.map={};let o=t.getProgramParameter(e,t.ACTIVE_UNIFORMS);for(let a=0;a<o;++a){let l=t.getActiveUniform(e,a),f=t.getUniformLocation(e,l.name);Fw(l,f,this)}}setValue(t,e,o,a){let l=this.map[e];l!==void 0&&l.setValue(t,o,a)}setOptional(t,e,o){let a=e[o];a!==void 0&&this.setValue(t,o,a)}static upload(t,e,o,a){for(let l=0,f=e.length;l!==f;++l){let h=e[l],p=o[h.id];p.needsUpdate!==!1&&h.setValue(t,p.value,a)}}static seqWithValue(t,e){let o=[];for(let a=0,l=t.length;a!==l;++a){let f=t[a];f.id in e&&o.push(f)}return o}};function kg(r,t,e){let o=r.createShader(t);return r.shaderSource(o,e),r.compileShader(o),o}var Uw=0;function Bw(r,t){let e=r.split(`\n`),o=[],a=Math.max(t-6,0),l=Math.min(t+6,e.length);for(let f=a;f<l;f++){let h=f+1;o.push(`${h===t?">":" "} ${h}: ${e[f]}`)}return o.join(`\n`)}function zw(r){let t=gn.getPrimaries(gn.workingColorSpace),e=gn.getPrimaries(r),o;switch(t===e?o="":t===Kl&&e===$l?o="LinearDisplayP3ToLinearSRGB":t===$l&&e===Kl&&(o="LinearSRGBToLinearDisplayP3"),r){case Wo:case pc:return[o,"LinearTransferOETF"];case br:case Xh:return[o,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space:",r),[o,"LinearTransferOETF"]}}function Gg(r,t,e){let o=r.getShaderParameter(t,r.COMPILE_STATUS),a=r.getShaderInfoLog(t).trim();if(o&&a==="")return"";let l=/ERROR: 0:(\\d+)/.exec(a);if(l){let f=parseInt(l[1]);return e.toUpperCase()+`\n\n`+a+`\n\n`+Bw(r.getShaderSource(t),f)}else return a}function kw(r,t){let e=zw(t);return`vec4 ${r}( vec4 value ) { return ${e[0]}( ${e[1]}( value ) ); }`}function Gw(r,t){let e;switch(t){case ox:e="Linear";break;case sx:e="Reinhard";break;case ax:e="OptimizedCineon";break;case ux:e="ACESFilmic";break;case lx:e="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",t),e="Linear"}return"vec3 "+r+"( vec3 color ) { return "+e+"ToneMapping( color ); }"}function Vw(r){return[r.extensionDerivatives||r.envMapCubeUVHeight||r.bumpMap||r.normalMapTangentSpace||r.clearcoatNormalMap||r.flatShading||r.shaderID==="physical"?"#extension GL_OES_standard_derivatives : enable":"",(r.extensionFragDepth||r.logarithmicDepthBuffer)&&r.rendererExtensionFragDepth?"#extension GL_EXT_frag_depth : enable":"",r.extensionDrawBuffers&&r.rendererExtensionDrawBuffers?"#extension GL_EXT_draw_buffers : require":"",(r.extensionShaderTextureLOD||r.envMap||r.transmission)&&r.rendererExtensionShaderTextureLod?"#extension GL_EXT_shader_texture_lod : enable":""].filter(Ru).join(`\n`)}function Hw(r){let t=[];for(let e in r){let o=r[e];o!==!1&&t.push("#define "+e+" "+o)}return t.join(`\n`)}function Ww(r,t){let e={},o=r.getProgramParameter(t,r.ACTIVE_ATTRIBUTES);for(let a=0;a<o;a++){let l=r.getActiveAttrib(t,a),f=l.name,h=1;l.type===r.FLOAT_MAT2&&(h=2),l.type===r.FLOAT_MAT3&&(h=3),l.type===r.FLOAT_MAT4&&(h=4),e[f]={type:l.type,location:r.getAttribLocation(t,f),locationSize:h}}return e}function Ru(r){return r!==""}function Vg(r,t){let e=t.numSpotLightShadows+t.numSpotLightMaps-t.numSpotLightShadowsWithMaps;return r.replace(/NUM_DIR_LIGHTS/g,t.numDirLights).replace(/NUM_SPOT_LIGHTS/g,t.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,t.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,e).replace(/NUM_RECT_AREA_LIGHTS/g,t.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,t.numPointLights).replace(/NUM_HEMI_LIGHTS/g,t.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,t.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,t.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,t.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,t.numPointLightShadows)}function Hg(r,t){return r.replace(/NUM_CLIPPING_PLANES/g,t.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,t.numClippingPlanes-t.numClipIntersection)}var qw=/^[ \\t]*#include +<([\\w\\d./]+)>/gm;function wh(r){return r.replace(qw,Yw)}var Xw=new Map([["encodings_fragment","colorspace_fragment"],["encodings_pars_fragment","colorspace_pars_fragment"],["output_fragment","opaque_fragment"]]);function Yw(r,t){let e=ge[t];if(e===void 0){let o=Xw.get(t);if(o!==void 0)e=ge[o],console.warn(\'THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.\',t,o);else throw new Error("Can not resolve #include <"+t+">")}return wh(e)}var Zw=/#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 Wg(r){return r.replace(Zw,Jw)}function Jw(r,t,e,o){let a="";for(let l=parseInt(t);l<parseInt(e);l++)a+=o.replace(/\\[\\s*i\\s*\\]/g,"[ "+l+" ]").replace(/UNROLLED_LOOP_INDEX/g,l);return a}function qg(r){let t="precision "+r.precision+` float;\nprecision `+r.precision+" int;";return r.precision==="highp"?t+=`\n#define HIGH_PRECISION`:r.precision==="mediump"?t+=`\n#define MEDIUM_PRECISION`:r.precision==="lowp"&&(t+=`\n#define LOW_PRECISION`),t}function $w(r){let t="SHADOWMAP_TYPE_BASIC";return r.shadowMapType===Jg?t="SHADOWMAP_TYPE_PCF":r.shadowMapType===U1?t="SHADOWMAP_TYPE_PCF_SOFT":r.shadowMapType===zo&&(t="SHADOWMAP_TYPE_VSM"),t}function Kw(r){let t="ENVMAP_TYPE_CUBE";if(r.envMap)switch(r.envMapMode){case za:case ka:t="ENVMAP_TYPE_CUBE";break;case hc:t="ENVMAP_TYPE_CUBE_UV";break}return t}function jw(r){let t="ENVMAP_MODE_REFLECTION";if(r.envMap)switch(r.envMapMode){case ka:t="ENVMAP_MODE_REFRACTION";break}return t}function Qw(r){let t="ENVMAP_BLENDING_NONE";if(r.envMap)switch(r.combine){case jg:t="ENVMAP_BLENDING_MULTIPLY";break;case rx:t="ENVMAP_BLENDING_MIX";break;case ix:t="ENVMAP_BLENDING_ADD";break}return t}function tb(r){let t=r.envMapCubeUVHeight;if(t===null)return null;let e=Math.log2(t)-2,o=1/t;return{texelWidth:1/(3*Math.max(Math.pow(2,e),7*16)),texelHeight:o,maxMip:e}}function eb(r,t,e,o){let a=r.getContext(),l=e.defines,f=e.vertexShader,h=e.fragmentShader,p=$w(e),d=Kw(e),g=jw(e),_=Qw(e),y=tb(e),M=e.isWebGL2?"":Vw(e),w=Hw(l),A=a.createProgram(),x,v,C=e.glslVersion?"#version "+e.glslVersion+`\n`:"";e.isRawShaderMaterial?(x=["#define SHADER_TYPE "+e.shaderType,"#define SHADER_NAME "+e.shaderName,w].filter(Ru).join(`\n`),x.length>0&&(x+=`\n`),v=[M,"#define SHADER_TYPE "+e.shaderType,"#define SHADER_NAME "+e.shaderName,w].filter(Ru).join(`\n`),v.length>0&&(v+=`\n`)):(x=[qg(e),"#define SHADER_TYPE "+e.shaderType,"#define SHADER_NAME "+e.shaderName,w,e.instancing?"#define USE_INSTANCING":"",e.instancingColor?"#define USE_INSTANCING_COLOR":"",e.useFog&&e.fog?"#define USE_FOG":"",e.useFog&&e.fogExp2?"#define FOG_EXP2":"",e.map?"#define USE_MAP":"",e.envMap?"#define USE_ENVMAP":"",e.envMap?"#define "+g:"",e.lightMap?"#define USE_LIGHTMAP":"",e.aoMap?"#define USE_AOMAP":"",e.bumpMap?"#define USE_BUMPMAP":"",e.normalMap?"#define USE_NORMALMAP":"",e.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",e.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",e.displacementMap?"#define USE_DISPLACEMENTMAP":"",e.emissiveMap?"#define USE_EMISSIVEMAP":"",e.anisotropy?"#define USE_ANISOTROPY":"",e.anisotropyMap?"#define USE_ANISOTROPYMAP":"",e.clearcoatMap?"#define USE_CLEARCOATMAP":"",e.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",e.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",e.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",e.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",e.specularMap?"#define USE_SPECULARMAP":"",e.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",e.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",e.roughnessMap?"#define USE_ROUGHNESSMAP":"",e.metalnessMap?"#define USE_METALNESSMAP":"",e.alphaMap?"#define USE_ALPHAMAP":"",e.alphaHash?"#define USE_ALPHAHASH":"",e.transmission?"#define USE_TRANSMISSION":"",e.transmissionMap?"#define USE_TRANSMISSIONMAP":"",e.thicknessMap?"#define USE_THICKNESSMAP":"",e.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",e.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",e.mapUv?"#define MAP_UV "+e.mapUv:"",e.alphaMapUv?"#define ALPHAMAP_UV "+e.alphaMapUv:"",e.lightMapUv?"#define LIGHTMAP_UV "+e.lightMapUv:"",e.aoMapUv?"#define AOMAP_UV "+e.aoMapUv:"",e.emissiveMapUv?"#define EMISSIVEMAP_UV "+e.emissiveMapUv:"",e.bumpMapUv?"#define BUMPMAP_UV "+e.bumpMapUv:"",e.normalMapUv?"#define NORMALMAP_UV "+e.normalMapUv:"",e.displacementMapUv?"#define DISPLACEMENTMAP_UV "+e.displacementMapUv:"",e.metalnessMapUv?"#define METALNESSMAP_UV "+e.metalnessMapUv:"",e.roughnessMapUv?"#define ROUGHNESSMAP_UV "+e.roughnessMapUv:"",e.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+e.anisotropyMapUv:"",e.clearcoatMapUv?"#define CLEARCOATMAP_UV "+e.clearcoatMapUv:"",e.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+e.clearcoatNormalMapUv:"",e.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+e.clearcoatRoughnessMapUv:"",e.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+e.iridescenceMapUv:"",e.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+e.iridescenceThicknessMapUv:"",e.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+e.sheenColorMapUv:"",e.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+e.sheenRoughnessMapUv:"",e.specularMapUv?"#define SPECULARMAP_UV "+e.specularMapUv:"",e.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+e.specularColorMapUv:"",e.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+e.specularIntensityMapUv:"",e.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+e.transmissionMapUv:"",e.thicknessMapUv?"#define THICKNESSMAP_UV "+e.thicknessMapUv:"",e.vertexTangents&&e.flatShading===!1?"#define USE_TANGENT":"",e.vertexColors?"#define USE_COLOR":"",e.vertexAlphas?"#define USE_COLOR_ALPHA":"",e.vertexUv1s?"#define USE_UV1":"",e.vertexUv2s?"#define USE_UV2":"",e.vertexUv3s?"#define USE_UV3":"",e.pointsUvs?"#define USE_POINTS_UV":"",e.flatShading?"#define FLAT_SHADED":"",e.skinning?"#define USE_SKINNING":"",e.morphTargets?"#define USE_MORPHTARGETS":"",e.morphNormals&&e.flatShading===!1?"#define USE_MORPHNORMALS":"",e.morphColors&&e.isWebGL2?"#define USE_MORPHCOLORS":"",e.morphTargetsCount>0&&e.isWebGL2?"#define MORPHTARGETS_TEXTURE":"",e.morphTargetsCount>0&&e.isWebGL2?"#define MORPHTARGETS_TEXTURE_STRIDE "+e.morphTextureStride:"",e.morphTargetsCount>0&&e.isWebGL2?"#define MORPHTARGETS_COUNT "+e.morphTargetsCount:"",e.doubleSided?"#define DOUBLE_SIDED":"",e.flipSided?"#define FLIP_SIDED":"",e.shadowMapEnabled?"#define USE_SHADOWMAP":"",e.shadowMapEnabled?"#define "+p:"",e.sizeAttenuation?"#define USE_SIZEATTENUATION":"",e.numLightProbes>0?"#define USE_LIGHT_PROBES":"",e.useLegacyLights?"#define LEGACY_LIGHTS":"",e.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",e.logarithmicDepthBuffer&&e.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","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","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","#if ( defined( USE_MORPHTARGETS ) && ! defined( MORPHTARGETS_TEXTURE ) )"," attribute vec3 morphTarget0;"," attribute vec3 morphTarget1;"," attribute vec3 morphTarget2;"," attribute vec3 morphTarget3;"," #ifdef USE_MORPHNORMALS"," attribute vec3 morphNormal0;"," attribute vec3 morphNormal1;"," attribute vec3 morphNormal2;"," attribute vec3 morphNormal3;"," #else"," attribute vec3 morphTarget4;"," attribute vec3 morphTarget5;"," attribute vec3 morphTarget6;"," attribute vec3 morphTarget7;"," #endif","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif",`\n`].filter(Ru).join(`\n`),v=[M,qg(e),"#define SHADER_TYPE "+e.shaderType,"#define SHADER_NAME "+e.shaderName,w,e.useFog&&e.fog?"#define USE_FOG":"",e.useFog&&e.fogExp2?"#define FOG_EXP2":"",e.map?"#define USE_MAP":"",e.matcap?"#define USE_MATCAP":"",e.envMap?"#define USE_ENVMAP":"",e.envMap?"#define "+d:"",e.envMap?"#define "+g:"",e.envMap?"#define "+_:"",y?"#define CUBEUV_TEXEL_WIDTH "+y.texelWidth:"",y?"#define CUBEUV_TEXEL_HEIGHT "+y.texelHeight:"",y?"#define CUBEUV_MAX_MIP "+y.maxMip+".0":"",e.lightMap?"#define USE_LIGHTMAP":"",e.aoMap?"#define USE_AOMAP":"",e.bumpMap?"#define USE_BUMPMAP":"",e.normalMap?"#define USE_NORMALMAP":"",e.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",e.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",e.emissiveMap?"#define USE_EMISSIVEMAP":"",e.anisotropy?"#define USE_ANISOTROPY":"",e.anisotropyMap?"#define USE_ANISOTROPYMAP":"",e.clearcoat?"#define USE_CLEARCOAT":"",e.clearcoatMap?"#define USE_CLEARCOATMAP":"",e.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",e.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",e.iridescence?"#define USE_IRIDESCENCE":"",e.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",e.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",e.specularMap?"#define USE_SPECULARMAP":"",e.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",e.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",e.roughnessMap?"#define USE_ROUGHNESSMAP":"",e.metalnessMap?"#define USE_METALNESSMAP":"",e.alphaMap?"#define USE_ALPHAMAP":"",e.alphaTest?"#define USE_ALPHATEST":"",e.alphaHash?"#define USE_ALPHAHASH":"",e.sheen?"#define USE_SHEEN":"",e.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",e.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",e.transmission?"#define USE_TRANSMISSION":"",e.transmissionMap?"#define USE_TRANSMISSIONMAP":"",e.thicknessMap?"#define USE_THICKNESSMAP":"",e.vertexTangents&&e.flatShading===!1?"#define USE_TANGENT":"",e.vertexColors||e.instancingColor?"#define USE_COLOR":"",e.vertexAlphas?"#define USE_COLOR_ALPHA":"",e.vertexUv1s?"#define USE_UV1":"",e.vertexUv2s?"#define USE_UV2":"",e.vertexUv3s?"#define USE_UV3":"",e.pointsUvs?"#define USE_POINTS_UV":"",e.gradientMap?"#define USE_GRADIENTMAP":"",e.flatShading?"#define FLAT_SHADED":"",e.doubleSided?"#define DOUBLE_SIDED":"",e.flipSided?"#define FLIP_SIDED":"",e.shadowMapEnabled?"#define USE_SHADOWMAP":"",e.shadowMapEnabled?"#define "+p:"",e.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",e.numLightProbes>0?"#define USE_LIGHT_PROBES":"",e.useLegacyLights?"#define LEGACY_LIGHTS":"",e.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",e.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",e.logarithmicDepthBuffer&&e.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",e.toneMapping!==fs?"#define TONE_MAPPING":"",e.toneMapping!==fs?ge.tonemapping_pars_fragment:"",e.toneMapping!==fs?Gw("toneMapping",e.toneMapping):"",e.dithering?"#define DITHERING":"",e.opaque?"#define OPAQUE":"",ge.colorspace_pars_fragment,kw("linearToOutputTexel",e.outputColorSpace),e.useDepthPacking?"#define DEPTH_PACKING "+e.depthPacking:"",`\n`].filter(Ru).join(`\n`)),f=wh(f),f=Vg(f,e),f=Hg(f,e),h=wh(h),h=Vg(h,e),h=Hg(h,e),f=Wg(f),h=Wg(h),e.isWebGL2&&e.isRawShaderMaterial!==!0&&(C=`#version 300 es\n`,x=["precision mediump sampler2DArray;","#define attribute in","#define varying out","#define texture2D texture"].join(`\n`)+`\n`+x,v=["#define varying in",e.glslVersion===cg?"":"layout(location = 0) out highp vec4 pc_fragColor;",e.glslVersion===cg?"":"#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(`\n`)+`\n`+v);let S=C+x+f,O=C+v+h,F=kg(a,a.VERTEX_SHADER,S),G=kg(a,a.FRAGMENT_SHADER,O);if(a.attachShader(A,F),a.attachShader(A,G),e.index0AttributeName!==void 0?a.bindAttribLocation(A,0,e.index0AttributeName):e.morphTargets===!0&&a.bindAttribLocation(A,0,"position"),a.linkProgram(A),r.debug.checkShaderErrors){let D=a.getProgramInfoLog(A).trim(),q=a.getShaderInfoLog(F).trim(),nt=a.getShaderInfoLog(G).trim(),k=!0,xt=!0;if(a.getProgramParameter(A,a.LINK_STATUS)===!1)if(k=!1,typeof r.debug.onShaderError=="function")r.debug.onShaderError(a,A,F,G);else{let X=Gg(a,F,"vertex"),it=Gg(a,G,"fragment");console.error("THREE.WebGLProgram: Shader Error "+a.getError()+" - VALIDATE_STATUS "+a.getProgramParameter(A,a.VALIDATE_STATUS)+`\n\nProgram Info Log: `+D+`\n`+X+`\n`+it)}else D!==""?console.warn("THREE.WebGLProgram: Program Info Log:",D):(q===""||nt==="")&&(xt=!1);xt&&(this.diagnostics={runnable:k,programLog:D,vertexShader:{log:q,prefix:x},fragmentShader:{log:nt,prefix:v}})}a.deleteShader(F),a.deleteShader(G);let z;this.getUniforms=function(){return z===void 0&&(z=new Ba(a,A)),z};let L;return this.getAttributes=function(){return L===void 0&&(L=Ww(a,A)),L},this.destroy=function(){o.releaseStatesOfProgram(this),a.deleteProgram(A),this.program=void 0},this.type=e.shaderType,this.name=e.shaderName,this.id=Uw++,this.cacheKey=t,this.usedTimes=1,this.program=A,this.vertexShader=F,this.fragmentShader=G,this}var nb=0,bh=class{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(t){let e=t.vertexShader,o=t.fragmentShader,a=this._getShaderStage(e),l=this._getShaderStage(o),f=this._getShaderCacheForMaterial(t);return f.has(a)===!1&&(f.add(a),a.usedTimes++),f.has(l)===!1&&(f.add(l),l.usedTimes++),this}remove(t){let e=this.materialCache.get(t);for(let o of e)o.usedTimes--,o.usedTimes===0&&this.shaderCache.delete(o.code);return this.materialCache.delete(t),this}getVertexShaderID(t){return this._getShaderStage(t.vertexShader).id}getFragmentShaderID(t){return this._getShaderStage(t.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(t){let e=this.materialCache,o=e.get(t);return o===void 0&&(o=new Set,e.set(t,o)),o}_getShaderStage(t){let e=this.shaderCache,o=e.get(t);return o===void 0&&(o=new Th(t),e.set(t,o)),o}},Th=class{constructor(t){this.id=nb++,this.code=t,this.usedTimes=0}};function rb(r,t,e,o,a,l,f){let h=new ic,p=new bh,d=[],g=a.isWebGL2,_=a.logarithmicDepthBuffer,y=a.vertexTextures,M=a.precision,w={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function A(D){return D===0?"uv":`uv${D}`}function x(D,q,nt,k,xt){let X=k.fog,it=xt.geometry,vt=D.isMeshStandardMaterial?k.environment:null,pt=(D.isMeshStandardMaterial?e:t).get(D.envMap||vt),et=pt&&pt.mapping===hc?pt.image.height:null,ot=w[D.type];D.precision!==null&&(M=a.getMaxPrecision(D.precision),M!==D.precision&&console.warn("THREE.WebGLProgram.getParameters:",D.precision,"not supported, using",M,"instead."));let V=it.morphAttributes.position||it.morphAttributes.normal||it.morphAttributes.color,K=V!==void 0?V.length:0,at=0;it.morphAttributes.position!==void 0&&(at=1),it.morphAttributes.normal!==void 0&&(at=2),it.morphAttributes.color!==void 0&&(at=3);let Tt,dt,Ct,Yt;if(ot){let He=lo[ot];Tt=He.vertexShader,dt=He.fragmentShader}else Tt=D.vertexShader,dt=D.fragmentShader,p.update(D),Ct=p.getVertexShaderID(D),Yt=p.getFragmentShaderID(D);let Wt=r.getRenderTarget(),Nt=xt.isInstancedMesh===!0,ne=!!D.map,Pt=!!D.matcap,Xt=!!pt,tt=!!D.aoMap,nn=!!D.lightMap,Gt=!!D.bumpMap,te=!!D.normalMap,qt=!!D.displacementMap,$=!!D.emissiveMap,N=!!D.metalnessMap,b=!!D.roughnessMap,R=D.anisotropy>0,W=D.clearcoat>0,J=D.iridescence>0,I=D.sheen>0,P=D.transmission>0,B=R&&!!D.anisotropyMap,lt=W&&!!D.clearcoatMap,ct=W&&!!D.clearcoatNormalMap,Q=W&&!!D.clearcoatRoughnessMap,St=J&&!!D.iridescenceMap,_t=J&&!!D.iridescenceThicknessMap,Mt=I&&!!D.sheenColorMap,Lt=I&&!!D.sheenRoughnessMap,Jt=!!D.specularMap,Et=!!D.specularColorMap,oe=!!D.specularIntensityMap,jt=P&&!!D.transmissionMap,Ht=P&&!!D.thicknessMap,Ot=!!D.gradientMap,Y=!!D.alphaMap,wt=D.alphaTest>0,j=!!D.alphaHash,Ut=!!D.extensions,Dt=!!it.attributes.uv1,ft=!!it.attributes.uv2,$t=!!it.attributes.uv3,re=fs;return D.toneMapped&&(Wt===null||Wt.isXRRenderTarget===!0)&&(re=r.toneMapping),{isWebGL2:g,shaderID:ot,shaderType:D.type,shaderName:D.name,vertexShader:Tt,fragmentShader:dt,defines:D.defines,customVertexShaderID:Ct,customFragmentShaderID:Yt,isRawShaderMaterial:D.isRawShaderMaterial===!0,glslVersion:D.glslVersion,precision:M,instancing:Nt,instancingColor:Nt&&xt.instanceColor!==null,supportsVertexTextures:y,outputColorSpace:Wt===null?r.outputColorSpace:Wt.isXRRenderTarget===!0?Wt.texture.colorSpace:Wo,map:ne,matcap:Pt,envMap:Xt,envMapMode:Xt&&pt.mapping,envMapCubeUVHeight:et,aoMap:tt,lightMap:nn,bumpMap:Gt,normalMap:te,displacementMap:y&&qt,emissiveMap:$,normalMapObjectSpace:te&&D.normalMapType===Sx,normalMapTangentSpace:te&&D.normalMapType===Mx,metalnessMap:N,roughnessMap:b,anisotropy:R,anisotropyMap:B,clearcoat:W,clearcoatMap:lt,clearcoatNormalMap:ct,clearcoatRoughnessMap:Q,iridescence:J,iridescenceMap:St,iridescenceThicknessMap:_t,sheen:I,sheenColorMap:Mt,sheenRoughnessMap:Lt,specularMap:Jt,specularColorMap:Et,specularIntensityMap:oe,transmission:P,transmissionMap:jt,thicknessMap:Ht,gradientMap:Ot,opaque:D.transparent===!1&&D.blending===Fa,alphaMap:Y,alphaTest:wt,alphaHash:j,combine:D.combine,mapUv:ne&&A(D.map.channel),aoMapUv:tt&&A(D.aoMap.channel),lightMapUv:nn&&A(D.lightMap.channel),bumpMapUv:Gt&&A(D.bumpMap.channel),normalMapUv:te&&A(D.normalMap.channel),displacementMapUv:qt&&A(D.displacementMap.channel),emissiveMapUv:$&&A(D.emissiveMap.channel),metalnessMapUv:N&&A(D.metalnessMap.channel),roughnessMapUv:b&&A(D.roughnessMap.channel),anisotropyMapUv:B&&A(D.anisotropyMap.channel),clearcoatMapUv:lt&&A(D.clearcoatMap.channel),clearcoatNormalMapUv:ct&&A(D.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:Q&&A(D.clearcoatRoughnessMap.channel),iridescenceMapUv:St&&A(D.iridescenceMap.channel),iridescenceThicknessMapUv:_t&&A(D.iridescenceThicknessMap.channel),sheenColorMapUv:Mt&&A(D.sheenColorMap.channel),sheenRoughnessMapUv:Lt&&A(D.sheenRoughnessMap.channel),specularMapUv:Jt&&A(D.specularMap.channel),specularColorMapUv:Et&&A(D.specularColorMap.channel),specularIntensityMapUv:oe&&A(D.specularIntensityMap.channel),transmissionMapUv:jt&&A(D.transmissionMap.channel),thicknessMapUv:Ht&&A(D.thicknessMap.channel),alphaMapUv:Y&&A(D.alphaMap.channel),vertexTangents:!!it.attributes.tangent&&(te||R),vertexColors:D.vertexColors,vertexAlphas:D.vertexColors===!0&&!!it.attributes.color&&it.attributes.color.itemSize===4,vertexUv1s:Dt,vertexUv2s:ft,vertexUv3s:$t,pointsUvs:xt.isPoints===!0&&!!it.attributes.uv&&(ne||Y),fog:!!X,useFog:D.fog===!0,fogExp2:X&&X.isFogExp2,flatShading:D.flatShading===!0,sizeAttenuation:D.sizeAttenuation===!0,logarithmicDepthBuffer:_,skinning:xt.isSkinnedMesh===!0,morphTargets:it.morphAttributes.position!==void 0,morphNormals:it.morphAttributes.normal!==void 0,morphColors:it.morphAttributes.color!==void 0,morphTargetsCount:K,morphTextureStride:at,numDirLights:q.directional.length,numPointLights:q.point.length,numSpotLights:q.spot.length,numSpotLightMaps:q.spotLightMap.length,numRectAreaLights:q.rectArea.length,numHemiLights:q.hemi.length,numDirLightShadows:q.directionalShadowMap.length,numPointLightShadows:q.pointShadowMap.length,numSpotLightShadows:q.spotShadowMap.length,numSpotLightShadowsWithMaps:q.numSpotLightShadowsWithMaps,numLightProbes:q.numLightProbes,numClippingPlanes:f.numPlanes,numClipIntersection:f.numIntersection,dithering:D.dithering,shadowMapEnabled:r.shadowMap.enabled&&nt.length>0,shadowMapType:r.shadowMap.type,toneMapping:re,useLegacyLights:r._useLegacyLights,decodeVideoTexture:ne&&D.map.isVideoTexture===!0&&gn.getTransfer(D.map.colorSpace)===Tn,premultipliedAlpha:D.premultipliedAlpha,doubleSided:D.side===Go,flipSided:D.side===ui,useDepthPacking:D.depthPacking>=0,depthPacking:D.depthPacking||0,index0AttributeName:D.index0AttributeName,extensionDerivatives:Ut&&D.extensions.derivatives===!0,extensionFragDepth:Ut&&D.extensions.fragDepth===!0,extensionDrawBuffers:Ut&&D.extensions.drawBuffers===!0,extensionShaderTextureLOD:Ut&&D.extensions.shaderTextureLOD===!0,rendererExtensionFragDepth:g||o.has("EXT_frag_depth"),rendererExtensionDrawBuffers:g||o.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:g||o.has("EXT_shader_texture_lod"),customProgramCacheKey:D.customProgramCacheKey()}}function v(D){let q=[];if(D.shaderID?q.push(D.shaderID):(q.push(D.customVertexShaderID),q.push(D.customFragmentShaderID)),D.defines!==void 0)for(let nt in D.defines)q.push(nt),q.push(D.defines[nt]);return D.isRawShaderMaterial===!1&&(C(q,D),S(q,D),q.push(r.outputColorSpace)),q.push(D.customProgramCacheKey),q.join()}function C(D,q){D.push(q.precision),D.push(q.outputColorSpace),D.push(q.envMapMode),D.push(q.envMapCubeUVHeight),D.push(q.mapUv),D.push(q.alphaMapUv),D.push(q.lightMapUv),D.push(q.aoMapUv),D.push(q.bumpMapUv),D.push(q.normalMapUv),D.push(q.displacementMapUv),D.push(q.emissiveMapUv),D.push(q.metalnessMapUv),D.push(q.roughnessMapUv),D.push(q.anisotropyMapUv),D.push(q.clearcoatMapUv),D.push(q.clearcoatNormalMapUv),D.push(q.clearcoatRoughnessMapUv),D.push(q.iridescenceMapUv),D.push(q.iridescenceThicknessMapUv),D.push(q.sheenColorMapUv),D.push(q.sheenRoughnessMapUv),D.push(q.specularMapUv),D.push(q.specularColorMapUv),D.push(q.specularIntensityMapUv),D.push(q.transmissionMapUv),D.push(q.thicknessMapUv),D.push(q.combine),D.push(q.fogExp2),D.push(q.sizeAttenuation),D.push(q.morphTargetsCount),D.push(q.morphAttributeCount),D.push(q.numDirLights),D.push(q.numPointLights),D.push(q.numSpotLights),D.push(q.numSpotLightMaps),D.push(q.numHemiLights),D.push(q.numRectAreaLights),D.push(q.numDirLightShadows),D.push(q.numPointLightShadows),D.push(q.numSpotLightShadows),D.push(q.numSpotLightShadowsWithMaps),D.push(q.numLightProbes),D.push(q.shadowMapType),D.push(q.toneMapping),D.push(q.numClippingPlanes),D.push(q.numClipIntersection),D.push(q.depthPacking)}function S(D,q){h.disableAll(),q.isWebGL2&&h.enable(0),q.supportsVertexTextures&&h.enable(1),q.instancing&&h.enable(2),q.instancingColor&&h.enable(3),q.matcap&&h.enable(4),q.envMap&&h.enable(5),q.normalMapObjectSpace&&h.enable(6),q.normalMapTangentSpace&&h.enable(7),q.clearcoat&&h.enable(8),q.iridescence&&h.enable(9),q.alphaTest&&h.enable(10),q.vertexColors&&h.enable(11),q.vertexAlphas&&h.enable(12),q.vertexUv1s&&h.enable(13),q.vertexUv2s&&h.enable(14),q.vertexUv3s&&h.enable(15),q.vertexTangents&&h.enable(16),q.anisotropy&&h.enable(17),D.push(h.mask),h.disableAll(),q.fog&&h.enable(0),q.useFog&&h.enable(1),q.flatShading&&h.enable(2),q.logarithmicDepthBuffer&&h.enable(3),q.skinning&&h.enable(4),q.morphTargets&&h.enable(5),q.morphNormals&&h.enable(6),q.morphColors&&h.enable(7),q.premultipliedAlpha&&h.enable(8),q.shadowMapEnabled&&h.enable(9),q.useLegacyLights&&h.enable(10),q.doubleSided&&h.enable(11),q.flipSided&&h.enable(12),q.useDepthPacking&&h.enable(13),q.dithering&&h.enable(14),q.transmission&&h.enable(15),q.sheen&&h.enable(16),q.opaque&&h.enable(17),q.pointsUvs&&h.enable(18),q.decodeVideoTexture&&h.enable(19),D.push(h.mask)}function O(D){let q=w[D.type],nt;if(q){let k=lo[q];nt=$x.clone(k.uniforms)}else nt=D.uniforms;return nt}function F(D,q){let nt;for(let k=0,xt=d.length;k<xt;k++){let X=d[k];if(X.cacheKey===q){nt=X,++nt.usedTimes;break}}return nt===void 0&&(nt=new eb(r,q,D,l),d.push(nt)),nt}function G(D){if(--D.usedTimes===0){let q=d.indexOf(D);d[q]=d[d.length-1],d.pop(),D.destroy()}}function z(D){p.remove(D)}function L(){p.dispose()}return{getParameters:x,getProgramCacheKey:v,getUniforms:O,acquireProgram:F,releaseProgram:G,releaseShaderCache:z,programs:d,dispose:L}}function ib(){let r=new WeakMap;function t(l){let f=r.get(l);return f===void 0&&(f={},r.set(l,f)),f}function e(l){r.delete(l)}function o(l,f,h){r.get(l)[f]=h}function a(){r=new WeakMap}return{get:t,remove:e,update:o,dispose:a}}function ob(r,t){return r.groupOrder!==t.groupOrder?r.groupOrder-t.groupOrder:r.renderOrder!==t.renderOrder?r.renderOrder-t.renderOrder:r.material.id!==t.material.id?r.material.id-t.material.id:r.z!==t.z?r.z-t.z:r.id-t.id}function Xg(r,t){return r.groupOrder!==t.groupOrder?r.groupOrder-t.groupOrder:r.renderOrder!==t.renderOrder?r.renderOrder-t.renderOrder:r.z!==t.z?t.z-r.z:r.id-t.id}function Yg(){let r=[],t=0,e=[],o=[],a=[];function l(){t=0,e.length=0,o.length=0,a.length=0}function f(_,y,M,w,A,x){let v=r[t];return v===void 0?(v={id:_.id,object:_,geometry:y,material:M,groupOrder:w,renderOrder:_.renderOrder,z:A,group:x},r[t]=v):(v.id=_.id,v.object=_,v.geometry=y,v.material=M,v.groupOrder=w,v.renderOrder=_.renderOrder,v.z=A,v.group=x),t++,v}function h(_,y,M,w,A,x){let v=f(_,y,M,w,A,x);M.transmission>0?o.push(v):M.transparent===!0?a.push(v):e.push(v)}function p(_,y,M,w,A,x){let v=f(_,y,M,w,A,x);M.transmission>0?o.unshift(v):M.transparent===!0?a.unshift(v):e.unshift(v)}function d(_,y){e.length>1&&e.sort(_||ob),o.length>1&&o.sort(y||Xg),a.length>1&&a.sort(y||Xg)}function g(){for(let _=t,y=r.length;_<y;_++){let M=r[_];if(M.id===null)break;M.id=null,M.object=null,M.geometry=null,M.material=null,M.group=null}}return{opaque:e,transmissive:o,transparent:a,init:l,push:h,unshift:p,finish:g,sort:d}}function sb(){let r=new WeakMap;function t(o,a){let l=r.get(o),f;return l===void 0?(f=new Yg,r.set(o,[f])):a>=l.length?(f=new Yg,l.push(f)):f=l[a],f}function e(){r=new WeakMap}return{get:t,dispose:e}}function ab(){let r={};return{get:function(t){if(r[t.id]!==void 0)return r[t.id];let e;switch(t.type){case"DirectionalLight":e={direction:new mt,color:new xn};break;case"SpotLight":e={position:new mt,direction:new mt,color:new xn,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":e={position:new mt,color:new xn,distance:0,decay:0};break;case"HemisphereLight":e={direction:new mt,skyColor:new xn,groundColor:new xn};break;case"RectAreaLight":e={color:new xn,position:new mt,halfWidth:new mt,halfHeight:new mt};break}return r[t.id]=e,e}}}function ub(){let r={};return{get:function(t){if(r[t.id]!==void 0)return r[t.id];let e;switch(t.type){case"DirectionalLight":e={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new fn};break;case"SpotLight":e={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new fn};break;case"PointLight":e={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new fn,shadowCameraNear:1,shadowCameraFar:1e3};break}return r[t.id]=e,e}}}var lb=0;function cb(r,t){return(t.castShadow?2:0)-(r.castShadow?2:0)+(t.map?1:0)-(r.map?1:0)}function fb(r,t){let e=new ab,o=ub(),a={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 g=0;g<9;g++)a.probe.push(new mt);let l=new mt,f=new zr,h=new zr;function p(g,_){let y=0,M=0,w=0;for(let k=0;k<9;k++)a.probe[k].set(0,0,0);let A=0,x=0,v=0,C=0,S=0,O=0,F=0,G=0,z=0,L=0,D=0;g.sort(cb);let q=_===!0?Math.PI:1;for(let k=0,xt=g.length;k<xt;k++){let X=g[k],it=X.color,vt=X.intensity,pt=X.distance,et=X.shadow&&X.shadow.map?X.shadow.map.texture:null;if(X.isAmbientLight)y+=it.r*vt*q,M+=it.g*vt*q,w+=it.b*vt*q;else if(X.isLightProbe){for(let ot=0;ot<9;ot++)a.probe[ot].addScaledVector(X.sh.coefficients[ot],vt);D++}else if(X.isDirectionalLight){let ot=e.get(X);if(ot.color.copy(X.color).multiplyScalar(X.intensity*q),X.castShadow){let V=X.shadow,K=o.get(X);K.shadowBias=V.bias,K.shadowNormalBias=V.normalBias,K.shadowRadius=V.radius,K.shadowMapSize=V.mapSize,a.directionalShadow[A]=K,a.directionalShadowMap[A]=et,a.directionalShadowMatrix[A]=X.shadow.matrix,O++}a.directional[A]=ot,A++}else if(X.isSpotLight){let ot=e.get(X);ot.position.setFromMatrixPosition(X.matrixWorld),ot.color.copy(it).multiplyScalar(vt*q),ot.distance=pt,ot.coneCos=Math.cos(X.angle),ot.penumbraCos=Math.cos(X.angle*(1-X.penumbra)),ot.decay=X.decay,a.spot[v]=ot;let V=X.shadow;if(X.map&&(a.spotLightMap[z]=X.map,z++,V.updateMatrices(X),X.castShadow&&L++),a.spotLightMatrix[v]=V.matrix,X.castShadow){let K=o.get(X);K.shadowBias=V.bias,K.shadowNormalBias=V.normalBias,K.shadowRadius=V.radius,K.shadowMapSize=V.mapSize,a.spotShadow[v]=K,a.spotShadowMap[v]=et,G++}v++}else if(X.isRectAreaLight){let ot=e.get(X);ot.color.copy(it).multiplyScalar(vt),ot.halfWidth.set(X.width*.5,0,0),ot.halfHeight.set(0,X.height*.5,0),a.rectArea[C]=ot,C++}else if(X.isPointLight){let ot=e.get(X);if(ot.color.copy(X.color).multiplyScalar(X.intensity*q),ot.distance=X.distance,ot.decay=X.decay,X.castShadow){let V=X.shadow,K=o.get(X);K.shadowBias=V.bias,K.shadowNormalBias=V.normalBias,K.shadowRadius=V.radius,K.shadowMapSize=V.mapSize,K.shadowCameraNear=V.camera.near,K.shadowCameraFar=V.camera.far,a.pointShadow[x]=K,a.pointShadowMap[x]=et,a.pointShadowMatrix[x]=X.shadow.matrix,F++}a.point[x]=ot,x++}else if(X.isHemisphereLight){let ot=e.get(X);ot.skyColor.copy(X.color).multiplyScalar(vt*q),ot.groundColor.copy(X.groundColor).multiplyScalar(vt*q),a.hemi[S]=ot,S++}}C>0&&(t.isWebGL2||r.has("OES_texture_float_linear")===!0?(a.rectAreaLTC1=zt.LTC_FLOAT_1,a.rectAreaLTC2=zt.LTC_FLOAT_2):r.has("OES_texture_half_float_linear")===!0?(a.rectAreaLTC1=zt.LTC_HALF_1,a.rectAreaLTC2=zt.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),a.ambient[0]=y,a.ambient[1]=M,a.ambient[2]=w;let nt=a.hash;(nt.directionalLength!==A||nt.pointLength!==x||nt.spotLength!==v||nt.rectAreaLength!==C||nt.hemiLength!==S||nt.numDirectionalShadows!==O||nt.numPointShadows!==F||nt.numSpotShadows!==G||nt.numSpotMaps!==z||nt.numLightProbes!==D)&&(a.directional.length=A,a.spot.length=v,a.rectArea.length=C,a.point.length=x,a.hemi.length=S,a.directionalShadow.length=O,a.directionalShadowMap.length=O,a.pointShadow.length=F,a.pointShadowMap.length=F,a.spotShadow.length=G,a.spotShadowMap.length=G,a.directionalShadowMatrix.length=O,a.pointShadowMatrix.length=F,a.spotLightMatrix.length=G+z-L,a.spotLightMap.length=z,a.numSpotLightShadowsWithMaps=L,a.numLightProbes=D,nt.directionalLength=A,nt.pointLength=x,nt.spotLength=v,nt.rectAreaLength=C,nt.hemiLength=S,nt.numDirectionalShadows=O,nt.numPointShadows=F,nt.numSpotShadows=G,nt.numSpotMaps=z,nt.numLightProbes=D,a.version=lb++)}function d(g,_){let y=0,M=0,w=0,A=0,x=0,v=_.matrixWorldInverse;for(let C=0,S=g.length;C<S;C++){let O=g[C];if(O.isDirectionalLight){let F=a.directional[y];F.direction.setFromMatrixPosition(O.matrixWorld),l.setFromMatrixPosition(O.target.matrixWorld),F.direction.sub(l),F.direction.transformDirection(v),y++}else if(O.isSpotLight){let F=a.spot[w];F.position.setFromMatrixPosition(O.matrixWorld),F.position.applyMatrix4(v),F.direction.setFromMatrixPosition(O.matrixWorld),l.setFromMatrixPosition(O.target.matrixWorld),F.direction.sub(l),F.direction.transformDirection(v),w++}else if(O.isRectAreaLight){let F=a.rectArea[A];F.position.setFromMatrixPosition(O.matrixWorld),F.position.applyMatrix4(v),h.identity(),f.copy(O.matrixWorld),f.premultiply(v),h.extractRotation(f),F.halfWidth.set(O.width*.5,0,0),F.halfHeight.set(0,O.height*.5,0),F.halfWidth.applyMatrix4(h),F.halfHeight.applyMatrix4(h),A++}else if(O.isPointLight){let F=a.point[M];F.position.setFromMatrixPosition(O.matrixWorld),F.position.applyMatrix4(v),M++}else if(O.isHemisphereLight){let F=a.hemi[x];F.direction.setFromMatrixPosition(O.matrixWorld),F.direction.transformDirection(v),x++}}}return{setup:p,setupView:d,state:a}}function Zg(r,t){let e=new fb(r,t),o=[],a=[];function l(){o.length=0,a.length=0}function f(_){o.push(_)}function h(_){a.push(_)}function p(_){e.setup(o,_)}function d(_){e.setupView(o,_)}return{init:l,state:{lightsArray:o,shadowsArray:a,lights:e},setupLights:p,setupLightsView:d,pushLight:f,pushShadow:h}}function hb(r,t){let e=new WeakMap;function o(l,f=0){let h=e.get(l),p;return h===void 0?(p=new Zg(r,t),e.set(l,[p])):f>=h.length?(p=new Zg(r,t),h.push(p)):p=h[f],p}function a(){e=new WeakMap}return{get:o,dispose:a}}var Ah=class extends Va{constructor(t){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=xx,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(t)}copy(t){return super.copy(t),this.depthPacking=t.depthPacking,this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this}},Ch=class extends Va{constructor(t){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(t)}copy(t){return super.copy(t),this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this}},pb=`void main() {\n gl_Position = vec4( position, 1.0 );\n}`,db=`uniform sampler2D shadow_pass;\nuniform vec2 resolution;\nuniform float radius;\n#include <packing>\nvoid main() {\n const float samples = float( VSM_SAMPLES );\n float mean = 0.0;\n float squared_mean = 0.0;\n float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );\n float uvStart = samples <= 1.0 ? 0.0 : - 1.0;\n for ( float i = 0.0; i < samples; i ++ ) {\n float uvOffset = uvStart + i * uvStride;\n #ifdef HORIZONTAL_PASS\n vec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) );\n mean += distribution.x;\n squared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\n #else\n float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) );\n mean += depth;\n squared_mean += depth * depth;\n #endif\n }\n mean = mean / samples;\n squared_mean = squared_mean / samples;\n float std_dev = sqrt( squared_mean - mean * mean );\n gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );\n}`;function mb(r,t,e){let o=new cc,a=new fn,l=new fn,f=new Tr,h=new Ah({depthPacking:Ex}),p=new Ch,d={},g=e.maxTextureSize,_={[ps]:ui,[ui]:ps,[Go]:Go},y=new Xo({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new fn},radius:{value:4}},vertexShader:pb,fragmentShader:db}),M=y.clone();M.defines.HORIZONTAL_PASS=1;let w=new Xs;w.setAttribute("position",new Di(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));let A=new co(w,y),x=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=Jg;let v=this.type;this.render=function(F,G,z){if(x.enabled===!1||x.autoUpdate===!1&&x.needsUpdate===!1||F.length===0)return;let L=r.getRenderTarget(),D=r.getActiveCubeFace(),q=r.getActiveMipmapLevel(),nt=r.state;nt.setBlending(cs),nt.buffers.color.setClear(1,1,1,1),nt.buffers.depth.setTest(!0),nt.setScissorTest(!1);let k=v!==zo&&this.type===zo,xt=v===zo&&this.type!==zo;for(let X=0,it=F.length;X<it;X++){let vt=F[X],pt=vt.shadow;if(pt===void 0){console.warn("THREE.WebGLShadowMap:",vt,"has no shadow.");continue}if(pt.autoUpdate===!1&&pt.needsUpdate===!1)continue;a.copy(pt.mapSize);let et=pt.getFrameExtents();if(a.multiply(et),l.copy(pt.mapSize),(a.x>g||a.y>g)&&(a.x>g&&(l.x=Math.floor(g/et.x),a.x=l.x*et.x,pt.mapSize.x=l.x),a.y>g&&(l.y=Math.floor(g/et.y),a.y=l.y*et.y,pt.mapSize.y=l.y)),pt.map===null||k===!0||xt===!0){let V=this.type!==zo?{minFilter:$r,magFilter:$r}:{};pt.map!==null&&pt.map.dispose(),pt.map=new qo(a.x,a.y,V),pt.map.texture.name=vt.name+".shadowMap",pt.camera.updateProjectionMatrix()}r.setRenderTarget(pt.map),r.clear();let ot=pt.getViewportCount();for(let V=0;V<ot;V++){let K=pt.getViewport(V);f.set(l.x*K.x,l.y*K.y,l.x*K.z,l.y*K.w),nt.viewport(f),pt.updateMatrices(vt,V),o=pt.getFrustum(),O(G,z,pt.camera,vt,this.type)}pt.isPointLightShadow!==!0&&this.type===zo&&C(pt,z),pt.needsUpdate=!1}v=this.type,x.needsUpdate=!1,r.setRenderTarget(L,D,q)};function C(F,G){let z=t.update(A);y.defines.VSM_SAMPLES!==F.blurSamples&&(y.defines.VSM_SAMPLES=F.blurSamples,M.defines.VSM_SAMPLES=F.blurSamples,y.needsUpdate=!0,M.needsUpdate=!0),F.mapPass===null&&(F.mapPass=new qo(a.x,a.y)),y.uniforms.shadow_pass.value=F.map.texture,y.uniforms.resolution.value=F.mapSize,y.uniforms.radius.value=F.radius,r.setRenderTarget(F.mapPass),r.clear(),r.renderBufferDirect(G,null,z,y,A,null),M.uniforms.shadow_pass.value=F.mapPass.texture,M.uniforms.resolution.value=F.mapSize,M.uniforms.radius.value=F.radius,r.setRenderTarget(F.map),r.clear(),r.renderBufferDirect(G,null,z,M,A,null)}function S(F,G,z,L){let D=null,q=z.isPointLight===!0?F.customDistanceMaterial:F.customDepthMaterial;if(q!==void 0)D=q;else if(D=z.isPointLight===!0?p:h,r.localClippingEnabled&&G.clipShadows===!0&&Array.isArray(G.clippingPlanes)&&G.clippingPlanes.length!==0||G.displacementMap&&G.displacementScale!==0||G.alphaMap&&G.alphaTest>0||G.map&&G.alphaTest>0){let nt=D.uuid,k=G.uuid,xt=d[nt];xt===void 0&&(xt={},d[nt]=xt);let X=xt[k];X===void 0&&(X=D.clone(),xt[k]=X),D=X}if(D.visible=G.visible,D.wireframe=G.wireframe,L===zo?D.side=G.shadowSide!==null?G.shadowSide:G.side:D.side=G.shadowSide!==null?G.shadowSide:_[G.side],D.alphaMap=G.alphaMap,D.alphaTest=G.alphaTest,D.map=G.map,D.clipShadows=G.clipShadows,D.clippingPlanes=G.clippingPlanes,D.clipIntersection=G.clipIntersection,D.displacementMap=G.displacementMap,D.displacementScale=G.displacementScale,D.displacementBias=G.displacementBias,D.wireframeLinewidth=G.wireframeLinewidth,D.linewidth=G.linewidth,z.isPointLight===!0&&D.isMeshDistanceMaterial===!0){let nt=r.properties.get(D);nt.light=z}return D}function O(F,G,z,L,D){if(F.visible===!1)return;if(F.layers.test(G.layers)&&(F.isMesh||F.isLine||F.isPoints)&&(F.castShadow||F.receiveShadow&&D===zo)&&(!F.frustumCulled||o.intersectsObject(F))){F.modelViewMatrix.multiplyMatrices(z.matrixWorldInverse,F.matrixWorld);let k=t.update(F),xt=F.material;if(Array.isArray(xt)){let X=k.groups;for(let it=0,vt=X.length;it<vt;it++){let pt=X[it],et=xt[pt.materialIndex];if(et&&et.visible){let ot=S(F,et,L,D);r.renderBufferDirect(z,null,k,ot,F,pt)}}}else if(xt.visible){let X=S(F,xt,L,D);r.renderBufferDirect(z,null,k,X,F,null)}}let nt=F.children;for(let k=0,xt=nt.length;k<xt;k++)O(nt[k],G,z,L,D)}}function gb(r,t,e){let o=e.isWebGL2;function a(){let Y=!1,wt=new Tr,j=null,Ut=new Tr(0,0,0,0);return{setMask:function(Dt){j!==Dt&&!Y&&(r.colorMask(Dt,Dt,Dt,Dt),j=Dt)},setLocked:function(Dt){Y=Dt},setClear:function(Dt,ft,$t,re,mn){mn===!0&&(Dt*=re,ft*=re,$t*=re),wt.set(Dt,ft,$t,re),Ut.equals(wt)===!1&&(r.clearColor(Dt,ft,$t,re),Ut.copy(wt))},reset:function(){Y=!1,j=null,Ut.set(-1,0,0,0)}}}function l(){let Y=!1,wt=null,j=null,Ut=null;return{setTest:function(Dt){Dt?Wt(r.DEPTH_TEST):Nt(r.DEPTH_TEST)},setMask:function(Dt){wt!==Dt&&!Y&&(r.depthMask(Dt),wt=Dt)},setFunc:function(Dt){if(j!==Dt){switch(Dt){case $1:r.depthFunc(r.NEVER);break;case K1:r.depthFunc(r.ALWAYS);break;case j1:r.depthFunc(r.LESS);break;case sh:r.depthFunc(r.LEQUAL);break;case Q1:r.depthFunc(r.EQUAL);break;case tx:r.depthFunc(r.GEQUAL);break;case ex:r.depthFunc(r.GREATER);break;case nx:r.depthFunc(r.NOTEQUAL);break;default:r.depthFunc(r.LEQUAL)}j=Dt}},setLocked:function(Dt){Y=Dt},setClear:function(Dt){Ut!==Dt&&(r.clearDepth(Dt),Ut=Dt)},reset:function(){Y=!1,wt=null,j=null,Ut=null}}}function f(){let Y=!1,wt=null,j=null,Ut=null,Dt=null,ft=null,$t=null,re=null,mn=null;return{setTest:function(He){Y||(He?Wt(r.STENCIL_TEST):Nt(r.STENCIL_TEST))},setMask:function(He){wt!==He&&!Y&&(r.stencilMask(He),wt=He)},setFunc:function(He,Mi,$n){(j!==He||Ut!==Mi||Dt!==$n)&&(r.stencilFunc(He,Mi,$n),j=He,Ut=Mi,Dt=$n)},setOp:function(He,Mi,$n){(ft!==He||$t!==Mi||re!==$n)&&(r.stencilOp(He,Mi,$n),ft=He,$t=Mi,re=$n)},setLocked:function(He){Y=He},setClear:function(He){mn!==He&&(r.clearStencil(He),mn=He)},reset:function(){Y=!1,wt=null,j=null,Ut=null,Dt=null,ft=null,$t=null,re=null,mn=null}}}let h=new a,p=new l,d=new f,g=new WeakMap,_=new WeakMap,y={},M={},w=new WeakMap,A=[],x=null,v=!1,C=null,S=null,O=null,F=null,G=null,z=null,L=null,D=!1,q=null,nt=null,k=null,xt=null,X=null,it=r.getParameter(r.MAX_COMBINED_TEXTURE_IMAGE_UNITS),vt=!1,pt=0,et=r.getParameter(r.VERSION);et.indexOf("WebGL")!==-1?(pt=parseFloat(/^WebGL (\\d)/.exec(et)[1]),vt=pt>=1):et.indexOf("OpenGL ES")!==-1&&(pt=parseFloat(/^OpenGL ES (\\d)/.exec(et)[1]),vt=pt>=2);let ot=null,V={},K=r.getParameter(r.SCISSOR_BOX),at=r.getParameter(r.VIEWPORT),Tt=new Tr().fromArray(K),dt=new Tr().fromArray(at);function Ct(Y,wt,j,Ut){let Dt=new Uint8Array(4),ft=r.createTexture();r.bindTexture(Y,ft),r.texParameteri(Y,r.TEXTURE_MIN_FILTER,r.NEAREST),r.texParameteri(Y,r.TEXTURE_MAG_FILTER,r.NEAREST);for(let $t=0;$t<j;$t++)o&&(Y===r.TEXTURE_3D||Y===r.TEXTURE_2D_ARRAY)?r.texImage3D(wt,0,r.RGBA,1,1,Ut,0,r.RGBA,r.UNSIGNED_BYTE,Dt):r.texImage2D(wt+$t,0,r.RGBA,1,1,0,r.RGBA,r.UNSIGNED_BYTE,Dt);return ft}let Yt={};Yt[r.TEXTURE_2D]=Ct(r.TEXTURE_2D,r.TEXTURE_2D,1),Yt[r.TEXTURE_CUBE_MAP]=Ct(r.TEXTURE_CUBE_MAP,r.TEXTURE_CUBE_MAP_POSITIVE_X,6),o&&(Yt[r.TEXTURE_2D_ARRAY]=Ct(r.TEXTURE_2D_ARRAY,r.TEXTURE_2D_ARRAY,1,1),Yt[r.TEXTURE_3D]=Ct(r.TEXTURE_3D,r.TEXTURE_3D,1,1)),h.setClear(0,0,0,1),p.setClear(1),d.setClear(0),Wt(r.DEPTH_TEST),p.setFunc(sh),qt(!1),$(Cm),Wt(r.CULL_FACE),Gt(cs);function Wt(Y){y[Y]!==!0&&(r.enable(Y),y[Y]=!0)}function Nt(Y){y[Y]!==!1&&(r.disable(Y),y[Y]=!1)}function ne(Y,wt){return M[Y]!==wt?(r.bindFramebuffer(Y,wt),M[Y]=wt,o&&(Y===r.DRAW_FRAMEBUFFER&&(M[r.FRAMEBUFFER]=wt),Y===r.FRAMEBUFFER&&(M[r.DRAW_FRAMEBUFFER]=wt)),!0):!1}function Pt(Y,wt){let j=A,Ut=!1;if(Y)if(j=w.get(wt),j===void 0&&(j=[],w.set(wt,j)),Y.isWebGLMultipleRenderTargets){let Dt=Y.texture;if(j.length!==Dt.length||j[0]!==r.COLOR_ATTACHMENT0){for(let ft=0,$t=Dt.length;ft<$t;ft++)j[ft]=r.COLOR_ATTACHMENT0+ft;j.length=Dt.length,Ut=!0}}else j[0]!==r.COLOR_ATTACHMENT0&&(j[0]=r.COLOR_ATTACHMENT0,Ut=!0);else j[0]!==r.BACK&&(j[0]=r.BACK,Ut=!0);Ut&&(e.isWebGL2?r.drawBuffers(j):t.get("WEBGL_draw_buffers").drawBuffersWEBGL(j))}function Xt(Y){return x!==Y?(r.useProgram(Y),x=Y,!0):!1}let tt={[La]:r.FUNC_ADD,[z1]:r.FUNC_SUBTRACT,[k1]:r.FUNC_REVERSE_SUBTRACT};if(o)tt[Lm]=r.MIN,tt[Nm]=r.MAX;else{let Y=t.get("EXT_blend_minmax");Y!==null&&(tt[Lm]=Y.MIN_EXT,tt[Nm]=Y.MAX_EXT)}let nn={[G1]:r.ZERO,[V1]:r.ONE,[H1]:r.SRC_COLOR,[$g]:r.SRC_ALPHA,[J1]:r.SRC_ALPHA_SATURATE,[Y1]:r.DST_COLOR,[q1]:r.DST_ALPHA,[W1]:r.ONE_MINUS_SRC_COLOR,[Kg]:r.ONE_MINUS_SRC_ALPHA,[Z1]:r.ONE_MINUS_DST_COLOR,[X1]:r.ONE_MINUS_DST_ALPHA};function Gt(Y,wt,j,Ut,Dt,ft,$t,re){if(Y===cs){v===!0&&(Nt(r.BLEND),v=!1);return}if(v===!1&&(Wt(r.BLEND),v=!0),Y!==B1){if(Y!==C||re!==D){if((S!==La||G!==La)&&(r.blendEquation(r.FUNC_ADD),S=La,G=La),re)switch(Y){case Fa:r.blendFuncSeparate(r.ONE,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA);break;case Pm:r.blendFunc(r.ONE,r.ONE);break;case Im:r.blendFuncSeparate(r.ZERO,r.ONE_MINUS_SRC_COLOR,r.ZERO,r.ONE);break;case Rm:r.blendFuncSeparate(r.ZERO,r.SRC_COLOR,r.ZERO,r.SRC_ALPHA);break;default:console.error("THREE.WebGLState: Invalid blending: ",Y);break}else switch(Y){case Fa:r.blendFuncSeparate(r.SRC_ALPHA,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA);break;case Pm:r.blendFunc(r.SRC_ALPHA,r.ONE);break;case Im:r.blendFuncSeparate(r.ZERO,r.ONE_MINUS_SRC_COLOR,r.ZERO,r.ONE);break;case Rm:r.blendFunc(r.ZERO,r.SRC_COLOR);break;default:console.error("THREE.WebGLState: Invalid blending: ",Y);break}O=null,F=null,z=null,L=null,C=Y,D=re}return}Dt=Dt||wt,ft=ft||j,$t=$t||Ut,(wt!==S||Dt!==G)&&(r.blendEquationSeparate(tt[wt],tt[Dt]),S=wt,G=Dt),(j!==O||Ut!==F||ft!==z||$t!==L)&&(r.blendFuncSeparate(nn[j],nn[Ut],nn[ft],nn[$t]),O=j,F=Ut,z=ft,L=$t),C=Y,D=!1}function te(Y,wt){Y.side===Go?Nt(r.CULL_FACE):Wt(r.CULL_FACE);let j=Y.side===ui;wt&&(j=!j),qt(j),Y.blending===Fa&&Y.transparent===!1?Gt(cs):Gt(Y.blending,Y.blendEquation,Y.blendSrc,Y.blendDst,Y.blendEquationAlpha,Y.blendSrcAlpha,Y.blendDstAlpha,Y.premultipliedAlpha),p.setFunc(Y.depthFunc),p.setTest(Y.depthTest),p.setMask(Y.depthWrite),h.setMask(Y.colorWrite);let Ut=Y.stencilWrite;d.setTest(Ut),Ut&&(d.setMask(Y.stencilWriteMask),d.setFunc(Y.stencilFunc,Y.stencilRef,Y.stencilFuncMask),d.setOp(Y.stencilFail,Y.stencilZFail,Y.stencilZPass)),b(Y.polygonOffset,Y.polygonOffsetFactor,Y.polygonOffsetUnits),Y.alphaToCoverage===!0?Wt(r.SAMPLE_ALPHA_TO_COVERAGE):Nt(r.SAMPLE_ALPHA_TO_COVERAGE)}function qt(Y){q!==Y&&(Y?r.frontFace(r.CW):r.frontFace(r.CCW),q=Y)}function $(Y){Y!==D1?(Wt(r.CULL_FACE),Y!==nt&&(Y===Cm?r.cullFace(r.BACK):Y===F1?r.cullFace(r.FRONT):r.cullFace(r.FRONT_AND_BACK))):Nt(r.CULL_FACE),nt=Y}function N(Y){Y!==k&&(vt&&r.lineWidth(Y),k=Y)}function b(Y,wt,j){Y?(Wt(r.POLYGON_OFFSET_FILL),(xt!==wt||X!==j)&&(r.polygonOffset(wt,j),xt=wt,X=j)):Nt(r.POLYGON_OFFSET_FILL)}function R(Y){Y?Wt(r.SCISSOR_TEST):Nt(r.SCISSOR_TEST)}function W(Y){Y===void 0&&(Y=r.TEXTURE0+it-1),ot!==Y&&(r.activeTexture(Y),ot=Y)}function J(Y,wt,j){j===void 0&&(ot===null?j=r.TEXTURE0+it-1:j=ot);let Ut=V[j];Ut===void 0&&(Ut={type:void 0,texture:void 0},V[j]=Ut),(Ut.type!==Y||Ut.texture!==wt)&&(ot!==j&&(r.activeTexture(j),ot=j),r.bindTexture(Y,wt||Yt[Y]),Ut.type=Y,Ut.texture=wt)}function I(){let Y=V[ot];Y!==void 0&&Y.type!==void 0&&(r.bindTexture(Y.type,null),Y.type=void 0,Y.texture=void 0)}function P(){try{r.compressedTexImage2D.apply(r,arguments)}catch(Y){console.error("THREE.WebGLState:",Y)}}function B(){try{r.compressedTexImage3D.apply(r,arguments)}catch(Y){console.error("THREE.WebGLState:",Y)}}function lt(){try{r.texSubImage2D.apply(r,arguments)}catch(Y){console.error("THREE.WebGLState:",Y)}}function ct(){try{r.texSubImage3D.apply(r,arguments)}catch(Y){console.error("THREE.WebGLState:",Y)}}function Q(){try{r.compressedTexSubImage2D.apply(r,arguments)}catch(Y){console.error("THREE.WebGLState:",Y)}}function St(){try{r.compressedTexSubImage3D.apply(r,arguments)}catch(Y){console.error("THREE.WebGLState:",Y)}}function _t(){try{r.texStorage2D.apply(r,arguments)}catch(Y){console.error("THREE.WebGLState:",Y)}}function Mt(){try{r.texStorage3D.apply(r,arguments)}catch(Y){console.error("THREE.WebGLState:",Y)}}function Lt(){try{r.texImage2D.apply(r,arguments)}catch(Y){console.error("THREE.WebGLState:",Y)}}function Jt(){try{r.texImage3D.apply(r,arguments)}catch(Y){console.error("THREE.WebGLState:",Y)}}function Et(Y){Tt.equals(Y)===!1&&(r.scissor(Y.x,Y.y,Y.z,Y.w),Tt.copy(Y))}function oe(Y){dt.equals(Y)===!1&&(r.viewport(Y.x,Y.y,Y.z,Y.w),dt.copy(Y))}function jt(Y,wt){let j=_.get(wt);j===void 0&&(j=new WeakMap,_.set(wt,j));let Ut=j.get(Y);Ut===void 0&&(Ut=r.getUniformBlockIndex(wt,Y.name),j.set(Y,Ut))}function Ht(Y,wt){let Ut=_.get(wt).get(Y);g.get(wt)!==Ut&&(r.uniformBlockBinding(wt,Ut,Y.__bindingPointIndex),g.set(wt,Ut))}function Ot(){r.disable(r.BLEND),r.disable(r.CULL_FACE),r.disable(r.DEPTH_TEST),r.disable(r.POLYGON_OFFSET_FILL),r.disable(r.SCISSOR_TEST),r.disable(r.STENCIL_TEST),r.disable(r.SAMPLE_ALPHA_TO_COVERAGE),r.blendEquation(r.FUNC_ADD),r.blendFunc(r.ONE,r.ZERO),r.blendFuncSeparate(r.ONE,r.ZERO,r.ONE,r.ZERO),r.colorMask(!0,!0,!0,!0),r.clearColor(0,0,0,0),r.depthMask(!0),r.depthFunc(r.LESS),r.clearDepth(1),r.stencilMask(4294967295),r.stencilFunc(r.ALWAYS,0,4294967295),r.stencilOp(r.KEEP,r.KEEP,r.KEEP),r.clearStencil(0),r.cullFace(r.BACK),r.frontFace(r.CCW),r.polygonOffset(0,0),r.activeTexture(r.TEXTURE0),r.bindFramebuffer(r.FRAMEBUFFER,null),o===!0&&(r.bindFramebuffer(r.DRAW_FRAMEBUFFER,null),r.bindFramebuffer(r.READ_FRAMEBUFFER,null)),r.useProgram(null),r.lineWidth(1),r.scissor(0,0,r.canvas.width,r.canvas.height),r.viewport(0,0,r.canvas.width,r.canvas.height),y={},ot=null,V={},M={},w=new WeakMap,A=[],x=null,v=!1,C=null,S=null,O=null,F=null,G=null,z=null,L=null,D=!1,q=null,nt=null,k=null,xt=null,X=null,Tt.set(0,0,r.canvas.width,r.canvas.height),dt.set(0,0,r.canvas.width,r.canvas.height),h.reset(),p.reset(),d.reset()}return{buffers:{color:h,depth:p,stencil:d},enable:Wt,disable:Nt,bindFramebuffer:ne,drawBuffers:Pt,useProgram:Xt,setBlending:Gt,setMaterial:te,setFlipSided:qt,setCullFace:$,setLineWidth:N,setPolygonOffset:b,setScissorTest:R,activeTexture:W,bindTexture:J,unbindTexture:I,compressedTexImage2D:P,compressedTexImage3D:B,texImage2D:Lt,texImage3D:Jt,updateUBOMapping:jt,uniformBlockBinding:Ht,texStorage2D:_t,texStorage3D:Mt,texSubImage2D:lt,texSubImage3D:ct,compressedTexSubImage2D:Q,compressedTexSubImage3D:St,scissor:Et,viewport:oe,reset:Ot}}function yb(r,t,e,o,a,l,f){let h=a.isWebGL2,p=a.maxTextures,d=a.maxCubemapSize,g=a.maxTextureSize,_=a.maxSamples,y=t.has("WEBGL_multisampled_render_to_texture")?t.get("WEBGL_multisampled_render_to_texture"):null,M=typeof navigator=="undefined"?!1:/OculusBrowser/g.test(navigator.userAgent),w=new WeakMap,A,x=new WeakMap,v=!1;try{v=typeof OffscreenCanvas!="undefined"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch(I){}function C(I,P){return v?new OffscreenCanvas(I,P):Ql("canvas")}function S(I,P,B,lt){let ct=1;if((I.width>lt||I.height>lt)&&(ct=lt/Math.max(I.width,I.height)),ct<1||P===!0)if(typeof HTMLImageElement!="undefined"&&I instanceof HTMLImageElement||typeof HTMLCanvasElement!="undefined"&&I instanceof HTMLCanvasElement||typeof ImageBitmap!="undefined"&&I instanceof ImageBitmap){let Q=P?ph:Math.floor,St=Q(ct*I.width),_t=Q(ct*I.height);A===void 0&&(A=C(St,_t));let Mt=B?C(St,_t):A;return Mt.width=St,Mt.height=_t,Mt.getContext("2d").drawImage(I,0,0,St,_t),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+I.width+"x"+I.height+") to ("+St+"x"+_t+")."),Mt}else return"data"in I&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+I.width+"x"+I.height+")."),I;return I}function O(I){return fg(I.width)&&fg(I.height)}function F(I){return h?!1:I.wrapS!==Ji||I.wrapT!==Ji||I.minFilter!==$r&&I.minFilter!==Ni}function G(I,P){return I.generateMipmaps&&P&&I.minFilter!==$r&&I.minFilter!==Ni}function z(I){r.generateMipmap(I)}function L(I,P,B,lt,ct=!1){if(h===!1)return P;if(I!==null){if(r[I]!==void 0)return r[I];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format \'"+I+"\'")}let Q=P;if(P===r.RED&&(B===r.FLOAT&&(Q=r.R32F),B===r.HALF_FLOAT&&(Q=r.R16F),B===r.UNSIGNED_BYTE&&(Q=r.R8)),P===r.RED_INTEGER&&(B===r.UNSIGNED_BYTE&&(Q=r.R8UI),B===r.UNSIGNED_SHORT&&(Q=r.R16UI),B===r.UNSIGNED_INT&&(Q=r.R32UI),B===r.BYTE&&(Q=r.R8I),B===r.SHORT&&(Q=r.R16I),B===r.INT&&(Q=r.R32I)),P===r.RG&&(B===r.FLOAT&&(Q=r.RG32F),B===r.HALF_FLOAT&&(Q=r.RG16F),B===r.UNSIGNED_BYTE&&(Q=r.RG8)),P===r.RGBA){let St=ct?Jl:gn.getTransfer(lt);B===r.FLOAT&&(Q=r.RGBA32F),B===r.HALF_FLOAT&&(Q=r.RGBA16F),B===r.UNSIGNED_BYTE&&(Q=St===Tn?r.SRGB8_ALPHA8:r.RGBA8),B===r.UNSIGNED_SHORT_4_4_4_4&&(Q=r.RGBA4),B===r.UNSIGNED_SHORT_5_5_5_1&&(Q=r.RGB5_A1)}return(Q===r.R16F||Q===r.R32F||Q===r.RG16F||Q===r.RG32F||Q===r.RGBA16F||Q===r.RGBA32F)&&t.get("EXT_color_buffer_float"),Q}function D(I,P,B){return G(I,B)===!0||I.isFramebufferTexture&&I.minFilter!==$r&&I.minFilter!==Ni?Math.log2(Math.max(P.width,P.height))+1:I.mipmaps!==void 0&&I.mipmaps.length>0?I.mipmaps.length:I.isCompressedTexture&&Array.isArray(I.image)?P.mipmaps.length:1}function q(I){return I===$r||I===Om||I===If?r.NEAREST:r.LINEAR}function nt(I){let P=I.target;P.removeEventListener("dispose",nt),xt(P),P.isVideoTexture&&w.delete(P)}function k(I){let P=I.target;P.removeEventListener("dispose",k),it(P)}function xt(I){let P=o.get(I);if(P.__webglInit===void 0)return;let B=I.source,lt=x.get(B);if(lt){let ct=lt[P.__cacheKey];ct.usedTimes--,ct.usedTimes===0&&X(I),Object.keys(lt).length===0&&x.delete(B)}o.remove(I)}function X(I){let P=o.get(I);r.deleteTexture(P.__webglTexture);let B=I.source,lt=x.get(B);delete lt[P.__cacheKey],f.memory.textures--}function it(I){let P=I.texture,B=o.get(I),lt=o.get(P);if(lt.__webglTexture!==void 0&&(r.deleteTexture(lt.__webglTexture),f.memory.textures--),I.depthTexture&&I.depthTexture.dispose(),I.isWebGLCubeRenderTarget)for(let ct=0;ct<6;ct++){if(Array.isArray(B.__webglFramebuffer[ct]))for(let Q=0;Q<B.__webglFramebuffer[ct].length;Q++)r.deleteFramebuffer(B.__webglFramebuffer[ct][Q]);else r.deleteFramebuffer(B.__webglFramebuffer[ct]);B.__webglDepthbuffer&&r.deleteRenderbuffer(B.__webglDepthbuffer[ct])}else{if(Array.isArray(B.__webglFramebuffer))for(let ct=0;ct<B.__webglFramebuffer.length;ct++)r.deleteFramebuffer(B.__webglFramebuffer[ct]);else r.deleteFramebuffer(B.__webglFramebuffer);if(B.__webglDepthbuffer&&r.deleteRenderbuffer(B.__webglDepthbuffer),B.__webglMultisampledFramebuffer&&r.deleteFramebuffer(B.__webglMultisampledFramebuffer),B.__webglColorRenderbuffer)for(let ct=0;ct<B.__webglColorRenderbuffer.length;ct++)B.__webglColorRenderbuffer[ct]&&r.deleteRenderbuffer(B.__webglColorRenderbuffer[ct]);B.__webglDepthRenderbuffer&&r.deleteRenderbuffer(B.__webglDepthRenderbuffer)}if(I.isWebGLMultipleRenderTargets)for(let ct=0,Q=P.length;ct<Q;ct++){let St=o.get(P[ct]);St.__webglTexture&&(r.deleteTexture(St.__webglTexture),f.memory.textures--),o.remove(P[ct])}o.remove(P),o.remove(I)}let vt=0;function pt(){vt=0}function et(){let I=vt;return I>=p&&console.warn("THREE.WebGLTextures: Trying to use "+I+" texture units while this GPU supports only "+p),vt+=1,I}function ot(I){let P=[];return P.push(I.wrapS),P.push(I.wrapT),P.push(I.wrapR||0),P.push(I.magFilter),P.push(I.minFilter),P.push(I.anisotropy),P.push(I.internalFormat),P.push(I.format),P.push(I.type),P.push(I.generateMipmaps),P.push(I.premultiplyAlpha),P.push(I.flipY),P.push(I.unpackAlignment),P.push(I.colorSpace),P.join()}function V(I,P){let B=o.get(I);if(I.isVideoTexture&&W(I),I.isRenderTargetTexture===!1&&I.version>0&&B.__version!==I.version){let lt=I.image;if(lt===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(lt.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{ne(B,I,P);return}}e.bindTexture(r.TEXTURE_2D,B.__webglTexture,r.TEXTURE0+P)}function K(I,P){let B=o.get(I);if(I.version>0&&B.__version!==I.version){ne(B,I,P);return}e.bindTexture(r.TEXTURE_2D_ARRAY,B.__webglTexture,r.TEXTURE0+P)}function at(I,P){let B=o.get(I);if(I.version>0&&B.__version!==I.version){ne(B,I,P);return}e.bindTexture(r.TEXTURE_3D,B.__webglTexture,r.TEXTURE0+P)}function Tt(I,P){let B=o.get(I);if(I.version>0&&B.__version!==I.version){Pt(B,I,P);return}e.bindTexture(r.TEXTURE_CUBE_MAP,B.__webglTexture,r.TEXTURE0+P)}let dt={[lh]:r.REPEAT,[Ji]:r.CLAMP_TO_EDGE,[ch]:r.MIRRORED_REPEAT},Ct={[$r]:r.NEAREST,[Om]:r.NEAREST_MIPMAP_NEAREST,[If]:r.NEAREST_MIPMAP_LINEAR,[Ni]:r.LINEAR,[cx]:r.LINEAR_MIPMAP_NEAREST,[Ou]:r.LINEAR_MIPMAP_LINEAR},Yt={[bx]:r.NEVER,[Lx]:r.ALWAYS,[Tx]:r.LESS,[Cx]:r.LEQUAL,[Ax]:r.EQUAL,[Rx]:r.GEQUAL,[Px]:r.GREATER,[Ix]:r.NOTEQUAL};function Wt(I,P,B){if(B?(r.texParameteri(I,r.TEXTURE_WRAP_S,dt[P.wrapS]),r.texParameteri(I,r.TEXTURE_WRAP_T,dt[P.wrapT]),(I===r.TEXTURE_3D||I===r.TEXTURE_2D_ARRAY)&&r.texParameteri(I,r.TEXTURE_WRAP_R,dt[P.wrapR]),r.texParameteri(I,r.TEXTURE_MAG_FILTER,Ct[P.magFilter]),r.texParameteri(I,r.TEXTURE_MIN_FILTER,Ct[P.minFilter])):(r.texParameteri(I,r.TEXTURE_WRAP_S,r.CLAMP_TO_EDGE),r.texParameteri(I,r.TEXTURE_WRAP_T,r.CLAMP_TO_EDGE),(I===r.TEXTURE_3D||I===r.TEXTURE_2D_ARRAY)&&r.texParameteri(I,r.TEXTURE_WRAP_R,r.CLAMP_TO_EDGE),(P.wrapS!==Ji||P.wrapT!==Ji)&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),r.texParameteri(I,r.TEXTURE_MAG_FILTER,q(P.magFilter)),r.texParameteri(I,r.TEXTURE_MIN_FILTER,q(P.minFilter)),P.minFilter!==$r&&P.minFilter!==Ni&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),P.compareFunction&&(r.texParameteri(I,r.TEXTURE_COMPARE_MODE,r.COMPARE_REF_TO_TEXTURE),r.texParameteri(I,r.TEXTURE_COMPARE_FUNC,Yt[P.compareFunction])),t.has("EXT_texture_filter_anisotropic")===!0){let lt=t.get("EXT_texture_filter_anisotropic");if(P.magFilter===$r||P.minFilter!==If&&P.minFilter!==Ou||P.type===ls&&t.has("OES_texture_float_linear")===!1||h===!1&&P.type===Du&&t.has("OES_texture_half_float_linear")===!1)return;(P.anisotropy>1||o.get(P).__currentAnisotropy)&&(r.texParameterf(I,lt.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(P.anisotropy,a.getMaxAnisotropy())),o.get(P).__currentAnisotropy=P.anisotropy)}}function Nt(I,P){let B=!1;I.__webglInit===void 0&&(I.__webglInit=!0,P.addEventListener("dispose",nt));let lt=P.source,ct=x.get(lt);ct===void 0&&(ct={},x.set(lt,ct));let Q=ot(P);if(Q!==I.__cacheKey){ct[Q]===void 0&&(ct[Q]={texture:r.createTexture(),usedTimes:0},f.memory.textures++,B=!0),ct[Q].usedTimes++;let St=ct[I.__cacheKey];St!==void 0&&(ct[I.__cacheKey].usedTimes--,St.usedTimes===0&&X(P)),I.__cacheKey=Q,I.__webglTexture=ct[Q].texture}return B}function ne(I,P,B){let lt=r.TEXTURE_2D;(P.isDataArrayTexture||P.isCompressedArrayTexture)&&(lt=r.TEXTURE_2D_ARRAY),P.isData3DTexture&&(lt=r.TEXTURE_3D);let ct=Nt(I,P),Q=P.source;e.bindTexture(lt,I.__webglTexture,r.TEXTURE0+B);let St=o.get(Q);if(Q.version!==St.__version||ct===!0){e.activeTexture(r.TEXTURE0+B);let _t=gn.getPrimaries(gn.workingColorSpace),Mt=P.colorSpace===Oi?null:gn.getPrimaries(P.colorSpace),Lt=P.colorSpace===Oi||_t===Mt?r.NONE:r.BROWSER_DEFAULT_WEBGL;r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,P.flipY),r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,P.premultiplyAlpha),r.pixelStorei(r.UNPACK_ALIGNMENT,P.unpackAlignment),r.pixelStorei(r.UNPACK_COLORSPACE_CONVERSION_WEBGL,Lt);let Jt=F(P)&&O(P.image)===!1,Et=S(P.image,Jt,!1,g);Et=J(P,Et);let oe=O(Et)||h,jt=l.convert(P.format,P.colorSpace),Ht=l.convert(P.type),Ot=L(P.internalFormat,jt,Ht,P.colorSpace,P.isVideoTexture);Wt(lt,P,oe);let Y,wt=P.mipmaps,j=h&&P.isVideoTexture!==!0,Ut=St.__version===void 0||ct===!0,Dt=D(P,Et,oe);if(P.isDepthTexture)Ot=r.DEPTH_COMPONENT,h?P.type===ls?Ot=r.DEPTH_COMPONENT32F:P.type===us?Ot=r.DEPTH_COMPONENT24:P.type===Vs?Ot=r.DEPTH24_STENCIL8:Ot=r.DEPTH_COMPONENT16:P.type===ls&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),P.format===Hs&&Ot===r.DEPTH_COMPONENT&&P.type!==qh&&P.type!==us&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),P.type=us,Ht=l.convert(P.type)),P.format===Ga&&Ot===r.DEPTH_COMPONENT&&(Ot=r.DEPTH_STENCIL,P.type!==Vs&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),P.type=Vs,Ht=l.convert(P.type))),Ut&&(j?e.texStorage2D(r.TEXTURE_2D,1,Ot,Et.width,Et.height):e.texImage2D(r.TEXTURE_2D,0,Ot,Et.width,Et.height,0,jt,Ht,null));else if(P.isDataTexture)if(wt.length>0&&oe){j&&Ut&&e.texStorage2D(r.TEXTURE_2D,Dt,Ot,wt[0].width,wt[0].height);for(let ft=0,$t=wt.length;ft<$t;ft++)Y=wt[ft],j?e.texSubImage2D(r.TEXTURE_2D,ft,0,0,Y.width,Y.height,jt,Ht,Y.data):e.texImage2D(r.TEXTURE_2D,ft,Ot,Y.width,Y.height,0,jt,Ht,Y.data);P.generateMipmaps=!1}else j?(Ut&&e.texStorage2D(r.TEXTURE_2D,Dt,Ot,Et.width,Et.height),e.texSubImage2D(r.TEXTURE_2D,0,0,0,Et.width,Et.height,jt,Ht,Et.data)):e.texImage2D(r.TEXTURE_2D,0,Ot,Et.width,Et.height,0,jt,Ht,Et.data);else if(P.isCompressedTexture)if(P.isCompressedArrayTexture){j&&Ut&&e.texStorage3D(r.TEXTURE_2D_ARRAY,Dt,Ot,wt[0].width,wt[0].height,Et.depth);for(let ft=0,$t=wt.length;ft<$t;ft++)Y=wt[ft],P.format!==$i?jt!==null?j?e.compressedTexSubImage3D(r.TEXTURE_2D_ARRAY,ft,0,0,0,Y.width,Y.height,Et.depth,jt,Y.data,0,0):e.compressedTexImage3D(r.TEXTURE_2D_ARRAY,ft,Ot,Y.width,Y.height,Et.depth,0,Y.data,0,0):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):j?e.texSubImage3D(r.TEXTURE_2D_ARRAY,ft,0,0,0,Y.width,Y.height,Et.depth,jt,Ht,Y.data):e.texImage3D(r.TEXTURE_2D_ARRAY,ft,Ot,Y.width,Y.height,Et.depth,0,jt,Ht,Y.data)}else{j&&Ut&&e.texStorage2D(r.TEXTURE_2D,Dt,Ot,wt[0].width,wt[0].height);for(let ft=0,$t=wt.length;ft<$t;ft++)Y=wt[ft],P.format!==$i?jt!==null?j?e.compressedTexSubImage2D(r.TEXTURE_2D,ft,0,0,Y.width,Y.height,jt,Y.data):e.compressedTexImage2D(r.TEXTURE_2D,ft,Ot,Y.width,Y.height,0,Y.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):j?e.texSubImage2D(r.TEXTURE_2D,ft,0,0,Y.width,Y.height,jt,Ht,Y.data):e.texImage2D(r.TEXTURE_2D,ft,Ot,Y.width,Y.height,0,jt,Ht,Y.data)}else if(P.isDataArrayTexture)j?(Ut&&e.texStorage3D(r.TEXTURE_2D_ARRAY,Dt,Ot,Et.width,Et.height,Et.depth),e.texSubImage3D(r.TEXTURE_2D_ARRAY,0,0,0,0,Et.width,Et.height,Et.depth,jt,Ht,Et.data)):e.texImage3D(r.TEXTURE_2D_ARRAY,0,Ot,Et.width,Et.height,Et.depth,0,jt,Ht,Et.data);else if(P.isData3DTexture)j?(Ut&&e.texStorage3D(r.TEXTURE_3D,Dt,Ot,Et.width,Et.height,Et.depth),e.texSubImage3D(r.TEXTURE_3D,0,0,0,0,Et.width,Et.height,Et.depth,jt,Ht,Et.data)):e.texImage3D(r.TEXTURE_3D,0,Ot,Et.width,Et.height,Et.depth,0,jt,Ht,Et.data);else if(P.isFramebufferTexture){if(Ut)if(j)e.texStorage2D(r.TEXTURE_2D,Dt,Ot,Et.width,Et.height);else{let ft=Et.width,$t=Et.height;for(let re=0;re<Dt;re++)e.texImage2D(r.TEXTURE_2D,re,Ot,ft,$t,0,jt,Ht,null),ft>>=1,$t>>=1}}else if(wt.length>0&&oe){j&&Ut&&e.texStorage2D(r.TEXTURE_2D,Dt,Ot,wt[0].width,wt[0].height);for(let ft=0,$t=wt.length;ft<$t;ft++)Y=wt[ft],j?e.texSubImage2D(r.TEXTURE_2D,ft,0,0,jt,Ht,Y):e.texImage2D(r.TEXTURE_2D,ft,Ot,jt,Ht,Y);P.generateMipmaps=!1}else j?(Ut&&e.texStorage2D(r.TEXTURE_2D,Dt,Ot,Et.width,Et.height),e.texSubImage2D(r.TEXTURE_2D,0,0,0,jt,Ht,Et)):e.texImage2D(r.TEXTURE_2D,0,Ot,jt,Ht,Et);G(P,oe)&&z(lt),St.__version=Q.version,P.onUpdate&&P.onUpdate(P)}I.__version=P.version}function Pt(I,P,B){if(P.image.length!==6)return;let lt=Nt(I,P),ct=P.source;e.bindTexture(r.TEXTURE_CUBE_MAP,I.__webglTexture,r.TEXTURE0+B);let Q=o.get(ct);if(ct.version!==Q.__version||lt===!0){e.activeTexture(r.TEXTURE0+B);let St=gn.getPrimaries(gn.workingColorSpace),_t=P.colorSpace===Oi?null:gn.getPrimaries(P.colorSpace),Mt=P.colorSpace===Oi||St===_t?r.NONE:r.BROWSER_DEFAULT_WEBGL;r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,P.flipY),r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,P.premultiplyAlpha),r.pixelStorei(r.UNPACK_ALIGNMENT,P.unpackAlignment),r.pixelStorei(r.UNPACK_COLORSPACE_CONVERSION_WEBGL,Mt);let Lt=P.isCompressedTexture||P.image[0].isCompressedTexture,Jt=P.image[0]&&P.image[0].isDataTexture,Et=[];for(let ft=0;ft<6;ft++)!Lt&&!Jt?Et[ft]=S(P.image[ft],!1,!0,d):Et[ft]=Jt?P.image[ft].image:P.image[ft],Et[ft]=J(P,Et[ft]);let oe=Et[0],jt=O(oe)||h,Ht=l.convert(P.format,P.colorSpace),Ot=l.convert(P.type),Y=L(P.internalFormat,Ht,Ot,P.colorSpace),wt=h&&P.isVideoTexture!==!0,j=Q.__version===void 0||lt===!0,Ut=D(P,oe,jt);Wt(r.TEXTURE_CUBE_MAP,P,jt);let Dt;if(Lt){wt&&j&&e.texStorage2D(r.TEXTURE_CUBE_MAP,Ut,Y,oe.width,oe.height);for(let ft=0;ft<6;ft++){Dt=Et[ft].mipmaps;for(let $t=0;$t<Dt.length;$t++){let re=Dt[$t];P.format!==$i?Ht!==null?wt?e.compressedTexSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+ft,$t,0,0,re.width,re.height,Ht,re.data):e.compressedTexImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+ft,$t,Y,re.width,re.height,0,re.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):wt?e.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+ft,$t,0,0,re.width,re.height,Ht,Ot,re.data):e.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+ft,$t,Y,re.width,re.height,0,Ht,Ot,re.data)}}}else{Dt=P.mipmaps,wt&&j&&(Dt.length>0&&Ut++,e.texStorage2D(r.TEXTURE_CUBE_MAP,Ut,Y,Et[0].width,Et[0].height));for(let ft=0;ft<6;ft++)if(Jt){wt?e.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+ft,0,0,0,Et[ft].width,Et[ft].height,Ht,Ot,Et[ft].data):e.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+ft,0,Y,Et[ft].width,Et[ft].height,0,Ht,Ot,Et[ft].data);for(let $t=0;$t<Dt.length;$t++){let mn=Dt[$t].image[ft].image;wt?e.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+ft,$t+1,0,0,mn.width,mn.height,Ht,Ot,mn.data):e.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+ft,$t+1,Y,mn.width,mn.height,0,Ht,Ot,mn.data)}}else{wt?e.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+ft,0,0,0,Ht,Ot,Et[ft]):e.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+ft,0,Y,Ht,Ot,Et[ft]);for(let $t=0;$t<Dt.length;$t++){let re=Dt[$t];wt?e.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+ft,$t+1,0,0,Ht,Ot,re.image[ft]):e.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+ft,$t+1,Y,Ht,Ot,re.image[ft])}}}G(P,jt)&&z(r.TEXTURE_CUBE_MAP),Q.__version=ct.version,P.onUpdate&&P.onUpdate(P)}I.__version=P.version}function Xt(I,P,B,lt,ct,Q){let St=l.convert(B.format,B.colorSpace),_t=l.convert(B.type),Mt=L(B.internalFormat,St,_t,B.colorSpace);if(!o.get(P).__hasExternalTextures){let Jt=Math.max(1,P.width>>Q),Et=Math.max(1,P.height>>Q);ct===r.TEXTURE_3D||ct===r.TEXTURE_2D_ARRAY?e.texImage3D(ct,Q,Mt,Jt,Et,P.depth,0,St,_t,null):e.texImage2D(ct,Q,Mt,Jt,Et,0,St,_t,null)}e.bindFramebuffer(r.FRAMEBUFFER,I),R(P)?y.framebufferTexture2DMultisampleEXT(r.FRAMEBUFFER,lt,ct,o.get(B).__webglTexture,0,b(P)):(ct===r.TEXTURE_2D||ct>=r.TEXTURE_CUBE_MAP_POSITIVE_X&&ct<=r.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&r.framebufferTexture2D(r.FRAMEBUFFER,lt,ct,o.get(B).__webglTexture,Q),e.bindFramebuffer(r.FRAMEBUFFER,null)}function tt(I,P,B){if(r.bindRenderbuffer(r.RENDERBUFFER,I),P.depthBuffer&&!P.stencilBuffer){let lt=h===!0?r.DEPTH_COMPONENT24:r.DEPTH_COMPONENT16;if(B||R(P)){let ct=P.depthTexture;ct&&ct.isDepthTexture&&(ct.type===ls?lt=r.DEPTH_COMPONENT32F:ct.type===us&&(lt=r.DEPTH_COMPONENT24));let Q=b(P);R(P)?y.renderbufferStorageMultisampleEXT(r.RENDERBUFFER,Q,lt,P.width,P.height):r.renderbufferStorageMultisample(r.RENDERBUFFER,Q,lt,P.width,P.height)}else r.renderbufferStorage(r.RENDERBUFFER,lt,P.width,P.height);r.framebufferRenderbuffer(r.FRAMEBUFFER,r.DEPTH_ATTACHMENT,r.RENDERBUFFER,I)}else if(P.depthBuffer&&P.stencilBuffer){let lt=b(P);B&&R(P)===!1?r.renderbufferStorageMultisample(r.RENDERBUFFER,lt,r.DEPTH24_STENCIL8,P.width,P.height):R(P)?y.renderbufferStorageMultisampleEXT(r.RENDERBUFFER,lt,r.DEPTH24_STENCIL8,P.width,P.height):r.renderbufferStorage(r.RENDERBUFFER,r.DEPTH_STENCIL,P.width,P.height),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.DEPTH_STENCIL_ATTACHMENT,r.RENDERBUFFER,I)}else{let lt=P.isWebGLMultipleRenderTargets===!0?P.texture:[P.texture];for(let ct=0;ct<lt.length;ct++){let Q=lt[ct],St=l.convert(Q.format,Q.colorSpace),_t=l.convert(Q.type),Mt=L(Q.internalFormat,St,_t,Q.colorSpace),Lt=b(P);B&&R(P)===!1?r.renderbufferStorageMultisample(r.RENDERBUFFER,Lt,Mt,P.width,P.height):R(P)?y.renderbufferStorageMultisampleEXT(r.RENDERBUFFER,Lt,Mt,P.width,P.height):r.renderbufferStorage(r.RENDERBUFFER,Mt,P.width,P.height)}}r.bindRenderbuffer(r.RENDERBUFFER,null)}function nn(I,P){if(P&&P.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(e.bindFramebuffer(r.FRAMEBUFFER,I),!(P.depthTexture&&P.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");(!o.get(P.depthTexture).__webglTexture||P.depthTexture.image.width!==P.width||P.depthTexture.image.height!==P.height)&&(P.depthTexture.image.width=P.width,P.depthTexture.image.height=P.height,P.depthTexture.needsUpdate=!0),V(P.depthTexture,0);let lt=o.get(P.depthTexture).__webglTexture,ct=b(P);if(P.depthTexture.format===Hs)R(P)?y.framebufferTexture2DMultisampleEXT(r.FRAMEBUFFER,r.DEPTH_ATTACHMENT,r.TEXTURE_2D,lt,0,ct):r.framebufferTexture2D(r.FRAMEBUFFER,r.DEPTH_ATTACHMENT,r.TEXTURE_2D,lt,0);else if(P.depthTexture.format===Ga)R(P)?y.framebufferTexture2DMultisampleEXT(r.FRAMEBUFFER,r.DEPTH_STENCIL_ATTACHMENT,r.TEXTURE_2D,lt,0,ct):r.framebufferTexture2D(r.FRAMEBUFFER,r.DEPTH_STENCIL_ATTACHMENT,r.TEXTURE_2D,lt,0);else throw new Error("Unknown depthTexture format")}function Gt(I){let P=o.get(I),B=I.isWebGLCubeRenderTarget===!0;if(I.depthTexture&&!P.__autoAllocateDepthBuffer){if(B)throw new Error("target.depthTexture not supported in Cube render targets");nn(P.__webglFramebuffer,I)}else if(B){P.__webglDepthbuffer=[];for(let lt=0;lt<6;lt++)e.bindFramebuffer(r.FRAMEBUFFER,P.__webglFramebuffer[lt]),P.__webglDepthbuffer[lt]=r.createRenderbuffer(),tt(P.__webglDepthbuffer[lt],I,!1)}else e.bindFramebuffer(r.FRAMEBUFFER,P.__webglFramebuffer),P.__webglDepthbuffer=r.createRenderbuffer(),tt(P.__webglDepthbuffer,I,!1);e.bindFramebuffer(r.FRAMEBUFFER,null)}function te(I,P,B){let lt=o.get(I);P!==void 0&&Xt(lt.__webglFramebuffer,I,I.texture,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,0),B!==void 0&&Gt(I)}function qt(I){let P=I.texture,B=o.get(I),lt=o.get(P);I.addEventListener("dispose",k),I.isWebGLMultipleRenderTargets!==!0&&(lt.__webglTexture===void 0&&(lt.__webglTexture=r.createTexture()),lt.__version=P.version,f.memory.textures++);let ct=I.isWebGLCubeRenderTarget===!0,Q=I.isWebGLMultipleRenderTargets===!0,St=O(I)||h;if(ct){B.__webglFramebuffer=[];for(let _t=0;_t<6;_t++)if(h&&P.mipmaps&&P.mipmaps.length>0){B.__webglFramebuffer[_t]=[];for(let Mt=0;Mt<P.mipmaps.length;Mt++)B.__webglFramebuffer[_t][Mt]=r.createFramebuffer()}else B.__webglFramebuffer[_t]=r.createFramebuffer()}else{if(h&&P.mipmaps&&P.mipmaps.length>0){B.__webglFramebuffer=[];for(let _t=0;_t<P.mipmaps.length;_t++)B.__webglFramebuffer[_t]=r.createFramebuffer()}else B.__webglFramebuffer=r.createFramebuffer();if(Q)if(a.drawBuffers){let _t=I.texture;for(let Mt=0,Lt=_t.length;Mt<Lt;Mt++){let Jt=o.get(_t[Mt]);Jt.__webglTexture===void 0&&(Jt.__webglTexture=r.createTexture(),f.memory.textures++)}}else console.warn("THREE.WebGLRenderer: WebGLMultipleRenderTargets can only be used with WebGL2 or WEBGL_draw_buffers extension.");if(h&&I.samples>0&&R(I)===!1){let _t=Q?P:[P];B.__webglMultisampledFramebuffer=r.createFramebuffer(),B.__webglColorRenderbuffer=[],e.bindFramebuffer(r.FRAMEBUFFER,B.__webglMultisampledFramebuffer);for(let Mt=0;Mt<_t.length;Mt++){let Lt=_t[Mt];B.__webglColorRenderbuffer[Mt]=r.createRenderbuffer(),r.bindRenderbuffer(r.RENDERBUFFER,B.__webglColorRenderbuffer[Mt]);let Jt=l.convert(Lt.format,Lt.colorSpace),Et=l.convert(Lt.type),oe=L(Lt.internalFormat,Jt,Et,Lt.colorSpace,I.isXRRenderTarget===!0),jt=b(I);r.renderbufferStorageMultisample(r.RENDERBUFFER,jt,oe,I.width,I.height),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0+Mt,r.RENDERBUFFER,B.__webglColorRenderbuffer[Mt])}r.bindRenderbuffer(r.RENDERBUFFER,null),I.depthBuffer&&(B.__webglDepthRenderbuffer=r.createRenderbuffer(),tt(B.__webglDepthRenderbuffer,I,!0)),e.bindFramebuffer(r.FRAMEBUFFER,null)}}if(ct){e.bindTexture(r.TEXTURE_CUBE_MAP,lt.__webglTexture),Wt(r.TEXTURE_CUBE_MAP,P,St);for(let _t=0;_t<6;_t++)if(h&&P.mipmaps&&P.mipmaps.length>0)for(let Mt=0;Mt<P.mipmaps.length;Mt++)Xt(B.__webglFramebuffer[_t][Mt],I,P,r.COLOR_ATTACHMENT0,r.TEXTURE_CUBE_MAP_POSITIVE_X+_t,Mt);else Xt(B.__webglFramebuffer[_t],I,P,r.COLOR_ATTACHMENT0,r.TEXTURE_CUBE_MAP_POSITIVE_X+_t,0);G(P,St)&&z(r.TEXTURE_CUBE_MAP),e.unbindTexture()}else if(Q){let _t=I.texture;for(let Mt=0,Lt=_t.length;Mt<Lt;Mt++){let Jt=_t[Mt],Et=o.get(Jt);e.bindTexture(r.TEXTURE_2D,Et.__webglTexture),Wt(r.TEXTURE_2D,Jt,St),Xt(B.__webglFramebuffer,I,Jt,r.COLOR_ATTACHMENT0+Mt,r.TEXTURE_2D,0),G(Jt,St)&&z(r.TEXTURE_2D)}e.unbindTexture()}else{let _t=r.TEXTURE_2D;if((I.isWebGL3DRenderTarget||I.isWebGLArrayRenderTarget)&&(h?_t=I.isWebGL3DRenderTarget?r.TEXTURE_3D:r.TEXTURE_2D_ARRAY:console.error("THREE.WebGLTextures: THREE.Data3DTexture and THREE.DataArrayTexture only supported with WebGL2.")),e.bindTexture(_t,lt.__webglTexture),Wt(_t,P,St),h&&P.mipmaps&&P.mipmaps.length>0)for(let Mt=0;Mt<P.mipmaps.length;Mt++)Xt(B.__webglFramebuffer[Mt],I,P,r.COLOR_ATTACHMENT0,_t,Mt);else Xt(B.__webglFramebuffer,I,P,r.COLOR_ATTACHMENT0,_t,0);G(P,St)&&z(_t),e.unbindTexture()}I.depthBuffer&&Gt(I)}function $(I){let P=O(I)||h,B=I.isWebGLMultipleRenderTargets===!0?I.texture:[I.texture];for(let lt=0,ct=B.length;lt<ct;lt++){let Q=B[lt];if(G(Q,P)){let St=I.isWebGLCubeRenderTarget?r.TEXTURE_CUBE_MAP:r.TEXTURE_2D,_t=o.get(Q).__webglTexture;e.bindTexture(St,_t),z(St),e.unbindTexture()}}}function N(I){if(h&&I.samples>0&&R(I)===!1){let P=I.isWebGLMultipleRenderTargets?I.texture:[I.texture],B=I.width,lt=I.height,ct=r.COLOR_BUFFER_BIT,Q=[],St=I.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT,_t=o.get(I),Mt=I.isWebGLMultipleRenderTargets===!0;if(Mt)for(let Lt=0;Lt<P.length;Lt++)e.bindFramebuffer(r.FRAMEBUFFER,_t.__webglMultisampledFramebuffer),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0+Lt,r.RENDERBUFFER,null),e.bindFramebuffer(r.FRAMEBUFFER,_t.__webglFramebuffer),r.framebufferTexture2D(r.DRAW_FRAMEBUFFER,r.COLOR_ATTACHMENT0+Lt,r.TEXTURE_2D,null,0);e.bindFramebuffer(r.READ_FRAMEBUFFER,_t.__webglMultisampledFramebuffer),e.bindFramebuffer(r.DRAW_FRAMEBUFFER,_t.__webglFramebuffer);for(let Lt=0;Lt<P.length;Lt++){Q.push(r.COLOR_ATTACHMENT0+Lt),I.depthBuffer&&Q.push(St);let Jt=_t.__ignoreDepthValues!==void 0?_t.__ignoreDepthValues:!1;if(Jt===!1&&(I.depthBuffer&&(ct|=r.DEPTH_BUFFER_BIT),I.stencilBuffer&&(ct|=r.STENCIL_BUFFER_BIT)),Mt&&r.framebufferRenderbuffer(r.READ_FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.RENDERBUFFER,_t.__webglColorRenderbuffer[Lt]),Jt===!0&&(r.invalidateFramebuffer(r.READ_FRAMEBUFFER,[St]),r.invalidateFramebuffer(r.DRAW_FRAMEBUFFER,[St])),Mt){let Et=o.get(P[Lt]).__webglTexture;r.framebufferTexture2D(r.DRAW_FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,Et,0)}r.blitFramebuffer(0,0,B,lt,0,0,B,lt,ct,r.NEAREST),M&&r.invalidateFramebuffer(r.READ_FRAMEBUFFER,Q)}if(e.bindFramebuffer(r.READ_FRAMEBUFFER,null),e.bindFramebuffer(r.DRAW_FRAMEBUFFER,null),Mt)for(let Lt=0;Lt<P.length;Lt++){e.bindFramebuffer(r.FRAMEBUFFER,_t.__webglMultisampledFramebuffer),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0+Lt,r.RENDERBUFFER,_t.__webglColorRenderbuffer[Lt]);let Jt=o.get(P[Lt]).__webglTexture;e.bindFramebuffer(r.FRAMEBUFFER,_t.__webglFramebuffer),r.framebufferTexture2D(r.DRAW_FRAMEBUFFER,r.COLOR_ATTACHMENT0+Lt,r.TEXTURE_2D,Jt,0)}e.bindFramebuffer(r.DRAW_FRAMEBUFFER,_t.__webglMultisampledFramebuffer)}}function b(I){return Math.min(_,I.samples)}function R(I){let P=o.get(I);return h&&I.samples>0&&t.has("WEBGL_multisampled_render_to_texture")===!0&&P.__useRenderToTexture!==!1}function W(I){let P=f.render.frame;w.get(I)!==P&&(w.set(I,P),I.update())}function J(I,P){let B=I.colorSpace,lt=I.format,ct=I.type;return I.isCompressedTexture===!0||I.isVideoTexture===!0||I.format===fh||B!==Wo&&B!==Oi&&(gn.getTransfer(B)===Tn?h===!1?t.has("EXT_sRGB")===!0&<===$i?(I.format=fh,I.minFilter=Ni,I.generateMipmaps=!1):P=tc.sRGBToLinear(P):(lt!==$i||ct!==hs)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",B)),P}this.allocateTextureUnit=et,this.resetTextureUnits=pt,this.setTexture2D=V,this.setTexture2DArray=K,this.setTexture3D=at,this.setTextureCube=Tt,this.rebindTextures=te,this.setupRenderTarget=qt,this.updateRenderTargetMipmap=$,this.updateMultisampleRenderTarget=N,this.setupDepthRenderbuffer=Gt,this.setupFrameBufferTexture=Xt,this.useMultisampledRTT=R}function vb(r,t,e){let o=e.isWebGL2;function a(l,f=Oi){let h,p=gn.getTransfer(f);if(l===hs)return r.UNSIGNED_BYTE;if(l===e0)return r.UNSIGNED_SHORT_4_4_4_4;if(l===n0)return r.UNSIGNED_SHORT_5_5_5_1;if(l===fx)return r.BYTE;if(l===hx)return r.SHORT;if(l===qh)return r.UNSIGNED_SHORT;if(l===t0)return r.INT;if(l===us)return r.UNSIGNED_INT;if(l===ls)return r.FLOAT;if(l===Du)return o?r.HALF_FLOAT:(h=t.get("OES_texture_half_float"),h!==null?h.HALF_FLOAT_OES:null);if(l===px)return r.ALPHA;if(l===$i)return r.RGBA;if(l===dx)return r.LUMINANCE;if(l===mx)return r.LUMINANCE_ALPHA;if(l===Hs)return r.DEPTH_COMPONENT;if(l===Ga)return r.DEPTH_STENCIL;if(l===fh)return h=t.get("EXT_sRGB"),h!==null?h.SRGB_ALPHA_EXT:null;if(l===gx)return r.RED;if(l===r0)return r.RED_INTEGER;if(l===yx)return r.RG;if(l===i0)return r.RG_INTEGER;if(l===o0)return r.RGBA_INTEGER;if(l===Rf||l===Lf||l===Nf||l===Of)if(p===Tn)if(h=t.get("WEBGL_compressed_texture_s3tc_srgb"),h!==null){if(l===Rf)return h.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(l===Lf)return h.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(l===Nf)return h.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(l===Of)return h.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(h=t.get("WEBGL_compressed_texture_s3tc"),h!==null){if(l===Rf)return h.COMPRESSED_RGB_S3TC_DXT1_EXT;if(l===Lf)return h.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(l===Nf)return h.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(l===Of)return h.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(l===Dm||l===Fm||l===Um||l===Bm)if(h=t.get("WEBGL_compressed_texture_pvrtc"),h!==null){if(l===Dm)return h.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(l===Fm)return h.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(l===Um)return h.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(l===Bm)return h.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(l===vx)return h=t.get("WEBGL_compressed_texture_etc1"),h!==null?h.COMPRESSED_RGB_ETC1_WEBGL:null;if(l===zm||l===km)if(h=t.get("WEBGL_compressed_texture_etc"),h!==null){if(l===zm)return p===Tn?h.COMPRESSED_SRGB8_ETC2:h.COMPRESSED_RGB8_ETC2;if(l===km)return p===Tn?h.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:h.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(l===Gm||l===Vm||l===Hm||l===Wm||l===qm||l===Xm||l===Ym||l===Zm||l===Jm||l===$m||l===Km||l===jm||l===Qm||l===tg)if(h=t.get("WEBGL_compressed_texture_astc"),h!==null){if(l===Gm)return p===Tn?h.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:h.COMPRESSED_RGBA_ASTC_4x4_KHR;if(l===Vm)return p===Tn?h.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:h.COMPRESSED_RGBA_ASTC_5x4_KHR;if(l===Hm)return p===Tn?h.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:h.COMPRESSED_RGBA_ASTC_5x5_KHR;if(l===Wm)return p===Tn?h.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:h.COMPRESSED_RGBA_ASTC_6x5_KHR;if(l===qm)return p===Tn?h.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:h.COMPRESSED_RGBA_ASTC_6x6_KHR;if(l===Xm)return p===Tn?h.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:h.COMPRESSED_RGBA_ASTC_8x5_KHR;if(l===Ym)return p===Tn?h.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:h.COMPRESSED_RGBA_ASTC_8x6_KHR;if(l===Zm)return p===Tn?h.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:h.COMPRESSED_RGBA_ASTC_8x8_KHR;if(l===Jm)return p===Tn?h.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:h.COMPRESSED_RGBA_ASTC_10x5_KHR;if(l===$m)return p===Tn?h.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:h.COMPRESSED_RGBA_ASTC_10x6_KHR;if(l===Km)return p===Tn?h.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:h.COMPRESSED_RGBA_ASTC_10x8_KHR;if(l===jm)return p===Tn?h.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:h.COMPRESSED_RGBA_ASTC_10x10_KHR;if(l===Qm)return p===Tn?h.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:h.COMPRESSED_RGBA_ASTC_12x10_KHR;if(l===tg)return p===Tn?h.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:h.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(l===Df||l===eg||l===ng)if(h=t.get("EXT_texture_compression_bptc"),h!==null){if(l===Df)return p===Tn?h.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:h.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(l===eg)return h.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(l===ng)return h.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(l===_x||l===rg||l===ig||l===og)if(h=t.get("EXT_texture_compression_rgtc"),h!==null){if(l===Df)return h.COMPRESSED_RED_RGTC1_EXT;if(l===rg)return h.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(l===ig)return h.COMPRESSED_RED_GREEN_RGTC2_EXT;if(l===og)return h.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return l===Vs?o?r.UNSIGNED_INT_24_8:(h=t.get("WEBGL_depth_texture"),h!==null?h.UNSIGNED_INT_24_8_WEBGL:null):r[l]!==void 0?r[l]:null}return{convert:a}}var Ph=class extends xi{constructor(t=[]){super(),this.isArrayCamera=!0,this.cameras=t}},Da=class extends fo{constructor(){super(),this.isGroup=!0,this.type="Group"}},_b={type:"move"},Nu=class{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new Da,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 Da,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new mt,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new mt),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new Da,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new mt,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new mt),this._grip}dispatchEvent(t){return this._targetRay!==null&&this._targetRay.dispatchEvent(t),this._grip!==null&&this._grip.dispatchEvent(t),this._hand!==null&&this._hand.dispatchEvent(t),this}connect(t){if(t&&t.hand){let e=this._hand;if(e)for(let o of t.hand.values())this._getHandJoint(e,o)}return this.dispatchEvent({type:"connected",data:t}),this}disconnect(t){return this.dispatchEvent({type:"disconnected",data:t}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(t,e,o){let a=null,l=null,f=null,h=this._targetRay,p=this._grip,d=this._hand;if(t&&e.session.visibilityState!=="visible-blurred"){if(d&&t.hand){f=!0;for(let A of t.hand.values()){let x=e.getJointPose(A,o),v=this._getHandJoint(d,A);x!==null&&(v.matrix.fromArray(x.transform.matrix),v.matrix.decompose(v.position,v.rotation,v.scale),v.matrixWorldNeedsUpdate=!0,v.jointRadius=x.radius),v.visible=x!==null}let g=d.joints["index-finger-tip"],_=d.joints["thumb-tip"],y=g.position.distanceTo(_.position),M=.02,w=.005;d.inputState.pinching&&y>M+w?(d.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:t.handedness,target:this})):!d.inputState.pinching&&y<=M-w&&(d.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:t.handedness,target:this}))}else p!==null&&t.gripSpace&&(l=e.getPose(t.gripSpace,o),l!==null&&(p.matrix.fromArray(l.transform.matrix),p.matrix.decompose(p.position,p.rotation,p.scale),p.matrixWorldNeedsUpdate=!0,l.linearVelocity?(p.hasLinearVelocity=!0,p.linearVelocity.copy(l.linearVelocity)):p.hasLinearVelocity=!1,l.angularVelocity?(p.hasAngularVelocity=!0,p.angularVelocity.copy(l.angularVelocity)):p.hasAngularVelocity=!1));h!==null&&(a=e.getPose(t.targetRaySpace,o),a===null&&l!==null&&(a=l),a!==null&&(h.matrix.fromArray(a.transform.matrix),h.matrix.decompose(h.position,h.rotation,h.scale),h.matrixWorldNeedsUpdate=!0,a.linearVelocity?(h.hasLinearVelocity=!0,h.linearVelocity.copy(a.linearVelocity)):h.hasLinearVelocity=!1,a.angularVelocity?(h.hasAngularVelocity=!0,h.angularVelocity.copy(a.angularVelocity)):h.hasAngularVelocity=!1,this.dispatchEvent(_b)))}return h!==null&&(h.visible=a!==null),p!==null&&(p.visible=l!==null),d!==null&&(d.visible=f!==null),this}_getHandJoint(t,e){if(t.joints[e.jointName]===void 0){let o=new Da;o.matrixAutoUpdate=!1,o.visible=!1,t.joints[e.jointName]=o,t.add(o)}return t.joints[e.jointName]}},Ih=class extends Ki{constructor(t,e,o,a,l,f,h,p,d,g){if(g=g!==void 0?g:Hs,g!==Hs&&g!==Ga)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");o===void 0&&g===Hs&&(o=us),o===void 0&&g===Ga&&(o=Vs),super(null,a,l,f,h,p,g,o,d),this.isDepthTexture=!0,this.image={width:t,height:e},this.magFilter=h!==void 0?h:$r,this.minFilter=p!==void 0?p:$r,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(t){return super.copy(t),this.compareFunction=t.compareFunction,this}toJSON(t){let e=super.toJSON(t);return this.compareFunction!==null&&(e.compareFunction=this.compareFunction),e}},Rh=class extends ds{constructor(t,e){super();let o=this,a=null,l=1,f=null,h="local-floor",p=1,d=null,g=null,_=null,y=null,M=null,w=null,A=e.getContextAttributes(),x=null,v=null,C=[],S=[],O=new xi;O.layers.enable(1),O.viewport=new Tr;let F=new xi;F.layers.enable(2),F.viewport=new Tr;let G=[O,F],z=new Ph;z.layers.enable(1),z.layers.enable(2);let L=null,D=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(K){let at=C[K];return at===void 0&&(at=new Nu,C[K]=at),at.getTargetRaySpace()},this.getControllerGrip=function(K){let at=C[K];return at===void 0&&(at=new Nu,C[K]=at),at.getGripSpace()},this.getHand=function(K){let at=C[K];return at===void 0&&(at=new Nu,C[K]=at),at.getHandSpace()};function q(K){let at=S.indexOf(K.inputSource);if(at===-1)return;let Tt=C[at];Tt!==void 0&&(Tt.update(K.inputSource,K.frame,d||f),Tt.dispatchEvent({type:K.type,data:K.inputSource}))}function nt(){a.removeEventListener("select",q),a.removeEventListener("selectstart",q),a.removeEventListener("selectend",q),a.removeEventListener("squeeze",q),a.removeEventListener("squeezestart",q),a.removeEventListener("squeezeend",q),a.removeEventListener("end",nt),a.removeEventListener("inputsourceschange",k);for(let K=0;K<C.length;K++){let at=S[K];at!==null&&(S[K]=null,C[K].disconnect(at))}L=null,D=null,t.setRenderTarget(x),M=null,y=null,_=null,a=null,v=null,V.stop(),o.isPresenting=!1,o.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(K){l=K,o.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(K){h=K,o.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return d||f},this.setReferenceSpace=function(K){d=K},this.getBaseLayer=function(){return y!==null?y:M},this.getBinding=function(){return _},this.getFrame=function(){return w},this.getSession=function(){return a},this.setSession=async function(K){if(a=K,a!==null){if(x=t.getRenderTarget(),a.addEventListener("select",q),a.addEventListener("selectstart",q),a.addEventListener("selectend",q),a.addEventListener("squeeze",q),a.addEventListener("squeezestart",q),a.addEventListener("squeezeend",q),a.addEventListener("end",nt),a.addEventListener("inputsourceschange",k),A.xrCompatible!==!0&&await e.makeXRCompatible(),a.renderState.layers===void 0||t.capabilities.isWebGL2===!1){let at={antialias:a.renderState.layers===void 0?A.antialias:!0,alpha:!0,depth:A.depth,stencil:A.stencil,framebufferScaleFactor:l};M=new XRWebGLLayer(a,e,at),a.updateRenderState({baseLayer:M}),v=new qo(M.framebufferWidth,M.framebufferHeight,{format:$i,type:hs,colorSpace:t.outputColorSpace,stencilBuffer:A.stencil})}else{let at=null,Tt=null,dt=null;A.depth&&(dt=A.stencil?e.DEPTH24_STENCIL8:e.DEPTH_COMPONENT24,at=A.stencil?Ga:Hs,Tt=A.stencil?Vs:us);let Ct={colorFormat:e.RGBA8,depthFormat:dt,scaleFactor:l};_=new XRWebGLBinding(a,e),y=_.createProjectionLayer(Ct),a.updateRenderState({layers:[y]}),v=new qo(y.textureWidth,y.textureHeight,{format:$i,type:hs,depthTexture:new Ih(y.textureWidth,y.textureHeight,Tt,void 0,void 0,void 0,void 0,void 0,void 0,at),stencilBuffer:A.stencil,colorSpace:t.outputColorSpace,samples:A.antialias?4:0});let Yt=t.properties.get(v);Yt.__ignoreDepthValues=y.ignoreDepthValues}v.isXRRenderTarget=!0,this.setFoveation(p),d=null,f=await a.requestReferenceSpace(h),V.setContext(a),V.start(),o.isPresenting=!0,o.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(a!==null)return a.environmentBlendMode};function k(K){for(let at=0;at<K.removed.length;at++){let Tt=K.removed[at],dt=S.indexOf(Tt);dt>=0&&(S[dt]=null,C[dt].disconnect(Tt))}for(let at=0;at<K.added.length;at++){let Tt=K.added[at],dt=S.indexOf(Tt);if(dt===-1){for(let Yt=0;Yt<C.length;Yt++)if(Yt>=S.length){S.push(Tt),dt=Yt;break}else if(S[Yt]===null){S[Yt]=Tt,dt=Yt;break}if(dt===-1)break}let Ct=C[dt];Ct&&Ct.connect(Tt)}}let xt=new mt,X=new mt;function it(K,at,Tt){xt.setFromMatrixPosition(at.matrixWorld),X.setFromMatrixPosition(Tt.matrixWorld);let dt=xt.distanceTo(X),Ct=at.projectionMatrix.elements,Yt=Tt.projectionMatrix.elements,Wt=Ct[14]/(Ct[10]-1),Nt=Ct[14]/(Ct[10]+1),ne=(Ct[9]+1)/Ct[5],Pt=(Ct[9]-1)/Ct[5],Xt=(Ct[8]-1)/Ct[0],tt=(Yt[8]+1)/Yt[0],nn=Wt*Xt,Gt=Wt*tt,te=dt/(-Xt+tt),qt=te*-Xt;at.matrixWorld.decompose(K.position,K.quaternion,K.scale),K.translateX(qt),K.translateZ(te),K.matrixWorld.compose(K.position,K.quaternion,K.scale),K.matrixWorldInverse.copy(K.matrixWorld).invert();let $=Wt+te,N=Nt+te,b=nn-qt,R=Gt+(dt-qt),W=ne*Nt/N*$,J=Pt*Nt/N*$;K.projectionMatrix.makePerspective(b,R,W,J,$,N),K.projectionMatrixInverse.copy(K.projectionMatrix).invert()}function vt(K,at){at===null?K.matrixWorld.copy(K.matrix):K.matrixWorld.multiplyMatrices(at.matrixWorld,K.matrix),K.matrixWorldInverse.copy(K.matrixWorld).invert()}this.updateCamera=function(K){if(a===null)return;z.near=F.near=O.near=K.near,z.far=F.far=O.far=K.far,(L!==z.near||D!==z.far)&&(a.updateRenderState({depthNear:z.near,depthFar:z.far}),L=z.near,D=z.far);let at=K.parent,Tt=z.cameras;vt(z,at);for(let dt=0;dt<Tt.length;dt++)vt(Tt[dt],at);Tt.length===2?it(z,O,F):z.projectionMatrix.copy(O.projectionMatrix),pt(K,z,at)};function pt(K,at,Tt){Tt===null?K.matrix.copy(at.matrixWorld):(K.matrix.copy(Tt.matrixWorld),K.matrix.invert(),K.matrix.multiply(at.matrixWorld)),K.matrix.decompose(K.position,K.quaternion,K.scale),K.updateMatrixWorld(!0),K.projectionMatrix.copy(at.projectionMatrix),K.projectionMatrixInverse.copy(at.projectionMatrixInverse),K.isPerspectiveCamera&&(K.fov=hh*2*Math.atan(1/K.projectionMatrix.elements[5]),K.zoom=1)}this.getCamera=function(){return z},this.getFoveation=function(){if(!(y===null&&M===null))return p},this.setFoveation=function(K){p=K,y!==null&&(y.fixedFoveation=K),M!==null&&M.fixedFoveation!==void 0&&(M.fixedFoveation=K)};let et=null;function ot(K,at){if(g=at.getViewerPose(d||f),w=at,g!==null){let Tt=g.views;M!==null&&(t.setRenderTargetFramebuffer(v,M.framebuffer),t.setRenderTarget(v));let dt=!1;Tt.length!==z.cameras.length&&(z.cameras.length=0,dt=!0);for(let Ct=0;Ct<Tt.length;Ct++){let Yt=Tt[Ct],Wt=null;if(M!==null)Wt=M.getViewport(Yt);else{let ne=_.getViewSubImage(y,Yt);Wt=ne.viewport,Ct===0&&(t.setRenderTargetTextures(v,ne.colorTexture,y.ignoreDepthValues?void 0:ne.depthStencilTexture),t.setRenderTarget(v))}let Nt=G[Ct];Nt===void 0&&(Nt=new xi,Nt.layers.enable(Ct),Nt.viewport=new Tr,G[Ct]=Nt),Nt.matrix.fromArray(Yt.transform.matrix),Nt.matrix.decompose(Nt.position,Nt.quaternion,Nt.scale),Nt.projectionMatrix.fromArray(Yt.projectionMatrix),Nt.projectionMatrixInverse.copy(Nt.projectionMatrix).invert(),Nt.viewport.set(Wt.x,Wt.y,Wt.width,Wt.height),Ct===0&&(z.matrix.copy(Nt.matrix),z.matrix.decompose(z.position,z.quaternion,z.scale)),dt===!0&&z.cameras.push(Nt)}}for(let Tt=0;Tt<C.length;Tt++){let dt=S[Tt],Ct=C[Tt];dt!==null&&Ct!==void 0&&Ct.update(dt,at,d||f)}et&&et(K,at),at.detectedPlanes&&o.dispatchEvent({type:"planesdetected",data:at}),w=null}let V=new c0;V.setAnimationLoop(ot),this.setAnimationLoop=function(K){et=K},this.dispose=function(){}}};function xb(r,t){function e(x,v){x.matrixAutoUpdate===!0&&x.updateMatrix(),v.value.copy(x.matrix)}function o(x,v){v.color.getRGB(x.fogColor.value,l0(r)),v.isFog?(x.fogNear.value=v.near,x.fogFar.value=v.far):v.isFogExp2&&(x.fogDensity.value=v.density)}function a(x,v,C,S,O){v.isMeshBasicMaterial||v.isMeshLambertMaterial?l(x,v):v.isMeshToonMaterial?(l(x,v),_(x,v)):v.isMeshPhongMaterial?(l(x,v),g(x,v)):v.isMeshStandardMaterial?(l(x,v),y(x,v),v.isMeshPhysicalMaterial&&M(x,v,O)):v.isMeshMatcapMaterial?(l(x,v),w(x,v)):v.isMeshDepthMaterial?l(x,v):v.isMeshDistanceMaterial?(l(x,v),A(x,v)):v.isMeshNormalMaterial?l(x,v):v.isLineBasicMaterial?(f(x,v),v.isLineDashedMaterial&&h(x,v)):v.isPointsMaterial?p(x,v,C,S):v.isSpriteMaterial?d(x,v):v.isShadowMaterial?(x.color.value.copy(v.color),x.opacity.value=v.opacity):v.isShaderMaterial&&(v.uniformsNeedUpdate=!1)}function l(x,v){x.opacity.value=v.opacity,v.color&&x.diffuse.value.copy(v.color),v.emissive&&x.emissive.value.copy(v.emissive).multiplyScalar(v.emissiveIntensity),v.map&&(x.map.value=v.map,e(v.map,x.mapTransform)),v.alphaMap&&(x.alphaMap.value=v.alphaMap,e(v.alphaMap,x.alphaMapTransform)),v.bumpMap&&(x.bumpMap.value=v.bumpMap,e(v.bumpMap,x.bumpMapTransform),x.bumpScale.value=v.bumpScale,v.side===ui&&(x.bumpScale.value*=-1)),v.normalMap&&(x.normalMap.value=v.normalMap,e(v.normalMap,x.normalMapTransform),x.normalScale.value.copy(v.normalScale),v.side===ui&&x.normalScale.value.negate()),v.displacementMap&&(x.displacementMap.value=v.displacementMap,e(v.displacementMap,x.displacementMapTransform),x.displacementScale.value=v.displacementScale,x.displacementBias.value=v.displacementBias),v.emissiveMap&&(x.emissiveMap.value=v.emissiveMap,e(v.emissiveMap,x.emissiveMapTransform)),v.specularMap&&(x.specularMap.value=v.specularMap,e(v.specularMap,x.specularMapTransform)),v.alphaTest>0&&(x.alphaTest.value=v.alphaTest);let C=t.get(v).envMap;if(C&&(x.envMap.value=C,x.flipEnvMap.value=C.isCubeTexture&&C.isRenderTargetTexture===!1?-1:1,x.reflectivity.value=v.reflectivity,x.ior.value=v.ior,x.refractionRatio.value=v.refractionRatio),v.lightMap){x.lightMap.value=v.lightMap;let S=r._useLegacyLights===!0?Math.PI:1;x.lightMapIntensity.value=v.lightMapIntensity*S,e(v.lightMap,x.lightMapTransform)}v.aoMap&&(x.aoMap.value=v.aoMap,x.aoMapIntensity.value=v.aoMapIntensity,e(v.aoMap,x.aoMapTransform))}function f(x,v){x.diffuse.value.copy(v.color),x.opacity.value=v.opacity,v.map&&(x.map.value=v.map,e(v.map,x.mapTransform))}function h(x,v){x.dashSize.value=v.dashSize,x.totalSize.value=v.dashSize+v.gapSize,x.scale.value=v.scale}function p(x,v,C,S){x.diffuse.value.copy(v.color),x.opacity.value=v.opacity,x.size.value=v.size*C,x.scale.value=S*.5,v.map&&(x.map.value=v.map,e(v.map,x.uvTransform)),v.alphaMap&&(x.alphaMap.value=v.alphaMap,e(v.alphaMap,x.alphaMapTransform)),v.alphaTest>0&&(x.alphaTest.value=v.alphaTest)}function d(x,v){x.diffuse.value.copy(v.color),x.opacity.value=v.opacity,x.rotation.value=v.rotation,v.map&&(x.map.value=v.map,e(v.map,x.mapTransform)),v.alphaMap&&(x.alphaMap.value=v.alphaMap,e(v.alphaMap,x.alphaMapTransform)),v.alphaTest>0&&(x.alphaTest.value=v.alphaTest)}function g(x,v){x.specular.value.copy(v.specular),x.shininess.value=Math.max(v.shininess,1e-4)}function _(x,v){v.gradientMap&&(x.gradientMap.value=v.gradientMap)}function y(x,v){x.metalness.value=v.metalness,v.metalnessMap&&(x.metalnessMap.value=v.metalnessMap,e(v.metalnessMap,x.metalnessMapTransform)),x.roughness.value=v.roughness,v.roughnessMap&&(x.roughnessMap.value=v.roughnessMap,e(v.roughnessMap,x.roughnessMapTransform)),t.get(v).envMap&&(x.envMapIntensity.value=v.envMapIntensity)}function M(x,v,C){x.ior.value=v.ior,v.sheen>0&&(x.sheenColor.value.copy(v.sheenColor).multiplyScalar(v.sheen),x.sheenRoughness.value=v.sheenRoughness,v.sheenColorMap&&(x.sheenColorMap.value=v.sheenColorMap,e(v.sheenColorMap,x.sheenColorMapTransform)),v.sheenRoughnessMap&&(x.sheenRoughnessMap.value=v.sheenRoughnessMap,e(v.sheenRoughnessMap,x.sheenRoughnessMapTransform))),v.clearcoat>0&&(x.clearcoat.value=v.clearcoat,x.clearcoatRoughness.value=v.clearcoatRoughness,v.clearcoatMap&&(x.clearcoatMap.value=v.clearcoatMap,e(v.clearcoatMap,x.clearcoatMapTransform)),v.clearcoatRoughnessMap&&(x.clearcoatRoughnessMap.value=v.clearcoatRoughnessMap,e(v.clearcoatRoughnessMap,x.clearcoatRoughnessMapTransform)),v.clearcoatNormalMap&&(x.clearcoatNormalMap.value=v.clearcoatNormalMap,e(v.clearcoatNormalMap,x.clearcoatNormalMapTransform),x.clearcoatNormalScale.value.copy(v.clearcoatNormalScale),v.side===ui&&x.clearcoatNormalScale.value.negate())),v.iridescence>0&&(x.iridescence.value=v.iridescence,x.iridescenceIOR.value=v.iridescenceIOR,x.iridescenceThicknessMinimum.value=v.iridescenceThicknessRange[0],x.iridescenceThicknessMaximum.value=v.iridescenceThicknessRange[1],v.iridescenceMap&&(x.iridescenceMap.value=v.iridescenceMap,e(v.iridescenceMap,x.iridescenceMapTransform)),v.iridescenceThicknessMap&&(x.iridescenceThicknessMap.value=v.iridescenceThicknessMap,e(v.iridescenceThicknessMap,x.iridescenceThicknessMapTransform))),v.transmission>0&&(x.transmission.value=v.transmission,x.transmissionSamplerMap.value=C.texture,x.transmissionSamplerSize.value.set(C.width,C.height),v.transmissionMap&&(x.transmissionMap.value=v.transmissionMap,e(v.transmissionMap,x.transmissionMapTransform)),x.thickness.value=v.thickness,v.thicknessMap&&(x.thicknessMap.value=v.thicknessMap,e(v.thicknessMap,x.thicknessMapTransform)),x.attenuationDistance.value=v.attenuationDistance,x.attenuationColor.value.copy(v.attenuationColor)),v.anisotropy>0&&(x.anisotropyVector.value.set(v.anisotropy*Math.cos(v.anisotropyRotation),v.anisotropy*Math.sin(v.anisotropyRotation)),v.anisotropyMap&&(x.anisotropyMap.value=v.anisotropyMap,e(v.anisotropyMap,x.anisotropyMapTransform))),x.specularIntensity.value=v.specularIntensity,x.specularColor.value.copy(v.specularColor),v.specularColorMap&&(x.specularColorMap.value=v.specularColorMap,e(v.specularColorMap,x.specularColorMapTransform)),v.specularIntensityMap&&(x.specularIntensityMap.value=v.specularIntensityMap,e(v.specularIntensityMap,x.specularIntensityMapTransform))}function w(x,v){v.matcap&&(x.matcap.value=v.matcap)}function A(x,v){let C=t.get(v).light;x.referencePosition.value.setFromMatrixPosition(C.matrixWorld),x.nearDistance.value=C.shadow.camera.near,x.farDistance.value=C.shadow.camera.far}return{refreshFogUniforms:o,refreshMaterialUniforms:a}}function Eb(r,t,e,o){let a={},l={},f=[],h=e.isWebGL2?r.getParameter(r.MAX_UNIFORM_BUFFER_BINDINGS):0;function p(C,S){let O=S.program;o.uniformBlockBinding(C,O)}function d(C,S){let O=a[C.id];O===void 0&&(w(C),O=g(C),a[C.id]=O,C.addEventListener("dispose",x));let F=S.program;o.updateUBOMapping(C,F);let G=t.render.frame;l[C.id]!==G&&(y(C),l[C.id]=G)}function g(C){let S=_();C.__bindingPointIndex=S;let O=r.createBuffer(),F=C.__size,G=C.usage;return r.bindBuffer(r.UNIFORM_BUFFER,O),r.bufferData(r.UNIFORM_BUFFER,F,G),r.bindBuffer(r.UNIFORM_BUFFER,null),r.bindBufferBase(r.UNIFORM_BUFFER,S,O),O}function _(){for(let C=0;C<h;C++)if(f.indexOf(C)===-1)return f.push(C),C;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function y(C){let S=a[C.id],O=C.uniforms,F=C.__cache;r.bindBuffer(r.UNIFORM_BUFFER,S);for(let G=0,z=O.length;G<z;G++){let L=O[G];if(M(L,G,F)===!0){let D=L.__offset,q=Array.isArray(L.value)?L.value:[L.value],nt=0;for(let k=0;k<q.length;k++){let xt=q[k],X=A(xt);typeof xt=="number"?(L.__data[0]=xt,r.bufferSubData(r.UNIFORM_BUFFER,D+nt,L.__data)):xt.isMatrix3?(L.__data[0]=xt.elements[0],L.__data[1]=xt.elements[1],L.__data[2]=xt.elements[2],L.__data[3]=xt.elements[0],L.__data[4]=xt.elements[3],L.__data[5]=xt.elements[4],L.__data[6]=xt.elements[5],L.__data[7]=xt.elements[0],L.__data[8]=xt.elements[6],L.__data[9]=xt.elements[7],L.__data[10]=xt.elements[8],L.__data[11]=xt.elements[0]):(xt.toArray(L.__data,nt),nt+=X.storage/Float32Array.BYTES_PER_ELEMENT)}r.bufferSubData(r.UNIFORM_BUFFER,D,L.__data)}}r.bindBuffer(r.UNIFORM_BUFFER,null)}function M(C,S,O){let F=C.value;if(O[S]===void 0){if(typeof F=="number")O[S]=F;else{let G=Array.isArray(F)?F:[F],z=[];for(let L=0;L<G.length;L++)z.push(G[L].clone());O[S]=z}return!0}else if(typeof F=="number"){if(O[S]!==F)return O[S]=F,!0}else{let G=Array.isArray(O[S])?O[S]:[O[S]],z=Array.isArray(F)?F:[F];for(let L=0;L<G.length;L++){let D=G[L];if(D.equals(z[L])===!1)return D.copy(z[L]),!0}}return!1}function w(C){let S=C.uniforms,O=0,F=16,G=0;for(let z=0,L=S.length;z<L;z++){let D=S[z],q={boundary:0,storage:0},nt=Array.isArray(D.value)?D.value:[D.value];for(let k=0,xt=nt.length;k<xt;k++){let X=nt[k],it=A(X);q.boundary+=it.boundary,q.storage+=it.storage}if(D.__data=new Float32Array(q.storage/Float32Array.BYTES_PER_ELEMENT),D.__offset=O,z>0){G=O%F;let k=F-G;G!==0&&k-q.boundary<0&&(O+=F-G,D.__offset=O)}O+=q.storage}return G=O%F,G>0&&(O+=F-G),C.__size=O,C.__cache={},this}function A(C){let S={boundary:0,storage:0};return typeof C=="number"?(S.boundary=4,S.storage=4):C.isVector2?(S.boundary=8,S.storage=8):C.isVector3||C.isColor?(S.boundary=16,S.storage=12):C.isVector4?(S.boundary=16,S.storage=16):C.isMatrix3?(S.boundary=48,S.storage=48):C.isMatrix4?(S.boundary=64,S.storage=64):C.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",C),S}function x(C){let S=C.target;S.removeEventListener("dispose",x);let O=f.indexOf(S.__bindingPointIndex);f.splice(O,1),r.deleteBuffer(a[S.id]),delete a[S.id],delete l[S.id]}function v(){for(let C in a)r.deleteBuffer(a[C]);f=[],a={},l={}}return{bind:p,update:d,dispose:v}}var Lh=class{constructor(t={}){let{canvas:e=Ox(),context:o=null,depth:a=!0,stencil:l=!0,alpha:f=!1,antialias:h=!1,premultipliedAlpha:p=!0,preserveDrawingBuffer:d=!1,powerPreference:g="default",failIfMajorPerformanceCaveat:_=!1}=t;this.isWebGLRenderer=!0;let y;o!==null?y=o.getContextAttributes().alpha:y=f;let M=new Uint32Array(4),w=new Int32Array(4),A=null,x=null,v=[],C=[];this.domElement=e,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this._outputColorSpace=br,this._useLegacyLights=!1,this.toneMapping=fs,this.toneMappingExposure=1;let S=this,O=!1,F=0,G=0,z=null,L=-1,D=null,q=new Tr,nt=new Tr,k=null,xt=new xn(0),X=0,it=e.width,vt=e.height,pt=1,et=null,ot=null,V=new Tr(0,0,it,vt),K=new Tr(0,0,it,vt),at=!1,Tt=new cc,dt=!1,Ct=!1,Yt=null,Wt=new zr,Nt=new fn,ne=new mt,Pt={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function Xt(){return z===null?pt:1}let tt=o;function nn(H,rt){for(let gt=0;gt<H.length;gt++){let st=H[gt],yt=e.getContext(st,rt);if(yt!==null)return yt}return null}try{let H={alpha:!0,depth:a,stencil:l,antialias:h,premultipliedAlpha:p,preserveDrawingBuffer:d,powerPreference:g,failIfMajorPerformanceCaveat:_};if("setAttribute"in e&&e.setAttribute("data-engine",`three.js r${Wh}`),e.addEventListener("webglcontextlost",wt,!1),e.addEventListener("webglcontextrestored",j,!1),e.addEventListener("webglcontextcreationerror",Ut,!1),tt===null){let rt=["webgl2","webgl","experimental-webgl"];if(S.isWebGL1Renderer===!0&&rt.shift(),tt=nn(rt,H),tt===null)throw nn(rt)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}typeof WebGLRenderingContext!="undefined"&&tt instanceof WebGLRenderingContext&&console.warn("THREE.WebGLRenderer: WebGL 1 support was deprecated in r153 and will be removed in r163."),tt.getShaderPrecisionFormat===void 0&&(tt.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(H){throw console.error("THREE.WebGLRenderer: "+H.message),H}let Gt,te,qt,$,N,b,R,W,J,I,P,B,lt,ct,Q,St,_t,Mt,Lt,Jt,Et,oe,jt,Ht;function Ot(){Gt=new VS(tt),te=new FS(tt,Gt,t),Gt.init(te),oe=new vb(tt,Gt,te),qt=new gb(tt,Gt,te),$=new qS(tt),N=new ib,b=new yb(tt,Gt,qt,N,te,oe,$),R=new BS(S),W=new GS(S),J=new eE(tt,te),jt=new OS(tt,Gt,J,te),I=new HS(tt,J,$,jt),P=new JS(tt,I,J,$),Lt=new ZS(tt,te,b),St=new US(N),B=new rb(S,R,W,Gt,te,jt,St),lt=new xb(S,N),ct=new sb,Q=new hb(Gt,te),Mt=new NS(S,R,W,qt,P,y,p),_t=new mb(S,P,te),Ht=new Eb(tt,$,te,qt),Jt=new DS(tt,Gt,$,te),Et=new WS(tt,Gt,$,te),$.programs=B.programs,S.capabilities=te,S.extensions=Gt,S.properties=N,S.renderLists=ct,S.shadowMap=_t,S.state=qt,S.info=$}Ot();let Y=new Rh(S,tt);this.xr=Y,this.getContext=function(){return tt},this.getContextAttributes=function(){return tt.getContextAttributes()},this.forceContextLoss=function(){let H=Gt.get("WEBGL_lose_context");H&&H.loseContext()},this.forceContextRestore=function(){let H=Gt.get("WEBGL_lose_context");H&&H.restoreContext()},this.getPixelRatio=function(){return pt},this.setPixelRatio=function(H){H!==void 0&&(pt=H,this.setSize(it,vt,!1))},this.getSize=function(H){return H.set(it,vt)},this.setSize=function(H,rt,gt=!0){if(Y.isPresenting){console.warn("THREE.WebGLRenderer: Can\'t change size while VR device is presenting.");return}it=H,vt=rt,e.width=Math.floor(H*pt),e.height=Math.floor(rt*pt),gt===!0&&(e.style.width=H+"px",e.style.height=rt+"px"),this.setViewport(0,0,H,rt)},this.getDrawingBufferSize=function(H){return H.set(it*pt,vt*pt).floor()},this.setDrawingBufferSize=function(H,rt,gt){it=H,vt=rt,pt=gt,e.width=Math.floor(H*gt),e.height=Math.floor(rt*gt),this.setViewport(0,0,H,rt)},this.getCurrentViewport=function(H){return H.copy(q)},this.getViewport=function(H){return H.copy(V)},this.setViewport=function(H,rt,gt,st){H.isVector4?V.set(H.x,H.y,H.z,H.w):V.set(H,rt,gt,st),qt.viewport(q.copy(V).multiplyScalar(pt).floor())},this.getScissor=function(H){return H.copy(K)},this.setScissor=function(H,rt,gt,st){H.isVector4?K.set(H.x,H.y,H.z,H.w):K.set(H,rt,gt,st),qt.scissor(nt.copy(K).multiplyScalar(pt).floor())},this.getScissorTest=function(){return at},this.setScissorTest=function(H){qt.setScissorTest(at=H)},this.setOpaqueSort=function(H){et=H},this.setTransparentSort=function(H){ot=H},this.getClearColor=function(H){return H.copy(Mt.getClearColor())},this.setClearColor=function(){Mt.setClearColor.apply(Mt,arguments)},this.getClearAlpha=function(){return Mt.getClearAlpha()},this.setClearAlpha=function(){Mt.setClearAlpha.apply(Mt,arguments)},this.clear=function(H=!0,rt=!0,gt=!0){let st=0;if(H){let yt=!1;if(z!==null){let It=z.texture.format;yt=It===o0||It===i0||It===r0}if(yt){let It=z.texture.type,Bt=It===hs||It===us||It===qh||It===Vs||It===e0||It===n0,se=Mt.getClearColor(),Qt=Mt.getClearAlpha(),ce=se.r,Vt=se.g,fe=se.b;Bt?(M[0]=ce,M[1]=Vt,M[2]=fe,M[3]=Qt,tt.clearBufferuiv(tt.COLOR,0,M)):(w[0]=ce,w[1]=Vt,w[2]=fe,w[3]=Qt,tt.clearBufferiv(tt.COLOR,0,w))}else st|=tt.COLOR_BUFFER_BIT}rt&&(st|=tt.DEPTH_BUFFER_BIT),gt&&(st|=tt.STENCIL_BUFFER_BIT),tt.clear(st)},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(){e.removeEventListener("webglcontextlost",wt,!1),e.removeEventListener("webglcontextrestored",j,!1),e.removeEventListener("webglcontextcreationerror",Ut,!1),ct.dispose(),Q.dispose(),N.dispose(),R.dispose(),W.dispose(),P.dispose(),jt.dispose(),Ht.dispose(),B.dispose(),Y.dispose(),Y.removeEventListener("sessionstart",He),Y.removeEventListener("sessionend",Mi),Yt&&(Yt.dispose(),Yt=null),$n.stop()};function wt(H){H.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),O=!0}function j(){console.log("THREE.WebGLRenderer: Context Restored."),O=!1;let H=$.autoReset,rt=_t.enabled,gt=_t.autoUpdate,st=_t.needsUpdate,yt=_t.type;Ot(),$.autoReset=H,_t.enabled=rt,_t.autoUpdate=gt,_t.needsUpdate=st,_t.type=yt}function Ut(H){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",H.statusMessage)}function Dt(H){let rt=H.target;rt.removeEventListener("dispose",Dt),ft(rt)}function ft(H){$t(H),N.remove(H)}function $t(H){let rt=N.get(H).programs;rt!==void 0&&(rt.forEach(function(gt){B.releaseProgram(gt)}),H.isShaderMaterial&&B.releaseShaderCache(H))}this.renderBufferDirect=function(H,rt,gt,st,yt,It){rt===null&&(rt=Pt);let Bt=yt.isMesh&&yt.matrixWorld.determinant()<0,se=ei(H,rt,gt,st,yt);qt.setMaterial(st,Bt);let Qt=gt.index,ce=1;if(st.wireframe===!0){if(Qt=I.getWireframeAttribute(gt),Qt===void 0)return;ce=2}let Vt=gt.drawRange,fe=gt.attributes.position,sn=Vt.start*ce,un=(Vt.start+Vt.count)*ce;It!==null&&(sn=Math.max(sn,It.start*ce),un=Math.min(un,(It.start+It.count)*ce)),Qt!==null?(sn=Math.max(sn,0),un=Math.min(un,Qt.count)):fe!=null&&(sn=Math.max(sn,0),un=Math.min(un,fe.count));let vn=un-sn;if(vn<0||vn===1/0)return;jt.setup(yt,st,se,gt,Qt);let ni,En=Jt;if(Qt!==null&&(ni=J.get(Qt),En=Et,En.setIndex(ni)),yt.isMesh)st.wireframe===!0?(qt.setLineWidth(st.wireframeLinewidth*Xt()),En.setMode(tt.LINES)):En.setMode(tt.TRIANGLES);else if(yt.isLine){let de=st.linewidth;de===void 0&&(de=1),qt.setLineWidth(de*Xt()),yt.isLineSegments?En.setMode(tt.LINES):yt.isLineLoop?En.setMode(tt.LINE_LOOP):En.setMode(tt.LINE_STRIP)}else yt.isPoints?En.setMode(tt.POINTS):yt.isSprite&&En.setMode(tt.TRIANGLES);if(yt.isInstancedMesh)En.renderInstances(sn,vn,yt.count);else if(gt.isInstancedBufferGeometry){let de=gt._maxInstanceCount!==void 0?gt._maxInstanceCount:1/0,xo=Math.min(gt.instanceCount,de);En.renderInstances(sn,vn,xo)}else En.render(sn,vn)},this.compile=function(H,rt){function gt(st,yt,It){st.transparent===!0&&st.side===Go&&st.forceSinglePass===!1?(st.side=ui,st.needsUpdate=!0,pe(st,yt,It),st.side=ps,st.needsUpdate=!0,pe(st,yt,It),st.side=Go):pe(st,yt,It)}x=Q.get(H),x.init(),C.push(x),H.traverseVisible(function(st){st.isLight&&st.layers.test(rt.layers)&&(x.pushLight(st),st.castShadow&&x.pushShadow(st))}),x.setupLights(S._useLegacyLights),H.traverse(function(st){let yt=st.material;if(yt)if(Array.isArray(yt))for(let It=0;It<yt.length;It++){let Bt=yt[It];gt(Bt,H,st)}else gt(yt,H,st)}),C.pop(),x=null};let re=null;function mn(H){re&&re(H)}function He(){$n.stop()}function Mi(){$n.start()}let $n=new c0;$n.setAnimationLoop(mn),typeof self!="undefined"&&$n.setContext(self),this.setAnimationLoop=function(H){re=H,Y.setAnimationLoop(H),H===null?$n.stop():$n.start()},Y.addEventListener("sessionstart",He),Y.addEventListener("sessionend",Mi),this.render=function(H,rt){if(rt!==void 0&&rt.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(O===!0)return;H.matrixWorldAutoUpdate===!0&&H.updateMatrixWorld(),rt.parent===null&&rt.matrixWorldAutoUpdate===!0&&rt.updateMatrixWorld(),Y.enabled===!0&&Y.isPresenting===!0&&(Y.cameraAutoUpdate===!0&&Y.updateCamera(rt),rt=Y.getCamera()),H.isScene===!0&&H.onBeforeRender(S,H,rt,z),x=Q.get(H,C.length),x.init(),C.push(x),Wt.multiplyMatrices(rt.projectionMatrix,rt.matrixWorldInverse),Tt.setFromProjectionMatrix(Wt),Ct=this.localClippingEnabled,dt=St.init(this.clippingPlanes,Ct),A=ct.get(H,v.length),A.init(),v.push(A),ml(H,rt,0,S.sortObjects),A.finish(),S.sortObjects===!0&&A.sort(et,ot),this.info.render.frame++,dt===!0&&St.beginShadows();let gt=x.state.shadowsArray;if(_t.render(gt,H,rt),dt===!0&&St.endShadows(),this.info.autoReset===!0&&this.info.reset(),Mt.render(A,H),x.setupLights(S._useLegacyLights),rt.isArrayCamera){let st=rt.cameras;for(let yt=0,It=st.length;yt<It;yt++){let Bt=st[yt];hi(A,H,Bt,Bt.viewport)}}else hi(A,H,rt);z!==null&&(b.updateMultisampleRenderTarget(z),b.updateRenderTargetMipmap(z)),H.isScene===!0&&H.onAfterRender(S,H,rt),jt.resetDefaultState(),L=-1,D=null,C.pop(),C.length>0?x=C[C.length-1]:x=null,v.pop(),v.length>0?A=v[v.length-1]:A=null};function ml(H,rt,gt,st){if(H.visible===!1)return;if(H.layers.test(rt.layers)){if(H.isGroup)gt=H.renderOrder;else if(H.isLOD)H.autoUpdate===!0&&H.update(rt);else if(H.isLight)x.pushLight(H),H.castShadow&&x.pushShadow(H);else if(H.isSprite){if(!H.frustumCulled||Tt.intersectsSprite(H)){st&&ne.setFromMatrixPosition(H.matrixWorld).applyMatrix4(Wt);let Bt=P.update(H),se=H.material;se.visible&&A.push(H,Bt,se,gt,ne.z,null)}}else if((H.isMesh||H.isLine||H.isPoints)&&(!H.frustumCulled||Tt.intersectsObject(H))){let Bt=P.update(H),se=H.material;if(st&&(H.boundingSphere!==void 0?(H.boundingSphere===null&&H.computeBoundingSphere(),ne.copy(H.boundingSphere.center)):(Bt.boundingSphere===null&&Bt.computeBoundingSphere(),ne.copy(Bt.boundingSphere.center)),ne.applyMatrix4(H.matrixWorld).applyMatrix4(Wt)),Array.isArray(se)){let Qt=Bt.groups;for(let ce=0,Vt=Qt.length;ce<Vt;ce++){let fe=Qt[ce],sn=se[fe.materialIndex];sn&&sn.visible&&A.push(H,Bt,sn,gt,ne.z,fe)}}else se.visible&&A.push(H,Bt,se,gt,ne.z,null)}}let It=H.children;for(let Bt=0,se=It.length;Bt<se;Bt++)ml(It[Bt],rt,gt,st)}function hi(H,rt,gt,st){let yt=H.opaque,It=H.transmissive,Bt=H.transparent;x.setupLightsView(gt),dt===!0&&St.setGlobalState(S.clippingPlanes,gt),It.length>0&&ws(yt,It,rt,gt),st&&qt.viewport(q.copy(st)),yt.length>0&&_o(yt,rt,gt),It.length>0&&_o(It,rt,gt),Bt.length>0&&_o(Bt,rt,gt),qt.buffers.depth.setTest(!0),qt.buffers.depth.setMask(!0),qt.buffers.color.setMask(!0),qt.setPolygonOffset(!1)}function ws(H,rt,gt,st){let yt=te.isWebGL2;Yt===null&&(Yt=new qo(1,1,{generateMipmaps:!0,type:Gt.has("EXT_color_buffer_half_float")?Du:hs,minFilter:Ou,samples:yt?4:0})),S.getDrawingBufferSize(Nt),yt?Yt.setSize(Nt.x,Nt.y):Yt.setSize(ph(Nt.x),ph(Nt.y));let It=S.getRenderTarget();S.setRenderTarget(Yt),S.getClearColor(xt),X=S.getClearAlpha(),X<1&&S.setClearColor(16777215,.5),S.clear();let Bt=S.toneMapping;S.toneMapping=fs,_o(H,gt,st),b.updateMultisampleRenderTarget(Yt),b.updateRenderTargetMipmap(Yt);let se=!1;for(let Qt=0,ce=rt.length;Qt<ce;Qt++){let Vt=rt[Qt],fe=Vt.object,sn=Vt.geometry,un=Vt.material,vn=Vt.group;if(un.side===Go&&fe.layers.test(st.layers)){let ni=un.side;un.side=ui,un.needsUpdate=!0,Fi(fe,gt,st,sn,un,vn),un.side=ni,un.needsUpdate=!0,se=!0}}se===!0&&(b.updateMultisampleRenderTarget(Yt),b.updateRenderTargetMipmap(Yt)),S.setRenderTarget(It),S.setClearColor(xt,X),S.toneMapping=Bt}function _o(H,rt,gt){let st=rt.isScene===!0?rt.overrideMaterial:null;for(let yt=0,It=H.length;yt<It;yt++){let Bt=H[yt],se=Bt.object,Qt=Bt.geometry,ce=st===null?Bt.material:st,Vt=Bt.group;se.layers.test(gt.layers)&&Fi(se,rt,gt,Qt,ce,Vt)}}function Fi(H,rt,gt,st,yt,It){H.onBeforeRender(S,rt,gt,st,yt,It),H.modelViewMatrix.multiplyMatrices(gt.matrixWorldInverse,H.matrixWorld),H.normalMatrix.getNormalMatrix(H.modelViewMatrix),yt.onBeforeRender(S,rt,gt,st,H,It),yt.transparent===!0&&yt.side===Go&&yt.forceSinglePass===!1?(yt.side=ui,yt.needsUpdate=!0,S.renderBufferDirect(gt,rt,st,yt,H,It),yt.side=ps,yt.needsUpdate=!0,S.renderBufferDirect(gt,rt,st,yt,H,It),yt.side=Go):S.renderBufferDirect(gt,rt,st,yt,H,It),H.onAfterRender(S,rt,gt,st,yt,It)}function pe(H,rt,gt){rt.isScene!==!0&&(rt=Pt);let st=N.get(H),yt=x.state.lights,It=x.state.shadowsArray,Bt=yt.state.version,se=B.getParameters(H,yt.state,It,rt,gt),Qt=B.getProgramCacheKey(se),ce=st.programs;st.environment=H.isMeshStandardMaterial?rt.environment:null,st.fog=rt.fog,st.envMap=(H.isMeshStandardMaterial?W:R).get(H.envMap||st.environment),ce===void 0&&(H.addEventListener("dispose",Dt),ce=new Map,st.programs=ce);let Vt=ce.get(Qt);if(Vt!==void 0){if(st.currentProgram===Vt&&st.lightsStateVersion===Bt)return Rr(H,se),Vt}else se.uniforms=B.getUniforms(H),H.onBuild(gt,se,S),H.onBeforeCompile(se,S),Vt=B.acquireProgram(se,Qt),ce.set(Qt,Vt),st.uniforms=se.uniforms;let fe=st.uniforms;(!H.isShaderMaterial&&!H.isRawShaderMaterial||H.clipping===!0)&&(fe.clippingPlanes=St.uniform),Rr(H,se),st.needsLights=Vn(H),st.lightsStateVersion=Bt,st.needsLights&&(fe.ambientLightColor.value=yt.state.ambient,fe.lightProbe.value=yt.state.probe,fe.directionalLights.value=yt.state.directional,fe.directionalLightShadows.value=yt.state.directionalShadow,fe.spotLights.value=yt.state.spot,fe.spotLightShadows.value=yt.state.spotShadow,fe.rectAreaLights.value=yt.state.rectArea,fe.ltc_1.value=yt.state.rectAreaLTC1,fe.ltc_2.value=yt.state.rectAreaLTC2,fe.pointLights.value=yt.state.point,fe.pointLightShadows.value=yt.state.pointShadow,fe.hemisphereLights.value=yt.state.hemi,fe.directionalShadowMap.value=yt.state.directionalShadowMap,fe.directionalShadowMatrix.value=yt.state.directionalShadowMatrix,fe.spotShadowMap.value=yt.state.spotShadowMap,fe.spotLightMatrix.value=yt.state.spotLightMatrix,fe.spotLightMap.value=yt.state.spotLightMap,fe.pointShadowMap.value=yt.state.pointShadowMap,fe.pointShadowMatrix.value=yt.state.pointShadowMatrix);let sn=Vt.getUniforms(),un=Ba.seqWithValue(sn.seq,fe);return st.currentProgram=Vt,st.uniformsList=un,Vt}function Rr(H,rt){let gt=N.get(H);gt.outputColorSpace=rt.outputColorSpace,gt.instancing=rt.instancing,gt.instancingColor=rt.instancingColor,gt.skinning=rt.skinning,gt.morphTargets=rt.morphTargets,gt.morphNormals=rt.morphNormals,gt.morphColors=rt.morphColors,gt.morphTargetsCount=rt.morphTargetsCount,gt.numClippingPlanes=rt.numClippingPlanes,gt.numIntersection=rt.numClipIntersection,gt.vertexAlphas=rt.vertexAlphas,gt.vertexTangents=rt.vertexTangents,gt.toneMapping=rt.toneMapping}function ei(H,rt,gt,st,yt){rt.isScene!==!0&&(rt=Pt),b.resetTextureUnits();let It=rt.fog,Bt=st.isMeshStandardMaterial?rt.environment:null,se=z===null?S.outputColorSpace:z.isXRRenderTarget===!0?z.texture.colorSpace:Wo,Qt=(st.isMeshStandardMaterial?W:R).get(st.envMap||Bt),ce=st.vertexColors===!0&&!!gt.attributes.color&>.attributes.color.itemSize===4,Vt=!!gt.attributes.tangent&&(!!st.normalMap||st.anisotropy>0),fe=!!gt.morphAttributes.position,sn=!!gt.morphAttributes.normal,un=!!gt.morphAttributes.color,vn=fs;st.toneMapped&&(z===null||z.isXRRenderTarget===!0)&&(vn=S.toneMapping);let ni=gt.morphAttributes.position||gt.morphAttributes.normal||gt.morphAttributes.color,En=ni!==void 0?ni.length:0,de=N.get(st),xo=x.state.lights;if(dt===!0&&(Ct===!0||H!==D)){let xr=H===D&&st.id===L;St.setState(st,H,xr)}let he=!1;st.version===de.__version?(de.needsLights&&de.lightsStateVersion!==xo.state.version||de.outputColorSpace!==se||yt.isInstancedMesh&&de.instancing===!1||!yt.isInstancedMesh&&de.instancing===!0||yt.isSkinnedMesh&&de.skinning===!1||!yt.isSkinnedMesh&&de.skinning===!0||yt.isInstancedMesh&&de.instancingColor===!0&&yt.instanceColor===null||yt.isInstancedMesh&&de.instancingColor===!1&&yt.instanceColor!==null||de.envMap!==Qt||st.fog===!0&&de.fog!==It||de.numClippingPlanes!==void 0&&(de.numClippingPlanes!==St.numPlanes||de.numIntersection!==St.numIntersection)||de.vertexAlphas!==ce||de.vertexTangents!==Vt||de.morphTargets!==fe||de.morphNormals!==sn||de.morphColors!==un||de.toneMapping!==vn||te.isWebGL2===!0&&de.morphTargetsCount!==En)&&(he=!0):(he=!0,de.__version=st.version);let no=de.currentProgram;he===!0&&(no=pe(st,rt,yt));let ri=!1,Eo=!1,ia=!1,ie=no.getUniforms(),Ui=de.uniforms;if(qt.useProgram(no.program)&&(ri=!0,Eo=!0,ia=!0),st.id!==L&&(L=st.id,Eo=!0),ri||D!==H){ie.setValue(tt,"projectionMatrix",H.projectionMatrix),ie.setValue(tt,"viewMatrix",H.matrixWorldInverse);let xr=ie.map.cameraPosition;xr!==void 0&&xr.setValue(tt,ne.setFromMatrixPosition(H.matrixWorld)),te.logarithmicDepthBuffer&&ie.setValue(tt,"logDepthBufFC",2/(Math.log(H.far+1)/Math.LN2)),(st.isMeshPhongMaterial||st.isMeshToonMaterial||st.isMeshLambertMaterial||st.isMeshBasicMaterial||st.isMeshStandardMaterial||st.isShaderMaterial)&&ie.setValue(tt,"isOrthographic",H.isOrthographicCamera===!0),D!==H&&(D=H,Eo=!0,ia=!0)}if(yt.isSkinnedMesh){ie.setOptional(tt,yt,"bindMatrix"),ie.setOptional(tt,yt,"bindMatrixInverse");let xr=yt.skeleton;xr&&(te.floatVertexTextures?(xr.boneTexture===null&&xr.computeBoneTexture(),ie.setValue(tt,"boneTexture",xr.boneTexture,b),ie.setValue(tt,"boneTextureSize",xr.boneTextureSize)):console.warn("THREE.WebGLRenderer: SkinnedMesh can only be used with WebGL 2. With WebGL 1 OES_texture_float and vertex textures support is required."))}let Lr=gt.morphAttributes;if((Lr.position!==void 0||Lr.normal!==void 0||Lr.color!==void 0&&te.isWebGL2===!0)&&Lt.update(yt,gt,no),(Eo||de.receiveShadow!==yt.receiveShadow)&&(de.receiveShadow=yt.receiveShadow,ie.setValue(tt,"receiveShadow",yt.receiveShadow)),st.isMeshGouraudMaterial&&st.envMap!==null&&(Ui.envMap.value=Qt,Ui.flipEnvMap.value=Qt.isCubeTexture&&Qt.isRenderTargetTexture===!1?-1:1),Eo&&(ie.setValue(tt,"toneMappingExposure",S.toneMappingExposure),de.needsLights&&Vr(Ui,ia),It&&st.fog===!0&<.refreshFogUniforms(Ui,It),lt.refreshMaterialUniforms(Ui,st,pt,vt,Yt),Ba.upload(tt,de.uniformsList,Ui,b)),st.isShaderMaterial&&st.uniformsNeedUpdate===!0&&(Ba.upload(tt,de.uniformsList,Ui,b),st.uniformsNeedUpdate=!1),st.isSpriteMaterial&&ie.setValue(tt,"center",yt.center),ie.setValue(tt,"modelViewMatrix",yt.modelViewMatrix),ie.setValue(tt,"normalMatrix",yt.normalMatrix),ie.setValue(tt,"modelMatrix",yt.matrixWorld),st.isShaderMaterial||st.isRawShaderMaterial){let xr=st.uniformsGroups;for(let le=0,gl=xr.length;le<gl;le++)if(te.isWebGL2){let yl=xr[le];Ht.update(yl,no),Ht.bind(yl,no)}else console.warn("THREE.WebGLRenderer: Uniform Buffer Objects can only be used with WebGL 2.")}return no}function Vr(H,rt){H.ambientLightColor.needsUpdate=rt,H.lightProbe.needsUpdate=rt,H.directionalLights.needsUpdate=rt,H.directionalLightShadows.needsUpdate=rt,H.pointLights.needsUpdate=rt,H.pointLightShadows.needsUpdate=rt,H.spotLights.needsUpdate=rt,H.spotLightShadows.needsUpdate=rt,H.rectAreaLights.needsUpdate=rt,H.hemisphereLights.needsUpdate=rt}function Vn(H){return H.isMeshLambertMaterial||H.isMeshToonMaterial||H.isMeshPhongMaterial||H.isMeshStandardMaterial||H.isShadowMaterial||H.isShaderMaterial&&H.lights===!0}this.getActiveCubeFace=function(){return F},this.getActiveMipmapLevel=function(){return G},this.getRenderTarget=function(){return z},this.setRenderTargetTextures=function(H,rt,gt){N.get(H.texture).__webglTexture=rt,N.get(H.depthTexture).__webglTexture=gt;let st=N.get(H);st.__hasExternalTextures=!0,st.__hasExternalTextures&&(st.__autoAllocateDepthBuffer=gt===void 0,st.__autoAllocateDepthBuffer||Gt.has("WEBGL_multisampled_render_to_texture")===!0&&(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),st.__useRenderToTexture=!1))},this.setRenderTargetFramebuffer=function(H,rt){let gt=N.get(H);gt.__webglFramebuffer=rt,gt.__useDefaultFramebuffer=rt===void 0},this.setRenderTarget=function(H,rt=0,gt=0){z=H,F=rt,G=gt;let st=!0,yt=null,It=!1,Bt=!1;if(H){let Qt=N.get(H);Qt.__useDefaultFramebuffer!==void 0?(qt.bindFramebuffer(tt.FRAMEBUFFER,null),st=!1):Qt.__webglFramebuffer===void 0?b.setupRenderTarget(H):Qt.__hasExternalTextures&&b.rebindTextures(H,N.get(H.texture).__webglTexture,N.get(H.depthTexture).__webglTexture);let ce=H.texture;(ce.isData3DTexture||ce.isDataArrayTexture||ce.isCompressedArrayTexture)&&(Bt=!0);let Vt=N.get(H).__webglFramebuffer;H.isWebGLCubeRenderTarget?(Array.isArray(Vt[rt])?yt=Vt[rt][gt]:yt=Vt[rt],It=!0):te.isWebGL2&&H.samples>0&&b.useMultisampledRTT(H)===!1?yt=N.get(H).__webglMultisampledFramebuffer:Array.isArray(Vt)?yt=Vt[gt]:yt=Vt,q.copy(H.viewport),nt.copy(H.scissor),k=H.scissorTest}else q.copy(V).multiplyScalar(pt).floor(),nt.copy(K).multiplyScalar(pt).floor(),k=at;if(qt.bindFramebuffer(tt.FRAMEBUFFER,yt)&&te.drawBuffers&&st&&qt.drawBuffers(H,yt),qt.viewport(q),qt.scissor(nt),qt.setScissorTest(k),It){let Qt=N.get(H.texture);tt.framebufferTexture2D(tt.FRAMEBUFFER,tt.COLOR_ATTACHMENT0,tt.TEXTURE_CUBE_MAP_POSITIVE_X+rt,Qt.__webglTexture,gt)}else if(Bt){let Qt=N.get(H.texture),ce=rt||0;tt.framebufferTextureLayer(tt.FRAMEBUFFER,tt.COLOR_ATTACHMENT0,Qt.__webglTexture,gt||0,ce)}L=-1},this.readRenderTargetPixels=function(H,rt,gt,st,yt,It,Bt){if(!(H&&H.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let se=N.get(H).__webglFramebuffer;if(H.isWebGLCubeRenderTarget&&Bt!==void 0&&(se=se[Bt]),se){qt.bindFramebuffer(tt.FRAMEBUFFER,se);try{let Qt=H.texture,ce=Qt.format,Vt=Qt.type;if(ce!==$i&&oe.convert(ce)!==tt.getParameter(tt.IMPLEMENTATION_COLOR_READ_FORMAT)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}let fe=Vt===Du&&(Gt.has("EXT_color_buffer_half_float")||te.isWebGL2&&Gt.has("EXT_color_buffer_float"));if(Vt!==hs&&oe.convert(Vt)!==tt.getParameter(tt.IMPLEMENTATION_COLOR_READ_TYPE)&&!(Vt===ls&&(te.isWebGL2||Gt.has("OES_texture_float")||Gt.has("WEBGL_color_buffer_float")))&&!fe){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}rt>=0&&rt<=H.width-st&>>=0&><=H.height-yt&&tt.readPixels(rt,gt,st,yt,oe.convert(ce),oe.convert(Vt),It)}finally{let Qt=z!==null?N.get(z).__webglFramebuffer:null;qt.bindFramebuffer(tt.FRAMEBUFFER,Qt)}}},this.copyFramebufferToTexture=function(H,rt,gt=0){let st=Math.pow(2,-gt),yt=Math.floor(rt.image.width*st),It=Math.floor(rt.image.height*st);b.setTexture2D(rt,0),tt.copyTexSubImage2D(tt.TEXTURE_2D,gt,0,0,H.x,H.y,yt,It),qt.unbindTexture()},this.copyTextureToTexture=function(H,rt,gt,st=0){let yt=rt.image.width,It=rt.image.height,Bt=oe.convert(gt.format),se=oe.convert(gt.type);b.setTexture2D(gt,0),tt.pixelStorei(tt.UNPACK_FLIP_Y_WEBGL,gt.flipY),tt.pixelStorei(tt.UNPACK_PREMULTIPLY_ALPHA_WEBGL,gt.premultiplyAlpha),tt.pixelStorei(tt.UNPACK_ALIGNMENT,gt.unpackAlignment),rt.isDataTexture?tt.texSubImage2D(tt.TEXTURE_2D,st,H.x,H.y,yt,It,Bt,se,rt.image.data):rt.isCompressedTexture?tt.compressedTexSubImage2D(tt.TEXTURE_2D,st,H.x,H.y,rt.mipmaps[0].width,rt.mipmaps[0].height,Bt,rt.mipmaps[0].data):tt.texSubImage2D(tt.TEXTURE_2D,st,H.x,H.y,Bt,se,rt.image),st===0&>.generateMipmaps&&tt.generateMipmap(tt.TEXTURE_2D),qt.unbindTexture()},this.copyTextureToTexture3D=function(H,rt,gt,st,yt=0){if(S.isWebGL1Renderer){console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");return}let It=H.max.x-H.min.x+1,Bt=H.max.y-H.min.y+1,se=H.max.z-H.min.z+1,Qt=oe.convert(st.format),ce=oe.convert(st.type),Vt;if(st.isData3DTexture)b.setTexture3D(st,0),Vt=tt.TEXTURE_3D;else if(st.isDataArrayTexture)b.setTexture2DArray(st,0),Vt=tt.TEXTURE_2D_ARRAY;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}tt.pixelStorei(tt.UNPACK_FLIP_Y_WEBGL,st.flipY),tt.pixelStorei(tt.UNPACK_PREMULTIPLY_ALPHA_WEBGL,st.premultiplyAlpha),tt.pixelStorei(tt.UNPACK_ALIGNMENT,st.unpackAlignment);let fe=tt.getParameter(tt.UNPACK_ROW_LENGTH),sn=tt.getParameter(tt.UNPACK_IMAGE_HEIGHT),un=tt.getParameter(tt.UNPACK_SKIP_PIXELS),vn=tt.getParameter(tt.UNPACK_SKIP_ROWS),ni=tt.getParameter(tt.UNPACK_SKIP_IMAGES),En=gt.isCompressedTexture?gt.mipmaps[0]:gt.image;tt.pixelStorei(tt.UNPACK_ROW_LENGTH,En.width),tt.pixelStorei(tt.UNPACK_IMAGE_HEIGHT,En.height),tt.pixelStorei(tt.UNPACK_SKIP_PIXELS,H.min.x),tt.pixelStorei(tt.UNPACK_SKIP_ROWS,H.min.y),tt.pixelStorei(tt.UNPACK_SKIP_IMAGES,H.min.z),gt.isDataTexture||gt.isData3DTexture?tt.texSubImage3D(Vt,yt,rt.x,rt.y,rt.z,It,Bt,se,Qt,ce,En.data):gt.isCompressedArrayTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),tt.compressedTexSubImage3D(Vt,yt,rt.x,rt.y,rt.z,It,Bt,se,Qt,En.data)):tt.texSubImage3D(Vt,yt,rt.x,rt.y,rt.z,It,Bt,se,Qt,ce,En),tt.pixelStorei(tt.UNPACK_ROW_LENGTH,fe),tt.pixelStorei(tt.UNPACK_IMAGE_HEIGHT,sn),tt.pixelStorei(tt.UNPACK_SKIP_PIXELS,un),tt.pixelStorei(tt.UNPACK_SKIP_ROWS,vn),tt.pixelStorei(tt.UNPACK_SKIP_IMAGES,ni),yt===0&&st.generateMipmaps&&tt.generateMipmap(Vt),qt.unbindTexture()},this.initTexture=function(H){H.isCubeTexture?b.setTextureCube(H,0):H.isData3DTexture?b.setTexture3D(H,0):H.isDataArrayTexture||H.isCompressedArrayTexture?b.setTexture2DArray(H,0):b.setTexture2D(H,0),qt.unbindTexture()},this.resetState=function(){F=0,G=0,z=null,qt.reset(),jt.reset()},typeof __THREE_DEVTOOLS__!="undefined"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return Vo}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(t){this._outputColorSpace=t;let e=this.getContext();e.drawingBufferColorSpace=t===Xh?"display-p3":"srgb",e.unpackColorSpace=gn.workingColorSpace===pc?"display-p3":"srgb"}get physicallyCorrectLights(){return console.warn("THREE.WebGLRenderer: The property .physicallyCorrectLights has been removed. Set renderer.useLegacyLights instead."),!this.useLegacyLights}set physicallyCorrectLights(t){console.warn("THREE.WebGLRenderer: The property .physicallyCorrectLights has been removed. Set renderer.useLegacyLights instead."),this.useLegacyLights=!t}get outputEncoding(){return console.warn("THREE.WebGLRenderer: Property .outputEncoding has been removed. Use .outputColorSpace instead."),this.outputColorSpace===br?Ws:s0}set outputEncoding(t){console.warn("THREE.WebGLRenderer: Property .outputEncoding has been removed. Use .outputColorSpace instead."),this.outputColorSpace=t===Ws?br:Wo}get useLegacyLights(){return console.warn("THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733."),this._useLegacyLights}set useLegacyLights(t){console.warn("THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733."),this._useLegacyLights=t}},Nh=class extends Lh{};Nh.prototype.isWebGL1Renderer=!0;function Xl(r,t,e){return!r||!e&&r.constructor===t?r:typeof t.BYTES_PER_ELEMENT=="number"?new t(r):Array.prototype.slice.call(r)}function Mb(r){return ArrayBuffer.isView(r)&&!(r instanceof DataView)}var Wa=class{constructor(t,e,o,a){this.parameterPositions=t,this._cachedIndex=0,this.resultBuffer=a!==void 0?a:new e.constructor(o),this.sampleValues=e,this.valueSize=o,this.settings=null,this.DefaultSettings_={}}evaluate(t){let e=this.parameterPositions,o=this._cachedIndex,a=e[o],l=e[o-1];n:{t:{let f;e:{r:if(!(t<a)){for(let h=o+2;;){if(a===void 0){if(t<l)break r;return o=e.length,this._cachedIndex=o,this.copySampleValue_(o-1)}if(o===h)break;if(l=a,a=e[++o],t<a)break t}f=e.length;break e}if(!(t>=l)){let h=e[1];t<h&&(o=2,l=h);for(let p=o-2;;){if(l===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(o===p)break;if(a=l,l=e[--o-1],t>=l)break t}f=o,o=0;break e}break n}for(;o<f;){let h=o+f>>>1;t<e[h]?f=h:o=h+1}if(a=e[o],l=e[o-1],l===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(a===void 0)return o=e.length,this._cachedIndex=o,this.copySampleValue_(o-1)}this._cachedIndex=o,this.intervalChanged_(o,l,a)}return this.interpolate_(o,l,t,a)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(t){let e=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=t*a;for(let f=0;f!==a;++f)e[f]=o[l+f];return e}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}},Oh=class extends Wa{constructor(t,e,o,a){super(t,e,o,a),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:sg,endingEnd:sg}}intervalChanged_(t,e,o){let a=this.parameterPositions,l=t-2,f=t+1,h=a[l],p=a[f];if(h===void 0)switch(this.getSettings_().endingStart){case ag:l=t,h=2*e-o;break;case ug:l=a.length-2,h=e+a[l]-a[l+1];break;default:l=t,h=o}if(p===void 0)switch(this.getSettings_().endingEnd){case ag:f=t,p=2*o-e;break;case ug:f=1,p=o+a[1]-a[0];break;default:f=t-1,p=e}let d=(o-e)*.5,g=this.valueSize;this._weightPrev=d/(e-h),this._weightNext=d/(p-o),this._offsetPrev=l*g,this._offsetNext=f*g}interpolate_(t,e,o,a){let l=this.resultBuffer,f=this.sampleValues,h=this.valueSize,p=t*h,d=p-h,g=this._offsetPrev,_=this._offsetNext,y=this._weightPrev,M=this._weightNext,w=(o-e)/(a-e),A=w*w,x=A*w,v=-y*x+2*y*A-y*w,C=(1+y)*x+(-1.5-2*y)*A+(-.5+y)*w+1,S=(-1-M)*x+(1.5+M)*A+.5*w,O=M*x-M*A;for(let F=0;F!==h;++F)l[F]=v*f[g+F]+C*f[d+F]+S*f[p+F]+O*f[_+F];return l}},Dh=class extends Wa{constructor(t,e,o,a){super(t,e,o,a)}interpolate_(t,e,o,a){let l=this.resultBuffer,f=this.sampleValues,h=this.valueSize,p=t*h,d=p-h,g=(o-e)/(a-e),_=1-g;for(let y=0;y!==h;++y)l[y]=f[d+y]*_+f[p+y]*g;return l}},Fh=class extends Wa{constructor(t,e,o,a){super(t,e,o,a)}interpolate_(t){return this.copySampleValue_(t-1)}},ji=class{constructor(t,e,o,a){if(t===void 0)throw new Error("THREE.KeyframeTrack: track name is undefined");if(e===void 0||e.length===0)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+t);this.name=t,this.times=Xl(e,this.TimeBufferType),this.values=Xl(o,this.ValueBufferType),this.setInterpolation(a||this.DefaultInterpolation)}static toJSON(t){let e=t.constructor,o;if(e.toJSON!==this.toJSON)o=e.toJSON(t);else{o={name:t.name,times:Xl(t.times,Array),values:Xl(t.values,Array)};let a=t.getInterpolation();a!==t.DefaultInterpolation&&(o.interpolation=a)}return o.type=t.ValueTypeName,o}InterpolantFactoryMethodDiscrete(t){return new Fh(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodLinear(t){return new Dh(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodSmooth(t){return new Oh(this.times,this.values,this.getValueSize(),t)}setInterpolation(t){let e;switch(t){case Yl:e=this.InterpolantFactoryMethodDiscrete;break;case Zl:e=this.InterpolantFactoryMethodLinear;break;case Ff:e=this.InterpolantFactoryMethodSmooth;break}if(e===void 0){let o="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(this.createInterpolant===void 0)if(t!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw new Error(o);return console.warn("THREE.KeyframeTrack:",o),this}return this.createInterpolant=e,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return Yl;case this.InterpolantFactoryMethodLinear:return Zl;case this.InterpolantFactoryMethodSmooth:return Ff}}getValueSize(){return this.values.length/this.times.length}shift(t){if(t!==0){let e=this.times;for(let o=0,a=e.length;o!==a;++o)e[o]+=t}return this}scale(t){if(t!==1){let e=this.times;for(let o=0,a=e.length;o!==a;++o)e[o]*=t}return this}trim(t,e){let o=this.times,a=o.length,l=0,f=a-1;for(;l!==a&&o[l]<t;)++l;for(;f!==-1&&o[f]>e;)--f;if(++f,l!==0||f!==a){l>=f&&(f=Math.max(f,1),l=f-1);let h=this.getValueSize();this.times=o.slice(l,f),this.values=this.values.slice(l*h,f*h)}return this}validate(){let t=!0,e=this.getValueSize();e-Math.floor(e)!==0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),t=!1);let o=this.times,a=this.values,l=o.length;l===0&&(console.error("THREE.KeyframeTrack: Track is empty.",this),t=!1);let f=null;for(let h=0;h!==l;h++){let p=o[h];if(typeof p=="number"&&isNaN(p)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,h,p),t=!1;break}if(f!==null&&f>p){console.error("THREE.KeyframeTrack: Out of order keys.",this,h,p,f),t=!1;break}f=p}if(a!==void 0&&Mb(a))for(let h=0,p=a.length;h!==p;++h){let d=a[h];if(isNaN(d)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,h,d),t=!1;break}}return t}optimize(){let t=this.times.slice(),e=this.values.slice(),o=this.getValueSize(),a=this.getInterpolation()===Ff,l=t.length-1,f=1;for(let h=1;h<l;++h){let p=!1,d=t[h],g=t[h+1];if(d!==g&&(h!==1||d!==t[0]))if(a)p=!0;else{let _=h*o,y=_-o,M=_+o;for(let w=0;w!==o;++w){let A=e[_+w];if(A!==e[y+w]||A!==e[M+w]){p=!0;break}}}if(p){if(h!==f){t[f]=t[h];let _=h*o,y=f*o;for(let M=0;M!==o;++M)e[y+M]=e[_+M]}++f}}if(l>0){t[f]=t[l];for(let h=l*o,p=f*o,d=0;d!==o;++d)e[p+d]=e[h+d];++f}return f!==t.length?(this.times=t.slice(0,f),this.values=e.slice(0,f*o)):(this.times=t,this.values=e),this}clone(){let t=this.times.slice(),e=this.values.slice(),o=this.constructor,a=new o(this.name,t,e);return a.createInterpolant=this.createInterpolant,a}};ji.prototype.TimeBufferType=Float32Array;ji.prototype.ValueBufferType=Float32Array;ji.prototype.DefaultInterpolation=Zl;var Ys=class extends ji{};Ys.prototype.ValueTypeName="bool";Ys.prototype.ValueBufferType=Array;Ys.prototype.DefaultInterpolation=Yl;Ys.prototype.InterpolantFactoryMethodLinear=void 0;Ys.prototype.InterpolantFactoryMethodSmooth=void 0;var Uh=class extends ji{};Uh.prototype.ValueTypeName="color";var Bh=class extends ji{};Bh.prototype.ValueTypeName="number";var zh=class extends Wa{constructor(t,e,o,a){super(t,e,o,a)}interpolate_(t,e,o,a){let l=this.resultBuffer,f=this.sampleValues,h=this.valueSize,p=(o-e)/(a-e),d=t*h;for(let g=d+h;d!==g;d+=4)ms.slerpFlat(l,0,f,d-h,f,d,p);return l}},Bu=class extends ji{InterpolantFactoryMethodLinear(t){return new zh(this.times,this.values,this.getValueSize(),t)}};Bu.prototype.ValueTypeName="quaternion";Bu.prototype.DefaultInterpolation=Zl;Bu.prototype.InterpolantFactoryMethodSmooth=void 0;var Zs=class extends ji{};Zs.prototype.ValueTypeName="string";Zs.prototype.ValueBufferType=Array;Zs.prototype.DefaultInterpolation=Yl;Zs.prototype.InterpolantFactoryMethodLinear=void 0;Zs.prototype.InterpolantFactoryMethodSmooth=void 0;var kh=class extends ji{};kh.prototype.ValueTypeName="vector";var Gh=class{constructor(t,e,o){let a=this,l=!1,f=0,h=0,p,d=[];this.onStart=void 0,this.onLoad=t,this.onProgress=e,this.onError=o,this.itemStart=function(g){h++,l===!1&&a.onStart!==void 0&&a.onStart(g,f,h),l=!0},this.itemEnd=function(g){f++,a.onProgress!==void 0&&a.onProgress(g,f,h),f===h&&(l=!1,a.onLoad!==void 0&&a.onLoad())},this.itemError=function(g){a.onError!==void 0&&a.onError(g)},this.resolveURL=function(g){return p?p(g):g},this.setURLModifier=function(g){return p=g,this},this.addHandler=function(g,_){return d.push(g,_),this},this.removeHandler=function(g){let _=d.indexOf(g);return _!==-1&&d.splice(_,2),this},this.getHandler=function(g){for(let _=0,y=d.length;_<y;_+=2){let M=d[_],w=d[_+1];if(M.global&&(M.lastIndex=0),M.test(g))return w}return null}}},Sb=new Gh,Vh=class{constructor(t){this.manager=t!==void 0?t:Sb,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(t,e){let o=this;return new Promise(function(a,l){o.load(t,a,e,l)})}parse(){}setCrossOrigin(t){return this.crossOrigin=t,this}setWithCredentials(t){return this.withCredentials=t,this}setPath(t){return this.path=t,this}setResourcePath(t){return this.resourcePath=t,this}setRequestHeader(t){return this.requestHeader=t,this}};Vh.DEFAULT_MATERIAL_NAME="__DEFAULT";var Zh="\\\\[\\\\]\\\\.:\\\\/",wb=new RegExp("["+Zh+"]","g"),Jh="[^"+Zh+"]",bb="[^"+Zh.replace("\\\\.","")+"]",Tb=/((?:WC+[\\/:])*)/.source.replace("WC",Jh),Ab=/(WCOD+)?/.source.replace("WCOD",bb),Cb=/(?:\\.(WC+)(?:\\[(.+)\\])?)?/.source.replace("WC",Jh),Pb=/\\.(WC+)(?:\\[(.+)\\])?/.source.replace("WC",Jh),Ib=new RegExp("^"+Tb+Ab+Cb+Pb+"$"),Rb=["material","materials","bones","map"],Hh=class{constructor(t,e,o){let a=o||Rn.parseTrackName(e);this._targetGroup=t,this._bindings=t.subscribe_(e,a)}getValue(t,e){this.bind();let o=this._targetGroup.nCachedObjects_,a=this._bindings[o];a!==void 0&&a.getValue(t,e)}setValue(t,e){let o=this._bindings;for(let a=this._targetGroup.nCachedObjects_,l=o.length;a!==l;++a)o[a].setValue(t,e)}bind(){let t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,o=t.length;e!==o;++e)t[e].bind()}unbind(){let t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,o=t.length;e!==o;++e)t[e].unbind()}},Rn=class r{constructor(t,e,o){this.path=e,this.parsedPath=o||r.parseTrackName(e),this.node=r.findNode(t,this.parsedPath.nodeName),this.rootNode=t,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(t,e,o){return t&&t.isAnimationObjectGroup?new r.Composite(t,e,o):new r(t,e,o)}static sanitizeNodeName(t){return t.replace(/\\s/g,"_").replace(wb,"")}static parseTrackName(t){let e=Ib.exec(t);if(e===null)throw new Error("PropertyBinding: Cannot parse trackName: "+t);let o={nodeName:e[2],objectName:e[3],objectIndex:e[4],propertyName:e[5],propertyIndex:e[6]},a=o.nodeName&&o.nodeName.lastIndexOf(".");if(a!==void 0&&a!==-1){let l=o.nodeName.substring(a+1);Rb.indexOf(l)!==-1&&(o.nodeName=o.nodeName.substring(0,a),o.objectName=l)}if(o.propertyName===null||o.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+t);return o}static findNode(t,e){if(e===void 0||e===""||e==="."||e===-1||e===t.name||e===t.uuid)return t;if(t.skeleton){let o=t.skeleton.getBoneByName(e);if(o!==void 0)return o}if(t.children){let o=function(l){for(let f=0;f<l.length;f++){let h=l[f];if(h.name===e||h.uuid===e)return h;let p=o(h.children);if(p)return p}return null},a=o(t.children);if(a)return a}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(t,e){t[e]=this.targetObject[this.propertyName]}_getValue_array(t,e){let o=this.resolvedProperty;for(let a=0,l=o.length;a!==l;++a)t[e++]=o[a]}_getValue_arrayElement(t,e){t[e]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(t,e){this.resolvedProperty.toArray(t,e)}_setValue_direct(t,e){this.targetObject[this.propertyName]=t[e]}_setValue_direct_setNeedsUpdate(t,e){this.targetObject[this.propertyName]=t[e],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(t,e){this.targetObject[this.propertyName]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(t,e){let o=this.resolvedProperty;for(let a=0,l=o.length;a!==l;++a)o[a]=t[e++]}_setValue_array_setNeedsUpdate(t,e){let o=this.resolvedProperty;for(let a=0,l=o.length;a!==l;++a)o[a]=t[e++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(t,e){let o=this.resolvedProperty;for(let a=0,l=o.length;a!==l;++a)o[a]=t[e++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(t,e){this.resolvedProperty[this.propertyIndex]=t[e]}_setValue_arrayElement_setNeedsUpdate(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(t,e){this.resolvedProperty.fromArray(t,e)}_setValue_fromArray_setNeedsUpdate(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(t,e){this.bind(),this.getValue(t,e)}_setValue_unbound(t,e){this.bind(),this.setValue(t,e)}bind(){let t=this.node,e=this.parsedPath,o=e.objectName,a=e.propertyName,l=e.propertyIndex;if(t||(t=r.findNode(this.rootNode,e.nodeName),this.node=t),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!t){console.warn("THREE.PropertyBinding: No target node found for track: "+this.path+".");return}if(o){let d=e.objectIndex;switch(o){case"materials":if(!t.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!t.material.materials){console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);return}t=t.material.materials;break;case"bones":if(!t.skeleton){console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);return}t=t.skeleton.bones;for(let g=0;g<t.length;g++)if(t[g].name===d){d=g;break}break;case"map":if("map"in t){t=t.map;break}if(!t.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!t.material.map){console.error("THREE.PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);return}t=t.material.map;break;default:if(t[o]===void 0){console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);return}t=t[o]}if(d!==void 0){if(t[d]===void 0){console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,t);return}t=t[d]}}let f=t[a];if(f===void 0){let d=e.nodeName;console.error("THREE.PropertyBinding: Trying to update property for track: "+d+"."+a+" but it wasn\'t found.",t);return}let h=this.Versioning.None;this.targetObject=t,t.needsUpdate!==void 0?h=this.Versioning.NeedsUpdate:t.matrixWorldNeedsUpdate!==void 0&&(h=this.Versioning.MatrixWorldNeedsUpdate);let p=this.BindingType.Direct;if(l!==void 0){if(a==="morphTargetInfluences"){if(!t.geometry){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(!t.geometry.morphAttributes){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);return}t.morphTargetDictionary[l]!==void 0&&(l=t.morphTargetDictionary[l])}p=this.BindingType.ArrayElement,this.resolvedProperty=f,this.propertyIndex=l}else f.fromArray!==void 0&&f.toArray!==void 0?(p=this.BindingType.HasFromToArray,this.resolvedProperty=f):Array.isArray(f)?(p=this.BindingType.EntireArray,this.resolvedProperty=f):this.propertyName=a;this.getValue=this.GetterByBindingType[p],this.setValue=this.SetterByBindingTypeAndVersioning[p][h]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}};Rn.Composite=Hh;Rn.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};Rn.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};Rn.prototype.GetterByBindingType=[Rn.prototype._getValue_direct,Rn.prototype._getValue_array,Rn.prototype._getValue_arrayElement,Rn.prototype._getValue_toArray];Rn.prototype.SetterByBindingTypeAndVersioning=[[Rn.prototype._setValue_direct,Rn.prototype._setValue_direct_setNeedsUpdate,Rn.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[Rn.prototype._setValue_array,Rn.prototype._setValue_array_setNeedsUpdate,Rn.prototype._setValue_array_setMatrixWorldNeedsUpdate],[Rn.prototype._setValue_arrayElement,Rn.prototype._setValue_arrayElement_setNeedsUpdate,Rn.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[Rn.prototype._setValue_fromArray,Rn.prototype._setValue_fromArray_setNeedsUpdate,Rn.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];var fR=new Float32Array(1);typeof __THREE_DEVTOOLS__!="undefined"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:Wh}}));typeof window!="undefined"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=Wh);function m0(r,t){return new Promise((e,o)=>{let a=new XMLHttpRequest;a.open("GET",r,!0),Object.keys(t.headers||{}).forEach(l=>{a.setRequestHeader(l,t.headers[l])}),a.onload=()=>{if(a.status>=200&&a.status<300)try{let l=JSON.parse(a.responseText);e(l)}catch(l){o(l)}else o(a.statusText)},a.onerror=()=>{o(a.statusText)},a.send()})}var mr=63710088e-1,dR={centimeters:mr*100,centimetres:mr*100,degrees:mr/111325,feet:mr*3.28084,inches:mr*39.37,kilometers:mr/1e3,kilometres:mr/1e3,meters:mr,metres:mr,miles:mr/1609.344,millimeters:mr*1e3,millimetres:mr*1e3,nauticalmiles:mr/1852,radians:1,yards:mr*1.0936},mR={centimeters:100,centimetres:100,degrees:1/111325,feet:3.28084,inches:39.37,kilometers:1/1e3,kilometres:1/1e3,meters:1,metres:1,miles:1/1609.344,millimeters:1e3,millimetres:1e3,nauticalmiles:1/1852,radians:1/mr,yards:1.0936133};function Kr(r,t,e){e===void 0&&(e={});var o={type:"Feature"};return(e.id===0||e.id)&&(o.id=e.id),e.bbox&&(o.bbox=e.bbox),o.properties=t||{},o.geometry=r,o}function Sn(r,t,e){if(e===void 0&&(e={}),!r)throw new Error("coordinates is required");if(!Array.isArray(r))throw new Error("coordinates must be an Array");if(r.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!ho(r[0])||!ho(r[1]))throw new Error("coordinates must contain numbers");var o={type:"Point",coordinates:r};return Kr(o,t,e)}function Ln(r,t,e){e===void 0&&(e={});for(var o=0,a=r;o<a.length;o++){var l=a[o];if(l.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");for(var f=0;f<l[l.length-1].length;f++)if(l[l.length-1][f]!==l[0][f])throw new Error("First and last Position are not equivalent.")}var h={type:"Polygon",coordinates:r};return Kr(h,t,e)}function gr(r,t,e){if(e===void 0&&(e={}),r.length<2)throw new Error("coordinates must be an array of two or more positions");var o={type:"LineString",coordinates:r};return Kr(o,t,e)}function $h(r,t,e){e===void 0&&(e={});var o={type:"MultiPoint",coordinates:r};return Kr(o,t,e)}function ho(r){return!isNaN(r)&&r!==null&&!Array.isArray(r)}function nr(r,t,e){if(r!==null)for(var o,a,l,f,h,p,d,g=0,_=0,y,M=r.type,w=M==="FeatureCollection",A=M==="Feature",x=w?r.features.length:1,v=0;v<x;v++){d=w?r.features[v].geometry:A?r.geometry:r,y=d?d.type==="GeometryCollection":!1,h=y?d.geometries.length:1;for(var C=0;C<h;C++){var S=0,O=0;if(f=y?d.geometries[C]:d,f!==null){p=f.coordinates;var F=f.type;switch(g=e&&(F==="Polygon"||F==="MultiPolygon")?1:0,F){case null:break;case"Point":if(t(p,_,v,S,O)===!1)return!1;_++,S++;break;case"LineString":case"MultiPoint":for(o=0;o<p.length;o++){if(t(p[o],_,v,S,O)===!1)return!1;_++,F==="MultiPoint"&&S++}F==="LineString"&&S++;break;case"Polygon":case"MultiLineString":for(o=0;o<p.length;o++){for(a=0;a<p[o].length-g;a++){if(t(p[o][a],_,v,S,O)===!1)return!1;_++}F==="MultiLineString"&&S++,F==="Polygon"&&O++}F==="Polygon"&&S++;break;case"MultiPolygon":for(o=0;o<p.length;o++){for(O=0,a=0;a<p[o].length;a++){for(l=0;l<p[o][a].length-g;l++){if(t(p[o][a][l],_,v,S,O)===!1)return!1;_++}O++}S++}break;case"GeometryCollection":for(o=0;o<f.geometries.length;o++)if(nr(f.geometries[o],t,e)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function g0(r,t,e,o){var a=e;return nr(r,function(l,f,h,p,d){f===0&&e===void 0?a=l:a=t(a,l,f,h,p,d)},o),a}function gs(r,t){var e,o,a,l,f,h,p,d,g,_,y=0,M=r.type==="FeatureCollection",w=r.type==="Feature",A=M?r.features.length:1;for(e=0;e<A;e++){for(h=M?r.features[e].geometry:w?r.geometry:r,d=M?r.features[e].properties:w?r.properties:{},g=M?r.features[e].bbox:w?r.bbox:void 0,_=M?r.features[e].id:w?r.id:void 0,p=h?h.type==="GeometryCollection":!1,f=p?h.geometries.length:1,a=0;a<f;a++){if(l=p?h.geometries[a]:h,l===null){if(t(null,y,d,g,_)===!1)return!1;continue}switch(l.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":{if(t(l,y,d,g,_)===!1)return!1;break}case"GeometryCollection":{for(o=0;o<l.geometries.length;o++)if(t(l.geometries[o],y,d,g,_)===!1)return!1;break}default:throw new Error("Unknown Geometry Type")}}y++}}function Ei(r,t){gs(r,function(e,o,a,l,f){var h=e===null?null:e.type;switch(h){case null:case"Point":case"LineString":case"Polygon":return t(Kr(e,a,{bbox:l,id:f}),o,0)===!1?!1:void 0}var p;switch(h){case"MultiPoint":p="Point";break;case"MultiLineString":p="LineString";break;case"MultiPolygon":p="Polygon";break}for(var d=0;d<e.coordinates.length;d++){var g=e.coordinates[d],_={type:p,coordinates:g};if(t(Kr(_,a),o,d)===!1)return!1}})}function Kh(r){var t=[1/0,1/0,-1/0,-1/0];return nr(r,function(e){t[0]>e[0]&&(t[0]=e[0]),t[1]>e[1]&&(t[1]=e[1]),t[2]<e[0]&&(t[2]=e[0]),t[3]<e[1]&&(t[3]=e[1])}),t}Kh.default=Kh;var jr=Kh;function Ar(r){if(!r)throw new Error("coord is required");if(!Array.isArray(r)){if(r.type==="Feature"&&r.geometry!==null&&r.geometry.type==="Point")return r.geometry.coordinates;if(r.type==="Point")return r.coordinates}if(Array.isArray(r)&&r.length>=2&&!Array.isArray(r[0])&&!Array.isArray(r[1]))return r;throw new Error("coord must be GeoJSON Point or an Array of numbers")}function jh(r,t,e){if(!r)throw new Error("No feature passed");if(!e)throw new Error(".featureOf() requires a name");if(!r||r.type!=="Feature"||!r.geometry)throw new Error("Invalid input to "+e+", Feature with geometry required");if(!r.geometry||r.geometry.type!==t)throw new Error("Invalid input to "+e+": must be a "+t+", given "+r.geometry.type)}function Cr(r){return r.type==="Feature"?r.geometry:r}var zb=Un(mc(),1);var Jb=Un(O0(),1);function yr(r,t,e){if(e===void 0&&(e={}),!r)throw new Error("point is required");if(!t)throw new Error("polygon is required");var o=Ar(r),a=Cr(t),l=a.type,f=t.bbox,h=a.coordinates;if(f&&$b(o,f)===!1)return!1;l==="Polygon"&&(h=[h]);for(var p=!1,d=0;d<h.length&&!p;d++)if(D0(o,h[d][0],e.ignoreBoundary)){for(var g=!1,_=1;_<h[d].length&&!g;)D0(o,h[d][_],!e.ignoreBoundary)&&(g=!0),_++;g||(p=!0)}return p}function D0(r,t,e){var o=!1;t[0][0]===t[t.length-1][0]&&t[0][1]===t[t.length-1][1]&&(t=t.slice(0,t.length-1));for(var a=0,l=t.length-1;a<t.length;l=a++){var f=t[a][0],h=t[a][1],p=t[l][0],d=t[l][1],g=r[1]*(f-p)+h*(p-r[0])+d*(r[0]-f)===0&&(f-r[0])*(p-r[0])<=0&&(h-r[1])*(d-r[1])<=0;if(g)return!e;var _=h>r[1]!=d>r[1]&&r[0]<(p-f)*(r[1]-h)/(d-h)+f;_&&(o=!o)}return o}function $b(r,t){return t[0]<=r[0]&&t[1]<=r[1]&&t[2]>=r[0]&&t[3]>=r[1]}var B0=new ArrayBuffer(16),WL=new Float64Array(B0),qL=new Uint32Array(B0);var fT=Un(dp(),1);var y2=function(){function r(t){this.points=t.points||[],this.duration=t.duration||1e4,this.sharpness=t.sharpness||.85,this.centers=[],this.controls=[],this.stepLength=t.stepLength||60,this.length=this.points.length,this.delay=0;for(var e=0;e<this.length;e++)this.points[e].z=this.points[e].z||0;for(var e=0;e<this.length-1;e++){var o=this.points[e],a=this.points[e+1];this.centers.push({x:(o.x+a.x)/2,y:(o.y+a.y)/2,z:(o.z+a.z)/2})}this.controls.push([this.points[0],this.points[0]]);for(var e=0;e<this.centers.length-1;e++){var l=this.points[e+1].x-(this.centers[e].x+this.centers[e+1].x)/2,f=this.points[e+1].y-(this.centers[e].y+this.centers[e+1].y)/2,h=this.points[e+1].z-(this.centers[e].y+this.centers[e+1].z)/2;this.controls.push([{x:(1-this.sharpness)*this.points[e+1].x+this.sharpness*(this.centers[e].x+l),y:(1-this.sharpness)*this.points[e+1].y+this.sharpness*(this.centers[e].y+f),z:(1-this.sharpness)*this.points[e+1].z+this.sharpness*(this.centers[e].z+h)},{x:(1-this.sharpness)*this.points[e+1].x+this.sharpness*(this.centers[e+1].x+l),y:(1-this.sharpness)*this.points[e+1].y+this.sharpness*(this.centers[e+1].y+f),z:(1-this.sharpness)*this.points[e+1].z+this.sharpness*(this.centers[e+1].z+h)}])}return this.controls.push([this.points[this.length-1],this.points[this.length-1]]),this.steps=this.cacheSteps(this.stepLength),this}return r.prototype.cacheSteps=function(t){var e=[],o=this.pos(0);e.push(0);for(var a=0;a<this.duration;a+=10){var l=this.pos(a),f=Math.sqrt((l.x-o.x)*(l.x-o.x)+(l.y-o.y)*(l.y-o.y)+(l.z-o.z)*(l.z-o.z));f>t&&(e.push(a),o=l)}return e},r.prototype.vector=function(t){var e=this.pos(t+10),o=this.pos(t-10);return{angle:180*Math.atan2(e.y-o.y,e.x-o.x)/3.14,speed:Math.sqrt((o.x-e.x)*(o.x-e.x)+(o.y-e.y)*(o.y-e.y)+(o.z-e.z)*(o.z-e.z))}},r.prototype.pos=function(t){var e=t-this.delay;e<0&&(e=0),e>this.duration&&(e=this.duration-1);var o=e/this.duration;if(o>=1)return this.points[this.length-1];var a=Math.floor((this.points.length-1)*o),l=(this.length-1)*o-a;return hT(l,this.points[a],this.controls[a][1],this.controls[a+1][0],this.points[a+1])},r}();function hT(r,t,e,o,a){var l=pT(r),f={x:a.x*l[0]+o.x*l[1]+e.x*l[2]+t.x*l[3],y:a.y*l[0]+o.y*l[1]+e.y*l[2]+t.y*l[3],z:a.z*l[0]+o.z*l[1]+e.z*l[2]+t.z*l[3]};return f}function pT(r){var t=r*r,e=t*r;return[e,3*t*(1-r),3*r*(1-r)*(1-r),(1-r)*(1-r)*(1-r)]}function Hu(r,t){t===void 0&&(t={});var e=Number(r[0]),o=Number(r[1]),a=Number(r[2]),l=Number(r[3]);if(r.length===6)throw new Error("@turf/bbox-polygon does not support BBox with 6 positions");var f=[e,o],h=[e,l],p=[a,l],d=[a,o];return Ln([[f,d,p,h,f]],t.properties,{bbox:r,id:t.id})}function dT(r){return Hu(jr(r))}var mp=dT;var RT=Un(J0(),1);var iA=Un(Lc(),1);var sA=Un(mc(),1);var lA=Un(dp(),1);var py=Math.PI/180,dy=180/Math.PI,$u=function(r,t){this.lon=r,this.lat=t,this.x=py*r,this.y=py*t};$u.prototype.view=function(){return String(this.lon).slice(0,4)+","+String(this.lat).slice(0,4)};$u.prototype.antipode=function(){var r=-1*this.lat,t=this.lon<0?180+this.lon:(180-this.lon)*-1;return new $u(t,r)};var my=function(){this.coords=[],this.length=0};my.prototype.move_to=function(r){this.length++,this.coords.push(r)};var Dp=function(r){this.properties=r||{},this.geometries=[]};Dp.prototype.json=function(){if(this.geometries.length<=0)return{geometry:{type:"LineString",coordinates:null},type:"Feature",properties:this.properties};if(this.geometries.length===1)return{geometry:{type:"LineString",coordinates:this.geometries[0].coords},type:"Feature",properties:this.properties};for(var r=[],t=0;t<this.geometries.length;t++)r.push(this.geometries[t].coords);return{geometry:{type:"MultiLineString",coordinates:r},type:"Feature",properties:this.properties}};Dp.prototype.wkt=function(){for(var r="",t="LINESTRING(",e=function(l){t+=l[0]+" "+l[1]+","},o=0;o<this.geometries.length;o++){if(this.geometries[o].coords.length===0)return"LINESTRING(empty)";var a=this.geometries[o].coords;a.forEach(e),r+=t.substring(0,t.length-1)+")"}return r};var gy=function(r,t,e){if(!r||r.x===void 0||r.y===void 0)throw new Error("GreatCircle constructor expects two args: start and end objects with x and y properties");if(!t||t.x===void 0||t.y===void 0)throw new Error("GreatCircle constructor expects two args: start and end objects with x and y properties");this.start=new $u(r.x,r.y),this.end=new $u(t.x,t.y),this.properties=e||{};var o=this.start.x-this.end.x,a=this.start.y-this.end.y,l=Math.pow(Math.sin(a/2),2)+Math.cos(this.start.y)*Math.cos(this.end.y)*Math.pow(Math.sin(o/2),2);if(this.g=2*Math.asin(Math.sqrt(l)),this.g===Math.PI)throw new Error("it appears "+r.view()+" and "+t.view()+" are \'antipodal\', e.g diametrically opposite, thus there is no single route but rather infinite");if(isNaN(this.g))throw new Error("could not calculate great circle between "+r+" and "+t)};gy.prototype.interpolate=function(r){var t=Math.sin((1-r)*this.g)/Math.sin(this.g),e=Math.sin(r*this.g)/Math.sin(this.g),o=t*Math.cos(this.start.y)*Math.cos(this.start.x)+e*Math.cos(this.end.y)*Math.cos(this.end.x),a=t*Math.cos(this.start.y)*Math.sin(this.start.x)+e*Math.cos(this.end.y)*Math.sin(this.end.x),l=t*Math.sin(this.start.y)+e*Math.sin(this.end.y),f=dy*Math.atan2(l,Math.sqrt(Math.pow(o,2)+Math.pow(a,2))),h=dy*Math.atan2(a,o);return[h,f]};gy.prototype.Arc=function(r,t){var e=[];if(!r||r<=2)e.push([this.start.lon,this.start.lat]),e.push([this.end.lon,this.end.lat]);else for(var o=1/(r-1),a=0;a<r;++a){var l=o*a,f=this.interpolate(l);e.push(f)}for(var h=!1,p=0,d=t&&t.offset?t.offset:10,g=180-d,_=-180+d,y=360-d,M=1;M<e.length;++M){var w=e[M-1][0],A=e[M][0],x=Math.abs(A-w);x>y&&(A>g&&w<_||w>g&&A<_)?h=!0:x>p&&(p=x)}var v=[];if(h&&p<d){var C=[];v.push(C);for(var S=0;S<e.length;++S){var O=parseFloat(e[S][0]);if(S>0&&Math.abs(O-e[S-1][0])>y){var F=parseFloat(e[S-1][0]),G=parseFloat(e[S-1][1]),z=parseFloat(e[S][0]),L=parseFloat(e[S][1]);if(F>-180&&F<_&&z===180&&S+1<e.length&&e[S-1][0]>-180&&e[S-1][0]<_){C.push([-180,e[S][1]]),S++,C.push([e[S][0],e[S][1]]);continue}else if(F>g&&F<180&&z===-180&&S+1<e.length&&e[S-1][0]>g&&e[S-1][0]<180){C.push([180,e[S][1]]),S++,C.push([e[S][0],e[S][1]]);continue}if(F<_&&z>g){var D=F;F=z,z=D;var q=G;G=L,L=q}if(F>g&&z<_&&(z+=360),F<=180&&z>=180&&F<z){var nt=(180-F)/(z-F),k=nt*L+(1-nt)*G;C.push([e[S-1][0]>g?180:-180,k]),C=[],C.push([e[S-1][0]>g?-180:180,k]),v.push(C)}else C=[],v.push(C);C.push([O,e[S][1]])}else C.push([e[S][0],e[S][1]])}}else{var xt=[];v.push(xt);for(var X=0;X<e.length;++X)xt.push([e[X][0],e[X][1]])}for(var it=new Dp(this.properties),vt=0;vt<v.length;++vt){var pt=new my;it.geometries.push(pt);for(var et=v[vt],ot=0;ot<et.length;++ot)pt.move_to(et[ot])}return it};var hA=Un(Lc(),1);var kC=Un(Lc(),1);var GC=Un(rd(),1);var WC=Un(mc(),1);var _e=[],xe=[],Ee=[],Me=[],Se=[],we=[],be=[],Te=[],Ae=[],Ce=[],Pe=[],Ie=[],Re=[],Le=[],Ne=[],Oe=[],De=[],Fe=[],Ue=[],Be=[],ze=[],ke=[],Ge=[],Ve=[];be[85]=Ce[85]=-1;Te[85]=Pe[85]=0;Ae[85]=Ie[85]=1;Ue[85]=ke[85]=1;Be[85]=Ge[85]=0;ze[85]=Ve[85]=1;_e[85]=Me[85]=0;xe[85]=Se[85]=-1;Ee[85]=Ne[85]=0;Oe[85]=Re[85]=0;De[85]=Le[85]=1;we[85]=Fe[85]=1;ke[1]=ke[169]=0;Ge[1]=Ge[169]=-1;Ve[1]=Ve[169]=0;Re[1]=Re[169]=-1;Le[1]=Le[169]=0;Ne[1]=Ne[169]=0;Ce[4]=Ce[166]=0;Pe[4]=Pe[166]=-1;Ie[4]=Ie[166]=1;Oe[4]=Oe[166]=1;De[4]=De[166]=0;Fe[4]=Fe[166]=0;be[16]=be[154]=0;Te[16]=Te[154]=1;Ae[16]=Ae[154]=1;Me[16]=Me[154]=1;Se[16]=Se[154]=0;we[16]=we[154]=1;Ue[64]=Ue[106]=0;Be[64]=Be[106]=1;ze[64]=ze[106]=0;_e[64]=_e[106]=-1;xe[64]=xe[106]=0;Ee[64]=Ee[106]=1;Ue[2]=Ue[168]=0;Be[2]=Be[168]=-1;ze[2]=ze[168]=1;ke[2]=ke[168]=0;Ge[2]=Ge[168]=-1;Ve[2]=Ve[168]=0;Re[2]=Re[168]=-1;Le[2]=Le[168]=0;Ne[2]=Ne[168]=0;Oe[2]=Oe[168]=-1;De[2]=De[168]=0;Fe[2]=Fe[168]=1;be[8]=be[162]=0;Te[8]=Te[162]=-1;Ae[8]=Ae[162]=0;Ce[8]=Ce[162]=0;Pe[8]=Pe[162]=-1;Ie[8]=Ie[162]=1;Re[8]=Re[162]=1;Le[8]=Le[162]=0;Ne[8]=Ne[162]=1;Oe[8]=Oe[162]=1;De[8]=De[162]=0;Fe[8]=Fe[162]=0;be[32]=be[138]=0;Te[32]=Te[138]=1;Ae[32]=Ae[138]=1;Ce[32]=Ce[138]=0;Pe[32]=Pe[138]=1;Ie[32]=Ie[138]=0;_e[32]=_e[138]=1;xe[32]=xe[138]=0;Ee[32]=Ee[138]=0;Me[32]=Me[138]=1;Se[32]=Se[138]=0;we[32]=we[138]=1;ke[128]=ke[42]=0;Ge[128]=Ge[42]=1;Ve[128]=Ve[42]=1;Ue[128]=Ue[42]=0;Be[128]=Be[42]=1;ze[128]=ze[42]=0;_e[128]=_e[42]=-1;xe[128]=xe[42]=0;Ee[128]=Ee[42]=1;Me[128]=Me[42]=-1;Se[128]=Se[42]=0;we[128]=we[42]=0;Ce[5]=Ce[165]=-1;Pe[5]=Pe[165]=0;Ie[5]=Ie[165]=0;ke[5]=ke[165]=1;Ge[5]=Ge[165]=0;Ve[5]=Ve[165]=0;Oe[20]=Oe[150]=0;De[20]=De[150]=1;Fe[20]=Fe[150]=1;Me[20]=Me[150]=0;Se[20]=Se[150]=-1;we[20]=we[150]=1;be[80]=be[90]=-1;Te[80]=Te[90]=0;Ae[80]=Ae[90]=1;Ue[80]=Ue[90]=1;Be[80]=Be[90]=0;ze[80]=ze[90]=1;Re[65]=Re[105]=0;Le[65]=Le[105]=1;Ne[65]=Ne[105]=0;_e[65]=_e[105]=0;xe[65]=xe[105]=-1;Ee[65]=Ee[105]=0;be[160]=be[10]=-1;Te[160]=Te[10]=0;Ae[160]=Ae[10]=1;Ce[160]=Ce[10]=-1;Pe[160]=Pe[10]=0;Ie[160]=Ie[10]=0;ke[160]=ke[10]=1;Ge[160]=Ge[10]=0;Ve[160]=Ve[10]=0;Ue[160]=Ue[10]=1;Be[160]=Be[10]=0;ze[160]=ze[10]=1;Oe[130]=Oe[40]=0;De[130]=De[40]=1;Fe[130]=Fe[40]=1;Re[130]=Re[40]=0;Le[130]=Le[40]=1;Ne[130]=Ne[40]=0;_e[130]=_e[40]=0;xe[130]=xe[40]=-1;Ee[130]=Ee[40]=0;Me[130]=Me[40]=0;Se[130]=Se[40]=-1;we[130]=we[40]=1;Ce[37]=Ce[133]=0;Pe[37]=Pe[133]=1;Ie[37]=Ie[133]=1;ke[37]=ke[133]=0;Ge[37]=Ge[133]=1;Ve[37]=Ve[133]=0;_e[37]=_e[133]=-1;xe[37]=xe[133]=0;Ee[37]=Ee[133]=0;Me[37]=Me[133]=1;Se[37]=Se[133]=0;we[37]=we[133]=0;Oe[148]=Oe[22]=-1;De[148]=De[22]=0;Fe[148]=Fe[22]=0;ke[148]=ke[22]=0;Ge[148]=Ge[22]=-1;Ve[148]=Ve[22]=1;Ue[148]=Ue[22]=0;Be[148]=Be[22]=1;ze[148]=ze[22]=1;Me[148]=Me[22]=-1;Se[148]=Se[22]=0;we[148]=we[22]=1;be[82]=be[88]=0;Te[82]=Te[88]=-1;Ae[82]=Ae[88]=1;Oe[82]=Oe[88]=1;De[82]=De[88]=0;Fe[82]=Fe[88]=1;Re[82]=Re[88]=-1;Le[82]=Le[88]=0;Ne[82]=Ne[88]=1;Ue[82]=Ue[88]=0;Be[82]=Be[88]=-1;ze[82]=ze[88]=0;be[73]=be[97]=0;Te[73]=Te[97]=1;Ae[73]=Ae[97]=0;Ce[73]=Ce[97]=0;Pe[73]=Pe[97]=-1;Ie[73]=Ie[97]=0;Re[73]=Re[97]=1;Le[73]=Le[97]=0;Ne[73]=Ne[97]=0;_e[73]=_e[97]=1;xe[73]=xe[97]=0;Ee[73]=Ee[97]=1;be[145]=be[25]=0;Te[145]=Te[25]=-1;Ae[145]=Ae[25]=0;Re[145]=Re[25]=1;Le[145]=Le[25]=0;Ne[145]=Ne[25]=1;ke[145]=ke[25]=0;Ge[145]=Ge[25]=1;Ve[145]=Ve[25]=1;Me[145]=Me[25]=-1;Se[145]=Se[25]=0;we[145]=we[25]=0;Ce[70]=Ce[100]=0;Pe[70]=Pe[100]=1;Ie[70]=Ie[100]=0;Oe[70]=Oe[100]=-1;De[70]=De[100]=0;Fe[70]=Fe[100]=1;Ue[70]=Ue[100]=0;Be[70]=Be[100]=-1;ze[70]=ze[100]=1;_e[70]=_e[100]=1;xe[70]=xe[100]=0;Ee[70]=Ee[100]=0;Ce[101]=Ce[69]=0;Pe[101]=Pe[69]=1;Ie[101]=Ie[69]=0;_e[101]=_e[69]=1;xe[101]=xe[69]=0;Ee[101]=Ee[69]=0;ke[149]=ke[21]=0;Ge[149]=Ge[21]=1;Ve[149]=Ve[21]=1;Me[149]=Me[21]=-1;Se[149]=Se[21]=0;we[149]=we[21]=0;Oe[86]=Oe[84]=-1;De[86]=De[84]=0;Fe[86]=Fe[84]=1;Ue[86]=Ue[84]=0;Be[86]=Be[84]=-1;ze[86]=ze[84]=1;be[89]=be[81]=0;Te[89]=Te[81]=-1;Ae[89]=Ae[81]=0;Re[89]=Re[81]=1;Le[89]=Le[81]=0;Ne[89]=Ne[81]=1;be[96]=be[74]=0;Te[96]=Te[74]=1;Ae[96]=Ae[74]=0;Ce[96]=Ce[74]=-1;Pe[96]=Pe[74]=0;Ie[96]=Ie[74]=1;Ue[96]=Ue[74]=1;Be[96]=Be[74]=0;ze[96]=ze[74]=0;_e[96]=_e[74]=1;xe[96]=xe[74]=0;Ee[96]=Ee[74]=1;be[24]=be[146]=0;Te[24]=Te[146]=-1;Ae[24]=Ae[146]=1;Oe[24]=Oe[146]=1;De[24]=De[146]=0;Fe[24]=Fe[146]=1;Re[24]=Re[146]=0;Le[24]=Le[146]=1;Ne[24]=Ne[146]=1;Me[24]=Me[146]=0;Se[24]=Se[146]=-1;we[24]=we[146]=0;Ce[6]=Ce[164]=-1;Pe[6]=Pe[164]=0;Ie[6]=Ie[164]=1;Oe[6]=Oe[164]=-1;De[6]=De[164]=0;Fe[6]=Fe[164]=0;ke[6]=ke[164]=0;Ge[6]=Ge[164]=-1;Ve[6]=Ve[164]=1;Ue[6]=Ue[164]=1;Be[6]=Be[164]=0;ze[6]=ze[164]=0;Re[129]=Re[41]=0;Le[129]=Le[41]=1;Ne[129]=Ne[41]=1;ke[129]=ke[41]=0;Ge[129]=Ge[41]=1;Ve[129]=Ve[41]=0;_e[129]=_e[41]=-1;xe[129]=xe[41]=0;Ee[129]=Ee[41]=0;Me[129]=Me[41]=0;Se[129]=Se[41]=-1;we[129]=we[41]=0;Oe[66]=Oe[104]=0;De[66]=De[104]=1;Fe[66]=Fe[104]=0;Re[66]=Re[104]=-1;Le[66]=Le[104]=0;Ne[66]=Ne[104]=1;Ue[66]=Ue[104]=0;Be[66]=Be[104]=-1;ze[66]=ze[104]=0;_e[66]=_e[104]=0;xe[66]=xe[104]=-1;Ee[66]=Ee[104]=1;be[144]=be[26]=-1;Te[144]=Te[26]=0;Ae[144]=Ae[26]=0;ke[144]=ke[26]=1;Ge[144]=Ge[26]=0;Ve[144]=Ve[26]=1;Ue[144]=Ue[26]=0;Be[144]=Be[26]=1;ze[144]=ze[26]=1;Me[144]=Me[26]=-1;Se[144]=Se[26]=0;we[144]=we[26]=1;Ce[36]=Ce[134]=0;Pe[36]=Pe[134]=1;Ie[36]=Ie[134]=1;Oe[36]=Oe[134]=0;De[36]=De[134]=1;Fe[36]=Fe[134]=0;_e[36]=_e[134]=0;xe[36]=xe[134]=-1;Ee[36]=Ee[134]=1;Me[36]=Me[134]=1;Se[36]=Se[134]=0;we[36]=we[134]=0;be[9]=be[161]=-1;Te[9]=Te[161]=0;Ae[9]=Ae[161]=0;Ce[9]=Ce[161]=0;Pe[9]=Pe[161]=-1;Ie[9]=Ie[161]=0;Re[9]=Re[161]=1;Le[9]=Le[161]=0;Ne[9]=Ne[161]=0;ke[9]=ke[161]=1;Ge[9]=Ge[161]=0;Ve[9]=Ve[161]=1;be[136]=0;Te[136]=1;Ae[136]=1;Ce[136]=0;Pe[136]=1;Ie[136]=0;Oe[136]=-1;De[136]=0;Fe[136]=1;Re[136]=-1;Le[136]=0;Ne[136]=0;ke[136]=0;Ge[136]=-1;Ve[136]=0;Ue[136]=0;Be[136]=-1;ze[136]=1;_e[136]=1;xe[136]=0;Ee[136]=0;Me[136]=1;Se[136]=0;we[136]=1;be[34]=0;Te[34]=-1;Ae[34]=0;Ce[34]=0;Pe[34]=-1;Ie[34]=1;Oe[34]=1;De[34]=0;Fe[34]=0;Re[34]=1;Le[34]=0;Ne[34]=1;ke[34]=0;Ge[34]=1;Ve[34]=1;Ue[34]=0;Be[34]=1;ze[34]=0;_e[34]=-1;xe[34]=0;Ee[34]=1;Me[34]=-1;Se[34]=0;we[34]=0;be[35]=0;Te[35]=1;Ae[35]=1;Ce[35]=0;Pe[35]=-1;Ie[35]=1;Oe[35]=1;De[35]=0;Fe[35]=0;Re[35]=-1;Le[35]=0;Ne[35]=0;ke[35]=0;Ge[35]=-1;Ve[35]=0;Ue[35]=0;Be[35]=1;ze[35]=0;_e[35]=-1;xe[35]=0;Ee[35]=1;Me[35]=1;Se[35]=0;we[35]=1;be[153]=0;Te[153]=1;Ae[153]=1;Re[153]=-1;Le[153]=0;Ne[153]=0;ke[153]=0;Ge[153]=-1;Ve[153]=0;Me[153]=1;Se[153]=0;we[153]=1;Ce[102]=0;Pe[102]=-1;Ie[102]=1;Oe[102]=1;De[102]=0;Fe[102]=0;Ue[102]=0;Be[102]=1;ze[102]=0;_e[102]=-1;xe[102]=0;Ee[102]=1;be[155]=0;Te[155]=-1;Ae[155]=0;Re[155]=1;Le[155]=0;Ne[155]=1;ke[155]=0;Ge[155]=1;Ve[155]=1;Me[155]=-1;Se[155]=0;we[155]=0;Ce[103]=0;Pe[103]=1;Ie[103]=0;Oe[103]=-1;De[103]=0;Fe[103]=1;Ue[103]=0;Be[103]=-1;ze[103]=1;_e[103]=1;xe[103]=0;Ee[103]=0;be[152]=0;Te[152]=1;Ae[152]=1;Oe[152]=-1;De[152]=0;Fe[152]=1;Re[152]=-1;Le[152]=0;Ne[152]=0;ke[152]=0;Ge[152]=-1;Ve[152]=0;Ue[152]=0;Be[152]=-1;ze[152]=1;Me[152]=1;Se[152]=0;we[152]=1;be[156]=0;Te[156]=-1;Ae[156]=1;Oe[156]=1;De[156]=0;Fe[156]=1;Re[156]=-1;Le[156]=0;Ne[156]=0;ke[156]=0;Ge[156]=-1;Ve[156]=0;Ue[156]=0;Be[156]=1;ze[156]=1;Me[156]=-1;Se[156]=0;we[156]=1;be[137]=0;Te[137]=1;Ae[137]=1;Ce[137]=0;Pe[137]=1;Ie[137]=0;Re[137]=-1;Le[137]=0;Ne[137]=0;ke[137]=0;Ge[137]=-1;Ve[137]=0;_e[137]=1;xe[137]=0;Ee[137]=0;Me[137]=1;Se[137]=0;we[137]=1;be[139]=0;Te[139]=1;Ae[139]=1;Ce[139]=0;Pe[139]=-1;Ie[139]=0;Re[139]=1;Le[139]=0;Ne[139]=0;ke[139]=0;Ge[139]=1;Ve[139]=0;_e[139]=-1;xe[139]=0;Ee[139]=0;Me[139]=1;Se[139]=0;we[139]=1;be[98]=0;Te[98]=-1;Ae[98]=0;Ce[98]=0;Pe[98]=-1;Ie[98]=1;Oe[98]=1;De[98]=0;Fe[98]=0;Re[98]=1;Le[98]=0;Ne[98]=1;Ue[98]=0;Be[98]=1;ze[98]=0;_e[98]=-1;xe[98]=0;Ee[98]=1;be[99]=0;Te[99]=1;Ae[99]=0;Ce[99]=0;Pe[99]=-1;Ie[99]=1;Oe[99]=1;De[99]=0;Fe[99]=0;Re[99]=-1;Le[99]=0;Ne[99]=1;Ue[99]=0;Be[99]=-1;ze[99]=0;_e[99]=1;xe[99]=0;Ee[99]=1;Ce[38]=0;Pe[38]=-1;Ie[38]=1;Oe[38]=1;De[38]=0;Fe[38]=0;ke[38]=0;Ge[38]=1;Ve[38]=1;Ue[38]=0;Be[38]=1;ze[38]=0;_e[38]=-1;xe[38]=0;Ee[38]=1;Me[38]=-1;Se[38]=0;we[38]=0;Ce[39]=0;Pe[39]=1;Ie[39]=1;Oe[39]=-1;De[39]=0;Fe[39]=0;ke[39]=0;Ge[39]=-1;Ve[39]=1;Ue[39]=0;Be[39]=1;ze[39]=0;_e[39]=-1;xe[39]=0;Ee[39]=1;Me[39]=1;Se[39]=0;we[39]=0;var id=function(r){return[[r.bottomleft,0],[0,0],[0,r.leftbottom]]},od=function(r){return[[1,r.rightbottom],[1,0],[r.bottomright,0]]},sd=function(r){return[[r.topright,1],[1,1],[1,r.righttop]]},ad=function(r){return[[0,r.lefttop],[0,1],[r.topleft,1]]},ud=function(r){return[[r.bottomright,0],[r.bottomleft,0],[0,r.leftbottom],[0,r.lefttop]]},ld=function(r){return[[r.bottomright,0],[r.bottomleft,0],[1,r.righttop],[1,r.rightbottom]]},cd=function(r){return[[1,r.righttop],[1,r.rightbottom],[r.topleft,1],[r.topright,1]]},fd=function(r){return[[0,r.leftbottom],[0,r.lefttop],[r.topleft,1],[r.topright,1]]},qC=function(r){return[[0,0],[0,r.leftbottom],[1,r.rightbottom],[1,0]]},XC=function(r){return[[1,0],[r.bottomright,0],[r.topright,1],[1,1]]},YC=function(r){return[[1,1],[1,r.righttop],[0,r.lefttop],[0,1]]},ZC=function(r){return[[r.bottomleft,0],[0,0],[0,1],[r.topleft,1]]},JC=function(r){return[[1,r.righttop],[1,r.rightbottom],[0,r.leftbottom],[0,r.lefttop]]},$C=function(r){return[[r.topleft,1],[r.topright,1],[r.bottomright,0],[r.bottomleft,0]]},KC=function(){return[[0,0],[0,1],[1,1],[1,0]]},jC=function(r){return[[1,r.rightbottom],[1,0],[0,0],[0,1],[r.topleft,1]]},QC=function(r){return[[r.topright,1],[1,1],[1,0],[0,0],[0,r.leftbottom]]},tP=function(r){return[[1,0],[r.bottomright,0],[0,r.lefttop],[0,1],[1,1]]},eP=function(r){return[[1,1],[1,r.righttop],[r.bottomleft,0],[0,0],[0,1]]},nP=function(r){return[[1,r.righttop],[1,r.rightbottom],[0,r.lefttop],[0,1],[r.topleft,1]]},rP=function(r){return[[1,1],[1,r.righttop],[r.bottomright,0],[r.bottomleft,0],[r.topright,1]]},iP=function(r){return[[1,r.rightbottom],[1,0],[r.bottomright,0],[0,r.leftbottom],[0,r.lefttop]]},oP=function(r){return[[r.topright,1],[r.bottomleft,0],[0,0],[0,r.leftbottom],[r.topleft,1]]},sP=function(r){return[[r.bottomright,0],[r.bottomleft,0],[0,r.lefttop],[0,1],[r.topleft,1]]},aP=function(r){return[[1,1],[1,r.righttop],[0,r.leftbottom],[0,r.lefttop],[r.topright,1]]},uP=function(r){return[[1,r.rightbottom],[1,0],[r.bottomright,0],[r.topleft,1],[r.topright,1]]},lP=function(r){return[[1,r.righttop],[1,r.rightbottom],[r.bottomleft,0],[0,0],[0,r.leftbottom]]},cP=function(r){return[[1,r.rightbottom],[1,0],[0,0],[0,r.leftbottom],[r.topleft,1],[r.topright,1]]},fP=function(r){return[[1,1],[1,0],[r.bottomright,0],[0,r.leftbottom],[0,r.lefttop],[r.topright,1]]},hP=function(r){return[[1,1],[1,r.righttop],[r.bottomright,0],[r.bottomleft,0],[0,r.lefttop],[0,1]]},pP=function(r){return[[1,r.righttop],[1,r.rightbottom],[r.bottomleft,0],[0,0],[0,1],[r.topleft,1]]},dP=function(r){return[[1,1],[1,r.righttop],[r.bottomleft,0],[0,0],[0,r.leftbottom],[r.topright,1]]},mP=function(r){return[[1,r.rightbottom],[1,0],[r.bottomright,0],[0,r.lefttop],[0,1],[r.topleft,1]]},gP=function(r){return[[1,r.righttop],[1,r.rightbottom],[r.bottomright,0],[r.bottomleft,0],[0,r.leftbottom],[0,r.lefttop],[r.topleft,1],[r.topright,1]]},yP=function(r){return[[1,1],[1,r.righttop],[r.bottomleft,0],[0,0],[0,r.leftbottom],[r.topright,1]]},vP=function(r){return[[1,r.rightbottom],[1,0],[r.bottomright,0],[0,r.lefttop],[0,1],[r.topleft,1]]},_P=function(r){return[[1,1],[1,r.righttop],[r.bottomright,0],[r.bottomleft,0],[0,r.leftbottom],[0,r.lefttop],[r.topright,1]]},xP=function(r){return[[1,r.righttop],[1,r.rightbottom],[r.bottomleft,0],[0,0],[0,r.leftbottom],[r.topleft,1],[r.topright,1]]},EP=function(r){return[[1,r.righttop],[1,r.rightbottom],[r.bottomright,0],[r.bottomleft,0],[0,r.lefttop],[0,1],[r.topleft,1]]},MP=function(r){return[[1,r.rightbottom],[1,0],[r.bottomright,0],[0,r.leftbottom],[0,r.lefttop],[r.topleft,1],[r.topright,1]]},Xe=[],Ye=[],Ze=[],Je=[],$e=[],Ke=[],je=[],Qe=[];Je[1]=$e[1]=18;Je[169]=$e[169]=18;Ze[4]=Ye[4]=12;Ze[166]=Ye[166]=12;Xe[16]=Qe[16]=4;Xe[154]=Qe[154]=4;Ke[64]=je[64]=22;Ke[106]=je[106]=22;Ze[2]=Ke[2]=17;Je[2]=$e[2]=18;Ze[168]=Ke[168]=17;Je[168]=$e[168]=18;Xe[8]=Je[8]=9;Ye[8]=Ze[8]=12;Xe[162]=Je[162]=9;Ye[162]=Ze[162]=12;Xe[32]=Qe[32]=4;Ye[32]=je[32]=1;Xe[138]=Qe[138]=4;Ye[138]=je[138]=1;$e[128]=Qe[128]=21;Ke[128]=je[128]=22;$e[42]=Qe[42]=21;Ke[42]=je[42]=22;Ye[5]=$e[5]=14;Ye[165]=$e[165]=14;Ze[20]=Qe[20]=6;Ze[150]=Qe[150]=6;Xe[80]=Ke[80]=11;Xe[90]=Ke[90]=11;Je[65]=je[65]=3;Je[105]=je[105]=3;Xe[160]=Ke[160]=11;Ye[160]=$e[160]=14;Xe[10]=Ke[10]=11;Ye[10]=$e[10]=14;Ze[130]=Qe[130]=6;Je[130]=je[130]=3;Ze[40]=Qe[40]=6;Je[40]=je[40]=3;Ye[101]=je[101]=1;Ye[69]=je[69]=1;$e[149]=Qe[149]=21;$e[21]=Qe[21]=21;Ze[86]=Ke[86]=17;Ze[84]=Ke[84]=17;Xe[89]=Je[89]=9;Xe[81]=Je[81]=9;Xe[96]=je[96]=0;Ye[96]=Ke[96]=15;Xe[74]=je[74]=0;Ye[74]=Ke[74]=15;Xe[24]=Ze[24]=8;Je[24]=Qe[24]=7;Xe[146]=Ze[146]=8;Je[146]=Qe[146]=7;Ye[6]=Ke[6]=15;Ze[6]=$e[6]=16;Ye[164]=Ke[164]=15;Ze[164]=$e[164]=16;Je[129]=Qe[129]=7;$e[129]=je[129]=20;Je[41]=Qe[41]=7;$e[41]=je[41]=20;Ze[66]=je[66]=2;Je[66]=Ke[66]=19;Ze[104]=je[104]=2;Je[104]=Ke[104]=19;Xe[144]=$e[144]=10;Ke[144]=Qe[144]=23;Xe[26]=$e[26]=10;Ke[26]=Qe[26]=23;Ye[36]=Qe[36]=5;Ze[36]=je[36]=2;Ye[134]=Qe[134]=5;Ze[134]=je[134]=2;Xe[9]=$e[9]=10;Ye[9]=Je[9]=13;Xe[161]=$e[161]=10;Ye[161]=Je[161]=13;Ye[37]=Qe[37]=5;$e[37]=je[37]=20;Ye[133]=Qe[133]=5;$e[133]=je[133]=20;Ze[148]=$e[148]=16;Ke[148]=Qe[148]=23;Ze[22]=$e[22]=16;Ke[22]=Qe[22]=23;Xe[82]=Ze[82]=8;Je[82]=Ke[82]=19;Xe[88]=Ze[88]=8;Je[88]=Ke[88]=19;Xe[73]=je[73]=0;Ye[73]=Je[73]=13;Xe[97]=je[97]=0;Ye[97]=Je[97]=13;Xe[145]=Je[145]=9;$e[145]=Qe[145]=21;Xe[25]=Je[25]=9;$e[25]=Qe[25]=21;Ye[70]=je[70]=1;Ze[70]=Ke[70]=17;Ye[100]=je[100]=1;Ze[100]=Ke[100]=17;Xe[34]=Je[34]=9;Ye[34]=Ze[34]=12;$e[34]=Qe[34]=21;Ke[34]=je[34]=22;Xe[136]=Qe[136]=4;Ye[136]=je[136]=1;Ze[136]=Ke[136]=17;Je[136]=$e[136]=18;Xe[35]=Qe[35]=4;Ye[35]=Ze[35]=12;Je[35]=$e[35]=18;Ke[35]=je[35]=22;Xe[153]=Qe[153]=4;Je[153]=$e[153]=18;Ye[102]=Ze[102]=12;Ke[102]=je[102]=22;Xe[155]=Je[155]=9;$e[155]=Qe[155]=23;Ye[103]=je[103]=1;Ze[103]=Ke[103]=17;Xe[152]=Qe[152]=4;Ze[152]=Ke[152]=17;Je[152]=$e[152]=18;Xe[156]=Ze[156]=8;Je[156]=$e[156]=18;Ke[156]=Qe[156]=23;Xe[137]=Qe[137]=4;Ye[137]=je[137]=1;Je[137]=$e[137]=18;Xe[139]=Qe[139]=4;Ye[139]=Je[139]=13;$e[139]=je[139]=20;Xe[98]=Je[98]=9;Ye[98]=Ze[98]=12;Ke[98]=je[98]=22;Xe[99]=je[99]=0;Ye[99]=Ze[99]=12;Je[99]=Ke[99]=19;Ye[38]=Ze[38]=12;$e[38]=Qe[38]=21;Ke[38]=je[38]=22;Ye[39]=Qe[39]=5;Ze[39]=$e[39]=16;Ke[39]=je[39]=22;var Ft=[];Ft[1]=Ft[169]=id;Ft[4]=Ft[166]=od;Ft[16]=Ft[154]=sd;Ft[64]=Ft[106]=ad;Ft[168]=Ft[2]=ud;Ft[162]=Ft[8]=ld;Ft[138]=Ft[32]=cd;Ft[42]=Ft[128]=fd;Ft[5]=Ft[165]=qC;Ft[20]=Ft[150]=XC;Ft[80]=Ft[90]=YC;Ft[65]=Ft[105]=ZC;Ft[160]=Ft[10]=JC;Ft[130]=Ft[40]=$C;Ft[85]=KC;Ft[101]=Ft[69]=jC;Ft[149]=Ft[21]=QC;Ft[86]=Ft[84]=tP;Ft[89]=Ft[81]=eP;Ft[96]=Ft[74]=nP;Ft[24]=Ft[146]=rP;Ft[6]=Ft[164]=iP;Ft[129]=Ft[41]=oP;Ft[66]=Ft[104]=sP;Ft[144]=Ft[26]=aP;Ft[36]=Ft[134]=uP;Ft[9]=Ft[161]=lP;Ft[37]=Ft[133]=cP;Ft[148]=Ft[22]=fP;Ft[82]=Ft[88]=hP;Ft[73]=Ft[97]=pP;Ft[145]=Ft[25]=dP;Ft[70]=Ft[100]=mP;Ft[34]=function(r){return[fd(r),ld(r)]};Ft[35]=gP;Ft[136]=function(r){return[cd(r),ud(r)]};Ft[153]=function(r){return[sd(r),id(r)]};Ft[102]=function(r){return[od(r),ad(r)]};Ft[155]=yP;Ft[103]=vP;Ft[152]=function(r){return[sd(r),ud(r)]};Ft[156]=_P;Ft[137]=function(r){return[cd(r),id(r)]};Ft[139]=xP;Ft[98]=function(r){return[ld(r),ad(r)]};Ft[99]=EP;Ft[38]=function(r){return[od(r),fd(r)]};Ft[39]=MP;function wP(r){return(r>0)-(r<0)||+r}function au(r,t,e){var o=t[0]-r[0],a=t[1]-r[1],l=e[0]-t[0],f=e[1]-t[1];return wP(o*f-l*a)}function u_(r,t){var e=r.geometry.coordinates[0].map(function(f){return f[0]}),o=r.geometry.coordinates[0].map(function(f){return f[1]}),a=t.geometry.coordinates[0].map(function(f){return f[0]}),l=t.geometry.coordinates[0].map(function(f){return f[1]});return Math.max.apply(null,e)===Math.max.apply(null,a)&&Math.max.apply(null,o)===Math.max.apply(null,l)&&Math.min.apply(null,e)===Math.min.apply(null,a)&&Math.min.apply(null,o)===Math.min.apply(null,l)}function hd(r,t){return t.geometry.coordinates[0].every(function(e){return yr(Sn(e),r)})}function l_(r,t){return r[0]===t[0]&&r[1]===t[1]}var bP=function(){function r(t){this.id=r.buildId(t),this.coordinates=t,this.innerEdges=[],this.outerEdges=[],this.outerEdgesSorted=!1}return r.buildId=function(t){return t.join(",")},r.prototype.removeInnerEdge=function(t){this.innerEdges=this.innerEdges.filter(function(e){return e.from.id!==t.from.id})},r.prototype.removeOuterEdge=function(t){this.outerEdges=this.outerEdges.filter(function(e){return e.to.id!==t.to.id})},r.prototype.addOuterEdge=function(t){this.outerEdges.push(t),this.outerEdgesSorted=!1},r.prototype.sortOuterEdges=function(){var t=this;this.outerEdgesSorted||(this.outerEdges.sort(function(e,o){var a=e.to,l=o.to;if(a.coordinates[0]-t.coordinates[0]>=0&&l.coordinates[0]-t.coordinates[0]<0)return 1;if(a.coordinates[0]-t.coordinates[0]<0&&l.coordinates[0]-t.coordinates[0]>=0)return-1;if(a.coordinates[0]-t.coordinates[0]===0&&l.coordinates[0]-t.coordinates[0]===0)return a.coordinates[1]-t.coordinates[1]>=0||l.coordinates[1]-t.coordinates[1]>=0?a.coordinates[1]-l.coordinates[1]:l.coordinates[1]-a.coordinates[1];var f=au(t.coordinates,a.coordinates,l.coordinates);if(f<0)return 1;if(f>0)return-1;var h=Math.pow(a.coordinates[0]-t.coordinates[0],2)+Math.pow(a.coordinates[1]-t.coordinates[1],2),p=Math.pow(l.coordinates[0]-t.coordinates[0],2)+Math.pow(l.coordinates[1]-t.coordinates[1],2);return h-p}),this.outerEdgesSorted=!0)},r.prototype.getOuterEdges=function(){return this.sortOuterEdges(),this.outerEdges},r.prototype.getOuterEdge=function(t){return this.sortOuterEdges(),this.outerEdges[t]},r.prototype.addInnerEdge=function(t){this.innerEdges.push(t)},r}(),pd=bP;var TP=function(){function r(t,e){this.from=t,this.to=e,this.next=void 0,this.label=void 0,this.symetric=void 0,this.ring=void 0,this.from.addOuterEdge(this),this.to.addInnerEdge(this)}return r.prototype.getSymetric=function(){return this.symetric||(this.symetric=new r(this.to,this.from),this.symetric.symetric=this),this.symetric},r.prototype.deleteEdge=function(){this.from.removeOuterEdge(this),this.to.removeInnerEdge(this)},r.prototype.isEqual=function(t){return this.from.id===t.from.id&&this.to.id===t.to.id},r.prototype.toString=function(){return"Edge { "+this.from.id+" -> "+this.to.id+" }"},r.prototype.toLineString=function(){return gr([this.from.coordinates,this.to.coordinates])},r.prototype.compareTo=function(t){return au(t.from.coordinates,t.to.coordinates,this.to.coordinates)},r}(),c_=TP;var AP=function(){function r(){this.edges=[],this.polygon=void 0,this.envelope=void 0}return r.prototype.push=function(t){this.edges.push(t),this.polygon=this.envelope=void 0},r.prototype.get=function(t){return this.edges[t]},Object.defineProperty(r.prototype,"length",{get:function(){return this.edges.length},enumerable:!0,configurable:!0}),r.prototype.forEach=function(t){this.edges.forEach(t)},r.prototype.map=function(t){return this.edges.map(t)},r.prototype.some=function(t){return this.edges.some(t)},r.prototype.isValid=function(){return!0},r.prototype.isHole=function(){var t=this,e=this.edges.reduce(function(f,h,p){return h.from.coordinates[1]>t.edges[f].from.coordinates[1]&&(f=p),f},0),o=(e===0?this.length:e)-1,a=(e+1)%this.length,l=au(this.edges[o].from.coordinates,this.edges[e].from.coordinates,this.edges[a].from.coordinates);return l===0?this.edges[o].from.coordinates[0]>this.edges[a].from.coordinates[0]:l>0},r.prototype.toMultiPoint=function(){return $h(this.edges.map(function(t){return t.from.coordinates}))},r.prototype.toPolygon=function(){if(this.polygon)return this.polygon;var t=this.edges.map(function(e){return e.from.coordinates});return t.push(this.edges[0].from.coordinates),this.polygon=Ln([t])},r.prototype.getEnvelope=function(){return this.envelope?this.envelope:this.envelope=mp(this.toPolygon())},r.findEdgeRingContaining=function(t,e){var o=t.getEnvelope(),a,l;return e.forEach(function(f){var h=f.getEnvelope();if(l&&(a=l.getEnvelope()),!u_(h,o)&&hd(h,o)){for(var p=t.map(function(w){return w.from.coordinates}),d=void 0,g=function(w){f.some(function(A){return l_(w,A.from.coordinates)})||(d=w)},_=0,y=p;_<y.length;_++){var M=y[_];g(M)}d&&f.inside(Sn(d))&&(!l||hd(a,h))&&(l=f)}}),l},r.prototype.inside=function(t){return yr(t,this.toPolygon())},r}(),dd=AP;function CP(r){if(!r)throw new Error("No geojson passed");if(r.type!=="FeatureCollection"&&r.type!=="GeometryCollection"&&r.type!=="MultiLineString"&&r.type!=="LineString"&&r.type!=="Feature")throw new Error("Invalid input type \'"+r.type+"\'. Geojson must be FeatureCollection, GeometryCollection, LineString, MultiLineString or Feature")}var jU=function(){function r(){this.edges=[],this.nodes={}}return r.fromGeoJson=function(t){CP(t);var e=new r;return Ei(t,function(o){jh(o,"LineString","Graph::fromGeoJson"),g0(o,function(a,l){if(a){var f=e.getNode(a),h=e.getNode(l);e.addEdge(f,h)}return l})}),e},r.prototype.getNode=function(t){var e=pd.buildId(t),o=this.nodes[e];return o||(o=this.nodes[e]=new pd(t)),o},r.prototype.addEdge=function(t,e){var o=new c_(t,e),a=o.getSymetric();this.edges.push(o),this.edges.push(a)},r.prototype.deleteDangles=function(){var t=this;Object.keys(this.nodes).map(function(e){return t.nodes[e]}).forEach(function(e){return t._removeIfDangle(e)})},r.prototype._removeIfDangle=function(t){var e=this;if(t.innerEdges.length<=1){var o=t.getOuterEdges().map(function(a){return a.to});this.removeNode(t),o.forEach(function(a){return e._removeIfDangle(a)})}},r.prototype.deleteCutEdges=function(){var t=this;this._computeNextCWEdges(),this._findLabeledEdgeRings(),this.edges.forEach(function(e){e.label===e.symetric.label&&(t.removeEdge(e.symetric),t.removeEdge(e))})},r.prototype._computeNextCWEdges=function(t){var e=this;typeof t=="undefined"?Object.keys(this.nodes).forEach(function(o){return e._computeNextCWEdges(e.nodes[o])}):t.getOuterEdges().forEach(function(o,a){t.getOuterEdge((a===0?t.getOuterEdges().length:a)-1).symetric.next=o})},r.prototype._computeNextCCWEdges=function(t,e){for(var o=t.getOuterEdges(),a,l,f=o.length-1;f>=0;--f){var h=o[f],p=h.symetric,d=void 0,g=void 0;h.label===e&&(d=h),p.label===e&&(g=p),!(!d||!g)&&(g&&(l=g),d&&(l&&(l.next=d,l=void 0),a||(a=d)))}l&&(l.next=a)},r.prototype._findLabeledEdgeRings=function(){var t=[],e=0;return this.edges.forEach(function(o){if(!(o.label>=0)){t.push(o);var a=o;do a.label=e,a=a.next;while(!o.isEqual(a));e++}}),t},r.prototype.getEdgeRings=function(){var t=this;this._computeNextCWEdges(),this.edges.forEach(function(o){o.label=void 0}),this._findLabeledEdgeRings().forEach(function(o){t._findIntersectionNodes(o).forEach(function(a){t._computeNextCCWEdges(a,o.label)})});var e=[];return this.edges.forEach(function(o){o.ring||e.push(t._findEdgeRing(o))}),e},r.prototype._findIntersectionNodes=function(t){var e=[],o=t,a=function(){var l=0;o.from.getOuterEdges().forEach(function(f){f.label===t.label&&++l}),l>1&&e.push(o.from),o=o.next};do a();while(!t.isEqual(o));return e},r.prototype._findEdgeRing=function(t){var e=t,o=new dd;do o.push(e),e.ring=o,e=e.next;while(!t.isEqual(e));return o},r.prototype.removeNode=function(t){var e=this;t.getOuterEdges().forEach(function(o){return e.removeEdge(o)}),t.innerEdges.forEach(function(o){return e.removeEdge(o)}),delete this.nodes[t.id]},r.prototype.removeEdge=function(t){this.edges=this.edges.filter(function(e){return!e.isEqual(t)}),t.deleteEdge()},r}();var LP=Un(md(),1);var NP=Un(md(),1);var DP=Un(__(),1);var VP=Un(P_(),1);function R_(r){for(var t=r,e=[];t.parent;)e.unshift(t),t=t.parent;return e}function WP(){return new L_(function(r){return r.f})}var _d={search:function(r,t,e,o){r.cleanDirty(),o=o||{};var a=o.heuristic||_d.heuristics.manhattan,l=o.closest||!1,f=WP(),h=t;for(t.h=a(t,e),f.push(t);f.size()>0;){var p=f.pop();if(p===e)return R_(p);p.closed=!0;for(var d=r.neighbors(p),g=0,_=d.length;g<_;++g){var y=d[g];if(!(y.closed||y.isWall())){var M=p.g+y.getCost(p),w=y.visited;(!w||M<y.g)&&(y.visited=!0,y.parent=p,y.h=y.h||a(y,e),y.g=M,y.f=y.g+y.h,r.markDirty(y),l&&(y.h<h.h||y.h===h.h&&y.g<h.g)&&(h=y),w?f.rescoreElement(y):f.push(y))}}}return l?R_(h):[]},heuristics:{manhattan:function(r,t){var e=Math.abs(t.x-r.x),o=Math.abs(t.y-r.y);return e+o},diagonal:function(r,t){var e=1,o=Math.sqrt(2),a=Math.abs(t.x-r.x),l=Math.abs(t.y-r.y);return e*(a+l)+(o-2*e)*Math.min(a,l)}},cleanNode:function(r){r.f=0,r.g=0,r.h=0,r.visited=!1,r.closed=!1,r.parent=null}};function ol(r,t){t=t||{},this.nodes=[],this.diagonal=!!t.diagonal,this.grid=[];for(var e=0;e<r.length;e++){this.grid[e]=[];for(var o=0,a=r[e];o<a.length;o++){var l=new ef(e,o,a[o]);this.grid[e][o]=l,this.nodes.push(l)}}this.init()}ol.prototype.init=function(){this.dirtyNodes=[];for(var r=0;r<this.nodes.length;r++)_d.cleanNode(this.nodes[r])};ol.prototype.cleanDirty=function(){for(var r=0;r<this.dirtyNodes.length;r++)_d.cleanNode(this.dirtyNodes[r]);this.dirtyNodes=[]};ol.prototype.markDirty=function(r){this.dirtyNodes.push(r)};ol.prototype.neighbors=function(r){var t=[],e=r.x,o=r.y,a=this.grid;return a[e-1]&&a[e-1][o]&&t.push(a[e-1][o]),a[e+1]&&a[e+1][o]&&t.push(a[e+1][o]),a[e]&&a[e][o-1]&&t.push(a[e][o-1]),a[e]&&a[e][o+1]&&t.push(a[e][o+1]),this.diagonal&&(a[e-1]&&a[e-1][o-1]&&t.push(a[e-1][o-1]),a[e+1]&&a[e+1][o-1]&&t.push(a[e+1][o-1]),a[e-1]&&a[e-1][o+1]&&t.push(a[e-1][o+1]),a[e+1]&&a[e+1][o+1]&&t.push(a[e+1][o+1])),t};ol.prototype.toString=function(){for(var r=[],t=this.grid,e,o,a,l,f=0,h=t.length;f<h;f++){for(e=[],o=t[f],a=0,l=o.length;a<l;a++)e.push(o[a].weight);r.push(e.join(" "))}return r.join(`\n`)};function ef(r,t,e){this.x=r,this.y=t,this.weight=e}ef.prototype.toString=function(){return"["+this.x+" "+this.y+"]"};ef.prototype.getCost=function(r){return r&&r.x!==this.x&&r.y!==this.y?this.weight*1.41421:this.weight};ef.prototype.isWall=function(){return this.weight===0};function L_(r){this.content=[],this.scoreFunction=r}L_.prototype={push:function(r){this.content.push(r),this.sinkDown(this.content.length-1)},pop:function(){var r=this.content[0],t=this.content.pop();return this.content.length>0&&(this.content[0]=t,this.bubbleUp(0)),r},remove:function(r){var t=this.content.indexOf(r),e=this.content.pop();t!==this.content.length-1&&(this.content[t]=e,this.scoreFunction(e)<this.scoreFunction(r)?this.sinkDown(t):this.bubbleUp(t))},size:function(){return this.content.length},rescoreElement:function(r){this.sinkDown(this.content.indexOf(r))},sinkDown:function(r){for(var t=this.content[r];r>0;){var e=(r+1>>1)-1,o=this.content[e];if(this.scoreFunction(t)<this.scoreFunction(o))this.content[e]=t,this.content[r]=o,r=e;else break}},bubbleUp:function(r){for(var t=this.content.length,e=this.content[r],o=this.scoreFunction(e);;){var a=r+1<<1,l=a-1,f=null,h;if(l<t){var p=this.content[l];h=this.scoreFunction(p),h<o&&(f=l)}if(a<t){var d=this.content[a],g=this.scoreFunction(d);g<(f===null?o:h)&&(f=a)}if(f!==null)this.content[r]=this.content[f],this.content[f]=e,r=f;else break}}};function xd(){this._=null}function lu(r){r.U=r.C=r.L=r.R=r.P=r.N=null}xd.prototype={constructor:xd,insert:function(r,t){var e,o,a;if(r){if(t.P=r,t.N=r.N,r.N&&(r.N.P=t),r.N=t,r.R){for(r=r.R;r.L;)r=r.L;r.L=t}else r.R=t;e=r}else this._?(r=N_(this._),t.P=null,t.N=r,r.P=r.L=t,e=r):(t.P=t.N=null,this._=t,e=null);for(t.L=t.R=null,t.U=e,t.C=!0,r=t;e&&e.C;)o=e.U,e===o.L?(a=o.R,a&&a.C?(e.C=a.C=!1,o.C=!0,r=o):(r===e.R&&(sl(this,e),r=e,e=r.U),e.C=!1,o.C=!0,al(this,o))):(a=o.L,a&&a.C?(e.C=a.C=!1,o.C=!0,r=o):(r===e.L&&(al(this,e),r=e,e=r.U),e.C=!1,o.C=!0,sl(this,o))),e=r.U;this._.C=!1},remove:function(r){r.N&&(r.N.P=r.P),r.P&&(r.P.N=r.N),r.N=r.P=null;var t=r.U,e,o=r.L,a=r.R,l,f;if(o?a?l=N_(a):l=o:l=a,t?t.L===r?t.L=l:t.R=l:this._=l,o&&a?(f=l.C,l.C=r.C,l.L=o,o.U=l,l!==a?(t=l.U,l.U=r.U,r=l.R,t.L=r,l.R=a,a.U=l):(l.U=t,t=l,r=l.R)):(f=r.C,r=l),r&&(r.U=t),!f){if(r&&r.C){r.C=!1;return}do{if(r===this._)break;if(r===t.L){if(e=t.R,e.C&&(e.C=!1,t.C=!0,sl(this,t),e=t.R),e.L&&e.L.C||e.R&&e.R.C){(!e.R||!e.R.C)&&(e.L.C=!1,e.C=!0,al(this,e),e=t.R),e.C=t.C,t.C=e.R.C=!1,sl(this,t),r=this._;break}}else if(e=t.L,e.C&&(e.C=!1,t.C=!0,al(this,t),e=t.L),e.L&&e.L.C||e.R&&e.R.C){(!e.L||!e.L.C)&&(e.R.C=!1,e.C=!0,sl(this,e),e=t.L),e.C=t.C,t.C=e.L.C=!1,al(this,t),r=this._;break}e.C=!0,r=t,t=t.U}while(!r.C);r&&(r.C=!1)}}};function sl(r,t){var e=t,o=t.R,a=e.U;a?a.L===e?a.L=o:a.R=o:r._=o,o.U=a,e.U=o,e.R=o.L,e.R&&(e.R.U=e),o.L=e}function al(r,t){var e=t,o=t.L,a=e.U;a?a.L===e?a.L=o:a.R=o:r._=o,o.U=a,e.U=o,e.L=o.R,e.L&&(e.L.U=e),o.R=e}function N_(r){for(;r.L;)r=r.L;return r}var Ed=xd;function cu(r,t,e,o){var a=[null,null],l=_r.push(a)-1;return a.left=r,a.right=t,e&&ul(a,r,t,e),o&&ul(a,t,r,o),Qr[r.index].halfedges.push(l),Qr[t.index].halfedges.push(l),a}function fu(r,t,e){var o=[t,e];return o.left=r,o}function ul(r,t,e,o){!r[0]&&!r[1]?(r[0]=o,r.left=t,r.right=e):r.left===e?r[1]=o:r[0]=o}function qP(r,t,e,o,a){var l=r[0],f=r[1],h=l[0],p=l[1],d=f[0],g=f[1],_=0,y=1,M=d-h,w=g-p,A;if(A=t-h,!(!M&&A>0)){if(A/=M,M<0){if(A<_)return;A<y&&(y=A)}else if(M>0){if(A>y)return;A>_&&(_=A)}if(A=o-h,!(!M&&A<0)){if(A/=M,M<0){if(A>y)return;A>_&&(_=A)}else if(M>0){if(A<_)return;A<y&&(y=A)}if(A=e-p,!(!w&&A>0)){if(A/=w,w<0){if(A<_)return;A<y&&(y=A)}else if(w>0){if(A>y)return;A>_&&(_=A)}if(A=a-p,!(!w&&A<0)){if(A/=w,w<0){if(A>y)return;A>_&&(_=A)}else if(w>0){if(A<_)return;A<y&&(y=A)}return!(_>0)&&!(y<1)||(_>0&&(r[0]=[h+_*M,p+_*w]),y<1&&(r[1]=[h+y*M,p+y*w])),!0}}}}}function XP(r,t,e,o,a){var l=r[1];if(l)return!0;var f=r[0],h=r.left,p=r.right,d=h[0],g=h[1],_=p[0],y=p[1],M=(d+_)/2,w=(g+y)/2,A,x;if(y===g){if(M<t||M>=o)return;if(d>_){if(!f)f=[M,e];else if(f[1]>=a)return;l=[M,a]}else{if(!f)f=[M,a];else if(f[1]<e)return;l=[M,e]}}else if(A=(d-_)/(y-g),x=w-A*M,A<-1||A>1)if(d>_){if(!f)f=[(e-x)/A,e];else if(f[1]>=a)return;l=[(a-x)/A,a]}else{if(!f)f=[(a-x)/A,a];else if(f[1]<e)return;l=[(e-x)/A,e]}else if(g<y){if(!f)f=[t,A*t+x];else if(f[0]>=o)return;l=[o,A*o+x]}else{if(!f)f=[o,A*o+x];else if(f[0]<t)return;l=[t,A*t+x]}return r[0]=f,r[1]=l,!0}function O_(r,t,e,o){for(var a=_r.length,l;a--;)(!XP(l=_r[a],r,t,e,o)||!qP(l,r,t,e,o)||!(Math.abs(l[0][0]-l[1][0])>yn||Math.abs(l[0][1]-l[1][1])>yn))&&delete _r[a]}function D_(r){return Qr[r.index]={site:r,halfedges:[]}}function YP(r,t){var e=r.site,o=t.left,a=t.right;return e===a&&(a=o,o=e),a?Math.atan2(a[1]-o[1],a[0]-o[0]):(e===o?(o=t[1],a=t[0]):(o=t[0],a=t[1]),Math.atan2(o[0]-a[0],a[1]-o[1]))}function Md(r,t){return t[+(t.left!==r.site)]}function ZP(r,t){return t[+(t.left===r.site)]}function F_(){for(var r=0,t=Qr.length,e,o,a,l;r<t;++r)if((e=Qr[r])&&(l=(o=e.halfedges).length)){var f=new Array(l),h=new Array(l);for(a=0;a<l;++a)f[a]=a,h[a]=YP(e,_r[o[a]]);for(f.sort(function(p,d){return h[d]-h[p]}),a=0;a<l;++a)h[a]=o[f[a]];for(a=0;a<l;++a)o[a]=h[a]}}function U_(r,t,e,o){var a=Qr.length,l,f,h,p,d,g,_,y,M,w,A,x,v=!0;for(l=0;l<a;++l)if(f=Qr[l]){for(h=f.site,d=f.halfedges,p=d.length;p--;)_r[d[p]]||d.splice(p,1);for(p=0,g=d.length;p<g;)w=ZP(f,_r[d[p]]),A=w[0],x=w[1],_=Md(f,_r[d[++p%g]]),y=_[0],M=_[1],(Math.abs(A-y)>yn||Math.abs(x-M)>yn)&&(d.splice(p,0,_r.push(fu(h,w,Math.abs(A-r)<yn&&o-x>yn?[r,Math.abs(y-r)<yn?M:o]:Math.abs(x-o)<yn&&e-A>yn?[Math.abs(M-o)<yn?y:e,o]:Math.abs(A-e)<yn&&x-t>yn?[e,Math.abs(y-e)<yn?M:t]:Math.abs(x-t)<yn&&A-r>yn?[Math.abs(M-t)<yn?y:r,t]:null))-1),++g);g&&(v=!1)}if(v){var C,S,O,F=1/0;for(l=0,v=null;l<a;++l)(f=Qr[l])&&(h=f.site,C=h[0]-r,S=h[1]-t,O=C*C+S*S,O<F&&(F=O,v=f));if(v){var G=[r,t],z=[r,o],L=[e,o],D=[e,t];v.halfedges.push(_r.push(fu(h=v.site,G,z))-1,_r.push(fu(h,z,L))-1,_r.push(fu(h,L,D))-1,_r.push(fu(h,D,G))-1)}}for(l=0;l<a;++l)(f=Qr[l])&&(f.halfedges.length||delete Qr[l])}var B_=[],nf;function JP(){lu(this),this.x=this.y=this.arc=this.site=this.cy=null}function Qs(r){var t=r.P,e=r.N;if(!(!t||!e)){var o=t.site,a=r.site,l=e.site;if(o!==l){var f=a[0],h=a[1],p=o[0]-f,d=o[1]-h,g=l[0]-f,_=l[1]-h,y=2*(p*_-d*g);if(!(y>=-z_)){var M=p*p+d*d,w=g*g+_*_,A=(_*M-d*w)/y,x=(p*w-g*M)/y,v=B_.pop()||new JP;v.arc=r,v.site=a,v.x=A+f,v.y=(v.cy=x+h)+Math.sqrt(A*A+x*x),r.circle=v;for(var C=null,S=hu._;S;)if(v.y<S.y||v.y===S.y&&v.x<=S.x)if(S.L)S=S.L;else{C=S.P;break}else if(S.R)S=S.R;else{C=S;break}hu.insert(C,v),C||(nf=v)}}}}function ta(r){var t=r.circle;t&&(t.P||(nf=t.N),hu.remove(t),B_.push(t),lu(t),r.circle=null)}var G_=[];function $P(){lu(this),this.edge=this.site=this.circle=null}function k_(r){var t=G_.pop()||new $P;return t.site=r,t}function Sd(r){ta(r),ea.remove(r),G_.push(r),lu(r)}function V_(r){var t=r.circle,e=t.x,o=t.cy,a=[e,o],l=r.P,f=r.N,h=[r];Sd(r);for(var p=l;p.circle&&Math.abs(e-p.circle.x)<yn&&Math.abs(o-p.circle.cy)<yn;)l=p.P,h.unshift(p),Sd(p),p=l;h.unshift(p),ta(p);for(var d=f;d.circle&&Math.abs(e-d.circle.x)<yn&&Math.abs(o-d.circle.cy)<yn;)f=d.N,h.push(d),Sd(d),d=f;h.push(d),ta(d);var g=h.length,_;for(_=1;_<g;++_)d=h[_],p=h[_-1],ul(d.edge,p.site,d.site,a);p=h[0],d=h[g-1],d.edge=cu(p.site,d.site,null,a),Qs(p),Qs(d)}function H_(r){for(var t=r[0],e=r[1],o,a,l,f,h=ea._;h;)if(l=W_(h,e)-t,l>yn)h=h.L;else if(f=t-KP(h,e),f>yn){if(!h.R){o=h;break}h=h.R}else{l>-yn?(o=h.P,a=h):f>-yn?(o=h,a=h.N):o=a=h;break}D_(r);var p=k_(r);if(ea.insert(o,p),!(!o&&!a)){if(o===a){ta(o),a=k_(o.site),ea.insert(p,a),p.edge=a.edge=cu(o.site,p.site),Qs(o),Qs(a);return}if(!a){p.edge=cu(o.site,p.site);return}ta(o),ta(a);var d=o.site,g=d[0],_=d[1],y=r[0]-g,M=r[1]-_,w=a.site,A=w[0]-g,x=w[1]-_,v=2*(y*x-M*A),C=y*y+M*M,S=A*A+x*x,O=[(x*C-M*S)/v+g,(y*S-A*C)/v+_];ul(a.edge,d,w,O),p.edge=cu(d,r,null,O),a.edge=cu(r,w,null,O),Qs(o),Qs(a)}}function W_(r,t){var e=r.site,o=e[0],a=e[1],l=a-t;if(!l)return o;var f=r.P;if(!f)return-1/0;e=f.site;var h=e[0],p=e[1],d=p-t;if(!d)return h;var g=h-o,_=1/l-1/d,y=g/d;return _?(-y+Math.sqrt(y*y-2*_*(g*g/(-2*d)-p+d/2+a-l/2)))/_+o:(o+h)/2}function KP(r,t){var e=r.N;if(e)return W_(e,t);var o=r.site;return o[1]===t?o[0]:1/0}var yn=1e-6,z_=1e-12,ea,Qr,hu,_r;function jP(r,t,e){return(r[0]-e[0])*(t[1]-r[1])-(r[0]-t[0])*(e[1]-r[1])}function QP(r,t){return t[1]-r[1]||t[0]-r[0]}function rf(r,t){var e=r.sort(QP).pop(),o,a,l;for(_r=[],Qr=new Array(r.length),ea=new Ed,hu=new Ed;;)if(l=nf,e&&(!l||e[1]<l.y||e[1]===l.y&&e[0]<l.x))(e[0]!==o||e[1]!==a)&&(H_(e),o=e[0],a=e[1]),e=r.pop();else if(l)V_(l.arc);else break;if(F_(),t){var f=+t[0][0],h=+t[0][1],p=+t[1][0],d=+t[1][1];O_(f,h,p,d),U_(f,h,p,d)}this.edges=_r,this.cells=Qr,ea=hu=_r=Qr=null}rf.prototype={constructor:rf,polygons:function(){var r=this.edges;return this.cells.map(function(t){var e=t.halfedges.map(function(o){return Md(t,r[o])});return e.data=t.site.data,e})},triangles:function(){var r=[],t=this.edges;return this.cells.forEach(function(e,o){if(h=(l=e.halfedges).length)for(var a=e.site,l,f=-1,h,p,d=t[l[h-1]],g=d.left===a?d.right:d.left;++f<h;)p=g,d=t[l[f]],g=d.left===a?d.right:d.left,p&&g&&o<p.index&&o<g.index&&jP(a,p,g)<0&&r.push([a.data,p.data,g.data])}),r},links:function(){return this.edges.filter(function(r){return r.right}).map(function(r){return{source:r.left.data,target:r.right.data}})},find:function(r,t,e){for(var o=this,a,l=o._found||0,f=o.cells.length,h;!(h=o.cells[l]);)if(++l>=f)return null;var p=r-h.site[0],d=t-h.site[1],g=p*p+d*d;do h=o.cells[a=l],l=null,h.halfedges.forEach(function(_){var y=o.edges[_],M=y.left;if(!((M===h.site||!M)&&!(M=y.right))){var w=r-M[0],A=t-M[1],x=w*w+A*A;x<g&&(g=x,l=M.index)}});while(l!==null);return o._found=a,e==null||g<=e*e?h.site:null}};var aI=Un(pu(),1);var Bd=Un(Z_(),1);function li(){return new af}function af(){this.reset()}af.prototype={constructor:af,reset:function(){this.s=this.t=0},add:function(r){J_(sf,r,this.t),J_(this,sf.s,this.s),this.s?this.t+=sf.t:this.s=sf.t},valueOf:function(){return this.s}};var sf=new af;function J_(r,t,e){var o=r.s=t+e,a=o-t,l=o-a;r.t=t-l+(e-a)}var cn=1e-6;var dn=Math.PI,or=dn/2,uf=dn/4,yo=dn*2,na=180/dn,ci=dn/180,Bn=Math.abs,to=Math.atan,fi=Math.atan2,en=Math.cos;var lf=Math.exp;var ll=Math.log;var ye=Math.sin;var Ir=Math.sqrt,cl=Math.tan;function Td(r){return r>1?0:r<-1?dn:Math.acos(r)}function ti(r){return r>1?or:r<-1?-or:Math.asin(r)}function eo(){}var uI=li(),Xk=li();function ra(r){var t=r[0],e=r[1],o=en(e);return[o*en(t),o*ye(t),ye(e)]}function fl(r,t){return[r[1]*t[2]-r[2]*t[1],r[2]*t[0]-r[0]*t[2],r[0]*t[1]-r[1]*t[0]]}function hl(r){var t=Ir(r[0]*r[0]+r[1]*r[1]+r[2]*r[2]);r[0]/=t,r[1]/=t,r[2]/=t}var nG=li();function K_(r,t){return[r>dn?r-yo:r<-dn?r+yo:r,t]}K_.invert=K_;function Ad(){var r=[],t;return{point:function(e,o){t.push([e,o])},lineStart:function(){r.push(t=[])},lineEnd:eo,rejoin:function(){r.length>1&&r.push(r.pop().concat(r.shift()))},result:function(){var e=r;return r=[],t=null,e}}}function Cd(r,t){return Bn(r[0]-t[0])<cn&&Bn(r[1]-t[1])<cn}function cf(r,t,e,o){this.x=r,this.z=t,this.o=e,this.e=o,this.v=!1,this.n=this.p=null}function Pd(r,t,e,o,a){var l=[],f=[],h,p;if(r.forEach(function(w){if(!((A=w.length-1)<=0)){var A,x=w[0],v=w[A],C;if(Cd(x,v)){for(a.lineStart(),h=0;h<A;++h)a.point((x=w[h])[0],x[1]);a.lineEnd();return}l.push(C=new cf(x,w,null,!0)),f.push(C.o=new cf(x,null,C,!1)),l.push(C=new cf(v,w,null,!1)),f.push(C.o=new cf(v,null,C,!0))}}),!!l.length){for(f.sort(t),j_(l),j_(f),h=0,p=f.length;h<p;++h)f[h].e=e=!e;for(var d=l[0],g,_;;){for(var y=d,M=!0;y.v;)if((y=y.n)===d)return;g=y.z,a.lineStart();do{if(y.v=y.o.v=!0,y.e){if(M)for(h=0,p=g.length;h<p;++h)a.point((_=g[h])[0],_[1]);else o(y.x,y.n.x,1,a);y=y.n}else{if(M)for(g=y.p.z,h=g.length-1;h>=0;--h)a.point((_=g[h])[0],_[1]);else o(y.x,y.p.x,-1,a);y=y.p}y=y.o,g=y.z,M=!M}while(!y.v);a.lineEnd()}}}function j_(r){if(t=r.length){for(var t,e=0,o=r[0],a;++e<t;)o.n=a=r[e],a.p=o,o=a;o.n=a=r[0],a.p=o}}function Es(r,t){return r<t?-1:r>t?1:r>=t?0:NaN}function Id(r){return r.length===1&&(r=fI(r)),{left:function(t,e,o,a){for(o==null&&(o=0),a==null&&(a=t.length);o<a;){var l=o+a>>>1;r(t[l],e)<0?o=l+1:a=l}return o},right:function(t,e,o,a){for(o==null&&(o=0),a==null&&(a=t.length);o<a;){var l=o+a>>>1;r(t[l],e)>0?a=l:o=l+1}return o}}}function fI(r){return function(t,e){return Es(r(t),e)}}var Q_=Id(Es),hI=Q_.right,pI=Q_.left;var t1=Array.prototype,mI=t1.slice,gI=t1.map;var ZG=Math.sqrt(50),JG=Math.sqrt(10),$G=Math.sqrt(2);function hf(r){for(var t=r.length,e,o=-1,a=0,l,f;++o<t;)a+=r[o].length;for(l=new Array(a);--t>=0;)for(f=r[t],e=f.length;--e>=0;)l[--a]=f[e];return l}var wI=1e9,N5=-wI;var Rd=li();function Ld(r,t){var e=t[0],o=t[1],a=[ye(e),-en(e),0],l=0,f=0;Rd.reset();for(var h=0,p=r.length;h<p;++h)if(g=(d=r[h]).length)for(var d,g,_=d[g-1],y=_[0],M=_[1]/2+uf,w=ye(M),A=en(M),x=0;x<g;++x,y=C,w=O,A=F,_=v){var v=d[x],C=v[0],S=v[1]/2+uf,O=ye(S),F=en(S),G=C-y,z=G>=0?1:-1,L=z*G,D=L>dn,q=w*O;if(Rd.add(fi(q*z*ye(L),A*F+q*en(L))),l+=D?G+z*yo:G,D^y>=e^C>=e){var nt=fl(ra(_),ra(v));hl(nt);var k=fl(a,nt);hl(k);var xt=(D^G>=0?-1:1)*ti(k[2]);(o>xt||o===xt&&(nt[0]||nt[1]))&&(f+=D^G>=0?1:-1)}}return(l<-cn||l<cn&&Rd<-cn)^f&1}var H5=li();var uV=li(),lV=li();var AI=1/0;var hV=-AI;function Nd(r){this._context=r}Nd.prototype={_radius:4.5,pointRadius:function(r){return this._radius=r,this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){this._line===0&&this._context.closePath(),this._point=NaN},point:function(r,t){switch(this._point){case 0:{this._context.moveTo(r,t),this._point=1;break}case 1:{this._context.lineTo(r,t);break}default:{this._context.moveTo(r+this._radius,t),this._context.arc(r,t,this._radius,0,yo);break}}},result:eo};var MV=li();function Od(){this._string=[]}Od.prototype={_radius:4.5,_circle:r1(4.5),pointRadius:function(r){return(r=+r)!==this._radius&&(this._radius=r,this._circle=null),this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){this._line===0&&this._string.push("Z"),this._point=NaN},point:function(r,t){switch(this._point){case 0:{this._string.push("M",r,",",t),this._point=1;break}case 1:{this._string.push("L",r,",",t);break}default:{this._circle==null&&(this._circle=r1(this._radius)),this._string.push("M",r,",",t,this._circle);break}}},result:function(){if(this._string.length){var r=this._string.join("");return this._string=[],r}else return null}};function r1(r){return"m0,"+r+"a"+r+","+r+" 0 1,1 0,"+-2*r+"a"+r+","+r+" 0 1,1 0,"+2*r+"z"}function Dd(r,t,e,o){return function(a,l){var f=t(l),h=a.invert(o[0],o[1]),p=Ad(),d=t(p),g=!1,_,y,M,w={point:A,lineStart:v,lineEnd:C,polygonStart:function(){w.point=S,w.lineStart=O,w.lineEnd=F,y=[],_=[]},polygonEnd:function(){w.point=A,w.lineStart=v,w.lineEnd=C,y=hf(y);var G=Ld(_,h);y.length?(g||(l.polygonStart(),g=!0),Pd(y,II,G,e,l)):G&&(g||(l.polygonStart(),g=!0),l.lineStart(),e(null,null,1,l),l.lineEnd()),g&&(l.polygonEnd(),g=!1),y=_=null},sphere:function(){l.polygonStart(),l.lineStart(),e(null,null,1,l),l.lineEnd(),l.polygonEnd()}};function A(G,z){var L=a(G,z);r(G=L[0],z=L[1])&&l.point(G,z)}function x(G,z){var L=a(G,z);f.point(L[0],L[1])}function v(){w.point=x,f.lineStart()}function C(){w.point=A,f.lineEnd()}function S(G,z){M.push([G,z]);var L=a(G,z);d.point(L[0],L[1])}function O(){d.lineStart(),M=[]}function F(){S(M[0][0],M[0][1]),d.lineEnd();var G=d.clean(),z=p.result(),L,D=z.length,q,nt,k;if(M.pop(),_.push(M),M=null,!!D){if(G&1){if(nt=z[0],(q=nt.length-1)>0){for(g||(l.polygonStart(),g=!0),l.lineStart(),L=0;L<q;++L)l.point((k=nt[L])[0],k[1]);l.lineEnd()}return}D>1&&G&2&&z.push(z.pop().concat(z.shift())),y.push(z.filter(PI))}}return w}}function PI(r){return r.length>1}function II(r,t){return((r=r.x)[0]<0?r[1]-or-cn:or-r[1])-((t=t.x)[0]<0?t[1]-or-cn:or-t[1])}var RI=Dd(function(){return!0},LI,OI,[-dn,-or]);function LI(r){var t=NaN,e=NaN,o=NaN,a;return{lineStart:function(){r.lineStart(),a=1},point:function(l,f){var h=l>0?dn:-dn,p=Bn(l-t);Bn(p-dn)<cn?(r.point(t,e=(e+f)/2>0?or:-or),r.point(o,e),r.lineEnd(),r.lineStart(),r.point(h,e),r.point(l,e),a=0):o!==h&&p>=dn&&(Bn(t-o)<cn&&(t-=o*cn),Bn(l-h)<cn&&(l-=h*cn),e=NI(t,e,l,f),r.point(o,e),r.lineEnd(),r.lineStart(),r.point(h,e),a=0),r.point(t=l,e=f),o=h},lineEnd:function(){r.lineEnd(),t=e=NaN},clean:function(){return 2-a}}}function NI(r,t,e,o){var a,l,f=ye(r-e);return Bn(f)>cn?to((ye(t)*(l=en(o))*ye(e)-ye(o)*(a=en(t))*ye(r))/(a*l*f)):(t+o)/2}function OI(r,t,e,o){var a;if(r==null)a=e*or,o.point(-dn,a),o.point(0,a),o.point(dn,a),o.point(dn,0),o.point(dn,-a),o.point(0,-a),o.point(-dn,-a),o.point(-dn,0),o.point(-dn,a);else if(Bn(r[0]-t[0])>cn){var l=r[0]<t[0]?dn:-dn;a=e*l/2,o.point(-l,a),o.point(0,a),o.point(l,a)}else o.point(t[0],t[1])}function pf(r){return function(t){var e=new Fd;for(var o in r)e[o]=r[o];return e.stream=t,e}}function Fd(){}Fd.prototype={constructor:Fd,point:function(r,t){this.stream.point(r,t)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};var lH=en(30*ci);var SH=pf({point:function(r,t){this.stream.point(r*ci,t*ci)}});function df(r){return function(t,e){var o=en(t),a=en(e),l=r(o*a);return[l*a*ye(t),l*ye(e)]}}function vo(r){return function(t,e){var o=Ir(t*t+e*e),a=r(o),l=ye(a),f=en(a);return[fi(t*l,o*f),ti(o&&e*l/o)]}}var c1=df(function(r){return Ir(2/(1+r))});c1.invert=vo(function(r){return 2*ti(r/2)});var f1=df(function(r){return(r=Td(r))&&r/ye(r)});f1.invert=vo(function(r){return r});function Ud(r,t){return[r,ll(cl((or+t)/2))]}Ud.invert=function(r,t){return[r,2*to(lf(t))-or]};function mf(r,t){return[r,t]}mf.invert=mf;function h1(r,t){var e=en(t),o=en(r)*e;return[e*ye(r)/o,ye(t)/o]}h1.invert=vo(to);function p1(r,t){var e=t*t,o=e*e;return[r*(.8707-.131979*e+o*(-.013791+o*(.003971*e-.001529*o))),t*(1.007226+e*(.015085+o*(-.044475+.028874*e-.005916*o)))]}p1.invert=function(r,t){var e=t,o=25,a;do{var l=e*e,f=l*l;e-=a=(e*(1.007226+l*(.015085+f*(-.044475+.028874*l-.005916*f)))-t)/(1.007226+l*(.015085*3+f*(-.044475*7+.028874*9*l-.005916*11*f)))}while(Bn(a)>cn&&--o>0);return[r/(.8707+(l=e*e)*(-.131979+l*(-.013791+l*l*l*(.003971-.001529*l)))),e]};function d1(r,t){return[en(t)*ye(r),ye(t)]}d1.invert=vo(ti);function m1(r,t){var e=en(t),o=1+en(r)*e;return[e*ye(r)/o,ye(t)/o]}m1.invert=vo(function(r){return 2*to(r)});function g1(r,t){return[ll(cl((or+t)/2)),-r]}g1.invert=function(r,t){return[-t,2*to(lf(r))-or]};var kI=Un(pu(),1);var GI=Un(pu(),1);var HI=Un(pu(),1);var WI=Un(pu(),1);function pl(r,t){return Math.sqrt((t[0]-r[0])**2+(t[1]-r[1])**2)}self.onmessage=r=>{switch(r.data.type){case"fetch_project_road":QI(r.data.data.fetchOption);break;case"get_direction_path":let t=nR(r.data.data.points);zd("direction_path_result",{path:t,key:r.data.data.key});break;case"get_path":let e=tR(r.data.data.start,r.data.data.end);zd("get_path_result",{path:e,key:r.data.data.key});break}};function zd(r,t){self.postMessage({type:r,data:t})}var Ss=new Map,kd=new Map,Gd=new Map,v1=new Vd.default;function dl(r,t,e){let o=Gd.get(r)||new Map;o.set(t,e),Gd.set(r,o)}async function QI(r){try{let e=(await m0(r.url,r)).data.map(l=>JSON.parse(l.road_info)),o=new Map,a=new Map;e.length&&(e.forEach(l=>{l.points.forEach(f=>{let h=`${l.floor}-${f.id}`;if(Ss.set(h,f),kd.set(`${f.floor}-${f.nodeId}`,h),["straightLadder","staircase"].includes(f.type)){let p=o.get(f.name)||[];p.push(hm({},f)),o.set(f.name,p)}if(f.type==="escalator"){let p=a.get(f.name)||{};f.escalatorDirection==="exit"?p.end={floor:f.floor,id:f.id}:p.start={floor:f.floor,id:f.id},a.set(f.name,p)}}),l.lines.forEach(f=>{var _,y;let h=`${l.floor}-${f.from}`,p=`${l.floor}-${f.to}`,d=(_=Ss.get(h))==null?void 0:_.cds,g=(y=Ss.get(p))==null?void 0:y.cds;if(d!=null&&d.length&&(g!=null&&g.length)){let M=pl(d,g);dl(h,p,M),f.direction==="double"&&dl(p,h,M)}})}),o.forEach((l,f)=>{var h,p;for(let d=0;d<l.length;d++){let g=`${l[d].floor}-${l[d].id}`;for(let _=0;_<l.length;_++)if(d!==_){let y=`${l[_].floor}-${l[_].id}`,M=(h=Ss.get(g))==null?void 0:h.cds,w=(p=Ss.get(y))==null?void 0:p.cds;M!=null&&M.length&&(w!=null&&w.length)&&(l[d].type==="straightLadder"?dl(g,y,2):dl(g,y,3))}}}),a.forEach((l,f)=>{var h,p;if(l.start&&l.end){let d=`${l.start.floor}-${l.start.id}`,g=`${l.end.floor}-${l.end.id}`,_=(h=Ss.get(d))==null?void 0:h.cds,y=(p=Ss.get(g))==null?void 0:p.cds;_!=null&&_.length&&(y!=null&&y.length)&&dl(d,g,1)}}),v1=new Vd.default(Gd)),zd("fetch_project_road_result",{result:!0})}catch(t){console.error("[\\u83B7\\u53D6\\u8DEF\\u7F51\\u9519\\u8BEF]",t)}}function tR(r,t){let e=`${r.floor}-${r.nodeId}`,o=`${t.floor}-${t.nodeId}`,a=kd.get(e),l=kd.get(o),f=v1.path(a,l);if(!f)return null;let h=[];return f.map(p=>{var g;let d=Ss.get(p);if(d){let{floor:_}=d;if(((g=h[h.length-1])==null?void 0:g.floor)===_){let y=h[h.length-1];y.points.push(d.cds),y.endType=d.type}else h.push({floor:_,points:[d.cds],endType:d.type})}}),h}function eR(r,t,e){let o=new fn(t[0]-r[0],t[1]-r[1]),a=new fn(t[0]-e[0],t[1]-e[1]),f=o.angleTo(a)*180/Math.PI,h=new fn(t[0]-r[0],t[1]-r[1]);return new fn(e[0]-r[0],e[1]-r[1]).cross(h)>0?f:-f}function nR(r){let t=[{direction:"start",distance:pl(r[0],r[1]),points:[r[0],r[1]]}];for(let e=2;e<r.length;e++){let o=rR(r[e-2],r[e-1],r[e]);if(o==="front"){let a=t[t.length-1],l=pl(r[e-1],r[e]);a.distance+=l,e!==2&&a.points.push(r[e-1])}else t.push({direction:o,distance:pl(r[e-1],r[e]),points:[r[e-1],r[e]]})}return t.push({direction:"end",distance:0,points:[r[r.length-1]]}),t}function rR(r,t,e){let o=eR(r,t,e);return 180-Math.abs(o)<15?"front":o>135?"right_front":o<-135?"left_front":o<=135&&o>=60?"right":o>=-135&&o<=-60?"left":o<60&&o>0?"right_back":o>-60&&o<0?"left_back":"front"}\n/*! Bundled license information:\n\nobject-assign/index.js:\n (*\n object-assign\n (c) Sindre Sorhus\n @license MIT\n *)\n\npolygon-clipping/dist/polygon-clipping.umd.js:\n (**\n * splaytree v3.1.0\n * Fast Splay tree for Node and browser\n *\n * @author Alexander Milevski <info@w8r.name>\n * @license MIT\n * @preserve\n *)\n\nthree/build/three.module.js:\n (**\n * @license\n * Copyright 2010-2023 Three.js Authors\n * SPDX-License-Identifier: MIT\n *)\n\n@turf/isolines/dist/es/index.js:\n (**\n * @license GNU Affero General Public License.\n * Copyright (c) 2015, 2015 Ronny Lorenz <ronny@tbi.univie.ac.at>\n * v. 1.2.0\n * https://github.com/RaumZeit/MarchingSquares.js\n *\n * MarchingSquaresJS is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * MarchingSquaresJS is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * As additional permission under GNU Affero General Public License version 3\n * section 7, third-party projects (personal or commercial) may distribute,\n * include, or link against UNMODIFIED VERSIONS of MarchingSquaresJS without the\n * requirement that said third-party project for that reason alone becomes\n * subject to any requirement of the GNU Affero General Public License version 3.\n * Any modifications to MarchingSquaresJS, however, must be shared with the public\n * and made available.\n *\n * In summary this:\n * - allows you to use MarchingSquaresJS at no cost\n * - allows you to use MarchingSquaresJS for both personal and commercial purposes\n * - allows you to distribute UNMODIFIED VERSIONS of MarchingSquaresJS under any\n * license as long as this license notice is included\n * - enables you to keep the source code of your program that uses MarchingSquaresJS\n * undisclosed\n * - forces you to share any modifications you have made to MarchingSquaresJS,\n * e.g. bug-fixes\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with MarchingSquaresJS. If not, see <http://www.gnu.org/licenses/>.\n *)\n\n@turf/isobands/dist/es/index.js:\n (*!\n * @license GNU Affero General Public License.\n * Copyright (c) 2015, 2015 Ronny Lorenz <ronny@tbi.univie.ac.at>\n * v. 1.2.0\n * https://github.com/RaumZeit/MarchingSquares.js\n *\n * MarchingSquaresJS is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * MarchingSquaresJS is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * As additional permission under GNU Affero General Public License version 3\n * section 7, third-party projects (personal or commercial) may distribute,\n * include, or link against UNMODIFIED VERSIONS of MarchingSquaresJS without the\n * requirement that said third-party project for that reason alone becomes\n * subject to any requirement of the GNU Affero General Public License version 3.\n * Any modifications to MarchingSquaresJS, however, must be shared with the public\n * and made available.\n *\n * In summary this:\n * - allows you to use MarchingSquaresJS at no cost\n * - allows you to use MarchingSquaresJS for both personal and commercial purposes\n * - allows you to distribute UNMODIFIED VERSIONS of MarchingSquaresJS under any\n * license as long as this license notice is included\n * - enables you to keep the source code of your program that uses MarchingSquaresJS\n * undisclosed\n * - forces you to share any modifications you have made to MarchingSquaresJS,\n * e.g. bug-fixes\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with MarchingSquaresJS. If not, see <http://www.gnu.org/licenses/>.\n *)\n*/\n');
|
|
4278
4278
|
}
|
|
4279
4279
|
|
|
4280
4280
|
// src/plugins/navigation/path.ts
|