@mappedin/react-native-sdk 6.17.0 → 6.17.1
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/THIRD_PARTY_LICENSES.txt +1 -1
- package/lib/index.js +6 -6
- package/package.json +2 -2
package/lib/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var Oq=Object.create;var lx=Object.defineProperty;var Nq=Object.getOwnPropertyDescriptor;var Uq=Object.getOwnPropertyNames;var jq=Object.getPrototypeOf,Vq=Object.prototype.hasOwnProperty;var Qq=(e,t,r)=>t in e?lx(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var Gq=(e,t)=>()=>(e&&(t=e(e=0)),t);var Yq=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var Hq=(e,t,r,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of Uq(t))!Vq.call(e,n)&&n!==r&&lx(e,n,{get:()=>t[n],enumerable:!(i=Nq(t,n))||i.enumerable});return e};var Wq=(e,t,r)=>(r=e!=null?Oq(jq(e)):{},Hq(t||!e||!e.__esModule?lx(r,"default",{value:e,enumerable:!0}):r,e));var Mm=(e,t,r)=>Qq(e,typeof t!="symbol"?t+"":t,r);var Bt,$e=Gq(()=>{Bt={env:{NODE_ENV:"production",npm_package_version:"6.17.
|
|
1
|
+
var Oq=Object.create;var lx=Object.defineProperty;var Nq=Object.getOwnPropertyDescriptor;var Uq=Object.getOwnPropertyNames;var jq=Object.getPrototypeOf,Vq=Object.prototype.hasOwnProperty;var Qq=(e,t,r)=>t in e?lx(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var Gq=(e,t)=>()=>(e&&(t=e(e=0)),t);var Yq=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var Hq=(e,t,r,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of Uq(t))!Vq.call(e,n)&&n!==r&&lx(e,n,{get:()=>t[n],enumerable:!(i=Nq(t,n))||i.enumerable});return e};var Wq=(e,t,r)=>(r=e!=null?Oq(jq(e)):{},Hq(t||!e||!e.__esModule?lx(r,"default",{value:e,enumerable:!0}):r,e));var Mm=(e,t,r)=>Qq(e,typeof t!="symbol"?t+"":t,r);var Bt,$e=Gq(()=>{Bt={env:{NODE_ENV:"production",npm_package_version:"6.17.1"}}});var bD=Yq((Lbe,_D)=>{"use strict";$e();_D.exports=`<!DOCTYPE html>
|
|
2
2
|
<html>
|
|
3
3
|
<head>
|
|
4
4
|
<!-- MAPPEDIN_HEAD_START -->
|
|
@@ -231,7 +231,7 @@ Material Type: \`+k.type+\`
|
|
|
231
231
|
|
|
232
232
|
Program Info Log: \`+R+\`
|
|
233
233
|
\`+j+\`
|
|
234
|
-
\`+Y)}else R!==""?console.warn("THREE.WebGLProgram: Program Info Log:",R):(F===""||B==="")&&(O=!1);O&&(k.diagnostics={runnable:z,programLog:R,vertexShader:{log:F,prefix:g},fragmentShader:{log:B,prefix:v}})}n.deleteShader(E),n.deleteShader(M),D=new cE(n,m),T=D0e(n,m)}let D;this.getUniforms=function(){return D===void 0&&S(this),D};let T;this.getAttributes=function(){return T===void 0&&S(this),T};let P=r.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return P===!1&&(P=n.getProgramParameter(m,w0e)),P},this.destroy=function(){i.releaseStatesOfProgram(this),n.deleteProgram(m),this.program=void 0},this.type=r.shaderType,this.name=r.shaderName,this.id=E0e++,this.cacheKey=t,this.usedTimes=1,this.program=m,this.vertexShader=E,this.fragmentShader=M,this}function W0e(e,t,r,i,n,a,o){let s=new xk,l=new Y0e,u=new Set,c=[],h=n.logarithmicDepthBuffer,d=n.vertexTextures,p=n.precision,f={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 m(T){return u.add(T),T===0?"uv":"uv".concat(T)}function g(T,P,k,R,F){let B=R.fog,z=F.geometry,O=T.isMeshStandardMaterial?R.environment:null,j=(T.isMeshStandardMaterial?r:t).get(T.envMap||O),Y=j&&j.mapping===yE?j.image.height:null,Z=f[T.type];T.precision!==null&&(p=n.getMaxPrecision(T.precision),p!==T.precision&&console.warn("THREE.WebGLProgram.getParameters:",T.precision,"not supported, using",p,"instead."));let ne=z.morphAttributes.position||z.morphAttributes.normal||z.morphAttributes.color,ie=ne!==void 0?ne.length:0,le=0;z.morphAttributes.position!==void 0&&(le=1),z.morphAttributes.normal!==void 0&&(le=2),z.morphAttributes.color!==void 0&&(le=3);let X,ce,ge,be;if(Z){let Yt=Bu[Z];X=Yt.vertexShader,ce=Yt.fragmentShader}else X=T.vertexShader,ce=T.fragmentShader,l.update(T),ge=l.getVertexShaderID(T),be=l.getFragmentShaderID(T);let _e=e.getRenderTarget(),ke=e.state.buffers.depth.getReversed(),Ye=F.isInstancedMesh===!0,We=F.isBatchedMesh===!0,Me=!!T.map,Ce=!!T.matcap,oe=!!j,it=!!T.aoMap,Oe=!!T.lightMap,Ke=!!T.bumpMap,Le=!!T.normalMap,Ze=!!T.displacementMap,ut=!!T.emissiveMap,et=!!T.metalnessMap,te=!!T.roughnessMap,K=T.anisotropy>0,ve=T.clearcoat>0,je=T.dispersion>0,Ne=T.iridescence>0,Ue=T.sheen>0,ft=T.transmission>0,ot=K&&!!T.anisotropyMap,Ae=ve&&!!T.clearcoatMap,Q=ve&&!!T.clearcoatNormalMap,G=ve&&!!T.clearcoatRoughnessMap,W=Ne&&!!T.iridescenceMap,re=Ne&&!!T.iridescenceThicknessMap,$=Ue&&!!T.sheenColorMap,me=Ue&&!!T.sheenRoughnessMap,ye=!!T.specularMap,Be=!!T.specularColorMap,Ge=!!T.specularIntensityMap,ue=ft&&!!T.transmissionMap,pe=ft&&!!T.thicknessMap,we=!!T.gradientMap,Ie=!!T.alphaMap,nt=T.alphaTest>0,lt=!!T.alphaHash,$e=!!T.extensions,He=ld;T.toneMapped&&(_e===null||_e.isXRRenderTarget===!0)&&(He=e.toneMapping);let wt={shaderID:Z,shaderType:T.type,shaderName:T.name,vertexShader:X,fragmentShader:ce,defines:T.defines,customVertexShaderID:ge,customFragmentShaderID:be,isRawShaderMaterial:T.isRawShaderMaterial===!0,glslVersion:T.glslVersion,precision:p,batching:We,batchingColor:We&&F._colorsTexture!==null,instancing:Ye,instancingColor:Ye&&F.instanceColor!==null,instancingMorph:Ye&&F.morphTexture!==null,supportsVertexTextures:d,outputColorSpace:_e===null?e.outputColorSpace:_e.isXRRenderTarget===!0?_e.texture.colorSpace:Na,alphaToCoverage:!!T.alphaToCoverage,map:Me,matcap:Ce,envMap:oe,envMapMode:oe&&j.mapping,envMapCubeUVHeight:Y,aoMap:it,lightMap:Oe,bumpMap:Ke,normalMap:Le,displacementMap:d&&Ze,emissiveMap:ut,normalMapObjectSpace:Le&&T.normalMapType===Ipe,normalMapTangentSpace:Le&&T.normalMapType===yk,metalnessMap:et,roughnessMap:te,anisotropy:K,anisotropyMap:ot,clearcoat:ve,clearcoatMap:Ae,clearcoatNormalMap:Q,clearcoatRoughnessMap:G,dispersion:je,iridescence:Ne,iridescenceMap:W,iridescenceThicknessMap:re,sheen:Ue,sheenColorMap:$,sheenRoughnessMap:me,specularMap:ye,specularColorMap:Be,specularIntensityMap:Ge,transmission:ft,transmissionMap:ue,thicknessMap:pe,gradientMap:we,opaque:T.transparent===!1&&T.blending===Tm&&T.alphaToCoverage===!1,alphaMap:Ie,alphaTest:nt,alphaHash:lt,combine:T.combine,mapUv:Me&&m(T.map.channel),aoMapUv:it&&m(T.aoMap.channel),lightMapUv:Oe&&m(T.lightMap.channel),bumpMapUv:Ke&&m(T.bumpMap.channel),normalMapUv:Le&&m(T.normalMap.channel),displacementMapUv:Ze&&m(T.displacementMap.channel),emissiveMapUv:ut&&m(T.emissiveMap.channel),metalnessMapUv:et&&m(T.metalnessMap.channel),roughnessMapUv:te&&m(T.roughnessMap.channel),anisotropyMapUv:ot&&m(T.anisotropyMap.channel),clearcoatMapUv:Ae&&m(T.clearcoatMap.channel),clearcoatNormalMapUv:Q&&m(T.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:G&&m(T.clearcoatRoughnessMap.channel),iridescenceMapUv:W&&m(T.iridescenceMap.channel),iridescenceThicknessMapUv:re&&m(T.iridescenceThicknessMap.channel),sheenColorMapUv:$&&m(T.sheenColorMap.channel),sheenRoughnessMapUv:me&&m(T.sheenRoughnessMap.channel),specularMapUv:ye&&m(T.specularMap.channel),specularColorMapUv:Be&&m(T.specularColorMap.channel),specularIntensityMapUv:Ge&&m(T.specularIntensityMap.channel),transmissionMapUv:ue&&m(T.transmissionMap.channel),thicknessMapUv:pe&&m(T.thicknessMap.channel),alphaMapUv:Ie&&m(T.alphaMap.channel),vertexTangents:!!z.attributes.tangent&&(Le||K),vertexColors:T.vertexColors,vertexAlphas:T.vertexColors===!0&&!!z.attributes.color&&z.attributes.color.itemSize===4,pointsUvs:F.isPoints===!0&&!!z.attributes.uv&&(Me||Ie),fog:!!B,useFog:T.fog===!0,fogExp2:!!B&&B.isFogExp2,flatShading:T.flatShading===!0,sizeAttenuation:T.sizeAttenuation===!0,logarithmicDepthBuffer:h,reverseDepthBuffer:ke,skinning:F.isSkinnedMesh===!0,morphTargets:z.morphAttributes.position!==void 0,morphNormals:z.morphAttributes.normal!==void 0,morphColors:z.morphAttributes.color!==void 0,morphTargetsCount:ie,morphTextureStride:le,numDirLights:P.directional.length,numPointLights:P.point.length,numSpotLights:P.spot.length,numSpotLightMaps:P.spotLightMap.length,numRectAreaLights:P.rectArea.length,numHemiLights:P.hemi.length,numDirLightShadows:P.directionalShadowMap.length,numPointLightShadows:P.pointShadowMap.length,numSpotLightShadows:P.spotShadowMap.length,numSpotLightShadowsWithMaps:P.numSpotLightShadowsWithMaps,numLightProbes:P.numLightProbes,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,dithering:T.dithering,shadowMapEnabled:e.shadowMap.enabled&&k.length>0,shadowMapType:e.shadowMap.type,toneMapping:He,decodeVideoTexture:Me&&T.map.isVideoTexture===!0&&Ai.getTransfer(T.map.colorSpace)===rn,decodeVideoTextureEmissive:ut&&T.emissiveMap.isVideoTexture===!0&&Ai.getTransfer(T.emissiveMap.colorSpace)===rn,premultipliedAlpha:T.premultipliedAlpha,doubleSided:T.side===kn,flipSided:T.side===La,useDepthPacking:T.depthPacking>=0,depthPacking:T.depthPacking||0,index0AttributeName:T.index0AttributeName,extensionClipCullDistance:$e&&T.extensions.clipCullDistance===!0&&i.has("WEBGL_clip_cull_distance"),extensionMultiDraw:($e&&T.extensions.multiDraw===!0||We)&&i.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:i.has("KHR_parallel_shader_compile"),customProgramCacheKey:T.customProgramCacheKey()};return wt.vertexUv1s=u.has(1),wt.vertexUv2s=u.has(2),wt.vertexUv3s=u.has(3),u.clear(),wt}function v(T){let P=[];if(T.shaderID?P.push(T.shaderID):(P.push(T.customVertexShaderID),P.push(T.customFragmentShaderID)),T.defines!==void 0)for(let k in T.defines)P.push(k),P.push(T.defines[k]);return T.isRawShaderMaterial===!1&&(_(P,T),x(P,T),P.push(e.outputColorSpace)),P.push(T.customProgramCacheKey),P.join()}function _(T,P){T.push(P.precision),T.push(P.outputColorSpace),T.push(P.envMapMode),T.push(P.envMapCubeUVHeight),T.push(P.mapUv),T.push(P.alphaMapUv),T.push(P.lightMapUv),T.push(P.aoMapUv),T.push(P.bumpMapUv),T.push(P.normalMapUv),T.push(P.displacementMapUv),T.push(P.emissiveMapUv),T.push(P.metalnessMapUv),T.push(P.roughnessMapUv),T.push(P.anisotropyMapUv),T.push(P.clearcoatMapUv),T.push(P.clearcoatNormalMapUv),T.push(P.clearcoatRoughnessMapUv),T.push(P.iridescenceMapUv),T.push(P.iridescenceThicknessMapUv),T.push(P.sheenColorMapUv),T.push(P.sheenRoughnessMapUv),T.push(P.specularMapUv),T.push(P.specularColorMapUv),T.push(P.specularIntensityMapUv),T.push(P.transmissionMapUv),T.push(P.thicknessMapUv),T.push(P.combine),T.push(P.fogExp2),T.push(P.sizeAttenuation),T.push(P.morphTargetsCount),T.push(P.morphAttributeCount),T.push(P.numDirLights),T.push(P.numPointLights),T.push(P.numSpotLights),T.push(P.numSpotLightMaps),T.push(P.numHemiLights),T.push(P.numRectAreaLights),T.push(P.numDirLightShadows),T.push(P.numPointLightShadows),T.push(P.numSpotLightShadows),T.push(P.numSpotLightShadowsWithMaps),T.push(P.numLightProbes),T.push(P.shadowMapType),T.push(P.toneMapping),T.push(P.numClippingPlanes),T.push(P.numClipIntersection),T.push(P.depthPacking)}function x(T,P){s.disableAll(),P.supportsVertexTextures&&s.enable(0),P.instancing&&s.enable(1),P.instancingColor&&s.enable(2),P.instancingMorph&&s.enable(3),P.matcap&&s.enable(4),P.envMap&&s.enable(5),P.normalMapObjectSpace&&s.enable(6),P.normalMapTangentSpace&&s.enable(7),P.clearcoat&&s.enable(8),P.iridescence&&s.enable(9),P.alphaTest&&s.enable(10),P.vertexColors&&s.enable(11),P.vertexAlphas&&s.enable(12),P.vertexUv1s&&s.enable(13),P.vertexUv2s&&s.enable(14),P.vertexUv3s&&s.enable(15),P.vertexTangents&&s.enable(16),P.anisotropy&&s.enable(17),P.alphaHash&&s.enable(18),P.batching&&s.enable(19),P.dispersion&&s.enable(20),P.batchingColor&&s.enable(21),T.push(s.mask),s.disableAll(),P.fog&&s.enable(0),P.useFog&&s.enable(1),P.flatShading&&s.enable(2),P.logarithmicDepthBuffer&&s.enable(3),P.reverseDepthBuffer&&s.enable(4),P.skinning&&s.enable(5),P.morphTargets&&s.enable(6),P.morphNormals&&s.enable(7),P.morphColors&&s.enable(8),P.premultipliedAlpha&&s.enable(9),P.shadowMapEnabled&&s.enable(10),P.doubleSided&&s.enable(11),P.flipSided&&s.enable(12),P.useDepthPacking&&s.enable(13),P.dithering&&s.enable(14),P.transmission&&s.enable(15),P.sheen&&s.enable(16),P.opaque&&s.enable(17),P.pointsUvs&&s.enable(18),P.decodeVideoTexture&&s.enable(19),P.decodeVideoTextureEmissive&&s.enable(20),P.alphaToCoverage&&s.enable(21),T.push(s.mask)}function b(T){let P=f[T.type],k;if(P){let R=Bu[P];k=_k.clone(R.uniforms)}else k=T.uniforms;return k}function E(T,P){let k;for(let R=0,F=c.length;R<F;R++){let B=c[R];if(B.cacheKey===P){k=B,++k.usedTimes;break}}return k===void 0&&(k=new G0e(e,P,T,a),c.push(k)),k}function M(T){if(--T.usedTimes===0){let P=c.indexOf(T);c[P]=c[c.length-1],c.pop(),T.destroy()}}function S(T){l.remove(T)}function D(){l.dispose()}return{getParameters:g,getProgramCacheKey:v,getUniforms:b,acquireProgram:E,releaseProgram:M,releaseShaderCache:S,programs:c,dispose:D}}function Z0e(){let e=new WeakMap;function t(o){return e.has(o)}function r(o){let s=e.get(o);return s===void 0&&(s={},e.set(o,s)),s}function i(o){e.delete(o)}function n(o,s,l){e.get(o)[s]=l}function a(){e=new WeakMap}return{has:t,get:r,remove:i,update:n,dispose:a}}function X0e(e,t){return e.groupOrder!==t.groupOrder?e.groupOrder-t.groupOrder:e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.material.id!==t.material.id?e.material.id-t.material.id:e.z!==t.z?e.z-t.z:e.id-t.id}function GG(e,t){return e.groupOrder!==t.groupOrder?e.groupOrder-t.groupOrder:e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.z!==t.z?t.z-e.z:e.id-t.id}function VG(){let e=[],t=0,r=[],i=[],n=[];function a(){t=0,r.length=0,i.length=0,n.length=0}function o(h,d,p,f,m,g){let v=e[t];return v===void 0?(v={id:h.id,object:h,geometry:d,material:p,groupOrder:f,renderOrder:h.renderOrder,z:m,group:g},e[t]=v):(v.id=h.id,v.object=h,v.geometry=d,v.material=p,v.groupOrder=f,v.renderOrder=h.renderOrder,v.z=m,v.group=g),t++,v}function s(h,d,p,f,m,g){let v=o(h,d,p,f,m,g);p.transmission>0?i.push(v):p.transparent===!0?n.push(v):r.push(v)}function l(h,d,p,f,m,g){let v=o(h,d,p,f,m,g);p.transmission>0?i.unshift(v):p.transparent===!0?n.unshift(v):r.unshift(v)}function u(h,d){r.length>1&&r.sort(h||X0e),i.length>1&&i.sort(d||GG),n.length>1&&n.sort(d||GG)}function c(){for(let h=t,d=e.length;h<d;h++){let p=e[h];if(p.id===null)break;p.id=null,p.object=null,p.geometry=null,p.material=null,p.group=null}}return{opaque:r,transmissive:i,transparent:n,init:a,push:s,unshift:l,finish:c,sort:u}}function J0e(){let e=new WeakMap;function t(i,n){let a=e.get(i),o;return a===void 0?(o=new VG,e.set(i,[o])):n>=a.length?(o=new VG,a.push(o)):o=a[n],o}function r(){e=new WeakMap}return{get:t,dispose:r}}function K0e(){let e={};return{get:function(t){if(e[t.id]!==void 0)return e[t.id];let r;switch(t.type){case"DirectionalLight":r={direction:new fe,color:new Dt};break;case"SpotLight":r={position:new fe,direction:new fe,color:new Dt,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":r={position:new fe,color:new Dt,distance:0,decay:0};break;case"HemisphereLight":r={direction:new fe,skyColor:new Dt,groundColor:new Dt};break;case"RectAreaLight":r={color:new Dt,position:new fe,halfWidth:new fe,halfHeight:new fe};break}return e[t.id]=r,r}}}function q0e(){let e={};return{get:function(t){if(e[t.id]!==void 0)return e[t.id];let r;switch(t.type){case"DirectionalLight":r={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new vt};break;case"SpotLight":r={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new vt};break;case"PointLight":r={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new vt,shadowCameraNear:1,shadowCameraFar:1e3};break}return e[t.id]=r,r}}}function eve(e,t){return(t.castShadow?2:0)-(e.castShadow?2:0)+(t.map?1:0)-(e.map?1:0)}function tve(e){let t=new K0e,r=q0e(),i={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 u=0;u<9;u++)i.probe.push(new fe);let n=new fe,a=new er,o=new er;function s(u){let c=0,h=0,d=0;for(let T=0;T<9;T++)i.probe[T].set(0,0,0);let p=0,f=0,m=0,g=0,v=0,_=0,x=0,b=0,E=0,M=0,S=0;u.sort(eve);for(let T=0,P=u.length;T<P;T++){let k=u[T],R=k.color,F=k.intensity,B=k.distance,z=k.shadow&&k.shadow.map?k.shadow.map.texture:null;if(k.isAmbientLight)c+=R.r*F,h+=R.g*F,d+=R.b*F;else if(k.isLightProbe){for(let O=0;O<9;O++)i.probe[O].addScaledVector(k.sh.coefficients[O],F);S++}else if(k.isDirectionalLight){let O=t.get(k);if(O.color.copy(k.color).multiplyScalar(k.intensity),k.castShadow){let j=k.shadow,Y=r.get(k);Y.shadowIntensity=j.intensity,Y.shadowBias=j.bias,Y.shadowNormalBias=j.normalBias,Y.shadowRadius=j.radius,Y.shadowMapSize=j.mapSize,i.directionalShadow[p]=Y,i.directionalShadowMap[p]=z,i.directionalShadowMatrix[p]=k.shadow.matrix,_++}i.directional[p]=O,p++}else if(k.isSpotLight){let O=t.get(k);O.position.setFromMatrixPosition(k.matrixWorld),O.color.copy(R).multiplyScalar(F),O.distance=B,O.coneCos=Math.cos(k.angle),O.penumbraCos=Math.cos(k.angle*(1-k.penumbra)),O.decay=k.decay,i.spot[m]=O;let j=k.shadow;if(k.map&&(i.spotLightMap[E]=k.map,E++,j.updateMatrices(k),k.castShadow&&M++),i.spotLightMatrix[m]=j.matrix,k.castShadow){let Y=r.get(k);Y.shadowIntensity=j.intensity,Y.shadowBias=j.bias,Y.shadowNormalBias=j.normalBias,Y.shadowRadius=j.radius,Y.shadowMapSize=j.mapSize,i.spotShadow[m]=Y,i.spotShadowMap[m]=z,b++}m++}else if(k.isRectAreaLight){let O=t.get(k);O.color.copy(R).multiplyScalar(F),O.halfWidth.set(k.width*.5,0,0),O.halfHeight.set(0,k.height*.5,0),i.rectArea[g]=O,g++}else if(k.isPointLight){let O=t.get(k);if(O.color.copy(k.color).multiplyScalar(k.intensity),O.distance=k.distance,O.decay=k.decay,k.castShadow){let j=k.shadow,Y=r.get(k);Y.shadowIntensity=j.intensity,Y.shadowBias=j.bias,Y.shadowNormalBias=j.normalBias,Y.shadowRadius=j.radius,Y.shadowMapSize=j.mapSize,Y.shadowCameraNear=j.camera.near,Y.shadowCameraFar=j.camera.far,i.pointShadow[f]=Y,i.pointShadowMap[f]=z,i.pointShadowMatrix[f]=k.shadow.matrix,x++}i.point[f]=O,f++}else if(k.isHemisphereLight){let O=t.get(k);O.skyColor.copy(k.color).multiplyScalar(F),O.groundColor.copy(k.groundColor).multiplyScalar(F),i.hemi[v]=O,v++}}g>0&&(e.has("OES_texture_float_linear")===!0?(i.rectAreaLTC1=Kt.LTC_FLOAT_1,i.rectAreaLTC2=Kt.LTC_FLOAT_2):(i.rectAreaLTC1=Kt.LTC_HALF_1,i.rectAreaLTC2=Kt.LTC_HALF_2)),i.ambient[0]=c,i.ambient[1]=h,i.ambient[2]=d;let D=i.hash;(D.directionalLength!==p||D.pointLength!==f||D.spotLength!==m||D.rectAreaLength!==g||D.hemiLength!==v||D.numDirectionalShadows!==_||D.numPointShadows!==x||D.numSpotShadows!==b||D.numSpotMaps!==E||D.numLightProbes!==S)&&(i.directional.length=p,i.spot.length=m,i.rectArea.length=g,i.point.length=f,i.hemi.length=v,i.directionalShadow.length=_,i.directionalShadowMap.length=_,i.pointShadow.length=x,i.pointShadowMap.length=x,i.spotShadow.length=b,i.spotShadowMap.length=b,i.directionalShadowMatrix.length=_,i.pointShadowMatrix.length=x,i.spotLightMatrix.length=b+E-M,i.spotLightMap.length=E,i.numSpotLightShadowsWithMaps=M,i.numLightProbes=S,D.directionalLength=p,D.pointLength=f,D.spotLength=m,D.rectAreaLength=g,D.hemiLength=v,D.numDirectionalShadows=_,D.numPointShadows=x,D.numSpotShadows=b,D.numSpotMaps=E,D.numLightProbes=S,i.version=$0e++)}function l(u,c){let h=0,d=0,p=0,f=0,m=0,g=c.matrixWorldInverse;for(let v=0,_=u.length;v<_;v++){let x=u[v];if(x.isDirectionalLight){let b=i.directional[h];b.direction.setFromMatrixPosition(x.matrixWorld),n.setFromMatrixPosition(x.target.matrixWorld),b.direction.sub(n),b.direction.transformDirection(g),h++}else if(x.isSpotLight){let b=i.spot[p];b.position.setFromMatrixPosition(x.matrixWorld),b.position.applyMatrix4(g),b.direction.setFromMatrixPosition(x.matrixWorld),n.setFromMatrixPosition(x.target.matrixWorld),b.direction.sub(n),b.direction.transformDirection(g),p++}else if(x.isRectAreaLight){let b=i.rectArea[f];b.position.setFromMatrixPosition(x.matrixWorld),b.position.applyMatrix4(g),o.identity(),a.copy(x.matrixWorld),a.premultiply(g),o.extractRotation(a),b.halfWidth.set(x.width*.5,0,0),b.halfHeight.set(0,x.height*.5,0),b.halfWidth.applyMatrix4(o),b.halfHeight.applyMatrix4(o),f++}else if(x.isPointLight){let b=i.point[d];b.position.setFromMatrixPosition(x.matrixWorld),b.position.applyMatrix4(g),d++}else if(x.isHemisphereLight){let b=i.hemi[m];b.direction.setFromMatrixPosition(x.matrixWorld),b.direction.transformDirection(g),m++}}}return{setup:s,setupView:l,state:i}}function YG(e){let t=new tve(e),r=[],i=[];function n(c){u.camera=c,r.length=0,i.length=0}function a(c){r.push(c)}function o(c){i.push(c)}function s(){t.setup(r)}function l(c){t.setupView(r,c)}let u={lightsArray:r,shadowsArray:i,camera:null,lights:t,transmissionRenderTarget:{}};return{init:n,state:u,setupLights:s,setupLightsView:l,pushLight:a,pushShadow:o}}function rve(e){let t=new WeakMap;function r(n,a=0){let o=t.get(n),s;return o===void 0?(s=new YG(e),t.set(n,[s])):a>=o.length?(s=new YG(e),o.push(s)):s=o[a],s}function i(){t=new WeakMap}return{get:r,dispose:i}}function ave(e,t,r){let i=new fd,n=new vt,a=new vt,o=new wi,s=new Mv({depthPacking:_v}),l=new Ck,u={},c=r.maxTextureSize,h={[mo]:La,[La]:mo,[kn]:kn},d=new go({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new vt},radius:{value:4}},vertexShader:ive,fragmentShader:nve}),p=d.clone();p.defines.HORIZONTAL_PASS=1;let f=new xn;f.setAttribute("position",new qr(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));let m=new Sr(f,d),g=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=HG;let v=this.type;this.render=function(M,S,D){if(g.enabled===!1||g.autoUpdate===!1&&g.needsUpdate===!1||M.length===0)return;let T=e.getRenderTarget(),P=e.getActiveCubeFace(),k=e.getActiveMipmapLevel(),R=e.state;R.setBlending(Du),R.buffers.color.setClear(1,1,1,1),R.buffers.depth.setTest(!0),R.setScissorTest(!1);let F=v!==Kc&&this.type===Kc,B=v===Kc&&this.type!==Kc;for(let z=0,O=M.length;z<O;z++){let j=M[z],Y=j.shadow;if(Y===void 0){console.warn("THREE.WebGLShadowMap:",j,"has no shadow.");continue}if(Y.autoUpdate===!1&&Y.needsUpdate===!1)continue;n.copy(Y.mapSize);let Z=Y.getFrameExtents();if(n.multiply(Z),a.copy(Y.mapSize),(n.x>c||n.y>c)&&(n.x>c&&(a.x=Math.floor(c/Z.x),n.x=a.x*Z.x,Y.mapSize.x=a.x),n.y>c&&(a.y=Math.floor(c/Z.y),n.y=a.y*Z.y,Y.mapSize.y=a.y)),Y.map===null||F===!0||B===!0){let ie=this.type!==Kc?{minFilter:Oa,magFilter:Oa}:{};Y.map!==null&&Y.map.dispose(),Y.map=new Ol(n.x,n.y,ie),Y.map.texture.name=j.name+".shadowMap",Y.camera.updateProjectionMatrix()}e.setRenderTarget(Y.map),e.clear();let ne=Y.getViewportCount();for(let ie=0;ie<ne;ie++){let le=Y.getViewport(ie);o.set(a.x*le.x,a.y*le.y,a.x*le.z,a.y*le.w),R.viewport(o),Y.updateMatrices(j,ie),i=Y.getFrustum(),b(S,D,Y.camera,j,this.type)}Y.isPointLightShadow!==!0&&this.type===Kc&&_(Y,D),Y.needsUpdate=!1}v=this.type,g.needsUpdate=!1,e.setRenderTarget(T,P,k)};function _(M,S){let D=t.update(m);d.defines.VSM_SAMPLES!==M.blurSamples&&(d.defines.VSM_SAMPLES=M.blurSamples,p.defines.VSM_SAMPLES=M.blurSamples,d.needsUpdate=!0,p.needsUpdate=!0),M.mapPass===null&&(M.mapPass=new Ol(n.x,n.y)),d.uniforms.shadow_pass.value=M.map.texture,d.uniforms.resolution.value=M.mapSize,d.uniforms.radius.value=M.radius,e.setRenderTarget(M.mapPass),e.clear(),e.renderBufferDirect(S,null,D,d,m,null),p.uniforms.shadow_pass.value=M.mapPass.texture,p.uniforms.resolution.value=M.mapSize,p.uniforms.radius.value=M.radius,e.setRenderTarget(M.map),e.clear(),e.renderBufferDirect(S,null,D,p,m,null)}function x(M,S,D,T){let P=null,k=D.isPointLight===!0?M.customDistanceMaterial:M.customDepthMaterial;if(k!==void 0)P=k;else if(P=D.isPointLight===!0?l:s,e.localClippingEnabled&&S.clipShadows===!0&&Array.isArray(S.clippingPlanes)&&S.clippingPlanes.length!==0||S.displacementMap&&S.displacementScale!==0||S.alphaMap&&S.alphaTest>0||S.map&&S.alphaTest>0){let R=P.uuid,F=S.uuid,B=u[R];B===void 0&&(B={},u[R]=B);let z=B[F];z===void 0&&(z=P.clone(),B[F]=z,S.addEventListener("dispose",E)),P=z}if(P.visible=S.visible,P.wireframe=S.wireframe,T===Kc?P.side=S.shadowSide!==null?S.shadowSide:S.side:P.side=S.shadowSide!==null?S.shadowSide:h[S.side],P.alphaMap=S.alphaMap,P.alphaTest=S.alphaTest,P.map=S.map,P.clipShadows=S.clipShadows,P.clippingPlanes=S.clippingPlanes,P.clipIntersection=S.clipIntersection,P.displacementMap=S.displacementMap,P.displacementScale=S.displacementScale,P.displacementBias=S.displacementBias,P.wireframeLinewidth=S.wireframeLinewidth,P.linewidth=S.linewidth,D.isPointLight===!0&&P.isMeshDistanceMaterial===!0){let R=e.properties.get(P);R.light=D}return P}function b(M,S,D,T,P){if(M.visible===!1)return;if(M.layers.test(S.layers)&&(M.isMesh||M.isLine||M.isPoints)&&(M.castShadow||M.receiveShadow&&P===Kc)&&(!M.frustumCulled||i.intersectsObject(M))){M.modelViewMatrix.multiplyMatrices(D.matrixWorldInverse,M.matrixWorld);let R=t.update(M),F=M.material;if(Array.isArray(F)){let B=R.groups;for(let z=0,O=B.length;z<O;z++){let j=B[z],Y=F[j.materialIndex];if(Y&&Y.visible){let Z=x(M,Y,T,P);M.onBeforeShadow(e,M,S,D,R,Z,j),e.renderBufferDirect(D,null,R,Z,M,j),M.onAfterShadow(e,M,S,D,R,Z,j)}}}else if(F.visible){let B=x(M,F,T,P);M.onBeforeShadow(e,M,S,D,R,B,null),e.renderBufferDirect(D,null,R,B,M,null),M.onAfterShadow(e,M,S,D,R,B,null)}}let k=M.children;for(let R=0,F=k.length;R<F;R++)b(k[R],S,D,T,P)}function E(M){M.target.removeEventListener("dispose",E);for(let S in u){let D=u[S],T=M.target.uuid;T in D&&(D[T].dispose(),delete D[T])}}}function sve(e,t){function r(){let ue=!1,pe=new wi,we=null,Ie=new wi(0,0,0,0);return{setMask:function(nt){we!==nt&&!ue&&(e.colorMask(nt,nt,nt,nt),we=nt)},setLocked:function(nt){ue=nt},setClear:function(nt,lt,$e,He,wt){wt===!0&&(nt*=He,lt*=He,$e*=He),pe.set(nt,lt,$e,He),Ie.equals(pe)===!1&&(e.clearColor(nt,lt,$e,He),Ie.copy(pe))},reset:function(){ue=!1,we=null,Ie.set(-1,0,0,0)}}}function i(){let ue=!1,pe=!1,we=null,Ie=null,nt=null;return{setReversed:function(lt){if(pe!==lt){let $e=t.get("EXT_clip_control");pe?$e.clipControlEXT($e.LOWER_LEFT_EXT,$e.ZERO_TO_ONE_EXT):$e.clipControlEXT($e.LOWER_LEFT_EXT,$e.NEGATIVE_ONE_TO_ONE_EXT);let He=nt;nt=null,this.setClear(He)}pe=lt},getReversed:function(){return pe},setTest:function(lt){lt?_e(e.DEPTH_TEST):ke(e.DEPTH_TEST)},setMask:function(lt){we!==lt&&!ue&&(e.depthMask(lt),we=lt)},setFunc:function(lt){if(pe&&(lt=ove[lt]),Ie!==lt){switch(lt){case E3:e.depthFunc(e.NEVER);break;case M3:e.depthFunc(e.ALWAYS);break;case S3:e.depthFunc(e.LESS);break;case Rm:e.depthFunc(e.LEQUAL);break;case I3:e.depthFunc(e.EQUAL);break;case C3:e.depthFunc(e.GEQUAL);break;case B3:e.depthFunc(e.GREATER);break;case T3:e.depthFunc(e.NOTEQUAL);break;default:e.depthFunc(e.LEQUAL)}Ie=lt}},setLocked:function(lt){ue=lt},setClear:function(lt){nt!==lt&&(pe&&(lt=1-lt),e.clearDepth(lt),nt=lt)},reset:function(){ue=!1,we=null,Ie=null,nt=null,pe=!1}}}function n(){let ue=!1,pe=null,we=null,Ie=null,nt=null,lt=null,$e=null,He=null,wt=null;return{setTest:function(Yt){ue||(Yt?_e(e.STENCIL_TEST):ke(e.STENCIL_TEST))},setMask:function(Yt){pe!==Yt&&!ue&&(e.stencilMask(Yt),pe=Yt)},setFunc:function(Yt,ur,Qt){(we!==Yt||Ie!==ur||nt!==Qt)&&(e.stencilFunc(Yt,ur,Qt),we=Yt,Ie=ur,nt=Qt)},setOp:function(Yt,ur,Qt){(lt!==Yt||$e!==ur||He!==Qt)&&(e.stencilOp(Yt,ur,Qt),lt=Yt,$e=ur,He=Qt)},setLocked:function(Yt){ue=Yt},setClear:function(Yt){wt!==Yt&&(e.clearStencil(Yt),wt=Yt)},reset:function(){ue=!1,pe=null,we=null,Ie=null,nt=null,lt=null,$e=null,He=null,wt=null}}}let a=new r,o=new i,s=new n,l=new WeakMap,u=new WeakMap,c={},h={},d=new WeakMap,p=[],f=null,m=!1,g=null,v=null,_=null,x=null,b=null,E=null,M=null,S=new Dt(0,0,0),D=0,T=!1,P=null,k=null,R=null,F=null,B=null,z=e.getParameter(e.MAX_COMBINED_TEXTURE_IMAGE_UNITS),O=!1,j=0,Y=e.getParameter(e.VERSION);Y.indexOf("WebGL")!==-1?(j=parseFloat(/^WebGL (\\d)/.exec(Y)[1]),O=j>=1):Y.indexOf("OpenGL ES")!==-1&&(j=parseFloat(/^OpenGL ES (\\d)/.exec(Y)[1]),O=j>=2);let Z=null,ne={},ie=e.getParameter(e.SCISSOR_BOX),le=e.getParameter(e.VIEWPORT),X=new wi().fromArray(ie),ce=new wi().fromArray(le);function ge(ue,pe,we,Ie){let nt=new Uint8Array(4),lt=e.createTexture();e.bindTexture(ue,lt),e.texParameteri(ue,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texParameteri(ue,e.TEXTURE_MAG_FILTER,e.NEAREST);for(let $e=0;$e<we;$e++)ue===e.TEXTURE_3D||ue===e.TEXTURE_2D_ARRAY?e.texImage3D(pe,0,e.RGBA,1,1,Ie,0,e.RGBA,e.UNSIGNED_BYTE,nt):e.texImage2D(pe+$e,0,e.RGBA,1,1,0,e.RGBA,e.UNSIGNED_BYTE,nt);return lt}let be={};be[e.TEXTURE_2D]=ge(e.TEXTURE_2D,e.TEXTURE_2D,1),be[e.TEXTURE_CUBE_MAP]=ge(e.TEXTURE_CUBE_MAP,e.TEXTURE_CUBE_MAP_POSITIVE_X,6),be[e.TEXTURE_2D_ARRAY]=ge(e.TEXTURE_2D_ARRAY,e.TEXTURE_2D_ARRAY,1,1),be[e.TEXTURE_3D]=ge(e.TEXTURE_3D,e.TEXTURE_3D,1,1),a.setClear(0,0,0,1),o.setClear(1),s.setClear(0),_e(e.DEPTH_TEST),o.setFunc(Rm),Ke(!1),Le(b9),_e(e.CULL_FACE),it(Du);function _e(ue){c[ue]!==!0&&(e.enable(ue),c[ue]=!0)}function ke(ue){c[ue]!==!1&&(e.disable(ue),c[ue]=!1)}function Ye(ue,pe){return h[ue]!==pe?(e.bindFramebuffer(ue,pe),h[ue]=pe,ue===e.DRAW_FRAMEBUFFER&&(h[e.FRAMEBUFFER]=pe),ue===e.FRAMEBUFFER&&(h[e.DRAW_FRAMEBUFFER]=pe),!0):!1}function We(ue,pe){let we=p,Ie=!1;if(ue){we=d.get(pe),we===void 0&&(we=[],d.set(pe,we));let nt=ue.textures;if(we.length!==nt.length||we[0]!==e.COLOR_ATTACHMENT0){for(let lt=0,$e=nt.length;lt<$e;lt++)we[lt]=e.COLOR_ATTACHMENT0+lt;we.length=nt.length,Ie=!0}}else we[0]!==e.BACK&&(we[0]=e.BACK,Ie=!0);Ie&&e.drawBuffers(we)}function Me(ue){return f!==ue?(e.useProgram(ue),f=ue,!0):!1}let Ce={[af]:e.FUNC_ADD,[qde]:e.FUNC_SUBTRACT,[$de]:e.FUNC_REVERSE_SUBTRACT};Ce[epe]=e.MIN,Ce[tpe]=e.MAX;let oe={[rpe]:e.ZERO,[ipe]:e.ONE,[npe]:e.SRC_COLOR,[b3]:e.SRC_ALPHA,[cpe]:e.SRC_ALPHA_SATURATE,[lpe]:e.DST_COLOR,[ope]:e.DST_ALPHA,[ape]:e.ONE_MINUS_SRC_COLOR,[w3]:e.ONE_MINUS_SRC_ALPHA,[upe]:e.ONE_MINUS_DST_COLOR,[spe]:e.ONE_MINUS_DST_ALPHA,[hpe]:e.CONSTANT_COLOR,[dpe]:e.ONE_MINUS_CONSTANT_COLOR,[ppe]:e.CONSTANT_ALPHA,[fpe]:e.ONE_MINUS_CONSTANT_ALPHA};function it(ue,pe,we,Ie,nt,lt,$e,He,wt,Yt){if(ue===Du){m===!0&&(ke(e.BLEND),m=!1);return}if(m===!1&&(_e(e.BLEND),m=!0),ue!==Kde){if(ue!==g||Yt!==T){if((v!==af||b!==af)&&(e.blendEquation(e.FUNC_ADD),v=af,b=af),Yt)switch(ue){case Tm:e.blendFuncSeparate(e.ONE,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA);break;case w9:e.blendFunc(e.ONE,e.ONE);break;case E9:e.blendFuncSeparate(e.ZERO,e.ONE_MINUS_SRC_COLOR,e.ZERO,e.ONE);break;case M9:e.blendFuncSeparate(e.ZERO,e.SRC_COLOR,e.ZERO,e.SRC_ALPHA);break;default:console.error("THREE.WebGLState: Invalid blending: ",ue);break}else switch(ue){case Tm:e.blendFuncSeparate(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA);break;case w9:e.blendFunc(e.SRC_ALPHA,e.ONE);break;case E9:e.blendFuncSeparate(e.ZERO,e.ONE_MINUS_SRC_COLOR,e.ZERO,e.ONE);break;case M9:e.blendFunc(e.ZERO,e.SRC_COLOR);break;default:console.error("THREE.WebGLState: Invalid blending: ",ue);break}_=null,x=null,E=null,M=null,S.set(0,0,0),D=0,g=ue,T=Yt}return}nt=nt||pe,lt=lt||we,$e=$e||Ie,(pe!==v||nt!==b)&&(e.blendEquationSeparate(Ce[pe],Ce[nt]),v=pe,b=nt),(we!==_||Ie!==x||lt!==E||$e!==M)&&(e.blendFuncSeparate(oe[we],oe[Ie],oe[lt],oe[$e]),_=we,x=Ie,E=lt,M=$e),(He.equals(S)===!1||wt!==D)&&(e.blendColor(He.r,He.g,He.b,wt),S.copy(He),D=wt),g=ue,T=!1}function Oe(ue,pe){ue.side===kn?ke(e.CULL_FACE):_e(e.CULL_FACE);let we=ue.side===La;pe&&(we=!we),Ke(we),ue.blending===Tm&&ue.transparent===!1?it(Du):it(ue.blending,ue.blendEquation,ue.blendSrc,ue.blendDst,ue.blendEquationAlpha,ue.blendSrcAlpha,ue.blendDstAlpha,ue.blendColor,ue.blendAlpha,ue.premultipliedAlpha),o.setFunc(ue.depthFunc),o.setTest(ue.depthTest),o.setMask(ue.depthWrite),a.setMask(ue.colorWrite);let Ie=ue.stencilWrite;s.setTest(Ie),Ie&&(s.setMask(ue.stencilWriteMask),s.setFunc(ue.stencilFunc,ue.stencilRef,ue.stencilFuncMask),s.setOp(ue.stencilFail,ue.stencilZFail,ue.stencilZPass)),ut(ue.polygonOffset,ue.polygonOffsetFactor,ue.polygonOffsetUnits),ue.alphaToCoverage===!0?_e(e.SAMPLE_ALPHA_TO_COVERAGE):ke(e.SAMPLE_ALPHA_TO_COVERAGE)}function Ke(ue){P!==ue&&(ue?e.frontFace(e.CW):e.frontFace(e.CCW),P=ue)}function Le(ue){ue!==Zde?(_e(e.CULL_FACE),ue!==k&&(ue===b9?e.cullFace(e.BACK):ue===Xde?e.cullFace(e.FRONT):e.cullFace(e.FRONT_AND_BACK))):ke(e.CULL_FACE),k=ue}function Ze(ue){ue!==R&&(O&&e.lineWidth(ue),R=ue)}function ut(ue,pe,we){ue?(_e(e.POLYGON_OFFSET_FILL),(F!==pe||B!==we)&&(e.polygonOffset(pe,we),F=pe,B=we)):ke(e.POLYGON_OFFSET_FILL)}function et(ue){ue?_e(e.SCISSOR_TEST):ke(e.SCISSOR_TEST)}function te(ue){ue===void 0&&(ue=e.TEXTURE0+z-1),Z!==ue&&(e.activeTexture(ue),Z=ue)}function K(ue,pe,we){we===void 0&&(Z===null?we=e.TEXTURE0+z-1:we=Z);let Ie=ne[we];Ie===void 0&&(Ie={type:void 0,texture:void 0},ne[we]=Ie),(Ie.type!==ue||Ie.texture!==pe)&&(Z!==we&&(e.activeTexture(we),Z=we),e.bindTexture(ue,pe||be[ue]),Ie.type=ue,Ie.texture=pe)}function ve(){let ue=ne[Z];ue!==void 0&&ue.type!==void 0&&(e.bindTexture(ue.type,null),ue.type=void 0,ue.texture=void 0)}function je(){try{e.compressedTexImage2D.apply(e,arguments)}catch(ue){console.error("THREE.WebGLState:",ue)}}function Ne(){try{e.compressedTexImage3D.apply(e,arguments)}catch(ue){console.error("THREE.WebGLState:",ue)}}function Ue(){try{e.texSubImage2D.apply(e,arguments)}catch(ue){console.error("THREE.WebGLState:",ue)}}function ft(){try{e.texSubImage3D.apply(e,arguments)}catch(ue){console.error("THREE.WebGLState:",ue)}}function ot(){try{e.compressedTexSubImage2D.apply(e,arguments)}catch(ue){console.error("THREE.WebGLState:",ue)}}function Ae(){try{e.compressedTexSubImage3D.apply(e,arguments)}catch(ue){console.error("THREE.WebGLState:",ue)}}function Q(){try{e.texStorage2D.apply(e,arguments)}catch(ue){console.error("THREE.WebGLState:",ue)}}function G(){try{e.texStorage3D.apply(e,arguments)}catch(ue){console.error("THREE.WebGLState:",ue)}}function W(){try{e.texImage2D.apply(e,arguments)}catch(ue){console.error("THREE.WebGLState:",ue)}}function re(){try{e.texImage3D.apply(e,arguments)}catch(ue){console.error("THREE.WebGLState:",ue)}}function $(ue){X.equals(ue)===!1&&(e.scissor(ue.x,ue.y,ue.z,ue.w),X.copy(ue))}function me(ue){ce.equals(ue)===!1&&(e.viewport(ue.x,ue.y,ue.z,ue.w),ce.copy(ue))}function ye(ue,pe){let we=u.get(pe);we===void 0&&(we=new WeakMap,u.set(pe,we));let Ie=we.get(ue);Ie===void 0&&(Ie=e.getUniformBlockIndex(pe,ue.name),we.set(ue,Ie))}function Be(ue,pe){let we=u.get(pe).get(ue);l.get(pe)!==we&&(e.uniformBlockBinding(pe,we,ue.__bindingPointIndex),l.set(pe,we))}function Ge(){e.disable(e.BLEND),e.disable(e.CULL_FACE),e.disable(e.DEPTH_TEST),e.disable(e.POLYGON_OFFSET_FILL),e.disable(e.SCISSOR_TEST),e.disable(e.STENCIL_TEST),e.disable(e.SAMPLE_ALPHA_TO_COVERAGE),e.blendEquation(e.FUNC_ADD),e.blendFunc(e.ONE,e.ZERO),e.blendFuncSeparate(e.ONE,e.ZERO,e.ONE,e.ZERO),e.blendColor(0,0,0,0),e.colorMask(!0,!0,!0,!0),e.clearColor(0,0,0,0),e.depthMask(!0),e.depthFunc(e.LESS),o.setReversed(!1),e.clearDepth(1),e.stencilMask(4294967295),e.stencilFunc(e.ALWAYS,0,4294967295),e.stencilOp(e.KEEP,e.KEEP,e.KEEP),e.clearStencil(0),e.cullFace(e.BACK),e.frontFace(e.CCW),e.polygonOffset(0,0),e.activeTexture(e.TEXTURE0),e.bindFramebuffer(e.FRAMEBUFFER,null),e.bindFramebuffer(e.DRAW_FRAMEBUFFER,null),e.bindFramebuffer(e.READ_FRAMEBUFFER,null),e.useProgram(null),e.lineWidth(1),e.scissor(0,0,e.canvas.width,e.canvas.height),e.viewport(0,0,e.canvas.width,e.canvas.height),c={},Z=null,ne={},h={},d=new WeakMap,p=[],f=null,m=!1,g=null,v=null,_=null,x=null,b=null,E=null,M=null,S=new Dt(0,0,0),D=0,T=!1,P=null,k=null,R=null,F=null,B=null,X.set(0,0,e.canvas.width,e.canvas.height),ce.set(0,0,e.canvas.width,e.canvas.height),a.reset(),o.reset(),s.reset()}return{buffers:{color:a,depth:o,stencil:s},enable:_e,disable:ke,bindFramebuffer:Ye,drawBuffers:We,useProgram:Me,setBlending:it,setMaterial:Oe,setFlipSided:Ke,setCullFace:Le,setLineWidth:Ze,setPolygonOffset:ut,setScissorTest:et,activeTexture:te,bindTexture:K,unbindTexture:ve,compressedTexImage2D:je,compressedTexImage3D:Ne,texImage2D:W,texImage3D:re,updateUBOMapping:ye,uniformBlockBinding:Be,texStorage2D:Q,texStorage3D:G,texSubImage2D:Ue,texSubImage3D:ft,compressedTexSubImage2D:ot,compressedTexSubImage3D:Ae,scissor:$,viewport:me,reset:Ge}}function lve(e,t,r,i,n,a,o){let s=t.has("WEBGL_multisampled_render_to_texture")?t.get("WEBGL_multisampled_render_to_texture"):null,l=typeof navigator>"u"?!1:/OculusBrowser/g.test(navigator.userAgent),u=new vt,c=new WeakMap,h,d=new WeakMap,p=!1;try{p=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch(te){}function f(te,K){return p?new OffscreenCanvas(te,K):fv("canvas")}function m(te,K,ve){let je=1,Ne=et(te);if((Ne.width>ve||Ne.height>ve)&&(je=ve/Math.max(Ne.width,Ne.height)),je<1)if(typeof HTMLImageElement<"u"&&te instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&te instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&te instanceof ImageBitmap||typeof VideoFrame<"u"&&te instanceof VideoFrame){let Ue=Math.floor(je*Ne.width),ft=Math.floor(je*Ne.height);h===void 0&&(h=f(Ue,ft));let ot=K?f(Ue,ft):h;return ot.width=Ue,ot.height=ft,ot.getContext("2d").drawImage(te,0,0,Ue,ft),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+Ne.width+"x"+Ne.height+") to ("+Ue+"x"+ft+")."),ot}else return"data"in te&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+Ne.width+"x"+Ne.height+")."),te;return te}function g(te){return te.generateMipmaps}function v(te){e.generateMipmap(te)}function _(te){return te.isWebGLCubeRenderTarget?e.TEXTURE_CUBE_MAP:te.isWebGL3DRenderTarget?e.TEXTURE_3D:te.isWebGLArrayRenderTarget||te.isCompressedArrayTexture?e.TEXTURE_2D_ARRAY:e.TEXTURE_2D}function x(te,K,ve,je,Ne=!1){if(te!==null){if(e[te]!==void 0)return e[te];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+te+"'")}let Ue=K;if(K===e.RED&&(ve===e.FLOAT&&(Ue=e.R32F),ve===e.HALF_FLOAT&&(Ue=e.R16F),ve===e.UNSIGNED_BYTE&&(Ue=e.R8)),K===e.RED_INTEGER&&(ve===e.UNSIGNED_BYTE&&(Ue=e.R8UI),ve===e.UNSIGNED_SHORT&&(Ue=e.R16UI),ve===e.UNSIGNED_INT&&(Ue=e.R32UI),ve===e.BYTE&&(Ue=e.R8I),ve===e.SHORT&&(Ue=e.R16I),ve===e.INT&&(Ue=e.R32I)),K===e.RG&&(ve===e.FLOAT&&(Ue=e.RG32F),ve===e.HALF_FLOAT&&(Ue=e.RG16F),ve===e.UNSIGNED_BYTE&&(Ue=e.RG8)),K===e.RG_INTEGER&&(ve===e.UNSIGNED_BYTE&&(Ue=e.RG8UI),ve===e.UNSIGNED_SHORT&&(Ue=e.RG16UI),ve===e.UNSIGNED_INT&&(Ue=e.RG32UI),ve===e.BYTE&&(Ue=e.RG8I),ve===e.SHORT&&(Ue=e.RG16I),ve===e.INT&&(Ue=e.RG32I)),K===e.RGB_INTEGER&&(ve===e.UNSIGNED_BYTE&&(Ue=e.RGB8UI),ve===e.UNSIGNED_SHORT&&(Ue=e.RGB16UI),ve===e.UNSIGNED_INT&&(Ue=e.RGB32UI),ve===e.BYTE&&(Ue=e.RGB8I),ve===e.SHORT&&(Ue=e.RGB16I),ve===e.INT&&(Ue=e.RGB32I)),K===e.RGBA_INTEGER&&(ve===e.UNSIGNED_BYTE&&(Ue=e.RGBA8UI),ve===e.UNSIGNED_SHORT&&(Ue=e.RGBA16UI),ve===e.UNSIGNED_INT&&(Ue=e.RGBA32UI),ve===e.BYTE&&(Ue=e.RGBA8I),ve===e.SHORT&&(Ue=e.RGBA16I),ve===e.INT&&(Ue=e.RGBA32I)),K===e.RGB&&ve===e.UNSIGNED_INT_5_9_9_9_REV&&(Ue=e.RGB9_E5),K===e.RGBA){let ft=Ne?hE:Ai.getTransfer(je);ve===e.FLOAT&&(Ue=e.RGBA32F),ve===e.HALF_FLOAT&&(Ue=e.RGBA16F),ve===e.UNSIGNED_BYTE&&(Ue=ft===rn?e.SRGB8_ALPHA8:e.RGBA8),ve===e.UNSIGNED_SHORT_4_4_4_4&&(Ue=e.RGBA4),ve===e.UNSIGNED_SHORT_5_5_5_1&&(Ue=e.RGB5_A1)}return(Ue===e.R16F||Ue===e.R32F||Ue===e.RG16F||Ue===e.RG32F||Ue===e.RGBA16F||Ue===e.RGBA32F)&&t.get("EXT_color_buffer_float"),Ue}function b(te,K){let ve;return te?K===null||K===ud||K===Lm?ve=e.DEPTH24_STENCIL8:K===Po?ve=e.DEPTH32F_STENCIL8:K===uf&&(ve=e.DEPTH24_STENCIL8,console.warn("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):K===null||K===ud||K===Lm?ve=e.DEPTH_COMPONENT24:K===Po?ve=e.DEPTH_COMPONENT32F:K===uf&&(ve=e.DEPTH_COMPONENT16),ve}function E(te,K){return g(te)===!0||te.isFramebufferTexture&&te.minFilter!==Oa&&te.minFilter!==Rn?Math.log2(Math.max(K.width,K.height))+1:te.mipmaps!==void 0&&te.mipmaps.length>0?te.mipmaps.length:te.isCompressedTexture&&Array.isArray(te.image)?K.mipmaps.length:1}function M(te){let K=te.target;K.removeEventListener("dispose",M),D(K),K.isVideoTexture&&c.delete(K)}function S(te){let K=te.target;K.removeEventListener("dispose",S),P(K)}function D(te){let K=i.get(te);if(K.__webglInit===void 0)return;let ve=te.source,je=d.get(ve);if(je){let Ne=je[K.__cacheKey];Ne.usedTimes--,Ne.usedTimes===0&&T(te),Object.keys(je).length===0&&d.delete(ve)}i.remove(te)}function T(te){let K=i.get(te);e.deleteTexture(K.__webglTexture);let ve=te.source,je=d.get(ve);delete je[K.__cacheKey],o.memory.textures--}function P(te){let K=i.get(te);if(te.depthTexture&&(te.depthTexture.dispose(),i.remove(te.depthTexture)),te.isWebGLCubeRenderTarget)for(let je=0;je<6;je++){if(Array.isArray(K.__webglFramebuffer[je]))for(let Ne=0;Ne<K.__webglFramebuffer[je].length;Ne++)e.deleteFramebuffer(K.__webglFramebuffer[je][Ne]);else e.deleteFramebuffer(K.__webglFramebuffer[je]);K.__webglDepthbuffer&&e.deleteRenderbuffer(K.__webglDepthbuffer[je])}else{if(Array.isArray(K.__webglFramebuffer))for(let je=0;je<K.__webglFramebuffer.length;je++)e.deleteFramebuffer(K.__webglFramebuffer[je]);else e.deleteFramebuffer(K.__webglFramebuffer);if(K.__webglDepthbuffer&&e.deleteRenderbuffer(K.__webglDepthbuffer),K.__webglMultisampledFramebuffer&&e.deleteFramebuffer(K.__webglMultisampledFramebuffer),K.__webglColorRenderbuffer)for(let je=0;je<K.__webglColorRenderbuffer.length;je++)K.__webglColorRenderbuffer[je]&&e.deleteRenderbuffer(K.__webglColorRenderbuffer[je]);K.__webglDepthRenderbuffer&&e.deleteRenderbuffer(K.__webglDepthRenderbuffer)}let ve=te.textures;for(let je=0,Ne=ve.length;je<Ne;je++){let Ue=i.get(ve[je]);Ue.__webglTexture&&(e.deleteTexture(Ue.__webglTexture),o.memory.textures--),i.remove(ve[je])}i.remove(te)}let k=0;function R(){k=0}function F(){let te=k;return te>=n.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+te+" texture units while this GPU supports only "+n.maxTextures),k+=1,te}function B(te){let K=[];return K.push(te.wrapS),K.push(te.wrapT),K.push(te.wrapR||0),K.push(te.magFilter),K.push(te.minFilter),K.push(te.anisotropy),K.push(te.internalFormat),K.push(te.format),K.push(te.type),K.push(te.generateMipmaps),K.push(te.premultiplyAlpha),K.push(te.flipY),K.push(te.unpackAlignment),K.push(te.colorSpace),K.join()}function z(te,K){let ve=i.get(te);if(te.isVideoTexture&&Ze(te),te.isRenderTargetTexture===!1&&te.version>0&&ve.__version!==te.version){let je=te.image;if(je===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(je.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{ce(ve,te,K);return}}r.bindTexture(e.TEXTURE_2D,ve.__webglTexture,e.TEXTURE0+K)}function O(te,K){let ve=i.get(te);if(te.version>0&&ve.__version!==te.version){ce(ve,te,K);return}r.bindTexture(e.TEXTURE_2D_ARRAY,ve.__webglTexture,e.TEXTURE0+K)}function j(te,K){let ve=i.get(te);if(te.version>0&&ve.__version!==te.version){ce(ve,te,K);return}r.bindTexture(e.TEXTURE_3D,ve.__webglTexture,e.TEXTURE0+K)}function Y(te,K){let ve=i.get(te);if(te.version>0&&ve.__version!==te.version){ge(ve,te,K);return}r.bindTexture(e.TEXTURE_CUBE_MAP,ve.__webglTexture,e.TEXTURE0+K)}let Z={[wa]:e.REPEAT,[Ll]:e.CLAMP_TO_EDGE,[lf]:e.MIRRORED_REPEAT},ne={[Oa]:e.NEAREST,[yv]:e.NEAREST_MIPMAP_NEAREST,[od]:e.NEAREST_MIPMAP_LINEAR,[Rn]:e.LINEAR,[sf]:e.LINEAR_MIPMAP_NEAREST,[el]:e.LINEAR_MIPMAP_LINEAR},ie={[Cpe]:e.NEVER,[Rpe]:e.ALWAYS,[Bpe]:e.LESS,[aV]:e.LEQUAL,[Tpe]:e.EQUAL,[kpe]:e.GEQUAL,[Ppe]:e.GREATER,[Dpe]:e.NOTEQUAL};function le(te,K){if(K.type===Po&&t.has("OES_texture_float_linear")===!1&&(K.magFilter===Rn||K.magFilter===sf||K.magFilter===od||K.magFilter===el||K.minFilter===Rn||K.minFilter===sf||K.minFilter===od||K.minFilter===el)&&console.warn("THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),e.texParameteri(te,e.TEXTURE_WRAP_S,Z[K.wrapS]),e.texParameteri(te,e.TEXTURE_WRAP_T,Z[K.wrapT]),(te===e.TEXTURE_3D||te===e.TEXTURE_2D_ARRAY)&&e.texParameteri(te,e.TEXTURE_WRAP_R,Z[K.wrapR]),e.texParameteri(te,e.TEXTURE_MAG_FILTER,ne[K.magFilter]),e.texParameteri(te,e.TEXTURE_MIN_FILTER,ne[K.minFilter]),K.compareFunction&&(e.texParameteri(te,e.TEXTURE_COMPARE_MODE,e.COMPARE_REF_TO_TEXTURE),e.texParameteri(te,e.TEXTURE_COMPARE_FUNC,ie[K.compareFunction])),t.has("EXT_texture_filter_anisotropic")===!0){if(K.magFilter===Oa||K.minFilter!==od&&K.minFilter!==el||K.type===Po&&t.has("OES_texture_float_linear")===!1)return;if(K.anisotropy>1||i.get(K).__currentAnisotropy){let ve=t.get("EXT_texture_filter_anisotropic");e.texParameterf(te,ve.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(K.anisotropy,n.getMaxAnisotropy())),i.get(K).__currentAnisotropy=K.anisotropy}}}function X(te,K){let ve=!1;te.__webglInit===void 0&&(te.__webglInit=!0,K.addEventListener("dispose",M));let je=K.source,Ne=d.get(je);Ne===void 0&&(Ne={},d.set(je,Ne));let Ue=B(K);if(Ue!==te.__cacheKey){Ne[Ue]===void 0&&(Ne[Ue]={texture:e.createTexture(),usedTimes:0},o.memory.textures++,ve=!0),Ne[Ue].usedTimes++;let ft=Ne[te.__cacheKey];ft!==void 0&&(Ne[te.__cacheKey].usedTimes--,ft.usedTimes===0&&T(K)),te.__cacheKey=Ue,te.__webglTexture=Ne[Ue].texture}return ve}function ce(te,K,ve){let je=e.TEXTURE_2D;(K.isDataArrayTexture||K.isCompressedArrayTexture)&&(je=e.TEXTURE_2D_ARRAY),K.isData3DTexture&&(je=e.TEXTURE_3D);let Ne=X(te,K),Ue=K.source;r.bindTexture(je,te.__webglTexture,e.TEXTURE0+ve);let ft=i.get(Ue);if(Ue.version!==ft.__version||Ne===!0){r.activeTexture(e.TEXTURE0+ve);let ot=Ai.getPrimaries(Ai.workingColorSpace),Ae=K.colorSpace===Tu?null:Ai.getPrimaries(K.colorSpace),Q=K.colorSpace===Tu||ot===Ae?e.NONE:e.BROWSER_DEFAULT_WEBGL;e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,K.flipY),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,K.premultiplyAlpha),e.pixelStorei(e.UNPACK_ALIGNMENT,K.unpackAlignment),e.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,Q);let G=m(K.image,!1,n.maxTextureSize);G=ut(K,G);let W=a.convert(K.format,K.colorSpace),re=a.convert(K.type),$=x(K.internalFormat,W,re,K.colorSpace,K.isVideoTexture);le(je,K);let me,ye=K.mipmaps,Be=K.isVideoTexture!==!0,Ge=ft.__version===void 0||Ne===!0,ue=Ue.dataReady,pe=E(K,G);if(K.isDepthTexture)$=b(K.format===Om,K.type),Ge&&(Be?r.texStorage2D(e.TEXTURE_2D,1,$,G.width,G.height):r.texImage2D(e.TEXTURE_2D,0,$,G.width,G.height,0,W,re,null));else if(K.isDataTexture)if(ye.length>0){Be&&Ge&&r.texStorage2D(e.TEXTURE_2D,pe,$,ye[0].width,ye[0].height);for(let we=0,Ie=ye.length;we<Ie;we++)me=ye[we],Be?ue&&r.texSubImage2D(e.TEXTURE_2D,we,0,0,me.width,me.height,W,re,me.data):r.texImage2D(e.TEXTURE_2D,we,$,me.width,me.height,0,W,re,me.data);K.generateMipmaps=!1}else Be?(Ge&&r.texStorage2D(e.TEXTURE_2D,pe,$,G.width,G.height),ue&&r.texSubImage2D(e.TEXTURE_2D,0,0,0,G.width,G.height,W,re,G.data)):r.texImage2D(e.TEXTURE_2D,0,$,G.width,G.height,0,W,re,G.data);else if(K.isCompressedTexture)if(K.isCompressedArrayTexture){Be&&Ge&&r.texStorage3D(e.TEXTURE_2D_ARRAY,pe,$,ye[0].width,ye[0].height,G.depth);for(let we=0,Ie=ye.length;we<Ie;we++)if(me=ye[we],K.format!==Xn)if(W!==null)if(Be){if(ue)if(K.layerUpdates.size>0){let nt=_G(me.width,me.height,K.format,K.type);for(let lt of K.layerUpdates){let $e=me.data.subarray(lt*nt/me.data.BYTES_PER_ELEMENT,(lt+1)*nt/me.data.BYTES_PER_ELEMENT);r.compressedTexSubImage3D(e.TEXTURE_2D_ARRAY,we,0,0,lt,me.width,me.height,1,W,$e)}K.clearLayerUpdates()}else r.compressedTexSubImage3D(e.TEXTURE_2D_ARRAY,we,0,0,0,me.width,me.height,G.depth,W,me.data)}else r.compressedTexImage3D(e.TEXTURE_2D_ARRAY,we,$,me.width,me.height,G.depth,0,me.data,0,0);else console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else Be?ue&&r.texSubImage3D(e.TEXTURE_2D_ARRAY,we,0,0,0,me.width,me.height,G.depth,W,re,me.data):r.texImage3D(e.TEXTURE_2D_ARRAY,we,$,me.width,me.height,G.depth,0,W,re,me.data)}else{Be&&Ge&&r.texStorage2D(e.TEXTURE_2D,pe,$,ye[0].width,ye[0].height);for(let we=0,Ie=ye.length;we<Ie;we++)me=ye[we],K.format!==Xn?W!==null?Be?ue&&r.compressedTexSubImage2D(e.TEXTURE_2D,we,0,0,me.width,me.height,W,me.data):r.compressedTexImage2D(e.TEXTURE_2D,we,$,me.width,me.height,0,me.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):Be?ue&&r.texSubImage2D(e.TEXTURE_2D,we,0,0,me.width,me.height,W,re,me.data):r.texImage2D(e.TEXTURE_2D,we,$,me.width,me.height,0,W,re,me.data)}else if(K.isDataArrayTexture)if(Be){if(Ge&&r.texStorage3D(e.TEXTURE_2D_ARRAY,pe,$,G.width,G.height,G.depth),ue)if(K.layerUpdates.size>0){let we=_G(G.width,G.height,K.format,K.type);for(let Ie of K.layerUpdates){let nt=G.data.subarray(Ie*we/G.data.BYTES_PER_ELEMENT,(Ie+1)*we/G.data.BYTES_PER_ELEMENT);r.texSubImage3D(e.TEXTURE_2D_ARRAY,0,0,0,Ie,G.width,G.height,1,W,re,nt)}K.clearLayerUpdates()}else r.texSubImage3D(e.TEXTURE_2D_ARRAY,0,0,0,0,G.width,G.height,G.depth,W,re,G.data)}else r.texImage3D(e.TEXTURE_2D_ARRAY,0,$,G.width,G.height,G.depth,0,W,re,G.data);else if(K.isData3DTexture)Be?(Ge&&r.texStorage3D(e.TEXTURE_3D,pe,$,G.width,G.height,G.depth),ue&&r.texSubImage3D(e.TEXTURE_3D,0,0,0,0,G.width,G.height,G.depth,W,re,G.data)):r.texImage3D(e.TEXTURE_3D,0,$,G.width,G.height,G.depth,0,W,re,G.data);else if(K.isFramebufferTexture){if(Ge)if(Be)r.texStorage2D(e.TEXTURE_2D,pe,$,G.width,G.height);else{let we=G.width,Ie=G.height;for(let nt=0;nt<pe;nt++)r.texImage2D(e.TEXTURE_2D,nt,$,we,Ie,0,W,re,null),we>>=1,Ie>>=1}}else if(ye.length>0){if(Be&&Ge){let we=et(ye[0]);r.texStorage2D(e.TEXTURE_2D,pe,$,we.width,we.height)}for(let we=0,Ie=ye.length;we<Ie;we++)me=ye[we],Be?ue&&r.texSubImage2D(e.TEXTURE_2D,we,0,0,W,re,me):r.texImage2D(e.TEXTURE_2D,we,$,W,re,me);K.generateMipmaps=!1}else if(Be){if(Ge){let we=et(G);r.texStorage2D(e.TEXTURE_2D,pe,$,we.width,we.height)}ue&&r.texSubImage2D(e.TEXTURE_2D,0,0,0,W,re,G)}else r.texImage2D(e.TEXTURE_2D,0,$,W,re,G);g(K)&&v(je),ft.__version=Ue.version,K.onUpdate&&K.onUpdate(K)}te.__version=K.version}function ge(te,K,ve){if(K.image.length!==6)return;let je=X(te,K),Ne=K.source;r.bindTexture(e.TEXTURE_CUBE_MAP,te.__webglTexture,e.TEXTURE0+ve);let Ue=i.get(Ne);if(Ne.version!==Ue.__version||je===!0){r.activeTexture(e.TEXTURE0+ve);let ft=Ai.getPrimaries(Ai.workingColorSpace),ot=K.colorSpace===Tu?null:Ai.getPrimaries(K.colorSpace),Ae=K.colorSpace===Tu||ft===ot?e.NONE:e.BROWSER_DEFAULT_WEBGL;e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,K.flipY),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,K.premultiplyAlpha),e.pixelStorei(e.UNPACK_ALIGNMENT,K.unpackAlignment),e.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,Ae);let Q=K.isCompressedTexture||K.image[0].isCompressedTexture,G=K.image[0]&&K.image[0].isDataTexture,W=[];for(let Ie=0;Ie<6;Ie++)!Q&&!G?W[Ie]=m(K.image[Ie],!0,n.maxCubemapSize):W[Ie]=G?K.image[Ie].image:K.image[Ie],W[Ie]=ut(K,W[Ie]);let re=W[0],$=a.convert(K.format,K.colorSpace),me=a.convert(K.type),ye=x(K.internalFormat,$,me,K.colorSpace),Be=K.isVideoTexture!==!0,Ge=Ue.__version===void 0||je===!0,ue=Ne.dataReady,pe=E(K,re);le(e.TEXTURE_CUBE_MAP,K);let we;if(Q){Be&&Ge&&r.texStorage2D(e.TEXTURE_CUBE_MAP,pe,ye,re.width,re.height);for(let Ie=0;Ie<6;Ie++){we=W[Ie].mipmaps;for(let nt=0;nt<we.length;nt++){let lt=we[nt];K.format!==Xn?$!==null?Be?ue&&r.compressedTexSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+Ie,nt,0,0,lt.width,lt.height,$,lt.data):r.compressedTexImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+Ie,nt,ye,lt.width,lt.height,0,lt.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):Be?ue&&r.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+Ie,nt,0,0,lt.width,lt.height,$,me,lt.data):r.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+Ie,nt,ye,lt.width,lt.height,0,$,me,lt.data)}}}else{if(we=K.mipmaps,Be&&Ge){we.length>0&&pe++;let Ie=et(W[0]);r.texStorage2D(e.TEXTURE_CUBE_MAP,pe,ye,Ie.width,Ie.height)}for(let Ie=0;Ie<6;Ie++)if(G){Be?ue&&r.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+Ie,0,0,0,W[Ie].width,W[Ie].height,$,me,W[Ie].data):r.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+Ie,0,ye,W[Ie].width,W[Ie].height,0,$,me,W[Ie].data);for(let nt=0;nt<we.length;nt++){let lt=we[nt].image[Ie].image;Be?ue&&r.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+Ie,nt+1,0,0,lt.width,lt.height,$,me,lt.data):r.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+Ie,nt+1,ye,lt.width,lt.height,0,$,me,lt.data)}}else{Be?ue&&r.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+Ie,0,0,0,$,me,W[Ie]):r.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+Ie,0,ye,$,me,W[Ie]);for(let nt=0;nt<we.length;nt++){let lt=we[nt];Be?ue&&r.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+Ie,nt+1,0,0,$,me,lt.image[Ie]):r.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+Ie,nt+1,ye,$,me,lt.image[Ie])}}}g(K)&&v(e.TEXTURE_CUBE_MAP),Ue.__version=Ne.version,K.onUpdate&&K.onUpdate(K)}te.__version=K.version}function be(te,K,ve,je,Ne,Ue){let ft=a.convert(ve.format,ve.colorSpace),ot=a.convert(ve.type),Ae=x(ve.internalFormat,ft,ot,ve.colorSpace),Q=i.get(K),G=i.get(ve);if(G.__renderTarget=K,!Q.__hasExternalTextures){let W=Math.max(1,K.width>>Ue),re=Math.max(1,K.height>>Ue);Ne===e.TEXTURE_3D||Ne===e.TEXTURE_2D_ARRAY?r.texImage3D(Ne,Ue,Ae,W,re,K.depth,0,ft,ot,null):r.texImage2D(Ne,Ue,Ae,W,re,0,ft,ot,null)}r.bindFramebuffer(e.FRAMEBUFFER,te),Le(K)?s.framebufferTexture2DMultisampleEXT(e.FRAMEBUFFER,je,Ne,G.__webglTexture,0,Ke(K)):(Ne===e.TEXTURE_2D||Ne>=e.TEXTURE_CUBE_MAP_POSITIVE_X&&Ne<=e.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&e.framebufferTexture2D(e.FRAMEBUFFER,je,Ne,G.__webglTexture,Ue),r.bindFramebuffer(e.FRAMEBUFFER,null)}function _e(te,K,ve){if(e.bindRenderbuffer(e.RENDERBUFFER,te),K.depthBuffer){let je=K.depthTexture,Ne=je&&je.isDepthTexture?je.type:null,Ue=b(K.stencilBuffer,Ne),ft=K.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,ot=Ke(K);Le(K)?s.renderbufferStorageMultisampleEXT(e.RENDERBUFFER,ot,Ue,K.width,K.height):ve?e.renderbufferStorageMultisample(e.RENDERBUFFER,ot,Ue,K.width,K.height):e.renderbufferStorage(e.RENDERBUFFER,Ue,K.width,K.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,ft,e.RENDERBUFFER,te)}else{let je=K.textures;for(let Ne=0;Ne<je.length;Ne++){let Ue=je[Ne],ft=a.convert(Ue.format,Ue.colorSpace),ot=a.convert(Ue.type),Ae=x(Ue.internalFormat,ft,ot,Ue.colorSpace),Q=Ke(K);ve&&Le(K)===!1?e.renderbufferStorageMultisample(e.RENDERBUFFER,Q,Ae,K.width,K.height):Le(K)?s.renderbufferStorageMultisampleEXT(e.RENDERBUFFER,Q,Ae,K.width,K.height):e.renderbufferStorage(e.RENDERBUFFER,Ae,K.width,K.height)}}e.bindRenderbuffer(e.RENDERBUFFER,null)}function ke(te,K){if(K&&K.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(r.bindFramebuffer(e.FRAMEBUFFER,te),!(K.depthTexture&&K.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");let ve=i.get(K.depthTexture);ve.__renderTarget=K,(!ve.__webglTexture||K.depthTexture.image.width!==K.width||K.depthTexture.image.height!==K.height)&&(K.depthTexture.image.width=K.width,K.depthTexture.image.height=K.height,K.depthTexture.needsUpdate=!0),z(K.depthTexture,0);let je=ve.__webglTexture,Ne=Ke(K);if(K.depthTexture.format===Pm)Le(K)?s.framebufferTexture2DMultisampleEXT(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.TEXTURE_2D,je,0,Ne):e.framebufferTexture2D(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.TEXTURE_2D,je,0);else if(K.depthTexture.format===Om)Le(K)?s.framebufferTexture2DMultisampleEXT(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.TEXTURE_2D,je,0,Ne):e.framebufferTexture2D(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.TEXTURE_2D,je,0);else throw new Error("Unknown depthTexture format")}function Ye(te){let K=i.get(te),ve=te.isWebGLCubeRenderTarget===!0;if(K.__boundDepthTexture!==te.depthTexture){let je=te.depthTexture;if(K.__depthDisposeCallback&&K.__depthDisposeCallback(),je){let Ne=()=>{delete K.__boundDepthTexture,delete K.__depthDisposeCallback,je.removeEventListener("dispose",Ne)};je.addEventListener("dispose",Ne),K.__depthDisposeCallback=Ne}K.__boundDepthTexture=je}if(te.depthTexture&&!K.__autoAllocateDepthBuffer){if(ve)throw new Error("target.depthTexture not supported in Cube render targets");ke(K.__webglFramebuffer,te)}else if(ve){K.__webglDepthbuffer=[];for(let je=0;je<6;je++)if(r.bindFramebuffer(e.FRAMEBUFFER,K.__webglFramebuffer[je]),K.__webglDepthbuffer[je]===void 0)K.__webglDepthbuffer[je]=e.createRenderbuffer(),_e(K.__webglDepthbuffer[je],te,!1);else{let Ne=te.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,Ue=K.__webglDepthbuffer[je];e.bindRenderbuffer(e.RENDERBUFFER,Ue),e.framebufferRenderbuffer(e.FRAMEBUFFER,Ne,e.RENDERBUFFER,Ue)}}else if(r.bindFramebuffer(e.FRAMEBUFFER,K.__webglFramebuffer),K.__webglDepthbuffer===void 0)K.__webglDepthbuffer=e.createRenderbuffer(),_e(K.__webglDepthbuffer,te,!1);else{let je=te.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,Ne=K.__webglDepthbuffer;e.bindRenderbuffer(e.RENDERBUFFER,Ne),e.framebufferRenderbuffer(e.FRAMEBUFFER,je,e.RENDERBUFFER,Ne)}r.bindFramebuffer(e.FRAMEBUFFER,null)}function We(te,K,ve){let je=i.get(te);K!==void 0&&be(je.__webglFramebuffer,te,te.texture,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,0),ve!==void 0&&Ye(te)}function Me(te){let K=te.texture,ve=i.get(te),je=i.get(K);te.addEventListener("dispose",S);let Ne=te.textures,Ue=te.isWebGLCubeRenderTarget===!0,ft=Ne.length>1;if(ft||(je.__webglTexture===void 0&&(je.__webglTexture=e.createTexture()),je.__version=K.version,o.memory.textures++),Ue){ve.__webglFramebuffer=[];for(let ot=0;ot<6;ot++)if(K.mipmaps&&K.mipmaps.length>0){ve.__webglFramebuffer[ot]=[];for(let Ae=0;Ae<K.mipmaps.length;Ae++)ve.__webglFramebuffer[ot][Ae]=e.createFramebuffer()}else ve.__webglFramebuffer[ot]=e.createFramebuffer()}else{if(K.mipmaps&&K.mipmaps.length>0){ve.__webglFramebuffer=[];for(let ot=0;ot<K.mipmaps.length;ot++)ve.__webglFramebuffer[ot]=e.createFramebuffer()}else ve.__webglFramebuffer=e.createFramebuffer();if(ft)for(let ot=0,Ae=Ne.length;ot<Ae;ot++){let Q=i.get(Ne[ot]);Q.__webglTexture===void 0&&(Q.__webglTexture=e.createTexture(),o.memory.textures++)}if(te.samples>0&&Le(te)===!1){ve.__webglMultisampledFramebuffer=e.createFramebuffer(),ve.__webglColorRenderbuffer=[],r.bindFramebuffer(e.FRAMEBUFFER,ve.__webglMultisampledFramebuffer);for(let ot=0;ot<Ne.length;ot++){let Ae=Ne[ot];ve.__webglColorRenderbuffer[ot]=e.createRenderbuffer(),e.bindRenderbuffer(e.RENDERBUFFER,ve.__webglColorRenderbuffer[ot]);let Q=a.convert(Ae.format,Ae.colorSpace),G=a.convert(Ae.type),W=x(Ae.internalFormat,Q,G,Ae.colorSpace,te.isXRRenderTarget===!0),re=Ke(te);e.renderbufferStorageMultisample(e.RENDERBUFFER,re,W,te.width,te.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0+ot,e.RENDERBUFFER,ve.__webglColorRenderbuffer[ot])}e.bindRenderbuffer(e.RENDERBUFFER,null),te.depthBuffer&&(ve.__webglDepthRenderbuffer=e.createRenderbuffer(),_e(ve.__webglDepthRenderbuffer,te,!0)),r.bindFramebuffer(e.FRAMEBUFFER,null)}}if(Ue){r.bindTexture(e.TEXTURE_CUBE_MAP,je.__webglTexture),le(e.TEXTURE_CUBE_MAP,K);for(let ot=0;ot<6;ot++)if(K.mipmaps&&K.mipmaps.length>0)for(let Ae=0;Ae<K.mipmaps.length;Ae++)be(ve.__webglFramebuffer[ot][Ae],te,K,e.COLOR_ATTACHMENT0,e.TEXTURE_CUBE_MAP_POSITIVE_X+ot,Ae);else be(ve.__webglFramebuffer[ot],te,K,e.COLOR_ATTACHMENT0,e.TEXTURE_CUBE_MAP_POSITIVE_X+ot,0);g(K)&&v(e.TEXTURE_CUBE_MAP),r.unbindTexture()}else if(ft){for(let ot=0,Ae=Ne.length;ot<Ae;ot++){let Q=Ne[ot],G=i.get(Q);r.bindTexture(e.TEXTURE_2D,G.__webglTexture),le(e.TEXTURE_2D,Q),be(ve.__webglFramebuffer,te,Q,e.COLOR_ATTACHMENT0+ot,e.TEXTURE_2D,0),g(Q)&&v(e.TEXTURE_2D)}r.unbindTexture()}else{let ot=e.TEXTURE_2D;if((te.isWebGL3DRenderTarget||te.isWebGLArrayRenderTarget)&&(ot=te.isWebGL3DRenderTarget?e.TEXTURE_3D:e.TEXTURE_2D_ARRAY),r.bindTexture(ot,je.__webglTexture),le(ot,K),K.mipmaps&&K.mipmaps.length>0)for(let Ae=0;Ae<K.mipmaps.length;Ae++)be(ve.__webglFramebuffer[Ae],te,K,e.COLOR_ATTACHMENT0,ot,Ae);else be(ve.__webglFramebuffer,te,K,e.COLOR_ATTACHMENT0,ot,0);g(K)&&v(ot),r.unbindTexture()}te.depthBuffer&&Ye(te)}function Ce(te){let K=te.textures;for(let ve=0,je=K.length;ve<je;ve++){let Ne=K[ve];if(g(Ne)){let Ue=_(te),ft=i.get(Ne).__webglTexture;r.bindTexture(Ue,ft),v(Ue),r.unbindTexture()}}}let oe=[],it=[];function Oe(te){if(te.samples>0){if(Le(te)===!1){let K=te.textures,ve=te.width,je=te.height,Ne=e.COLOR_BUFFER_BIT,Ue=te.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,ft=i.get(te),ot=K.length>1;if(ot)for(let Ae=0;Ae<K.length;Ae++)r.bindFramebuffer(e.FRAMEBUFFER,ft.__webglMultisampledFramebuffer),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0+Ae,e.RENDERBUFFER,null),r.bindFramebuffer(e.FRAMEBUFFER,ft.__webglFramebuffer),e.framebufferTexture2D(e.DRAW_FRAMEBUFFER,e.COLOR_ATTACHMENT0+Ae,e.TEXTURE_2D,null,0);r.bindFramebuffer(e.READ_FRAMEBUFFER,ft.__webglMultisampledFramebuffer),r.bindFramebuffer(e.DRAW_FRAMEBUFFER,ft.__webglFramebuffer);for(let Ae=0;Ae<K.length;Ae++){if(te.resolveDepthBuffer&&(te.depthBuffer&&(Ne|=e.DEPTH_BUFFER_BIT),te.stencilBuffer&&te.resolveStencilBuffer&&(Ne|=e.STENCIL_BUFFER_BIT)),ot){e.framebufferRenderbuffer(e.READ_FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.RENDERBUFFER,ft.__webglColorRenderbuffer[Ae]);let Q=i.get(K[Ae]).__webglTexture;e.framebufferTexture2D(e.DRAW_FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,Q,0)}e.blitFramebuffer(0,0,ve,je,0,0,ve,je,Ne,e.NEAREST),l===!0&&(oe.length=0,it.length=0,oe.push(e.COLOR_ATTACHMENT0+Ae),te.depthBuffer&&te.resolveDepthBuffer===!1&&(oe.push(Ue),it.push(Ue),e.invalidateFramebuffer(e.DRAW_FRAMEBUFFER,it)),e.invalidateFramebuffer(e.READ_FRAMEBUFFER,oe))}if(r.bindFramebuffer(e.READ_FRAMEBUFFER,null),r.bindFramebuffer(e.DRAW_FRAMEBUFFER,null),ot)for(let Ae=0;Ae<K.length;Ae++){r.bindFramebuffer(e.FRAMEBUFFER,ft.__webglMultisampledFramebuffer),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0+Ae,e.RENDERBUFFER,ft.__webglColorRenderbuffer[Ae]);let Q=i.get(K[Ae]).__webglTexture;r.bindFramebuffer(e.FRAMEBUFFER,ft.__webglFramebuffer),e.framebufferTexture2D(e.DRAW_FRAMEBUFFER,e.COLOR_ATTACHMENT0+Ae,e.TEXTURE_2D,Q,0)}r.bindFramebuffer(e.DRAW_FRAMEBUFFER,ft.__webglMultisampledFramebuffer)}else if(te.depthBuffer&&te.resolveDepthBuffer===!1&&l){let K=te.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT;e.invalidateFramebuffer(e.DRAW_FRAMEBUFFER,[K])}}}function Ke(te){return Math.min(n.maxSamples,te.samples)}function Le(te){let K=i.get(te);return te.samples>0&&t.has("WEBGL_multisampled_render_to_texture")===!0&&K.__useRenderToTexture!==!1}function Ze(te){let K=o.render.frame;c.get(te)!==K&&(c.set(te,K),te.update())}function ut(te,K){let ve=te.colorSpace,je=te.format,Ne=te.type;return te.isCompressedTexture===!0||te.isVideoTexture===!0||ve!==Na&&ve!==Tu&&(Ai.getTransfer(ve)===rn?(je!==Xn||Ne!==Ss)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",ve)),K}function et(te){return typeof HTMLImageElement<"u"&&te instanceof HTMLImageElement?(u.width=te.naturalWidth||te.width,u.height=te.naturalHeight||te.height):typeof VideoFrame<"u"&&te instanceof VideoFrame?(u.width=te.displayWidth,u.height=te.displayHeight):(u.width=te.width,u.height=te.height),u}this.allocateTextureUnit=F,this.resetTextureUnits=R,this.setTexture2D=z,this.setTexture2DArray=O,this.setTexture3D=j,this.setTextureCube=Y,this.rebindTextures=We,this.setupRenderTarget=Me,this.updateRenderTargetMipmap=Ce,this.updateMultisampleRenderTarget=Oe,this.setupDepthRenderbuffer=Ye,this.setupFrameBufferTexture=be,this.useMultisampledRTT=Le}function uve(e,t){function r(i,n=Tu){let a,o=Ai.getTransfer(n);if(i===Ss)return e.UNSIGNED_BYTE;if(i===pk)return e.UNSIGNED_SHORT_4_4_4_4;if(i===fk)return e.UNSIGNED_SHORT_5_5_5_1;if(i===JG)return e.UNSIGNED_INT_5_9_9_9_REV;if(i===ZG)return e.BYTE;if(i===XG)return e.SHORT;if(i===uf)return e.UNSIGNED_SHORT;if(i===dk)return e.INT;if(i===ud)return e.UNSIGNED_INT;if(i===Po)return e.FLOAT;if(i===vv)return e.HALF_FLOAT;if(i===KG)return e.ALPHA;if(i===qG)return e.RGB;if(i===Xn)return e.RGBA;if(i===$G)return e.LUMINANCE;if(i===eV)return e.LUMINANCE_ALPHA;if(i===Pm)return e.DEPTH_COMPONENT;if(i===Om)return e.DEPTH_STENCIL;if(i===Ak)return e.RED;if(i===vE)return e.RED_INTEGER;if(i===tV)return e.RG;if(i===mk)return e.RG_INTEGER;if(i===gk)return e.RGBA_INTEGER;if(i===iE||i===nE||i===aE||i===oE)if(o===rn)if(a=t.get("WEBGL_compressed_texture_s3tc_srgb"),a!==null){if(i===iE)return a.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(i===nE)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(i===aE)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(i===oE)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(a=t.get("WEBGL_compressed_texture_s3tc"),a!==null){if(i===iE)return a.COMPRESSED_RGB_S3TC_DXT1_EXT;if(i===nE)return a.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(i===aE)return a.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(i===oE)return a.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(i===D3||i===k3||i===R3||i===F3)if(a=t.get("WEBGL_compressed_texture_pvrtc"),a!==null){if(i===D3)return a.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(i===k3)return a.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(i===R3)return a.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(i===F3)return a.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(i===z3||i===L3||i===O3)if(a=t.get("WEBGL_compressed_texture_etc"),a!==null){if(i===z3||i===L3)return o===rn?a.COMPRESSED_SRGB8_ETC2:a.COMPRESSED_RGB8_ETC2;if(i===O3)return o===rn?a.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:a.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(i===N3||i===U3||i===Q3||i===j3||i===G3||i===V3||i===Y3||i===H3||i===W3||i===Z3||i===X3||i===J3||i===K3||i===q3)if(a=t.get("WEBGL_compressed_texture_astc"),a!==null){if(i===N3)return o===rn?a.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:a.COMPRESSED_RGBA_ASTC_4x4_KHR;if(i===U3)return o===rn?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:a.COMPRESSED_RGBA_ASTC_5x4_KHR;if(i===Q3)return o===rn?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:a.COMPRESSED_RGBA_ASTC_5x5_KHR;if(i===j3)return o===rn?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:a.COMPRESSED_RGBA_ASTC_6x5_KHR;if(i===G3)return o===rn?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:a.COMPRESSED_RGBA_ASTC_6x6_KHR;if(i===V3)return o===rn?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:a.COMPRESSED_RGBA_ASTC_8x5_KHR;if(i===Y3)return o===rn?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:a.COMPRESSED_RGBA_ASTC_8x6_KHR;if(i===H3)return o===rn?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:a.COMPRESSED_RGBA_ASTC_8x8_KHR;if(i===W3)return o===rn?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:a.COMPRESSED_RGBA_ASTC_10x5_KHR;if(i===Z3)return o===rn?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:a.COMPRESSED_RGBA_ASTC_10x6_KHR;if(i===X3)return o===rn?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:a.COMPRESSED_RGBA_ASTC_10x8_KHR;if(i===J3)return o===rn?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:a.COMPRESSED_RGBA_ASTC_10x10_KHR;if(i===K3)return o===rn?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:a.COMPRESSED_RGBA_ASTC_12x10_KHR;if(i===q3)return o===rn?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:a.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(i===sE||i===$3||i===ek)if(a=t.get("EXT_texture_compression_bptc"),a!==null){if(i===sE)return o===rn?a.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:a.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(i===$3)return a.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(i===ek)return a.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(i===rV||i===tk||i===rk||i===ik)if(a=t.get("EXT_texture_compression_rgtc"),a!==null){if(i===sE)return a.COMPRESSED_RED_RGTC1_EXT;if(i===tk)return a.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(i===rk)return a.COMPRESSED_RED_GREEN_RGTC2_EXT;if(i===ik)return a.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return i===Lm?e.UNSIGNED_INT_24_8:e[i]!==void 0?e[i]:null}return{convert:r}}function Ave(e,t){function r(g,v){g.matrixAutoUpdate===!0&&g.updateMatrix(),v.value.copy(g.matrix)}function i(g,v){v.color.getRGB(g.fogColor.value,vV(e)),v.isFog?(g.fogNear.value=v.near,g.fogFar.value=v.far):v.isFogExp2&&(g.fogDensity.value=v.density)}function n(g,v,_,x,b){v.isMeshBasicMaterial||v.isMeshLambertMaterial?a(g,v):v.isMeshToonMaterial?(a(g,v),h(g,v)):v.isMeshPhongMaterial?(a(g,v),c(g,v)):v.isMeshStandardMaterial?(a(g,v),d(g,v),v.isMeshPhysicalMaterial&&p(g,v,b)):v.isMeshMatcapMaterial?(a(g,v),f(g,v)):v.isMeshDepthMaterial?a(g,v):v.isMeshDistanceMaterial?(a(g,v),m(g,v)):v.isMeshNormalMaterial?a(g,v):v.isLineBasicMaterial?(o(g,v),v.isLineDashedMaterial&&s(g,v)):v.isPointsMaterial?l(g,v,_,x):v.isSpriteMaterial?u(g,v):v.isShadowMaterial?(g.color.value.copy(v.color),g.opacity.value=v.opacity):v.isShaderMaterial&&(v.uniformsNeedUpdate=!1)}function a(g,v){g.opacity.value=v.opacity,v.color&&g.diffuse.value.copy(v.color),v.emissive&&g.emissive.value.copy(v.emissive).multiplyScalar(v.emissiveIntensity),v.map&&(g.map.value=v.map,r(v.map,g.mapTransform)),v.alphaMap&&(g.alphaMap.value=v.alphaMap,r(v.alphaMap,g.alphaMapTransform)),v.bumpMap&&(g.bumpMap.value=v.bumpMap,r(v.bumpMap,g.bumpMapTransform),g.bumpScale.value=v.bumpScale,v.side===La&&(g.bumpScale.value*=-1)),v.normalMap&&(g.normalMap.value=v.normalMap,r(v.normalMap,g.normalMapTransform),g.normalScale.value.copy(v.normalScale),v.side===La&&g.normalScale.value.negate()),v.displacementMap&&(g.displacementMap.value=v.displacementMap,r(v.displacementMap,g.displacementMapTransform),g.displacementScale.value=v.displacementScale,g.displacementBias.value=v.displacementBias),v.emissiveMap&&(g.emissiveMap.value=v.emissiveMap,r(v.emissiveMap,g.emissiveMapTransform)),v.specularMap&&(g.specularMap.value=v.specularMap,r(v.specularMap,g.specularMapTransform)),v.alphaTest>0&&(g.alphaTest.value=v.alphaTest);let _=t.get(v),x=_.envMap,b=_.envMapRotation;x&&(g.envMap.value=x,rf.copy(b),rf.x*=-1,rf.y*=-1,rf.z*=-1,x.isCubeTexture&&x.isRenderTargetTexture===!1&&(rf.y*=-1,rf.z*=-1),g.envMapRotation.value.setFromMatrix4(fve.makeRotationFromEuler(rf)),g.flipEnvMap.value=x.isCubeTexture&&x.isRenderTargetTexture===!1?-1:1,g.reflectivity.value=v.reflectivity,g.ior.value=v.ior,g.refractionRatio.value=v.refractionRatio),v.lightMap&&(g.lightMap.value=v.lightMap,g.lightMapIntensity.value=v.lightMapIntensity,r(v.lightMap,g.lightMapTransform)),v.aoMap&&(g.aoMap.value=v.aoMap,g.aoMapIntensity.value=v.aoMapIntensity,r(v.aoMap,g.aoMapTransform))}function o(g,v){g.diffuse.value.copy(v.color),g.opacity.value=v.opacity,v.map&&(g.map.value=v.map,r(v.map,g.mapTransform))}function s(g,v){g.dashSize.value=v.dashSize,g.totalSize.value=v.dashSize+v.gapSize,g.scale.value=v.scale}function l(g,v,_,x){g.diffuse.value.copy(v.color),g.opacity.value=v.opacity,g.size.value=v.size*_,g.scale.value=x*.5,v.map&&(g.map.value=v.map,r(v.map,g.uvTransform)),v.alphaMap&&(g.alphaMap.value=v.alphaMap,r(v.alphaMap,g.alphaMapTransform)),v.alphaTest>0&&(g.alphaTest.value=v.alphaTest)}function u(g,v){g.diffuse.value.copy(v.color),g.opacity.value=v.opacity,g.rotation.value=v.rotation,v.map&&(g.map.value=v.map,r(v.map,g.mapTransform)),v.alphaMap&&(g.alphaMap.value=v.alphaMap,r(v.alphaMap,g.alphaMapTransform)),v.alphaTest>0&&(g.alphaTest.value=v.alphaTest)}function c(g,v){g.specular.value.copy(v.specular),g.shininess.value=Math.max(v.shininess,1e-4)}function h(g,v){v.gradientMap&&(g.gradientMap.value=v.gradientMap)}function d(g,v){g.metalness.value=v.metalness,v.metalnessMap&&(g.metalnessMap.value=v.metalnessMap,r(v.metalnessMap,g.metalnessMapTransform)),g.roughness.value=v.roughness,v.roughnessMap&&(g.roughnessMap.value=v.roughnessMap,r(v.roughnessMap,g.roughnessMapTransform)),v.envMap&&(g.envMapIntensity.value=v.envMapIntensity)}function p(g,v,_){g.ior.value=v.ior,v.sheen>0&&(g.sheenColor.value.copy(v.sheenColor).multiplyScalar(v.sheen),g.sheenRoughness.value=v.sheenRoughness,v.sheenColorMap&&(g.sheenColorMap.value=v.sheenColorMap,r(v.sheenColorMap,g.sheenColorMapTransform)),v.sheenRoughnessMap&&(g.sheenRoughnessMap.value=v.sheenRoughnessMap,r(v.sheenRoughnessMap,g.sheenRoughnessMapTransform))),v.clearcoat>0&&(g.clearcoat.value=v.clearcoat,g.clearcoatRoughness.value=v.clearcoatRoughness,v.clearcoatMap&&(g.clearcoatMap.value=v.clearcoatMap,r(v.clearcoatMap,g.clearcoatMapTransform)),v.clearcoatRoughnessMap&&(g.clearcoatRoughnessMap.value=v.clearcoatRoughnessMap,r(v.clearcoatRoughnessMap,g.clearcoatRoughnessMapTransform)),v.clearcoatNormalMap&&(g.clearcoatNormalMap.value=v.clearcoatNormalMap,r(v.clearcoatNormalMap,g.clearcoatNormalMapTransform),g.clearcoatNormalScale.value.copy(v.clearcoatNormalScale),v.side===La&&g.clearcoatNormalScale.value.negate())),v.dispersion>0&&(g.dispersion.value=v.dispersion),v.iridescence>0&&(g.iridescence.value=v.iridescence,g.iridescenceIOR.value=v.iridescenceIOR,g.iridescenceThicknessMinimum.value=v.iridescenceThicknessRange[0],g.iridescenceThicknessMaximum.value=v.iridescenceThicknessRange[1],v.iridescenceMap&&(g.iridescenceMap.value=v.iridescenceMap,r(v.iridescenceMap,g.iridescenceMapTransform)),v.iridescenceThicknessMap&&(g.iridescenceThicknessMap.value=v.iridescenceThicknessMap,r(v.iridescenceThicknessMap,g.iridescenceThicknessMapTransform))),v.transmission>0&&(g.transmission.value=v.transmission,g.transmissionSamplerMap.value=_.texture,g.transmissionSamplerSize.value.set(_.width,_.height),v.transmissionMap&&(g.transmissionMap.value=v.transmissionMap,r(v.transmissionMap,g.transmissionMapTransform)),g.thickness.value=v.thickness,v.thicknessMap&&(g.thicknessMap.value=v.thicknessMap,r(v.thicknessMap,g.thicknessMapTransform)),g.attenuationDistance.value=v.attenuationDistance,g.attenuationColor.value.copy(v.attenuationColor)),v.anisotropy>0&&(g.anisotropyVector.value.set(v.anisotropy*Math.cos(v.anisotropyRotation),v.anisotropy*Math.sin(v.anisotropyRotation)),v.anisotropyMap&&(g.anisotropyMap.value=v.anisotropyMap,r(v.anisotropyMap,g.anisotropyMapTransform))),g.specularIntensity.value=v.specularIntensity,g.specularColor.value.copy(v.specularColor),v.specularColorMap&&(g.specularColorMap.value=v.specularColorMap,r(v.specularColorMap,g.specularColorMapTransform)),v.specularIntensityMap&&(g.specularIntensityMap.value=v.specularIntensityMap,r(v.specularIntensityMap,g.specularIntensityMapTransform))}function f(g,v){v.matcap&&(g.matcap.value=v.matcap)}function m(g,v){let _=t.get(v).light;g.referencePosition.value.setFromMatrixPosition(_.matrixWorld),g.nearDistance.value=_.shadow.camera.near,g.farDistance.value=_.shadow.camera.far}return{refreshFogUniforms:i,refreshMaterialUniforms:n}}function mve(e,t,r,i){let n={},a={},o=[],s=e.getParameter(e.MAX_UNIFORM_BUFFER_BINDINGS);function l(_,x){let b=x.program;i.uniformBlockBinding(_,b)}function u(_,x){let b=n[_.id];b===void 0&&(f(_),b=c(_),n[_.id]=b,_.addEventListener("dispose",g));let E=x.program;i.updateUBOMapping(_,E);let M=t.render.frame;a[_.id]!==M&&(d(_),a[_.id]=M)}function c(_){let x=h();_.__bindingPointIndex=x;let b=e.createBuffer(),E=_.__size,M=_.usage;return e.bindBuffer(e.UNIFORM_BUFFER,b),e.bufferData(e.UNIFORM_BUFFER,E,M),e.bindBuffer(e.UNIFORM_BUFFER,null),e.bindBufferBase(e.UNIFORM_BUFFER,x,b),b}function h(){for(let _=0;_<s;_++)if(o.indexOf(_)===-1)return o.push(_),_;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function d(_){let x=n[_.id],b=_.uniforms,E=_.__cache;e.bindBuffer(e.UNIFORM_BUFFER,x);for(let M=0,S=b.length;M<S;M++){let D=Array.isArray(b[M])?b[M]:[b[M]];for(let T=0,P=D.length;T<P;T++){let k=D[T];if(p(k,M,T,E)===!0){let R=k.__offset,F=Array.isArray(k.value)?k.value:[k.value],B=0;for(let z=0;z<F.length;z++){let O=F[z],j=m(O);typeof O=="number"||typeof O=="boolean"?(k.__data[0]=O,e.bufferSubData(e.UNIFORM_BUFFER,R+B,k.__data)):O.isMatrix3?(k.__data[0]=O.elements[0],k.__data[1]=O.elements[1],k.__data[2]=O.elements[2],k.__data[3]=0,k.__data[4]=O.elements[3],k.__data[5]=O.elements[4],k.__data[6]=O.elements[5],k.__data[7]=0,k.__data[8]=O.elements[6],k.__data[9]=O.elements[7],k.__data[10]=O.elements[8],k.__data[11]=0):(O.toArray(k.__data,B),B+=j.storage/Float32Array.BYTES_PER_ELEMENT)}e.bufferSubData(e.UNIFORM_BUFFER,R,k.__data)}}}e.bindBuffer(e.UNIFORM_BUFFER,null)}function p(_,x,b,E){let M=_.value,S=x+"_"+b;if(E[S]===void 0)return typeof M=="number"||typeof M=="boolean"?E[S]=M:E[S]=M.clone(),!0;{let D=E[S];if(typeof M=="number"||typeof M=="boolean"){if(D!==M)return E[S]=M,!0}else if(D.equals(M)===!1)return D.copy(M),!0}return!1}function f(_){let x=_.uniforms,b=0,E=16;for(let S=0,D=x.length;S<D;S++){let T=Array.isArray(x[S])?x[S]:[x[S]];for(let P=0,k=T.length;P<k;P++){let R=T[P],F=Array.isArray(R.value)?R.value:[R.value];for(let B=0,z=F.length;B<z;B++){let O=F[B],j=m(O),Y=b%E,Z=Y%j.boundary,ne=Y+Z;b+=Z,ne!==0&&E-ne<j.storage&&(b+=E-ne),R.__data=new Float32Array(j.storage/Float32Array.BYTES_PER_ELEMENT),R.__offset=b,b+=j.storage}}}let M=b%E;return M>0&&(b+=E-M),_.__size=b,_.__cache={},this}function m(_){let x={boundary:0,storage:0};return typeof _=="number"||typeof _=="boolean"?(x.boundary=4,x.storage=4):_.isVector2?(x.boundary=8,x.storage=8):_.isVector3||_.isColor?(x.boundary=16,x.storage=12):_.isVector4?(x.boundary=16,x.storage=16):_.isMatrix3?(x.boundary=48,x.storage=48):_.isMatrix4?(x.boundary=64,x.storage=64):_.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",_),x}function g(_){let x=_.target;x.removeEventListener("dispose",g);let b=o.indexOf(x.__bindingPointIndex);o.splice(b,1),e.deleteBuffer(n[x.id]),delete n[x.id],delete a[x.id]}function v(){for(let _ in n)e.deleteBuffer(n[_]);o=[],n={},a={}}return{bind:l,update:u,dispose:v}}var Fi,H,gE,Zde,b9,Xde,HG,Jde,Kc,mo,La,kn,Du,Tm,w9,E9,M9,Kde,af,qde,$de,epe,tpe,rpe,ipe,npe,ape,b3,w3,ope,spe,lpe,upe,cpe,hpe,dpe,ppe,fpe,E3,M3,S3,Rm,I3,C3,B3,T3,hk,Ape,mpe,ld,gpe,ype,vpe,xpe,_pe,bpe,wpe,S9,Epe,WG,Fm,zm,pv,P3,yE,wa,Ll,lf,Oa,yv,od,Rn,sf,el,Ss,ZG,XG,uf,dk,ud,Po,vv,pk,fk,Lm,JG,KG,qG,Xn,$G,eV,Pm,Om,Ak,vE,tV,mk,gk,iE,nE,aE,oE,D3,k3,R3,F3,z3,L3,O3,N3,U3,Q3,j3,G3,V3,Y3,H3,W3,Z3,X3,J3,K3,q3,sE,$3,ek,rV,tk,rk,ik,cd,hd,FD,I9,C9,B9,Mpe,iV,xE,xv,Spe,_v,yk,Ipe,Tu,Zi,Na,hE,rn,Zn,ku,_E,bE,nV,Gm,Nm,Cpe,Bpe,Tpe,aV,Ppe,Dpe,kpe,Rpe,nk,oV,dE,Pu,pE,Vm,po,T9,Dm,Um,Zr,vt,Wr,zD,P9,D9,k9,Ai,cm,rfe,ife,wE,nfe,ia,wi,afe,Ol,hV,ofe,Sa,fe,OD,R9,Ei,Yc,kl,_w,hm,dm,pm,ed,td,Xp,ev,bw,ww,Jp,sfe,tv,UD,ba,Hc,QD,Ew,rd,jD,Mw,GD,bv,er,fm,Rl,lfe,ufe,id,Sw,Es,F9,z9,Ua,xk,cfe,L9,Am,Wc,Iw,rv,hfe,dfe,O9,N9,U9,Q9,pfe,mm,VD,mi,Fl,Zc,YD,Xc,gm,ym,j9,HD,WD,ZD,XD,JD,KD,Mm,fV,nd,Cw,Dt,fo,ffe,es,Fn,ha,Bw,Afe,qr,AV,mV,nn,mfe,$s,$D,vm,Ms,iv,Fa,xn,G9,Kp,Tw,V9,Pw,Dw,kw,e3,Rw,Y9,Fw,Sr,th,_k,vfe,xfe,go,wv,ad,H9,W9,za,xm,_m,_fe,xV,bfe,tl,wfe,t3,pd,_V,Bo,bV,Z9,X9,J9,Efe,K9,Lw,r3,q9,i3,EV,bk,eh,$9,Mfe,MV,jm,bm,eG,Ow,tG,Sfe,nv,av,An,n3,Ife,Cfe,qc,qp,Nw,fd,Pfe,$o,Dfe,o3,Uw,$p,ov,rG,kfe,s3,Ao,Qw,Ev,Ad,fE,AE,iG,sv,jw,l3,nG,EE,aG,oG,md,IV,wk,sG,ok,Vw,Yw,CV,ME,BV,SE,il,Ek,Ffe,Hw,u3,c3,h3,Sk,TV,Gfe,PV,Vfe,DV,kV,RV,mE,Yfe,dd,Ww,Zw,d3,Xw,FV,pf,Hfe,p3,Ym,uAe,Qa,Ik,GV,gd,Nl,Ru,Mv,Ck,Hm,pAe,fAe,AAe,Fu,Wm,HV,hf,mAe,ff,Zm,df,WV,sd,vAe,xAe,Af,Jc,_Ae,Bk,bAe,Sv,CE,f3,fG,AG,Tk,wAe,ZV,mG,lv,A3,EAe,XV,mf,MAe,Iv,JV,Xm,KV,qV,SAe,$V,Pk,IAe,Dk,CAe,BAe,TAe,PAe,DAe,kAe,RAe,FAe,Wi,u$e,yG,Cv,xG,kk,$w,Wn,eY,tY,OAe,NAe,UAe,QAe,jAe,GAe,VAe,YAe,HAe,WAe,ZAe,XAe,JAe,KAe,qAe,$Ae,eme,tme,rme,ime,nme,ame,ome,sme,lme,ume,cme,hme,dme,pme,fme,Ame,mme,gme,yme,vme,xme,_me,bme,wme,Eme,Mme,Sme,Ime,Cme,Bme,Tme,Pme,Dme,kme,Rme,Fme,zme,Lme,Ome,Nme,Ume,Qme,jme,Gme,Vme,Yme,Hme,Wme,Zme,Xme,Jme,Kme,qme,$me,ege,tge,rge,ige,nge,age,oge,sge,lge,uge,cge,hge,dge,pge,fge,Age,mge,gge,yge,vge,xge,_ge,bge,wge,Ege,Mge,Sge,Ige,Cge,Bge,Tge,Pge,Dge,kge,Rge,Fge,zge,Lge,Oge,Nge,Uge,Qge,jge,Gge,Vge,Yge,Hge,Wge,Zge,Xge,Jge,Kge,qge,$ge,eye,tye,rye,iye,nye,aye,oye,sye,lye,uye,cye,hye,dye,pye,fye,Aye,mye,jr,Kt,Bu,eE,tf,gye,Bm,bG,of,m3,wG,g3,y3,v3,x3,nf,wm,EG,MG,iY,BG,nY,aY,oY,TG,PG,DG,kG,RG,v0e,x0e,_0e,_3,cE,w0e,E0e,LG,rE,k0e,R0e,z0e,V0e,Y0e,H0e,$0e,ive,nve,ove,cve,hve,dve,pve,rf,fve,sY,nl=Ot(()=>{"use strict";ws();H=x9(()=>{Fi={env:{NODE_ENV:"production",npm_package_version:"6.17.0"}}});H();gE={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},Zde=0,b9=1,Xde=2,HG=1,Jde=2,Kc=3,mo=0,La=1,kn=2,Du=0,Tm=1,w9=2,E9=3,M9=4,Kde=5,af=100,qde=101,$de=102,epe=103,tpe=104,rpe=200,ipe=201,npe=202,ape=203,b3=204,w3=205,ope=206,spe=207,lpe=208,upe=209,cpe=210,hpe=211,dpe=212,ppe=213,fpe=214,E3=0,M3=1,S3=2,Rm=3,I3=4,C3=5,B3=6,T3=7,hk=0,Ape=1,mpe=2,ld=0,gpe=1,ype=2,vpe=3,xpe=4,_pe=5,bpe=6,wpe=7,S9="attached",Epe="detached",WG=300,Fm=301,zm=302,pv=303,P3=304,yE=306,wa=1e3,Ll=1001,lf=1002,Oa=1003,yv=1004,od=1005,Rn=1006,sf=1007,el=1008,Ss=1009,ZG=1010,XG=1011,uf=1012,dk=1013,ud=1014,Po=1015,vv=1016,pk=1017,fk=1018,Lm=1020,JG=35902,KG=1021,qG=1022,Xn=1023,$G=1024,eV=1025,Pm=1026,Om=1027,Ak=1028,vE=1029,tV=1030,mk=1031,gk=1033,iE=33776,nE=33777,aE=33778,oE=33779,D3=35840,k3=35841,R3=35842,F3=35843,z3=36196,L3=37492,O3=37496,N3=37808,U3=37809,Q3=37810,j3=37811,G3=37812,V3=37813,Y3=37814,H3=37815,W3=37816,Z3=37817,X3=37818,J3=37819,K3=37820,q3=37821,sE=36492,$3=36494,ek=36495,rV=36283,tk=36284,rk=36285,ik=36286,cd=2300,hd=2301,FD=2302,I9=2400,C9=2401,B9=2402,Mpe=2500,iV=0,xE=1,xv=2,Spe=3200,_v=3201,yk=0,Ipe=1,Tu="",Zi="srgb",Na="srgb-linear",hE="linear",rn="srgb",Zn=7680,ku=7681,_E=34055,bE=34056,nV=514,Gm=517,Nm=519,Cpe=512,Bpe=513,Tpe=514,aV=515,Ppe=516,Dpe=517,kpe=518,Rpe=519,nk=35044,oV=35048,dE="300 es",Pu=2e3,pE=2001,Vm=class{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});let r=this._listeners;r[e]===void 0&&(r[e]=[]),r[e].indexOf(t)===-1&&r[e].push(t)}hasEventListener(e,t){let r=this._listeners;return r===void 0?!1:r[e]!==void 0&&r[e].indexOf(t)!==-1}removeEventListener(e,t){let r=this._listeners;if(r===void 0)return;let i=r[e];if(i!==void 0){let n=i.indexOf(t);n!==-1&&i.splice(n,1)}}dispatchEvent(e){let t=this._listeners;if(t===void 0)return;let r=t[e.type];if(r!==void 0){e.target=this;let i=r.slice(0);for(let n=0,a=i.length;n<a;n++)i[n].call(this,e);e.target=null}}},po=["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"],T9=1234567,Dm=Math.PI/180,Um=180/Math.PI;Zr={DEG2RAD:Dm,RAD2DEG:Um,generateUUID:rl,clamp:li,euclideanModulo:vk,mapLinear:Fpe,inverseLerp:zpe,lerp:cv,damp:Lpe,pingpong:Ope,smoothstep:Npe,smootherstep:Upe,randInt:Qpe,randFloat:jpe,randFloatSpread:Gpe,seededRandom:Vpe,degToRad:Ype,radToDeg:Hpe,isPowerOfTwo:Wpe,ceilPowerOfTwo:Zpe,floorPowerOfTwo:Xpe,setQuaternionFromProperEuler:Jpe,normalize:Hi,denormalize:zl},vt=class sV{constructor(t=0,r=0){sV.prototype.isVector2=!0,this.x=t,this.y=r}get width(){return this.x}set width(t){this.x=t}get height(){return this.y}set height(t){this.y=t}set(t,r){return this.x=t,this.y=r,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,r){switch(t){case 0:this.x=r;break;case 1:this.y=r;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,r){return this.x=t.x+r.x,this.y=t.y+r.y,this}addScaledVector(t,r){return this.x+=t.x*r,this.y+=t.y*r,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,r){return this.x=t.x-r.x,this.y=t.y-r.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 r=this.x,i=this.y,n=t.elements;return this.x=n[0]*r+n[3]*i+n[6],this.y=n[1]*r+n[4]*i+n[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,r){return this.x=li(this.x,t.x,r.x),this.y=li(this.y,t.y,r.y),this}clampScalar(t,r){return this.x=li(this.x,t,r),this.y=li(this.y,t,r),this}clampLength(t,r){let i=this.length();return this.divideScalar(i||1).multiplyScalar(li(i,t,r))}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 r=Math.sqrt(this.lengthSq()*t.lengthSq());if(r===0)return Math.PI/2;let i=this.dot(t)/r;return Math.acos(li(i,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){let r=this.x-t.x,i=this.y-t.y;return r*r+i*i}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,r){return this.x+=(t.x-this.x)*r,this.y+=(t.y-this.y)*r,this}lerpVectors(t,r,i){return this.x=t.x+(r.x-t.x)*i,this.y=t.y+(r.y-t.y)*i,this}equals(t){return t.x===this.x&&t.y===this.y}fromArray(t,r=0){return this.x=t[r],this.y=t[r+1],this}toArray(t=[],r=0){return t[r]=this.x,t[r+1]=this.y,t}fromBufferAttribute(t,r){return this.x=t.getX(r),this.y=t.getY(r),this}rotateAround(t,r){let i=Math.cos(r),n=Math.sin(r),a=this.x-t.x,o=this.y-t.y;return this.x=a*i-o*n+t.x,this.y=a*n+o*i+t.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}},Wr=class lV{constructor(t,r,i,n,a,o,s,l,u){lV.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],t!==void 0&&this.set(t,r,i,n,a,o,s,l,u)}set(t,r,i,n,a,o,s,l,u){let c=this.elements;return c[0]=t,c[1]=n,c[2]=s,c[3]=r,c[4]=a,c[5]=l,c[6]=i,c[7]=o,c[8]=u,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(t){let r=this.elements,i=t.elements;return r[0]=i[0],r[1]=i[1],r[2]=i[2],r[3]=i[3],r[4]=i[4],r[5]=i[5],r[6]=i[6],r[7]=i[7],r[8]=i[8],this}extractBasis(t,r,i){return t.setFromMatrix3Column(this,0),r.setFromMatrix3Column(this,1),i.setFromMatrix3Column(this,2),this}setFromMatrix4(t){let r=t.elements;return this.set(r[0],r[4],r[8],r[1],r[5],r[9],r[2],r[6],r[10]),this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,r){let i=t.elements,n=r.elements,a=this.elements,o=i[0],s=i[3],l=i[6],u=i[1],c=i[4],h=i[7],d=i[2],p=i[5],f=i[8],m=n[0],g=n[3],v=n[6],_=n[1],x=n[4],b=n[7],E=n[2],M=n[5],S=n[8];return a[0]=o*m+s*_+l*E,a[3]=o*g+s*x+l*M,a[6]=o*v+s*b+l*S,a[1]=u*m+c*_+h*E,a[4]=u*g+c*x+h*M,a[7]=u*v+c*b+h*S,a[2]=d*m+p*_+f*E,a[5]=d*g+p*x+f*M,a[8]=d*v+p*b+f*S,this}multiplyScalar(t){let r=this.elements;return r[0]*=t,r[3]*=t,r[6]*=t,r[1]*=t,r[4]*=t,r[7]*=t,r[2]*=t,r[5]*=t,r[8]*=t,this}determinant(){let t=this.elements,r=t[0],i=t[1],n=t[2],a=t[3],o=t[4],s=t[5],l=t[6],u=t[7],c=t[8];return r*o*c-r*s*u-i*a*c+i*s*l+n*a*u-n*o*l}invert(){let t=this.elements,r=t[0],i=t[1],n=t[2],a=t[3],o=t[4],s=t[5],l=t[6],u=t[7],c=t[8],h=c*o-s*u,d=s*l-c*a,p=u*a-o*l,f=r*h+i*d+n*p;if(f===0)return this.set(0,0,0,0,0,0,0,0,0);let m=1/f;return t[0]=h*m,t[1]=(n*u-c*i)*m,t[2]=(s*i-n*o)*m,t[3]=d*m,t[4]=(c*r-n*l)*m,t[5]=(n*a-s*r)*m,t[6]=p*m,t[7]=(i*l-u*r)*m,t[8]=(o*r-i*a)*m,this}transpose(){let t,r=this.elements;return t=r[1],r[1]=r[3],r[3]=t,t=r[2],r[2]=r[6],r[6]=t,t=r[5],r[5]=r[7],r[7]=t,this}getNormalMatrix(t){return this.setFromMatrix4(t).invert().transpose()}transposeIntoArray(t){let r=this.elements;return t[0]=r[0],t[1]=r[3],t[2]=r[6],t[3]=r[1],t[4]=r[4],t[5]=r[7],t[6]=r[2],t[7]=r[5],t[8]=r[8],this}setUvTransform(t,r,i,n,a,o,s){let l=Math.cos(a),u=Math.sin(a);return this.set(i*l,i*u,-i*(l*o+u*s)+o+t,-n*u,n*l,-n*(-u*o+l*s)+s+r,0,0,1),this}scale(t,r){return this.premultiply(zD.makeScale(t,r)),this}rotate(t){return this.premultiply(zD.makeRotation(-t)),this}translate(t,r){return this.premultiply(zD.makeTranslation(t,r)),this}makeTranslation(t,r){return t.isVector2?this.set(1,0,t.x,0,1,t.y,0,0,1):this.set(1,0,t,0,1,r,0,0,1),this}makeRotation(t){let r=Math.cos(t),i=Math.sin(t);return this.set(r,-i,0,i,r,0,0,0,1),this}makeScale(t,r){return this.set(t,0,0,0,r,0,0,0,1),this}equals(t){let r=this.elements,i=t.elements;for(let n=0;n<9;n++)if(r[n]!==i[n])return!1;return!0}fromArray(t,r=0){for(let i=0;i<9;i++)this.elements[i]=t[i+r];return this}toArray(t=[],r=0){let i=this.elements;return t[r]=i[0],t[r+1]=i[1],t[r+2]=i[2],t[r+3]=i[3],t[r+4]=i[4],t[r+5]=i[5],t[r+6]=i[6],t[r+7]=i[7],t[r+8]=i[8],t}clone(){return new this.constructor().fromArray(this.elements)}},zD=new Wr;P9={};D9=new Wr().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),k9=new Wr().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);Ai=tfe();rfe=class{static getDataURL(e){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let t;if(e instanceof HTMLCanvasElement)t=e;else{cm===void 0&&(cm=fv("canvas")),cm.width=e.width,cm.height=e.height;let r=cm.getContext("2d");e instanceof ImageData?r.putImageData(e,0,0):r.drawImage(e,0,0,e.width,e.height),t=cm}return t.toDataURL("image/png")}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){let t=fv("canvas");t.width=e.width,t.height=e.height;let r=t.getContext("2d");r.drawImage(e,0,0,e.width,e.height);let i=r.getImageData(0,0,e.width,e.height),n=i.data;for(let a=0;a<n.length;a++)n[a]=$c(n[a]/255)*255;return r.putImageData(i,0,0),t}else if(e.data){let t=e.data.slice(0);for(let r=0;r<t.length;r++)t instanceof Uint8Array||t instanceof Uint8ClampedArray?t[r]=Math.floor($c(t[r]/255)*255):t[r]=$c(t[r]);return{data:t,width:e.width,height:e.height}}else return console.warn("THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}},ife=0,wE=class{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:ife++}),this.uuid=rl(),this.data=e,this.dataReady=!0,this.version=0}set needsUpdate(e){e===!0&&this.version++}toJSON(e){let t=e===void 0||typeof e=="string";if(!t&&e.images[this.uuid]!==void 0)return e.images[this.uuid];let r={uuid:this.uuid,url:""},i=this.data;if(i!==null){let n;if(Array.isArray(i)){n=[];for(let a=0,o=i.length;a<o;a++)i[a].isDataTexture?n.push(LD(i[a].image)):n.push(LD(i[a]))}else n=LD(i);r.url=n}return t||(e.images[this.uuid]=r),r}};nfe=0,ia=class lE extends Vm{constructor(t=lE.DEFAULT_IMAGE,r=lE.DEFAULT_MAPPING,i=Ll,n=Ll,a=Rn,o=el,s=Xn,l=Ss,u=lE.DEFAULT_ANISOTROPY,c=Tu){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:nfe++}),this.uuid=rl(),this.name="",this.source=new wE(t),this.mipmaps=[],this.mapping=r,this.channel=0,this.wrapS=i,this.wrapT=n,this.magFilter=a,this.minFilter=o,this.anisotropy=u,this.format=s,this.internalFormat=null,this.type=l,this.offset=new vt(0,0),this.repeat=new vt(1,1),this.center=new vt(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Wr,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=c,this.userData={},this.version=0,this.onUpdate=null,this.renderTarget=null,this.isRenderTargetTexture=!1,this.pmremVersion=0}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.renderTarget=t.renderTarget,this.isRenderTargetTexture=t.isRenderTargetTexture,this.userData=JSON.parse(JSON.stringify(t.userData)),this.needsUpdate=!0,this}toJSON(t){let r=t===void 0||typeof t=="string";if(!r&&t.textures[this.uuid]!==void 0)return t.textures[this.uuid];let i={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&&(i.userData=this.userData),r||(t.textures[this.uuid]=i),i}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(t){if(this.mapping!==WG)return t;if(t.applyMatrix3(this.matrix),t.x<0||t.x>1)switch(this.wrapS){case wa:t.x=t.x-Math.floor(t.x);break;case Ll:t.x=t.x<0?0:1;break;case lf: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 wa:t.y=t.y-Math.floor(t.y);break;case Ll:t.y=t.y<0?0:1;break;case lf: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)}set needsPMREMUpdate(t){t===!0&&this.pmremVersion++}};ia.DEFAULT_IMAGE=null;ia.DEFAULT_MAPPING=WG;ia.DEFAULT_ANISOTROPY=1;wi=class cV{constructor(t=0,r=0,i=0,n=1){cV.prototype.isVector4=!0,this.x=t,this.y=r,this.z=i,this.w=n}get width(){return this.z}set width(t){this.z=t}get height(){return this.w}set height(t){this.w=t}set(t,r,i,n){return this.x=t,this.y=r,this.z=i,this.w=n,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,r){switch(t){case 0:this.x=r;break;case 1:this.y=r;break;case 2:this.z=r;break;case 3:this.w=r;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,r){return this.x=t.x+r.x,this.y=t.y+r.y,this.z=t.z+r.z,this.w=t.w+r.w,this}addScaledVector(t,r){return this.x+=t.x*r,this.y+=t.y*r,this.z+=t.z*r,this.w+=t.w*r,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,r){return this.x=t.x-r.x,this.y=t.y-r.y,this.z=t.z-r.z,this.w=t.w-r.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 r=this.x,i=this.y,n=this.z,a=this.w,o=t.elements;return this.x=o[0]*r+o[4]*i+o[8]*n+o[12]*a,this.y=o[1]*r+o[5]*i+o[9]*n+o[13]*a,this.z=o[2]*r+o[6]*i+o[10]*n+o[14]*a,this.w=o[3]*r+o[7]*i+o[11]*n+o[15]*a,this}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this.w/=t.w,this}divideScalar(t){return this.multiplyScalar(1/t)}setAxisAngleFromQuaternion(t){this.w=2*Math.acos(t.w);let r=Math.sqrt(1-t.w*t.w);return r<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=t.x/r,this.y=t.y/r,this.z=t.z/r),this}setAxisAngleFromRotationMatrix(t){let r,i,n,a,o=t.elements,s=o[0],l=o[4],u=o[8],c=o[1],h=o[5],d=o[9],p=o[2],f=o[6],m=o[10];if(Math.abs(l-c)<.01&&Math.abs(u-p)<.01&&Math.abs(d-f)<.01){if(Math.abs(l+c)<.1&&Math.abs(u+p)<.1&&Math.abs(d+f)<.1&&Math.abs(s+h+m-3)<.1)return this.set(1,0,0,0),this;r=Math.PI;let v=(s+1)/2,_=(h+1)/2,x=(m+1)/2,b=(l+c)/4,E=(u+p)/4,M=(d+f)/4;return v>_&&v>x?v<.01?(i=0,n=.707106781,a=.707106781):(i=Math.sqrt(v),n=b/i,a=E/i):_>x?_<.01?(i=.707106781,n=0,a=.707106781):(n=Math.sqrt(_),i=b/n,a=M/n):x<.01?(i=.707106781,n=.707106781,a=0):(a=Math.sqrt(x),i=E/a,n=M/a),this.set(i,n,a,r),this}let g=Math.sqrt((f-d)*(f-d)+(u-p)*(u-p)+(c-l)*(c-l));return Math.abs(g)<.001&&(g=1),this.x=(f-d)/g,this.y=(u-p)/g,this.z=(c-l)/g,this.w=Math.acos((s+h+m-1)/2),this}setFromMatrixPosition(t){let r=t.elements;return this.x=r[12],this.y=r[13],this.z=r[14],this.w=r[15],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,r){return this.x=li(this.x,t.x,r.x),this.y=li(this.y,t.y,r.y),this.z=li(this.z,t.z,r.z),this.w=li(this.w,t.w,r.w),this}clampScalar(t,r){return this.x=li(this.x,t,r),this.y=li(this.y,t,r),this.z=li(this.z,t,r),this.w=li(this.w,t,r),this}clampLength(t,r){let i=this.length();return this.divideScalar(i||1).multiplyScalar(li(i,t,r))}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,r){return this.x+=(t.x-this.x)*r,this.y+=(t.y-this.y)*r,this.z+=(t.z-this.z)*r,this.w+=(t.w-this.w)*r,this}lerpVectors(t,r,i){return this.x=t.x+(r.x-t.x)*i,this.y=t.y+(r.y-t.y)*i,this.z=t.z+(r.z-t.z)*i,this.w=t.w+(r.w-t.w)*i,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w}fromArray(t,r=0){return this.x=t[r],this.y=t[r+1],this.z=t[r+2],this.w=t[r+3],this}toArray(t=[],r=0){return t[r]=this.x,t[r+1]=this.y,t[r+2]=this.z,t[r+3]=this.w,t}fromBufferAttribute(t,r){return this.x=t.getX(r),this.y=t.getY(r),this.z=t.getZ(r),this.w=t.getW(r),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}},afe=class extends Vm{constructor(e=1,t=1,r={}){super(),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=1,this.scissor=new wi(0,0,e,t),this.scissorTest=!1,this.viewport=new wi(0,0,e,t);let i={width:e,height:t,depth:1};r=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:Rn,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1},r);let n=new ia(i,r.mapping,r.wrapS,r.wrapT,r.magFilter,r.minFilter,r.format,r.type,r.anisotropy,r.colorSpace);n.flipY=!1,n.generateMipmaps=r.generateMipmaps,n.internalFormat=r.internalFormat,this.textures=[];let a=r.count;for(let o=0;o<a;o++)this.textures[o]=n.clone(),this.textures[o].isRenderTargetTexture=!0,this.textures[o].renderTarget=this;this.depthBuffer=r.depthBuffer,this.stencilBuffer=r.stencilBuffer,this.resolveDepthBuffer=r.resolveDepthBuffer,this.resolveStencilBuffer=r.resolveStencilBuffer,this._depthTexture=null,this.depthTexture=r.depthTexture,this.samples=r.samples}get texture(){return this.textures[0]}set texture(e){this.textures[0]=e}set depthTexture(e){this._depthTexture!==null&&(this._depthTexture.renderTarget=null),e!==null&&(e.renderTarget=this),this._depthTexture=e}get depthTexture(){return this._depthTexture}setSize(e,t,r=1){if(this.width!==e||this.height!==t||this.depth!==r){this.width=e,this.height=t,this.depth=r;for(let i=0,n=this.textures.length;i<n;i++)this.textures[i].image.width=e,this.textures[i].image.height=t,this.textures[i].image.depth=r;this.dispose()}this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.textures.length=0;for(let r=0,i=e.textures.length;r<i;r++)this.textures[r]=e.textures[r].clone(),this.textures[r].isRenderTargetTexture=!0,this.textures[r].renderTarget=this;let t=Object.assign({},e.texture.image);return this.texture.source=new wE(t),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.resolveDepthBuffer=e.resolveDepthBuffer,this.resolveStencilBuffer=e.resolveStencilBuffer,e.depthTexture!==null&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}},Ol=class extends afe{constructor(e=1,t=1,r={}){super(e,t,r),this.isWebGLRenderTarget=!0}},hV=class extends ia{constructor(e=null,t=1,r=1,i=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:r,depth:i},this.magFilter=Oa,this.minFilter=Oa,this.wrapR=Ll,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}},ofe=class extends ia{constructor(e=null,t=1,r=1,i=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:r,depth:i},this.magFilter=Oa,this.minFilter=Oa,this.wrapR=Ll,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}},Sa=class{constructor(e=0,t=0,r=0,i=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=r,this._w=i}static slerpFlat(e,t,r,i,n,a,o){let s=r[i+0],l=r[i+1],u=r[i+2],c=r[i+3],h=n[a+0],d=n[a+1],p=n[a+2],f=n[a+3];if(o===0){e[t+0]=s,e[t+1]=l,e[t+2]=u,e[t+3]=c;return}if(o===1){e[t+0]=h,e[t+1]=d,e[t+2]=p,e[t+3]=f;return}if(c!==f||s!==h||l!==d||u!==p){let m=1-o,g=s*h+l*d+u*p+c*f,v=g>=0?1:-1,_=1-g*g;if(_>Number.EPSILON){let b=Math.sqrt(_),E=Math.atan2(b,g*v);m=Math.sin(m*E)/b,o=Math.sin(o*E)/b}let x=o*v;if(s=s*m+h*x,l=l*m+d*x,u=u*m+p*x,c=c*m+f*x,m===1-o){let b=1/Math.sqrt(s*s+l*l+u*u+c*c);s*=b,l*=b,u*=b,c*=b}}e[t]=s,e[t+1]=l,e[t+2]=u,e[t+3]=c}static multiplyQuaternionsFlat(e,t,r,i,n,a){let o=r[i],s=r[i+1],l=r[i+2],u=r[i+3],c=n[a],h=n[a+1],d=n[a+2],p=n[a+3];return e[t]=o*p+u*c+s*d-l*h,e[t+1]=s*p+u*h+l*c-o*d,e[t+2]=l*p+u*d+o*h-s*c,e[t+3]=u*p-o*c-s*h-l*d,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,r,i){return this._x=e,this._y=t,this._z=r,this._w=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){let r=e._x,i=e._y,n=e._z,a=e._order,o=Math.cos,s=Math.sin,l=o(r/2),u=o(i/2),c=o(n/2),h=s(r/2),d=s(i/2),p=s(n/2);switch(a){case"XYZ":this._x=h*u*c+l*d*p,this._y=l*d*c-h*u*p,this._z=l*u*p+h*d*c,this._w=l*u*c-h*d*p;break;case"YXZ":this._x=h*u*c+l*d*p,this._y=l*d*c-h*u*p,this._z=l*u*p-h*d*c,this._w=l*u*c+h*d*p;break;case"ZXY":this._x=h*u*c-l*d*p,this._y=l*d*c+h*u*p,this._z=l*u*p+h*d*c,this._w=l*u*c-h*d*p;break;case"ZYX":this._x=h*u*c-l*d*p,this._y=l*d*c+h*u*p,this._z=l*u*p-h*d*c,this._w=l*u*c+h*d*p;break;case"YZX":this._x=h*u*c+l*d*p,this._y=l*d*c+h*u*p,this._z=l*u*p-h*d*c,this._w=l*u*c-h*d*p;break;case"XZY":this._x=h*u*c-l*d*p,this._y=l*d*c-h*u*p,this._z=l*u*p+h*d*c,this._w=l*u*c+h*d*p;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+a)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){let r=t/2,i=Math.sin(r);return this._x=e.x*i,this._y=e.y*i,this._z=e.z*i,this._w=Math.cos(r),this._onChangeCallback(),this}setFromRotationMatrix(e){let t=e.elements,r=t[0],i=t[4],n=t[8],a=t[1],o=t[5],s=t[9],l=t[2],u=t[6],c=t[10],h=r+o+c;if(h>0){let d=.5/Math.sqrt(h+1);this._w=.25/d,this._x=(u-s)*d,this._y=(n-l)*d,this._z=(a-i)*d}else if(r>o&&r>c){let d=2*Math.sqrt(1+r-o-c);this._w=(u-s)/d,this._x=.25*d,this._y=(i+a)/d,this._z=(n+l)/d}else if(o>c){let d=2*Math.sqrt(1+o-r-c);this._w=(n-l)/d,this._x=(i+a)/d,this._y=.25*d,this._z=(s+u)/d}else{let d=2*Math.sqrt(1+c-r-o);this._w=(a-i)/d,this._x=(n+l)/d,this._y=(s+u)/d,this._z=.25*d}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let r=e.dot(t)+1;return r<Number.EPSILON?(r=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=r):(this._x=0,this._y=-e.z,this._z=e.y,this._w=r)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=r),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(li(this.dot(e),-1,1)))}rotateTowards(e,t){let r=this.angleTo(e);if(r===0)return this;let i=Math.min(1,t/r);return this.slerp(e,i),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){let r=e._x,i=e._y,n=e._z,a=e._w,o=t._x,s=t._y,l=t._z,u=t._w;return this._x=r*u+a*o+i*l-n*s,this._y=i*u+a*s+n*o-r*l,this._z=n*u+a*l+r*s-i*o,this._w=a*u-r*o-i*s-n*l,this._onChangeCallback(),this}slerp(e,t){if(t===0)return this;if(t===1)return this.copy(e);let r=this._x,i=this._y,n=this._z,a=this._w,o=a*e._w+r*e._x+i*e._y+n*e._z;if(o<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,o=-o):this.copy(e),o>=1)return this._w=a,this._x=r,this._y=i,this._z=n,this;let s=1-o*o;if(s<=Number.EPSILON){let d=1-t;return this._w=d*a+t*this._w,this._x=d*r+t*this._x,this._y=d*i+t*this._y,this._z=d*n+t*this._z,this.normalize(),this}let l=Math.sqrt(s),u=Math.atan2(l,o),c=Math.sin((1-t)*u)/l,h=Math.sin(t*u)/l;return this._w=a*c+this._w*h,this._x=r*c+this._x*h,this._y=i*c+this._y*h,this._z=n*c+this._z*h,this._onChangeCallback(),this}slerpQuaternions(e,t,r){return this.copy(e).slerp(t,r)}random(){let e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),r=Math.random(),i=Math.sqrt(1-r),n=Math.sqrt(r);return this.set(i*Math.sin(e),i*Math.cos(e),n*Math.sin(t),n*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}},fe=class dV{constructor(t=0,r=0,i=0){dV.prototype.isVector3=!0,this.x=t,this.y=r,this.z=i}set(t,r,i){return i===void 0&&(i=this.z),this.x=t,this.y=r,this.z=i,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,r){switch(t){case 0:this.x=r;break;case 1:this.y=r;break;case 2:this.z=r;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,r){return this.x=t.x+r.x,this.y=t.y+r.y,this.z=t.z+r.z,this}addScaledVector(t,r){return this.x+=t.x*r,this.y+=t.y*r,this.z+=t.z*r,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,r){return this.x=t.x-r.x,this.y=t.y-r.y,this.z=t.z-r.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,r){return this.x=t.x*r.x,this.y=t.y*r.y,this.z=t.z*r.z,this}applyEuler(t){return this.applyQuaternion(R9.setFromEuler(t))}applyAxisAngle(t,r){return this.applyQuaternion(R9.setFromAxisAngle(t,r))}applyMatrix3(t){let r=this.x,i=this.y,n=this.z,a=t.elements;return this.x=a[0]*r+a[3]*i+a[6]*n,this.y=a[1]*r+a[4]*i+a[7]*n,this.z=a[2]*r+a[5]*i+a[8]*n,this}applyNormalMatrix(t){return this.applyMatrix3(t).normalize()}applyMatrix4(t){let r=this.x,i=this.y,n=this.z,a=t.elements,o=1/(a[3]*r+a[7]*i+a[11]*n+a[15]);return this.x=(a[0]*r+a[4]*i+a[8]*n+a[12])*o,this.y=(a[1]*r+a[5]*i+a[9]*n+a[13])*o,this.z=(a[2]*r+a[6]*i+a[10]*n+a[14])*o,this}applyQuaternion(t){let r=this.x,i=this.y,n=this.z,a=t.x,o=t.y,s=t.z,l=t.w,u=2*(o*n-s*i),c=2*(s*r-a*n),h=2*(a*i-o*r);return this.x=r+l*u+o*h-s*c,this.y=i+l*c+s*u-a*h,this.z=n+l*h+a*c-o*u,this}project(t){return this.applyMatrix4(t.matrixWorldInverse).applyMatrix4(t.projectionMatrix)}unproject(t){return this.applyMatrix4(t.projectionMatrixInverse).applyMatrix4(t.matrixWorld)}transformDirection(t){let r=this.x,i=this.y,n=this.z,a=t.elements;return this.x=a[0]*r+a[4]*i+a[8]*n,this.y=a[1]*r+a[5]*i+a[9]*n,this.z=a[2]*r+a[6]*i+a[10]*n,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,r){return this.x=li(this.x,t.x,r.x),this.y=li(this.y,t.y,r.y),this.z=li(this.z,t.z,r.z),this}clampScalar(t,r){return this.x=li(this.x,t,r),this.y=li(this.y,t,r),this.z=li(this.z,t,r),this}clampLength(t,r){let i=this.length();return this.divideScalar(i||1).multiplyScalar(li(i,t,r))}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,r){return this.x+=(t.x-this.x)*r,this.y+=(t.y-this.y)*r,this.z+=(t.z-this.z)*r,this}lerpVectors(t,r,i){return this.x=t.x+(r.x-t.x)*i,this.y=t.y+(r.y-t.y)*i,this.z=t.z+(r.z-t.z)*i,this}cross(t){return this.crossVectors(this,t)}crossVectors(t,r){let i=t.x,n=t.y,a=t.z,o=r.x,s=r.y,l=r.z;return this.x=n*l-a*s,this.y=a*o-i*l,this.z=i*s-n*o,this}projectOnVector(t){let r=t.lengthSq();if(r===0)return this.set(0,0,0);let i=t.dot(this)/r;return this.copy(t).multiplyScalar(i)}projectOnPlane(t){return OD.copy(this).projectOnVector(t),this.sub(OD)}reflect(t){return this.sub(OD.copy(t).multiplyScalar(2*this.dot(t)))}angleTo(t){let r=Math.sqrt(this.lengthSq()*t.lengthSq());if(r===0)return Math.PI/2;let i=this.dot(t)/r;return Math.acos(li(i,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){let r=this.x-t.x,i=this.y-t.y,n=this.z-t.z;return r*r+i*i+n*n}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,r,i){let n=Math.sin(r)*t;return this.x=n*Math.sin(i),this.y=Math.cos(r)*t,this.z=n*Math.cos(i),this}setFromCylindrical(t){return this.setFromCylindricalCoords(t.radius,t.theta,t.y)}setFromCylindricalCoords(t,r,i){return this.x=t*Math.sin(r),this.y=i,this.z=t*Math.cos(r),this}setFromMatrixPosition(t){let r=t.elements;return this.x=r[12],this.y=r[13],this.z=r[14],this}setFromMatrixScale(t){let r=this.setFromMatrixColumn(t,0).length(),i=this.setFromMatrixColumn(t,1).length(),n=this.setFromMatrixColumn(t,2).length();return this.x=r,this.y=i,this.z=n,this}setFromMatrixColumn(t,r){return this.fromArray(t.elements,r*4)}setFromMatrix3Column(t,r){return this.fromArray(t.elements,r*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,r=0){return this.x=t[r],this.y=t[r+1],this.z=t[r+2],this}toArray(t=[],r=0){return t[r]=this.x,t[r+1]=this.y,t[r+2]=this.z,t}fromBufferAttribute(t,r){return this.x=t.getX(r),this.y=t.getY(r),this.z=t.getZ(r),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){let t=Math.random()*Math.PI*2,r=Math.random()*2-1,i=Math.sqrt(1-r*r);return this.x=i*Math.cos(t),this.y=r,this.z=i*Math.sin(t),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}},OD=new fe,R9=new Sa,Ei=class{constructor(e=new fe(1/0,1/0,1/0),t=new fe(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,r=e.length;t<r;t+=3)this.expandByPoint(kl.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,r=e.count;t<r;t++)this.expandByPoint(kl.fromBufferAttribute(e,t));return this}setFromPoints(e){this.makeEmpty();for(let t=0,r=e.length;t<r;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){let r=kl.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(r),this.max.copy(e).add(r),this}setFromObject(e,t=!1){return this.makeEmpty(),this.expandByObject(e,t)}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}expandByObject(e,t=!1){e.updateWorldMatrix(!1,!1);let r=e.geometry;if(r!==void 0){let n=r.getAttribute("position");if(t===!0&&n!==void 0&&e.isInstancedMesh!==!0)for(let a=0,o=n.count;a<o;a++)e.isMesh===!0?e.getVertexPosition(a,kl):kl.fromBufferAttribute(n,a),kl.applyMatrix4(e.matrixWorld),this.expandByPoint(kl);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),_w.copy(e.boundingBox)):(r.boundingBox===null&&r.computeBoundingBox(),_w.copy(r.boundingBox)),_w.applyMatrix4(e.matrixWorld),this.union(_w)}let i=e.children;for(let n=0,a=i.length;n<a;n++)this.expandByObject(i[n],t);return this}containsPoint(e){return e.x>=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y&&e.z>=this.min.z&&e.z<=this.max.z}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y&&e.max.z>=this.min.z&&e.min.z<=this.max.z}intersectsSphere(e){return this.clampPoint(e.center,kl),kl.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,r;return e.normal.x>0?(t=e.normal.x*this.min.x,r=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,r=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,r+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,r+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,r+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,r+=e.normal.z*this.min.z),t<=-e.constant&&r>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(ev),bw.subVectors(this.max,ev),hm.subVectors(e.a,ev),dm.subVectors(e.b,ev),pm.subVectors(e.c,ev),ed.subVectors(dm,hm),td.subVectors(pm,dm),Xp.subVectors(hm,pm);let t=[0,-ed.z,ed.y,0,-td.z,td.y,0,-Xp.z,Xp.y,ed.z,0,-ed.x,td.z,0,-td.x,Xp.z,0,-Xp.x,-ed.y,ed.x,0,-td.y,td.x,0,-Xp.y,Xp.x,0];return!ND(t,hm,dm,pm,bw)||(t=[1,0,0,0,1,0,0,0,1],!ND(t,hm,dm,pm,bw))?!1:(ww.crossVectors(ed,td),t=[ww.x,ww.y,ww.z],ND(t,hm,dm,pm,bw))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,kl).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(kl).length()*.5),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()?this:(Yc[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Yc[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Yc[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Yc[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Yc[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Yc[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Yc[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Yc[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Yc),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}},Yc=[new fe,new fe,new fe,new fe,new fe,new fe,new fe,new fe],kl=new fe,_w=new Ei,hm=new fe,dm=new fe,pm=new fe,ed=new fe,td=new fe,Xp=new fe,ev=new fe,bw=new fe,ww=new fe,Jp=new fe;sfe=new Ei,tv=new fe,UD=new fe,ba=class{constructor(e=new fe,t=-1){this.isSphere=!0,this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){let r=this.center;t!==void 0?r.copy(t):sfe.setFromPoints(e).getCenter(r);let i=0;for(let n=0,a=e.length;n<a;n++)i=Math.max(i,r.distanceToSquared(e[n]));return this.radius=Math.sqrt(i),this}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(e){return e.distanceTo(this.center)-this.radius}intersectsSphere(e){let t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t}intersectsBox(e){return e.intersectsSphere(this)}intersectsPlane(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}clampPoint(e,t){let r=this.center.distanceToSquared(e);return t.copy(e),r>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;tv.subVectors(e,this.center);let t=tv.lengthSq();if(t>this.radius*this.radius){let r=Math.sqrt(t),i=(r-this.radius)*.5;this.center.addScaledVector(tv,i/r),this.radius+=i}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):(UD.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(tv.copy(e.center).add(UD)),this.expandByPoint(tv.copy(e.center).sub(UD))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}},Hc=new fe,QD=new fe,Ew=new fe,rd=new fe,jD=new fe,Mw=new fe,GD=new fe,bv=class{constructor(e=new fe,t=new fe(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,Hc)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);let r=t.dot(this.direction);return r<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,r)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){let t=Hc.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(Hc.copy(this.origin).addScaledVector(this.direction,t),Hc.distanceToSquared(e))}distanceSqToSegment(e,t,r,i){QD.copy(e).add(t).multiplyScalar(.5),Ew.copy(t).sub(e).normalize(),rd.copy(this.origin).sub(QD);let n=e.distanceTo(t)*.5,a=-this.direction.dot(Ew),o=rd.dot(this.direction),s=-rd.dot(Ew),l=rd.lengthSq(),u=Math.abs(1-a*a),c,h,d,p;if(u>0)if(c=a*s-o,h=a*o-s,p=n*u,c>=0)if(h>=-p)if(h<=p){let f=1/u;c*=f,h*=f,d=c*(c+a*h+2*o)+h*(a*c+h+2*s)+l}else h=n,c=Math.max(0,-(a*h+o)),d=-c*c+h*(h+2*s)+l;else h=-n,c=Math.max(0,-(a*h+o)),d=-c*c+h*(h+2*s)+l;else h<=-p?(c=Math.max(0,-(-a*n+o)),h=c>0?-n:Math.min(Math.max(-n,-s),n),d=-c*c+h*(h+2*s)+l):h<=p?(c=0,h=Math.min(Math.max(-n,-s),n),d=h*(h+2*s)+l):(c=Math.max(0,-(a*n+o)),h=c>0?n:Math.min(Math.max(-n,-s),n),d=-c*c+h*(h+2*s)+l);else h=a>0?-n:n,c=Math.max(0,-(a*h+o)),d=-c*c+h*(h+2*s)+l;return r&&r.copy(this.origin).addScaledVector(this.direction,c),i&&i.copy(QD).addScaledVector(Ew,h),d}intersectSphere(e,t){Hc.subVectors(e.center,this.origin);let r=Hc.dot(this.direction),i=Hc.dot(Hc)-r*r,n=e.radius*e.radius;if(i>n)return null;let a=Math.sqrt(n-i),o=r-a,s=r+a;return s<0?null:o<0?this.at(s,t):this.at(o,t)}intersectsSphere(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){let t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;let r=-(this.origin.dot(e.normal)+e.constant)/t;return r>=0?r:null}intersectPlane(e,t){let r=this.distanceToPlane(e);return r===null?null:this.at(r,t)}intersectsPlane(e){let t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let r,i,n,a,o,s,l=1/this.direction.x,u=1/this.direction.y,c=1/this.direction.z,h=this.origin;return l>=0?(r=(e.min.x-h.x)*l,i=(e.max.x-h.x)*l):(r=(e.max.x-h.x)*l,i=(e.min.x-h.x)*l),u>=0?(n=(e.min.y-h.y)*u,a=(e.max.y-h.y)*u):(n=(e.max.y-h.y)*u,a=(e.min.y-h.y)*u),r>a||n>i||((n>r||isNaN(r))&&(r=n),(a<i||isNaN(i))&&(i=a),c>=0?(o=(e.min.z-h.z)*c,s=(e.max.z-h.z)*c):(o=(e.max.z-h.z)*c,s=(e.min.z-h.z)*c),r>s||o>i)||((o>r||r!==r)&&(r=o),(s<i||i!==i)&&(i=s),i<0)?null:this.at(r>=0?r:i,t)}intersectsBox(e){return this.intersectBox(e,Hc)!==null}intersectTriangle(e,t,r,i,n){jD.subVectors(t,e),Mw.subVectors(r,e),GD.crossVectors(jD,Mw);let a=this.direction.dot(GD),o;if(a>0){if(i)return null;o=1}else if(a<0)o=-1,a=-a;else return null;rd.subVectors(this.origin,e);let s=o*this.direction.dot(Mw.crossVectors(rd,Mw));if(s<0)return null;let l=o*this.direction.dot(jD.cross(rd));if(l<0||s+l>a)return null;let u=-o*rd.dot(GD);return u<0?null:this.at(u/a,n)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}},er=class ak{constructor(t,r,i,n,a,o,s,l,u,c,h,d,p,f,m,g){ak.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,r,i,n,a,o,s,l,u,c,h,d,p,f,m,g)}set(t,r,i,n,a,o,s,l,u,c,h,d,p,f,m,g){let v=this.elements;return v[0]=t,v[4]=r,v[8]=i,v[12]=n,v[1]=a,v[5]=o,v[9]=s,v[13]=l,v[2]=u,v[6]=c,v[10]=h,v[14]=d,v[3]=p,v[7]=f,v[11]=m,v[15]=g,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 ak().fromArray(this.elements)}copy(t){let r=this.elements,i=t.elements;return r[0]=i[0],r[1]=i[1],r[2]=i[2],r[3]=i[3],r[4]=i[4],r[5]=i[5],r[6]=i[6],r[7]=i[7],r[8]=i[8],r[9]=i[9],r[10]=i[10],r[11]=i[11],r[12]=i[12],r[13]=i[13],r[14]=i[14],r[15]=i[15],this}copyPosition(t){let r=this.elements,i=t.elements;return r[12]=i[12],r[13]=i[13],r[14]=i[14],this}setFromMatrix3(t){let r=t.elements;return this.set(r[0],r[3],r[6],0,r[1],r[4],r[7],0,r[2],r[5],r[8],0,0,0,0,1),this}extractBasis(t,r,i){return t.setFromMatrixColumn(this,0),r.setFromMatrixColumn(this,1),i.setFromMatrixColumn(this,2),this}makeBasis(t,r,i){return this.set(t.x,r.x,i.x,0,t.y,r.y,i.y,0,t.z,r.z,i.z,0,0,0,0,1),this}extractRotation(t){let r=this.elements,i=t.elements,n=1/fm.setFromMatrixColumn(t,0).length(),a=1/fm.setFromMatrixColumn(t,1).length(),o=1/fm.setFromMatrixColumn(t,2).length();return r[0]=i[0]*n,r[1]=i[1]*n,r[2]=i[2]*n,r[3]=0,r[4]=i[4]*a,r[5]=i[5]*a,r[6]=i[6]*a,r[7]=0,r[8]=i[8]*o,r[9]=i[9]*o,r[10]=i[10]*o,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,this}makeRotationFromEuler(t){let r=this.elements,i=t.x,n=t.y,a=t.z,o=Math.cos(i),s=Math.sin(i),l=Math.cos(n),u=Math.sin(n),c=Math.cos(a),h=Math.sin(a);if(t.order==="XYZ"){let d=o*c,p=o*h,f=s*c,m=s*h;r[0]=l*c,r[4]=-l*h,r[8]=u,r[1]=p+f*u,r[5]=d-m*u,r[9]=-s*l,r[2]=m-d*u,r[6]=f+p*u,r[10]=o*l}else if(t.order==="YXZ"){let d=l*c,p=l*h,f=u*c,m=u*h;r[0]=d+m*s,r[4]=f*s-p,r[8]=o*u,r[1]=o*h,r[5]=o*c,r[9]=-s,r[2]=p*s-f,r[6]=m+d*s,r[10]=o*l}else if(t.order==="ZXY"){let d=l*c,p=l*h,f=u*c,m=u*h;r[0]=d-m*s,r[4]=-o*h,r[8]=f+p*s,r[1]=p+f*s,r[5]=o*c,r[9]=m-d*s,r[2]=-o*u,r[6]=s,r[10]=o*l}else if(t.order==="ZYX"){let d=o*c,p=o*h,f=s*c,m=s*h;r[0]=l*c,r[4]=f*u-p,r[8]=d*u+m,r[1]=l*h,r[5]=m*u+d,r[9]=p*u-f,r[2]=-u,r[6]=s*l,r[10]=o*l}else if(t.order==="YZX"){let d=o*l,p=o*u,f=s*l,m=s*u;r[0]=l*c,r[4]=m-d*h,r[8]=f*h+p,r[1]=h,r[5]=o*c,r[9]=-s*c,r[2]=-u*c,r[6]=p*h+f,r[10]=d-m*h}else if(t.order==="XZY"){let d=o*l,p=o*u,f=s*l,m=s*u;r[0]=l*c,r[4]=-h,r[8]=u*c,r[1]=d*h+m,r[5]=o*c,r[9]=p*h-f,r[2]=f*h-p,r[6]=s*c,r[10]=m*h+d}return r[3]=0,r[7]=0,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,this}makeRotationFromQuaternion(t){return this.compose(lfe,t,ufe)}lookAt(t,r,i){let n=this.elements;return Es.subVectors(t,r),Es.lengthSq()===0&&(Es.z=1),Es.normalize(),id.crossVectors(i,Es),id.lengthSq()===0&&(Math.abs(i.z)===1?Es.x+=1e-4:Es.z+=1e-4,Es.normalize(),id.crossVectors(i,Es)),id.normalize(),Sw.crossVectors(Es,id),n[0]=id.x,n[4]=Sw.x,n[8]=Es.x,n[1]=id.y,n[5]=Sw.y,n[9]=Es.y,n[2]=id.z,n[6]=Sw.z,n[10]=Es.z,this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,r){let i=t.elements,n=r.elements,a=this.elements,o=i[0],s=i[4],l=i[8],u=i[12],c=i[1],h=i[5],d=i[9],p=i[13],f=i[2],m=i[6],g=i[10],v=i[14],_=i[3],x=i[7],b=i[11],E=i[15],M=n[0],S=n[4],D=n[8],T=n[12],P=n[1],k=n[5],R=n[9],F=n[13],B=n[2],z=n[6],O=n[10],j=n[14],Y=n[3],Z=n[7],ne=n[11],ie=n[15];return a[0]=o*M+s*P+l*B+u*Y,a[4]=o*S+s*k+l*z+u*Z,a[8]=o*D+s*R+l*O+u*ne,a[12]=o*T+s*F+l*j+u*ie,a[1]=c*M+h*P+d*B+p*Y,a[5]=c*S+h*k+d*z+p*Z,a[9]=c*D+h*R+d*O+p*ne,a[13]=c*T+h*F+d*j+p*ie,a[2]=f*M+m*P+g*B+v*Y,a[6]=f*S+m*k+g*z+v*Z,a[10]=f*D+m*R+g*O+v*ne,a[14]=f*T+m*F+g*j+v*ie,a[3]=_*M+x*P+b*B+E*Y,a[7]=_*S+x*k+b*z+E*Z,a[11]=_*D+x*R+b*O+E*ne,a[15]=_*T+x*F+b*j+E*ie,this}multiplyScalar(t){let r=this.elements;return r[0]*=t,r[4]*=t,r[8]*=t,r[12]*=t,r[1]*=t,r[5]*=t,r[9]*=t,r[13]*=t,r[2]*=t,r[6]*=t,r[10]*=t,r[14]*=t,r[3]*=t,r[7]*=t,r[11]*=t,r[15]*=t,this}determinant(){let t=this.elements,r=t[0],i=t[4],n=t[8],a=t[12],o=t[1],s=t[5],l=t[9],u=t[13],c=t[2],h=t[6],d=t[10],p=t[14],f=t[3],m=t[7],g=t[11],v=t[15];return f*(+a*l*h-n*u*h-a*s*d+i*u*d+n*s*p-i*l*p)+m*(+r*l*p-r*u*d+a*o*d-n*o*p+n*u*c-a*l*c)+g*(+r*u*h-r*s*p-a*o*h+i*o*p+a*s*c-i*u*c)+v*(-n*s*c-r*l*h+r*s*d+n*o*h-i*o*d+i*l*c)}transpose(){let t=this.elements,r;return r=t[1],t[1]=t[4],t[4]=r,r=t[2],t[2]=t[8],t[8]=r,r=t[6],t[6]=t[9],t[9]=r,r=t[3],t[3]=t[12],t[12]=r,r=t[7],t[7]=t[13],t[13]=r,r=t[11],t[11]=t[14],t[14]=r,this}setPosition(t,r,i){let n=this.elements;return t.isVector3?(n[12]=t.x,n[13]=t.y,n[14]=t.z):(n[12]=t,n[13]=r,n[14]=i),this}invert(){let t=this.elements,r=t[0],i=t[1],n=t[2],a=t[3],o=t[4],s=t[5],l=t[6],u=t[7],c=t[8],h=t[9],d=t[10],p=t[11],f=t[12],m=t[13],g=t[14],v=t[15],_=h*g*u-m*d*u+m*l*p-s*g*p-h*l*v+s*d*v,x=f*d*u-c*g*u-f*l*p+o*g*p+c*l*v-o*d*v,b=c*m*u-f*h*u+f*s*p-o*m*p-c*s*v+o*h*v,E=f*h*l-c*m*l-f*s*d+o*m*d+c*s*g-o*h*g,M=r*_+i*x+n*b+a*E;if(M===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);let S=1/M;return t[0]=_*S,t[1]=(m*d*a-h*g*a-m*n*p+i*g*p+h*n*v-i*d*v)*S,t[2]=(s*g*a-m*l*a+m*n*u-i*g*u-s*n*v+i*l*v)*S,t[3]=(h*l*a-s*d*a-h*n*u+i*d*u+s*n*p-i*l*p)*S,t[4]=x*S,t[5]=(c*g*a-f*d*a+f*n*p-r*g*p-c*n*v+r*d*v)*S,t[6]=(f*l*a-o*g*a-f*n*u+r*g*u+o*n*v-r*l*v)*S,t[7]=(o*d*a-c*l*a+c*n*u-r*d*u-o*n*p+r*l*p)*S,t[8]=b*S,t[9]=(f*h*a-c*m*a-f*i*p+r*m*p+c*i*v-r*h*v)*S,t[10]=(o*m*a-f*s*a+f*i*u-r*m*u-o*i*v+r*s*v)*S,t[11]=(c*s*a-o*h*a-c*i*u+r*h*u+o*i*p-r*s*p)*S,t[12]=E*S,t[13]=(c*m*n-f*h*n+f*i*d-r*m*d-c*i*g+r*h*g)*S,t[14]=(f*s*n-o*m*n-f*i*l+r*m*l+o*i*g-r*s*g)*S,t[15]=(o*h*n-c*s*n+c*i*l-r*h*l-o*i*d+r*s*d)*S,this}scale(t){let r=this.elements,i=t.x,n=t.y,a=t.z;return r[0]*=i,r[4]*=n,r[8]*=a,r[1]*=i,r[5]*=n,r[9]*=a,r[2]*=i,r[6]*=n,r[10]*=a,r[3]*=i,r[7]*=n,r[11]*=a,this}getMaxScaleOnAxis(){let t=this.elements,r=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],i=t[4]*t[4]+t[5]*t[5]+t[6]*t[6],n=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(r,i,n))}makeTranslation(t,r,i){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,r,0,0,1,i,0,0,0,1),this}makeRotationX(t){let r=Math.cos(t),i=Math.sin(t);return this.set(1,0,0,0,0,r,-i,0,0,i,r,0,0,0,0,1),this}makeRotationY(t){let r=Math.cos(t),i=Math.sin(t);return this.set(r,0,i,0,0,1,0,0,-i,0,r,0,0,0,0,1),this}makeRotationZ(t){let r=Math.cos(t),i=Math.sin(t);return this.set(r,-i,0,0,i,r,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(t,r){let i=Math.cos(r),n=Math.sin(r),a=1-i,o=t.x,s=t.y,l=t.z,u=a*o,c=a*s;return this.set(u*o+i,u*s-n*l,u*l+n*s,0,u*s+n*l,c*s+i,c*l-n*o,0,u*l-n*s,c*l+n*o,a*l*l+i,0,0,0,0,1),this}makeScale(t,r,i){return this.set(t,0,0,0,0,r,0,0,0,0,i,0,0,0,0,1),this}makeShear(t,r,i,n,a,o){return this.set(1,i,a,0,t,1,o,0,r,n,1,0,0,0,0,1),this}compose(t,r,i){let n=this.elements,a=r._x,o=r._y,s=r._z,l=r._w,u=a+a,c=o+o,h=s+s,d=a*u,p=a*c,f=a*h,m=o*c,g=o*h,v=s*h,_=l*u,x=l*c,b=l*h,E=i.x,M=i.y,S=i.z;return n[0]=(1-(m+v))*E,n[1]=(p+b)*E,n[2]=(f-x)*E,n[3]=0,n[4]=(p-b)*M,n[5]=(1-(d+v))*M,n[6]=(g+_)*M,n[7]=0,n[8]=(f+x)*S,n[9]=(g-_)*S,n[10]=(1-(d+m))*S,n[11]=0,n[12]=t.x,n[13]=t.y,n[14]=t.z,n[15]=1,this}decompose(t,r,i){let n=this.elements,a=fm.set(n[0],n[1],n[2]).length(),o=fm.set(n[4],n[5],n[6]).length(),s=fm.set(n[8],n[9],n[10]).length();this.determinant()<0&&(a=-a),t.x=n[12],t.y=n[13],t.z=n[14],Rl.copy(this);let l=1/a,u=1/o,c=1/s;return Rl.elements[0]*=l,Rl.elements[1]*=l,Rl.elements[2]*=l,Rl.elements[4]*=u,Rl.elements[5]*=u,Rl.elements[6]*=u,Rl.elements[8]*=c,Rl.elements[9]*=c,Rl.elements[10]*=c,r.setFromRotationMatrix(Rl),i.x=a,i.y=o,i.z=s,this}makePerspective(t,r,i,n,a,o,s=Pu){let l=this.elements,u=2*a/(r-t),c=2*a/(i-n),h=(r+t)/(r-t),d=(i+n)/(i-n),p,f;if(s===Pu)p=-(o+a)/(o-a),f=-2*o*a/(o-a);else if(s===pE)p=-o/(o-a),f=-o*a/(o-a);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+s);return l[0]=u,l[4]=0,l[8]=h,l[12]=0,l[1]=0,l[5]=c,l[9]=d,l[13]=0,l[2]=0,l[6]=0,l[10]=p,l[14]=f,l[3]=0,l[7]=0,l[11]=-1,l[15]=0,this}makeOrthographic(t,r,i,n,a,o,s=Pu){let l=this.elements,u=1/(r-t),c=1/(i-n),h=1/(o-a),d=(r+t)*u,p=(i+n)*c,f,m;if(s===Pu)f=(o+a)*h,m=-2*h;else if(s===pE)f=a*h,m=-1*h;else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+s);return l[0]=2*u,l[4]=0,l[8]=0,l[12]=-d,l[1]=0,l[5]=2*c,l[9]=0,l[13]=-p,l[2]=0,l[6]=0,l[10]=m,l[14]=-f,l[3]=0,l[7]=0,l[11]=0,l[15]=1,this}equals(t){let r=this.elements,i=t.elements;for(let n=0;n<16;n++)if(r[n]!==i[n])return!1;return!0}fromArray(t,r=0){for(let i=0;i<16;i++)this.elements[i]=t[i+r];return this}toArray(t=[],r=0){let i=this.elements;return t[r]=i[0],t[r+1]=i[1],t[r+2]=i[2],t[r+3]=i[3],t[r+4]=i[4],t[r+5]=i[5],t[r+6]=i[6],t[r+7]=i[7],t[r+8]=i[8],t[r+9]=i[9],t[r+10]=i[10],t[r+11]=i[11],t[r+12]=i[12],t[r+13]=i[13],t[r+14]=i[14],t[r+15]=i[15],t}},fm=new fe,Rl=new er,lfe=new fe(0,0,0),ufe=new fe(1,1,1),id=new fe,Sw=new fe,Es=new fe,F9=new er,z9=new Sa,Ua=class pV{constructor(t=0,r=0,i=0,n=pV.DEFAULT_ORDER){this.isEuler=!0,this._x=t,this._y=r,this._z=i,this._order=n}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,r,i,n=this._order){return this._x=t,this._y=r,this._z=i,this._order=n,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,r=this._order,i=!0){let n=t.elements,a=n[0],o=n[4],s=n[8],l=n[1],u=n[5],c=n[9],h=n[2],d=n[6],p=n[10];switch(r){case"XYZ":this._y=Math.asin(li(s,-1,1)),Math.abs(s)<.9999999?(this._x=Math.atan2(-c,p),this._z=Math.atan2(-o,a)):(this._x=Math.atan2(d,u),this._z=0);break;case"YXZ":this._x=Math.asin(-li(c,-1,1)),Math.abs(c)<.9999999?(this._y=Math.atan2(s,p),this._z=Math.atan2(l,u)):(this._y=Math.atan2(-h,a),this._z=0);break;case"ZXY":this._x=Math.asin(li(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(-h,p),this._z=Math.atan2(-o,u)):(this._y=0,this._z=Math.atan2(l,a));break;case"ZYX":this._y=Math.asin(-li(h,-1,1)),Math.abs(h)<.9999999?(this._x=Math.atan2(d,p),this._z=Math.atan2(l,a)):(this._x=0,this._z=Math.atan2(-o,u));break;case"YZX":this._z=Math.asin(li(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-c,u),this._y=Math.atan2(-h,a)):(this._x=0,this._y=Math.atan2(s,p));break;case"XZY":this._z=Math.asin(-li(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(d,u),this._y=Math.atan2(s,a)):(this._x=Math.atan2(-c,p),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+r)}return this._order=r,i===!0&&this._onChangeCallback(),this}setFromQuaternion(t,r,i){return F9.makeRotationFromQuaternion(t),this.setFromRotationMatrix(F9,r,i)}setFromVector3(t,r=this._order){return this.set(t.x,t.y,t.z,r)}reorder(t){return z9.setFromEuler(this),this.setFromQuaternion(z9,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=[],r=0){return t[r]=this._x,t[r+1]=this._y,t[r+2]=this._z,t[r+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}};Ua.DEFAULT_ORDER="XYZ";xk=class{constructor(){this.mask=1}set(e){this.mask=(1<<e|0)>>>0}enable(e){this.mask|=1<<e|0}enableAll(){this.mask=-1}toggle(e){this.mask^=1<<e|0}disable(e){this.mask&=~(1<<e|0)}disableAll(){this.mask=0}test(e){return(this.mask&e.mask)!==0}isEnabled(e){return(this.mask&(1<<e|0))!==0}},cfe=0,L9=new fe,Am=new Sa,Wc=new er,Iw=new fe,rv=new fe,hfe=new fe,dfe=new Sa,O9=new fe(1,0,0),N9=new fe(0,1,0),U9=new fe(0,0,1),Q9={type:"added"},pfe={type:"removed"},mm={type:"childadded",child:null},VD={type:"childremoved",child:null},mi=class uE extends Vm{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:cfe++}),this.uuid=rl(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=uE.DEFAULT_UP.clone();let t=new fe,r=new Ua,i=new Sa,n=new fe(1,1,1);function a(){i.setFromEuler(r,!1)}function o(){r.setFromQuaternion(i,void 0,!1)}r._onChange(a),i._onChange(o),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:t},rotation:{configurable:!0,enumerable:!0,value:r},quaternion:{configurable:!0,enumerable:!0,value:i},scale:{configurable:!0,enumerable:!0,value:n},modelViewMatrix:{value:new er},normalMatrix:{value:new Wr}}),this.matrix=new er,this.matrixWorld=new er,this.matrixAutoUpdate=uE.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=uE.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new xk,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.userData={}}onBeforeShadow(){}onAfterShadow(){}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,r){this.quaternion.setFromAxisAngle(t,r)}setRotationFromEuler(t){this.quaternion.setFromEuler(t,!0)}setRotationFromMatrix(t){this.quaternion.setFromRotationMatrix(t)}setRotationFromQuaternion(t){this.quaternion.copy(t)}rotateOnAxis(t,r){return Am.setFromAxisAngle(t,r),this.quaternion.multiply(Am),this}rotateOnWorldAxis(t,r){return Am.setFromAxisAngle(t,r),this.quaternion.premultiply(Am),this}rotateX(t){return this.rotateOnAxis(O9,t)}rotateY(t){return this.rotateOnAxis(N9,t)}rotateZ(t){return this.rotateOnAxis(U9,t)}translateOnAxis(t,r){return L9.copy(t).applyQuaternion(this.quaternion),this.position.add(L9.multiplyScalar(r)),this}translateX(t){return this.translateOnAxis(O9,t)}translateY(t){return this.translateOnAxis(N9,t)}translateZ(t){return this.translateOnAxis(U9,t)}localToWorld(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(this.matrixWorld)}worldToLocal(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(Wc.copy(this.matrixWorld).invert())}lookAt(t,r,i){t.isVector3?Iw.copy(t):Iw.set(t,r,i);let n=this.parent;this.updateWorldMatrix(!0,!1),rv.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?Wc.lookAt(rv,Iw,this.up):Wc.lookAt(Iw,rv,this.up),this.quaternion.setFromRotationMatrix(Wc),n&&(Wc.extractRotation(n.matrixWorld),Am.setFromRotationMatrix(Wc),this.quaternion.premultiply(Am.invert()))}add(t){if(arguments.length>1){for(let r=0;r<arguments.length;r++)this.add(arguments[r]);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.removeFromParent(),t.parent=this,this.children.push(t),t.dispatchEvent(Q9),mm.child=t,this.dispatchEvent(mm),mm.child=null):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",t),this)}remove(t){if(arguments.length>1){for(let i=0;i<arguments.length;i++)this.remove(arguments[i]);return this}let r=this.children.indexOf(t);return r!==-1&&(t.parent=null,this.children.splice(r,1),t.dispatchEvent(pfe),VD.child=t,this.dispatchEvent(VD),VD.child=null),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),Wc.copy(this.matrixWorld).invert(),t.parent!==null&&(t.parent.updateWorldMatrix(!0,!1),Wc.multiply(t.parent.matrixWorld)),t.applyMatrix4(Wc),t.removeFromParent(),t.parent=this,this.children.push(t),t.updateWorldMatrix(!1,!0),t.dispatchEvent(Q9),mm.child=t,this.dispatchEvent(mm),mm.child=null,this}getObjectById(t){return this.getObjectByProperty("id",t)}getObjectByName(t){return this.getObjectByProperty("name",t)}getObjectByProperty(t,r){if(this[t]===r)return this;for(let i=0,n=this.children.length;i<n;i++){let a=this.children[i].getObjectByProperty(t,r);if(a!==void 0)return a}}getObjectsByProperty(t,r,i=[]){this[t]===r&&i.push(this);let n=this.children;for(let a=0,o=n.length;a<o;a++)n[a].getObjectsByProperty(t,r,i);return i}getWorldPosition(t){return this.updateWorldMatrix(!0,!1),t.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(rv,t,hfe),t}getWorldScale(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(rv,dfe,t),t}getWorldDirection(t){this.updateWorldMatrix(!0,!1);let r=this.matrixWorld.elements;return t.set(r[8],r[9],r[10]).normalize()}raycast(){}traverse(t){t(this);let r=this.children;for(let i=0,n=r.length;i<n;i++)r[i].traverse(t)}traverseVisible(t){if(this.visible===!1)return;t(this);let r=this.children;for(let i=0,n=r.length;i<n;i++)r[i].traverseVisible(t)}traverseAncestors(t){let r=this.parent;r!==null&&(t(r),r.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.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,t=!0);let r=this.children;for(let i=0,n=r.length;i<n;i++)r[i].updateMatrixWorld(t)}updateWorldMatrix(t,r){let i=this.parent;if(t===!0&&i!==null&&i.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),r===!0){let n=this.children;for(let a=0,o=n.length;a<o;a++)n[a].updateWorldMatrix(!1,!0)}}toJSON(t){let r=t===void 0||typeof t=="string",i={};r&&(t={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},i.metadata={version:4.6,type:"Object",generator:"Object3D.toJSON"});let n={};n.uuid=this.uuid,n.type=this.type,this.name!==""&&(n.name=this.name),this.castShadow===!0&&(n.castShadow=!0),this.receiveShadow===!0&&(n.receiveShadow=!0),this.visible===!1&&(n.visible=!1),this.frustumCulled===!1&&(n.frustumCulled=!1),this.renderOrder!==0&&(n.renderOrder=this.renderOrder),Object.keys(this.userData).length>0&&(n.userData=this.userData),n.layers=this.layers.mask,n.matrix=this.matrix.toArray(),n.up=this.up.toArray(),this.matrixAutoUpdate===!1&&(n.matrixAutoUpdate=!1),this.isInstancedMesh&&(n.type="InstancedMesh",n.count=this.count,n.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(n.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(n.type="BatchedMesh",n.perObjectFrustumCulled=this.perObjectFrustumCulled,n.sortObjects=this.sortObjects,n.drawRanges=this._drawRanges,n.reservedRanges=this._reservedRanges,n.visibility=this._visibility,n.active=this._active,n.bounds=this._bounds.map(s=>({boxInitialized:s.boxInitialized,boxMin:s.box.min.toArray(),boxMax:s.box.max.toArray(),sphereInitialized:s.sphereInitialized,sphereRadius:s.sphere.radius,sphereCenter:s.sphere.center.toArray()})),n.maxInstanceCount=this._maxInstanceCount,n.maxVertexCount=this._maxVertexCount,n.maxIndexCount=this._maxIndexCount,n.geometryInitialized=this._geometryInitialized,n.geometryCount=this._geometryCount,n.matricesTexture=this._matricesTexture.toJSON(t),this._colorsTexture!==null&&(n.colorsTexture=this._colorsTexture.toJSON(t)),this.boundingSphere!==null&&(n.boundingSphere={center:n.boundingSphere.center.toArray(),radius:n.boundingSphere.radius}),this.boundingBox!==null&&(n.boundingBox={min:n.boundingBox.min.toArray(),max:n.boundingBox.max.toArray()}));function a(s,l){return s[l.uuid]===void 0&&(s[l.uuid]=l.toJSON(t)),l.uuid}if(this.isScene)this.background&&(this.background.isColor?n.background=this.background.toJSON():this.background.isTexture&&(n.background=this.background.toJSON(t).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(n.environment=this.environment.toJSON(t).uuid);else if(this.isMesh||this.isLine||this.isPoints){n.geometry=a(t.geometries,this.geometry);let s=this.geometry.parameters;if(s!==void 0&&s.shapes!==void 0){let l=s.shapes;if(Array.isArray(l))for(let u=0,c=l.length;u<c;u++){let h=l[u];a(t.shapes,h)}else a(t.shapes,l)}}if(this.isSkinnedMesh&&(n.bindMode=this.bindMode,n.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(a(t.skeletons,this.skeleton),n.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){let s=[];for(let l=0,u=this.material.length;l<u;l++)s.push(a(t.materials,this.material[l]));n.material=s}else n.material=a(t.materials,this.material);if(this.children.length>0){n.children=[];for(let s=0;s<this.children.length;s++)n.children.push(this.children[s].toJSON(t).object)}if(this.animations.length>0){n.animations=[];for(let s=0;s<this.animations.length;s++){let l=this.animations[s];n.animations.push(a(t.animations,l))}}if(r){let s=o(t.geometries),l=o(t.materials),u=o(t.textures),c=o(t.images),h=o(t.shapes),d=o(t.skeletons),p=o(t.animations),f=o(t.nodes);s.length>0&&(i.geometries=s),l.length>0&&(i.materials=l),u.length>0&&(i.textures=u),c.length>0&&(i.images=c),h.length>0&&(i.shapes=h),d.length>0&&(i.skeletons=d),p.length>0&&(i.animations=p),f.length>0&&(i.nodes=f)}return i.object=n,i;function o(s){let l=[];for(let u in s){let c=s[u];delete c.metadata,l.push(c)}return l}}clone(t){return new this.constructor().copy(this,t)}copy(t,r=!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.matrixWorldAutoUpdate=t.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,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)),r===!0)for(let i=0;i<t.children.length;i++){let n=t.children[i];this.add(n.clone())}return this}};mi.DEFAULT_UP=new fe(0,1,0);mi.DEFAULT_MATRIX_AUTO_UPDATE=!0;mi.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;Fl=new fe,Zc=new fe,YD=new fe,Xc=new fe,gm=new fe,ym=new fe,j9=new fe,HD=new fe,WD=new fe,ZD=new fe,XD=new wi,JD=new wi,KD=new wi,Mm=class Sm{constructor(t=new fe,r=new fe,i=new fe){this.a=t,this.b=r,this.c=i}static getNormal(t,r,i,n){n.subVectors(i,r),Fl.subVectors(t,r),n.cross(Fl);let a=n.lengthSq();return a>0?n.multiplyScalar(1/Math.sqrt(a)):n.set(0,0,0)}static getBarycoord(t,r,i,n,a){Fl.subVectors(n,r),Zc.subVectors(i,r),YD.subVectors(t,r);let o=Fl.dot(Fl),s=Fl.dot(Zc),l=Fl.dot(YD),u=Zc.dot(Zc),c=Zc.dot(YD),h=o*u-s*s;if(h===0)return a.set(0,0,0),null;let d=1/h,p=(u*l-s*c)*d,f=(o*c-s*l)*d;return a.set(1-p-f,f,p)}static containsPoint(t,r,i,n){return this.getBarycoord(t,r,i,n,Xc)===null?!1:Xc.x>=0&&Xc.y>=0&&Xc.x+Xc.y<=1}static getInterpolation(t,r,i,n,a,o,s,l){return this.getBarycoord(t,r,i,n,Xc)===null?(l.x=0,l.y=0,"z"in l&&(l.z=0),"w"in l&&(l.w=0),null):(l.setScalar(0),l.addScaledVector(a,Xc.x),l.addScaledVector(o,Xc.y),l.addScaledVector(s,Xc.z),l)}static getInterpolatedAttribute(t,r,i,n,a,o){return XD.setScalar(0),JD.setScalar(0),KD.setScalar(0),XD.fromBufferAttribute(t,r),JD.fromBufferAttribute(t,i),KD.fromBufferAttribute(t,n),o.setScalar(0),o.addScaledVector(XD,a.x),o.addScaledVector(JD,a.y),o.addScaledVector(KD,a.z),o}static isFrontFacing(t,r,i,n){return Fl.subVectors(i,r),Zc.subVectors(t,r),Fl.cross(Zc).dot(n)<0}set(t,r,i){return this.a.copy(t),this.b.copy(r),this.c.copy(i),this}setFromPointsAndIndices(t,r,i,n){return this.a.copy(t[r]),this.b.copy(t[i]),this.c.copy(t[n]),this}setFromAttributeAndIndices(t,r,i,n){return this.a.fromBufferAttribute(t,r),this.b.fromBufferAttribute(t,i),this.c.fromBufferAttribute(t,n),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 Fl.subVectors(this.c,this.b),Zc.subVectors(this.a,this.b),Fl.cross(Zc).length()*.5}getMidpoint(t){return t.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(t){return Sm.getNormal(this.a,this.b,this.c,t)}getPlane(t){return t.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(t,r){return Sm.getBarycoord(t,this.a,this.b,this.c,r)}getInterpolation(t,r,i,n,a){return Sm.getInterpolation(t,this.a,this.b,this.c,r,i,n,a)}containsPoint(t){return Sm.containsPoint(t,this.a,this.b,this.c)}isFrontFacing(t){return Sm.isFrontFacing(this.a,this.b,this.c,t)}intersectsBox(t){return t.intersectsTriangle(this)}closestPointToPoint(t,r){let i=this.a,n=this.b,a=this.c,o,s;gm.subVectors(n,i),ym.subVectors(a,i),HD.subVectors(t,i);let l=gm.dot(HD),u=ym.dot(HD);if(l<=0&&u<=0)return r.copy(i);WD.subVectors(t,n);let c=gm.dot(WD),h=ym.dot(WD);if(c>=0&&h<=c)return r.copy(n);let d=l*h-c*u;if(d<=0&&l>=0&&c<=0)return o=l/(l-c),r.copy(i).addScaledVector(gm,o);ZD.subVectors(t,a);let p=gm.dot(ZD),f=ym.dot(ZD);if(f>=0&&p<=f)return r.copy(a);let m=p*u-l*f;if(m<=0&&u>=0&&f<=0)return s=u/(u-f),r.copy(i).addScaledVector(ym,s);let g=c*f-p*h;if(g<=0&&h-c>=0&&p-f>=0)return j9.subVectors(a,n),s=(h-c)/(h-c+(p-f)),r.copy(n).addScaledVector(j9,s);let v=1/(g+m+d);return o=m*v,s=d*v,r.copy(i).addScaledVector(gm,o).addScaledVector(ym,s)}equals(t){return t.a.equals(this.a)&&t.b.equals(this.b)&&t.c.equals(this.c)}},fV={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},nd={h:0,s:0,l:0},Cw={h:0,s:0,l:0};Dt=class{constructor(e,t,r){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,r)}set(e,t,r){if(t===void 0&&r===void 0){let i=e;i&&i.isColor?this.copy(i):typeof i=="number"?this.setHex(i):typeof i=="string"&&this.setStyle(i)}else this.setRGB(e,t,r);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=Zi){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,Ai.toWorkingColorSpace(this,t),this}setRGB(e,t,r,i=Ai.workingColorSpace){return this.r=e,this.g=t,this.b=r,Ai.toWorkingColorSpace(this,i),this}setHSL(e,t,r,i=Ai.workingColorSpace){if(e=vk(e,1),t=li(t,0,1),r=li(r,0,1),t===0)this.r=this.g=this.b=r;else{let n=r<=.5?r*(1+t):r+t-r*t,a=2*r-n;this.r=qD(a,n,e+1/3),this.g=qD(a,n,e),this.b=qD(a,n,e-1/3)}return Ai.toWorkingColorSpace(this,i),this}setStyle(e,t=Zi){function r(n){n!==void 0&&parseFloat(n)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let i;if(i=/^(\\w+)\\(([^\\)]*)\\)/.exec(e)){let n,a=i[1],o=i[2];switch(a){case"rgb":case"rgba":if(n=/^\\s*(\\d+)\\s*,\\s*(\\d+)\\s*,\\s*(\\d+)\\s*(?:,\\s*(\\d*\\.?\\d+)\\s*)?$/.exec(o))return r(n[4]),this.setRGB(Math.min(255,parseInt(n[1],10))/255,Math.min(255,parseInt(n[2],10))/255,Math.min(255,parseInt(n[3],10))/255,t);if(n=/^\\s*(\\d+)\\%\\s*,\\s*(\\d+)\\%\\s*,\\s*(\\d+)\\%\\s*(?:,\\s*(\\d*\\.?\\d+)\\s*)?$/.exec(o))return r(n[4]),this.setRGB(Math.min(100,parseInt(n[1],10))/100,Math.min(100,parseInt(n[2],10))/100,Math.min(100,parseInt(n[3],10))/100,t);break;case"hsl":case"hsla":if(n=/^\\s*(\\d*\\.?\\d+)\\s*,\\s*(\\d*\\.?\\d+)\\%\\s*,\\s*(\\d*\\.?\\d+)\\%\\s*(?:,\\s*(\\d*\\.?\\d+)\\s*)?$/.exec(o))return r(n[4]),this.setHSL(parseFloat(n[1])/360,parseFloat(n[2])/100,parseFloat(n[3])/100,t);break;default:console.warn("THREE.Color: Unknown color model "+e)}}else if(i=/^\\#([A-Fa-f\\d]+)$/.exec(e)){let n=i[1],a=n.length;if(a===3)return this.setRGB(parseInt(n.charAt(0),16)/15,parseInt(n.charAt(1),16)/15,parseInt(n.charAt(2),16)/15,t);if(a===6)return this.setHex(parseInt(n,16),t);console.warn("THREE.Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=Zi){let r=fV[e.toLowerCase()];return r!==void 0?this.setHex(r,t):console.warn("THREE.Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=$c(e.r),this.g=$c(e.g),this.b=$c(e.b),this}copyLinearToSRGB(e){return this.r=km(e.r),this.g=km(e.g),this.b=km(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=Zi){return Ai.fromWorkingColorSpace(fo.copy(this),e),Math.round(li(fo.r*255,0,255))*65536+Math.round(li(fo.g*255,0,255))*256+Math.round(li(fo.b*255,0,255))}getHexString(e=Zi){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=Ai.workingColorSpace){Ai.fromWorkingColorSpace(fo.copy(this),t);let r=fo.r,i=fo.g,n=fo.b,a=Math.max(r,i,n),o=Math.min(r,i,n),s,l,u=(o+a)/2;if(o===a)s=0,l=0;else{let c=a-o;switch(l=u<=.5?c/(a+o):c/(2-a-o),a){case r:s=(i-n)/c+(i<n?6:0);break;case i:s=(n-r)/c+2;break;case n:s=(r-i)/c+4;break}s/=6}return e.h=s,e.s=l,e.l=u,e}getRGB(e,t=Ai.workingColorSpace){return Ai.fromWorkingColorSpace(fo.copy(this),t),e.r=fo.r,e.g=fo.g,e.b=fo.b,e}getStyle(e=Zi){Ai.fromWorkingColorSpace(fo.copy(this),e);let t=fo.r,r=fo.g,i=fo.b;return e!==Zi?"color(".concat(e," ").concat(t.toFixed(3)," ").concat(r.toFixed(3)," ").concat(i.toFixed(3),")"):"rgb(".concat(Math.round(t*255),",").concat(Math.round(r*255),",").concat(Math.round(i*255),")")}offsetHSL(e,t,r){return this.getHSL(nd),this.setHSL(nd.h+e,nd.s+t,nd.l+r)}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this}lerpColors(e,t,r){return this.r=e.r+(t.r-e.r)*r,this.g=e.g+(t.g-e.g)*r,this.b=e.b+(t.b-e.b)*r,this}lerpHSL(e,t){this.getHSL(nd),e.getHSL(Cw);let r=cv(nd.h,Cw.h,t),i=cv(nd.s,Cw.s,t),n=cv(nd.l,Cw.l,t);return this.setHSL(r,i,n),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){let t=this.r,r=this.g,i=this.b,n=e.elements;return this.r=n[0]*t+n[3]*r+n[6]*i,this.g=n[1]*t+n[4]*r+n[7]*i,this.b=n[2]*t+n[5]*r+n[8]*i,this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,t=0){return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}toArray(e=[],t=0){return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}fromBufferAttribute(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}},fo=new Dt;Dt.NAMES=fV;ffe=0,es=class extends Vm{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:ffe++}),this.uuid=rl(),this.name="",this.type="Material",this.blending=Tm,this.side=mo,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=b3,this.blendDst=w3,this.blendEquation=af,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new Dt(0,0,0),this.blendAlpha=0,this.depthFunc=Rm,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=Nm,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=Zn,this.stencilZFail=Zn,this.stencilZPass=Zn,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(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(let t in e){let r=e[t];if(r===void 0){console.warn("THREE.Material: parameter '".concat(t,"' has value of undefined."));continue}let i=this[t];if(i===void 0){console.warn("THREE.Material: '".concat(t,"' is not a property of THREE.").concat(this.type,"."));continue}i&&i.isColor?i.set(r):i&&i.isVector3&&r&&r.isVector3?i.copy(r):this[t]=r}}toJSON(e){let t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});let r={metadata:{version:4.6,type:"Material",generator:"Material.toJSON"}};r.uuid=this.uuid,r.type=this.type,this.name!==""&&(r.name=this.name),this.color&&this.color.isColor&&(r.color=this.color.getHex()),this.roughness!==void 0&&(r.roughness=this.roughness),this.metalness!==void 0&&(r.metalness=this.metalness),this.sheen!==void 0&&(r.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(r.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(r.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(r.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(r.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(r.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(r.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(r.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(r.shininess=this.shininess),this.clearcoat!==void 0&&(r.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(r.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(r.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(r.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(r.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,r.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.dispersion!==void 0&&(r.dispersion=this.dispersion),this.iridescence!==void 0&&(r.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(r.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(r.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(r.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(r.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(r.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(r.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(r.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(r.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(r.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(r.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(r.lightMap=this.lightMap.toJSON(e).uuid,r.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(r.aoMap=this.aoMap.toJSON(e).uuid,r.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(r.bumpMap=this.bumpMap.toJSON(e).uuid,r.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(r.normalMap=this.normalMap.toJSON(e).uuid,r.normalMapType=this.normalMapType,r.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(r.displacementMap=this.displacementMap.toJSON(e).uuid,r.displacementScale=this.displacementScale,r.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(r.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(r.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(r.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(r.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(r.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(r.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(r.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(r.combine=this.combine)),this.envMapRotation!==void 0&&(r.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(r.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(r.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(r.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(r.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(r.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(r.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(r.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(r.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(r.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(r.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(r.size=this.size),this.shadowSide!==null&&(r.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(r.sizeAttenuation=this.sizeAttenuation),this.blending!==Tm&&(r.blending=this.blending),this.side!==mo&&(r.side=this.side),this.vertexColors===!0&&(r.vertexColors=!0),this.opacity<1&&(r.opacity=this.opacity),this.transparent===!0&&(r.transparent=!0),this.blendSrc!==b3&&(r.blendSrc=this.blendSrc),this.blendDst!==w3&&(r.blendDst=this.blendDst),this.blendEquation!==af&&(r.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(r.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(r.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(r.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(r.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(r.blendAlpha=this.blendAlpha),this.depthFunc!==Rm&&(r.depthFunc=this.depthFunc),this.depthTest===!1&&(r.depthTest=this.depthTest),this.depthWrite===!1&&(r.depthWrite=this.depthWrite),this.colorWrite===!1&&(r.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(r.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==Nm&&(r.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(r.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(r.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==Zn&&(r.stencilFail=this.stencilFail),this.stencilZFail!==Zn&&(r.stencilZFail=this.stencilZFail),this.stencilZPass!==Zn&&(r.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(r.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(r.rotation=this.rotation),this.polygonOffset===!0&&(r.polygonOffset=!0),this.polygonOffsetFactor!==0&&(r.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(r.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(r.linewidth=this.linewidth),this.dashSize!==void 0&&(r.dashSize=this.dashSize),this.gapSize!==void 0&&(r.gapSize=this.gapSize),this.scale!==void 0&&(r.scale=this.scale),this.dithering===!0&&(r.dithering=!0),this.alphaTest>0&&(r.alphaTest=this.alphaTest),this.alphaHash===!0&&(r.alphaHash=!0),this.alphaToCoverage===!0&&(r.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(r.premultipliedAlpha=!0),this.forceSinglePass===!0&&(r.forceSinglePass=!0),this.wireframe===!0&&(r.wireframe=!0),this.wireframeLinewidth>1&&(r.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(r.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(r.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(r.flatShading=!0),this.visible===!1&&(r.visible=!1),this.toneMapped===!1&&(r.toneMapped=!1),this.fog===!1&&(r.fog=!1),Object.keys(this.userData).length>0&&(r.userData=this.userData);function i(n){let a=[];for(let o in n){let s=n[o];delete s.metadata,a.push(s)}return a}if(t){let n=i(e.textures),a=i(e.images);n.length>0&&(r.textures=n),a.length>0&&(r.images=a)}return r}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;let t=e.clippingPlanes,r=null;if(t!==null){let i=t.length;r=new Array(i);for(let n=0;n!==i;++n)r[n]=t[n].clone()}return this.clippingPlanes=r,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}onBuild(){console.warn("Material: onBuild() has been removed.")}},Fn=class extends es{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new Dt(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Ua,this.combine=hk,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}},ha=new fe,Bw=new vt,Afe=0,qr=class{constructor(e,t,r=!1){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:Afe++}),this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=r,this.usage=nk,this.updateRanges=[],this.gpuType=Po,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,r){e*=this.itemSize,r*=t.itemSize;for(let i=0,n=this.itemSize;i<n;i++)this.array[e+i]=t.array[r+i];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(this.itemSize===2)for(let t=0,r=this.count;t<r;t++)Bw.fromBufferAttribute(this,t),Bw.applyMatrix3(e),this.setXY(t,Bw.x,Bw.y);else if(this.itemSize===3)for(let t=0,r=this.count;t<r;t++)ha.fromBufferAttribute(this,t),ha.applyMatrix3(e),this.setXYZ(t,ha.x,ha.y,ha.z);return this}applyMatrix4(e){for(let t=0,r=this.count;t<r;t++)ha.fromBufferAttribute(this,t),ha.applyMatrix4(e),this.setXYZ(t,ha.x,ha.y,ha.z);return this}applyNormalMatrix(e){for(let t=0,r=this.count;t<r;t++)ha.fromBufferAttribute(this,t),ha.applyNormalMatrix(e),this.setXYZ(t,ha.x,ha.y,ha.z);return this}transformDirection(e){for(let t=0,r=this.count;t<r;t++)ha.fromBufferAttribute(this,t),ha.transformDirection(e),this.setXYZ(t,ha.x,ha.y,ha.z);return this}set(e,t=0){return this.array.set(e,t),this}getComponent(e,t){let r=this.array[e*this.itemSize+t];return this.normalized&&(r=zl(r,this.array)),r}setComponent(e,t,r){return this.normalized&&(r=Hi(r,this.array)),this.array[e*this.itemSize+t]=r,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=zl(t,this.array)),t}setX(e,t){return this.normalized&&(t=Hi(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=zl(t,this.array)),t}setY(e,t){return this.normalized&&(t=Hi(t,this.array)),this.array[e*this.itemSize+1]=t,this}getZ(e){let t=this.array[e*this.itemSize+2];return this.normalized&&(t=zl(t,this.array)),t}setZ(e,t){return this.normalized&&(t=Hi(t,this.array)),this.array[e*this.itemSize+2]=t,this}getW(e){let t=this.array[e*this.itemSize+3];return this.normalized&&(t=zl(t,this.array)),t}setW(e,t){return this.normalized&&(t=Hi(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,r){return e*=this.itemSize,this.normalized&&(t=Hi(t,this.array),r=Hi(r,this.array)),this.array[e+0]=t,this.array[e+1]=r,this}setXYZ(e,t,r,i){return e*=this.itemSize,this.normalized&&(t=Hi(t,this.array),r=Hi(r,this.array),i=Hi(i,this.array)),this.array[e+0]=t,this.array[e+1]=r,this.array[e+2]=i,this}setXYZW(e,t,r,i,n){return e*=this.itemSize,this.normalized&&(t=Hi(t,this.array),r=Hi(r,this.array),i=Hi(i,this.array),n=Hi(n,this.array)),this.array[e+0]=t,this.array[e+1]=r,this.array[e+2]=i,this.array[e+3]=n,this}onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){let e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return this.name!==""&&(e.name=this.name),this.usage!==nk&&(e.usage=this.usage),e}},AV=class extends qr{constructor(e,t,r){super(new Uint16Array(e),t,r)}},mV=class extends qr{constructor(e,t,r){super(new Uint32Array(e),t,r)}},nn=class extends qr{constructor(e,t,r){super(new Float32Array(e),t,r)}},mfe=0,$s=new er,$D=new mi,vm=new fe,Ms=new Ei,iv=new Ei,Fa=new fe,xn=class gV extends Vm{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:mfe++}),this.uuid=rl(),this.name="",this.type="BufferGeometry",this.index=null,this.indirect=null,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(t){return Array.isArray(t)?this.index=new(uV(t)?mV:AV)(t,1):this.index=t,this}setIndirect(t){return this.indirect=t,this}getIndirect(){return this.indirect}getAttribute(t){return this.attributes[t]}setAttribute(t,r){return this.attributes[t]=r,this}deleteAttribute(t){return delete this.attributes[t],this}hasAttribute(t){return this.attributes[t]!==void 0}addGroup(t,r,i=0){this.groups.push({start:t,count:r,materialIndex:i})}clearGroups(){this.groups=[]}setDrawRange(t,r){this.drawRange.start=t,this.drawRange.count=r}applyMatrix4(t){let r=this.attributes.position;r!==void 0&&(r.applyMatrix4(t),r.needsUpdate=!0);let i=this.attributes.normal;if(i!==void 0){let a=new Wr().getNormalMatrix(t);i.applyNormalMatrix(a),i.needsUpdate=!0}let n=this.attributes.tangent;return n!==void 0&&(n.transformDirection(t),n.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(t){return $s.makeRotationFromQuaternion(t),this.applyMatrix4($s),this}rotateX(t){return $s.makeRotationX(t),this.applyMatrix4($s),this}rotateY(t){return $s.makeRotationY(t),this.applyMatrix4($s),this}rotateZ(t){return $s.makeRotationZ(t),this.applyMatrix4($s),this}translate(t,r,i){return $s.makeTranslation(t,r,i),this.applyMatrix4($s),this}scale(t,r,i){return $s.makeScale(t,r,i),this.applyMatrix4($s),this}lookAt(t){return $D.lookAt(t),$D.updateMatrix(),this.applyMatrix4($D.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(vm).negate(),this.translate(vm.x,vm.y,vm.z),this}setFromPoints(t){let r=this.getAttribute("position");if(r===void 0){let i=[];for(let n=0,a=t.length;n<a;n++){let o=t[n];i.push(o.x,o.y,o.z||0)}this.setAttribute("position",new nn(i,3))}else{let i=Math.min(t.length,r.count);for(let n=0;n<i;n++){let a=t[n];r.setXYZ(n,a.x,a.y,a.z||0)}t.length>r.count&&console.warn("THREE.BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),r.needsUpdate=!0}return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Ei);let t=this.attributes.position,r=this.morphAttributes.position;if(t&&t.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new fe(-1/0,-1/0,-1/0),new fe(1/0,1/0,1/0));return}if(t!==void 0){if(this.boundingBox.setFromBufferAttribute(t),r)for(let i=0,n=r.length;i<n;i++){let a=r[i];Ms.setFromBufferAttribute(a),this.morphTargetsRelative?(Fa.addVectors(this.boundingBox.min,Ms.min),this.boundingBox.expandByPoint(Fa),Fa.addVectors(this.boundingBox.max,Ms.max),this.boundingBox.expandByPoint(Fa)):(this.boundingBox.expandByPoint(Ms.min),this.boundingBox.expandByPoint(Ms.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 ba);let t=this.attributes.position,r=this.morphAttributes.position;if(t&&t.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new fe,1/0);return}if(t){let i=this.boundingSphere.center;if(Ms.setFromBufferAttribute(t),r)for(let a=0,o=r.length;a<o;a++){let s=r[a];iv.setFromBufferAttribute(s),this.morphTargetsRelative?(Fa.addVectors(Ms.min,iv.min),Ms.expandByPoint(Fa),Fa.addVectors(Ms.max,iv.max),Ms.expandByPoint(Fa)):(Ms.expandByPoint(iv.min),Ms.expandByPoint(iv.max))}Ms.getCenter(i);let n=0;for(let a=0,o=t.count;a<o;a++)Fa.fromBufferAttribute(t,a),n=Math.max(n,i.distanceToSquared(Fa));if(r)for(let a=0,o=r.length;a<o;a++){let s=r[a],l=this.morphTargetsRelative;for(let u=0,c=s.count;u<c;u++)Fa.fromBufferAttribute(s,u),l&&(vm.fromBufferAttribute(t,u),Fa.add(vm)),n=Math.max(n,i.distanceToSquared(Fa))}this.boundingSphere.radius=Math.sqrt(n),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,r=this.attributes;if(t===null||r.position===void 0||r.normal===void 0||r.uv===void 0){console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}let i=r.position,n=r.normal,a=r.uv;this.hasAttribute("tangent")===!1&&this.setAttribute("tangent",new qr(new Float32Array(4*i.count),4));let o=this.getAttribute("tangent"),s=[],l=[];for(let D=0;D<i.count;D++)s[D]=new fe,l[D]=new fe;let u=new fe,c=new fe,h=new fe,d=new vt,p=new vt,f=new vt,m=new fe,g=new fe;function v(D,T,P){u.fromBufferAttribute(i,D),c.fromBufferAttribute(i,T),h.fromBufferAttribute(i,P),d.fromBufferAttribute(a,D),p.fromBufferAttribute(a,T),f.fromBufferAttribute(a,P),c.sub(u),h.sub(u),p.sub(d),f.sub(d);let k=1/(p.x*f.y-f.x*p.y);isFinite(k)&&(m.copy(c).multiplyScalar(f.y).addScaledVector(h,-p.y).multiplyScalar(k),g.copy(h).multiplyScalar(p.x).addScaledVector(c,-f.x).multiplyScalar(k),s[D].add(m),s[T].add(m),s[P].add(m),l[D].add(g),l[T].add(g),l[P].add(g))}let _=this.groups;_.length===0&&(_=[{start:0,count:t.count}]);for(let D=0,T=_.length;D<T;++D){let P=_[D],k=P.start,R=P.count;for(let F=k,B=k+R;F<B;F+=3)v(t.getX(F+0),t.getX(F+1),t.getX(F+2))}let x=new fe,b=new fe,E=new fe,M=new fe;function S(D){E.fromBufferAttribute(n,D),M.copy(E);let T=s[D];x.copy(T),x.sub(E.multiplyScalar(E.dot(T))).normalize(),b.crossVectors(M,T);let P=b.dot(l[D])<0?-1:1;o.setXYZW(D,x.x,x.y,x.z,P)}for(let D=0,T=_.length;D<T;++D){let P=_[D],k=P.start,R=P.count;for(let F=k,B=k+R;F<B;F+=3)S(t.getX(F+0)),S(t.getX(F+1)),S(t.getX(F+2))}}computeVertexNormals(){let t=this.index,r=this.getAttribute("position");if(r!==void 0){let i=this.getAttribute("normal");if(i===void 0)i=new qr(new Float32Array(r.count*3),3),this.setAttribute("normal",i);else for(let d=0,p=i.count;d<p;d++)i.setXYZ(d,0,0,0);let n=new fe,a=new fe,o=new fe,s=new fe,l=new fe,u=new fe,c=new fe,h=new fe;if(t)for(let d=0,p=t.count;d<p;d+=3){let f=t.getX(d+0),m=t.getX(d+1),g=t.getX(d+2);n.fromBufferAttribute(r,f),a.fromBufferAttribute(r,m),o.fromBufferAttribute(r,g),c.subVectors(o,a),h.subVectors(n,a),c.cross(h),s.fromBufferAttribute(i,f),l.fromBufferAttribute(i,m),u.fromBufferAttribute(i,g),s.add(c),l.add(c),u.add(c),i.setXYZ(f,s.x,s.y,s.z),i.setXYZ(m,l.x,l.y,l.z),i.setXYZ(g,u.x,u.y,u.z)}else for(let d=0,p=r.count;d<p;d+=3)n.fromBufferAttribute(r,d+0),a.fromBufferAttribute(r,d+1),o.fromBufferAttribute(r,d+2),c.subVectors(o,a),h.subVectors(n,a),c.cross(h),i.setXYZ(d+0,c.x,c.y,c.z),i.setXYZ(d+1,c.x,c.y,c.z),i.setXYZ(d+2,c.x,c.y,c.z);this.normalizeNormals(),i.needsUpdate=!0}}normalizeNormals(){let t=this.attributes.normal;for(let r=0,i=t.count;r<i;r++)Fa.fromBufferAttribute(t,r),Fa.normalize(),t.setXYZ(r,Fa.x,Fa.y,Fa.z)}toNonIndexed(){function t(s,l){let u=s.array,c=s.itemSize,h=s.normalized,d=new u.constructor(l.length*c),p=0,f=0;for(let m=0,g=l.length;m<g;m++){s.isInterleavedBufferAttribute?p=l[m]*s.data.stride+s.offset:p=l[m]*c;for(let v=0;v<c;v++)d[f++]=u[p++]}return new qr(d,c,h)}if(this.index===null)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;let r=new gV,i=this.index.array,n=this.attributes;for(let s in n){let l=n[s],u=t(l,i);r.setAttribute(s,u)}let a=this.morphAttributes;for(let s in a){let l=[],u=a[s];for(let c=0,h=u.length;c<h;c++){let d=u[c],p=t(d,i);l.push(p)}r.morphAttributes[s]=l}r.morphTargetsRelative=this.morphTargetsRelative;let o=this.groups;for(let s=0,l=o.length;s<l;s++){let u=o[s];r.addGroup(u.start,u.count,u.materialIndex)}return r}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 l=this.parameters;for(let u in l)l[u]!==void 0&&(t[u]=l[u]);return t}t.data={attributes:{}};let r=this.index;r!==null&&(t.data.index={type:r.array.constructor.name,array:Array.prototype.slice.call(r.array)});let i=this.attributes;for(let l in i){let u=i[l];t.data.attributes[l]=u.toJSON(t.data)}let n={},a=!1;for(let l in this.morphAttributes){let u=this.morphAttributes[l],c=[];for(let h=0,d=u.length;h<d;h++){let p=u[h];c.push(p.toJSON(t.data))}c.length>0&&(n[l]=c,a=!0)}a&&(t.data.morphAttributes=n,t.data.morphTargetsRelative=this.morphTargetsRelative);let o=this.groups;o.length>0&&(t.data.groups=JSON.parse(JSON.stringify(o)));let s=this.boundingSphere;return s!==null&&(t.data.boundingSphere={center:s.center.toArray(),radius:s.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 r={};this.name=t.name;let i=t.index;i!==null&&this.setIndex(i.clone(r));let n=t.attributes;for(let u in n){let c=n[u];this.setAttribute(u,c.clone(r))}let a=t.morphAttributes;for(let u in a){let c=[],h=a[u];for(let d=0,p=h.length;d<p;d++)c.push(h[d].clone(r));this.morphAttributes[u]=c}this.morphTargetsRelative=t.morphTargetsRelative;let o=t.groups;for(let u=0,c=o.length;u<c;u++){let h=o[u];this.addGroup(h.start,h.count,h.materialIndex)}let s=t.boundingBox;s!==null&&(this.boundingBox=s.clone());let l=t.boundingSphere;return l!==null&&(this.boundingSphere=l.clone()),this.drawRange.start=t.drawRange.start,this.drawRange.count=t.drawRange.count,this.userData=t.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}},G9=new er,Kp=new bv,Tw=new ba,V9=new fe,Pw=new fe,Dw=new fe,kw=new fe,e3=new fe,Rw=new fe,Y9=new fe,Fw=new fe,Sr=class extends mi{constructor(e=new xn,t=new Fn){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),e.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),e.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}updateMorphTargets(){let e=this.geometry.morphAttributes,t=Object.keys(e);if(t.length>0){let r=e[t[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let i=0,n=r.length;i<n;i++){let a=r[i].name||String(i);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=i}}}}getVertexPosition(e,t){let r=this.geometry,i=r.attributes.position,n=r.morphAttributes.position,a=r.morphTargetsRelative;t.fromBufferAttribute(i,e);let o=this.morphTargetInfluences;if(n&&o){Rw.set(0,0,0);for(let s=0,l=n.length;s<l;s++){let u=o[s],c=n[s];u!==0&&(e3.fromBufferAttribute(c,e),a?Rw.addScaledVector(e3,u):Rw.addScaledVector(e3.sub(t),u))}t.add(Rw)}return t}raycast(e,t){let r=this.geometry,i=this.material,n=this.matrixWorld;i!==void 0&&(r.boundingSphere===null&&r.computeBoundingSphere(),Tw.copy(r.boundingSphere),Tw.applyMatrix4(n),Kp.copy(e.ray).recast(e.near),!(Tw.containsPoint(Kp.origin)===!1&&(Kp.intersectSphere(Tw,V9)===null||Kp.origin.distanceToSquared(V9)>bs(e.far-e.near,2)))&&(G9.copy(n).invert(),Kp.copy(e.ray).applyMatrix4(G9),!(r.boundingBox!==null&&Kp.intersectsBox(r.boundingBox)===!1)&&this._computeIntersections(e,t,Kp)))}_computeIntersections(e,t,r){let i,n=this.geometry,a=this.material,o=n.index,s=n.attributes.position,l=n.attributes.uv,u=n.attributes.uv1,c=n.attributes.normal,h=n.groups,d=n.drawRange;if(o!==null)if(Array.isArray(a))for(let p=0,f=h.length;p<f;p++){let m=h[p],g=a[m.materialIndex],v=Math.max(m.start,d.start),_=Math.min(o.count,Math.min(m.start+m.count,d.start+d.count));for(let x=v,b=_;x<b;x+=3){let E=o.getX(x),M=o.getX(x+1),S=o.getX(x+2);i=zw(this,g,e,r,l,u,c,E,M,S),i&&(i.faceIndex=Math.floor(x/3),i.face.materialIndex=m.materialIndex,t.push(i))}}else{let p=Math.max(0,d.start),f=Math.min(o.count,d.start+d.count);for(let m=p,g=f;m<g;m+=3){let v=o.getX(m),_=o.getX(m+1),x=o.getX(m+2);i=zw(this,a,e,r,l,u,c,v,_,x),i&&(i.faceIndex=Math.floor(m/3),t.push(i))}}else if(s!==void 0)if(Array.isArray(a))for(let p=0,f=h.length;p<f;p++){let m=h[p],g=a[m.materialIndex],v=Math.max(m.start,d.start),_=Math.min(s.count,Math.min(m.start+m.count,d.start+d.count));for(let x=v,b=_;x<b;x+=3){let E=x,M=x+1,S=x+2;i=zw(this,g,e,r,l,u,c,E,M,S),i&&(i.faceIndex=Math.floor(x/3),i.face.materialIndex=m.materialIndex,t.push(i))}}else{let p=Math.max(0,d.start),f=Math.min(s.count,d.start+d.count);for(let m=p,g=f;m<g;m+=3){let v=m,_=m+1,x=m+2;i=zw(this,a,e,r,l,u,c,v,_,x),i&&(i.faceIndex=Math.floor(m/3),t.push(i))}}}};th=class yV extends xn{constructor(t=1,r=1,i=1,n=1,a=1,o=1){super(),this.type="BoxGeometry",this.parameters={width:t,height:r,depth:i,widthSegments:n,heightSegments:a,depthSegments:o};let s=this;n=Math.floor(n),a=Math.floor(a),o=Math.floor(o);let l=[],u=[],c=[],h=[],d=0,p=0;f("z","y","x",-1,-1,i,r,t,o,a,0),f("z","y","x",1,-1,i,r,-t,o,a,1),f("x","z","y",1,1,t,i,r,n,o,2),f("x","z","y",1,-1,t,i,-r,n,o,3),f("x","y","z",1,-1,t,r,i,n,a,4),f("x","y","z",-1,-1,t,r,-i,n,a,5),this.setIndex(l),this.setAttribute("position",new nn(u,3)),this.setAttribute("normal",new nn(c,3)),this.setAttribute("uv",new nn(h,2));function f(m,g,v,_,x,b,E,M,S,D,T){let P=b/S,k=E/D,R=b/2,F=E/2,B=M/2,z=S+1,O=D+1,j=0,Y=0,Z=new fe;for(let ne=0;ne<O;ne++){let ie=ne*k-F;for(let le=0;le<z;le++){let X=le*P-R;Z[m]=X*_,Z[g]=ie*x,Z[v]=B,u.push(Z.x,Z.y,Z.z),Z[m]=0,Z[g]=0,Z[v]=M>0?1:-1,c.push(Z.x,Z.y,Z.z),h.push(le/S),h.push(1-ne/D),j+=1}}for(let ne=0;ne<D;ne++)for(let ie=0;ie<S;ie++){let le=d+ie+z*ne,X=d+ie+z*(ne+1),ce=d+(ie+1)+z*(ne+1),ge=d+(ie+1)+z*ne;l.push(le,X,ge),l.push(X,ce,ge),Y+=6}s.addGroup(p,Y,T),p+=Y,d+=j}}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new yV(t.width,t.height,t.depth,t.widthSegments,t.heightSegments,t.depthSegments)}};_k={clone:Qm,merge:To},vfe=\`void main() {
|
|
234
|
+
\`+Y)}else R!==""?console.warn("THREE.WebGLProgram: Program Info Log:",R):(F===""||B==="")&&(O=!1);O&&(k.diagnostics={runnable:z,programLog:R,vertexShader:{log:F,prefix:g},fragmentShader:{log:B,prefix:v}})}n.deleteShader(E),n.deleteShader(M),D=new cE(n,m),T=D0e(n,m)}let D;this.getUniforms=function(){return D===void 0&&S(this),D};let T;this.getAttributes=function(){return T===void 0&&S(this),T};let P=r.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return P===!1&&(P=n.getProgramParameter(m,w0e)),P},this.destroy=function(){i.releaseStatesOfProgram(this),n.deleteProgram(m),this.program=void 0},this.type=r.shaderType,this.name=r.shaderName,this.id=E0e++,this.cacheKey=t,this.usedTimes=1,this.program=m,this.vertexShader=E,this.fragmentShader=M,this}function W0e(e,t,r,i,n,a,o){let s=new xk,l=new Y0e,u=new Set,c=[],h=n.logarithmicDepthBuffer,d=n.vertexTextures,p=n.precision,f={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 m(T){return u.add(T),T===0?"uv":"uv".concat(T)}function g(T,P,k,R,F){let B=R.fog,z=F.geometry,O=T.isMeshStandardMaterial?R.environment:null,j=(T.isMeshStandardMaterial?r:t).get(T.envMap||O),Y=j&&j.mapping===yE?j.image.height:null,Z=f[T.type];T.precision!==null&&(p=n.getMaxPrecision(T.precision),p!==T.precision&&console.warn("THREE.WebGLProgram.getParameters:",T.precision,"not supported, using",p,"instead."));let ne=z.morphAttributes.position||z.morphAttributes.normal||z.morphAttributes.color,ie=ne!==void 0?ne.length:0,le=0;z.morphAttributes.position!==void 0&&(le=1),z.morphAttributes.normal!==void 0&&(le=2),z.morphAttributes.color!==void 0&&(le=3);let X,ce,ge,be;if(Z){let Yt=Bu[Z];X=Yt.vertexShader,ce=Yt.fragmentShader}else X=T.vertexShader,ce=T.fragmentShader,l.update(T),ge=l.getVertexShaderID(T),be=l.getFragmentShaderID(T);let _e=e.getRenderTarget(),ke=e.state.buffers.depth.getReversed(),Ye=F.isInstancedMesh===!0,We=F.isBatchedMesh===!0,Me=!!T.map,Ce=!!T.matcap,oe=!!j,it=!!T.aoMap,Oe=!!T.lightMap,Ke=!!T.bumpMap,Le=!!T.normalMap,Ze=!!T.displacementMap,ut=!!T.emissiveMap,et=!!T.metalnessMap,te=!!T.roughnessMap,K=T.anisotropy>0,ve=T.clearcoat>0,je=T.dispersion>0,Ne=T.iridescence>0,Ue=T.sheen>0,ft=T.transmission>0,ot=K&&!!T.anisotropyMap,Ae=ve&&!!T.clearcoatMap,Q=ve&&!!T.clearcoatNormalMap,G=ve&&!!T.clearcoatRoughnessMap,W=Ne&&!!T.iridescenceMap,re=Ne&&!!T.iridescenceThicknessMap,$=Ue&&!!T.sheenColorMap,me=Ue&&!!T.sheenRoughnessMap,ye=!!T.specularMap,Be=!!T.specularColorMap,Ge=!!T.specularIntensityMap,ue=ft&&!!T.transmissionMap,pe=ft&&!!T.thicknessMap,we=!!T.gradientMap,Ie=!!T.alphaMap,nt=T.alphaTest>0,lt=!!T.alphaHash,$e=!!T.extensions,He=ld;T.toneMapped&&(_e===null||_e.isXRRenderTarget===!0)&&(He=e.toneMapping);let wt={shaderID:Z,shaderType:T.type,shaderName:T.name,vertexShader:X,fragmentShader:ce,defines:T.defines,customVertexShaderID:ge,customFragmentShaderID:be,isRawShaderMaterial:T.isRawShaderMaterial===!0,glslVersion:T.glslVersion,precision:p,batching:We,batchingColor:We&&F._colorsTexture!==null,instancing:Ye,instancingColor:Ye&&F.instanceColor!==null,instancingMorph:Ye&&F.morphTexture!==null,supportsVertexTextures:d,outputColorSpace:_e===null?e.outputColorSpace:_e.isXRRenderTarget===!0?_e.texture.colorSpace:Na,alphaToCoverage:!!T.alphaToCoverage,map:Me,matcap:Ce,envMap:oe,envMapMode:oe&&j.mapping,envMapCubeUVHeight:Y,aoMap:it,lightMap:Oe,bumpMap:Ke,normalMap:Le,displacementMap:d&&Ze,emissiveMap:ut,normalMapObjectSpace:Le&&T.normalMapType===Ipe,normalMapTangentSpace:Le&&T.normalMapType===yk,metalnessMap:et,roughnessMap:te,anisotropy:K,anisotropyMap:ot,clearcoat:ve,clearcoatMap:Ae,clearcoatNormalMap:Q,clearcoatRoughnessMap:G,dispersion:je,iridescence:Ne,iridescenceMap:W,iridescenceThicknessMap:re,sheen:Ue,sheenColorMap:$,sheenRoughnessMap:me,specularMap:ye,specularColorMap:Be,specularIntensityMap:Ge,transmission:ft,transmissionMap:ue,thicknessMap:pe,gradientMap:we,opaque:T.transparent===!1&&T.blending===Tm&&T.alphaToCoverage===!1,alphaMap:Ie,alphaTest:nt,alphaHash:lt,combine:T.combine,mapUv:Me&&m(T.map.channel),aoMapUv:it&&m(T.aoMap.channel),lightMapUv:Oe&&m(T.lightMap.channel),bumpMapUv:Ke&&m(T.bumpMap.channel),normalMapUv:Le&&m(T.normalMap.channel),displacementMapUv:Ze&&m(T.displacementMap.channel),emissiveMapUv:ut&&m(T.emissiveMap.channel),metalnessMapUv:et&&m(T.metalnessMap.channel),roughnessMapUv:te&&m(T.roughnessMap.channel),anisotropyMapUv:ot&&m(T.anisotropyMap.channel),clearcoatMapUv:Ae&&m(T.clearcoatMap.channel),clearcoatNormalMapUv:Q&&m(T.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:G&&m(T.clearcoatRoughnessMap.channel),iridescenceMapUv:W&&m(T.iridescenceMap.channel),iridescenceThicknessMapUv:re&&m(T.iridescenceThicknessMap.channel),sheenColorMapUv:$&&m(T.sheenColorMap.channel),sheenRoughnessMapUv:me&&m(T.sheenRoughnessMap.channel),specularMapUv:ye&&m(T.specularMap.channel),specularColorMapUv:Be&&m(T.specularColorMap.channel),specularIntensityMapUv:Ge&&m(T.specularIntensityMap.channel),transmissionMapUv:ue&&m(T.transmissionMap.channel),thicknessMapUv:pe&&m(T.thicknessMap.channel),alphaMapUv:Ie&&m(T.alphaMap.channel),vertexTangents:!!z.attributes.tangent&&(Le||K),vertexColors:T.vertexColors,vertexAlphas:T.vertexColors===!0&&!!z.attributes.color&&z.attributes.color.itemSize===4,pointsUvs:F.isPoints===!0&&!!z.attributes.uv&&(Me||Ie),fog:!!B,useFog:T.fog===!0,fogExp2:!!B&&B.isFogExp2,flatShading:T.flatShading===!0,sizeAttenuation:T.sizeAttenuation===!0,logarithmicDepthBuffer:h,reverseDepthBuffer:ke,skinning:F.isSkinnedMesh===!0,morphTargets:z.morphAttributes.position!==void 0,morphNormals:z.morphAttributes.normal!==void 0,morphColors:z.morphAttributes.color!==void 0,morphTargetsCount:ie,morphTextureStride:le,numDirLights:P.directional.length,numPointLights:P.point.length,numSpotLights:P.spot.length,numSpotLightMaps:P.spotLightMap.length,numRectAreaLights:P.rectArea.length,numHemiLights:P.hemi.length,numDirLightShadows:P.directionalShadowMap.length,numPointLightShadows:P.pointShadowMap.length,numSpotLightShadows:P.spotShadowMap.length,numSpotLightShadowsWithMaps:P.numSpotLightShadowsWithMaps,numLightProbes:P.numLightProbes,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,dithering:T.dithering,shadowMapEnabled:e.shadowMap.enabled&&k.length>0,shadowMapType:e.shadowMap.type,toneMapping:He,decodeVideoTexture:Me&&T.map.isVideoTexture===!0&&Ai.getTransfer(T.map.colorSpace)===rn,decodeVideoTextureEmissive:ut&&T.emissiveMap.isVideoTexture===!0&&Ai.getTransfer(T.emissiveMap.colorSpace)===rn,premultipliedAlpha:T.premultipliedAlpha,doubleSided:T.side===kn,flipSided:T.side===La,useDepthPacking:T.depthPacking>=0,depthPacking:T.depthPacking||0,index0AttributeName:T.index0AttributeName,extensionClipCullDistance:$e&&T.extensions.clipCullDistance===!0&&i.has("WEBGL_clip_cull_distance"),extensionMultiDraw:($e&&T.extensions.multiDraw===!0||We)&&i.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:i.has("KHR_parallel_shader_compile"),customProgramCacheKey:T.customProgramCacheKey()};return wt.vertexUv1s=u.has(1),wt.vertexUv2s=u.has(2),wt.vertexUv3s=u.has(3),u.clear(),wt}function v(T){let P=[];if(T.shaderID?P.push(T.shaderID):(P.push(T.customVertexShaderID),P.push(T.customFragmentShaderID)),T.defines!==void 0)for(let k in T.defines)P.push(k),P.push(T.defines[k]);return T.isRawShaderMaterial===!1&&(_(P,T),x(P,T),P.push(e.outputColorSpace)),P.push(T.customProgramCacheKey),P.join()}function _(T,P){T.push(P.precision),T.push(P.outputColorSpace),T.push(P.envMapMode),T.push(P.envMapCubeUVHeight),T.push(P.mapUv),T.push(P.alphaMapUv),T.push(P.lightMapUv),T.push(P.aoMapUv),T.push(P.bumpMapUv),T.push(P.normalMapUv),T.push(P.displacementMapUv),T.push(P.emissiveMapUv),T.push(P.metalnessMapUv),T.push(P.roughnessMapUv),T.push(P.anisotropyMapUv),T.push(P.clearcoatMapUv),T.push(P.clearcoatNormalMapUv),T.push(P.clearcoatRoughnessMapUv),T.push(P.iridescenceMapUv),T.push(P.iridescenceThicknessMapUv),T.push(P.sheenColorMapUv),T.push(P.sheenRoughnessMapUv),T.push(P.specularMapUv),T.push(P.specularColorMapUv),T.push(P.specularIntensityMapUv),T.push(P.transmissionMapUv),T.push(P.thicknessMapUv),T.push(P.combine),T.push(P.fogExp2),T.push(P.sizeAttenuation),T.push(P.morphTargetsCount),T.push(P.morphAttributeCount),T.push(P.numDirLights),T.push(P.numPointLights),T.push(P.numSpotLights),T.push(P.numSpotLightMaps),T.push(P.numHemiLights),T.push(P.numRectAreaLights),T.push(P.numDirLightShadows),T.push(P.numPointLightShadows),T.push(P.numSpotLightShadows),T.push(P.numSpotLightShadowsWithMaps),T.push(P.numLightProbes),T.push(P.shadowMapType),T.push(P.toneMapping),T.push(P.numClippingPlanes),T.push(P.numClipIntersection),T.push(P.depthPacking)}function x(T,P){s.disableAll(),P.supportsVertexTextures&&s.enable(0),P.instancing&&s.enable(1),P.instancingColor&&s.enable(2),P.instancingMorph&&s.enable(3),P.matcap&&s.enable(4),P.envMap&&s.enable(5),P.normalMapObjectSpace&&s.enable(6),P.normalMapTangentSpace&&s.enable(7),P.clearcoat&&s.enable(8),P.iridescence&&s.enable(9),P.alphaTest&&s.enable(10),P.vertexColors&&s.enable(11),P.vertexAlphas&&s.enable(12),P.vertexUv1s&&s.enable(13),P.vertexUv2s&&s.enable(14),P.vertexUv3s&&s.enable(15),P.vertexTangents&&s.enable(16),P.anisotropy&&s.enable(17),P.alphaHash&&s.enable(18),P.batching&&s.enable(19),P.dispersion&&s.enable(20),P.batchingColor&&s.enable(21),T.push(s.mask),s.disableAll(),P.fog&&s.enable(0),P.useFog&&s.enable(1),P.flatShading&&s.enable(2),P.logarithmicDepthBuffer&&s.enable(3),P.reverseDepthBuffer&&s.enable(4),P.skinning&&s.enable(5),P.morphTargets&&s.enable(6),P.morphNormals&&s.enable(7),P.morphColors&&s.enable(8),P.premultipliedAlpha&&s.enable(9),P.shadowMapEnabled&&s.enable(10),P.doubleSided&&s.enable(11),P.flipSided&&s.enable(12),P.useDepthPacking&&s.enable(13),P.dithering&&s.enable(14),P.transmission&&s.enable(15),P.sheen&&s.enable(16),P.opaque&&s.enable(17),P.pointsUvs&&s.enable(18),P.decodeVideoTexture&&s.enable(19),P.decodeVideoTextureEmissive&&s.enable(20),P.alphaToCoverage&&s.enable(21),T.push(s.mask)}function b(T){let P=f[T.type],k;if(P){let R=Bu[P];k=_k.clone(R.uniforms)}else k=T.uniforms;return k}function E(T,P){let k;for(let R=0,F=c.length;R<F;R++){let B=c[R];if(B.cacheKey===P){k=B,++k.usedTimes;break}}return k===void 0&&(k=new G0e(e,P,T,a),c.push(k)),k}function M(T){if(--T.usedTimes===0){let P=c.indexOf(T);c[P]=c[c.length-1],c.pop(),T.destroy()}}function S(T){l.remove(T)}function D(){l.dispose()}return{getParameters:g,getProgramCacheKey:v,getUniforms:b,acquireProgram:E,releaseProgram:M,releaseShaderCache:S,programs:c,dispose:D}}function Z0e(){let e=new WeakMap;function t(o){return e.has(o)}function r(o){let s=e.get(o);return s===void 0&&(s={},e.set(o,s)),s}function i(o){e.delete(o)}function n(o,s,l){e.get(o)[s]=l}function a(){e=new WeakMap}return{has:t,get:r,remove:i,update:n,dispose:a}}function X0e(e,t){return e.groupOrder!==t.groupOrder?e.groupOrder-t.groupOrder:e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.material.id!==t.material.id?e.material.id-t.material.id:e.z!==t.z?e.z-t.z:e.id-t.id}function GG(e,t){return e.groupOrder!==t.groupOrder?e.groupOrder-t.groupOrder:e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.z!==t.z?t.z-e.z:e.id-t.id}function VG(){let e=[],t=0,r=[],i=[],n=[];function a(){t=0,r.length=0,i.length=0,n.length=0}function o(h,d,p,f,m,g){let v=e[t];return v===void 0?(v={id:h.id,object:h,geometry:d,material:p,groupOrder:f,renderOrder:h.renderOrder,z:m,group:g},e[t]=v):(v.id=h.id,v.object=h,v.geometry=d,v.material=p,v.groupOrder=f,v.renderOrder=h.renderOrder,v.z=m,v.group=g),t++,v}function s(h,d,p,f,m,g){let v=o(h,d,p,f,m,g);p.transmission>0?i.push(v):p.transparent===!0?n.push(v):r.push(v)}function l(h,d,p,f,m,g){let v=o(h,d,p,f,m,g);p.transmission>0?i.unshift(v):p.transparent===!0?n.unshift(v):r.unshift(v)}function u(h,d){r.length>1&&r.sort(h||X0e),i.length>1&&i.sort(d||GG),n.length>1&&n.sort(d||GG)}function c(){for(let h=t,d=e.length;h<d;h++){let p=e[h];if(p.id===null)break;p.id=null,p.object=null,p.geometry=null,p.material=null,p.group=null}}return{opaque:r,transmissive:i,transparent:n,init:a,push:s,unshift:l,finish:c,sort:u}}function J0e(){let e=new WeakMap;function t(i,n){let a=e.get(i),o;return a===void 0?(o=new VG,e.set(i,[o])):n>=a.length?(o=new VG,a.push(o)):o=a[n],o}function r(){e=new WeakMap}return{get:t,dispose:r}}function K0e(){let e={};return{get:function(t){if(e[t.id]!==void 0)return e[t.id];let r;switch(t.type){case"DirectionalLight":r={direction:new fe,color:new Dt};break;case"SpotLight":r={position:new fe,direction:new fe,color:new Dt,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":r={position:new fe,color:new Dt,distance:0,decay:0};break;case"HemisphereLight":r={direction:new fe,skyColor:new Dt,groundColor:new Dt};break;case"RectAreaLight":r={color:new Dt,position:new fe,halfWidth:new fe,halfHeight:new fe};break}return e[t.id]=r,r}}}function q0e(){let e={};return{get:function(t){if(e[t.id]!==void 0)return e[t.id];let r;switch(t.type){case"DirectionalLight":r={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new vt};break;case"SpotLight":r={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new vt};break;case"PointLight":r={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new vt,shadowCameraNear:1,shadowCameraFar:1e3};break}return e[t.id]=r,r}}}function eve(e,t){return(t.castShadow?2:0)-(e.castShadow?2:0)+(t.map?1:0)-(e.map?1:0)}function tve(e){let t=new K0e,r=q0e(),i={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 u=0;u<9;u++)i.probe.push(new fe);let n=new fe,a=new er,o=new er;function s(u){let c=0,h=0,d=0;for(let T=0;T<9;T++)i.probe[T].set(0,0,0);let p=0,f=0,m=0,g=0,v=0,_=0,x=0,b=0,E=0,M=0,S=0;u.sort(eve);for(let T=0,P=u.length;T<P;T++){let k=u[T],R=k.color,F=k.intensity,B=k.distance,z=k.shadow&&k.shadow.map?k.shadow.map.texture:null;if(k.isAmbientLight)c+=R.r*F,h+=R.g*F,d+=R.b*F;else if(k.isLightProbe){for(let O=0;O<9;O++)i.probe[O].addScaledVector(k.sh.coefficients[O],F);S++}else if(k.isDirectionalLight){let O=t.get(k);if(O.color.copy(k.color).multiplyScalar(k.intensity),k.castShadow){let j=k.shadow,Y=r.get(k);Y.shadowIntensity=j.intensity,Y.shadowBias=j.bias,Y.shadowNormalBias=j.normalBias,Y.shadowRadius=j.radius,Y.shadowMapSize=j.mapSize,i.directionalShadow[p]=Y,i.directionalShadowMap[p]=z,i.directionalShadowMatrix[p]=k.shadow.matrix,_++}i.directional[p]=O,p++}else if(k.isSpotLight){let O=t.get(k);O.position.setFromMatrixPosition(k.matrixWorld),O.color.copy(R).multiplyScalar(F),O.distance=B,O.coneCos=Math.cos(k.angle),O.penumbraCos=Math.cos(k.angle*(1-k.penumbra)),O.decay=k.decay,i.spot[m]=O;let j=k.shadow;if(k.map&&(i.spotLightMap[E]=k.map,E++,j.updateMatrices(k),k.castShadow&&M++),i.spotLightMatrix[m]=j.matrix,k.castShadow){let Y=r.get(k);Y.shadowIntensity=j.intensity,Y.shadowBias=j.bias,Y.shadowNormalBias=j.normalBias,Y.shadowRadius=j.radius,Y.shadowMapSize=j.mapSize,i.spotShadow[m]=Y,i.spotShadowMap[m]=z,b++}m++}else if(k.isRectAreaLight){let O=t.get(k);O.color.copy(R).multiplyScalar(F),O.halfWidth.set(k.width*.5,0,0),O.halfHeight.set(0,k.height*.5,0),i.rectArea[g]=O,g++}else if(k.isPointLight){let O=t.get(k);if(O.color.copy(k.color).multiplyScalar(k.intensity),O.distance=k.distance,O.decay=k.decay,k.castShadow){let j=k.shadow,Y=r.get(k);Y.shadowIntensity=j.intensity,Y.shadowBias=j.bias,Y.shadowNormalBias=j.normalBias,Y.shadowRadius=j.radius,Y.shadowMapSize=j.mapSize,Y.shadowCameraNear=j.camera.near,Y.shadowCameraFar=j.camera.far,i.pointShadow[f]=Y,i.pointShadowMap[f]=z,i.pointShadowMatrix[f]=k.shadow.matrix,x++}i.point[f]=O,f++}else if(k.isHemisphereLight){let O=t.get(k);O.skyColor.copy(k.color).multiplyScalar(F),O.groundColor.copy(k.groundColor).multiplyScalar(F),i.hemi[v]=O,v++}}g>0&&(e.has("OES_texture_float_linear")===!0?(i.rectAreaLTC1=Kt.LTC_FLOAT_1,i.rectAreaLTC2=Kt.LTC_FLOAT_2):(i.rectAreaLTC1=Kt.LTC_HALF_1,i.rectAreaLTC2=Kt.LTC_HALF_2)),i.ambient[0]=c,i.ambient[1]=h,i.ambient[2]=d;let D=i.hash;(D.directionalLength!==p||D.pointLength!==f||D.spotLength!==m||D.rectAreaLength!==g||D.hemiLength!==v||D.numDirectionalShadows!==_||D.numPointShadows!==x||D.numSpotShadows!==b||D.numSpotMaps!==E||D.numLightProbes!==S)&&(i.directional.length=p,i.spot.length=m,i.rectArea.length=g,i.point.length=f,i.hemi.length=v,i.directionalShadow.length=_,i.directionalShadowMap.length=_,i.pointShadow.length=x,i.pointShadowMap.length=x,i.spotShadow.length=b,i.spotShadowMap.length=b,i.directionalShadowMatrix.length=_,i.pointShadowMatrix.length=x,i.spotLightMatrix.length=b+E-M,i.spotLightMap.length=E,i.numSpotLightShadowsWithMaps=M,i.numLightProbes=S,D.directionalLength=p,D.pointLength=f,D.spotLength=m,D.rectAreaLength=g,D.hemiLength=v,D.numDirectionalShadows=_,D.numPointShadows=x,D.numSpotShadows=b,D.numSpotMaps=E,D.numLightProbes=S,i.version=$0e++)}function l(u,c){let h=0,d=0,p=0,f=0,m=0,g=c.matrixWorldInverse;for(let v=0,_=u.length;v<_;v++){let x=u[v];if(x.isDirectionalLight){let b=i.directional[h];b.direction.setFromMatrixPosition(x.matrixWorld),n.setFromMatrixPosition(x.target.matrixWorld),b.direction.sub(n),b.direction.transformDirection(g),h++}else if(x.isSpotLight){let b=i.spot[p];b.position.setFromMatrixPosition(x.matrixWorld),b.position.applyMatrix4(g),b.direction.setFromMatrixPosition(x.matrixWorld),n.setFromMatrixPosition(x.target.matrixWorld),b.direction.sub(n),b.direction.transformDirection(g),p++}else if(x.isRectAreaLight){let b=i.rectArea[f];b.position.setFromMatrixPosition(x.matrixWorld),b.position.applyMatrix4(g),o.identity(),a.copy(x.matrixWorld),a.premultiply(g),o.extractRotation(a),b.halfWidth.set(x.width*.5,0,0),b.halfHeight.set(0,x.height*.5,0),b.halfWidth.applyMatrix4(o),b.halfHeight.applyMatrix4(o),f++}else if(x.isPointLight){let b=i.point[d];b.position.setFromMatrixPosition(x.matrixWorld),b.position.applyMatrix4(g),d++}else if(x.isHemisphereLight){let b=i.hemi[m];b.direction.setFromMatrixPosition(x.matrixWorld),b.direction.transformDirection(g),m++}}}return{setup:s,setupView:l,state:i}}function YG(e){let t=new tve(e),r=[],i=[];function n(c){u.camera=c,r.length=0,i.length=0}function a(c){r.push(c)}function o(c){i.push(c)}function s(){t.setup(r)}function l(c){t.setupView(r,c)}let u={lightsArray:r,shadowsArray:i,camera:null,lights:t,transmissionRenderTarget:{}};return{init:n,state:u,setupLights:s,setupLightsView:l,pushLight:a,pushShadow:o}}function rve(e){let t=new WeakMap;function r(n,a=0){let o=t.get(n),s;return o===void 0?(s=new YG(e),t.set(n,[s])):a>=o.length?(s=new YG(e),o.push(s)):s=o[a],s}function i(){t=new WeakMap}return{get:r,dispose:i}}function ave(e,t,r){let i=new fd,n=new vt,a=new vt,o=new wi,s=new Mv({depthPacking:_v}),l=new Ck,u={},c=r.maxTextureSize,h={[mo]:La,[La]:mo,[kn]:kn},d=new go({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new vt},radius:{value:4}},vertexShader:ive,fragmentShader:nve}),p=d.clone();p.defines.HORIZONTAL_PASS=1;let f=new xn;f.setAttribute("position",new qr(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));let m=new Sr(f,d),g=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=HG;let v=this.type;this.render=function(M,S,D){if(g.enabled===!1||g.autoUpdate===!1&&g.needsUpdate===!1||M.length===0)return;let T=e.getRenderTarget(),P=e.getActiveCubeFace(),k=e.getActiveMipmapLevel(),R=e.state;R.setBlending(Du),R.buffers.color.setClear(1,1,1,1),R.buffers.depth.setTest(!0),R.setScissorTest(!1);let F=v!==Kc&&this.type===Kc,B=v===Kc&&this.type!==Kc;for(let z=0,O=M.length;z<O;z++){let j=M[z],Y=j.shadow;if(Y===void 0){console.warn("THREE.WebGLShadowMap:",j,"has no shadow.");continue}if(Y.autoUpdate===!1&&Y.needsUpdate===!1)continue;n.copy(Y.mapSize);let Z=Y.getFrameExtents();if(n.multiply(Z),a.copy(Y.mapSize),(n.x>c||n.y>c)&&(n.x>c&&(a.x=Math.floor(c/Z.x),n.x=a.x*Z.x,Y.mapSize.x=a.x),n.y>c&&(a.y=Math.floor(c/Z.y),n.y=a.y*Z.y,Y.mapSize.y=a.y)),Y.map===null||F===!0||B===!0){let ie=this.type!==Kc?{minFilter:Oa,magFilter:Oa}:{};Y.map!==null&&Y.map.dispose(),Y.map=new Ol(n.x,n.y,ie),Y.map.texture.name=j.name+".shadowMap",Y.camera.updateProjectionMatrix()}e.setRenderTarget(Y.map),e.clear();let ne=Y.getViewportCount();for(let ie=0;ie<ne;ie++){let le=Y.getViewport(ie);o.set(a.x*le.x,a.y*le.y,a.x*le.z,a.y*le.w),R.viewport(o),Y.updateMatrices(j,ie),i=Y.getFrustum(),b(S,D,Y.camera,j,this.type)}Y.isPointLightShadow!==!0&&this.type===Kc&&_(Y,D),Y.needsUpdate=!1}v=this.type,g.needsUpdate=!1,e.setRenderTarget(T,P,k)};function _(M,S){let D=t.update(m);d.defines.VSM_SAMPLES!==M.blurSamples&&(d.defines.VSM_SAMPLES=M.blurSamples,p.defines.VSM_SAMPLES=M.blurSamples,d.needsUpdate=!0,p.needsUpdate=!0),M.mapPass===null&&(M.mapPass=new Ol(n.x,n.y)),d.uniforms.shadow_pass.value=M.map.texture,d.uniforms.resolution.value=M.mapSize,d.uniforms.radius.value=M.radius,e.setRenderTarget(M.mapPass),e.clear(),e.renderBufferDirect(S,null,D,d,m,null),p.uniforms.shadow_pass.value=M.mapPass.texture,p.uniforms.resolution.value=M.mapSize,p.uniforms.radius.value=M.radius,e.setRenderTarget(M.map),e.clear(),e.renderBufferDirect(S,null,D,p,m,null)}function x(M,S,D,T){let P=null,k=D.isPointLight===!0?M.customDistanceMaterial:M.customDepthMaterial;if(k!==void 0)P=k;else if(P=D.isPointLight===!0?l:s,e.localClippingEnabled&&S.clipShadows===!0&&Array.isArray(S.clippingPlanes)&&S.clippingPlanes.length!==0||S.displacementMap&&S.displacementScale!==0||S.alphaMap&&S.alphaTest>0||S.map&&S.alphaTest>0){let R=P.uuid,F=S.uuid,B=u[R];B===void 0&&(B={},u[R]=B);let z=B[F];z===void 0&&(z=P.clone(),B[F]=z,S.addEventListener("dispose",E)),P=z}if(P.visible=S.visible,P.wireframe=S.wireframe,T===Kc?P.side=S.shadowSide!==null?S.shadowSide:S.side:P.side=S.shadowSide!==null?S.shadowSide:h[S.side],P.alphaMap=S.alphaMap,P.alphaTest=S.alphaTest,P.map=S.map,P.clipShadows=S.clipShadows,P.clippingPlanes=S.clippingPlanes,P.clipIntersection=S.clipIntersection,P.displacementMap=S.displacementMap,P.displacementScale=S.displacementScale,P.displacementBias=S.displacementBias,P.wireframeLinewidth=S.wireframeLinewidth,P.linewidth=S.linewidth,D.isPointLight===!0&&P.isMeshDistanceMaterial===!0){let R=e.properties.get(P);R.light=D}return P}function b(M,S,D,T,P){if(M.visible===!1)return;if(M.layers.test(S.layers)&&(M.isMesh||M.isLine||M.isPoints)&&(M.castShadow||M.receiveShadow&&P===Kc)&&(!M.frustumCulled||i.intersectsObject(M))){M.modelViewMatrix.multiplyMatrices(D.matrixWorldInverse,M.matrixWorld);let R=t.update(M),F=M.material;if(Array.isArray(F)){let B=R.groups;for(let z=0,O=B.length;z<O;z++){let j=B[z],Y=F[j.materialIndex];if(Y&&Y.visible){let Z=x(M,Y,T,P);M.onBeforeShadow(e,M,S,D,R,Z,j),e.renderBufferDirect(D,null,R,Z,M,j),M.onAfterShadow(e,M,S,D,R,Z,j)}}}else if(F.visible){let B=x(M,F,T,P);M.onBeforeShadow(e,M,S,D,R,B,null),e.renderBufferDirect(D,null,R,B,M,null),M.onAfterShadow(e,M,S,D,R,B,null)}}let k=M.children;for(let R=0,F=k.length;R<F;R++)b(k[R],S,D,T,P)}function E(M){M.target.removeEventListener("dispose",E);for(let S in u){let D=u[S],T=M.target.uuid;T in D&&(D[T].dispose(),delete D[T])}}}function sve(e,t){function r(){let ue=!1,pe=new wi,we=null,Ie=new wi(0,0,0,0);return{setMask:function(nt){we!==nt&&!ue&&(e.colorMask(nt,nt,nt,nt),we=nt)},setLocked:function(nt){ue=nt},setClear:function(nt,lt,$e,He,wt){wt===!0&&(nt*=He,lt*=He,$e*=He),pe.set(nt,lt,$e,He),Ie.equals(pe)===!1&&(e.clearColor(nt,lt,$e,He),Ie.copy(pe))},reset:function(){ue=!1,we=null,Ie.set(-1,0,0,0)}}}function i(){let ue=!1,pe=!1,we=null,Ie=null,nt=null;return{setReversed:function(lt){if(pe!==lt){let $e=t.get("EXT_clip_control");pe?$e.clipControlEXT($e.LOWER_LEFT_EXT,$e.ZERO_TO_ONE_EXT):$e.clipControlEXT($e.LOWER_LEFT_EXT,$e.NEGATIVE_ONE_TO_ONE_EXT);let He=nt;nt=null,this.setClear(He)}pe=lt},getReversed:function(){return pe},setTest:function(lt){lt?_e(e.DEPTH_TEST):ke(e.DEPTH_TEST)},setMask:function(lt){we!==lt&&!ue&&(e.depthMask(lt),we=lt)},setFunc:function(lt){if(pe&&(lt=ove[lt]),Ie!==lt){switch(lt){case E3:e.depthFunc(e.NEVER);break;case M3:e.depthFunc(e.ALWAYS);break;case S3:e.depthFunc(e.LESS);break;case Rm:e.depthFunc(e.LEQUAL);break;case I3:e.depthFunc(e.EQUAL);break;case C3:e.depthFunc(e.GEQUAL);break;case B3:e.depthFunc(e.GREATER);break;case T3:e.depthFunc(e.NOTEQUAL);break;default:e.depthFunc(e.LEQUAL)}Ie=lt}},setLocked:function(lt){ue=lt},setClear:function(lt){nt!==lt&&(pe&&(lt=1-lt),e.clearDepth(lt),nt=lt)},reset:function(){ue=!1,we=null,Ie=null,nt=null,pe=!1}}}function n(){let ue=!1,pe=null,we=null,Ie=null,nt=null,lt=null,$e=null,He=null,wt=null;return{setTest:function(Yt){ue||(Yt?_e(e.STENCIL_TEST):ke(e.STENCIL_TEST))},setMask:function(Yt){pe!==Yt&&!ue&&(e.stencilMask(Yt),pe=Yt)},setFunc:function(Yt,ur,Qt){(we!==Yt||Ie!==ur||nt!==Qt)&&(e.stencilFunc(Yt,ur,Qt),we=Yt,Ie=ur,nt=Qt)},setOp:function(Yt,ur,Qt){(lt!==Yt||$e!==ur||He!==Qt)&&(e.stencilOp(Yt,ur,Qt),lt=Yt,$e=ur,He=Qt)},setLocked:function(Yt){ue=Yt},setClear:function(Yt){wt!==Yt&&(e.clearStencil(Yt),wt=Yt)},reset:function(){ue=!1,pe=null,we=null,Ie=null,nt=null,lt=null,$e=null,He=null,wt=null}}}let a=new r,o=new i,s=new n,l=new WeakMap,u=new WeakMap,c={},h={},d=new WeakMap,p=[],f=null,m=!1,g=null,v=null,_=null,x=null,b=null,E=null,M=null,S=new Dt(0,0,0),D=0,T=!1,P=null,k=null,R=null,F=null,B=null,z=e.getParameter(e.MAX_COMBINED_TEXTURE_IMAGE_UNITS),O=!1,j=0,Y=e.getParameter(e.VERSION);Y.indexOf("WebGL")!==-1?(j=parseFloat(/^WebGL (\\d)/.exec(Y)[1]),O=j>=1):Y.indexOf("OpenGL ES")!==-1&&(j=parseFloat(/^OpenGL ES (\\d)/.exec(Y)[1]),O=j>=2);let Z=null,ne={},ie=e.getParameter(e.SCISSOR_BOX),le=e.getParameter(e.VIEWPORT),X=new wi().fromArray(ie),ce=new wi().fromArray(le);function ge(ue,pe,we,Ie){let nt=new Uint8Array(4),lt=e.createTexture();e.bindTexture(ue,lt),e.texParameteri(ue,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texParameteri(ue,e.TEXTURE_MAG_FILTER,e.NEAREST);for(let $e=0;$e<we;$e++)ue===e.TEXTURE_3D||ue===e.TEXTURE_2D_ARRAY?e.texImage3D(pe,0,e.RGBA,1,1,Ie,0,e.RGBA,e.UNSIGNED_BYTE,nt):e.texImage2D(pe+$e,0,e.RGBA,1,1,0,e.RGBA,e.UNSIGNED_BYTE,nt);return lt}let be={};be[e.TEXTURE_2D]=ge(e.TEXTURE_2D,e.TEXTURE_2D,1),be[e.TEXTURE_CUBE_MAP]=ge(e.TEXTURE_CUBE_MAP,e.TEXTURE_CUBE_MAP_POSITIVE_X,6),be[e.TEXTURE_2D_ARRAY]=ge(e.TEXTURE_2D_ARRAY,e.TEXTURE_2D_ARRAY,1,1),be[e.TEXTURE_3D]=ge(e.TEXTURE_3D,e.TEXTURE_3D,1,1),a.setClear(0,0,0,1),o.setClear(1),s.setClear(0),_e(e.DEPTH_TEST),o.setFunc(Rm),Ke(!1),Le(b9),_e(e.CULL_FACE),it(Du);function _e(ue){c[ue]!==!0&&(e.enable(ue),c[ue]=!0)}function ke(ue){c[ue]!==!1&&(e.disable(ue),c[ue]=!1)}function Ye(ue,pe){return h[ue]!==pe?(e.bindFramebuffer(ue,pe),h[ue]=pe,ue===e.DRAW_FRAMEBUFFER&&(h[e.FRAMEBUFFER]=pe),ue===e.FRAMEBUFFER&&(h[e.DRAW_FRAMEBUFFER]=pe),!0):!1}function We(ue,pe){let we=p,Ie=!1;if(ue){we=d.get(pe),we===void 0&&(we=[],d.set(pe,we));let nt=ue.textures;if(we.length!==nt.length||we[0]!==e.COLOR_ATTACHMENT0){for(let lt=0,$e=nt.length;lt<$e;lt++)we[lt]=e.COLOR_ATTACHMENT0+lt;we.length=nt.length,Ie=!0}}else we[0]!==e.BACK&&(we[0]=e.BACK,Ie=!0);Ie&&e.drawBuffers(we)}function Me(ue){return f!==ue?(e.useProgram(ue),f=ue,!0):!1}let Ce={[af]:e.FUNC_ADD,[qde]:e.FUNC_SUBTRACT,[$de]:e.FUNC_REVERSE_SUBTRACT};Ce[epe]=e.MIN,Ce[tpe]=e.MAX;let oe={[rpe]:e.ZERO,[ipe]:e.ONE,[npe]:e.SRC_COLOR,[b3]:e.SRC_ALPHA,[cpe]:e.SRC_ALPHA_SATURATE,[lpe]:e.DST_COLOR,[ope]:e.DST_ALPHA,[ape]:e.ONE_MINUS_SRC_COLOR,[w3]:e.ONE_MINUS_SRC_ALPHA,[upe]:e.ONE_MINUS_DST_COLOR,[spe]:e.ONE_MINUS_DST_ALPHA,[hpe]:e.CONSTANT_COLOR,[dpe]:e.ONE_MINUS_CONSTANT_COLOR,[ppe]:e.CONSTANT_ALPHA,[fpe]:e.ONE_MINUS_CONSTANT_ALPHA};function it(ue,pe,we,Ie,nt,lt,$e,He,wt,Yt){if(ue===Du){m===!0&&(ke(e.BLEND),m=!1);return}if(m===!1&&(_e(e.BLEND),m=!0),ue!==Kde){if(ue!==g||Yt!==T){if((v!==af||b!==af)&&(e.blendEquation(e.FUNC_ADD),v=af,b=af),Yt)switch(ue){case Tm:e.blendFuncSeparate(e.ONE,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA);break;case w9:e.blendFunc(e.ONE,e.ONE);break;case E9:e.blendFuncSeparate(e.ZERO,e.ONE_MINUS_SRC_COLOR,e.ZERO,e.ONE);break;case M9:e.blendFuncSeparate(e.ZERO,e.SRC_COLOR,e.ZERO,e.SRC_ALPHA);break;default:console.error("THREE.WebGLState: Invalid blending: ",ue);break}else switch(ue){case Tm:e.blendFuncSeparate(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA);break;case w9:e.blendFunc(e.SRC_ALPHA,e.ONE);break;case E9:e.blendFuncSeparate(e.ZERO,e.ONE_MINUS_SRC_COLOR,e.ZERO,e.ONE);break;case M9:e.blendFunc(e.ZERO,e.SRC_COLOR);break;default:console.error("THREE.WebGLState: Invalid blending: ",ue);break}_=null,x=null,E=null,M=null,S.set(0,0,0),D=0,g=ue,T=Yt}return}nt=nt||pe,lt=lt||we,$e=$e||Ie,(pe!==v||nt!==b)&&(e.blendEquationSeparate(Ce[pe],Ce[nt]),v=pe,b=nt),(we!==_||Ie!==x||lt!==E||$e!==M)&&(e.blendFuncSeparate(oe[we],oe[Ie],oe[lt],oe[$e]),_=we,x=Ie,E=lt,M=$e),(He.equals(S)===!1||wt!==D)&&(e.blendColor(He.r,He.g,He.b,wt),S.copy(He),D=wt),g=ue,T=!1}function Oe(ue,pe){ue.side===kn?ke(e.CULL_FACE):_e(e.CULL_FACE);let we=ue.side===La;pe&&(we=!we),Ke(we),ue.blending===Tm&&ue.transparent===!1?it(Du):it(ue.blending,ue.blendEquation,ue.blendSrc,ue.blendDst,ue.blendEquationAlpha,ue.blendSrcAlpha,ue.blendDstAlpha,ue.blendColor,ue.blendAlpha,ue.premultipliedAlpha),o.setFunc(ue.depthFunc),o.setTest(ue.depthTest),o.setMask(ue.depthWrite),a.setMask(ue.colorWrite);let Ie=ue.stencilWrite;s.setTest(Ie),Ie&&(s.setMask(ue.stencilWriteMask),s.setFunc(ue.stencilFunc,ue.stencilRef,ue.stencilFuncMask),s.setOp(ue.stencilFail,ue.stencilZFail,ue.stencilZPass)),ut(ue.polygonOffset,ue.polygonOffsetFactor,ue.polygonOffsetUnits),ue.alphaToCoverage===!0?_e(e.SAMPLE_ALPHA_TO_COVERAGE):ke(e.SAMPLE_ALPHA_TO_COVERAGE)}function Ke(ue){P!==ue&&(ue?e.frontFace(e.CW):e.frontFace(e.CCW),P=ue)}function Le(ue){ue!==Zde?(_e(e.CULL_FACE),ue!==k&&(ue===b9?e.cullFace(e.BACK):ue===Xde?e.cullFace(e.FRONT):e.cullFace(e.FRONT_AND_BACK))):ke(e.CULL_FACE),k=ue}function Ze(ue){ue!==R&&(O&&e.lineWidth(ue),R=ue)}function ut(ue,pe,we){ue?(_e(e.POLYGON_OFFSET_FILL),(F!==pe||B!==we)&&(e.polygonOffset(pe,we),F=pe,B=we)):ke(e.POLYGON_OFFSET_FILL)}function et(ue){ue?_e(e.SCISSOR_TEST):ke(e.SCISSOR_TEST)}function te(ue){ue===void 0&&(ue=e.TEXTURE0+z-1),Z!==ue&&(e.activeTexture(ue),Z=ue)}function K(ue,pe,we){we===void 0&&(Z===null?we=e.TEXTURE0+z-1:we=Z);let Ie=ne[we];Ie===void 0&&(Ie={type:void 0,texture:void 0},ne[we]=Ie),(Ie.type!==ue||Ie.texture!==pe)&&(Z!==we&&(e.activeTexture(we),Z=we),e.bindTexture(ue,pe||be[ue]),Ie.type=ue,Ie.texture=pe)}function ve(){let ue=ne[Z];ue!==void 0&&ue.type!==void 0&&(e.bindTexture(ue.type,null),ue.type=void 0,ue.texture=void 0)}function je(){try{e.compressedTexImage2D.apply(e,arguments)}catch(ue){console.error("THREE.WebGLState:",ue)}}function Ne(){try{e.compressedTexImage3D.apply(e,arguments)}catch(ue){console.error("THREE.WebGLState:",ue)}}function Ue(){try{e.texSubImage2D.apply(e,arguments)}catch(ue){console.error("THREE.WebGLState:",ue)}}function ft(){try{e.texSubImage3D.apply(e,arguments)}catch(ue){console.error("THREE.WebGLState:",ue)}}function ot(){try{e.compressedTexSubImage2D.apply(e,arguments)}catch(ue){console.error("THREE.WebGLState:",ue)}}function Ae(){try{e.compressedTexSubImage3D.apply(e,arguments)}catch(ue){console.error("THREE.WebGLState:",ue)}}function Q(){try{e.texStorage2D.apply(e,arguments)}catch(ue){console.error("THREE.WebGLState:",ue)}}function G(){try{e.texStorage3D.apply(e,arguments)}catch(ue){console.error("THREE.WebGLState:",ue)}}function W(){try{e.texImage2D.apply(e,arguments)}catch(ue){console.error("THREE.WebGLState:",ue)}}function re(){try{e.texImage3D.apply(e,arguments)}catch(ue){console.error("THREE.WebGLState:",ue)}}function $(ue){X.equals(ue)===!1&&(e.scissor(ue.x,ue.y,ue.z,ue.w),X.copy(ue))}function me(ue){ce.equals(ue)===!1&&(e.viewport(ue.x,ue.y,ue.z,ue.w),ce.copy(ue))}function ye(ue,pe){let we=u.get(pe);we===void 0&&(we=new WeakMap,u.set(pe,we));let Ie=we.get(ue);Ie===void 0&&(Ie=e.getUniformBlockIndex(pe,ue.name),we.set(ue,Ie))}function Be(ue,pe){let we=u.get(pe).get(ue);l.get(pe)!==we&&(e.uniformBlockBinding(pe,we,ue.__bindingPointIndex),l.set(pe,we))}function Ge(){e.disable(e.BLEND),e.disable(e.CULL_FACE),e.disable(e.DEPTH_TEST),e.disable(e.POLYGON_OFFSET_FILL),e.disable(e.SCISSOR_TEST),e.disable(e.STENCIL_TEST),e.disable(e.SAMPLE_ALPHA_TO_COVERAGE),e.blendEquation(e.FUNC_ADD),e.blendFunc(e.ONE,e.ZERO),e.blendFuncSeparate(e.ONE,e.ZERO,e.ONE,e.ZERO),e.blendColor(0,0,0,0),e.colorMask(!0,!0,!0,!0),e.clearColor(0,0,0,0),e.depthMask(!0),e.depthFunc(e.LESS),o.setReversed(!1),e.clearDepth(1),e.stencilMask(4294967295),e.stencilFunc(e.ALWAYS,0,4294967295),e.stencilOp(e.KEEP,e.KEEP,e.KEEP),e.clearStencil(0),e.cullFace(e.BACK),e.frontFace(e.CCW),e.polygonOffset(0,0),e.activeTexture(e.TEXTURE0),e.bindFramebuffer(e.FRAMEBUFFER,null),e.bindFramebuffer(e.DRAW_FRAMEBUFFER,null),e.bindFramebuffer(e.READ_FRAMEBUFFER,null),e.useProgram(null),e.lineWidth(1),e.scissor(0,0,e.canvas.width,e.canvas.height),e.viewport(0,0,e.canvas.width,e.canvas.height),c={},Z=null,ne={},h={},d=new WeakMap,p=[],f=null,m=!1,g=null,v=null,_=null,x=null,b=null,E=null,M=null,S=new Dt(0,0,0),D=0,T=!1,P=null,k=null,R=null,F=null,B=null,X.set(0,0,e.canvas.width,e.canvas.height),ce.set(0,0,e.canvas.width,e.canvas.height),a.reset(),o.reset(),s.reset()}return{buffers:{color:a,depth:o,stencil:s},enable:_e,disable:ke,bindFramebuffer:Ye,drawBuffers:We,useProgram:Me,setBlending:it,setMaterial:Oe,setFlipSided:Ke,setCullFace:Le,setLineWidth:Ze,setPolygonOffset:ut,setScissorTest:et,activeTexture:te,bindTexture:K,unbindTexture:ve,compressedTexImage2D:je,compressedTexImage3D:Ne,texImage2D:W,texImage3D:re,updateUBOMapping:ye,uniformBlockBinding:Be,texStorage2D:Q,texStorage3D:G,texSubImage2D:Ue,texSubImage3D:ft,compressedTexSubImage2D:ot,compressedTexSubImage3D:Ae,scissor:$,viewport:me,reset:Ge}}function lve(e,t,r,i,n,a,o){let s=t.has("WEBGL_multisampled_render_to_texture")?t.get("WEBGL_multisampled_render_to_texture"):null,l=typeof navigator>"u"?!1:/OculusBrowser/g.test(navigator.userAgent),u=new vt,c=new WeakMap,h,d=new WeakMap,p=!1;try{p=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch(te){}function f(te,K){return p?new OffscreenCanvas(te,K):fv("canvas")}function m(te,K,ve){let je=1,Ne=et(te);if((Ne.width>ve||Ne.height>ve)&&(je=ve/Math.max(Ne.width,Ne.height)),je<1)if(typeof HTMLImageElement<"u"&&te instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&te instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&te instanceof ImageBitmap||typeof VideoFrame<"u"&&te instanceof VideoFrame){let Ue=Math.floor(je*Ne.width),ft=Math.floor(je*Ne.height);h===void 0&&(h=f(Ue,ft));let ot=K?f(Ue,ft):h;return ot.width=Ue,ot.height=ft,ot.getContext("2d").drawImage(te,0,0,Ue,ft),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+Ne.width+"x"+Ne.height+") to ("+Ue+"x"+ft+")."),ot}else return"data"in te&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+Ne.width+"x"+Ne.height+")."),te;return te}function g(te){return te.generateMipmaps}function v(te){e.generateMipmap(te)}function _(te){return te.isWebGLCubeRenderTarget?e.TEXTURE_CUBE_MAP:te.isWebGL3DRenderTarget?e.TEXTURE_3D:te.isWebGLArrayRenderTarget||te.isCompressedArrayTexture?e.TEXTURE_2D_ARRAY:e.TEXTURE_2D}function x(te,K,ve,je,Ne=!1){if(te!==null){if(e[te]!==void 0)return e[te];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+te+"'")}let Ue=K;if(K===e.RED&&(ve===e.FLOAT&&(Ue=e.R32F),ve===e.HALF_FLOAT&&(Ue=e.R16F),ve===e.UNSIGNED_BYTE&&(Ue=e.R8)),K===e.RED_INTEGER&&(ve===e.UNSIGNED_BYTE&&(Ue=e.R8UI),ve===e.UNSIGNED_SHORT&&(Ue=e.R16UI),ve===e.UNSIGNED_INT&&(Ue=e.R32UI),ve===e.BYTE&&(Ue=e.R8I),ve===e.SHORT&&(Ue=e.R16I),ve===e.INT&&(Ue=e.R32I)),K===e.RG&&(ve===e.FLOAT&&(Ue=e.RG32F),ve===e.HALF_FLOAT&&(Ue=e.RG16F),ve===e.UNSIGNED_BYTE&&(Ue=e.RG8)),K===e.RG_INTEGER&&(ve===e.UNSIGNED_BYTE&&(Ue=e.RG8UI),ve===e.UNSIGNED_SHORT&&(Ue=e.RG16UI),ve===e.UNSIGNED_INT&&(Ue=e.RG32UI),ve===e.BYTE&&(Ue=e.RG8I),ve===e.SHORT&&(Ue=e.RG16I),ve===e.INT&&(Ue=e.RG32I)),K===e.RGB_INTEGER&&(ve===e.UNSIGNED_BYTE&&(Ue=e.RGB8UI),ve===e.UNSIGNED_SHORT&&(Ue=e.RGB16UI),ve===e.UNSIGNED_INT&&(Ue=e.RGB32UI),ve===e.BYTE&&(Ue=e.RGB8I),ve===e.SHORT&&(Ue=e.RGB16I),ve===e.INT&&(Ue=e.RGB32I)),K===e.RGBA_INTEGER&&(ve===e.UNSIGNED_BYTE&&(Ue=e.RGBA8UI),ve===e.UNSIGNED_SHORT&&(Ue=e.RGBA16UI),ve===e.UNSIGNED_INT&&(Ue=e.RGBA32UI),ve===e.BYTE&&(Ue=e.RGBA8I),ve===e.SHORT&&(Ue=e.RGBA16I),ve===e.INT&&(Ue=e.RGBA32I)),K===e.RGB&&ve===e.UNSIGNED_INT_5_9_9_9_REV&&(Ue=e.RGB9_E5),K===e.RGBA){let ft=Ne?hE:Ai.getTransfer(je);ve===e.FLOAT&&(Ue=e.RGBA32F),ve===e.HALF_FLOAT&&(Ue=e.RGBA16F),ve===e.UNSIGNED_BYTE&&(Ue=ft===rn?e.SRGB8_ALPHA8:e.RGBA8),ve===e.UNSIGNED_SHORT_4_4_4_4&&(Ue=e.RGBA4),ve===e.UNSIGNED_SHORT_5_5_5_1&&(Ue=e.RGB5_A1)}return(Ue===e.R16F||Ue===e.R32F||Ue===e.RG16F||Ue===e.RG32F||Ue===e.RGBA16F||Ue===e.RGBA32F)&&t.get("EXT_color_buffer_float"),Ue}function b(te,K){let ve;return te?K===null||K===ud||K===Lm?ve=e.DEPTH24_STENCIL8:K===Po?ve=e.DEPTH32F_STENCIL8:K===uf&&(ve=e.DEPTH24_STENCIL8,console.warn("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):K===null||K===ud||K===Lm?ve=e.DEPTH_COMPONENT24:K===Po?ve=e.DEPTH_COMPONENT32F:K===uf&&(ve=e.DEPTH_COMPONENT16),ve}function E(te,K){return g(te)===!0||te.isFramebufferTexture&&te.minFilter!==Oa&&te.minFilter!==Rn?Math.log2(Math.max(K.width,K.height))+1:te.mipmaps!==void 0&&te.mipmaps.length>0?te.mipmaps.length:te.isCompressedTexture&&Array.isArray(te.image)?K.mipmaps.length:1}function M(te){let K=te.target;K.removeEventListener("dispose",M),D(K),K.isVideoTexture&&c.delete(K)}function S(te){let K=te.target;K.removeEventListener("dispose",S),P(K)}function D(te){let K=i.get(te);if(K.__webglInit===void 0)return;let ve=te.source,je=d.get(ve);if(je){let Ne=je[K.__cacheKey];Ne.usedTimes--,Ne.usedTimes===0&&T(te),Object.keys(je).length===0&&d.delete(ve)}i.remove(te)}function T(te){let K=i.get(te);e.deleteTexture(K.__webglTexture);let ve=te.source,je=d.get(ve);delete je[K.__cacheKey],o.memory.textures--}function P(te){let K=i.get(te);if(te.depthTexture&&(te.depthTexture.dispose(),i.remove(te.depthTexture)),te.isWebGLCubeRenderTarget)for(let je=0;je<6;je++){if(Array.isArray(K.__webglFramebuffer[je]))for(let Ne=0;Ne<K.__webglFramebuffer[je].length;Ne++)e.deleteFramebuffer(K.__webglFramebuffer[je][Ne]);else e.deleteFramebuffer(K.__webglFramebuffer[je]);K.__webglDepthbuffer&&e.deleteRenderbuffer(K.__webglDepthbuffer[je])}else{if(Array.isArray(K.__webglFramebuffer))for(let je=0;je<K.__webglFramebuffer.length;je++)e.deleteFramebuffer(K.__webglFramebuffer[je]);else e.deleteFramebuffer(K.__webglFramebuffer);if(K.__webglDepthbuffer&&e.deleteRenderbuffer(K.__webglDepthbuffer),K.__webglMultisampledFramebuffer&&e.deleteFramebuffer(K.__webglMultisampledFramebuffer),K.__webglColorRenderbuffer)for(let je=0;je<K.__webglColorRenderbuffer.length;je++)K.__webglColorRenderbuffer[je]&&e.deleteRenderbuffer(K.__webglColorRenderbuffer[je]);K.__webglDepthRenderbuffer&&e.deleteRenderbuffer(K.__webglDepthRenderbuffer)}let ve=te.textures;for(let je=0,Ne=ve.length;je<Ne;je++){let Ue=i.get(ve[je]);Ue.__webglTexture&&(e.deleteTexture(Ue.__webglTexture),o.memory.textures--),i.remove(ve[je])}i.remove(te)}let k=0;function R(){k=0}function F(){let te=k;return te>=n.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+te+" texture units while this GPU supports only "+n.maxTextures),k+=1,te}function B(te){let K=[];return K.push(te.wrapS),K.push(te.wrapT),K.push(te.wrapR||0),K.push(te.magFilter),K.push(te.minFilter),K.push(te.anisotropy),K.push(te.internalFormat),K.push(te.format),K.push(te.type),K.push(te.generateMipmaps),K.push(te.premultiplyAlpha),K.push(te.flipY),K.push(te.unpackAlignment),K.push(te.colorSpace),K.join()}function z(te,K){let ve=i.get(te);if(te.isVideoTexture&&Ze(te),te.isRenderTargetTexture===!1&&te.version>0&&ve.__version!==te.version){let je=te.image;if(je===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(je.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{ce(ve,te,K);return}}r.bindTexture(e.TEXTURE_2D,ve.__webglTexture,e.TEXTURE0+K)}function O(te,K){let ve=i.get(te);if(te.version>0&&ve.__version!==te.version){ce(ve,te,K);return}r.bindTexture(e.TEXTURE_2D_ARRAY,ve.__webglTexture,e.TEXTURE0+K)}function j(te,K){let ve=i.get(te);if(te.version>0&&ve.__version!==te.version){ce(ve,te,K);return}r.bindTexture(e.TEXTURE_3D,ve.__webglTexture,e.TEXTURE0+K)}function Y(te,K){let ve=i.get(te);if(te.version>0&&ve.__version!==te.version){ge(ve,te,K);return}r.bindTexture(e.TEXTURE_CUBE_MAP,ve.__webglTexture,e.TEXTURE0+K)}let Z={[wa]:e.REPEAT,[Ll]:e.CLAMP_TO_EDGE,[lf]:e.MIRRORED_REPEAT},ne={[Oa]:e.NEAREST,[yv]:e.NEAREST_MIPMAP_NEAREST,[od]:e.NEAREST_MIPMAP_LINEAR,[Rn]:e.LINEAR,[sf]:e.LINEAR_MIPMAP_NEAREST,[el]:e.LINEAR_MIPMAP_LINEAR},ie={[Cpe]:e.NEVER,[Rpe]:e.ALWAYS,[Bpe]:e.LESS,[aV]:e.LEQUAL,[Tpe]:e.EQUAL,[kpe]:e.GEQUAL,[Ppe]:e.GREATER,[Dpe]:e.NOTEQUAL};function le(te,K){if(K.type===Po&&t.has("OES_texture_float_linear")===!1&&(K.magFilter===Rn||K.magFilter===sf||K.magFilter===od||K.magFilter===el||K.minFilter===Rn||K.minFilter===sf||K.minFilter===od||K.minFilter===el)&&console.warn("THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),e.texParameteri(te,e.TEXTURE_WRAP_S,Z[K.wrapS]),e.texParameteri(te,e.TEXTURE_WRAP_T,Z[K.wrapT]),(te===e.TEXTURE_3D||te===e.TEXTURE_2D_ARRAY)&&e.texParameteri(te,e.TEXTURE_WRAP_R,Z[K.wrapR]),e.texParameteri(te,e.TEXTURE_MAG_FILTER,ne[K.magFilter]),e.texParameteri(te,e.TEXTURE_MIN_FILTER,ne[K.minFilter]),K.compareFunction&&(e.texParameteri(te,e.TEXTURE_COMPARE_MODE,e.COMPARE_REF_TO_TEXTURE),e.texParameteri(te,e.TEXTURE_COMPARE_FUNC,ie[K.compareFunction])),t.has("EXT_texture_filter_anisotropic")===!0){if(K.magFilter===Oa||K.minFilter!==od&&K.minFilter!==el||K.type===Po&&t.has("OES_texture_float_linear")===!1)return;if(K.anisotropy>1||i.get(K).__currentAnisotropy){let ve=t.get("EXT_texture_filter_anisotropic");e.texParameterf(te,ve.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(K.anisotropy,n.getMaxAnisotropy())),i.get(K).__currentAnisotropy=K.anisotropy}}}function X(te,K){let ve=!1;te.__webglInit===void 0&&(te.__webglInit=!0,K.addEventListener("dispose",M));let je=K.source,Ne=d.get(je);Ne===void 0&&(Ne={},d.set(je,Ne));let Ue=B(K);if(Ue!==te.__cacheKey){Ne[Ue]===void 0&&(Ne[Ue]={texture:e.createTexture(),usedTimes:0},o.memory.textures++,ve=!0),Ne[Ue].usedTimes++;let ft=Ne[te.__cacheKey];ft!==void 0&&(Ne[te.__cacheKey].usedTimes--,ft.usedTimes===0&&T(K)),te.__cacheKey=Ue,te.__webglTexture=Ne[Ue].texture}return ve}function ce(te,K,ve){let je=e.TEXTURE_2D;(K.isDataArrayTexture||K.isCompressedArrayTexture)&&(je=e.TEXTURE_2D_ARRAY),K.isData3DTexture&&(je=e.TEXTURE_3D);let Ne=X(te,K),Ue=K.source;r.bindTexture(je,te.__webglTexture,e.TEXTURE0+ve);let ft=i.get(Ue);if(Ue.version!==ft.__version||Ne===!0){r.activeTexture(e.TEXTURE0+ve);let ot=Ai.getPrimaries(Ai.workingColorSpace),Ae=K.colorSpace===Tu?null:Ai.getPrimaries(K.colorSpace),Q=K.colorSpace===Tu||ot===Ae?e.NONE:e.BROWSER_DEFAULT_WEBGL;e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,K.flipY),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,K.premultiplyAlpha),e.pixelStorei(e.UNPACK_ALIGNMENT,K.unpackAlignment),e.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,Q);let G=m(K.image,!1,n.maxTextureSize);G=ut(K,G);let W=a.convert(K.format,K.colorSpace),re=a.convert(K.type),$=x(K.internalFormat,W,re,K.colorSpace,K.isVideoTexture);le(je,K);let me,ye=K.mipmaps,Be=K.isVideoTexture!==!0,Ge=ft.__version===void 0||Ne===!0,ue=Ue.dataReady,pe=E(K,G);if(K.isDepthTexture)$=b(K.format===Om,K.type),Ge&&(Be?r.texStorage2D(e.TEXTURE_2D,1,$,G.width,G.height):r.texImage2D(e.TEXTURE_2D,0,$,G.width,G.height,0,W,re,null));else if(K.isDataTexture)if(ye.length>0){Be&&Ge&&r.texStorage2D(e.TEXTURE_2D,pe,$,ye[0].width,ye[0].height);for(let we=0,Ie=ye.length;we<Ie;we++)me=ye[we],Be?ue&&r.texSubImage2D(e.TEXTURE_2D,we,0,0,me.width,me.height,W,re,me.data):r.texImage2D(e.TEXTURE_2D,we,$,me.width,me.height,0,W,re,me.data);K.generateMipmaps=!1}else Be?(Ge&&r.texStorage2D(e.TEXTURE_2D,pe,$,G.width,G.height),ue&&r.texSubImage2D(e.TEXTURE_2D,0,0,0,G.width,G.height,W,re,G.data)):r.texImage2D(e.TEXTURE_2D,0,$,G.width,G.height,0,W,re,G.data);else if(K.isCompressedTexture)if(K.isCompressedArrayTexture){Be&&Ge&&r.texStorage3D(e.TEXTURE_2D_ARRAY,pe,$,ye[0].width,ye[0].height,G.depth);for(let we=0,Ie=ye.length;we<Ie;we++)if(me=ye[we],K.format!==Xn)if(W!==null)if(Be){if(ue)if(K.layerUpdates.size>0){let nt=_G(me.width,me.height,K.format,K.type);for(let lt of K.layerUpdates){let $e=me.data.subarray(lt*nt/me.data.BYTES_PER_ELEMENT,(lt+1)*nt/me.data.BYTES_PER_ELEMENT);r.compressedTexSubImage3D(e.TEXTURE_2D_ARRAY,we,0,0,lt,me.width,me.height,1,W,$e)}K.clearLayerUpdates()}else r.compressedTexSubImage3D(e.TEXTURE_2D_ARRAY,we,0,0,0,me.width,me.height,G.depth,W,me.data)}else r.compressedTexImage3D(e.TEXTURE_2D_ARRAY,we,$,me.width,me.height,G.depth,0,me.data,0,0);else console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else Be?ue&&r.texSubImage3D(e.TEXTURE_2D_ARRAY,we,0,0,0,me.width,me.height,G.depth,W,re,me.data):r.texImage3D(e.TEXTURE_2D_ARRAY,we,$,me.width,me.height,G.depth,0,W,re,me.data)}else{Be&&Ge&&r.texStorage2D(e.TEXTURE_2D,pe,$,ye[0].width,ye[0].height);for(let we=0,Ie=ye.length;we<Ie;we++)me=ye[we],K.format!==Xn?W!==null?Be?ue&&r.compressedTexSubImage2D(e.TEXTURE_2D,we,0,0,me.width,me.height,W,me.data):r.compressedTexImage2D(e.TEXTURE_2D,we,$,me.width,me.height,0,me.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):Be?ue&&r.texSubImage2D(e.TEXTURE_2D,we,0,0,me.width,me.height,W,re,me.data):r.texImage2D(e.TEXTURE_2D,we,$,me.width,me.height,0,W,re,me.data)}else if(K.isDataArrayTexture)if(Be){if(Ge&&r.texStorage3D(e.TEXTURE_2D_ARRAY,pe,$,G.width,G.height,G.depth),ue)if(K.layerUpdates.size>0){let we=_G(G.width,G.height,K.format,K.type);for(let Ie of K.layerUpdates){let nt=G.data.subarray(Ie*we/G.data.BYTES_PER_ELEMENT,(Ie+1)*we/G.data.BYTES_PER_ELEMENT);r.texSubImage3D(e.TEXTURE_2D_ARRAY,0,0,0,Ie,G.width,G.height,1,W,re,nt)}K.clearLayerUpdates()}else r.texSubImage3D(e.TEXTURE_2D_ARRAY,0,0,0,0,G.width,G.height,G.depth,W,re,G.data)}else r.texImage3D(e.TEXTURE_2D_ARRAY,0,$,G.width,G.height,G.depth,0,W,re,G.data);else if(K.isData3DTexture)Be?(Ge&&r.texStorage3D(e.TEXTURE_3D,pe,$,G.width,G.height,G.depth),ue&&r.texSubImage3D(e.TEXTURE_3D,0,0,0,0,G.width,G.height,G.depth,W,re,G.data)):r.texImage3D(e.TEXTURE_3D,0,$,G.width,G.height,G.depth,0,W,re,G.data);else if(K.isFramebufferTexture){if(Ge)if(Be)r.texStorage2D(e.TEXTURE_2D,pe,$,G.width,G.height);else{let we=G.width,Ie=G.height;for(let nt=0;nt<pe;nt++)r.texImage2D(e.TEXTURE_2D,nt,$,we,Ie,0,W,re,null),we>>=1,Ie>>=1}}else if(ye.length>0){if(Be&&Ge){let we=et(ye[0]);r.texStorage2D(e.TEXTURE_2D,pe,$,we.width,we.height)}for(let we=0,Ie=ye.length;we<Ie;we++)me=ye[we],Be?ue&&r.texSubImage2D(e.TEXTURE_2D,we,0,0,W,re,me):r.texImage2D(e.TEXTURE_2D,we,$,W,re,me);K.generateMipmaps=!1}else if(Be){if(Ge){let we=et(G);r.texStorage2D(e.TEXTURE_2D,pe,$,we.width,we.height)}ue&&r.texSubImage2D(e.TEXTURE_2D,0,0,0,W,re,G)}else r.texImage2D(e.TEXTURE_2D,0,$,W,re,G);g(K)&&v(je),ft.__version=Ue.version,K.onUpdate&&K.onUpdate(K)}te.__version=K.version}function ge(te,K,ve){if(K.image.length!==6)return;let je=X(te,K),Ne=K.source;r.bindTexture(e.TEXTURE_CUBE_MAP,te.__webglTexture,e.TEXTURE0+ve);let Ue=i.get(Ne);if(Ne.version!==Ue.__version||je===!0){r.activeTexture(e.TEXTURE0+ve);let ft=Ai.getPrimaries(Ai.workingColorSpace),ot=K.colorSpace===Tu?null:Ai.getPrimaries(K.colorSpace),Ae=K.colorSpace===Tu||ft===ot?e.NONE:e.BROWSER_DEFAULT_WEBGL;e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,K.flipY),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,K.premultiplyAlpha),e.pixelStorei(e.UNPACK_ALIGNMENT,K.unpackAlignment),e.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,Ae);let Q=K.isCompressedTexture||K.image[0].isCompressedTexture,G=K.image[0]&&K.image[0].isDataTexture,W=[];for(let Ie=0;Ie<6;Ie++)!Q&&!G?W[Ie]=m(K.image[Ie],!0,n.maxCubemapSize):W[Ie]=G?K.image[Ie].image:K.image[Ie],W[Ie]=ut(K,W[Ie]);let re=W[0],$=a.convert(K.format,K.colorSpace),me=a.convert(K.type),ye=x(K.internalFormat,$,me,K.colorSpace),Be=K.isVideoTexture!==!0,Ge=Ue.__version===void 0||je===!0,ue=Ne.dataReady,pe=E(K,re);le(e.TEXTURE_CUBE_MAP,K);let we;if(Q){Be&&Ge&&r.texStorage2D(e.TEXTURE_CUBE_MAP,pe,ye,re.width,re.height);for(let Ie=0;Ie<6;Ie++){we=W[Ie].mipmaps;for(let nt=0;nt<we.length;nt++){let lt=we[nt];K.format!==Xn?$!==null?Be?ue&&r.compressedTexSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+Ie,nt,0,0,lt.width,lt.height,$,lt.data):r.compressedTexImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+Ie,nt,ye,lt.width,lt.height,0,lt.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):Be?ue&&r.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+Ie,nt,0,0,lt.width,lt.height,$,me,lt.data):r.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+Ie,nt,ye,lt.width,lt.height,0,$,me,lt.data)}}}else{if(we=K.mipmaps,Be&&Ge){we.length>0&&pe++;let Ie=et(W[0]);r.texStorage2D(e.TEXTURE_CUBE_MAP,pe,ye,Ie.width,Ie.height)}for(let Ie=0;Ie<6;Ie++)if(G){Be?ue&&r.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+Ie,0,0,0,W[Ie].width,W[Ie].height,$,me,W[Ie].data):r.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+Ie,0,ye,W[Ie].width,W[Ie].height,0,$,me,W[Ie].data);for(let nt=0;nt<we.length;nt++){let lt=we[nt].image[Ie].image;Be?ue&&r.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+Ie,nt+1,0,0,lt.width,lt.height,$,me,lt.data):r.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+Ie,nt+1,ye,lt.width,lt.height,0,$,me,lt.data)}}else{Be?ue&&r.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+Ie,0,0,0,$,me,W[Ie]):r.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+Ie,0,ye,$,me,W[Ie]);for(let nt=0;nt<we.length;nt++){let lt=we[nt];Be?ue&&r.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+Ie,nt+1,0,0,$,me,lt.image[Ie]):r.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+Ie,nt+1,ye,$,me,lt.image[Ie])}}}g(K)&&v(e.TEXTURE_CUBE_MAP),Ue.__version=Ne.version,K.onUpdate&&K.onUpdate(K)}te.__version=K.version}function be(te,K,ve,je,Ne,Ue){let ft=a.convert(ve.format,ve.colorSpace),ot=a.convert(ve.type),Ae=x(ve.internalFormat,ft,ot,ve.colorSpace),Q=i.get(K),G=i.get(ve);if(G.__renderTarget=K,!Q.__hasExternalTextures){let W=Math.max(1,K.width>>Ue),re=Math.max(1,K.height>>Ue);Ne===e.TEXTURE_3D||Ne===e.TEXTURE_2D_ARRAY?r.texImage3D(Ne,Ue,Ae,W,re,K.depth,0,ft,ot,null):r.texImage2D(Ne,Ue,Ae,W,re,0,ft,ot,null)}r.bindFramebuffer(e.FRAMEBUFFER,te),Le(K)?s.framebufferTexture2DMultisampleEXT(e.FRAMEBUFFER,je,Ne,G.__webglTexture,0,Ke(K)):(Ne===e.TEXTURE_2D||Ne>=e.TEXTURE_CUBE_MAP_POSITIVE_X&&Ne<=e.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&e.framebufferTexture2D(e.FRAMEBUFFER,je,Ne,G.__webglTexture,Ue),r.bindFramebuffer(e.FRAMEBUFFER,null)}function _e(te,K,ve){if(e.bindRenderbuffer(e.RENDERBUFFER,te),K.depthBuffer){let je=K.depthTexture,Ne=je&&je.isDepthTexture?je.type:null,Ue=b(K.stencilBuffer,Ne),ft=K.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,ot=Ke(K);Le(K)?s.renderbufferStorageMultisampleEXT(e.RENDERBUFFER,ot,Ue,K.width,K.height):ve?e.renderbufferStorageMultisample(e.RENDERBUFFER,ot,Ue,K.width,K.height):e.renderbufferStorage(e.RENDERBUFFER,Ue,K.width,K.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,ft,e.RENDERBUFFER,te)}else{let je=K.textures;for(let Ne=0;Ne<je.length;Ne++){let Ue=je[Ne],ft=a.convert(Ue.format,Ue.colorSpace),ot=a.convert(Ue.type),Ae=x(Ue.internalFormat,ft,ot,Ue.colorSpace),Q=Ke(K);ve&&Le(K)===!1?e.renderbufferStorageMultisample(e.RENDERBUFFER,Q,Ae,K.width,K.height):Le(K)?s.renderbufferStorageMultisampleEXT(e.RENDERBUFFER,Q,Ae,K.width,K.height):e.renderbufferStorage(e.RENDERBUFFER,Ae,K.width,K.height)}}e.bindRenderbuffer(e.RENDERBUFFER,null)}function ke(te,K){if(K&&K.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(r.bindFramebuffer(e.FRAMEBUFFER,te),!(K.depthTexture&&K.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");let ve=i.get(K.depthTexture);ve.__renderTarget=K,(!ve.__webglTexture||K.depthTexture.image.width!==K.width||K.depthTexture.image.height!==K.height)&&(K.depthTexture.image.width=K.width,K.depthTexture.image.height=K.height,K.depthTexture.needsUpdate=!0),z(K.depthTexture,0);let je=ve.__webglTexture,Ne=Ke(K);if(K.depthTexture.format===Pm)Le(K)?s.framebufferTexture2DMultisampleEXT(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.TEXTURE_2D,je,0,Ne):e.framebufferTexture2D(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.TEXTURE_2D,je,0);else if(K.depthTexture.format===Om)Le(K)?s.framebufferTexture2DMultisampleEXT(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.TEXTURE_2D,je,0,Ne):e.framebufferTexture2D(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.TEXTURE_2D,je,0);else throw new Error("Unknown depthTexture format")}function Ye(te){let K=i.get(te),ve=te.isWebGLCubeRenderTarget===!0;if(K.__boundDepthTexture!==te.depthTexture){let je=te.depthTexture;if(K.__depthDisposeCallback&&K.__depthDisposeCallback(),je){let Ne=()=>{delete K.__boundDepthTexture,delete K.__depthDisposeCallback,je.removeEventListener("dispose",Ne)};je.addEventListener("dispose",Ne),K.__depthDisposeCallback=Ne}K.__boundDepthTexture=je}if(te.depthTexture&&!K.__autoAllocateDepthBuffer){if(ve)throw new Error("target.depthTexture not supported in Cube render targets");ke(K.__webglFramebuffer,te)}else if(ve){K.__webglDepthbuffer=[];for(let je=0;je<6;je++)if(r.bindFramebuffer(e.FRAMEBUFFER,K.__webglFramebuffer[je]),K.__webglDepthbuffer[je]===void 0)K.__webglDepthbuffer[je]=e.createRenderbuffer(),_e(K.__webglDepthbuffer[je],te,!1);else{let Ne=te.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,Ue=K.__webglDepthbuffer[je];e.bindRenderbuffer(e.RENDERBUFFER,Ue),e.framebufferRenderbuffer(e.FRAMEBUFFER,Ne,e.RENDERBUFFER,Ue)}}else if(r.bindFramebuffer(e.FRAMEBUFFER,K.__webglFramebuffer),K.__webglDepthbuffer===void 0)K.__webglDepthbuffer=e.createRenderbuffer(),_e(K.__webglDepthbuffer,te,!1);else{let je=te.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,Ne=K.__webglDepthbuffer;e.bindRenderbuffer(e.RENDERBUFFER,Ne),e.framebufferRenderbuffer(e.FRAMEBUFFER,je,e.RENDERBUFFER,Ne)}r.bindFramebuffer(e.FRAMEBUFFER,null)}function We(te,K,ve){let je=i.get(te);K!==void 0&&be(je.__webglFramebuffer,te,te.texture,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,0),ve!==void 0&&Ye(te)}function Me(te){let K=te.texture,ve=i.get(te),je=i.get(K);te.addEventListener("dispose",S);let Ne=te.textures,Ue=te.isWebGLCubeRenderTarget===!0,ft=Ne.length>1;if(ft||(je.__webglTexture===void 0&&(je.__webglTexture=e.createTexture()),je.__version=K.version,o.memory.textures++),Ue){ve.__webglFramebuffer=[];for(let ot=0;ot<6;ot++)if(K.mipmaps&&K.mipmaps.length>0){ve.__webglFramebuffer[ot]=[];for(let Ae=0;Ae<K.mipmaps.length;Ae++)ve.__webglFramebuffer[ot][Ae]=e.createFramebuffer()}else ve.__webglFramebuffer[ot]=e.createFramebuffer()}else{if(K.mipmaps&&K.mipmaps.length>0){ve.__webglFramebuffer=[];for(let ot=0;ot<K.mipmaps.length;ot++)ve.__webglFramebuffer[ot]=e.createFramebuffer()}else ve.__webglFramebuffer=e.createFramebuffer();if(ft)for(let ot=0,Ae=Ne.length;ot<Ae;ot++){let Q=i.get(Ne[ot]);Q.__webglTexture===void 0&&(Q.__webglTexture=e.createTexture(),o.memory.textures++)}if(te.samples>0&&Le(te)===!1){ve.__webglMultisampledFramebuffer=e.createFramebuffer(),ve.__webglColorRenderbuffer=[],r.bindFramebuffer(e.FRAMEBUFFER,ve.__webglMultisampledFramebuffer);for(let ot=0;ot<Ne.length;ot++){let Ae=Ne[ot];ve.__webglColorRenderbuffer[ot]=e.createRenderbuffer(),e.bindRenderbuffer(e.RENDERBUFFER,ve.__webglColorRenderbuffer[ot]);let Q=a.convert(Ae.format,Ae.colorSpace),G=a.convert(Ae.type),W=x(Ae.internalFormat,Q,G,Ae.colorSpace,te.isXRRenderTarget===!0),re=Ke(te);e.renderbufferStorageMultisample(e.RENDERBUFFER,re,W,te.width,te.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0+ot,e.RENDERBUFFER,ve.__webglColorRenderbuffer[ot])}e.bindRenderbuffer(e.RENDERBUFFER,null),te.depthBuffer&&(ve.__webglDepthRenderbuffer=e.createRenderbuffer(),_e(ve.__webglDepthRenderbuffer,te,!0)),r.bindFramebuffer(e.FRAMEBUFFER,null)}}if(Ue){r.bindTexture(e.TEXTURE_CUBE_MAP,je.__webglTexture),le(e.TEXTURE_CUBE_MAP,K);for(let ot=0;ot<6;ot++)if(K.mipmaps&&K.mipmaps.length>0)for(let Ae=0;Ae<K.mipmaps.length;Ae++)be(ve.__webglFramebuffer[ot][Ae],te,K,e.COLOR_ATTACHMENT0,e.TEXTURE_CUBE_MAP_POSITIVE_X+ot,Ae);else be(ve.__webglFramebuffer[ot],te,K,e.COLOR_ATTACHMENT0,e.TEXTURE_CUBE_MAP_POSITIVE_X+ot,0);g(K)&&v(e.TEXTURE_CUBE_MAP),r.unbindTexture()}else if(ft){for(let ot=0,Ae=Ne.length;ot<Ae;ot++){let Q=Ne[ot],G=i.get(Q);r.bindTexture(e.TEXTURE_2D,G.__webglTexture),le(e.TEXTURE_2D,Q),be(ve.__webglFramebuffer,te,Q,e.COLOR_ATTACHMENT0+ot,e.TEXTURE_2D,0),g(Q)&&v(e.TEXTURE_2D)}r.unbindTexture()}else{let ot=e.TEXTURE_2D;if((te.isWebGL3DRenderTarget||te.isWebGLArrayRenderTarget)&&(ot=te.isWebGL3DRenderTarget?e.TEXTURE_3D:e.TEXTURE_2D_ARRAY),r.bindTexture(ot,je.__webglTexture),le(ot,K),K.mipmaps&&K.mipmaps.length>0)for(let Ae=0;Ae<K.mipmaps.length;Ae++)be(ve.__webglFramebuffer[Ae],te,K,e.COLOR_ATTACHMENT0,ot,Ae);else be(ve.__webglFramebuffer,te,K,e.COLOR_ATTACHMENT0,ot,0);g(K)&&v(ot),r.unbindTexture()}te.depthBuffer&&Ye(te)}function Ce(te){let K=te.textures;for(let ve=0,je=K.length;ve<je;ve++){let Ne=K[ve];if(g(Ne)){let Ue=_(te),ft=i.get(Ne).__webglTexture;r.bindTexture(Ue,ft),v(Ue),r.unbindTexture()}}}let oe=[],it=[];function Oe(te){if(te.samples>0){if(Le(te)===!1){let K=te.textures,ve=te.width,je=te.height,Ne=e.COLOR_BUFFER_BIT,Ue=te.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,ft=i.get(te),ot=K.length>1;if(ot)for(let Ae=0;Ae<K.length;Ae++)r.bindFramebuffer(e.FRAMEBUFFER,ft.__webglMultisampledFramebuffer),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0+Ae,e.RENDERBUFFER,null),r.bindFramebuffer(e.FRAMEBUFFER,ft.__webglFramebuffer),e.framebufferTexture2D(e.DRAW_FRAMEBUFFER,e.COLOR_ATTACHMENT0+Ae,e.TEXTURE_2D,null,0);r.bindFramebuffer(e.READ_FRAMEBUFFER,ft.__webglMultisampledFramebuffer),r.bindFramebuffer(e.DRAW_FRAMEBUFFER,ft.__webglFramebuffer);for(let Ae=0;Ae<K.length;Ae++){if(te.resolveDepthBuffer&&(te.depthBuffer&&(Ne|=e.DEPTH_BUFFER_BIT),te.stencilBuffer&&te.resolveStencilBuffer&&(Ne|=e.STENCIL_BUFFER_BIT)),ot){e.framebufferRenderbuffer(e.READ_FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.RENDERBUFFER,ft.__webglColorRenderbuffer[Ae]);let Q=i.get(K[Ae]).__webglTexture;e.framebufferTexture2D(e.DRAW_FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,Q,0)}e.blitFramebuffer(0,0,ve,je,0,0,ve,je,Ne,e.NEAREST),l===!0&&(oe.length=0,it.length=0,oe.push(e.COLOR_ATTACHMENT0+Ae),te.depthBuffer&&te.resolveDepthBuffer===!1&&(oe.push(Ue),it.push(Ue),e.invalidateFramebuffer(e.DRAW_FRAMEBUFFER,it)),e.invalidateFramebuffer(e.READ_FRAMEBUFFER,oe))}if(r.bindFramebuffer(e.READ_FRAMEBUFFER,null),r.bindFramebuffer(e.DRAW_FRAMEBUFFER,null),ot)for(let Ae=0;Ae<K.length;Ae++){r.bindFramebuffer(e.FRAMEBUFFER,ft.__webglMultisampledFramebuffer),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0+Ae,e.RENDERBUFFER,ft.__webglColorRenderbuffer[Ae]);let Q=i.get(K[Ae]).__webglTexture;r.bindFramebuffer(e.FRAMEBUFFER,ft.__webglFramebuffer),e.framebufferTexture2D(e.DRAW_FRAMEBUFFER,e.COLOR_ATTACHMENT0+Ae,e.TEXTURE_2D,Q,0)}r.bindFramebuffer(e.DRAW_FRAMEBUFFER,ft.__webglMultisampledFramebuffer)}else if(te.depthBuffer&&te.resolveDepthBuffer===!1&&l){let K=te.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT;e.invalidateFramebuffer(e.DRAW_FRAMEBUFFER,[K])}}}function Ke(te){return Math.min(n.maxSamples,te.samples)}function Le(te){let K=i.get(te);return te.samples>0&&t.has("WEBGL_multisampled_render_to_texture")===!0&&K.__useRenderToTexture!==!1}function Ze(te){let K=o.render.frame;c.get(te)!==K&&(c.set(te,K),te.update())}function ut(te,K){let ve=te.colorSpace,je=te.format,Ne=te.type;return te.isCompressedTexture===!0||te.isVideoTexture===!0||ve!==Na&&ve!==Tu&&(Ai.getTransfer(ve)===rn?(je!==Xn||Ne!==Ss)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",ve)),K}function et(te){return typeof HTMLImageElement<"u"&&te instanceof HTMLImageElement?(u.width=te.naturalWidth||te.width,u.height=te.naturalHeight||te.height):typeof VideoFrame<"u"&&te instanceof VideoFrame?(u.width=te.displayWidth,u.height=te.displayHeight):(u.width=te.width,u.height=te.height),u}this.allocateTextureUnit=F,this.resetTextureUnits=R,this.setTexture2D=z,this.setTexture2DArray=O,this.setTexture3D=j,this.setTextureCube=Y,this.rebindTextures=We,this.setupRenderTarget=Me,this.updateRenderTargetMipmap=Ce,this.updateMultisampleRenderTarget=Oe,this.setupDepthRenderbuffer=Ye,this.setupFrameBufferTexture=be,this.useMultisampledRTT=Le}function uve(e,t){function r(i,n=Tu){let a,o=Ai.getTransfer(n);if(i===Ss)return e.UNSIGNED_BYTE;if(i===pk)return e.UNSIGNED_SHORT_4_4_4_4;if(i===fk)return e.UNSIGNED_SHORT_5_5_5_1;if(i===JG)return e.UNSIGNED_INT_5_9_9_9_REV;if(i===ZG)return e.BYTE;if(i===XG)return e.SHORT;if(i===uf)return e.UNSIGNED_SHORT;if(i===dk)return e.INT;if(i===ud)return e.UNSIGNED_INT;if(i===Po)return e.FLOAT;if(i===vv)return e.HALF_FLOAT;if(i===KG)return e.ALPHA;if(i===qG)return e.RGB;if(i===Xn)return e.RGBA;if(i===$G)return e.LUMINANCE;if(i===eV)return e.LUMINANCE_ALPHA;if(i===Pm)return e.DEPTH_COMPONENT;if(i===Om)return e.DEPTH_STENCIL;if(i===Ak)return e.RED;if(i===vE)return e.RED_INTEGER;if(i===tV)return e.RG;if(i===mk)return e.RG_INTEGER;if(i===gk)return e.RGBA_INTEGER;if(i===iE||i===nE||i===aE||i===oE)if(o===rn)if(a=t.get("WEBGL_compressed_texture_s3tc_srgb"),a!==null){if(i===iE)return a.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(i===nE)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(i===aE)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(i===oE)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(a=t.get("WEBGL_compressed_texture_s3tc"),a!==null){if(i===iE)return a.COMPRESSED_RGB_S3TC_DXT1_EXT;if(i===nE)return a.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(i===aE)return a.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(i===oE)return a.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(i===D3||i===k3||i===R3||i===F3)if(a=t.get("WEBGL_compressed_texture_pvrtc"),a!==null){if(i===D3)return a.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(i===k3)return a.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(i===R3)return a.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(i===F3)return a.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(i===z3||i===L3||i===O3)if(a=t.get("WEBGL_compressed_texture_etc"),a!==null){if(i===z3||i===L3)return o===rn?a.COMPRESSED_SRGB8_ETC2:a.COMPRESSED_RGB8_ETC2;if(i===O3)return o===rn?a.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:a.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(i===N3||i===U3||i===Q3||i===j3||i===G3||i===V3||i===Y3||i===H3||i===W3||i===Z3||i===X3||i===J3||i===K3||i===q3)if(a=t.get("WEBGL_compressed_texture_astc"),a!==null){if(i===N3)return o===rn?a.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:a.COMPRESSED_RGBA_ASTC_4x4_KHR;if(i===U3)return o===rn?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:a.COMPRESSED_RGBA_ASTC_5x4_KHR;if(i===Q3)return o===rn?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:a.COMPRESSED_RGBA_ASTC_5x5_KHR;if(i===j3)return o===rn?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:a.COMPRESSED_RGBA_ASTC_6x5_KHR;if(i===G3)return o===rn?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:a.COMPRESSED_RGBA_ASTC_6x6_KHR;if(i===V3)return o===rn?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:a.COMPRESSED_RGBA_ASTC_8x5_KHR;if(i===Y3)return o===rn?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:a.COMPRESSED_RGBA_ASTC_8x6_KHR;if(i===H3)return o===rn?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:a.COMPRESSED_RGBA_ASTC_8x8_KHR;if(i===W3)return o===rn?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:a.COMPRESSED_RGBA_ASTC_10x5_KHR;if(i===Z3)return o===rn?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:a.COMPRESSED_RGBA_ASTC_10x6_KHR;if(i===X3)return o===rn?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:a.COMPRESSED_RGBA_ASTC_10x8_KHR;if(i===J3)return o===rn?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:a.COMPRESSED_RGBA_ASTC_10x10_KHR;if(i===K3)return o===rn?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:a.COMPRESSED_RGBA_ASTC_12x10_KHR;if(i===q3)return o===rn?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:a.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(i===sE||i===$3||i===ek)if(a=t.get("EXT_texture_compression_bptc"),a!==null){if(i===sE)return o===rn?a.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:a.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(i===$3)return a.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(i===ek)return a.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(i===rV||i===tk||i===rk||i===ik)if(a=t.get("EXT_texture_compression_rgtc"),a!==null){if(i===sE)return a.COMPRESSED_RED_RGTC1_EXT;if(i===tk)return a.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(i===rk)return a.COMPRESSED_RED_GREEN_RGTC2_EXT;if(i===ik)return a.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return i===Lm?e.UNSIGNED_INT_24_8:e[i]!==void 0?e[i]:null}return{convert:r}}function Ave(e,t){function r(g,v){g.matrixAutoUpdate===!0&&g.updateMatrix(),v.value.copy(g.matrix)}function i(g,v){v.color.getRGB(g.fogColor.value,vV(e)),v.isFog?(g.fogNear.value=v.near,g.fogFar.value=v.far):v.isFogExp2&&(g.fogDensity.value=v.density)}function n(g,v,_,x,b){v.isMeshBasicMaterial||v.isMeshLambertMaterial?a(g,v):v.isMeshToonMaterial?(a(g,v),h(g,v)):v.isMeshPhongMaterial?(a(g,v),c(g,v)):v.isMeshStandardMaterial?(a(g,v),d(g,v),v.isMeshPhysicalMaterial&&p(g,v,b)):v.isMeshMatcapMaterial?(a(g,v),f(g,v)):v.isMeshDepthMaterial?a(g,v):v.isMeshDistanceMaterial?(a(g,v),m(g,v)):v.isMeshNormalMaterial?a(g,v):v.isLineBasicMaterial?(o(g,v),v.isLineDashedMaterial&&s(g,v)):v.isPointsMaterial?l(g,v,_,x):v.isSpriteMaterial?u(g,v):v.isShadowMaterial?(g.color.value.copy(v.color),g.opacity.value=v.opacity):v.isShaderMaterial&&(v.uniformsNeedUpdate=!1)}function a(g,v){g.opacity.value=v.opacity,v.color&&g.diffuse.value.copy(v.color),v.emissive&&g.emissive.value.copy(v.emissive).multiplyScalar(v.emissiveIntensity),v.map&&(g.map.value=v.map,r(v.map,g.mapTransform)),v.alphaMap&&(g.alphaMap.value=v.alphaMap,r(v.alphaMap,g.alphaMapTransform)),v.bumpMap&&(g.bumpMap.value=v.bumpMap,r(v.bumpMap,g.bumpMapTransform),g.bumpScale.value=v.bumpScale,v.side===La&&(g.bumpScale.value*=-1)),v.normalMap&&(g.normalMap.value=v.normalMap,r(v.normalMap,g.normalMapTransform),g.normalScale.value.copy(v.normalScale),v.side===La&&g.normalScale.value.negate()),v.displacementMap&&(g.displacementMap.value=v.displacementMap,r(v.displacementMap,g.displacementMapTransform),g.displacementScale.value=v.displacementScale,g.displacementBias.value=v.displacementBias),v.emissiveMap&&(g.emissiveMap.value=v.emissiveMap,r(v.emissiveMap,g.emissiveMapTransform)),v.specularMap&&(g.specularMap.value=v.specularMap,r(v.specularMap,g.specularMapTransform)),v.alphaTest>0&&(g.alphaTest.value=v.alphaTest);let _=t.get(v),x=_.envMap,b=_.envMapRotation;x&&(g.envMap.value=x,rf.copy(b),rf.x*=-1,rf.y*=-1,rf.z*=-1,x.isCubeTexture&&x.isRenderTargetTexture===!1&&(rf.y*=-1,rf.z*=-1),g.envMapRotation.value.setFromMatrix4(fve.makeRotationFromEuler(rf)),g.flipEnvMap.value=x.isCubeTexture&&x.isRenderTargetTexture===!1?-1:1,g.reflectivity.value=v.reflectivity,g.ior.value=v.ior,g.refractionRatio.value=v.refractionRatio),v.lightMap&&(g.lightMap.value=v.lightMap,g.lightMapIntensity.value=v.lightMapIntensity,r(v.lightMap,g.lightMapTransform)),v.aoMap&&(g.aoMap.value=v.aoMap,g.aoMapIntensity.value=v.aoMapIntensity,r(v.aoMap,g.aoMapTransform))}function o(g,v){g.diffuse.value.copy(v.color),g.opacity.value=v.opacity,v.map&&(g.map.value=v.map,r(v.map,g.mapTransform))}function s(g,v){g.dashSize.value=v.dashSize,g.totalSize.value=v.dashSize+v.gapSize,g.scale.value=v.scale}function l(g,v,_,x){g.diffuse.value.copy(v.color),g.opacity.value=v.opacity,g.size.value=v.size*_,g.scale.value=x*.5,v.map&&(g.map.value=v.map,r(v.map,g.uvTransform)),v.alphaMap&&(g.alphaMap.value=v.alphaMap,r(v.alphaMap,g.alphaMapTransform)),v.alphaTest>0&&(g.alphaTest.value=v.alphaTest)}function u(g,v){g.diffuse.value.copy(v.color),g.opacity.value=v.opacity,g.rotation.value=v.rotation,v.map&&(g.map.value=v.map,r(v.map,g.mapTransform)),v.alphaMap&&(g.alphaMap.value=v.alphaMap,r(v.alphaMap,g.alphaMapTransform)),v.alphaTest>0&&(g.alphaTest.value=v.alphaTest)}function c(g,v){g.specular.value.copy(v.specular),g.shininess.value=Math.max(v.shininess,1e-4)}function h(g,v){v.gradientMap&&(g.gradientMap.value=v.gradientMap)}function d(g,v){g.metalness.value=v.metalness,v.metalnessMap&&(g.metalnessMap.value=v.metalnessMap,r(v.metalnessMap,g.metalnessMapTransform)),g.roughness.value=v.roughness,v.roughnessMap&&(g.roughnessMap.value=v.roughnessMap,r(v.roughnessMap,g.roughnessMapTransform)),v.envMap&&(g.envMapIntensity.value=v.envMapIntensity)}function p(g,v,_){g.ior.value=v.ior,v.sheen>0&&(g.sheenColor.value.copy(v.sheenColor).multiplyScalar(v.sheen),g.sheenRoughness.value=v.sheenRoughness,v.sheenColorMap&&(g.sheenColorMap.value=v.sheenColorMap,r(v.sheenColorMap,g.sheenColorMapTransform)),v.sheenRoughnessMap&&(g.sheenRoughnessMap.value=v.sheenRoughnessMap,r(v.sheenRoughnessMap,g.sheenRoughnessMapTransform))),v.clearcoat>0&&(g.clearcoat.value=v.clearcoat,g.clearcoatRoughness.value=v.clearcoatRoughness,v.clearcoatMap&&(g.clearcoatMap.value=v.clearcoatMap,r(v.clearcoatMap,g.clearcoatMapTransform)),v.clearcoatRoughnessMap&&(g.clearcoatRoughnessMap.value=v.clearcoatRoughnessMap,r(v.clearcoatRoughnessMap,g.clearcoatRoughnessMapTransform)),v.clearcoatNormalMap&&(g.clearcoatNormalMap.value=v.clearcoatNormalMap,r(v.clearcoatNormalMap,g.clearcoatNormalMapTransform),g.clearcoatNormalScale.value.copy(v.clearcoatNormalScale),v.side===La&&g.clearcoatNormalScale.value.negate())),v.dispersion>0&&(g.dispersion.value=v.dispersion),v.iridescence>0&&(g.iridescence.value=v.iridescence,g.iridescenceIOR.value=v.iridescenceIOR,g.iridescenceThicknessMinimum.value=v.iridescenceThicknessRange[0],g.iridescenceThicknessMaximum.value=v.iridescenceThicknessRange[1],v.iridescenceMap&&(g.iridescenceMap.value=v.iridescenceMap,r(v.iridescenceMap,g.iridescenceMapTransform)),v.iridescenceThicknessMap&&(g.iridescenceThicknessMap.value=v.iridescenceThicknessMap,r(v.iridescenceThicknessMap,g.iridescenceThicknessMapTransform))),v.transmission>0&&(g.transmission.value=v.transmission,g.transmissionSamplerMap.value=_.texture,g.transmissionSamplerSize.value.set(_.width,_.height),v.transmissionMap&&(g.transmissionMap.value=v.transmissionMap,r(v.transmissionMap,g.transmissionMapTransform)),g.thickness.value=v.thickness,v.thicknessMap&&(g.thicknessMap.value=v.thicknessMap,r(v.thicknessMap,g.thicknessMapTransform)),g.attenuationDistance.value=v.attenuationDistance,g.attenuationColor.value.copy(v.attenuationColor)),v.anisotropy>0&&(g.anisotropyVector.value.set(v.anisotropy*Math.cos(v.anisotropyRotation),v.anisotropy*Math.sin(v.anisotropyRotation)),v.anisotropyMap&&(g.anisotropyMap.value=v.anisotropyMap,r(v.anisotropyMap,g.anisotropyMapTransform))),g.specularIntensity.value=v.specularIntensity,g.specularColor.value.copy(v.specularColor),v.specularColorMap&&(g.specularColorMap.value=v.specularColorMap,r(v.specularColorMap,g.specularColorMapTransform)),v.specularIntensityMap&&(g.specularIntensityMap.value=v.specularIntensityMap,r(v.specularIntensityMap,g.specularIntensityMapTransform))}function f(g,v){v.matcap&&(g.matcap.value=v.matcap)}function m(g,v){let _=t.get(v).light;g.referencePosition.value.setFromMatrixPosition(_.matrixWorld),g.nearDistance.value=_.shadow.camera.near,g.farDistance.value=_.shadow.camera.far}return{refreshFogUniforms:i,refreshMaterialUniforms:n}}function mve(e,t,r,i){let n={},a={},o=[],s=e.getParameter(e.MAX_UNIFORM_BUFFER_BINDINGS);function l(_,x){let b=x.program;i.uniformBlockBinding(_,b)}function u(_,x){let b=n[_.id];b===void 0&&(f(_),b=c(_),n[_.id]=b,_.addEventListener("dispose",g));let E=x.program;i.updateUBOMapping(_,E);let M=t.render.frame;a[_.id]!==M&&(d(_),a[_.id]=M)}function c(_){let x=h();_.__bindingPointIndex=x;let b=e.createBuffer(),E=_.__size,M=_.usage;return e.bindBuffer(e.UNIFORM_BUFFER,b),e.bufferData(e.UNIFORM_BUFFER,E,M),e.bindBuffer(e.UNIFORM_BUFFER,null),e.bindBufferBase(e.UNIFORM_BUFFER,x,b),b}function h(){for(let _=0;_<s;_++)if(o.indexOf(_)===-1)return o.push(_),_;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function d(_){let x=n[_.id],b=_.uniforms,E=_.__cache;e.bindBuffer(e.UNIFORM_BUFFER,x);for(let M=0,S=b.length;M<S;M++){let D=Array.isArray(b[M])?b[M]:[b[M]];for(let T=0,P=D.length;T<P;T++){let k=D[T];if(p(k,M,T,E)===!0){let R=k.__offset,F=Array.isArray(k.value)?k.value:[k.value],B=0;for(let z=0;z<F.length;z++){let O=F[z],j=m(O);typeof O=="number"||typeof O=="boolean"?(k.__data[0]=O,e.bufferSubData(e.UNIFORM_BUFFER,R+B,k.__data)):O.isMatrix3?(k.__data[0]=O.elements[0],k.__data[1]=O.elements[1],k.__data[2]=O.elements[2],k.__data[3]=0,k.__data[4]=O.elements[3],k.__data[5]=O.elements[4],k.__data[6]=O.elements[5],k.__data[7]=0,k.__data[8]=O.elements[6],k.__data[9]=O.elements[7],k.__data[10]=O.elements[8],k.__data[11]=0):(O.toArray(k.__data,B),B+=j.storage/Float32Array.BYTES_PER_ELEMENT)}e.bufferSubData(e.UNIFORM_BUFFER,R,k.__data)}}}e.bindBuffer(e.UNIFORM_BUFFER,null)}function p(_,x,b,E){let M=_.value,S=x+"_"+b;if(E[S]===void 0)return typeof M=="number"||typeof M=="boolean"?E[S]=M:E[S]=M.clone(),!0;{let D=E[S];if(typeof M=="number"||typeof M=="boolean"){if(D!==M)return E[S]=M,!0}else if(D.equals(M)===!1)return D.copy(M),!0}return!1}function f(_){let x=_.uniforms,b=0,E=16;for(let S=0,D=x.length;S<D;S++){let T=Array.isArray(x[S])?x[S]:[x[S]];for(let P=0,k=T.length;P<k;P++){let R=T[P],F=Array.isArray(R.value)?R.value:[R.value];for(let B=0,z=F.length;B<z;B++){let O=F[B],j=m(O),Y=b%E,Z=Y%j.boundary,ne=Y+Z;b+=Z,ne!==0&&E-ne<j.storage&&(b+=E-ne),R.__data=new Float32Array(j.storage/Float32Array.BYTES_PER_ELEMENT),R.__offset=b,b+=j.storage}}}let M=b%E;return M>0&&(b+=E-M),_.__size=b,_.__cache={},this}function m(_){let x={boundary:0,storage:0};return typeof _=="number"||typeof _=="boolean"?(x.boundary=4,x.storage=4):_.isVector2?(x.boundary=8,x.storage=8):_.isVector3||_.isColor?(x.boundary=16,x.storage=12):_.isVector4?(x.boundary=16,x.storage=16):_.isMatrix3?(x.boundary=48,x.storage=48):_.isMatrix4?(x.boundary=64,x.storage=64):_.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",_),x}function g(_){let x=_.target;x.removeEventListener("dispose",g);let b=o.indexOf(x.__bindingPointIndex);o.splice(b,1),e.deleteBuffer(n[x.id]),delete n[x.id],delete a[x.id]}function v(){for(let _ in n)e.deleteBuffer(n[_]);o=[],n={},a={}}return{bind:l,update:u,dispose:v}}var Fi,H,gE,Zde,b9,Xde,HG,Jde,Kc,mo,La,kn,Du,Tm,w9,E9,M9,Kde,af,qde,$de,epe,tpe,rpe,ipe,npe,ape,b3,w3,ope,spe,lpe,upe,cpe,hpe,dpe,ppe,fpe,E3,M3,S3,Rm,I3,C3,B3,T3,hk,Ape,mpe,ld,gpe,ype,vpe,xpe,_pe,bpe,wpe,S9,Epe,WG,Fm,zm,pv,P3,yE,wa,Ll,lf,Oa,yv,od,Rn,sf,el,Ss,ZG,XG,uf,dk,ud,Po,vv,pk,fk,Lm,JG,KG,qG,Xn,$G,eV,Pm,Om,Ak,vE,tV,mk,gk,iE,nE,aE,oE,D3,k3,R3,F3,z3,L3,O3,N3,U3,Q3,j3,G3,V3,Y3,H3,W3,Z3,X3,J3,K3,q3,sE,$3,ek,rV,tk,rk,ik,cd,hd,FD,I9,C9,B9,Mpe,iV,xE,xv,Spe,_v,yk,Ipe,Tu,Zi,Na,hE,rn,Zn,ku,_E,bE,nV,Gm,Nm,Cpe,Bpe,Tpe,aV,Ppe,Dpe,kpe,Rpe,nk,oV,dE,Pu,pE,Vm,po,T9,Dm,Um,Zr,vt,Wr,zD,P9,D9,k9,Ai,cm,rfe,ife,wE,nfe,ia,wi,afe,Ol,hV,ofe,Sa,fe,OD,R9,Ei,Yc,kl,_w,hm,dm,pm,ed,td,Xp,ev,bw,ww,Jp,sfe,tv,UD,ba,Hc,QD,Ew,rd,jD,Mw,GD,bv,er,fm,Rl,lfe,ufe,id,Sw,Es,F9,z9,Ua,xk,cfe,L9,Am,Wc,Iw,rv,hfe,dfe,O9,N9,U9,Q9,pfe,mm,VD,mi,Fl,Zc,YD,Xc,gm,ym,j9,HD,WD,ZD,XD,JD,KD,Mm,fV,nd,Cw,Dt,fo,ffe,es,Fn,ha,Bw,Afe,qr,AV,mV,nn,mfe,$s,$D,vm,Ms,iv,Fa,xn,G9,Kp,Tw,V9,Pw,Dw,kw,e3,Rw,Y9,Fw,Sr,th,_k,vfe,xfe,go,wv,ad,H9,W9,za,xm,_m,_fe,xV,bfe,tl,wfe,t3,pd,_V,Bo,bV,Z9,X9,J9,Efe,K9,Lw,r3,q9,i3,EV,bk,eh,$9,Mfe,MV,jm,bm,eG,Ow,tG,Sfe,nv,av,An,n3,Ife,Cfe,qc,qp,Nw,fd,Pfe,$o,Dfe,o3,Uw,$p,ov,rG,kfe,s3,Ao,Qw,Ev,Ad,fE,AE,iG,sv,jw,l3,nG,EE,aG,oG,md,IV,wk,sG,ok,Vw,Yw,CV,ME,BV,SE,il,Ek,Ffe,Hw,u3,c3,h3,Sk,TV,Gfe,PV,Vfe,DV,kV,RV,mE,Yfe,dd,Ww,Zw,d3,Xw,FV,pf,Hfe,p3,Ym,uAe,Qa,Ik,GV,gd,Nl,Ru,Mv,Ck,Hm,pAe,fAe,AAe,Fu,Wm,HV,hf,mAe,ff,Zm,df,WV,sd,vAe,xAe,Af,Jc,_Ae,Bk,bAe,Sv,CE,f3,fG,AG,Tk,wAe,ZV,mG,lv,A3,EAe,XV,mf,MAe,Iv,JV,Xm,KV,qV,SAe,$V,Pk,IAe,Dk,CAe,BAe,TAe,PAe,DAe,kAe,RAe,FAe,Wi,u$e,yG,Cv,xG,kk,$w,Wn,eY,tY,OAe,NAe,UAe,QAe,jAe,GAe,VAe,YAe,HAe,WAe,ZAe,XAe,JAe,KAe,qAe,$Ae,eme,tme,rme,ime,nme,ame,ome,sme,lme,ume,cme,hme,dme,pme,fme,Ame,mme,gme,yme,vme,xme,_me,bme,wme,Eme,Mme,Sme,Ime,Cme,Bme,Tme,Pme,Dme,kme,Rme,Fme,zme,Lme,Ome,Nme,Ume,Qme,jme,Gme,Vme,Yme,Hme,Wme,Zme,Xme,Jme,Kme,qme,$me,ege,tge,rge,ige,nge,age,oge,sge,lge,uge,cge,hge,dge,pge,fge,Age,mge,gge,yge,vge,xge,_ge,bge,wge,Ege,Mge,Sge,Ige,Cge,Bge,Tge,Pge,Dge,kge,Rge,Fge,zge,Lge,Oge,Nge,Uge,Qge,jge,Gge,Vge,Yge,Hge,Wge,Zge,Xge,Jge,Kge,qge,$ge,eye,tye,rye,iye,nye,aye,oye,sye,lye,uye,cye,hye,dye,pye,fye,Aye,mye,jr,Kt,Bu,eE,tf,gye,Bm,bG,of,m3,wG,g3,y3,v3,x3,nf,wm,EG,MG,iY,BG,nY,aY,oY,TG,PG,DG,kG,RG,v0e,x0e,_0e,_3,cE,w0e,E0e,LG,rE,k0e,R0e,z0e,V0e,Y0e,H0e,$0e,ive,nve,ove,cve,hve,dve,pve,rf,fve,sY,nl=Ot(()=>{"use strict";ws();H=x9(()=>{Fi={env:{NODE_ENV:"production",npm_package_version:"6.17.1"}}});H();gE={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},Zde=0,b9=1,Xde=2,HG=1,Jde=2,Kc=3,mo=0,La=1,kn=2,Du=0,Tm=1,w9=2,E9=3,M9=4,Kde=5,af=100,qde=101,$de=102,epe=103,tpe=104,rpe=200,ipe=201,npe=202,ape=203,b3=204,w3=205,ope=206,spe=207,lpe=208,upe=209,cpe=210,hpe=211,dpe=212,ppe=213,fpe=214,E3=0,M3=1,S3=2,Rm=3,I3=4,C3=5,B3=6,T3=7,hk=0,Ape=1,mpe=2,ld=0,gpe=1,ype=2,vpe=3,xpe=4,_pe=5,bpe=6,wpe=7,S9="attached",Epe="detached",WG=300,Fm=301,zm=302,pv=303,P3=304,yE=306,wa=1e3,Ll=1001,lf=1002,Oa=1003,yv=1004,od=1005,Rn=1006,sf=1007,el=1008,Ss=1009,ZG=1010,XG=1011,uf=1012,dk=1013,ud=1014,Po=1015,vv=1016,pk=1017,fk=1018,Lm=1020,JG=35902,KG=1021,qG=1022,Xn=1023,$G=1024,eV=1025,Pm=1026,Om=1027,Ak=1028,vE=1029,tV=1030,mk=1031,gk=1033,iE=33776,nE=33777,aE=33778,oE=33779,D3=35840,k3=35841,R3=35842,F3=35843,z3=36196,L3=37492,O3=37496,N3=37808,U3=37809,Q3=37810,j3=37811,G3=37812,V3=37813,Y3=37814,H3=37815,W3=37816,Z3=37817,X3=37818,J3=37819,K3=37820,q3=37821,sE=36492,$3=36494,ek=36495,rV=36283,tk=36284,rk=36285,ik=36286,cd=2300,hd=2301,FD=2302,I9=2400,C9=2401,B9=2402,Mpe=2500,iV=0,xE=1,xv=2,Spe=3200,_v=3201,yk=0,Ipe=1,Tu="",Zi="srgb",Na="srgb-linear",hE="linear",rn="srgb",Zn=7680,ku=7681,_E=34055,bE=34056,nV=514,Gm=517,Nm=519,Cpe=512,Bpe=513,Tpe=514,aV=515,Ppe=516,Dpe=517,kpe=518,Rpe=519,nk=35044,oV=35048,dE="300 es",Pu=2e3,pE=2001,Vm=class{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});let r=this._listeners;r[e]===void 0&&(r[e]=[]),r[e].indexOf(t)===-1&&r[e].push(t)}hasEventListener(e,t){let r=this._listeners;return r===void 0?!1:r[e]!==void 0&&r[e].indexOf(t)!==-1}removeEventListener(e,t){let r=this._listeners;if(r===void 0)return;let i=r[e];if(i!==void 0){let n=i.indexOf(t);n!==-1&&i.splice(n,1)}}dispatchEvent(e){let t=this._listeners;if(t===void 0)return;let r=t[e.type];if(r!==void 0){e.target=this;let i=r.slice(0);for(let n=0,a=i.length;n<a;n++)i[n].call(this,e);e.target=null}}},po=["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"],T9=1234567,Dm=Math.PI/180,Um=180/Math.PI;Zr={DEG2RAD:Dm,RAD2DEG:Um,generateUUID:rl,clamp:li,euclideanModulo:vk,mapLinear:Fpe,inverseLerp:zpe,lerp:cv,damp:Lpe,pingpong:Ope,smoothstep:Npe,smootherstep:Upe,randInt:Qpe,randFloat:jpe,randFloatSpread:Gpe,seededRandom:Vpe,degToRad:Ype,radToDeg:Hpe,isPowerOfTwo:Wpe,ceilPowerOfTwo:Zpe,floorPowerOfTwo:Xpe,setQuaternionFromProperEuler:Jpe,normalize:Hi,denormalize:zl},vt=class sV{constructor(t=0,r=0){sV.prototype.isVector2=!0,this.x=t,this.y=r}get width(){return this.x}set width(t){this.x=t}get height(){return this.y}set height(t){this.y=t}set(t,r){return this.x=t,this.y=r,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,r){switch(t){case 0:this.x=r;break;case 1:this.y=r;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,r){return this.x=t.x+r.x,this.y=t.y+r.y,this}addScaledVector(t,r){return this.x+=t.x*r,this.y+=t.y*r,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,r){return this.x=t.x-r.x,this.y=t.y-r.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 r=this.x,i=this.y,n=t.elements;return this.x=n[0]*r+n[3]*i+n[6],this.y=n[1]*r+n[4]*i+n[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,r){return this.x=li(this.x,t.x,r.x),this.y=li(this.y,t.y,r.y),this}clampScalar(t,r){return this.x=li(this.x,t,r),this.y=li(this.y,t,r),this}clampLength(t,r){let i=this.length();return this.divideScalar(i||1).multiplyScalar(li(i,t,r))}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 r=Math.sqrt(this.lengthSq()*t.lengthSq());if(r===0)return Math.PI/2;let i=this.dot(t)/r;return Math.acos(li(i,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){let r=this.x-t.x,i=this.y-t.y;return r*r+i*i}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,r){return this.x+=(t.x-this.x)*r,this.y+=(t.y-this.y)*r,this}lerpVectors(t,r,i){return this.x=t.x+(r.x-t.x)*i,this.y=t.y+(r.y-t.y)*i,this}equals(t){return t.x===this.x&&t.y===this.y}fromArray(t,r=0){return this.x=t[r],this.y=t[r+1],this}toArray(t=[],r=0){return t[r]=this.x,t[r+1]=this.y,t}fromBufferAttribute(t,r){return this.x=t.getX(r),this.y=t.getY(r),this}rotateAround(t,r){let i=Math.cos(r),n=Math.sin(r),a=this.x-t.x,o=this.y-t.y;return this.x=a*i-o*n+t.x,this.y=a*n+o*i+t.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}},Wr=class lV{constructor(t,r,i,n,a,o,s,l,u){lV.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],t!==void 0&&this.set(t,r,i,n,a,o,s,l,u)}set(t,r,i,n,a,o,s,l,u){let c=this.elements;return c[0]=t,c[1]=n,c[2]=s,c[3]=r,c[4]=a,c[5]=l,c[6]=i,c[7]=o,c[8]=u,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(t){let r=this.elements,i=t.elements;return r[0]=i[0],r[1]=i[1],r[2]=i[2],r[3]=i[3],r[4]=i[4],r[5]=i[5],r[6]=i[6],r[7]=i[7],r[8]=i[8],this}extractBasis(t,r,i){return t.setFromMatrix3Column(this,0),r.setFromMatrix3Column(this,1),i.setFromMatrix3Column(this,2),this}setFromMatrix4(t){let r=t.elements;return this.set(r[0],r[4],r[8],r[1],r[5],r[9],r[2],r[6],r[10]),this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,r){let i=t.elements,n=r.elements,a=this.elements,o=i[0],s=i[3],l=i[6],u=i[1],c=i[4],h=i[7],d=i[2],p=i[5],f=i[8],m=n[0],g=n[3],v=n[6],_=n[1],x=n[4],b=n[7],E=n[2],M=n[5],S=n[8];return a[0]=o*m+s*_+l*E,a[3]=o*g+s*x+l*M,a[6]=o*v+s*b+l*S,a[1]=u*m+c*_+h*E,a[4]=u*g+c*x+h*M,a[7]=u*v+c*b+h*S,a[2]=d*m+p*_+f*E,a[5]=d*g+p*x+f*M,a[8]=d*v+p*b+f*S,this}multiplyScalar(t){let r=this.elements;return r[0]*=t,r[3]*=t,r[6]*=t,r[1]*=t,r[4]*=t,r[7]*=t,r[2]*=t,r[5]*=t,r[8]*=t,this}determinant(){let t=this.elements,r=t[0],i=t[1],n=t[2],a=t[3],o=t[4],s=t[5],l=t[6],u=t[7],c=t[8];return r*o*c-r*s*u-i*a*c+i*s*l+n*a*u-n*o*l}invert(){let t=this.elements,r=t[0],i=t[1],n=t[2],a=t[3],o=t[4],s=t[5],l=t[6],u=t[7],c=t[8],h=c*o-s*u,d=s*l-c*a,p=u*a-o*l,f=r*h+i*d+n*p;if(f===0)return this.set(0,0,0,0,0,0,0,0,0);let m=1/f;return t[0]=h*m,t[1]=(n*u-c*i)*m,t[2]=(s*i-n*o)*m,t[3]=d*m,t[4]=(c*r-n*l)*m,t[5]=(n*a-s*r)*m,t[6]=p*m,t[7]=(i*l-u*r)*m,t[8]=(o*r-i*a)*m,this}transpose(){let t,r=this.elements;return t=r[1],r[1]=r[3],r[3]=t,t=r[2],r[2]=r[6],r[6]=t,t=r[5],r[5]=r[7],r[7]=t,this}getNormalMatrix(t){return this.setFromMatrix4(t).invert().transpose()}transposeIntoArray(t){let r=this.elements;return t[0]=r[0],t[1]=r[3],t[2]=r[6],t[3]=r[1],t[4]=r[4],t[5]=r[7],t[6]=r[2],t[7]=r[5],t[8]=r[8],this}setUvTransform(t,r,i,n,a,o,s){let l=Math.cos(a),u=Math.sin(a);return this.set(i*l,i*u,-i*(l*o+u*s)+o+t,-n*u,n*l,-n*(-u*o+l*s)+s+r,0,0,1),this}scale(t,r){return this.premultiply(zD.makeScale(t,r)),this}rotate(t){return this.premultiply(zD.makeRotation(-t)),this}translate(t,r){return this.premultiply(zD.makeTranslation(t,r)),this}makeTranslation(t,r){return t.isVector2?this.set(1,0,t.x,0,1,t.y,0,0,1):this.set(1,0,t,0,1,r,0,0,1),this}makeRotation(t){let r=Math.cos(t),i=Math.sin(t);return this.set(r,-i,0,i,r,0,0,0,1),this}makeScale(t,r){return this.set(t,0,0,0,r,0,0,0,1),this}equals(t){let r=this.elements,i=t.elements;for(let n=0;n<9;n++)if(r[n]!==i[n])return!1;return!0}fromArray(t,r=0){for(let i=0;i<9;i++)this.elements[i]=t[i+r];return this}toArray(t=[],r=0){let i=this.elements;return t[r]=i[0],t[r+1]=i[1],t[r+2]=i[2],t[r+3]=i[3],t[r+4]=i[4],t[r+5]=i[5],t[r+6]=i[6],t[r+7]=i[7],t[r+8]=i[8],t}clone(){return new this.constructor().fromArray(this.elements)}},zD=new Wr;P9={};D9=new Wr().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),k9=new Wr().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);Ai=tfe();rfe=class{static getDataURL(e){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let t;if(e instanceof HTMLCanvasElement)t=e;else{cm===void 0&&(cm=fv("canvas")),cm.width=e.width,cm.height=e.height;let r=cm.getContext("2d");e instanceof ImageData?r.putImageData(e,0,0):r.drawImage(e,0,0,e.width,e.height),t=cm}return t.toDataURL("image/png")}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){let t=fv("canvas");t.width=e.width,t.height=e.height;let r=t.getContext("2d");r.drawImage(e,0,0,e.width,e.height);let i=r.getImageData(0,0,e.width,e.height),n=i.data;for(let a=0;a<n.length;a++)n[a]=$c(n[a]/255)*255;return r.putImageData(i,0,0),t}else if(e.data){let t=e.data.slice(0);for(let r=0;r<t.length;r++)t instanceof Uint8Array||t instanceof Uint8ClampedArray?t[r]=Math.floor($c(t[r]/255)*255):t[r]=$c(t[r]);return{data:t,width:e.width,height:e.height}}else return console.warn("THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}},ife=0,wE=class{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:ife++}),this.uuid=rl(),this.data=e,this.dataReady=!0,this.version=0}set needsUpdate(e){e===!0&&this.version++}toJSON(e){let t=e===void 0||typeof e=="string";if(!t&&e.images[this.uuid]!==void 0)return e.images[this.uuid];let r={uuid:this.uuid,url:""},i=this.data;if(i!==null){let n;if(Array.isArray(i)){n=[];for(let a=0,o=i.length;a<o;a++)i[a].isDataTexture?n.push(LD(i[a].image)):n.push(LD(i[a]))}else n=LD(i);r.url=n}return t||(e.images[this.uuid]=r),r}};nfe=0,ia=class lE extends Vm{constructor(t=lE.DEFAULT_IMAGE,r=lE.DEFAULT_MAPPING,i=Ll,n=Ll,a=Rn,o=el,s=Xn,l=Ss,u=lE.DEFAULT_ANISOTROPY,c=Tu){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:nfe++}),this.uuid=rl(),this.name="",this.source=new wE(t),this.mipmaps=[],this.mapping=r,this.channel=0,this.wrapS=i,this.wrapT=n,this.magFilter=a,this.minFilter=o,this.anisotropy=u,this.format=s,this.internalFormat=null,this.type=l,this.offset=new vt(0,0),this.repeat=new vt(1,1),this.center=new vt(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Wr,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=c,this.userData={},this.version=0,this.onUpdate=null,this.renderTarget=null,this.isRenderTargetTexture=!1,this.pmremVersion=0}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.renderTarget=t.renderTarget,this.isRenderTargetTexture=t.isRenderTargetTexture,this.userData=JSON.parse(JSON.stringify(t.userData)),this.needsUpdate=!0,this}toJSON(t){let r=t===void 0||typeof t=="string";if(!r&&t.textures[this.uuid]!==void 0)return t.textures[this.uuid];let i={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&&(i.userData=this.userData),r||(t.textures[this.uuid]=i),i}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(t){if(this.mapping!==WG)return t;if(t.applyMatrix3(this.matrix),t.x<0||t.x>1)switch(this.wrapS){case wa:t.x=t.x-Math.floor(t.x);break;case Ll:t.x=t.x<0?0:1;break;case lf: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 wa:t.y=t.y-Math.floor(t.y);break;case Ll:t.y=t.y<0?0:1;break;case lf: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)}set needsPMREMUpdate(t){t===!0&&this.pmremVersion++}};ia.DEFAULT_IMAGE=null;ia.DEFAULT_MAPPING=WG;ia.DEFAULT_ANISOTROPY=1;wi=class cV{constructor(t=0,r=0,i=0,n=1){cV.prototype.isVector4=!0,this.x=t,this.y=r,this.z=i,this.w=n}get width(){return this.z}set width(t){this.z=t}get height(){return this.w}set height(t){this.w=t}set(t,r,i,n){return this.x=t,this.y=r,this.z=i,this.w=n,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,r){switch(t){case 0:this.x=r;break;case 1:this.y=r;break;case 2:this.z=r;break;case 3:this.w=r;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,r){return this.x=t.x+r.x,this.y=t.y+r.y,this.z=t.z+r.z,this.w=t.w+r.w,this}addScaledVector(t,r){return this.x+=t.x*r,this.y+=t.y*r,this.z+=t.z*r,this.w+=t.w*r,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,r){return this.x=t.x-r.x,this.y=t.y-r.y,this.z=t.z-r.z,this.w=t.w-r.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 r=this.x,i=this.y,n=this.z,a=this.w,o=t.elements;return this.x=o[0]*r+o[4]*i+o[8]*n+o[12]*a,this.y=o[1]*r+o[5]*i+o[9]*n+o[13]*a,this.z=o[2]*r+o[6]*i+o[10]*n+o[14]*a,this.w=o[3]*r+o[7]*i+o[11]*n+o[15]*a,this}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this.w/=t.w,this}divideScalar(t){return this.multiplyScalar(1/t)}setAxisAngleFromQuaternion(t){this.w=2*Math.acos(t.w);let r=Math.sqrt(1-t.w*t.w);return r<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=t.x/r,this.y=t.y/r,this.z=t.z/r),this}setAxisAngleFromRotationMatrix(t){let r,i,n,a,o=t.elements,s=o[0],l=o[4],u=o[8],c=o[1],h=o[5],d=o[9],p=o[2],f=o[6],m=o[10];if(Math.abs(l-c)<.01&&Math.abs(u-p)<.01&&Math.abs(d-f)<.01){if(Math.abs(l+c)<.1&&Math.abs(u+p)<.1&&Math.abs(d+f)<.1&&Math.abs(s+h+m-3)<.1)return this.set(1,0,0,0),this;r=Math.PI;let v=(s+1)/2,_=(h+1)/2,x=(m+1)/2,b=(l+c)/4,E=(u+p)/4,M=(d+f)/4;return v>_&&v>x?v<.01?(i=0,n=.707106781,a=.707106781):(i=Math.sqrt(v),n=b/i,a=E/i):_>x?_<.01?(i=.707106781,n=0,a=.707106781):(n=Math.sqrt(_),i=b/n,a=M/n):x<.01?(i=.707106781,n=.707106781,a=0):(a=Math.sqrt(x),i=E/a,n=M/a),this.set(i,n,a,r),this}let g=Math.sqrt((f-d)*(f-d)+(u-p)*(u-p)+(c-l)*(c-l));return Math.abs(g)<.001&&(g=1),this.x=(f-d)/g,this.y=(u-p)/g,this.z=(c-l)/g,this.w=Math.acos((s+h+m-1)/2),this}setFromMatrixPosition(t){let r=t.elements;return this.x=r[12],this.y=r[13],this.z=r[14],this.w=r[15],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,r){return this.x=li(this.x,t.x,r.x),this.y=li(this.y,t.y,r.y),this.z=li(this.z,t.z,r.z),this.w=li(this.w,t.w,r.w),this}clampScalar(t,r){return this.x=li(this.x,t,r),this.y=li(this.y,t,r),this.z=li(this.z,t,r),this.w=li(this.w,t,r),this}clampLength(t,r){let i=this.length();return this.divideScalar(i||1).multiplyScalar(li(i,t,r))}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,r){return this.x+=(t.x-this.x)*r,this.y+=(t.y-this.y)*r,this.z+=(t.z-this.z)*r,this.w+=(t.w-this.w)*r,this}lerpVectors(t,r,i){return this.x=t.x+(r.x-t.x)*i,this.y=t.y+(r.y-t.y)*i,this.z=t.z+(r.z-t.z)*i,this.w=t.w+(r.w-t.w)*i,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w}fromArray(t,r=0){return this.x=t[r],this.y=t[r+1],this.z=t[r+2],this.w=t[r+3],this}toArray(t=[],r=0){return t[r]=this.x,t[r+1]=this.y,t[r+2]=this.z,t[r+3]=this.w,t}fromBufferAttribute(t,r){return this.x=t.getX(r),this.y=t.getY(r),this.z=t.getZ(r),this.w=t.getW(r),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}},afe=class extends Vm{constructor(e=1,t=1,r={}){super(),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=1,this.scissor=new wi(0,0,e,t),this.scissorTest=!1,this.viewport=new wi(0,0,e,t);let i={width:e,height:t,depth:1};r=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:Rn,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1},r);let n=new ia(i,r.mapping,r.wrapS,r.wrapT,r.magFilter,r.minFilter,r.format,r.type,r.anisotropy,r.colorSpace);n.flipY=!1,n.generateMipmaps=r.generateMipmaps,n.internalFormat=r.internalFormat,this.textures=[];let a=r.count;for(let o=0;o<a;o++)this.textures[o]=n.clone(),this.textures[o].isRenderTargetTexture=!0,this.textures[o].renderTarget=this;this.depthBuffer=r.depthBuffer,this.stencilBuffer=r.stencilBuffer,this.resolveDepthBuffer=r.resolveDepthBuffer,this.resolveStencilBuffer=r.resolveStencilBuffer,this._depthTexture=null,this.depthTexture=r.depthTexture,this.samples=r.samples}get texture(){return this.textures[0]}set texture(e){this.textures[0]=e}set depthTexture(e){this._depthTexture!==null&&(this._depthTexture.renderTarget=null),e!==null&&(e.renderTarget=this),this._depthTexture=e}get depthTexture(){return this._depthTexture}setSize(e,t,r=1){if(this.width!==e||this.height!==t||this.depth!==r){this.width=e,this.height=t,this.depth=r;for(let i=0,n=this.textures.length;i<n;i++)this.textures[i].image.width=e,this.textures[i].image.height=t,this.textures[i].image.depth=r;this.dispose()}this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.textures.length=0;for(let r=0,i=e.textures.length;r<i;r++)this.textures[r]=e.textures[r].clone(),this.textures[r].isRenderTargetTexture=!0,this.textures[r].renderTarget=this;let t=Object.assign({},e.texture.image);return this.texture.source=new wE(t),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.resolveDepthBuffer=e.resolveDepthBuffer,this.resolveStencilBuffer=e.resolveStencilBuffer,e.depthTexture!==null&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}},Ol=class extends afe{constructor(e=1,t=1,r={}){super(e,t,r),this.isWebGLRenderTarget=!0}},hV=class extends ia{constructor(e=null,t=1,r=1,i=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:r,depth:i},this.magFilter=Oa,this.minFilter=Oa,this.wrapR=Ll,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}},ofe=class extends ia{constructor(e=null,t=1,r=1,i=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:r,depth:i},this.magFilter=Oa,this.minFilter=Oa,this.wrapR=Ll,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}},Sa=class{constructor(e=0,t=0,r=0,i=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=r,this._w=i}static slerpFlat(e,t,r,i,n,a,o){let s=r[i+0],l=r[i+1],u=r[i+2],c=r[i+3],h=n[a+0],d=n[a+1],p=n[a+2],f=n[a+3];if(o===0){e[t+0]=s,e[t+1]=l,e[t+2]=u,e[t+3]=c;return}if(o===1){e[t+0]=h,e[t+1]=d,e[t+2]=p,e[t+3]=f;return}if(c!==f||s!==h||l!==d||u!==p){let m=1-o,g=s*h+l*d+u*p+c*f,v=g>=0?1:-1,_=1-g*g;if(_>Number.EPSILON){let b=Math.sqrt(_),E=Math.atan2(b,g*v);m=Math.sin(m*E)/b,o=Math.sin(o*E)/b}let x=o*v;if(s=s*m+h*x,l=l*m+d*x,u=u*m+p*x,c=c*m+f*x,m===1-o){let b=1/Math.sqrt(s*s+l*l+u*u+c*c);s*=b,l*=b,u*=b,c*=b}}e[t]=s,e[t+1]=l,e[t+2]=u,e[t+3]=c}static multiplyQuaternionsFlat(e,t,r,i,n,a){let o=r[i],s=r[i+1],l=r[i+2],u=r[i+3],c=n[a],h=n[a+1],d=n[a+2],p=n[a+3];return e[t]=o*p+u*c+s*d-l*h,e[t+1]=s*p+u*h+l*c-o*d,e[t+2]=l*p+u*d+o*h-s*c,e[t+3]=u*p-o*c-s*h-l*d,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,r,i){return this._x=e,this._y=t,this._z=r,this._w=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){let r=e._x,i=e._y,n=e._z,a=e._order,o=Math.cos,s=Math.sin,l=o(r/2),u=o(i/2),c=o(n/2),h=s(r/2),d=s(i/2),p=s(n/2);switch(a){case"XYZ":this._x=h*u*c+l*d*p,this._y=l*d*c-h*u*p,this._z=l*u*p+h*d*c,this._w=l*u*c-h*d*p;break;case"YXZ":this._x=h*u*c+l*d*p,this._y=l*d*c-h*u*p,this._z=l*u*p-h*d*c,this._w=l*u*c+h*d*p;break;case"ZXY":this._x=h*u*c-l*d*p,this._y=l*d*c+h*u*p,this._z=l*u*p+h*d*c,this._w=l*u*c-h*d*p;break;case"ZYX":this._x=h*u*c-l*d*p,this._y=l*d*c+h*u*p,this._z=l*u*p-h*d*c,this._w=l*u*c+h*d*p;break;case"YZX":this._x=h*u*c+l*d*p,this._y=l*d*c+h*u*p,this._z=l*u*p-h*d*c,this._w=l*u*c-h*d*p;break;case"XZY":this._x=h*u*c-l*d*p,this._y=l*d*c-h*u*p,this._z=l*u*p+h*d*c,this._w=l*u*c+h*d*p;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+a)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){let r=t/2,i=Math.sin(r);return this._x=e.x*i,this._y=e.y*i,this._z=e.z*i,this._w=Math.cos(r),this._onChangeCallback(),this}setFromRotationMatrix(e){let t=e.elements,r=t[0],i=t[4],n=t[8],a=t[1],o=t[5],s=t[9],l=t[2],u=t[6],c=t[10],h=r+o+c;if(h>0){let d=.5/Math.sqrt(h+1);this._w=.25/d,this._x=(u-s)*d,this._y=(n-l)*d,this._z=(a-i)*d}else if(r>o&&r>c){let d=2*Math.sqrt(1+r-o-c);this._w=(u-s)/d,this._x=.25*d,this._y=(i+a)/d,this._z=(n+l)/d}else if(o>c){let d=2*Math.sqrt(1+o-r-c);this._w=(n-l)/d,this._x=(i+a)/d,this._y=.25*d,this._z=(s+u)/d}else{let d=2*Math.sqrt(1+c-r-o);this._w=(a-i)/d,this._x=(n+l)/d,this._y=(s+u)/d,this._z=.25*d}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let r=e.dot(t)+1;return r<Number.EPSILON?(r=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=r):(this._x=0,this._y=-e.z,this._z=e.y,this._w=r)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=r),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(li(this.dot(e),-1,1)))}rotateTowards(e,t){let r=this.angleTo(e);if(r===0)return this;let i=Math.min(1,t/r);return this.slerp(e,i),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){let r=e._x,i=e._y,n=e._z,a=e._w,o=t._x,s=t._y,l=t._z,u=t._w;return this._x=r*u+a*o+i*l-n*s,this._y=i*u+a*s+n*o-r*l,this._z=n*u+a*l+r*s-i*o,this._w=a*u-r*o-i*s-n*l,this._onChangeCallback(),this}slerp(e,t){if(t===0)return this;if(t===1)return this.copy(e);let r=this._x,i=this._y,n=this._z,a=this._w,o=a*e._w+r*e._x+i*e._y+n*e._z;if(o<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,o=-o):this.copy(e),o>=1)return this._w=a,this._x=r,this._y=i,this._z=n,this;let s=1-o*o;if(s<=Number.EPSILON){let d=1-t;return this._w=d*a+t*this._w,this._x=d*r+t*this._x,this._y=d*i+t*this._y,this._z=d*n+t*this._z,this.normalize(),this}let l=Math.sqrt(s),u=Math.atan2(l,o),c=Math.sin((1-t)*u)/l,h=Math.sin(t*u)/l;return this._w=a*c+this._w*h,this._x=r*c+this._x*h,this._y=i*c+this._y*h,this._z=n*c+this._z*h,this._onChangeCallback(),this}slerpQuaternions(e,t,r){return this.copy(e).slerp(t,r)}random(){let e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),r=Math.random(),i=Math.sqrt(1-r),n=Math.sqrt(r);return this.set(i*Math.sin(e),i*Math.cos(e),n*Math.sin(t),n*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}},fe=class dV{constructor(t=0,r=0,i=0){dV.prototype.isVector3=!0,this.x=t,this.y=r,this.z=i}set(t,r,i){return i===void 0&&(i=this.z),this.x=t,this.y=r,this.z=i,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,r){switch(t){case 0:this.x=r;break;case 1:this.y=r;break;case 2:this.z=r;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,r){return this.x=t.x+r.x,this.y=t.y+r.y,this.z=t.z+r.z,this}addScaledVector(t,r){return this.x+=t.x*r,this.y+=t.y*r,this.z+=t.z*r,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,r){return this.x=t.x-r.x,this.y=t.y-r.y,this.z=t.z-r.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,r){return this.x=t.x*r.x,this.y=t.y*r.y,this.z=t.z*r.z,this}applyEuler(t){return this.applyQuaternion(R9.setFromEuler(t))}applyAxisAngle(t,r){return this.applyQuaternion(R9.setFromAxisAngle(t,r))}applyMatrix3(t){let r=this.x,i=this.y,n=this.z,a=t.elements;return this.x=a[0]*r+a[3]*i+a[6]*n,this.y=a[1]*r+a[4]*i+a[7]*n,this.z=a[2]*r+a[5]*i+a[8]*n,this}applyNormalMatrix(t){return this.applyMatrix3(t).normalize()}applyMatrix4(t){let r=this.x,i=this.y,n=this.z,a=t.elements,o=1/(a[3]*r+a[7]*i+a[11]*n+a[15]);return this.x=(a[0]*r+a[4]*i+a[8]*n+a[12])*o,this.y=(a[1]*r+a[5]*i+a[9]*n+a[13])*o,this.z=(a[2]*r+a[6]*i+a[10]*n+a[14])*o,this}applyQuaternion(t){let r=this.x,i=this.y,n=this.z,a=t.x,o=t.y,s=t.z,l=t.w,u=2*(o*n-s*i),c=2*(s*r-a*n),h=2*(a*i-o*r);return this.x=r+l*u+o*h-s*c,this.y=i+l*c+s*u-a*h,this.z=n+l*h+a*c-o*u,this}project(t){return this.applyMatrix4(t.matrixWorldInverse).applyMatrix4(t.projectionMatrix)}unproject(t){return this.applyMatrix4(t.projectionMatrixInverse).applyMatrix4(t.matrixWorld)}transformDirection(t){let r=this.x,i=this.y,n=this.z,a=t.elements;return this.x=a[0]*r+a[4]*i+a[8]*n,this.y=a[1]*r+a[5]*i+a[9]*n,this.z=a[2]*r+a[6]*i+a[10]*n,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,r){return this.x=li(this.x,t.x,r.x),this.y=li(this.y,t.y,r.y),this.z=li(this.z,t.z,r.z),this}clampScalar(t,r){return this.x=li(this.x,t,r),this.y=li(this.y,t,r),this.z=li(this.z,t,r),this}clampLength(t,r){let i=this.length();return this.divideScalar(i||1).multiplyScalar(li(i,t,r))}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,r){return this.x+=(t.x-this.x)*r,this.y+=(t.y-this.y)*r,this.z+=(t.z-this.z)*r,this}lerpVectors(t,r,i){return this.x=t.x+(r.x-t.x)*i,this.y=t.y+(r.y-t.y)*i,this.z=t.z+(r.z-t.z)*i,this}cross(t){return this.crossVectors(this,t)}crossVectors(t,r){let i=t.x,n=t.y,a=t.z,o=r.x,s=r.y,l=r.z;return this.x=n*l-a*s,this.y=a*o-i*l,this.z=i*s-n*o,this}projectOnVector(t){let r=t.lengthSq();if(r===0)return this.set(0,0,0);let i=t.dot(this)/r;return this.copy(t).multiplyScalar(i)}projectOnPlane(t){return OD.copy(this).projectOnVector(t),this.sub(OD)}reflect(t){return this.sub(OD.copy(t).multiplyScalar(2*this.dot(t)))}angleTo(t){let r=Math.sqrt(this.lengthSq()*t.lengthSq());if(r===0)return Math.PI/2;let i=this.dot(t)/r;return Math.acos(li(i,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){let r=this.x-t.x,i=this.y-t.y,n=this.z-t.z;return r*r+i*i+n*n}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,r,i){let n=Math.sin(r)*t;return this.x=n*Math.sin(i),this.y=Math.cos(r)*t,this.z=n*Math.cos(i),this}setFromCylindrical(t){return this.setFromCylindricalCoords(t.radius,t.theta,t.y)}setFromCylindricalCoords(t,r,i){return this.x=t*Math.sin(r),this.y=i,this.z=t*Math.cos(r),this}setFromMatrixPosition(t){let r=t.elements;return this.x=r[12],this.y=r[13],this.z=r[14],this}setFromMatrixScale(t){let r=this.setFromMatrixColumn(t,0).length(),i=this.setFromMatrixColumn(t,1).length(),n=this.setFromMatrixColumn(t,2).length();return this.x=r,this.y=i,this.z=n,this}setFromMatrixColumn(t,r){return this.fromArray(t.elements,r*4)}setFromMatrix3Column(t,r){return this.fromArray(t.elements,r*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,r=0){return this.x=t[r],this.y=t[r+1],this.z=t[r+2],this}toArray(t=[],r=0){return t[r]=this.x,t[r+1]=this.y,t[r+2]=this.z,t}fromBufferAttribute(t,r){return this.x=t.getX(r),this.y=t.getY(r),this.z=t.getZ(r),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){let t=Math.random()*Math.PI*2,r=Math.random()*2-1,i=Math.sqrt(1-r*r);return this.x=i*Math.cos(t),this.y=r,this.z=i*Math.sin(t),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}},OD=new fe,R9=new Sa,Ei=class{constructor(e=new fe(1/0,1/0,1/0),t=new fe(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,r=e.length;t<r;t+=3)this.expandByPoint(kl.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,r=e.count;t<r;t++)this.expandByPoint(kl.fromBufferAttribute(e,t));return this}setFromPoints(e){this.makeEmpty();for(let t=0,r=e.length;t<r;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){let r=kl.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(r),this.max.copy(e).add(r),this}setFromObject(e,t=!1){return this.makeEmpty(),this.expandByObject(e,t)}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}expandByObject(e,t=!1){e.updateWorldMatrix(!1,!1);let r=e.geometry;if(r!==void 0){let n=r.getAttribute("position");if(t===!0&&n!==void 0&&e.isInstancedMesh!==!0)for(let a=0,o=n.count;a<o;a++)e.isMesh===!0?e.getVertexPosition(a,kl):kl.fromBufferAttribute(n,a),kl.applyMatrix4(e.matrixWorld),this.expandByPoint(kl);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),_w.copy(e.boundingBox)):(r.boundingBox===null&&r.computeBoundingBox(),_w.copy(r.boundingBox)),_w.applyMatrix4(e.matrixWorld),this.union(_w)}let i=e.children;for(let n=0,a=i.length;n<a;n++)this.expandByObject(i[n],t);return this}containsPoint(e){return e.x>=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y&&e.z>=this.min.z&&e.z<=this.max.z}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y&&e.max.z>=this.min.z&&e.min.z<=this.max.z}intersectsSphere(e){return this.clampPoint(e.center,kl),kl.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,r;return e.normal.x>0?(t=e.normal.x*this.min.x,r=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,r=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,r+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,r+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,r+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,r+=e.normal.z*this.min.z),t<=-e.constant&&r>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(ev),bw.subVectors(this.max,ev),hm.subVectors(e.a,ev),dm.subVectors(e.b,ev),pm.subVectors(e.c,ev),ed.subVectors(dm,hm),td.subVectors(pm,dm),Xp.subVectors(hm,pm);let t=[0,-ed.z,ed.y,0,-td.z,td.y,0,-Xp.z,Xp.y,ed.z,0,-ed.x,td.z,0,-td.x,Xp.z,0,-Xp.x,-ed.y,ed.x,0,-td.y,td.x,0,-Xp.y,Xp.x,0];return!ND(t,hm,dm,pm,bw)||(t=[1,0,0,0,1,0,0,0,1],!ND(t,hm,dm,pm,bw))?!1:(ww.crossVectors(ed,td),t=[ww.x,ww.y,ww.z],ND(t,hm,dm,pm,bw))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,kl).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(kl).length()*.5),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()?this:(Yc[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Yc[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Yc[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Yc[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Yc[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Yc[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Yc[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Yc[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Yc),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}},Yc=[new fe,new fe,new fe,new fe,new fe,new fe,new fe,new fe],kl=new fe,_w=new Ei,hm=new fe,dm=new fe,pm=new fe,ed=new fe,td=new fe,Xp=new fe,ev=new fe,bw=new fe,ww=new fe,Jp=new fe;sfe=new Ei,tv=new fe,UD=new fe,ba=class{constructor(e=new fe,t=-1){this.isSphere=!0,this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){let r=this.center;t!==void 0?r.copy(t):sfe.setFromPoints(e).getCenter(r);let i=0;for(let n=0,a=e.length;n<a;n++)i=Math.max(i,r.distanceToSquared(e[n]));return this.radius=Math.sqrt(i),this}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(e){return e.distanceTo(this.center)-this.radius}intersectsSphere(e){let t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t}intersectsBox(e){return e.intersectsSphere(this)}intersectsPlane(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}clampPoint(e,t){let r=this.center.distanceToSquared(e);return t.copy(e),r>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;tv.subVectors(e,this.center);let t=tv.lengthSq();if(t>this.radius*this.radius){let r=Math.sqrt(t),i=(r-this.radius)*.5;this.center.addScaledVector(tv,i/r),this.radius+=i}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):(UD.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(tv.copy(e.center).add(UD)),this.expandByPoint(tv.copy(e.center).sub(UD))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}},Hc=new fe,QD=new fe,Ew=new fe,rd=new fe,jD=new fe,Mw=new fe,GD=new fe,bv=class{constructor(e=new fe,t=new fe(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,Hc)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);let r=t.dot(this.direction);return r<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,r)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){let t=Hc.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(Hc.copy(this.origin).addScaledVector(this.direction,t),Hc.distanceToSquared(e))}distanceSqToSegment(e,t,r,i){QD.copy(e).add(t).multiplyScalar(.5),Ew.copy(t).sub(e).normalize(),rd.copy(this.origin).sub(QD);let n=e.distanceTo(t)*.5,a=-this.direction.dot(Ew),o=rd.dot(this.direction),s=-rd.dot(Ew),l=rd.lengthSq(),u=Math.abs(1-a*a),c,h,d,p;if(u>0)if(c=a*s-o,h=a*o-s,p=n*u,c>=0)if(h>=-p)if(h<=p){let f=1/u;c*=f,h*=f,d=c*(c+a*h+2*o)+h*(a*c+h+2*s)+l}else h=n,c=Math.max(0,-(a*h+o)),d=-c*c+h*(h+2*s)+l;else h=-n,c=Math.max(0,-(a*h+o)),d=-c*c+h*(h+2*s)+l;else h<=-p?(c=Math.max(0,-(-a*n+o)),h=c>0?-n:Math.min(Math.max(-n,-s),n),d=-c*c+h*(h+2*s)+l):h<=p?(c=0,h=Math.min(Math.max(-n,-s),n),d=h*(h+2*s)+l):(c=Math.max(0,-(a*n+o)),h=c>0?n:Math.min(Math.max(-n,-s),n),d=-c*c+h*(h+2*s)+l);else h=a>0?-n:n,c=Math.max(0,-(a*h+o)),d=-c*c+h*(h+2*s)+l;return r&&r.copy(this.origin).addScaledVector(this.direction,c),i&&i.copy(QD).addScaledVector(Ew,h),d}intersectSphere(e,t){Hc.subVectors(e.center,this.origin);let r=Hc.dot(this.direction),i=Hc.dot(Hc)-r*r,n=e.radius*e.radius;if(i>n)return null;let a=Math.sqrt(n-i),o=r-a,s=r+a;return s<0?null:o<0?this.at(s,t):this.at(o,t)}intersectsSphere(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){let t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;let r=-(this.origin.dot(e.normal)+e.constant)/t;return r>=0?r:null}intersectPlane(e,t){let r=this.distanceToPlane(e);return r===null?null:this.at(r,t)}intersectsPlane(e){let t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let r,i,n,a,o,s,l=1/this.direction.x,u=1/this.direction.y,c=1/this.direction.z,h=this.origin;return l>=0?(r=(e.min.x-h.x)*l,i=(e.max.x-h.x)*l):(r=(e.max.x-h.x)*l,i=(e.min.x-h.x)*l),u>=0?(n=(e.min.y-h.y)*u,a=(e.max.y-h.y)*u):(n=(e.max.y-h.y)*u,a=(e.min.y-h.y)*u),r>a||n>i||((n>r||isNaN(r))&&(r=n),(a<i||isNaN(i))&&(i=a),c>=0?(o=(e.min.z-h.z)*c,s=(e.max.z-h.z)*c):(o=(e.max.z-h.z)*c,s=(e.min.z-h.z)*c),r>s||o>i)||((o>r||r!==r)&&(r=o),(s<i||i!==i)&&(i=s),i<0)?null:this.at(r>=0?r:i,t)}intersectsBox(e){return this.intersectBox(e,Hc)!==null}intersectTriangle(e,t,r,i,n){jD.subVectors(t,e),Mw.subVectors(r,e),GD.crossVectors(jD,Mw);let a=this.direction.dot(GD),o;if(a>0){if(i)return null;o=1}else if(a<0)o=-1,a=-a;else return null;rd.subVectors(this.origin,e);let s=o*this.direction.dot(Mw.crossVectors(rd,Mw));if(s<0)return null;let l=o*this.direction.dot(jD.cross(rd));if(l<0||s+l>a)return null;let u=-o*rd.dot(GD);return u<0?null:this.at(u/a,n)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}},er=class ak{constructor(t,r,i,n,a,o,s,l,u,c,h,d,p,f,m,g){ak.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,r,i,n,a,o,s,l,u,c,h,d,p,f,m,g)}set(t,r,i,n,a,o,s,l,u,c,h,d,p,f,m,g){let v=this.elements;return v[0]=t,v[4]=r,v[8]=i,v[12]=n,v[1]=a,v[5]=o,v[9]=s,v[13]=l,v[2]=u,v[6]=c,v[10]=h,v[14]=d,v[3]=p,v[7]=f,v[11]=m,v[15]=g,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 ak().fromArray(this.elements)}copy(t){let r=this.elements,i=t.elements;return r[0]=i[0],r[1]=i[1],r[2]=i[2],r[3]=i[3],r[4]=i[4],r[5]=i[5],r[6]=i[6],r[7]=i[7],r[8]=i[8],r[9]=i[9],r[10]=i[10],r[11]=i[11],r[12]=i[12],r[13]=i[13],r[14]=i[14],r[15]=i[15],this}copyPosition(t){let r=this.elements,i=t.elements;return r[12]=i[12],r[13]=i[13],r[14]=i[14],this}setFromMatrix3(t){let r=t.elements;return this.set(r[0],r[3],r[6],0,r[1],r[4],r[7],0,r[2],r[5],r[8],0,0,0,0,1),this}extractBasis(t,r,i){return t.setFromMatrixColumn(this,0),r.setFromMatrixColumn(this,1),i.setFromMatrixColumn(this,2),this}makeBasis(t,r,i){return this.set(t.x,r.x,i.x,0,t.y,r.y,i.y,0,t.z,r.z,i.z,0,0,0,0,1),this}extractRotation(t){let r=this.elements,i=t.elements,n=1/fm.setFromMatrixColumn(t,0).length(),a=1/fm.setFromMatrixColumn(t,1).length(),o=1/fm.setFromMatrixColumn(t,2).length();return r[0]=i[0]*n,r[1]=i[1]*n,r[2]=i[2]*n,r[3]=0,r[4]=i[4]*a,r[5]=i[5]*a,r[6]=i[6]*a,r[7]=0,r[8]=i[8]*o,r[9]=i[9]*o,r[10]=i[10]*o,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,this}makeRotationFromEuler(t){let r=this.elements,i=t.x,n=t.y,a=t.z,o=Math.cos(i),s=Math.sin(i),l=Math.cos(n),u=Math.sin(n),c=Math.cos(a),h=Math.sin(a);if(t.order==="XYZ"){let d=o*c,p=o*h,f=s*c,m=s*h;r[0]=l*c,r[4]=-l*h,r[8]=u,r[1]=p+f*u,r[5]=d-m*u,r[9]=-s*l,r[2]=m-d*u,r[6]=f+p*u,r[10]=o*l}else if(t.order==="YXZ"){let d=l*c,p=l*h,f=u*c,m=u*h;r[0]=d+m*s,r[4]=f*s-p,r[8]=o*u,r[1]=o*h,r[5]=o*c,r[9]=-s,r[2]=p*s-f,r[6]=m+d*s,r[10]=o*l}else if(t.order==="ZXY"){let d=l*c,p=l*h,f=u*c,m=u*h;r[0]=d-m*s,r[4]=-o*h,r[8]=f+p*s,r[1]=p+f*s,r[5]=o*c,r[9]=m-d*s,r[2]=-o*u,r[6]=s,r[10]=o*l}else if(t.order==="ZYX"){let d=o*c,p=o*h,f=s*c,m=s*h;r[0]=l*c,r[4]=f*u-p,r[8]=d*u+m,r[1]=l*h,r[5]=m*u+d,r[9]=p*u-f,r[2]=-u,r[6]=s*l,r[10]=o*l}else if(t.order==="YZX"){let d=o*l,p=o*u,f=s*l,m=s*u;r[0]=l*c,r[4]=m-d*h,r[8]=f*h+p,r[1]=h,r[5]=o*c,r[9]=-s*c,r[2]=-u*c,r[6]=p*h+f,r[10]=d-m*h}else if(t.order==="XZY"){let d=o*l,p=o*u,f=s*l,m=s*u;r[0]=l*c,r[4]=-h,r[8]=u*c,r[1]=d*h+m,r[5]=o*c,r[9]=p*h-f,r[2]=f*h-p,r[6]=s*c,r[10]=m*h+d}return r[3]=0,r[7]=0,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,this}makeRotationFromQuaternion(t){return this.compose(lfe,t,ufe)}lookAt(t,r,i){let n=this.elements;return Es.subVectors(t,r),Es.lengthSq()===0&&(Es.z=1),Es.normalize(),id.crossVectors(i,Es),id.lengthSq()===0&&(Math.abs(i.z)===1?Es.x+=1e-4:Es.z+=1e-4,Es.normalize(),id.crossVectors(i,Es)),id.normalize(),Sw.crossVectors(Es,id),n[0]=id.x,n[4]=Sw.x,n[8]=Es.x,n[1]=id.y,n[5]=Sw.y,n[9]=Es.y,n[2]=id.z,n[6]=Sw.z,n[10]=Es.z,this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,r){let i=t.elements,n=r.elements,a=this.elements,o=i[0],s=i[4],l=i[8],u=i[12],c=i[1],h=i[5],d=i[9],p=i[13],f=i[2],m=i[6],g=i[10],v=i[14],_=i[3],x=i[7],b=i[11],E=i[15],M=n[0],S=n[4],D=n[8],T=n[12],P=n[1],k=n[5],R=n[9],F=n[13],B=n[2],z=n[6],O=n[10],j=n[14],Y=n[3],Z=n[7],ne=n[11],ie=n[15];return a[0]=o*M+s*P+l*B+u*Y,a[4]=o*S+s*k+l*z+u*Z,a[8]=o*D+s*R+l*O+u*ne,a[12]=o*T+s*F+l*j+u*ie,a[1]=c*M+h*P+d*B+p*Y,a[5]=c*S+h*k+d*z+p*Z,a[9]=c*D+h*R+d*O+p*ne,a[13]=c*T+h*F+d*j+p*ie,a[2]=f*M+m*P+g*B+v*Y,a[6]=f*S+m*k+g*z+v*Z,a[10]=f*D+m*R+g*O+v*ne,a[14]=f*T+m*F+g*j+v*ie,a[3]=_*M+x*P+b*B+E*Y,a[7]=_*S+x*k+b*z+E*Z,a[11]=_*D+x*R+b*O+E*ne,a[15]=_*T+x*F+b*j+E*ie,this}multiplyScalar(t){let r=this.elements;return r[0]*=t,r[4]*=t,r[8]*=t,r[12]*=t,r[1]*=t,r[5]*=t,r[9]*=t,r[13]*=t,r[2]*=t,r[6]*=t,r[10]*=t,r[14]*=t,r[3]*=t,r[7]*=t,r[11]*=t,r[15]*=t,this}determinant(){let t=this.elements,r=t[0],i=t[4],n=t[8],a=t[12],o=t[1],s=t[5],l=t[9],u=t[13],c=t[2],h=t[6],d=t[10],p=t[14],f=t[3],m=t[7],g=t[11],v=t[15];return f*(+a*l*h-n*u*h-a*s*d+i*u*d+n*s*p-i*l*p)+m*(+r*l*p-r*u*d+a*o*d-n*o*p+n*u*c-a*l*c)+g*(+r*u*h-r*s*p-a*o*h+i*o*p+a*s*c-i*u*c)+v*(-n*s*c-r*l*h+r*s*d+n*o*h-i*o*d+i*l*c)}transpose(){let t=this.elements,r;return r=t[1],t[1]=t[4],t[4]=r,r=t[2],t[2]=t[8],t[8]=r,r=t[6],t[6]=t[9],t[9]=r,r=t[3],t[3]=t[12],t[12]=r,r=t[7],t[7]=t[13],t[13]=r,r=t[11],t[11]=t[14],t[14]=r,this}setPosition(t,r,i){let n=this.elements;return t.isVector3?(n[12]=t.x,n[13]=t.y,n[14]=t.z):(n[12]=t,n[13]=r,n[14]=i),this}invert(){let t=this.elements,r=t[0],i=t[1],n=t[2],a=t[3],o=t[4],s=t[5],l=t[6],u=t[7],c=t[8],h=t[9],d=t[10],p=t[11],f=t[12],m=t[13],g=t[14],v=t[15],_=h*g*u-m*d*u+m*l*p-s*g*p-h*l*v+s*d*v,x=f*d*u-c*g*u-f*l*p+o*g*p+c*l*v-o*d*v,b=c*m*u-f*h*u+f*s*p-o*m*p-c*s*v+o*h*v,E=f*h*l-c*m*l-f*s*d+o*m*d+c*s*g-o*h*g,M=r*_+i*x+n*b+a*E;if(M===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);let S=1/M;return t[0]=_*S,t[1]=(m*d*a-h*g*a-m*n*p+i*g*p+h*n*v-i*d*v)*S,t[2]=(s*g*a-m*l*a+m*n*u-i*g*u-s*n*v+i*l*v)*S,t[3]=(h*l*a-s*d*a-h*n*u+i*d*u+s*n*p-i*l*p)*S,t[4]=x*S,t[5]=(c*g*a-f*d*a+f*n*p-r*g*p-c*n*v+r*d*v)*S,t[6]=(f*l*a-o*g*a-f*n*u+r*g*u+o*n*v-r*l*v)*S,t[7]=(o*d*a-c*l*a+c*n*u-r*d*u-o*n*p+r*l*p)*S,t[8]=b*S,t[9]=(f*h*a-c*m*a-f*i*p+r*m*p+c*i*v-r*h*v)*S,t[10]=(o*m*a-f*s*a+f*i*u-r*m*u-o*i*v+r*s*v)*S,t[11]=(c*s*a-o*h*a-c*i*u+r*h*u+o*i*p-r*s*p)*S,t[12]=E*S,t[13]=(c*m*n-f*h*n+f*i*d-r*m*d-c*i*g+r*h*g)*S,t[14]=(f*s*n-o*m*n-f*i*l+r*m*l+o*i*g-r*s*g)*S,t[15]=(o*h*n-c*s*n+c*i*l-r*h*l-o*i*d+r*s*d)*S,this}scale(t){let r=this.elements,i=t.x,n=t.y,a=t.z;return r[0]*=i,r[4]*=n,r[8]*=a,r[1]*=i,r[5]*=n,r[9]*=a,r[2]*=i,r[6]*=n,r[10]*=a,r[3]*=i,r[7]*=n,r[11]*=a,this}getMaxScaleOnAxis(){let t=this.elements,r=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],i=t[4]*t[4]+t[5]*t[5]+t[6]*t[6],n=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(r,i,n))}makeTranslation(t,r,i){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,r,0,0,1,i,0,0,0,1),this}makeRotationX(t){let r=Math.cos(t),i=Math.sin(t);return this.set(1,0,0,0,0,r,-i,0,0,i,r,0,0,0,0,1),this}makeRotationY(t){let r=Math.cos(t),i=Math.sin(t);return this.set(r,0,i,0,0,1,0,0,-i,0,r,0,0,0,0,1),this}makeRotationZ(t){let r=Math.cos(t),i=Math.sin(t);return this.set(r,-i,0,0,i,r,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(t,r){let i=Math.cos(r),n=Math.sin(r),a=1-i,o=t.x,s=t.y,l=t.z,u=a*o,c=a*s;return this.set(u*o+i,u*s-n*l,u*l+n*s,0,u*s+n*l,c*s+i,c*l-n*o,0,u*l-n*s,c*l+n*o,a*l*l+i,0,0,0,0,1),this}makeScale(t,r,i){return this.set(t,0,0,0,0,r,0,0,0,0,i,0,0,0,0,1),this}makeShear(t,r,i,n,a,o){return this.set(1,i,a,0,t,1,o,0,r,n,1,0,0,0,0,1),this}compose(t,r,i){let n=this.elements,a=r._x,o=r._y,s=r._z,l=r._w,u=a+a,c=o+o,h=s+s,d=a*u,p=a*c,f=a*h,m=o*c,g=o*h,v=s*h,_=l*u,x=l*c,b=l*h,E=i.x,M=i.y,S=i.z;return n[0]=(1-(m+v))*E,n[1]=(p+b)*E,n[2]=(f-x)*E,n[3]=0,n[4]=(p-b)*M,n[5]=(1-(d+v))*M,n[6]=(g+_)*M,n[7]=0,n[8]=(f+x)*S,n[9]=(g-_)*S,n[10]=(1-(d+m))*S,n[11]=0,n[12]=t.x,n[13]=t.y,n[14]=t.z,n[15]=1,this}decompose(t,r,i){let n=this.elements,a=fm.set(n[0],n[1],n[2]).length(),o=fm.set(n[4],n[5],n[6]).length(),s=fm.set(n[8],n[9],n[10]).length();this.determinant()<0&&(a=-a),t.x=n[12],t.y=n[13],t.z=n[14],Rl.copy(this);let l=1/a,u=1/o,c=1/s;return Rl.elements[0]*=l,Rl.elements[1]*=l,Rl.elements[2]*=l,Rl.elements[4]*=u,Rl.elements[5]*=u,Rl.elements[6]*=u,Rl.elements[8]*=c,Rl.elements[9]*=c,Rl.elements[10]*=c,r.setFromRotationMatrix(Rl),i.x=a,i.y=o,i.z=s,this}makePerspective(t,r,i,n,a,o,s=Pu){let l=this.elements,u=2*a/(r-t),c=2*a/(i-n),h=(r+t)/(r-t),d=(i+n)/(i-n),p,f;if(s===Pu)p=-(o+a)/(o-a),f=-2*o*a/(o-a);else if(s===pE)p=-o/(o-a),f=-o*a/(o-a);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+s);return l[0]=u,l[4]=0,l[8]=h,l[12]=0,l[1]=0,l[5]=c,l[9]=d,l[13]=0,l[2]=0,l[6]=0,l[10]=p,l[14]=f,l[3]=0,l[7]=0,l[11]=-1,l[15]=0,this}makeOrthographic(t,r,i,n,a,o,s=Pu){let l=this.elements,u=1/(r-t),c=1/(i-n),h=1/(o-a),d=(r+t)*u,p=(i+n)*c,f,m;if(s===Pu)f=(o+a)*h,m=-2*h;else if(s===pE)f=a*h,m=-1*h;else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+s);return l[0]=2*u,l[4]=0,l[8]=0,l[12]=-d,l[1]=0,l[5]=2*c,l[9]=0,l[13]=-p,l[2]=0,l[6]=0,l[10]=m,l[14]=-f,l[3]=0,l[7]=0,l[11]=0,l[15]=1,this}equals(t){let r=this.elements,i=t.elements;for(let n=0;n<16;n++)if(r[n]!==i[n])return!1;return!0}fromArray(t,r=0){for(let i=0;i<16;i++)this.elements[i]=t[i+r];return this}toArray(t=[],r=0){let i=this.elements;return t[r]=i[0],t[r+1]=i[1],t[r+2]=i[2],t[r+3]=i[3],t[r+4]=i[4],t[r+5]=i[5],t[r+6]=i[6],t[r+7]=i[7],t[r+8]=i[8],t[r+9]=i[9],t[r+10]=i[10],t[r+11]=i[11],t[r+12]=i[12],t[r+13]=i[13],t[r+14]=i[14],t[r+15]=i[15],t}},fm=new fe,Rl=new er,lfe=new fe(0,0,0),ufe=new fe(1,1,1),id=new fe,Sw=new fe,Es=new fe,F9=new er,z9=new Sa,Ua=class pV{constructor(t=0,r=0,i=0,n=pV.DEFAULT_ORDER){this.isEuler=!0,this._x=t,this._y=r,this._z=i,this._order=n}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,r,i,n=this._order){return this._x=t,this._y=r,this._z=i,this._order=n,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,r=this._order,i=!0){let n=t.elements,a=n[0],o=n[4],s=n[8],l=n[1],u=n[5],c=n[9],h=n[2],d=n[6],p=n[10];switch(r){case"XYZ":this._y=Math.asin(li(s,-1,1)),Math.abs(s)<.9999999?(this._x=Math.atan2(-c,p),this._z=Math.atan2(-o,a)):(this._x=Math.atan2(d,u),this._z=0);break;case"YXZ":this._x=Math.asin(-li(c,-1,1)),Math.abs(c)<.9999999?(this._y=Math.atan2(s,p),this._z=Math.atan2(l,u)):(this._y=Math.atan2(-h,a),this._z=0);break;case"ZXY":this._x=Math.asin(li(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(-h,p),this._z=Math.atan2(-o,u)):(this._y=0,this._z=Math.atan2(l,a));break;case"ZYX":this._y=Math.asin(-li(h,-1,1)),Math.abs(h)<.9999999?(this._x=Math.atan2(d,p),this._z=Math.atan2(l,a)):(this._x=0,this._z=Math.atan2(-o,u));break;case"YZX":this._z=Math.asin(li(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-c,u),this._y=Math.atan2(-h,a)):(this._x=0,this._y=Math.atan2(s,p));break;case"XZY":this._z=Math.asin(-li(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(d,u),this._y=Math.atan2(s,a)):(this._x=Math.atan2(-c,p),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+r)}return this._order=r,i===!0&&this._onChangeCallback(),this}setFromQuaternion(t,r,i){return F9.makeRotationFromQuaternion(t),this.setFromRotationMatrix(F9,r,i)}setFromVector3(t,r=this._order){return this.set(t.x,t.y,t.z,r)}reorder(t){return z9.setFromEuler(this),this.setFromQuaternion(z9,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=[],r=0){return t[r]=this._x,t[r+1]=this._y,t[r+2]=this._z,t[r+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}};Ua.DEFAULT_ORDER="XYZ";xk=class{constructor(){this.mask=1}set(e){this.mask=(1<<e|0)>>>0}enable(e){this.mask|=1<<e|0}enableAll(){this.mask=-1}toggle(e){this.mask^=1<<e|0}disable(e){this.mask&=~(1<<e|0)}disableAll(){this.mask=0}test(e){return(this.mask&e.mask)!==0}isEnabled(e){return(this.mask&(1<<e|0))!==0}},cfe=0,L9=new fe,Am=new Sa,Wc=new er,Iw=new fe,rv=new fe,hfe=new fe,dfe=new Sa,O9=new fe(1,0,0),N9=new fe(0,1,0),U9=new fe(0,0,1),Q9={type:"added"},pfe={type:"removed"},mm={type:"childadded",child:null},VD={type:"childremoved",child:null},mi=class uE extends Vm{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:cfe++}),this.uuid=rl(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=uE.DEFAULT_UP.clone();let t=new fe,r=new Ua,i=new Sa,n=new fe(1,1,1);function a(){i.setFromEuler(r,!1)}function o(){r.setFromQuaternion(i,void 0,!1)}r._onChange(a),i._onChange(o),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:t},rotation:{configurable:!0,enumerable:!0,value:r},quaternion:{configurable:!0,enumerable:!0,value:i},scale:{configurable:!0,enumerable:!0,value:n},modelViewMatrix:{value:new er},normalMatrix:{value:new Wr}}),this.matrix=new er,this.matrixWorld=new er,this.matrixAutoUpdate=uE.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=uE.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new xk,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.userData={}}onBeforeShadow(){}onAfterShadow(){}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,r){this.quaternion.setFromAxisAngle(t,r)}setRotationFromEuler(t){this.quaternion.setFromEuler(t,!0)}setRotationFromMatrix(t){this.quaternion.setFromRotationMatrix(t)}setRotationFromQuaternion(t){this.quaternion.copy(t)}rotateOnAxis(t,r){return Am.setFromAxisAngle(t,r),this.quaternion.multiply(Am),this}rotateOnWorldAxis(t,r){return Am.setFromAxisAngle(t,r),this.quaternion.premultiply(Am),this}rotateX(t){return this.rotateOnAxis(O9,t)}rotateY(t){return this.rotateOnAxis(N9,t)}rotateZ(t){return this.rotateOnAxis(U9,t)}translateOnAxis(t,r){return L9.copy(t).applyQuaternion(this.quaternion),this.position.add(L9.multiplyScalar(r)),this}translateX(t){return this.translateOnAxis(O9,t)}translateY(t){return this.translateOnAxis(N9,t)}translateZ(t){return this.translateOnAxis(U9,t)}localToWorld(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(this.matrixWorld)}worldToLocal(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(Wc.copy(this.matrixWorld).invert())}lookAt(t,r,i){t.isVector3?Iw.copy(t):Iw.set(t,r,i);let n=this.parent;this.updateWorldMatrix(!0,!1),rv.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?Wc.lookAt(rv,Iw,this.up):Wc.lookAt(Iw,rv,this.up),this.quaternion.setFromRotationMatrix(Wc),n&&(Wc.extractRotation(n.matrixWorld),Am.setFromRotationMatrix(Wc),this.quaternion.premultiply(Am.invert()))}add(t){if(arguments.length>1){for(let r=0;r<arguments.length;r++)this.add(arguments[r]);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.removeFromParent(),t.parent=this,this.children.push(t),t.dispatchEvent(Q9),mm.child=t,this.dispatchEvent(mm),mm.child=null):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",t),this)}remove(t){if(arguments.length>1){for(let i=0;i<arguments.length;i++)this.remove(arguments[i]);return this}let r=this.children.indexOf(t);return r!==-1&&(t.parent=null,this.children.splice(r,1),t.dispatchEvent(pfe),VD.child=t,this.dispatchEvent(VD),VD.child=null),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),Wc.copy(this.matrixWorld).invert(),t.parent!==null&&(t.parent.updateWorldMatrix(!0,!1),Wc.multiply(t.parent.matrixWorld)),t.applyMatrix4(Wc),t.removeFromParent(),t.parent=this,this.children.push(t),t.updateWorldMatrix(!1,!0),t.dispatchEvent(Q9),mm.child=t,this.dispatchEvent(mm),mm.child=null,this}getObjectById(t){return this.getObjectByProperty("id",t)}getObjectByName(t){return this.getObjectByProperty("name",t)}getObjectByProperty(t,r){if(this[t]===r)return this;for(let i=0,n=this.children.length;i<n;i++){let a=this.children[i].getObjectByProperty(t,r);if(a!==void 0)return a}}getObjectsByProperty(t,r,i=[]){this[t]===r&&i.push(this);let n=this.children;for(let a=0,o=n.length;a<o;a++)n[a].getObjectsByProperty(t,r,i);return i}getWorldPosition(t){return this.updateWorldMatrix(!0,!1),t.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(rv,t,hfe),t}getWorldScale(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(rv,dfe,t),t}getWorldDirection(t){this.updateWorldMatrix(!0,!1);let r=this.matrixWorld.elements;return t.set(r[8],r[9],r[10]).normalize()}raycast(){}traverse(t){t(this);let r=this.children;for(let i=0,n=r.length;i<n;i++)r[i].traverse(t)}traverseVisible(t){if(this.visible===!1)return;t(this);let r=this.children;for(let i=0,n=r.length;i<n;i++)r[i].traverseVisible(t)}traverseAncestors(t){let r=this.parent;r!==null&&(t(r),r.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.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,t=!0);let r=this.children;for(let i=0,n=r.length;i<n;i++)r[i].updateMatrixWorld(t)}updateWorldMatrix(t,r){let i=this.parent;if(t===!0&&i!==null&&i.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),r===!0){let n=this.children;for(let a=0,o=n.length;a<o;a++)n[a].updateWorldMatrix(!1,!0)}}toJSON(t){let r=t===void 0||typeof t=="string",i={};r&&(t={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},i.metadata={version:4.6,type:"Object",generator:"Object3D.toJSON"});let n={};n.uuid=this.uuid,n.type=this.type,this.name!==""&&(n.name=this.name),this.castShadow===!0&&(n.castShadow=!0),this.receiveShadow===!0&&(n.receiveShadow=!0),this.visible===!1&&(n.visible=!1),this.frustumCulled===!1&&(n.frustumCulled=!1),this.renderOrder!==0&&(n.renderOrder=this.renderOrder),Object.keys(this.userData).length>0&&(n.userData=this.userData),n.layers=this.layers.mask,n.matrix=this.matrix.toArray(),n.up=this.up.toArray(),this.matrixAutoUpdate===!1&&(n.matrixAutoUpdate=!1),this.isInstancedMesh&&(n.type="InstancedMesh",n.count=this.count,n.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(n.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(n.type="BatchedMesh",n.perObjectFrustumCulled=this.perObjectFrustumCulled,n.sortObjects=this.sortObjects,n.drawRanges=this._drawRanges,n.reservedRanges=this._reservedRanges,n.visibility=this._visibility,n.active=this._active,n.bounds=this._bounds.map(s=>({boxInitialized:s.boxInitialized,boxMin:s.box.min.toArray(),boxMax:s.box.max.toArray(),sphereInitialized:s.sphereInitialized,sphereRadius:s.sphere.radius,sphereCenter:s.sphere.center.toArray()})),n.maxInstanceCount=this._maxInstanceCount,n.maxVertexCount=this._maxVertexCount,n.maxIndexCount=this._maxIndexCount,n.geometryInitialized=this._geometryInitialized,n.geometryCount=this._geometryCount,n.matricesTexture=this._matricesTexture.toJSON(t),this._colorsTexture!==null&&(n.colorsTexture=this._colorsTexture.toJSON(t)),this.boundingSphere!==null&&(n.boundingSphere={center:n.boundingSphere.center.toArray(),radius:n.boundingSphere.radius}),this.boundingBox!==null&&(n.boundingBox={min:n.boundingBox.min.toArray(),max:n.boundingBox.max.toArray()}));function a(s,l){return s[l.uuid]===void 0&&(s[l.uuid]=l.toJSON(t)),l.uuid}if(this.isScene)this.background&&(this.background.isColor?n.background=this.background.toJSON():this.background.isTexture&&(n.background=this.background.toJSON(t).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(n.environment=this.environment.toJSON(t).uuid);else if(this.isMesh||this.isLine||this.isPoints){n.geometry=a(t.geometries,this.geometry);let s=this.geometry.parameters;if(s!==void 0&&s.shapes!==void 0){let l=s.shapes;if(Array.isArray(l))for(let u=0,c=l.length;u<c;u++){let h=l[u];a(t.shapes,h)}else a(t.shapes,l)}}if(this.isSkinnedMesh&&(n.bindMode=this.bindMode,n.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(a(t.skeletons,this.skeleton),n.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){let s=[];for(let l=0,u=this.material.length;l<u;l++)s.push(a(t.materials,this.material[l]));n.material=s}else n.material=a(t.materials,this.material);if(this.children.length>0){n.children=[];for(let s=0;s<this.children.length;s++)n.children.push(this.children[s].toJSON(t).object)}if(this.animations.length>0){n.animations=[];for(let s=0;s<this.animations.length;s++){let l=this.animations[s];n.animations.push(a(t.animations,l))}}if(r){let s=o(t.geometries),l=o(t.materials),u=o(t.textures),c=o(t.images),h=o(t.shapes),d=o(t.skeletons),p=o(t.animations),f=o(t.nodes);s.length>0&&(i.geometries=s),l.length>0&&(i.materials=l),u.length>0&&(i.textures=u),c.length>0&&(i.images=c),h.length>0&&(i.shapes=h),d.length>0&&(i.skeletons=d),p.length>0&&(i.animations=p),f.length>0&&(i.nodes=f)}return i.object=n,i;function o(s){let l=[];for(let u in s){let c=s[u];delete c.metadata,l.push(c)}return l}}clone(t){return new this.constructor().copy(this,t)}copy(t,r=!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.matrixWorldAutoUpdate=t.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,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)),r===!0)for(let i=0;i<t.children.length;i++){let n=t.children[i];this.add(n.clone())}return this}};mi.DEFAULT_UP=new fe(0,1,0);mi.DEFAULT_MATRIX_AUTO_UPDATE=!0;mi.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;Fl=new fe,Zc=new fe,YD=new fe,Xc=new fe,gm=new fe,ym=new fe,j9=new fe,HD=new fe,WD=new fe,ZD=new fe,XD=new wi,JD=new wi,KD=new wi,Mm=class Sm{constructor(t=new fe,r=new fe,i=new fe){this.a=t,this.b=r,this.c=i}static getNormal(t,r,i,n){n.subVectors(i,r),Fl.subVectors(t,r),n.cross(Fl);let a=n.lengthSq();return a>0?n.multiplyScalar(1/Math.sqrt(a)):n.set(0,0,0)}static getBarycoord(t,r,i,n,a){Fl.subVectors(n,r),Zc.subVectors(i,r),YD.subVectors(t,r);let o=Fl.dot(Fl),s=Fl.dot(Zc),l=Fl.dot(YD),u=Zc.dot(Zc),c=Zc.dot(YD),h=o*u-s*s;if(h===0)return a.set(0,0,0),null;let d=1/h,p=(u*l-s*c)*d,f=(o*c-s*l)*d;return a.set(1-p-f,f,p)}static containsPoint(t,r,i,n){return this.getBarycoord(t,r,i,n,Xc)===null?!1:Xc.x>=0&&Xc.y>=0&&Xc.x+Xc.y<=1}static getInterpolation(t,r,i,n,a,o,s,l){return this.getBarycoord(t,r,i,n,Xc)===null?(l.x=0,l.y=0,"z"in l&&(l.z=0),"w"in l&&(l.w=0),null):(l.setScalar(0),l.addScaledVector(a,Xc.x),l.addScaledVector(o,Xc.y),l.addScaledVector(s,Xc.z),l)}static getInterpolatedAttribute(t,r,i,n,a,o){return XD.setScalar(0),JD.setScalar(0),KD.setScalar(0),XD.fromBufferAttribute(t,r),JD.fromBufferAttribute(t,i),KD.fromBufferAttribute(t,n),o.setScalar(0),o.addScaledVector(XD,a.x),o.addScaledVector(JD,a.y),o.addScaledVector(KD,a.z),o}static isFrontFacing(t,r,i,n){return Fl.subVectors(i,r),Zc.subVectors(t,r),Fl.cross(Zc).dot(n)<0}set(t,r,i){return this.a.copy(t),this.b.copy(r),this.c.copy(i),this}setFromPointsAndIndices(t,r,i,n){return this.a.copy(t[r]),this.b.copy(t[i]),this.c.copy(t[n]),this}setFromAttributeAndIndices(t,r,i,n){return this.a.fromBufferAttribute(t,r),this.b.fromBufferAttribute(t,i),this.c.fromBufferAttribute(t,n),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 Fl.subVectors(this.c,this.b),Zc.subVectors(this.a,this.b),Fl.cross(Zc).length()*.5}getMidpoint(t){return t.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(t){return Sm.getNormal(this.a,this.b,this.c,t)}getPlane(t){return t.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(t,r){return Sm.getBarycoord(t,this.a,this.b,this.c,r)}getInterpolation(t,r,i,n,a){return Sm.getInterpolation(t,this.a,this.b,this.c,r,i,n,a)}containsPoint(t){return Sm.containsPoint(t,this.a,this.b,this.c)}isFrontFacing(t){return Sm.isFrontFacing(this.a,this.b,this.c,t)}intersectsBox(t){return t.intersectsTriangle(this)}closestPointToPoint(t,r){let i=this.a,n=this.b,a=this.c,o,s;gm.subVectors(n,i),ym.subVectors(a,i),HD.subVectors(t,i);let l=gm.dot(HD),u=ym.dot(HD);if(l<=0&&u<=0)return r.copy(i);WD.subVectors(t,n);let c=gm.dot(WD),h=ym.dot(WD);if(c>=0&&h<=c)return r.copy(n);let d=l*h-c*u;if(d<=0&&l>=0&&c<=0)return o=l/(l-c),r.copy(i).addScaledVector(gm,o);ZD.subVectors(t,a);let p=gm.dot(ZD),f=ym.dot(ZD);if(f>=0&&p<=f)return r.copy(a);let m=p*u-l*f;if(m<=0&&u>=0&&f<=0)return s=u/(u-f),r.copy(i).addScaledVector(ym,s);let g=c*f-p*h;if(g<=0&&h-c>=0&&p-f>=0)return j9.subVectors(a,n),s=(h-c)/(h-c+(p-f)),r.copy(n).addScaledVector(j9,s);let v=1/(g+m+d);return o=m*v,s=d*v,r.copy(i).addScaledVector(gm,o).addScaledVector(ym,s)}equals(t){return t.a.equals(this.a)&&t.b.equals(this.b)&&t.c.equals(this.c)}},fV={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},nd={h:0,s:0,l:0},Cw={h:0,s:0,l:0};Dt=class{constructor(e,t,r){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,r)}set(e,t,r){if(t===void 0&&r===void 0){let i=e;i&&i.isColor?this.copy(i):typeof i=="number"?this.setHex(i):typeof i=="string"&&this.setStyle(i)}else this.setRGB(e,t,r);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=Zi){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,Ai.toWorkingColorSpace(this,t),this}setRGB(e,t,r,i=Ai.workingColorSpace){return this.r=e,this.g=t,this.b=r,Ai.toWorkingColorSpace(this,i),this}setHSL(e,t,r,i=Ai.workingColorSpace){if(e=vk(e,1),t=li(t,0,1),r=li(r,0,1),t===0)this.r=this.g=this.b=r;else{let n=r<=.5?r*(1+t):r+t-r*t,a=2*r-n;this.r=qD(a,n,e+1/3),this.g=qD(a,n,e),this.b=qD(a,n,e-1/3)}return Ai.toWorkingColorSpace(this,i),this}setStyle(e,t=Zi){function r(n){n!==void 0&&parseFloat(n)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let i;if(i=/^(\\w+)\\(([^\\)]*)\\)/.exec(e)){let n,a=i[1],o=i[2];switch(a){case"rgb":case"rgba":if(n=/^\\s*(\\d+)\\s*,\\s*(\\d+)\\s*,\\s*(\\d+)\\s*(?:,\\s*(\\d*\\.?\\d+)\\s*)?$/.exec(o))return r(n[4]),this.setRGB(Math.min(255,parseInt(n[1],10))/255,Math.min(255,parseInt(n[2],10))/255,Math.min(255,parseInt(n[3],10))/255,t);if(n=/^\\s*(\\d+)\\%\\s*,\\s*(\\d+)\\%\\s*,\\s*(\\d+)\\%\\s*(?:,\\s*(\\d*\\.?\\d+)\\s*)?$/.exec(o))return r(n[4]),this.setRGB(Math.min(100,parseInt(n[1],10))/100,Math.min(100,parseInt(n[2],10))/100,Math.min(100,parseInt(n[3],10))/100,t);break;case"hsl":case"hsla":if(n=/^\\s*(\\d*\\.?\\d+)\\s*,\\s*(\\d*\\.?\\d+)\\%\\s*,\\s*(\\d*\\.?\\d+)\\%\\s*(?:,\\s*(\\d*\\.?\\d+)\\s*)?$/.exec(o))return r(n[4]),this.setHSL(parseFloat(n[1])/360,parseFloat(n[2])/100,parseFloat(n[3])/100,t);break;default:console.warn("THREE.Color: Unknown color model "+e)}}else if(i=/^\\#([A-Fa-f\\d]+)$/.exec(e)){let n=i[1],a=n.length;if(a===3)return this.setRGB(parseInt(n.charAt(0),16)/15,parseInt(n.charAt(1),16)/15,parseInt(n.charAt(2),16)/15,t);if(a===6)return this.setHex(parseInt(n,16),t);console.warn("THREE.Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=Zi){let r=fV[e.toLowerCase()];return r!==void 0?this.setHex(r,t):console.warn("THREE.Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=$c(e.r),this.g=$c(e.g),this.b=$c(e.b),this}copyLinearToSRGB(e){return this.r=km(e.r),this.g=km(e.g),this.b=km(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=Zi){return Ai.fromWorkingColorSpace(fo.copy(this),e),Math.round(li(fo.r*255,0,255))*65536+Math.round(li(fo.g*255,0,255))*256+Math.round(li(fo.b*255,0,255))}getHexString(e=Zi){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=Ai.workingColorSpace){Ai.fromWorkingColorSpace(fo.copy(this),t);let r=fo.r,i=fo.g,n=fo.b,a=Math.max(r,i,n),o=Math.min(r,i,n),s,l,u=(o+a)/2;if(o===a)s=0,l=0;else{let c=a-o;switch(l=u<=.5?c/(a+o):c/(2-a-o),a){case r:s=(i-n)/c+(i<n?6:0);break;case i:s=(n-r)/c+2;break;case n:s=(r-i)/c+4;break}s/=6}return e.h=s,e.s=l,e.l=u,e}getRGB(e,t=Ai.workingColorSpace){return Ai.fromWorkingColorSpace(fo.copy(this),t),e.r=fo.r,e.g=fo.g,e.b=fo.b,e}getStyle(e=Zi){Ai.fromWorkingColorSpace(fo.copy(this),e);let t=fo.r,r=fo.g,i=fo.b;return e!==Zi?"color(".concat(e," ").concat(t.toFixed(3)," ").concat(r.toFixed(3)," ").concat(i.toFixed(3),")"):"rgb(".concat(Math.round(t*255),",").concat(Math.round(r*255),",").concat(Math.round(i*255),")")}offsetHSL(e,t,r){return this.getHSL(nd),this.setHSL(nd.h+e,nd.s+t,nd.l+r)}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this}lerpColors(e,t,r){return this.r=e.r+(t.r-e.r)*r,this.g=e.g+(t.g-e.g)*r,this.b=e.b+(t.b-e.b)*r,this}lerpHSL(e,t){this.getHSL(nd),e.getHSL(Cw);let r=cv(nd.h,Cw.h,t),i=cv(nd.s,Cw.s,t),n=cv(nd.l,Cw.l,t);return this.setHSL(r,i,n),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){let t=this.r,r=this.g,i=this.b,n=e.elements;return this.r=n[0]*t+n[3]*r+n[6]*i,this.g=n[1]*t+n[4]*r+n[7]*i,this.b=n[2]*t+n[5]*r+n[8]*i,this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,t=0){return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}toArray(e=[],t=0){return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}fromBufferAttribute(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}},fo=new Dt;Dt.NAMES=fV;ffe=0,es=class extends Vm{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:ffe++}),this.uuid=rl(),this.name="",this.type="Material",this.blending=Tm,this.side=mo,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=b3,this.blendDst=w3,this.blendEquation=af,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new Dt(0,0,0),this.blendAlpha=0,this.depthFunc=Rm,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=Nm,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=Zn,this.stencilZFail=Zn,this.stencilZPass=Zn,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(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(let t in e){let r=e[t];if(r===void 0){console.warn("THREE.Material: parameter '".concat(t,"' has value of undefined."));continue}let i=this[t];if(i===void 0){console.warn("THREE.Material: '".concat(t,"' is not a property of THREE.").concat(this.type,"."));continue}i&&i.isColor?i.set(r):i&&i.isVector3&&r&&r.isVector3?i.copy(r):this[t]=r}}toJSON(e){let t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});let r={metadata:{version:4.6,type:"Material",generator:"Material.toJSON"}};r.uuid=this.uuid,r.type=this.type,this.name!==""&&(r.name=this.name),this.color&&this.color.isColor&&(r.color=this.color.getHex()),this.roughness!==void 0&&(r.roughness=this.roughness),this.metalness!==void 0&&(r.metalness=this.metalness),this.sheen!==void 0&&(r.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(r.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(r.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(r.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(r.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(r.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(r.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(r.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(r.shininess=this.shininess),this.clearcoat!==void 0&&(r.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(r.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(r.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(r.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(r.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,r.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.dispersion!==void 0&&(r.dispersion=this.dispersion),this.iridescence!==void 0&&(r.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(r.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(r.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(r.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(r.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(r.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(r.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(r.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(r.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(r.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(r.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(r.lightMap=this.lightMap.toJSON(e).uuid,r.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(r.aoMap=this.aoMap.toJSON(e).uuid,r.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(r.bumpMap=this.bumpMap.toJSON(e).uuid,r.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(r.normalMap=this.normalMap.toJSON(e).uuid,r.normalMapType=this.normalMapType,r.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(r.displacementMap=this.displacementMap.toJSON(e).uuid,r.displacementScale=this.displacementScale,r.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(r.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(r.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(r.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(r.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(r.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(r.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(r.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(r.combine=this.combine)),this.envMapRotation!==void 0&&(r.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(r.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(r.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(r.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(r.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(r.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(r.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(r.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(r.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(r.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(r.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(r.size=this.size),this.shadowSide!==null&&(r.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(r.sizeAttenuation=this.sizeAttenuation),this.blending!==Tm&&(r.blending=this.blending),this.side!==mo&&(r.side=this.side),this.vertexColors===!0&&(r.vertexColors=!0),this.opacity<1&&(r.opacity=this.opacity),this.transparent===!0&&(r.transparent=!0),this.blendSrc!==b3&&(r.blendSrc=this.blendSrc),this.blendDst!==w3&&(r.blendDst=this.blendDst),this.blendEquation!==af&&(r.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(r.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(r.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(r.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(r.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(r.blendAlpha=this.blendAlpha),this.depthFunc!==Rm&&(r.depthFunc=this.depthFunc),this.depthTest===!1&&(r.depthTest=this.depthTest),this.depthWrite===!1&&(r.depthWrite=this.depthWrite),this.colorWrite===!1&&(r.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(r.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==Nm&&(r.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(r.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(r.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==Zn&&(r.stencilFail=this.stencilFail),this.stencilZFail!==Zn&&(r.stencilZFail=this.stencilZFail),this.stencilZPass!==Zn&&(r.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(r.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(r.rotation=this.rotation),this.polygonOffset===!0&&(r.polygonOffset=!0),this.polygonOffsetFactor!==0&&(r.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(r.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(r.linewidth=this.linewidth),this.dashSize!==void 0&&(r.dashSize=this.dashSize),this.gapSize!==void 0&&(r.gapSize=this.gapSize),this.scale!==void 0&&(r.scale=this.scale),this.dithering===!0&&(r.dithering=!0),this.alphaTest>0&&(r.alphaTest=this.alphaTest),this.alphaHash===!0&&(r.alphaHash=!0),this.alphaToCoverage===!0&&(r.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(r.premultipliedAlpha=!0),this.forceSinglePass===!0&&(r.forceSinglePass=!0),this.wireframe===!0&&(r.wireframe=!0),this.wireframeLinewidth>1&&(r.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(r.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(r.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(r.flatShading=!0),this.visible===!1&&(r.visible=!1),this.toneMapped===!1&&(r.toneMapped=!1),this.fog===!1&&(r.fog=!1),Object.keys(this.userData).length>0&&(r.userData=this.userData);function i(n){let a=[];for(let o in n){let s=n[o];delete s.metadata,a.push(s)}return a}if(t){let n=i(e.textures),a=i(e.images);n.length>0&&(r.textures=n),a.length>0&&(r.images=a)}return r}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;let t=e.clippingPlanes,r=null;if(t!==null){let i=t.length;r=new Array(i);for(let n=0;n!==i;++n)r[n]=t[n].clone()}return this.clippingPlanes=r,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}onBuild(){console.warn("Material: onBuild() has been removed.")}},Fn=class extends es{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new Dt(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Ua,this.combine=hk,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}},ha=new fe,Bw=new vt,Afe=0,qr=class{constructor(e,t,r=!1){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:Afe++}),this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=r,this.usage=nk,this.updateRanges=[],this.gpuType=Po,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,r){e*=this.itemSize,r*=t.itemSize;for(let i=0,n=this.itemSize;i<n;i++)this.array[e+i]=t.array[r+i];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(this.itemSize===2)for(let t=0,r=this.count;t<r;t++)Bw.fromBufferAttribute(this,t),Bw.applyMatrix3(e),this.setXY(t,Bw.x,Bw.y);else if(this.itemSize===3)for(let t=0,r=this.count;t<r;t++)ha.fromBufferAttribute(this,t),ha.applyMatrix3(e),this.setXYZ(t,ha.x,ha.y,ha.z);return this}applyMatrix4(e){for(let t=0,r=this.count;t<r;t++)ha.fromBufferAttribute(this,t),ha.applyMatrix4(e),this.setXYZ(t,ha.x,ha.y,ha.z);return this}applyNormalMatrix(e){for(let t=0,r=this.count;t<r;t++)ha.fromBufferAttribute(this,t),ha.applyNormalMatrix(e),this.setXYZ(t,ha.x,ha.y,ha.z);return this}transformDirection(e){for(let t=0,r=this.count;t<r;t++)ha.fromBufferAttribute(this,t),ha.transformDirection(e),this.setXYZ(t,ha.x,ha.y,ha.z);return this}set(e,t=0){return this.array.set(e,t),this}getComponent(e,t){let r=this.array[e*this.itemSize+t];return this.normalized&&(r=zl(r,this.array)),r}setComponent(e,t,r){return this.normalized&&(r=Hi(r,this.array)),this.array[e*this.itemSize+t]=r,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=zl(t,this.array)),t}setX(e,t){return this.normalized&&(t=Hi(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=zl(t,this.array)),t}setY(e,t){return this.normalized&&(t=Hi(t,this.array)),this.array[e*this.itemSize+1]=t,this}getZ(e){let t=this.array[e*this.itemSize+2];return this.normalized&&(t=zl(t,this.array)),t}setZ(e,t){return this.normalized&&(t=Hi(t,this.array)),this.array[e*this.itemSize+2]=t,this}getW(e){let t=this.array[e*this.itemSize+3];return this.normalized&&(t=zl(t,this.array)),t}setW(e,t){return this.normalized&&(t=Hi(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,r){return e*=this.itemSize,this.normalized&&(t=Hi(t,this.array),r=Hi(r,this.array)),this.array[e+0]=t,this.array[e+1]=r,this}setXYZ(e,t,r,i){return e*=this.itemSize,this.normalized&&(t=Hi(t,this.array),r=Hi(r,this.array),i=Hi(i,this.array)),this.array[e+0]=t,this.array[e+1]=r,this.array[e+2]=i,this}setXYZW(e,t,r,i,n){return e*=this.itemSize,this.normalized&&(t=Hi(t,this.array),r=Hi(r,this.array),i=Hi(i,this.array),n=Hi(n,this.array)),this.array[e+0]=t,this.array[e+1]=r,this.array[e+2]=i,this.array[e+3]=n,this}onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){let e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return this.name!==""&&(e.name=this.name),this.usage!==nk&&(e.usage=this.usage),e}},AV=class extends qr{constructor(e,t,r){super(new Uint16Array(e),t,r)}},mV=class extends qr{constructor(e,t,r){super(new Uint32Array(e),t,r)}},nn=class extends qr{constructor(e,t,r){super(new Float32Array(e),t,r)}},mfe=0,$s=new er,$D=new mi,vm=new fe,Ms=new Ei,iv=new Ei,Fa=new fe,xn=class gV extends Vm{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:mfe++}),this.uuid=rl(),this.name="",this.type="BufferGeometry",this.index=null,this.indirect=null,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(t){return Array.isArray(t)?this.index=new(uV(t)?mV:AV)(t,1):this.index=t,this}setIndirect(t){return this.indirect=t,this}getIndirect(){return this.indirect}getAttribute(t){return this.attributes[t]}setAttribute(t,r){return this.attributes[t]=r,this}deleteAttribute(t){return delete this.attributes[t],this}hasAttribute(t){return this.attributes[t]!==void 0}addGroup(t,r,i=0){this.groups.push({start:t,count:r,materialIndex:i})}clearGroups(){this.groups=[]}setDrawRange(t,r){this.drawRange.start=t,this.drawRange.count=r}applyMatrix4(t){let r=this.attributes.position;r!==void 0&&(r.applyMatrix4(t),r.needsUpdate=!0);let i=this.attributes.normal;if(i!==void 0){let a=new Wr().getNormalMatrix(t);i.applyNormalMatrix(a),i.needsUpdate=!0}let n=this.attributes.tangent;return n!==void 0&&(n.transformDirection(t),n.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(t){return $s.makeRotationFromQuaternion(t),this.applyMatrix4($s),this}rotateX(t){return $s.makeRotationX(t),this.applyMatrix4($s),this}rotateY(t){return $s.makeRotationY(t),this.applyMatrix4($s),this}rotateZ(t){return $s.makeRotationZ(t),this.applyMatrix4($s),this}translate(t,r,i){return $s.makeTranslation(t,r,i),this.applyMatrix4($s),this}scale(t,r,i){return $s.makeScale(t,r,i),this.applyMatrix4($s),this}lookAt(t){return $D.lookAt(t),$D.updateMatrix(),this.applyMatrix4($D.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(vm).negate(),this.translate(vm.x,vm.y,vm.z),this}setFromPoints(t){let r=this.getAttribute("position");if(r===void 0){let i=[];for(let n=0,a=t.length;n<a;n++){let o=t[n];i.push(o.x,o.y,o.z||0)}this.setAttribute("position",new nn(i,3))}else{let i=Math.min(t.length,r.count);for(let n=0;n<i;n++){let a=t[n];r.setXYZ(n,a.x,a.y,a.z||0)}t.length>r.count&&console.warn("THREE.BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),r.needsUpdate=!0}return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Ei);let t=this.attributes.position,r=this.morphAttributes.position;if(t&&t.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new fe(-1/0,-1/0,-1/0),new fe(1/0,1/0,1/0));return}if(t!==void 0){if(this.boundingBox.setFromBufferAttribute(t),r)for(let i=0,n=r.length;i<n;i++){let a=r[i];Ms.setFromBufferAttribute(a),this.morphTargetsRelative?(Fa.addVectors(this.boundingBox.min,Ms.min),this.boundingBox.expandByPoint(Fa),Fa.addVectors(this.boundingBox.max,Ms.max),this.boundingBox.expandByPoint(Fa)):(this.boundingBox.expandByPoint(Ms.min),this.boundingBox.expandByPoint(Ms.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 ba);let t=this.attributes.position,r=this.morphAttributes.position;if(t&&t.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new fe,1/0);return}if(t){let i=this.boundingSphere.center;if(Ms.setFromBufferAttribute(t),r)for(let a=0,o=r.length;a<o;a++){let s=r[a];iv.setFromBufferAttribute(s),this.morphTargetsRelative?(Fa.addVectors(Ms.min,iv.min),Ms.expandByPoint(Fa),Fa.addVectors(Ms.max,iv.max),Ms.expandByPoint(Fa)):(Ms.expandByPoint(iv.min),Ms.expandByPoint(iv.max))}Ms.getCenter(i);let n=0;for(let a=0,o=t.count;a<o;a++)Fa.fromBufferAttribute(t,a),n=Math.max(n,i.distanceToSquared(Fa));if(r)for(let a=0,o=r.length;a<o;a++){let s=r[a],l=this.morphTargetsRelative;for(let u=0,c=s.count;u<c;u++)Fa.fromBufferAttribute(s,u),l&&(vm.fromBufferAttribute(t,u),Fa.add(vm)),n=Math.max(n,i.distanceToSquared(Fa))}this.boundingSphere.radius=Math.sqrt(n),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,r=this.attributes;if(t===null||r.position===void 0||r.normal===void 0||r.uv===void 0){console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}let i=r.position,n=r.normal,a=r.uv;this.hasAttribute("tangent")===!1&&this.setAttribute("tangent",new qr(new Float32Array(4*i.count),4));let o=this.getAttribute("tangent"),s=[],l=[];for(let D=0;D<i.count;D++)s[D]=new fe,l[D]=new fe;let u=new fe,c=new fe,h=new fe,d=new vt,p=new vt,f=new vt,m=new fe,g=new fe;function v(D,T,P){u.fromBufferAttribute(i,D),c.fromBufferAttribute(i,T),h.fromBufferAttribute(i,P),d.fromBufferAttribute(a,D),p.fromBufferAttribute(a,T),f.fromBufferAttribute(a,P),c.sub(u),h.sub(u),p.sub(d),f.sub(d);let k=1/(p.x*f.y-f.x*p.y);isFinite(k)&&(m.copy(c).multiplyScalar(f.y).addScaledVector(h,-p.y).multiplyScalar(k),g.copy(h).multiplyScalar(p.x).addScaledVector(c,-f.x).multiplyScalar(k),s[D].add(m),s[T].add(m),s[P].add(m),l[D].add(g),l[T].add(g),l[P].add(g))}let _=this.groups;_.length===0&&(_=[{start:0,count:t.count}]);for(let D=0,T=_.length;D<T;++D){let P=_[D],k=P.start,R=P.count;for(let F=k,B=k+R;F<B;F+=3)v(t.getX(F+0),t.getX(F+1),t.getX(F+2))}let x=new fe,b=new fe,E=new fe,M=new fe;function S(D){E.fromBufferAttribute(n,D),M.copy(E);let T=s[D];x.copy(T),x.sub(E.multiplyScalar(E.dot(T))).normalize(),b.crossVectors(M,T);let P=b.dot(l[D])<0?-1:1;o.setXYZW(D,x.x,x.y,x.z,P)}for(let D=0,T=_.length;D<T;++D){let P=_[D],k=P.start,R=P.count;for(let F=k,B=k+R;F<B;F+=3)S(t.getX(F+0)),S(t.getX(F+1)),S(t.getX(F+2))}}computeVertexNormals(){let t=this.index,r=this.getAttribute("position");if(r!==void 0){let i=this.getAttribute("normal");if(i===void 0)i=new qr(new Float32Array(r.count*3),3),this.setAttribute("normal",i);else for(let d=0,p=i.count;d<p;d++)i.setXYZ(d,0,0,0);let n=new fe,a=new fe,o=new fe,s=new fe,l=new fe,u=new fe,c=new fe,h=new fe;if(t)for(let d=0,p=t.count;d<p;d+=3){let f=t.getX(d+0),m=t.getX(d+1),g=t.getX(d+2);n.fromBufferAttribute(r,f),a.fromBufferAttribute(r,m),o.fromBufferAttribute(r,g),c.subVectors(o,a),h.subVectors(n,a),c.cross(h),s.fromBufferAttribute(i,f),l.fromBufferAttribute(i,m),u.fromBufferAttribute(i,g),s.add(c),l.add(c),u.add(c),i.setXYZ(f,s.x,s.y,s.z),i.setXYZ(m,l.x,l.y,l.z),i.setXYZ(g,u.x,u.y,u.z)}else for(let d=0,p=r.count;d<p;d+=3)n.fromBufferAttribute(r,d+0),a.fromBufferAttribute(r,d+1),o.fromBufferAttribute(r,d+2),c.subVectors(o,a),h.subVectors(n,a),c.cross(h),i.setXYZ(d+0,c.x,c.y,c.z),i.setXYZ(d+1,c.x,c.y,c.z),i.setXYZ(d+2,c.x,c.y,c.z);this.normalizeNormals(),i.needsUpdate=!0}}normalizeNormals(){let t=this.attributes.normal;for(let r=0,i=t.count;r<i;r++)Fa.fromBufferAttribute(t,r),Fa.normalize(),t.setXYZ(r,Fa.x,Fa.y,Fa.z)}toNonIndexed(){function t(s,l){let u=s.array,c=s.itemSize,h=s.normalized,d=new u.constructor(l.length*c),p=0,f=0;for(let m=0,g=l.length;m<g;m++){s.isInterleavedBufferAttribute?p=l[m]*s.data.stride+s.offset:p=l[m]*c;for(let v=0;v<c;v++)d[f++]=u[p++]}return new qr(d,c,h)}if(this.index===null)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;let r=new gV,i=this.index.array,n=this.attributes;for(let s in n){let l=n[s],u=t(l,i);r.setAttribute(s,u)}let a=this.morphAttributes;for(let s in a){let l=[],u=a[s];for(let c=0,h=u.length;c<h;c++){let d=u[c],p=t(d,i);l.push(p)}r.morphAttributes[s]=l}r.morphTargetsRelative=this.morphTargetsRelative;let o=this.groups;for(let s=0,l=o.length;s<l;s++){let u=o[s];r.addGroup(u.start,u.count,u.materialIndex)}return r}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 l=this.parameters;for(let u in l)l[u]!==void 0&&(t[u]=l[u]);return t}t.data={attributes:{}};let r=this.index;r!==null&&(t.data.index={type:r.array.constructor.name,array:Array.prototype.slice.call(r.array)});let i=this.attributes;for(let l in i){let u=i[l];t.data.attributes[l]=u.toJSON(t.data)}let n={},a=!1;for(let l in this.morphAttributes){let u=this.morphAttributes[l],c=[];for(let h=0,d=u.length;h<d;h++){let p=u[h];c.push(p.toJSON(t.data))}c.length>0&&(n[l]=c,a=!0)}a&&(t.data.morphAttributes=n,t.data.morphTargetsRelative=this.morphTargetsRelative);let o=this.groups;o.length>0&&(t.data.groups=JSON.parse(JSON.stringify(o)));let s=this.boundingSphere;return s!==null&&(t.data.boundingSphere={center:s.center.toArray(),radius:s.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 r={};this.name=t.name;let i=t.index;i!==null&&this.setIndex(i.clone(r));let n=t.attributes;for(let u in n){let c=n[u];this.setAttribute(u,c.clone(r))}let a=t.morphAttributes;for(let u in a){let c=[],h=a[u];for(let d=0,p=h.length;d<p;d++)c.push(h[d].clone(r));this.morphAttributes[u]=c}this.morphTargetsRelative=t.morphTargetsRelative;let o=t.groups;for(let u=0,c=o.length;u<c;u++){let h=o[u];this.addGroup(h.start,h.count,h.materialIndex)}let s=t.boundingBox;s!==null&&(this.boundingBox=s.clone());let l=t.boundingSphere;return l!==null&&(this.boundingSphere=l.clone()),this.drawRange.start=t.drawRange.start,this.drawRange.count=t.drawRange.count,this.userData=t.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}},G9=new er,Kp=new bv,Tw=new ba,V9=new fe,Pw=new fe,Dw=new fe,kw=new fe,e3=new fe,Rw=new fe,Y9=new fe,Fw=new fe,Sr=class extends mi{constructor(e=new xn,t=new Fn){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),e.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),e.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}updateMorphTargets(){let e=this.geometry.morphAttributes,t=Object.keys(e);if(t.length>0){let r=e[t[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let i=0,n=r.length;i<n;i++){let a=r[i].name||String(i);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=i}}}}getVertexPosition(e,t){let r=this.geometry,i=r.attributes.position,n=r.morphAttributes.position,a=r.morphTargetsRelative;t.fromBufferAttribute(i,e);let o=this.morphTargetInfluences;if(n&&o){Rw.set(0,0,0);for(let s=0,l=n.length;s<l;s++){let u=o[s],c=n[s];u!==0&&(e3.fromBufferAttribute(c,e),a?Rw.addScaledVector(e3,u):Rw.addScaledVector(e3.sub(t),u))}t.add(Rw)}return t}raycast(e,t){let r=this.geometry,i=this.material,n=this.matrixWorld;i!==void 0&&(r.boundingSphere===null&&r.computeBoundingSphere(),Tw.copy(r.boundingSphere),Tw.applyMatrix4(n),Kp.copy(e.ray).recast(e.near),!(Tw.containsPoint(Kp.origin)===!1&&(Kp.intersectSphere(Tw,V9)===null||Kp.origin.distanceToSquared(V9)>bs(e.far-e.near,2)))&&(G9.copy(n).invert(),Kp.copy(e.ray).applyMatrix4(G9),!(r.boundingBox!==null&&Kp.intersectsBox(r.boundingBox)===!1)&&this._computeIntersections(e,t,Kp)))}_computeIntersections(e,t,r){let i,n=this.geometry,a=this.material,o=n.index,s=n.attributes.position,l=n.attributes.uv,u=n.attributes.uv1,c=n.attributes.normal,h=n.groups,d=n.drawRange;if(o!==null)if(Array.isArray(a))for(let p=0,f=h.length;p<f;p++){let m=h[p],g=a[m.materialIndex],v=Math.max(m.start,d.start),_=Math.min(o.count,Math.min(m.start+m.count,d.start+d.count));for(let x=v,b=_;x<b;x+=3){let E=o.getX(x),M=o.getX(x+1),S=o.getX(x+2);i=zw(this,g,e,r,l,u,c,E,M,S),i&&(i.faceIndex=Math.floor(x/3),i.face.materialIndex=m.materialIndex,t.push(i))}}else{let p=Math.max(0,d.start),f=Math.min(o.count,d.start+d.count);for(let m=p,g=f;m<g;m+=3){let v=o.getX(m),_=o.getX(m+1),x=o.getX(m+2);i=zw(this,a,e,r,l,u,c,v,_,x),i&&(i.faceIndex=Math.floor(m/3),t.push(i))}}else if(s!==void 0)if(Array.isArray(a))for(let p=0,f=h.length;p<f;p++){let m=h[p],g=a[m.materialIndex],v=Math.max(m.start,d.start),_=Math.min(s.count,Math.min(m.start+m.count,d.start+d.count));for(let x=v,b=_;x<b;x+=3){let E=x,M=x+1,S=x+2;i=zw(this,g,e,r,l,u,c,E,M,S),i&&(i.faceIndex=Math.floor(x/3),i.face.materialIndex=m.materialIndex,t.push(i))}}else{let p=Math.max(0,d.start),f=Math.min(s.count,d.start+d.count);for(let m=p,g=f;m<g;m+=3){let v=m,_=m+1,x=m+2;i=zw(this,a,e,r,l,u,c,v,_,x),i&&(i.faceIndex=Math.floor(m/3),t.push(i))}}}};th=class yV extends xn{constructor(t=1,r=1,i=1,n=1,a=1,o=1){super(),this.type="BoxGeometry",this.parameters={width:t,height:r,depth:i,widthSegments:n,heightSegments:a,depthSegments:o};let s=this;n=Math.floor(n),a=Math.floor(a),o=Math.floor(o);let l=[],u=[],c=[],h=[],d=0,p=0;f("z","y","x",-1,-1,i,r,t,o,a,0),f("z","y","x",1,-1,i,r,-t,o,a,1),f("x","z","y",1,1,t,i,r,n,o,2),f("x","z","y",1,-1,t,i,-r,n,o,3),f("x","y","z",1,-1,t,r,i,n,a,4),f("x","y","z",-1,-1,t,r,-i,n,a,5),this.setIndex(l),this.setAttribute("position",new nn(u,3)),this.setAttribute("normal",new nn(c,3)),this.setAttribute("uv",new nn(h,2));function f(m,g,v,_,x,b,E,M,S,D,T){let P=b/S,k=E/D,R=b/2,F=E/2,B=M/2,z=S+1,O=D+1,j=0,Y=0,Z=new fe;for(let ne=0;ne<O;ne++){let ie=ne*k-F;for(let le=0;le<z;le++){let X=le*P-R;Z[m]=X*_,Z[g]=ie*x,Z[v]=B,u.push(Z.x,Z.y,Z.z),Z[m]=0,Z[g]=0,Z[v]=M>0?1:-1,c.push(Z.x,Z.y,Z.z),h.push(le/S),h.push(1-ne/D),j+=1}}for(let ne=0;ne<D;ne++)for(let ie=0;ie<S;ie++){let le=d+ie+z*ne,X=d+ie+z*(ne+1),ce=d+(ie+1)+z*(ne+1),ge=d+(ie+1)+z*ne;l.push(le,X,ge),l.push(X,ce,ge),Y+=6}s.addGroup(p,Y,T),p+=Y,d+=j}}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new yV(t.width,t.height,t.depth,t.widthSegments,t.heightSegments,t.depthSegments)}};_k={clone:Qm,merge:To},vfe=\`void main() {
|
|
235
235
|
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
|
|
236
236
|
}\`,xfe=\`void main() {
|
|
237
237
|
gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );
|
|
@@ -4885,7 +4885,7 @@ if (u_projection_transition < 0.999) {return mix(1.0,thickness,u_projection_tran
|
|
|
4885
4885
|
);color.rgb=1.0-exp(-1.0*color.rgb);color=pow(color,vec4(1.0/2.2));fragColor=vec4(color.rgb,1.0-color.a)*u_atmosphere_blend;}\`,i4e="in vec2 a_pos;uniform mat4 u_inv_proj_matrix;out vec3 view_direction;void main() {view_direction=(u_inv_proj_matrix*vec4(a_pos,0.0,1.0)).xyz;gl_Position=vec4(a_pos,0.0,1.0);}",n4e="uniform vec4 u_sky_color;uniform vec4 u_horizon_color;uniform vec2 u_horizon;uniform vec2 u_horizon_normal;uniform float u_sky_horizon_blend;uniform float u_sky_blend;void main() {float x=gl_FragCoord.x;float y=gl_FragCoord.y;float blend=(y-u_horizon.y)*u_horizon_normal.y+(x-u_horizon.x)*u_horizon_normal.x;if (blend > 0.0) {if (blend < u_sky_horizon_blend) {fragColor=mix(u_sky_color,u_horizon_color,pow(1.0-blend/u_sky_horizon_blend,2.0));} else {fragColor=u_sky_color;}}fragColor=mix(fragColor,vec4(vec3(0.0),0.0),u_sky_blend);}",a4e="in vec2 a_pos;void main() {gl_Position=vec4(a_pos,1.0,1.0);}",qu={prelude:gi(H3e,W3e),projectionMercator:gi("",e4e),projectionGlobe:gi("",t4e),background:gi(Z3e,X3e),backgroundPattern:gi(J3e,K3e),circle:gi(q3e,$3e),clippingMask:gi($X,eke),heatmap:gi(tke,rke),heatmapTexture:gi(ike,nke),collisionBox:gi(ake,oke),collisionCircle:gi(ske,lke),colorRelief:gi(uke,cke),debug:gi(hke,dke),depth:gi($X,pke),fill:gi(fke,Ake),fillOutline:gi(mke,gke),fillOutlinePattern:gi(yke,vke),fillPattern:gi(xke,_ke),fillExtrusion:gi(bke,wke),fillExtrusionPattern:gi(Eke,Mke),hillshadePrepare:gi(Ske,Ike),hillshade:gi(Cke,Bke),line:gi(Tke,Pke),lineGradient:gi(Dke,kke),linePattern:gi(Rke,Fke),lineSDF:gi(zke,Lke),raster:gi(Oke,Nke),symbolIcon:gi(Uke,Qke),symbolSDF:gi(jke,Gke),symbolTextAndIcon:gi(Vke,Yke),terrain:gi(Zke,Xke),terrainDepth:gi(Hke,Jke),terrainCoords:gi(Wke,Kke),projectionErrorMeasurement:gi($ke,qke),atmosphere:gi(r4e,i4e),sky:gi(n4e,a4e)};gy=class{constructor(e,t,r){this.vertexBuffer=e,this.indexBuffer=t,this.segments=r}destroy(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.vertexBuffer=null,this.indexBuffer=null,this.segments=null}},Wd=Vn([{name:"a_pos",type:"Int16",components:2}]),Zee="#define PROJECTION_MERCATOR",Xee="mercator",ZO=class{constructor(){this._cachedMesh=null}get name(){return"mercator"}get useSubdivision(){return!1}get shaderVariantName(){return Xee}get shaderDefine(){return Zee}get shaderPreludeCode(){return qu.projectionMercator}get vertexShaderPreludeCode(){return qu.projectionMercator.vertexSource}get subdivisionGranularity(){return kU.noSubdivision}get useGlobeControls(){return!1}get transitionState(){return 0}get latitudeErrorCorrectionRadians(){return 0}destroy(){}updateGPUdependent(e){}getMeshFromTileID(e,t,r,i,n){if(this._cachedMesh)return this._cachedMesh;let a=new ph;a.emplaceBack(0,0),a.emplaceBack(8192,0),a.emplaceBack(0,8192),a.emplaceBack(8192,8192);let o=e.createVertexBuffer(a,Wd.members),s=gn.simpleSegment(0,0,4,2),l=new au;l.emplaceBack(1,0,2),l.emplaceBack(1,2,3);let u=e.createIndexBuffer(l);return this._cachedMesh=new gy(o,u,s),this._cachedMesh}recalculate(){}hasTransition(){return!1}setErrorQueryLatitudeDegrees(e){}},Cs=Er(zr(),1),Gf=Er(zr(),1),l4e=Er(zr(),1),eJ=class Jee{constructor(t=0,r=0,i=0,n=0){if(isNaN(t)||t<0||isNaN(r)||r<0||isNaN(i)||i<0||isNaN(n)||n<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=t,this.bottom=r,this.left=i,this.right=n}interpolate(t,r,i){return r.top!=null&&t.top!=null&&(this.top=On.number(t.top,r.top,i)),r.bottom!=null&&t.bottom!=null&&(this.bottom=On.number(t.bottom,r.bottom,i)),r.left!=null&&t.left!=null&&(this.left=On.number(t.left,r.left,i)),r.right!=null&&t.right!=null&&(this.right=On.number(t.right,r.right,i)),this}getCenter(t,r){let i=Ii((this.left+t-this.right)/2,0,t),n=Ii((this.top+r-this.bottom)/2,0,r);return new l4e.default(i,n)}equals(t){return this.top===t.top&&this.bottom===t.bottom&&this.left===t.left&&this.right===t.right}clone(){return new Jee(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}};QU=class{constructor(e,t,r,i,n,a){this._callbacks=e,this._tileSize=512,this._renderWorldCopies=a===void 0?!0:!!a,this._minZoom=t||0,this._maxZoom=r||22,this._minPitch=i!=null?i:0,this._maxPitch=n!=null?n:60,this.setMaxBounds(),this._width=0,this._height=0,this._center=new wr(0,0),this._elevation=0,this._zoom=0,this._tileZoom=tJ(this._zoom),this._scale=Lo(this._zoom),this._bearingInRadians=0,this._fovInRadians=.6435011087932844,this._pitchInRadians=0,this._rollInRadians=0,this._unmodified=!0,this._edgeInsets=new eJ,this._minElevationForCurrentTile=0,this._autoCalculateNearFarZ=!0}apply(e,t,r){this._latRange=e.latRange,this._lngRange=e.lngRange,this._width=e.width,this._height=e.height,this._center=e.center,this._elevation=e.elevation,this._minElevationForCurrentTile=e.minElevationForCurrentTile,this._zoom=e.zoom,this._tileZoom=tJ(this._zoom),this._scale=Lo(this._zoom),this._bearingInRadians=e.bearingInRadians,this._fovInRadians=e.fovInRadians,this._pitchInRadians=e.pitchInRadians,this._rollInRadians=e.rollInRadians,this._unmodified=e.unmodified,this._edgeInsets=new eJ(e.padding.top,e.padding.bottom,e.padding.left,e.padding.right),this._minZoom=e.minZoom,this._maxZoom=e.maxZoom,this._minPitch=e.minPitch,this._maxPitch=e.maxPitch,this._renderWorldCopies=e.renderWorldCopies,this._cameraToCenterDistance=e.cameraToCenterDistance,this._nearZ=e.nearZ,this._farZ=e.farZ,this._autoCalculateNearFarZ=!r&&e.autoCalculateNearFarZ,t&&this._constrain(),this._calcMatrices()}get pixelsToClipSpaceMatrix(){return this._pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._clipSpaceToPixelsMatrix}get minElevationForCurrentTile(){return this._minElevationForCurrentTile}setMinElevationForCurrentTile(e){this._minElevationForCurrentTile=e}get tileSize(){return this._tileSize}get tileZoom(){return this._tileZoom}get scale(){return this._scale}get width(){return this._width}get height(){return this._height}get bearingInRadians(){return this._bearingInRadians}get lngRange(){return this._lngRange}get latRange(){return this._latRange}get pixelsToGLUnits(){return this._pixelsToGLUnits}get minZoom(){return this._minZoom}setMinZoom(e){this._minZoom!==e&&(this._minZoom=e,this.setZoom(this.getConstrained(this._center,this.zoom).zoom))}get maxZoom(){return this._maxZoom}setMaxZoom(e){this._maxZoom!==e&&(this._maxZoom=e,this.setZoom(this.getConstrained(this._center,this.zoom).zoom))}get minPitch(){return this._minPitch}setMinPitch(e){this._minPitch!==e&&(this._minPitch=e,this.setPitch(Math.max(this.pitch,e)))}get maxPitch(){return this._maxPitch}setMaxPitch(e){this._maxPitch!==e&&(this._maxPitch=e,this.setPitch(Math.min(this.pitch,e)))}get renderWorldCopies(){return this._renderWorldCopies}setRenderWorldCopies(e){e===void 0?e=!0:e===null&&(e=!1),this._renderWorldCopies=e}get worldSize(){return this._tileSize*this._scale}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new Gf.default(this._width,this._height)}get bearing(){return this._bearingInRadians/Math.PI*180}setBearing(e){let t=Wf(e,-180,180)*Math.PI/180;this._bearingInRadians!==t&&(this._unmodified=!1,this._bearingInRadians=t,this._calcMatrices(),this._rotationMatrix=Tx.create(),Tx.rotate(this._rotationMatrix,this._rotationMatrix,-this._bearingInRadians))}get rotationMatrix(){return this._rotationMatrix}get pitchInRadians(){return this._pitchInRadians}get pitch(){return this._pitchInRadians/Math.PI*180}setPitch(e){let t=Ii(e,this.minPitch,this.maxPitch)/180*Math.PI;this._pitchInRadians!==t&&(this._unmodified=!1,this._pitchInRadians=t,this._calcMatrices())}get rollInRadians(){return this._rollInRadians}get roll(){return this._rollInRadians/Math.PI*180}setRoll(e){let t=e/180*Math.PI;this._rollInRadians!==t&&(this._unmodified=!1,this._rollInRadians=t,this._calcMatrices())}get fovInRadians(){return this._fovInRadians}get fov(){return Yg(this._fovInRadians)}setFov(e){e=Ii(e,.1,150),this.fov!==e&&(this._unmodified=!1,this._fovInRadians=mn(e),this._calcMatrices())}get zoom(){return this._zoom}setZoom(e){let t=this.getConstrained(this._center,e).zoom;this._zoom!==t&&(this._unmodified=!1,this._zoom=t,this._tileZoom=Math.max(0,Math.floor(t)),this._scale=Lo(t),this._constrain(),this._calcMatrices())}get center(){return this._center}setCenter(e){e.lat===this._center.lat&&e.lng===this._center.lng||(this._unmodified=!1,this._center=e,this._constrain(),this._calcMatrices())}get elevation(){return this._elevation}setElevation(e){e!==this._elevation&&(this._elevation=e,this._constrain(),this._calcMatrices())}get padding(){return this._edgeInsets.toJSON()}setPadding(e){this._edgeInsets.equals(e)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,e,1),this._calcMatrices())}get centerPoint(){return this._edgeInsets.getCenter(this._width,this._height)}get pixelsPerMeter(){return this._pixelPerMeter}get unmodified(){return this._unmodified}get cameraToCenterDistance(){return this._cameraToCenterDistance}get nearZ(){return this._nearZ}get farZ(){return this._farZ}get autoCalculateNearFarZ(){return this._autoCalculateNearFarZ}overrideNearFarZ(e,t){this._autoCalculateNearFarZ=!1,this._nearZ=e,this._farZ=t,this._calcMatrices()}clearNearFarZOverride(){this._autoCalculateNearFarZ=!0,this._calcMatrices()}isPaddingEqual(e){return this._edgeInsets.equals(e)}interpolatePadding(e,t,r){this._unmodified=!1,this._edgeInsets.interpolate(e,t,r),this._constrain(),this._calcMatrices()}resize(e,t,r=!0){this._width=e,this._height=t,r&&this._constrain(),this._calcMatrices()}getMaxBounds(){return!this._latRange||this._latRange.length!==2||!this._lngRange||this._lngRange.length!==2?null:new vh([this._lngRange[0],this._latRange[0]],[this._lngRange[1],this._latRange[1]])}setMaxBounds(e){e?(this._lngRange=[e.getWest(),e.getEast()],this._latRange=[e.getSouth(),e.getNorth()],this._constrain()):(this._lngRange=null,this._latRange=[-ic,ic])}getConstrained(e,t){return this._callbacks.getConstrained(e,t)}getCameraQueryGeometry(e,t){if(t.length===1)return[t[0],e];{let{minX:r,minY:i,maxX:n,maxY:a}=tc.fromPoints(t).extend(e);return[new Gf.default(r,i),new Gf.default(n,i),new Gf.default(n,a),new Gf.default(r,a),new Gf.default(r,i)]}}_constrain(){if(!this.center||!this._width||!this._height||this._constraining)return;this._constraining=!0;let e=this._unmodified,{center:t,zoom:r}=this.getConstrained(this.center,this.zoom);this.setCenter(t),this.setZoom(r),this._unmodified=e,this._constraining=!1}_calcMatrices(){if(this._width&&this._height){this._pixelsToGLUnits=[2/this._width,-2/this._height];let e=_t.identity(new Float64Array(16));_t.scale(e,e,[this._width/2,-this._height/2,1]),_t.translate(e,e,[1,-1,0]),this._clipSpaceToPixelsMatrix=e,e=_t.identity(new Float64Array(16)),_t.scale(e,e,[1,-1,1]),_t.translate(e,e,[-1,-1,0]),_t.scale(e,e,[2/this._width,2/this._height,1]),this._pixelsToClipSpaceMatrix=e;let t=this.fovInRadians/2;this._cameraToCenterDistance=.5/Math.tan(t)*this._height}this._callbacks.calcMatrices()}calculateCenterFromCameraLngLatAlt(e,t,r,i){let n=r!==void 0?r:this.bearing,a=i=i!==void 0?i:this.pitch,o=Gi.fromLngLat(e,t),s=-Math.cos(mn(a)),l=Math.sin(mn(a)),u=l*Math.sin(mn(n)),c=-l*Math.cos(mn(n)),h=this.elevation,d=t-h,p;s*d>=0||Math.abs(s)<.1?(p=1e4,h=t+p*s):p=-d/s;let f=OO(1,o.y),m,g,v=0,_=10;do{if(v+=1,v>_)break;g=p/f;let E=u*g,M=c*g;m=new Gi(o.x+E,o.y+M),f=1/m.meterInMercatorCoordinateUnits()}while(Math.abs(p-g*f)>1e-12);let x=m.toLngLat(),b=Oo(this.height/2/Math.tan(this.fovInRadians/2)/g/this.tileSize);return{center:x,elevation:h,zoom:b}}recalculateZoomAndCenter(e){if(this.elevation-e===0)return;let t=Jf(1,this.center.lat)*this.worldSize,r=this.cameraToCenterDistance/t,i=Gi.fromLngLat(this.center,this.elevation),n=jO(this.center,this.elevation,this.pitch,this.bearing,r);this._elevation=e;let a=this.calculateCenterFromCameraLngLatAlt(n.toLngLat(),OO(n.z,i.y),this.bearing,this.pitch);this._elevation=a.elevation,this._center=a.center,this.setZoom(a.zoom)}getCameraPoint(){let e=this.pitchInRadians,t=Math.tan(e)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new Gf.default(t*Math.sin(this.rollInRadians),t*Math.cos(this.rollInRadians)))}getCameraAltitude(){return Math.cos(this.pitchInRadians)*this._cameraToCenterDistance/this._pixelPerMeter+this.elevation}getCameraLngLat(){let e=Jf(1,this.center.lat)*this.worldSize,t=this.cameraToCenterDistance/e;return jO(this.center,this.elevation,this.pitch,this.bearing,t).toLngLat()}getMercatorTileCoordinates(e){if(!e)return[0,0,1,1];let t=e.canonical.z>=0?1<<e.canonical.z:Math.pow(2,e.canonical.z);return[e.canonical.x/t,e.canonical.y/t,1/t/8192,1/t/8192]}},Kee=class qee{constructor(t,r){this.min=t,this.max=r,this.center=St.scale([],St.add([],this.min,this.max),.5)}quadrant(t){let r=[t%2===0,t<2],i=St.clone(this.min),n=St.clone(this.max);for(let a=0;a<r.length;a++)i[a]=r[a]?this.min[a]:this.center[a],n[a]=r[a]?this.center[a]:this.max[a];return n[2]=this.max[2],new qee(i,n)}distanceX(t){return Math.max(Math.min(this.max[0],t[0]),this.min[0])-t[0]}distanceY(t){return Math.max(Math.min(this.max[1],t[1]),this.min[1])-t[1]}intersectsFrustum(t){let r=!0;for(let i=0;i<t.planes.length;i++){let n=this.intersectsPlane(t.planes[i]);if(n===0)return 0;n===1&&(r=!1)}return r?2:t.aabb.min[0]>this.max[0]||t.aabb.min[1]>this.max[1]||t.aabb.min[2]>this.max[2]||t.aabb.max[0]<this.min[0]||t.aabb.max[1]<this.min[1]||t.aabb.max[2]<this.min[2]?0:1}intersectsPlane(t){let r=t[3],i=t[3];for(let n=0;n<3;n++)t[n]>0?(r+=t[n]*this.min[n],i+=t[n]*this.max[n]):(i+=t[n]*this.min[n],r+=t[n]*this.max[n]);return r>=0?2:i<0?0:1}},u4e=class{distanceToTile2d(e,t,r,i){let n=i.distanceX([e,t]),a=i.distanceY([e,t]);return Math.hypot(n,a)}getWrap(e,t,r){return r}getTileBoundingVolume(e,t,r,i){var n,a;let o=0,s=0;if(i!=null&&i.terrain){let u=new bo(e.z,t,e.z,e.x,e.y),c=i.terrain.getMinMaxElevation(u);o=(n=c.minElevation)!=null?n:Math.min(0,r),s=(a=c.maxElevation)!=null?a:Math.max(0,r)}let l=1<<e.z;return new Kee([t+e.x/l,e.y/l,o],[t+(e.x+1)/l,(e.y+1)/l,s])}allowVariableZoom(e,t){let r=e.fov*(Math.abs(Math.cos(e.rollInRadians))*e.height+Math.abs(Math.sin(e.rollInRadians))*e.width)/e.height,i=Ii(78.5-r/2,0,60);return!!t.terrain||e.pitch>i}allowWorldCopies(){return!0}prepareNextFrame(){}},$ee=class ete{constructor(t,r,i){this.points=t,this.planes=r,this.aabb=i}static fromInvProjectionMatrix(t,r=1,i=0,n,a){let o=[[-1,1,-1,1],[1,1,-1,1],[1,-1,-1,1],[-1,-1,-1,1],[-1,1,1,1],[1,1,1,1],[1,-1,1,1],[-1,-1,1,1]],s=a?[[6,5,4],[0,1,2],[0,3,7],[2,1,5],[3,2,6],[0,4,5]]:[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]],l=Math.pow(2,i),u=o.map(p=>c4e(p,t,r,l));n&&h4e(u,s[0],n,a);let c=s.map(p=>{let f=St.sub([],u[p[0]],u[p[1]]),m=St.sub([],u[p[2]],u[p[1]]),g=St.normalize([],St.cross([],f,m)),v=-St.dot(g,u[p[1]]);return g.concat(v)}),h=[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY],d=[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY];for(let p of u)for(let f=0;f<3;f++)h[f]=Math.min(h[f],p[f]),d[f]=Math.max(d[f],p[f]);return new ete(u,c,new Kee(h,d))}};yI=class tte{constructor(t,r,i,n,a){this._posMatrixCache=new Map,this._alignedPosMatrixCache=new Map,this._fogMatrixCacheF32=new Map,this._helper=new QU({calcMatrices:()=>{this._calcMatrices()},getConstrained:(o,s)=>this.getConstrained(o,s)},t,r,i,n,a),this._coveringTilesDetailsProvider=new u4e}get pixelsToClipSpaceMatrix(){return this._helper.pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._helper.clipSpaceToPixelsMatrix}get pixelsToGLUnits(){return this._helper.pixelsToGLUnits}get centerOffset(){return this._helper.centerOffset}get size(){return this._helper.size}get rotationMatrix(){return this._helper.rotationMatrix}get centerPoint(){return this._helper.centerPoint}get pixelsPerMeter(){return this._helper.pixelsPerMeter}setMinZoom(t){this._helper.setMinZoom(t)}setMaxZoom(t){this._helper.setMaxZoom(t)}setMinPitch(t){this._helper.setMinPitch(t)}setMaxPitch(t){this._helper.setMaxPitch(t)}setRenderWorldCopies(t){this._helper.setRenderWorldCopies(t)}setBearing(t){this._helper.setBearing(t)}setPitch(t){this._helper.setPitch(t)}setRoll(t){this._helper.setRoll(t)}setFov(t){this._helper.setFov(t)}setZoom(t){this._helper.setZoom(t)}setCenter(t){this._helper.setCenter(t)}setElevation(t){this._helper.setElevation(t)}setMinElevationForCurrentTile(t){this._helper.setMinElevationForCurrentTile(t)}setPadding(t){this._helper.setPadding(t)}interpolatePadding(t,r,i){return this._helper.interpolatePadding(t,r,i)}isPaddingEqual(t){return this._helper.isPaddingEqual(t)}resize(t,r,i=!0){this._helper.resize(t,r,i)}getMaxBounds(){return this._helper.getMaxBounds()}setMaxBounds(t){this._helper.setMaxBounds(t)}overrideNearFarZ(t,r){this._helper.overrideNearFarZ(t,r)}clearNearFarZOverride(){this._helper.clearNearFarZOverride()}getCameraQueryGeometry(t){return this._helper.getCameraQueryGeometry(this.getCameraPoint(),t)}get tileSize(){return this._helper.tileSize}get tileZoom(){return this._helper.tileZoom}get scale(){return this._helper.scale}get worldSize(){return this._helper.worldSize}get width(){return this._helper.width}get height(){return this._helper.height}get lngRange(){return this._helper.lngRange}get latRange(){return this._helper.latRange}get minZoom(){return this._helper.minZoom}get maxZoom(){return this._helper.maxZoom}get zoom(){return this._helper.zoom}get center(){return this._helper.center}get minPitch(){return this._helper.minPitch}get maxPitch(){return this._helper.maxPitch}get pitch(){return this._helper.pitch}get pitchInRadians(){return this._helper.pitchInRadians}get roll(){return this._helper.roll}get rollInRadians(){return this._helper.rollInRadians}get bearing(){return this._helper.bearing}get bearingInRadians(){return this._helper.bearingInRadians}get fov(){return this._helper.fov}get fovInRadians(){return this._helper.fovInRadians}get elevation(){return this._helper.elevation}get minElevationForCurrentTile(){return this._helper.minElevationForCurrentTile}get padding(){return this._helper.padding}get unmodified(){return this._helper.unmodified}get renderWorldCopies(){return this._helper.renderWorldCopies}get cameraToCenterDistance(){return this._helper.cameraToCenterDistance}get nearZ(){return this._helper.nearZ}get farZ(){return this._helper.farZ}get autoCalculateNearFarZ(){return this._helper.autoCalculateNearFarZ}setTransitionState(t,r){}clone(){let t=new tte;return t.apply(this),t}apply(t,r,i){this._helper.apply(t,r,i)}get cameraPosition(){return this._cameraPosition}get projectionMatrix(){return this._projectionMatrix}get modelViewProjectionMatrix(){return this._viewProjMatrix}get inverseProjectionMatrix(){return this._invProjMatrix}get mercatorMatrix(){return this._mercatorMatrix}getVisibleUnwrappedCoordinates(t){let r=[new AI(0,t)];if(this._helper._renderWorldCopies){let i=this.screenPointToMercatorCoordinate(new Cs.default(0,0)),n=this.screenPointToMercatorCoordinate(new Cs.default(this._helper._width,0)),a=this.screenPointToMercatorCoordinate(new Cs.default(this._helper._width,this._helper._height)),o=this.screenPointToMercatorCoordinate(new Cs.default(0,this._helper._height)),s=Math.floor(Math.min(i.x,n.x,a.x,o.x)),l=Math.floor(Math.max(i.x,n.x,a.x,o.x)),u=1;for(let c=s-u;c<=l+u;c++)c!==0&&r.push(new AI(c,t))}return r}getCameraFrustum(){return $ee.fromInvProjectionMatrix(this._invViewProjMatrix,this.worldSize)}getClippingPlane(){return null}getCoveringTilesDetailsProvider(){return this._coveringTilesDetailsProvider}recalculateZoomAndCenter(t){let r=this.screenPointToLocation(this.centerPoint,t),i=t?t.getElevationForLngLatZoom(r,this._helper._tileZoom):0;this._helper.recalculateZoomAndCenter(i)}setLocationAtPoint(t,r){let i=Jf(this.elevation,this.center.lat),n=this.screenPointToMercatorCoordinateAtZ(r,i),a=this.screenPointToMercatorCoordinateAtZ(this.centerPoint,i),o=Gi.fromLngLat(t),s=new Gi(o.x-(n.x-a.x),o.y-(n.y-a.y));this.setCenter(s==null?void 0:s.toLngLat()),this._helper._renderWorldCopies&&this.setCenter(this.center.wrap())}locationToScreenPoint(t,r){return r?this.coordinatePoint(Gi.fromLngLat(t),r.getElevationForLngLatZoom(t,this._helper._tileZoom),this._pixelMatrix3D):this.coordinatePoint(Gi.fromLngLat(t))}screenPointToLocation(t,r){var i;return(i=this.screenPointToMercatorCoordinate(t,r))==null?void 0:i.toLngLat()}screenPointToMercatorCoordinate(t,r){if(r){let i=r.pointCoordinate(t);if(i!=null)return i}return this.screenPointToMercatorCoordinateAtZ(t)}screenPointToMercatorCoordinateAtZ(t,r){let i=r||0,n=[t.x,t.y,0,1],a=[t.x,t.y,1,1];Kn.transformMat4(n,n,this._pixelMatrixInverse),Kn.transformMat4(a,a,this._pixelMatrixInverse);let o=n[3],s=a[3],l=n[0]/o,u=a[0]/s,c=n[1]/o,h=a[1]/s,d=n[2]/o,p=a[2]/s,f=d===p?0:(i-d)/(p-d);return new Gi(On.number(l,u,f)/this.worldSize,On.number(c,h,f)/this.worldSize,i)}coordinatePoint(t,r=0,i=this._pixelMatrix){let n=[t.x*this.worldSize,t.y*this.worldSize,r,1];return Kn.transformMat4(n,n,i),new Cs.default(n[0]/n[3],n[1]/n[3])}getBounds(){let t=Math.max(0,this._helper._height/2-WS(this));return new vh().extend(this.screenPointToLocation(new Cs.default(0,t))).extend(this.screenPointToLocation(new Cs.default(this._helper._width,t))).extend(this.screenPointToLocation(new Cs.default(this._helper._width,this._helper._height))).extend(this.screenPointToLocation(new Cs.default(0,this._helper._height)))}isPointOnMapSurface(t,r){return r?r.pointCoordinate(t)!=null:t.y>this.height/2-WS(this)}calculatePosMatrix(t,r=!1,i){var n;let a=(n=t.key)!=null?n:qg(t.wrap,t.canonical.z,t.canonical.z,t.canonical.x,t.canonical.y),o=r?this._alignedPosMatrixCache:this._posMatrixCache;if(o.has(a)){let u=o.get(a);return i?u.f32:u.f64}let s=B5(t,this.worldSize);_t.multiply(s,r?this._alignedProjMatrix:this._viewProjMatrix,s);let l={f64:s,f32:new Float32Array(s)};return o.set(a,l),i?l.f32:l.f64}calculateFogMatrix(t){let r=t.key,i=this._fogMatrixCacheF32;if(i.has(r))return i.get(r);let n=B5(t,this.worldSize);return _t.multiply(n,this._fogMatrix,n),i.set(r,new Float32Array(n)),i.get(r)}getConstrained(t,r){r=Ii(+r,this.minZoom,this.maxZoom);let i={center:new wr(t.lng,t.lat),zoom:r},n=this._helper._lngRange;if(!this._helper._renderWorldCopies&&n===null){let x=179.9999999999;n=[-x,x]}let a=this.tileSize*Lo(i.zoom),o=0,s=a,l=0,u=a,c=0,h=0,{x:d,y:p}=this.size;if(this._helper._latRange){let x=this._helper._latRange;o=tA(x[1])*a,s=tA(x[0])*a,s-o<p&&(c=p/(s-o))}n&&(l=Wf(hy(n[0])*a,0,a),u=Wf(hy(n[1])*a,0,a),u<l&&(u+=a),u-l<d&&(h=d/(u-l)));let{x:f,y:m}=Ku(a,t),g,v,_=Math.max(h||0,c||0);if(_){let x=new Cs.default(h?(u+l)/2:f,c?(s+o)/2:m);return i.center=Wx(a,x).wrap(),i.zoom+=Oo(_),i}if(this._helper._latRange){let x=p/2;m-x<o&&(v=o+x),m+x>s&&(v=s-x)}if(n){let x=(l+u)/2,b=f;this._helper._renderWorldCopies&&(b=Wf(f,x-a/2,x+a/2));let E=d/2;b-E<l&&(g=l+E),b+E>u&&(g=u-E)}if(g!==void 0||v!==void 0){let x=new Cs.default(g!=null?g:f,v!=null?v:m);i.center=Wx(a,x).wrap()}return i}calculateCenterFromCameraLngLatAlt(t,r,i,n){return this._helper.calculateCenterFromCameraLngLatAlt(t,r,i,n)}_calculateNearFarZIfNeeded(t,r,i){if(!this._helper.autoCalculateNearFarZ)return;let n=Math.min(this.elevation,this.minElevationForCurrentTile,this.getCameraAltitude()-100),a=t-n*this._helper._pixelPerMeter/Math.cos(r),o=n<0?a:t,s=Math.PI/2+this.pitchInRadians,l=mn(this.fov)*(Math.abs(Math.cos(mn(this.roll)))*this.height+Math.abs(Math.sin(mn(this.roll)))*this.width)/this.height*(.5+i.y/this.height),u=Math.sin(l)*o/Math.sin(Ii(Math.PI-s-l,.01,Math.PI-.01)),c=WS(this),h=Math.atan(c/this._helper.cameraToCenterDistance),d=mn(90-$g),p=h>d?2*h*(.5+i.y/(c*2)):d,f=Math.sin(p)*o/Math.sin(Ii(Math.PI-s-p,.01,Math.PI-.01)),m=Math.min(u,f);this._helper._farZ=(Math.cos(Math.PI/2-r)*m+o)*1.01,this._helper._nearZ=this._helper._height/50}_calcMatrices(){if(!this._helper._height)return;let t=this.centerOffset,r=Ku(this.worldSize,this.center),i=r.x,n=r.y;this._helper._pixelPerMeter=Jf(1,this.center.lat)*this.worldSize;let a=mn(Math.min(this.pitch,$g)),o=Math.max(this._helper.cameraToCenterDistance/2,this._helper.cameraToCenterDistance+this._helper._elevation*this._helper._pixelPerMeter/Math.cos(a));this._calculateNearFarZIfNeeded(o,a,t);let s;s=new Float64Array(16),_t.perspective(s,this.fovInRadians,this._helper._width/this._helper._height,this._helper._nearZ,this._helper._farZ),this._invProjMatrix=new Float64Array(16),_t.invert(this._invProjMatrix,s),s[8]=-t.x*2/this._helper._width,s[9]=t.y*2/this._helper._height,this._projectionMatrix=_t.clone(s),_t.scale(s,s,[1,-1,1]),_t.translate(s,s,[0,0,-this._helper.cameraToCenterDistance]),_t.rotateZ(s,s,-this.rollInRadians),_t.rotateX(s,s,this.pitchInRadians),_t.rotateZ(s,s,-this.bearingInRadians),_t.translate(s,s,[-i,-n,0]),this._mercatorMatrix=_t.scale([],s,[this.worldSize,this.worldSize,this.worldSize]),_t.scale(s,s,[1,1,this._helper._pixelPerMeter]),this._pixelMatrix=_t.multiply(new Float64Array(16),this.clipSpaceToPixelsMatrix,s),_t.translate(s,s,[0,0,-this.elevation]),this._viewProjMatrix=s,this._invViewProjMatrix=_t.invert([],s);let l=[0,0,-1,1];Kn.transformMat4(l,l,this._invViewProjMatrix),this._cameraPosition=[l[0]/l[3],l[1]/l[3],l[2]/l[3]],this._fogMatrix=new Float64Array(16),_t.perspective(this._fogMatrix,this.fovInRadians,this.width/this.height,o,this._helper._farZ),this._fogMatrix[8]=-t.x*2/this.width,this._fogMatrix[9]=t.y*2/this.height,_t.scale(this._fogMatrix,this._fogMatrix,[1,-1,1]),_t.translate(this._fogMatrix,this._fogMatrix,[0,0,-this.cameraToCenterDistance]),_t.rotateZ(this._fogMatrix,this._fogMatrix,-this.rollInRadians),_t.rotateX(this._fogMatrix,this._fogMatrix,this.pitchInRadians),_t.rotateZ(this._fogMatrix,this._fogMatrix,-this.bearingInRadians),_t.translate(this._fogMatrix,this._fogMatrix,[-i,-n,0]),_t.scale(this._fogMatrix,this._fogMatrix,[1,1,this._helper._pixelPerMeter]),_t.translate(this._fogMatrix,this._fogMatrix,[0,0,-this.elevation]),this._pixelMatrix3D=_t.multiply(new Float64Array(16),this.clipSpaceToPixelsMatrix,s);let u=this._helper._width%2/2,c=this._helper._height%2/2,h=Math.cos(this.bearingInRadians),d=Math.sin(-this.bearingInRadians),p=i-Math.round(i)+h*u+d*c,f=n-Math.round(n)+h*c+d*u,m=new Float64Array(s);if(_t.translate(m,m,[p>.5?p-1:p,f>.5?f-1:f,0]),this._alignedProjMatrix=m,s=_t.invert(new Float64Array(16),this._pixelMatrix),!s)throw new Error("failed to invert matrix");this._pixelMatrixInverse=s,this._clearMatrixCaches()}_clearMatrixCaches(){this._posMatrixCache.clear(),this._alignedPosMatrixCache.clear(),this._fogMatrixCacheF32.clear()}maxPitchScaleFactor(){if(!this._pixelMatrixInverse)return 1;let t=this.screenPointToMercatorCoordinate(new Cs.default(0,0)),r=[t.x*this.worldSize,t.y*this.worldSize,0,1];return Kn.transformMat4(r,r,this._pixelMatrix)[3]/this._helper.cameraToCenterDistance}getCameraPoint(){return this._helper.getCameraPoint()}getCameraAltitude(){return this._helper.getCameraAltitude()}getCameraLngLat(){let t=Jf(1,this.center.lat)*this.worldSize,r=this._helper.cameraToCenterDistance/t;return jO(this.center,this.elevation,this.pitch,this.bearing,r).toLngLat()}lngLatToCameraDepth(t,r){let i=Gi.fromLngLat(t),n=[i.x*this.worldSize,i.y*this.worldSize,r,1];return Kn.transformMat4(n,n,this._viewProjMatrix),n[2]/n[3]}getProjectionData(t){let{overscaledTileID:r,aligned:i,applyTerrainMatrix:n}=t,a=this._helper.getMercatorTileCoordinates(r),o=r?this.calculatePosMatrix(r,i,!0):null,s;return r&&r.terrainRttPosMatrix32f&&n?s=r.terrainRttPosMatrix32f:o?s=o:s=hq(),{mainMatrix:s,tileMercatorCoords:a,clippingPlane:[0,0,0,0],projectionTransition:0,fallbackMatrix:s}}isLocationOccluded(t){return!1}getPixelScale(){return 1}getCircleRadiusCorrection(){return 1}getPitchedTextCorrection(t,r,i){return 1}transformLightDirection(t){return St.clone(t)}getRayDirectionFromPixel(t){throw new Error("Not implemented.")}projectTileCoordinates(t,r,i,n){let a=this.calculatePosMatrix(i),o;n?(o=[t,r,n(t,r),1],Kn.transformMat4(o,o,a)):(o=[t,r,0,1],UU(o,o,a));let s=o[3];return{point:new Cs.default(o[0]/s,o[1]/s),signedDistanceFromCamera:s,isOccluded:!1}}populateCache(t){for(let r of t)this.calculatePosMatrix(r)}getMatrixForModel(t,r){let i=Gi.fromLngLat(t,r),n=i.meterInMercatorCoordinateUnits(),a=Cg();return _t.translate(a,a,[i.x,i.y,i.z]),_t.rotateZ(a,a,Math.PI),_t.rotateX(a,a,Math.PI/2),_t.scale(a,a,[-n,n,n]),a}getProjectionDataForCustomLayer(t=!0){let r=new bo(0,0,0,0,0),i=this.getProjectionData({overscaledTileID:r,applyGlobeMatrix:t}),n=B5(r,this.worldSize);_t.multiply(n,this._viewProjMatrix,n),i.tileMercatorCoords=[0,0,1,1];let a=[8192,8192,this.worldSize/this._helper.pixelsPerMeter],o=Yd();return _t.scale(o,n,a),i.fallbackMatrix=o,i.mainMatrix=o,i}getFastPathSimpleProjectionMatrix(t){return this.calculatePosMatrix(t)}},vS=Er(zr(),1);vI=class{get useGlobeControls(){return!1}handlePanInertia(e,t){return{easingOffset:e,easingCenter:t.center}}handleMapControlsRollPitchBearingZoom(e,t){e.bearingDelta&&t.setBearing(t.bearing+e.bearingDelta),e.pitchDelta&&t.setPitch(t.pitch+e.pitchDelta),e.rollDelta&&t.setRoll(t.roll+e.rollDelta),e.zoomDelta&&t.setZoom(t.zoom+e.zoomDelta)}handleMapControlsPan(e,t,r){e.around.distSqr(t.centerPoint)<.01||t.setLocationAtPoint(r,e.around)}cameraForBoxAndBearing(e,t,r,i,n){return nte(e,t,r,i,n)}handleJumpToCenterZoom(e,t){let r=typeof t.zoom<"u"?+t.zoom:e.zoom;e.zoom!==r&&e.setZoom(+t.zoom),t.center!==void 0&&e.setCenter(wr.convert(t.center))}handleEaseTo(e,t){let r=e.zoom,i=e.padding,n={roll:e.roll,pitch:e.pitch,bearing:e.bearing},a=t.roll===void 0?e.roll:t.roll,o=t.pitch===void 0?e.pitch:t.pitch,s=t.bearing===void 0?e.bearing:t.bearing,l={roll:a,pitch:o,bearing:s},u=typeof t.zoom<"u",c=!e.isPaddingEqual(t.padding),h=!1,d=u?+t.zoom:e.zoom,p=e.centerPoint.add(t.offsetAsPoint),f=e.screenPointToLocation(p),{center:m,zoom:g}=e.getConstrained(wr.convert(t.center||f),d!=null?d:r);gI(e,m);let v=Ku(e.worldSize,f),_=Ku(e.worldSize,m).sub(v),x=Lo(g-r);return h=g!==r,{easeFunc:b=>{if(h&&e.setZoom(On.number(r,g,b)),Aq(n,l)||ite({startEulerAngles:n,endEulerAngles:l,tr:e,k:b,useSlerp:n.roll!=l.roll}),c&&(e.interpolatePadding(i,t.padding,b),p=e.centerPoint.add(t.offsetAsPoint)),t.around)e.setLocationAtPoint(t.around,t.aroundPoint);else{let E=Lo(e.zoom-r),M=g>r?Math.min(2,x):Math.max(.5,x),S=Math.pow(M,1-b),D=Wx(e.worldSize,v.add(_.mult(b*S)).mult(E));e.setLocationAtPoint(e.renderWorldCopies?D.wrap():D,p)}},isZooming:h,elevationCenter:m}}handleFlyTo(e,t){let r=typeof t.zoom<"u",i=e.zoom,n=e.getConstrained(wr.convert(t.center||t.locationAtOffset),r?+t.zoom:i),a=n.center,o=n.zoom;gI(e,a);let s=Ku(e.worldSize,t.locationAtOffset),l=Ku(e.worldSize,a).sub(s),u=l.mag(),c=Lo(o-i),h=typeof t.minZoom<"u",d;if(h){let p=Math.min(+t.minZoom,i,o),f=e.getConstrained(a,p).zoom;d=Lo(f-i)}return{easeFunc:(p,f,m,g)=>{e.setZoom(p===1?o:i+Oo(f));let v=p===1?a:Wx(e.worldSize,s.add(l.mult(m)).mult(f));e.setLocationAtPoint(e.renderWorldCopies?v.wrap():v,g)},scaleOfZoom:c,targetCenter:a,scaleOfMinZoom:d,pixelPathLength:u}}},f4e=0,ate=1,A4e=771,Sn=class{constructor(e,t,r){this.blendFunction=e,this.blendColor=t,this.mask=r}};Sn.Replace=[ate,f4e];Sn.disabled=new Sn(Sn.Replace,mr.transparent,[!1,!1,!1,!1]);Sn.unblended=new Sn(Sn.Replace,mr.transparent,[!0,!0,!0,!0]);Sn.alphaBlended=new Sn([ate,A4e],mr.transparent,[!0,!0,!0,!0]);xi=class{constructor(e,t,r){this.enable=e,this.mode=t,this.frontFace=r}};xi.disabled=new xi(!1,1029,2305);xi.backCCW=new xi(!0,1029,2305);xi.frontCCW=new xi(!0,1028,2305);Ur=class{constructor(e,t,r){this.func=e,this.mask=t,this.range=r}};Ur.ReadOnly=!1;Ur.ReadWrite=!0;Ur.disabled=new Ur(519,Ur.ReadOnly,[0,1]);Mi=class{constructor(e,t,r,i,n,a){this.test=e,this.ref=t,this.mask=r,this.fail=i,this.depthFail=n,this.pass=a}};Mi.disabled=new Mi({func:519,mask:0},0,0,7680,7680,7680);m4e=(e,t)=>({u_input:new Rt(e,t.u_input),u_output_expected:new Rt(e,t.u_output_expected)}),g4e=(e,t)=>({u_input:e,u_output_expected:t}),D5=new WeakMap;y4e=class ote{constructor(t){this._readbackWaitFrames=4,this._measureWaitFrames=6,this._texWidth=1,this._texHeight=1,this._measuredError=0,this._updateCount=0,this._lastReadbackFrame=-1e3,this._readbackQueue=null,this._cachedRenderContext=t;let r=t.context,i=r.gl;this._texFormat=i.RGBA,this._texType=i.UNSIGNED_BYTE;let n=new ph;n.emplaceBack(-1,-1),n.emplaceBack(2,-1),n.emplaceBack(-1,2);let a=new au;a.emplaceBack(0,1,2),this._fullscreenTriangle=new gy(r.createVertexBuffer(n,Wd.members),r.createIndexBuffer(a),gn.simpleSegment(0,0,n.length,a.length)),this._resultBuffer=new Uint8Array(4),r.activeTexture.set(i.TEXTURE1);let o=i.createTexture();i.bindTexture(i.TEXTURE_2D,o),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,i.CLAMP_TO_EDGE),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_T,i.CLAMP_TO_EDGE),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,i.NEAREST),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MAG_FILTER,i.NEAREST),i.texImage2D(i.TEXTURE_2D,0,this._texFormat,this._texWidth,this._texHeight,0,this._texFormat,this._texType,null),this._fbo=r.createFramebuffer(this._texWidth,this._texHeight,!1,!1),this._fbo.colorAttachment.set(o),mh(i)&&(this._pbo=i.createBuffer(),i.bindBuffer(i.PIXEL_PACK_BUFFER,this._pbo),i.bufferData(i.PIXEL_PACK_BUFFER,4,i.STREAM_READ),i.bindBuffer(i.PIXEL_PACK_BUFFER,null))}get awaitingQuery(){return!!this._readbackQueue}destroy(){let t=this._cachedRenderContext.context.gl;this._fullscreenTriangle.destroy(),this._fbo.destroy(),t.deleteBuffer(this._pbo),this._fullscreenTriangle=null,this._fbo=null,this._pbo=null,this._resultBuffer=null}updateErrorLoop(t,r){let i=this._updateCount;return this._readbackQueue?i>=this._readbackQueue.frameNumberIssued+this._readbackWaitFrames&&this._tryReadback():i>=this._lastReadbackFrame+this._measureWaitFrames&&this._renderErrorTexture(t,r),this._updateCount++,this._measuredError}_bindFramebuffer(){let t=this._cachedRenderContext.context,r=t.gl;t.activeTexture.set(r.TEXTURE1),r.bindTexture(r.TEXTURE_2D,this._fbo.colorAttachment.get()),t.bindFramebuffer.set(this._fbo.framebuffer)}_renderErrorTexture(t,r){let i=this._cachedRenderContext.context,n=i.gl;if(this._bindFramebuffer(),i.viewport.set([0,0,this._texWidth,this._texHeight]),i.clear({color:mr.transparent}),this._cachedRenderContext.useProgram("projectionErrorMeasurement").draw(i,n.TRIANGLES,Ur.disabled,Mi.disabled,Sn.unblended,xi.disabled,g4e(t,r),null,null,"$clipping",this._fullscreenTriangle.vertexBuffer,this._fullscreenTriangle.indexBuffer,this._fullscreenTriangle.segments),this._pbo&&mh(n)){n.bindBuffer(n.PIXEL_PACK_BUFFER,this._pbo),n.readBuffer(n.COLOR_ATTACHMENT0),n.readPixels(0,0,this._texWidth,this._texHeight,this._texFormat,this._texType,0),n.bindBuffer(n.PIXEL_PACK_BUFFER,null);let a=n.fenceSync(n.SYNC_GPU_COMMANDS_COMPLETE,0);n.flush(),this._readbackQueue={frameNumberIssued:this._updateCount,sync:a}}else this._readbackQueue={frameNumberIssued:this._updateCount,sync:null}}_tryReadback(){let t=this._cachedRenderContext.context.gl;if(this._pbo&&this._readbackQueue&&mh(t)){let r=t.clientWaitSync(this._readbackQueue.sync,0,0);if(r===t.WAIT_FAILED){oa("WebGL2 clientWaitSync failed."),this._readbackQueue=null,this._lastReadbackFrame=this._updateCount;return}if(r===t.TIMEOUT_EXPIRED)return;t.bindBuffer(t.PIXEL_PACK_BUFFER,this._pbo),t.getBufferSubData(t.PIXEL_PACK_BUFFER,0,this._resultBuffer,0,4),t.bindBuffer(t.PIXEL_PACK_BUFFER,null)}else this._bindFramebuffer(),t.readPixels(0,0,this._texWidth,this._texHeight,this._texFormat,this._texType,this._resultBuffer);this._readbackQueue=null,this._measuredError=ote._parseRGBA8float(this._resultBuffer),this._lastReadbackFrame=this._updateCount}static _parseRGBA8float(t){let r=0;return r+=t[0]/256,r+=t[1]/65536,r+=t[2]/16777216,t[3]<127&&(r=-r),r/128}},xS=8192/128;_4e="#define GLOBE",b4e="globe",rJ={errorTransitionTimeSeconds:.5},k5=new kU({fill:new fh(128,2),line:new fh(512,0),tile:new fh(128,32),stencil:new fh(128,1),circle:3}),ste=class{constructor(){this._tileMeshCache={},this._errorCorrectionUsable=0,this._errorMeasurementLastValue=0,this._errorCorrectionPreviousValue=0,this._errorMeasurementLastChangeTime=-1e3}get name(){return"vertical-perspective"}get transitionState(){return 1}get useSubdivision(){return!0}get shaderVariantName(){return b4e}get shaderDefine(){return _4e}get shaderPreludeCode(){return qu.projectionGlobe}get vertexShaderPreludeCode(){return qu.projectionMercator.vertexSource}get subdivisionGranularity(){return k5}get useGlobeControls(){return!0}get latitudeErrorCorrectionRadians(){return this._errorCorrectionUsable}destroy(){this._errorMeasurement&&this._errorMeasurement.destroy()}updateGPUdependent(e){this._errorMeasurement||(this._errorMeasurement=new y4e(e));let t=tA(this._errorQueryLatitudeDegrees),r=2*Math.atan(Math.exp(Math.PI-t*Math.PI*2))-Math.PI*.5,i=this._errorMeasurement.updateErrorLoop(t,r),n=ri.now();i!==this._errorMeasurementLastValue&&(this._errorCorrectionPreviousValue=this._errorCorrectionUsable,this._errorMeasurementLastValue=i,this._errorMeasurementLastChangeTime=n);let a=(n-this._errorMeasurementLastChangeTime)/1e3,o=Math.min(Math.max(a/rJ.errorTransitionTimeSeconds,0),1),s=-this._errorMeasurementLastValue;this._errorCorrectionUsable=Xg(this._errorCorrectionPreviousValue,s,dq(o))}_getMeshKey(e){return"".concat(e.granularity.toString(36),"_").concat(e.generateBorders?"b":"").concat(e.extendToNorthPole?"n":"").concat(e.extendToSouthPole?"s":"")}getMeshFromTileID(e,t,r,i,n){let a=(n==="stencil"?k5.stencil:k5.tile).getGranularityForZoomLevel(t.z),o=t.y===0&&i,s=t.y===(1<<t.z)-1&&i;return this._getMesh(e,{granularity:a,generateBorders:r,extendToNorthPole:o,extendToSouthPole:s})}_getMesh(e,t){let r=this._getMeshKey(t);if(r in this._tileMeshCache)return this._tileMeshCache[r];let i=v4e(e,t);return this._tileMeshCache[r]=i,i}recalculate(e){}hasTransition(){let e=ri.now(),t=!1;return t=t||(e-this._errorMeasurementLastChangeTime)/1e3<rJ.errorTransitionTimeSeconds+.2,t=t||this._errorMeasurement&&this._errorMeasurement.awaitingQuery,t}setErrorQueryLatitudeDegrees(e){this._errorQueryLatitudeDegrees=e}},w4e=new ao({type:new Wt(ht.projection.type)}),iJ=class extends cs{constructor(e){super(),this._transitionable=new KI(w4e),this.setProjection(e),this._transitioning=this._transitionable.untransitioned(),this.recalculate(new ea(0)),this._mercatorProjection=new ZO,this._verticalPerspectiveProjection=new ste}get transitionState(){let e=this.properties.get("type");if(typeof e=="string"&&e==="mercator")return 0;if(typeof e=="string"&&e==="vertical-perspective")return 1;if(e instanceof oA){if(e.from==="vertical-perspective"&&e.to==="mercator")return 1-e.transition;if(e.from==="mercator"&&e.to==="vertical-perspective")return e.transition}return 1}get useGlobeRendering(){return this.transitionState>0}get latitudeErrorCorrectionRadians(){return this._verticalPerspectiveProjection.latitudeErrorCorrectionRadians}get currentProjection(){return this.useGlobeRendering?this._verticalPerspectiveProjection:this._mercatorProjection}get name(){return"globe"}get useSubdivision(){return this.currentProjection.useSubdivision}get shaderVariantName(){return this.currentProjection.shaderVariantName}get shaderDefine(){return this.currentProjection.shaderDefine}get shaderPreludeCode(){return this.currentProjection.shaderPreludeCode}get vertexShaderPreludeCode(){return this.currentProjection.vertexShaderPreludeCode}get subdivisionGranularity(){return this.currentProjection.subdivisionGranularity}get useGlobeControls(){return this.transitionState>0}destroy(){this._mercatorProjection.destroy(),this._verticalPerspectiveProjection.destroy()}updateGPUdependent(e){this._mercatorProjection.updateGPUdependent(e),this._verticalPerspectiveProjection.updateGPUdependent(e)}getMeshFromTileID(e,t,r,i,n){return this.currentProjection.getMeshFromTileID(e,t,r,i,n)}setProjection(e){this._transitionable.setValue("type",(e==null?void 0:e.type)||"mercator")}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()||this.currentProjection.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}setErrorQueryLatitudeDegrees(e){this._verticalPerspectiveProjection.setErrorQueryLatitudeDegrees(e),this._mercatorProjection.setErrorQueryLatitudeDegrees(e)}},Uu=Er(zr(),1);T4e=class{constructor(e){this._cachePrevious=new Map,this._cache=new Map,this._hadAnyChanges=!1,this._boundingVolumeFactory=e}swapBuffers(){if(!this._hadAnyChanges)return;let e=this._cachePrevious;this._cachePrevious=this._cache,this._cache=e,this._cache.clear(),this._hadAnyChanges=!1}getTileBoundingVolume(e,t,r,i){let n="".concat(e.z,"_").concat(e.x,"_").concat(e.y,"_").concat(i!=null&&i.terrain?"t":""),a=this._cache.get(n);if(a)return a;let o=this._cachePrevious.get(n);if(o)return this._cache.set(n,o),o;let s=this._boundingVolumeFactory(e,t,r,i);return this._cache.set(n,s),this._hadAnyChanges=!0,s}},F5=class XO{constructor(t,r,i,n){this.min=i,this.max=n,this.points=t,this.planes=r}static fromAabb(t,r){let i=[];for(let n=0;n<8;n++)i.push([(n>>0&1)===1?r[0]:t[0],(n>>1&1)===1?r[1]:t[1],(n>>2&1)===1?r[2]:t[2]]);return new XO(i,[[-1,0,0,r[0]],[1,0,0,-t[0]],[0,-1,0,r[1]],[0,1,0,-t[1]],[0,0,-1,r[2]],[0,0,1,-t[2]]],t,r)}static fromCenterSizeAngles(t,r,i){let n=PI.fromEuler([],i[0],i[1],i[2]),a=St.transformQuat([],[r[0],0,0],n),o=St.transformQuat([],[0,r[1],0],n),s=St.transformQuat([],[0,0,r[2]],n),l=[...t],u=[...t];for(let h=0;h<8;h++)for(let d=0;d<3;d++){let p=t[d]+a[d]*((h>>0&1)===1?1:-1)+o[d]*((h>>1&1)===1?1:-1)+s[d]*((h>>2&1)===1?1:-1);l[d]=Math.min(l[d],p),u[d]=Math.max(u[d],p)}let c=[];for(let h=0;h<8;h++){let d=[...t];St.add(d,d,St.scale([],a,(h>>0&1)===1?1:-1)),St.add(d,d,St.scale([],o,(h>>1&1)===1?1:-1)),St.add(d,d,St.scale([],s,(h>>2&1)===1?1:-1)),c.push(d)}return new XO(c,[[...a,-St.dot(a,c[0])],[...o,-St.dot(o,c[0])],[...s,-St.dot(s,c[0])],[-a[0],-a[1],-a[2],-St.dot(a,c[7])],[-o[0],-o[1],-o[2],-St.dot(o,c[7])],[-s[0],-s[1],-s[2],-St.dot(s,c[7])]],l,u)}intersectsFrustum(t){let r=!0,i=this.points.length,n=this.planes.length,a=t.planes.length,o=t.points.length;for(let s=0;s<a;s++){let l=t.planes[s],u=0;for(let c=0;c<i;c++){let h=this.points[c];l[0]*h[0]+l[1]*h[1]+l[2]*h[2]+l[3]>=0&&u++}if(u===0)return 0;u<i&&(r=!1)}if(r)return 2;for(let s=0;s<n;s++){let l=this.planes[s],u=0;for(let c=0;c<o;c++){let h=t.points[c];l[0]*h[0]+l[1]*h[1]+l[2]*h[2]+l[3]>=0&&u++}if(u===0)return 0}return 1}intersectsPlane(t){let r=this.points.length,i=0;for(let n=0;n<r;n++){let a=this.points[n];t[0]*a[0]+t[1]*a[1]+t[2]*a[2]+t[3]>=0&&i++}return i===r?2:i===0?0:1}};P4e=class{constructor(){this._boundingVolumeCache=new T4e(this._computeTileBoundingVolume)}prepareNextFrame(){this._boundingVolumeCache.swapBuffers()}distanceToTile2d(e,t,r,i){let n=1<<r.z,a=1/n,o=r.x/n,s=r.y/n,l=1,u=.5*l,c=2*l;return c=Math.min(c,z5(e,t,o,s,a)),c=Math.min(c,z5(e,t,o+u,-s-a,a)),c=Math.min(c,z5(e,t,o+u,l+l-s-a,a)),c}getWrap(e,t,r){let i=1<<t.z,n=1/i,a=t.x/i,o=ZS(e.x,a,n),s=ZS(e.x,a-1,n),l=ZS(e.x,a+1,n),u=Math.min(o,s,l);return u===l?1:u===s?-1:0}allowVariableZoom(e,t){return lC(e,t)>4}allowWorldCopies(){return!1}getTileBoundingVolume(e,t,r,i){return this._boundingVolumeCache.getTileBoundingVolume(e,t,r,i)}_computeTileBoundingVolume(e,t,r,i){var n,a;let o=0,s=0;if(i!=null&&i.terrain){let l=new bo(e.z,t,e.z,e.x,e.y),u=i.terrain.getMinMaxElevation(l);o=(n=u.minElevation)!=null?n:Math.min(0,r),s=(a=u.maxElevation)!=null?a:Math.max(0,r)}if(o/=Xu,s/=Xu,o+=1,s+=1,e.z<=0)return F5.fromAabb([-s,-s,-s],[s,s,s]);if(e.z===1)return F5.fromAabb([e.x===0?-s:0,e.y===0?0:-s,-s],[e.x===0?0:s,e.y===0?s:0,s]);{let l=[Qd(0,0,e.x,e.y,e.z),Qd(8192,0,e.x,e.y,e.z),Qd(8192,8192,e.x,e.y,e.z),Qd(0,8192,e.x,e.y,e.z)],u=[];for(let P of l)u.push(St.scale([],P,s));if(s!==o)for(let P of l)u.push(St.scale([],P,o));e.y===0&&u.push([0,1,0]),e.y===(1<<e.z)-1&&u.push([0,-1,0]);let c=[1,1,1],h=[-1,-1,-1];for(let P of u)for(let k=0;k<3;k++)c[k]=Math.min(c[k],P[k]),h[k]=Math.max(h[k],P[k]);let d=Qd(8192/2,8192/2,e.x,e.y,e.z),p=St.cross([],[0,1,0],d);St.normalize(p,p);let f=St.cross([],d,p);St.normalize(f,f);let m=St.cross([],l[2],l[1]);St.normalize(m,m);let g=St.cross([],l[0],l[3]);St.normalize(g,g),u.push(St.scale([],d,s)),e.y>=(1<<e.z)/2&&u.push(St.scale([],Qd(8192/2,0,e.x,e.y,e.z),s)),e.y<(1<<e.z)/2&&u.push(St.scale([],Qd(8192/2,8192,e.x,e.y,e.z),s));let v=sJ(d,u),_=sJ(f,u),x=[-d[0],-d[1],-d[2],v.max],b=[d[0],d[1],d[2],-v.min],E=[-f[0],-f[1],-f[2],_.max],M=[f[0],f[1],f[2],-_.min],S=[...m,0],D=[...g,0],T=[];return e.y===0?T.push(sl(D,S,x),sl(D,S,b)):T.push(sl(E,S,x),sl(E,S,b),sl(E,D,x),sl(E,D,b)),e.y===(1<<e.z)-1?T.push(sl(D,S,x),sl(D,S,b)):T.push(sl(M,S,x),sl(M,S,b),sl(M,D,x),sl(M,D,b)),new F5(T,[x,b,E,M,S,D],c,h)}}};ute=class cte{constructor(){this._cachedClippingPlane=Y1(),this._projectionMatrix=Cg(),this._globeViewProjMatrix32f=hq(),this._globeViewProjMatrixNoCorrection=Cg(),this._globeViewProjMatrixNoCorrectionInverted=Cg(),this._globeProjMatrixInverted=Cg(),this._cameraPosition=na(),this._globeLatitudeErrorCorrectionRadians=0,this._helper=new QU({calcMatrices:()=>{this._calcMatrices()},getConstrained:(t,r)=>this.getConstrained(t,r)}),this._coveringTilesDetailsProvider=new P4e}get pixelsToClipSpaceMatrix(){return this._helper.pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._helper.clipSpaceToPixelsMatrix}get pixelsToGLUnits(){return this._helper.pixelsToGLUnits}get centerOffset(){return this._helper.centerOffset}get size(){return this._helper.size}get rotationMatrix(){return this._helper.rotationMatrix}get centerPoint(){return this._helper.centerPoint}get pixelsPerMeter(){return this._helper.pixelsPerMeter}setMinZoom(t){this._helper.setMinZoom(t)}setMaxZoom(t){this._helper.setMaxZoom(t)}setMinPitch(t){this._helper.setMinPitch(t)}setMaxPitch(t){this._helper.setMaxPitch(t)}setRenderWorldCopies(t){this._helper.setRenderWorldCopies(t)}setBearing(t){this._helper.setBearing(t)}setPitch(t){this._helper.setPitch(t)}setRoll(t){this._helper.setRoll(t)}setFov(t){this._helper.setFov(t)}setZoom(t){this._helper.setZoom(t)}setCenter(t){this._helper.setCenter(t)}setElevation(t){this._helper.setElevation(t)}setMinElevationForCurrentTile(t){this._helper.setMinElevationForCurrentTile(t)}setPadding(t){this._helper.setPadding(t)}interpolatePadding(t,r,i){return this._helper.interpolatePadding(t,r,i)}isPaddingEqual(t){return this._helper.isPaddingEqual(t)}resize(t,r){this._helper.resize(t,r)}getMaxBounds(){return this._helper.getMaxBounds()}setMaxBounds(t){this._helper.setMaxBounds(t)}overrideNearFarZ(t,r){this._helper.overrideNearFarZ(t,r)}clearNearFarZOverride(){this._helper.clearNearFarZOverride()}getCameraQueryGeometry(t){return this._helper.getCameraQueryGeometry(this.getCameraPoint(),t)}get tileSize(){return this._helper.tileSize}get tileZoom(){return this._helper.tileZoom}get scale(){return this._helper.scale}get worldSize(){return this._helper.worldSize}get width(){return this._helper.width}get height(){return this._helper.height}get lngRange(){return this._helper.lngRange}get latRange(){return this._helper.latRange}get minZoom(){return this._helper.minZoom}get maxZoom(){return this._helper.maxZoom}get zoom(){return this._helper.zoom}get center(){return this._helper.center}get minPitch(){return this._helper.minPitch}get maxPitch(){return this._helper.maxPitch}get pitch(){return this._helper.pitch}get pitchInRadians(){return this._helper.pitchInRadians}get roll(){return this._helper.roll}get rollInRadians(){return this._helper.rollInRadians}get bearing(){return this._helper.bearing}get bearingInRadians(){return this._helper.bearingInRadians}get fov(){return this._helper.fov}get fovInRadians(){return this._helper.fovInRadians}get elevation(){return this._helper.elevation}get minElevationForCurrentTile(){return this._helper.minElevationForCurrentTile}get padding(){return this._helper.padding}get unmodified(){return this._helper.unmodified}get renderWorldCopies(){return this._helper.renderWorldCopies}get nearZ(){return this._helper.nearZ}get farZ(){return this._helper.farZ}get autoCalculateNearFarZ(){return this._helper.autoCalculateNearFarZ}setTransitionState(t){}clone(){let t=new cte;return t.apply(this),t}apply(t,r){this._globeLatitudeErrorCorrectionRadians=r||0,this._helper.apply(t)}get projectionMatrix(){return this._projectionMatrix}get modelViewProjectionMatrix(){return this._globeViewProjMatrixNoCorrection}get inverseProjectionMatrix(){return this._globeProjMatrixInverted}get cameraPosition(){let t=na();return t[0]=this._cameraPosition[0],t[1]=this._cameraPosition[1],t[2]=this._cameraPosition[2],t}get cameraToCenterDistance(){return this._helper.cameraToCenterDistance}getProjectionData(t){let{overscaledTileID:r,applyGlobeMatrix:i}=t,n=this._helper.getMercatorTileCoordinates(r);return{mainMatrix:this._globeViewProjMatrix32f,tileMercatorCoords:n,clippingPlane:this._cachedClippingPlane,projectionTransition:i?1:0,fallbackMatrix:this._globeViewProjMatrix32f}}_computeClippingPlane(t){let r=this.pitchInRadians,i=this.cameraToCenterDistance/t,n=1,a=Math.sin(r)*i,o=Math.cos(r)*i+n,s=Math.sqrt(a*a+o*o),l=n/s*n,u=-a,c=o,h=Math.sqrt(u*u+c*c);u/=h,c/=h;let d=[0,u,c];St.rotateZ(d,d,[0,0,0],-this.bearingInRadians),St.rotateX(d,d,[0,0,0],-1*this.center.lat*Math.PI/180),St.rotateY(d,d,[0,0,0],this.center.lng*Math.PI/180);let p=1/St.length(d);return St.scale(d,d,p),[...d,-l*p]}isLocationOccluded(t){return!this.isSurfacePointVisible(_o(t))}transformLightDirection(t){let r=this._helper._center.lng*Math.PI/180,i=this._helper._center.lat*Math.PI/180,n=Math.cos(i),a=[Math.sin(r)*n,Math.sin(i),Math.cos(r)*n],o=[a[2],0,-a[0]],s=[0,0,0];St.cross(s,o,a),St.normalize(o,o),St.normalize(s,s);let l=[o[0]*t[0]+s[0]*t[1]+a[0]*t[2],o[1]*t[0]+s[1]*t[1]+a[1]*t[2],o[2]*t[0]+s[2]*t[1]+a[2]*t[2]],u=[0,0,0];return St.normalize(u,l),u}getPixelScale(){return 1/Math.cos(this._helper._center.lat*Math.PI/180)}getCircleRadiusCorrection(){return Math.cos(this._helper._center.lat*Math.PI/180)}getPitchedTextCorrection(t,r,i){let n=c3e(t,r,i.canonical),a=M4e(n.x,n.y);return this.getCircleRadiusCorrection()/Math.cos(a[1])}projectTileCoordinates(t,r,i,n){let a=i.canonical,o=Qd(t,r,a.x,a.y,a.z),s=1+(n?n(t,r):0)/Xu,l=[o[0]*s,o[1]*s,o[2]*s,1];Kn.transformMat4(l,l,this._globeViewProjMatrixNoCorrection);let u=this._cachedClippingPlane,c=u[0]*o[0]+u[1]*o[1]+u[2]*o[2]+u[3]<0;return{point:new Uu.default(l[0]/l[3],l[1]/l[3]),signedDistanceFromCamera:l[3],isOccluded:c}}_calcMatrices(){if(!this._helper._width||!this._helper._height)return;let t=cC(this.worldSize,this.center.lat),r=Yd(),i=Yd();this._helper.autoCalculateNearFarZ&&(this._helper._nearZ=.5,this._helper._farZ=this.cameraToCenterDistance+t*2),_t.perspective(r,this.fovInRadians,this.width/this.height,this._helper._nearZ,this._helper._farZ);let n=this.centerOffset;r[8]=-n.x*2/this._helper._width,r[9]=n.y*2/this._helper._height,this._projectionMatrix=_t.clone(r),this._globeProjMatrixInverted=Yd(),_t.invert(this._globeProjMatrixInverted,r),_t.translate(r,r,[0,0,-this.cameraToCenterDistance]),_t.rotateZ(r,r,this.rollInRadians),_t.rotateX(r,r,-this.pitchInRadians),_t.rotateZ(r,r,this.bearingInRadians),_t.translate(r,r,[0,0,-t]);let a=na();a[0]=t,a[1]=t,a[2]=t,_t.rotateX(i,r,this.center.lat*Math.PI/180),_t.rotateY(i,i,-this.center.lng*Math.PI/180),_t.scale(i,i,a),this._globeViewProjMatrixNoCorrection=i,_t.rotateX(r,r,this.center.lat*Math.PI/180-this._globeLatitudeErrorCorrectionRadians),_t.rotateY(r,r,-this.center.lng*Math.PI/180),_t.scale(r,r,a),this._globeViewProjMatrix32f=new Float32Array(r),this._globeViewProjMatrixNoCorrectionInverted=Yd(),_t.invert(this._globeViewProjMatrixNoCorrectionInverted,i);let o=na();this._cameraPosition=na(),this._cameraPosition[2]=this.cameraToCenterDistance/t,St.rotateZ(this._cameraPosition,this._cameraPosition,o,-this.rollInRadians),St.rotateX(this._cameraPosition,this._cameraPosition,o,this.pitchInRadians),St.rotateZ(this._cameraPosition,this._cameraPosition,o,-this.bearingInRadians),St.add(this._cameraPosition,this._cameraPosition,[0,0,1]),St.rotateX(this._cameraPosition,this._cameraPosition,o,-this.center.lat*Math.PI/180),St.rotateY(this._cameraPosition,this._cameraPosition,o,this.center.lng*Math.PI/180),this._cachedClippingPlane=this._computeClippingPlane(t);let s=_t.clone(this._globeViewProjMatrixNoCorrectionInverted);_t.scale(s,s,[1,1,-1]),this._cachedFrustum=$ee.fromInvProjectionMatrix(s,1,0,this._cachedClippingPlane,!0)}calculateFogMatrix(t){oa("calculateFogMatrix is not supported on globe projection.");let r=Yd();return _t.identity(r),r}getVisibleUnwrappedCoordinates(t){return[new AI(0,t)]}getCameraFrustum(){return this._cachedFrustum}getClippingPlane(){return this._cachedClippingPlane}getCoveringTilesDetailsProvider(){return this._coveringTilesDetailsProvider}recalculateZoomAndCenter(t){t&&oa("terrain is not fully supported on vertical perspective projection."),this._helper.recalculateZoomAndCenter(0)}maxPitchScaleFactor(){return 1}getCameraPoint(){return this._helper.getCameraPoint()}getCameraAltitude(){return this._helper.getCameraAltitude()}getCameraLngLat(){return this._helper.getCameraLngLat()}lngLatToCameraDepth(t,r){if(!this._globeViewProjMatrixNoCorrection)return 1;let i=_o(t);St.scale(i,i,1+r/Xu);let n=Y1();return Kn.transformMat4(n,[i[0],i[1],i[2],1],this._globeViewProjMatrixNoCorrection),n[2]/n[3]}populateCache(t){}getBounds(){let t=this.width*.5,r=this.height*.5,i=[new Uu.default(0,0),new Uu.default(t,0),new Uu.default(this.width,0),new Uu.default(this.width,r),new Uu.default(this.width,this.height),new Uu.default(t,this.height),new Uu.default(0,this.height),new Uu.default(0,r)],n=[];for(let h of i)n.push(this.unprojectScreenPoint(h));let a=0,o=0,s=0,l=0,u=this.center;for(let h of n){let d=Ps(u.lng,h.lng),p=Ps(u.lat,h.lat);d<o&&(o=d),d>a&&(a=d),p<l&&(l=p),p>s&&(s=p)}let c=[u.lng+o,u.lat+l,u.lng+a,u.lat+s];return this.isSurfacePointOnScreen([0,1,0])&&(c[3]=90,c[0]=-180,c[2]=180),this.isSurfacePointOnScreen([0,-1,0])&&(c[1]=-90,c[0]=-180,c[2]=180),new vh(c)}getConstrained(t,r){let i=Ii(t.lat,-ic,ic),n=Ii(+r,this.minZoom+Ga(0,i),this.maxZoom);return{center:new wr(t.lng,i),zoom:n}}calculateCenterFromCameraLngLatAlt(t,r,i,n){return this._helper.calculateCenterFromCameraLngLatAlt(t,r,i,n)}setLocationAtPoint(t,r){let i=this.unprojectScreenPoint(r),n=_o(i),a=_o(t),o=na();St.zero(o);let s=na();St.rotateY(s,n,o,-this.center.lng*Math.PI/180),St.rotateX(s,s,o,this.center.lat*Math.PI/180);let l=a[0]*a[0]+a[2]*a[2],u=s[0]*s[0];if(l<u)return;let c=Math.sqrt(l-u),h=-c,d=K2(a[0],a[2],s[0],c),p=K2(a[0],a[2],s[0],h),f=na();St.rotateY(f,a,o,-d);let m=K2(f[1],f[2],s[1],s[2]),g=na();St.rotateY(g,a,o,-p);let v=K2(g[1],g[2],s[1],s[2]),_=Math.PI*.5,x=m>=-_&&m<=_,b=v>=-_&&v<=_,E,M;if(x&&b){let P=this.center.lng*Math.PI/180,k=this.center.lat*Math.PI/180,R=q2(d,P),F=q2(m,k),B=q2(p,P),z=q2(v,k);R+F<B+z?(E=d,M=m):(E=p,M=v)}else if(x)E=d,M=m;else if(b)E=p,M=v;else return;let S=E/Math.PI*180,D=M/Math.PI*180,T=this.center.lat;this.setCenter(new wr(S,Ii(D,-90,90))),this.setZoom(this.zoom+Ga(T,this.center.lat))}locationToScreenPoint(t,r){let i=_o(t);if(r){let n=r.getElevationForLngLatZoom(t,this._helper._tileZoom);St.scale(i,i,1+n/Xu)}return this._projectSurfacePointToScreen(i)}_projectSurfacePointToScreen(t){let r=Y1();return Kn.transformMat4(r,[...t,1],this._globeViewProjMatrixNoCorrection),r[0]/=r[3],r[1]/=r[3],new Uu.default((r[0]*.5+.5)*this.width,(-r[1]*.5+.5)*this.height)}screenPointToMercatorCoordinate(t,r){if(r){let i=r.pointCoordinate(t);if(i)return i}return Gi.fromLngLat(this.unprojectScreenPoint(t))}screenPointToLocation(t,r){var i;return(i=this.screenPointToMercatorCoordinate(t,r))==null?void 0:i.toLngLat()}isPointOnMapSurface(t,r){let i=this._cameraPosition,n=this.getRayDirectionFromPixel(t);return!!this.rayPlanetIntersection(i,n)}getRayDirectionFromPixel(t){let r=Y1();r[0]=t.x/this.width*2-1,r[1]=(t.y/this.height*2-1)*-1,r[2]=1,r[3]=1,Kn.transformMat4(r,r,this._globeViewProjMatrixNoCorrectionInverted),r[0]/=r[3],r[1]/=r[3],r[2]/=r[3];let i=na();i[0]=r[0]-this._cameraPosition[0],i[1]=r[1]-this._cameraPosition[1],i[2]=r[2]-this._cameraPosition[2];let n=na();return St.normalize(n,i),n}isSurfacePointVisible(t){let r=this._cachedClippingPlane;return r[0]*t[0]+r[1]*t[1]+r[2]*t[2]+r[3]>=0}isSurfacePointOnScreen(t){if(!this.isSurfacePointVisible(t))return!1;let r=Y1();return Kn.transformMat4(r,[...t,1],this._globeViewProjMatrixNoCorrection),r[0]/=r[3],r[1]/=r[3],r[2]/=r[3],r[0]>-1&&r[0]<1&&r[1]>-1&&r[1]<1&&r[2]>-1&&r[2]<1}rayPlanetIntersection(t,r){let i=St.dot(t,r),n=1,a=na(),o=na();St.scale(o,r,i),St.sub(a,t,o);let s=n-St.dot(a,a);if(s<0)return null;let l=St.dot(t,t)-n,u=-i+(i<0?1:-1)*Math.sqrt(s),c=l/u,h=u,d=Math.min(c,h),p=Math.max(c,h);return{tMin:d,tMax:p}}unprojectScreenPoint(t){let r=this._cameraPosition,i=this.getRayDirectionFromPixel(t),n=this.rayPlanetIntersection(r,i);if(n){let d=na();St.add(d,r,[i[0]*n.tMin,i[1]*n.tMin,i[2]*n.tMin]);let p=na();return St.normalize(p,d),nJ(p)}let a=this._cachedClippingPlane,o=a[0]*i[0]+a[1]*i[1]+a[2]*i[2],s=-iO(a,r)/o,l=2,u=na();if(s>0)St.add(u,r,[i[0]*s,i[1]*s,i[2]*s]);else{let d=na();St.add(d,r,[i[0]*l,i[1]*l,i[2]*l]);let p=iO(this._cachedClippingPlane,d);St.sub(u,d,[this._cachedClippingPlane[0]*p,this._cachedClippingPlane[1]*p,this._cachedClippingPlane[2]*p])}let c=I4e(a),h=C4e(c.center,c.radius,u);return nJ(h)}getMatrixForModel(t,r){let i=wr.convert(t),n=1/Xu,a=Cg();return _t.rotateY(a,a,i.lng/180*Math.PI),_t.rotateX(a,a,-i.lat/180*Math.PI),_t.translate(a,a,[0,0,1+r/Xu]),_t.rotateX(a,a,Math.PI*.5),_t.scale(a,a,[n,n,n]),a}getProjectionDataForCustomLayer(t=!0){let r=this.getProjectionData({overscaledTileID:new bo(0,0,0,0,0),applyGlobeMatrix:t});return r.tileMercatorCoords=[0,0,1,1],r}getFastPathSimpleProjectionMatrix(t){}},lJ=class hte{constructor(){this._globeLatitudeErrorCorrectionRadians=0,this._globeness=1,this._helper=new QU({calcMatrices:()=>{this._calcMatrices()},getConstrained:(t,r)=>this.getConstrained(t,r)}),this._globeness=1,this._mercatorTransform=new yI,this._verticalPerspectiveTransform=new ute}get pixelsToClipSpaceMatrix(){return this._helper.pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._helper.clipSpaceToPixelsMatrix}get pixelsToGLUnits(){return this._helper.pixelsToGLUnits}get centerOffset(){return this._helper.centerOffset}get size(){return this._helper.size}get rotationMatrix(){return this._helper.rotationMatrix}get centerPoint(){return this._helper.centerPoint}get pixelsPerMeter(){return this._helper.pixelsPerMeter}setMinZoom(t){this._helper.setMinZoom(t)}setMaxZoom(t){this._helper.setMaxZoom(t)}setMinPitch(t){this._helper.setMinPitch(t)}setMaxPitch(t){this._helper.setMaxPitch(t)}setRenderWorldCopies(t){this._helper.setRenderWorldCopies(t)}setBearing(t){this._helper.setBearing(t)}setPitch(t){this._helper.setPitch(t)}setRoll(t){this._helper.setRoll(t)}setFov(t){this._helper.setFov(t)}setZoom(t){this._helper.setZoom(t)}setCenter(t){this._helper.setCenter(t)}setElevation(t){this._helper.setElevation(t)}setMinElevationForCurrentTile(t){this._helper.setMinElevationForCurrentTile(t)}setPadding(t){this._helper.setPadding(t)}interpolatePadding(t,r,i){return this._helper.interpolatePadding(t,r,i)}isPaddingEqual(t){return this._helper.isPaddingEqual(t)}resize(t,r,i=!0){this._helper.resize(t,r,i)}getMaxBounds(){return this._helper.getMaxBounds()}setMaxBounds(t){this._helper.setMaxBounds(t)}overrideNearFarZ(t,r){this._helper.overrideNearFarZ(t,r)}clearNearFarZOverride(){this._helper.clearNearFarZOverride()}getCameraQueryGeometry(t){return this._helper.getCameraQueryGeometry(this.getCameraPoint(),t)}get tileSize(){return this._helper.tileSize}get tileZoom(){return this._helper.tileZoom}get scale(){return this._helper.scale}get worldSize(){return this._helper.worldSize}get width(){return this._helper.width}get height(){return this._helper.height}get lngRange(){return this._helper.lngRange}get latRange(){return this._helper.latRange}get minZoom(){return this._helper.minZoom}get maxZoom(){return this._helper.maxZoom}get zoom(){return this._helper.zoom}get center(){return this._helper.center}get minPitch(){return this._helper.minPitch}get maxPitch(){return this._helper.maxPitch}get pitch(){return this._helper.pitch}get pitchInRadians(){return this._helper.pitchInRadians}get roll(){return this._helper.roll}get rollInRadians(){return this._helper.rollInRadians}get bearing(){return this._helper.bearing}get bearingInRadians(){return this._helper.bearingInRadians}get fov(){return this._helper.fov}get fovInRadians(){return this._helper.fovInRadians}get elevation(){return this._helper.elevation}get minElevationForCurrentTile(){return this._helper.minElevationForCurrentTile}get padding(){return this._helper.padding}get unmodified(){return this._helper.unmodified}get renderWorldCopies(){return this._helper.renderWorldCopies}get cameraToCenterDistance(){return this._helper.cameraToCenterDistance}get nearZ(){return this._helper.nearZ}get farZ(){return this._helper.farZ}get autoCalculateNearFarZ(){return this._helper.autoCalculateNearFarZ}get isGlobeRendering(){return this._globeness>0}setTransitionState(t,r){this._globeness=t,this._globeLatitudeErrorCorrectionRadians=r,this._calcMatrices(),this._verticalPerspectiveTransform.getCoveringTilesDetailsProvider().prepareNextFrame(),this._mercatorTransform.getCoveringTilesDetailsProvider().prepareNextFrame()}get currentTransform(){return this.isGlobeRendering?this._verticalPerspectiveTransform:this._mercatorTransform}clone(){let t=new hte;return t._globeness=this._globeness,t._globeLatitudeErrorCorrectionRadians=this._globeLatitudeErrorCorrectionRadians,t.apply(this),t}apply(t){this._helper.apply(t),this._mercatorTransform.apply(this),this._verticalPerspectiveTransform.apply(this,this._globeLatitudeErrorCorrectionRadians)}get projectionMatrix(){return this.currentTransform.projectionMatrix}get modelViewProjectionMatrix(){return this.currentTransform.modelViewProjectionMatrix}get inverseProjectionMatrix(){return this.currentTransform.inverseProjectionMatrix}get cameraPosition(){return this.currentTransform.cameraPosition}getProjectionData(t){let r=this._mercatorTransform.getProjectionData(t),i=this._verticalPerspectiveTransform.getProjectionData(t);return{mainMatrix:this.isGlobeRendering?i.mainMatrix:r.mainMatrix,clippingPlane:i.clippingPlane,tileMercatorCoords:i.tileMercatorCoords,projectionTransition:t.applyGlobeMatrix?this._globeness:0,fallbackMatrix:r.fallbackMatrix}}isLocationOccluded(t){return this.currentTransform.isLocationOccluded(t)}transformLightDirection(t){return this.currentTransform.transformLightDirection(t)}getPixelScale(){return Xg(this._mercatorTransform.getPixelScale(),this._verticalPerspectiveTransform.getPixelScale(),this._globeness)}getCircleRadiusCorrection(){return Xg(this._mercatorTransform.getCircleRadiusCorrection(),this._verticalPerspectiveTransform.getCircleRadiusCorrection(),this._globeness)}getPitchedTextCorrection(t,r,i){let n=this._mercatorTransform.getPitchedTextCorrection(t,r,i),a=this._verticalPerspectiveTransform.getPitchedTextCorrection(t,r,i);return Xg(n,a,this._globeness)}projectTileCoordinates(t,r,i,n){return this.currentTransform.projectTileCoordinates(t,r,i,n)}_calcMatrices(){!this._helper._width||!this._helper._height||(this._verticalPerspectiveTransform.apply(this,this._globeLatitudeErrorCorrectionRadians),this._helper._nearZ=this._verticalPerspectiveTransform.nearZ,this._helper._farZ=this._verticalPerspectiveTransform.farZ,this._mercatorTransform.apply(this,!0,this.isGlobeRendering),this._helper._nearZ=this._mercatorTransform.nearZ,this._helper._farZ=this._mercatorTransform.farZ)}calculateFogMatrix(t){return this.currentTransform.calculateFogMatrix(t)}getVisibleUnwrappedCoordinates(t){return this.currentTransform.getVisibleUnwrappedCoordinates(t)}getCameraFrustum(){return this.currentTransform.getCameraFrustum()}getClippingPlane(){return this.currentTransform.getClippingPlane()}getCoveringTilesDetailsProvider(){return this.currentTransform.getCoveringTilesDetailsProvider()}recalculateZoomAndCenter(t){this._mercatorTransform.recalculateZoomAndCenter(t),this._verticalPerspectiveTransform.recalculateZoomAndCenter(t)}maxPitchScaleFactor(){return this._mercatorTransform.maxPitchScaleFactor()}getCameraPoint(){return this._helper.getCameraPoint()}getCameraAltitude(){return this._helper.getCameraAltitude()}getCameraLngLat(){return this._helper.getCameraLngLat()}lngLatToCameraDepth(t,r){return this.currentTransform.lngLatToCameraDepth(t,r)}populateCache(t){this._mercatorTransform.populateCache(t),this._verticalPerspectiveTransform.populateCache(t)}getBounds(){return this.currentTransform.getBounds()}getConstrained(t,r){return this.currentTransform.getConstrained(t,r)}calculateCenterFromCameraLngLatAlt(t,r,i,n){return this._helper.calculateCenterFromCameraLngLatAlt(t,r,i,n)}setLocationAtPoint(t,r){if(!this.isGlobeRendering){this._mercatorTransform.setLocationAtPoint(t,r),this.apply(this._mercatorTransform);return}this._verticalPerspectiveTransform.setLocationAtPoint(t,r),this.apply(this._verticalPerspectiveTransform)}locationToScreenPoint(t,r){return this.currentTransform.locationToScreenPoint(t,r)}screenPointToMercatorCoordinate(t,r){return this.currentTransform.screenPointToMercatorCoordinate(t,r)}screenPointToLocation(t,r){return this.currentTransform.screenPointToLocation(t,r)}isPointOnMapSurface(t,r){return this.currentTransform.isPointOnMapSurface(t,r)}getRayDirectionFromPixel(t){return this._verticalPerspectiveTransform.getRayDirectionFromPixel(t)}getMatrixForModel(t,r){return this.currentTransform.getMatrixForModel(t,r)}getProjectionDataForCustomLayer(t=!0){let r=this._mercatorTransform.getProjectionDataForCustomLayer(t);if(!this.isGlobeRendering)return r;let i=this._verticalPerspectiveTransform.getProjectionDataForCustomLayer(t);return i.fallbackMatrix=r.mainMatrix,i}getFastPathSimpleProjectionMatrix(t){return this.currentTransform.getFastPathSimpleProjectionMatrix(t)}},L5=Er(zr(),1),dte=class lh{get useGlobeControls(){return!0}handlePanInertia(t,r){let i=aJ(t,r);return Math.abs(i.lng-r.center.lng)>180&&(i.lng=r.center.lng+179.5*Math.sign(i.lng-r.center.lng)),{easingCenter:i,easingOffset:new L5.default(0,0)}}handleMapControlsRollPitchBearingZoom(t,r){let i=t.around,n=r.screenPointToLocation(i);t.bearingDelta&&r.setBearing(r.bearing+t.bearingDelta),t.pitchDelta&&r.setPitch(r.pitch+t.pitchDelta),t.rollDelta&&r.setRoll(r.roll+t.rollDelta);let a=r.zoom;t.zoomDelta&&r.setZoom(r.zoom+t.zoomDelta);let o=r.zoom-a;if(o===0)return;let s=.3,l=.5,u=45,c=85,h=.25,d=.75,p=.35,f=.9,m=.5,g=.25,v=Ps(r.center.lng,n.lng),_=v/(Math.abs(v/180)+1),x=Ps(r.center.lat,n.lat),b=r.getRayDirectionFromPixel(i),E=r.cameraPosition,M=St.dot(E,b)*-1,S=na();St.add(S,E,[b[0]*M,b[1]*M,b[2]*M]);let D=St.length(S)-1,T=Math.exp(-Math.max(D-s,0)*l),P=cC(r.worldSize,r.center.lat)/Math.min(r.width,r.height),k=NS(P,f,m,1,g),R=(1-Lo(-o))*Math.min(T,k),F=r.center.lat,B=r.zoom,z=new wr(r.center.lng+_*R,Ii(r.center.lat+x*R,-ic,ic));r.setLocationAtPoint(n,i);let O=r.center,j=NS(Math.abs(v),u,c,0,1),Y=NS(P,d,p,0,1),Z=Math.pow(Math.max(j,Y),h),ne=Ps(O.lng,z.lng),ie=Ps(O.lat,z.lat);r.setCenter(new wr(O.lng+ne*Z,O.lat+ie*Z).wrap()),r.setZoom(B+Ga(F,r.center.lat))}handleMapControlsPan(t,r,i){if(!t.panDelta)return;let n=r.center.lat,a=r.zoom;r.setCenter(aJ(t.panDelta,r).wrap()),r.setZoom(a+Ga(n,r.center.lat))}cameraForBoxAndBearing(t,r,i,n,a){let o=nte(t,r,i,n,a),s=r.left/a.width*2-1,l=(a.width-r.right)/a.width*2-1,u=r.top/a.height*-2+1,c=(a.height-r.bottom)/a.height*-2+1,h=Ps(i.getWest(),i.getEast())<0,d=h?i.getEast():i.getWest(),p=h?i.getWest():i.getEast(),f=Math.max(i.getNorth(),i.getSouth()),m=Math.min(i.getNorth(),i.getSouth()),g=d+Ps(d,p)*.5,v=f+Ps(f,m)*.5,_=a.clone();_.setCenter(o.center),_.setBearing(o.bearing),_.setPitch(0),_.setRoll(0),_.setZoom(o.zoom);let x=_.modelViewProjectionMatrix,b=[_o(i.getNorthWest()),_o(i.getNorthEast()),_o(i.getSouthWest()),_o(i.getSouthEast()),_o(new wr(p,v)),_o(new wr(d,v)),_o(new wr(g,f)),_o(new wr(g,m))],E=_o(o.center),M=Number.POSITIVE_INFINITY;for(let S of b)s<0&&(M=lh.getLesserNonNegativeNonNull(M,lh.solveVectorScale(S,E,x,"x",s))),l>0&&(M=lh.getLesserNonNegativeNonNull(M,lh.solveVectorScale(S,E,x,"x",l))),u>0&&(M=lh.getLesserNonNegativeNonNull(M,lh.solveVectorScale(S,E,x,"y",u))),c<0&&(M=lh.getLesserNonNegativeNonNull(M,lh.solveVectorScale(S,E,x,"y",c)));if(!Number.isFinite(M)||M===0){rte();return}return o.zoom=_.zoom+Oo(M),o}handleJumpToCenterZoom(t,r){let i=t.center.lat,n=t.getConstrained(r.center?wr.convert(r.center):t.center,t.zoom).center;t.setCenter(n.wrap());let a=typeof r.zoom<"u"?+r.zoom:t.zoom+Ga(i,n.lat);t.zoom!==a&&t.setZoom(a)}handleEaseTo(t,r){let i=t.zoom,n=t.center,a=t.padding,o={roll:t.roll,pitch:t.pitch,bearing:t.bearing},s=r.roll===void 0?t.roll:r.roll,l=r.pitch===void 0?t.pitch:r.pitch,u=r.bearing===void 0?t.bearing:r.bearing,c={roll:s,pitch:l,bearing:u},h=typeof r.zoom<"u",d=!t.isPaddingEqual(r.padding),p=!1,f=r.center?wr.convert(r.center):n,m=t.getConstrained(f,i).center;gI(t,m);let g=t.clone();g.setCenter(m),g.setZoom(h?+r.zoom:i+Ga(n.lat,f.lat)),g.setBearing(r.bearing);let v=new L5.default(Ii(t.centerPoint.x+r.offsetAsPoint.x,0,t.width),Ii(t.centerPoint.y+r.offsetAsPoint.y,0,t.height));g.setLocationAtPoint(m,v);let _=(r.offset&&r.offsetAsPoint.mag())>0?g.center:m,x=h?+r.zoom:i+Ga(n.lat,_.lat),b=i+Ga(n.lat,0),E=x+Ga(_.lat,0),M=Ps(n.lng,_.lng),S=Ps(n.lat,_.lat),D=Lo(E-b);return p=x!==i,{easeFunc:T=>{if(Aq(o,c)||ite({startEulerAngles:o,endEulerAngles:c,tr:t,k:T,useSlerp:o.roll!=c.roll}),d&&t.interpolatePadding(a,r.padding,T),r.around)oa("Easing around a point is not supported under globe projection."),t.setLocationAtPoint(r.around,r.aroundPoint);else{let P=E>b?Math.min(2,D):Math.max(.5,D),k=Math.pow(P,1-T),R=T*k,F=oJ(n,M,S,R);t.setCenter(F.wrap())}if(p){let P=On.number(b,E,T)+Ga(0,t.center.lat);t.setZoom(P)}},isZooming:p,elevationCenter:_}}handleFlyTo(t,r){let i=typeof r.zoom<"u",n=t.center,a=t.zoom,o=t.padding,s=!t.isPaddingEqual(r.padding),l=t.getConstrained(wr.convert(r.center||r.locationAtOffset),a).center,u=i?+r.zoom:t.zoom+Ga(t.center.lat,l.lat),c=t.clone();c.setCenter(l),c.setZoom(u),c.setBearing(r.bearing);let h=new L5.default(Ii(t.centerPoint.x+r.offsetAsPoint.x,0,t.width),Ii(t.centerPoint.y+r.offsetAsPoint.y,0,t.height));c.setLocationAtPoint(l,h);let d=c.center;gI(t,d);let p=E4e(t,n,d),f=a+Ga(n.lat,0),m=u+Ga(d.lat,0),g=Lo(m-f),v=typeof r.minZoom=="number",_;if(v){let E=+r.minZoom+Ga(d.lat,0),M=Math.min(E,f,m)+Ga(0,d.lat),S=t.getConstrained(d,M).zoom+Ga(d.lat,0);_=Lo(S-f)}let x=Ps(n.lng,d.lng),b=Ps(n.lat,d.lat);return{easeFunc:(E,M,S,D)=>{let T=oJ(n,x,b,S);s&&t.interpolatePadding(o,r.padding,E);let P=E===1?d:T;t.setCenter(P.wrap());let k=f+Oo(M);t.setZoom(E===1?u:k+Ga(0,P.lat))},scaleOfZoom:g,targetCenter:d,scaleOfMinZoom:_,pixelPathLength:p}}static solveVectorScale(t,r,i,n,a){let o=a,s=n==="x"?[i[0],i[4],i[8],i[12]]:[i[1],i[5],i[9],i[13]],l=[i[3],i[7],i[11],i[15]],u=t[0]*s[0]+t[1]*s[1]+t[2]*s[2],c=t[0]*l[0]+t[1]*l[1]+t[2]*l[2],h=r[0]*s[0]+r[1]*s[1]+r[2]*s[2],d=r[0]*l[0]+r[1]*l[1]+r[2]*l[2],p=(h+s[3]-o*d-o*l[3])/(h-u-o*d+o*c);return h+o*c===u+o*d||l[3]*(u-h)+s[3]*(d-c)+u*d===h*c?null:p}static getLesserNonNegativeNonNull(t,r){return r!==null&&r>=0&&r<t?r:t}},uJ=class{constructor(e){this._globe=e,this._mercatorCameraHelper=new vI,this._verticalPerspectiveCameraHelper=new dte}get useGlobeControls(){return this._globe.useGlobeRendering}get currentHelper(){return this.useGlobeControls?this._verticalPerspectiveCameraHelper:this._mercatorCameraHelper}handlePanInertia(e,t){return this.currentHelper.handlePanInertia(e,t)}handleMapControlsRollPitchBearingZoom(e,t){return this.currentHelper.handleMapControlsRollPitchBearingZoom(e,t)}handleMapControlsPan(e,t,r){this.currentHelper.handleMapControlsPan(e,t,r)}cameraForBoxAndBearing(e,t,r,i,n){return this.currentHelper.cameraForBoxAndBearing(e,t,r,i,n)}handleJumpToCenterZoom(e,t){this.currentHelper.handleJumpToCenterZoom(e,t)}handleEaseTo(e,t){return this.currentHelper.handleEaseTo(e,t)}handleFlyTo(e,t){return this.currentHelper.handleFlyTo(e,t)}};_S=(e,t)=>XI(e,t&&t.filter(r=>r.identifier!=="source.canvas")),k4e=UCe(),cJ=class extends cs{constructor(e,t={}){super(),this._rtlPluginLoaded=()=>{for(let r in this.sourceCaches){let i=this.sourceCaches[r].getSource().type;(i==="vector"||i==="geojson")&&this.sourceCaches[r].reload()}},this.map=e,this.dispatcher=new Cee(Iee(),e._getMapId()),this.dispatcher.registerMessageHandler("GG",(r,i)=>this.getGlyphs(r,i)),this.dispatcher.registerMessageHandler("GI",(r,i)=>this.getImages(r,i)),this.imageManager=new cDe,this.imageManager.setEventedParent(this),this.glyphManager=new pDe(e._requestManager,t.localIdeographFontFamily),this.lineAtlas=new yDe(256,512),this.crossTileSymbolIndex=new Wee,this._spritesImagesIds={},this._layers={},this._order=[],this.sourceCaches={},this.zoomHistory=new xO,this._loaded=!1,this._availableImages=[],this._globalState={},this._resetUpdates(),this.dispatcher.broadcast("SR",ON()),QO().on(UO,this._rtlPluginLoaded),this.on("data",r=>{if(r.dataType!=="source"||r.sourceDataType!=="metadata")return;let i=this.sourceCaches[r.sourceId];if(!i)return;let n=i.getSource();if(!(!n||!n.vectorLayerIds))for(let a in this._layers){let o=this._layers[a];o.source===n.id&&this._validateLayer(o)}})}setGlobalStateProperty(e,t){var r,i,n;this._checkLoaded();let a=t===null?(n=(i=(r=this.stylesheet.state)==null?void 0:r[e])==null?void 0:i.default)!=null?n:null:t;if(Yu(a,this._globalState[e]))return this;this._globalState[e]=a;let o=this._findGlobalStateAffectedSources([e]);for(let s in this.sourceCaches)o.has(s)&&(this._reloadSource(s),this._changed=!0)}getGlobalState(){return this._globalState}setGlobalState(e){this._checkLoaded();let t=[];for(let i in e)!Yu(this._globalState[i],e[i].default)&&(t.push(i),this._globalState[i]=e[i].default);let r=this._findGlobalStateAffectedSources(t);for(let i in this.sourceCaches)r.has(i)&&(this._reloadSource(i),this._changed=!0)}_findGlobalStateAffectedSources(e){if(e.length===0)return new Set;let t=new Set;for(let r in this._layers){let i=this._layers[r],n=i.getLayoutAffectingGlobalStateRefs();for(let a of e)n.has(a)&&t.add(i.source)}return t}loadURL(e,t={},r){this.fire(new kt("dataloading",{dataType:"style"})),t.validate=typeof t.validate=="boolean"?t.validate:!0;let i=this.map._requestManager.transformRequest(e,"Style");this._loadStyleRequest=new AbortController;let n=this._loadStyleRequest;FI(i,this._loadStyleRequest).then(a=>{this._loadStyleRequest=null,this._load(a.data,t,r)}).catch(a=>{this._loadStyleRequest=null,a&&!n.signal.aborted&&this.fire(new yr(a))})}loadJSON(e,t={},r){this.fire(new kt("dataloading",{dataType:"style"})),this._frameRequest=new AbortController,ri.frameAsync(this._frameRequest).then(()=>{this._frameRequest=null,t.validate=t.validate!==!1,this._load(e,t,r)}).catch(()=>{})}loadEmpty(){this.fire(new kt("dataloading",{dataType:"style"})),this._load(k4e,{validate:!1})}_load(e,t,r){var i,n,a;let o=t.transformStyle?t.transformStyle(r,e):e;if(!(t.validate&&_S(this,aa(o)))){this._loaded=!0,this.stylesheet=o;for(let s in o.sources)this.addSource(s,o.sources[s],{validate:!1});o.sprite?this._loadSprite(o.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(o.glyphs),this._createLayers(),this.light=new ADe(this.stylesheet.light),this._setProjectionInternal(((i=this.stylesheet.projection)==null?void 0:i.type)||"mercator"),this.sky=new gDe(this.stylesheet.sky),this.map.setTerrain((n=this.stylesheet.terrain)!=null?n:null),this.setGlobalState((a=this.stylesheet.state)!=null?a:null),this.fire(new kt("data",{dataType:"style"})),this.fire(new kt("style.load"))}}_createLayers(){let e=MZ(this.stylesheet.layers);this.dispatcher.broadcast("SL",e),this._order=e.map(t=>t.id),this._layers={},this._serializedLayers=null;for(let t of e){let r=M5(t);r.setEventedParent(this,{layer:{id:t.id}}),this._layers[t.id]=r}}_loadSprite(e,t=!1,r=void 0){this.imageManager.setLoaded(!1),this._spriteRequest=new AbortController;let i;lDe(e,this.map._requestManager,this.map.getPixelRatio(),this._spriteRequest).then(n=>{if(this._spriteRequest=null,n)for(let a in n){this._spritesImagesIds[a]=[];let o=this._spritesImagesIds[a]?this._spritesImagesIds[a].filter(s=>!(s in n)):[];for(let s of o)this.imageManager.removeImage(s),this._changedImages[s]=!0;for(let s in n[a]){let l=a==="default"?s:"".concat(a,":").concat(s);this._spritesImagesIds[a].push(l),l in this.imageManager.images?this.imageManager.updateImage(l,n[a][s],!1):this.imageManager.addImage(l,n[a][s]),t&&(this._changedImages[l]=!0)}}}).catch(n=>{this._spriteRequest=null,i=n,this.fire(new yr(i))}).finally(()=>{this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),t&&(this._changed=!0),this.dispatcher.broadcast("SI",this._availableImages),this.fire(new kt("data",{dataType:"style"})),r&&r(i)})}_unloadSprite(){for(let e of Object.values(this._spritesImagesIds).flat())this.imageManager.removeImage(e),this._changedImages[e]=!0;this._spritesImagesIds={},this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new kt("data",{dataType:"style"}))}_validateLayer(e){let t=this.sourceCaches[e.source];if(!t)return;let r=e.sourceLayer;if(!r)return;let i=t.getSource();(i.type==="geojson"||i.vectorLayerIds&&i.vectorLayerIds.indexOf(r)===-1)&&this.fire(new yr(new Error('Source layer "'.concat(r,'" does not exist on source "').concat(i.id,'" as specified by style layer "').concat(e.id,'".'))))}loaded(){if(!this._loaded||Object.keys(this._updatedSources).length)return!1;for(let e in this.sourceCaches)if(!this.sourceCaches[e].loaded())return!1;return!!this.imageManager.isLoaded()}_serializeByIds(e,t=!1){let r=this._serializedAllLayers();if(!e||e.length===0)return Object.values(t?us(r):r);let i=[];for(let n of e)if(r[n]){let a=t?us(r[n]):r[n];i.push(a)}return i}_serializedAllLayers(){let e=this._serializedLayers;if(e)return e;e=this._serializedLayers={};let t=Object.keys(this._layers);for(let r of t){let i=this._layers[r];i.type!=="custom"&&(e[r]=i.serialize())}return e}hasTransitions(){var e,t,r;if((e=this.light)!=null&&e.hasTransition()||(t=this.sky)!=null&&t.hasTransition()||(r=this.projection)!=null&&r.hasTransition())return!0;for(let i in this.sourceCaches)if(this.sourceCaches[i].hasTransition())return!0;for(let i in this._layers)if(this._layers[i].hasTransition())return!0;return!1}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading.")}update(e){if(!this._loaded)return;let t=this._changed;if(t){let i=Object.keys(this._updatedLayers),n=Object.keys(this._removedLayers);(i.length||n.length)&&this._updateWorkerLayers(i,n);for(let a in this._updatedSources){let o=this._updatedSources[a];if(o==="reload")this._reloadSource(a);else if(o==="clear")this._clearSource(a);else throw new Error("Invalid action ".concat(o))}this._updateTilesForChangedImages(),this._updateTilesForChangedGlyphs();for(let a in this._updatedPaintProps)this._layers[a].updateTransitions(e);this.light.updateTransitions(e),this.sky.updateTransitions(e),this._resetUpdates()}let r={};for(let i in this.sourceCaches){let n=this.sourceCaches[i];r[i]=n.used,n.used=!1}for(let i of this._order){let n=this._layers[i];n.recalculate(e,this._availableImages),!n.isHidden(e.zoom)&&n.source&&(this.sourceCaches[n.source].used=!0)}for(let i in r){let n=this.sourceCaches[i];!!r[i]!=!!n.used&&n.fire(new kt("data",{sourceDataType:"visibility",dataType:"source",sourceId:i}))}this.light.recalculate(e),this.sky.recalculate(e),this.projection.recalculate(e),this.z=e.zoom,t&&this.fire(new kt("data",{dataType:"style"}))}_updateTilesForChangedImages(){let e=Object.keys(this._changedImages);if(e.length){for(let t in this.sourceCaches)this.sourceCaches[t].reloadTilesForDependencies(["icons","patterns"],e);this._changedImages={}}}_updateTilesForChangedGlyphs(){if(this._glyphsDidChange){for(let e in this.sourceCaches)this.sourceCaches[e].reloadTilesForDependencies(["glyphs"],[""]);this._glyphsDidChange=!1}}_updateWorkerLayers(e,t){this.dispatcher.broadcast("UL",{layers:this._serializeByIds(e,!1),removedIds:t})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={},this._glyphsDidChange=!1}setState(e,t={}){var r;this._checkLoaded();let i=this.serialize();if(e=t.transformStyle?t.transformStyle(i,e):e,((r=t.validate)!=null?r:!0)&&_S(this,aa(e)))return!1;e=us(e),e.layers=MZ(e.layers);let n=aIe(i,e),a=this._getOperationsToPerform(n);if(a.unimplemented.length>0)throw new Error("Unimplemented: ".concat(a.unimplemented.join(", "),"."));if(a.operations.length===0)return!1;for(let o of a.operations)o();return this.stylesheet=e,this._serializedLayers=null,!0}_getOperationsToPerform(e){let t=[],r=[];for(let i of e)switch(i.command){case"setCenter":case"setZoom":case"setBearing":case"setPitch":case"setRoll":continue;case"addLayer":t.push(()=>this.addLayer.apply(this,i.args));break;case"removeLayer":t.push(()=>this.removeLayer.apply(this,i.args));break;case"setPaintProperty":t.push(()=>this.setPaintProperty.apply(this,i.args));break;case"setLayoutProperty":t.push(()=>this.setLayoutProperty.apply(this,i.args));break;case"setFilter":t.push(()=>this.setFilter.apply(this,i.args));break;case"addSource":t.push(()=>this.addSource.apply(this,i.args));break;case"removeSource":t.push(()=>this.removeSource.apply(this,i.args));break;case"setLayerZoomRange":t.push(()=>this.setLayerZoomRange.apply(this,i.args));break;case"setLight":t.push(()=>this.setLight.apply(this,i.args));break;case"setGeoJSONSourceData":t.push(()=>this.setGeoJSONSourceData.apply(this,i.args));break;case"setGlyphs":t.push(()=>this.setGlyphs.apply(this,i.args));break;case"setSprite":t.push(()=>this.setSprite.apply(this,i.args));break;case"setTerrain":t.push(()=>this.map.setTerrain.apply(this,i.args));break;case"setSky":t.push(()=>this.setSky.apply(this,i.args));break;case"setProjection":this.setProjection.apply(this,i.args);break;case"setGlobalState":t.push(()=>this.setGlobalState.apply(this,i.args));break;case"setTransition":t.push(()=>{});break;default:r.push(i.command);break}return{operations:t,unimplemented:r}}addImage(e,t){if(this.getImage(e))return this.fire(new yr(new Error('An image named "'.concat(e,'" already exists.'))));this.imageManager.addImage(e,t),this._afterImageUpdated(e)}updateImage(e,t){this.imageManager.updateImage(e,t)}getImage(e){return this.imageManager.getImage(e)}removeImage(e){if(!this.getImage(e))return this.fire(new yr(new Error('An image named "'.concat(e,'" does not exist.'))));this.imageManager.removeImage(e),this._afterImageUpdated(e)}_afterImageUpdated(e){this._availableImages=this.imageManager.listImages(),this._changedImages[e]=!0,this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new kt("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(e,t,r={}){if(this._checkLoaded(),this.sourceCaches[e]!==void 0)throw new Error('Source "'.concat(e,'" already exists.'));if(!t.type)throw new Error("The type property must be defined, but only the following properties were given: ".concat(Object.keys(t).join(", "),"."));if(["vector","raster","geojson","video","image"].indexOf(t.type)>=0&&this._validate(aa.source,"sources.".concat(e),t,null,r))return;this.map&&this.map._collectResourceTiming&&(t.collectResourceTiming=!0);let i=this.sourceCaches[e]=new Zx(e,t,this.dispatcher);i.style=this,i.setEventedParent(this,()=>({isSourceLoaded:i.loaded(),source:i.serialize(),sourceId:e})),i.onAdd(this.map),this._changed=!0}removeSource(e){if(this._checkLoaded(),this.sourceCaches[e]===void 0)throw new Error("There is no source with this ID");for(let r in this._layers)if(this._layers[r].source===e)return this.fire(new yr(new Error('Source "'.concat(e,'" cannot be removed while layer "').concat(r,'" is using it.'))));let t=this.sourceCaches[e];delete this.sourceCaches[e],delete this._updatedSources[e],t.fire(new kt("data",{sourceDataType:"metadata",dataType:"source",sourceId:e})),t.setEventedParent(null),t.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(e,t){if(this._checkLoaded(),this.sourceCaches[e]===void 0)throw new Error("There is no source with this ID=".concat(e));let r=this.sourceCaches[e].getSource();if(r.type!=="geojson")throw new Error("geojsonSource.type is ".concat(r.type,", which is !== 'geojson"));r.setData(t),this._changed=!0}getSource(e){return this.sourceCaches[e]&&this.sourceCaches[e].getSource()}addLayer(e,t,r={}){this._checkLoaded();let i=e.id;if(this.getLayer(i)){this.fire(new yr(new Error('Layer "'.concat(i,'" already exists on this map.'))));return}let n;if(e.type==="custom"){if(_S(this,aDe(e)))return;n=M5(e)}else{if("source"in e&&typeof e.source=="object"&&(this.addSource(i,e.source),e=us(e),e=tr(e,{source:i})),this._validate(aa.layer,"layers.".concat(i),e,{arrayIndex:-1},r))return;n=M5(e),this._validateLayer(n),n.setEventedParent(this,{layer:{id:i}})}let a=t?this._order.indexOf(t):this._order.length;if(t&&a===-1){this.fire(new yr(new Error('Cannot add layer "'.concat(i,'" before non-existing layer "').concat(t,'".'))));return}if(this._order.splice(a,0,i),this._layerOrderChanged=!0,this._layers[i]=n,this._removedLayers[i]&&n.source&&n.type!=="custom"){let o=this._removedLayers[i];delete this._removedLayers[i],o.type!==n.type?this._updatedSources[n.source]="clear":(this._updatedSources[n.source]="reload",this.sourceCaches[n.source].pause())}this._updateLayer(n),n.onAdd&&n.onAdd(this.map)}moveLayer(e,t){if(this._checkLoaded(),this._changed=!0,!this._layers[e]){this.fire(new yr(new Error("The layer '".concat(e,"' does not exist in the map's style and cannot be moved."))));return}if(e===t)return;let r=this._order.indexOf(e);this._order.splice(r,1);let i=t?this._order.indexOf(t):this._order.length;if(t&&i===-1){this.fire(new yr(new Error('Cannot move layer "'.concat(e,'" before non-existing layer "').concat(t,'".'))));return}this._order.splice(i,0,e),this._layerOrderChanged=!0}removeLayer(e){this._checkLoaded();let t=this._layers[e];if(!t){this.fire(new yr(new Error('Cannot remove non-existing layer "'.concat(e,'".'))));return}t.setEventedParent(null);let r=this._order.indexOf(e);this._order.splice(r,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[e]=t,delete this._layers[e],this._serializedLayers&&delete this._serializedLayers[e],delete this._updatedLayers[e],delete this._updatedPaintProps[e],t.onRemove&&t.onRemove(this.map)}getLayer(e){return this._layers[e]}getLayersOrder(){return[...this._order]}hasLayer(e){return e in this._layers}setLayerZoomRange(e,t,r){this._checkLoaded();let i=this.getLayer(e);if(!i){this.fire(new yr(new Error('Cannot set the zoom range of non-existing layer "'.concat(e,'".'))));return}i.minzoom===t&&i.maxzoom===r||(t!=null&&(i.minzoom=t),r!=null&&(i.maxzoom=r),this._updateLayer(i))}setFilter(e,t,r={}){this._checkLoaded();let i=this.getLayer(e);if(!i){this.fire(new yr(new Error('Cannot filter non-existing layer "'.concat(e,'".'))));return}if(!Yu(i.filter,t)){if(t==null){i.setFilter(void 0),this._updateLayer(i);return}this._validate(aa.filter,"layers.".concat(i.id,".filter"),t,null,r)||(i.setFilter(us(t)),this._updateLayer(i))}}getFilter(e){return us(this.getLayer(e).filter)}setLayoutProperty(e,t,r,i={}){this._checkLoaded();let n=this.getLayer(e);if(!n){this.fire(new yr(new Error('Cannot style non-existing layer "'.concat(e,'".'))));return}Yu(n.getLayoutProperty(t),r)||(n.setLayoutProperty(t,r,i),this._updateLayer(n))}getLayoutProperty(e,t){let r=this.getLayer(e);if(!r){this.fire(new yr(new Error('Cannot get style of non-existing layer "'.concat(e,'".'))));return}return r.getLayoutProperty(t)}setPaintProperty(e,t,r,i={}){this._checkLoaded();let n=this.getLayer(e);if(!n){this.fire(new yr(new Error('Cannot style non-existing layer "'.concat(e,'".'))));return}Yu(n.getPaintProperty(t),r)||(n.setPaintProperty(t,r,i)&&this._updateLayer(n),this._changed=!0,this._updatedPaintProps[e]=!0,this._serializedLayers=null)}getPaintProperty(e,t){return this.getLayer(e).getPaintProperty(t)}setFeatureState(e,t){this._checkLoaded();let r=e.source,i=e.sourceLayer,n=this.sourceCaches[r];if(n===void 0){this.fire(new yr(new Error("The source '".concat(r,"' does not exist in the map's style."))));return}let a=n.getSource().type;if(a==="geojson"&&i){this.fire(new yr(new Error("GeoJSON sources cannot have a sourceLayer parameter.")));return}if(a==="vector"&&!i){this.fire(new yr(new Error("The sourceLayer parameter must be provided for vector source types.")));return}e.id===void 0&&this.fire(new yr(new Error("The feature id parameter must be provided."))),n.setFeatureState(i,e.id,t)}removeFeatureState(e,t){this._checkLoaded();let r=e.source,i=this.sourceCaches[r];if(i===void 0){this.fire(new yr(new Error("The source '".concat(r,"' does not exist in the map's style."))));return}let n=i.getSource().type,a=n==="vector"?e.sourceLayer:void 0;if(n==="vector"&&!a){this.fire(new yr(new Error("The sourceLayer parameter must be provided for vector source types.")));return}if(t&&typeof e.id!="string"&&typeof e.id!="number"){this.fire(new yr(new Error("A feature id is required to remove its specific state property.")));return}i.removeFeatureState(a,e.id,t)}getFeatureState(e){this._checkLoaded();let t=e.source,r=e.sourceLayer,i=this.sourceCaches[t];if(i===void 0){this.fire(new yr(new Error("The source '".concat(t,"' does not exist in the map's style."))));return}if(i.getSource().type==="vector"&&!r){this.fire(new yr(new Error("The sourceLayer parameter must be provided for vector source types.")));return}return e.id===void 0&&this.fire(new yr(new Error("The feature id parameter must be provided."))),i.getFeatureState(r,e.id)}getTransition(){return tr({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){if(!this._loaded)return;let e=zN(this.sourceCaches,n=>n.serialize()),t=this._serializeByIds(this._order,!0),r=this.map.getTerrain()||void 0,i=this.stylesheet;return fq({version:i.version,name:i.name,metadata:i.metadata,light:i.light,sky:i.sky,center:i.center,zoom:i.zoom,bearing:i.bearing,pitch:i.pitch,sprite:i.sprite,glyphs:i.glyphs,transition:i.transition,projection:i.projection,sources:e,layers:t,terrain:r},n=>n!==void 0)}_updateLayer(e){this._updatedLayers[e.id]=!0,e.source&&!this._updatedSources[e.source]&&this.sourceCaches[e.source].getSource().type!=="raster"&&(this._updatedSources[e.source]="reload",this.sourceCaches[e.source].pause()),this._serializedLayers=null,this._changed=!0}_flattenAndSortRenderedFeatures(e){let t=a=>this._layers[a].type==="fill-extrusion",r={},i=[];for(let a=this._order.length-1;a>=0;a--){let o=this._order[a];if(t(o)){r[o]=a;for(let s of e){let l=s[o];if(l)for(let u of l)i.push(u)}}}i.sort((a,o)=>o.intersectionZ-a.intersectionZ);let n=[];for(let a=this._order.length-1;a>=0;a--){let o=this._order[a];if(t(o))for(let s=i.length-1;s>=0;s--){let l=i[s].feature;if(r[l.layer.id]<a)break;n.push(l),i.pop()}else for(let s of e){let l=s[o];if(l)for(let u of l)n.push(u.feature)}}return n}queryRenderedFeatures(e,t,r){t&&t.filter&&this._validate(aa.filter,"queryRenderedFeatures.filter",t.filter,null,t);let i={};if(t&&t.layers){if(!(Array.isArray(t.layers)||t.layers instanceof Set))return this.fire(new yr(new Error("parameters.layers must be an Array or a Set of strings"))),[];for(let l of t.layers){let u=this._layers[l];if(!u)return this.fire(new yr(new Error("The layer '".concat(l,"' does not exist in the map's style and cannot be queried for features.")))),[];i[u.source]=!0}}let n=[];t.availableImages=this._availableImages;let a=this._serializedAllLayers(),o=t.layers instanceof Set?t.layers:Array.isArray(t.layers)?new Set(t.layers):null,s=bt(ze({},t),{layers:o});for(let l in this.sourceCaches)t.layers&&!i[l]||n.push(TDe(this.sourceCaches[l],this._layers,a,e,s,r,this.map.terrain?(u,c,h)=>this.map.terrain.getElevation(u,c,h):void 0));return this.placement&&n.push(PDe(this._layers,a,this.sourceCaches,e,s,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(n)}querySourceFeatures(e,t){t&&t.filter&&this._validate(aa.filter,"querySourceFeatures.filter",t.filter,null,t);let r=this.sourceCaches[e];return r?DDe(r,t):[]}getLight(){return this.light.getLight()}setLight(e,t={}){this._checkLoaded();let r=this.light.getLight(),i=!1;for(let a in e)if(!Yu(e[a],r[a])){i=!0;break}if(!i)return;let n={now:ri.now(),transition:tr({duration:300,delay:0},this.stylesheet.transition)};this.light.setLight(e,t),this.light.updateTransitions(n)}getProjection(){var e;return(e=this.stylesheet)==null?void 0:e.projection}setProjection(e){if(this._checkLoaded(),this.projection){if(this.projection.name===e.type)return;this.projection.destroy(),delete this.projection}this.stylesheet.projection=e,this._setProjectionInternal(e.type)}getSky(){var e;return(e=this.stylesheet)==null?void 0:e.sky}setSky(e,t={}){this._checkLoaded();let r=this.getSky(),i=!1;if(!e&&!r)return;if(e&&!r)i=!0;else if(!e&&r)i=!0;else for(let a in e)if(!Yu(e[a],r[a])){i=!0;break}if(!i)return;let n={now:ri.now(),transition:tr({duration:300,delay:0},this.stylesheet.transition)};this.stylesheet.sky=e,this.sky.setSky(e,t),this.sky.updateTransitions(n)}_setProjectionInternal(e){let t=D4e(e);this.projection=t.projection,this.map.migrateProjection(t.transform,t.cameraHelper);for(let r in this.sourceCaches)this.sourceCaches[r].reload()}_validate(e,t,r,i,n={}){return n&&n.validate===!1?!1:_S(this,e.call(aa,tr({key:t,style:this.serialize(),value:r,styleSpec:ht},i)))}_remove(e=!0){this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._loadStyleRequest&&(this._loadStyleRequest.abort(),this._loadStyleRequest=null),this._spriteRequest&&(this._spriteRequest.abort(),this._spriteRequest=null),QO().off(UO,this._rtlPluginLoaded);for(let t in this._layers)this._layers[t].setEventedParent(null);for(let t in this.sourceCaches){let r=this.sourceCaches[t];r.setEventedParent(null),r.onRemove(this.map)}this.imageManager.setEventedParent(null),this.setEventedParent(null),e&&this.dispatcher.broadcast("RM",void 0),this.dispatcher.remove(e)}_clearSource(e){this.sourceCaches[e].clearTiles()}_reloadSource(e){this.sourceCaches[e].resume(),this.sourceCaches[e].reload()}_updateSources(e){for(let t in this.sourceCaches)this.sourceCaches[t].update(e,this.map.terrain)}_generateCollisionBoxes(){for(let e in this.sourceCaches)this._reloadSource(e)}_updatePlacement(e,t,r,i,n=!1){let a=!1,o=!1,s={};for(let l of this._order){let u=this._layers[l];if(u.type!=="symbol")continue;if(!s[u.source]){let h=this.sourceCaches[u.source];s[u.source]=h.getRenderableIds(!0).map(d=>h.getTileByID(d)).sort((d,p)=>p.tileID.overscaledZ-d.tileID.overscaledZ||(d.tileID.isLessThan(p.tileID)?-1:1))}let c=this.crossTileSymbolIndex.addLayer(u,s[u.source],e.center.lng);a=a||c}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),n=n||this._layerOrderChanged||r===0,(n||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(ri.now(),e.zoom))&&(this.pauseablePlacement=new U3e(e,this.map.terrain,this._order,n,t,r,i,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,s),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(ri.now()),o=!0),a&&this.pauseablePlacement.placement.setStale()),o||a)for(let l of this._order){let u=this._layers[l];u.type==="symbol"&&this.placement.updateLayerOpacities(u,s[u.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(ri.now())}_releaseSymbolFadeTiles(){for(let e in this.sourceCaches)this.sourceCaches[e].releaseSymbolFadeTiles()}getImages(e,t){return Qe(this,null,function*(){let r=yield this.imageManager.getImages(t.icons);this._updateTilesForChangedImages();let i=this.sourceCaches[t.source];return i&&i.setDependencies(t.tileID.key,t.type,t.icons),r})}getGlyphs(e,t){return Qe(this,null,function*(){let r=yield this.glyphManager.getGlyphs(t.stacks),i=this.sourceCaches[t.source];return i&&i.setDependencies(t.tileID.key,t.type,[""]),r})}getGlyphsUrl(){return this.stylesheet.glyphs||null}setGlyphs(e,t={}){this._checkLoaded(),!(e&&this._validate(aa.glyphs,"glyphs",e,null,t))&&(this._glyphsDidChange=!0,this.stylesheet.glyphs=e,this.glyphManager.entries={},this.glyphManager.setURL(e))}addSprite(e,t,r={},i){this._checkLoaded();let n=[{id:e,url:t}],a=[...HS(this.stylesheet.sprite),...n];this._validate(aa.sprite,"sprite",a,null,r)||(this.stylesheet.sprite=a,this._loadSprite(n,!0,i))}removeSprite(e){this._checkLoaded();let t=HS(this.stylesheet.sprite);if(!t.find(r=>r.id===e)){this.fire(new yr(new Error('Sprite "'.concat(e,\`" doesn't exists on this map.\`))));return}if(this._spritesImagesIds[e])for(let r of this._spritesImagesIds[e])this.imageManager.removeImage(r),this._changedImages[r]=!0;t.splice(t.findIndex(r=>r.id===e),1),this.stylesheet.sprite=t.length>0?t:void 0,delete this._spritesImagesIds[e],this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new kt("data",{dataType:"style"}))}getSprite(){return HS(this.stylesheet.sprite)}setSprite(e,t={},r){this._checkLoaded(),!(e&&this._validate(aa.sprite,"sprite",e,null,t))&&(this.stylesheet.sprite=e,e?this._loadSprite(e,!0,r):(this._unloadSprite(),r&&r(null)))}},R4e=Vn([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]),F4e=class{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null}bind(e,t,r,i,n,a,o,s,l){this.context=e;let u=this.boundPaintVertexBuffers.length!==i.length;for(let c=0;!u&&c<i.length;c++)this.boundPaintVertexBuffers[c]!==i[c]&&(u=!0);!this.vao||this.boundProgram!==t||this.boundLayoutVertexBuffer!==r||u||this.boundIndexBuffer!==n||this.boundVertexOffset!==a||this.boundDynamicVertexBuffer!==o||this.boundDynamicVertexBuffer2!==s||this.boundDynamicVertexBuffer3!==l?this.freshBind(t,r,i,n,a,o,s,l):(e.bindVertexArray.set(this.vao),o&&o.bind(),n&&n.dynamicDraw&&n.bind(),s&&s.bind(),l&&l.bind())}freshBind(e,t,r,i,n,a,o,s){let l=e.numAttributes,u=this.context,c=u.gl;this.vao&&this.destroy(),this.vao=u.createVertexArray(),u.bindVertexArray.set(this.vao),this.boundProgram=e,this.boundLayoutVertexBuffer=t,this.boundPaintVertexBuffers=r,this.boundIndexBuffer=i,this.boundVertexOffset=n,this.boundDynamicVertexBuffer=a,this.boundDynamicVertexBuffer2=o,this.boundDynamicVertexBuffer3=s,t.enableAttributes(c,e);for(let h of r)h.enableAttributes(c,e);a&&a.enableAttributes(c,e),o&&o.enableAttributes(c,e),s&&s.enableAttributes(c,e),t.bind(),t.setVertexAttribPointers(c,e,n);for(let h of r)h.bind(),h.setVertexAttribPointers(c,e,n);a&&(a.bind(),a.setVertexAttribPointers(c,e,n)),i&&i.bind(),o&&(o.bind(),o.setVertexAttribPointers(c,e,n)),s&&(s.bind(),s.setVertexAttribPointers(c,e,n)),u.currentNumAttributes=l}destroy(){this.vao&&(this.context.deleteVertexArray(this.vao),this.vao=null)}},z4e=(e,t)=>({u_depth:new Ir(e,t.u_depth),u_terrain:new Ir(e,t.u_terrain),u_terrain_dim:new Rt(e,t.u_terrain_dim),u_terrain_matrix:new Fs(e,t.u_terrain_matrix),u_terrain_unpack:new qd(e,t.u_terrain_unpack),u_terrain_exaggeration:new Rt(e,t.u_terrain_exaggeration)}),L4e=(e,t)=>({u_texture:new Ir(e,t.u_texture),u_ele_delta:new Rt(e,t.u_ele_delta),u_fog_matrix:new Fs(e,t.u_fog_matrix),u_fog_color:new $d(e,t.u_fog_color),u_fog_ground_blend:new Rt(e,t.u_fog_ground_blend),u_fog_ground_blend_opacity:new Rt(e,t.u_fog_ground_blend_opacity),u_horizon_color:new $d(e,t.u_horizon_color),u_horizon_fog_blend:new Rt(e,t.u_horizon_fog_blend),u_is_globe_mode:new Rt(e,t.u_is_globe_mode)}),O4e=(e,t)=>({u_ele_delta:new Rt(e,t.u_ele_delta)}),N4e=(e,t)=>({u_texture:new Ir(e,t.u_texture),u_terrain_coords_id:new Rt(e,t.u_terrain_coords_id),u_ele_delta:new Rt(e,t.u_ele_delta)}),U4e=(e,t,r,i,n)=>({u_texture:0,u_ele_delta:e,u_fog_matrix:t,u_fog_color:r?r.properties.get("fog-color"):mr.white,u_fog_ground_blend:r?r.properties.get("fog-ground-blend"):1,u_fog_ground_blend_opacity:n?0:r?r.calculateFogBlendOpacity(i):0,u_horizon_color:r?r.properties.get("horizon-color"):mr.white,u_horizon_fog_blend:r?r.properties.get("horizon-fog-blend"):1,u_is_globe_mode:n?1:0}),Q4e=e=>({u_ele_delta:e}),j4e=(e,t)=>({u_terrain_coords_id:e/255,u_texture:0,u_ele_delta:t}),G4e=(e,t)=>({u_projection_matrix:new Fs(e,t.u_projection_matrix),u_projection_tile_mercator_coords:new qd(e,t.u_projection_tile_mercator_coords),u_projection_clipping_plane:new qd(e,t.u_projection_clipping_plane),u_projection_transition:new Rt(e,t.u_projection_transition),u_projection_fallback_matrix:new Fs(e,t.u_projection_fallback_matrix)}),V4e={mainMatrix:"u_projection_matrix",tileMercatorCoords:"u_projection_tile_mercator_coords",clippingPlane:"u_projection_clipping_plane",projectionTransition:"u_projection_transition",fallbackMatrix:"u_projection_fallback_matrix"};Y4e=class{constructor(e,t,r,i,n,a,o,s,l=[]){let u=e.gl;this.program=u.createProgram();let c=bS(t.staticAttributes),h=r?r.getBinderAttributes():[],d=c.concat(h),p=qu.prelude.staticUniforms?bS(qu.prelude.staticUniforms):[],f=o.staticUniforms?bS(o.staticUniforms):[],m=t.staticUniforms?bS(t.staticUniforms):[],g=r?r.getBinderUniforms():[],v=p.concat(f).concat(m).concat(g),_=[];for(let T of v)_.indexOf(T)<0&&_.push(T);let x=r?r.defines():[];mh(u)&&x.unshift("#version 300 es"),n&&x.push("#define OVERDRAW_INSPECTOR;"),a&&x.push("#define TERRAIN3D;"),s&&x.push(s),l&&x.push(...l);let b=x.concat(qu.prelude.fragmentSource,o.fragmentSource,t.fragmentSource).join(\`
|
|
4886
4886
|
\`),E=x.concat(qu.prelude.vertexSource,o.vertexSource,t.vertexSource).join(\`
|
|
4887
4887
|
\`);mh(u)||(b=s4e(b),E=o4e(E));let M=u.createShader(u.FRAGMENT_SHADER);if(u.isContextLost()){this.failedToCreate=!0;return}if(u.shaderSource(M,b),u.compileShader(M),!u.getShaderParameter(M,u.COMPILE_STATUS))throw new Error("Could not compile fragment shader: ".concat(u.getShaderInfoLog(M)));u.attachShader(this.program,M);let S=u.createShader(u.VERTEX_SHADER);if(u.isContextLost()){this.failedToCreate=!0;return}if(u.shaderSource(S,E),u.compileShader(S),!u.getShaderParameter(S,u.COMPILE_STATUS))throw new Error("Could not compile vertex shader: ".concat(u.getShaderInfoLog(S)));u.attachShader(this.program,S),this.attributes={};let D={};this.numAttributes=d.length;for(let T=0;T<this.numAttributes;T++)d[T]&&(u.bindAttribLocation(this.program,T,d[T]),this.attributes[d[T]]=T);if(u.linkProgram(this.program),!u.getProgramParameter(this.program,u.LINK_STATUS))throw new Error("Program failed to link: ".concat(u.getProgramInfoLog(this.program)));u.deleteShader(S),u.deleteShader(M);for(let T=0;T<_.length;T++){let P=_[T];if(P&&!D[P]){let k=u.getUniformLocation(this.program,P);k&&(D[P]=k)}}this.fixedUniforms=i(e,D),this.terrainUniforms=z4e(e,D),this.projectionUniforms=G4e(e,D),this.binderUniforms=r?r.getUniforms(e,D):[]}draw(e,t,r,i,n,a,o,s,l,u,c,h,d,p,f,m,g,v,_){let x=e.gl;if(this.failedToCreate)return;if(e.program.set(this.program),e.setDepthMode(r),e.setStencilMode(i),e.setColorMode(n),e.setCullFace(a),s){e.activeTexture.set(x.TEXTURE2),x.bindTexture(x.TEXTURE_2D,s.depthTexture),e.activeTexture.set(x.TEXTURE3),x.bindTexture(x.TEXTURE_2D,s.texture);for(let E in this.terrainUniforms)this.terrainUniforms[E].set(s[E])}if(l)for(let E in l){let M=V4e[E];this.projectionUniforms[M].set(l[E])}if(o)for(let E in this.fixedUniforms)this.fixedUniforms[E].set(o[E]);m&&m.setUniforms(e,this.binderUniforms,p,{zoom:f});let b=0;switch(t){case x.LINES:b=2;break;case x.TRIANGLES:b=3;break;case x.LINE_STRIP:b=1;break}for(let E of d.get()){let M=E.vaos||(E.vaos={});(M[u]||(M[u]=new F4e)).bind(e,this,c,m?m.getPaintVertexBuffers():[],h,E.vertexOffset,g,v,_),x.drawElements(t,E.primitiveLength*b,x.UNSIGNED_SHORT,E.primitiveOffset*b*2)}}};W4e=(e,t)=>({u_lightpos:new ks(e,t.u_lightpos),u_lightpos_globe:new ks(e,t.u_lightpos_globe),u_lightintensity:new Rt(e,t.u_lightintensity),u_lightcolor:new ks(e,t.u_lightcolor),u_vertical_gradient:new Rt(e,t.u_vertical_gradient),u_opacity:new Rt(e,t.u_opacity),u_fill_translate:new vr(e,t.u_fill_translate)}),Z4e=(e,t)=>({u_lightpos:new ks(e,t.u_lightpos),u_lightpos_globe:new ks(e,t.u_lightpos_globe),u_lightintensity:new Rt(e,t.u_lightintensity),u_lightcolor:new ks(e,t.u_lightcolor),u_vertical_gradient:new Rt(e,t.u_vertical_gradient),u_height_factor:new Rt(e,t.u_height_factor),u_opacity:new Rt(e,t.u_opacity),u_fill_translate:new vr(e,t.u_fill_translate),u_image:new Ir(e,t.u_image),u_texsize:new vr(e,t.u_texsize),u_pixel_coord_upper:new vr(e,t.u_pixel_coord_upper),u_pixel_coord_lower:new vr(e,t.u_pixel_coord_lower),u_scale:new ks(e,t.u_scale),u_fade:new Rt(e,t.u_fade)}),fte=(e,t,r,i)=>{let n=e.style.light,a=n.properties.get("position"),o=[a.x,a.y,a.z],s=Px.create();n.properties.get("anchor")==="viewport"&&Px.fromRotation(s,e.transform.bearingInRadians),St.transformMat3(o,o,s);let l=e.transform.transformLightDirection(o),u=n.properties.get("color");return{u_lightpos:o,u_lightpos_globe:l,u_lightintensity:n.properties.get("intensity"),u_lightcolor:[u.r,u.g,u.b],u_vertical_gradient:+t,u_opacity:r,u_fill_translate:i}},X4e=(e,t,r,i,n,a,o)=>tr(fte(e,t,r,i),pte(a,e,o),{u_height_factor:-Math.pow(2,n.overscaledZ)/o.tileSize/8}),J4e=(e,t)=>({u_fill_translate:new vr(e,t.u_fill_translate)}),K4e=(e,t)=>({u_image:new Ir(e,t.u_image),u_texsize:new vr(e,t.u_texsize),u_pixel_coord_upper:new vr(e,t.u_pixel_coord_upper),u_pixel_coord_lower:new vr(e,t.u_pixel_coord_lower),u_scale:new ks(e,t.u_scale),u_fade:new Rt(e,t.u_fade),u_fill_translate:new vr(e,t.u_fill_translate)}),q4e=(e,t)=>({u_world:new vr(e,t.u_world),u_fill_translate:new vr(e,t.u_fill_translate)}),$4e=(e,t)=>({u_world:new vr(e,t.u_world),u_image:new Ir(e,t.u_image),u_texsize:new vr(e,t.u_texsize),u_pixel_coord_upper:new vr(e,t.u_pixel_coord_upper),u_pixel_coord_lower:new vr(e,t.u_pixel_coord_lower),u_scale:new ks(e,t.u_scale),u_fade:new Rt(e,t.u_fade),u_fill_translate:new vr(e,t.u_fill_translate)}),Ate=(e,t,r,i)=>tr(pte(t,e,r),{u_fill_translate:i}),eRe=e=>({u_fill_translate:e}),tRe=(e,t)=>({u_world:e,u_fill_translate:t}),rRe=(e,t,r,i,n)=>tr(Ate(e,t,r,n),{u_world:i}),iRe=(e,t)=>({u_camera_to_center_distance:new Rt(e,t.u_camera_to_center_distance),u_scale_with_map:new Ir(e,t.u_scale_with_map),u_pitch_with_map:new Ir(e,t.u_pitch_with_map),u_extrude_scale:new vr(e,t.u_extrude_scale),u_device_pixel_ratio:new Rt(e,t.u_device_pixel_ratio),u_globe_extrude_scale:new Rt(e,t.u_globe_extrude_scale),u_translate:new vr(e,t.u_translate)}),nRe=(e,t,r,i,n)=>{let a=e.transform,o,s,l=0;if(r.paint.get("circle-pitch-alignment")==="map"){let u=Rs(t,1,a.zoom);o=!0,s=[u,u],l=u/(8192*Math.pow(2,t.tileID.overscaledZ))*2*Math.PI*n}else o=!1,s=a.pixelsToGLUnits;return{u_camera_to_center_distance:a.cameraToCenterDistance,u_scale_with_map:+(r.paint.get("circle-pitch-scale")==="map"),u_pitch_with_map:+o,u_device_pixel_ratio:e.pixelRatio,u_extrude_scale:s,u_globe_extrude_scale:l,u_translate:i}},aRe=(e,t)=>({u_pixel_extrude_scale:new vr(e,t.u_pixel_extrude_scale)}),oRe=(e,t)=>({u_viewport_size:new vr(e,t.u_viewport_size)}),sRe=e=>({u_pixel_extrude_scale:[1/e.width,1/e.height]}),lRe=e=>({u_viewport_size:[e.width,e.height]}),uRe=(e,t)=>({u_color:new $d(e,t.u_color),u_overlay:new Ir(e,t.u_overlay),u_overlay_scale:new Rt(e,t.u_overlay_scale)}),hJ=(e,t=1)=>({u_color:e,u_overlay:0,u_overlay_scale:t}),cRe=(e,t)=>({u_extrude_scale:new Rt(e,t.u_extrude_scale),u_intensity:new Rt(e,t.u_intensity),u_globe_extrude_scale:new Rt(e,t.u_globe_extrude_scale)}),hRe=(e,t)=>({u_matrix:new Fs(e,t.u_matrix),u_world:new vr(e,t.u_world),u_image:new Ir(e,t.u_image),u_color_ramp:new Ir(e,t.u_color_ramp),u_opacity:new Rt(e,t.u_opacity)}),mte=(e,t,r,i)=>{let n=Rs(e,1,t)/(8192*Math.pow(2,e.tileID.overscaledZ))*2*Math.PI*i;return{u_extrude_scale:Rs(e,1,t),u_intensity:r,u_globe_extrude_scale:n}},gte=(e,t,r,i)=>{let n=_t.create();_t.ortho(n,0,e.width,e.height,0,0,1);let a=e.context.gl;return{u_matrix:n,u_world:[a.drawingBufferWidth,a.drawingBufferHeight],u_image:r,u_color_ramp:i,u_opacity:t.paint.get("heatmap-opacity")}},dRe=(e,t)=>({u_image:new Ir(e,t.u_image),u_latrange:new vr(e,t.u_latrange),u_exaggeration:new Rt(e,t.u_exaggeration),u_altitudes:new tX(e,t.u_altitudes),u_azimuths:new tX(e,t.u_azimuths),u_accent:new $d(e,t.u_accent),u_method:new Ir(e,t.u_method),u_shadows:new eX(e,t.u_shadows),u_highlights:new eX(e,t.u_highlights)}),pRe=(e,t)=>({u_matrix:new Fs(e,t.u_matrix),u_image:new Ir(e,t.u_image),u_dimension:new vr(e,t.u_dimension),u_zoom:new Rt(e,t.u_zoom),u_unpack:new qd(e,t.u_unpack)}),fRe=(e,t,r)=>{let i=r.paint.get("hillshade-accent-color"),n;switch(r.paint.get("hillshade-method")){case"basic":n=4;break;case"combined":n=1;break;case"igor":n=2;break;case"multidirectional":n=3;break;default:n=0;break}let a=r.getIlluminationProperties();for(let o=0;o<a.directionRadians.length;o++)r.paint.get("hillshade-illumination-anchor")==="viewport"&&(a.directionRadians[o]+=e.transform.bearingInRadians);return{u_image:0,u_latrange:mRe(e,t.tileID),u_exaggeration:r.paint.get("hillshade-exaggeration"),u_altitudes:a.altitudeRadians,u_azimuths:a.directionRadians,u_accent:i,u_method:n,u_highlights:a.highlightColor,u_shadows:a.shadowColor}},ARe=(e,t)=>{let r=t.stride,i=_t.create();return _t.ortho(i,0,8192,-8192,0,0,1),_t.translate(i,i,[0,-8192,0]),{u_matrix:i,u_image:1,u_dimension:[r,r],u_zoom:e.overscaledZ,u_unpack:t.getUnpackVector()}};gRe=(e,t)=>({u_image:new Ir(e,t.u_image),u_unpack:new qd(e,t.u_unpack),u_dimension:new vr(e,t.u_dimension),u_elevation_stops:new Ir(e,t.u_elevation_stops),u_color_stops:new Ir(e,t.u_color_stops),u_opacity:new Rt(e,t.u_opacity)}),yRe=(e,t)=>({u_image:0,u_unpack:t.getUnpackVector(),u_dimension:[t.stride,t.stride],u_elevation_stops:1,u_color_stops:4,u_opacity:e.paint.get("color-relief-opacity")}),vRe=(e,t)=>({u_translation:new vr(e,t.u_translation),u_ratio:new Rt(e,t.u_ratio),u_device_pixel_ratio:new Rt(e,t.u_device_pixel_ratio),u_units_to_pixels:new vr(e,t.u_units_to_pixels)}),xRe=(e,t)=>({u_translation:new vr(e,t.u_translation),u_ratio:new Rt(e,t.u_ratio),u_device_pixel_ratio:new Rt(e,t.u_device_pixel_ratio),u_units_to_pixels:new vr(e,t.u_units_to_pixels),u_image:new Ir(e,t.u_image),u_image_height:new Rt(e,t.u_image_height)}),_Re=(e,t)=>({u_translation:new vr(e,t.u_translation),u_texsize:new vr(e,t.u_texsize),u_ratio:new Rt(e,t.u_ratio),u_device_pixel_ratio:new Rt(e,t.u_device_pixel_ratio),u_image:new Ir(e,t.u_image),u_units_to_pixels:new vr(e,t.u_units_to_pixels),u_scale:new ks(e,t.u_scale),u_fade:new Rt(e,t.u_fade)}),bRe=(e,t)=>({u_translation:new vr(e,t.u_translation),u_ratio:new Rt(e,t.u_ratio),u_device_pixel_ratio:new Rt(e,t.u_device_pixel_ratio),u_units_to_pixels:new vr(e,t.u_units_to_pixels),u_patternscale_a:new vr(e,t.u_patternscale_a),u_patternscale_b:new vr(e,t.u_patternscale_b),u_sdfgamma:new Rt(e,t.u_sdfgamma),u_image:new Ir(e,t.u_image),u_tex_y_a:new Rt(e,t.u_tex_y_a),u_tex_y_b:new Rt(e,t.u_tex_y_b),u_mix:new Rt(e,t.u_mix)}),jU=(e,t,r,i)=>{let n=e.transform;return{u_translation:vte(e,t,r),u_ratio:i/Rs(t,1,n.zoom),u_device_pixel_ratio:e.pixelRatio,u_units_to_pixels:[1/n.pixelsToGLUnits[0],1/n.pixelsToGLUnits[1]]}},wRe=(e,t,r,i,n)=>tr(jU(e,t,r,i),{u_image:0,u_image_height:n}),ERe=(e,t,r,i,n)=>{let a=e.transform,o=yte(t,a);return{u_translation:vte(e,t,r),u_texsize:t.imageAtlasTexture.size,u_ratio:i/Rs(t,1,a.zoom),u_device_pixel_ratio:e.pixelRatio,u_image:0,u_scale:[o,n.fromScale,n.toScale],u_fade:n.t,u_units_to_pixels:[1/a.pixelsToGLUnits[0],1/a.pixelsToGLUnits[1]]}},MRe=(e,t,r,i,n,a)=>{let o=e.transform,s=e.lineAtlas,l=yte(t,o),u=r.layout.get("line-cap")==="round",c=s.getDash(n.from,u),h=s.getDash(n.to,u),d=c.width*a.fromScale,p=h.width*a.toScale;return tr(jU(e,t,r,i),{u_patternscale_a:[l/d,-c.height/2],u_patternscale_b:[l/p,-h.height/2],u_sdfgamma:s.width/(Math.min(d,p)*256*e.pixelRatio)/2,u_image:0,u_tex_y_a:c.y,u_tex_y_b:h.y,u_mix:a.t})};SRe=(e,t)=>({u_tl_parent:new vr(e,t.u_tl_parent),u_scale_parent:new Rt(e,t.u_scale_parent),u_buffer_scale:new Rt(e,t.u_buffer_scale),u_fade_t:new Rt(e,t.u_fade_t),u_opacity:new Rt(e,t.u_opacity),u_image0:new Ir(e,t.u_image0),u_image1:new Ir(e,t.u_image1),u_brightness_low:new Rt(e,t.u_brightness_low),u_brightness_high:new Rt(e,t.u_brightness_high),u_saturation_factor:new Rt(e,t.u_saturation_factor),u_contrast_factor:new Rt(e,t.u_contrast_factor),u_spin_weights:new ks(e,t.u_spin_weights),u_coords_top:new qd(e,t.u_coords_top),u_coords_bottom:new qd(e,t.u_coords_bottom)}),IRe=(e,t,r,i,n)=>({u_tl_parent:e,u_scale_parent:t,u_buffer_scale:1,u_fade_t:r.mix,u_opacity:r.opacity*i.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:i.paint.get("raster-brightness-min"),u_brightness_high:i.paint.get("raster-brightness-max"),u_saturation_factor:TRe(i.paint.get("raster-saturation")),u_contrast_factor:BRe(i.paint.get("raster-contrast")),u_spin_weights:CRe(i.paint.get("raster-hue-rotate")),u_coords_top:[n[0].x,n[0].y,n[1].x,n[1].y],u_coords_bottom:[n[3].x,n[3].y,n[2].x,n[2].y]});PRe=(e,t)=>({u_is_size_zoom_constant:new Ir(e,t.u_is_size_zoom_constant),u_is_size_feature_constant:new Ir(e,t.u_is_size_feature_constant),u_size_t:new Rt(e,t.u_size_t),u_size:new Rt(e,t.u_size),u_camera_to_center_distance:new Rt(e,t.u_camera_to_center_distance),u_pitch:new Rt(e,t.u_pitch),u_rotate_symbol:new Ir(e,t.u_rotate_symbol),u_aspect_ratio:new Rt(e,t.u_aspect_ratio),u_fade_change:new Rt(e,t.u_fade_change),u_label_plane_matrix:new Fs(e,t.u_label_plane_matrix),u_coord_matrix:new Fs(e,t.u_coord_matrix),u_is_text:new Ir(e,t.u_is_text),u_pitch_with_map:new Ir(e,t.u_pitch_with_map),u_is_along_line:new Ir(e,t.u_is_along_line),u_is_variable_anchor:new Ir(e,t.u_is_variable_anchor),u_texsize:new vr(e,t.u_texsize),u_texture:new Ir(e,t.u_texture),u_translation:new vr(e,t.u_translation),u_pitched_scale:new Rt(e,t.u_pitched_scale)}),DRe=(e,t)=>({u_is_size_zoom_constant:new Ir(e,t.u_is_size_zoom_constant),u_is_size_feature_constant:new Ir(e,t.u_is_size_feature_constant),u_size_t:new Rt(e,t.u_size_t),u_size:new Rt(e,t.u_size),u_camera_to_center_distance:new Rt(e,t.u_camera_to_center_distance),u_pitch:new Rt(e,t.u_pitch),u_rotate_symbol:new Ir(e,t.u_rotate_symbol),u_aspect_ratio:new Rt(e,t.u_aspect_ratio),u_fade_change:new Rt(e,t.u_fade_change),u_label_plane_matrix:new Fs(e,t.u_label_plane_matrix),u_coord_matrix:new Fs(e,t.u_coord_matrix),u_is_text:new Ir(e,t.u_is_text),u_pitch_with_map:new Ir(e,t.u_pitch_with_map),u_is_along_line:new Ir(e,t.u_is_along_line),u_is_variable_anchor:new Ir(e,t.u_is_variable_anchor),u_texsize:new vr(e,t.u_texsize),u_texture:new Ir(e,t.u_texture),u_gamma_scale:new Rt(e,t.u_gamma_scale),u_device_pixel_ratio:new Rt(e,t.u_device_pixel_ratio),u_is_halo:new Ir(e,t.u_is_halo),u_translation:new vr(e,t.u_translation),u_pitched_scale:new Rt(e,t.u_pitched_scale)}),kRe=(e,t)=>({u_is_size_zoom_constant:new Ir(e,t.u_is_size_zoom_constant),u_is_size_feature_constant:new Ir(e,t.u_is_size_feature_constant),u_size_t:new Rt(e,t.u_size_t),u_size:new Rt(e,t.u_size),u_camera_to_center_distance:new Rt(e,t.u_camera_to_center_distance),u_pitch:new Rt(e,t.u_pitch),u_rotate_symbol:new Ir(e,t.u_rotate_symbol),u_aspect_ratio:new Rt(e,t.u_aspect_ratio),u_fade_change:new Rt(e,t.u_fade_change),u_label_plane_matrix:new Fs(e,t.u_label_plane_matrix),u_coord_matrix:new Fs(e,t.u_coord_matrix),u_is_text:new Ir(e,t.u_is_text),u_pitch_with_map:new Ir(e,t.u_pitch_with_map),u_is_along_line:new Ir(e,t.u_is_along_line),u_is_variable_anchor:new Ir(e,t.u_is_variable_anchor),u_texsize:new vr(e,t.u_texsize),u_texsize_icon:new vr(e,t.u_texsize_icon),u_texture:new Ir(e,t.u_texture),u_texture_icon:new Ir(e,t.u_texture_icon),u_gamma_scale:new Rt(e,t.u_gamma_scale),u_device_pixel_ratio:new Rt(e,t.u_device_pixel_ratio),u_is_halo:new Ir(e,t.u_is_halo),u_translation:new vr(e,t.u_translation),u_pitched_scale:new Rt(e,t.u_pitched_scale)}),xte=(e,t,r,i,n,a,o,s,l,u,c,h,d)=>{let p=o.transform;return{u_is_size_zoom_constant:+(e==="constant"||e==="source"),u_is_size_feature_constant:+(e==="constant"||e==="camera"),u_size_t:t?t.uSizeT:0,u_size:t?t.uSize:0,u_camera_to_center_distance:p.cameraToCenterDistance,u_pitch:p.pitch/360*2*Math.PI,u_rotate_symbol:+r,u_aspect_ratio:p.width/p.height,u_fade_change:o.options.fadeDuration?o.symbolFadeChange:1,u_label_plane_matrix:s,u_coord_matrix:l,u_is_text:+c,u_pitch_with_map:+i,u_is_along_line:n,u_is_variable_anchor:a,u_texsize:h,u_texture:0,u_translation:u,u_pitched_scale:d}},_te=(e,t,r,i,n,a,o,s,l,u,c,h,d,p)=>{let f=o.transform;return tr(xte(e,t,r,i,n,a,o,s,l,u,c,h,p),{u_gamma_scale:i?Math.cos(f.pitch*Math.PI/180)*f.cameraToCenterDistance:1,u_device_pixel_ratio:o.pixelRatio,u_is_halo:+d})},RRe=(e,t,r,i,n,a,o,s,l,u,c,h,d)=>tr(_te(e,t,r,i,n,a,o,s,l,u,!0,c,!0,d),{u_texsize_icon:h,u_texture_icon:1}),FRe=(e,t)=>({u_opacity:new Rt(e,t.u_opacity),u_color:new $d(e,t.u_color)}),zRe=(e,t)=>({u_opacity:new Rt(e,t.u_opacity),u_image:new Ir(e,t.u_image),u_pattern_tl_a:new vr(e,t.u_pattern_tl_a),u_pattern_br_a:new vr(e,t.u_pattern_br_a),u_pattern_tl_b:new vr(e,t.u_pattern_tl_b),u_pattern_br_b:new vr(e,t.u_pattern_br_b),u_texsize:new vr(e,t.u_texsize),u_mix:new Rt(e,t.u_mix),u_pattern_size_a:new vr(e,t.u_pattern_size_a),u_pattern_size_b:new vr(e,t.u_pattern_size_b),u_scale_a:new Rt(e,t.u_scale_a),u_scale_b:new Rt(e,t.u_scale_b),u_pixel_coord_upper:new vr(e,t.u_pixel_coord_upper),u_pixel_coord_lower:new vr(e,t.u_pixel_coord_lower),u_tile_units_to_pixels:new Rt(e,t.u_tile_units_to_pixels)}),LRe=(e,t)=>({u_opacity:e,u_color:t}),ORe=(e,t,r,i,n)=>tr(H4e(r,n,t,i),{u_opacity:e}),NRe=(e,t)=>({u_sun_pos:new ks(e,t.u_sun_pos),u_atmosphere_blend:new Rt(e,t.u_atmosphere_blend),u_globe_position:new ks(e,t.u_globe_position),u_globe_radius:new Rt(e,t.u_globe_radius),u_inv_proj_matrix:new Fs(e,t.u_inv_proj_matrix)}),URe=(e,t,r,i,n)=>({u_sun_pos:e,u_atmosphere_blend:t,u_globe_position:r,u_globe_radius:i,u_inv_proj_matrix:n}),QRe=(e,t)=>({u_sky_color:new $d(e,t.u_sky_color),u_horizon_color:new $d(e,t.u_horizon_color),u_horizon:new vr(e,t.u_horizon),u_horizon_normal:new vr(e,t.u_horizon_normal),u_sky_horizon_blend:new Rt(e,t.u_sky_horizon_blend),u_sky_blend:new Rt(e,t.u_sky_blend)}),jRe=(e,t,r)=>{let i=Math.cos(t.rollInRadians),n=Math.sin(t.rollInRadians),a=WS(t),o=t.getProjectionData({overscaledTileID:null,applyGlobeMatrix:!0,applyTerrainMatrix:!0}).projectionTransition;return{u_sky_color:e.properties.get("sky-color"),u_horizon_color:e.properties.get("horizon-color"),u_horizon:[(t.width/2-a*n)*r,(t.height/2+a*i)*r],u_horizon_normal:[-n,i],u_sky_horizon_blend:e.properties.get("sky-horizon-blend")*t.height/2*r,u_sky_blend:o}},dJ=(e,t)=>{},GRe={fillExtrusion:W4e,fillExtrusionPattern:Z4e,fill:J4e,fillPattern:K4e,fillOutline:q4e,fillOutlinePattern:$4e,circle:iRe,collisionBox:aRe,collisionCircle:oRe,debug:uRe,depth:dJ,clippingMask:dJ,heatmap:cRe,heatmapTexture:hRe,hillshade:dRe,hillshadePrepare:pRe,colorRelief:gRe,line:vRe,lineGradient:xRe,linePattern:_Re,lineSDF:bRe,raster:SRe,symbolIcon:PRe,symbolSDF:DRe,symbolTextAndIcon:kRe,background:FRe,backgroundPattern:zRe,terrain:L4e,terrainDepth:O4e,terrainCoords:N4e,projectionErrorMeasurement:m4e,atmosphere:NRe,sky:QRe},VRe=class{constructor(e,t,r){this.context=e;let i=e.gl;this.buffer=i.createBuffer(),this.dynamicDraw=!!r,this.context.unbindVAO(),e.bindElementBuffer.set(this.buffer),i.bufferData(i.ELEMENT_ARRAY_BUFFER,t.arrayBuffer,this.dynamicDraw?i.DYNAMIC_DRAW:i.STATIC_DRAW),this.dynamicDraw||delete t.arrayBuffer}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(e){let t=this.context.gl;if(!this.dynamicDraw)throw new Error("Attempted to update data while not in dynamic mode.");this.context.unbindVAO(),this.bind(),t.bufferSubData(t.ELEMENT_ARRAY_BUFFER,0,e.arrayBuffer)}destroy(){let e=this.context.gl;this.buffer&&(e.deleteBuffer(this.buffer),delete this.buffer)}},YRe={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"},HRe=class{constructor(e,t,r,i){this.length=t.length,this.attributes=r,this.itemSize=t.bytesPerElement,this.dynamicDraw=i,this.context=e;let n=e.gl;this.buffer=n.createBuffer(),e.bindVertexBuffer.set(this.buffer),n.bufferData(n.ARRAY_BUFFER,t.arrayBuffer,this.dynamicDraw?n.DYNAMIC_DRAW:n.STATIC_DRAW),this.dynamicDraw||delete t.arrayBuffer}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(e){if(e.length!==this.length)throw new Error("Length of new data is ".concat(e.length,", which doesn't match current length of ").concat(this.length));let t=this.context.gl;this.bind(),t.bufferSubData(t.ARRAY_BUFFER,0,e.arrayBuffer)}enableAttributes(e,t){for(let r=0;r<this.attributes.length;r++){let i=this.attributes[r],n=t.attributes[i.name];n!==void 0&&e.enableVertexAttribArray(n)}}setVertexAttribPointers(e,t,r){for(let i=0;i<this.attributes.length;i++){let n=this.attributes[i],a=t.attributes[n.name];a!==void 0&&e.vertexAttribPointer(a,n.components,e[YRe[n.type]],!1,this.itemSize,n.offset+this.itemSize*(r||0))}}destroy(){let e=this.context.gl;this.buffer&&(e.deleteBuffer(this.buffer),delete this.buffer)}},Ti=class{constructor(e){this.gl=e.gl,this.default=this.getDefault(),this.current=this.default,this.dirty=!1}get(){return this.current}set(e){}getDefault(){return this.default}setDefault(){this.set(this.default)}},WRe=class extends Ti{getDefault(){return mr.transparent}set(e){let t=this.current;e.r===t.r&&e.g===t.g&&e.b===t.b&&e.a===t.a&&!this.dirty||(this.gl.clearColor(e.r,e.g,e.b,e.a),this.current=e,this.dirty=!1)}},ZRe=class extends Ti{getDefault(){return 1}set(e){e===this.current&&!this.dirty||(this.gl.clearDepth(e),this.current=e,this.dirty=!1)}},XRe=class extends Ti{getDefault(){return 0}set(e){e===this.current&&!this.dirty||(this.gl.clearStencil(e),this.current=e,this.dirty=!1)}},JRe=class extends Ti{getDefault(){return[!0,!0,!0,!0]}set(e){let t=this.current;e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]&&!this.dirty||(this.gl.colorMask(e[0],e[1],e[2],e[3]),this.current=e,this.dirty=!1)}},KRe=class extends Ti{getDefault(){return!0}set(e){e===this.current&&!this.dirty||(this.gl.depthMask(e),this.current=e,this.dirty=!1)}},qRe=class extends Ti{getDefault(){return 255}set(e){e===this.current&&!this.dirty||(this.gl.stencilMask(e),this.current=e,this.dirty=!1)}},$Re=class extends Ti{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(e){let t=this.current;e.func===t.func&&e.ref===t.ref&&e.mask===t.mask&&!this.dirty||(this.gl.stencilFunc(e.func,e.ref,e.mask),this.current=e,this.dirty=!1)}},eFe=class extends Ti{getDefault(){let e=this.gl;return[e.KEEP,e.KEEP,e.KEEP]}set(e){let t=this.current;e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&!this.dirty||(this.gl.stencilOp(e[0],e[1],e[2]),this.current=e,this.dirty=!1)}},tFe=class extends Ti{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;e?t.enable(t.STENCIL_TEST):t.disable(t.STENCIL_TEST),this.current=e,this.dirty=!1}},rFe=class extends Ti{getDefault(){return[0,1]}set(e){let t=this.current;e[0]===t[0]&&e[1]===t[1]&&!this.dirty||(this.gl.depthRange(e[0],e[1]),this.current=e,this.dirty=!1)}},iFe=class extends Ti{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;e?t.enable(t.DEPTH_TEST):t.disable(t.DEPTH_TEST),this.current=e,this.dirty=!1}},nFe=class extends Ti{getDefault(){return this.gl.LESS}set(e){e===this.current&&!this.dirty||(this.gl.depthFunc(e),this.current=e,this.dirty=!1)}},aFe=class extends Ti{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;e?t.enable(t.BLEND):t.disable(t.BLEND),this.current=e,this.dirty=!1}},oFe=class extends Ti{getDefault(){let e=this.gl;return[e.ONE,e.ZERO]}set(e){let t=this.current;e[0]===t[0]&&e[1]===t[1]&&!this.dirty||(this.gl.blendFunc(e[0],e[1]),this.current=e,this.dirty=!1)}},sFe=class extends Ti{getDefault(){return mr.transparent}set(e){let t=this.current;e.r===t.r&&e.g===t.g&&e.b===t.b&&e.a===t.a&&!this.dirty||(this.gl.blendColor(e.r,e.g,e.b,e.a),this.current=e,this.dirty=!1)}},lFe=class extends Ti{getDefault(){return this.gl.FUNC_ADD}set(e){e===this.current&&!this.dirty||(this.gl.blendEquation(e),this.current=e,this.dirty=!1)}},uFe=class extends Ti{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;e?t.enable(t.CULL_FACE):t.disable(t.CULL_FACE),this.current=e,this.dirty=!1}},cFe=class extends Ti{getDefault(){return this.gl.BACK}set(e){e===this.current&&!this.dirty||(this.gl.cullFace(e),this.current=e,this.dirty=!1)}},hFe=class extends Ti{getDefault(){return this.gl.CCW}set(e){e===this.current&&!this.dirty||(this.gl.frontFace(e),this.current=e,this.dirty=!1)}},dFe=class extends Ti{getDefault(){return null}set(e){e===this.current&&!this.dirty||(this.gl.useProgram(e),this.current=e,this.dirty=!1)}},pFe=class extends Ti{getDefault(){return this.gl.TEXTURE0}set(e){e===this.current&&!this.dirty||(this.gl.activeTexture(e),this.current=e,this.dirty=!1)}},fFe=class extends Ti{getDefault(){let e=this.gl;return[0,0,e.drawingBufferWidth,e.drawingBufferHeight]}set(e){let t=this.current;e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]&&!this.dirty||(this.gl.viewport(e[0],e[1],e[2],e[3]),this.current=e,this.dirty=!1)}},AFe=class extends Ti{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;t.bindFramebuffer(t.FRAMEBUFFER,e),this.current=e,this.dirty=!1}},mFe=class extends Ti{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;t.bindRenderbuffer(t.RENDERBUFFER,e),this.current=e,this.dirty=!1}},gFe=class extends Ti{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;t.bindTexture(t.TEXTURE_2D,e),this.current=e,this.dirty=!1}},yFe=class extends Ti{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;t.bindBuffer(t.ARRAY_BUFFER,e),this.current=e,this.dirty=!1}},vFe=class extends Ti{getDefault(){return null}set(e){let t=this.gl;t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,e),this.current=e,this.dirty=!1}},xFe=class extends Ti{getDefault(){return null}set(e){var t;if(e===this.current&&!this.dirty)return;let r=this.gl;mh(r)?r.bindVertexArray(e):(t=r.getExtension("OES_vertex_array_object"))==null||t.bindVertexArrayOES(e),this.current=e,this.dirty=!1}},_Fe=class extends Ti{getDefault(){return 4}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;t.pixelStorei(t.UNPACK_ALIGNMENT,e),this.current=e,this.dirty=!1}},bFe=class extends Ti{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e),this.current=e,this.dirty=!1}},wFe=class extends Ti{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,e),this.current=e,this.dirty=!1}},GU=class extends Ti{constructor(e,t){super(e),this.context=e,this.parent=t}getDefault(){return null}},EFe=class extends GU{setDirty(){this.dirty=!0}set(e){if(e===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);let t=this.gl;t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,e,0),this.current=e,this.dirty=!1}},MFe=class extends GU{set(e){if(e===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);let t=this.gl;t.framebufferRenderbuffer(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.RENDERBUFFER,e),this.current=e,this.dirty=!1}},SFe=class extends GU{set(e){if(e===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);let t=this.gl;t.framebufferRenderbuffer(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.RENDERBUFFER,e),this.current=e,this.dirty=!1}},bte="Framebuffer is not complete";BFe=class{constructor(e,t,r,i,n){this.context=e,this.width=t,this.height=r;let a=e.gl,o=this.framebuffer=a.createFramebuffer();if(this.colorAttachment=new EFe(e,o),i)this.depthAttachment=n?new SFe(e,o):new MFe(e,o);else if(n)throw new Error("Stencil cannot be set without depth");if(a.checkFramebufferStatus(a.FRAMEBUFFER)!==a.FRAMEBUFFER_COMPLETE)throw CFe()}destroy(){let e=this.context.gl,t=this.colorAttachment.get();if(t&&e.deleteTexture(t),this.depthAttachment){let r=this.depthAttachment.get();r&&e.deleteRenderbuffer(r)}e.deleteFramebuffer(this.framebuffer)}},TFe=class{constructor(e){var t,r;if(this.gl=e,this.clearColor=new WRe(this),this.clearDepth=new ZRe(this),this.clearStencil=new XRe(this),this.colorMask=new JRe(this),this.depthMask=new KRe(this),this.stencilMask=new qRe(this),this.stencilFunc=new $Re(this),this.stencilOp=new eFe(this),this.stencilTest=new tFe(this),this.depthRange=new rFe(this),this.depthTest=new iFe(this),this.depthFunc=new nFe(this),this.blend=new aFe(this),this.blendFunc=new oFe(this),this.blendColor=new sFe(this),this.blendEquation=new lFe(this),this.cullFace=new uFe(this),this.cullFaceSide=new cFe(this),this.frontFace=new hFe(this),this.program=new dFe(this),this.activeTexture=new pFe(this),this.viewport=new fFe(this),this.bindFramebuffer=new AFe(this),this.bindRenderbuffer=new mFe(this),this.bindTexture=new gFe(this),this.bindVertexBuffer=new yFe(this),this.bindElementBuffer=new vFe(this),this.bindVertexArray=new xFe(this),this.pixelStoreUnpack=new _Fe(this),this.pixelStoreUnpackPremultiplyAlpha=new bFe(this),this.pixelStoreUnpackFlipY=new wFe(this),this.extTextureFilterAnisotropic=e.getExtension("EXT_texture_filter_anisotropic")||e.getExtension("MOZ_EXT_texture_filter_anisotropic")||e.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=e.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT)),this.maxTextureSize=e.getParameter(e.MAX_TEXTURE_SIZE),mh(e)){this.HALF_FLOAT=e.HALF_FLOAT;let i=e.getExtension("EXT_color_buffer_half_float");this.RGBA16F=(t=e.RGBA16F)!=null?t:i==null?void 0:i.RGBA16F_EXT,this.RGB16F=(r=e.RGB16F)!=null?r:i==null?void 0:i.RGB16F_EXT,e.getExtension("EXT_color_buffer_float")}else{e.getExtension("EXT_color_buffer_half_float"),e.getExtension("OES_texture_half_float_linear");let i=e.getExtension("OES_texture_half_float");this.HALF_FLOAT=i==null?void 0:i.HALF_FLOAT_OES}}setDefault(){this.unbindVAO(),this.clearColor.setDefault(),this.clearDepth.setDefault(),this.clearStencil.setDefault(),this.colorMask.setDefault(),this.depthMask.setDefault(),this.stencilMask.setDefault(),this.stencilFunc.setDefault(),this.stencilOp.setDefault(),this.stencilTest.setDefault(),this.depthRange.setDefault(),this.depthTest.setDefault(),this.depthFunc.setDefault(),this.blend.setDefault(),this.blendFunc.setDefault(),this.blendColor.setDefault(),this.blendEquation.setDefault(),this.cullFace.setDefault(),this.cullFaceSide.setDefault(),this.frontFace.setDefault(),this.program.setDefault(),this.activeTexture.setDefault(),this.bindFramebuffer.setDefault(),this.pixelStoreUnpack.setDefault(),this.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.pixelStoreUnpackFlipY.setDefault()}setDirty(){this.clearColor.dirty=!0,this.clearDepth.dirty=!0,this.clearStencil.dirty=!0,this.colorMask.dirty=!0,this.depthMask.dirty=!0,this.stencilMask.dirty=!0,this.stencilFunc.dirty=!0,this.stencilOp.dirty=!0,this.stencilTest.dirty=!0,this.depthRange.dirty=!0,this.depthTest.dirty=!0,this.depthFunc.dirty=!0,this.blend.dirty=!0,this.blendFunc.dirty=!0,this.blendColor.dirty=!0,this.blendEquation.dirty=!0,this.cullFace.dirty=!0,this.cullFaceSide.dirty=!0,this.frontFace.dirty=!0,this.program.dirty=!0,this.activeTexture.dirty=!0,this.viewport.dirty=!0,this.bindFramebuffer.dirty=!0,this.bindRenderbuffer.dirty=!0,this.bindTexture.dirty=!0,this.bindVertexBuffer.dirty=!0,this.bindElementBuffer.dirty=!0,this.bindVertexArray.dirty=!0,this.pixelStoreUnpack.dirty=!0,this.pixelStoreUnpackPremultiplyAlpha.dirty=!0,this.pixelStoreUnpackFlipY.dirty=!0}createIndexBuffer(e,t){return new VRe(this,e,t)}createVertexBuffer(e,t,r){return new HRe(this,e,t,r)}createRenderbuffer(e,t,r){let i=this.gl,n=i.createRenderbuffer();return this.bindRenderbuffer.set(n),i.renderbufferStorage(i.RENDERBUFFER,e,t,r),this.bindRenderbuffer.set(null),n}createFramebuffer(e,t,r,i){return new BFe(this,e,t,r,i)}clear({color:e,depth:t,stencil:r}){let i=this.gl,n=0;e&&(n|=i.COLOR_BUFFER_BIT,this.clearColor.set(e),this.colorMask.set([!0,!0,!0,!0])),typeof t<"u"&&(n|=i.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(t),this.depthMask.set(!0)),typeof r<"u"&&(n|=i.STENCIL_BUFFER_BIT,this.clearStencil.set(r),this.stencilMask.set(255)),i.clear(n)}setCullFace(e){e.enable===!1?this.cullFace.set(!1):(this.cullFace.set(!0),this.cullFaceSide.set(e.mode),this.frontFace.set(e.frontFace))}setDepthMode(e){e.func===this.gl.ALWAYS&&!e.mask?this.depthTest.set(!1):(this.depthTest.set(!0),this.depthFunc.set(e.func),this.depthMask.set(e.mask),this.depthRange.set(e.range))}setStencilMode(e){e.test.func===this.gl.ALWAYS&&!e.mask?this.stencilTest.set(!1):(this.stencilTest.set(!0),this.stencilMask.set(e.mask),this.stencilOp.set([e.fail,e.depthFail,e.pass]),this.stencilFunc.set({func:e.test.func,ref:e.ref,mask:e.test.mask}))}setColorMode(e){Yu(e.blendFunction,Sn.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(e.blendFunction),this.blendColor.set(e.blendColor)),this.colorMask.set(e.mask)}createVertexArray(){var e;return mh(this.gl)?this.gl.createVertexArray():(e=this.gl.getExtension("OES_vertex_array_object"))==null?void 0:e.createVertexArrayOES()}deleteVertexArray(e){var t;return mh(this.gl)?this.gl.deleteVertexArray(e):(t=this.gl.getExtension("OES_vertex_array_object"))==null?void 0:t.deleteVertexArrayOES(e)}unbindVAO(){this.bindVertexArray.set(null)}},VU=Er(zr(),1);DFe=_t.identity(new Float32Array(16));ES=Er(zr(),1),Q5=[new ES.default(0,0),new ES.default(8192,0),new ES.default(8192,8192),new ES.default(0,8192)];tze=new mr(1,0,0,1),rze=new mr(0,1,0,1),ize=new mr(0,0,1,1),nze=new mr(1,0,1,1),aze=new mr(0,1,1,1);yze=class{constructor(e,t){this.context=new TFe(e),this.transform=t,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:_t.identity(new Float64Array(16)),renderTime:0},this.setup(),this.numSublayers=Zx.maxUnderzooming+Zx.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new Wee}resize(e,t,r){if(this.width=Math.floor(e*r),this.height=Math.floor(t*r),this.pixelRatio=r,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(let i of this.style._order)this.style._layers[i].resize()}setup(){let e=this.context,t=new ph;t.emplaceBack(0,0),t.emplaceBack(8192,0),t.emplaceBack(0,8192),t.emplaceBack(8192,8192),this.tileExtentBuffer=e.createVertexBuffer(t,Wd.members),this.tileExtentSegments=gn.simpleSegment(0,0,4,2);let r=new ph;r.emplaceBack(0,0),r.emplaceBack(8192,0),r.emplaceBack(0,8192),r.emplaceBack(8192,8192),this.debugBuffer=e.createVertexBuffer(r,Wd.members),this.debugSegments=gn.simpleSegment(0,0,4,5);let i=new EBe;i.emplaceBack(0,0,0,0),i.emplaceBack(8192,0,8192,0),i.emplaceBack(0,8192,0,8192),i.emplaceBack(8192,8192,8192,8192),this.rasterBoundsBuffer=e.createVertexBuffer(i,R4e.members),this.rasterBoundsSegments=gn.simpleSegment(0,0,4,2);let n=new ph;n.emplaceBack(0,0),n.emplaceBack(8192,0),n.emplaceBack(0,8192),n.emplaceBack(8192,8192),this.rasterBoundsBufferPosOnly=e.createVertexBuffer(n,Wd.members),this.rasterBoundsSegmentsPosOnly=gn.simpleSegment(0,0,4,5);let a=new ph;a.emplaceBack(0,0),a.emplaceBack(1,0),a.emplaceBack(0,1),a.emplaceBack(1,1),this.viewportBuffer=e.createVertexBuffer(a,Wd.members),this.viewportSegments=gn.simpleSegment(0,0,4,2);let o=new zBe;o.emplaceBack(0),o.emplaceBack(1),o.emplaceBack(3),o.emplaceBack(2),o.emplaceBack(0),this.tileBorderIndexBuffer=e.createIndexBuffer(o);let s=new au;s.emplaceBack(1,0,2),s.emplaceBack(1,2,3),this.quadTriangleIndexBuffer=e.createIndexBuffer(s);let l=this.context.gl;this.stencilClearMode=new Mi({func:l.ALWAYS,mask:0},0,255,l.ZERO,l.ZERO,l.ZERO),this.tileExtentMesh=new gy(this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}clearStencil(){let e=this.context,t=e.gl;this.nextStencilID=1,this.currentStencilSource=void 0;let r=_t.create();_t.ortho(r,0,this.width,this.height,0,0,1),_t.scale(r,r,[t.drawingBufferWidth,t.drawingBufferHeight,0]);let i={mainMatrix:r,tileMercatorCoords:[0,0,1,1],clippingPlane:[0,0,0,0],projectionTransition:0,fallbackMatrix:r};this.useProgram("clippingMask",null,!0).draw(e,t.TRIANGLES,Ur.disabled,this.stencilClearMode,Sn.disabled,xi.disabled,null,null,i,"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(e,t,r){if(this.currentStencilSource===e.source||!e.isTileClipped()||!t||!t.length)return;this.currentStencilSource=e.source,this.nextStencilID+t.length>256&&this.clearStencil();let i=this.context;i.setColorMode(Sn.disabled),i.setDepthMode(Ur.disabled);let n={};for(let a of t)n[a.key]=this.nextStencilID++;this._renderTileMasks(n,t,r,!0),this._renderTileMasks(n,t,r,!1),this._tileClippingMaskIDs=n}_renderTileMasks(e,t,r,i){let n=this.context,a=n.gl,o=this.style.projection,s=this.transform,l=this.useProgram("clippingMask");for(let u of t){let c=e[u.key],h=this.style.map.terrain&&this.style.map.terrain.getTerrainData(u),d=o.getMeshFromTileID(this.context,u.canonical,i,!0,"stencil"),p=s.getProjectionData({overscaledTileID:u,applyGlobeMatrix:!r,applyTerrainMatrix:!0});l.draw(n,a.TRIANGLES,Ur.disabled,new Mi({func:a.ALWAYS,mask:0},c,255,a.KEEP,a.KEEP,a.REPLACE),Sn.disabled,r?xi.disabled:xi.backCCW,null,h,p,"$clipping",d.vertexBuffer,d.indexBuffer,d.segments)}}_renderTilesDepthBuffer(){let e=this.context,t=e.gl,r=this.style.projection,i=this.transform,n=this.useProgram("depth"),a=this.getDepthModeFor3D(),o=uC(i,{tileSize:i.tileSize});for(let s of o){let l=this.style.map.terrain&&this.style.map.terrain.getTerrainData(s),u=r.getMeshFromTileID(this.context,s.canonical,!0,!0,"raster"),c=i.getProjectionData({overscaledTileID:s,applyGlobeMatrix:!0,applyTerrainMatrix:!0});n.draw(e,t.TRIANGLES,a,Mi.disabled,Sn.disabled,xi.backCCW,null,l,c,"$clipping",u.vertexBuffer,u.indexBuffer,u.segments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();let e=this.nextStencilID++,t=this.context.gl;return new Mi({func:t.NOTEQUAL,mask:255},e,255,t.KEEP,t.KEEP,t.REPLACE)}stencilModeForClipping(e){let t=this.context.gl;return new Mi({func:t.EQUAL,mask:255},this._tileClippingMaskIDs[e.key],0,t.KEEP,t.KEEP,t.REPLACE)}getStencilConfigForOverlapAndUpdateStencilID(e){let t=this.context.gl,r=e.sort((a,o)=>o.overscaledZ-a.overscaledZ),i=r[r.length-1].overscaledZ,n=r[0].overscaledZ-i+1;if(n>1){this.currentStencilSource=void 0,this.nextStencilID+n>256&&this.clearStencil();let a={};for(let o=0;o<n;o++)a[o+i]=new Mi({func:t.GEQUAL,mask:255},o+this.nextStencilID,255,t.KEEP,t.KEEP,t.REPLACE);return this.nextStencilID+=n,[a,r]}return[{[i]:Mi.disabled},r]}stencilConfigForOverlapTwoPass(e){let t=this.context.gl,r=e.sort((a,o)=>o.overscaledZ-a.overscaledZ),i=r[r.length-1].overscaledZ,n=r[0].overscaledZ-i+1;if(this.clearStencil(),n>1){let a={},o={};for(let s=0;s<n;s++)a[s+i]=new Mi({func:t.GREATER,mask:255},n+1+s,255,t.KEEP,t.KEEP,t.REPLACE),o[s+i]=new Mi({func:t.GREATER,mask:255},1+s,255,t.KEEP,t.KEEP,t.REPLACE);return this.nextStencilID=n*2+1,[a,o,r]}else return this.nextStencilID=3,[{[i]:new Mi({func:t.GREATER,mask:255},2,255,t.KEEP,t.KEEP,t.REPLACE)},{[i]:new Mi({func:t.GREATER,mask:255},1,255,t.KEEP,t.KEEP,t.REPLACE)},r]}colorModeForRenderPass(){let e=this.context.gl;return this._showOverdrawInspector?new Sn([e.CONSTANT_COLOR,e.ONE],new mr(.125,.125,.125,0),[!0,!0,!0,!0]):this.renderPass==="opaque"?Sn.unblended:Sn.alphaBlended}getDepthModeForSublayer(e,t,r){if(!this.opaquePassEnabledForLayer())return Ur.disabled;let i=1-((1+this.currentLayer)*this.numSublayers+e)*this.depthEpsilon;return new Ur(r||this.context.gl.LEQUAL,t,[i,i])}getDepthModeFor3D(){return new Ur(this.context.gl.LEQUAL,Ur.ReadWrite,this.depthRangeFor3D)}opaquePassEnabledForLayer(){return this.currentLayer<this.opaquePassCutoff}render(e,t){var r,i;this.style=e,this.options=t,this.lineAtlas=e.lineAtlas,this.imageManager=e.imageManager,this.glyphManager=e.glyphManager,this.symbolFadeChange=e.placement.symbolFadeChange(ri.now()),this.imageManager.beginFrame();let n=this.style._order,a=this.style.sourceCaches,o={},s={},l={},u={isRenderingToTexture:!1,isRenderingGlobe:((r=e.projection)==null?void 0:r.transitionState)>0};for(let h in a){let d=a[h];d.used&&d.prepare(this.context),o[h]=d.getVisibleCoordinates(!1),s[h]=o[h].slice().reverse(),l[h]=d.getVisibleCoordinates(!0).reverse()}this.opaquePassCutoff=1/0;for(let h=0;h<n.length;h++){let d=n[h];if(this.style._layers[d].is3D()){this.opaquePassCutoff=h;break}}this.maybeDrawDepthAndCoords(!1),this.renderToTexture&&(this.renderToTexture.prepareForRender(this.style,this.transform.zoom),this.opaquePassCutoff=0),this.renderPass="offscreen";for(let h of n){let d=this.style._layers[h];if(!d.hasOffscreenPass()||d.isHidden(this.transform.zoom))continue;let p=s[d.source];d.type!=="custom"&&!p.length||this.renderLayer(this,a[d.source],d,p,u)}if((i=this.style.projection)==null||i.updateGPUdependent({context:this.context,useProgram:h=>this.useProgram(h)}),this.context.viewport.set([0,0,this.width,this.height]),this.context.bindFramebuffer.set(null),this.context.clear({color:t.showOverdrawInspector?mr.black:mr.transparent,depth:1}),this.clearStencil(),this.style.sky&&Aze(this,this.style.sky),this._showOverdrawInspector=t.showOverdrawInspector,this.depthRangeFor3D=[0,1-(e._order.length+2)*this.numSublayers*this.depthEpsilon],!this.renderToTexture)for(this.renderPass="opaque",this.currentLayer=n.length-1;this.currentLayer>=0;this.currentLayer--){let h=this.style._layers[n[this.currentLayer]],d=a[h.source],p=o[h.source];this._renderTileClippingMasks(h,p,!1),this.renderLayer(this,d,h,p,u)}this.renderPass="translucent";let c=!1;for(this.currentLayer=0;this.currentLayer<n.length;this.currentLayer++){let h=this.style._layers[n[this.currentLayer]],d=a[h.source];if(this.renderToTexture&&this.renderToTexture.renderLayer(h,u))continue;!this.opaquePassEnabledForLayer()&&!c&&(c=!0,u.isRenderingGlobe&&!this.style.map.terrain&&this._renderTilesDepthBuffer());let p=(h.type==="symbol"?l:s)[h.source];this._renderTileClippingMasks(h,o[h.source],!!this.renderToTexture),this.renderLayer(this,d,h,p,u)}if(u.isRenderingGlobe&&gze(this,this.style.sky,this.style.light),this.options.showTileBoundaries){let h=hze(this.style,this.transform.zoom);h&&lze(this,h,h.getVisibleCoordinates())}this.options.showPadding&&oze(this),this.context.setDefault()}maybeDrawDepthAndCoords(e){if(!this.style||!this.style.map||!this.style.map.terrain)return;let t=this.terrainFacilitator.matrix,r=this.transform.modelViewProjectionMatrix,i=this.terrainFacilitator.dirty;i||(i=e?!_t.exactEquals(t,r):!_t.equals(t,r)),i||(i=this.style.map.terrain.sourceCache.anyTilesAfterTime(this.terrainFacilitator.renderTime)),i&&(_t.copy(t,r),this.terrainFacilitator.renderTime=Date.now(),this.terrainFacilitator.dirty=!1,pze(this,this.style.map.terrain),fze(this,this.style.map.terrain))}renderLayer(e,t,r,i,n){r.isHidden(this.transform.zoom)||r.type!=="background"&&r.type!=="custom"&&!(i||[]).length||(this.id=r.id,XPe(r)?kFe(e,t,r,i,this.style.placement.variableOffsets,n):iTe(r)?NFe(e,t,r,i,n):lTe(r)?UFe(e,t,r,i,n):EPe(r)?HFe(e,t,r,i,n):ZTe(r)?WFe(e,t,r,i,n):oPe(r)?ZFe(e,t,r,i,n):dTe(r)?XFe(e,t,r,i,n):gTe(r)?KFe(e,t,r,i,n):iDe(r)?qFe(e,t,r,i,n):$Pe(r)?eze(e,t,r,i,n):oDe(r)&&dze(e,t,r,n))}saveTileTexture(e){let t=this._tileTextures[e.size[0]];t?t.push(e):this._tileTextures[e.size[0]]=[e]}getTileTexture(e){let t=this._tileTextures[e];return t&&t.length>0?t.pop():null}isPatternMissing(e){if(!e)return!1;if(!e.from||!e.to)return!0;let t=this.imageManager.getPattern(e.from.toString()),r=this.imageManager.getPattern(e.to.toString());return!t||!r}useProgram(e,t,r=!1,i=[]){this.cache=this.cache||{};let n=!!this.style.map.terrain,a=this.style.projection,o=r?qu.projectionMercator:a.shaderPreludeCode,s=r?Zee:a.shaderDefine,l="/".concat(r?Xee:a.shaderVariantName),u=t?t.cacheKey:"",c=this._showOverdrawInspector?"/overdraw":"",h=n?"/terrain":"",d=i?"/".concat(i.join("/")):"",p=e+u+l+c+h+d;return this.cache[p]||(this.cache[p]=new Y4e(this.context,qu[e],t,GRe[e],this._showOverdrawInspector,n,o,s,i)),this.cache[p]}setCustomLayerDefaults(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault()}setBaseState(){let e=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(e.FUNC_ADD)}initDebugOverlayCanvas(){if(this.debugOverlayCanvas==null){this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512;let e=this.context.gl;this.debugOverlayTexture=new $n(this.context,this.debugOverlayCanvas,e.RGBA)}}destroy(){this.debugOverlayTexture&&this.debugOverlayTexture.destroy()}overLimit(){let{drawingBufferWidth:e,drawingBufferHeight:t}=this.context.gl;return this.width!==e||this.height!==t}};vze=class{constructor(e){this._getCurrentHash=()=>{let t=window.location.hash.replace("#","");if(this._hashName){let r;return t.split("&").map(i=>i.split("=")).forEach(i=>{i[0]===this._hashName&&(r=i)}),(r&&r[1]||"").split("/")}return t.split("/")},this._onHashChange=()=>{let t=this._getCurrentHash();if(!this._isValidHash(t))return!1;let r=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(t[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+t[2],+t[1]],zoom:+t[0],bearing:r,pitch:+(t[4]||0)}),!0},this._updateHashUnthrottled=()=>{let t=window.location.href.replace(/(#.*)?$/,this.getHashString());window.history.replaceState(window.history.state,null,t)},this._removeHash=()=>{let t=this._getCurrentHash();if(t.length===0)return;let r=t.join("/"),i=r;i.split("&").length>0&&(i=i.split("&")[0]),this._hashName&&(i="".concat(this._hashName,"=").concat(r));let n=window.location.hash.replace(i,"");n.startsWith("#&")?n=n.slice(0,1)+n.slice(2):n==="#"&&(n="");let a=window.location.href.replace(/(#.+)?$/,n);a=a.replace("&&","&"),window.history.replaceState(window.history.state,null,a)},this._updateHash=Ite(this._updateHashUnthrottled,30*1e3/100),this._hashName=e&&encodeURIComponent(e)}addTo(e){return this._map=e,addEventListener("hashchange",this._onHashChange,!1),this._map.on("moveend",this._updateHash),this}remove(){return removeEventListener("hashchange",this._onHashChange,!1),this._map.off("moveend",this._updateHash),clearTimeout(this._updateHash()),this._removeHash(),delete this._map,this}getHashString(e){let t=this._map.getCenter(),r=Math.round(this._map.getZoom()*100)/100,i=Math.ceil((r*Math.LN2+Math.log(512/360/.5))/Math.LN10),n=Math.pow(10,i),a=Math.round(t.lng*n)/n,o=Math.round(t.lat*n)/n,s=this._map.getBearing(),l=this._map.getPitch(),u="";if(e?u+="/".concat(a,"/").concat(o,"/").concat(r):u+="".concat(r,"/").concat(o,"/").concat(a),(s||l)&&(u+="/".concat(Math.round(s*10)/10)),l&&(u+="/".concat(Math.round(l))),this._hashName){let c=this._hashName,h=!1,d=window.location.hash.slice(1).split("&").map(p=>{let f=p.split("=")[0];return f===c?(h=!0,"".concat(f,"=").concat(u)):p}).filter(p=>p);return h||d.push("".concat(c,"=").concat(u)),"#".concat(d.join("&"))}return"#".concat(u)}_isValidHash(e){if(e.length<3||e.some(isNaN))return!1;try{new wr(+e[2],+e[1])}catch(n){return!1}let t=+e[0],r=+(e[3]||0),i=+(e[4]||0);return t>=this._map.getMinZoom()&&t<=this._map.getMaxZoom()&&r>=-180&&r<=180&&i>=this._map.getMinPitch()&&i<=this._map.getMaxPitch()}},xze=Er(zr(),1),u_={linearity:.3,easing:FN(0,0,.3,1)},_ze=tr({deceleration:2500,maxSpeed:1400},u_),bze=tr({deceleration:20,maxSpeed:1400},u_),wze=tr({deceleration:1e3,maxSpeed:360},u_),Eze=tr({deceleration:1e3,maxSpeed:90},u_),Mze=tr({deceleration:1e3,maxSpeed:360},u_),Sze=class{constructor(e){this._map=e,this.clear()}clear(){this._inertiaBuffer=[]}record(e){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:ri.now(),settings:e})}_drainInertiaBuffer(){let e=this._inertiaBuffer,t=ri.now(),r=160;for(;e.length>0&&t-e[0].time>r;)e.shift()}_onMoveEnd(e){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;let t={zoom:0,bearing:0,pitch:0,roll:0,pan:new xze.default(0,0),pinchAround:void 0,around:void 0};for(let{settings:n}of this._inertiaBuffer)t.zoom+=n.zoomDelta||0,t.bearing+=n.bearingDelta||0,t.pitch+=n.pitchDelta||0,t.roll+=n.rollDelta||0,n.panDelta&&t.pan._add(n.panDelta),n.around&&(t.around=n.around),n.pinchAround&&(t.pinchAround=n.pinchAround);let r=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,i={};if(t.pan.mag()){let n=tx(t.pan.mag(),r,tr({},_ze,e||{})),a=t.pan.mult(n.amount/t.pan.mag()),o=this._map.cameraHelper.handlePanInertia(a,this._map.transform);i.center=o.easingCenter,i.offset=o.easingOffset,ex(i,n)}if(t.zoom){let n=tx(t.zoom,r,bze);i.zoom=this._map.transform.zoom+n.amount,ex(i,n)}if(t.bearing){let n=tx(t.bearing,r,wze);i.bearing=this._map.transform.bearing+Ii(n.amount,-179,179),ex(i,n)}if(t.pitch){let n=tx(t.pitch,r,Eze);i.pitch=this._map.transform.pitch+n.amount,ex(i,n)}if(t.roll){let n=tx(t.roll,r,Mze);i.roll=this._map.transform.roll+Ii(n.amount,-179,179),ex(i,n)}if(i.zoom||i.bearing){let n=t.pinchAround===void 0?t.around:t.pinchAround;i.around=n?this._map.unproject(n):this._map.getCenter()}return this.clear(),tr(i,{noMoveStart:!0})}};Ize=Er(zr(),1),hl=class extends kt{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,t,r,i={}){r=r instanceof MouseEvent?r:new MouseEvent(e,r);let n=ui.mousePos(t.getCanvas(),r),a=t.unproject(n);super(e,tr({point:n,lngLat:a,originalEvent:r},i)),this._defaultPrevented=!1,this.target=t}},SS=class extends kt{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,t,r){let i=e==="touchend"?r.changedTouches:r.touches,n=ui.touchPos(t.getCanvasContainer(),i),a=n.map(l=>t.unproject(l)),o=n.reduce((l,u,c,h)=>l.add(u.div(h.length)),new Ize.default(0,0)),s=t.unproject(o);super(e,{points:n,point:o,lngLats:a,lngLat:s,originalEvent:r}),this._defaultPrevented=!1}},Cze=class extends kt{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,t,r){super(e,{originalEvent:r}),this._defaultPrevented=!1}},Bze=class{constructor(e,t){this._map=e,this._clickTolerance=t.clickTolerance}reset(){delete this._mousedownPos}wheel(e){return this._firePreventable(new Cze(e.type,this._map,e))}mousedown(e,t){return this._mousedownPos=t,this._firePreventable(new hl(e.type,this._map,e))}mouseup(e){this._map.fire(new hl(e.type,this._map,e))}click(e,t){this._mousedownPos&&this._mousedownPos.dist(t)>=this._clickTolerance||this._map.fire(new hl(e.type,this._map,e))}dblclick(e){return this._firePreventable(new hl(e.type,this._map,e))}mouseover(e){this._map.fire(new hl(e.type,this._map,e))}mouseout(e){this._map.fire(new hl(e.type,this._map,e))}touchstart(e){return this._firePreventable(new SS(e.type,this._map,e))}touchmove(e){this._map.fire(new SS(e.type,this._map,e))}touchend(e){this._map.fire(new SS(e.type,this._map,e))}touchcancel(e){this._map.fire(new SS(e.type,this._map,e))}_firePreventable(e){if(this._map.fire(e),e.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}},Tze=class{constructor(e){this._map=e}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(e){this._map.fire(new hl(e.type,this._map,e))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new hl("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(e){this._delayContextMenu?this._contextMenuEvent=e:this._ignoreContextMenu||this._map.fire(new hl(e.type,this._map,e)),this._map.listens("contextmenu")&&e.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}},Pze=Er(zr(),1),c_=class{constructor(e){this._map=e}get transform(){return this._map._requestedCameraState||this._map.transform}get center(){return{lng:this.transform.center.lng,lat:this.transform.center.lat}}get zoom(){return this.transform.zoom}get pitch(){return this.transform.pitch}get bearing(){return this.transform.bearing}unproject(e){return this.transform.screenPointToLocation(Pze.default.convert(e),this._map.terrain)}},Dze=class{constructor(e,t){this._map=e,this._tr=new c_(e),this._el=e.getCanvasContainer(),this._container=e.getContainer(),this._clickTolerance=t.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(e,t){this.isEnabled()&&e.shiftKey&&e.button===0&&(ui.disableDrag(),this._startPos=this._lastPos=t,this._active=!0)}mousemoveWindow(e,t){if(!this._active)return;let r=t;if(this._lastPos.equals(r)||!this._box&&r.dist(this._startPos)<this._clickTolerance)return;let i=this._startPos;this._lastPos=r,this._box||(this._box=ui.create("div","maplibregl-boxzoom",this._container),this._container.classList.add("maplibregl-crosshair"),this._fireEvent("boxzoomstart",e));let n=Math.min(i.x,r.x),a=Math.max(i.x,r.x),o=Math.min(i.y,r.y),s=Math.max(i.y,r.y);ui.setTransform(this._box,"translate(".concat(n,"px,").concat(o,"px)")),this._box.style.width="".concat(a-n,"px"),this._box.style.height="".concat(s-o,"px")}mouseupWindow(e,t){if(!this._active||e.button!==0)return;let r=this._startPos,i=t;if(this.reset(),ui.suppressClick(),r.x===i.x&&r.y===i.y)this._fireEvent("boxzoomcancel",e);else return this._map.fire(new kt("boxzoomend",{originalEvent:e})),{cameraAnimation:n=>n.fitScreenCoordinates(r,i,this._tr.bearing,{linear:!0})}}keydown(e){this._active&&e.keyCode===27&&(this.reset(),this._fireEvent("boxzoomcancel",e))}reset(){this._active=!1,this._container.classList.remove("maplibregl-crosshair"),this._box&&(ui.remove(this._box),this._box=null),ui.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(e,t){return this._map.fire(new kt(e,{originalEvent:t}))}},kze=Er(zr(),1);Cte=500,Fze=500,YU=30,zze=class{constructor(e){this.reset(),this.numTouches=e.numTouches}reset(){delete this.centroid,delete this.startTime,delete this.touches,this.aborted=!1}touchstart(e,t,r){(this.centroid||r.length>this.numTouches)&&(this.aborted=!0),!this.aborted&&(this.startTime===void 0&&(this.startTime=e.timeStamp),r.length===this.numTouches&&(this.centroid=Rze(t),this.touches=JO(r,t)))}touchmove(e,t,r){if(this.aborted||!this.centroid)return;let i=JO(r,t);for(let n in this.touches){let a=this.touches[n],o=i[n];(!o||o.dist(a)>YU)&&(this.aborted=!0)}}touchend(e,t,r){if((!this.centroid||e.timeStamp-this.startTime>Fze)&&(this.aborted=!0),r.length===0){let i=!this.aborted&&this.centroid;if(this.reset(),i)return i}}},KO=class{constructor(e){this.singleTap=new zze(e),this.numTaps=e.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(e,t,r){this.singleTap.touchstart(e,t,r)}touchmove(e,t,r){this.singleTap.touchmove(e,t,r)}touchend(e,t,r){let i=this.singleTap.touchend(e,t,r);if(i){let n=e.timeStamp-this.lastTime<Cte,a=!this.lastTap||this.lastTap.dist(i)<YU;if((!n||!a)&&this.reset(),this.count++,this.lastTime=e.timeStamp,this.lastTap=i,this.count===this.numTaps)return this.reset(),i}}},Lze=class{constructor(e){this._tr=new c_(e),this._zoomIn=new KO({numTouches:1,numTaps:2}),this._zoomOut=new KO({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(e,t,r){this._zoomIn.touchstart(e,t,r),this._zoomOut.touchstart(e,t,r)}touchmove(e,t,r){this._zoomIn.touchmove(e,t,r),this._zoomOut.touchmove(e,t,r)}touchend(e,t,r){let i=this._zoomIn.touchend(e,t,r),n=this._zoomOut.touchend(e,t,r),a=this._tr;if(i)return this._active=!0,e.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:o=>o.easeTo({duration:300,zoom:a.zoom+1,around:a.unproject(i)},{originalEvent:e})};if(n)return this._active=!0,e.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:o=>o.easeTo({duration:300,zoom:a.zoom-1,around:a.unproject(n)},{originalEvent:e})}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}},Oze=Er(zr(),1),hC=class{constructor(e){this._enabled=!!e.enable,this._moveStateManager=e.moveStateManager,this._clickTolerance=e.clickTolerance||1,this._moveFunction=e.move,this._activateOnStart=!!e.activateOnStart,e.assignEvents(this),this.reset()}reset(e){this._active=!1,this._moved=!1,delete this._lastPoint,this._moveStateManager.endMove(e)}_move(...e){let t=this._moveFunction(...e);if(t.bearingDelta||t.pitchDelta||t.rollDelta||t.around||t.panDelta)return this._active=!0,t}dragStart(e,t){!this.isEnabled()||this._lastPoint||this._moveStateManager.isValidStartEvent(e)&&(this._moveStateManager.startMove(e),this._lastPoint=Array.isArray(t)?t[0]:t,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(e,t){if(!this.isEnabled())return;let r=this._lastPoint;if(!r)return;if(e.preventDefault(),!this._moveStateManager.isValidMoveEvent(e)){this.reset(e);return}let i=Array.isArray(t)?t[0]:t;if(!(!this._moved&&i.dist(r)<this._clickTolerance))return this._moved=!0,this._lastPoint=i,this._move(r,i)}dragEnd(e){!this.isEnabled()||!this._lastPoint||this._moveStateManager.isValidEndEvent(e)&&(this._moved&&ui.suppressClick(),this.reset(e))}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}getClickTolerance(){return this._clickTolerance}},Nze=0,Uze=2,Qze={[Nze]:1,[Uze]:2};dC=class{constructor(e){this._correctEvent=e.checkCorrectEvent}startMove(e){let t=ui.mouseButton(e);this._eventButton=t}endMove(e){delete this._eventButton}isValidStartEvent(e){return this._correctEvent(e)}isValidMoveEvent(e){return!jze(e,this._eventButton)}isValidEndEvent(e){return ui.mouseButton(e)===this._eventButton}},HU=0,WU=2,pC=e=>{e.mousedown=e.dragStart,e.mousemoveWindow=e.dragMove,e.mouseup=e.dragEnd,e.contextmenu=t=>{t.preventDefault()}};j5=Er(zr(),1),Wze=class{constructor(e,t){this._clickTolerance=e.clickTolerance||1,this._map=t,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new j5.default(0,0)}_shouldBePrevented(e){let t=this._map.cooperativeGestures.isEnabled()?2:1;return e<t}touchstart(e,t,r){return this._calculateTransform(e,t,r)}touchmove(e,t,r){if(this._active){if(this._shouldBePrevented(r.length)){this._map.cooperativeGestures.notifyGestureBlocked("touch_pan",e);return}return e.preventDefault(),this._calculateTransform(e,t,r)}}touchend(e,t,r){this._calculateTransform(e,t,r),this._active&&this._shouldBePrevented(r.length)&&this.reset()}touchcancel(){this.reset()}_calculateTransform(e,t,r){r.length>0&&(this._active=!0);let i=JO(r,t),n=new j5.default(0,0),a=new j5.default(0,0),o=0;for(let l in i){let u=i[l],c=this._touches[l];c&&(n._add(u),a._add(u.sub(c)),o++,i[l]=u)}if(this._touches=i,this._shouldBePrevented(o)||!a.mag())return;let s=a.div(o);return this._sum._add(s),this._sum.mag()<this._clickTolerance?void 0:{around:n.div(o),panDelta:s}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}},ZU=class{constructor(){this.reset()}reset(){this._active=!1,delete this._firstTwoTouches}touchstart(e,t,r){this._firstTwoTouches||r.length<2||(this._firstTwoTouches=[r[0].identifier,r[1].identifier],this._start([t[0],t[1]]))}touchmove(e,t,r){if(!this._firstTwoTouches)return;e.preventDefault();let[i,n]=this._firstTwoTouches,a=IS(r,t,i),o=IS(r,t,n);if(!a||!o)return;let s=this._aroundCenter?null:a.add(o).div(2);return this._move([a,o],s,e)}touchend(e,t,r){if(!this._firstTwoTouches)return;let[i,n]=this._firstTwoTouches,a=IS(r,t,i),o=IS(r,t,n);a&&o||(this._active&&ui.suppressClick(),this.reset())}touchcancel(){this.reset()}enable(e){this._enabled=!0,this._aroundCenter=!!e&&e.around==="center"}disable(){this._enabled=!1,this.reset()}isEnabled(){return!!this._enabled}isActive(){return!!this._active}};Zze=.1;Xze=class extends ZU{reset(){super.reset(),delete this._distance,delete this._startDistance}_start(e){this._startDistance=this._distance=e[0].dist(e[1])}_move(e,t){let r=this._distance;if(this._distance=e[0].dist(e[1]),!(!this._active&&Math.abs(xJ(this._distance,this._startDistance))<Zze))return this._active=!0,{zoomDelta:xJ(this._distance,r),pinchAround:t}}},Jze=25;Kze=class extends ZU{reset(){super.reset(),delete this._minDiameter,delete this._startVector,delete this._vector}_start(e){this._startVector=this._vector=e[0].sub(e[1]),this._minDiameter=e[0].dist(e[1])}_move(e,t,r){let i=this._vector;if(this._vector=e[0].sub(e[1]),!(!this._active&&this._isBelowThreshold(this._vector)))return this._active=!0,{bearingDelta:_J(this._vector,i),pinchAround:t}}_isBelowThreshold(e){this._minDiameter=Math.min(this._minDiameter,e.mag());let t=Math.PI*this._minDiameter,r=Jze/t*360,i=_J(e,this._startVector);return Math.abs(i)<r}};qze=100,$ze=class extends ZU{constructor(e){super(),this._currentTouchCount=0,this._map=e}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(e,t,r){super.touchstart(e,t,r),this._currentTouchCount=r.length}_start(e){this._lastPoints=e,G5(e[0].sub(e[1]))&&(this._valid=!1)}_move(e,t,r){if(this._map.cooperativeGestures.isEnabled()&&this._currentTouchCount<3)return;let i=e[0].sub(this._lastPoints[0]),n=e[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(i,n,r.timeStamp),this._valid?(this._lastPoints=e,this._active=!0,{pitchDelta:(i.y+n.y)/2*-.5}):void 0}gestureBeginsVertically(e,t,r){if(this._valid!==void 0)return this._valid;let i=2,n=e.mag()>=i,a=t.mag()>=i;if(!n&&!a)return;if(!n||!a)return this._firstMove===void 0&&(this._firstMove=r),r-this._firstMove<qze?void 0:!1;let o=e.y>0==t.y>0;return G5(e)&&G5(t)&&o}},eLe={panStep:100,bearingStep:15,pitchStep:10},tLe=class{constructor(e){this._tr=new c_(e);let t=eLe;this._panStep=t.panStep,this._bearingStep=t.bearingStep,this._pitchStep=t.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(e){if(e.altKey||e.ctrlKey||e.metaKey)return;let t=0,r=0,i=0,n=0,a=0;switch(e.keyCode){case 61:case 107:case 171:case 187:t=1;break;case 189:case 109:case 173:t=-1;break;case 37:e.shiftKey?r=-1:(e.preventDefault(),n=-1);break;case 39:e.shiftKey?r=1:(e.preventDefault(),n=1);break;case 38:e.shiftKey?i=1:(e.preventDefault(),a=-1);break;case 40:e.shiftKey?i=-1:(e.preventDefault(),a=1);break;default:return}return this._rotationDisabled&&(r=0,i=0),{cameraAnimation:o=>{let s=this._tr;o.easeTo({duration:300,easeId:"keyboardHandler",easing:rLe,zoom:t?Math.round(s.zoom)+t*(e.shiftKey?2:1):s.zoom,bearing:s.bearing+r*this._bearingStep,pitch:s.pitch+i*this._pitchStep,offset:[-n*this._panStep,-a*this._panStep],center:s.center},{originalEvent:e})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}disableRotation(){this._rotationDisabled=!0}enableRotation(){this._rotationDisabled=!1}};bJ=4.000244140625,iLe=1/100,nLe=1/450,aLe=2,oLe=5,sLe=class{constructor(e,t){this._onTimeout=r=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(r)},this._map=e,this._tr=new c_(e),this._triggerRenderFrame=t,this._delta=0,this._defaultZoomRate=iLe,this._wheelZoomRate=nLe}setZoomRate(e){this._defaultZoomRate=e}setWheelZoomRate(e){this._wheelZoomRate=e}isEnabled(){return!!this._enabled}isActive(){return!!this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(e){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!e&&e.around==="center")}disable(){this.isEnabled()&&(this._enabled=!1)}_shouldBePrevented(e){return this._map.cooperativeGestures.isEnabled()?!(e.ctrlKey||this._map.cooperativeGestures.isBypassed(e)):!1}wheel(e){if(!this.isEnabled())return;if(this._shouldBePrevented(e)){this._map.cooperativeGestures.notifyGestureBlocked("wheel_zoom",e);return}let t=e.deltaMode===WheelEvent.DOM_DELTA_LINE?e.deltaY*40:e.deltaY,r=ri.now(),i=r-(this._lastWheelEventTime||0);this._lastWheelEventTime=r,t!==0&&t%bJ===0?this._type="wheel":t!==0&&Math.abs(t)<4?this._type="trackpad":i>400?(this._type=null,this._lastValue=t,this._timeout=setTimeout(this._onTimeout,40,e)):this._type||(this._type=Math.abs(i*t)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,t+=this._lastValue)),e.shiftKey&&t&&(t=t/4),this._type&&(this._lastWheelEvent=e,this._delta-=t,this._active||this._start(e)),e.preventDefault()}_start(e){if(!this._delta)return;this._frameId&&(this._frameId=null),this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);let t=ui.mousePos(this._map.getCanvas(),e),r=this._tr;this._aroundCenter?this._aroundPoint=r.transform.locationToScreenPoint(wr.convert(r.center)):this._aroundPoint=t,this._frameId||(this._frameId=!0,this._triggerRenderFrame())}renderFrame(){if(!this._frameId||(this._frameId=null,!this.isActive()))return;let e=this._tr.transform;if(typeof this._lastExpectedZoom=="number"){let o=e.zoom-this._lastExpectedZoom;typeof this._startZoom=="number"&&(this._startZoom+=o),typeof this._targetZoom=="number"&&(this._targetZoom+=o)}if(this._delta!==0){let o=this._type==="wheel"&&Math.abs(this._delta)>bJ?this._wheelZoomRate:this._defaultZoomRate,s=aLe/(1+Math.exp(-Math.abs(this._delta*o)));this._delta<0&&s!==0&&(s=1/s);let l=typeof this._targetZoom!="number"?e.scale:Lo(this._targetZoom);this._targetZoom=e.getConstrained(e.getCameraLngLat(),Oo(l*s)).zoom,this._type==="wheel"&&(this._startZoom=e.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}let t=typeof this._targetZoom!="number"?e.zoom:this._targetZoom,r=this._startZoom,i=this._easing,n=!1,a;if(this._type==="wheel"&&r&&i){let o=ri.now()-this._lastWheelEventTime,s=Math.min((o+oLe)/200,1),l=i(s);a=On.number(r,t,l),s<1?this._frameId||(this._frameId=!0):n=!0}else a=t,n=!0;return this._active=!0,n&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._triggerRenderFrame(),delete this._targetZoom,delete this._lastExpectedZoom,delete this._finishTimeout},200)),this._lastExpectedZoom=a,{noInertia:!0,needsRenderFrame:!n,zoomDelta:a-e.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(e){let t=nO;if(this._prevEase){let r=this._prevEase,i=(ri.now()-r.start)/r.duration,n=r.easing(i+.01)-r.easing(i),a=.27/Math.sqrt(n*n+1e-4)*.01,o=Math.sqrt(.27*.27-a*a);t=FN(a,o,.25,1)}return this._prevEase={start:ri.now(),duration:e,easing:t},t}reset(){this._active=!1,this._zooming=!1,delete this._targetZoom,delete this._lastExpectedZoom,this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout)}},lLe=class{constructor(e,t){this._clickZoom=e,this._tapZoom=t}enable(){this._clickZoom.enable(),this._tapZoom.enable()}disable(){this._clickZoom.disable(),this._tapZoom.disable()}isEnabled(){return this._clickZoom.isEnabled()&&this._tapZoom.isEnabled()}isActive(){return this._clickZoom.isActive()||this._tapZoom.isActive()}},uLe=class{constructor(e){this._tr=new c_(e),this.reset()}reset(){this._active=!1}dblclick(e,t){return e.preventDefault(),{cameraAnimation:r=>{r.easeTo({duration:300,zoom:this._tr.zoom+(e.shiftKey?-1:1),around:this._tr.unproject(t)},{originalEvent:e})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}},cLe=class{constructor(){this._tap=new KO({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,delete this._tapPoint,this._tap.reset()}touchstart(e,t,r){if(!this._swipePoint)if(!this._tapTime)this._tap.touchstart(e,t,r);else{let i=t[0],n=e.timeStamp-this._tapTime<Cte,a=this._tapPoint.dist(i)<YU;!n||!a?this.reset():r.length>0&&(this._swipePoint=i,this._swipeTouch=r[0].identifier)}}touchmove(e,t,r){if(!this._tapTime)this._tap.touchmove(e,t,r);else if(this._swipePoint){if(r[0].identifier!==this._swipeTouch)return;let i=t[0],n=i.y-this._swipePoint.y;return this._swipePoint=i,e.preventDefault(),this._active=!0,{zoomDelta:n/128}}}touchend(e,t,r){if(this._tapTime)this._swipePoint&&r.length===0&&this.reset();else{let i=this._tap.touchend(e,t,r);i&&(this._tapTime=e.timeStamp,this._tapPoint=i)}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}},hLe=class{constructor(e,t,r){this._el=e,this._mousePan=t,this._touchPan=r}enable(e){this._inertiaOptions=e||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("maplibregl-touch-drag-pan")}disable(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("maplibregl-touch-drag-pan")}isEnabled(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()}isActive(){return this._mousePan.isActive()||this._touchPan.isActive()}},dLe=class{constructor(e,t,r,i){this._pitchWithRotate=e.pitchWithRotate,this._rollEnabled=e.rollEnabled,this._mouseRotate=t,this._mousePitch=r,this._mouseRoll=i}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable(),this._rollEnabled&&this._mouseRoll.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable(),this._mouseRoll.disable()}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())&&(!this._rollEnabled||this._mouseRoll.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()||this._mouseRoll.isActive()}},pLe=class{constructor(e,t,r,i){this._el=e,this._touchZoom=t,this._touchRotate=r,this._tapDragZoom=i,this._rotationDisabled=!1,this._enabled=!0}enable(e){this._touchZoom.enable(e),this._rotationDisabled||this._touchRotate.enable(e),this._tapDragZoom.enable(),this._el.classList.add("maplibregl-touch-zoom-rotate")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("maplibregl-touch-zoom-rotate")}isEnabled(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()}isActive(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}},fLe=class{constructor(e,t){this._bypassKey=navigator.userAgent.indexOf("Mac")!==-1?"metaKey":"ctrlKey",this._map=e,this._options=t,this._enabled=!1}isActive(){return!1}reset(){}_setupUI(){if(this._container)return;let e=this._map.getCanvasContainer();e.classList.add("maplibregl-cooperative-gestures"),this._container=ui.create("div","maplibregl-cooperative-gesture-screen",e);let t=this._map._getUIString("CooperativeGesturesHandler.WindowsHelpText");this._bypassKey==="metaKey"&&(t=this._map._getUIString("CooperativeGesturesHandler.MacHelpText"));let r=this._map._getUIString("CooperativeGesturesHandler.MobileHelpText"),i=document.createElement("div");i.className="maplibregl-desktop-message",i.textContent=t,this._container.appendChild(i);let n=document.createElement("div");n.className="maplibregl-mobile-message",n.textContent=r,this._container.appendChild(n),this._container.setAttribute("aria-hidden","true")}_destroyUI(){this._container&&(ui.remove(this._container),this._map.getCanvasContainer().classList.remove("maplibregl-cooperative-gestures")),delete this._container}enable(){this._setupUI(),this._enabled=!0}disable(){this._enabled=!1,this._destroyUI()}isEnabled(){return this._enabled}isBypassed(e){return e[this._bypassKey]}notifyGestureBlocked(e,t){this._enabled&&(this._map.fire(new kt("cooperativegestureprevented",{gestureType:e,originalEvent:t})),this._container.classList.add("maplibregl-show"),setTimeout(()=>{this._container.classList.remove("maplibregl-show")},100))}},ALe=Er(zr(),1),CS=e=>e.zoom||e.drag||e.roll||e.pitch||e.rotate,mLe=class extends kt{};gLe=class{constructor(e,t){this.handleWindowEvent=i=>{this.handleEvent(i,"".concat(i.type,"Window"))},this.handleEvent=(i,n)=>{if(i.type==="blur"){this.stop(!0);return}this._updatingCamera=!0;let a=i.type==="renderFrame"?void 0:i,o={needsRenderFrame:!1},s={},l={};for(let{handlerName:h,handler:d,allowed:p}of this._handlers){if(!d.isEnabled())continue;let f;if(this._blockedByActive(l,p,h))d.reset();else if(d[n||i.type]){if(tSe(i,n||i.type)){let m=ui.mousePos(this._map.getCanvas(),i);f=d[n||i.type](i,m)}else if(eSe(i,n||i.type)){let m=i.touches,g=this._getMapTouches(m),v=ui.touchPos(this._map.getCanvas(),g);f=d[n||i.type](i,v,g)}else rSe(n||i.type)||(f=d[n||i.type](i));this.mergeHandlerResult(o,s,f,h,a),f&&f.needsRenderFrame&&this._triggerRenderFrame()}(f||d.isActive())&&(l[h]=d)}let u={};for(let h in this._previousActiveHandlers)l[h]||(u[h]=a);this._previousActiveHandlers=l,(Object.keys(u).length||V5(o))&&(this._changes.push([o,s,u]),this._triggerRenderFrame()),(Object.keys(l).length||V5(o))&&this._map._stop(!0),this._updatingCamera=!1;let{cameraAnimation:c}=o;c&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],c(this._map))},this._map=e,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new Sze(e),this._bearingSnap=t.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(t);let r=this._el;this._listeners=[[r,"touchstart",{passive:!0}],[r,"touchmove",{passive:!1}],[r,"touchend",void 0],[r,"touchcancel",void 0],[r,"mousedown",void 0],[r,"mousemove",void 0],[r,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[r,"mouseover",void 0],[r,"mouseout",void 0],[r,"dblclick",void 0],[r,"click",void 0],[r,"keydown",{capture:!1}],[r,"keyup",void 0],[r,"wheel",{passive:!1}],[r,"contextmenu",void 0],[window,"blur",void 0]];for(let[i,n,a]of this._listeners)ui.addEventListener(i,n,i===document?this.handleWindowEvent:this.handleEvent,a)}destroy(){for(let[e,t,r]of this._listeners)ui.removeEventListener(e,t,e===document?this.handleWindowEvent:this.handleEvent,r)}_addDefaultHandlers(e){let t=this._map,r=t.getCanvasContainer();this._add("mapEvent",new Bze(t,e));let i=t.boxZoom=new Dze(t,e);this._add("boxZoom",i),e.interactive&&e.boxZoom&&i.enable();let n=t.cooperativeGestures=new fLe(t,e.cooperativeGestures);this._add("cooperativeGestures",n),e.cooperativeGestures&&n.enable();let a=new Lze(t),o=new uLe(t);t.doubleClickZoom=new lLe(o,a),this._add("tapZoom",a),this._add("clickZoom",o),e.interactive&&e.doubleClickZoom&&t.doubleClickZoom.enable();let s=new cLe;this._add("tapDragZoom",s);let l=t.touchPitch=new $ze(t);this._add("touchPitch",l),e.interactive&&e.touchPitch&&t.touchPitch.enable(e.touchPitch);let u=()=>t.project(t.getCenter()),c=Vze(e,u),h=Yze(e),d=Hze(e,u);t.dragRotate=new dLe(e,c,h,d),this._add("mouseRotate",c,["mousePitch"]),this._add("mousePitch",h,["mouseRotate","mouseRoll"]),this._add("mouseRoll",d,["mousePitch"]),e.interactive&&e.dragRotate&&t.dragRotate.enable();let p=Gze(e),f=new Wze(e,t);t.dragPan=new hLe(r,p,f),this._add("mousePan",p),this._add("touchPan",f,["touchZoom","touchRotate"]),e.interactive&&e.dragPan&&t.dragPan.enable(e.dragPan);let m=new Kze,g=new Xze;t.touchZoomRotate=new pLe(r,g,m,s),this._add("touchRotate",m,["touchPan","touchZoom"]),this._add("touchZoom",g,["touchPan","touchRotate"]),e.interactive&&e.touchZoomRotate&&t.touchZoomRotate.enable(e.touchZoomRotate);let v=t.scrollZoom=new sLe(t,()=>this._triggerRenderFrame());this._add("scrollZoom",v,["mousePan"]),e.interactive&&e.scrollZoom&&t.scrollZoom.enable(e.scrollZoom);let _=t.keyboard=new tLe(t);this._add("keyboard",_),e.interactive&&e.keyboard&&t.keyboard.enable(),this._add("blockableMapEvent",new Tze(t))}_add(e,t,r){this._handlers.push({handlerName:e,handler:t,allowed:r}),this._handlersById[e]=t}stop(e){if(!this._updatingCamera){for(let{handler:t}of this._handlers)t.reset();this._inertia.clear(),this._fireEvents({},{},e),this._changes=[]}}isActive(){for(let{handler:e}of this._handlers)if(e.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!CS(this._eventsInProgress)||this.isZooming()}_blockedByActive(e,t,r){for(let i in e)if(i!==r&&(!t||t.indexOf(i)<0))return!0;return!1}_getMapTouches(e){let t=[];for(let r of e){let i=r.target;this._el.contains(i)&&t.push(r)}return t}mergeHandlerResult(e,t,r,i,n){if(!r)return;tr(e,r);let a={handlerName:i,originalEvent:r.originalEvent||n};r.zoomDelta!==void 0&&(t.zoom=a),r.panDelta!==void 0&&(t.drag=a),r.rollDelta!==void 0&&(t.roll=a),r.pitchDelta!==void 0&&(t.pitch=a),r.bearingDelta!==void 0&&(t.rotate=a)}_applyChanges(){let e={},t={},r={};for(let[i,n,a]of this._changes)i.panDelta&&(e.panDelta=(e.panDelta||new ALe.default(0,0))._add(i.panDelta)),i.zoomDelta&&(e.zoomDelta=(e.zoomDelta||0)+i.zoomDelta),i.bearingDelta&&(e.bearingDelta=(e.bearingDelta||0)+i.bearingDelta),i.pitchDelta&&(e.pitchDelta=(e.pitchDelta||0)+i.pitchDelta),i.rollDelta&&(e.rollDelta=(e.rollDelta||0)+i.rollDelta),i.around!==void 0&&(e.around=i.around),i.pinchAround!==void 0&&(e.pinchAround=i.pinchAround),i.noInertia&&(e.noInertia=i.noInertia),tr(t,n),tr(r,a);this._updateMapTransform(e,t,r),this._changes=[]}_updateMapTransform(e,t,r){let i=this._map,n=i._getTransformForUpdate(),a=i.terrain;if(!V5(e)&&!(a&&this._terrainMovement))return this._fireEvents(t,r,!0);i._stop(!0);let{panDelta:o,zoomDelta:s,bearingDelta:l,pitchDelta:u,rollDelta:c,around:h,pinchAround:d}=e;d!==void 0&&(h=d),h=h||i.transform.centerPoint,a&&!n.isPointOnMapSurface(h)&&(h=n.centerPoint);let p={panDelta:o,zoomDelta:s,rollDelta:c,pitchDelta:u,bearingDelta:l,around:h};this._map.cameraHelper.useGlobeControls&&!n.isPointOnMapSurface(h)&&(h=n.centerPoint);let f=h.distSqr(n.centerPoint)<.01?n.center:n.screenPointToLocation(o?h.sub(o):h);a?(this._map.cameraHelper.handleMapControlsRollPitchBearingZoom(p,n),!this._terrainMovement&&(t.drag||t.zoom)?(this._terrainMovement=!0,this._map._elevationFreeze=!0,this._map.cameraHelper.handleMapControlsPan(p,n,f)):t.drag&&this._terrainMovement?n.setCenter(n.screenPointToLocation(n.centerPoint.sub(o))):this._map.cameraHelper.handleMapControlsPan(p,n,f)):(this._map.cameraHelper.handleMapControlsRollPitchBearingZoom(p,n),this._map.cameraHelper.handleMapControlsPan(p,n,f)),i._applyUpdatedTransform(n),this._map._update(),e.noInertia||this._inertia.record(e),this._fireEvents(t,r,!0)}_fireEvents(e,t,r){let i=CS(this._eventsInProgress),n=CS(e),a={};for(let c in e){let{originalEvent:h}=e[c];this._eventsInProgress[c]||(a["".concat(c,"start")]=h),this._eventsInProgress[c]=e[c]}!i&&n&&this._fireEvent("movestart",n.originalEvent);for(let c in a)this._fireEvent(c,a[c]);n&&this._fireEvent("move",n.originalEvent);for(let c in e){let{originalEvent:h}=e[c];this._fireEvent(c,h)}let o={},s;for(let c in this._eventsInProgress){let{handlerName:h,originalEvent:d}=this._eventsInProgress[c];this._handlersById[h].isActive()||(delete this._eventsInProgress[c],s=t[h]||d,o["".concat(c,"end")]=s)}for(let c in o)this._fireEvent(c,o[c]);let l=CS(this._eventsInProgress),u=(i||n)&&!l;if(u&&this._terrainMovement){this._map._elevationFreeze=!1,this._terrainMovement=!1;let c=this._map._getTransformForUpdate();this._map.getCenterClampedToGround()&&c.recalculateZoomAndCenter(this._map.terrain),this._map._applyUpdatedTransform(c)}if(r&&u){this._updatingCamera=!0;let c=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),h=d=>d!==0&&-this._bearingSnap<d&&d<this._bearingSnap;c&&(c.essential||!ri.prefersReducedMotion)?(h(c.bearing||this._map.getBearing())&&(c.bearing=0),c.freezeElevation=!0,this._map.easeTo(c,{originalEvent:s})):(this._map.fire(new kt("moveend",{originalEvent:s})),h(this._map.getBearing())&&this._map.resetNorth()),this._updatingCamera=!1}}_fireEvent(e,t){this._map.fire(new kt(e,t?{originalEvent:t}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add(e=>{delete this._frameId,this.handleEvent(new mLe("renderFrame",{timeStamp:e})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}},rx=Er(zr(),1),yLe=class extends cs{constructor(e,t,r){super(),this._renderFrameCallback=()=>{let i=Math.min((ri.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(i)),i<1&&this._easeFrameId?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()},this._moving=!1,this._zooming=!1,this.transform=e,this._bearingSnap=r.bearingSnap,this.cameraHelper=t,this.on("moveend",()=>{delete this._requestedCameraState})}migrateProjection(e,t){e.apply(this.transform),this.transform=e,this.cameraHelper=t}getCenter(){return new wr(this.transform.center.lng,this.transform.center.lat)}setCenter(e,t){return this.jumpTo({center:e},t)}getCenterElevation(){return this.transform.elevation}setCenterElevation(e,t){return this.jumpTo({elevation:e},t),this}getCenterClampedToGround(){return this._centerClampedToGround}setCenterClampedToGround(e){this._centerClampedToGround=e}panBy(e,t,r){return e=rx.default.convert(e).mult(-1),this.panTo(this.transform.center,tr({offset:e},t),r)}panTo(e,t,r){return this.easeTo(tr({center:e},t),r)}getZoom(){return this.transform.zoom}setZoom(e,t){return this.jumpTo({zoom:e},t),this}zoomTo(e,t,r){return this.easeTo(tr({zoom:e},t),r)}zoomIn(e,t){return this.zoomTo(this.getZoom()+1,e,t),this}zoomOut(e,t){return this.zoomTo(this.getZoom()-1,e,t),this}getVerticalFieldOfView(){return this.transform.fov}setVerticalFieldOfView(e,t){return e!=this.transform.fov&&(this.transform.setFov(e),this.fire(new kt("movestart",t)).fire(new kt("move",t)).fire(new kt("moveend",t))),this}getBearing(){return this.transform.bearing}setBearing(e,t){return this.jumpTo({bearing:e},t),this}getPadding(){return this.transform.padding}setPadding(e,t){return this.jumpTo({padding:e},t),this}rotateTo(e,t,r){return this.easeTo(tr({bearing:e},t),r)}resetNorth(e,t){return this.rotateTo(0,tr({duration:1e3},e),t),this}resetNorthPitch(e,t){return this.easeTo(tr({bearing:0,pitch:0,roll:0,duration:1e3},e),t),this}snapToNorth(e,t){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(e,t):this}getPitch(){return this.transform.pitch}setPitch(e,t){return this.jumpTo({pitch:e},t),this}getRoll(){return this.transform.roll}setRoll(e,t){return this.jumpTo({roll:e},t),this}cameraForBounds(e,t){e=vh.convert(e).adjustAntiMeridian();let r=t&&t.bearing||0;return this._cameraForBoxAndBearing(e.getNorthWest(),e.getSouthEast(),r,t)}_cameraForBoxAndBearing(e,t,r,i){let n={top:0,bottom:0,right:0,left:0};if(i=tr({padding:n,offset:[0,0],maxZoom:this.transform.maxZoom},i),typeof i.padding=="number"){let l=i.padding;i.padding={top:l,bottom:l,right:l,left:l}}let a=tr(n,i.padding);i.padding=a;let o=this.transform,s=new vh(e,t);return this.cameraHelper.cameraForBoxAndBearing(i,a,s,r,o)}fitBounds(e,t,r){return this._fitInternal(this.cameraForBounds(e,t),t,r)}fitScreenCoordinates(e,t,r,i,n){return this._fitInternal(this._cameraForBoxAndBearing(this.transform.screenPointToLocation(rx.default.convert(e)),this.transform.screenPointToLocation(rx.default.convert(t)),r,i),i,n)}_fitInternal(e,t,r){return e?(t=tr(e,t),delete t.padding,t.linear?this.easeTo(t,r):this.flyTo(t,r)):this}jumpTo(e,t){this.stop();let r=this._getTransformForUpdate(),i=!1,n=!1,a=!1,o=r.zoom;this.cameraHelper.handleJumpToCenterZoom(r,e);let s=r.zoom!==o;return"elevation"in e&&r.elevation!==+e.elevation&&r.setElevation(+e.elevation),"bearing"in e&&r.bearing!==+e.bearing&&(i=!0,r.setBearing(+e.bearing)),"pitch"in e&&r.pitch!==+e.pitch&&(n=!0,r.setPitch(+e.pitch)),"roll"in e&&r.roll!==+e.roll&&(a=!0,r.setRoll(+e.roll)),e.padding!=null&&!r.isPaddingEqual(e.padding)&&r.setPadding(e.padding),this._applyUpdatedTransform(r),this.fire(new kt("movestart",t)).fire(new kt("move",t)),s&&this.fire(new kt("zoomstart",t)).fire(new kt("zoom",t)).fire(new kt("zoomend",t)),i&&this.fire(new kt("rotatestart",t)).fire(new kt("rotate",t)).fire(new kt("rotateend",t)),n&&this.fire(new kt("pitchstart",t)).fire(new kt("pitch",t)).fire(new kt("pitchend",t)),a&&this.fire(new kt("rollstart",t)).fire(new kt("roll",t)).fire(new kt("rollend",t)),this.fire(new kt("moveend",t))}calculateCameraOptionsFromTo(e,t,r,i=0){let n=Gi.fromLngLat(e,t),a=Gi.fromLngLat(r,i),o=a.x-n.x,s=a.y-n.y,l=a.z-n.z,u=Math.hypot(o,s,l);if(u===0)throw new Error("Can't calculate camera options with same From and To");let c=Math.hypot(o,s),h=Oo(this.transform.cameraToCenterDistance/u/this.transform.tileSize),d=Math.atan2(o,-s)*180/Math.PI,p=Math.acos(c/u)*180/Math.PI;return p=l<0?90-p:90+p,{center:a.toLngLat(),elevation:i,zoom:h,pitch:p,bearing:d}}calculateCameraOptionsFromCameraLngLatAltRotation(e,t,r,i,n){let a=this.transform.calculateCenterFromCameraLngLatAlt(e,t,r,i);return{center:a.center,elevation:a.elevation,zoom:a.zoom,bearing:r,pitch:i,roll:n}}easeTo(e,t){this._stop(!1,e.easeId),e=tr({offset:[0,0],duration:500,easing:nO},e),(e.animate===!1||!e.essential&&ri.prefersReducedMotion)&&(e.duration=0);let r=this._getTransformForUpdate(),i=this.getBearing(),n=r.pitch,a=r.roll,o="bearing"in e?this._normalizeBearing(e.bearing,i):i,s="pitch"in e?+e.pitch:n,l="roll"in e?this._normalizeBearing(e.roll,a):a,u="padding"in e?e.padding:r.padding,c=rx.default.convert(e.offset),h,d;e.around&&(h=wr.convert(e.around),d=r.locationToScreenPoint(h));let p={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching,rolling:this._rolling},f=this.cameraHelper.handleEaseTo(r,{bearing:o,pitch:s,roll:l,padding:u,around:h,aroundPoint:d,offsetAsPoint:c,offset:e.offset,zoom:e.zoom,center:e.center});return this._rotating=this._rotating||i!==o,this._pitching=this._pitching||s!==n,this._rolling=this._rolling||l!==a,this._padding=!r.isPaddingEqual(u),this._zooming=this._zooming||f.isZooming,this._easeId=e.easeId,this._prepareEase(t,e.noMoveStart,p),this.terrain&&this._prepareElevation(f.elevationCenter),this._ease(m=>{f.easeFunc(m),this.terrain&&!e.freezeElevation&&this._updateElevation(m),this._applyUpdatedTransform(r),this._fireMoveEvents(t)},m=>{this.terrain&&e.freezeElevation&&this._finalizeElevation(),this._afterEase(t,m)},e),this}_prepareEase(e,t,r={}){this._moving=!0,!t&&!r.moving&&this.fire(new kt("movestart",e)),this._zooming&&!r.zooming&&this.fire(new kt("zoomstart",e)),this._rotating&&!r.rotating&&this.fire(new kt("rotatestart",e)),this._pitching&&!r.pitching&&this.fire(new kt("pitchstart",e)),this._rolling&&!r.rolling&&this.fire(new kt("rollstart",e))}_prepareElevation(e){this._elevationCenter=e,this._elevationStart=this.transform.elevation,this._elevationTarget=this.terrain.getElevationForLngLatZoom(e,this.transform.tileZoom),this._elevationFreeze=!0}_updateElevation(e){this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom));let t=this.terrain.getElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);if(e<1&&t!==this._elevationTarget){let r=this._elevationTarget-this._elevationStart,i=(t-(r*e+this._elevationStart))/(1-e);this._elevationStart+=e*(r-i),this._elevationTarget=t}this.transform.setElevation(On.number(this._elevationStart,this._elevationTarget,e))}_finalizeElevation(){this._elevationFreeze=!1,this.getCenterClampedToGround()&&this.transform.recalculateZoomAndCenter(this.terrain)}_getTransformForUpdate(){return!this.transformCameraUpdate&&!this.terrain?this.transform:(this._requestedCameraState||(this._requestedCameraState=this.transform.clone()),this._requestedCameraState)}_elevateCameraIfInsideTerrain(e){return{}}_applyUpdatedTransform(e){let t=[];if(t.push(i=>this._elevateCameraIfInsideTerrain(i)),this.transformCameraUpdate&&t.push(i=>this.transformCameraUpdate(i)),!t.length)return;let r=e.clone();for(let i of t){let n=r.clone(),{center:a,zoom:o,roll:s,pitch:l,bearing:u,elevation:c}=i(n);a&&n.setCenter(a),c!==void 0&&n.setElevation(c),o!==void 0&&n.setZoom(o),s!==void 0&&n.setRoll(s),l!==void 0&&n.setPitch(l),u!==void 0&&n.setBearing(u),r.apply(n)}this.transform.apply(r)}_fireMoveEvents(e){this.fire(new kt("move",e)),this._zooming&&this.fire(new kt("zoom",e)),this._rotating&&this.fire(new kt("rotate",e)),this._pitching&&this.fire(new kt("pitch",e)),this._rolling&&this.fire(new kt("roll",e))}_afterEase(e,t){if(this._easeId&&t&&this._easeId===t)return;delete this._easeId;let r=this._zooming,i=this._rotating,n=this._pitching,a=this._rolling;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._rolling=!1,this._padding=!1,r&&this.fire(new kt("zoomend",e)),i&&this.fire(new kt("rotateend",e)),n&&this.fire(new kt("pitchend",e)),a&&this.fire(new kt("rollend",e)),this.fire(new kt("moveend",e))}flyTo(e,t){if(!e.essential&&ri.prefersReducedMotion){let R=e_(e,["center","zoom","bearing","pitch","roll","elevation"]);return this.jumpTo(R,t)}this.stop(),e=tr({offset:[0,0],speed:1.2,curve:1.42,easing:nO},e);let r=this._getTransformForUpdate(),i=r.bearing,n=r.pitch,a=r.roll,o=r.padding,s="bearing"in e?this._normalizeBearing(e.bearing,i):i,l="pitch"in e?+e.pitch:n,u="roll"in e?this._normalizeBearing(e.roll,a):a,c="padding"in e?e.padding:r.padding,h=rx.default.convert(e.offset),d=r.centerPoint.add(h),p=r.screenPointToLocation(d),f=this.cameraHelper.handleFlyTo(r,{bearing:s,pitch:l,roll:u,padding:c,locationAtOffset:p,offsetAsPoint:h,center:e.center,minZoom:e.minZoom,zoom:e.zoom}),m=e.curve,g=Math.max(r.width,r.height),v=g/f.scaleOfZoom,_=f.pixelPathLength;if(typeof f.scaleOfMinZoom=="number"){let R=g/f.scaleOfMinZoom;m=Math.sqrt(R/_*2)}let x=m*m;function b(R){let F=(v*v-g*g+(R?-1:1)*x*x*_*_)/(2*(R?v:g)*x*_);return Math.log(Math.sqrt(F*F+1)-F)}function E(R){return(Math.exp(R)-Math.exp(-R))/2}function M(R){return(Math.exp(R)+Math.exp(-R))/2}function S(R){return E(R)/M(R)}let D=b(!1),T=function(R){return M(D)/M(D+m*R)},P=function(R){return g*((M(D)*S(D+m*R)-E(D))/x)/_},k=(b(!0)-D)/m;if(Math.abs(_)<2e-6||!isFinite(k)){if(Math.abs(g-v)<1e-6)return this.easeTo(e,t);let R=v<g?-1:1;k=Math.abs(Math.log(v/g))/m,P=()=>0,T=F=>Math.exp(R*m*F)}if("duration"in e)e.duration=+e.duration;else{let R="screenSpeed"in e?+e.screenSpeed/m:+e.speed;e.duration=1e3*k/R}return e.maxDuration&&e.duration>e.maxDuration&&(e.duration=0),this._zooming=!0,this._rotating=i!==s,this._pitching=l!==n,this._rolling=u!==a,this._padding=!r.isPaddingEqual(c),this._prepareEase(t,!1),this.terrain&&this._prepareElevation(f.targetCenter),this._ease(R=>{let F=R*k,B=1/T(F),z=P(F);this._rotating&&r.setBearing(On.number(i,s,R)),this._pitching&&r.setPitch(On.number(n,l,R)),this._rolling&&r.setRoll(On.number(a,u,R)),this._padding&&(r.interpolatePadding(o,c,R),d=r.centerPoint.add(h)),f.easeFunc(R,B,z,d),this.terrain&&!e.freezeElevation&&this._updateElevation(R),this._applyUpdatedTransform(r),this._fireMoveEvents(t)},()=>{this.terrain&&e.freezeElevation&&this._finalizeElevation(),this._afterEase(t)},e),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(e,t){var r;if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){let i=this._onEaseEnd;delete this._onEaseEnd,i.call(this,t)}return e||(r=this.handlers)==null||r.stop(!1),this}_ease(e,t,r){r.animate===!1||r.duration===0?(e(1),t()):(this._easeStart=ri.now(),this._easeOptions=r,this._onEaseFrame=e,this._onEaseEnd=t,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(e,t){e=Wf(e,-180,180);let r=Math.abs(e-t);return Math.abs(e-360-t)<r&&(e-=360),Math.abs(e+360-t)<r&&(e+=360),e}queryTerrainElevation(e){return this.terrain?this.terrain.getElevationForLngLatZoom(wr.convert(e),this.transform.tileZoom):null}},Ld=Er(zr(),1),Bte={compact:!0,customAttribution:'<a href="https://maplibre.org/" target="_blank">MapLibre</a>'},vLe=class{constructor(e=Bte){this._toggleAttribution=()=>{this._container.classList.contains("maplibregl-compact")&&(this._container.classList.contains("maplibregl-compact-show")?(this._container.setAttribute("open",""),this._container.classList.remove("maplibregl-compact-show")):(this._container.classList.add("maplibregl-compact-show"),this._container.removeAttribute("open")))},this._updateData=t=>{t&&(t.sourceDataType==="metadata"||t.sourceDataType==="visibility"||t.dataType==="style"||t.type==="terrain")&&this._updateAttributions()},this._updateCompact=()=>{this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact===!1?this._container.setAttribute("open",""):!this._container.classList.contains("maplibregl-compact")&&!this._container.classList.contains("maplibregl-attrib-empty")&&(this._container.setAttribute("open",""),this._container.classList.add("maplibregl-compact","maplibregl-compact-show")):(this._container.setAttribute("open",""),this._container.classList.contains("maplibregl-compact")&&this._container.classList.remove("maplibregl-compact","maplibregl-compact-show"))},this._updateCompactMinimize=()=>{this._container.classList.contains("maplibregl-compact")&&this._container.classList.contains("maplibregl-compact-show")&&this._container.classList.remove("maplibregl-compact-show")},this.options=e}getDefaultPosition(){return"bottom-right"}onAdd(e){return this._map=e,this._compact=this.options.compact,this._container=ui.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=ui.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=ui.create("div","maplibregl-ctrl-attrib-inner",this._container),this._updateAttributions(),this._updateCompact(),this._map.on("styledata",this._updateData),this._map.on("sourcedata",this._updateData),this._map.on("terrain",this._updateData),this._map.on("resize",this._updateCompact),this._map.on("drag",this._updateCompactMinimize),this._container}onRemove(){ui.remove(this._container),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("terrain",this._updateData),this._map.off("resize",this._updateCompact),this._map.off("drag",this._updateCompactMinimize),this._map=void 0,this._compact=void 0,this._attribHTML=void 0}_setElementTitle(e,t){let r=this._map._getUIString("AttributionControl.".concat(t));e.title=r,e.setAttribute("aria-label",r)}_updateAttributions(){if(!this._map.style)return;let e=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?e=e.concat(this.options.customAttribution.map(i=>typeof i!="string"?"":i)):typeof this.options.customAttribution=="string"&&e.push(this.options.customAttribution)),this._map.style.stylesheet){let i=this._map.style.stylesheet;this.styleOwner=i.owner,this.styleId=i.id}let t=this._map.style.sourceCaches;for(let i in t){let n=t[i];if(n.used||n.usedForTerrain){let a=n.getSource();a.attribution&&e.indexOf(a.attribution)<0&&e.push(a.attribution)}}e=e.filter(i=>String(i).trim()),e.sort((i,n)=>i.length-n.length),e=e.filter((i,n)=>{for(let a=n+1;a<e.length;a++)if(e[a].indexOf(i)>=0)return!1;return!0});let r=e.join(" | ");r!==this._attribHTML&&(this._attribHTML=r,e.length?(this._innerContainer.innerHTML=ui.sanitize(r),this._container.classList.remove("maplibregl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty"),this._updateCompact(),this._editLink=null)}},xLe=class{constructor(e={}){this._updateCompact=()=>{let t=this._container.children;if(t.length){let r=t[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact!==!1&&r.classList.add("maplibregl-compact"):r.classList.remove("maplibregl-compact")}},this.options=e}getDefaultPosition(){return"bottom-left"}onAdd(e){this._map=e,this._compact=this.options&&this.options.compact,this._container=ui.create("div","maplibregl-ctrl");let t=ui.create("a","maplibregl-ctrl-logo");return t.target="_blank",t.rel="noopener nofollow",t.href="https://maplibre.org/",t.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),t.setAttribute("rel","noopener nofollow"),this._container.appendChild(t),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){ui.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}},_Le=class{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(e){let t=++this._id;return this._queue.push({callback:e,id:t,cancelled:!1}),t}remove(e){let t=this._currentlyRunning,r=t?this._queue.concat(t):this._queue;for(let i of r)if(i.id===e){i.cancelled=!0;return}}run(e=0){if(this._currentlyRunning)throw new Error("Attempting to run(), but is already running.");let t=this._currentlyRunning=this._queue;this._queue=[];for(let r of t)if(!r.cancelled&&(r.callback(e),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}},qO=(e=>(e.create="create",e.load="load",e.fullLoad="fullLoad",e))(qO||{}),BS=null,ix=[],bLe=60,Y5=1e3/bLe,H5="loadTime",W5="fullLoadTime",nx={mark(e){performance.mark(e)},frame(e){let t=e;if(BS!=null){let r=t-BS;ix.push(r)}BS=t},clearMetrics(){BS=null,ix=[],performance.clearMeasures(H5),performance.clearMeasures(W5);for(let e in qO)performance.clearMarks(qO[e])},getPerformanceMetrics(){performance.measure(H5,"create","load"),performance.measure(W5,"create","fullLoad");let e=performance.getEntriesByName(H5)[0].duration,t=performance.getEntriesByName(W5)[0].duration,r=ix.length,i=1/(ix.reduce((o,s)=>o+s,0)/r/1e3),n=ix.filter(o=>o>Y5).reduce((o,s)=>o+(s-Y5)/Y5,0),a=n/(r+n)*100;return{loadTime:e,fullLoadTime:t,fps:i,percentDroppedFrames:a,totalFrames:r}}},wLe=Vn([{name:"a_pos3d",type:"Int16",components:3}]),ELe=class extends cs{constructor(e){super(),this._lastTilesetChange=ri.now(),this.sourceCache=e,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.minzoom=0,this.maxzoom=22,this.deltaZoom=1,this.tileSize=e._source.tileSize*bs(2,this.deltaZoom),e.usedForTerrain=!0,e.tileSize=this.tileSize}destruct(){this.sourceCache.usedForTerrain=!1,this.sourceCache.tileSize=null}update(e,t){this.sourceCache.update(e,t),this._renderableTilesKeys=[];let r={};for(let i of uC(e,{tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:t,calculateTileZoom:this.sourceCache._source.calculateTileZoom}))r[i.key]=!0,this._renderableTilesKeys.push(i.key),this._tiles[i.key]||(i.terrainRttPosMatrix32f=new Float64Array(16),_t.ortho(i.terrainRttPosMatrix32f,0,8192,8192,0,0,1),this._tiles[i.key]=new Oee(i,this.tileSize),this._lastTilesetChange=ri.now());for(let i in this._tiles)r[i]||delete this._tiles[i]}freeRtt(e){for(let t in this._tiles){let r=this._tiles[t];(!e||r.tileID.equals(e)||r.tileID.isChildOf(e)||e.isChildOf(r.tileID))&&(r.rtt=[])}}getRenderableTiles(){return this._renderableTilesKeys.map(e=>this.getTileByID(e))}getTileByID(e){return this._tiles[e]}getTerrainCoords(e,t){return t?this._getTerrainCoordsForTileRanges(e,t):this._getTerrainCoordsForRegularTile(e)}_getTerrainCoordsForRegularTile(e){let t={};for(let r of this._renderableTilesKeys){let i=this._tiles[r].tileID,n=e.clone(),a=Yd();if(i.canonical.equals(e.canonical))_t.ortho(a,0,8192,8192,0,0,1);else if(i.canonical.isChildOf(e.canonical)){let o=i.canonical.z-e.canonical.z,s=i.canonical.x-(i.canonical.x>>o<<o),l=i.canonical.y-(i.canonical.y>>o<<o),u=8192>>o;_t.ortho(a,0,u,u,0,0,1),_t.translate(a,a,[-s*u,-l*u,0])}else if(e.canonical.isChildOf(i.canonical)){let o=e.canonical.z-i.canonical.z,s=e.canonical.x-(e.canonical.x>>o<<o),l=e.canonical.y-(e.canonical.y>>o<<o),u=8192>>o;_t.ortho(a,0,8192,8192,0,0,1),_t.translate(a,a,[s*u,l*u,0]),_t.scale(a,a,[1/bs(2,o),1/bs(2,o),0])}else continue;n.terrainRttPosMatrix32f=new Float32Array(a),t[r]=n}return t}_getTerrainCoordsForTileRanges(e,t){let r={};for(let i of this._renderableTilesKeys){let n=this._tiles[i].tileID;if(!this._isWithinTileRanges(n,t))continue;let a=e.clone(),o=Yd();if(n.canonical.z===e.canonical.z){let s=e.canonical.x-n.canonical.x,l=e.canonical.y-n.canonical.y;_t.ortho(o,0,8192,8192,0,0,1),_t.translate(o,o,[s*8192,l*8192,0])}else if(n.canonical.z>e.canonical.z){let s=n.canonical.z-e.canonical.z,l=n.canonical.x-(n.canonical.x>>s<<s),u=n.canonical.y-(n.canonical.y>>s<<s),c=e.canonical.x-(n.canonical.x>>s),h=e.canonical.y-(n.canonical.y>>s),d=8192>>s;_t.ortho(o,0,d,d,0,0,1),_t.translate(o,o,[-l*d+c*8192,-u*d+h*8192,0])}else{let s=e.canonical.z-n.canonical.z,l=e.canonical.x-(e.canonical.x>>s<<s),u=e.canonical.y-(e.canonical.y>>s<<s),c=(e.canonical.x>>s)-n.canonical.x,h=(e.canonical.y>>s)-n.canonical.y,d=8192<<s;_t.ortho(o,0,d,d,0,0,1),_t.translate(o,o,[l*8192+c*d,u*8192+h*d,0])}a.terrainRttPosMatrix32f=new Float32Array(o),r[i]=a}return r}getSourceTile(e,t){let r=this.sourceCache._source,i=e.overscaledZ-this.deltaZoom;if(i>r.maxzoom&&(i=r.maxzoom),i<r.minzoom)return null;this._sourceTileCache[e.key]||(this._sourceTileCache[e.key]=e.scaledTo(i).key);let n=this.sourceCache.getTileByID(this._sourceTileCache[e.key]);if(!(n&&n.dem)&&t)for(;i>=r.minzoom&&!(n&&n.dem);)n=this.sourceCache.getTileByID(e.scaledTo(i--).key);return n}anyTilesAfterTime(e=Date.now()){return this._lastTilesetChange>=e}_isWithinTileRanges(e,t){return t[e.canonical.z]&&e.canonical.x>=t[e.canonical.z].minTileX&&e.canonical.x<=t[e.canonical.z].maxTileX&&e.canonical.y>=t[e.canonical.z].minTileY&&e.canonical.y<=t[e.canonical.z].maxTileY}},MLe=class{constructor(e,t,r){this._meshCache={},this.painter=e,this.sourceCache=new ELe(t),this.options=r,this.exaggeration=typeof r.exaggeration=="number"?r.exaggeration:1,this.qualityFactor=2,this.meshSize=128,this._demMatrixCache={},this.coordsIndex=[],this._coordsTextureSize=1024}getDEMElevation(e,t,r,i=8192){var n;if(!(t>=0&&t<i&&r>=0&&r<i))return 0;let a=this.getTerrainData(e),o=(n=a.tile)==null?void 0:n.dem;if(!o)return 0;let s=ls.transformMat4([],[t/i*8192,r/i*8192],a.u_terrain_matrix),l=[s[0]*o.dim,s[1]*o.dim],u=Math.floor(l[0]),c=Math.floor(l[1]),h=l[0]-u,d=l[1]-c;return o.get(u,c)*(1-h)*(1-d)+o.get(u+1,c)*h*(1-d)+o.get(u,c+1)*(1-h)*d+o.get(u+1,c+1)*h*d}getElevationForLngLatZoom(e,t){if(!jDe(t,e.wrap()))return 0;let{tileID:r,mercatorX:i,mercatorY:n}=this._getOverscaledTileIDFromLngLatZoom(e,t);return this.getElevation(r,i%8192,n%8192,8192)}getElevation(e,t,r,i=8192){return this.getDEMElevation(e,t,r,i)*this.exaggeration}getTerrainData(e){if(!this._emptyDemTexture){let i=this.painter.context,n=new Mn({width:1,height:1},new Uint8Array(4));this._emptyDepthTexture=new $n(i,n,i.gl.RGBA,{premultiply:!1}),this._emptyDemUnpack=[0,0,0,0],this._emptyDemTexture=new $n(i,new Mn({width:1,height:1}),i.gl.RGBA,{premultiply:!1}),this._emptyDemTexture.bind(i.gl.NEAREST,i.gl.CLAMP_TO_EDGE),this._emptyDemMatrix=_t.identity([])}let t=this.sourceCache.getSourceTile(e,!0);if(t&&t.dem&&(!t.demTexture||t.needsTerrainPrepare)){let i=this.painter.context;t.demTexture=this.painter.getTileTexture(t.dem.stride),t.demTexture?t.demTexture.update(t.dem.getPixels(),{premultiply:!1}):t.demTexture=new $n(i,t.dem.getPixels(),i.gl.RGBA,{premultiply:!1}),t.demTexture.bind(i.gl.NEAREST,i.gl.CLAMP_TO_EDGE),t.needsTerrainPrepare=!1}let r=t&&t+t.tileID.key+e.key;if(r&&!this._demMatrixCache[r]){let i=this.sourceCache.sourceCache._source.maxzoom,n=e.canonical.z-t.tileID.canonical.z;e.overscaledZ>e.canonical.z&&(e.canonical.z>=i?n=e.canonical.z-i:oa("cannot calculate elevation if elevation maxzoom > source.maxzoom"));let a=e.canonical.x-(e.canonical.x>>n<<n),o=e.canonical.y-(e.canonical.y>>n<<n),s=_t.fromScaling(new Float64Array(16),[1/(8192<<n),1/(8192<<n),0]);_t.translate(s,s,[a*8192,o*8192,0]),this._demMatrixCache[e.key]={matrix:s,coord:e}}return{u_depth:2,u_terrain:3,u_terrain_dim:t&&t.dem&&t.dem.dim||1,u_terrain_matrix:r?this._demMatrixCache[e.key].matrix:this._emptyDemMatrix,u_terrain_unpack:t&&t.dem&&t.dem.getUnpackVector()||this._emptyDemUnpack,u_terrain_exaggeration:this.exaggeration,texture:(t&&t.demTexture||this._emptyDemTexture).texture,depthTexture:(this._fboDepthTexture||this._emptyDepthTexture).texture,tile:t}}getFramebuffer(e){let t=this.painter,r=t.width/devicePixelRatio,i=t.height/devicePixelRatio;return this._fbo&&(this._fbo.width!==r||this._fbo.height!==i)&&(this._fbo.destroy(),this._fboCoordsTexture.destroy(),this._fboDepthTexture.destroy(),delete this._fbo,delete this._fboDepthTexture,delete this._fboCoordsTexture),this._fboCoordsTexture||(this._fboCoordsTexture=new $n(t.context,{width:r,height:i,data:null},t.context.gl.RGBA,{premultiply:!1}),this._fboCoordsTexture.bind(t.context.gl.NEAREST,t.context.gl.CLAMP_TO_EDGE)),this._fboDepthTexture||(this._fboDepthTexture=new $n(t.context,{width:r,height:i,data:null},t.context.gl.RGBA,{premultiply:!1}),this._fboDepthTexture.bind(t.context.gl.NEAREST,t.context.gl.CLAMP_TO_EDGE)),this._fbo||(this._fbo=t.context.createFramebuffer(r,i,!0,!1),this._fbo.depthAttachment.set(t.context.createRenderbuffer(t.context.gl.DEPTH_COMPONENT16,r,i))),this._fbo.colorAttachment.set(e==="coords"?this._fboCoordsTexture.texture:this._fboDepthTexture.texture),this._fbo}getCoordsTexture(){let e=this.painter.context;if(this._coordsTexture)return this._coordsTexture;let t=new Uint8Array(this._coordsTextureSize*this._coordsTextureSize*4);for(let n=0,a=0;n<this._coordsTextureSize;n++)for(let o=0;o<this._coordsTextureSize;o++,a+=4)t[a+0]=o&255,t[a+1]=n&255,t[a+2]=o>>8<<4|n>>8,t[a+3]=0;let r=new Mn({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(t.buffer)),i=new $n(e,r,e.gl.RGBA,{premultiply:!1});return i.bind(e.gl.NEAREST,e.gl.CLAMP_TO_EDGE),this._coordsTexture=i,i}pointCoordinate(e){this.painter.maybeDrawDepthAndCoords(!0);let t=new Uint8Array(4),r=this.painter.context,i=r.gl,n=Math.round(e.x*this.painter.pixelRatio/devicePixelRatio),a=Math.round(e.y*this.painter.pixelRatio/devicePixelRatio),o=Math.round(this.painter.height/devicePixelRatio);r.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),i.readPixels(n,o-a-1,1,1,i.RGBA,i.UNSIGNED_BYTE,t),r.bindFramebuffer.set(null);let s=t[0]+(t[2]>>4<<8),l=t[1]+((t[2]&15)<<8),u=this.coordsIndex[255-t[3]],c=u&&this.sourceCache.getTileByID(u);if(!c)return null;let h=this._coordsTextureSize,d=(1<<c.tileID.canonical.z)*h;return new Gi((c.tileID.canonical.x*h+s)/d+c.tileID.wrap,(c.tileID.canonical.y*h+l)/d,this.getElevation(c.tileID,s,l,h))}depthAtPoint(e){let t=new Uint8Array(4),r=this.painter.context,i=r.gl;return r.bindFramebuffer.set(this.getFramebuffer("depth").framebuffer),i.readPixels(e.x,this.painter.height/devicePixelRatio-e.y-1,1,1,i.RGBA,i.UNSIGNED_BYTE,t),r.bindFramebuffer.set(null),(t[0]/(256*256*256)+t[1]/(256*256)+t[2]/256+t[3])/256}getTerrainMesh(e){var t;let r=((t=this.painter.style.projection)==null?void 0:t.transitionState)>0,i=r&&e.canonical.y===0,n=r&&e.canonical.y===(1<<e.canonical.z)-1,a="m_".concat(i?"n":"","_").concat(n?"s":"");if(this._meshCache[a])return this._meshCache[a];let o=this.painter.context,s=new wBe,l=new au,u=this.meshSize,c=8192/u,h=u*u;for(let S=0;S<=u;S++)for(let D=0;D<=u;D++)s.emplaceBack(D*c,S*c,0);for(let S=0;S<h;S+=u+1)for(let D=0;D<u;D++)l.emplaceBack(D+S,u+D+S+1,u+D+S+2),l.emplaceBack(D+S,u+D+S+2,D+S+1);let d=s.length,p=0,f=d+(u+1),m=(u+1)*u,g=i?Vd:0,v=i?0:1,_=n?Yf:8192,x=n?0:1;for(let S=0;S<=u;S++)s.emplaceBack(S*c,g,v);for(let S=0;S<=u;S++)s.emplaceBack(S*c,_,x);for(let S=0;S<u;S++)l.emplaceBack(m+S,f+S,f+S+1),l.emplaceBack(m+S,f+S+1,m+S+1),l.emplaceBack(p+S,d+S+1,d+S),l.emplaceBack(p+S,p+S+1,d+S+1);let b=s.length,E=b+(u+1)*2;for(let S of[0,1])for(let D=0;D<=u;D++)for(let T of[0,1])s.emplaceBack(S*8192,D*c,T);for(let S=0;S<u*2;S+=2)l.emplaceBack(b+S,b+S+1,b+S+3),l.emplaceBack(b+S,b+S+3,b+S+2),l.emplaceBack(E+S,E+S+3,E+S+1),l.emplaceBack(E+S,E+S+2,E+S+3);let M=new gy(o.createVertexBuffer(s,wLe.members),o.createIndexBuffer(l),gn.simpleSegment(0,0,s.length,l.length));return this._meshCache[a]=M,M}getMeshFrameDelta(e){return 2*Math.PI*Xu/Math.pow(2,Math.max(e,0))/5}getMinTileElevationForLngLatZoom(e,t){var r;let{tileID:i}=this._getOverscaledTileIDFromLngLatZoom(e,t);return(r=this.getMinMaxElevation(i).minElevation)!=null?r:0}getMinMaxElevation(e){let t=this.getTerrainData(e).tile,r={minElevation:null,maxElevation:null};return t&&t.dem&&(r.minElevation=t.dem.min*this.exaggeration,r.maxElevation=t.dem.max*this.exaggeration),r}_getOverscaledTileIDFromLngLatZoom(e,t){let r=Gi.fromLngLat(e.wrap()),i=(1<<t)*8192,n=r.x*i,a=r.y*i,o=Math.floor(n/8192),s=Math.floor(a/8192);return{tileID:new bo(t,0,t,o,s),mercatorX:n,mercatorY:a}}},SLe=class{constructor(e,t,r){this._context=e,this._size=t,this._tileSize=r,this._objects=[],this._recentlyUsed=[],this._stamp=0}destruct(){for(let e of this._objects)e.texture.destroy(),e.fbo.destroy()}_createObject(e){let t=this._context.createFramebuffer(this._tileSize,this._tileSize,!0,!0),r=new $n(this._context,{width:this._tileSize,height:this._tileSize,data:null},this._context.gl.RGBA);return r.bind(this._context.gl.LINEAR,this._context.gl.CLAMP_TO_EDGE),this._context.extTextureFilterAnisotropic&&this._context.gl.texParameterf(this._context.gl.TEXTURE_2D,this._context.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,this._context.extTextureFilterAnisotropicMax),t.depthAttachment.set(this._context.createRenderbuffer(this._context.gl.DEPTH_STENCIL,this._tileSize,this._tileSize)),t.colorAttachment.set(r.texture),{id:e,fbo:t,texture:r,stamp:-1,inUse:!1}}getObjectForId(e){return this._objects[e]}useObject(e){e.inUse=!0,this._recentlyUsed=this._recentlyUsed.filter(t=>e.id!==t),this._recentlyUsed.push(e.id)}stampObject(e){e.stamp=++this._stamp}getOrCreateFreeObject(){for(let t of this._recentlyUsed)if(!this._objects[t].inUse)return this._objects[t];if(this._objects.length>=this._size)throw new Error("No free RenderPool available, call freeAllObjects() required!");let e=this._createObject(this._objects.length);return this._objects.push(e),e}freeObject(e){e.inUse=!1}freeAllObjects(){for(let e of this._objects)this.freeObject(e)}isFull(){return this._objects.length<this._size?!1:this._objects.some(e=>!e.inUse)===!1}},Sg={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0,"color-relief":!0},ILe=class{constructor(e,t){this.painter=e,this.terrain=t,this.pool=new SLe(e.context,30,t.sourceCache.tileSize*t.qualityFactor)}destruct(){this.pool.destruct()}getTexture(e){return this.pool.getObjectForId(e.rtt[this._stacks.length-1].id).texture}prepareForRender(e,t){this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.sourceCache.getRenderableTiles(),this._renderableLayerIds=e._order.filter(r=>!e._layers[r].isHidden(t)),this._coordsAscending={};for(let r in e.sourceCaches){this._coordsAscending[r]={};let i=e.sourceCaches[r].getVisibleCoordinates(),n=e.sourceCaches[r].getSource(),a=n instanceof l_?n.terrainTileRanges:null;for(let o of i){let s=this.terrain.sourceCache.getTerrainCoords(o,a);for(let l in s)this._coordsAscending[r][l]||(this._coordsAscending[r][l]=[]),this._coordsAscending[r][l].push(s[l])}}this._coordsAscendingStr={};for(let r of e._order){let i=e._layers[r],n=i.source;if(Sg[i.type]&&!this._coordsAscendingStr[n]){this._coordsAscendingStr[n]={};for(let a in this._coordsAscending[n])this._coordsAscendingStr[n][a]=this._coordsAscending[n][a].map(o=>o.key).sort().join()}}for(let r of this._renderableTiles)for(let i in this._coordsAscendingStr){let n=this._coordsAscendingStr[i][r.tileID.key];n&&n!==r.rttCoords[i]&&(r.rtt=[])}}renderLayer(e,t){if(e.isHidden(this.painter.transform.zoom))return!1;let r=bt(ze({},t),{isRenderingToTexture:!0}),i=e.type,n=this.painter,a=this._renderableLayerIds[this._renderableLayerIds.length-1]===e.id;if(Sg[i]&&((!this._prevType||!Sg[this._prevType])&&this._stacks.push([]),this._prevType=i,this._stacks[this._stacks.length-1].push(e.id),!a))return!0;if(Sg[this._prevType]||Sg[i]&&a){this._prevType=i;let o=this._stacks.length-1,s=this._stacks[o]||[];for(let l of this._renderableTiles){if(this.pool.isFull()&&(vJ(this.painter,this.terrain,this._rttTiles,r),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(l),l.rtt[o]){let c=this.pool.getObjectForId(l.rtt[o].id);if(c.stamp===l.rtt[o].stamp){this.pool.useObject(c);continue}}let u=this.pool.getOrCreateFreeObject();this.pool.useObject(u),this.pool.stampObject(u),l.rtt[o]={id:u.id,stamp:u.stamp},n.context.bindFramebuffer.set(u.fbo.framebuffer),n.context.clear({color:mr.transparent,stencil:0}),n.currentStencilSource=void 0;for(let c=0;c<s.length;c++){let h=n.style._layers[s[c]],d=h.source?this._coordsAscending[h.source][l.tileID.key]:[l.tileID];n.context.viewport.set([0,0,u.fbo.width,u.fbo.height]),n._renderTileClippingMasks(h,d,!0),n.renderLayer(n,n.style.sourceCaches[h.source],h,d,r),h.source&&(l.rttCoords[h.source]=this._coordsAscendingStr[h.source][l.tileID.key])}}return vJ(this.painter,this.terrain,this._rttTiles,r),this._rttTiles=[],this.pool.freeAllObjects(),Sg[i]}return!1}},CLe={"AttributionControl.ToggleAttribution":"Toggle attribution","AttributionControl.MapFeedback":"Map feedback","FullscreenControl.Enter":"Enter fullscreen","FullscreenControl.Exit":"Exit fullscreen","GeolocateControl.FindMyLocation":"Find my location","GeolocateControl.LocationNotAvailable":"Location not available","LogoControl.Title":"MapLibre logo","Map.Title":"Map","Marker.Title":"Map marker","NavigationControl.ResetBearing":"Reset bearing to north","NavigationControl.ZoomIn":"Zoom in","NavigationControl.ZoomOut":"Zoom out","Popup.Close":"Close popup","ScaleControl.Feet":"ft","ScaleControl.Meters":"m","ScaleControl.Kilometers":"km","ScaleControl.Miles":"mi","ScaleControl.NauticalMiles":"nm","GlobeControl.Enable":"Enable globe","GlobeControl.Disable":"Disable globe","TerrainControl.Enable":"Enable terrain","TerrainControl.Disable":"Disable terrain","CooperativeGesturesHandler.WindowsHelpText":"Use Ctrl + scroll to zoom the map","CooperativeGesturesHandler.MacHelpText":"Use \\u2318 + scroll to zoom the map","CooperativeGesturesHandler.MobileHelpText":"Use two fingers to move the map"},BLe=lK.version,XS=-2,Tte=22,jd=0,Pte=60,TS=180,wJ={hash:!1,interactive:!0,bearingSnap:7,attributionControl:Bte,maplibreLogo:!1,refreshExpiredTiles:!0,canvasContextAttributes:{antialias:!1,preserveDrawingBuffer:!1,powerPreference:"high-performance",failIfMajorPerformanceCaveat:!1,desynchronized:!1,contextType:void 0},scrollZoom:!0,minZoom:XS,maxZoom:Tte,minPitch:jd,maxPitch:Pte,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,touchPitch:!0,cooperativeGestures:!1,trackResize:!0,center:[0,0],elevation:0,zoom:0,bearing:0,pitch:0,roll:0,renderWorldCopies:!0,maxTileCacheSize:null,maxTileCacheZoomLevels:Kd.MAX_TILE_CACHE_ZOOM_LEVELS,transformRequest:null,transformCameraUpdate:null,fadeDuration:300,crossSourceCollisions:!0,clickTolerance:3,localIdeographFontFamily:"sans-serif",pitchWithRotate:!0,rollEnabled:!1,validateStyle:!0,maxCanvasSize:[4096,4096],cancelPendingTileRequestsWhileZooming:!0,centerClampedToGround:!0},Dte=class extends yLe{constructor(e){var t,r;nx.mark("create");let i=bt(ze(ze({},wJ),e),{canvasContextAttributes:ze(ze({},wJ.canvasContextAttributes),e.canvasContextAttributes)});if(i.minZoom!=null&&i.maxZoom!=null&&i.minZoom>i.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(i.minPitch!=null&&i.maxPitch!=null&&i.minPitch>i.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(i.minPitch!=null&&i.minPitch<jd)throw new Error("minPitch must be greater than or equal to ".concat(jd));if(i.maxPitch!=null&&i.maxPitch>TS)throw new Error("maxPitch must be less than or equal to ".concat(TS));let n=new yI,a=new vI;if(i.minZoom!==void 0&&n.setMinZoom(i.minZoom),i.maxZoom!==void 0&&n.setMaxZoom(i.maxZoom),i.minPitch!==void 0&&n.setMinPitch(i.minPitch),i.maxPitch!==void 0&&n.setMaxPitch(i.maxPitch),i.renderWorldCopies!==void 0&&n.setRenderWorldCopies(i.renderWorldCopies),super(n,a,{bearingSnap:i.bearingSnap}),this._idleTriggered=!1,this._crossFadingFactor=1,this._renderTaskQueue=new _Le,this._controls=[],this._mapId=pq(),this._contextLost=l=>{l.preventDefault(),this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this.fire(new kt("webglcontextlost",{originalEvent:l}))},this._contextRestored=l=>{this._setupPainter(),this.resize(),this._update(),this.fire(new kt("webglcontextrestored",{originalEvent:l}))},this._onMapScroll=l=>{if(l.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1},this._onWindowOnline=()=>{this._update()},this._interactive=i.interactive,this._maxTileCacheSize=i.maxTileCacheSize,this._maxTileCacheZoomLevels=i.maxTileCacheZoomLevels,this._canvasContextAttributes=ze({},i.canvasContextAttributes),this._trackResize=i.trackResize===!0,this._bearingSnap=i.bearingSnap,this._centerClampedToGround=i.centerClampedToGround,this._refreshExpiredTiles=i.refreshExpiredTiles===!0,this._fadeDuration=i.fadeDuration,this._crossSourceCollisions=i.crossSourceCollisions===!0,this._collectResourceTiming=i.collectResourceTiming===!0,this._locale=ze(ze({},CLe),i.locale),this._clickTolerance=i.clickTolerance,this._overridePixelRatio=i.pixelRatio,this._maxCanvasSize=i.maxCanvasSize,this.transformCameraUpdate=i.transformCameraUpdate,this.cancelPendingTileRequestsWhileZooming=i.cancelPendingTileRequestsWhileZooming===!0,this._imageQueueHandle=$u.addThrottleControl(()=>this.isMoving()),this._requestManager=new dSe(i.transformRequest),typeof i.container=="string"){if(this._container=document.getElementById(i.container),!this._container)throw new Error("Container '".concat(i.container,"' not found."))}else if(i.container instanceof HTMLElement)this._container=i.container;else throw new Error("Invalid type: 'container' must be a String or HTMLElement.");if(i.maxBounds&&this.setMaxBounds(i.maxBounds),this._setupContainer(),this._setupPainter(),this.on("move",()=>this._update(!1)),this.on("moveend",()=>this._update(!1)),this.on("zoom",()=>this._update(!0)),this.on("terrain",()=>{this.painter.terrainFacilitator.dirty=!0,this._update(!0)}),this.once("idle",()=>{this._idleTriggered=!0}),typeof window<"u"){addEventListener("online",this._onWindowOnline,!1);let l=!1,u=Ite(c=>{this._trackResize&&!this._removed&&(this.resize(c),this.redraw())},50);this._resizeObserver=new ResizeObserver(c=>{if(!l){l=!0;return}u(c)}),this._resizeObserver.observe(this._container)}this.handlers=new gLe(this,i);let o=typeof i.hash=="string"&&i.hash||void 0;this._hash=i.hash&&new vze(o).addTo(this),(!this._hash||!this._hash._onHashChange())&&(this.jumpTo({center:i.center,elevation:i.elevation,zoom:i.zoom,bearing:i.bearing,pitch:i.pitch,roll:i.roll}),i.bounds&&(this.resize(),this.fitBounds(i.bounds,tr({},i.fitBoundsOptions,{duration:0}))));let s=typeof i.style=="string"||((r=(t=i.style)==null?void 0:t.projection)==null?void 0:r.type)!=="globe";this.resize(null,s),this._localIdeographFontFamily=i.localIdeographFontFamily,this._validateStyle=i.validateStyle,i.style&&this.setStyle(i.style,{localIdeographFontFamily:i.localIdeographFontFamily}),i.attributionControl&&this.addControl(new vLe(typeof i.attributionControl=="boolean"?void 0:i.attributionControl)),i.maplibreLogo&&this.addControl(new xLe,i.logoPosition),this.on("style.load",()=>{if(s||this._resizeTransform(),this.transform.unmodified){let l=e_(this.style.stylesheet,["center","zoom","bearing","pitch","roll"]);this.jumpTo(l)}}),this.on("data",l=>{this._update(l.dataType==="style"),this.fire(new kt("".concat(l.dataType,"data"),l))}),this.on("dataloading",l=>{this.fire(new kt("".concat(l.dataType,"dataloading"),l))}),this.on("dataabort",l=>{this.fire(new kt("sourcedataabort",l))})}_getMapId(){return this._mapId}setGlobalStateProperty(e,t){return this.style.setGlobalStateProperty(e,t),this._update(!0)}getGlobalState(){return this.style.getGlobalState()}addControl(e,t){if(t===void 0&&(e.getDefaultPosition?t=e.getDefaultPosition():t="top-right"),!e||!e.onAdd)return this.fire(new yr(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));let r=e.onAdd(this);this._controls.push(e);let i=this._controlPositions[t];return t.indexOf("bottom")!==-1?i.insertBefore(r,i.firstChild):i.appendChild(r),this}removeControl(e){if(!e||!e.onRemove)return this.fire(new yr(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));let t=this._controls.indexOf(e);return t>-1&&this._controls.splice(t,1),e.onRemove(this),this}hasControl(e){return this._controls.indexOf(e)>-1}calculateCameraOptionsFromTo(e,t,r,i){return i==null&&this.terrain&&(i=this.terrain.getElevationForLngLatZoom(r,this.transform.tileZoom)),super.calculateCameraOptionsFromTo(e,t,r,i)}resize(e,t=!0){let[r,i]=this._containerDimensions(),n=this._getClampedPixelRatio(r,i);if(this._resizeCanvas(r,i,n),this.painter.resize(r,i,n),this.painter.overLimit()){let o=this.painter.context.gl;this._maxCanvasSize=[o.drawingBufferWidth,o.drawingBufferHeight];let s=this._getClampedPixelRatio(r,i);this._resizeCanvas(r,i,s),this.painter.resize(r,i,s)}this._resizeTransform(t);let a=!this._moving;return a&&(this.stop(),this.fire(new kt("movestart",e)).fire(new kt("move",e))),this.fire(new kt("resize",e)),a&&this.fire(new kt("moveend",e)),this}_resizeTransform(e=!0){var t;let[r,i]=this._containerDimensions();this.transform.resize(r,i,e),(t=this._requestedCameraState)==null||t.resize(r,i,e)}_getClampedPixelRatio(e,t){let{0:r,1:i}=this._maxCanvasSize,n=this.getPixelRatio(),a=e*n,o=t*n,s=a>r?r/a:1,l=o>i?i/o:1;return Math.min(s,l)*n}getPixelRatio(){var e;return(e=this._overridePixelRatio)!=null?e:devicePixelRatio}setPixelRatio(e){this._overridePixelRatio=e,this.resize()}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(e){return this.transform.setMaxBounds(vh.convert(e)),this._update()}setMinZoom(e){if(e=e!=null?e:XS,e>=XS&&e<=this.transform.maxZoom)return this.transform.setMinZoom(e),this._update(),this.getZoom()<e&&this.setZoom(e),this;throw new Error("minZoom must be between ".concat(XS," and the current maxZoom, inclusive"))}getMinZoom(){return this.transform.minZoom}setMaxZoom(e){if(e=e!=null?e:Tte,e>=this.transform.minZoom)return this.transform.setMaxZoom(e),this._update(),this.getZoom()>e&&this.setZoom(e),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(e){if(e=e!=null?e:jd,e<jd)throw new Error("minPitch must be greater than or equal to ".concat(jd));if(e>=jd&&e<=this.transform.maxPitch)return this.transform.setMinPitch(e),this._update(),this.getPitch()<e&&this.setPitch(e),this;throw new Error("minPitch must be between ".concat(jd," and the current maxPitch, inclusive"))}getMinPitch(){return this.transform.minPitch}setMaxPitch(e){if(e=e!=null?e:Pte,e>TS)throw new Error("maxPitch must be less than or equal to ".concat(TS));if(e>=this.transform.minPitch)return this.transform.setMaxPitch(e),this._update(),this.getPitch()>e&&this.setPitch(e),this;throw new Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(e){return this.transform.setRenderWorldCopies(e),this._update()}project(e){return this.transform.locationToScreenPoint(wr.convert(e),this.style&&this.terrain)}unproject(e){return this.transform.screenPointToLocation(Ld.default.convert(e),this.terrain)}isMoving(){var e;return this._moving||((e=this.handlers)==null?void 0:e.isMoving())}isZooming(){var e;return this._zooming||((e=this.handlers)==null?void 0:e.isZooming())}isRotating(){var e;return this._rotating||((e=this.handlers)==null?void 0:e.isRotating())}_createDelegatedListener(e,t,r){if(e==="mouseenter"||e==="mouseover"){let i=!1;return{layers:t,listener:r,delegates:{mousemove:n=>{let a=t.filter(s=>this.getLayer(s)),o=a.length!==0?this.queryRenderedFeatures(n.point,{layers:a}):[];o.length?i||(i=!0,r.call(this,new hl(e,this,n.originalEvent,{features:o}))):i=!1},mouseout:()=>{i=!1}}}}else if(e==="mouseleave"||e==="mouseout"){let i=!1;return{layers:t,listener:r,delegates:{mousemove:n=>{let a=t.filter(o=>this.getLayer(o));(a.length!==0?this.queryRenderedFeatures(n.point,{layers:a}):[]).length?i=!0:i&&(i=!1,r.call(this,new hl(e,this,n.originalEvent)))},mouseout:n=>{i&&(i=!1,r.call(this,new hl(e,this,n.originalEvent)))}}}}else{let i=n=>{let a=t.filter(s=>this.getLayer(s)),o=a.length!==0?this.queryRenderedFeatures(n.point,{layers:a}):[];o.length&&(n.features=o,r.call(this,n),delete n.features)};return{layers:t,listener:r,delegates:{[e]:i}}}}_saveDelegatedListener(e,t){this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[e]=this._delegatedListeners[e]||[],this._delegatedListeners[e].push(t)}_removeDelegatedListener(e,t,r){if(!this._delegatedListeners||!this._delegatedListeners[e])return;let i=this._delegatedListeners[e];for(let n=0;n<i.length;n++){let a=i[n];if(a.listener===r&&a.layers.length===t.length&&a.layers.every(o=>t.includes(o))){for(let o in a.delegates)this.off(o,a.delegates[o]);i.splice(n,1);return}}}on(e,t,r){if(r===void 0)return super.on(e,t);let i=typeof t=="string"?[t]:t,n=this._createDelegatedListener(e,i,r);this._saveDelegatedListener(e,n);for(let a in n.delegates)this.on(a,n.delegates[a]);return{unsubscribe:()=>{this._removeDelegatedListener(e,i,r)}}}once(e,t,r){if(r===void 0)return super.once(e,t);let i=typeof t=="string"?[t]:t,n=this._createDelegatedListener(e,i,r);for(let a in n.delegates){let o=n.delegates[a];n.delegates[a]=(...s)=>{this._removeDelegatedListener(e,i,r),o(...s)}}this._saveDelegatedListener(e,n);for(let a in n.delegates)this.once(a,n.delegates[a]);return this}off(e,t,r){if(r===void 0)return super.off(e,t);let i=typeof t=="string"?[t]:t;return this._removeDelegatedListener(e,i,r),this}queryRenderedFeatures(e,t){if(!this.style)return[];let r,i=e instanceof Ld.default||Array.isArray(e),n=i?e:[[0,0],[this.transform.width,this.transform.height]];if(t=t||(i?{}:e)||{},n instanceof Ld.default||typeof n[0]=="number")r=[Ld.default.convert(n)];else{let a=Ld.default.convert(n[0]),o=Ld.default.convert(n[1]);r=[a,new Ld.default(o.x,a.y),o,new Ld.default(a.x,o.y),a]}return this.style.queryRenderedFeatures(r,t,this.transform)}querySourceFeatures(e,t){return this.style.querySourceFeatures(e,t)}setStyle(e,t){return t=tr({},{localIdeographFontFamily:this._localIdeographFontFamily,validate:this._validateStyle},t),t.diff!==!1&&t.localIdeographFontFamily===this._localIdeographFontFamily&&this.style&&e?(this._diffStyle(e,t),this):(this._localIdeographFontFamily=t.localIdeographFontFamily,this._updateStyle(e,t))}setTransformRequest(e){return this._requestManager.setTransformRequest(e),this}_getUIString(e){let t=this._locale[e];if(t==null)throw new Error("Missing UI string '".concat(e,"'"));return t}_updateStyle(e,t){var r,i;if(t.transformStyle&&this.style&&!this.style._loaded){this.style.once("style.load",()=>this._updateStyle(e,t));return}let n=this.style&&t.transformStyle?this.style.serialize():void 0;if(this.style&&(this.style.setEventedParent(null),this.style._remove(!e)),e)this.style=new cJ(this,t||{});else return(i=(r=this.style)==null?void 0:r.projection)==null||i.destroy(),delete this.style,this;return this.style.setEventedParent(this,{style:this.style}),typeof e=="string"?this.style.loadURL(e,t,n):this.style.loadJSON(e,t,n),this}_lazyInitEmptyStyle(){this.style||(this.style=new cJ(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(e,t){if(typeof e=="string"){let r=e,i=this._requestManager.transformRequest(r,"Style");FI(i,new AbortController).then(n=>{this._updateDiff(n.data,t)}).catch(n=>{n&&this.fire(new yr(n))})}else typeof e=="object"&&this._updateDiff(e,t)}_updateDiff(e,t){try{this.style.setState(e,t)&&this._update(!0)}catch(r){oa("Unable to perform style diff: ".concat(r.message||r.error||r,". Rebuilding the style from scratch.")),this._updateStyle(e,t)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():oa("There is no style added to the map.")}addSource(e,t){return this._lazyInitEmptyStyle(),this.style.addSource(e,t),this._update(!0)}isSourceLoaded(e){let t=this.style&&this.style.sourceCaches[e];if(t===void 0){this.fire(new yr(new Error("There is no source with ID '".concat(e,"'"))));return}return t.loaded()}setTerrain(e){if(this.style._checkLoaded(),this._terrainDataCallback&&this.style.off("data",this._terrainDataCallback),!e)this.terrain&&this.terrain.sourceCache.destruct(),this.terrain=null,this.painter.renderToTexture&&this.painter.renderToTexture.destruct(),this.painter.renderToTexture=null,this._centerClampedToGround&&this.transform.setElevation(0);else{let t=this.style.sourceCaches[e.source];if(!t)throw new Error("cannot load terrain, because there exists no source with ID: ".concat(e.source));this.terrain===null&&t.reload();for(let r in this.style._layers){let i=this.style._layers[r];i.type==="hillshade"&&i.source===e.source&&oa("You are using the same source for a hillshade layer and for 3D terrain. Please consider using two separate sources to improve rendering quality."),i.type==="color-relief"&&i.source===e.source&&oa("You are using the same source for a color-relief layer and for 3D terrain. Please consider using two separate sources to improve rendering quality.")}this.terrain=new MLe(this.painter,t,e),this.painter.renderToTexture=new ILe(this.painter,this.terrain),this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this.transform.setElevation(this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this._terrainDataCallback=r=>{var i;r.dataType==="style"?this.terrain.sourceCache.freeRtt():r.dataType==="source"&&r.tile&&(r.sourceId===e.source&&!this._elevationFreeze&&(this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this._centerClampedToGround&&this.transform.setElevation(this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom))),((i=r.source)==null?void 0:i.type)==="image"?this.terrain.sourceCache.freeRtt():this.terrain.sourceCache.freeRtt(r.tile.tileID))},this.style.on("data",this._terrainDataCallback)}return this.fire(new kt("terrain",{terrain:e})),this}getTerrain(){var e,t;return(t=(e=this.terrain)==null?void 0:e.options)!=null?t:null}areTilesLoaded(){let e=this.style&&this.style.sourceCaches;for(let t in e){let r=e[t]._tiles;for(let i in r){let n=r[i];if(!(n.state==="loaded"||n.state==="errored"))return!1}}return!0}removeSource(e){return this.style.removeSource(e),this._update(!0)}getSource(e){return this.style.getSource(e)}setSourceTileLodParams(e,t,r){if(r){let i=this.getSource(r);if(!i)throw new Error('There is no source with ID "'.concat(r,'", cannot set LOD parameters'));i.calculateTileZoom=GO(Math.max(1,e),Math.max(1,t))}else for(let i in this.style.sourceCaches)this.style.sourceCaches[i].getSource().calculateTileZoom=GO(Math.max(1,e),Math.max(1,t));return this._update(!0),this}refreshTiles(e,t){let r=this.style.sourceCaches[e];if(!r)throw new Error('There is no source cache with ID "'.concat(e,'", cannot refresh tile'));t===void 0?r.reload(!0):r.refreshTiles(t.map(i=>new sC(i.z,i.x,i.y)))}addImage(e,t,r={}){let{pixelRatio:i=1,sdf:n=!1,stretchX:a,stretchY:o,content:s,textFitWidth:l,textFitHeight:u}=r;this._lazyInitEmptyStyle();let c=0;if(t instanceof HTMLImageElement||Ah(t)){let{width:h,height:d,data:p}=ri.getImageData(t);this.style.addImage(e,{data:new Mn({width:h,height:d},p),pixelRatio:i,stretchX:a,stretchY:o,content:s,textFitWidth:l,textFitHeight:u,sdf:n,version:c})}else{if(t.width===void 0||t.height===void 0)return this.fire(new yr(new Error("Invalid arguments to map.addImage(). The second argument must be an \`HTMLImageElement\`, \`ImageData\`, \`ImageBitmap\`, or object with \`width\`, \`height\`, and \`data\` properties with the same format as \`ImageData\`")));{let{width:h,height:d,data:p}=t,f=t;return this.style.addImage(e,{data:new Mn({width:h,height:d},new Uint8Array(p)),pixelRatio:i,stretchX:a,stretchY:o,content:s,textFitWidth:l,textFitHeight:u,sdf:n,version:c,userImage:f}),f.onAdd&&f.onAdd(this,e),this}}}updateImage(e,t){let r=this.style.getImage(e);if(!r)return this.fire(new yr(new Error("The map has no image with that id. If you are adding a new image use \`map.addImage(...)\` instead.")));let i=t instanceof HTMLImageElement||Ah(t)?ri.getImageData(t):t,{width:n,height:a,data:o}=i;if(n===void 0||a===void 0)return this.fire(new yr(new Error("Invalid arguments to map.updateImage(). The second argument must be an \`HTMLImageElement\`, \`ImageData\`, \`ImageBitmap\`, or object with \`width\`, \`height\`, and \`data\` properties with the same format as \`ImageData\`")));if(n!==r.data.width||a!==r.data.height)return this.fire(new yr(new Error("The width and height of the updated image must be that same as the previous version of the image")));let s=!(t instanceof HTMLImageElement||Ah(t));return r.data.replace(o,s),this.style.updateImage(e,r),this}getImage(e){return this.style.getImage(e)}hasImage(e){return e?!!this.style.getImage(e):(this.fire(new yr(new Error("Missing required image id"))),!1)}removeImage(e){this.style.removeImage(e)}loadImage(e){return $u.getImage(this._requestManager.transformRequest(e,"Image"),new AbortController)}listImages(){return this.style.listImages()}addLayer(e,t){return this._lazyInitEmptyStyle(),this.style.addLayer(e,t),this._update(!0)}moveLayer(e,t){return this.style.moveLayer(e,t),this._update(!0)}removeLayer(e){return this.style.removeLayer(e),this._update(!0)}getLayer(e){return this.style.getLayer(e)}getLayersOrder(){return this.style.getLayersOrder()}setLayerZoomRange(e,t,r){return this.style.setLayerZoomRange(e,t,r),this._update(!0)}setFilter(e,t,r={}){return this.style.setFilter(e,t,r),this._update(!0)}getFilter(e){return this.style.getFilter(e)}setPaintProperty(e,t,r,i={}){return this.style.setPaintProperty(e,t,r,i),this._update(!0)}getPaintProperty(e,t){return this.style.getPaintProperty(e,t)}setLayoutProperty(e,t,r,i={}){return this.style.setLayoutProperty(e,t,r,i),this._update(!0)}getLayoutProperty(e,t){return this.style.getLayoutProperty(e,t)}setGlyphs(e,t={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(e,t),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}addSprite(e,t,r={}){return this._lazyInitEmptyStyle(),this.style.addSprite(e,t,r,i=>{i||this._update(!0)}),this}removeSprite(e){return this._lazyInitEmptyStyle(),this.style.removeSprite(e),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(e,t={}){return this._lazyInitEmptyStyle(),this.style.setSprite(e,t,r=>{r||this._update(!0)}),this}setLight(e,t={}){return this._lazyInitEmptyStyle(),this.style.setLight(e,t),this._update(!0)}getLight(){return this.style.getLight()}setSky(e,t={}){return this._lazyInitEmptyStyle(),this.style.setSky(e,t),this._update(!0)}getSky(){return this.style.getSky()}setFeatureState(e,t){return this.style.setFeatureState(e,t),this._update()}removeFeatureState(e,t){return this.style.removeFeatureState(e,t),this._update()}getFeatureState(e){return this.style.getFeatureState(e)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let e=0,t=0;return this._container&&(e=this._container.clientWidth||400,t=this._container.clientHeight||300),[e,t]}_setupContainer(){let e=this._container;e.classList.add("maplibregl-map");let t=this._canvasContainer=ui.create("div","maplibregl-canvas-container",e);this._interactive&&t.classList.add("maplibregl-interactive"),this._canvas=ui.create("canvas","maplibregl-canvas",t),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex",this._interactive?"0":"-1"),this._canvas.setAttribute("aria-label",this._getUIString("Map.Title")),this._canvas.setAttribute("role","region");let r=this._containerDimensions(),i=this._getClampedPixelRatio(r[0],r[1]);this._resizeCanvas(r[0],r[1],i);let n=this._controlContainer=ui.create("div","maplibregl-control-container",e),a=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(o=>{a[o]=ui.create("div","maplibregl-ctrl-".concat(o," "),n)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(e,t,r){this._canvas.width=Math.floor(r*e),this._canvas.height=Math.floor(r*t),this._canvas.style.width="".concat(e,"px"),this._canvas.style.height="".concat(t,"px")}_setupPainter(){let e=bt(ze({},this._canvasContextAttributes),{alpha:!0,depth:!0,stencil:!0,premultipliedAlpha:!0}),t=null;this._canvas.addEventListener("webglcontextcreationerror",i=>{t={requestedAttributes:e},i&&(t.statusMessage=i.statusMessage,t.type=i.type)},{once:!0});let r=null;if(this._canvasContextAttributes.contextType?r=this._canvas.getContext(this._canvasContextAttributes.contextType,e):r=this._canvas.getContext("webgl2",e)||this._canvas.getContext("webgl",e),!r){let i="Failed to initialize WebGL";throw t?(t.message=i,new Error(JSON.stringify(t))):new Error(i)}this.painter=new yze(r,this.transform),NN.testSupport(r)}migrateProjection(e,t){super.migrateProjection(e,t),this.painter.transform=e,this.fire(new kt("projectiontransition",{newProjection:this.style.projection.name}))}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(e){return!this.style||!this.style._loaded?this:(this._styleDirty=this._styleDirty||e,this._sourcesDirty=!0,this.triggerRepaint(),this)}_requestRenderFrame(e){return this._update(),this._renderTaskQueue.add(e)}_cancelRenderFrame(e){this._renderTaskQueue.remove(e)}_render(e){var t,r,i,n,a;let o=this._idleTriggered?this._fadeDuration:0,s=((t=this.style.projection)==null?void 0:t.transitionState)>0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(e),this._removed)return;let l=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;let h=this.transform.zoom,d=ri.now();this.style.zoomHistory.update(h,d);let p=new ea(h,{now:d,fadeDuration:o,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition(),globalState:this.style.getGlobalState()}),f=p.crossFadingFactor();(f!==1||f!==this._crossFadingFactor)&&(l=!0,this._crossFadingFactor=f),this.style.update(p)}let u=((r=this.style.projection)==null?void 0:r.transitionState)>0!==s;(i=this.style.projection)==null||i.setErrorQueryLatitudeDegrees(this.transform.center.lat),this.transform.setTransitionState((n=this.style.projection)==null?void 0:n.transitionState,(a=this.style.projection)==null?void 0:a.latitudeErrorCorrectionRadians),this.style&&(this._sourcesDirty||u)&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.terrain?(this.terrain.sourceCache.update(this.transform,this.terrain),this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),!this._elevationFreeze&&this._centerClampedToGround&&this.transform.setElevation(this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom))):this._centerClampedToGround&&this.transform.setElevation(0),this._placementDirty=this.style&&this.style._updatePlacement(this.transform,this.showCollisionBoxes,o,this._crossSourceCollisions,u),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:o,showPadding:this.showPadding}),this.fire(new kt("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,nx.mark("load"),this.fire(new kt("load"))),this.style&&(this.style.hasTransitions()||l)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();let c=this._sourcesDirty||this._styleDirty||this._placementDirty;return c||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new kt("idle")),this._loaded&&!this._fullyLoaded&&!c&&(this._fullyLoaded=!0,nx.mark("fullLoad")),this}redraw(){return this.style&&(this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._render(0)),this}remove(){var e;this._hash&&this._hash.remove();for(let r of this._controls)r.onRemove(this);this._controls=[],this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._renderTaskQueue.clear(),this.painter.destroy(),this.handlers.destroy(),delete this.handlers,this.setStyle(null),typeof window<"u"&&removeEventListener("online",this._onWindowOnline,!1),$u.removeThrottleControl(this._imageQueueHandle),(e=this._resizeObserver)==null||e.disconnect();let t=this.painter.context.gl.getExtension("WEBGL_lose_context");t!=null&&t.loseContext&&t.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),ui.remove(this._canvasContainer),ui.remove(this._controlContainer),this._container.removeEventListener("scroll",this._onMapScroll,!1),this._container.classList.remove("maplibregl-map"),nx.clearMetrics(),this._removed=!0,this.fire(new kt("remove"))}triggerRepaint(){this.style&&!this._frameRequest&&(this._frameRequest=new AbortController,ri.frame(this._frameRequest,e=>{nx.frame(e),this._frameRequest=null;try{this._render(e)}catch(t){if(!iSe(t)&&!IFe(t))throw t}},()=>{}))}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(e){this._showTileBoundaries!==e&&(this._showTileBoundaries=e,this._update())}get showPadding(){return!!this._showPadding}set showPadding(e){this._showPadding!==e&&(this._showPadding=e,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(e){this._showCollisionBoxes!==e&&(this._showCollisionBoxes=e,e?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(e){this._showOverdrawInspector!==e&&(this._showOverdrawInspector=e,this._update())}get repaint(){return!!this._repaint}set repaint(e){this._repaint!==e&&(this._repaint=e,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(e){this._vertices=e,this._update()}get version(){return BLe}getCameraTargetElevation(){return this.transform.elevation}getProjection(){return this.style.getProjection()}setProjection(e){return this._lazyInitEmptyStyle(),this.style.setProjection(e),this._update(!0)}},vat=Er(zr(),1),xat=Er(zr(),1),_at=Er(zr(),1),bat=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", "),TLe=Er(zr(),1),wat=lK.version;XU=TLe.default;H();JU={top:0,bottom:0,left:0,right:0,type:"pixel"},ax={enabled:!1,thickness:0,size:0,offset:0,segments:3};KU="mappedin",hs={MASKS:12,GEOMETRY:0,IMAGE_MESH:1,XRAY_PATH:9,STENCIL_PATH:10,ALWAYS_ON_TOP_PATHS:11,ALWAYS_ON_TOP_MODELS:12},uc={SHOULD_CAST_SHADOWS:30},cA={PATH:1,UNDERGROUND_MASK:251,CLIPPING_BASELINE:252},qU=250,bh={tension:0,cornerRadius:.5};H();H();H();Rte=e=>t=>{if(!t.includes("mappedin")){let r={};for(let i in e){let n=e[i];t.includes("mappedin")||(e[i]=n)}return{url:t,headers:r}}return{url:t,headers:e}};H();H();PLe=1e4;H();H();H();H();H();H();H();H();Fo=63710088e-1,zte={centimeters:Fo*100,centimetres:Fo*100,degrees:Fo/111325,feet:Fo*3.28084,inches:Fo*39.37,kilometers:Fo/1e3,kilometres:Fo/1e3,meters:Fo,metres:Fo,miles:Fo/1609.344,millimeters:Fo*1e3,millimetres:Fo*1e3,nauticalmiles:Fo/1852,radians:1,yards:Fo*1.0936},Eat={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/Fo,yards:1.0936133};$O.default=$O;op=$O;H();H();FLe=new Set(Object.keys(Dt.NAMES)),zLe=e=>FLe.has(e.toLowerCase()),LLe=e=>{if(!e.startsWith("#"))return!1;let t=e.slice(1);if(t.length!==3&&t.length!==6)return!1;for(let r=0;r<t.length;r++)if(!(t[r]>="0"&&t[r]<="9"||t[r]>="A"&&t[r]<="F"||t[r]>="a"&&t[r]<="f"))return!1;return!0},OLe=e=>{if(!e.startsWith("rgb(")&&!e.startsWith("rgba("))return!1;let t=e.indexOf("("),r=e.lastIndexOf(")");if(t===-1||r===-1||r<=t||r!==e.length-1)return!1;let i=e.slice(t+1,r).split(",");if(i.length!==3&&i.length!==4)return!1;for(let n=0;n<i.length;n++){let a=i[n].trim();if(n<3)if(a.endsWith("%")){let o=parseFloat(a.slice(0,-1));if(isNaN(o)||o<0||o>100)return!1}else{let o=parseInt(a,10);if(isNaN(o)||o<0||o>255)return!1}else{let o=parseFloat(a);if(isNaN(o)||o<0||o>1)return!1}}return!0},NLe=e=>{if(!e.startsWith("hsl(")&&!e.startsWith("hsla("))return!1;let t=e.indexOf("("),r=e.lastIndexOf(")");if(t===-1||r===-1||r<=t||r!==e.length-1)return!1;let i=e.slice(t+1,r).split(",");if(i.length!==3&&i.length!==4)return!1;for(let n=0;n<i.length;n++){let a=i[n].trim();if(n===0){let o=parseFloat(a);if(isNaN(o))return!1}else if(n<3){if(!a.endsWith("%"))return!1;let o=parseFloat(a.slice(0,-1));if(isNaN(o)||o<0||o>100)return!1}else{let o=parseFloat(a);if(isNaN(o)||o<0||o>1)return!1}}return!0},Cx=e=>e==null||typeof e!="string"?!1:!!(LLe(e)||OLe(e)||NLe(e)||zLe(e));H();H();H();H();Z5=class{constructor(){I(this,"type","interaction"),I(this,"hover",!1),I(this,"dirty",!1)}};H();ULe=Object.create,AC=Object.defineProperty,QLe=Object.getOwnPropertyDescriptor,jLe=Object.getOwnPropertyNames,MJ=Object.getOwnPropertySymbols,GLe=Object.getPrototypeOf,Qte=Object.prototype.hasOwnProperty,VLe=Object.prototype.propertyIsEnumerable,jte=e=>{throw TypeError(e)},eN=(e,t,r)=>t in e?AC(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Gte=(e,t)=>{for(var r in t||(t={}))Qte.call(t,r)&&eN(e,r,t[r]);if(MJ)for(var r of MJ(t))VLe.call(t,r)&&eN(e,r,t[r]);return e},Te=(e,t)=>AC(e,"name",{value:t,configurable:!0}),YLe=(e,t)=>()=>(e&&(t=e(e=0)),t),HLe=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),WLe=(e,t,r,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of jLe(t))!Qte.call(e,n)&&n!==r&&AC(e,n,{get:()=>t[n],enumerable:!(i=QLe(t,n))||i.enumerable});return e},ZLe=(e,t,r)=>(r=e!=null?ULe(GLe(e)):{},WLe(t||!e||!e.__esModule?AC(r,"default",{value:e,enumerable:!0}):r,e)),ct=(e,t,r)=>eN(e,typeof t!="symbol"?t+"":t,r),t6=(e,t,r)=>t.has(e)||jte("Cannot "+r),gt=(e,t,r)=>(t6(e,t,"read from private field"),r?r.call(e):t.get(e)),zi=(e,t,r)=>t.has(e)?jte("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),Fr=(e,t,r,i)=>(t6(e,t,"write to private field"),i?i.call(e,r):t.set(e,r),r),tN=(e,t,r)=>(t6(e,t,"access private method"),r),XLe=(e,t,r,i)=>({set _(n){Fr(e,t,n,r)},get _(){return gt(e,t,i)}}),ii=YLe(()=>{Vte={env:{NODE_ENV:"production",npm_package_version:"0.1.0"}}}),JLe=HLe((e,t)=>{ii();var r=200,i="__lodash_hash_undefined__",n=800,a=16,o=9007199254740991,s="[object Arguments]",l="[object Array]",u="[object AsyncFunction]",c="[object Boolean]",h="[object Date]",d="[object Error]",p="[object Function]",f="[object GeneratorFunction]",m="[object Map]",g="[object Number]",v="[object Null]",_="[object Object]",x="[object Proxy]",b="[object RegExp]",E="[object Set]",M="[object String]",S="[object Undefined]",D="[object WeakMap]",T="[object ArrayBuffer]",P="[object DataView]",k="[object Float32Array]",R="[object Float64Array]",F="[object Int8Array]",B="[object Int16Array]",z="[object Int32Array]",O="[object Uint8Array]",j="[object Uint8ClampedArray]",Y="[object Uint16Array]",Z="[object Uint32Array]",ne=/[\\\\^$.*+?()[\\]{}|]/g,ie=/^\\[object .+?Constructor\\]$/,le=/^(?:0|[1-9]\\d*)$/,X={};X[k]=X[R]=X[F]=X[B]=X[z]=X[O]=X[j]=X[Y]=X[Z]=!0,X[s]=X[l]=X[T]=X[c]=X[P]=X[h]=X[d]=X[p]=X[m]=X[g]=X[_]=X[b]=X[E]=X[M]=X[D]=!1;var ce=typeof global=="object"&&global&&global.Object===Object&&global,ge=typeof self=="object"&&self&&self.Object===Object&&self,be=ce||ge||Function("return this")(),_e=typeof e=="object"&&e&&!e.nodeType&&e,ke=_e&&typeof t=="object"&&t&&!t.nodeType&&t,Ye=ke&&ke.exports===_e,We=Ye&&ce.process,Me=(function(){try{var V=ke&&ke.require&&ke.require("util").types;return V||We&&We.binding&&We.binding("util")}catch(ae){}})(),Ce=Me&&Me.isTypedArray;function oe(V,ae,U){switch(U.length){case 0:return V.call(ae);case 1:return V.call(ae,U[0]);case 2:return V.call(ae,U[0],U[1]);case 3:return V.call(ae,U[0],U[1],U[2])}return V.apply(ae,U)}Te(oe,"apply");function it(V,ae){for(var U=-1,de=Array(V);++U<V;)de[U]=ae(U);return de}Te(it,"baseTimes");function Oe(V){return function(ae){return V(ae)}}Te(Oe,"baseUnary");function Ke(V,ae){return V==null?void 0:V[ae]}Te(Ke,"getValue");function Le(V,ae){return function(U){return V(ae(U))}}Te(Le,"overArg");var Ze=Array.prototype,ut=Function.prototype,et=Object.prototype,te=be["__core-js_shared__"],K=ut.toString,ve=et.hasOwnProperty,je=(function(){var V=/[^.]+$/.exec(te&&te.keys&&te.keys.IE_PROTO||"");return V?"Symbol(src)_1."+V:""})(),Ne=et.toString,Ue=K.call(Object),ft=RegExp("^"+K.call(ve).replace(ne,"\\\\$&").replace(/hasOwnProperty|(function).*?(?=\\\\\\()| for .+?(?=\\\\\\])/g,"$1.*?")+"$"),ot=Ye?be.Buffer:void 0,Ae=be.Symbol,Q=be.Uint8Array,G=ot?ot.allocUnsafe:void 0,W=Le(Object.getPrototypeOf,Object),re=Object.create,$=et.propertyIsEnumerable,me=Ze.splice,ye=Ae?Ae.toStringTag:void 0,Be=(function(){try{var V=Nt(Object,"defineProperty");return V({},"",{}),V}catch(ae){}})(),Ge=ot?ot.isBuffer:void 0,ue=Math.max,pe=Date.now,we=Nt(be,"Map"),Ie=Nt(Object,"create"),nt=(function(){function V(){}return Te(V,"object"),function(ae){if(!si(ae))return{};if(re)return re(ae);V.prototype=ae;var U=new V;return V.prototype=void 0,U}})();function lt(V){var ae=-1,U=V==null?0:V.length;for(this.clear();++ae<U;){var de=V[ae];this.set(de[0],de[1])}}Te(lt,"Hash");function $e(){this.__data__=Ie?Ie(null):{},this.size=0}Te($e,"hashClear");function He(V){var ae=this.has(V)&&delete this.__data__[V];return this.size-=ae?1:0,ae}Te(He,"hashDelete");function wt(V){var ae=this.__data__;if(Ie){var U=ae[V];return U===i?void 0:U}return ve.call(ae,V)?ae[V]:void 0}Te(wt,"hashGet");function Yt(V){var ae=this.__data__;return Ie?ae[V]!==void 0:ve.call(ae,V)}Te(Yt,"hashHas");function ur(V,ae){var U=this.__data__;return this.size+=this.has(V)?0:1,U[V]=Ie&&ae===void 0?i:ae,this}Te(ur,"hashSet"),lt.prototype.clear=$e,lt.prototype.delete=He,lt.prototype.get=wt,lt.prototype.has=Yt,lt.prototype.set=ur;function Qt(V){var ae=-1,U=V==null?0:V.length;for(this.clear();++ae<U;){var de=V[ae];this.set(de[0],de[1])}}Te(Qt,"ListCache");function Lr(){this.__data__=[],this.size=0}Te(Lr,"listCacheClear");function Vr(V){var ae=this.__data__,U=Ee(ae,V);if(U<0)return!1;var de=ae.length-1;return U==de?ae.pop():me.call(ae,U,1),--this.size,!0}Te(Vr,"listCacheDelete");function Dr(V){var ae=this.__data__,U=Ee(ae,V);return U<0?void 0:ae[U][1]}Te(Dr,"listCacheGet");function Xr(V){return Ee(this.__data__,V)>-1}Te(Xr,"listCacheHas");function yi(V,ae){var U=this.__data__,de=Ee(U,V);return de<0?(++this.size,U.push([V,ae])):U[de][1]=ae,this}Te(yi,"listCacheSet"),Qt.prototype.clear=Lr,Qt.prototype.delete=Vr,Qt.prototype.get=Dr,Qt.prototype.has=Xr,Qt.prototype.set=yi;function Mr(V){var ae=-1,U=V==null?0:V.length;for(this.clear();++ae<U;){var de=V[ae];this.set(de[0],de[1])}}Te(Mr,"MapCache");function Yr(){this.size=0,this.__data__={hash:new lt,map:new(we||Qt),string:new lt}}Te(Yr,"mapCacheClear");function vi(V){var ae=vn(this,V).delete(V);return this.size-=ae?1:0,ae}Te(vi,"mapCacheDelete");function Ri(V){return vn(this,V).get(V)}Te(Ri,"mapCacheGet");function va(V){return vn(this,V).has(V)}Te(va,"mapCacheHas");function xa(V,ae){var U=vn(this,V),de=U.size;return U.set(V,ae),this.size+=U.size==de?0:1,this}Te(xa,"mapCacheSet"),Mr.prototype.clear=Yr,Mr.prototype.delete=vi,Mr.prototype.get=Ri,Mr.prototype.has=va,Mr.prototype.set=xa;function Bi(V){var ae=this.__data__=new Qt(V);this.size=ae.size}Te(Bi,"Stack");function co(){this.__data__=new Qt,this.size=0}Te(co,"stackClear");function qa(V){var ae=this.__data__,U=ae.delete(V);return this.size=ae.size,U}Te(qa,"stackDelete");function Pe(V){return this.__data__.get(V)}Te(Pe,"stackGet");function Vt(V){return this.__data__.has(V)}Te(Vt,"stackHas");function ee(V,ae){var U=this.__data__;if(U instanceof Qt){var de=U.__data__;if(!we||de.length<r-1)return de.push([V,ae]),this.size=++U.size,this;U=this.__data__=new Mr(de)}return U.set(V,ae),this.size=U.size,this}Te(ee,"stackSet"),Bi.prototype.clear=co,Bi.prototype.delete=qa,Bi.prototype.get=Pe,Bi.prototype.has=Vt,Bi.prototype.set=ee;function Re(V,ae){var U=$t(V),de=!U&&xt(V),Fe=!U&&!de&&nr(V),mt=!U&&!de&&!Fe&&_s(V),Ut=U||de||Fe||mt,Mt=Ut?it(V.length,String):[],Ht=Mt.length;for(var Jt in V)(ae||ve.call(V,Jt))&&!(Ut&&(Jt=="length"||Fe&&(Jt=="offset"||Jt=="parent")||mt&&(Jt=="buffer"||Jt=="byteLength"||Jt=="byteOffset")||bi(Jt,Ht)))&&Mt.push(Jt);return Mt}Te(Re,"arrayLikeKeys");function qe(V,ae,U){(U!==void 0&&!st(V[ae],U)||U===void 0&&!(ae in V))&&At(V,ae,U)}Te(qe,"assignMergeValue");function Xe(V,ae,U){var de=V[ae];(!(ve.call(V,ae)&&st(de,U))||U===void 0&&!(ae in V))&&At(V,ae,U)}Te(Xe,"assignValue");function Ee(V,ae){for(var U=V.length;U--;)if(st(V[U][0],ae))return U;return-1}Te(Ee,"assocIndexOf");function At(V,ae,U){ae=="__proto__"&&Be?Be(V,ae,{configurable:!0,enumerable:!0,value:U,writable:!0}):V[ae]=U}Te(At,"baseAssignValue");var Lt=dn();function Bt(V){return V==null?V===void 0?S:v:ye&&ye in Object(V)?tn(V):L(V)}Te(Bt,"baseGetTag");function Ft(V){return fi(V)&&Bt(V)==s}Te(Ft,"baseIsArguments");function hr(V){if(!si(V)||y(V))return!1;var ae=_r(V)?ft:ie;return ae.test(Ve(V))}Te(hr,"baseIsNative");function rr(V){return fi(V)&&ci(V.length)&&!!X[Bt(V)]}Te(rr,"baseIsTypedArray");function fr(V){if(!si(V))return C(V);var ae=w(V),U=[];for(var de in V)de=="constructor"&&(ae||!ve.call(V,de))||U.push(de);return U}Te(fr,"baseKeysIn");function Br(V,ae,U,de,Fe){V!==ae&&Lt(ae,function(mt,Ut){if(Fe||(Fe=new Bi),si(mt))Jr(V,ae,Ut,U,Br,de,Fe);else{var Mt=de?de(q(V,Ut),mt,Ut+"",V,ae,Fe):void 0;Mt===void 0&&(Mt=mt),qe(V,Ut,Mt)}},Tl)}Te(Br,"baseMerge");function Jr(V,ae,U,de,Fe,mt,Ut){var Mt=q(V,U),Ht=q(ae,U),Jt=Ut.get(Ht);if(Jt){qe(V,U,Jt);return}var xr=mt?mt(Mt,Ht,U+"",V,ae,Ut):void 0,Yi=xr===void 0;if(Yi){var fn=$t(Ht),ho=!fn&&nr(Ht),Dl=!fn&&!ho&&_s(Ht);xr=Ht,fn||ho||Dl?$t(Mt)?xr=Mt:ar(Mt)?xr=ca(Mt):ho?(Yi=!1,xr=oi(Ht,!0)):Dl?(Yi=!1,xr=Qi(Ht,!0)):xr=[]:Dn(Ht)||xt(Ht)?(xr=Mt,xt(Mt)?xr=eo(Mt):(!si(Mt)||_r(Mt))&&(xr=pn(Ht))):Yi=!1}Yi&&(Ut.set(Ht,xr),Fe(xr,Ht,de,mt,Ut),Ut.delete(Ht)),qe(V,U,xr)}Te(Jr,"baseMergeDeep");function _i(V,ae){return se(N(V,ae,Pl),V+"")}Te(_i,"baseRest");var ai=Be?function(V,ae){return Be(V,"toString",{configurable:!0,enumerable:!1,value:Cu(ae),writable:!0})}:Pl;function oi(V,ae){if(ae)return V.slice();var U=V.length,de=G?G(U):new V.constructor(U);return V.copy(de),de}Te(oi,"cloneBuffer");function sr(V){var ae=new V.constructor(V.byteLength);return new Q(ae).set(new Q(V)),ae}Te(sr,"cloneArrayBuffer");function Qi(V,ae){var U=ae?sr(V.buffer):V.buffer;return new V.constructor(U,V.byteOffset,V.length)}Te(Qi,"cloneTypedArray");function ca(V,ae){var U=-1,de=V.length;for(ae||(ae=Array(de));++U<de;)ae[U]=V[U];return ae}Te(ca,"copyArray");function Hr(V,ae,U,de){var Fe=!U;U||(U={});for(var mt=-1,Ut=ae.length;++mt<Ut;){var Mt=ae[mt],Ht=de?de(U[Mt],V[Mt],Mt,U,V):void 0;Ht===void 0&&(Ht=V[Mt]),Fe?At(U,Mt,Ht):Xe(U,Mt,Ht)}return U}Te(Hr,"copyObject");function _a(V){return _i(function(ae,U){var de=-1,Fe=U.length,mt=Fe>1?U[Fe-1]:void 0,Ut=Fe>2?U[2]:void 0;for(mt=V.length>3&&typeof mt=="function"?(Fe--,mt):void 0,Ut&&Pn(U[0],U[1],Ut)&&(mt=Fe<3?void 0:mt,Fe=1),ae=Object(ae);++de<Fe;){var Mt=U[de];Mt&&V(ae,Mt,de,mt)}return ae})}Te(_a,"createAssigner");function dn(V){return function(ae,U,de){for(var Fe=-1,mt=Object(ae),Ut=de(ae),Mt=Ut.length;Mt--;){var Ht=Ut[V?Mt:++Fe];if(U(mt[Ht],Ht,mt)===!1)break}return ae}}Te(dn,"createBaseFor");function vn(V,ae){var U=V.__data__;return $a(ae)?U[typeof ae=="string"?"string":"hash"]:U.map}Te(vn,"getMapData");function Nt(V,ae){var U=Ke(V,ae);return hr(U)?U:void 0}Te(Nt,"getNative");function tn(V){var ae=ve.call(V,ye),U=V[ye];try{V[ye]=void 0;var de=!0}catch(mt){}var Fe=Ne.call(V);return de&&(ae?V[ye]=U:delete V[ye]),Fe}Te(tn,"getRawTag");function pn(V){return typeof V.constructor=="function"&&!w(V)?nt(W(V)):{}}Te(pn,"initCloneObject");function bi(V,ae){var U=typeof V;return ae=ae==null?o:ae,!!ae&&(U=="number"||U!="symbol"&&le.test(V))&&V>-1&&V%1==0&&V<ae}Te(bi,"isIndex");function Pn(V,ae,U){if(!si(U))return!1;var de=typeof ae;return(de=="number"?Et(U)&&bi(ae,U.length):de=="string"&&ae in U)?st(U[ae],V):!1}Te(Pn,"isIterateeCall");function $a(V){var ae=typeof V;return ae=="string"||ae=="number"||ae=="symbol"||ae=="boolean"?V!=="__proto__":V===null}Te($a,"isKeyable");function y(V){return!!je&&je in V}Te(y,"isMasked");function w(V){var ae=V&&V.constructor,U=typeof ae=="function"&&ae.prototype||et;return V===U}Te(w,"isPrototype");function C(V){var ae=[];if(V!=null)for(var U in Object(V))ae.push(U);return ae}Te(C,"nativeKeysIn");function L(V){return Ne.call(V)}Te(L,"objectToString");function N(V,ae,U){return ae=ue(ae===void 0?V.length-1:ae,0),function(){for(var de=arguments,Fe=-1,mt=ue(de.length-ae,0),Ut=Array(mt);++Fe<mt;)Ut[Fe]=de[ae+Fe];Fe=-1;for(var Mt=Array(ae+1);++Fe<ae;)Mt[Fe]=de[Fe];return Mt[ae]=U(Ut),oe(V,this,Mt)}}Te(N,"overRest");function q(V,ae){if(!(ae==="constructor"&&typeof V[ae]=="function")&&ae!="__proto__")return V[ae]}Te(q,"safeGet");var se=Se(ai);function Se(V){var ae=0,U=0;return function(){var de=pe(),Fe=a-(de-U);if(U=de,Fe>0){if(++ae>=n)return arguments[0]}else ae=0;return V.apply(void 0,arguments)}}Te(Se,"shortOut");function Ve(V){if(V!=null){try{return K.call(V)}catch(ae){}try{return V+""}catch(ae){}}return""}Te(Ve,"toSource");function st(V,ae){return V===ae||V!==V&&ae!==ae}Te(st,"eq");var xt=Ft((function(){return arguments})())?Ft:function(V){return fi(V)&&ve.call(V,"callee")&&!$.call(V,"callee")},$t=Array.isArray;function Et(V){return V!=null&&ci(V.length)&&!_r(V)}Te(Et,"isArrayLike");function ar(V){return fi(V)&&Et(V)}Te(ar,"isArrayLikeObject");var nr=Ge||qs;function _r(V){if(!si(V))return!1;var ae=Bt(V);return ae==p||ae==f||ae==u||ae==x}Te(_r,"isFunction");function ci(V){return typeof V=="number"&&V>-1&&V%1==0&&V<=o}Te(ci,"isLength");function si(V){var ae=typeof V;return V!=null&&(ae=="object"||ae=="function")}Te(si,"isObject");function fi(V){return V!=null&&typeof V=="object"}Te(fi,"isObjectLike");function Dn(V){if(!fi(V)||Bt(V)!=_)return!1;var ae=W(V);if(ae===null)return!0;var U=ve.call(ae,"constructor")&&ae.constructor;return typeof U=="function"&&U instanceof U&&K.call(U)==Ue}Te(Dn,"isPlainObject");var _s=Ce?Oe(Ce):rr;function eo(V){return Hr(V,Tl(V))}Te(eo,"toPlainObject");function Tl(V){return Et(V)?Re(V,!0):fr(V)}Te(Tl,"keysIn");var Vc=_a(function(V,ae,U){Br(V,ae,U)});function Cu(V){return function(){return V}}Te(Cu,"constant");function Pl(V){return V}Te(Pl,"identity");function qs(){return!1}Te(qs,"stubFalse"),t.exports=Vc});ii();ii();Yte=class{constructor(e,t,r=0,i){ct(this,"id"),ct(this,"type"),ct(this,"component"),ct(this,"worldPosition"),ct(this,"verticalOffset"),ct(this,"disposed",!1),ct(this,"positionDirty",!0),ct(this,"parentId"),this.id=e.id,this.component=e,this.type=e.type,this.worldPosition={x:t.x,y:t.y,z:t.z+r},this.verticalOffset=r,this.parentId=i}updatePosition(e,t,r){this.worldPosition.x=e,this.worldPosition.y=t,this.worldPosition.z=r,this.positionDirty=!0}setAltitude(e){this.worldPosition.z=e,this.positionDirty=!0}};Te(Yte,"Entity2D");KLe=Yte;ii();ii();ii();X5=[0,4,6,8,10],Hte=Te(()=>{let e=new Array(16).fill(0),t=Math.random()*4294967296;for(let i=0;i<e.length;i++)i>0&&(i&3)===0&&(t=Math.random()*4294967296),e[i]=t>>>((i&3)<<3)&255;let r=e.map(i=>i.toString(16).padStart(2,"0"));return r[6]="4"+r[6][1],r[8]=["8","9","a","b"].includes(r[7][0])?r[7]:"a"+r[7][1],X5.map((i,n)=>r.slice(i,n===X5.length-1?void 0:X5[n+1]).join("")).join("-")},"randomId");ii();ii();mC=J.union([J.enum(["low","medium","high","always-visible"]),J.number()]),Wte=["","","low","medium","high","always-visible"];Te(r6,"clampTierNumber");Te(gC,"convertCollisionRankingTierToNumber");Te(yy,"convertNumberToCollisionRankingTier");ii();qLe=(e=>(e[e.ACTIVE=1]="ACTIVE",e[e.INACTIVE=.5]="INACTIVE",e[e.HIDDEN=0]="HIDDEN",e))(qLe||{}),$Le=(e=>(e.LEFT="left",e.CENTER="center",e.RIGHT="right",e))($Le||{});ii();ii();Te(Jx,"_typeof");e5e=/^\\s+/,t5e=/\\s+$/;Te(dr,"tinycolor");dr.prototype={isDark:Te(function(){return this.getBrightness()<128},"isDark"),isLight:Te(function(){return!this.isDark()},"isLight"),isValid:Te(function(){return this._ok},"isValid"),getOriginalInput:Te(function(){return this._originalInput},"getOriginalInput"),getFormat:Te(function(){return this._format},"getFormat"),getAlpha:Te(function(){return this._a},"getAlpha"),getBrightness:Te(function(){var e=this.toRgb();return(e.r*299+e.g*587+e.b*114)/1e3},"getBrightness"),getLuminance:Te(function(){var e=this.toRgb(),t,r,i,n,a,o;return t=e.r/255,r=e.g/255,i=e.b/255,t<=.03928?n=t/12.92:n=Math.pow((t+.055)/1.055,2.4),r<=.03928?a=r/12.92:a=Math.pow((r+.055)/1.055,2.4),i<=.03928?o=i/12.92:o=Math.pow((i+.055)/1.055,2.4),.2126*n+.7152*a+.0722*o},"getLuminance"),setAlpha:Te(function(e){return this._a=i6(e),this._roundA=Math.round(100*this._a)/100,this},"setAlpha"),toHsv:Te(function(){var e=iN(this._r,this._g,this._b);return{h:e.h*360,s:e.s,v:e.v,a:this._a}},"toHsv"),toHsvString:Te(function(){var e=iN(this._r,this._g,this._b),t=Math.round(e.h*360),r=Math.round(e.s*100),i=Math.round(e.v*100);return this._a==1?"hsv("+t+", "+r+"%, "+i+"%)":"hsva("+t+", "+r+"%, "+i+"%, "+this._roundA+")"},"toHsvString"),toHsl:Te(function(){var e=rN(this._r,this._g,this._b);return{h:e.h*360,s:e.s,l:e.l,a:this._a}},"toHsl"),toHslString:Te(function(){var e=rN(this._r,this._g,this._b),t=Math.round(e.h*360),r=Math.round(e.s*100),i=Math.round(e.l*100);return this._a==1?"hsl("+t+", "+r+"%, "+i+"%)":"hsla("+t+", "+r+"%, "+i+"%, "+this._roundA+")"},"toHslString"),toHex:Te(function(e){return nN(this._r,this._g,this._b,e)},"toHex"),toHexString:Te(function(e){return"#"+this.toHex(e)},"toHexString"),toHex8:Te(function(e){return qte(this._r,this._g,this._b,this._a,e)},"toHex8"),toHex8String:Te(function(e){return"#"+this.toHex8(e)},"toHex8String"),toRgb:Te(function(){return{r:Math.round(this._r),g:Math.round(this._g),b:Math.round(this._b),a:this._a}},"toRgb"),toRgbString:Te(function(){return this._a==1?"rgb("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+")":"rgba("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+", "+this._roundA+")"},"toRgbString"),toPercentageRgb:Te(function(){return{r:Math.round(En(this._r,255)*100)+"%",g:Math.round(En(this._g,255)*100)+"%",b:Math.round(En(this._b,255)*100)+"%",a:this._a}},"toPercentageRgb"),toPercentageRgbString:Te(function(){return this._a==1?"rgb("+Math.round(En(this._r,255)*100)+"%, "+Math.round(En(this._g,255)*100)+"%, "+Math.round(En(this._b,255)*100)+"%)":"rgba("+Math.round(En(this._r,255)*100)+"%, "+Math.round(En(this._g,255)*100)+"%, "+Math.round(En(this._b,255)*100)+"%, "+this._roundA+")"},"toPercentageRgbString"),toName:Te(function(){return this._a===0?"transparent":this._a<1?!1:r5e[nN(this._r,this._g,this._b,!0)]||!1},"toName"),toFilter:Te(function(e){var t="#"+aN(this._r,this._g,this._b,this._a),r=t,i=this._gradientType?"GradientType = 1, ":"";if(e){var n=dr(e);r="#"+aN(n._r,n._g,n._b,n._a)}return"progid:DXImageTransform.Microsoft.gradient("+i+"startColorstr="+t+",endColorstr="+r+")"},"toFilter"),toString:Te(function(e){var t=!!e;e=e||this._format;var r=!1,i=this._a<1&&this._a>=0,n=!t&&i&&(e==="hex"||e==="hex6"||e==="hex3"||e==="hex4"||e==="hex8"||e==="name");return n?e==="name"&&this._a===0?this.toName():this.toRgbString():(e==="rgb"&&(r=this.toRgbString()),e==="prgb"&&(r=this.toPercentageRgbString()),(e==="hex"||e==="hex6")&&(r=this.toHexString()),e==="hex3"&&(r=this.toHexString(!0)),e==="hex4"&&(r=this.toHex8String(!0)),e==="hex8"&&(r=this.toHex8String()),e==="name"&&(r=this.toName()),e==="hsl"&&(r=this.toHslString()),e==="hsv"&&(r=this.toHsvString()),r||this.toHexString())},"toString"),clone:Te(function(){return dr(this.toString())},"clone"),_applyModification:Te(function(e,t){var r=e.apply(null,[this].concat([].slice.call(t)));return this._r=r._r,this._g=r._g,this._b=r._b,this.setAlpha(r._a),this},"_applyModification"),lighten:Te(function(){return this._applyModification(rre,arguments)},"lighten"),brighten:Te(function(){return this._applyModification(ire,arguments)},"brighten"),darken:Te(function(){return this._applyModification(nre,arguments)},"darken"),desaturate:Te(function(){return this._applyModification($te,arguments)},"desaturate"),saturate:Te(function(){return this._applyModification(ere,arguments)},"saturate"),greyscale:Te(function(){return this._applyModification(tre,arguments)},"greyscale"),spin:Te(function(){return this._applyModification(are,arguments)},"spin"),_applyCombination:Te(function(e,t){return e.apply(null,[this].concat([].slice.call(t)))},"_applyCombination"),analogous:Te(function(){return this._applyCombination(lre,arguments)},"analogous"),complement:Te(function(){return this._applyCombination(ore,arguments)},"complement"),monochromatic:Te(function(){return this._applyCombination(ure,arguments)},"monochromatic"),splitcomplement:Te(function(){return this._applyCombination(sre,arguments)},"splitcomplement"),triad:Te(function(){return this._applyCombination(oN,[3])},"triad"),tetrad:Te(function(){return this._applyCombination(oN,[4])},"tetrad")};dr.fromRatio=function(e,t){if(Jx(e)=="object"){var r={};for(var i in e)e.hasOwnProperty(i)&&(i==="a"?r[i]=e[i]:r[i]=Zg(e[i]));e=r}return dr(e,t)};Te(Zte,"inputToRGB");Te(Xte,"rgbToRgb");Te(rN,"rgbToHsl");Te(Jte,"hslToRgb");Te(iN,"rgbToHsv");Te(Kte,"hsvToRgb");Te(nN,"rgbToHex");Te(qte,"rgbaToHex");Te(aN,"rgbaToArgbHex");dr.equals=function(e,t){return!e||!t?!1:dr(e).toRgbString()==dr(t).toRgbString()};dr.random=function(){return dr.fromRatio({r:Math.random(),g:Math.random(),b:Math.random()})};Te($te,"_desaturate");Te(ere,"_saturate");Te(tre,"_greyscale");Te(rre,"_lighten");Te(ire,"_brighten");Te(nre,"_darken");Te(are,"_spin");Te(ore,"_complement");Te(oN,"polyad");Te(sre,"_splitcomplement");Te(lre,"_analogous");Te(ure,"_monochromatic");dr.mix=function(e,t,r){r=r===0?0:r||50;var i=dr(e).toRgb(),n=dr(t).toRgb(),a=r/100,o={r:(n.r-i.r)*a+i.r,g:(n.g-i.g)*a+i.g,b:(n.b-i.b)*a+i.b,a:(n.a-i.a)*a+i.a};return dr(o)};dr.readability=function(e,t){var r=dr(e),i=dr(t);return(Math.max(r.getLuminance(),i.getLuminance())+.05)/(Math.min(r.getLuminance(),i.getLuminance())+.05)};dr.isReadable=function(e,t,r){var i=dr.readability(e,t),n,a;switch(a=!1,n=fre(r),n.level+n.size){case"AAsmall":case"AAAlarge":a=i>=4.5;break;case"AAlarge":a=i>=3;break;case"AAAsmall":a=i>=7;break}return a};dr.mostReadable=function(e,t,r){var i=null,n=0,a,o,s,l;r=r||{},o=r.includeFallbackColors,s=r.level,l=r.size;for(var u=0;u<t.length;u++)a=dr.readability(e,t[u]),a>n&&(n=a,i=dr(t[u]));return dr.isReadable(e,i,{level:s,size:l})||!o?i:(r.includeFallbackColors=!1,dr.mostReadable(e,["#fff","#000"],r))};sN=dr.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},r5e=dr.hexNames=cre(sN);Te(cre,"flip");Te(i6,"boundAlpha");Te(En,"bound01");Te(m_,"clamp01");Te(os,"parseIntFromHex");Te(hre,"isOnePointZero");Te(dre,"isPercentage");Te(pl,"pad2");Te(Zg,"convertToPercentage");Te(n6,"convertDecimalToHex");Te(lN,"convertHexToDecimal");Zl=(function(){var e="[-\\\\+]?\\\\d+%?",t="[-\\\\+]?\\\\d*\\\\.\\\\d+%?",r="(?:"+t+")|(?:"+e+")",i="[\\\\s|\\\\(]+("+r+")[,|\\\\s]+("+r+")[,|\\\\s]+("+r+")\\\\s*\\\\)?",n="[\\\\s|\\\\(]+("+r+")[,|\\\\s]+("+r+")[,|\\\\s]+("+r+")[,|\\\\s]+("+r+")\\\\s*\\\\)?";return{CSS_UNIT:new RegExp(r),rgb:new RegExp("rgb"+i),rgba:new RegExp("rgba"+n),hsl:new RegExp("hsl"+i),hsla:new RegExp("hsla"+n),hsv:new RegExp("hsv"+i),hsva:new RegExp("hsva"+n),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/}})();Te(Qu,"isValidCSSUnit");Te(pre,"stringInputToObject");Te(fre,"validateWCAG2Parms");Ia={RIGHT:"right",LEFT:"left",TOP:"top",HIDDEN:"hidden",CENTER:"center"},Ig="low-priority",yC=Object.values(Ia),g_=[Ia.RIGHT,Ia.LEFT,Ia.TOP,Ia.HIDDEN],i5e=J.string(),n5e=J.object({on:J.literal("zoom-level"),input:J.tuple([J.number()]).rest(J.number()),output:J.tuple([J.number()]).rest(J.number()),easing:i5e.default("linear")}).refine(e=>e.input.length===e.output.length,{message:"input and output must have the same length"}),a6=J.object({margin:J.number().min(6).default(6),maxLines:J.number().min(1).default(2),textSize:J.number().min(0).default(11.5),maxWidth:J.number().min(0).default(150),lineHeight:J.number().min(0).default(1.2),color:J.string().default("#333"),outlineColor:J.string().default("white"),textColor:J.string().optional(),textOutlineColor:J.string().optional(),pinColor:J.string().optional(),pinOutlineColor:J.string().optional(),pinColorInactive:J.string().optional(),pinOutlineColorInactive:J.string().optional(),icon:J.string().optional(),iconSize:J.number().min(0).default(20),iconScale:J.union([J.number(),n5e]).default(1),iconPadding:J.number().min(0).default(2),iconFit:J.enum(["fill","contain","cover"]).default("cover"),iconOverflow:J.enum(["visible","hidden"]).default("hidden"),iconVisible:J.union([J.boolean(),J.number()]).default(!0),opacity:J.number().min(0).max(1).default(1)}),Are=Te(e=>{var t,r;let i=Gte({},e);i.color!=null&&(i.textColor==null&&(i.textColor=i.color),i.pinColor==null&&(i.pinColor=i.color)),i.outlineColor!=null&&(i.textOutlineColor==null&&(i.textOutlineColor=i.outlineColor),i.pinOutlineColor==null&&(i.pinOutlineColor=i.outlineColor));let n=(t=i.pinColor)!=null?t:i.color,a=(r=i.pinOutlineColor)!=null?r:i.outlineColor;return n!=null&&i.pinColorInactive==null&&(i.pinColorInactive=dr(n).toRgbString()),a!=null&&i.pinOutlineColorInactive==null&&(i.pinOutlineColorInactive=dr(a).toRgbString()),i},"applyLabelAppearanceShorthands"),mre=a6.transform(e=>Are(e)),o6=Te(e=>mre.parse(e),"parseLabelAppearance"),a5e=Te((e,t)=>["color","outlineColor","maxLines","lineHeight","textSize","maxWidth","textColor","textOutlineColor"].some(r=>t[r]!=null&&e[r]!==t[r]),"isOneOfTextDirtyOptions"),o5e=Te((e,t)=>["color","outlineColor","icon","iconSize","iconScale","iconVisible","iconPadding","pinColor","pinOutlineColor","pinColorInactive","pinOutlineColorInactive"].some(r=>t[r]!=null&&e[r]!==t[r]),"isOneOfPinDirtyOptions"),s5e=Te((e,t)=>{var r,i;return t.textPlacement!=null&&e.textPlacement!==t.textPlacement||((r=t.appearance)==null?void 0:r.margin)!=null&&((i=e.appearance)==null?void 0:i.margin)!==t.appearance.margin},"isOneOfColliderDirtyOptions"),SJ=4,l5e=6,gre=6.5,PS=gre/2,IJ=[PS,PS,PS,PS],uN=class cN{constructor(t,r,i){ct(this,"lines",0),ct(this,"id"),ct(this,"rank"),ct(this,"type","label"),ct(this,"initialRank"),ct(this,"contextConfigured",!1),ct(this,"fillText"),ct(this,"newStyle",{}),ct(this,"currentOpacity",0),ct(this,"visibilityNeedsUpdate",!1),ct(this,"activePlacement",Ia.RIGHT),ct(this,"text"),ct(this,"style",{top:0,left:0,textLabelVisible:!0,pinVisibility:1,textAlign:"left"}),ct(this,"projection",{x:0,y:0}),ct(this,"labelCacheId"),ct(this,"_cache",{}),ct(this,"appearance"),ct(this,"options"),ct(this,"visible",!0),ct(this,"enabled",!0),ct(this,"interactive",!1),ct(this,"isOccluded",!1),ct(this,"offscreen",!1),ct(this,"canShow",!1),ct(this,"activeBoundingBox",{x:0,y:0,w:0,h:0}),ct(this,"dimensions",{width:0,height:0}),ct(this,"currentStrategyIndex",-1),ct(this,"totalPinSize",0),ct(this,"iconScale",1),ct(this,"iconPadding"),ct(this,"dirty",!0),ct(this,"textDirty",!0),ct(this,"pinDirty",!0),ct(this,"attachedDirty",!0),ct(this,"collisionDirty",!0),ct(this,"lastTextAlign"),ct(this,"imageHash"),ct(this,"pinSize",0),ct(this,"iconVisible",!1),ct(this,"dp"),ct(this,"_cachedStrategies",null),ct(this,"animate",!0),ct(this,"onStrategySelected",Te(l=>{var u;if(this.currentStrategyIndex===l)return;this.currentStrategyIndex=l;let c=this.strategies[l];if(this.activePlacement=(u=c==null?void 0:c.name)!=null?u:this.activePlacement,c){c.onStrategySelected();let h=this.style;this.style=this.newStyle,this.newStyle=h}},"onStrategySelected")),ct(this,"packedMessage",{x:0,y:0,enabled:!1,rank:0,bboxes:[],shouldCollideWithScreenEdges:!1,lockedToStrategyIndex:-1});var n,a,o;if(this.id=(n=r.id)!=null?n:Hte(),this.options=r!=null?r:{},this.text=t,this.dp=(l=1)=>l*i,typeof r.rank=="string")this.rank=gC(r.rank),this.initialRank=this.rank;else if(r.rank!=null&&r.rank>0)this.rank=r.rank,this.initialRank=r.rank;else{let l=Math.trunc(cN.testId*10)/10;cN.testId+=.001,this.rank=l,this.initialRank=l}this.options.textPlacement=(a=r.textPlacement)!=null?a:g_;let s=o6((o=r.appearance)!=null?o:{});this.appearance=s,this.iconPadding=s.iconPadding}get scaledPinSize(){return this.totalPinSize*this.iconScale}get scaledIconPadding(){return this.appearance.iconPadding*this.iconScale}get textVisible(){return this.offscreen||!this.visible||!this.canShow||!this.enabled?!1:this.style.textLabelVisible===!0&&this.style.textAlign!=null&&this.style.left!=null&&this.style.top!=null}calculatePinSize(){let t=this.dp();this.iconVisible&&typeof this.appearance.iconSize<"u"&&this.imageHash?this.pinSize=this.dp(this.appearance.iconSize):this.pinSize=this.dp(gre),this.totalPinSize=Math.ceil((this.pinSize+2.5)/t)}getNoTextBbox(t){let r=this.scaledPinSize/2+t;return[r,r,r,r]}getHiddenTextPlacementBbox(t){return this.iconVisible?this.getNoTextBbox(t):IJ}getBoundingBoxForPlacement(t){let{width:r,height:i}=this.dimensions,{margin:n}=this.appearance,a=Math.max(l5e,n);if(this.text==="")return this.getNoTextBbox(a);let o=Math.max(this.scaledPinSize,i);switch(t){case Ia.RIGHT:return[o/2+a,o/2+a,this.scaledPinSize/2+a,this.scaledPinSize/2+r+a];case Ia.LEFT:return[o/2+a,o/2+a,this.scaledPinSize/2+r+a,this.scaledPinSize/2+a];case Ia.TOP:{let s=this.dp();return[i+this.scaledPinSize/2/s+a,this.scaledPinSize/2+a,r/2+a,r/2+a]}case Ia.CENTER:return[i/2+a,i/2+a,r/2+a,r/2+a];case Ia.HIDDEN:return this.getHiddenTextPlacementBbox(a);case Ig:return IJ;default:return this.getNoTextBbox(a)}}getStrategyStyleForPlacement(t){let{width:r,height:i}=this.dimensions;switch(t){case Ia.TOP:this.newStyle.pinVisibility=1,this.newStyle.textAlign="center",this.newStyle.textLabelVisible=!0,this.newStyle.top=-i-this.scaledPinSize/2,this.newStyle.left=-r/2;return;case Ia.LEFT:this.newStyle.textAlign="right",this.newStyle.pinVisibility=1,this.newStyle.top=-i/2,this.newStyle.left=-r-this.scaledPinSize/2-SJ,this.newStyle.textLabelVisible=!0;return;case Ia.RIGHT:this.newStyle.textAlign="left",this.newStyle.pinVisibility=1,this.newStyle.top=-i/2,this.newStyle.left=this.scaledPinSize/2+SJ,this.newStyle.textLabelVisible=!0;return;case Ia.CENTER:this.newStyle.pinVisibility=0,this.newStyle.textAlign="center",this.newStyle.textLabelVisible=!0,this.newStyle.top=-i/2,this.newStyle.left=-r/2;return;case Ia.HIDDEN:this.newStyle.pinVisibility=this.iconVisible?1:.5,this.newStyle.textLabelVisible=!1,this.newStyle.top=0,this.newStyle.left=0;return;case Ig:default:this.newStyle.pinVisibility=.5,this.newStyle.textLabelVisible=!1,this.newStyle.top=0,this.newStyle.left=0;return}}invalidateStrategies(){this._cachedStrategies=null}get strategies(){if(this._cachedStrategies)return this._cachedStrategies;let t=Array.isArray(this.options.textPlacement)?this.options.textPlacement:[this.options.textPlacement],r=[],i=!1;for(let n of t)this.options.rank==="always-visible"&&n===Ia.HIDDEN&&t.length>1||(r.push({name:n,getBoundingBox:Te(()=>this.getBoundingBoxForPlacement(n),"getBoundingBox"),onStrategySelected:Te(()=>this.getStrategyStyleForPlacement(n),"onStrategySelected")}),n===Ia.HIDDEN&&(i=!0));return i&&r.push({name:Ig,getBoundingBox:Te(()=>this.getBoundingBoxForPlacement(Ig),"getBoundingBox"),onStrategySelected:Te(()=>this.getStrategyStyleForPlacement(Ig),"onStrategySelected")}),this._cachedStrategies=r,r}recomputeCurrentStrategy(t=this.iconScale){let r=this.iconScale!==t;if(r||this.dirty){let i=this.pinDirty,n=this.strategies[this.currentStrategyIndex];if(this.iconScale=t,this.collisionDirty=!0,r&&!i&&this.calculatePinSize(),n){n.onStrategySelected();let a=this.style;this.style=this.newStyle,this.newStyle=a}this.dirty=!1}}toPackedMessage(t=!1){var r;let i=this.strategies[this.currentStrategyIndex],n=this.currentStrategyIndex!=null&&this.currentStrategyIndex!==-1&&this.text!==""&&i!=null&&i.name!==Ia.HIDDEN&&i.name!==Ig;if(this.visible&&t&&this.collisionDirty===!1&&n?this.packedMessage.lockedToStrategyIndex=this.currentStrategyIndex:this.packedMessage.lockedToStrategyIndex=-1,this.packedMessage.x=this.projection.x,this.packedMessage.y=this.projection.y,this.packedMessage.enabled=this.enabled,this.packedMessage.rank=this.rank,n&&this.currentStrategyIndex!==((r=this.packedMessage.bboxes[0])==null?void 0:r[4])){let l=this.packedMessage.bboxes;for(let u=1;u<l.length;u++)if(l[u][4]===this.currentStrategyIndex){let c=l[0];l[0]=l[u],l[u]=c;break}}if(!this.collisionDirty)return this.packedMessage;let a=[],o=this.strategies,s=-1;for(let l=0;l<o.length;l++){let u=o[l].getBoundingBox();a.push([u[0],u[1],u[2],u[3],l]),n&&l===this.currentStrategyIndex&&(s=a.length-1)}if(s>0){let l=a[0];a[0]=a[s],a[s]=l}return this.packedMessage.bboxes=a,this.packedMessage.shouldCollideWithScreenEdges=!1,this.collisionDirty=!1,this.packedMessage}destroy(){}};Te(uN,"LabelComponent"),ct(uN,"testId",0);sp=uN,yre=sp;ii();u5e=ZLe(JLe());ii();_n={TOP:"top",BOTTOM:"bottom",LEFT:"left",RIGHT:"right",CENTER:"center",TOP_LEFT:"top-left",TOP_RIGHT:"top-right",BOTTOM_LEFT:"bottom-left",BOTTOM_RIGHT:"bottom-right",HIDDEN:"hidden"},vC=Object.values(_n),c5e=[_n.CENTER,_n.HIDDEN],h5e=Object.freeze({size:8,color:"#666"}),hN=class dN{constructor(t,r={}){ct(this,"id"),ct(this,"type","marker"),ct(this,"rank",0),ct(this,"initialRank",0),ct(this,"activePlacement","center"),ct(this,"pointerEvents","none"),ct(this,"options",{rank:"low",interactive:!1,id:"",placement:c5e,dynamicResize:!1,occlude:!0,occluderId:0,zIndex:void 0,verticalOffset:0,lowPriorityPin:Gte({},h5e)}),ct(this,"projection",{x:0,y:0}),ct(this,"enabled",!0),ct(this,"interactive",!1),ct(this,"canShow",!1),ct(this,"visible",!0),ct(this,"isOccluded",!1),ct(this,"offscreen",!1),ct(this,"strategyIndex",-1),ct(this,"activeBoundingBox",{x:0,y:0,w:0,h:0}),ct(this,"dimensions",{width:0,height:0}),ct(this,"markerContainer"),ct(this,"containerEl"),ct(this,"contentEl",null),ct(this,"contentHtml",""),ct(this,"style",{top:"0px",left:"0px"}),ct(this,"dirty",!1),ct(this,"attachedDirty",!0),ct(this,"collisionDirty",!0),ct(this,"visibilityNeedsUpdate","show"),ct(this,"animation",null),ct(this,"currentStrategyIndex",-1),ct(this,"onStrategySelected",Te((s,l=!1)=>{var u;if(this.currentStrategyIndex===s&&!l)return;this.currentStrategyIndex=s;let c=this.strategies[s];if(this.activePlacement=(u=c==null?void 0:c.name)!=null?u:"center",this.activePlacement===_n.HIDDEN){this.markerContainer.setAttribute("data-placement",_n.HIDDEN);let h=this.options.lowPriorityPin,d=h.size,p=h.color;this.markerContainer.style.setProperty("--mappedin-pin-size","".concat(d,"px")),this.markerContainer.style.setProperty("--pin-color",p),this.markerContainer.style.opacity="0.6",this.style.top=-d/2+"px",this.style.left=-d/2+"px"}else{this.markerContainer.setAttribute("data-placement",this.activePlacement),this.markerContainer.style.removeProperty("--mappedin-pin-size"),this.markerContainer.style.removeProperty("--pin-color"),this.markerContainer.style.opacity="1";let{width:h,height:d}=this.dimensions,p=-d/2+"px",f=-h/2+"px";switch(this.style.top=p,this.style.left=f,this.activePlacement){case _n.TOP:this.style.top=-d+"px";break;case _n.BOTTOM:this.style.top="0px";break;case _n.LEFT:this.style.left=-h+"px";break;case _n.RIGHT:this.style.left="0px";break;case _n.TOP_LEFT:this.style.top=-d+"px",this.style.left=-h+"px";break;case _n.TOP_RIGHT:this.style.top=-d+"px",this.style.left="0px";break;case _n.BOTTOM_LEFT:this.style.top="0px",this.style.left=-h+"px";break;case _n.BOTTOM_RIGHT:this.style.top="0px",this.style.left="0px";break;case _n.CENTER:default:this.style.top=p,this.style.left=f}}this.markerContainer.style.top=this.style.top,this.markerContainer.style.left=this.style.left},"onStrategySelected")),ct(this,"_cachedStrategies",null),ct(this,"packedMessage",{x:0,y:0,enabled:!1,rank:0,bboxes:[],lockedToStrategyIndex:-1,shouldCollideWithScreenEdges:!0}),ct(this,"_cachedLowPriorityPinIndex",null);var i,n,a,o;if(this.id=(r==null?void 0:r.id)||Hte(),this.options=(0,u5e.default)(this.options,r),this.options.placement=(i=r.placement)!=null?i:this.options.placement,typeof r.rank=="string")this.rank=gC(r.rank);else if(r.rank!=null&&r.rank>0)this.rank=r.rank;else{let s=Math.trunc(dN.testId*10)/10;dN.testId+=.001,this.rank=s}typeof r.interactive=="string"&&(this.pointerEvents=r.interactive==="pointer-events-auto"?"auto":"none"),this.contentHtml=t,this.initialRank=this.rank,this.markerContainer=document.createElement("div"),this.markerContainer.className="mappedin-marker",this.markerContainer.style.opacity="0",this.markerContainer.innerHTML='<div class="mappedin-marker-content">'.concat(this.contentHtml,"</div>"),this.markerContainer.setAttribute("data-marker-id",this.id.toString()),this.containerEl=(n=this.markerContainer.firstElementChild)!=null?n:null,this.contentEl=(o=(a=this.markerContainer.firstElementChild)==null?void 0:a.firstElementChild)!=null?o:null}updateDimensionsIfZeroWidthHeight(t,r){this.dimensions.width===0&&this.dimensions.height===0&&this.updateDimensions(t,r)}updateDimensions(t,r){if(t!=null&&r!=null)this.dimensions={width:t,height:r};else{let{width:i,height:n}=this.markerContainer.getBoundingClientRect();this.dimensions={width:i,height:n}}this.currentStrategyIndex=-1,this.invalidateStrategies()}invalidateStrategies(){this._cachedStrategies=null,this._cachedLowPriorityPinIndex=null}getBoundingBoxForPlacement(t){let{width:r,height:i}=this.dimensions;switch(t){case _n.TOP:return[i+4,4,r/2+4,r/2+4];case _n.BOTTOM:return[4,i+4,r/2+4,r/2+4];case _n.LEFT:return[i/2+4,i/2+4,r+4,4];case _n.RIGHT:return[i/2+4,i/2+4,4,r+4];case _n.TOP_LEFT:return[i+4,4,r+4,4];case _n.TOP_RIGHT:return[i+4,4,4,r+4];case _n.BOTTOM_LEFT:return[4,i+4,r+4,4];case _n.BOTTOM_RIGHT:return[4,i+4,4,r+4];case _n.HIDDEN:{let n=Math.max(2,2),a=this.options.lowPriorityPin.size/2+n;return[a,a,a,a]}default:return[i/2+4,i/2+4,r/2+4,r/2+4]}}get strategies(){if(this._cachedStrategies)return this._cachedStrategies;let{width:t,height:r}=this.dimensions;if(t===0||r===0)return[];let i=Array.isArray(this.options.placement)?this.options.placement:[this.options.placement],n=[];for(let a of i)this.options.rank==="always-visible"&&a===_n.HIDDEN&&i.length>1||n.push({name:a,getBoundingBox:Te(()=>this.getBoundingBoxForPlacement(a),"getBoundingBox")});return this._cachedStrategies=n,n}toPackedMessage(t=!1){var r;this.packedMessage.x=this.projection.x,this.packedMessage.y=this.projection.y,this.packedMessage.enabled=this.enabled,this.packedMessage.rank=this.rank,this.packedMessage.shouldCollideWithScreenEdges=!0;let i=this.currentStrategyIndex!==-1&&this.currentStrategyIndex!==this.lowPriorityPinStrategyIndex;if(this.visible&&t&&i&&this.collisionDirty===!1?this.packedMessage.lockedToStrategyIndex=this.currentStrategyIndex:this.packedMessage.lockedToStrategyIndex=-1,i&&this.currentStrategyIndex!==((r=this.packedMessage.bboxes[0])==null?void 0:r[4])){let s=this.packedMessage.bboxes;for(let l=1;l<s.length;l++)if(s[l][4]===this.currentStrategyIndex){let u=s[0];s[0]=s[l],s[l]=u;break}}if(!this.collisionDirty)return this.packedMessage;let n=[],a=this.strategies,o=-1;for(let s=0;s<a.length;s++){let l=a[s].getBoundingBox();n.push([l[0],l[1],l[2],l[3],s]),s===this.currentStrategyIndex&&i&&(o=n.length-1)}if(o>0){let s=n[0];n[0]=n[o],n[o]=s}return this.packedMessage.bboxes=n,this.collisionDirty=!1,this.packedMessage}get lowPriorityPinStrategyIndex(){return this._cachedLowPriorityPinIndex!=null?this._cachedLowPriorityPinIndex:this.options.rank==="always-visible"?(this._cachedLowPriorityPinIndex=-1,-1):(this._cachedLowPriorityPinIndex=this.strategies.findIndex(t=>t.name===_n.HIDDEN),this._cachedLowPriorityPinIndex)}destroy(){}};Te(hN,"MarkerComponent"),ct(hN,"testId",0);lp=hN;ii();ii();ii();ii();ii();ii();Te(vre,"contains");ii();Te(xre,"intersectPoint");ii();Te(_re,"intersects");ii();Te(uh,"appendItems");ii();bre=class{constructor(e,t,r,i,n){ct(this,"x"),ct(this,"y"),ct(this,"w"),ct(this,"h"),ct(this,"userData"),this.userData=typeof n>"u"?null:n,this.x=e,this.y=t,this.w=r,this.h=i}contains(e){return e===this?!1:vre(this,e)}intersects(e){return _re(this,e)}intersectsPoint(e){return xre(this,e)}draw(e){e.fillStyle="rgba(123,222,26, 0.8)",e.fillRect(this.x,this.y,this.w,this.h)}};Te(bre,"Rectangle");wn=bre,wre=class gx{constructor(t,r){ct(this,"topLeft"),ct(this,"topRight"),ct(this,"bottomLeft"),ct(this,"bottomRight"),ct(this,"divided",!1),ct(this,"boundary"),ct(this,"capacity",16),ct(this,"objects",[]),ct(this,"parent"),this.parent=r,this.boundary=t}getSize(){return this.divided?this.objects.length+this.topLeft.getSize()+this.topRight.getSize()+this.bottomLeft.getSize()+this.bottomRight.getSize():this.objects.length}subdivide(){let{x:t,y:r,w:i,h:n}=this.boundary;this.topLeft=new gx(new wn(t,r,i/2,n/2),this),this.topRight=new gx(new wn(t+i/2,r,i/2,n/2),this),this.bottomLeft=new gx(new wn(t,r+n/2,i/2,n/2),this),this.bottomRight=new gx(new wn(t+i/2,r+n/2,i/2,n/2),this),this.divided=!0}queryRect(t){let r=[];if(this.boundary.intersects(t))r.push(...this.objects);else return[];return this.divided&&(uh(r,this.topLeft.queryRect(t)),uh(r,this.topRight.queryRect(t)),uh(r,this.bottomLeft.queryRect(t)),uh(r,this.bottomRight.queryRect(t))),r}queryPoint(t){let r=[];if(this.boundary.intersectsPoint(t))r.push(...this.objects);else return[];return this.divided&&(uh(r,this.topLeft.queryPoint(t)),uh(r,this.topRight.queryPoint(t)),uh(r,this.bottomLeft.queryPoint(t)),uh(r,this.bottomRight.queryPoint(t))),r}insert(t){return(this.parent?!this.boundary.contains(t):!this.boundary.intersects(t))?!1:this.objects.length<this.capacity?(this.objects.push(t),!0):(this.divided||this.subdivide(),(this.topLeft.insert(t)||this.topRight.insert(t)||this.bottomLeft.insert(t)||this.bottomRight.insert(t))===!1&&this.objects.push(t),!0)}drawObjects(t){this.objects.forEach(r=>r.draw(t)),this.divided&&(this.topLeft.drawObjects(t),this.topRight.drawObjects(t),this.bottomLeft.drawObjects(t),this.bottomRight.drawObjects(t))}draw(t){t.rect(this.boundary.x,this.boundary.y,this.boundary.w,this.boundary.h),this.divided&&(this.topLeft.draw(t),this.topRight.draw(t),this.bottomLeft.draw(t),this.bottomRight.draw(t)),t.strokeStyle="black",t.lineWidth=4,t.stroke()}};Te(wre,"QuadTree");yx=wre;ii();Ere=class{constructor(){ct(this,"_subscribers",{}),ct(this,"_abortController",new AbortController),ct(this,"_cleanupFunctions",[])}get signal(){return this._abortController.signal}publish(e,t){!this._subscribers||!this._subscribers[e]||this.signal.aborted||this._subscribers[e].forEach(function(r){typeof r=="function"&&r(t)})}onAbort(e){this.signal.addEventListener("abort",()=>e(),{once:!0})}on(e,t,r){let i=r==null?void 0:r.signal;if(i!=null&&i.aborted||this._abortController&&this._abortController.signal.aborted)return()=>{};this._subscribers||(this._subscribers={}),this._subscribers[e]=this._subscribers[e]||[],this._subscribers[e].push(t);let n=Te(()=>this.off(e,t),"cleanup");return i&&i.addEventListener("abort",n,{once:!0}),this._cleanupFunctions.push(n),n}off(e,t){if(!this._subscribers||this._subscribers[e]==null||this.signal.aborted)return;let r=this._subscribers[e].indexOf(t);r!==-1&&this._subscribers[e].splice(r,1)}destroy(){if(!this.signal.aborted){for(let e of this._cleanupFunctions)e();this._cleanupFunctions=[],this._subscribers={},this._abortController.abort()}}};Te(Ere,"PubSub");xC=Ere;ii();Mre=9,ll=200,DS=10;Te(Sre,"processColliders");Te(Ire,"getWatermarkBoundary");ii();ii();Te(Cre,"unpackMessage");Bre=class{constructor(){ct(this,"onerror",Te(()=>{},"onerror")),ct(this,"onmessage",Te(()=>{},"onmessage")),ct(this,"postMessage",Te(e=>{let t=Cre(e);this.onmessage({data:Sre(t.colliders,t.totalWidth,t.totalHeight,t.watermarkWidth,t.watermarkHeight,t.watermarkPosition,t.msgId)})},"postMessage")),ct(this,"terminate",Te(()=>{},"terminate"))}};Te(Bre,"SyncWorker");kS=Bre;ii();CJ=\`"use strict";(()=>{var ne=Object.defineProperty;var oe=(n,e,t)=>e in n?ne(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var u=(n,e,t)=>oe(n,typeof e!="symbol"?e+"":e,t);function O(n,e){return e.x+e.w<n.x+n.w&&e.x>n.x&&e.y>n.y&&e.y+e.h<n.y+n.h}function Q(n,e){let[t,o]=e;return t>=n.x&&t<=n.x+n.w&&o>=n.y&&o<=n.y+n.h}function Y(n,e){let t=e.x,o=e.y,r=e.x+e.w,h=e.y+e.h,L=n.x,m=n.y,x=n.x+n.w,T=n.y+n.h;return t<x&&L<r&&o<T&&m<h}function f(n,e){for(let t=0;t<e.length;t++)n.push(e[t])}var i=class{constructor(e,t,o,r,h){u(this,"x");u(this,"y");u(this,"w");u(this,"h");u(this,"userData");this.userData=typeof h>"u"?null:h,this.x=e,this.y=t,this.w=o,this.h=r}contains(e){return e===this?!1:O(this,e)}intersects(e){return Y(this,e)}intersectsPoint(e){return Q(this,e)}draw(e){e.fillStyle="rgba(123,222,26, 0.8)",e.fillRect(this.x,this.y,this.w,this.h)}};var S=class n{constructor(e,t){u(this,"topLeft");u(this,"topRight");u(this,"bottomLeft");u(this,"bottomRight");u(this,"divided",!1);u(this,"boundary");u(this,"capacity",16);u(this,"objects",[]);u(this,"parent");this.parent=t,this.boundary=e}getSize(){return this.divided?this.objects.length+this.topLeft.getSize()+this.topRight.getSize()+this.bottomLeft.getSize()+this.bottomRight.getSize():this.objects.length}subdivide(){let{x:e,y:t,w:o,h:r}=this.boundary;this.topLeft=new n(new i(e,t,o/2,r/2),this),this.topRight=new n(new i(e+o/2,t,o/2,r/2),this),this.bottomLeft=new n(new i(e,t+r/2,o/2,r/2),this),this.bottomRight=new n(new i(e+o/2,t+r/2,o/2,r/2),this),this.divided=!0}queryRect(e){let t=[];if(this.boundary.intersects(e))t.push(...this.objects);else return[];return this.divided&&(f(t,this.topLeft.queryRect(e)),f(t,this.topRight.queryRect(e)),f(t,this.bottomLeft.queryRect(e)),f(t,this.bottomRight.queryRect(e))),t}queryPoint(e){let t=[];if(this.boundary.intersectsPoint(e))t.push(...this.objects);else return[];return this.divided&&(f(t,this.topLeft.queryPoint(e)),f(t,this.topRight.queryPoint(e)),f(t,this.bottomLeft.queryPoint(e)),f(t,this.bottomRight.queryPoint(e))),t}insert(e){return(this.parent?!this.boundary.contains(e):!this.boundary.intersects(e))?!1:this.objects.length<this.capacity?(this.objects.push(e),!0):(this.divided||this.subdivide(),(this.topLeft.insert(e)||this.topRight.insert(e)||this.bottomLeft.insert(e)||this.bottomRight.insert(e))===!1&&this.objects.push(e),!0)}drawObjects(e){this.objects.forEach(t=>t.draw(e)),this.divided&&(this.topLeft.drawObjects(e),this.topRight.drawObjects(e),this.bottomLeft.drawObjects(e),this.bottomRight.drawObjects(e))}draw(e){e.rect(this.boundary.x,this.boundary.y,this.boundary.w,this.boundary.h),this.divided&&(this.topLeft.draw(e),this.topRight.draw(e),this.bottomLeft.draw(e),this.bottomRight.draw(e)),e.strokeStyle="black",e.lineWidth=4,e.stroke()}};var ie=9,l=200,C=10;function K(n,e,t,o,r,h,L="-1"){var j,N;let m=1/0,x=1/0,T=-1/0,B=-1/0,F=new i(-C,0,5,t),k=new i(-C,0,e,5),U=new i(e-5,0,e+C,t),G=new i(0,t-5,e,t+C),J=se(e,t,o,r,h),Z=[F,k,U,G],M=new i(-l,-l,e+l*2,t+l*2);for(let s of n){let b,I;for(let p=0;p<s.bboxes.length;p++){if(s.bboxes[p]==null||(b=s.bboxes[p].boundingBox,I=s.bboxes[p].index,s.lockedToStrategyIndex!==-1&&I!==s.lockedToStrategyIndex))continue;let[a,P,c,y]=b,[E,g,z,te]=[s.y-a,s.y+P,s.x-c,s.x+y],v=z,D=E,q=te-z,X=g-E;m=Math.min(m,v)-l,x=Math.min(x,D)-l,T=Math.max(T,v+q)+l,B=Math.max(B,D+X)+l,s.bboxes[p].boundingRect=new i(v,D,q,X)}}let w=new S(new i(m,x,T-m,B-x)),R={msgId:L,colliders:new Array(n.length),staticColliders:[],debug:[]},_=0;for(let s=0;s<n.length;s++){let b=n[s];((N=(j=b.bboxes)==null?void 0:j[0])==null?void 0:N.index)===ie&&(R.staticColliders.push(b.bboxes[0].boundingRect),w.insert(b.bboxes[0].boundingRect),_++)}n=n.slice(_,n.length);let $=-l,W=e+l,H=-l,ee=t+l,d;for(let s=0;s<n.length;s++){d=n[s];let b=d.x<$||d.x>W||d.y<H||d.y>ee?1:0;if(R.colliders[s]=[-1,b],d.enabledAndVisible){let[I,p,a]=[1/0,-1,void 0];for(let{index:P,boundingRect:c}of d.bboxes){if(c==null)continue;let y=[];if(y=w.queryRect(c).filter(g=>c.intersects(g)),d.shouldCollideWithScreenEdges)for(let g of Z)c.intersects(g)&&y.push(g);if(c.intersects(J)){R.colliders[s]=[-1,b,c];break}if(y.length<I&&(a=c,p=P,I=y.length),y.length===0){w.insert(c),R.colliders[s]=[P,M.contains(c)?0:1,c];break}}d.rank===5&&a!=null&&(w.insert(a),R.colliders[s]=[p,M.contains(a)?0:1,a])}}return R}function se(n,e,t,o,r){switch(r){case"top-left":return new i(0,0,t,o);case"top-right":return new i(n-t,0,t,o);case"bottom-left":return new i(0,e-o,t,o);case"bottom-right":return new i(n-t,e-o,t,o);case"center":return new i((n-t)/2,(e-o)/2,t,o);case"top":return new i((n-t)/2,0,t,o);case"bottom":return new i((n-t)/2,e-o,t,o);case"left":return new i(0,(e-o)/2,t,o);case"right":return new i(n-t,(e-o)/2,t,o);default:return new i(0,e-o,t,o)}}function V(n){let e=n[0].map(t=>{let o=t[0].map(r=>({index:r[4],boundingBox:[r[0],r[1],r[2],r[3]]}));return{enabledAndVisible:t[1]===1,rank:t[2]===1?5:0,x:t[3],y:t[4],shouldCollideWithScreenEdges:t[5]===1,bboxes:o,lockedToStrategyIndex:t[6]}});return{msgId:"-1",totalWidth:n[3],totalHeight:n[2],watermarkWidth:n[4],watermarkHeight:n[5],watermarkPosition:n[6],colliders:e,devicePixelRatio:n[1]}}self.onmessage=n=>{let e=V(n.data);self.postMessage(K(e.colliders,e.totalWidth,e.totalHeight,e.watermarkWidth,e.watermarkHeight,e.watermarkPosition,e.msgId))};})();
|
|
4888
|
-
\`,Pre=class extends xC{constructor(e,t,r,i,n=!0,a){if(super(),zi(this,pN),ct(this,"worker"),ct(this,"collidersDirty",!0),ct(this,"packedMessage",[[],0,0,0,0,0,"bottom-left"]),ct(this,"visibleCollidersQTree",new yx(new wn(0,0,0,0))),ct(this,"interactiveCollidersQTree",new yx(new wn(0,0,0,0))),zi(this,JS),zi(this,zg),zi(this,Lg),zi(this,Bx,!1),zi(this,bn,null),zi(this,Zd,null),ct(this,"working",!1),ct(this,"componentArray",[]),ct(this,"update",Te((o,s,l="bottom-left",u=!1,c=[])=>{let h=!1;if(this.collidersDirty){this.packedMessage=[[],0,0,0,0,0,"bottom-left"],this.componentArray=[];for(let v of gt(this,JS).entities)this.componentArray.push(v.component);this.resize(o,s,l),this.collidersDirty=!1,h=!0}else for(let v=0;v<this.componentArray.length;v++)if(this.componentArray[v].collisionDirty){h=!0;break}h&&this.componentArray.sort((v,_)=>_.rank-v.rank);let d=this.packedMessage[0],p=c.length+this.componentArray.length,f=u;d.length=p;let m=0,g;for(let v=0;v<c.length;v++){let _=c[v];d[m]==null&&(d[m]=[[],0,0,0,0,0,-1]),g=d[m],g[0]=[[_.h/2,_.h/2,_.w/2,_.w/2,Mre]],g[1]=1,g[2]=1,g[3]=_.x,g[4]=_.y,g[5]=0,g[6]=-1,m++}for(let v=0;v<this.componentArray.length;v++){let _=this.componentArray[v],x=_.toPackedMessage(f);d[m]==null&&(d[m]=[[],0,0,0,0,0,-1]),g=d[m],g[0]=x.bboxes,g[1]=x.enabled&&_.visible&&!_.isOccluded?1:0,g[2]=x.rank===5?1:0,g[3]=x.x,g[4]=x.y,g[5]=x.shouldCollideWithScreenEdges?1:0,g[6]=x.lockedToStrategyIndex,m++}this.working||(this.working=!0,this.worker.postMessage(this.packedMessage))},"update")),ct(this,"resolve",Te(o=>{if(this.working=!1,this.collidersDirty||!o.data)return;let s=o.data.colliders,l=-1,u,c,h=new wn(0,0,gt(this,zg),gt(this,Lg));this.visibleCollidersQTree=new yx(h),this.interactiveCollidersQTree=new yx(h);for(let d=0;d<this.componentArray.length;d++){let p=this.componentArray[d];if(s[d]==null)continue;l=s[d][0],u=s[d][2];let f=p.offscreen,m=s[d][1]===1;p.offscreen=m,l!==-1&&u!=null?(c=new wn(u.x,u.y,u.w,u.h,{entityId:p.id}),this.visibleCollidersQTree.insert(c),p.interactive&&this.interactiveCollidersQTree.insert(c),(p.canShow===!1||p.visibilityNeedsUpdate!==!1||f&&!m)&&"visibilityNeedsUpdate"in p&&(p.visibilityNeedsUpdate="show"),l!==-1&&l!==p.currentStrategyIndex&&(p.activeBoundingBox=c,p.onStrategySelected(l))):((p.canShow===!0||p.visibilityNeedsUpdate!==!1)&&"visibilityNeedsUpdate"in p&&(p.visibilityNeedsUpdate="hide"),l!==-1&&l!==p.currentStrategyIndex&&p.onStrategySelected(l))}tN(this,pN,Tre).call(this),this.publish("visibility-changed")},"resolve")),ct(this,"destroy",Te(()=>{var o;this.worker.terminate(),(o=gt(this,bn))==null||o.remove()},"destroy")),Fr(this,JS,e),Fr(this,zg,t),Fr(this,Lg,r),!n)this.worker=new kS;else if(i)this.worker=new Worker(i);else if(CJ)try{this.worker=new Worker(URL.createObjectURL(new Blob([CJ])))}catch(o){this.worker=new kS}else this.worker=new kS;this.worker.onerror=()=>{this.working=!1,this.worker=new kS,this.worker.onmessage=o=>this.resolve(o)},this.worker.onmessage=o=>this.resolve(o),a&&(Fr(this,bn,document.createElement("canvas")),gt(this,bn).style.cssText="position:absolute;top:0;left:0;pointer-events:none;z-index:0;display:none;",gt(this,bn).width=t,gt(this,bn).height=r,gt(this,bn).style.width=t+"px",gt(this,bn).style.height=r+"px",a.appendChild(gt(this,bn)),Fr(this,Zd,gt(this,bn).getContext("2d")))}resizeCanvas(e,t){Fr(this,zg,e),Fr(this,Lg,t),gt(this,bn)&&(gt(this,bn).width=e,gt(this,bn).height=t,gt(this,bn).style.width=e+"px",gt(this,bn).style.height=t+"px")}resize(e,t,r){this.packedMessage[6]=r,this.packedMessage[5]=t,this.packedMessage[4]=e,this.packedMessage[3]=gt(this,zg),this.packedMessage[2]=gt(this,Lg)}showCollisionBoxes(){Fr(this,Bx,!0),gt(this,bn)&&(gt(this,bn).style.display="block")}hideCollisionBoxes(){Fr(this,Bx,!1),gt(this,Zd)&>(this,bn)&&(gt(this,Zd).clearRect(0,0,gt(this,bn).width,gt(this,bn).height),gt(this,bn).style.display="none")}};JS=new WeakMap,zg=new WeakMap,Lg=new WeakMap,Bx=new WeakMap,bn=new WeakMap,Zd=new WeakMap,pN=new WeakSet,Tre=Te(function(){!gt(this,Bx)||!gt(this,Zd)||!gt(this,bn)||(gt(this,Zd).clearRect(0,0,gt(this,bn).width,gt(this,bn).height),this.visibleCollidersQTree.drawObjects(gt(this,Zd)))},"#drawDebug"),Te(Pre,"CollisionSystem");d5e=Pre;ii();ii();ii();p5e=Te((function(){let e,t;return r=>{if((!t||!t)&&(e=document.createElement("canvas"),e.width=500*r,e.height=500*r,e.style.width="500px",e.style.height="500px",t=e.getContext("2d")),!t)throw new Error("Could not get 2D context");return{measureCanvas:e,measureCanvasContext:t}}}),"createMeasureCanvasContext")(),f5e=Te(({text:e,size:t,maxWidth:r,pixelRatio:i,maxLines:n=2,lineHeight:a=1.2,options:o={strokeText:!0}})=>{let s="bold ".concat(t*i,"px 'InterUI-Regular', Helvetica Neue, Arial, sans-serif"),{measureCanvasContext:l}=p5e(i);l.font=s;let u=[],c=e.split(" "),h=0,d=0,p=0;for(;d<c.length;){let g=c[d];if(h===n&&h>0){u[h-1]+="...";break}if(u[h]==null&&(u[h]=g,d++),c.length===1){u[h]=g;break}if(c[d]==null)break;let{width:v}=l.measureText(u[h]+" "+c[d]);v<=r*i?(u[h]+=" "+c[d],d++):h++}u.forEach(g=>{let{width:v}=l.measureText(g);p=Math.max(v,p)});let f=t*i*a,m=u.length*f;return{maxWidth:p,maxHeight:m,lines:u.length,draw:Te((g,v,_)=>{u.length===1?(o.strokeText&&g.strokeText(u[0],v,_),g.fillText(u[0],v,_)):(o.strokeText&&(g.strokeText(u[0],v,_-f/2),g.strokeText(u[1],v,_+f/2)),g.fillText(u[0],v,_-f/2),g.fillText(u[1],v,_+f/2))},"draw")}},"shaveText");ii();Dre="[MappedinJS]";Te(kre,"createLogger");A5e=kre(),m5e=A5e;ii();ii();Te(Rre,"formatMessage");Fre=class extends Error{constructor(e,t=Dre){super(Rre(e,t)),this.name="MappedinError"}};Te(Fre,"MappedinError");g5e=Fre,s6=Te(e=>e,"linearEase"),y5e=Te(e=>e*e,"quadEaseIn"),zre=Te(e=>1-Math.cos(e*Math.PI/2),"easeIn"),v5e=Te(e=>1-(1-e)*(1-e),"quadEaseOut"),x5e=Te(e=>1-Math.pow(1-e,3),"cubicEaseOut"),Lre={linear:s6,"ease-in":y5e,"ease-out":v5e,"ease-in-out":zre,"ease-out-cubic":x5e};Te(Ore,"interpolate");Te(Nre,"getInterpolationBreakpoint");Te(Ure,"interpolateMulti");ii();_5e=(()=>{let e;return{getDeviceType(){if(e)return e;let{userAgent:t,platform:r,maxTouchPoints:i}=window.navigator,n=/(iphone|ipod|ipad)/i.test(t),a=r==="iPad"||r.indexOf("Mac")===0&&i>0&&!window.MSStream,o=/android/i.test(t);return e={isIpad:a,isMobile:o||n||a,isIOS:n,isAndroid:o,isSafari12:/Version\\/12.+Safari/.test(t),isFirefox:/Firefox/.test(t),isWindows:/windows/i.test(t)},e},_reset(){e=void 0}}})(),BJ=_5e.getDeviceType,Qre=(()=>{let e,t,r;function i(){if(t!==void 0)return t;e||(e=document.createElement("canvas"));let a=e.getContext("webgl")||e.getContext("experimental-webgl");if(!a)return t;try{let o=BJ().isFirefox?null:a.getExtension("WEBGL_debug_renderer_info");return t=o?a.getParameter(o.UNMASKED_RENDERER_WEBGL):a.getParameter(a.RENDERER),t}catch(o){let s=new Error("Failed getting device info");throw s.name="FailedGettingDeviceInfo",s}}Te(i,"getInfo");function n(){var a,o;if(!BJ().isWindows)return!1;if(r!==void 0)return r;let s=(o=(a=b5e())==null?void 0:a.toLowerCase())!=null?o:"";return r=s.includes("intel")&&(s.includes("uhd")||s.includes("iris")),r}return Te(n,"shouldDisableOffscreenCanvas"),{getInfo:i,shouldDisableOffscreenCanvas:n,_setCanvas(a){e=a,t=void 0,r=void 0}}})(),b5e=Qre.getInfo,w5e=Qre.shouldDisableOffscreenCanvas;ii();Te(jre,"createImage");Te(fN,"fastTrunc");Te(Gre,"cyrb53");Vre=class extends xC{constructor(e,t,r){super(),ct(this,"dirty",!1),ct(this,"state"),ct(this,"colliderContext"),ct(this,"colliderCanvas"),ct(this,"transformRequestFunc"),ct(this,"transformRequest",Te(i=>Qe(this,null,function*(){return this.transformRequestFunc?yield this.transformRequestFunc(i):{url:i}}),"transformRequest")),ct(this,"pinCache",{}),ct(this,"imageCache",{}),ct(this,"imagePromiseCache",{}),ct(this,"imageDimensionsCache",{}),ct(this,"textCache",{}),ct(this,"update",Te(i=>{let n=this.state.pixelRatio;this.colliderContext.clearRect(0,0,this.colliderCanvas.width,this.colliderCanvas.height);let a,o,s,l,u,c;for(let h of this.state.entities)if((h==null?void 0:h.component)instanceof yre&&!h.disposed){if(c=h.component,u=c.appearance.iconVisible,c.appearance.icon!=null&&u!=null){let p=typeof u=="boolean"?u:i>=u;p!==c.iconVisible&&(c.iconVisible=p,c.dirty=!0)}if((c.pinDirty||c.dirty||this.dirty)&&c.calculatePinSize(),c.offscreen||!c.visible)continue;if(o={active:c.appearance.pinColor,inactive:c.appearance.pinColorInactive},s={active:c.appearance.pinOutlineColor,inactive:c.appearance.pinOutlineColorInactive},l=fN(c.pinSize),a="".concat(o.active,"-").concat(o.inactive,"-").concat(s.active,"-").concat(s.inactive,"-").concat(l,"-").concat(c.iconVisible),c.labelCacheId=a,(!this.pinCache[a]||this.dirty)&&(this.prepare(c,a,this.colliderContext),c.dirty=!0),(c.appearance.icon&&(!c.imageHash||c.pinDirty)||this.dirty)&&this.cacheImage(c),this.textCache[c.id]==null||c.textDirty||this.dirty){c.dirty=!0,this.textCache[c.id]={};let{textDrawFn:p,width:f,height:m}=this.processText(c.text,c.appearance.textSize,c.appearance.maxWidth,c.appearance.maxLines,c.appearance.lineHeight),g=["left","center","right"];for(let v of g)this.textCache[c.id][v]=this.textToCanvas(p,c.appearance.textSize,v,f,m,c.appearance.textColor,c.appearance.textOutlineColor);c.dimensions={width:Math.ceil(f/n),height:Math.ceil(m/n)}}let d=1;if(c.appearance.iconScale)if(typeof c.appearance.iconScale=="number")d=c.appearance.iconScale;else{let{on:p,input:f,output:m,easing:g}=c.appearance.iconScale;p==="zoom-level"?d=fN(Ure(i,f,m,g!=null?g:"linear")):m5e.warn("Unsupported interpolation property: ".concat(p))}c.recomputeCurrentStrategy(c.iconVisible?d:1),c.canShow&&(c.enabled||c.visibilityNeedsUpdate!==!1)&&this.draw(c,a,this.colliderContext),c.textDirty=!1,c.pinDirty=!1}this.dirty=!1},"update")),ct(this,"processText",Te((i,n,a,o,s)=>{let l=this.state.pixelRatio,{draw:u,maxWidth:c,maxHeight:h}=f5e({text:i,size:n,pixelRatio:l,maxWidth:a,maxLines:o,lineHeight:s});return{textDrawFn:u,width:c+2.5*l*2,height:h+2.5*l*2}},"processText")),ct(this,"textToCanvas",Te((i,n,a,o,s,l,u)=>{let c=this.state.pixelRatio,h,d=o,p=s;window.OffscreenCanvas!=null&&!w5e()?h=new OffscreenCanvas(d,p):(h=document.createElement("canvas"),h.width=d,h.height=p,h.style.width=d+"px",h.style.height=p+"px");let f=h.getContext("2d",{willReadFrequently:!0});if(!f)return;let m=2.5*c;f.textAlign=a,f.font="bold ".concat(n*c,"px 'InterUI-Regular', Helvetica Neue, Arial, sans-serif"),f.textBaseline="middle",f.lineJoin="miter",f.miterLimit=2,f.strokeStyle="white",f.lineWidth=m,f.fillStyle=l,f.strokeStyle=u;let g=a==="left"?m/2:a==="center"?d/2:d-m/2;return i(f,g,(p+m/2)/2),h},"textToCanvas")),ct(this,"cacheImage",Te(i=>{if(!i.appearance.icon)return;let n=Gre(i.appearance.icon);this.imagePromiseCache[n]||(this.imagePromiseCache[n]=new Promise(a=>{this.transformRequest(i.appearance.icon).then(o=>{let s=jre(o.url);s.onload=()=>{this.imageCache[n]=s,this.publish("img:loaded"),a(s)}})})),i.imageHash!==n&&(i.imageHash=n,this.imagePromiseCache[n].then(()=>{i.dirty=!0}))},"cacheImage")),ct(this,"createPinCanvas",Te((i,n,a,o,s=1)=>{let l,u=this.state.pixelRatio,c=i.totalPinSize*2*u*s;window.OffscreenCanvas!=null?l=new OffscreenCanvas(c,c):(l=document.createElement("canvas"),l.width=c,l.height=c,l.style.width=c/u+"px",l.style.height=c/u+"px");let h=l.getContext("2d");return h.shadowColor="rgba(0,0,0,0.3)",h.shadowOffsetY=2*u,h.shadowBlur=5*u,h.beginPath(),h.arc(c/2,c/2,(n/2+2.5*u/2)*s,0,2*Math.PI),h.fillStyle=a,h.fill(),h.beginPath(),h.arc(c/2,c/2,n/2*s,0,2*Math.PI),h.shadowColor="transparent",h.fillStyle=o,h.fill(),l},"createPinCanvas")),ct(this,"prepare",Te((i,n,a)=>{let o=this.state.pixelRatio;a.lineWidth=4*o;let s=typeof i.appearance.iconScale=="number"?[i.appearance.iconScale]:i.appearance.iconScale==null?[]:i.appearance.iconScale.output,l=s.length>0?Math.max(...s):void 0,u=this.createPinCanvas(i,i.pinSize,i.appearance.pinOutlineColor,i.appearance.pinColor,l),c=this.createPinCanvas(i,3.5*o,i.appearance.pinOutlineColorInactive,i.appearance.pinColorInactive,l);this.pinCache[n]=[u,c]},"prepare")),this.state=e,this.colliderCanvas=t,this.colliderContext=t.getContext("2d"),this.transformRequestFunc=r}draw(e,t,r){var i;if(!e.canShow||!e.visible)return;r.save(),r.globalAlpha=e.currentOpacity;let n=this.state.pixelRatio,a=e.projection.x*n,o=e.projection.y*n,s=e.style.pinVisibility===1?this.pinCache[t][0]:this.pinCache[t][1],l=e.style.pinVisibility===1?e.scaledPinSize*n:e.totalPinSize*n;if(e.style.pinVisibility!==0&&r.drawImage(s,a-l,o-l,l*2,l*2),e.appearance.icon&&e.iconVisible&&e.imageHash&&e.appearance.iconSize&&this.imageCache[e.imageHash]&&e.style.pinVisibility===1){let u=this.imageCache[e.imageHash],c=(e.scaledPinSize-e.scaledIconPadding)*n,h=e.appearance.iconFit,d=c,p=c,f="".concat(e.imageHash,"_").concat(h);if(this.imageDimensionsCache[f])d=this.imageDimensionsCache[f].width,p=this.imageDimensionsCache[f].height;else{let m=u.width*n,g=u.height*n;if(h==="contain"){let v=Math.sqrt(bs(m,2)+bs(g,2)),_=c/v;d=m*_,p=g*_}if(h==="cover"){let v=c/m,_=c/g,x=Math.max(v,_);d=m*x,p=g*x}}r.save(),r.beginPath(),r.arc(a,o,c/2,0,2*Math.PI),r.closePath(),((i=e==null?void 0:e.appearance)==null?void 0:i.iconOverflow)!=="visible"&&r.clip(),r.drawImage(u,a-d/2,o-p/2,d,p),r.restore()}e.style.textLabelVisible&&e.style.textAlign!=null&&e.style.left!=null&&e.style.top!=null&&r.drawImage(this.textCache[e.id][e.style.textAlign],a+e.style.left*n,o+e.style.top*n),r.restore()}};Te(Vre,"TwoDDrawSystem");E5e=Vre;ii();Yre=class extends xC{constructor(e){super(),ct(this,"state"),ct(this,"animating",new Map),ct(this,"isAnimating",!1),ct(this,"startTime",-1),ct(this,"showDuration",300),ct(this,"hideDuration",250),ct(this,"update",Te(()=>{var t;this.animating.clear();for(let r of this.state.entities){let i=r.component;i instanceof yre&&(i.visibilityNeedsUpdate==="show"?(i.canShow=!0,this.animating.set(i,[i.currentOpacity,(t=i.appearance.opacity)!=null?t:1])):i.visibilityNeedsUpdate==="hide"&&this.animating.set(i,[i.currentOpacity,0]))}this.startTime=performance.now(),this.publish("animate:2d")},"update")),ct(this,"playAnimations"),this.state=e,this.playAnimations=this._playAnimations}_playAnimations(){let e=performance.now();for(let[t,[r,i]]of this.animating.entries()){let n=i===1?this.showDuration:this.hideDuration,a=(e-this.startTime)/n;t.currentOpacity=Ore(a,0,1,r,i,i===0?s6:zre),e-this.startTime>=n&&(i===1?t.canShow=!0:i===0&&(t.canShow=!1),t.visibilityNeedsUpdate=!1,this.animating.delete(t))}this.publish("draw:2d"),this.animating.size>0&&this.publish("animate:2d")}};Te(Yre,"TwoDVisibilitySystem");M5e=Yre;ii();S5e=["running","paused"],Hre=class{constructor(e){ct(this,"state"),this.state=e}update(e){let t;for(let r of this.state.entities)if(r&&(t=r.component,t&&"containerEl"in t&&t.markerContainer!=null)){let i=t;i.visibilityNeedsUpdate!==!1&&(i.visibilityNeedsUpdate==="show"?i.canShow=!0:i.canShow=!1),i.offscreen&&(i.animation&&(i.animation.cancel(),i.animation=null),i.markerContainer.style.opacity="0");let n=i.animation!=null&&(i.animation.pending===!0||S5e.includes(i.animation.playState));if((i.canShow&&i.visible===!0||n)&&!i.offscreen&&(i.markerContainer.style.transform="translate3D(".concat(i.projection.x,"px, ").concat(i.projection.y,"px, 0px)")),i.canShow===!0&&i.visible===!0&&!i.offscreen?i.markerContainer.style.pointerEvents=e?"none":i.pointerEvents:i.markerContainer.style.pointerEvents="none",i.currentStrategyIndex===-1&&i.visible&&i.visibilityNeedsUpdate==="show")continue;i.visibilityNeedsUpdate!==!1&&!i.offscreen&&(i.visibilityNeedsUpdate==="show"&&(i.markerContainer.style.opacity="0"),i.animation&&i.animation.cancel(),i.animation=i.markerContainer.animate([{opacity:i.canShow&&i.visible?"1":"0"}],{duration:300,easing:"ease-in-out",fill:"forwards"}),i.visibilityNeedsUpdate=!1)}}};Te(Hre,"DOMDrawSystem");I5e=Hre;ii();Wre=class{constructor(e,t){ct(this,"state"),ct(this,"dirty",!0),ct(this,"domTree"),this.state=e,this.domTree=t}update(){var e;if(this.dirty){for(let t of Array.from(this.domTree.children)){let r=(e=t.userData)==null?void 0:e.entityId,i=r!=null?this.state.entityMap.get(r):void 0;if(i){let n=i.component;(!n.enabled||!n.visible||!this.state.entityIds.has(r))&&this.domTree.removeChild(t)}else this.domTree.removeChild(t)}for(let t of this.state.entities){let r=t.component;r instanceof lp&&r.enabled&&r.markerContainer&&!this.domTree.contains(r.markerContainer)&&(r.markerContainer.userData={entityId:t.id},this.domTree.appendChild(r.markerContainer),r.updateDimensionsIfZeroWidthHeight())}this.dirty=!1}}};Te(Wre,"DOMVisibilitySystem");C5e=Wre;ii();Zre=class extends xC{constructor(e,t){super(),ct(this,"state"),ct(this,"dirty",!0),ct(this,"domTree"),ct(this,"observers",new Map),ct(this,"updateDimensions",Te(r=>{var i;for(let n of r){let a=(i=n.target.parentElement)==null?void 0:i.getAttribute("data-marker-id");if(a){let o=this.state.entityMap.get(a);if(o){let s=o.component;s instanceof lp&&(s.updateDimensions(n.contentRect.width,n.contentRect.height),s.collisionDirty=!0)}}}this.publish("dimensions-update")},"updateDimensions")),this.state=e,this.domTree=t}setupObserver(){var e;for(let t of this.observers.values())t.disconnect();this.observers.clear();for(let t of this.domTree.children){let r=t.getAttribute("data-marker-id");if(r!=null){let i=this.state.entityMap.get(r);if(i){let n=i.component;if((e=n.options)!=null&&e.dynamicResize){let a=new ResizeObserver(this.updateDimensions);a.observe(n.containerEl),this.observers.set(t.userData.entityId,a)}}}}}update(){this.dirty&&(this.setupObserver(),this.dirty=!1)}destroy(){for(let e of this.observers.values())e.disconnect();this.observers.clear()}};Te(Zre,"DOMResizeSystem");B5e=Zre,RS=9,Kre=class{constructor(e,t,r,i={}){zi(this,qS),zi(this,Jn),zi(this,Og),zi(this,bI),zi(this,Xl),zi(this,Ng),zi(this,ss),zi(this,Ug),zi(this,ch),zi(this,Qg),zi(this,vx),zi(this,Gd),zi(this,Vf,RS),zi(this,Hu,null),zi(this,ju,null),zi(this,Gu,null),zi(this,Vu,null),ct(this,"collidersNeedRecomputing",!0),zi(this,Wu),zi(this,KS,0),zi(this,wI,[]),zi(this,AN,Te(()=>{gt(this,Vu)&&(cancelAnimationFrame(gt(this,Vu)),Fr(this,Vu,null)),Fr(this,Vu,requestAnimationFrame(()=>{Fr(this,Vu,null),gt(this,ch).update(),gt(this,$S).call(this)}))},"#onVisibilityChanged")),zi(this,$S,Te(()=>{Fr(this,ju,requestAnimationFrame(()=>{Fr(this,ju,null),gt(this,Ug).update(gt(this,KS)),gt(this,Qg).update(!1)}))},"#draw2DEntities")),zi(this,mN,Te(()=>{gt(this,$S).call(this)},"#onDraw2D")),zi(this,gN,Te(()=>{gt(this,Gu)&&(cancelAnimationFrame(gt(this,Gu)),Fr(this,Gu,null)),Fr(this,Gu,requestAnimationFrame(()=>{Fr(this,Gu,null),gt(this,ch).playAnimations()}))},"#onAnimate2D"));var n,a;Fr(this,Jn,t),Fr(this,Og,e),Fr(this,bI,r),Fr(this,Wu,(n=i.watermark)!=null?n:{width:0,height:0,position:"bottom-left"}),Fr(this,Xl,document.createElement("canvas")),gt(this,Xl).style.cssText="position:absolute;top:0;left:0;width:100%;height:100%;pointer-events:none;z-index:1;",e.appendChild(gt(this,Xl));let o=document.createElement("div");o.classList.add("mappedin-2d-entities"),Object.assign(o.style,{position:"absolute",top:"0",left:"0",bottom:"0",right:"0",overflow:"hidden",pointerEvents:"none",zIndex:"2",transformStyle:"preserve-3d"}),e.appendChild(o),Fr(this,Ng,o),this.resize(),Fr(this,ss,new d5e(t,gt(this,Og).clientWidth,gt(this,Og).clientHeight,i.workerUrl,(a=i.useCollisionWorker)!=null?a:!0,e)),Fr(this,Ug,new E5e(t,gt(this,Xl),i.transformImageRequest)),Fr(this,ch,new M5e(t)),Fr(this,Qg,new I5e(t)),Fr(this,vx,new C5e(t,gt(this,Ng))),Fr(this,Gd,new B5e(t,gt(this,Ng))),gt(this,ss).on("visibility-changed",gt(this,AN),{signal:gt(this,ss).signal}),gt(this,ch).on("draw:2d",gt(this,mN),{signal:gt(this,ch).signal}),gt(this,ch).on("animate:2d",gt(this,gN),{signal:gt(this,ch).signal}),gt(this,Gd).on("dimensions-update",()=>{gt(this,ss).collidersDirty=!0,tN(this,qS,Jre).call(this)},{signal:gt(this,Gd).signal})}get collisionSystem(){return gt(this,ss)}get drawSystem(){return gt(this,Ug)}get domDrawSystem(){return gt(this,Qg)}registerEntity(e){gt(this,Jn).entityMap.set(e.id,e)}addEntity(e){gt(this,Jn).entityMap.set(e.id,e),gt(this,Jn).entities.add(e),gt(this,Jn).entityIds.add(e.id)}activateEntity(e){gt(this,Jn).entities.add(e),gt(this,Jn).entityIds.add(e.id)}deactivateEntity(e){gt(this,Jn).entities.delete(e),gt(this,Jn).entityIds.delete(e.id)}removeEntity(e){gt(this,Jn).entities.delete(e),gt(this,Jn).entityMap.delete(e.id),gt(this,Jn).entityIds.delete(e.id)}clearEntities(){gt(this,Jn).entities.clear(),gt(this,Jn).entityMap.clear(),gt(this,Jn).entityIds.clear()}getEntity(e){return gt(this,Jn).entityMap.get(e)}hasActiveEntity(e){return gt(this,Jn).entities.has(e)}resize(){var e;let{clientWidth:t,clientHeight:r}=gt(this,Og),i=gt(this,Jn).pixelRatio;gt(this,Xl).width=t*i,gt(this,Xl).height=r*i,gt(this,Xl).style.width=t+"px",gt(this,Xl).style.height=r+"px",(e=gt(this,ss))==null||e.resizeCanvas(t,r)}update(e,t,r=!1,i=[]){Fr(this,KS,e),Fr(this,wI,i),tN(this,qS,Xre).call(this),gt(this,vx).update(),gt(this,Gd).update(),gt(this,ju)&&(cancelAnimationFrame(gt(this,ju)),Fr(this,ju,null)),gt(this,Ug).update(e),gt(this,Qg).update(t);let n=this.collidersNeedRecomputing,a=!n&&r;n&&Fr(this,Vf,RS),XLe(this,Vf)._++,gt(this,Vf)>=RS&&(Fr(this,Vf,0),gt(this,ss).update(gt(this,Wu).width,gt(this,Wu).height,gt(this,Wu).position,a,i)),this.collidersNeedRecomputing=!1}updateWatermark(e){Fr(this,Wu,e)}markDirty(){gt(this,vx).dirty=!0,gt(this,Gd).dirty=!0,gt(this,ss).collidersDirty=!0,this.collidersNeedRecomputing=!0,Fr(this,Vf,RS)}cancelPendingFrames(){gt(this,Hu)&&(cancelAnimationFrame(gt(this,Hu)),Fr(this,Hu,null)),gt(this,ju)&&(cancelAnimationFrame(gt(this,ju)),Fr(this,ju,null)),gt(this,Gu)&&(cancelAnimationFrame(gt(this,Gu)),Fr(this,Gu,null)),gt(this,Vu)&&(cancelAnimationFrame(gt(this,Vu)),Fr(this,Vu,null))}createLabel(e,t){return new sp(e,t,gt(this,Jn).pixelRatio)}createMarker(e,t={}){return new lp(e,t)}showCollisionBoxes(){gt(this,ss).showCollisionBoxes()}hideCollisionBoxes(){gt(this,ss).hideCollisionBoxes()}destroy(){this.cancelPendingFrames(),gt(this,ss).destroy(),gt(this,Gd).destroy(),gt(this,Xl).remove(),gt(this,Ng).remove()}};Jn=new WeakMap,Og=new WeakMap,bI=new WeakMap,Xl=new WeakMap,Ng=new WeakMap,ss=new WeakMap,Ug=new WeakMap,ch=new WeakMap,Qg=new WeakMap,vx=new WeakMap,Gd=new WeakMap,Vf=new WeakMap,Hu=new WeakMap,ju=new WeakMap,Gu=new WeakMap,Vu=new WeakMap,Wu=new WeakMap,KS=new WeakMap,wI=new WeakMap,qS=new WeakSet,Xre=Te(function(){for(let e of gt(this,Jn).entities){let t=e.worldPosition,r=gt(this,bI).call(this,t.x,t.y,t.z);r?(e.component.projection.x=r.x,e.component.projection.y=r.y,e.component.offscreen=!1):e.component.offscreen=!0}},"#projectEntities"),Jre=Te(function(){gt(this,Hu)&&(cancelAnimationFrame(gt(this,Hu)),Fr(this,Hu,null)),Fr(this,Hu,requestAnimationFrame(()=>{Fr(this,Hu,null),gt(this,ss).update(gt(this,Wu).width,gt(this,Wu).height,gt(this,Wu).position,!1,gt(this,wI))}))},"#scheduleCollisionUpdate"),AN=new WeakMap,$S=new WeakMap,mN=new WeakMap,gN=new WeakMap,Te(Kre,"TwoDPipeline");qre=Kre;H();TJ=yC,PJ=vC,T5e=J.object({rank:mC.optional(),appearance:mre.optional(),interactive:J.boolean().default(!1),textPlacement:J.union([J.enum(TJ),J.array(J.enum(TJ))]).default(g_),occlude:J.boolean().default(!0)}),$re=J.object({rank:J.union([J.enum(["low","medium","high","always-visible"]),J.number()]).optional(),interactive:J.union([J.boolean(),J.literal("pointer-events-auto")]).optional(),id:J.string().optional(),placement:J.union([J.enum(PJ),J.array(J.enum(PJ))]).optional(),dynamicResize:J.boolean().optional(),zIndex:J.number().optional(),lowPriorityPin:J.object({size:J.number().positive().optional(),color:J.string().optional()}).optional()}),P5e=e=>{T5e.parse(e!=null?e:{})},eie=(e,t,r)=>{J.array(J.number()).min(2).max(3).parse(e),J.string().parse(t),P5e(r)};H();H();J5=[0,4,6,8,10],Pi=()=>{let e=new Array(16).fill(0),t=Math.random()*4294967296;for(let i=0;i<e.length;i++)i>0&&(i&3)===0&&(t=Math.random()*4294967296),e[i]=t>>>((i&3)<<3)&255;let r=e.map(i=>i.toString(16).padStart(2,"0"));return r[6]="4"+r[6][1],r[8]=["8","9","a","b"].includes(r[7][0])?r[7]:"a"+r[7][1],J5.map((i,n)=>r.slice(i,n===J5.length-1?void 0:J5[n+1]).join("")).join("-")};cc=class extends mi{constructor(){super(...arguments),I(this,"type","geometry"),I(this,"userData",{entityId:"",type:"geometry"}),I(this,"components",[])}raycast(e,t){this.userData.type==="model"&&this.children[0]&&e.intersectObject(this.children[0],!0).forEach(r=>{t.push(r)})}},ln=class{constructor(e,t){I(this,"id",Pi()),I(this,"components"),I(this,"parentId"),I(this,"type"),I(this,"entities2D",new Map),this.components=[e,t],this.type=e.type}getComponent(e){return this.components.find(t=>(t==null?void 0:t.type)===e)}get object3d(){return this.components[0].mesh}get parentObject3D(){var e;return(e=this.components[0].mesh)==null?void 0:e.parent}attach(e){this.parentObject3D instanceof da?e.object3d.userData.attachedEntityId=this.id:this.entities2D.set(e.id,e)}detach(e){this.parentObject3D instanceof da&&(e.object3d.userData.parentEntityId=void 0),this.entities2D.delete(e.id)}removeAllEntities(){for(let e of this.entities2D.values())this.detach(e)}};H();Kx=class extends mi{},iA=class{constructor(e,t,r=0){I(this,"id"),I(this,"type"),I(this,"entity2D"),I(this,"verticalOffset"),I(this,"object3d",new Kx),I(this,"components"),I(this,"disposed",!1),I(this,"worldPosition",new fe),this.id=e.id||Pi(),this.components=[e],this.verticalOffset=r,this.object3d=new Kx,this.object3d.position.set(t.x,t.y,t.z+r),this.object3d.userData.entityId=this.id,this.type=e.type,this.object3d.userData.type=this.type,this.positionDirty=!0,this.entity2D=new KLe(e,{x:t.x,y:t.y,z:t.z+r})}get parentObject3D(){return this.object3d.parent}get attachedTo(){return this.object3d.userData.attachedEntityId}getComponent(e){return this.components.find(t=>(t==null?void 0:t.type)===e)}get position(){return this.positionDirty&&(this.object3d.matrixAutoUpdate=!0,this.object3d.getWorldPosition(this.worldPosition),this.positionDirty=!1,this.object3d.matrixAutoUpdate=!1),this.worldPosition}get positionDirty(){return this.object3d.userData.worldPositionDirty}set positionDirty(e){this.object3d.userData.worldPositionDirty=e}updatePosition(e){this.object3d.position.copy(e),this.positionDirty=!0}setAltitude(e){this.object3d.position.z=e,this.positionDirty=!0}syncPosition(){let e=this.position;this.entity2D.worldPosition.x=e.x,this.entity2D.worldPosition.y=e.y,this.entity2D.worldPosition.z=e.z}};H();H();H();H();Ki=class{constructor(){I(this,"_subscribers",{}),I(this,"_abortController",new AbortController),I(this,"_cleanupFunctions",[])}get signal(){return this._abortController.signal}publish(e,t){!this._subscribers||!this._subscribers[e]||this.signal.aborted||this._subscribers[e].forEach(function(r){typeof r=="function"&&r(t)})}onAbort(e){this.signal.addEventListener("abort",()=>e(),{once:!0})}on(e,t,r){let i=r==null?void 0:r.signal;if(i!=null&&i.aborted||this._abortController&&this._abortController.signal.aborted)return()=>{};this._subscribers||(this._subscribers={}),this._subscribers[e]=this._subscribers[e]||[],this._subscribers[e].push(t);let n=()=>this.off(e,t);return i&&i.addEventListener("abort",n,{once:!0}),this._cleanupFunctions.push(n),n}off(e,t){if(!this._subscribers||this._subscribers[e]==null||this.signal.aborted)return;let r=this._subscribers[e].indexOf(t);r!==-1&&this._subscribers[e].splice(r,1)}destroy(){if(!this.signal.aborted){for(let e of this._cleanupFunctions)e();this._cleanupFunctions=[],this._subscribers={},this._abortController.abort()}}},rie=class extends Ki{constructor(e,t,r=!0){super(),I(this,"rendererState"),I(this,"convertTo3DMapPosition"),I(this,"textSet",new Set),I(this,"batchedTextMap",new Map),I(this,"resolvedBatchedTextMap",new Map),I(this,"useWorker",!0),I(this,"debugTextAreaMesh",new Map),(r===!1||!mbe())&&(this.useWorker=!1,l6(!1)),this.rendererState=e,this.convertTo3DMapPosition=t}remove(e){this.textSet.delete(e)}getBatchedText(e){return this.resolvedBatchedTextMap.get(e)}update(e){var t,r,i;let n,a,o,s=[];for(let l of this.rendererState.geometry3DIdsInScene)if(n=this.rendererState.geometry3DMap.get(l),(n==null?void 0:n.type)==="text3d"){a=n.components[0],o=n.components[1];let u=(t=a.mesh)==null?void 0:t.parent;if(!u||!(u instanceof Vi)||!(a instanceof y_))continue;if("textArea"in a.feature.properties&&a.mesh!=null&&a.polygonEntityId!=null&&a.textMesh==null&&a.mesh.parent!=null&&((i=(r=a.feature.properties)==null?void 0:r.textArea)==null?void 0:i.position)!=null){if(this.textSet.has(a.polygonEntityId))continue;this.textSet.add(a.polygonEntityId),this.batchedTextMap.has(u)||this.batchedTextMap.set(u,dy().then(({BatchedText:d})=>{let p=new d;return p.type="batchedtext",u.add(p),this.resolvedBatchedTextMap.set(u,p),p}));let h=this.batchedTextMap.get(u);if(!h)throw new Error("batched text required");s.push(DJ({entityId:l,textComponent:a,styleComponent:o,convertTo3DMapPosition:this.convertTo3DMapPosition,batchedMeshPromise:h,rendererState:this.rendererState,type:"text-area"}).then(d=>(d&&d.styleComponent.flipToFaceCamera!==!1&&this.flipIfNeeded(d.textComponent,e),d)))}else if(a.mesh!=null&&a.textMesh==null&&a.mesh.parent!=null){if(this.textSet.has(l.toString()))continue;this.textSet.add(l.toString()),this.batchedTextMap.has(u)||this.batchedTextMap.set(u,dy().then(({BatchedText:d})=>{let p=new d;return p.type="batchedtext",u.add(p),this.resolvedBatchedTextMap.set(u,p),p}));let h=this.batchedTextMap.get(u);if(!h)throw new Error("batched text required");s.push(DJ({entityId:l,textComponent:a,styleComponent:o,convertTo3DMapPosition:this.convertTo3DMapPosition,batchedMeshPromise:h,rendererState:this.rendererState,type:"point"}).then(d=>(d&&d.styleComponent.flipToFaceCamera!==!1&&this.flipIfNeeded(d.textComponent,e),d)))}let c=this.batchedTextMap.get(u);a.textMesh&&c&&Promise.all([c,Promise.resolve({meshComponent:a,styleComponent:o})]).then(([h,{meshComponent:d,styleComponent:p}])=>{let{textMesh:f}=d;if(f){if(h){let m=iie(h,f);d.visible&&!m?h.add(f):!d.visible&&m&&h.remove(f)}p.flipToFaceCamera&&this.flipIfNeeded(d,e)}})}return Promise.all(s).then(l=>{if(l.length===0)return;let u=new Set(l.map(h=>h==null?void 0:h.batchedText)),c=[];return u.forEach(h=>{c.push(new Promise(d=>{h?h.sync(()=>{d()}):d()}))}),this.publish("render"),Promise.all(c)})}flipIfNeeded(e,t){let r=e.textMesh;if(!r)return!1;let i=r.rotation.z,n=V1(i+t);return n>Math.PI/2&&n<3*Math.PI/2?(r.rotation.z=V1(i+Math.PI),r.updateMatrix(),!0):!1}showTextAreaMesh(){let e,t;for(let r of this.rendererState.geometry3DIdsInScene)if(e=this.rendererState.geometry3DMap.get(r),(e==null?void 0:e.type)==="text3d"&&(t=e.components[0],"textArea"in t.feature.properties)){let i=t.feature.properties.textArea;if(!i)continue;let n=new Qa(i.maxWidth,i.maxHeight),a=new Sr(n,new Fn({color:"pink"})),{textMesh:o}=t;if(!o)continue;let s=this.convertTo3DMapPosition(i.position,ox);a.position.copy(s),a.position.z=o.position.z-.1,a.rotation.z=o.rotation.z,K5.identity(),K5.makeRotationAxis(new fe(0,0,1),o.userData.rotationZ),ox.set(i.maxWidth/2,0,0),ox.applyMatrix4(K5),a.position.x-=ox.x,a.position.y-=ox.y,this.rendererState.geometryScene.add(a),this.debugTextAreaMesh.set(r,a)}this.publish("render")}hideTextAreaMesh(){this.debugTextAreaMesh.forEach(e=>{this.rendererState.geometryScene.remove(e)}),this.debugTextAreaMesh.clear(),this.publish("render")}};K5=new er,ox=new fe;D5e=.5,k5e=J.object({visible:J.boolean(),color:J.string(),flipToFaceCamera:J.boolean(),font:J.string().optional(),fontSize:J.number(),margin:J.union([J.number(),J.tuple([J.number(),J.number(),J.number(),J.number()])]),outlineColor:J.string(),outlineOpacity:J.number(),outlineBlur:J.union([J.number(),J.string()]),outlineWidth:J.number(),outlineOffsetX:J.number(),outlineOffsetY:J.number(),strokeWidth:J.number(),maxWidth:J.number().optional(),maxHeight:J.number().optional(),strokeOpacity:J.number(),strokeColor:J.string(),fillOpacity:J.number(),hoverColor:J.string().optional(),id:J.union([J.string(),J.number()]),type:J.literal("text3d"),position:J.tuple([J.number(),J.number(),J.number()]),content:J.string(),rotation:J.number()}),nie=J.strictObject(k5e.partial().omit({id:!0,type:!0}).shape),R5e=J.strictObject(nie.omit({margin:!0,position:!0,maxWidth:!0,maxHeight:!0,content:!0,rotation:!0}).shape),aie=J.strictObject({appearance:nie.optional(),parentId:J.string().optional()}),y_=class{constructor(e){I(this,"mesh",new cc),I(this,"textMesh"),I(this,"type","text3d"),I(this,"feature"),I(this,"parent"),I(this,"batchedText"),I(this,"polygonEntityId"),this.feature=e}get visible(){return this.batchedText&&this.textMesh?iie(this.batchedText,this.textMesh):this.textMesh?this.textMesh.visible:!1}set visible(e){this.batchedText&&this.textMesh?e?this.batchedText.addText(this.textMesh):this.batchedText.removeText(this.textMesh):this.textMesh&&(this.textMesh.visible=e),this.mesh.visible=e}};H();u6=class{constructor(e){I(this,"type","outline"),I(this,"color"),I(this,"dirty",!0),I(this,"enabled",!0),he(this,xx,!1),I(this,"edgeColors"),I(this,"edgeVisibility"),I(this,"geometry"),I(this,"ranges"),I(this,"topFaceVerticesIndices"),this.color=e}get currentOpacity(){return this.edgeColors&&this.ranges?this.edgeColors.array[this.ranges.start*4+3]:0}set visible(e){if(!this.edgeVisibility||!this.ranges||A(this,xx)===e)return;xe(this,xx,e);let t=this.edgeVisibility.array,r=e?1:0;for(let i=0;i<this.ranges.count;i++){let n=this.ranges.start+i;t[n]=r}this.edgeVisibility.needsUpdate=!0}get visible(){return A(this,xx)}get currentColor(){return this.edgeColors&&this.ranges?[this.edgeColors.array[this.ranges.start*4],this.edgeColors.array[this.ranges.start*4+1],this.edgeColors.array[this.ranges.start*4+2]]:[0,0,0]}};xx=new WeakMap;H();H();H();H();F5e=class extends eh{constructor(e){let t=e,r=3,i=r*4;super(new Uint8Array(e*i),r,e,Xn,Ss),I(this,"_width"),I(this,"_height"),I(this,"_propertiesLength"),this._width=i,this._height=t,this._propertiesLength=r}setColor(e,t,r){let i=this.image.data,n=e*this._width;i[n]=Math.round(t.r*255),i[n+1]=Math.round(t.g*255),i[n+2]=Math.round(t.b*255),i[n+3]=0,i[n+4]=Math.round(r.r*255),i[n+5]=Math.round(r.g*255),i[n+6]=Math.round(r.b*255),i[n+7]=0,this.needsUpdate=!0}getColor(e){let t=this.image.data,r=e*this._width,i=new Dt(t[r]/255,t[r+1]/255,t[r+2]/255),n=new Dt(t[r+4]/255,t[r+5]/255,t[r+6]/255);return{color:i,topColor:n}}setTexture(e,t,r){let i=this.image.data,n=e*this._width;i[n+8]=t?255:0,i[n+9]=r?255:0,i[n+10]=0,i[n+11]=0,this.needsUpdate=!0}getTexture(e){let t=this.image.data,r=e*this._width,i=t[r+8]===255,n=t[r+9]===255;return{texture:i,topTexture:n}}};H();z5e=\`#define LAMBERT
|
|
4888
|
+
\`,Pre=class extends xC{constructor(e,t,r,i,n=!0,a){if(super(),zi(this,pN),ct(this,"worker"),ct(this,"collidersDirty",!0),ct(this,"packedMessage",[[],0,0,0,0,0,"bottom-left"]),ct(this,"visibleCollidersQTree",new yx(new wn(0,0,0,0))),ct(this,"interactiveCollidersQTree",new yx(new wn(0,0,0,0))),zi(this,JS),zi(this,zg),zi(this,Lg),zi(this,Bx,!1),zi(this,bn,null),zi(this,Zd,null),ct(this,"working",!1),ct(this,"componentArray",[]),ct(this,"update",Te((o,s,l="bottom-left",u=!1,c=[])=>{let h=!1;if(this.collidersDirty){this.packedMessage=[[],0,0,0,0,0,"bottom-left"],this.componentArray=[];for(let v of gt(this,JS).entities)this.componentArray.push(v.component);this.resize(o,s,l),this.collidersDirty=!1,h=!0}else for(let v=0;v<this.componentArray.length;v++)if(this.componentArray[v].collisionDirty){h=!0;break}h&&this.componentArray.sort((v,_)=>_.rank-v.rank);let d=this.packedMessage[0],p=c.length+this.componentArray.length,f=u;d.length=p;let m=0,g;for(let v=0;v<c.length;v++){let _=c[v];d[m]==null&&(d[m]=[[],0,0,0,0,0,-1]),g=d[m],g[0]=[[_.h/2,_.h/2,_.w/2,_.w/2,Mre]],g[1]=1,g[2]=1,g[3]=_.x,g[4]=_.y,g[5]=0,g[6]=-1,m++}for(let v=0;v<this.componentArray.length;v++){let _=this.componentArray[v],x=_.toPackedMessage(f);d[m]==null&&(d[m]=[[],0,0,0,0,0,-1]),g=d[m],g[0]=x.bboxes,g[1]=x.enabled&&_.visible&&(x.rank===5||!_.isOccluded)?1:0,g[2]=x.rank===5?1:0,g[3]=x.x,g[4]=x.y,g[5]=x.shouldCollideWithScreenEdges?1:0,g[6]=x.lockedToStrategyIndex,m++}this.working||(this.working=!0,this.worker.postMessage(this.packedMessage))},"update")),ct(this,"resolve",Te(o=>{if(this.working=!1,this.collidersDirty||!o.data)return;let s=o.data.colliders,l=-1,u,c,h=new wn(0,0,gt(this,zg),gt(this,Lg));this.visibleCollidersQTree=new yx(h),this.interactiveCollidersQTree=new yx(h);for(let d=0;d<this.componentArray.length;d++){let p=this.componentArray[d];if(s[d]==null)continue;l=s[d][0],u=s[d][2];let f=p.offscreen,m=s[d][1]===1;p.offscreen=m,l!==-1&&u!=null?(c=new wn(u.x,u.y,u.w,u.h,{entityId:p.id}),this.visibleCollidersQTree.insert(c),p.interactive&&this.interactiveCollidersQTree.insert(c),(p.canShow===!1||p.visibilityNeedsUpdate!==!1||f&&!m)&&"visibilityNeedsUpdate"in p&&(p.visibilityNeedsUpdate="show"),l!==-1&&l!==p.currentStrategyIndex&&(p.activeBoundingBox=c,p.onStrategySelected(l))):((p.canShow===!0||p.visibilityNeedsUpdate!==!1)&&"visibilityNeedsUpdate"in p&&(p.visibilityNeedsUpdate="hide"),l!==-1&&l!==p.currentStrategyIndex&&p.onStrategySelected(l))}tN(this,pN,Tre).call(this),this.publish("visibility-changed")},"resolve")),ct(this,"destroy",Te(()=>{var o;this.worker.terminate(),(o=gt(this,bn))==null||o.remove()},"destroy")),Fr(this,JS,e),Fr(this,zg,t),Fr(this,Lg,r),!n)this.worker=new kS;else if(i)this.worker=new Worker(i);else if(CJ)try{this.worker=new Worker(URL.createObjectURL(new Blob([CJ])))}catch(o){this.worker=new kS}else this.worker=new kS;this.worker.onerror=()=>{this.working=!1,this.worker=new kS,this.worker.onmessage=o=>this.resolve(o)},this.worker.onmessage=o=>this.resolve(o),a&&(Fr(this,bn,document.createElement("canvas")),gt(this,bn).style.cssText="position:absolute;top:0;left:0;pointer-events:none;z-index:0;display:none;",gt(this,bn).width=t,gt(this,bn).height=r,gt(this,bn).style.width=t+"px",gt(this,bn).style.height=r+"px",a.appendChild(gt(this,bn)),Fr(this,Zd,gt(this,bn).getContext("2d")))}resizeCanvas(e,t){Fr(this,zg,e),Fr(this,Lg,t),gt(this,bn)&&(gt(this,bn).width=e,gt(this,bn).height=t,gt(this,bn).style.width=e+"px",gt(this,bn).style.height=t+"px")}resize(e,t,r){this.packedMessage[6]=r,this.packedMessage[5]=t,this.packedMessage[4]=e,this.packedMessage[3]=gt(this,zg),this.packedMessage[2]=gt(this,Lg)}showCollisionBoxes(){Fr(this,Bx,!0),gt(this,bn)&&(gt(this,bn).style.display="block")}hideCollisionBoxes(){Fr(this,Bx,!1),gt(this,Zd)&>(this,bn)&&(gt(this,Zd).clearRect(0,0,gt(this,bn).width,gt(this,bn).height),gt(this,bn).style.display="none")}};JS=new WeakMap,zg=new WeakMap,Lg=new WeakMap,Bx=new WeakMap,bn=new WeakMap,Zd=new WeakMap,pN=new WeakSet,Tre=Te(function(){!gt(this,Bx)||!gt(this,Zd)||!gt(this,bn)||(gt(this,Zd).clearRect(0,0,gt(this,bn).width,gt(this,bn).height),this.visibleCollidersQTree.drawObjects(gt(this,Zd)))},"#drawDebug"),Te(Pre,"CollisionSystem");d5e=Pre;ii();ii();ii();p5e=Te((function(){let e,t;return r=>{if((!t||!t)&&(e=document.createElement("canvas"),e.width=500*r,e.height=500*r,e.style.width="500px",e.style.height="500px",t=e.getContext("2d")),!t)throw new Error("Could not get 2D context");return{measureCanvas:e,measureCanvasContext:t}}}),"createMeasureCanvasContext")(),f5e=Te(({text:e,size:t,maxWidth:r,pixelRatio:i,maxLines:n=2,lineHeight:a=1.2,options:o={strokeText:!0}})=>{let s="bold ".concat(t*i,"px 'InterUI-Regular', Helvetica Neue, Arial, sans-serif"),{measureCanvasContext:l}=p5e(i);l.font=s;let u=[],c=e.split(" "),h=0,d=0,p=0;for(;d<c.length;){let g=c[d];if(h===n&&h>0){u[h-1]+="...";break}if(u[h]==null&&(u[h]=g,d++),c.length===1){u[h]=g;break}if(c[d]==null)break;let{width:v}=l.measureText(u[h]+" "+c[d]);v<=r*i?(u[h]+=" "+c[d],d++):h++}u.forEach(g=>{let{width:v}=l.measureText(g);p=Math.max(v,p)});let f=t*i*a,m=u.length*f;return{maxWidth:p,maxHeight:m,lines:u.length,draw:Te((g,v,_)=>{u.length===1?(o.strokeText&&g.strokeText(u[0],v,_),g.fillText(u[0],v,_)):(o.strokeText&&(g.strokeText(u[0],v,_-f/2),g.strokeText(u[1],v,_+f/2)),g.fillText(u[0],v,_-f/2),g.fillText(u[1],v,_+f/2))},"draw")}},"shaveText");ii();Dre="[MappedinJS]";Te(kre,"createLogger");A5e=kre(),m5e=A5e;ii();ii();Te(Rre,"formatMessage");Fre=class extends Error{constructor(e,t=Dre){super(Rre(e,t)),this.name="MappedinError"}};Te(Fre,"MappedinError");g5e=Fre,s6=Te(e=>e,"linearEase"),y5e=Te(e=>e*e,"quadEaseIn"),zre=Te(e=>1-Math.cos(e*Math.PI/2),"easeIn"),v5e=Te(e=>1-(1-e)*(1-e),"quadEaseOut"),x5e=Te(e=>1-Math.pow(1-e,3),"cubicEaseOut"),Lre={linear:s6,"ease-in":y5e,"ease-out":v5e,"ease-in-out":zre,"ease-out-cubic":x5e};Te(Ore,"interpolate");Te(Nre,"getInterpolationBreakpoint");Te(Ure,"interpolateMulti");ii();_5e=(()=>{let e;return{getDeviceType(){if(e)return e;let{userAgent:t,platform:r,maxTouchPoints:i}=window.navigator,n=/(iphone|ipod|ipad)/i.test(t),a=r==="iPad"||r.indexOf("Mac")===0&&i>0&&!window.MSStream,o=/android/i.test(t);return e={isIpad:a,isMobile:o||n||a,isIOS:n,isAndroid:o,isSafari12:/Version\\/12.+Safari/.test(t),isFirefox:/Firefox/.test(t),isWindows:/windows/i.test(t)},e},_reset(){e=void 0}}})(),BJ=_5e.getDeviceType,Qre=(()=>{let e,t,r;function i(){if(t!==void 0)return t;e||(e=document.createElement("canvas"));let a=e.getContext("webgl")||e.getContext("experimental-webgl");if(!a)return t;try{let o=BJ().isFirefox?null:a.getExtension("WEBGL_debug_renderer_info");return t=o?a.getParameter(o.UNMASKED_RENDERER_WEBGL):a.getParameter(a.RENDERER),t}catch(o){let s=new Error("Failed getting device info");throw s.name="FailedGettingDeviceInfo",s}}Te(i,"getInfo");function n(){var a,o;if(!BJ().isWindows)return!1;if(r!==void 0)return r;let s=(o=(a=b5e())==null?void 0:a.toLowerCase())!=null?o:"";return r=s.includes("intel")&&(s.includes("uhd")||s.includes("iris")),r}return Te(n,"shouldDisableOffscreenCanvas"),{getInfo:i,shouldDisableOffscreenCanvas:n,_setCanvas(a){e=a,t=void 0,r=void 0}}})(),b5e=Qre.getInfo,w5e=Qre.shouldDisableOffscreenCanvas;ii();Te(jre,"createImage");Te(fN,"fastTrunc");Te(Gre,"cyrb53");Vre=class extends xC{constructor(e,t,r){super(),ct(this,"dirty",!1),ct(this,"state"),ct(this,"colliderContext"),ct(this,"colliderCanvas"),ct(this,"transformRequestFunc"),ct(this,"transformRequest",Te(i=>Qe(this,null,function*(){return this.transformRequestFunc?yield this.transformRequestFunc(i):{url:i}}),"transformRequest")),ct(this,"pinCache",{}),ct(this,"imageCache",{}),ct(this,"imagePromiseCache",{}),ct(this,"imageDimensionsCache",{}),ct(this,"textCache",{}),ct(this,"update",Te(i=>{let n=this.state.pixelRatio;this.colliderContext.clearRect(0,0,this.colliderCanvas.width,this.colliderCanvas.height);let a,o,s,l,u,c;for(let h of this.state.entities)if((h==null?void 0:h.component)instanceof yre&&!h.disposed){if(c=h.component,u=c.appearance.iconVisible,c.appearance.icon!=null&&u!=null){let p=typeof u=="boolean"?u:i>=u;p!==c.iconVisible&&(c.iconVisible=p,c.dirty=!0)}if((c.pinDirty||c.dirty||this.dirty)&&c.calculatePinSize(),c.offscreen||!c.visible)continue;if(o={active:c.appearance.pinColor,inactive:c.appearance.pinColorInactive},s={active:c.appearance.pinOutlineColor,inactive:c.appearance.pinOutlineColorInactive},l=fN(c.pinSize),a="".concat(o.active,"-").concat(o.inactive,"-").concat(s.active,"-").concat(s.inactive,"-").concat(l,"-").concat(c.iconVisible),c.labelCacheId=a,(!this.pinCache[a]||this.dirty)&&(this.prepare(c,a,this.colliderContext),c.dirty=!0),(c.appearance.icon&&(!c.imageHash||c.pinDirty)||this.dirty)&&this.cacheImage(c),this.textCache[c.id]==null||c.textDirty||this.dirty){c.dirty=!0,this.textCache[c.id]={};let{textDrawFn:p,width:f,height:m}=this.processText(c.text,c.appearance.textSize,c.appearance.maxWidth,c.appearance.maxLines,c.appearance.lineHeight),g=["left","center","right"];for(let v of g)this.textCache[c.id][v]=this.textToCanvas(p,c.appearance.textSize,v,f,m,c.appearance.textColor,c.appearance.textOutlineColor);c.dimensions={width:Math.ceil(f/n),height:Math.ceil(m/n)}}let d=1;if(c.appearance.iconScale)if(typeof c.appearance.iconScale=="number")d=c.appearance.iconScale;else{let{on:p,input:f,output:m,easing:g}=c.appearance.iconScale;p==="zoom-level"?d=fN(Ure(i,f,m,g!=null?g:"linear")):m5e.warn("Unsupported interpolation property: ".concat(p))}c.recomputeCurrentStrategy(c.iconVisible?d:1),c.canShow&&(c.enabled||c.visibilityNeedsUpdate!==!1)&&this.draw(c,a,this.colliderContext),c.textDirty=!1,c.pinDirty=!1}this.dirty=!1},"update")),ct(this,"processText",Te((i,n,a,o,s)=>{let l=this.state.pixelRatio,{draw:u,maxWidth:c,maxHeight:h}=f5e({text:i,size:n,pixelRatio:l,maxWidth:a,maxLines:o,lineHeight:s});return{textDrawFn:u,width:c+2.5*l*2,height:h+2.5*l*2}},"processText")),ct(this,"textToCanvas",Te((i,n,a,o,s,l,u)=>{let c=this.state.pixelRatio,h,d=o,p=s;window.OffscreenCanvas!=null&&!w5e()?h=new OffscreenCanvas(d,p):(h=document.createElement("canvas"),h.width=d,h.height=p,h.style.width=d+"px",h.style.height=p+"px");let f=h.getContext("2d",{willReadFrequently:!0});if(!f)return;let m=2.5*c;f.textAlign=a,f.font="bold ".concat(n*c,"px 'InterUI-Regular', Helvetica Neue, Arial, sans-serif"),f.textBaseline="middle",f.lineJoin="miter",f.miterLimit=2,f.strokeStyle="white",f.lineWidth=m,f.fillStyle=l,f.strokeStyle=u;let g=a==="left"?m/2:a==="center"?d/2:d-m/2;return i(f,g,(p+m/2)/2),h},"textToCanvas")),ct(this,"cacheImage",Te(i=>{if(!i.appearance.icon)return;let n=Gre(i.appearance.icon);this.imagePromiseCache[n]||(this.imagePromiseCache[n]=new Promise(a=>{this.transformRequest(i.appearance.icon).then(o=>{let s=jre(o.url);s.onload=()=>{this.imageCache[n]=s,this.publish("img:loaded"),a(s)}})})),i.imageHash!==n&&(i.imageHash=n,this.imagePromiseCache[n].then(()=>{i.dirty=!0}))},"cacheImage")),ct(this,"createPinCanvas",Te((i,n,a,o,s=1)=>{let l,u=this.state.pixelRatio,c=i.totalPinSize*2*u*s;window.OffscreenCanvas!=null?l=new OffscreenCanvas(c,c):(l=document.createElement("canvas"),l.width=c,l.height=c,l.style.width=c/u+"px",l.style.height=c/u+"px");let h=l.getContext("2d");return h.shadowColor="rgba(0,0,0,0.3)",h.shadowOffsetY=2*u,h.shadowBlur=5*u,h.beginPath(),h.arc(c/2,c/2,(n/2+2.5*u/2)*s,0,2*Math.PI),h.fillStyle=a,h.fill(),h.beginPath(),h.arc(c/2,c/2,n/2*s,0,2*Math.PI),h.shadowColor="transparent",h.fillStyle=o,h.fill(),l},"createPinCanvas")),ct(this,"prepare",Te((i,n,a)=>{let o=this.state.pixelRatio;a.lineWidth=4*o;let s=typeof i.appearance.iconScale=="number"?[i.appearance.iconScale]:i.appearance.iconScale==null?[]:i.appearance.iconScale.output,l=s.length>0?Math.max(...s):void 0,u=this.createPinCanvas(i,i.pinSize,i.appearance.pinOutlineColor,i.appearance.pinColor,l),c=this.createPinCanvas(i,3.5*o,i.appearance.pinOutlineColorInactive,i.appearance.pinColorInactive,l);this.pinCache[n]=[u,c]},"prepare")),this.state=e,this.colliderCanvas=t,this.colliderContext=t.getContext("2d"),this.transformRequestFunc=r}draw(e,t,r){var i;if(!e.canShow||!e.visible)return;r.save(),r.globalAlpha=e.currentOpacity;let n=this.state.pixelRatio,a=e.projection.x*n,o=e.projection.y*n,s=e.style.pinVisibility===1?this.pinCache[t][0]:this.pinCache[t][1],l=e.style.pinVisibility===1?e.scaledPinSize*n:e.totalPinSize*n;if(e.style.pinVisibility!==0&&r.drawImage(s,a-l,o-l,l*2,l*2),e.appearance.icon&&e.iconVisible&&e.imageHash&&e.appearance.iconSize&&this.imageCache[e.imageHash]&&e.style.pinVisibility===1){let u=this.imageCache[e.imageHash],c=(e.scaledPinSize-e.scaledIconPadding)*n,h=e.appearance.iconFit,d=c,p=c,f="".concat(e.imageHash,"_").concat(h);if(this.imageDimensionsCache[f])d=this.imageDimensionsCache[f].width,p=this.imageDimensionsCache[f].height;else{let m=u.width*n,g=u.height*n;if(h==="contain"){let v=Math.sqrt(bs(m,2)+bs(g,2)),_=c/v;d=m*_,p=g*_}if(h==="cover"){let v=c/m,_=c/g,x=Math.max(v,_);d=m*x,p=g*x}}r.save(),r.beginPath(),r.arc(a,o,c/2,0,2*Math.PI),r.closePath(),((i=e==null?void 0:e.appearance)==null?void 0:i.iconOverflow)!=="visible"&&r.clip(),r.drawImage(u,a-d/2,o-p/2,d,p),r.restore()}e.style.textLabelVisible&&e.style.textAlign!=null&&e.style.left!=null&&e.style.top!=null&&r.drawImage(this.textCache[e.id][e.style.textAlign],a+e.style.left*n,o+e.style.top*n),r.restore()}};Te(Vre,"TwoDDrawSystem");E5e=Vre;ii();Yre=class extends xC{constructor(e){super(),ct(this,"state"),ct(this,"animating",new Map),ct(this,"isAnimating",!1),ct(this,"startTime",-1),ct(this,"showDuration",300),ct(this,"hideDuration",250),ct(this,"update",Te(()=>{var t;this.animating.clear();for(let r of this.state.entities){let i=r.component;i instanceof yre&&(i.visibilityNeedsUpdate==="show"?(i.canShow=!0,this.animating.set(i,[i.currentOpacity,(t=i.appearance.opacity)!=null?t:1])):i.visibilityNeedsUpdate==="hide"&&this.animating.set(i,[i.currentOpacity,0]))}this.startTime=performance.now(),this.publish("animate:2d")},"update")),ct(this,"playAnimations"),this.state=e,this.playAnimations=this._playAnimations}_playAnimations(){let e=performance.now();for(let[t,[r,i]]of this.animating.entries()){let n=i===1?this.showDuration:this.hideDuration,a=(e-this.startTime)/n;t.currentOpacity=Ore(a,0,1,r,i,i===0?s6:zre),e-this.startTime>=n&&(i===1?t.canShow=!0:i===0&&(t.canShow=!1),t.visibilityNeedsUpdate=!1,this.animating.delete(t))}this.publish("draw:2d"),this.animating.size>0&&this.publish("animate:2d")}};Te(Yre,"TwoDVisibilitySystem");M5e=Yre;ii();S5e=["running","paused"],Hre=class{constructor(e){ct(this,"state"),this.state=e}update(e){let t;for(let r of this.state.entities)if(r&&(t=r.component,t&&"containerEl"in t&&t.markerContainer!=null)){let i=t;i.visibilityNeedsUpdate!==!1&&(i.visibilityNeedsUpdate==="show"?i.canShow=!0:i.canShow=!1),i.offscreen&&(i.animation&&(i.animation.cancel(),i.animation=null),i.markerContainer.style.opacity="0");let n=i.animation!=null&&(i.animation.pending===!0||S5e.includes(i.animation.playState));if((i.canShow&&i.visible===!0||n)&&!i.offscreen&&(i.markerContainer.style.transform="translate3D(".concat(i.projection.x,"px, ").concat(i.projection.y,"px, 0px)")),i.canShow===!0&&i.visible===!0&&!i.offscreen?i.markerContainer.style.pointerEvents=e?"none":i.pointerEvents:i.markerContainer.style.pointerEvents="none",i.currentStrategyIndex===-1&&i.visible&&i.visibilityNeedsUpdate==="show")continue;i.visibilityNeedsUpdate!==!1&&!i.offscreen&&(i.visibilityNeedsUpdate==="show"&&(i.markerContainer.style.opacity="0"),i.animation&&i.animation.cancel(),i.animation=i.markerContainer.animate([{opacity:i.canShow&&i.visible?"1":"0"}],{duration:300,easing:"ease-in-out",fill:"forwards"}),i.visibilityNeedsUpdate=!1)}}};Te(Hre,"DOMDrawSystem");I5e=Hre;ii();Wre=class{constructor(e,t){ct(this,"state"),ct(this,"dirty",!0),ct(this,"domTree"),this.state=e,this.domTree=t}update(){var e;if(this.dirty){for(let t of Array.from(this.domTree.children)){let r=(e=t.userData)==null?void 0:e.entityId,i=r!=null?this.state.entityMap.get(r):void 0;if(i){let n=i.component;(!n.enabled||!n.visible||!this.state.entityIds.has(r))&&this.domTree.removeChild(t)}else this.domTree.removeChild(t)}for(let t of this.state.entities){let r=t.component;r instanceof lp&&r.enabled&&r.markerContainer&&!this.domTree.contains(r.markerContainer)&&(r.markerContainer.userData={entityId:t.id},this.domTree.appendChild(r.markerContainer),r.updateDimensionsIfZeroWidthHeight())}this.dirty=!1}}};Te(Wre,"DOMVisibilitySystem");C5e=Wre;ii();Zre=class extends xC{constructor(e,t){super(),ct(this,"state"),ct(this,"dirty",!0),ct(this,"domTree"),ct(this,"observers",new Map),ct(this,"updateDimensions",Te(r=>{var i;for(let n of r){let a=(i=n.target.parentElement)==null?void 0:i.getAttribute("data-marker-id");if(a){let o=this.state.entityMap.get(a);if(o){let s=o.component;s instanceof lp&&(s.updateDimensions(n.contentRect.width,n.contentRect.height),s.collisionDirty=!0)}}}this.publish("dimensions-update")},"updateDimensions")),this.state=e,this.domTree=t}setupObserver(){var e;for(let t of this.observers.values())t.disconnect();this.observers.clear();for(let t of this.domTree.children){let r=t.getAttribute("data-marker-id");if(r!=null){let i=this.state.entityMap.get(r);if(i){let n=i.component;if((e=n.options)!=null&&e.dynamicResize){let a=new ResizeObserver(this.updateDimensions);a.observe(n.containerEl),this.observers.set(t.userData.entityId,a)}}}}}update(){this.dirty&&(this.setupObserver(),this.dirty=!1)}destroy(){for(let e of this.observers.values())e.disconnect();this.observers.clear()}};Te(Zre,"DOMResizeSystem");B5e=Zre,RS=9,Kre=class{constructor(e,t,r,i={}){zi(this,qS),zi(this,Jn),zi(this,Og),zi(this,bI),zi(this,Xl),zi(this,Ng),zi(this,ss),zi(this,Ug),zi(this,ch),zi(this,Qg),zi(this,vx),zi(this,Gd),zi(this,Vf,RS),zi(this,Hu,null),zi(this,ju,null),zi(this,Gu,null),zi(this,Vu,null),ct(this,"collidersNeedRecomputing",!0),zi(this,Wu),zi(this,KS,0),zi(this,wI,[]),zi(this,AN,Te(()=>{gt(this,Vu)&&(cancelAnimationFrame(gt(this,Vu)),Fr(this,Vu,null)),Fr(this,Vu,requestAnimationFrame(()=>{Fr(this,Vu,null),gt(this,ch).update(),gt(this,$S).call(this)}))},"#onVisibilityChanged")),zi(this,$S,Te(()=>{Fr(this,ju,requestAnimationFrame(()=>{Fr(this,ju,null),gt(this,Ug).update(gt(this,KS)),gt(this,Qg).update(!1)}))},"#draw2DEntities")),zi(this,mN,Te(()=>{gt(this,$S).call(this)},"#onDraw2D")),zi(this,gN,Te(()=>{gt(this,Gu)&&(cancelAnimationFrame(gt(this,Gu)),Fr(this,Gu,null)),Fr(this,Gu,requestAnimationFrame(()=>{Fr(this,Gu,null),gt(this,ch).playAnimations()}))},"#onAnimate2D"));var n,a;Fr(this,Jn,t),Fr(this,Og,e),Fr(this,bI,r),Fr(this,Wu,(n=i.watermark)!=null?n:{width:0,height:0,position:"bottom-left"}),Fr(this,Xl,document.createElement("canvas")),gt(this,Xl).style.cssText="position:absolute;top:0;left:0;width:100%;height:100%;pointer-events:none;z-index:1;",e.appendChild(gt(this,Xl));let o=document.createElement("div");o.classList.add("mappedin-2d-entities"),Object.assign(o.style,{position:"absolute",top:"0",left:"0",bottom:"0",right:"0",overflow:"hidden",pointerEvents:"none",zIndex:"2",transformStyle:"preserve-3d"}),e.appendChild(o),Fr(this,Ng,o),this.resize(),Fr(this,ss,new d5e(t,gt(this,Og).clientWidth,gt(this,Og).clientHeight,i.workerUrl,(a=i.useCollisionWorker)!=null?a:!0,e)),Fr(this,Ug,new E5e(t,gt(this,Xl),i.transformImageRequest)),Fr(this,ch,new M5e(t)),Fr(this,Qg,new I5e(t)),Fr(this,vx,new C5e(t,gt(this,Ng))),Fr(this,Gd,new B5e(t,gt(this,Ng))),gt(this,ss).on("visibility-changed",gt(this,AN),{signal:gt(this,ss).signal}),gt(this,ch).on("draw:2d",gt(this,mN),{signal:gt(this,ch).signal}),gt(this,ch).on("animate:2d",gt(this,gN),{signal:gt(this,ch).signal}),gt(this,Gd).on("dimensions-update",()=>{gt(this,ss).collidersDirty=!0,tN(this,qS,Jre).call(this)},{signal:gt(this,Gd).signal})}get collisionSystem(){return gt(this,ss)}get drawSystem(){return gt(this,Ug)}get domDrawSystem(){return gt(this,Qg)}registerEntity(e){gt(this,Jn).entityMap.set(e.id,e)}addEntity(e){gt(this,Jn).entityMap.set(e.id,e),gt(this,Jn).entities.add(e),gt(this,Jn).entityIds.add(e.id)}activateEntity(e){gt(this,Jn).entities.add(e),gt(this,Jn).entityIds.add(e.id)}deactivateEntity(e){gt(this,Jn).entities.delete(e),gt(this,Jn).entityIds.delete(e.id)}removeEntity(e){gt(this,Jn).entities.delete(e),gt(this,Jn).entityMap.delete(e.id),gt(this,Jn).entityIds.delete(e.id)}clearEntities(){gt(this,Jn).entities.clear(),gt(this,Jn).entityMap.clear(),gt(this,Jn).entityIds.clear()}getEntity(e){return gt(this,Jn).entityMap.get(e)}hasActiveEntity(e){return gt(this,Jn).entities.has(e)}resize(){var e;let{clientWidth:t,clientHeight:r}=gt(this,Og),i=gt(this,Jn).pixelRatio;gt(this,Xl).width=t*i,gt(this,Xl).height=r*i,gt(this,Xl).style.width=t+"px",gt(this,Xl).style.height=r+"px",(e=gt(this,ss))==null||e.resizeCanvas(t,r)}update(e,t,r=!1,i=[]){Fr(this,KS,e),Fr(this,wI,i),tN(this,qS,Xre).call(this),gt(this,vx).update(),gt(this,Gd).update(),gt(this,ju)&&(cancelAnimationFrame(gt(this,ju)),Fr(this,ju,null)),gt(this,Ug).update(e),gt(this,Qg).update(t);let n=this.collidersNeedRecomputing,a=!n&&r;n&&Fr(this,Vf,RS),XLe(this,Vf)._++,gt(this,Vf)>=RS&&(Fr(this,Vf,0),gt(this,ss).update(gt(this,Wu).width,gt(this,Wu).height,gt(this,Wu).position,a,i)),this.collidersNeedRecomputing=!1}updateWatermark(e){Fr(this,Wu,e)}markDirty(){gt(this,vx).dirty=!0,gt(this,Gd).dirty=!0,gt(this,ss).collidersDirty=!0,this.collidersNeedRecomputing=!0,Fr(this,Vf,RS)}cancelPendingFrames(){gt(this,Hu)&&(cancelAnimationFrame(gt(this,Hu)),Fr(this,Hu,null)),gt(this,ju)&&(cancelAnimationFrame(gt(this,ju)),Fr(this,ju,null)),gt(this,Gu)&&(cancelAnimationFrame(gt(this,Gu)),Fr(this,Gu,null)),gt(this,Vu)&&(cancelAnimationFrame(gt(this,Vu)),Fr(this,Vu,null))}createLabel(e,t){return new sp(e,t,gt(this,Jn).pixelRatio)}createMarker(e,t={}){return new lp(e,t)}showCollisionBoxes(){gt(this,ss).showCollisionBoxes()}hideCollisionBoxes(){gt(this,ss).hideCollisionBoxes()}destroy(){this.cancelPendingFrames(),gt(this,ss).destroy(),gt(this,Gd).destroy(),gt(this,Xl).remove(),gt(this,Ng).remove()}};Jn=new WeakMap,Og=new WeakMap,bI=new WeakMap,Xl=new WeakMap,Ng=new WeakMap,ss=new WeakMap,Ug=new WeakMap,ch=new WeakMap,Qg=new WeakMap,vx=new WeakMap,Gd=new WeakMap,Vf=new WeakMap,Hu=new WeakMap,ju=new WeakMap,Gu=new WeakMap,Vu=new WeakMap,Wu=new WeakMap,KS=new WeakMap,wI=new WeakMap,qS=new WeakSet,Xre=Te(function(){for(let e of gt(this,Jn).entities){let t=e.worldPosition,r=gt(this,bI).call(this,t.x,t.y,t.z);r?(e.component.projection.x=r.x,e.component.projection.y=r.y,e.component.offscreen=!1):e.component.offscreen=!0}},"#projectEntities"),Jre=Te(function(){gt(this,Hu)&&(cancelAnimationFrame(gt(this,Hu)),Fr(this,Hu,null)),Fr(this,Hu,requestAnimationFrame(()=>{Fr(this,Hu,null),gt(this,ss).update(gt(this,Wu).width,gt(this,Wu).height,gt(this,Wu).position,!1,gt(this,wI))}))},"#scheduleCollisionUpdate"),AN=new WeakMap,$S=new WeakMap,mN=new WeakMap,gN=new WeakMap,Te(Kre,"TwoDPipeline");qre=Kre;H();TJ=yC,PJ=vC,T5e=J.object({rank:mC.optional(),appearance:mre.optional(),interactive:J.boolean().default(!1),textPlacement:J.union([J.enum(TJ),J.array(J.enum(TJ))]).default(g_),occlude:J.boolean().default(!0)}),$re=J.object({rank:J.union([J.enum(["low","medium","high","always-visible"]),J.number()]).optional(),interactive:J.union([J.boolean(),J.literal("pointer-events-auto")]).optional(),id:J.string().optional(),placement:J.union([J.enum(PJ),J.array(J.enum(PJ))]).optional(),dynamicResize:J.boolean().optional(),zIndex:J.number().optional(),lowPriorityPin:J.object({size:J.number().positive().optional(),color:J.string().optional()}).optional()}),P5e=e=>{T5e.parse(e!=null?e:{})},eie=(e,t,r)=>{J.array(J.number()).min(2).max(3).parse(e),J.string().parse(t),P5e(r)};H();H();J5=[0,4,6,8,10],Pi=()=>{let e=new Array(16).fill(0),t=Math.random()*4294967296;for(let i=0;i<e.length;i++)i>0&&(i&3)===0&&(t=Math.random()*4294967296),e[i]=t>>>((i&3)<<3)&255;let r=e.map(i=>i.toString(16).padStart(2,"0"));return r[6]="4"+r[6][1],r[8]=["8","9","a","b"].includes(r[7][0])?r[7]:"a"+r[7][1],J5.map((i,n)=>r.slice(i,n===J5.length-1?void 0:J5[n+1]).join("")).join("-")};cc=class extends mi{constructor(){super(...arguments),I(this,"type","geometry"),I(this,"userData",{entityId:"",type:"geometry"}),I(this,"components",[])}raycast(e,t){this.userData.type==="model"&&this.children[0]&&e.intersectObject(this.children[0],!0).forEach(r=>{t.push(r)})}},ln=class{constructor(e,t){I(this,"id",Pi()),I(this,"components"),I(this,"parentId"),I(this,"type"),I(this,"entities2D",new Map),this.components=[e,t],this.type=e.type}getComponent(e){return this.components.find(t=>(t==null?void 0:t.type)===e)}get object3d(){return this.components[0].mesh}get parentObject3D(){var e;return(e=this.components[0].mesh)==null?void 0:e.parent}attach(e){this.parentObject3D instanceof da?e.object3d.userData.attachedEntityId=this.id:this.entities2D.set(e.id,e)}detach(e){this.parentObject3D instanceof da&&(e.object3d.userData.parentEntityId=void 0),this.entities2D.delete(e.id)}removeAllEntities(){for(let e of this.entities2D.values())this.detach(e)}};H();Kx=class extends mi{},iA=class{constructor(e,t,r=0){I(this,"id"),I(this,"type"),I(this,"entity2D"),I(this,"verticalOffset"),I(this,"object3d",new Kx),I(this,"components"),I(this,"disposed",!1),I(this,"worldPosition",new fe),this.id=e.id||Pi(),this.components=[e],this.verticalOffset=r,this.object3d=new Kx,this.object3d.position.set(t.x,t.y,t.z+r),this.object3d.userData.entityId=this.id,this.type=e.type,this.object3d.userData.type=this.type,this.positionDirty=!0,this.entity2D=new KLe(e,{x:t.x,y:t.y,z:t.z+r})}get parentObject3D(){return this.object3d.parent}get attachedTo(){return this.object3d.userData.attachedEntityId}getComponent(e){return this.components.find(t=>(t==null?void 0:t.type)===e)}get position(){return this.positionDirty&&(this.object3d.matrixAutoUpdate=!0,this.object3d.getWorldPosition(this.worldPosition),this.positionDirty=!1,this.object3d.matrixAutoUpdate=!1),this.worldPosition}get positionDirty(){return this.object3d.userData.worldPositionDirty}set positionDirty(e){this.object3d.userData.worldPositionDirty=e}updatePosition(e){this.object3d.position.copy(e),this.positionDirty=!0}setAltitude(e){this.object3d.position.z=e,this.positionDirty=!0}syncPosition(){let e=this.position;this.entity2D.worldPosition.x=e.x,this.entity2D.worldPosition.y=e.y,this.entity2D.worldPosition.z=e.z}};H();H();H();H();Ki=class{constructor(){I(this,"_subscribers",{}),I(this,"_abortController",new AbortController),I(this,"_cleanupFunctions",[])}get signal(){return this._abortController.signal}publish(e,t){!this._subscribers||!this._subscribers[e]||this.signal.aborted||this._subscribers[e].forEach(function(r){typeof r=="function"&&r(t)})}onAbort(e){this.signal.addEventListener("abort",()=>e(),{once:!0})}on(e,t,r){let i=r==null?void 0:r.signal;if(i!=null&&i.aborted||this._abortController&&this._abortController.signal.aborted)return()=>{};this._subscribers||(this._subscribers={}),this._subscribers[e]=this._subscribers[e]||[],this._subscribers[e].push(t);let n=()=>this.off(e,t);return i&&i.addEventListener("abort",n,{once:!0}),this._cleanupFunctions.push(n),n}off(e,t){if(!this._subscribers||this._subscribers[e]==null||this.signal.aborted)return;let r=this._subscribers[e].indexOf(t);r!==-1&&this._subscribers[e].splice(r,1)}destroy(){if(!this.signal.aborted){for(let e of this._cleanupFunctions)e();this._cleanupFunctions=[],this._subscribers={},this._abortController.abort()}}},rie=class extends Ki{constructor(e,t,r=!0){super(),I(this,"rendererState"),I(this,"convertTo3DMapPosition"),I(this,"textSet",new Set),I(this,"batchedTextMap",new Map),I(this,"resolvedBatchedTextMap",new Map),I(this,"useWorker",!0),I(this,"debugTextAreaMesh",new Map),(r===!1||!mbe())&&(this.useWorker=!1,l6(!1)),this.rendererState=e,this.convertTo3DMapPosition=t}remove(e){this.textSet.delete(e)}getBatchedText(e){return this.resolvedBatchedTextMap.get(e)}update(e){var t,r,i;let n,a,o,s=[];for(let l of this.rendererState.geometry3DIdsInScene)if(n=this.rendererState.geometry3DMap.get(l),(n==null?void 0:n.type)==="text3d"){a=n.components[0],o=n.components[1];let u=(t=a.mesh)==null?void 0:t.parent;if(!u||!(u instanceof Vi)||!(a instanceof y_))continue;if("textArea"in a.feature.properties&&a.mesh!=null&&a.polygonEntityId!=null&&a.textMesh==null&&a.mesh.parent!=null&&((i=(r=a.feature.properties)==null?void 0:r.textArea)==null?void 0:i.position)!=null){if(this.textSet.has(a.polygonEntityId))continue;this.textSet.add(a.polygonEntityId),this.batchedTextMap.has(u)||this.batchedTextMap.set(u,dy().then(({BatchedText:d})=>{let p=new d;return p.type="batchedtext",u.add(p),this.resolvedBatchedTextMap.set(u,p),p}));let h=this.batchedTextMap.get(u);if(!h)throw new Error("batched text required");s.push(DJ({entityId:l,textComponent:a,styleComponent:o,convertTo3DMapPosition:this.convertTo3DMapPosition,batchedMeshPromise:h,rendererState:this.rendererState,type:"text-area"}).then(d=>(d&&d.styleComponent.flipToFaceCamera!==!1&&this.flipIfNeeded(d.textComponent,e),d)))}else if(a.mesh!=null&&a.textMesh==null&&a.mesh.parent!=null){if(this.textSet.has(l.toString()))continue;this.textSet.add(l.toString()),this.batchedTextMap.has(u)||this.batchedTextMap.set(u,dy().then(({BatchedText:d})=>{let p=new d;return p.type="batchedtext",u.add(p),this.resolvedBatchedTextMap.set(u,p),p}));let h=this.batchedTextMap.get(u);if(!h)throw new Error("batched text required");s.push(DJ({entityId:l,textComponent:a,styleComponent:o,convertTo3DMapPosition:this.convertTo3DMapPosition,batchedMeshPromise:h,rendererState:this.rendererState,type:"point"}).then(d=>(d&&d.styleComponent.flipToFaceCamera!==!1&&this.flipIfNeeded(d.textComponent,e),d)))}let c=this.batchedTextMap.get(u);a.textMesh&&c&&Promise.all([c,Promise.resolve({meshComponent:a,styleComponent:o})]).then(([h,{meshComponent:d,styleComponent:p}])=>{let{textMesh:f}=d;if(f){if(h){let m=iie(h,f);d.visible&&!m?h.add(f):!d.visible&&m&&h.remove(f)}p.flipToFaceCamera&&this.flipIfNeeded(d,e)}})}return Promise.all(s).then(l=>{if(l.length===0)return;let u=new Set(l.map(h=>h==null?void 0:h.batchedText)),c=[];return u.forEach(h=>{c.push(new Promise(d=>{h?h.sync(()=>{d()}):d()}))}),this.publish("render"),Promise.all(c)})}flipIfNeeded(e,t){let r=e.textMesh;if(!r)return!1;let i=r.rotation.z,n=V1(i+t);return n>Math.PI/2&&n<3*Math.PI/2?(r.rotation.z=V1(i+Math.PI),r.updateMatrix(),!0):!1}showTextAreaMesh(){let e,t;for(let r of this.rendererState.geometry3DIdsInScene)if(e=this.rendererState.geometry3DMap.get(r),(e==null?void 0:e.type)==="text3d"&&(t=e.components[0],"textArea"in t.feature.properties)){let i=t.feature.properties.textArea;if(!i)continue;let n=new Qa(i.maxWidth,i.maxHeight),a=new Sr(n,new Fn({color:"pink"})),{textMesh:o}=t;if(!o)continue;let s=this.convertTo3DMapPosition(i.position,ox);a.position.copy(s),a.position.z=o.position.z-.1,a.rotation.z=o.rotation.z,K5.identity(),K5.makeRotationAxis(new fe(0,0,1),o.userData.rotationZ),ox.set(i.maxWidth/2,0,0),ox.applyMatrix4(K5),a.position.x-=ox.x,a.position.y-=ox.y,this.rendererState.geometryScene.add(a),this.debugTextAreaMesh.set(r,a)}this.publish("render")}hideTextAreaMesh(){this.debugTextAreaMesh.forEach(e=>{this.rendererState.geometryScene.remove(e)}),this.debugTextAreaMesh.clear(),this.publish("render")}};K5=new er,ox=new fe;D5e=.5,k5e=J.object({visible:J.boolean(),color:J.string(),flipToFaceCamera:J.boolean(),font:J.string().optional(),fontSize:J.number(),margin:J.union([J.number(),J.tuple([J.number(),J.number(),J.number(),J.number()])]),outlineColor:J.string(),outlineOpacity:J.number(),outlineBlur:J.union([J.number(),J.string()]),outlineWidth:J.number(),outlineOffsetX:J.number(),outlineOffsetY:J.number(),strokeWidth:J.number(),maxWidth:J.number().optional(),maxHeight:J.number().optional(),strokeOpacity:J.number(),strokeColor:J.string(),fillOpacity:J.number(),hoverColor:J.string().optional(),id:J.union([J.string(),J.number()]),type:J.literal("text3d"),position:J.tuple([J.number(),J.number(),J.number()]),content:J.string(),rotation:J.number()}),nie=J.strictObject(k5e.partial().omit({id:!0,type:!0}).shape),R5e=J.strictObject(nie.omit({margin:!0,position:!0,maxWidth:!0,maxHeight:!0,content:!0,rotation:!0}).shape),aie=J.strictObject({appearance:nie.optional(),parentId:J.string().optional()}),y_=class{constructor(e){I(this,"mesh",new cc),I(this,"textMesh"),I(this,"type","text3d"),I(this,"feature"),I(this,"parent"),I(this,"batchedText"),I(this,"polygonEntityId"),this.feature=e}get visible(){return this.batchedText&&this.textMesh?iie(this.batchedText,this.textMesh):this.textMesh?this.textMesh.visible:!1}set visible(e){this.batchedText&&this.textMesh?e?this.batchedText.addText(this.textMesh):this.batchedText.removeText(this.textMesh):this.textMesh&&(this.textMesh.visible=e),this.mesh.visible=e}};H();u6=class{constructor(e){I(this,"type","outline"),I(this,"color"),I(this,"dirty",!0),I(this,"enabled",!0),he(this,xx,!1),I(this,"edgeColors"),I(this,"edgeVisibility"),I(this,"geometry"),I(this,"ranges"),I(this,"topFaceVerticesIndices"),this.color=e}get currentOpacity(){return this.edgeColors&&this.ranges?this.edgeColors.array[this.ranges.start*4+3]:0}set visible(e){if(!this.edgeVisibility||!this.ranges||A(this,xx)===e)return;xe(this,xx,e);let t=this.edgeVisibility.array,r=e?1:0;for(let i=0;i<this.ranges.count;i++){let n=this.ranges.start+i;t[n]=r}this.edgeVisibility.needsUpdate=!0}get visible(){return A(this,xx)}get currentColor(){return this.edgeColors&&this.ranges?[this.edgeColors.array[this.ranges.start*4],this.edgeColors.array[this.ranges.start*4+1],this.edgeColors.array[this.ranges.start*4+2]]:[0,0,0]}};xx=new WeakMap;H();H();H();H();F5e=class extends eh{constructor(e){let t=e,r=3,i=r*4;super(new Uint8Array(e*i),r,e,Xn,Ss),I(this,"_width"),I(this,"_height"),I(this,"_propertiesLength"),this._width=i,this._height=t,this._propertiesLength=r}setColor(e,t,r){let i=this.image.data,n=e*this._width;i[n]=Math.round(t.r*255),i[n+1]=Math.round(t.g*255),i[n+2]=Math.round(t.b*255),i[n+3]=0,i[n+4]=Math.round(r.r*255),i[n+5]=Math.round(r.g*255),i[n+6]=Math.round(r.b*255),i[n+7]=0,this.needsUpdate=!0}getColor(e){let t=this.image.data,r=e*this._width,i=new Dt(t[r]/255,t[r+1]/255,t[r+2]/255),n=new Dt(t[r+4]/255,t[r+5]/255,t[r+6]/255);return{color:i,topColor:n}}setTexture(e,t,r){let i=this.image.data,n=e*this._width;i[n+8]=t?255:0,i[n+9]=r?255:0,i[n+10]=0,i[n+11]=0,this.needsUpdate=!0}getTexture(e){let t=this.image.data,r=e*this._width,i=t[r+8]===255,n=t[r+9]===255;return{texture:i,topTexture:n}}};H();z5e=\`#define LAMBERT
|
|
4889
4889
|
varying vec3 vViewPosition;
|
|
4890
4890
|
varying vec4 vPosition;
|
|
4891
4891
|
varying vec2 vUv;
|
|
@@ -6189,7 +6189,7 @@ void main() {
|
|
|
6189
6189
|
max-height: 300px;
|
|
6190
6190
|
overflow-y: auto;
|
|
6191
6191
|
min-width: 200px;
|
|
6192
|
-
\`,document.body.appendChild(this.element)}getActualInstanceCount(e){for(let t of e.mesh.children)if(t.isInstancedMesh)return t.count;return e.count}update(e,t,r){var i,n,a;if(!this.enabled||!this.element)return;let o='<div style="margin-bottom: 5px; font-weight: bold; border-bottom: 1px solid #666; padding-bottom: 5px;">Model Batches</div>';if(e.size===0)o+='<div style="color: #888;">No models loaded</div>';else{let s=0,l=0,u=Array.from(e.keys()).sort((c,h)=>{var d,p;let f=(d=t.get(c))!=null?d:"",m=(p=t.get(h))!=null?p:"";return f.localeCompare(m)});for(let c of u){let h=e.get(c);if(!h||h.size===0)continue;let d=(i=t.get(c))!=null?i:"unknown_".concat(c),p=0;for(let m of h)p+=this.getActualInstanceCount(m);s+=h.size,l+=p,o+='<div style="margin: 6px 0 2px 0;">',o+='<span style="color: #4fc3f7; font-weight: bold;">"'.concat(d,'"</span>'),o+='<span style="color: #aaa;"> ('.concat(p," total, ").concat(h.size," batch").concat(h.size!==1?"es":"",")</span>"),o+="</div>";let f=Array.from(h).sort((m,g)=>m.id.localeCompare(g.id));for(let m of f){let g=this.getActualInstanceCount(m),v=m.count,_=g!==v,x=m.opacity===1?"":" @".concat((m.opacity*100).toFixed(0),"%");o+='<div style="margin-left: 12px; color: #ccc; font-size: 11px;">',o+='<span style="color: #81c784;">'.concat(m.id,"</span>"),_?o+='<span style="color: #e57373;">: '.concat(g," actual / ").concat(v," tracked</span>"):o+='<span style="color: #fff;">: '.concat(g," instance").concat(g!==1?"s":"","</span>"),x&&(o+='<span style="color: #ffb74d;">'.concat(x,"</span>")),o+="</div>"}}o+='<div style="margin-top: 8px; padding-top: 5px; border-top: 1px solid #666; color: #fff;">',o+='Total: <span style="color: #81c784;">'.concat(l," instance").concat(l!==1?"s":"","</span>"),o+=', <span style="color: #e57373;">'.concat(s," draw call").concat(s!==1?"s":"","</span>"),o+="</div>"}if(r.size>0){o+='<div style="margin-top: 8px; border-top: 1px solid #666; padding-top: 5px;">',o+='<div style="margin-bottom: 5px; font-weight: bold; color: #ff9800;">Non-instanced Models</div>',o+='<span style="color: #aaa;">('.concat(r.size," total, ").concat(r.size," draw call").concat(r.size!==1?"s":"",")</span>");let s=new Map;for(let[l,u]of r){let c=(n=s.get(u.urlHash))!=null?n:[];c.push(l),s.set(u.urlHash,c)}for(let[l,u]of s){let c=(a=t.get(l))!=null?a:"unknown_".concat(l);o+='<div style="margin: 6px 0 2px 0;">',o+='<span style="color: #ff9800;">"'.concat(c,'"</span>'),o+='<span style="color: #aaa;"> ('.concat(u.length," model").concat(u.length!==1?"s":"",")</span>"),o+="</div>";for(let h of u)o+='<div style="margin-left: 12px; color: #ccc; font-size: 11px;">'.concat(h,"</div>")}o+="</div>"}this.element.innerHTML=o}destroy(){this.element&&(this.element.remove(),this.element=null)}},Iy=100,a7e=!0,o7e=class extends Ki{constructor(e,t){super(),I(this,"transparencyChanged",!1),I(this,"state"),I(this,"convertTo3DMapPosition"),I(this,"loader"),I(this,"loadPromises",[]),I(this,"gltfCache",new Map),I(this,"gltfLoadPromises",new Map),I(this,"instanceMap",new Map),I(this,"debugUI"),I(this,"modelNames",new Map),I(this,"batchCounter",0),I(this,"batchByMesh",new Map),I(this,"batchesByUrlHash",new Map),I(this,"nonInstancedModels",new Map),I(this,"pendingOpacityChanges",new Map),I(this,"detachedEntityIds",new Set),I(this,"tempMatrix",new er),I(this,"tempQuaternion",new Sa),I(this,"tempEuler",new Ua),I(this,"tempScale",new fe),I(this,"tempColor",new Dt),I(this,"endFrame",()=>{this.transparencyChanged=!1}),this.state=e,this.convertTo3DMapPosition=t,this.debugUI=new n7e}createBatch(e,t,r,i,n){this.batchCounter++;let a={id:"batch_".concat(this.batchCounter),mesh:e,count:0,maxCount:n,opacity:i,urlHash:t,containerId:r};return e.userData.batchId=a.id,this.batchByMesh.set(e,a),this.batchesByUrlHash.has(t)||this.batchesByUrlHash.set(t,new Set),this.batchesByUrlHash.get(t).add(a),a}removeBatch(e){var t,r;this.batchByMesh.delete(e.mesh),(t=this.batchesByUrlHash.get(e.urlHash))==null||t.delete(e),((r=this.batchesByUrlHash.get(e.urlHash))==null?void 0:r.size)===0&&this.batchesByUrlHash.delete(e.urlHash)}getBatchForMesh(e){return this.batchByMesh.get(e)}updateDebugUI(){this.debugUI.update(this.batchesByUrlHash,this.modelNames,this.nonInstancedModels)}showDebug(){this.debugUI.show(),this.updateDebugUI()}hideDebug(){this.debugUI.hide()}getGLTFLoader(){return Qe(this,null,function*(){if(this.loader)return this.loader;let{GLTFLoader:e}=yield Promise.resolve().then(()=>(pne(),dne));return this.loader=new e,this.loader})}getOrLoadGLTF(e,t){return Qe(this,null,function*(){let r=this.gltfCache.get(t);if(r)return r;let i=this.gltfLoadPromises.get(t);if(i)return i;let n=yield this.getGLTFLoader(),a=new Promise((o,s)=>{let l=c=>{this.gltfCache.set(t,c),this.gltfLoadPromises.delete(t),o(c)},u=c=>{this.gltfLoadPromises.delete(t),s(c)};die(e)?n.parse(pie(e),"",l,u):fie(e)?n.parse(Aie(e),"",l,u):n.load(e,l,void 0,u)});return this.gltfLoadPromises.set(t,a),a})}createNonInstancedModel(e,t,r,i){var n,a,o,s,l;let u=e.components[0],c=e.components[1],h=u.feature,d=t.scene.clone(!0);d.updateWorldMatrix(!0,!0);let p=new cc;p.userData={nonInstanced:!0,entityId:String(e.id),type:"model"},d.traverse(b=>{let E=b;if("isMesh"in E&&E.isMesh===!0){let M=E.clone();M.geometry=E.geometry.clone(),M.geometry.applyMatrix4(E.matrixWorld),M.position.set(0,0,0),M.rotation.set(0,0,0),M.scale.set(1,1,1),Array.isArray(E.material)?M.material=E.material.map(S=>S.clone()):M.material=E.material.clone(),M.userData={entityId:String(e.id)},p.add(M)}});let{x:f,y:m}=this.convertTo3DMapPosition(h.geometry.coordinates[1],h.geometry.coordinates[0],0),g=(n=h.geometry.coordinates[2])!=null?n:0,v=((a=c.verticalOffset)!=null?a:0)+g;u.altitude=v,u.position.set(f,m,u.altitude);let _=(o=c.scale)!=null?o:by,x=(s=c.rotation)!=null?s:wy;if(p.position.copy(u.position),p.rotation.set(Zr.degToRad(x[0]),Zr.degToRad(x[1]),Zr.degToRad(x[2])),p.scale.set(_[0],_[1],_[2]),c.color&&Kne(p,c.color),c.opacity!=null&&c.opacity!==1&&qne(p,c.opacity),c.visibleThroughGeometry&&r7e(p,!0),!c.EXPERIMENTAL_clippingEnabled){let b=(l=c.opacity)!=null?l:1;mA(p,b)}r.add(p),u.mesh=p,u.instanceIndex=-1,this.nonInstancedModels.set(e.id,{urlHash:i,mesh:p}),this.updateDebugUI()}resizeInstanceContainer(e,t){let r=t7e(e.maxCount),i=I_(t,r),n=e.object.children,a=i.children;for(let s=0;s<n.length;s++){let l=n[s],u=a[s];if(!(!(l instanceof An)||!(u instanceof An))){for(let c=0;c<e.count;c++)l.getMatrixAt(c,this.tempMatrix),u.setMatrixAt(c,this.tempMatrix),u.userData.entities[c]=l.userData.entities[c],l.instanceColor&&(l.getColorAt(c,this.tempColor),u.setColorAt(c,this.tempColor));u.count=e.count,u.instanceMatrix.needsUpdate=!0}}let o=e.object.parent;return o&&(o.remove(e.object),o.add(i)),e.object=i,e.maxCount=r,e}getOrCreateInstanceContainer(e,t,r){let i=this.instanceMap.get(e);i||(i=new Map,this.instanceMap.set(e,i));let n=i.get(t);if(n){let a=this.getBatchForMesh(n.object);a&&(n.count=a.count)}else{let a=I_(r,Iy);n={object:a,count:0,maxCount:Iy},i.set(t,n);let o=this.createBatch(a,t,e,1,Iy);n.batch=o}return n}createModelFromFeature(e,t,r){let i=new fB(t),n=ze({},r);t.properties.verticalOffset!=null&&(n.verticalOffset=t.properties.verticalOffset),t.properties.rotation!=null&&(n.rotation=t.properties.rotation),t.properties.scale!=null&&(n.scale=t.properties.scale);let a=new B6(n);i.instancingDisabled=a.visibleThroughGeometry===!0||a.EXPERIMENTAL_clippingEnabled===!0;let o=new ln(i,a);return o.id=e,a.EXPERIMENTAL_clippingEnabled&&(o.components[7]=new IC),o}populateModelGroup(e,t,r){return Qe(this,null,function*(){var i,n,a,o;let s=up(t),l=this.getOrLoadGLTF(t,s).then(h=>{var d;let p=r.parent;if(!(p instanceof Vi))return;let f=p.userData.entityId,m=this.getOrCreateInstanceContainer(f,s,h);m.count+e.size>m.maxCount&&(m=this.resizeInstanceContainer(m,h)),m.object.parent||r.add(m.object);let g=new er,v=new Ua,_=new Sa,x=new fe,b,E,M;for(let S of e.values()){if(M=this.state.geometry3DMap.get(S),!M||(M==null?void 0:M.type)!=="model"||!this.state.geometry3DsInScene.has(M))continue;let D=M.components[0],T=M.components[1];if(D.instanceIndex!=null&&D.instanceIndex>=0||D.instancingDisabled&&D.mesh)continue;if(E=D.feature,D.instancingDisabled){this.createNonInstancedModel(M,h,r,s);continue}let P=T.opacity!=null&&T.opacity!==1;if(P){let F=(d=T.opacity)!=null?d:1,B=Math.round(F*100),z,O,j=this.batchesByUrlHash.get(s);if(j){for(let Z of j)if(Z.containerId===p.userData.entityId&&Math.round(Z.opacity*100)===B&&Z.count<Z.maxCount){z=Z,O=Z.mesh;break}}if(!z||!O){let Z=I_(h,Iy);Z.userData.detached=!0,Z.userData.sharedOpacity=F,r.add(Z),z=this.createBatch(Z,s,p.userData.entityId,F,Iy),O=Z,C_(Z,F),mA(Z,F)}let Y=z.count;D.mesh=O,D.instanceIndex=Y,z.count++,this.detachedEntityIds.add(M.id)}else D.mesh=m.object,D.instanceIndex=m.count;K6(M),T.dirty=!1,b=this.convertTo3DMapPosition(E.geometry.coordinates[1],E.geometry.coordinates[0],0),D.position.set(b.x,b.y,D.altitude),qC(v,T.rotation),$C(x,T.scale),_.setFromEuler(v),g.compose(D.position,_,x);let k=D.mesh,R=D.instanceIndex;for(let F of k.children)F instanceof An&&(F.setMatrixAt(R,g),F.userData.entities[R]=M.id,F.count=R+1,F.instanceMatrix.needsUpdate=!0);if(e8(k,R,T.color,T.material),!P){m.count++;let F=this.getBatchForMesh(m.object);F&&(F.count=m.count)}q6(D.mesh)}this.publish("model-loaded")});this.loadPromises.push(l);let u=(n=(i=r.parent)==null?void 0:i.userData)==null?void 0:n.entityId,c=(a=this.instanceMap.get(u))==null?void 0:a.get(s);return(o=c==null?void 0:c.object)!=null?o:new cc})}update(){for(let t of this.state.geometryGroupIdsToLoad.values()){let r=this.state.geometry3DMap.get(t);r instanceof da&&r.userData.dirty&&r.userData.modelURL&&(this.populateModelGroup(r.userData.entities3D,r.userData.modelURL,r),r.userData.dirty=!1,r.userData.localCenter=void 0)}this.updateModelStyles(),this.rebatchDetachedInstances(),this.flushPendingOpacityChanges(),this.updateDebugUI();let e=this.loadPromises;return this.loadPromises=[],Promise.all(e)}rebatchDetachedInstances(){var e,t,r,i;if(!a7e||this.detachedEntityIds.size===0)return;let n=new Map;for(let a of this.detachedEntityIds){let o=this.state.geometry3DMap.get(a);if(!o||o.type!=="model")continue;let s=o.components[0],l=o.components[1],u=(e=s.mesh)==null?void 0:e.userData;if(!((t=s.mesh)!=null&&t.parent))continue;let c=(r=l.opacity)!=null?r:1,h=u==null?void 0:u.sharedOpacity;if(Math.round(c*100)===100&&h!==void 0){this.pendingOpacityChanges.set(o.id,{entity:o,targetOpacity:c});continue}if(h!==void 0&&Math.abs(c-h)<=.01)continue;if(h!==void 0&&Math.abs(c-h)>.01){this.pendingOpacityChanges.set(o.id,{entity:o,targetOpacity:c});continue}let d=s.mesh.parent;if(!(d instanceof da))continue;let p=d.userData.modelURL;if(!p)continue;let f=up(p),m=(i=l.opacity)!=null?i:1,g=Math.round(m*100);n.has(f)||n.set(f,new Map);let v=n.get(f);v.has(g)||v.set(g,[]),v.get(g).push(o)}for(let[a,o]of n.entries()){let s=this.gltfCache.get(a);if(s)for(let[l,u]of o.entries()){if(u.length<2)continue;let c=l/100;this.createSharedBatchForDetached(u,s,c,a)}}this.publish("batch-changed")}createSharedBatchForDetached(e,t,r,i){var n;if(e.length<2)return;let a=(n=e[0].components[0].mesh)==null?void 0:n.parent;if(!a)return;let o=a.parent,s=o instanceof Vi?o.userData.entityId:"unknown",l=I_(t,e.length);l.userData.detached=!0,l.userData.sharedOpacity=r,a.add(l);let u=this.createBatch(l,i,s,r,e.length);C_(l,r),mA(l,r);let c=new er,h=new Ua,d=new Sa,p=new fe,f,m,g=0;for(let v of e){let _=v.components[0],x=v.components[1],b=_.mesh;if(b){let E=this.getBatchForMesh(b);E&&this.removeBatch(E),$6(b)}_.mesh=l,_.instanceIndex=g,m=_.feature,f=this.convertTo3DMapPosition(m.geometry.coordinates[1],m.geometry.coordinates[0],0),_.position.set(f.x,f.y,_.altitude),qC(h,x.rotation),$C(p,x.scale),x.visible===!1&&p.set(0,0,0),d.setFromEuler(h),c.compose(_.position,d,p);for(let E of l.children)E instanceof An&&(E.setMatrixAt(g,c),E.userData.entities[g]=v.id,E.count=g+1,E.instanceMatrix.needsUpdate=!0);e8(l,g,x.color,x.material),g++}u.count=g,q6(l)}removeInstanceFromBatch(e,t,r){var i;let n=e.count-1,a=e.opacity===1&&((i=t.userData)==null?void 0:i.detached)!==!0;if(e.count===1){if(a){e.count=0;for(let c of t.children)c instanceof An&&(c.count=0,c.instanceMatrix.needsUpdate=!0);let l=this.instanceMap.get(e.containerId),u=l==null?void 0:l.get(e.urlHash);u&&u.object===e.mesh&&(u.count=0),this.updateDebugUI();return}this.removeBatch(e),$6(t),this.updateDebugUI();return}for(let l of t.children)if(l instanceof An){if(r!==n){l.getMatrixAt(n,this.tempMatrix),l.getColorAt(n,this.tempColor),l.setMatrixAt(r,this.tempMatrix),l.setColorAt(r,this.tempColor);let u=l.userData.entities[n];if(u){l.userData.entities[r]=u;let c=this.state.geometry3DMap.get(u);c&&(c.components[0].instanceIndex=r)}}delete l.userData.entities[n],l.count=n,l.instanceMatrix.needsUpdate=!0,l.instanceColor&&(l.instanceColor.needsUpdate=!0)}e.count=n;let o=this.instanceMap.get(e.containerId),s=o==null?void 0:o.get(e.urlHash);s&&s.object===e.mesh&&(s.count=n),this.updateDebugUI()}updateModelStyles(){var e,t,r,i,n;for(let a of this.state.geometry3DsInScene){if((a==null?void 0:a.type)!=="model")continue;let o=a.components[1],s=a.components[0];if(!o.dirty&&!s.positionDirty)continue;if(s.instancingDisabled){this.updateNonInstancedModelStyle(a),o.dirty=!1,s.positionDirty=!1;continue}let l=(e=s.mesh)==null?void 0:e.userData,u=l==null?void 0:l.detached,c=o.opacity!=null&&o.opacity!==1,h=(t=o.opacity)!=null?t:1,d=l==null?void 0:l.sharedOpacity,p=d!==void 0&&Math.abs(h-d)>.01;if((c&&!u&&s.mesh||p)&&this.pendingOpacityChanges.set(a.id,{entity:a,targetOpacity:h}),K6(a),this.updateInstanceTransform(a),this.updateInstanceColor(a,o.color,o.material),((i=(r=s.mesh)==null?void 0:r.userData)==null?void 0:i.detached)&&s.mesh){let f=(n=o.opacity)!=null?n:1;C_(s.mesh,f),mA(s.mesh,f)&&(this.transparencyChanged=!0)}o.dirty=!1,s.positionDirty=!1}}flushPendingOpacityChanges(){var e,t;if(this.pendingOpacityChanges.size===0)return;let r=new Map,i=new Map,n=(a,o,s,l,u,c)=>{let h=Math.round(o*100),d="".concat(s,"_").concat(l,"_").concat(h),p=i.get(d);p||(p={entities:[],targetOpacity:o,urlHash:s,containerId:l,gltf:u,parent:c},i.set(d,p)),p.entities.push(a)};for(let{entity:a,targetOpacity:o}of this.pendingOpacityChanges.values()){let s=a.components[0];if(!s.mesh||s.instanceIndex==null)continue;let l=s.mesh,u=this.getBatchForMesh(l),c=l.parent;if(!(c instanceof da))continue;let h=c.userData.modelURL;if(!h)continue;let d=up(h),p=this.gltfCache.get(d);if(!p)continue;let f=c.parent,m=f instanceof Vi?f.userData.entityId:"unknown";if(u){let g=r.get(u);g||(g={entities:[],targetOpacity:o},r.set(u,g)),Math.round(g.targetOpacity*100)===Math.round(o*100)?g.entities.push(a):n(a,o,d,m,p,c)}else n(a,o,d,m,p,c)}for(let[a,o]of r){let{entities:s,targetOpacity:l}=o,u=((e=a.mesh.userData)==null?void 0:e.detached)===!0,c=Math.round(l*100)===100;if(s.length===a.count&&u&&!c)a.opacity=l,a.mesh.userData.sharedOpacity=l,C_(a.mesh,l),mA(a.mesh,l)&&(this.transparencyChanged=!0);else{let h=(t=s[0])==null?void 0:t.components[0],d=h==null?void 0:h.mesh,p=d==null?void 0:d.parent;if(p instanceof da){let f=p.userData.modelURL;if(f){let m=up(f),g=this.gltfCache.get(m),v=p.parent,_=v instanceof Vi?v.userData.entityId:"unknown";if(g)for(let x of s)n(x,l,m,_,g,p)}}}}for(let a of i.values()){let{entities:o,targetOpacity:s,urlHash:l,containerId:u,gltf:c,parent:h}=a,d=Math.round(s*100);for(let _ of o){let x=_.components[0],b=x.mesh,E=this.getBatchForMesh(b),M=x.instanceIndex;E&&M!=null&&M>=0&&this.removeInstanceFromBatch(E,b,M)}let p,f,m=this.batchesByUrlHash.get(l);if(m){for(let _ of m)if(_.containerId===u&&Math.round(_.opacity*100)===d&&_.count+o.length<=_.maxCount){p=_,f=_.mesh;break}}if(!p||!f){let _=Math.max(Iy,o.length),x=I_(c,_);x.userData.detached=!0,x.userData.sharedOpacity=s,h.add(x),p=this.createBatch(x,l,u,s,_),f=x,C_(x,s),mA(x,s)&&(this.transparencyChanged=!0)}let g,v;for(let _ of o){let x=_.components[0],b=_.components[1],E=p.count;x.mesh=f,x.instanceIndex=E,v=x.feature,g=this.convertTo3DMapPosition(v.geometry.coordinates[1],v.geometry.coordinates[0],0),x.position.set(g.x,g.y,x.altitude),qC(this.tempEuler,b.rotation),$C(this.tempScale,b.scale),b.visible===!1&&this.tempScale.set(0,0,0),this.tempQuaternion.setFromEuler(this.tempEuler),this.tempMatrix.compose(x.position,this.tempQuaternion,this.tempScale);for(let M of f.children)M instanceof An&&(M.setMatrixAt(E,this.tempMatrix),M.userData.entities[E]=_.id,M.count=E+1,M.instanceMatrix.needsUpdate=!0);this.updateInstanceColor(_,b.color,b.material),p.count++,f.userData.detached?this.detachedEntityIds.add(_.id):this.detachedEntityIds.delete(_.id)}q6(f),this.publish("batch-changed")}this.pendingOpacityChanges.clear(),this.updateDebugUI()}updateInstanceTransform(e){let t=e.components[0],r=e.components[1];if(!t.mesh)return;let i=t.feature,{x:n,y:a}=this.convertTo3DMapPosition(i.geometry.coordinates[1],i.geometry.coordinates[0],0);if(t.position.set(n,a,t.altitude),qC(this.tempEuler,r.rotation),r.visible===!1?this.tempScale.set(0,0,0):$C(this.tempScale,r.scale),t.instancingDisabled){t.mesh.position.copy(t.position),t.mesh.rotation.set(this.tempEuler.x,this.tempEuler.y,this.tempEuler.z),t.mesh.scale.copy(this.tempScale);return}if(!(t.instanceIndex==null||t.instanceIndex<0)){this.tempQuaternion.setFromEuler(this.tempEuler),this.tempMatrix.compose(t.position,this.tempQuaternion,this.tempScale);for(let o of t.mesh.children)o instanceof An&&(o.setMatrixAt(t.instanceIndex,this.tempMatrix),o.instanceMatrix.needsUpdate=!0)}}updateNonInstancedModelStyle(e){var t;let r=e.components[0],i=e.components[1];if(!r.mesh)return;K6(e),this.updateInstanceTransform(e);let n=(t=i.opacity)!=null?t:1;qne(r.mesh,n,i.visibleThroughGeometry),i.EXPERIMENTAL_clippingEnabled||mA(r.mesh,n)&&(this.transparencyChanged=!0),i.color&&Kne(r.mesh,i.color)}updateInstanceColor(e,t,r){let i=e.components[0];!i.mesh||i.instanceIndex==null||i.instanceIndex<0||e8(i.mesh,i.instanceIndex,t,r)}removeInstance(e){var t,r;let i=e.components[0];if(this.detachedEntityIds.delete(e.id),this.nonInstancedModels.has(e.id)){let c=this.nonInstancedModels.get(e.id);return c!=null&&c.mesh&&($ne(c.mesh),(t=c.mesh.parent)==null||t.remove(c.mesh)),this.nonInstancedModels.delete(e.id),i.mesh=null,this.updateDebugUI(),!0}if(!i.mesh||i.instanceIndex==null||i.instanceIndex<0)return!0;let n=this.getBatchForMesh(i.mesh);if(!n)return!0;let a=i.instanceIndex,o=n.count-1,s=n.opacity===1&&((r=i.mesh.userData)==null?void 0:r.detached)!==!0;if(n.count===1){if(s){n.count=0;for(let m of i.mesh.children)m instanceof An&&(m.count=0,m.instanceMatrix.needsUpdate=!0);let p=this.instanceMap.get(n.containerId),f=p==null?void 0:p.get(n.urlHash);return f&&f.object===n.mesh&&(f.count=0),i.mesh.parent&&i.mesh.parent.remove(i.mesh),i.mesh=null,this.updateDebugUI(),!1}let c=n.urlHash;this.removeBatch(n);let h=this.batchesByUrlHash.get(c),d=!1;if(h){for(let p of h)if(p.count>0){d=!0;break}}return $6(i.mesh),i.mesh=null,this.updateDebugUI(),!d}for(let c of i.mesh.children)if(c instanceof An){if(a!==o){c.getMatrixAt(o,this.tempMatrix),c.getColorAt(o,this.tempColor),c.setMatrixAt(a,this.tempMatrix),c.setColorAt(a,this.tempColor);let h=c.userData.entities[o];if(h){c.userData.entities[a]=h;let d=this.state.geometry3DMap.get(h);d?d.components[0].instanceIndex=a:rt.warn("[removeInstance] Could not find lastEntity in geometry3DMap:",h)}}delete c.userData.entities[o],c.count=o,c.instanceMatrix.needsUpdate=!0,c.instanceColor&&(c.instanceColor.needsUpdate=!0)}n.count=o;let l=this.instanceMap.get(n.containerId),u=l==null?void 0:l.get(n.urlHash);return u&&u.object===n.mesh&&(u.count=o),i.mesh=null,this.updateDebugUI(),!1}destroy(){var e;this.gltfCache.clear(),this.gltfLoadPromises.clear();for(let t of this.instanceMap.values())for(let r of t.values())i7e(r.object);this.instanceMap.clear(),this.modelNames.clear(),this.batchByMesh.clear(),this.batchesByUrlHash.clear(),this.batchCounter=0;for(let t of this.nonInstancedModels.values())t.mesh&&($ne(t.mesh),(e=t.mesh.parent)==null||e.remove(t.mesh));this.nonInstancedModels.clear(),this.debugUI.destroy(),this.loadPromises=[],this.loader=void 0}};H();s7e=class{constructor(e,t,r,i,n={}){he(this,EB),he(this,Ep),he(this,bB),he(this,fa),he(this,wB,new fe),he(this,mp,new vt),xe(this,Ep,t),xe(this,bB,r),xe(this,fa,new qre(e,r,yt(this,EB,Zae).call(this,i),n))}get pipeline(){return A(this,fa)}get interactiveCollidersQTree(){return A(this,fa).collisionSystem.interactiveCollidersQTree}get visibleCollidersQTree(){return A(this,fa).collisionSystem.visibleCollidersQTree}resize(){A(this,fa).resize()}syncTwoDEntities(){A(this,fa).clearEntities(),A(this,bB).pixelRatio=A(this,Ep).pixelRatio;for(let e of A(this,Ep).geometry2DsInScene)e.syncPosition(),A(this,fa).addEntity(e.entity2D)}update(e,t,r,i=[]){yt(this,EB,Xae).call(this),A(this,fa).update(e,t,r,i)}markDirty(){A(this,fa).markDirty()}get collidersNeedRecomputing(){return A(this,fa).collidersNeedRecomputing}set collidersNeedRecomputing(e){A(this,fa).collidersNeedRecomputing=e}updateWatermark(e){A(this,fa).updateWatermark(e)}cancelPendingFrames(){A(this,fa).cancelPendingFrames()}setCollidersDirty(){A(this,fa).collisionSystem.collidersDirty=!0}deleteTextCacheEntry(e){delete A(this,fa).drawSystem.textCache[e]}showCollisionBoxes(){A(this,fa).showCollisionBoxes()}hideCollisionBoxes(){A(this,fa).hideCollisionBoxes()}destroy(){A(this,fa).destroy()}};Ep=new WeakMap,bB=new WeakMap,fa=new WeakMap,wB=new WeakMap,mp=new WeakMap,EB=new WeakSet,Zae=function(e){return(t,r,i)=>(A(this,wB).set(t,r,i),A(this,mp).set(0,0),e(A(this,mp),A(this,wB)),A(this,mp).x===0&&A(this,mp).y===0?null:{x:A(this,mp).x,y:A(this,mp).y})},Xae=function(){let e,t;for(let r of A(this,Ep).geometry2DsInScene){t=r.components[0];let i=r.attachedTo?A(this,Ep).geometry3DMap.get(r.attachedTo):void 0;if(i instanceof ln)if(A(this,Ep).geometry3DsInScene.has(i)){if(e=i.components[1],e.dirty||t.attachedDirty){let a=e.height,o=e.altitude;r.setAltitude(a+o),r.syncPosition()}let n=e.visible;t.visible!==n&&(t.visible=n)}else t.visible===!0&&(t.visible=!1);t.attachedDirty=!1}};eae=new Cv,{DEFAULT_PITCH:Jae,DEFAULT_BEARING:Kae,DEFAULT_ZOOM_LEVEL:qae,DEFAULT_MIN_ZOOM_LEVEL:l7e,DEFAULT_MAX_ZOOM_LEVEL:u7e}=wA,c7e=Zr.radToDeg(.6435011087932844),h7e=class extends Ki{constructor(e,t={}){var r,i,n,a,o,s,l,u,c,h,d,p,f,m,g,v,_;if(super(),he(this,mc),I(this,"options"),I(this,"container"),I(this,"Debug"),he(this,Hn),he(this,Yn),he(this,Fy),he(this,zy),he(this,N_),he(this,_A),he(this,Ly),he(this,Oy),I(this,"rendererDomElement"),he(this,Je,{geometry3DMap:new Map,geometry2DMap:new Map,geometry2DIdsInScene:new Set,geometry3DIdsInScene:new Set,geometryGroupIdsToLoad:new Set,geometry3DsInScene:new Set,geometry2DsInScene:new Set,geometryScene:new Vi("__scene"),hoverColor:"#f6efff",text3dHoverColor:"white",insetsPadding:JU,shouldMeasureCanvas:!0,pixelRatio:this.resolutionScale,canvasWidth:0,canvasHeight:0,internalTweenGroup:new II,externalTweenGroup:new II,cameraObject:new za,naturalBearing:0,containerOffset:[0,0],useStandaloneCamera:!1,directionalLight:new Iv(16777215,.3*Math.PI),ambientLight:new JV(16777215,.741*Math.PI),renderer:void 0,threeJSScene:new pd,depthRangeFor3D:[0,1],geometry2DState:{entities:new Set,entityMap:new Map,entityIds:new Set,pixelRatio:1}}),I(this,"camera"),he(this,Aa),he(this,bA),he(this,fs),he(this,Ba),he(this,at,{}),he(this,D8,window.matchMedia("screen and (min-resolution: 2dppx)")),I(this,"map"),he(this,yl,()=>{var F,B;(F=this.signal)!=null&&F.aborted||!((B=A(this,at))!=null&&B.renderSystem)||(A(this,at).renderSystem.twoDdirty=!0)}),he(this,la,()=>{var F,B;(F=this.signal)!=null&&F.aborted||!((B=A(this,at))!=null&&B.renderSystem)||(A(this,at).renderSystem.threeDdirty=!0)}),he(this,k8,()=>{this.map&&(A(this,Je).depthRangeFor3D=this.map.painter.depthRangeFor3D)}),he(this,Ny,(F,B)=>{F.addEventListener("childadded",B),F.addEventListener("childremoved",B),this.onAbort(()=>{F.removeEventListener("childadded",B),F.removeEventListener("childremoved",B)})}),he(this,xp,"standalone"),he(this,R8,()=>{A(this,at).geometryDisposalSystem.dirty=!0,this.render()}),he(this,MB,F=>Math.trunc(F*10)/10),he(this,F8,()=>{yt(this,mc,P8).call(this,h_()),A(this,Je).geometry2DState.pixelRatio=this.resolutionScale,A(this,at).twoDEntitySystem.markDirty(),A(this,Q_).call(this,void 0,void 0,!0)}),he(this,z8,()=>{A(this,Q_).call(this)}),he(this,U_),he(this,Q_,(F,B,z=!1)=>{let O=F!=null?F:this.rendererDomElement.clientWidth,j=B!=null?B:this.rendererDomElement.clientHeight;if((O===0||j===0)&&!z)return;if(A(this,Je).canvasWidth=O,A(this,Je).canvasHeight=j,A(this,at).twoDEntitySystem.resize(),yt(this,mc,P8).call(this,h_()),A(this,CB).call(this),yt(this,mc,eoe).call(this),A(this,at).cameraSystem.resize(this.canvasWidth,this.canvasHeight),A(this,at).cameraSystem.dirty=!0,this.map!=null){C6(this.map,this.camera.minZoomLevel,this.camera.maxZoomLevel);let ne=this.camera.zoomLevel,ie=Zr.clamp(ne,this.camera.minZoomLevel,this.camera.maxZoomLevel);ie!==ne&&this.camera.setZoomLevel(ie)}A(this,at).watermarkSystem.resize(this.canvasWidth,this.canvasHeight),A(this,at).htmlControlsSystem.resize(this.canvasWidth),A(this,at).geometryInFocusSystem.resize(),A(this,at).occlusion2DSystem.resize(),A(this,at).twoDEntitySystem.resize();let{top:Y,left:Z}=this.container.getBoundingClientRect();A(this,Je).containerOffset=[Y,Z],this.publish("resize"),this.render()}),he(this,L8,()=>{this.renderSync()}),he(this,SB,new fe),I(this,"project",(F,B)=>{if(A(this,Yn).position.z+this.camera.elevation>B.z){A(this,SB).copy(B);let z=A(this,SB).project(A(this,U_)),O=(z.x+1)/2*this.canvasWidth-0/2,j=(-z.y+1)/2*this.canvasHeight-0/2,Y=A(this,MB).call(this,O),Z=A(this,MB).call(this,j);F.x=Y,F.y=Z,F instanceof fe&&(F.z=z.z)}else F.x=-1e3,F.y=-1e3,F instanceof fe&&(F.z=1/0)}),he(this,IB,(F,B)=>{A(this,Ba).setBufferSize(F,B),A(this,Yn).aspect=F/B,A(this,Yn).updateProjectionMatrix(),A(this,Yn).updateMatrixWorld(!0),A(this,N_).x=F,A(this,N_).y=B}),he(this,CB,()=>{var F;let B=A(this,Je).canvasWidth=this.rendererDomElement.clientWidth,z=A(this,Je).canvasHeight=this.rendererDomElement.clientHeight,O=Math.floor(B*this.resolutionScale),j=Math.floor(z*this.resolutionScale);A(this,IB).call(this,O,j),(F=this.map)==null||F.resize(),A(this,Je).shouldMeasureCanvas=!1}),I(this,"getParentContainer",(F,B=!0)=>{if(!F)return B?A(this,Je).geometryScene:void 0;if(typeof F=="string"||typeof F=="number"){let z=A(this,Je).geometry3DMap.get(F);return z instanceof Vi?z:(rt.warn("Parent (".concat(typeof F=="object"?F.id:F,") is not a valid container, adding to scene")),B?A(this,Je).geometryScene:void 0)}else if(F.type==="group-container"){let z=A(this,Je).geometry3DMap.get(F.id);if(z instanceof Vi)return z}return B?A(this,Je).geometryScene:void 0}),I(this,"showCollisionBoxes",()=>{A(this,at).twoDEntitySystem.showCollisionBoxes(),this.render()}),I(this,"hideCollisionBoxes",()=>{A(this,at).twoDEntitySystem.hideCollisionBoxes(),this.render()}),I(this,"projectScreenXYToCoordinate",(F,B,z=!1)=>{var O,j;let Y=this.container.getBoundingClientRect(),Z=(F-Y.left)/A(this,Je).canvasWidth*2-1,ne=-((B-Y.top)/A(this,Je).canvasHeight)*2+1,ie=new vt(Z,ne),le,X;if(z)eae.setFromCamera(ie,A(this,Yn)),le=(O=eae.intersectObject(A(this,_A),!1)[0])==null?void 0:O.point;else{let ce=A(this,at).interactionSystem.getThreeDIntersectsFromXY(ie);le=(j=ce==null?void 0:ce[0])==null?void 0:j.point,X=A(this,at).interactionSystem.getGroupContainerIntersectsFromXY(ie)}if(le)return{coordinate:this.convert3DMapPositionToCoordinate(le),groupContainers:X}}),I(this,"projectCoordinateToScreenXY",F=>{let B=this.convertTo3DMapPosition(F[1],F[0],F[2]||0),z=new vt;return this.project(z,B),{x:z.x,y:z.y}}),I(this,"convert3DMapPositionToCoordinate",F=>{var B,z,O,j;let{lat:Y,lon:Z}=_6((z=(B=A(this,Je).center)==null?void 0:B[1])!=null?z:0,(j=(O=A(this,Je).center)==null?void 0:O[0])!=null?j:0,F.x,F.y);return[Z,Y,F.z]}),I(this,"setBackgroundColor",(F,B)=>{A(this,Ba).setBackgroundColor(F,B)}),I(this,"getMetersPerPixel",()=>A(this,at).cameraSystem.getCurrentMetersPerPixel()),I(this,"hideOutdoorLayersIntersectingPolygons",(F,B)=>{A(this,at).outdoorLayersSystem.hideLayersIntersectingPolygons(F,B),this.render()}),he(this,Uy,new fd),he(this,BB,new er),he(this,TB,F=>{var B;rt.error("Render failed: ",F,(B=F.stack)!=null?B:"No stack trace available"),this.publish("render-error",{error:F})}),I(this,"render",()=>{var F,B;if(!(((F=A(this,at))==null?void 0:F.renderSystem)==null||(B=this.signal)!=null&&B.aborted))if(this.map&&(this.mode==="outdoors-interleaved"||this.mode==="outdoors-overlay"))this.map.triggerRepaint();else return A(this,at).renderSystem.update().catch(A(this,TB))}),I(this,"renderSync",()=>{var F;return(F=this.signal)!=null&&F.aborted?Promise.resolve():A(this,at).renderSystem.update(!0).catch(A(this,TB))}),he(this,gp,oc(()=>{this.publish("user-interaction-start",void 0)},0,!0)),he(this,yp,oc(()=>{this.publish("user-interaction-end",void 0),this.render()},0,!0)),I(this,"on",(F,B,z)=>{let O=super.on(F,B,z);return["outdoor-view-loaded","outdoor-style-loaded"].includes(F)&&this.mode==="standalone"&&Fi.env.NODE_ENV!=="test"&&(rt.warn('"'.concat(F,'" was subscribed to but outdoor view is disabled. The event has been triggered immediately. Enable outdoor view or remove the listener.')),this.publish(F),O()),O}),I(this,"off",(F,B)=>{super.off(F,B)}),I(this,"getCursor",()=>A(this,at).interactionSystem.getCursor()),he(this,U8,()=>{try{A(this,xp)!=="outdoors-overlay"&&(this.map&&this.map.remove(),this.container&&this.rendererDomElement&&this.container.contains(this.rendererDomElement)&&this.container.removeChild(this.rendererDomElement)),this.container&&A(this,Aa)&&this.container.contains(A(this,Aa))&&this.container.removeChild(A(this,Aa))}catch(F){rt.warn("Error during DOM cleanup, some elements may not have been removed:",F)}}),he(this,Di,F=>(this.onAbort(()=>{F&&typeof F=="object"&&("destroy"in F&&typeof F.destroy=="function"?F.destroy():"dispose"in F&&typeof F.dispose=="function"&&F.dispose())}),F)),I(this,"destroy",()=>{var F,B,z;!A(this,at)||(F=this.signal)!=null&&F.aborted||(super.destroy(),(B=globalThis.MappedinDebug)!=null&&B.__idleCallbackInteractionState&&(globalThis.MappedinDebug.__idleCallbackInteractionState.unregisterInteractionChecker(A(this,at).cameraSystem.isUserInteracting),globalThis.MappedinDebug.__idleCallbackInteractionState.unregisterInteractionChecker(A(this,at).cameraSystem.isCameraMoving)),this.remove("__scene"),A(this,Ba).destroy(),(z=A(this,Hn))==null||z.traverse(O=>{wo(O),"dispose"in O&&typeof O.dispose=="function"&&O.dispose()}),xe(this,Hn,void 0),xe(this,at,void 0),A(this,U8).call(this),xe(this,Ba,void 0))}),he(this,j_,new fe),he(this,PB,new fe),A(this,Je).useStandaloneCamera=(r=t.useStandaloneCamera)!=null?r:!1,A(this,Je).naturalBearing=(i=t.naturalBearing)!=null?i:0,this.convertTo3DMapPosition=this.convertTo3DMapPosition.bind(this),!e.clientWidth||!e.clientHeight)throw new Error("[MappedinJS] Container width and height must be greater than 0");(t.mode==="outdoors-interleaved"||t.mode==="outdoors-overlay")&&t.map&&(xe(this,xp,t.mode),this.map=t.map),A(this,Ny).call(this,A(this,Je).geometryScene,()=>{A(this,la).call(this),A(this,yl).call(this)}),A(this,Je).geometry3DMap.set(A(this,Je).geometryScene.userData.entityId,A(this,Je).geometryScene),t.center&&(A(this,Je).center=t.center?[...t.center]:[0,0]),this.options=t,this.container=e,yt(this,mc,$ae).call(this),A(this,at).htmlControlsSystem=A(this,Di).call(this,new w6e(this.container,{outdoorEnabled:!!this.map})),A(this,at).maskingSystem=A(this,Di).call(this,new xQe(A(this,Je))),A(this,xp)!=="outdoors-overlay"&&A(this,at).htmlControlsSystem.addAttributionControl(this.options.attribution),window.MappedinDebug||(window.MappedinDebug={}),Fi.env.NODE_ENV==="test"&&(window.MappedinDebug.mapViewCoreInstance=this),xe(this,Ba,new tUe({antialias:typeof t.antialias=="boolean"?t.antialias:!0,alpha:!1,canvas:this.mode!=="standalone"?(n=t.gl)==null?void 0:n.canvas:void 0,onWebGLContextCreationError:t.onWebGLContextCreationError,onWebGLContextLost:t.onWebGLContextLost,onWebGLContextRestored:F=>{var B;(B=t.onWebGLContextRestored)==null||B.call(t,F),A(this,yl).call(this),A(this,la).call(this),this.render()},onWebGLRendererError:t.onWebGLRendererError,backgroundColor:t.backgroundColor||"#ffffff",backgroundAlpha:(a=t.backgroundAlpha)!=null?a:1})),A(this,Je).renderer=A(this,Ba).renderer,xe(this,Hn,A(this,Je).threeJSScene),A(this,Hn).matrixWorldAutoUpdate=!1,A(this,xp)!=="standalone"&&A(this,Hn).add(Xie()),A(this,Hn).add(A(this,Je).geometryScene);let x=window.__THREE_DEVTOOLS__;Fi.env.NODE_ENV==="dev"&&typeof x<"u"&&(x.dispatchEvent(new CustomEvent("observe",{detail:A(this,Hn)})),x.dispatchEvent(new CustomEvent("observe",{detail:A(this,Ba)}))),xe(this,Yn,new za(c7e,this.aspect,50,1e5)),A(this,Je).cameraObject=A(this,Yn),xe(this,zy,new wv),A(this,zy).matrixWorldAutoUpdate=!1,A(this,Yn).renderOrder=999;let b=new mi;b.add(A(this,Yn)),xe(this,Oy,new mi),A(this,Oy).add(b),A(this,Hn).add(A(this,Oy)),A(this,Yn).updateProjectionMatrix(),A(this,Yn).updateMatrixWorld(!0),(o=t.__EXPERIMENTAL_shadows)!=null&&o.enabled&&(A(this,at).shadowsSystem=A(this,Di).call(this,new $Qe(A(this,Je),A(this,Ba),A(this,Oy),t.__EXPERIMENTAL_shadows)),this.map&&this.onMapLibreEvent("render",A(this,k8))),xe(this,U_,this.mode==="standalone"?A(this,Yn):A(this,zy)),this.referenceMap={scale:1,latitude:0,longitude:0,getNorth:()=>0,georeference:[{target:{x:0,y:0}},{target:{x:0,y:0}},{target:{x:0,y:0}},{target:{x:0,y:0}}]},this.rendererDomElement=A(this,Ba).domElement(),xe(this,N_,new vt);let E=new Qa(1e6,1e6),M=new Fn({color:0,visible:!1});xe(this,_A,new Sr(E,M)),A(this,_A).name="worldPlane",A(this,Hn).add(A(this,_A)),(s=t.gl)!=null&&s.canvas||e.appendChild(this.rendererDomElement),window.addEventListener("resize",A(this,z8),{capture:!1,signal:this.signal}),A(this,D8).addEventListener("change",A(this,F8),{signal:this.signal}),typeof ResizeObserver=="function"&&((l=Fi.env)==null?void 0:l.NODE_ENV)!=="test"&&(xe(this,Ly,new ResizeObserver(MN(F=>{A(this,Q_).call(this,F[0].contentRect.width,F[0].contentRect.height)},50))),(u=A(this,Ly))==null||u.observe(e),A(this,Ly)&&this.onAbort(()=>{var F;return(F=A(this,Ly))==null?void 0:F.disconnect()})),e.classList.add("mappedin-map"),this.rendererDomElement.style.width=(c=globalThis.MappedinDebug)!=null&&c.TEST_IOS?"1080px":"100%",this.rendererDomElement.style.height=(h=globalThis.MappedinDebug)!=null&&h.TEST_IOS?"1920px":"100%",Fi.env.NODE_ENV==="test"&&this.rendererDomElement.setAttribute("data-testid","mappedin-canvas"),this.mode!=="outdoors-overlay"&&this.rendererDomElement.tabIndex!==void 0&&this.rendererDomElement.removeAttribute("tabindex"),A(this,Je).canvasWidth=this.rendererDomElement.clientWidth,A(this,Je).canvasHeight=this.rendererDomElement.clientHeight,this.rendererDomElement.style.touchAction="manipulation";let S=this.canvasWidth,D=this.canvasHeight;A(this,at).watermarkSystem=A(this,Di).call(this,new m6e(A(this,Yn),A(this,Je),t==null?void 0:t.watermark)),A(this,at).watermarkSystem.on("texture-loaded",this.render),A(this,Je).shouldMeasureCanvas=!0,A(this,Je).pixelRatio=this.resolutionScale,A(this,IB).call(this,Math.floor(S*this.resolutionScale),Math.floor(D*this.resolutionScale)),A(this,Je).directionalLight.position.set(-150,-150,350),A(this,Hn).add(A(this,Je).directionalLight),A(this,Hn).add(A(this,Je).ambientLight),A(this,at).cameraSystem=A(this,Di).call(this,new K8(A(this,Yn),A(this,Hn),A(this,Ba).renderer,A(this,Je),{mode:this.mode,canvasHeight:D,canvasWidth:S})),(d=globalThis.MappedinDebug)!=null&&d.__idleCallbackInteractionState&&(globalThis.MappedinDebug.__idleCallbackInteractionState.registerInteractionChecker(A(this,at).cameraSystem.isUserInteracting),globalThis.MappedinDebug.__idleCallbackInteractionState.registerInteractionChecker(A(this,at).cameraSystem.isCameraMoving)),A(this,at).cameraSystem.on("user-dolly-start",A(this,gp),{signal:this.signal}),A(this,at).cameraSystem.on("user-pan-start",A(this,gp),{signal:this.signal}),A(this,at).cameraSystem.on("user-rotate-start",A(this,gp),{signal:this.signal}),A(this,at).cameraSystem.on("user-zoom-start",A(this,gp),{signal:this.signal}),A(this,at).cameraSystem.on("user-tilt-start",A(this,gp),{signal:this.signal}),A(this,at).cameraSystem.on("user-pedestal-start",A(this,gp),{signal:this.signal}),A(this,at).cameraSystem.on("user-dolly-end",A(this,yp),{signal:this.signal}),A(this,at).cameraSystem.on("user-pan-end",A(this,yp),{signal:this.signal}),A(this,at).cameraSystem.on("user-rotate-end",A(this,yp),{signal:this.signal}),A(this,at).cameraSystem.on("user-zoom-end",A(this,yp),{signal:this.signal}),A(this,at).cameraSystem.on("user-tilt-end",A(this,yp),{signal:this.signal}),A(this,at).cameraSystem.on("user-pedestal-end",A(this,yp),{signal:this.signal}),A(this,at).cameraSystem.on("change",()=>{this.publish("camera-change",this.camera),A(this,at).geometryInFocusSystem&&(A(this,at).geometryInFocusSystem.cameraDirty=!0),this.render()}),A(this,at).pathSystem=A(this,Di).call(this,new sQe(A(this,Je),this.convertTo3DMapPosition,this.getParentContainer,A(this,at).cameraSystem.convertZoomLevelToAltitude)),A(this,at).pathSystem.on("animate:path",this.render,{signal:this.signal}),A(this,at).panBoundsSystem=A(this,Di).call(this,new y6e(A(this,Je),A(this,at).cameraSystem));let T=()=>{let{panBounds:F,fov:B,convertAltitudeToZoomLevel:z}=A(this,at).cameraSystem;if(A(this,at).panBoundsSystem.autoMinZoomLevel){if(F.radius<=0)return;let O=Math.min(A(this,Je).canvasWidth/A(this,Je).canvasHeight,1),j=B*Math.PI/180*O,Y=Math.tan(j/2),{radius:Z,center:ne}=A(this,at).cameraSystem.panBounds,ie=Z/Y,le=this.getThreeCamera().getWorldPosition(new fe),X=ne.distanceTo(le),ce=Math.abs(le.z-ne.z),ge=ie*ce/X,be=z(ge);Zie(be,this.camera.minZoomLevel)&&this.camera.setMinZoomLevel(be)}this.publish("pan-bounds-change",A(this,at).cameraSystem.panBounds)};A(this,at).panBoundsSystem.on("update",T,{signal:this.signal}),this.camera=A(this,Di).call(this,new n6e(this,A(this,at),A(this,Je)));let P=()=>{A(this,at).geometryInFocusSystem&&A(this,at).geometryInFocusSystem.resize(),this.render()};this.camera.on("padding-change",P,{signal:this.signal}),this.camera.setZoomLevel((p=t.zoomLevel)!=null?p:qae),this.camera.setBearing((f=t.bearing)!=null?f:Kae),this.camera.setPitch((m=t.pitch)!=null?m:Jae),this.camera.setMaxZoomLevel(u7e),this.camera.setMinZoomLevel(l7e),A(this,Je).geometry2DState.pixelRatio=this.resolutionScale,A(this,at).twoDEntitySystem=A(this,Di).call(this,new s7e(this.container,A(this,Je),A(this,Je).geometry2DState,this.project,{workerUrl:rp||void 0,useCollisionWorker:((g=t.useCollisionWorker)!=null?g:!0)&&((v=t.useWorkers)!=null?v:!0),transformImageRequest:t.transformImageRequest,watermark:{width:0,height:0,position:"bottom-left"}})),A(this,at).interactionSystem=A(this,Di).call(this,new uUe(this.rendererDomElement,A(this,Je),A(this,Yn),A(this,_A),A(this,at).cameraSystem.isUserInteracting)),A(this,at).interactionSystem.on("doubletap-with-onefinger",F=>{var B;A(this,at).cameraSystem.enableZoom&&this.camera.animateTo({center:(B=this.projectScreenXYToCoordinate(F.clientX,F.clientY))==null?void 0:B.coordinate,zoomLevel:this.camera.zoomLevel+1,duration:qU,easing:"ease-out"})}),A(this,at).interactionSystem.on("singletap-with-twofinger",()=>{A(this,at).cameraSystem.enableZoom&&this.camera.animateTo({zoomLevel:this.camera.zoomLevel-1,duration:qU,easing:"ease-out"})}),A(this,at).interactionSystem.on("hover",this.render),A(this,at).interactionSystem.on("click",F=>{var B,z,O,j,Y,Z,ne,ie,le;if(F.entity2D.some(be=>be.id==="watermark")&&typeof A(this,at).watermarkSystem.options.onClick=="function"&&A(this,at).watermarkSystem.options.interactive){A(this,at).watermarkSystem.options.onClick();return}if(!F.position){rt.error("Pointer event outside world-plane");return}let X=F.entity3D?[(B=F.entity3D)==null?void 0:B.id]:[];(j=(O=(z=F.entity3D)==null?void 0:z.parentObject3D)==null?void 0:O.userData)!=null&&j.entityId&&X.push((ne=(Z=(Y=F.entity3D)==null?void 0:Y.parentObject3D)==null?void 0:Z.userData)==null?void 0:ne.entityId);let ce=[],ge=[];for(let be of F.entity2D)be.components&&(be.components[0]instanceof lp?ce.push(be.id):be.components[0]instanceof sp&&ge.push(be.id));this.publish("click",{coordinate:this.convert3DMapPositionToCoordinate(F.position),geometry:X,paths:((ie=F.entity3D)==null?void 0:ie.components[0])instanceof sB?[F.entity3D.id]:[],markers:ce,models:((le=F.entity3D)==null?void 0:le.components[0])instanceof fB?[F.entity3D.id]:[],labels:ge,containers:Array.isArray(F.groupContainers)?F.groupContainers.map(be=>be.userData.entityId):[],pointerEvent:F.pointerEvent})}),A(this,at).interactionSystem.on("hover",F=>{var B,z,O;if(!F.position)return;let j=[],Y=[];for(let Z of F.entity2D)Z.components&&(Z.components[0]instanceof lp?j.push(Z.id):Z.components[0]instanceof sp&&Y.push(Z.id));this.publish("hover",{coordinate:this.convert3DMapPositionToCoordinate(F.position),geometry:F.entity3D?[(B=F.entity3D)==null?void 0:B.id]:[],paths:((z=F.entity3D)==null?void 0:z.components[0])instanceof sB?[F.entity3D.id]:[],markers:j,models:((O=F.entity3D)==null?void 0:O.components[0])instanceof fB?[F.entity3D.id]:[],labels:Y,containers:Array.isArray(F.groupContainers)?F.groupContainers.map(Z=>Z.userData.entityId):[]})}),A(this,at).geometryInFocusSystem=A(this,Di).call(this,new I8e(A(this,Je),A(this,U_)));let k=F=>{this.publish("geometry-in-focus",F)};A(this,at).geometryInFocusSystem.on("geometry-in-focus",k,{signal:this.signal}),A(this,at).drawSystem=A(this,Di).call(this,new MUe(A(this,Je),this.convertTo3DMapPosition,this.convert3DMapPositionToCoordinate)),A(this,at).exporterSystem=A(this,Di).call(this,new pUe(A(this,Je))),A(this,at).meshOptimizationSystem=A(this,Di).call(this,new wUe(A(this,Je),this.convertTo3DMapPosition)),A(this,at).meshOptimizationSystem.on("geometry-2d-added",this.render,{signal:this.signal}),A(this,at).meshOptimizationSystem.on("geometry-group-added",A(this,R8),{signal:this.signal}),A(this,at).modelSystem=A(this,Di).call(this,new o7e(A(this,Je),this.convertTo3DMapPosition)),A(this,at).modelSystem.on("model-loaded",()=>{A(this,at).shadowsSystem&&(A(this,at).shadowsSystem.needsRender=!0),this.render()},{signal:this.signal}),A(this,at).modelSystem.on("batch-changed",()=>{A(this,at).interactionSystem.dirty3D=!0},{signal:this.signal}),A(this,at).meshDetachmentSystem=A(this,Di).call(this,new lQe(A(this,Je))),A(this,at).meshModificationSystem=A(this,Di).call(this,new hQe(A(this,Je))),A(this,at).geometryDisposalSystem=A(this,Di).call(this,new gQe(A(this,Je))),A(this,at).textureSystem=A(this,Di).call(this,new yQe(A(this,Je))),A(this,at).textureSystem.on("texture-added",this.render,{signal:this.signal}),A(this,at).borderSystem=A(this,Di).call(this,new Uie(A(this,Je),this.convertTo3DMapPosition)),A(this,at).clippingPlaneSystem=A(this,Di).call(this,new _Qe(A(this,Je))),A(this,at).renderOrderSystem=A(this,Di).call(this,new vQe(A(this,Je))),A(this,at).pluginSystem=A(this,Di).call(this,new bQe),A(this,at).customGeometrySystem=A(this,Di).call(this,new E6e(A(this,Je),this.convertTo3DMapPosition));let R=typeof t.outlines=="object"?t.outlines:void 0;R&&(A(this,Je).outlinesOptions=R),A(this,at).outlineInterpolationSystem=A(this,Di).call(this,new T6e(A(this,Je),R)),A(this,at).outlineInterpolationSystem.on("needs-render",this.render,{signal:this.signal}),A(this,at).renderSystem=A(this,Di).call(this,new SUe(A(this,Ba),A(this,Je),this.mode,A(this,Hn),A(this,Yn),this.viewCamera,A(this,at))),A(this,at).imageSystem=A(this,Di).call(this,new r8e(A(this,Je),this.convertTo3DMapPosition,this.project,t.bearing,t.naturalBearing,t.imagePlacementOptions,t.transformImageRequest)),A(this,at).text3DSystem=A(this,Di).call(this,new rie(A(this,Je),this.convertTo3DMapPosition,(_=t.useWorkers)!=null?_:!0)),A(this,at).text3DSystem.on("render",this.render,{signal:this.signal}),A(this,at).imageSystem.on("image-loaded",this.render,{signal:this.signal}),A(this,at).renderSystem.on("pre-render",()=>this.publish("pre-render"),{signal:this.signal}),A(this,at).renderSystem.on("post-render",()=>this.publish("post-render"),{signal:this.signal}),A(this,at).renderSystem.on("measure-canvas",A(this,CB),{signal:this.signal}),A(this,at).outdoorLayersSystem=A(this,Di).call(this,new H8e(this.map)),A(this,at).occlusion2DSystem=A(this,Di).call(this,new mQe(A(this,Je),this.convertTo3DMapPosition,A(this,Ba))),t.occlusionEnabled&&A(this,at).occlusion2DSystem.enable(),this.Debug=new pQe(this),t.environment!==!1&&xe(this,Fy,yt(this,mc,N8).call(this)),A(this,L8).call(this)}get viewCamera(){return A(this,zy)}get cameraObject(){return A(this,Yn)}get canvasWidth(){return A(this,Je).canvasWidth}get canvasHeight(){return A(this,Je).canvasHeight}get resolutionScale(){var e,t;return(t=(e=this.map)==null?void 0:e._getClampedPixelRatio(this.canvasWidth,this.canvasHeight))!=null?t:h_()}get aspect(){return this.canvasWidth/this.canvasHeight}get labelsCanvas(){var e;return(e=A(this,fs))!=null?e:null}get mode(){return A(this,xp)}addGroupContainer(e,t,r){if(!A(this,Je).geometry3DMap.has(e)&&!A(this,Je).geometry2DMap.has(e)){let i=new Vi(e);A(this,Ny).call(this,i,()=>{A(this,la).call(this),A(this,yl).call(this)}),(t==null?void 0:t.visible)!==void 0&&(i.visible=t.visible),(t==null?void 0:t.altitude)!==void 0&&i.setAltitude(t.altitude),(t==null?void 0:t.interactive)!==void 0&&io(i,t.interactive,A(this,Je)),(t==null?void 0:t.focusable)!==void 0&&DC(i,t.focusable),(t==null?void 0:t.preloadGeometry)!==void 0&&(i.userData.preloadGeometry=t.preloadGeometry),A(this,Je).geometry3DMap.set(e,i);let n=this.getParentContainer(r);n instanceof Vi&&n.addEntity(i),A(this,la).call(this),this.render()}else rt.error("Group container with ID '".concat(e,"' already exists. The group container cannot be added."));return{id:e,type:"group-container"}}addCustomGeometry(e,t,r,i,n){if(A(this,Je).geometry3DMap.has(e))rt.error("Custom geometry with ID '".concat(e,"' already exists. The custom geometry cannot be added."));else{let a=new j6(t,r),o=new ln(a,new dA(i));(i==null?void 0:i.interactive)!==void 0&&io(o,i.interactive,A(this,Je)),o.id=e,a.mesh.userData={entityId:e,type:"custom-geometry"},A(this,Je).geometry3DMap.set(o.id,o);let s=this.getParentContainer(n);n&&s instanceof Vi?s.addEntity(o):A(this,Je).geometryScene.addEntity(o),A(this,at).panBoundsSystem.dirty=!0,A(this,la).call(this),this.render()}return{id:e,type:"custom-geometry"}}registerPlugin(e){A(this,at).pluginSystem.registerPlugin(e)}unregisterPlugin(e){A(this,at).pluginSystem.unregisterPlugin(e)}addGeometryGroup(e,t,r,i){var n,a,o;if(!A(this,Je).geometry3DMap.has(e)&&!A(this,Je).geometry2DMap.has(e)){let s=new da(e);A(this,Ny).call(this,s,()=>{A(this,la).call(this),A(this,yl).call(this)}),s.userData.dirty=!0,A(this,Je).geometry3DMap.set(e,s);let l=typeof r=="function"?r(t.features[0]):r;(l==null?void 0:l.altitude)!=null&&(s.position.z=l.altitude);for(let c of t.features){if(c.geometry==null||!["Polygon","MultiPolygon","LineString","MultiLineString"].includes(c.geometry.type))continue;let h=(c==null?void 0:c.id)||((n=c==null?void 0:c.properties)==null?void 0:n.id)||Pi(),d={color:py};if(typeof r=="function")d=(a=r(c))!=null?a:{color:py};else{let f=r||{color:py},{visible:m,altitude:g}=f;d=Co(f,["visible","altitude"])}let p=A(this,at).meshOptimizationSystem.createEntityFromFeature(h,c,ze({outline:!0},d));A(this,Je).geometry3DMap.set(h,p),s.userData.entities3D.add(h),A(this,at).textureSystem.dirty=!0}(l==null?void 0:l.__EXPERIMENTAL_maskEnabled)===!0&&g6(s,{enabled:l.__EXPERIMENTAL_maskEnabled,maskId:l.__EXPERIMENTAL_maskId,effect:l.__EXPERIMENTAL_maskEffect,mode:l.__EXPERIMENTAL_maskMode}),s.setVisible((o=l==null?void 0:l.visible)!=null?o:!0);let u=this.getParentContainer(i);u instanceof Vi&&u.addEntity(s),A(this,at).panBoundsSystem.dirty=!0,A(this,la).call(this),this.render()}else rt.error("Geometry group with ID '".concat(e,"' already exists. The geometry group cannot be added."));return A(this,at).outlineInterpolationSystem.geometries3DDirty=!0,{id:e,type:"geometry-group"}}addOccluder(e,t){let r=this.getParentContainer(t),i=A(this,at).occlusion2DSystem.reserveOccluderId();return r==null||r.addOccluderFeature(e,i),i}addImage(e,t,r,i){var n;try{L6e(e,t,r)}catch(a){rt.error(a);return}if(!A(this,Je).geometry3DMap.has(e)&&!A(this,Je).geometry2DMap.has(e)){let a=new O6e(t),o=new ln(a,new dA(r));o.id=e||Pi(),a.mesh.userData={entityId:o.id,type:"path"},A(this,Je).geometry3DMap.set(o.id,o);let s=this.getParentContainer(i);s instanceof Vi&&s.addEntity(o);let l=t.geometry.coordinates;if(l){let u=this.convertTo3DMapPosition(l[1],l[0],(n=l[2])!=null?n:0);A(this,at).panBoundsSystem.expandBoundsIfOutside(u)}A(this,la).call(this),this.render()}else rt.error("Image with ID '".concat(e,"' already exists. The image cannot be added."));return{id:e,type:"image"}}addModelGroup(e,t,r,{parent:i,onComplete:n}={}){var a,o,s,l;try{qUe(e,t,r)}catch(u){rt.error(u);return}if(!A(this,Je).geometry3DMap.has(e)&&!A(this,Je).geometry2DMap.has(e)){let u=new da(e);A(this,Ny).call(this,u,()=>{A(this,la).call(this),A(this,yl).call(this)}),A(this,Je).geometry3DMap.set(e,u),u.userData.dirty=!0,u.userData.modelURL=r.url;for(let d of t.features){let p=d.id||d.properties.id||Pi(),f=A(this,at).modelSystem.createModelFromFeature(p,d,ze({},r));(d.properties.interactive!==void 0||r.interactive!=null)&&io(f,(a=d.properties.interactive)!=null?a:r.interactive,A(this,Je)),r.clippingPlaneZOffset!=null&&(f.components[7]=new IC,f.components[7].verticalOffset=r.clippingPlaneZOffset,r.clippingPlaneTopColor!=null&&(f.components[7].topColor=r.clippingPlaneTopColor),r.clippingPlaneTopVisible!=null&&(f.components[7].topVisible=r.clippingPlaneTopVisible)),f.parentId=u.userData.entityId,A(this,Je).geometry3DMap.set(p,f),u.userData.entities3D.add(p)}let c=this.getParentContainer(i);c instanceof Vi&&c.addEntity(u);let h=(o=t.features[0])==null?void 0:o.geometry.coordinates;if(h){let d=this.convertTo3DMapPosition(h[1],h[0],(s=h[2])!=null?s:0);A(this,at).panBoundsSystem.expandBoundsIfOutside(d)}A(this,la).call(this),(l=this.render())==null||l.then(n)}else rt.error("Model group with ID '".concat(e,"' already exists. The model group cannot be added."));return{id:e,type:"geometry-group"}}addMarker2D(e,t,r,i){var n;let a=r==null?void 0:r.id;try{tie(e,t,r||{})}catch(o){rt.error(o);return}if(a===void 0||!A(this,Je).geometry2DMap.has(a)&&!A(this,Je).geometry3DMap.has(a)){let o=yt(this,mc,O8).call(this,e,new lp(t,r),r==null?void 0:r.occluderId,r==null?void 0:r.verticalOffset);o.id=a||String(o.id),a=o.id,(r==null?void 0:r.interactive)!=null&&r.interactive!=="pointer-events-auto"&&io(o,r==null?void 0:r.interactive,A(this,Je)),(r==null?void 0:r.enabled)!=null&&TC(o,r.enabled),(r==null?void 0:r.occlude)!=null&&v_(o,r.occlude);let s=typeof(r==null?void 0:r.attachTo)=="string"||typeof(r==null?void 0:r.attachTo)=="number"?A(this,Je).geometry3DMap.get(r.attachTo):void 0;s instanceof ln&&s.attach(o),(n=this.getParentContainer(i))==null||n.addEntity(o),A(this,at).panBoundsSystem.expandBoundsIfOutside(o.object3d.position),this.render()}else rt.error("Marker2D with ID '".concat(a,"' already exists. The marker cannot be added."));return{id:a,type:"marker"}}addText3D(e,t,r,i){var n;if(!A(this,Je).geometry3DMap.has(e)&&!A(this,Je).geometry2DMap.has(e)){let a=new y_(bt(ze({},t),{properties:bt(ze({},t.properties),{id:e,content:t.properties.text})})),o=new ln(a,new LC(r==null?void 0:r.appearance));o.id=e,a.mesh.userData.entityId=e.toString(),a.mesh.userData.type="text3d",A(this,Je).geometry3DMap.set(e,o);let s=this.getParentContainer(i);s instanceof Vi&&s.addEntity(o);let l=t.geometry.coordinates;if(l){let u=this.convertTo3DMapPosition(l[1],l[0],(n=l[2])!=null?n:0);A(this,at).panBoundsSystem.expandBoundsIfOutside(u)}A(this,la).call(this),this.render()}else rt.error("Text3D with ID '".concat(e,"' already exists. The text3d cannot be added."));return{id:e,type:"text3d"}}labelText3D(e,t,r={}){var i,n;try{if(!t||!e)throw new Error("content and meshGeometryId are required");aie.parse(r)}catch(u){rt.error(u);return}let a=A(this,Je).geometry3DMap.get(e);if((a==null?void 0:a.type)!=="geometry"){rt.error(".labelText3D failed: target incorrect");return}let o=a==null?void 0:a.components[0];if(!o.feature.properties.textArea)return;if(o.textEntityId){let u=A(this,Je).geometry3DMap.get(o.textEntityId);if((u==null?void 0:u.type)!=="text3d"){rt.error(".labelText3D failed: existing text3d not found");return}return{id:u.id,type:u.type}}let s=new y_({type:"Feature",geometry:{coordinates:(i=o.feature.properties.textArea)==null?void 0:i.position,type:"Point"},properties:{textArea:o.feature.properties.textArea,content:t,id:Pi()}});s.polygonEntityId=e;let l=new ln(s,new LC(r==null?void 0:r.appearance));return o.textEntityId=l.id.toString(),s.mesh.userData.entityId=l.id.toString(),s.mesh.userData.type="text3d",A(this,Je).geometry3DMap.set(l.id.toString(),l),r.parentId&&((n=this.getParentContainer(r.parentId))==null||n.addEntity(l)),this.render(),{id:l.id,type:"text3d"}}addLabel2D(e,t,r,i){var n;let a=r==null?void 0:r.id;try{eie(e,t,r||{})}catch(o){rt.error(o);return}if(a===void 0||!A(this,Je).geometry2DMap.has(a)&&!A(this,Je).geometry3DMap.has(a)){let o=yt(this,mc,O8).call(this,e,new sp(t,r||{},A(this,Je).pixelRatio),r==null?void 0:r.occluderId,r==null?void 0:r.verticalOffset);o.id=a||String(o.id),a=o.id,(r==null?void 0:r.interactive)!=null&&io(o,r==null?void 0:r.interactive,A(this,Je)),(r==null?void 0:r.enabled)!=null&&TC(o,r.enabled),(r==null?void 0:r.occlude)!=null&&v_(o,r.occlude);let s=typeof(r==null?void 0:r.attachTo)=="string"||typeof(r==null?void 0:r.attachTo)=="number"?A(this,Je).geometry3DMap.get(r.attachTo):void 0;s instanceof ln&&s.attach(o),(n=this.getParentContainer(i))==null||n.addEntity(o),A(this,at).panBoundsSystem.expandBoundsIfOutside(o.object3d.position),A(this,yl).call(this),this.render()}else rt.error("Label2D with ID '".concat(a,"' already exists. The label cannot be added."));return{id:a,type:"label"}}addPath(e,t={},r){var i,n;try{BUe(e,t||{})}catch(l){rt.error(l);return}let a=new sB(e,y6(t)),o=new ln(a,new dA({color:(i=t==null?void 0:t.color)!=null?i:"#ff834c",altitude:(n=t==null?void 0:t.verticalOffset)!=null?n:.1}));o.id=(t==null?void 0:t.id)||Pi(),a.mesh.userData={entityId:o.id,type:"path"},A(this,Je).geometry3DMap.set(o.id,o),(t==null?void 0:t.interactive)!=null&&io(o,t==null?void 0:t.interactive,A(this,Je));let s=this.getParentContainer(r);return s instanceof Vi&&s.addEntity(o),A(this,at).panBoundsSystem.dirty=!0,A(this,la).call(this),this.render(),{id:o.id,type:"path"}}updateWatermark(e){A(this,at).watermarkSystem.options=e,A(this,at).watermarkSystem.dirty=!0,A(this,at).twoDEntitySystem.setCollidersDirty(),this.render()}remove(e){var t,r,i;let n;if(typeof e=="string"||typeof e=="number"?(n=A(this,Je).geometry2DMap.get(e),n==null&&(n=A(this,Je).geometry3DMap.get(e))):typeof e.id=="string"||typeof e.id=="number"?(n=A(this,Je).geometry2DMap.get(e.id),n==null&&(n=A(this,Je).geometry3DMap.get(e.id))):n=e,n!=null){if(n.type==="custom-geometry")A(this,Je).geometry3DMap.delete(n.id),n.object3d&&wo(n.object3d);else if(n.type==="group-container"){A(this,Je).geometry3DMap.delete(n.userData.entityId);for(let a of n.childrenIds.values())this.remove(a),n.userData.entities2D.delete(a);wo(n)}else if(n.type==="geometry-group"){A(this,Je).geometry3DMap.delete(n.userData.entityId);for(let a of n.userData.entities3D.values())this.remove(a),n.userData.entities3D.delete(a);wo(n)}else if(n.type==="geometry"||n.type==="model"||n.type==="path"){let a=n.components[0];if(n.entities2D.size>0){for(let s of n.entities2D.values())this.remove(s);n.removeAllEntities()}let o=(r=(t=n.parentObject3D)==null?void 0:t.userData.entityId)!=null?r:n.parentId;if(o){let s=A(this,Je).geometry3DMap.get(o);s instanceof da&&s.userData.entities3D.delete(n.id)}if(n.type==="model"){if(A(this,at).modelSystem.removeInstance(n)&&n.object3d&&wo(n.object3d),o){let s=A(this,Je).geometry3DMap.get(o);if(s instanceof da&&s.userData.entities3D.size===0){let l=!1;for(let u of s.children)if(u.children.length>0){let c=u.children[0];if(c.isInstancedMesh&&((i=c.count)!=null?i:0)>0){l=!0;break}}l||this.remove(o)}}}else n.object3d&&wo(n.object3d);if(n.type==="geometry"){let s=n.components[3];s&&(s.enabled=!1,s.dirty=!0)}"textMesh"in a&&a.textMesh!=null&&this.remove(a.textMesh.userData.entityId),A(this,Je).geometry3DMap.delete(n.id)}else if(n.type==="marker"||n.type==="label"){let a=n.attachedTo;if(a){let o=A(this,Je).geometry3DMap.get(a);o instanceof ln&&o.detach(n)}n.object3d&&wo(n.object3d),n.type==="label"&&A(this,at).twoDEntitySystem.deleteTextCacheEntry(n.id),A(this,Je).geometry2DMap.delete(n.id)}else if(n.type==="image")n.object3d&&wo(n.object3d),A(this,Je).geometry3DMap.delete(n.id);else if(n.type==="text3d"){wo(n.object3d);let{batchedText:a,textMesh:o,polygonEntityId:s}=n.components[0];if(o&&(a&&a.removeText(o),wo(o)),s){A(this,at).text3DSystem.remove(s);let l=A(this,Je).geometry3DMap.get(s);(l==null?void 0:l.type)==="geometry"&&(l.components[0].textMesh=void 0,l.components[0].textEntityId=void 0)}A(this,Je).geometry3DMap.delete(n.id)}A(this,la).call(this),A(this,yl).call(this),this.render()}}getScene(){return this.getState("__scene")}getThreeScene(){return A(this,Hn)}getThreeCamera(){return A(this,Yn)}setEnvironment(e){return Qe(this,null,function*(){if(A(this,Hn))if(e==="basic"){A(this,Fy)||xe(this,Fy,yt(this,mc,N8).call(this));let t=yield A(this,Fy);A(this,Hn).environment=t}else A(this,Hn).environment=null})}getEnvironment(){var e;return(e=A(this,Hn))!=null&&e.environment?"basic":!1}getCurrentSceneGLTF(e){return A(this,at).exporterSystem.getCurrentSceneGLTF(e)}getBoundingArea(e){(A(this,at).renderSystem.threeDdirty||A(this,at).renderSystem.twoDdirty)&&this.renderSync();let t=new Ei;if(e==null)t.setFromObject(A(this,Je).geometryScene);else{let r=cp(A(this,Je),e);if((r==null?void 0:r.type)==="geometry"&&(r==null?void 0:r.object3d)!=null){let i=r.components[0],n=i instanceof oo?i.geometry:void 0;i.mesh instanceof Ev&&n?(n.computeBoundingBox(),n.boundingBox&&t.union(n.boundingBox)):t.setFromObject(r.object3d)}else((r==null?void 0:r.type)==="geometry-group"||(r==null?void 0:r.type)==="group-container")&&(r==null?void 0:r.userData.entityId)!=null&&t.setFromObject(r)}if(vy(t))return jie(t).map(this.convert3DMapPositionToCoordinate)}hasState(e){return cp(A(this,Je),e)!=null}getState(e){var t,r,i,n,a,o,s,l,u,c,h,d,p,f,m,g,v,_,x,b,E,M,S,D,T,P,k,R,F,B,z,O;if(e==null)return{type:"map-view",hoverColor:A(this,Je).hoverColor,text3dHoverColor:A(this,Je).text3dHoverColor};let j=cp(A(this,Je),e);if((j==null?void 0:j.type)==="custom-geometry"){let Y=j.components[0],Z=j.components[1];return{id:j.id,type:"custom-geometry",visible:Z.visible,altitude:Z.altitude,parent:(t=j.parentObject3D)==null?void 0:t.userData.entityId,position:this.convert3DMapPositionToCoordinate(Y.position)}}else if((j==null?void 0:j.type)==="geometry-group"){let Y=Array.from(j.userData.entities3D.values()),Z=Y==null?void 0:Y[0],ne=Z?this.getState(Z):{},ie=A(this,Je),le=this.convert3DMapPositionToCoordinate;return{id:j.userData.entityId,type:"geometry-group",visible:j.visible,altitude:j.position.z,initialColor:ne==null?void 0:ne.initialColor,color:ne==null?void 0:ne.color,side:(r=ne==null?void 0:ne.side)!=null?r:"double",opacity:ne==null?void 0:ne.opacity,height:ne==null?void 0:ne.height,texture:ne==null?void 0:ne.texture,topColor:ne==null?void 0:ne.topColor,topTexture:ne==null?void 0:ne.topTexture,interactive:Array.from(j.userData.entities3D.values()).map(X=>A(this,Je).geometry3DMap.get(X)).every(X=>X&&X.components[2]!=null),children:Y,bevel:ne==null?void 0:ne.bevel,maskId:(i=j.components[0])==null?void 0:i.maskId,maskEnabled:(n=j.components[0])==null?void 0:n.enabled,maskEffect:(a=j.components[0])==null?void 0:a.effect,maskMode:(o=j.components[0])==null?void 0:o.mode,get position(){return Fie(j,ie,le)}}}else{if((j==null?void 0:j.type)==="group-container")return{id:j.userData.entityId,type:"group-container",visible:j.visible,altitude:(s=j.getWorldPosition(d7e).z)!=null?s:0,opacity:j.opacity,interactive:!!j.components[0],children:Array.from(j.childrenIds.values()).map(Y=>this.getState(Y)).filter(Boolean)};if((j==null?void 0:j.type)==="label"){let Y=j.components[0],Z=j.object3d.parent,ne=Z==null?void 0:Z.userData.entityId;return{id:j.id,type:"label",text:Y.text||"",parent:{id:ne,type:Z==null?void 0:Z.type},position:this.convert3DMapPositionToCoordinate(j.position),enabled:Y.enabled,visible:Y.visible,initialRank:yy(Y.initialRank),verticalOffset:j.verticalOffset,options:{rank:yy(Y.rank),appearance:Y.appearance,interactive:j.components[1]!=null,verticalOffset:j.verticalOffset,attachTo:j.attachedTo,occlude:(u=(l=j.components[2])==null?void 0:l.enabled)!=null?u:!1}}}else if((j==null?void 0:j.type)==="marker"){let Y=j.components[0],Z=j.object3d.parent,ne=Z==null?void 0:Z.userData.entityId;return{id:j.id,type:"marker",enabled:Y.enabled,visible:Y.visible,placement:Y.options.placement,dynamicResize:Y.options.dynamicResize,parent:{id:ne,type:Z==null?void 0:Z.type},position:this.convert3DMapPositionToCoordinate(j.position),element:Y.containerEl,initialRank:yy(Y.initialRank),contentHTML:Y.contentHtml,options:{rank:yy(Y.rank),interactive:j.components[1]!=null||!1,verticalOffset:j.verticalOffset,attachTo:j.attachedTo,lowPriorityPin:Y.options.lowPriorityPin,occlude:(h=(c=j.components[2])==null?void 0:c.enabled)!=null?h:!1,zIndex:Y.options.zIndex}}}else if((j==null?void 0:j.type)==="geometry"){let{color:Y,hoverColor:Z,initialColor:ne,initialTopColor:ie,topColor:le,altitude:X}=j.components[1],ce=j.components[0],ge=j.components[4],be=j.components[1],_e=j.components[6],ke=j.components[2],Ye=j.components[3],We=j.parentObject3D;return{id:j.id,type:"geometry",opacity:be.opacity,initialColor:ne,color:Y,focusable:ge!=null&&ge.vertices!=null&&ge.vertices.length>0,initialTopColor:ie,topColor:le,side:be.side,hoverColor:Z,hovered:!!(ke!=null&&ke.hover),height:be.height,visible:be.visible,outline:Ye==null?void 0:Ye.enabled,showImage:be.showImage,texture:(d=_e==null?void 0:_e.texture)==null?void 0:d.path,topTexture:(p=_e==null?void 0:_e.topTexture)==null?void 0:p.path,flipImageToFaceCamera:be.flipImageToFaceCamera,enableImageCollisions:be.enableImageCollisions,parent:{id:We==null?void 0:We.userData.entityId,type:We==null?void 0:We.type},altitude:X,bevel:be.bevel,position:this.convert3DMapPositionToCoordinate(ce.position),interactive:j.components[2]!=null,borderVisible:be.borderVisible,borderColor:be.borderColor,borderWidth:be.borderWidth}}else if((j==null?void 0:j.type)==="model"){let Y=j.components[0],Z=j.components[1],ne=j.components[2],ie=j.components[7],le=Y.feature.geometry.coordinates,X=[le[0],le[1],(f=le[2])!=null?f:0];return{id:j.id,type:"model",position:X,interactive:ne!=null,material:Z.material,parent:(m=j.parentObject3D)!=null&&m.parent?{id:j.parentObject3D.parent.userData.entityId,type:j.parentObject3D.parent.type}:void 0,visible:Z.visible,verticalOffset:Z.verticalOffset,color:Z.color,opacity:Z.opacity,rotation:(g=Z.rotation)!=null?g:wy,scale:(v=Z.scale)!=null?v:by,clippingPlaneZOffset:(_=ie==null?void 0:ie.verticalOffset)!=null?_:Z.clippingPlaneZOffset,clippingPlaneTopColor:(x=ie==null?void 0:ie.topColor)!=null?x:Z.clippingPlaneTopColor,clippingPlaneTopVisible:(b=ie==null?void 0:ie.topVisible)!=null?b:Z.clippingPlaneTopVisible}}else if((j==null?void 0:j.type)==="path"){let Y=j.components[0],Z=j.components[2],ne=j.components[1];return{id:j.id,type:"path",position:this.convert3DMapPositionToCoordinate(Y.position),visible:ne.visible,interactive:Z!=null,completeFraction:Y.completeFraction,color:ne.color,accentColor:Y.accentColor,width:Y.width,animateArrowsOnPath:Y.animateArrowsOnPath,displayArrowsOnPath:Y.displayArrowsOnPath,verticalOffset:ne.altitude,highlightCompleteFraction:Y.highlightCompleteFraction,highlightStartFraction:Y.highlightStartFraction,highlightEndFraction:Y.highlightEndFraction,highlightColor:Y.highlightColor,highlightWidthMultiplier:Y.highlightWidthMultiplier,xrayOpacity:Y.xrayOpacity,smoothingTension:Y.smoothingTension,smoothingCornerRadius:Y.smoothingCornerRadius,dashed:Y.dashed,dashLength:Y.dashLength,dashGap:Y.dashGap,dashRelativeToWidth:Y.dashRelativeToWidth,dashSize:Y.dashSize,gapSize:Y.gapSize,dashAbsolute:Y.dashAbsolute,dashMeters:Y.dashMeters,gapMeters:Y.gapMeters,__EXPERIMENTAL_GEOMETRY:Y.__EXPERIMENTAL_GEOMETRY,__EXPERIMENTAL_ENDCAP_EXTENSION:Y.__EXPERIMENTAL_ENDCAP_EXTENSION,__EXPERIMENTAL_BILLBOARDING:Y.__EXPERIMENTAL_BILLBOARDING,__EXPERIMENTAL_BORDER:Y.__EXPERIMENTAL_BORDER,__EXPERIMENTAL_PREVENT_SELF_OVERLAP:Y.__EXPERIMENTAL_PREVENT_SELF_OVERLAP}}else if((j==null?void 0:j.type)==="image"){let Y=j.components[0];return{id:j.id,type:"image",position:this.convert3DMapPositionToCoordinate(Y.position),visible:j.components[1].visible,verticalOffset:(E=Y.feature.properties.verticalOffset)!=null?E:0,opacity:j.components[1].opacity,flipImageToFaceCamera:j.components[1].flipImageToFaceCamera,width:(M=Y.feature.properties.width)!=null?M:0,height:(S=Y.feature.properties.height)!=null?S:0,rotation:(D=Y.feature.properties.rotation)!=null?D:0}}else if((j==null?void 0:j.type)==="text3d"&&j.components[0]instanceof y_){Pie(j);let Y=j.components[0],Z=j.components[1],{textMesh:ne}=Y,ie=Y.feature.properties,le=(T=Y.mesh)==null?void 0:T.parent;le instanceof Vi&&((P=le.children.find(be=>be.type==="batchedtext"))==null||P.getWorldPosition(A(this,PB))),A(this,j_).set(0,0,0);let X=ne?ne.getWorldPosition(A(this,j_)):A(this,j_),ce=(F=(R=ie.rotation)!=null?R:(k=ie.textArea)==null?void 0:k.rotation)!=null?F:0,ge=(z=(B=ie.content)!=null?B:ie.text)!=null?z:"";return Object.assign({},Si,Z.getState(),{id:j.id,type:"text3d",position:this.convert3DMapPositionToCoordinate(X.add(A(this,PB))),visible:(O=Y.visible)!=null?O:!1,content:ge,rotation:ce})}else return}}getRenderedState(e){let t=typeof e=="string"||typeof e=="number"?e:e.id,r=cp(A(this,Je),t);if(r&&r.type==="label")return{textVisible:r.components[0].textVisible}}setState(e,t){var r,i,n,a,o,s,l;if(typeof e=="object"&&t==null){"hoverColor"in e&&(Cx(e.hoverColor)?A(this,Je).hoverColor=(r=e.hoverColor)!=null?r:A(this,Je).hoverColor:rt.warn('Failed to update global hover color. Invalid color "'.concat(e.hoverColor,'".'))),"text3dHoverColor"in e&&(A(this,Je).text3dHoverColor=(i=e.text3dHoverColor)!=null?i:A(this,Je).text3dHoverColor);return}let u=cp(A(this,Je),e);if(u!=null){if(u.type==="custom-geometry"){let c=A(this,Je).geometry3DMap.get(u.id);if(c instanceof ln&&c.components[0]instanceof j6){let h=t;hc(u,A(this,Je),h.visible),_y(u,A(this,Je),h.altitude),h6(u,h.position,this.convertTo3DMapPosition,A(this,at).panBoundsSystem),d6(u,this.getParentContainer(h.parent,!1)),io(u,h.interactive,A(this,Je))&&A(this,la).call(this)}}else if(u.type==="path"){let c=t;io(u,c.interactive,A(this,Je))&&A(this,la).call(this),_y(u,A(this,Je),c.verticalOffset),Tie(u,A(this,Je),c)}else if(u.type==="model"){let c=t;io(u,c.interactive,A(this,Je))&&A(this,la).call(this),hc(u,A(this,Je),c.visible),kie(u,c,this.convertTo3DMapPosition,A(this,at).panBoundsSystem),Rie(u,c)}else if(u.type==="group-container"){let c=t;hc(u,A(this,Je),c.visible)&&(A(this,at).pathSystem.verticalDistanceDirty=!0,A(this,at).geometryInFocusSystem.focusablesDirty=!0),_y(u,A(this,Je),c.altitude)&&(A(this,at).pathSystem.verticalDistanceDirty=!0),io(u,c.interactive,A(this,Je))&&A(this,la).call(this),x_(u,A(this,Je),c.opacity)&&(A(this,at).outlineInterpolationSystem.outlineOpacitiesDirty=!0),c.preloadGeometry&&u.userData.preloadGeometry!==!0&&(u.userData.preloadGeometry=!0,A(this,at).outlineInterpolationSystem.geometries3DDirty=!0),DC(u,c.focusable)&&(A(this,at).geometryInFocusSystem.focusablesDirty=!0)}else if(u.type==="geometry-group"){let c=t;hc(u,A(this,Je),c.visible),mie(u,A(this,Je),c),PC(u,A(this,Je),c.outline),c.height!=null&&CC(u,A(this,Je),c.height),c.altitude!=null&&(u.position.z=c.altitude),f6(u,A(this,Je),c)&&(A(this,at).textureSystem.dirty=!0),f6(u,A(this,Je),c),gie(u,A(this,Je),c.shading),x_(u,A(this,Je),c.opacity)&&(A(this,at).outlineInterpolationSystem.outlineOpacitiesDirty=!0),io(u,c.interactive,A(this,Je))&&(A(this,la).call(this),A(this,yl).call(this)),kC(u,A(this,Je),c.side),g6(u,{maskId:c.maskId,enabled:c.maskEnabled,effect:c.maskEffect,mode:c.maskMode}),m6(u,A(this,Je),{effectStart:c.effectStart,effectDistance:c.effectDistance,darkenAmount:c.darkenAmount,darkenUseDepth:c.darkenUseDepth,desaturateAmount:c.desaturateAmount,desaturateUseDepth:c.desaturateUseDepth,washOutAmount:c.washOutAmount,washOutUseDepth:c.washOutUseDepth}),c.position!=null&&(u.userData.centroid=[c.position[0],c.position[1]],u.userData.positionDirty=!0)}else if(u.type==="geometry"){if(u.components[0]instanceof oo){let c=t;if(hc(u,A(this,Je),c.visible)&&A(this,la).call(this),PC(u,A(this,Je),c.outline),yie(u,c),DC(u,c.focusable)&&(A(this,at).geometryInFocusSystem.focusablesDirty=!0),Cie(u,c.renderOrder)&&(A(this,at).meshDetachmentSystem.dirty=!0),Iie(u,c.opacity)&&(A(this,at).meshDetachmentSystem.dirty=!0,A(this,at).interactionSystem.dirty3D=!0,A(this,at).outlineInterpolationSystem.outlineOpacitiesDirty=!0),p6(u,c.flipImageToFaceCamera),Mie(u,c.enableImageCollisions),_y(u,A(this,Je),c.altitude)){let h=u.components[1],d=((n=h.altitude)!=null?n:0)+((a=h.height)!=null?a:0);A(this,at).panBoundsSystem.expandBoundsIfOutside(new fe(0,0,d)),A(this,at).shadowsSystem&&(A(this,at).shadowsSystem.needsRender=!0)}if(c.height!=null&&CC(u,A(this,Je),c.height)){let h=u.components[1],d=((o=h.altitude)!=null?o:0)+((s=h.height)!=null?s:0);A(this,at).panBoundsSystem.expandBoundsIfOutside(new fe(0,0,d)),A(this,at).shadowsSystem&&(A(this,at).shadowsSystem.needsRender=!0)}A6(u,c)&&(A(this,at).meshDetachmentSystem.dirty=!0,A(this,at).textureSystem.dirty=!0),BC(u,c,(l=A(this,Je).outlinesOptions)==null?void 0:l.darkenFactor),wie(u,c.hoverColor),io(u,c.interactive,A(this,Je))&&(A(this,at).interactionSystem.dirty3D=!0),Eie(u,c.hovered),kC(u,A(this,Je),c.side),Bie(u,c)}}else if(u.type==="label"||u.type==="marker"){let c=t;_ie(u,c,A(this,Je)),vie(u,c,A(this,Je))&&(A(this,yl).call(this),A(this,at).twoDEntitySystem.markDirty()),h6(u,c.position,this.convertTo3DMapPosition,A(this,at).panBoundsSystem),d6(u,this.getParentContainer(c.parent,!1))&&(A(this,yl).call(this),A(this,at).panBoundsSystem.dirty=!0),TC(u,c.enabled),hc(u,A(this,Je),c.visible)}else if(u.type==="image"){let c=t;hc(u,A(this,Je),c.visible),x_(u,A(this,Je),c.opacity),p6(u,c.flipImageToFaceCamera)}else if(u.type==="text3d"){let c=t;Die(u,A(this,Je),c)}this.render()}}convertTo3DMapPosition(e,t,r=0,i){var n,a,o,s,l;if(Array.isArray(e))return this.convertTo3DMapPosition(e[1],e[0],(n=e[2])!=null?n:r,typeof t=="function"?t:void 0);if(typeof t!="number")throw new Error("convertTo3DMapPosition failed: longitude must be a number");let{x:u,y:c}=b6((o=(a=A(this,Je).center)==null?void 0:a[1])!=null?o:0,(l=(s=A(this,Je).center)==null?void 0:s[0])!=null?l:0,e,t);return i?(i.set(u,c,r),i):new fe(u,c,r)}get backgroundColor(){return typeof A(this,Ba).backgroundColor=="string"?A(this,Ba).backgroundColor:"#".concat(A(this,Ba).backgroundColor.getHexString())}get backgroundAlpha(){return A(this,Ba).backgroundAlpha}getThreeRenderer(){return A(this,Ba)}getCenter(e){let t=Array.isArray(e)?e:this.getBoundingArea(e);return t?Wie(t):void 0}isInView(e){let t=cp(A(this,Je),e);if(A(this,BB).identity().multiply(A(this,Yn).projectionMatrix).multiply(A(this,Yn).matrixWorldInverse),A(this,Uy).setFromProjectionMatrix(A(this,BB)),t instanceof iA)return A(this,Uy).containsPoint(t.position);if(t instanceof ln){let r=t==null?void 0:t.components[0];if(r instanceof j6||r instanceof fB)return A(this,Uy).containsPoint(this.convertTo3DMapPosition(r.feature.geometry.coordinates));if(r instanceof oo){let i=new Ei(this.convertTo3DMapPosition(r.featureBbox[1],r.featureBbox[0],0),this.convertTo3DMapPosition(r.featureBbox[3],r.featureBbox[2],0));return A(this,Uy).intersectsBox(i)}}return!1}queryGeometry2DInView(e){let{screenOffsets:t,fullyContains:r}=e!=null?e:{},[i,n,a,o]=Jie(this.container,t),s=new bp(i,n,a,o);return A(this,at).twoDEntitySystem.visibleCollidersQTree.queryRect(s).filter(l=>r?s.contains(l):s.intersects(l)).map(l=>A(this,Je).geometry2DMap.get(l.userData.entityId)).filter(l=>l!=null).filter(l=>l.components[0]instanceof sp||l.components[0]instanceof lp).map(l=>l.id.toString())}onMapLibreEvent(e,t){if(!this.map){rt.warn('Tried to add event listener "'.concat(e,'" but MapLibre map is not initialized.'));return}let r=this.map.on(e,t);r!=null&&r.unsubscribe&&this.onAbort(()=>r.unsubscribe())}offMapLibreEvent(e,t){this.map&&this.map.off(e,t)}getSystems(){return A(this,at)}getInternalState(){return A(this,Je)}getInternalTweenGroup(){return A(this,Je).internalTweenGroup}getExternalTweenGroup(){return A(this,Je).externalTweenGroup}computeMinZOffsetBetweenContainers(e,t,r){if(!e||!t)return-1;K_(e,"group-container"),K_(t,"group-container"),e.updateMatrixWorld(!0),t.updateMatrixWorld(!0);let i=zC(e,this.getThreeCamera()),n=t.clone(!0);xh(n,!0),n.updateMatrixWorld();let a=zC(n,this.getThreeCamera());if(!vy(i)||!vy(a))return-1;let o=0,s;r&&this.container.querySelectorAll(".debug-box").forEach(l=>l.remove());do{if(o>1e4)return-1;if(o+=20,n.setAltitude(o),a.makeEmpty(),zC(n,A(this,Yn),a),s=i.intersectsBox(a),r){let l=I6(i,"blue",this.container),u=I6(a,s?"red":"green",this.container);l.classList.add("debug-box"),u.classList.add("debug-box")}}while(s);return o}};Hn=new WeakMap,Yn=new WeakMap,Fy=new WeakMap,zy=new WeakMap,N_=new WeakMap,_A=new WeakMap,Ly=new WeakMap,Oy=new WeakMap,mc=new WeakSet,P8=function(e){var t;A(this,xp)!=="outdoors-overlay"&&((t=this.map)==null||t.setPixelRatio(e)),A(this,Je).pixelRatio=this.resolutionScale},Je=new WeakMap,Aa=new WeakMap,bA=new WeakMap,fs=new WeakMap,Ba=new WeakMap,at=new WeakMap,D8=new WeakMap,yl=new WeakMap,la=new WeakMap,k8=new WeakMap,Ny=new WeakMap,$ae=function(){xe(this,Aa,document.createElement("div")),A(this,Aa).classList.add("mappedin__smart-collision-engine__container"),xe(this,bA,document.createElement("canvas")),A(this,bA).classList.add("mappedin__smart-collision-engine-debug__container"),this.container.appendChild(A(this,Aa)),xe(this,fs,document.createElement("canvas")),A(this,fs).classList.add("mappedin__smart-collision-engine__container"),A(this,fs).width=A(this,Aa).clientWidth*this.resolutionScale,A(this,fs).height=A(this,Aa).clientHeight*this.resolutionScale,A(this,fs).style.width=A(this,Aa).clientWidth+"px",A(this,fs).style.height=A(this,Aa).clientHeight+"px",A(this,Aa).appendChild(A(this,bA)),A(this,Aa).appendChild(A(this,fs)),A(this,bA).width=A(this,Aa).clientWidth,A(this,bA).height=A(this,Aa).clientHeight,A(this,fs).width=A(this,Aa).clientWidth*this.resolutionScale,A(this,fs).height=A(this,Aa).clientHeight*this.resolutionScale,A(this,fs).style.width=A(this,Aa).clientWidth+"px",A(this,fs).style.height=A(this,Aa).clientHeight+"px"},eoe=function(){A(this,at).twoDEntitySystem.markDirty()},xp=new WeakMap,R8=new WeakMap,MB=new WeakMap,F8=new WeakMap,z8=new WeakMap,U_=new WeakMap,Q_=new WeakMap,L8=new WeakMap,SB=new WeakMap,IB=new WeakMap,CB=new WeakMap,O8=function(e,t,r,i){let n=new iA(t,this.convertTo3DMapPosition(e[1],e[0],e[2]||0),i);return n.components[2]=new wQe(r!=null?r:A(this,at).occlusion2DSystem.backgroundId),A(this,Je).geometry2DMap.set(n.id,n),n},Uy=new WeakMap,BB=new WeakMap,TB=new WeakMap,gp=new WeakMap,yp=new WeakMap,N8=function(){return Qe(this,null,function*(){return QB.load(qNe).then(e=>{var t;return A(this,Hn)&&((t=A(this,Hn).environment)==null||t.dispose(),e.mapping=pv,A(this,Hn).environment=e,this.render()),e})})},U8=new WeakMap,Di=new WeakMap,j_=new WeakMap,PB=new WeakMap;d7e=new fe,G_=h7e;H();H();jB=class extends Ki{constructor(e,t){super(),I(this,"gl"),I(this,"options"),I(this,"el",document.createElement("div")),I(this,"core"),I(this,"origin"),I(this,"map"),I(this,"layer"),I(this,"handleStyleChange",()=>{!this.map||!this.layer||this.map.getLayer(this.layer.id)||(this.map.addLayer(this.layer),this.core.camera.setMinZoomLevel(this.map.getMinZoom()),this.core.camera.setMaxZoomLevel(this.map.getMaxZoom()),this.core.camera.setMinPitch(this.map.getMinPitch()),this.core.camera.setMaxPitch(this.map.getMaxPitch()))}),I(this,"handleMove",()=>{if(!this.map)return;let[r,i]=this.map.getCenter().toArray();this.core.getSystems().cameraSystem.setCenter(r,i),this.core.getSystems().cameraSystem.setZoomLevel(this.map.getZoom()),this.core.getSystems().cameraSystem.setRotation(Zr.degToRad(this.map.getBearing())),this.core.getSystems().cameraSystem.setTilt(Zr.degToRad(this.map.getPitch()))}),I(this,"handleError",r=>{rt.warn(r)}),this.origin=e,this.options=t}onAdd(e){this.origin=this.origin||e.getCenter().toArray(),this.gl=e.painter.context.gl,this.core=new G_(e._container,bt(ze({},this.options),{center:this.origin,zoomLevel:e.getZoom(),pitch:e.getPitch(),bearing:e.getBearing(),gl:this.gl,map:e,mode:"outdoors-overlay"})),this.map=e,this.core.camera.setMinZoomLevel(e.getMinZoom()),this.core.camera.setMaxZoomLevel(e.getMaxZoom()),this.core.camera.setMinPitch(e.getMinPitch()),this.core.camera.setMaxPitch(e.getMaxPitch()),this.map.on("error",this.handleError);let t=Gi.fromLngLat(this.origin,0);return this.layer=$U(t,this.core.viewCamera,()=>{this.core.renderSync()}),this.map.on("styledata",this.handleStyleChange),this.map.on("move",this.handleMove),this.handleStyleChange(),this.el}onRemove(){this.map&&(this.map.off("styledata",this.handleStyleChange),this.map.off("move",this.handleMove),this.map.off("error",this.handleError),this.layer&&this.map.removeLayer(this.layer.id)),this.layer=void 0,this.map=void 0,this.core&&this.core.destroy(),this.core=void 0}};H();H();H();H();H();H();Cp=class{constructor({origin:e,destination:t,distance:r=0,angle:i=0,pathWeight:n=0,multiplicativeDistanceWeightScaling:a=!0}){if(I(this,"origin"),I(this,"destination"),I(this,"distance"),I(this,"angle"),I(this,"weight"),this.origin=e,this.destination=t,this.distance=r,this.angle=i,this.weight=n||0,a?e.properties.floor===t.properties.floor&&(this.weight=(this.weight>=0?this.distance*this.weight:0)+this.distance):e.properties.map===t.properties.map&&(this.weight=this.weight>=0?this.distance+this.weight:0),isNaN(this.angle))throw new Error("Invalid angle: Expected a numeric value, but received NaN.")}};H();H();H();H();H();H();H();H();H();H();iae=111e3;H();q8=.4,m7e=class{constructor({nodes:e,groupBy:t,multiplicativeDistanceWeightScaling:r}){he(this,gc),I(this,"edges",{}),I(this,"nodesById"),I(this,"nodesByGroup",new Map),he(this,Qy),I(this,"hasLineOfSight",(n,a,o=[],s=q8)=>CA({type:"Feature",properties:{id:"origin",neighbors:[]},geometry:{type:"Point",coordinates:n}},{type:"Feature",properties:{id:"destination",neighbors:[]},geometry:{type:"Point",coordinates:a}},o,s)===!0),he(this,j8,(n,a)=>{let o=0;for(let s of a)(!s[A(this,Qy)]||s[A(this,Qy)]===n.properties[A(this,Qy)])&&Ip(n.geometry.coordinates,s.geometry.geometry)&&(o+=Math.max(0,s.cost));return o}),xe(this,Qy,t);let{features:i}=e;this.nodesById=yt(this,gc,roe).call(this,i),yt(this,gc,ioe).call(this),yt(this,gc,noe).call(this,i,t,{multiplicativeDistanceWeightScaling:r})}getShortestEuclideanDistance(e,t){return t.reduce((r,i)=>{let n=YUe(e.geometry.coordinates,i.geometry.coordinates);return Math.min(r,n)},Number.MAX_VALUE)}dijkstraFindWithinTravelDistance(e,t,r,i,n,a){var o;let s=this.nodesById[e];if(!s)return[];let l=[],u={},c={},h=new Set,d=[];for(l.push({node:s,distance:0}),u[s.properties.id]=null,c[s.properties.id]=0;l.length>0;){l.sort((g,v)=>g.distance-v.distance);let p=l.shift();if(!p)break;let f=p.node,m=p.distance;if(!h.has(f.properties.id)){if(h.add(f.properties.id),d.length>=a)break;f.properties.id!=null&&r.includes((o=f.properties.id)==null?void 0:o.toString())&&(n?this.hasLineOfSight(s.geometry.coordinates,f.geometry.coordinates,i)&&d.push({feature:f,distance:m}):d.push({feature:f,distance:m}));for(let g of this.edges[f.properties.id]){let v=g.destination,_=m+g.distance,x=c[f.properties.id]+g.weight;_>t||h.has(v.properties.id)||c[v.properties.id]!==void 0&&x>=c[v.properties.id]||(c[v.properties.id]=x,u[v.properties.id]=g,l.push({node:v,distance:_}))}}}return d.sort((p,f)=>p.distance-f.distance)}aStar({originIds:e,destinationNodeIds:t,disabledConnectionNodeIds:r,zones:i,overrideEdgeWeights:n,disabledNodeIds:a}){var o;let s=yt(this,gc,Q8).call(this,e),l=yt(this,gc,Q8).call(this,t);if(s.length===0||l.length===0)return[];let{frontier:u,cameFrom:c,costSoFar:h}=yt(this,gc,aoe).call(this,s,l);for(;u.length>0;){let d=u.shift();if(!d)break;if(yt(this,gc,ooe).call(this,d.origin,l))return yt(this,gc,soe).call(this,c,d.origin.properties.id);for(let p of this.edges[d.origin.properties.id]){let f=(o=n==null?void 0:n.get(p))!=null?o:p.weight,m=p.destination.properties.map!==p.origin.properties.map,g=r==null?void 0:r.has(p.destination.properties.id);if(r!=null&&r.has(p.origin.properties.id)&&(m||g)||a!=null&&a.has(p.origin.properties.id))continue;let v=h[d.origin.properties.id]+f+A(this,j8).call(this,p.destination,i);if(v!==1/0&&(h[p.destination.properties.id]==null||v<h[p.destination.properties.id])){let _=v+this.getShortestEuclideanDistance(p.destination,l);h[p.destination.properties.id]=v,c[p.destination.properties.id]=p,u.push({origin:p.destination,priority:_})}}u.sort((p,f)=>p.priority-f.priority)}return[]}};Qy=new WeakMap,gc=new WeakSet,Q8=function(e){return e.map(t=>this.nodesById[t]).filter(Boolean)},roe=function(e){return e.reduce((t,r)=>(t[r.properties.id]=r,t),{})},ioe=function(){for(let e in this.nodesById)this.nodesById.hasOwnProperty(e)&&(this.nodesById[e].properties.neighbors=this.nodesById[e].properties.neighbors.filter(({id:t})=>!!this.nodesById[t]))},noe=function(e,t,r){e.forEach(i=>{let n=t==="default"?t:i.properties[t];this.nodesByGroup.has(n)||this.nodesByGroup.set(n,[]),this.nodesByGroup.get(n).push(i),this.edges[i.properties.id]=i.properties.neighbors.map(({id:a,weight:o})=>{let s=this.nodesById[a],l=So(i.geometry.coordinates,s.geometry.coordinates),u=cu(i.geometry.coordinates,s.geometry.coordinates);return new Cp({origin:i,destination:s,pathWeight:o,distance:l,angle:u,multiplicativeDistanceWeightScaling:r==null?void 0:r.multiplicativeDistanceWeightScaling})})})},aoe=function(e,t){let r=[],i={},n={};return e.forEach(a=>{let o=this.getShortestEuclideanDistance(a,t);r.push({origin:a,priority:o}),i[a.properties.id]=null,n[a.properties.id]=0}),r.sort((a,o)=>a.priority-o.priority),{frontier:r,cameFrom:i,costSoFar:n}},ooe=function(e,t){return t.some(r=>r.properties.id===e.properties.id)},soe=function(e,t){let r=[],i=e[t];for(;i;)r.push(i),i=e[i.origin.properties.id];return r.reverse()},j8=new WeakMap;H();H();v7e=qo(hae());H();x7e=EN("Navigator");H();_7e=.5;H();H();S7e=qo(hae());H();H();r8={accessible:"accessible",outdoors:"outdoors",public:"public"};H();H();H();B7e=e=>{if(e==="space"||e==="obstruction"||e==="entrance")return{}},T7e=/\\.json|\\.geojson$/,eB=(e,t,r)=>{let i=e[t];if(typeof i!="object"||Object.keys(i).length===0)return B7e(t);let n={};for(let[a,o]of Object.entries(i)){let s=a.replace(T7e,"");n[s]=JSON.parse(r(o))}return n},P7e=["floorstack.json","styles.json","shapes.json","mapstack.json","floor.geojson","tileset.json","location.json","category.json","navigationFlags.json","annotation-symbols.json"],D7e=P7e,k7e=["annotation","textAreas","enterprise","floorImages","shapeInstances","modelInstances","window","area","facade"],R7e=k7e,$8=e=>{let t=new TextDecoder("utf-8"),r=t.decode.bind(t),i={"manifest.geojson":JSON.parse(r(e["manifest.geojson"])),"mapstack.geojson":JSON.parse(r(e["mapstack.geojson"])),"map.geojson":JSON.parse(r(e["map.geojson"])),"node.geojson":JSON.parse(r(e["node.geojson"])),"connection.json":JSON.parse(r(e["connection.json"])),space:eB(e,"space",r),obstruction:eB(e,"obstruction",r),entrance:eB(e,"entrance",r)};for(let n of D7e)e[n]&&(i[n]=JSON.parse(r(e[n])));for(let n of R7e)e[n]&&(i[n]=eB(e,n,r));return i};H();H();H();eQ=["agriculture","airport","casino","city-district","convention-center","entertainment","event-centre","first-responder-building","government-building","grocery-store","healthcare","higher-education","hotel","library","manufacturing","medical-centre","mixed-use","multifamily","museum","office-building","oil-and-energy","other","parking-facility","religious-institution","resort","retail-store","schools-k-12","shopping-mall","stadium-or-arena","storage-facility","theme-park","transit","transportation-hub","warehousing"],ydt=[...eQ,"unknown"],F7e=Object.freeze(Object.fromEntries([...eQ,"unknown"].map(e=>[e,e])));H();tQ=["reference-point","checkpoint","checkpoint-passport","parent"],vdt=[...tQ,"unknown"],xdt=Object.freeze(Object.fromEntries([...tQ,"unknown"].map(e=>[e,e]))),rQ=["closed-temporarily","new","pop-up","coming-soon","relocated"],_dt=[...rQ,"unknown"],bdt=Object.freeze(Object.fromEntries([...rQ,"unknown"].map(e=>[e,e])));H();iQ=["left","center","right"],wdt=[...iQ,"unknown"],Edt=Object.freeze(Object.fromEntries([...iQ,"unknown"].map(e=>[e,e])));H();nQ=["near","center"],Mdt=[...nQ,"unknown"],Sdt=Object.freeze(Object.fromEntries([...nQ,"unknown"].map(e=>[e,e])));H();aQ=["top","side"],Idt=[...aQ,"unknown"],Cdt=Object.freeze(Object.fromEntries([...aQ,"unknown"].map(e=>[e,e]))),oQ=["inside","outside","both"],Bdt=[...oQ,"unknown"],Tdt=Object.freeze(Object.fromEntries([...oQ,"unknown"].map(e=>[e,e])));H();sQ=["elevator","escalator","travelator","stairs","door","ramp","ladder"],Pdt=[...sQ,"unknown"],uoe=Object.freeze(Object.fromEntries([...sQ,"unknown"].map(e=>[e,e])));H();lQ=["room","hallway","wall","object","poi","area","window"],Ddt=[...lQ,"unknown"],kdt=Object.freeze(Object.fromEntries([...lQ,"unknown"].map(e=>[e,e])));H();H();coe=class{constructor(e){I(this,"_value"),this._value=e}[Symbol.iterator](){return this}next(){if(this._value==null)return{done:!0,value:void 0};let e=this._value;return this._value=null,{done:!1,value:e}}},hoe=class{constructor(e){I(this,"_tag","Some"),I(this,"_value"),this._value=e}get value(){return this._value}isSome(){return!0}isSomeAnd(e){return e(this.value)}isNone(){return!1}equals(e){return e.isSome()&&e.value===this.value}expect(e){return this.value}unwrap(){return this.value}unwrapOr(e){return this.value}unwrapOrElse(e){return this.value}inspect(e){return e(this.value),this}inspectNone(e){return this}map(e){return aae(e(this.value))}mapAsync(e){return e(this.value).then(t=>aae(t))}mapOr(e,t){return this.map(e).unwrapOr(t)}mapOrAsync(e,t){return this.mapAsync(e).then(r=>r.unwrapOr(t))}mapOrElse(e,t){return this.map(e).unwrapOrElse(t)}mapOrElseAsync(e,t){return this.mapAsync(e).then(r=>r.unwrapOrElse(t))}and(e){return e}andThen(e){return e(this.value)}andThenAsync(e){return e(this.value)}filter(e){return e(this.value)?this:IA()}or(e){return this}orElse(e){return this}xor(e){return e.isSome()?IA():this}toString(){return"Some(".concat(this.value,")")}okOr(e){return BA(this.value)}okOrElse(e){return BA(this.value)}iter(){return new coe(this.value)}[Symbol.iterator](){return this.iter()}zip(e){return e.isSome()?tb([this.value,e.value]):IA()}zipWith(e,t){return e.isSome()?tb(t(this.value,e.value)):IA()}get[Symbol.toStringTag](){return"Some"}},doe=class{constructor(){I(this,"_tag","None")}get value(){return null}isSome(){return!1}isSomeAnd(e){return!1}isNone(){return!0}equals(e){return e.isNone()}expect(e){throw new Error(e)}unwrap(){throw new Error("Tried to unwrap a None value!")}unwrapOr(e){return e}unwrapOrElse(e){return e()}inspect(e){return this}inspectNone(e){return e(),this}map(e){return this}mapAsync(e){return Promise.resolve(this)}mapOr(e,t){return t}mapOrAsync(e,t){return Promise.resolve(t)}mapOrElse(e,t){return t()}mapOrElseAsync(e,t){return t()}and(e){return this}andThen(e){return this}andThenAsync(e){return Promise.resolve(this)}filter(e){return this}or(e){return e}orElse(e){return e()}xor(e){return e}toString(){return"None"}okOr(e){return OB(e)}okOrElse(e){return OB(e())}iter(){return new coe(null)}[Symbol.iterator](){return this.iter()}zip(e){return this}zipWith(e,t){return this}get[Symbol.toStringTag](){return"None"}},tb=e=>new hoe(e),IA=()=>new doe,aae=e=>e instanceof hoe||e instanceof doe?e:e==null?IA():tb(e),poe=class{constructor(e){I(this,"_value"),this._value=e}[Symbol.iterator](){return this}next(){if(this._value==null)return{done:!0,value:void 0};let e=this._value;return this._value=null,{done:!1,value:e}}},z7e=class{constructor(e){I(this,"_tag","Ok"),I(this,"_value"),this._value=e}get value(){return this._value}get error(){return null}isOk(){return!0}isOkAnd(e){return e(this.value)}isErr(){return!1}isErrAnd(e){return!1}ok(){return tb(this.value)}err(){return IA()}expect(e){return this.value}expectErr(e){throw new Error(e)}unwrap(){return this.value}unwrapOr(e){return this.value}unwrapOrElse(e){return this.value}inspect(e){return e(this.value),this}inspectErr(){return this}map(e){return BA(e(this.value))}mapAsync(e){return Qe(this,null,function*(){return e(this.value).then(BA)})}mapOr(e,t){return e(this.value)}mapOrAsync(e,t){return Qe(this,null,function*(){return e(this.value)})}mapOrElse(e,t){return e(this.value)}mapOrElseAsync(e,t){return Qe(this,null,function*(){return e(this.value)})}mapErr(e){return this}iter(){return new poe(this.value)}[Symbol.iterator](){return this.iter()}and(e){return e}andThen(e){return e(this.value)}or(e){return this}orElse(e){return this}andThenAsync(e){return Qe(this,null,function*(){return e(this.value)})}toString(){return"Ok(".concat(this.value,")")}get[Symbol.toStringTag](){return"Ok"}},L7e=class foe{constructor(t){I(this,"_tag","Err"),I(this,"_error"),this._error=t}get value(){return null}get error(){return this._error}isOk(){return!1}isOkAnd(t){return!1}isErr(){return!0}isErrAnd(t){return t(this.error)}ok(){return IA()}err(){return tb(this.error)}expect(t){throw new Error(t)}expectErr(t){return this.error}unwrap(){throw this.error}unwrapOr(t){return t}unwrapOrElse(t){return t()}inspect(){return this}inspectErr(t){return t(this.error),this}map(t){return this}iter(){return new poe(null)}[Symbol.iterator](){return this.iter()}mapAsync(t){return Qe(this,null,function*(){return this})}mapOr(t,r){return r}mapOrAsync(t,r){return Qe(this,null,function*(){return r})}mapOrElse(t,r){return r()}mapOrElseAsync(t,r){return Qe(this,null,function*(){return r()})}mapErr(t){return new foe(t(this.error))}and(t){return this}andThen(t){return this}andThenAsync(t){return Qe(this,null,function*(){return this})}or(t){return t}orElse(t){return t(this.error)}toString(){return"Err(".concat(this.error,")")}get[Symbol.toStringTag](){return"Err"}},BA=e=>new z7e(e),OB=e=>new L7e(e);H();Us=Uint8Array,Hy=Uint16Array,O7e=Int32Array,Aoe=new Us([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),moe=new Us([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),N7e=new Us([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),goe=function(e,t){for(var r=new Hy(31),i=0;i<31;++i)r[i]=t+=1<<e[i-1];for(var n=new O7e(r[30]),i=1;i<30;++i)for(var a=r[i];a<r[i+1];++a)n[a]=a-r[i]<<5|i;return{b:r,r:n}},yoe=goe(Aoe,2),voe=yoe.b,U7e=yoe.r;voe[28]=258,U7e[258]=28;xoe=goe(moe,0),Q7e=xoe.b,Rdt=xoe.r,G8=new Hy(32768);for(Oi=0;Oi<32768;++Oi)Sh=(Oi&43690)>>1|(Oi&21845)<<1,Sh=(Sh&52428)>>2|(Sh&13107)<<2,Sh=(Sh&61680)>>4|(Sh&3855)<<4,G8[Oi]=((Sh&65280)>>8|(Sh&255)<<8)>>1;J_=(function(e,t,r){for(var i=e.length,n=0,a=new Hy(t);n<i;++n)e[n]&&++a[e[n]-1];var o=new Hy(t);for(n=1;n<t;++n)o[n]=o[n-1]+a[n-1]<<1;var s;if(r){s=new Hy(1<<t);var l=15-t;for(n=0;n<i;++n)if(e[n])for(var u=n<<4|e[n],c=t-e[n],h=o[e[n]-1]++<<c,d=h|(1<<c)-1;h<=d;++h)s[G8[h]>>l]=u}else for(s=new Hy(i),n=0;n<i;++n)e[n]&&(s[n]=G8[o[e[n]-1]++]>>15-e[n]);return s}),nb=new Us(288);for(Oi=0;Oi<144;++Oi)nb[Oi]=8;for(Oi=144;Oi<256;++Oi)nb[Oi]=9;for(Oi=256;Oi<280;++Oi)nb[Oi]=7;for(Oi=280;Oi<288;++Oi)nb[Oi]=8;_oe=new Us(32);for(Oi=0;Oi<32;++Oi)_oe[Oi]=5;j7e=J_(nb,9,1),G7e=J_(_oe,5,1),i8=function(e){for(var t=e[0],r=1;r<e.length;++r)e[r]>t&&(t=e[r]);return t},ou=function(e,t,r){var i=t/8|0;return(e[i]|e[i+1]<<8)>>(t&7)&r},n8=function(e,t){var r=t/8|0;return(e[r]|e[r+1]<<8|e[r+2]<<16)>>(t&7)},V7e=function(e){return(e+7)/8|0},uQ=function(e,t,r){return(t==null||t<0)&&(t=0),(r==null||r>e.length)&&(r=e.length),new Us(e.subarray(t,r))},Y7e=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],vl=function(e,t,r){var i=new Error(t||Y7e[e]);if(i.code=e,Error.captureStackTrace&&Error.captureStackTrace(i,vl),!r)throw i;return i},H7e=function(e,t,r,i){var n=e.length,a=i?i.length:0;if(!n||t.f&&!t.l)return r||new Us(0);var o=!r,s=o||t.i!=2,l=t.i;o&&(r=new Us(n*3));var u=function(Me){var Ce=r.length;if(Me>Ce){var oe=new Us(Math.max(Ce*2,Me));oe.set(r),r=oe}},c=t.f||0,h=t.p||0,d=t.b||0,p=t.l,f=t.d,m=t.m,g=t.n,v=n*8;do{if(!p){c=ou(e,h,1);var _=ou(e,h+1,3);if(h+=3,_)if(_==1)p=j7e,f=G7e,m=9,g=5;else if(_==2){var x=ou(e,h,31)+257,b=ou(e,h+10,15)+4,E=x+ou(e,h+5,31)+1;h+=14;for(var M=new Us(E),S=new Us(19),D=0;D<b;++D)S[N7e[D]]=ou(e,h+D*3,7);h+=b*3;for(var T=i8(S),P=(1<<T)-1,k=J_(S,T,1),D=0;D<E;){var R=k[ou(e,h,P)];h+=R&15;var F=R>>4;if(F<16)M[D++]=F;else{var B=0,z=0;for(F==16?(z=3+ou(e,h,3),h+=2,B=M[D-1]):F==17?(z=3+ou(e,h,7),h+=3):F==18&&(z=11+ou(e,h,127),h+=7);z--;)M[D++]=B}}var O=M.subarray(0,x),j=M.subarray(x);m=i8(O),g=i8(j),p=J_(O,m,1),f=J_(j,g,1)}else vl(1);else{var F=V7e(h)+4,Y=e[F-4]|e[F-3]<<8,Z=F+Y;if(Z>n){l&&vl(0);break}s&&u(d+Y),r.set(e.subarray(F,Z),d),t.b=d+=Y,t.p=h=Z*8,t.f=c;continue}if(h>v){l&&vl(0);break}}s&&u(d+131072);for(var ne=(1<<m)-1,ie=(1<<g)-1,le=h;;le=h){var B=p[n8(e,h)&ne],X=B>>4;if(h+=B&15,h>v){l&&vl(0);break}if(B||vl(2),X<256)r[d++]=X;else if(X==256){le=h,p=null;break}else{var ce=X-254;if(X>264){var D=X-257,ge=Aoe[D];ce=ou(e,h,(1<<ge)-1)+voe[D],h+=ge}var be=f[n8(e,h)&ie],_e=be>>4;be||vl(3),h+=be&15;var j=Q7e[_e];if(_e>3){var ge=moe[_e];j+=n8(e,h)&(1<<ge)-1,h+=ge}if(h>v){l&&vl(0);break}s&&u(d+131072);var ke=d+ce;if(d<j){var Ye=a-j,We=Math.min(j,ke);for(Ye+d<0&&vl(3);d<We;++d)r[d]=i[Ye+d]}for(;d<ke;++d)r[d]=r[d-j]}}t.l=p,t.p=le,t.b=d,t.f=c,p&&(c=1,t.m=m,t.d=f,t.n=g)}while(!c);return d!=r.length&&o?uQ(r,0,d):r.subarray(0,d)},W7e=new Us(0),_c=function(e,t){return e[t]|e[t+1]<<8},uu=function(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0},a8=function(e,t){return uu(e,t)+uu(e,t+4)*4294967296};V8=typeof TextDecoder<"u"&&new TextDecoder,X7e=0;try{V8.decode(W7e,{stream:!0}),X7e=1}catch(e){}J7e=function(e){for(var t="",r=0;;){var i=e[r++],n=(i>127)+(i>223)+(i>239);if(r+n>e.length)return{s:t,r:uQ(e,r-1)};n?n==3?(i=((i&15)<<18|(e[r++]&63)<<12|(e[r++]&63)<<6|e[r++]&63)-65536,t+=String.fromCharCode(55296|i>>10,56320|i&1023)):n&1?t+=String.fromCharCode((i&31)<<6|e[r++]&63):t+=String.fromCharCode((i&15)<<12|(e[r++]&63)<<6|e[r++]&63):t+=String.fromCharCode(i)}};K7e=function(e,t){return t+30+_c(e,t+26)+_c(e,t+28)},q7e=function(e,t,r){var i=_c(e,t+28),n=boe(e.subarray(t+46,t+46+i),!(_c(e,t+8)&2048)),a=t+46+i,o=uu(e,t+20),s=r&&o==4294967295?$7e(e,a):[o,uu(e,t+24),uu(e,t+42)],l=s[0],u=s[1],c=s[2];return[_c(e,t+10),l,u,n,a+_c(e,t+30)+_c(e,t+32),c]},$7e=function(e,t){for(;_c(e,t)!=1;t+=4+_c(e,t+2));return[a8(e,t+12),a8(e,t+4),a8(e,t+20)]};H();H();H();H();bc=e=>Object.entries(e);H();Y8=e=>Object.keys(e);H();H();H();H();sae={accessible:"accessible",outdoors:"outdoors",public:"public"};H();yje=["facebook","instagram","twitter"];H();vje=e=>"fc_".concat(e.slice(3));H();H();H();H();H();Eje=qo(KNe(),1),Mje=e=>{let t=e.geometry.coordinates[0],r=0;for(let i=0;i<t.length-1;i++)r+=t[i][0]*t[i+1][1]-t[i+1][0]*t[i][1];return Math.abs(r/2)},Sje=(e,t)=>{let[r,i]=e,n=t.geometry.coordinates[0],a=!1;for(let o=0,s=n.length-1;o<n.length;s=o++){let[l,u]=n[o],[c,h]=n[s];u>i!=h>i&&r<(c-l)*(i-u)/(h-u)+l&&(a=!a)}return a},Ije=e=>{let t=e.geometry.coordinates[0],r=0,i=0;for(let n=0;n<t.length-1;n++)r+=t[n][0],i+=t[n][1];return{geometry:{coordinates:[r/(t.length-1),i/(t.length-1)]}}},Cje=e=>{let t=Mje(e),r=Number.isFinite(t)?Math.max(t,1):1;return Math.sqrt(r)*1e-6},cQ=e=>{try{let t=Ije(e).geometry.coordinates;if(!Sje(t,e)){let r=(0,Eje.default)(e.geometry.coordinates,Cje(e));return BA([r[0],r[1]])}return BA(t)}catch(t){return OB(new Error("Unable to calculate center of polygon"))}};H();H();H();H();ta=e=>JSON.parse(boe(e)),Vje=/^geometry\\/(.+)\\.geojson$/,Yje=/^nodes\\/(.+)\\.(geo)?json$/,Hje=/^floorImages\\/(.+)\\.geojson$/,Wje=/^facade\\/(.+)\\.json$/,Zje=/^walkable\\/(.+)\\.json$/,Xje=/^nonwalkable\\/(.+)\\.json$/,Jje=/^kinds\\/(.+)\\.json$/,Kje=/^annotations\\/(.+)\\.json$/,qje=/^cms\\/(?:([^/]+)\\/)?([^/]+)\\.(?:json|geojson)$/,$je=[(e,t)=>e==="manifest.geojson"?{manifest:ta(t)}:void 0,(e,t)=>e==="floors.geojson"?{floors:ta(t)}:void 0,(e,t)=>{let r=e.match(Vje);return r?{geometry:{[r[1]]:ta(t)}}:void 0},(e,t)=>e==="connections.json"?{connections:ta(t)}:void 0,(e,t)=>e==="navigationFlags.json"?{navigationFlags:ta(t)}:void 0,(e,t)=>{let r=e.match(Yje);return r?{nodes:{[r[1]]:ta(t)}}:void 0},(e,t)=>e==="default-style.json"?{defaultStyle:ta(t)}:void 0,(e,t)=>e==="floor-stacks.json"?{floorStacks:ta(t)}:void 0,(e,t)=>e==="outdoors.json"?{outdoors:ta(t)}:void 0,(e,t)=>e==="tileset.json"?{tileset:ta(t)}:void 0,(e,t)=>{let r=e.match(Hje);return r?{floorImages:{[r[1]]:ta(t)}}:void 0},(e,t)=>{let r=e.match(Wje);return r?{facade:{[r[1]]:ta(t)}}:void 0},(e,t)=>{let r=e.match(Zje);return r?{walkable:{[r[1]]:ta(t)}}:void 0},(e,t)=>{let r=e.match(Xje);return r?{nonwalkable:{[r[1]]:ta(t)}}:void 0},(e,t)=>{let r=e.match(Jje);return r?{kinds:{[r[1]]:ta(t)}}:void 0},(e,t)=>e==="annotation-symbols.json"?{annotationSymbols:ta(t)}:void 0,(e,t)=>{let r=e.match(Kje);return r?{annotations:{[r[1]]:ta(t)}}:void 0},(e,t)=>e==="locations.json"?{locations:ta(t)}:void 0,(e,t)=>e==="location-categories.json"?{locationCategories:ta(t)}:void 0,(e,t)=>e==="location-instances.json"?{locationInstances:ta(t)}:void 0,(e,t)=>{let r=e.match(qje);if(!r)return;let[,i,n]=r;return i==="floorText"||i==="textures"||i==="textAreas"?{cms:{[i]:{[n]:ta(t)}}}:{cms:{[n]:ta(t)}}}],e9e=new Set(sQ),t9e=new Set(lQ),r9e=new Set(eQ),i9e=new Set(rQ),n9e=new Set(tQ),a9e=new Set(iQ),o9e=new Set(nQ),s9e=new Set(aQ),l9e=new Set(oQ);Moe={decompressUnsafeSync:e=>rB(e),decompressUnsafe:e=>Promise.resolve(rB(e)),decompressSync:e=>rB(e),decompress:e=>Promise.resolve(rB(e))},GB=class{constructor({nodes:e,geojsonCollection:t,groupBy:r="default",multiplicativeDistanceWeightScaling:i,flagDeclarations:n,getDoorByNodeId:a}){I(this,"groupBy"),I(this,"graph"),I(this,"geometryEdgesByMapId",new Map),I(this,"flagDeclarations",{}),I(this,"getDoorByNodeId"),I(this,"disabledNodeIds"),I(this,"generatePath",s=>{let{destination:l}=s[s.length-1],u={type:"FeatureCollection",features:[]};for(let h=0;h<s.length;h++){let{origin:d,destination:p}=s[h],f={id:d.properties.id,angle:s[h].angle,distance:s[h].distance,destination:p.properties.id,edges:this.graph.edges[d.properties.id]};this.groupBy!=="default"&&(f.groupBy=d.properties[this.groupBy]),u.features.push({type:"Feature",geometry:{type:"Point",coordinates:[d.geometry.coordinates[0],d.geometry.coordinates[1]]},properties:f})}let c={id:l.properties.id,edges:this.graph.edges[l.properties.id]};return this.groupBy!=="default"&&(c.groupBy=l.properties[this.groupBy]),u.features.push({type:"Feature",geometry:{type:"Point",coordinates:[l.geometry.coordinates[0],l.geometry.coordinates[1]]},properties:c}),u}),I(this,"findNearestNodesOnGraph",(s,l,u,c,h=!1,d=1/0)=>{var p;return this.graph.dijkstraFindWithinTravelDistance(s,l,c,(p=this.geometryEdgesByMapId.get(u))!=null?p:[],h,d)}),I(this,"hasLineOfSight",(s,l,u,c)=>this.graph.hasLineOfSight(s,l,this.geometryEdgesByMapId.get(u),c)),I(this,"getDistance",(s,l)=>So(s,l)),I(this,"getAngle",(s,l)=>cu(s,l)),this.groupBy=r,this.graph=new m7e({nodes:e,groupBy:this.groupBy,multiplicativeDistanceWeightScaling:i});let o=(t==null?void 0:t.features)||[];this.flagDeclarations=n!=null?n:{},this.getDoorByNodeId=a,this.disabledNodeIds=this.getDisabledNodeIds(),o.forEach(s=>{let l=null;if(s.geometry.type==="LineString"?l=s.geometry.coordinates:s.geometry.type==="Polygon"&&(l=s.geometry.coordinates.flat()),l){let u=this.groupBy==="default"?this.groupBy:s.properties[this.groupBy];this.geometryEdgesByMapId.has(u)||this.geometryEdgesByMapId.set(u,[]),l.forEach((c,h)=>{this.geometryEdgesByMapId.get(u).push([c,l[h+1]||l[0]])})}})}getDisabledNodeIds(){let e=new Set;if(r8.public in this.flagDeclarations)for(let t in this.graph.nodesById)loe(this.graph.nodesById[t].properties.flags,this.flagDeclarations[r8.public].index,this.flagDeclarations[r8.public].bit)||e.add(t);return e}getDirections({zones:e,originIds:t,from:r,to:i,destinationNodeIds:n,disabledConnectionNodeIds:a,simplify:o,multiplicativeDistanceWeightScaling:s,overrideEdgeWeights:l}){var u;let c=(u=o==null?void 0:o.enabled)!=null?u:!0,h=e!=null?e:[],d=this.graph.aStar({originIds:t,destinationNodeIds:n,zones:h,disabledConnectionNodeIds:new Set(a),overrideEdgeWeights:l,disabledNodeIds:this.disabledNodeIds});if(d.length===0)return{type:"FeatureCollection",features:[]};if((o==null?void 0:o.__EXPERIMENTAL_METHOD)!=="greedy-los"&&r&&i&&r.length===1&&i.length===1){let p=new Cp({origin:r[0],destination:d[0].origin,distance:So(r[0].geometry.coordinates,d[0].origin.geometry.coordinates),angle:cu(r[0].geometry.coordinates,d[0].origin.geometry.coordinates),multiplicativeDistanceWeightScaling:s}),f=d.slice(),m=new Cp({origin:d[d.length-1].destination,destination:i[0],distance:So(d[d.length-1].destination.geometry.coordinates,i[0].geometry.coordinates),angle:cu(d[d.length-1].destination.geometry.coordinates,i[0].geometry.coordinates),multiplicativeDistanceWeightScaling:s});f.unshift(p),f.push(m),d=f}return c&&(d=this.simplifyAllSteps(d,o,s)),this.generatePath(d)}simplifyAllSteps(e,t={enabled:!0,__EXPERIMENTAL_METHOD:"greedy-los"},r){var i,n,a,o;let s=[],l=[e[0]],u=(i=t.__EXPERIMENTAL_METHOD)!=null?i:"greedy-los",c=(n=t.radius)!=null?n:q8,h=u==="dp-optimal"?this.simplifyStepsWithDPMethod.bind(this):u==="rdp"?this.simplifyStepsImprovedWithSimplifyBeforeLoSChecks.bind(this):this.simplifySteps.bind(this);for(let m=1;m<e.length;m++)if(this.groupBy!=="default"&&e[m].origin.properties[this.groupBy]!==e[m-1].origin.properties[this.groupBy]){let g=e[m-1].origin.properties[this.groupBy],v=(a=this.geometryEdgesByMapId.get(g))!=null?a:[];s.push(...h(l,v,c,r,t)),l=[e[m]]}else l.push(e[m]);let d=e[e.length-1],p=this.groupBy==="default"?this.groupBy:d.origin.properties[this.groupBy],f=(o=this.geometryEdgesByMapId.get(p))!=null?o:[];return s.push(...h(l,f,c,r,t)),s}simplifySteps(e,t,r,i,n){return M7e(e,t,r,this.flagDeclarations,i)}simplifyStepsImprovedWithSimplifyBeforeLoSChecks(e,t,r,i,n){var a;if(e.length<3)return e;e=w7e(e,this.getDoorByNodeId,i,t);let o=(n==null?void 0:n.__EXPERIMENTAL_METHOD)==="rdp"&&(a=n.mustIncludeDoorBufferNodes)!=null?a:!0;return E7e(e,t,i,o)}simplifyStepsWithDPMethod(e,t,r,i,n){var a;if(e.length<3)return e;let o=new Set;(n==null?void 0:n.__EXPERIMENTAL_METHOD)==="dp-optimal"&&(a=n.includeDoorBufferNodes)!=null&&a&&(o=I7e(e,this.getDoorByNodeId));for(let u=0;u<e.length-1;u++){let c=e[u].origin.properties.floor,h=e[u+1].origin.properties.floor;c!==h&&(e[u].origin.properties.preventSmoothing||(e[u].origin.properties.preventSmoothing=!0,o.add(e[u].origin.properties.id)),e[u+1].origin.properties.preventSmoothing||(e[u+1].origin.properties.preventSmoothing=!0,o.add(e[u+1].origin.properties.id)))}let s=e[e.length-1];s.origin.properties.floor!==s.destination.properties.floor&&(s.origin.properties.preventSmoothing||(s.origin.properties.preventSmoothing=!0,o.add(s.origin.properties.id)));let l=y7e(e,t,i,r);for(let u of e)o.has(u.origin.properties.id)&&delete u.origin.properties.preventSmoothing,o.has(u.destination.properties.id)&&delete u.destination.properties.preventSmoothing;return l}},s8="https://tiles-cdn.mappedin.com/styles/mappedin/style.json",h9e="https://auth.mappedin.com/oauth2/token"});var Noe={};Ra(Noe,{InternalSearch:()=>M9e,removeAccents:()=>JB});function S9e(e,{placesResult:t,locationsResult:r,categoriesResult:i}){let n=t.reduce((s,{id:l,match:u,score:c,__type:h})=>{let d=e.getById(h,l);return d!=null&&!js.is(d)&&!Tp.is(d)&&!Za.is(d)&&!ma.is(d)&&!xl.is(d)&&s.push({type:d.__type,match:u,score:c,item:d}),s},[]),a;if(r){a=[];for(let{id:s,match:l,score:u}of r){let c=e.getById("enterprise-location",s);c&&a.push({type:c.__type,match:l,score:u,item:c})}}let o;if(i){o=[];for(let{id:s,match:l,score:u}of i){let c=e.getById("enterprise-category",s);c&&o.push({type:c.__type,match:l,score:u,item:c})}}return{places:n,enterpriseLocations:a,enterpriseCategories:o}}function JB(e){return e.normalize("NFD").replace(/[\\u0300-\\u036f|\\u2019|\\u0027|\\']/g,"").toLowerCase()}function C9e(e){let t=new WB({fields:["name","description"],storeFields:["id","__type"],searchOptions:{fuzzy:.2,prefix:!0,boost:{name:2},combineWith:"AND"},extractField:(o,s)=>{let l=o[s];return typeof l=="string"?JB(l):o[s]},processTerm:o=>P9e.has(o)?"":o.toLowerCase()}),r=e.getByType("enterprise-location"),i;r&&(i=new WB({fields:["name","tags","description"],storeFields:["id","__type"],searchOptions:{combineWith:"OR",prefix:!0,fuzzy:.2,boost:{name:3,tags:2,description:1}},extractField:(o,s)=>Array.isArray(o[s])?o[s].join(" "):typeof o[s]=="string"?JB(o[s]):o[s]}));let n=e.getByType("enterprise-category"),a;return n&&(a=new WB({fields:["name","description","locations.name"],storeFields:["id","__type"],extractField(o,s){return s==="locations.name"?o.locations.reduce((l,u)=>l+" ".concat(Toe," ")+u.name,"")+" ".concat(Toe):typeof o[s]=="string"?JB(o[s]):o[s]},searchOptions:{combineWith:"OR",prefix:!0,fuzzy:.2,boost:{name:2,"locations.name":2}}})),{enterpriseCategories:a,enterpriseLocations:i,places:t}}var d9e,p9e,Poe,Doe,dQ,Xy,f9e,koe,pQ,KB,yQ,fQ,A9e,Roe,Foe,bQ,wQ,zoe,m9e,WB,AQ,g9e,y9e,v9e,x9e,mQ,Soe,_9e,vQ,xQ,gQ,b9e,Ioe,Coe,Boe,YB,HB,Loe,w9e,E9e,XB,_Q,Ooe,M9e,I9e,B9e,T9e,P9e,Toe,Uoe=Ot(()=>{"use strict";qB();Zy();Rd();rh();nl();ws();Ji();d9e=Kr((e,t)=>{H();var r=200,i="__lodash_hash_undefined__",n=800,a=16,o=9007199254740991,s="[object Arguments]",l="[object Array]",u="[object AsyncFunction]",c="[object Boolean]",h="[object Date]",d="[object Error]",p="[object Function]",f="[object GeneratorFunction]",m="[object Map]",g="[object Number]",v="[object Null]",_="[object Object]",x="[object Proxy]",b="[object RegExp]",E="[object Set]",M="[object String]",S="[object Undefined]",D="[object WeakMap]",T="[object ArrayBuffer]",P="[object DataView]",k="[object Float32Array]",R="[object Float64Array]",F="[object Int8Array]",B="[object Int16Array]",z="[object Int32Array]",O="[object Uint8Array]",j="[object Uint8ClampedArray]",Y="[object Uint16Array]",Z="[object Uint32Array]",ne=/[\\\\^$.*+?()[\\]{}|]/g,ie=/^\\[object .+?Constructor\\]$/,le=/^(?:0|[1-9]\\d*)$/,X={};X[k]=X[R]=X[F]=X[B]=X[z]=X[O]=X[j]=X[Y]=X[Z]=!0,X[s]=X[l]=X[T]=X[c]=X[P]=X[h]=X[d]=X[p]=X[m]=X[g]=X[_]=X[b]=X[E]=X[M]=X[D]=!1;var ce=typeof global=="object"&&global&&global.Object===Object&&global,ge=typeof self=="object"&&self&&self.Object===Object&&self,be=ce||ge||Function("return this")(),_e=typeof e=="object"&&e&&!e.nodeType&&e,ke=_e&&typeof t=="object"&&t&&!t.nodeType&&t,Ye=ke&&ke.exports===_e,We=Ye&&ce.process,Me=(function(){try{var U=ke&&ke.require&&ke.require("util").types;return U||We&&We.binding&&We.binding("util")}catch(de){}})(),Ce=Me&&Me.isTypedArray;function oe(U,de,Fe){switch(Fe.length){case 0:return U.call(de);case 1:return U.call(de,Fe[0]);case 2:return U.call(de,Fe[0],Fe[1]);case 3:return U.call(de,Fe[0],Fe[1],Fe[2])}return U.apply(de,Fe)}function it(U,de){for(var Fe=-1,mt=Array(U);++Fe<U;)mt[Fe]=de(Fe);return mt}function Oe(U){return function(de){return U(de)}}function Ke(U,de){return U==null?void 0:U[de]}function Le(U,de){return function(Fe){return U(de(Fe))}}var Ze=Array.prototype,ut=Function.prototype,et=Object.prototype,te=be["__core-js_shared__"],K=ut.toString,ve=et.hasOwnProperty,je=(function(){var U=/[^.]+$/.exec(te&&te.keys&&te.keys.IE_PROTO||"");return U?"Symbol(src)_1."+U:""})(),Ne=et.toString,Ue=K.call(Object),ft=RegExp("^"+K.call(ve).replace(ne,"\\\\$&").replace(/hasOwnProperty|(function).*?(?=\\\\\\()| for .+?(?=\\\\\\])/g,"$1.*?")+"$"),ot=Ye?be.Buffer:void 0,Ae=be.Symbol,Q=be.Uint8Array,G=ot?ot.allocUnsafe:void 0,W=Le(Object.getPrototypeOf,Object),re=Object.create,$=et.propertyIsEnumerable,me=Ze.splice,ye=Ae?Ae.toStringTag:void 0,Be=(function(){try{var U=tn(Object,"defineProperty");return U({},"",{}),U}catch(de){}})(),Ge=ot?ot.isBuffer:void 0,ue=Math.max,pe=Date.now,we=tn(be,"Map"),Ie=tn(Object,"create"),nt=(function(){function U(){}return function(de){if(!fi(de))return{};if(re)return re(de);U.prototype=de;var Fe=new U;return U.prototype=void 0,Fe}})();function lt(U){var de=-1,Fe=U==null?0:U.length;for(this.clear();++de<Fe;){var mt=U[de];this.set(mt[0],mt[1])}}function $e(){this.__data__=Ie?Ie(null):{},this.size=0}function He(U){var de=this.has(U)&&delete this.__data__[U];return this.size-=de?1:0,de}function wt(U){var de=this.__data__;if(Ie){var Fe=de[U];return Fe===i?void 0:Fe}return ve.call(de,U)?de[U]:void 0}function Yt(U){var de=this.__data__;return Ie?de[U]!==void 0:ve.call(de,U)}function ur(U,de){var Fe=this.__data__;return this.size+=this.has(U)?0:1,Fe[U]=Ie&&de===void 0?i:de,this}lt.prototype.clear=$e,lt.prototype.delete=He,lt.prototype.get=wt,lt.prototype.has=Yt,lt.prototype.set=ur;function Qt(U){var de=-1,Fe=U==null?0:U.length;for(this.clear();++de<Fe;){var mt=U[de];this.set(mt[0],mt[1])}}function Lr(){this.__data__=[],this.size=0}function Vr(U){var de=this.__data__,Fe=Ee(de,U);if(Fe<0)return!1;var mt=de.length-1;return Fe==mt?de.pop():me.call(de,Fe,1),--this.size,!0}function Dr(U){var de=this.__data__,Fe=Ee(de,U);return Fe<0?void 0:de[Fe][1]}function Xr(U){return Ee(this.__data__,U)>-1}function yi(U,de){var Fe=this.__data__,mt=Ee(Fe,U);return mt<0?(++this.size,Fe.push([U,de])):Fe[mt][1]=de,this}Qt.prototype.clear=Lr,Qt.prototype.delete=Vr,Qt.prototype.get=Dr,Qt.prototype.has=Xr,Qt.prototype.set=yi;function Mr(U){var de=-1,Fe=U==null?0:U.length;for(this.clear();++de<Fe;){var mt=U[de];this.set(mt[0],mt[1])}}function Yr(){this.size=0,this.__data__={hash:new lt,map:new(we||Qt),string:new lt}}function vi(U){var de=Nt(this,U).delete(U);return this.size-=de?1:0,de}function Ri(U){return Nt(this,U).get(U)}function va(U){return Nt(this,U).has(U)}function xa(U,de){var Fe=Nt(this,U),mt=Fe.size;return Fe.set(U,de),this.size+=Fe.size==mt?0:1,this}Mr.prototype.clear=Yr,Mr.prototype.delete=vi,Mr.prototype.get=Ri,Mr.prototype.has=va,Mr.prototype.set=xa;function Bi(U){var de=this.__data__=new Qt(U);this.size=de.size}function co(){this.__data__=new Qt,this.size=0}function qa(U){var de=this.__data__,Fe=de.delete(U);return this.size=de.size,Fe}function Pe(U){return this.__data__.get(U)}function Vt(U){return this.__data__.has(U)}function ee(U,de){var Fe=this.__data__;if(Fe instanceof Qt){var mt=Fe.__data__;if(!we||mt.length<r-1)return mt.push([U,de]),this.size=++Fe.size,this;Fe=this.__data__=new Mr(mt)}return Fe.set(U,de),this.size=Fe.size,this}Bi.prototype.clear=co,Bi.prototype.delete=qa,Bi.prototype.get=Pe,Bi.prototype.has=Vt,Bi.prototype.set=ee;function Re(U,de){var Fe=Et(U),mt=!Fe&&$t(U),Ut=!Fe&&!mt&&_r(U),Mt=!Fe&&!mt&&!Ut&&eo(U),Ht=Fe||mt||Ut||Mt,Jt=Ht?it(U.length,String):[],xr=Jt.length;for(var Yi in U)(de||ve.call(U,Yi))&&!(Ht&&(Yi=="length"||Ut&&(Yi=="offset"||Yi=="parent")||Mt&&(Yi=="buffer"||Yi=="byteLength"||Yi=="byteOffset")||Pn(Yi,xr)))&&Jt.push(Yi);return Jt}function qe(U,de,Fe){(Fe!==void 0&&!xt(U[de],Fe)||Fe===void 0&&!(de in U))&&At(U,de,Fe)}function Xe(U,de,Fe){var mt=U[de];(!(ve.call(U,de)&&xt(mt,Fe))||Fe===void 0&&!(de in U))&&At(U,de,Fe)}function Ee(U,de){for(var Fe=U.length;Fe--;)if(xt(U[Fe][0],de))return Fe;return-1}function At(U,de,Fe){de=="__proto__"&&Be?Be(U,de,{configurable:!0,enumerable:!0,value:Fe,writable:!0}):U[de]=Fe}var Lt=dn();function Bt(U){return U==null?U===void 0?S:v:ye&&ye in Object(U)?pn(U):N(U)}function Ft(U){return Dn(U)&&Bt(U)==s}function hr(U){if(!fi(U)||w(U))return!1;var de=ci(U)?ft:ie;return de.test(st(U))}function rr(U){return Dn(U)&&si(U.length)&&!!X[Bt(U)]}function fr(U){if(!fi(U))return L(U);var de=C(U),Fe=[];for(var mt in U)mt=="constructor"&&(de||!ve.call(U,mt))||Fe.push(mt);return Fe}function Br(U,de,Fe,mt,Ut){U!==de&&Lt(de,function(Mt,Ht){if(Ut||(Ut=new Bi),fi(Mt))Jr(U,de,Ht,Fe,Br,mt,Ut);else{var Jt=mt?mt(se(U,Ht),Mt,Ht+"",U,de,Ut):void 0;Jt===void 0&&(Jt=Mt),qe(U,Ht,Jt)}},Cu)}function Jr(U,de,Fe,mt,Ut,Mt,Ht){var Jt=se(U,Fe),xr=se(de,Fe),Yi=Ht.get(xr);if(Yi){qe(U,Fe,Yi);return}var fn=Mt?Mt(Jt,xr,Fe+"",U,de,Ht):void 0,ho=fn===void 0;if(ho){var Dl=Et(xr),ka=!Dl&&_r(xr),Jo=!Dl&&!ka&&eo(xr);fn=xr,Dl||ka||Jo?Et(Jt)?fn=Jt:nr(Jt)?fn=ca(Jt):ka?(ho=!1,fn=oi(xr,!0)):Jo?(ho=!1,fn=Qi(xr,!0)):fn=[]:_s(xr)||$t(xr)?(fn=Jt,$t(Jt)?fn=Tl(Jt):(!fi(Jt)||ci(Jt))&&(fn=bi(xr))):ho=!1}ho&&(Ht.set(xr,fn),Ut(fn,xr,mt,Mt,Ht),Ht.delete(xr)),qe(U,Fe,fn)}function _i(U,de){return Se(q(U,de,V),U+"")}var ai=Be?function(U,de){return Be(U,"toString",{configurable:!0,enumerable:!1,value:qs(de),writable:!0})}:V;function oi(U,de){if(de)return U.slice();var Fe=U.length,mt=G?G(Fe):new U.constructor(Fe);return U.copy(mt),mt}function sr(U){var de=new U.constructor(U.byteLength);return new Q(de).set(new Q(U)),de}function Qi(U,de){var Fe=de?sr(U.buffer):U.buffer;return new U.constructor(Fe,U.byteOffset,U.length)}function ca(U,de){var Fe=-1,mt=U.length;for(de||(de=Array(mt));++Fe<mt;)de[Fe]=U[Fe];return de}function Hr(U,de,Fe,mt){var Ut=!Fe;Fe||(Fe={});for(var Mt=-1,Ht=de.length;++Mt<Ht;){var Jt=de[Mt],xr=mt?mt(Fe[Jt],U[Jt],Jt,Fe,U):void 0;xr===void 0&&(xr=U[Jt]),Ut?At(Fe,Jt,xr):Xe(Fe,Jt,xr)}return Fe}function _a(U){return _i(function(de,Fe){var mt=-1,Ut=Fe.length,Mt=Ut>1?Fe[Ut-1]:void 0,Ht=Ut>2?Fe[2]:void 0;for(Mt=U.length>3&&typeof Mt=="function"?(Ut--,Mt):void 0,Ht&&$a(Fe[0],Fe[1],Ht)&&(Mt=Ut<3?void 0:Mt,Ut=1),de=Object(de);++mt<Ut;){var Jt=Fe[mt];Jt&&U(de,Jt,mt,Mt)}return de})}function dn(U){return function(de,Fe,mt){for(var Ut=-1,Mt=Object(de),Ht=mt(de),Jt=Ht.length;Jt--;){var xr=Ht[U?Jt:++Ut];if(Fe(Mt[xr],xr,Mt)===!1)break}return de}}function vn(U,de,Fe,mt,Ut,Mt){return fi(U)&&fi(de)&&(Mt.set(de,U),Br(U,de,void 0,vn,Mt),Mt.delete(de)),U}function Nt(U,de){var Fe=U.__data__;return y(de)?Fe[typeof de=="string"?"string":"hash"]:Fe.map}function tn(U,de){var Fe=Ke(U,de);return hr(Fe)?Fe:void 0}function pn(U){var de=ve.call(U,ye),Fe=U[ye];try{U[ye]=void 0;var mt=!0}catch(Mt){}var Ut=Ne.call(U);return mt&&(de?U[ye]=Fe:delete U[ye]),Ut}function bi(U){return typeof U.constructor=="function"&&!C(U)?nt(W(U)):{}}function Pn(U,de){var Fe=typeof U;return de=de==null?o:de,!!de&&(Fe=="number"||Fe!="symbol"&&le.test(U))&&U>-1&&U%1==0&&U<de}function $a(U,de,Fe){if(!fi(Fe))return!1;var mt=typeof de;return(mt=="number"?ar(Fe)&&Pn(de,Fe.length):mt=="string"&&de in Fe)?xt(Fe[de],U):!1}function y(U){var de=typeof U;return de=="string"||de=="number"||de=="symbol"||de=="boolean"?U!=="__proto__":U===null}function w(U){return!!je&&je in U}function C(U){var de=U&&U.constructor,Fe=typeof de=="function"&&de.prototype||et;return U===Fe}function L(U){var de=[];if(U!=null)for(var Fe in Object(U))de.push(Fe);return de}function N(U){return Ne.call(U)}function q(U,de,Fe){return de=ue(de===void 0?U.length-1:de,0),function(){for(var mt=arguments,Ut=-1,Mt=ue(mt.length-de,0),Ht=Array(Mt);++Ut<Mt;)Ht[Ut]=mt[de+Ut];Ut=-1;for(var Jt=Array(de+1);++Ut<de;)Jt[Ut]=mt[Ut];return Jt[de]=Fe(Ht),oe(U,this,Jt)}}function se(U,de){if(!(de==="constructor"&&typeof U[de]=="function")&&de!="__proto__")return U[de]}var Se=Ve(ai);function Ve(U){var de=0,Fe=0;return function(){var mt=pe(),Ut=a-(mt-Fe);if(Fe=mt,Ut>0){if(++de>=n)return arguments[0]}else de=0;return U.apply(void 0,arguments)}}function st(U){if(U!=null){try{return K.call(U)}catch(de){}try{return U+""}catch(de){}}return""}function xt(U,de){return U===de||U!==U&&de!==de}var $t=Ft((function(){return arguments})())?Ft:function(U){return Dn(U)&&ve.call(U,"callee")&&!$.call(U,"callee")},Et=Array.isArray;function ar(U){return U!=null&&si(U.length)&&!ci(U)}function nr(U){return Dn(U)&&ar(U)}var _r=Ge||ae;function ci(U){if(!fi(U))return!1;var de=Bt(U);return de==p||de==f||de==u||de==x}function si(U){return typeof U=="number"&&U>-1&&U%1==0&&U<=o}function fi(U){var de=typeof U;return U!=null&&(de=="object"||de=="function")}function Dn(U){return U!=null&&typeof U=="object"}function _s(U){if(!Dn(U)||Bt(U)!=_)return!1;var de=W(U);if(de===null)return!0;var Fe=ve.call(de,"constructor")&&de.constructor;return typeof Fe=="function"&&Fe instanceof Fe&&K.call(Fe)==Ue}var eo=Ce?Oe(Ce):rr;function Tl(U){return Hr(U,Cu(U))}var Vc=_i(function(U){return U.push(void 0,vn),oe(Pl,void 0,U)});function Cu(U){return ar(U)?Re(U,!0):fr(U)}var Pl=_a(function(U,de,Fe,mt){Br(U,de,Fe,mt)});function qs(U){return function(){return U}}function V(U){return U}function ae(){return!1}t.exports=Vc});H();H();p9e="ENTRIES",Poe="KEYS",Doe="VALUES",dQ=class{constructor(e,t){let r=e._tree,i=Array.from(r.keys());this.set=e,this._type=t,this._path=i.length>0?[{node:r,keys:i}]:[]}next(){let e=this.dive();return this.backtrack(),e}dive(){if(this._path.length===0)return{done:!0,value:void 0};let{node:e,keys:t}=Xy(this._path);if(Xy(t)==="")return{done:!1,value:this.result()};let r=e.get(Xy(t));return this._path.push({node:r,keys:Array.from(r.keys())}),this.dive()}backtrack(){if(this._path.length===0)return;let e=Xy(this._path).keys;e.pop(),!(e.length>0)&&(this._path.pop(),this.backtrack())}key(){return this.set._prefix+this._path.map(({keys:e})=>Xy(e)).filter(e=>e!=="").join("")}value(){return Xy(this._path).node.get("")}result(){switch(this._type){case Doe:return this.value();case Poe:return this.key();default:return[this.key(),this.value()]}}[Symbol.iterator](){return this}},Xy=e=>e[e.length-1],f9e=(e,t,r)=>{let i=new Map;if(t===void 0)return i;let n=t.length+1,a=n+r,o=new Uint8Array(a*n).fill(r+1);for(let s=0;s<n;++s)o[s]=s;for(let s=1;s<a;++s)o[s*n]=s;return koe(e,t,r,i,o,1,n,""),i},koe=(e,t,r,i,n,a,o,s)=>{let l=a*o;e:for(let u of e.keys())if(u===""){let c=n[l-1];c<=r&&i.set(s,[e.get(u),c])}else{let c=a;for(let h=0;h<u.length;++h,++c){let d=u[h],p=o*c,f=p-o,m=n[p],g=Math.max(0,c-r-1),v=Math.min(o-1,c+r);for(let _=g;_<v;++_){let x=d!==t[_],b=n[f+_]+ +x,E=n[f+_+1]+1,M=n[p+_]+1,S=n[p+_+1]=Math.min(b,E,M);S<m&&(m=S)}if(m>r)continue e}koe(e.get(u),t,r,i,n,c,o,s+u)}},pQ=class ab{constructor(t=new Map,r=""){this._size=void 0,this._tree=t,this._prefix=r}atPrefix(t){if(!t.startsWith(this._prefix))throw new Error("Mismatched prefix");let[r,i]=KB(this._tree,t.slice(this._prefix.length));if(r===void 0){let[n,a]=bQ(i);for(let o of n.keys())if(o!==""&&o.startsWith(a)){let s=new Map;return s.set(o.slice(a.length),n.get(o)),new ab(s,t)}}return new ab(r,t)}clear(){this._size=void 0,this._tree.clear()}delete(t){return this._size=void 0,A9e(this._tree,t)}entries(){return new dQ(this,p9e)}forEach(t){for(let[r,i]of this)t(r,i,this)}fuzzyGet(t,r){return f9e(this._tree,t,r)}get(t){let r=yQ(this._tree,t);return r!==void 0?r.get(""):void 0}has(t){let r=yQ(this._tree,t);return r!==void 0&&r.has("")}keys(){return new dQ(this,Poe)}set(t,r){if(typeof t!="string")throw new Error("key must be a string");return this._size=void 0,fQ(this._tree,t).set("",r),this}get size(){if(this._size)return this._size;this._size=0;let t=this.entries();for(;!t.next().done;)this._size+=1;return this._size}update(t,r){if(typeof t!="string")throw new Error("key must be a string");this._size=void 0;let i=fQ(this._tree,t);return i.set("",r(i.get(""))),this}fetch(t,r){if(typeof t!="string")throw new Error("key must be a string");this._size=void 0;let i=fQ(this._tree,t),n=i.get("");return n===void 0&&i.set("",n=r()),n}values(){return new dQ(this,Doe)}[Symbol.iterator](){return this.entries()}static from(t){let r=new ab;for(let[i,n]of t)r.set(i,n);return r}static fromObject(t){return ab.from(Object.entries(t))}},KB=(e,t,r=[])=>{if(t.length===0||e==null)return[e,r];for(let i of e.keys())if(i!==""&&t.startsWith(i))return r.push([e,i]),KB(e.get(i),t.slice(i.length),r);return r.push([e,t]),KB(void 0,"",r)},yQ=(e,t)=>{if(t.length===0||e==null)return e;for(let r of e.keys())if(r!==""&&t.startsWith(r))return yQ(e.get(r),t.slice(r.length))},fQ=(e,t)=>{let r=t.length;e:for(let i=0;e&&i<r;){for(let a of e.keys())if(a!==""&&t[i]===a[0]){let o=Math.min(r-i,a.length),s=1;for(;s<o&&t[i+s]===a[s];)++s;let l=e.get(a);if(s===a.length)e=l;else{let u=new Map;u.set(a.slice(s),l),e.set(t.slice(i,i+s),u),e.delete(a),e=u}i+=s;continue e}let n=new Map;return e.set(t.slice(i),n),n}return e},A9e=(e,t)=>{let[r,i]=KB(e,t);if(r!==void 0){if(r.delete(""),r.size===0)Roe(i);else if(r.size===1){let[n,a]=r.entries().next().value;Foe(i,n,a)}}},Roe=e=>{if(e.length===0)return;let[t,r]=bQ(e);if(t.delete(r),t.size===0)Roe(e.slice(0,-1));else if(t.size===1){let[i,n]=t.entries().next().value;i!==""&&Foe(e.slice(0,-1),i,n)}},Foe=(e,t,r)=>{if(e.length===0)return;let[i,n]=bQ(e);i.set(n+t,r),i.delete(n)},bQ=e=>e[e.length-1],wQ="or",zoe="and",m9e="and_not",WB=class ZB{constructor(t){if((t==null?void 0:t.fields)==null)throw new Error('MiniSearch: option "fields" must be provided');let r=t.autoVacuum==null||t.autoVacuum===!0?gQ:t.autoVacuum;this._options=bt(ze(ze({},mQ),t),{autoVacuum:r,searchOptions:ze(ze({},Soe),t.searchOptions||{}),autoSuggestOptions:ze(ze({},_9e),t.autoSuggestOptions||{})}),this._index=new pQ,this._documentCount=0,this._documentIds=new Map,this._idToShortId=new Map,this._fieldIds={},this._fieldLength=new Map,this._avgFieldLength=[],this._nextId=0,this._storedFields=new Map,this._dirtCount=0,this._currentVacuum=null,this._enqueuedVacuum=null,this._enqueuedVacuumConditions=xQ,this.addFields(this._options.fields)}add(t){let{extractField:r,stringifyField:i,tokenize:n,processTerm:a,fields:o,idField:s}=this._options,l=r(t,s);if(l==null)throw new Error('MiniSearch: document does not have ID field "'.concat(s,'"'));if(this._idToShortId.has(l))throw new Error("MiniSearch: duplicate ID ".concat(l));let u=this.addDocumentId(l);this.saveStoredFields(u,t);for(let c of o){let h=r(t,c);if(h==null)continue;let d=n(i(h,c),c),p=this._fieldIds[c],f=new Set(d).size;this.addFieldLength(u,p,this._documentCount-1,f);for(let m of d){let g=a(m,c);if(Array.isArray(g))for(let v of g)this.addTerm(p,u,v);else g&&this.addTerm(p,u,g)}}}addAll(t){for(let r of t)this.add(r)}addAllAsync(t,r={}){let{chunkSize:i=10}=r,n={chunk:[],promise:Promise.resolve()},{chunk:a,promise:o}=t.reduce(({chunk:s,promise:l},u,c)=>(s.push(u),(c+1)%i===0?{chunk:[],promise:l.then(()=>new Promise(h=>setTimeout(h,0))).then(()=>this.addAll(s))}:{chunk:s,promise:l}),n);return o.then(()=>this.addAll(a))}remove(t){let{tokenize:r,processTerm:i,extractField:n,stringifyField:a,fields:o,idField:s}=this._options,l=n(t,s);if(l==null)throw new Error('MiniSearch: document does not have ID field "'.concat(s,'"'));let u=this._idToShortId.get(l);if(u==null)throw new Error("MiniSearch: cannot remove document with ID ".concat(l,": it is not in the index"));for(let c of o){let h=n(t,c);if(h==null)continue;let d=r(a(h,c),c),p=this._fieldIds[c],f=new Set(d).size;this.removeFieldLength(u,p,this._documentCount,f);for(let m of d){let g=i(m,c);if(Array.isArray(g))for(let v of g)this.removeTerm(p,u,v);else g&&this.removeTerm(p,u,g)}}this._storedFields.delete(u),this._documentIds.delete(u),this._idToShortId.delete(l),this._fieldLength.delete(u),this._documentCount-=1}removeAll(t){if(t)for(let r of t)this.remove(r);else{if(arguments.length>0)throw new Error("Expected documents to be present. Omit the argument to remove all documents.");this._index=new pQ,this._documentCount=0,this._documentIds=new Map,this._idToShortId=new Map,this._fieldLength=new Map,this._avgFieldLength=[],this._storedFields=new Map,this._nextId=0}}discard(t){let r=this._idToShortId.get(t);if(r==null)throw new Error("MiniSearch: cannot discard document with ID ".concat(t,": it is not in the index"));this._idToShortId.delete(t),this._documentIds.delete(r),this._storedFields.delete(r),(this._fieldLength.get(r)||[]).forEach((i,n)=>{this.removeFieldLength(r,n,this._documentCount,i)}),this._fieldLength.delete(r),this._documentCount-=1,this._dirtCount+=1,this.maybeAutoVacuum()}maybeAutoVacuum(){if(this._options.autoVacuum===!1)return;let{minDirtFactor:t,minDirtCount:r,batchSize:i,batchWait:n}=this._options.autoVacuum;this.conditionalVacuum({batchSize:i,batchWait:n},{minDirtCount:r,minDirtFactor:t})}discardAll(t){let r=this._options.autoVacuum;try{this._options.autoVacuum=!1;for(let i of t)this.discard(i)}finally{this._options.autoVacuum=r}this.maybeAutoVacuum()}replace(t){let{idField:r,extractField:i}=this._options,n=i(t,r);this.discard(n),this.add(t)}vacuum(t={}){return this.conditionalVacuum(t)}conditionalVacuum(t,r){return this._currentVacuum?(this._enqueuedVacuumConditions=this._enqueuedVacuumConditions&&r,this._enqueuedVacuum!=null?this._enqueuedVacuum:(this._enqueuedVacuum=this._currentVacuum.then(()=>{let i=this._enqueuedVacuumConditions;return this._enqueuedVacuumConditions=xQ,this.performVacuuming(t,i)}),this._enqueuedVacuum)):this.vacuumConditionsMet(r)===!1?Promise.resolve():(this._currentVacuum=this.performVacuuming(t),this._currentVacuum)}performVacuuming(t,r){return Qe(this,null,function*(){let i=this._dirtCount;if(this.vacuumConditionsMet(r)){let n=t.batchSize||vQ.batchSize,a=t.batchWait||vQ.batchWait,o=1;for(let[s,l]of this._index){for(let[u,c]of l)for(let[h]of c)this._documentIds.has(h)||(c.size<=1?l.delete(u):c.delete(h));this._index.get(s).size===0&&this._index.delete(s),o%n===0&&(yield new Promise(u=>setTimeout(u,a))),o+=1}this._dirtCount-=i}yield null,this._currentVacuum=this._enqueuedVacuum,this._enqueuedVacuum=null})}vacuumConditionsMet(t){if(t==null)return!0;let{minDirtCount:r,minDirtFactor:i}=t;return r=r||gQ.minDirtCount,i=i||gQ.minDirtFactor,this.dirtCount>=r&&this.dirtFactor>=i}get isVacuuming(){return this._currentVacuum!=null}get dirtCount(){return this._dirtCount}get dirtFactor(){return this._dirtCount/(1+this._documentCount+this._dirtCount)}has(t){return this._idToShortId.has(t)}getStoredFields(t){let r=this._idToShortId.get(t);if(r!=null)return this._storedFields.get(r)}search(t,r={}){let{searchOptions:i}=this._options,n=ze(ze({},i),r),a=this.executeQuery(t,r),o=[];for(let[s,{score:l,terms:u,match:c}]of a){let h=u.length||1,d={id:this._documentIds.get(s),score:l*h,terms:Object.keys(c),queryTerms:u,match:c};Object.assign(d,this._storedFields.get(s)),(n.filter==null||n.filter(d))&&o.push(d)}return t===ZB.wildcard&&n.boostDocument==null||o.sort(Coe),o}autoSuggest(t,r={}){r=ze(ze({},this._options.autoSuggestOptions),r);let i=new Map;for(let{score:a,terms:o}of this.search(t,r)){let s=o.join(" "),l=i.get(s);l!=null?(l.score+=a,l.count+=1):i.set(s,{score:a,terms:o,count:1})}let n=[];for(let[a,{score:o,terms:s,count:l}]of i)n.push({suggestion:a,terms:s,score:o/l});return n.sort(Coe),n}get documentCount(){return this._documentCount}get termCount(){return this._index.size}static loadJSON(t,r){if(r==null)throw new Error("MiniSearch: loadJSON should be given the same options used when serializing the index");return this.loadJS(JSON.parse(t),r)}static loadJSONAsync(t,r){return Qe(this,null,function*(){if(r==null)throw new Error("MiniSearch: loadJSON should be given the same options used when serializing the index");return this.loadJSAsync(JSON.parse(t),r)})}static getDefault(t){if(mQ.hasOwnProperty(t))return AQ(mQ,t);throw new Error('MiniSearch: unknown option "'.concat(t,'"'))}static loadJS(t,r){let{index:i,documentIds:n,fieldLength:a,storedFields:o,serializationVersion:s}=t,l=this.instantiateMiniSearch(t,r);l._documentIds=YB(n),l._fieldLength=YB(a),l._storedFields=YB(o);for(let[u,c]of l._documentIds)l._idToShortId.set(c,u);for(let[u,c]of i){let h=new Map;for(let d of Object.keys(c)){let p=c[d];s===1&&(p=p.ds),h.set(parseInt(d,10),YB(p))}l._index.set(u,h)}return l}static loadJSAsync(t,r){return Qe(this,null,function*(){let{index:i,documentIds:n,fieldLength:a,storedFields:o,serializationVersion:s}=t,l=this.instantiateMiniSearch(t,r);l._documentIds=yield HB(n),l._fieldLength=yield HB(a),l._storedFields=yield HB(o);for(let[c,h]of l._documentIds)l._idToShortId.set(h,c);let u=0;for(let[c,h]of i){let d=new Map;for(let p of Object.keys(h)){let f=h[p];s===1&&(f=f.ds),d.set(parseInt(p,10),yield HB(f))}++u%1e3===0&&(yield Loe(0)),l._index.set(c,d)}return l})}static instantiateMiniSearch(t,r){let{documentCount:i,nextId:n,fieldIds:a,averageFieldLength:o,dirtCount:s,serializationVersion:l}=t;if(l!==1&&l!==2)throw new Error("MiniSearch: cannot deserialize an index created with an incompatible version");let u=new ZB(r);return u._documentCount=i,u._nextId=n,u._idToShortId=new Map,u._fieldIds=a,u._avgFieldLength=o,u._dirtCount=s||0,u._index=new pQ,u}executeQuery(t,r={}){if(t===ZB.wildcard)return this.executeWildcardQuery(r);if(typeof t!="string"){let c=bt(ze(ze({},r),t),{queries:void 0}),h=t.queries.map(d=>this.executeQuery(d,c));return this.combineResults(h,c.combineWith)}let{tokenize:i,processTerm:n,searchOptions:a}=this._options,o=ze(ze({tokenize:i,processTerm:n},a),r),{tokenize:s,processTerm:l}=o,u=s(t).flatMap(c=>l(c)).filter(c=>!!c).map(x9e(o)).map(c=>this.executeQuerySpec(c,o));return this.combineResults(u,o.combineWith)}executeQuerySpec(t,r){let i=ze(ze({},this._options.searchOptions),r),n=(i.fields||this._options.fields).reduce((m,g)=>bt(ze({},m),{[g]:AQ(i.boost,g)||1}),{}),{boostDocument:a,weights:o,maxFuzzy:s,bm25:l}=i,{fuzzy:u,prefix:c}=ze(ze({},Soe.weights),o),h=this._index.get(t.term),d=this.termResults(t.term,t.term,1,t.termBoost,h,n,a,l),p,f;if(t.prefix&&(p=this._index.atPrefix(t.term)),t.fuzzy){let m=t.fuzzy===!0?.2:t.fuzzy,g=m<1?Math.min(s,Math.round(t.term.length*m)):m;g&&(f=this._index.fuzzyGet(t.term,g))}if(p)for(let[m,g]of p){let v=m.length-t.term.length;if(!v)continue;f==null||f.delete(m);let _=c*m.length/(m.length+.3*v);this.termResults(t.term,m,_,t.termBoost,g,n,a,l,d)}if(f)for(let m of f.keys()){let[g,v]=f.get(m);if(!v)continue;let _=u*m.length/(m.length+v);this.termResults(t.term,m,_,t.termBoost,g,n,a,l,d)}return d}executeWildcardQuery(t){let r=new Map,i=ze(ze({},this._options.searchOptions),t);for(let[n,a]of this._documentIds){let o=i.boostDocument?i.boostDocument(a,"",this._storedFields.get(n)):1;r.set(n,{score:o,terms:[],match:{}})}return r}combineResults(t,r=wQ){if(t.length===0)return new Map;let i=r.toLowerCase(),n=g9e[i];if(!n)throw new Error("Invalid combination operator: ".concat(r));return t.reduce(n)||new Map}toJSON(){let t=[];for(let[r,i]of this._index){let n={};for(let[a,o]of i)n[a]=Object.fromEntries(o);t.push([r,n])}return{documentCount:this._documentCount,nextId:this._nextId,documentIds:Object.fromEntries(this._documentIds),fieldIds:this._fieldIds,fieldLength:Object.fromEntries(this._fieldLength),averageFieldLength:this._avgFieldLength,storedFields:Object.fromEntries(this._storedFields),dirtCount:this._dirtCount,index:t,serializationVersion:2}}termResults(t,r,i,n,a,o,s,l,u=new Map){if(a==null)return u;for(let c of Object.keys(o)){let h=o[c],d=this._fieldIds[c],p=a.get(d);if(p==null)continue;let f=p.size,m=this._avgFieldLength[d];for(let g of p.keys()){if(!this._documentIds.has(g)){this.removeTerm(d,g,r),f-=1;continue}let v=s?s(this._documentIds.get(g),r,this._storedFields.get(g)):1;if(!v)continue;let _=p.get(g),x=this._fieldLength.get(g)[d],b=v9e(_,f,this._documentCount,x,m,l),E=i*n*h*v*b,M=u.get(g);if(M){M.score+=E,b9e(M.terms,t);let S=AQ(M.match,r);S?S.push(c):M.match[r]=[c]}else u.set(g,{score:E,terms:[t],match:{[r]:[c]}})}}return u}addTerm(t,r,i){let n=this._index.fetch(i,Boe),a=n.get(t);if(a==null)a=new Map,a.set(r,1),n.set(t,a);else{let o=a.get(r);a.set(r,(o||0)+1)}}removeTerm(t,r,i){if(!this._index.has(i)){this.warnDocumentChanged(r,t,i);return}let n=this._index.fetch(i,Boe),a=n.get(t);a==null||a.get(r)==null?this.warnDocumentChanged(r,t,i):a.get(r)<=1?a.size<=1?n.delete(t):a.delete(r):a.set(r,a.get(r)-1),this._index.get(i).size===0&&this._index.delete(i)}warnDocumentChanged(t,r,i){for(let n of Object.keys(this._fieldIds))if(this._fieldIds[n]===r){this._options.logger("warn","MiniSearch: document with ID ".concat(this._documentIds.get(t),' has changed before removal: term "').concat(i,'" was not present in field "').concat(n,'". Removing a document after it has changed can corrupt the index!'),"version_conflict");return}}addDocumentId(t){let r=this._nextId;return this._idToShortId.set(t,r),this._documentIds.set(r,t),this._documentCount+=1,this._nextId+=1,r}addFields(t){for(let r=0;r<t.length;r++)this._fieldIds[t[r]]=r}addFieldLength(t,r,i,n){let a=this._fieldLength.get(t);a==null&&this._fieldLength.set(t,a=[]),a[r]=n;let o=(this._avgFieldLength[r]||0)*i+n;this._avgFieldLength[r]=o/(i+1)}removeFieldLength(t,r,i,n){if(i===1){this._avgFieldLength[r]=0;return}let a=this._avgFieldLength[r]*i-n;this._avgFieldLength[r]=a/(i-1)}saveStoredFields(t,r){let{storeFields:i,extractField:n}=this._options;if(i==null||i.length===0)return;let a=this._storedFields.get(t);a==null&&this._storedFields.set(t,a={});for(let o of i){let s=n(r,o);s!==void 0&&(a[o]=s)}}};WB.wildcard=Symbol("*");AQ=(e,t)=>Object.prototype.hasOwnProperty.call(e,t)?e[t]:void 0,g9e={[wQ]:(e,t)=>{for(let r of t.keys()){let i=e.get(r);if(i==null)e.set(r,t.get(r));else{let{score:n,terms:a,match:o}=t.get(r);i.score=i.score+n,i.match=Object.assign(i.match,o),Ioe(i.terms,a)}}return e},[zoe]:(e,t)=>{let r=new Map;for(let i of t.keys()){let n=e.get(i);if(n==null)continue;let{score:a,terms:o,match:s}=t.get(i);Ioe(n.terms,o),r.set(i,{score:n.score+a,terms:n.terms,match:Object.assign(n.match,s)})}return r},[m9e]:(e,t)=>{for(let r of t.keys())e.delete(r);return e}},y9e={k:1.2,b:.7,d:.5},v9e=(e,t,r,i,n,a)=>{let{k:o,b:s,d:l}=a;return Math.log(1+(r-t+.5)/(t+.5))*(l+e*(o+1)/(e+o*(1-s+s*i/n)))},x9e=e=>(t,r,i)=>{let n=typeof e.fuzzy=="function"?e.fuzzy(t,r,i):e.fuzzy||!1,a=typeof e.prefix=="function"?e.prefix(t,r,i):e.prefix===!0,o=typeof e.boostTerm=="function"?e.boostTerm(t,r,i):1;return{term:t,fuzzy:n,prefix:a,termBoost:o}},mQ={idField:"id",extractField:(e,t)=>e[t],stringifyField:(e,t)=>e.toString(),tokenize:e=>e.split(w9e),processTerm:e=>e.toLowerCase(),fields:void 0,searchOptions:void 0,storeFields:[],logger:(e,t)=>{typeof(console==null?void 0:console[e])=="function"&&console[e](t)},autoVacuum:!0},Soe={combineWith:wQ,prefix:!1,fuzzy:!1,maxFuzzy:6,boost:{},weights:{fuzzy:.45,prefix:.375},bm25:y9e},_9e={combineWith:zoe,prefix:(e,t,r)=>t===r.length-1},vQ={batchSize:1e3,batchWait:10},xQ={minDirtFactor:.1,minDirtCount:20},gQ=ze(ze({},vQ),xQ),b9e=(e,t)=>{e.includes(t)||e.push(t)},Ioe=(e,t)=>{for(let r of t)e.includes(r)||e.push(r)},Coe=({score:e},{score:t})=>t-e,Boe=()=>new Map,YB=e=>{let t=new Map;for(let r of Object.keys(e))t.set(parseInt(r,10),e[r]);return t},HB=e=>Qe(null,null,function*(){let t=new Map,r=0;for(let i of Object.keys(e))t.set(parseInt(i,10),e[i]),++r%1e3===0&&(yield Loe(0));return t}),Loe=e=>new Promise(t=>setTimeout(t,e)),w9e=new RegExp("[\\\\n\\\\r\\\\p{Z}\\\\p{P}]+","u"),E9e=qo(d9e(),1),M9e=class{constructor(e){he(this,_Q),I(this,"mapData"),I(this,"indexes"),I(this,"ready"),he(this,XB),this.mapData=e,this.indexes=C9e(e),this.ready=this.populate(),xe(this,XB,oc(yt(this,_Q,Ooe).bind(this),2e3))}populate(){return Qe(this,null,function*(){let{places:e,enterpriseLocations:t,enterpriseCategories:r}=this.indexes,i=this.mapData,n=[];return e.removeAll(),n=n.concat([e.addAllAsync(i.getByType("space")),e.addAllAsync(i.getByType("point-of-interest")),e.addAllAsync(i.getByType("object")),e.addAllAsync(i.getByType("connection")),e.addAllAsync(i.getByType("floor")),e.addAllAsync(i.getByType("door")),e.addAllAsync(i.getByType("annotation")),e.addAllAsync(i.getByType("area"))]),t&&(t==null||t.removeAll(),n.push(t.addAllAsync(i.getByType("enterprise-location")))),r&&(r==null||r.removeAll(),n.push(r.addAllAsync(i.getByType("enterprise-category")))),Promise.all(n)})}search(r){return Qe(this,arguments,function*(e,t={}){var i,n;yield this.ready,B9e.parse(t);let a=(0,E9e.default)({},t,I9e),o=this.indexes.places.search(e,{fields:Object.keys(a.places.fields).filter(c=>a.places.fields[c])});a.places.limit&&(o=o.slice(0,a.places.limit));let s=(i=this.indexes.enterpriseLocations)==null?void 0:i.search(e,{fields:Object.keys(a.enterpriseLocations.fields).filter(c=>a.enterpriseLocations.fields[c])});s&&a.enterpriseLocations.limit&&(s=s.slice(0,a.enterpriseLocations.limit));let l=(n=this.indexes.enterpriseCategories)==null?void 0:n.search(e,{fields:Object.keys(a.enterpriseCategories.fields).filter(c=>a.enterpriseCategories.fields[c])});l&&a.enterpriseCategories.limit&&(l=l.slice(0,a.enterpriseCategories.limit));let u=S9e(this.mapData,{placesResult:o,locationsResult:s,categoriesResult:l});return A(this,XB).call(this,e),u})}suggest(r){return Qe(this,arguments,function*(e,t={}){yield this.ready,T9e.parse(t);let i=[],{places:{enabled:n=!0}={},enterpriseLocations:{enabled:a=!0}={}}=t;a&&this.indexes.enterpriseLocations&&this.indexes.enterpriseLocations.autoSuggest(e,{fields:["name","tags"],combineWith:"AND",prefix:!0,boost:{name:2,tags:1}}).forEach(l=>i.push(l)),n&&this.indexes.places.autoSuggest(e,{fields:["name"],combineWith:"AND",prefix:!0}).forEach(l=>i.push(l));let o=new Map;i.forEach(l=>{let u=o.get(l.suggestion);(!u||l.score>u.score)&&o.set(l.suggestion,l)});let s=Array.from(o.values());return s.sort((l,u)=>u.score-l.score),this.mapData.Analytics.capture("$query-suggest",{query:e,suggestions:s.map(l=>l.suggestion)}),s})}};XB=new WeakMap,_Q=new WeakSet,Ooe=function(e){this.mapData.Analytics.capture("$query-search",{query:e})};I9e={places:{fields:{name:!0,description:!0}},enterpriseCategories:{fields:{name:!0,description:!1,"locations.name":!0}},enterpriseLocations:{fields:{name:!0,tags:!0,description:!0}}};B9e=J.object({places:J.object({fields:J.object({name:J.boolean().optional(),description:J.boolean().optional()}).optional(),limit:J.number().positive().optional()}).optional(),enterpriseCategories:J.object({fields:J.object({name:J.boolean().optional(),description:J.boolean().optional(),"locations.name":J.boolean().optional()}).optional(),limit:J.number().positive().optional()}).optional(),enterpriseLocations:J.object({fields:J.object({name:J.boolean().optional(),tags:J.boolean().optional(),description:J.boolean().optional()}).optional(),limit:J.number().positive().optional()}).optional()}),T9e=J.object({places:J.object({enabled:J.boolean().optional()}).optional(),enterpriseLocations:J.object({enabled:J.boolean().optional()}).optional()}),P9e=new Set(["the","an","and","or","of","in","on","at","to","from","with","by","for"]),Toe=""});var Qoe={};Ra(Qoe,{ANIMATION_TWEENS:()=>q_,ATTRIBUTION_POSITIONS:()=>RB,COLLISION_WORKER_PATH:()=>CI,DEFAULT_PATH_SMOOTHING:()=>bh,MAPLIBRE_WORKER_PATH:()=>BI,MAPPEDIN_LAYER_ID:()=>KU,MapLibreOverlay:()=>jB,Navigator:()=>GB,TEXT3D_STYLE_UPDATE_PROPS:()=>v6,collisionWorkerUrl:()=>rp,configureWorker:()=>l6,createRenderer:()=>VB,debounce:()=>oc,enableTestMode:()=>Aae,interpolate:()=>SI,mountSceneGraphVisualizer:()=>toe,preloadFont:()=>_C,setCollisionWorkerUrl:()=>$x});var joe=Ot(()=>{"use strict";Zy();Rd();rh();nl();ws()});var Zoe={};Ra(Zoe,{Inspector:()=>yGe});function SQ(e){let t,r;return(t=e.match(/(#|0x)?([a-f0-9]{6})/i))?r=t[2]:(t=e.match(/rgb\\(\\s*(\\d*)\\s*,\\s*(\\d*)\\s*,\\s*(\\d*)\\s*\\)/))?r=parseInt(t[1]).toString(16).padStart(2,0)+parseInt(t[2]).toString(16).padStart(2,0)+parseInt(t[3]).toString(16).padStart(2,0):(t=e.match(/^#?([a-f0-9])([a-f0-9])([a-f0-9])$/i))&&(r=t[1]+t[1]+t[2]+t[2]+t[3]+t[3]),r?"#"+r:!1}function L9e(e){return z9e.find(t=>t.match(e))}function G9e(e){let t=document.createElement("style");t.innerHTML=e;let r=document.querySelector("head link[rel=stylesheet], head style");r?document.head.insertBefore(t,r):document.head.appendChild(t)}function Y9e(e){let t;for(t of e)t()}function Woe(e,t,r){let i={id:t.id,__type:t.__type},n=r.addFolder("".concat(t.type,"-").concat(t.id));for(let a in t){if(a==="visible"&&n.add(t,a).onChange(o=>{e.updateState(i,{[a]:o})}),a==="color"||a==="hoverColor"){t[a]=wc(t[a]),n.addColor(t,a).onChange(o=>{e.updateState(i,{[a]:o})});continue}if(a==="height"){n.add(t,a,0,20,1).onChange(o=>{e.updateState(i,{[a]:o})});continue}if(a==="texture"&&t.texture){n.addFolder("Texture - side").add(t.texture,"url").onChange(o=>{e.updateState(i,{texture:{url:o}})});continue}if(a==="topTexture"&&t.topTexture){n.addFolder("Texture - top").add(t.topTexture,"url").onChange(o=>{e.updateState(i,{topTexture:{url:o}})});continue}if(a==="opacity"){n.add(t,a,0,1,.1).onChange(o=>{e.updateState(i,{[a]:o})});continue}if(a==="altitude"){n.add(t,a,0,100,1).onChange(o=>{e.updateState(i,{[a]:o})});continue}H9e.includes(a)&&n.add(t,a).onChange(o=>{e.updateState(i,{[a]:o})})}return t.isInView&&(n.add(t,"isInView").listen().disable(),n.add(t,"isInViewCheck")),{cleanup(){n.destroy()}}}function W9e(){let e=[];function t(n,a){var o;let s=Object.values(n.getMapData())[0],l=a;if(l&&ua.is(l)){let u=(o=s.getByType("enterprise-location"))==null?void 0:o.find(c=>c.spaces.some(h=>h.id===l.id));u&&(l=u)}return l}function r(n,a){return Qe(this,null,function*(){return a instanceof xl?n.Camera.focusOn(a.locations.flatMap(o=>o.spaces),ob):a instanceof ma?n.Camera.focusOn(a.spaces,ob):n.Camera.focusOn(a,ob)})}function i(n,a,{focus:o=!1}={}){if(!window.enableHighlightCard)return()=>{};let s=t(n,a),l=document.createElement("div");if(l.style.cssText=\`
|
|
6192
|
+
\`,document.body.appendChild(this.element)}getActualInstanceCount(e){for(let t of e.mesh.children)if(t.isInstancedMesh)return t.count;return e.count}update(e,t,r){var i,n,a;if(!this.enabled||!this.element)return;let o='<div style="margin-bottom: 5px; font-weight: bold; border-bottom: 1px solid #666; padding-bottom: 5px;">Model Batches</div>';if(e.size===0)o+='<div style="color: #888;">No models loaded</div>';else{let s=0,l=0,u=Array.from(e.keys()).sort((c,h)=>{var d,p;let f=(d=t.get(c))!=null?d:"",m=(p=t.get(h))!=null?p:"";return f.localeCompare(m)});for(let c of u){let h=e.get(c);if(!h||h.size===0)continue;let d=(i=t.get(c))!=null?i:"unknown_".concat(c),p=0;for(let m of h)p+=this.getActualInstanceCount(m);s+=h.size,l+=p,o+='<div style="margin: 6px 0 2px 0;">',o+='<span style="color: #4fc3f7; font-weight: bold;">"'.concat(d,'"</span>'),o+='<span style="color: #aaa;"> ('.concat(p," total, ").concat(h.size," batch").concat(h.size!==1?"es":"",")</span>"),o+="</div>";let f=Array.from(h).sort((m,g)=>m.id.localeCompare(g.id));for(let m of f){let g=this.getActualInstanceCount(m),v=m.count,_=g!==v,x=m.opacity===1?"":" @".concat((m.opacity*100).toFixed(0),"%");o+='<div style="margin-left: 12px; color: #ccc; font-size: 11px;">',o+='<span style="color: #81c784;">'.concat(m.id,"</span>"),_?o+='<span style="color: #e57373;">: '.concat(g," actual / ").concat(v," tracked</span>"):o+='<span style="color: #fff;">: '.concat(g," instance").concat(g!==1?"s":"","</span>"),x&&(o+='<span style="color: #ffb74d;">'.concat(x,"</span>")),o+="</div>"}}o+='<div style="margin-top: 8px; padding-top: 5px; border-top: 1px solid #666; color: #fff;">',o+='Total: <span style="color: #81c784;">'.concat(l," instance").concat(l!==1?"s":"","</span>"),o+=', <span style="color: #e57373;">'.concat(s," draw call").concat(s!==1?"s":"","</span>"),o+="</div>"}if(r.size>0){o+='<div style="margin-top: 8px; border-top: 1px solid #666; padding-top: 5px;">',o+='<div style="margin-bottom: 5px; font-weight: bold; color: #ff9800;">Non-instanced Models</div>',o+='<span style="color: #aaa;">('.concat(r.size," total, ").concat(r.size," draw call").concat(r.size!==1?"s":"",")</span>");let s=new Map;for(let[l,u]of r){let c=(n=s.get(u.urlHash))!=null?n:[];c.push(l),s.set(u.urlHash,c)}for(let[l,u]of s){let c=(a=t.get(l))!=null?a:"unknown_".concat(l);o+='<div style="margin: 6px 0 2px 0;">',o+='<span style="color: #ff9800;">"'.concat(c,'"</span>'),o+='<span style="color: #aaa;"> ('.concat(u.length," model").concat(u.length!==1?"s":"",")</span>"),o+="</div>";for(let h of u)o+='<div style="margin-left: 12px; color: #ccc; font-size: 11px;">'.concat(h,"</div>")}o+="</div>"}this.element.innerHTML=o}destroy(){this.element&&(this.element.remove(),this.element=null)}},Iy=100,a7e=!0,o7e=class extends Ki{constructor(e,t){super(),I(this,"transparencyChanged",!1),I(this,"state"),I(this,"convertTo3DMapPosition"),I(this,"loader"),I(this,"loadPromises",[]),I(this,"gltfCache",new Map),I(this,"gltfLoadPromises",new Map),I(this,"instanceMap",new Map),I(this,"debugUI"),I(this,"modelNames",new Map),I(this,"batchCounter",0),I(this,"batchByMesh",new Map),I(this,"batchesByUrlHash",new Map),I(this,"nonInstancedModels",new Map),I(this,"pendingOpacityChanges",new Map),I(this,"detachedEntityIds",new Set),I(this,"tempMatrix",new er),I(this,"tempQuaternion",new Sa),I(this,"tempEuler",new Ua),I(this,"tempScale",new fe),I(this,"tempColor",new Dt),I(this,"endFrame",()=>{this.transparencyChanged=!1}),this.state=e,this.convertTo3DMapPosition=t,this.debugUI=new n7e}createBatch(e,t,r,i,n){this.batchCounter++;let a={id:"batch_".concat(this.batchCounter),mesh:e,count:0,maxCount:n,opacity:i,urlHash:t,containerId:r};return e.userData.batchId=a.id,this.batchByMesh.set(e,a),this.batchesByUrlHash.has(t)||this.batchesByUrlHash.set(t,new Set),this.batchesByUrlHash.get(t).add(a),a}removeBatch(e){var t,r;this.batchByMesh.delete(e.mesh),(t=this.batchesByUrlHash.get(e.urlHash))==null||t.delete(e),((r=this.batchesByUrlHash.get(e.urlHash))==null?void 0:r.size)===0&&this.batchesByUrlHash.delete(e.urlHash)}getBatchForMesh(e){return this.batchByMesh.get(e)}updateDebugUI(){this.debugUI.update(this.batchesByUrlHash,this.modelNames,this.nonInstancedModels)}showDebug(){this.debugUI.show(),this.updateDebugUI()}hideDebug(){this.debugUI.hide()}getGLTFLoader(){return Qe(this,null,function*(){if(this.loader)return this.loader;let{GLTFLoader:e}=yield Promise.resolve().then(()=>(pne(),dne));return this.loader=new e,this.loader})}getOrLoadGLTF(e,t){return Qe(this,null,function*(){let r=this.gltfCache.get(t);if(r)return r;let i=this.gltfLoadPromises.get(t);if(i)return i;let n=yield this.getGLTFLoader(),a=new Promise((o,s)=>{let l=c=>{this.gltfCache.set(t,c),this.gltfLoadPromises.delete(t),o(c)},u=c=>{this.gltfLoadPromises.delete(t),s(c)};die(e)?n.parse(pie(e),"",l,u):fie(e)?n.parse(Aie(e),"",l,u):n.load(e,l,void 0,u)});return this.gltfLoadPromises.set(t,a),a})}createNonInstancedModel(e,t,r,i){var n,a,o,s,l;let u=e.components[0],c=e.components[1],h=u.feature,d=t.scene.clone(!0);d.updateWorldMatrix(!0,!0);let p=new cc;p.userData={nonInstanced:!0,entityId:String(e.id),type:"model"},d.traverse(b=>{let E=b;if("isMesh"in E&&E.isMesh===!0){let M=E.clone();M.geometry=E.geometry.clone(),M.geometry.applyMatrix4(E.matrixWorld),M.position.set(0,0,0),M.rotation.set(0,0,0),M.scale.set(1,1,1),Array.isArray(E.material)?M.material=E.material.map(S=>S.clone()):M.material=E.material.clone(),M.userData={entityId:String(e.id)},p.add(M)}});let{x:f,y:m}=this.convertTo3DMapPosition(h.geometry.coordinates[1],h.geometry.coordinates[0],0),g=(n=h.geometry.coordinates[2])!=null?n:0,v=((a=c.verticalOffset)!=null?a:0)+g;u.altitude=v,u.position.set(f,m,u.altitude);let _=(o=c.scale)!=null?o:by,x=(s=c.rotation)!=null?s:wy;if(p.position.copy(u.position),p.rotation.set(Zr.degToRad(x[0]),Zr.degToRad(x[1]),Zr.degToRad(x[2])),p.scale.set(_[0],_[1],_[2]),c.color&&Kne(p,c.color),c.opacity!=null&&c.opacity!==1&&qne(p,c.opacity),c.visibleThroughGeometry&&r7e(p,!0),!c.EXPERIMENTAL_clippingEnabled){let b=(l=c.opacity)!=null?l:1;mA(p,b)}r.add(p),u.mesh=p,u.instanceIndex=-1,this.nonInstancedModels.set(e.id,{urlHash:i,mesh:p}),this.updateDebugUI()}resizeInstanceContainer(e,t){let r=t7e(e.maxCount),i=I_(t,r),n=e.object.children,a=i.children;for(let s=0;s<n.length;s++){let l=n[s],u=a[s];if(!(!(l instanceof An)||!(u instanceof An))){for(let c=0;c<e.count;c++)l.getMatrixAt(c,this.tempMatrix),u.setMatrixAt(c,this.tempMatrix),u.userData.entities[c]=l.userData.entities[c],l.instanceColor&&(l.getColorAt(c,this.tempColor),u.setColorAt(c,this.tempColor));u.count=e.count,u.instanceMatrix.needsUpdate=!0}}let o=e.object.parent;return o&&(o.remove(e.object),o.add(i)),e.object=i,e.maxCount=r,e}getOrCreateInstanceContainer(e,t,r){let i=this.instanceMap.get(e);i||(i=new Map,this.instanceMap.set(e,i));let n=i.get(t);if(n){let a=this.getBatchForMesh(n.object);a&&(n.count=a.count)}else{let a=I_(r,Iy);n={object:a,count:0,maxCount:Iy},i.set(t,n);let o=this.createBatch(a,t,e,1,Iy);n.batch=o}return n}createModelFromFeature(e,t,r){let i=new fB(t),n=ze({},r);t.properties.verticalOffset!=null&&(n.verticalOffset=t.properties.verticalOffset),t.properties.rotation!=null&&(n.rotation=t.properties.rotation),t.properties.scale!=null&&(n.scale=t.properties.scale);let a=new B6(n);i.instancingDisabled=a.visibleThroughGeometry===!0||a.EXPERIMENTAL_clippingEnabled===!0;let o=new ln(i,a);return o.id=e,a.EXPERIMENTAL_clippingEnabled&&(o.components[7]=new IC),o}populateModelGroup(e,t,r){return Qe(this,null,function*(){var i,n,a,o;let s=up(t),l=this.getOrLoadGLTF(t,s).then(h=>{var d;let p=r.parent;if(!(p instanceof Vi))return;let f=p.userData.entityId,m=this.getOrCreateInstanceContainer(f,s,h);m.count+e.size>m.maxCount&&(m=this.resizeInstanceContainer(m,h)),m.object.parent||r.add(m.object);let g=new er,v=new Ua,_=new Sa,x=new fe,b,E,M;for(let S of e.values()){if(M=this.state.geometry3DMap.get(S),!M||(M==null?void 0:M.type)!=="model"||!this.state.geometry3DsInScene.has(M))continue;let D=M.components[0],T=M.components[1];if(D.instanceIndex!=null&&D.instanceIndex>=0||D.instancingDisabled&&D.mesh)continue;if(E=D.feature,D.instancingDisabled){this.createNonInstancedModel(M,h,r,s);continue}let P=T.opacity!=null&&T.opacity!==1;if(P){let F=(d=T.opacity)!=null?d:1,B=Math.round(F*100),z,O,j=this.batchesByUrlHash.get(s);if(j){for(let Z of j)if(Z.containerId===p.userData.entityId&&Math.round(Z.opacity*100)===B&&Z.count<Z.maxCount){z=Z,O=Z.mesh;break}}if(!z||!O){let Z=I_(h,Iy);Z.userData.detached=!0,Z.userData.sharedOpacity=F,r.add(Z),z=this.createBatch(Z,s,p.userData.entityId,F,Iy),O=Z,C_(Z,F),mA(Z,F)}let Y=z.count;D.mesh=O,D.instanceIndex=Y,z.count++,this.detachedEntityIds.add(M.id)}else D.mesh=m.object,D.instanceIndex=m.count;K6(M),T.dirty=!1,b=this.convertTo3DMapPosition(E.geometry.coordinates[1],E.geometry.coordinates[0],0),D.position.set(b.x,b.y,D.altitude),qC(v,T.rotation),$C(x,T.scale),_.setFromEuler(v),g.compose(D.position,_,x);let k=D.mesh,R=D.instanceIndex;for(let F of k.children)F instanceof An&&(F.setMatrixAt(R,g),F.userData.entities[R]=M.id,F.count=R+1,F.instanceMatrix.needsUpdate=!0);if(e8(k,R,T.color,T.material),!P){m.count++;let F=this.getBatchForMesh(m.object);F&&(F.count=m.count)}q6(D.mesh)}this.publish("model-loaded")});this.loadPromises.push(l);let u=(n=(i=r.parent)==null?void 0:i.userData)==null?void 0:n.entityId,c=(a=this.instanceMap.get(u))==null?void 0:a.get(s);return(o=c==null?void 0:c.object)!=null?o:new cc})}update(){for(let t of this.state.geometryGroupIdsToLoad.values()){let r=this.state.geometry3DMap.get(t);r instanceof da&&r.userData.dirty&&r.userData.modelURL&&(this.populateModelGroup(r.userData.entities3D,r.userData.modelURL,r),r.userData.dirty=!1,r.userData.localCenter=void 0)}this.updateModelStyles(),this.rebatchDetachedInstances(),this.flushPendingOpacityChanges(),this.updateDebugUI();let e=this.loadPromises;return this.loadPromises=[],Promise.all(e)}rebatchDetachedInstances(){var e,t,r,i;if(!a7e||this.detachedEntityIds.size===0)return;let n=new Map;for(let a of this.detachedEntityIds){let o=this.state.geometry3DMap.get(a);if(!o||o.type!=="model")continue;let s=o.components[0],l=o.components[1],u=(e=s.mesh)==null?void 0:e.userData;if(!((t=s.mesh)!=null&&t.parent))continue;let c=(r=l.opacity)!=null?r:1,h=u==null?void 0:u.sharedOpacity;if(Math.round(c*100)===100&&h!==void 0){this.pendingOpacityChanges.set(o.id,{entity:o,targetOpacity:c});continue}if(h!==void 0&&Math.abs(c-h)<=.01)continue;if(h!==void 0&&Math.abs(c-h)>.01){this.pendingOpacityChanges.set(o.id,{entity:o,targetOpacity:c});continue}let d=s.mesh.parent;if(!(d instanceof da))continue;let p=d.userData.modelURL;if(!p)continue;let f=up(p),m=(i=l.opacity)!=null?i:1,g=Math.round(m*100);n.has(f)||n.set(f,new Map);let v=n.get(f);v.has(g)||v.set(g,[]),v.get(g).push(o)}for(let[a,o]of n.entries()){let s=this.gltfCache.get(a);if(s)for(let[l,u]of o.entries()){if(u.length<2)continue;let c=l/100;this.createSharedBatchForDetached(u,s,c,a)}}this.publish("batch-changed")}createSharedBatchForDetached(e,t,r,i){var n;if(e.length<2)return;let a=(n=e[0].components[0].mesh)==null?void 0:n.parent;if(!a)return;let o=a.parent,s=o instanceof Vi?o.userData.entityId:"unknown",l=I_(t,e.length);l.userData.detached=!0,l.userData.sharedOpacity=r,a.add(l);let u=this.createBatch(l,i,s,r,e.length);C_(l,r),mA(l,r);let c=new er,h=new Ua,d=new Sa,p=new fe,f,m,g=0;for(let v of e){let _=v.components[0],x=v.components[1],b=_.mesh;if(b){let E=this.getBatchForMesh(b);E&&this.removeBatch(E),$6(b)}_.mesh=l,_.instanceIndex=g,m=_.feature,f=this.convertTo3DMapPosition(m.geometry.coordinates[1],m.geometry.coordinates[0],0),_.position.set(f.x,f.y,_.altitude),qC(h,x.rotation),$C(p,x.scale),x.visible===!1&&p.set(0,0,0),d.setFromEuler(h),c.compose(_.position,d,p);for(let E of l.children)E instanceof An&&(E.setMatrixAt(g,c),E.userData.entities[g]=v.id,E.count=g+1,E.instanceMatrix.needsUpdate=!0);e8(l,g,x.color,x.material),g++}u.count=g,q6(l)}removeInstanceFromBatch(e,t,r){var i;let n=e.count-1,a=e.opacity===1&&((i=t.userData)==null?void 0:i.detached)!==!0;if(e.count===1){if(a){e.count=0;for(let c of t.children)c instanceof An&&(c.count=0,c.instanceMatrix.needsUpdate=!0);let l=this.instanceMap.get(e.containerId),u=l==null?void 0:l.get(e.urlHash);u&&u.object===e.mesh&&(u.count=0),this.updateDebugUI();return}this.removeBatch(e),$6(t),this.updateDebugUI();return}for(let l of t.children)if(l instanceof An){if(r!==n){l.getMatrixAt(n,this.tempMatrix),l.getColorAt(n,this.tempColor),l.setMatrixAt(r,this.tempMatrix),l.setColorAt(r,this.tempColor);let u=l.userData.entities[n];if(u){l.userData.entities[r]=u;let c=this.state.geometry3DMap.get(u);c&&(c.components[0].instanceIndex=r)}}delete l.userData.entities[n],l.count=n,l.instanceMatrix.needsUpdate=!0,l.instanceColor&&(l.instanceColor.needsUpdate=!0)}e.count=n;let o=this.instanceMap.get(e.containerId),s=o==null?void 0:o.get(e.urlHash);s&&s.object===e.mesh&&(s.count=n),this.updateDebugUI()}updateModelStyles(){var e,t,r,i,n;for(let a of this.state.geometry3DsInScene){if((a==null?void 0:a.type)!=="model")continue;let o=a.components[1],s=a.components[0];if(!o.dirty&&!s.positionDirty)continue;if(s.instancingDisabled){this.updateNonInstancedModelStyle(a),o.dirty=!1,s.positionDirty=!1;continue}let l=(e=s.mesh)==null?void 0:e.userData,u=l==null?void 0:l.detached,c=o.opacity!=null&&o.opacity!==1,h=(t=o.opacity)!=null?t:1,d=l==null?void 0:l.sharedOpacity,p=d!==void 0&&Math.abs(h-d)>.01;if((c&&!u&&s.mesh||p)&&this.pendingOpacityChanges.set(a.id,{entity:a,targetOpacity:h}),K6(a),this.updateInstanceTransform(a),this.updateInstanceColor(a,o.color,o.material),((i=(r=s.mesh)==null?void 0:r.userData)==null?void 0:i.detached)&&s.mesh){let f=(n=o.opacity)!=null?n:1;C_(s.mesh,f),mA(s.mesh,f)&&(this.transparencyChanged=!0)}o.dirty=!1,s.positionDirty=!1}}flushPendingOpacityChanges(){var e,t;if(this.pendingOpacityChanges.size===0)return;let r=new Map,i=new Map,n=(a,o,s,l,u,c)=>{let h=Math.round(o*100),d="".concat(s,"_").concat(l,"_").concat(h),p=i.get(d);p||(p={entities:[],targetOpacity:o,urlHash:s,containerId:l,gltf:u,parent:c},i.set(d,p)),p.entities.push(a)};for(let{entity:a,targetOpacity:o}of this.pendingOpacityChanges.values()){let s=a.components[0];if(!s.mesh||s.instanceIndex==null)continue;let l=s.mesh,u=this.getBatchForMesh(l),c=l.parent;if(!(c instanceof da))continue;let h=c.userData.modelURL;if(!h)continue;let d=up(h),p=this.gltfCache.get(d);if(!p)continue;let f=c.parent,m=f instanceof Vi?f.userData.entityId:"unknown";if(u){let g=r.get(u);g||(g={entities:[],targetOpacity:o},r.set(u,g)),Math.round(g.targetOpacity*100)===Math.round(o*100)?g.entities.push(a):n(a,o,d,m,p,c)}else n(a,o,d,m,p,c)}for(let[a,o]of r){let{entities:s,targetOpacity:l}=o,u=((e=a.mesh.userData)==null?void 0:e.detached)===!0,c=Math.round(l*100)===100;if(s.length===a.count&&u&&!c)a.opacity=l,a.mesh.userData.sharedOpacity=l,C_(a.mesh,l),mA(a.mesh,l)&&(this.transparencyChanged=!0);else{let h=(t=s[0])==null?void 0:t.components[0],d=h==null?void 0:h.mesh,p=d==null?void 0:d.parent;if(p instanceof da){let f=p.userData.modelURL;if(f){let m=up(f),g=this.gltfCache.get(m),v=p.parent,_=v instanceof Vi?v.userData.entityId:"unknown";if(g)for(let x of s)n(x,l,m,_,g,p)}}}}for(let a of i.values()){let{entities:o,targetOpacity:s,urlHash:l,containerId:u,gltf:c,parent:h}=a,d=Math.round(s*100);for(let _ of o){let x=_.components[0],b=x.mesh,E=this.getBatchForMesh(b),M=x.instanceIndex;E&&M!=null&&M>=0&&this.removeInstanceFromBatch(E,b,M)}let p,f,m=this.batchesByUrlHash.get(l);if(m){for(let _ of m)if(_.containerId===u&&Math.round(_.opacity*100)===d&&_.count+o.length<=_.maxCount){p=_,f=_.mesh;break}}if(!p||!f){let _=Math.max(Iy,o.length),x=I_(c,_);x.userData.detached=!0,x.userData.sharedOpacity=s,h.add(x),p=this.createBatch(x,l,u,s,_),f=x,C_(x,s),mA(x,s)&&(this.transparencyChanged=!0)}let g,v;for(let _ of o){let x=_.components[0],b=_.components[1],E=p.count;x.mesh=f,x.instanceIndex=E,v=x.feature,g=this.convertTo3DMapPosition(v.geometry.coordinates[1],v.geometry.coordinates[0],0),x.position.set(g.x,g.y,x.altitude),qC(this.tempEuler,b.rotation),$C(this.tempScale,b.scale),b.visible===!1&&this.tempScale.set(0,0,0),this.tempQuaternion.setFromEuler(this.tempEuler),this.tempMatrix.compose(x.position,this.tempQuaternion,this.tempScale);for(let M of f.children)M instanceof An&&(M.setMatrixAt(E,this.tempMatrix),M.userData.entities[E]=_.id,M.count=E+1,M.instanceMatrix.needsUpdate=!0);this.updateInstanceColor(_,b.color,b.material),p.count++,f.userData.detached?this.detachedEntityIds.add(_.id):this.detachedEntityIds.delete(_.id)}q6(f),this.publish("batch-changed")}this.pendingOpacityChanges.clear(),this.updateDebugUI()}updateInstanceTransform(e){let t=e.components[0],r=e.components[1];if(!t.mesh)return;let i=t.feature,{x:n,y:a}=this.convertTo3DMapPosition(i.geometry.coordinates[1],i.geometry.coordinates[0],0);if(t.position.set(n,a,t.altitude),qC(this.tempEuler,r.rotation),r.visible===!1?this.tempScale.set(0,0,0):$C(this.tempScale,r.scale),t.instancingDisabled){t.mesh.position.copy(t.position),t.mesh.rotation.set(this.tempEuler.x,this.tempEuler.y,this.tempEuler.z),t.mesh.scale.copy(this.tempScale);return}if(!(t.instanceIndex==null||t.instanceIndex<0)){this.tempQuaternion.setFromEuler(this.tempEuler),this.tempMatrix.compose(t.position,this.tempQuaternion,this.tempScale);for(let o of t.mesh.children)o instanceof An&&(o.setMatrixAt(t.instanceIndex,this.tempMatrix),o.instanceMatrix.needsUpdate=!0)}}updateNonInstancedModelStyle(e){var t;let r=e.components[0],i=e.components[1];if(!r.mesh)return;K6(e),this.updateInstanceTransform(e);let n=(t=i.opacity)!=null?t:1;qne(r.mesh,n,i.visibleThroughGeometry),i.EXPERIMENTAL_clippingEnabled||mA(r.mesh,n)&&(this.transparencyChanged=!0),i.color&&Kne(r.mesh,i.color)}updateInstanceColor(e,t,r){let i=e.components[0];!i.mesh||i.instanceIndex==null||i.instanceIndex<0||e8(i.mesh,i.instanceIndex,t,r)}removeInstance(e){var t,r;let i=e.components[0];if(this.detachedEntityIds.delete(e.id),this.nonInstancedModels.has(e.id)){let c=this.nonInstancedModels.get(e.id);return c!=null&&c.mesh&&($ne(c.mesh),(t=c.mesh.parent)==null||t.remove(c.mesh)),this.nonInstancedModels.delete(e.id),i.mesh=null,this.updateDebugUI(),!0}if(!i.mesh||i.instanceIndex==null||i.instanceIndex<0)return!0;let n=this.getBatchForMesh(i.mesh);if(!n)return!0;let a=i.instanceIndex,o=n.count-1,s=n.opacity===1&&((r=i.mesh.userData)==null?void 0:r.detached)!==!0;if(n.count===1){if(s){n.count=0;for(let m of i.mesh.children)m instanceof An&&(m.count=0,m.instanceMatrix.needsUpdate=!0);let p=this.instanceMap.get(n.containerId),f=p==null?void 0:p.get(n.urlHash);return f&&f.object===n.mesh&&(f.count=0),i.mesh.parent&&i.mesh.parent.remove(i.mesh),i.mesh=null,this.updateDebugUI(),!1}let c=n.urlHash;this.removeBatch(n);let h=this.batchesByUrlHash.get(c),d=!1;if(h){for(let p of h)if(p.count>0){d=!0;break}}return $6(i.mesh),i.mesh=null,this.updateDebugUI(),!d}for(let c of i.mesh.children)if(c instanceof An){if(a!==o){c.getMatrixAt(o,this.tempMatrix),c.getColorAt(o,this.tempColor),c.setMatrixAt(a,this.tempMatrix),c.setColorAt(a,this.tempColor);let h=c.userData.entities[o];if(h){c.userData.entities[a]=h;let d=this.state.geometry3DMap.get(h);d?d.components[0].instanceIndex=a:rt.warn("[removeInstance] Could not find lastEntity in geometry3DMap:",h)}}delete c.userData.entities[o],c.count=o,c.instanceMatrix.needsUpdate=!0,c.instanceColor&&(c.instanceColor.needsUpdate=!0)}n.count=o;let l=this.instanceMap.get(n.containerId),u=l==null?void 0:l.get(n.urlHash);return u&&u.object===n.mesh&&(u.count=o),i.mesh=null,this.updateDebugUI(),!1}destroy(){var e;this.gltfCache.clear(),this.gltfLoadPromises.clear();for(let t of this.instanceMap.values())for(let r of t.values())i7e(r.object);this.instanceMap.clear(),this.modelNames.clear(),this.batchByMesh.clear(),this.batchesByUrlHash.clear(),this.batchCounter=0;for(let t of this.nonInstancedModels.values())t.mesh&&($ne(t.mesh),(e=t.mesh.parent)==null||e.remove(t.mesh));this.nonInstancedModels.clear(),this.debugUI.destroy(),this.loadPromises=[],this.loader=void 0}};H();s7e=class{constructor(e,t,r,i,n={}){he(this,EB),he(this,Ep),he(this,bB),he(this,fa),he(this,wB,new fe),he(this,mp,new vt),xe(this,Ep,t),xe(this,bB,r),xe(this,fa,new qre(e,r,yt(this,EB,Zae).call(this,i),n))}get pipeline(){return A(this,fa)}get interactiveCollidersQTree(){return A(this,fa).collisionSystem.interactiveCollidersQTree}get visibleCollidersQTree(){return A(this,fa).collisionSystem.visibleCollidersQTree}resize(){A(this,fa).resize()}syncTwoDEntities(){A(this,fa).clearEntities(),A(this,bB).pixelRatio=A(this,Ep).pixelRatio;for(let e of A(this,Ep).geometry2DsInScene)e.syncPosition(),A(this,fa).addEntity(e.entity2D)}update(e,t,r,i=[]){yt(this,EB,Xae).call(this),A(this,fa).update(e,t,r,i)}markDirty(){A(this,fa).markDirty()}get collidersNeedRecomputing(){return A(this,fa).collidersNeedRecomputing}set collidersNeedRecomputing(e){A(this,fa).collidersNeedRecomputing=e}updateWatermark(e){A(this,fa).updateWatermark(e)}cancelPendingFrames(){A(this,fa).cancelPendingFrames()}setCollidersDirty(){A(this,fa).collisionSystem.collidersDirty=!0}deleteTextCacheEntry(e){delete A(this,fa).drawSystem.textCache[e]}showCollisionBoxes(){A(this,fa).showCollisionBoxes()}hideCollisionBoxes(){A(this,fa).hideCollisionBoxes()}destroy(){A(this,fa).destroy()}};Ep=new WeakMap,bB=new WeakMap,fa=new WeakMap,wB=new WeakMap,mp=new WeakMap,EB=new WeakSet,Zae=function(e){return(t,r,i)=>(A(this,wB).set(t,r,i),A(this,mp).set(0,0),e(A(this,mp),A(this,wB)),A(this,mp).x===0&&A(this,mp).y===0?null:{x:A(this,mp).x,y:A(this,mp).y})},Xae=function(){let e,t;for(let r of A(this,Ep).geometry2DsInScene){t=r.components[0];let i=r.attachedTo?A(this,Ep).geometry3DMap.get(r.attachedTo):void 0;if(i instanceof ln)if(A(this,Ep).geometry3DsInScene.has(i)){if(e=i.components[1],e.dirty||t.attachedDirty){let a=e.height,o=e.altitude;r.setAltitude(a+o),r.syncPosition()}let n=e.visible;t.visible!==n&&(t.visible=n)}else t.visible===!0&&(t.visible=!1);t.attachedDirty=!1}};eae=new Cv,{DEFAULT_PITCH:Jae,DEFAULT_BEARING:Kae,DEFAULT_ZOOM_LEVEL:qae,DEFAULT_MIN_ZOOM_LEVEL:l7e,DEFAULT_MAX_ZOOM_LEVEL:u7e}=wA,c7e=Zr.radToDeg(.6435011087932844),h7e=class extends Ki{constructor(e,t={}){var r,i,n,a,o,s,l,u,c,h,d,p,f,m,g,v,_;if(super(),he(this,mc),I(this,"options"),I(this,"container"),I(this,"Debug"),he(this,Hn),he(this,Yn),he(this,Fy),he(this,zy),he(this,N_),he(this,_A),he(this,Ly),he(this,Oy),I(this,"rendererDomElement"),he(this,Je,{geometry3DMap:new Map,geometry2DMap:new Map,geometry2DIdsInScene:new Set,geometry3DIdsInScene:new Set,geometryGroupIdsToLoad:new Set,geometry3DsInScene:new Set,geometry2DsInScene:new Set,geometryScene:new Vi("__scene"),hoverColor:"#f6efff",text3dHoverColor:"white",insetsPadding:JU,shouldMeasureCanvas:!0,pixelRatio:this.resolutionScale,canvasWidth:0,canvasHeight:0,internalTweenGroup:new II,externalTweenGroup:new II,cameraObject:new za,naturalBearing:0,containerOffset:[0,0],useStandaloneCamera:!1,directionalLight:new Iv(16777215,.3*Math.PI),ambientLight:new JV(16777215,.741*Math.PI),renderer:void 0,threeJSScene:new pd,depthRangeFor3D:[0,1],geometry2DState:{entities:new Set,entityMap:new Map,entityIds:new Set,pixelRatio:1}}),I(this,"camera"),he(this,Aa),he(this,bA),he(this,fs),he(this,Ba),he(this,at,{}),he(this,D8,window.matchMedia("screen and (min-resolution: 2dppx)")),I(this,"map"),he(this,yl,()=>{var F,B;(F=this.signal)!=null&&F.aborted||!((B=A(this,at))!=null&&B.renderSystem)||(A(this,at).renderSystem.twoDdirty=!0)}),he(this,la,()=>{var F,B;(F=this.signal)!=null&&F.aborted||!((B=A(this,at))!=null&&B.renderSystem)||(A(this,at).renderSystem.threeDdirty=!0)}),he(this,k8,()=>{this.map&&(A(this,Je).depthRangeFor3D=this.map.painter.depthRangeFor3D)}),he(this,Ny,(F,B)=>{F.addEventListener("childadded",B),F.addEventListener("childremoved",B),this.onAbort(()=>{F.removeEventListener("childadded",B),F.removeEventListener("childremoved",B)})}),he(this,xp,"standalone"),he(this,R8,()=>{A(this,at).geometryDisposalSystem.dirty=!0,this.render()}),he(this,MB,F=>Math.trunc(F*10)/10),he(this,F8,()=>{yt(this,mc,P8).call(this,h_()),A(this,Je).geometry2DState.pixelRatio=this.resolutionScale,A(this,at).twoDEntitySystem.markDirty(),A(this,Q_).call(this,void 0,void 0,!0)}),he(this,z8,()=>{A(this,Q_).call(this)}),he(this,U_),he(this,Q_,(F,B,z=!1)=>{let O=F!=null?F:this.rendererDomElement.clientWidth,j=B!=null?B:this.rendererDomElement.clientHeight;if((O===0||j===0)&&!z)return;if(A(this,Je).canvasWidth=O,A(this,Je).canvasHeight=j,A(this,at).twoDEntitySystem.resize(),yt(this,mc,P8).call(this,h_()),A(this,CB).call(this),yt(this,mc,eoe).call(this),A(this,at).cameraSystem.resize(this.canvasWidth,this.canvasHeight),A(this,at).cameraSystem.dirty=!0,A(this,at).cameraSystem.stateDirty=!0,this.map!=null){C6(this.map,this.camera.minZoomLevel,this.camera.maxZoomLevel);let ne=this.camera.zoomLevel,ie=Zr.clamp(ne,this.camera.minZoomLevel,this.camera.maxZoomLevel);ie!==ne&&this.camera.setZoomLevel(ie)}A(this,at).watermarkSystem.resize(this.canvasWidth,this.canvasHeight),A(this,at).htmlControlsSystem.resize(this.canvasWidth),A(this,at).geometryInFocusSystem.resize(),A(this,at).occlusion2DSystem.resize(),A(this,at).twoDEntitySystem.resize();let{top:Y,left:Z}=this.container.getBoundingClientRect();A(this,Je).containerOffset=[Y,Z],this.publish("resize"),this.map!=null&&this.publish("camera-change",this.camera),this.render()}),he(this,L8,()=>{this.renderSync()}),he(this,SB,new fe),I(this,"project",(F,B)=>{if(A(this,Yn).position.z+this.camera.elevation>B.z){A(this,SB).copy(B);let z=A(this,SB).project(A(this,U_)),O=(z.x+1)/2*this.canvasWidth-0/2,j=(-z.y+1)/2*this.canvasHeight-0/2,Y=A(this,MB).call(this,O),Z=A(this,MB).call(this,j);F.x=Y,F.y=Z,F instanceof fe&&(F.z=z.z)}else F.x=-1e3,F.y=-1e3,F instanceof fe&&(F.z=1/0)}),he(this,IB,(F,B)=>{A(this,Ba).setBufferSize(F,B),A(this,Yn).aspect=F/B,A(this,Yn).updateProjectionMatrix(),A(this,Yn).updateMatrixWorld(!0),A(this,N_).x=F,A(this,N_).y=B}),he(this,CB,()=>{var F;let B=A(this,Je).canvasWidth=this.rendererDomElement.clientWidth,z=A(this,Je).canvasHeight=this.rendererDomElement.clientHeight,O=Math.floor(B*this.resolutionScale),j=Math.floor(z*this.resolutionScale);A(this,IB).call(this,O,j),(F=this.map)==null||F.resize(),A(this,Je).shouldMeasureCanvas=!1}),I(this,"getParentContainer",(F,B=!0)=>{if(!F)return B?A(this,Je).geometryScene:void 0;if(typeof F=="string"||typeof F=="number"){let z=A(this,Je).geometry3DMap.get(F);return z instanceof Vi?z:(rt.warn("Parent (".concat(typeof F=="object"?F.id:F,") is not a valid container, adding to scene")),B?A(this,Je).geometryScene:void 0)}else if(F.type==="group-container"){let z=A(this,Je).geometry3DMap.get(F.id);if(z instanceof Vi)return z}return B?A(this,Je).geometryScene:void 0}),I(this,"showCollisionBoxes",()=>{A(this,at).twoDEntitySystem.showCollisionBoxes(),this.render()}),I(this,"hideCollisionBoxes",()=>{A(this,at).twoDEntitySystem.hideCollisionBoxes(),this.render()}),I(this,"projectScreenXYToCoordinate",(F,B,z=!1)=>{var O,j;let Y=this.container.getBoundingClientRect(),Z=(F-Y.left)/A(this,Je).canvasWidth*2-1,ne=-((B-Y.top)/A(this,Je).canvasHeight)*2+1,ie=new vt(Z,ne),le,X;if(z)eae.setFromCamera(ie,A(this,Yn)),le=(O=eae.intersectObject(A(this,_A),!1)[0])==null?void 0:O.point;else{let ce=A(this,at).interactionSystem.getThreeDIntersectsFromXY(ie);le=(j=ce==null?void 0:ce[0])==null?void 0:j.point,X=A(this,at).interactionSystem.getGroupContainerIntersectsFromXY(ie)}if(le)return{coordinate:this.convert3DMapPositionToCoordinate(le),groupContainers:X}}),I(this,"projectCoordinateToScreenXY",F=>{let B=this.convertTo3DMapPosition(F[1],F[0],F[2]||0),z=new vt;return this.project(z,B),{x:z.x,y:z.y}}),I(this,"convert3DMapPositionToCoordinate",F=>{var B,z,O,j;let{lat:Y,lon:Z}=_6((z=(B=A(this,Je).center)==null?void 0:B[1])!=null?z:0,(j=(O=A(this,Je).center)==null?void 0:O[0])!=null?j:0,F.x,F.y);return[Z,Y,F.z]}),I(this,"setBackgroundColor",(F,B)=>{A(this,Ba).setBackgroundColor(F,B)}),I(this,"getMetersPerPixel",()=>A(this,at).cameraSystem.getCurrentMetersPerPixel()),I(this,"hideOutdoorLayersIntersectingPolygons",(F,B)=>{A(this,at).outdoorLayersSystem.hideLayersIntersectingPolygons(F,B),this.render()}),he(this,Uy,new fd),he(this,BB,new er),he(this,TB,F=>{var B;rt.error("Render failed: ",F,(B=F.stack)!=null?B:"No stack trace available"),this.publish("render-error",{error:F})}),I(this,"render",()=>{var F,B;if(!(((F=A(this,at))==null?void 0:F.renderSystem)==null||(B=this.signal)!=null&&B.aborted))if(this.map&&(this.mode==="outdoors-interleaved"||this.mode==="outdoors-overlay"))this.map.triggerRepaint();else return A(this,at).renderSystem.update().catch(A(this,TB))}),I(this,"renderSync",()=>{var F;return(F=this.signal)!=null&&F.aborted?Promise.resolve():A(this,at).renderSystem.update(!0).catch(A(this,TB))}),he(this,gp,oc(()=>{this.publish("user-interaction-start",void 0)},0,!0)),he(this,yp,oc(()=>{this.publish("user-interaction-end",void 0),this.render()},0,!0)),I(this,"on",(F,B,z)=>{let O=super.on(F,B,z);return["outdoor-view-loaded","outdoor-style-loaded"].includes(F)&&this.mode==="standalone"&&Fi.env.NODE_ENV!=="test"&&(rt.warn('"'.concat(F,'" was subscribed to but outdoor view is disabled. The event has been triggered immediately. Enable outdoor view or remove the listener.')),this.publish(F),O()),O}),I(this,"off",(F,B)=>{super.off(F,B)}),I(this,"getCursor",()=>A(this,at).interactionSystem.getCursor()),he(this,U8,()=>{try{A(this,xp)!=="outdoors-overlay"&&(this.map&&this.map.remove(),this.container&&this.rendererDomElement&&this.container.contains(this.rendererDomElement)&&this.container.removeChild(this.rendererDomElement)),this.container&&A(this,Aa)&&this.container.contains(A(this,Aa))&&this.container.removeChild(A(this,Aa))}catch(F){rt.warn("Error during DOM cleanup, some elements may not have been removed:",F)}}),he(this,Di,F=>(this.onAbort(()=>{F&&typeof F=="object"&&("destroy"in F&&typeof F.destroy=="function"?F.destroy():"dispose"in F&&typeof F.dispose=="function"&&F.dispose())}),F)),I(this,"destroy",()=>{var F,B,z;!A(this,at)||(F=this.signal)!=null&&F.aborted||(super.destroy(),(B=globalThis.MappedinDebug)!=null&&B.__idleCallbackInteractionState&&(globalThis.MappedinDebug.__idleCallbackInteractionState.unregisterInteractionChecker(A(this,at).cameraSystem.isUserInteracting),globalThis.MappedinDebug.__idleCallbackInteractionState.unregisterInteractionChecker(A(this,at).cameraSystem.isCameraMoving)),this.remove("__scene"),A(this,Ba).destroy(),(z=A(this,Hn))==null||z.traverse(O=>{wo(O),"dispose"in O&&typeof O.dispose=="function"&&O.dispose()}),xe(this,Hn,void 0),xe(this,at,void 0),A(this,U8).call(this),xe(this,Ba,void 0))}),he(this,j_,new fe),he(this,PB,new fe),A(this,Je).useStandaloneCamera=(r=t.useStandaloneCamera)!=null?r:!1,A(this,Je).naturalBearing=(i=t.naturalBearing)!=null?i:0,this.convertTo3DMapPosition=this.convertTo3DMapPosition.bind(this),!e.clientWidth||!e.clientHeight)throw new Error("[MappedinJS] Container width and height must be greater than 0");(t.mode==="outdoors-interleaved"||t.mode==="outdoors-overlay")&&t.map&&(xe(this,xp,t.mode),this.map=t.map),A(this,Ny).call(this,A(this,Je).geometryScene,()=>{A(this,la).call(this),A(this,yl).call(this)}),A(this,Je).geometry3DMap.set(A(this,Je).geometryScene.userData.entityId,A(this,Je).geometryScene),t.center&&(A(this,Je).center=t.center?[...t.center]:[0,0]),this.options=t,this.container=e,yt(this,mc,$ae).call(this),A(this,at).htmlControlsSystem=A(this,Di).call(this,new w6e(this.container,{outdoorEnabled:!!this.map})),A(this,at).maskingSystem=A(this,Di).call(this,new xQe(A(this,Je))),A(this,xp)!=="outdoors-overlay"&&A(this,at).htmlControlsSystem.addAttributionControl(this.options.attribution),window.MappedinDebug||(window.MappedinDebug={}),Fi.env.NODE_ENV==="test"&&(window.MappedinDebug.mapViewCoreInstance=this),xe(this,Ba,new tUe({antialias:typeof t.antialias=="boolean"?t.antialias:!0,alpha:!1,canvas:this.mode!=="standalone"?(n=t.gl)==null?void 0:n.canvas:void 0,onWebGLContextCreationError:t.onWebGLContextCreationError,onWebGLContextLost:t.onWebGLContextLost,onWebGLContextRestored:F=>{var B;(B=t.onWebGLContextRestored)==null||B.call(t,F),A(this,yl).call(this),A(this,la).call(this),this.render()},onWebGLRendererError:t.onWebGLRendererError,backgroundColor:t.backgroundColor||"#ffffff",backgroundAlpha:(a=t.backgroundAlpha)!=null?a:1})),A(this,Je).renderer=A(this,Ba).renderer,xe(this,Hn,A(this,Je).threeJSScene),A(this,Hn).matrixWorldAutoUpdate=!1,A(this,xp)!=="standalone"&&A(this,Hn).add(Xie()),A(this,Hn).add(A(this,Je).geometryScene);let x=window.__THREE_DEVTOOLS__;Fi.env.NODE_ENV==="dev"&&typeof x<"u"&&(x.dispatchEvent(new CustomEvent("observe",{detail:A(this,Hn)})),x.dispatchEvent(new CustomEvent("observe",{detail:A(this,Ba)}))),xe(this,Yn,new za(c7e,this.aspect,50,1e5)),A(this,Je).cameraObject=A(this,Yn),xe(this,zy,new wv),A(this,zy).matrixWorldAutoUpdate=!1,A(this,Yn).renderOrder=999;let b=new mi;b.add(A(this,Yn)),xe(this,Oy,new mi),A(this,Oy).add(b),A(this,Hn).add(A(this,Oy)),A(this,Yn).updateProjectionMatrix(),A(this,Yn).updateMatrixWorld(!0),(o=t.__EXPERIMENTAL_shadows)!=null&&o.enabled&&(A(this,at).shadowsSystem=A(this,Di).call(this,new $Qe(A(this,Je),A(this,Ba),A(this,Oy),t.__EXPERIMENTAL_shadows)),this.map&&this.onMapLibreEvent("render",A(this,k8))),xe(this,U_,this.mode==="standalone"?A(this,Yn):A(this,zy)),this.referenceMap={scale:1,latitude:0,longitude:0,getNorth:()=>0,georeference:[{target:{x:0,y:0}},{target:{x:0,y:0}},{target:{x:0,y:0}},{target:{x:0,y:0}}]},this.rendererDomElement=A(this,Ba).domElement(),xe(this,N_,new vt);let E=new Qa(1e6,1e6),M=new Fn({color:0,visible:!1});xe(this,_A,new Sr(E,M)),A(this,_A).name="worldPlane",A(this,Hn).add(A(this,_A)),(s=t.gl)!=null&&s.canvas||e.appendChild(this.rendererDomElement),window.addEventListener("resize",A(this,z8),{capture:!1,signal:this.signal}),A(this,D8).addEventListener("change",A(this,F8),{signal:this.signal}),typeof ResizeObserver=="function"&&((l=Fi.env)==null?void 0:l.NODE_ENV)!=="test"&&(xe(this,Ly,new ResizeObserver(MN(F=>{A(this,Q_).call(this,F[0].contentRect.width,F[0].contentRect.height)},50))),(u=A(this,Ly))==null||u.observe(e),A(this,Ly)&&this.onAbort(()=>{var F;return(F=A(this,Ly))==null?void 0:F.disconnect()})),e.classList.add("mappedin-map"),this.rendererDomElement.style.width=(c=globalThis.MappedinDebug)!=null&&c.TEST_IOS?"1080px":"100%",this.rendererDomElement.style.height=(h=globalThis.MappedinDebug)!=null&&h.TEST_IOS?"1920px":"100%",Fi.env.NODE_ENV==="test"&&this.rendererDomElement.setAttribute("data-testid","mappedin-canvas"),this.mode!=="outdoors-overlay"&&this.rendererDomElement.tabIndex!==void 0&&this.rendererDomElement.removeAttribute("tabindex"),A(this,Je).canvasWidth=this.rendererDomElement.clientWidth,A(this,Je).canvasHeight=this.rendererDomElement.clientHeight,this.rendererDomElement.style.touchAction="manipulation";let S=this.canvasWidth,D=this.canvasHeight;A(this,at).watermarkSystem=A(this,Di).call(this,new m6e(A(this,Yn),A(this,Je),t==null?void 0:t.watermark)),A(this,at).watermarkSystem.on("texture-loaded",this.render),A(this,Je).shouldMeasureCanvas=!0,A(this,Je).pixelRatio=this.resolutionScale,A(this,IB).call(this,Math.floor(S*this.resolutionScale),Math.floor(D*this.resolutionScale)),A(this,Je).directionalLight.position.set(-150,-150,350),A(this,Hn).add(A(this,Je).directionalLight),A(this,Hn).add(A(this,Je).ambientLight),A(this,at).cameraSystem=A(this,Di).call(this,new K8(A(this,Yn),A(this,Hn),A(this,Ba).renderer,A(this,Je),{mode:this.mode,canvasHeight:D,canvasWidth:S})),(d=globalThis.MappedinDebug)!=null&&d.__idleCallbackInteractionState&&(globalThis.MappedinDebug.__idleCallbackInteractionState.registerInteractionChecker(A(this,at).cameraSystem.isUserInteracting),globalThis.MappedinDebug.__idleCallbackInteractionState.registerInteractionChecker(A(this,at).cameraSystem.isCameraMoving)),A(this,at).cameraSystem.on("user-dolly-start",A(this,gp),{signal:this.signal}),A(this,at).cameraSystem.on("user-pan-start",A(this,gp),{signal:this.signal}),A(this,at).cameraSystem.on("user-rotate-start",A(this,gp),{signal:this.signal}),A(this,at).cameraSystem.on("user-zoom-start",A(this,gp),{signal:this.signal}),A(this,at).cameraSystem.on("user-tilt-start",A(this,gp),{signal:this.signal}),A(this,at).cameraSystem.on("user-pedestal-start",A(this,gp),{signal:this.signal}),A(this,at).cameraSystem.on("user-dolly-end",A(this,yp),{signal:this.signal}),A(this,at).cameraSystem.on("user-pan-end",A(this,yp),{signal:this.signal}),A(this,at).cameraSystem.on("user-rotate-end",A(this,yp),{signal:this.signal}),A(this,at).cameraSystem.on("user-zoom-end",A(this,yp),{signal:this.signal}),A(this,at).cameraSystem.on("user-tilt-end",A(this,yp),{signal:this.signal}),A(this,at).cameraSystem.on("user-pedestal-end",A(this,yp),{signal:this.signal}),A(this,at).cameraSystem.on("change",()=>{this.publish("camera-change",this.camera),A(this,at).geometryInFocusSystem&&(A(this,at).geometryInFocusSystem.cameraDirty=!0),this.render()}),A(this,at).pathSystem=A(this,Di).call(this,new sQe(A(this,Je),this.convertTo3DMapPosition,this.getParentContainer,A(this,at).cameraSystem.convertZoomLevelToAltitude)),A(this,at).pathSystem.on("animate:path",this.render,{signal:this.signal}),A(this,at).panBoundsSystem=A(this,Di).call(this,new y6e(A(this,Je),A(this,at).cameraSystem));let T=()=>{let{panBounds:F,fov:B,convertAltitudeToZoomLevel:z}=A(this,at).cameraSystem;if(A(this,at).panBoundsSystem.autoMinZoomLevel){if(F.radius<=0)return;let O=Math.min(A(this,Je).canvasWidth/A(this,Je).canvasHeight,1),j=B*Math.PI/180*O,Y=Math.tan(j/2),{radius:Z,center:ne}=A(this,at).cameraSystem.panBounds,ie=Z/Y,le=this.getThreeCamera().getWorldPosition(new fe),X=ne.distanceTo(le),ce=Math.abs(le.z-ne.z),ge=ie*ce/X,be=z(ge);Zie(be,this.camera.minZoomLevel)&&this.camera.setMinZoomLevel(be)}this.publish("pan-bounds-change",A(this,at).cameraSystem.panBounds)};A(this,at).panBoundsSystem.on("update",T,{signal:this.signal}),this.camera=A(this,Di).call(this,new n6e(this,A(this,at),A(this,Je)));let P=()=>{A(this,at).geometryInFocusSystem&&A(this,at).geometryInFocusSystem.resize(),this.render()};this.camera.on("padding-change",P,{signal:this.signal}),this.camera.setZoomLevel((p=t.zoomLevel)!=null?p:qae),this.camera.setBearing((f=t.bearing)!=null?f:Kae),this.camera.setPitch((m=t.pitch)!=null?m:Jae),this.camera.setMaxZoomLevel(u7e),this.camera.setMinZoomLevel(l7e),A(this,Je).geometry2DState.pixelRatio=this.resolutionScale,A(this,at).twoDEntitySystem=A(this,Di).call(this,new s7e(this.container,A(this,Je),A(this,Je).geometry2DState,this.project,{workerUrl:rp||void 0,useCollisionWorker:((g=t.useCollisionWorker)!=null?g:!0)&&((v=t.useWorkers)!=null?v:!0),transformImageRequest:t.transformImageRequest,watermark:{width:0,height:0,position:"bottom-left"}})),A(this,at).interactionSystem=A(this,Di).call(this,new uUe(this.rendererDomElement,A(this,Je),A(this,Yn),A(this,_A),A(this,at).cameraSystem.isUserInteracting)),A(this,at).interactionSystem.on("doubletap-with-onefinger",F=>{var B;A(this,at).cameraSystem.enableZoom&&this.camera.animateTo({center:(B=this.projectScreenXYToCoordinate(F.clientX,F.clientY))==null?void 0:B.coordinate,zoomLevel:this.camera.zoomLevel+1,duration:qU,easing:"ease-out"})}),A(this,at).interactionSystem.on("singletap-with-twofinger",()=>{A(this,at).cameraSystem.enableZoom&&this.camera.animateTo({zoomLevel:this.camera.zoomLevel-1,duration:qU,easing:"ease-out"})}),A(this,at).interactionSystem.on("hover",this.render),A(this,at).interactionSystem.on("click",F=>{var B,z,O,j,Y,Z,ne,ie,le;if(F.entity2D.some(be=>be.id==="watermark")&&typeof A(this,at).watermarkSystem.options.onClick=="function"&&A(this,at).watermarkSystem.options.interactive){A(this,at).watermarkSystem.options.onClick();return}if(!F.position){rt.error("Pointer event outside world-plane");return}let X=F.entity3D?[(B=F.entity3D)==null?void 0:B.id]:[];(j=(O=(z=F.entity3D)==null?void 0:z.parentObject3D)==null?void 0:O.userData)!=null&&j.entityId&&X.push((ne=(Z=(Y=F.entity3D)==null?void 0:Y.parentObject3D)==null?void 0:Z.userData)==null?void 0:ne.entityId);let ce=[],ge=[];for(let be of F.entity2D)be.components&&(be.components[0]instanceof lp?ce.push(be.id):be.components[0]instanceof sp&&ge.push(be.id));this.publish("click",{coordinate:this.convert3DMapPositionToCoordinate(F.position),geometry:X,paths:((ie=F.entity3D)==null?void 0:ie.components[0])instanceof sB?[F.entity3D.id]:[],markers:ce,models:((le=F.entity3D)==null?void 0:le.components[0])instanceof fB?[F.entity3D.id]:[],labels:ge,containers:Array.isArray(F.groupContainers)?F.groupContainers.map(be=>be.userData.entityId):[],pointerEvent:F.pointerEvent})}),A(this,at).interactionSystem.on("hover",F=>{var B,z,O;if(!F.position)return;let j=[],Y=[];for(let Z of F.entity2D)Z.components&&(Z.components[0]instanceof lp?j.push(Z.id):Z.components[0]instanceof sp&&Y.push(Z.id));this.publish("hover",{coordinate:this.convert3DMapPositionToCoordinate(F.position),geometry:F.entity3D?[(B=F.entity3D)==null?void 0:B.id]:[],paths:((z=F.entity3D)==null?void 0:z.components[0])instanceof sB?[F.entity3D.id]:[],markers:j,models:((O=F.entity3D)==null?void 0:O.components[0])instanceof fB?[F.entity3D.id]:[],labels:Y,containers:Array.isArray(F.groupContainers)?F.groupContainers.map(Z=>Z.userData.entityId):[]})}),A(this,at).geometryInFocusSystem=A(this,Di).call(this,new I8e(A(this,Je),A(this,U_)));let k=F=>{this.publish("geometry-in-focus",F)};A(this,at).geometryInFocusSystem.on("geometry-in-focus",k,{signal:this.signal}),A(this,at).drawSystem=A(this,Di).call(this,new MUe(A(this,Je),this.convertTo3DMapPosition,this.convert3DMapPositionToCoordinate)),A(this,at).exporterSystem=A(this,Di).call(this,new pUe(A(this,Je))),A(this,at).meshOptimizationSystem=A(this,Di).call(this,new wUe(A(this,Je),this.convertTo3DMapPosition)),A(this,at).meshOptimizationSystem.on("geometry-2d-added",this.render,{signal:this.signal}),A(this,at).meshOptimizationSystem.on("geometry-group-added",A(this,R8),{signal:this.signal}),A(this,at).modelSystem=A(this,Di).call(this,new o7e(A(this,Je),this.convertTo3DMapPosition)),A(this,at).modelSystem.on("model-loaded",()=>{A(this,at).shadowsSystem&&(A(this,at).shadowsSystem.needsRender=!0),this.render()},{signal:this.signal}),A(this,at).modelSystem.on("batch-changed",()=>{A(this,at).interactionSystem.dirty3D=!0},{signal:this.signal}),A(this,at).meshDetachmentSystem=A(this,Di).call(this,new lQe(A(this,Je))),A(this,at).meshModificationSystem=A(this,Di).call(this,new hQe(A(this,Je))),A(this,at).geometryDisposalSystem=A(this,Di).call(this,new gQe(A(this,Je))),A(this,at).textureSystem=A(this,Di).call(this,new yQe(A(this,Je))),A(this,at).textureSystem.on("texture-added",this.render,{signal:this.signal}),A(this,at).borderSystem=A(this,Di).call(this,new Uie(A(this,Je),this.convertTo3DMapPosition)),A(this,at).clippingPlaneSystem=A(this,Di).call(this,new _Qe(A(this,Je))),A(this,at).renderOrderSystem=A(this,Di).call(this,new vQe(A(this,Je))),A(this,at).pluginSystem=A(this,Di).call(this,new bQe),A(this,at).customGeometrySystem=A(this,Di).call(this,new E6e(A(this,Je),this.convertTo3DMapPosition));let R=typeof t.outlines=="object"?t.outlines:void 0;R&&(A(this,Je).outlinesOptions=R),A(this,at).outlineInterpolationSystem=A(this,Di).call(this,new T6e(A(this,Je),R)),A(this,at).outlineInterpolationSystem.on("needs-render",this.render,{signal:this.signal}),A(this,at).renderSystem=A(this,Di).call(this,new SUe(A(this,Ba),A(this,Je),this.mode,A(this,Hn),A(this,Yn),this.viewCamera,A(this,at))),A(this,at).imageSystem=A(this,Di).call(this,new r8e(A(this,Je),this.convertTo3DMapPosition,this.project,t.bearing,t.naturalBearing,t.imagePlacementOptions,t.transformImageRequest)),A(this,at).text3DSystem=A(this,Di).call(this,new rie(A(this,Je),this.convertTo3DMapPosition,(_=t.useWorkers)!=null?_:!0)),A(this,at).text3DSystem.on("render",this.render,{signal:this.signal}),A(this,at).imageSystem.on("image-loaded",this.render,{signal:this.signal}),A(this,at).renderSystem.on("pre-render",()=>this.publish("pre-render"),{signal:this.signal}),A(this,at).renderSystem.on("post-render",()=>this.publish("post-render"),{signal:this.signal}),A(this,at).renderSystem.on("measure-canvas",A(this,CB),{signal:this.signal}),A(this,at).outdoorLayersSystem=A(this,Di).call(this,new H8e(this.map)),A(this,at).occlusion2DSystem=A(this,Di).call(this,new mQe(A(this,Je),this.convertTo3DMapPosition,A(this,Ba))),t.occlusionEnabled&&A(this,at).occlusion2DSystem.enable(),this.Debug=new pQe(this),t.environment!==!1&&xe(this,Fy,yt(this,mc,N8).call(this)),A(this,L8).call(this)}get viewCamera(){return A(this,zy)}get cameraObject(){return A(this,Yn)}get canvasWidth(){return A(this,Je).canvasWidth}get canvasHeight(){return A(this,Je).canvasHeight}get resolutionScale(){var e,t;return(t=(e=this.map)==null?void 0:e._getClampedPixelRatio(this.canvasWidth,this.canvasHeight))!=null?t:h_()}get aspect(){return this.canvasWidth/this.canvasHeight}get labelsCanvas(){var e;return(e=A(this,fs))!=null?e:null}get mode(){return A(this,xp)}addGroupContainer(e,t,r){if(!A(this,Je).geometry3DMap.has(e)&&!A(this,Je).geometry2DMap.has(e)){let i=new Vi(e);A(this,Ny).call(this,i,()=>{A(this,la).call(this),A(this,yl).call(this)}),(t==null?void 0:t.visible)!==void 0&&(i.visible=t.visible),(t==null?void 0:t.altitude)!==void 0&&i.setAltitude(t.altitude),(t==null?void 0:t.interactive)!==void 0&&io(i,t.interactive,A(this,Je)),(t==null?void 0:t.focusable)!==void 0&&DC(i,t.focusable),(t==null?void 0:t.preloadGeometry)!==void 0&&(i.userData.preloadGeometry=t.preloadGeometry),A(this,Je).geometry3DMap.set(e,i);let n=this.getParentContainer(r);n instanceof Vi&&n.addEntity(i),A(this,la).call(this),this.render()}else rt.error("Group container with ID '".concat(e,"' already exists. The group container cannot be added."));return{id:e,type:"group-container"}}addCustomGeometry(e,t,r,i,n){if(A(this,Je).geometry3DMap.has(e))rt.error("Custom geometry with ID '".concat(e,"' already exists. The custom geometry cannot be added."));else{let a=new j6(t,r),o=new ln(a,new dA(i));(i==null?void 0:i.interactive)!==void 0&&io(o,i.interactive,A(this,Je)),o.id=e,a.mesh.userData={entityId:e,type:"custom-geometry"},A(this,Je).geometry3DMap.set(o.id,o);let s=this.getParentContainer(n);n&&s instanceof Vi?s.addEntity(o):A(this,Je).geometryScene.addEntity(o),A(this,at).panBoundsSystem.dirty=!0,A(this,la).call(this),this.render()}return{id:e,type:"custom-geometry"}}registerPlugin(e){A(this,at).pluginSystem.registerPlugin(e)}unregisterPlugin(e){A(this,at).pluginSystem.unregisterPlugin(e)}addGeometryGroup(e,t,r,i){var n,a,o;if(!A(this,Je).geometry3DMap.has(e)&&!A(this,Je).geometry2DMap.has(e)){let s=new da(e);A(this,Ny).call(this,s,()=>{A(this,la).call(this),A(this,yl).call(this)}),s.userData.dirty=!0,A(this,Je).geometry3DMap.set(e,s);let l=typeof r=="function"?r(t.features[0]):r;(l==null?void 0:l.altitude)!=null&&(s.position.z=l.altitude);for(let c of t.features){if(c.geometry==null||!["Polygon","MultiPolygon","LineString","MultiLineString"].includes(c.geometry.type))continue;let h=(c==null?void 0:c.id)||((n=c==null?void 0:c.properties)==null?void 0:n.id)||Pi(),d={color:py};if(typeof r=="function")d=(a=r(c))!=null?a:{color:py};else{let f=r||{color:py},{visible:m,altitude:g}=f;d=Co(f,["visible","altitude"])}let p=A(this,at).meshOptimizationSystem.createEntityFromFeature(h,c,ze({outline:!0},d));A(this,Je).geometry3DMap.set(h,p),s.userData.entities3D.add(h),A(this,at).textureSystem.dirty=!0}(l==null?void 0:l.__EXPERIMENTAL_maskEnabled)===!0&&g6(s,{enabled:l.__EXPERIMENTAL_maskEnabled,maskId:l.__EXPERIMENTAL_maskId,effect:l.__EXPERIMENTAL_maskEffect,mode:l.__EXPERIMENTAL_maskMode}),s.setVisible((o=l==null?void 0:l.visible)!=null?o:!0);let u=this.getParentContainer(i);u instanceof Vi&&u.addEntity(s),A(this,at).panBoundsSystem.dirty=!0,A(this,la).call(this),this.render()}else rt.error("Geometry group with ID '".concat(e,"' already exists. The geometry group cannot be added."));return A(this,at).outlineInterpolationSystem.geometries3DDirty=!0,{id:e,type:"geometry-group"}}addOccluder(e,t){let r=this.getParentContainer(t),i=A(this,at).occlusion2DSystem.reserveOccluderId();return r==null||r.addOccluderFeature(e,i),i}addImage(e,t,r,i){var n;try{L6e(e,t,r)}catch(a){rt.error(a);return}if(!A(this,Je).geometry3DMap.has(e)&&!A(this,Je).geometry2DMap.has(e)){let a=new O6e(t),o=new ln(a,new dA(r));o.id=e||Pi(),a.mesh.userData={entityId:o.id,type:"path"},A(this,Je).geometry3DMap.set(o.id,o);let s=this.getParentContainer(i);s instanceof Vi&&s.addEntity(o);let l=t.geometry.coordinates;if(l){let u=this.convertTo3DMapPosition(l[1],l[0],(n=l[2])!=null?n:0);A(this,at).panBoundsSystem.expandBoundsIfOutside(u)}A(this,la).call(this),this.render()}else rt.error("Image with ID '".concat(e,"' already exists. The image cannot be added."));return{id:e,type:"image"}}addModelGroup(e,t,r,{parent:i,onComplete:n}={}){var a,o,s,l;try{qUe(e,t,r)}catch(u){rt.error(u);return}if(!A(this,Je).geometry3DMap.has(e)&&!A(this,Je).geometry2DMap.has(e)){let u=new da(e);A(this,Ny).call(this,u,()=>{A(this,la).call(this),A(this,yl).call(this)}),A(this,Je).geometry3DMap.set(e,u),u.userData.dirty=!0,u.userData.modelURL=r.url;for(let d of t.features){let p=d.id||d.properties.id||Pi(),f=A(this,at).modelSystem.createModelFromFeature(p,d,ze({},r));(d.properties.interactive!==void 0||r.interactive!=null)&&io(f,(a=d.properties.interactive)!=null?a:r.interactive,A(this,Je)),r.clippingPlaneZOffset!=null&&(f.components[7]=new IC,f.components[7].verticalOffset=r.clippingPlaneZOffset,r.clippingPlaneTopColor!=null&&(f.components[7].topColor=r.clippingPlaneTopColor),r.clippingPlaneTopVisible!=null&&(f.components[7].topVisible=r.clippingPlaneTopVisible)),f.parentId=u.userData.entityId,A(this,Je).geometry3DMap.set(p,f),u.userData.entities3D.add(p)}let c=this.getParentContainer(i);c instanceof Vi&&c.addEntity(u);let h=(o=t.features[0])==null?void 0:o.geometry.coordinates;if(h){let d=this.convertTo3DMapPosition(h[1],h[0],(s=h[2])!=null?s:0);A(this,at).panBoundsSystem.expandBoundsIfOutside(d)}A(this,la).call(this),(l=this.render())==null||l.then(n)}else rt.error("Model group with ID '".concat(e,"' already exists. The model group cannot be added."));return{id:e,type:"geometry-group"}}addMarker2D(e,t,r,i){var n;let a=r==null?void 0:r.id;try{tie(e,t,r||{})}catch(o){rt.error(o);return}if(a===void 0||!A(this,Je).geometry2DMap.has(a)&&!A(this,Je).geometry3DMap.has(a)){let o=yt(this,mc,O8).call(this,e,new lp(t,r),r==null?void 0:r.occluderId,r==null?void 0:r.verticalOffset);o.id=a||String(o.id),a=o.id,(r==null?void 0:r.interactive)!=null&&r.interactive!=="pointer-events-auto"&&io(o,r==null?void 0:r.interactive,A(this,Je)),(r==null?void 0:r.enabled)!=null&&TC(o,r.enabled),(r==null?void 0:r.occlude)!=null&&v_(o,r.occlude);let s=typeof(r==null?void 0:r.attachTo)=="string"||typeof(r==null?void 0:r.attachTo)=="number"?A(this,Je).geometry3DMap.get(r.attachTo):void 0;s instanceof ln&&s.attach(o),(n=this.getParentContainer(i))==null||n.addEntity(o),A(this,at).panBoundsSystem.expandBoundsIfOutside(o.object3d.position),this.render()}else rt.error("Marker2D with ID '".concat(a,"' already exists. The marker cannot be added."));return{id:a,type:"marker"}}addText3D(e,t,r,i){var n;if(!A(this,Je).geometry3DMap.has(e)&&!A(this,Je).geometry2DMap.has(e)){let a=new y_(bt(ze({},t),{properties:bt(ze({},t.properties),{id:e,content:t.properties.text})})),o=new ln(a,new LC(r==null?void 0:r.appearance));o.id=e,a.mesh.userData.entityId=e.toString(),a.mesh.userData.type="text3d",A(this,Je).geometry3DMap.set(e,o);let s=this.getParentContainer(i);s instanceof Vi&&s.addEntity(o);let l=t.geometry.coordinates;if(l){let u=this.convertTo3DMapPosition(l[1],l[0],(n=l[2])!=null?n:0);A(this,at).panBoundsSystem.expandBoundsIfOutside(u)}A(this,la).call(this),this.render()}else rt.error("Text3D with ID '".concat(e,"' already exists. The text3d cannot be added."));return{id:e,type:"text3d"}}labelText3D(e,t,r={}){var i,n;try{if(!t||!e)throw new Error("content and meshGeometryId are required");aie.parse(r)}catch(u){rt.error(u);return}let a=A(this,Je).geometry3DMap.get(e);if((a==null?void 0:a.type)!=="geometry"){rt.error(".labelText3D failed: target incorrect");return}let o=a==null?void 0:a.components[0];if(!o.feature.properties.textArea)return;if(o.textEntityId){let u=A(this,Je).geometry3DMap.get(o.textEntityId);if((u==null?void 0:u.type)!=="text3d"){rt.error(".labelText3D failed: existing text3d not found");return}return{id:u.id,type:u.type}}let s=new y_({type:"Feature",geometry:{coordinates:(i=o.feature.properties.textArea)==null?void 0:i.position,type:"Point"},properties:{textArea:o.feature.properties.textArea,content:t,id:Pi()}});s.polygonEntityId=e;let l=new ln(s,new LC(r==null?void 0:r.appearance));return o.textEntityId=l.id.toString(),s.mesh.userData.entityId=l.id.toString(),s.mesh.userData.type="text3d",A(this,Je).geometry3DMap.set(l.id.toString(),l),r.parentId&&((n=this.getParentContainer(r.parentId))==null||n.addEntity(l)),this.render(),{id:l.id,type:"text3d"}}addLabel2D(e,t,r,i){var n;let a=r==null?void 0:r.id;try{eie(e,t,r||{})}catch(o){rt.error(o);return}if(a===void 0||!A(this,Je).geometry2DMap.has(a)&&!A(this,Je).geometry3DMap.has(a)){let o=yt(this,mc,O8).call(this,e,new sp(t,r||{},A(this,Je).pixelRatio),r==null?void 0:r.occluderId,r==null?void 0:r.verticalOffset);o.id=a||String(o.id),a=o.id,(r==null?void 0:r.interactive)!=null&&io(o,r==null?void 0:r.interactive,A(this,Je)),(r==null?void 0:r.enabled)!=null&&TC(o,r.enabled),(r==null?void 0:r.occlude)!=null&&v_(o,r.occlude);let s=typeof(r==null?void 0:r.attachTo)=="string"||typeof(r==null?void 0:r.attachTo)=="number"?A(this,Je).geometry3DMap.get(r.attachTo):void 0;s instanceof ln&&s.attach(o),(n=this.getParentContainer(i))==null||n.addEntity(o),A(this,at).panBoundsSystem.expandBoundsIfOutside(o.object3d.position),A(this,yl).call(this),this.render()}else rt.error("Label2D with ID '".concat(a,"' already exists. The label cannot be added."));return{id:a,type:"label"}}addPath(e,t={},r){var i,n;try{BUe(e,t||{})}catch(l){rt.error(l);return}let a=new sB(e,y6(t)),o=new ln(a,new dA({color:(i=t==null?void 0:t.color)!=null?i:"#ff834c",altitude:(n=t==null?void 0:t.verticalOffset)!=null?n:.1}));o.id=(t==null?void 0:t.id)||Pi(),a.mesh.userData={entityId:o.id,type:"path"},A(this,Je).geometry3DMap.set(o.id,o),(t==null?void 0:t.interactive)!=null&&io(o,t==null?void 0:t.interactive,A(this,Je));let s=this.getParentContainer(r);return s instanceof Vi&&s.addEntity(o),A(this,at).panBoundsSystem.dirty=!0,A(this,la).call(this),this.render(),{id:o.id,type:"path"}}updateWatermark(e){A(this,at).watermarkSystem.options=e,A(this,at).watermarkSystem.dirty=!0,A(this,at).twoDEntitySystem.setCollidersDirty(),this.render()}remove(e){var t,r,i;let n;if(typeof e=="string"||typeof e=="number"?(n=A(this,Je).geometry2DMap.get(e),n==null&&(n=A(this,Je).geometry3DMap.get(e))):typeof e.id=="string"||typeof e.id=="number"?(n=A(this,Je).geometry2DMap.get(e.id),n==null&&(n=A(this,Je).geometry3DMap.get(e.id))):n=e,n!=null){if(n.type==="custom-geometry")A(this,Je).geometry3DMap.delete(n.id),n.object3d&&wo(n.object3d);else if(n.type==="group-container"){A(this,Je).geometry3DMap.delete(n.userData.entityId);for(let a of n.childrenIds.values())this.remove(a),n.userData.entities2D.delete(a);wo(n)}else if(n.type==="geometry-group"){A(this,Je).geometry3DMap.delete(n.userData.entityId);for(let a of n.userData.entities3D.values())this.remove(a),n.userData.entities3D.delete(a);wo(n)}else if(n.type==="geometry"||n.type==="model"||n.type==="path"){let a=n.components[0];if(n.entities2D.size>0){for(let s of n.entities2D.values())this.remove(s);n.removeAllEntities()}let o=(r=(t=n.parentObject3D)==null?void 0:t.userData.entityId)!=null?r:n.parentId;if(o){let s=A(this,Je).geometry3DMap.get(o);s instanceof da&&s.userData.entities3D.delete(n.id)}if(n.type==="model"){if(A(this,at).modelSystem.removeInstance(n)&&n.object3d&&wo(n.object3d),o){let s=A(this,Je).geometry3DMap.get(o);if(s instanceof da&&s.userData.entities3D.size===0){let l=!1;for(let u of s.children)if(u.children.length>0){let c=u.children[0];if(c.isInstancedMesh&&((i=c.count)!=null?i:0)>0){l=!0;break}}l||this.remove(o)}}}else n.object3d&&wo(n.object3d);if(n.type==="geometry"){let s=n.components[3];s&&(s.enabled=!1,s.dirty=!0)}"textMesh"in a&&a.textMesh!=null&&this.remove(a.textMesh.userData.entityId),A(this,Je).geometry3DMap.delete(n.id)}else if(n.type==="marker"||n.type==="label"){let a=n.attachedTo;if(a){let o=A(this,Je).geometry3DMap.get(a);o instanceof ln&&o.detach(n)}n.object3d&&wo(n.object3d),n.type==="label"&&A(this,at).twoDEntitySystem.deleteTextCacheEntry(n.id),A(this,Je).geometry2DMap.delete(n.id)}else if(n.type==="image")n.object3d&&wo(n.object3d),A(this,Je).geometry3DMap.delete(n.id);else if(n.type==="text3d"){wo(n.object3d);let{batchedText:a,textMesh:o,polygonEntityId:s}=n.components[0];if(o&&(a&&a.removeText(o),wo(o)),s){A(this,at).text3DSystem.remove(s);let l=A(this,Je).geometry3DMap.get(s);(l==null?void 0:l.type)==="geometry"&&(l.components[0].textMesh=void 0,l.components[0].textEntityId=void 0)}A(this,Je).geometry3DMap.delete(n.id)}A(this,la).call(this),A(this,yl).call(this),this.render()}}getScene(){return this.getState("__scene")}getThreeScene(){return A(this,Hn)}getThreeCamera(){return A(this,Yn)}setEnvironment(e){return Qe(this,null,function*(){if(A(this,Hn))if(e==="basic"){A(this,Fy)||xe(this,Fy,yt(this,mc,N8).call(this));let t=yield A(this,Fy);A(this,Hn).environment=t}else A(this,Hn).environment=null})}getEnvironment(){var e;return(e=A(this,Hn))!=null&&e.environment?"basic":!1}getCurrentSceneGLTF(e){return A(this,at).exporterSystem.getCurrentSceneGLTF(e)}getBoundingArea(e){(A(this,at).renderSystem.threeDdirty||A(this,at).renderSystem.twoDdirty)&&this.renderSync();let t=new Ei;if(e==null)t.setFromObject(A(this,Je).geometryScene);else{let r=cp(A(this,Je),e);if((r==null?void 0:r.type)==="geometry"&&(r==null?void 0:r.object3d)!=null){let i=r.components[0],n=i instanceof oo?i.geometry:void 0;i.mesh instanceof Ev&&n?(n.computeBoundingBox(),n.boundingBox&&t.union(n.boundingBox)):t.setFromObject(r.object3d)}else((r==null?void 0:r.type)==="geometry-group"||(r==null?void 0:r.type)==="group-container")&&(r==null?void 0:r.userData.entityId)!=null&&t.setFromObject(r)}if(vy(t))return jie(t).map(this.convert3DMapPositionToCoordinate)}hasState(e){return cp(A(this,Je),e)!=null}getState(e){var t,r,i,n,a,o,s,l,u,c,h,d,p,f,m,g,v,_,x,b,E,M,S,D,T,P,k,R,F,B,z,O;if(e==null)return{type:"map-view",hoverColor:A(this,Je).hoverColor,text3dHoverColor:A(this,Je).text3dHoverColor};let j=cp(A(this,Je),e);if((j==null?void 0:j.type)==="custom-geometry"){let Y=j.components[0],Z=j.components[1];return{id:j.id,type:"custom-geometry",visible:Z.visible,altitude:Z.altitude,parent:(t=j.parentObject3D)==null?void 0:t.userData.entityId,position:this.convert3DMapPositionToCoordinate(Y.position)}}else if((j==null?void 0:j.type)==="geometry-group"){let Y=Array.from(j.userData.entities3D.values()),Z=Y==null?void 0:Y[0],ne=Z?this.getState(Z):{},ie=A(this,Je),le=this.convert3DMapPositionToCoordinate;return{id:j.userData.entityId,type:"geometry-group",visible:j.visible,altitude:j.position.z,initialColor:ne==null?void 0:ne.initialColor,color:ne==null?void 0:ne.color,side:(r=ne==null?void 0:ne.side)!=null?r:"double",opacity:ne==null?void 0:ne.opacity,height:ne==null?void 0:ne.height,texture:ne==null?void 0:ne.texture,topColor:ne==null?void 0:ne.topColor,topTexture:ne==null?void 0:ne.topTexture,interactive:Array.from(j.userData.entities3D.values()).map(X=>A(this,Je).geometry3DMap.get(X)).every(X=>X&&X.components[2]!=null),children:Y,bevel:ne==null?void 0:ne.bevel,maskId:(i=j.components[0])==null?void 0:i.maskId,maskEnabled:(n=j.components[0])==null?void 0:n.enabled,maskEffect:(a=j.components[0])==null?void 0:a.effect,maskMode:(o=j.components[0])==null?void 0:o.mode,get position(){return Fie(j,ie,le)}}}else{if((j==null?void 0:j.type)==="group-container")return{id:j.userData.entityId,type:"group-container",visible:j.visible,altitude:(s=j.getWorldPosition(d7e).z)!=null?s:0,opacity:j.opacity,interactive:!!j.components[0],children:Array.from(j.childrenIds.values()).map(Y=>this.getState(Y)).filter(Boolean)};if((j==null?void 0:j.type)==="label"){let Y=j.components[0],Z=j.object3d.parent,ne=Z==null?void 0:Z.userData.entityId;return{id:j.id,type:"label",text:Y.text||"",parent:{id:ne,type:Z==null?void 0:Z.type},position:this.convert3DMapPositionToCoordinate(j.position),enabled:Y.enabled,visible:Y.visible,initialRank:yy(Y.initialRank),verticalOffset:j.verticalOffset,options:{rank:yy(Y.rank),appearance:Y.appearance,interactive:j.components[1]!=null,verticalOffset:j.verticalOffset,attachTo:j.attachedTo,occlude:(u=(l=j.components[2])==null?void 0:l.enabled)!=null?u:!1}}}else if((j==null?void 0:j.type)==="marker"){let Y=j.components[0],Z=j.object3d.parent,ne=Z==null?void 0:Z.userData.entityId;return{id:j.id,type:"marker",enabled:Y.enabled,visible:Y.visible,placement:Y.options.placement,dynamicResize:Y.options.dynamicResize,parent:{id:ne,type:Z==null?void 0:Z.type},position:this.convert3DMapPositionToCoordinate(j.position),element:Y.containerEl,initialRank:yy(Y.initialRank),contentHTML:Y.contentHtml,options:{rank:yy(Y.rank),interactive:j.components[1]!=null||!1,verticalOffset:j.verticalOffset,attachTo:j.attachedTo,lowPriorityPin:Y.options.lowPriorityPin,occlude:(h=(c=j.components[2])==null?void 0:c.enabled)!=null?h:!1,zIndex:Y.options.zIndex}}}else if((j==null?void 0:j.type)==="geometry"){let{color:Y,hoverColor:Z,initialColor:ne,initialTopColor:ie,topColor:le,altitude:X}=j.components[1],ce=j.components[0],ge=j.components[4],be=j.components[1],_e=j.components[6],ke=j.components[2],Ye=j.components[3],We=j.parentObject3D;return{id:j.id,type:"geometry",opacity:be.opacity,initialColor:ne,color:Y,focusable:ge!=null&&ge.vertices!=null&&ge.vertices.length>0,initialTopColor:ie,topColor:le,side:be.side,hoverColor:Z,hovered:!!(ke!=null&&ke.hover),height:be.height,visible:be.visible,outline:Ye==null?void 0:Ye.enabled,showImage:be.showImage,texture:(d=_e==null?void 0:_e.texture)==null?void 0:d.path,topTexture:(p=_e==null?void 0:_e.topTexture)==null?void 0:p.path,flipImageToFaceCamera:be.flipImageToFaceCamera,enableImageCollisions:be.enableImageCollisions,parent:{id:We==null?void 0:We.userData.entityId,type:We==null?void 0:We.type},altitude:X,bevel:be.bevel,position:this.convert3DMapPositionToCoordinate(ce.position),interactive:j.components[2]!=null,borderVisible:be.borderVisible,borderColor:be.borderColor,borderWidth:be.borderWidth}}else if((j==null?void 0:j.type)==="model"){let Y=j.components[0],Z=j.components[1],ne=j.components[2],ie=j.components[7],le=Y.feature.geometry.coordinates,X=[le[0],le[1],(f=le[2])!=null?f:0];return{id:j.id,type:"model",position:X,interactive:ne!=null,material:Z.material,parent:(m=j.parentObject3D)!=null&&m.parent?{id:j.parentObject3D.parent.userData.entityId,type:j.parentObject3D.parent.type}:void 0,visible:Z.visible,verticalOffset:Z.verticalOffset,color:Z.color,opacity:Z.opacity,rotation:(g=Z.rotation)!=null?g:wy,scale:(v=Z.scale)!=null?v:by,clippingPlaneZOffset:(_=ie==null?void 0:ie.verticalOffset)!=null?_:Z.clippingPlaneZOffset,clippingPlaneTopColor:(x=ie==null?void 0:ie.topColor)!=null?x:Z.clippingPlaneTopColor,clippingPlaneTopVisible:(b=ie==null?void 0:ie.topVisible)!=null?b:Z.clippingPlaneTopVisible}}else if((j==null?void 0:j.type)==="path"){let Y=j.components[0],Z=j.components[2],ne=j.components[1];return{id:j.id,type:"path",position:this.convert3DMapPositionToCoordinate(Y.position),visible:ne.visible,interactive:Z!=null,completeFraction:Y.completeFraction,color:ne.color,accentColor:Y.accentColor,width:Y.width,animateArrowsOnPath:Y.animateArrowsOnPath,displayArrowsOnPath:Y.displayArrowsOnPath,verticalOffset:ne.altitude,highlightCompleteFraction:Y.highlightCompleteFraction,highlightStartFraction:Y.highlightStartFraction,highlightEndFraction:Y.highlightEndFraction,highlightColor:Y.highlightColor,highlightWidthMultiplier:Y.highlightWidthMultiplier,xrayOpacity:Y.xrayOpacity,smoothingTension:Y.smoothingTension,smoothingCornerRadius:Y.smoothingCornerRadius,dashed:Y.dashed,dashLength:Y.dashLength,dashGap:Y.dashGap,dashRelativeToWidth:Y.dashRelativeToWidth,dashSize:Y.dashSize,gapSize:Y.gapSize,dashAbsolute:Y.dashAbsolute,dashMeters:Y.dashMeters,gapMeters:Y.gapMeters,__EXPERIMENTAL_GEOMETRY:Y.__EXPERIMENTAL_GEOMETRY,__EXPERIMENTAL_ENDCAP_EXTENSION:Y.__EXPERIMENTAL_ENDCAP_EXTENSION,__EXPERIMENTAL_BILLBOARDING:Y.__EXPERIMENTAL_BILLBOARDING,__EXPERIMENTAL_BORDER:Y.__EXPERIMENTAL_BORDER,__EXPERIMENTAL_PREVENT_SELF_OVERLAP:Y.__EXPERIMENTAL_PREVENT_SELF_OVERLAP}}else if((j==null?void 0:j.type)==="image"){let Y=j.components[0];return{id:j.id,type:"image",position:this.convert3DMapPositionToCoordinate(Y.position),visible:j.components[1].visible,verticalOffset:(E=Y.feature.properties.verticalOffset)!=null?E:0,opacity:j.components[1].opacity,flipImageToFaceCamera:j.components[1].flipImageToFaceCamera,width:(M=Y.feature.properties.width)!=null?M:0,height:(S=Y.feature.properties.height)!=null?S:0,rotation:(D=Y.feature.properties.rotation)!=null?D:0}}else if((j==null?void 0:j.type)==="text3d"&&j.components[0]instanceof y_){Pie(j);let Y=j.components[0],Z=j.components[1],{textMesh:ne}=Y,ie=Y.feature.properties,le=(T=Y.mesh)==null?void 0:T.parent;le instanceof Vi&&((P=le.children.find(be=>be.type==="batchedtext"))==null||P.getWorldPosition(A(this,PB))),A(this,j_).set(0,0,0);let X=ne?ne.getWorldPosition(A(this,j_)):A(this,j_),ce=(F=(R=ie.rotation)!=null?R:(k=ie.textArea)==null?void 0:k.rotation)!=null?F:0,ge=(z=(B=ie.content)!=null?B:ie.text)!=null?z:"";return Object.assign({},Si,Z.getState(),{id:j.id,type:"text3d",position:this.convert3DMapPositionToCoordinate(X.add(A(this,PB))),visible:(O=Y.visible)!=null?O:!1,content:ge,rotation:ce})}else return}}getRenderedState(e){let t=typeof e=="string"||typeof e=="number"?e:e.id,r=cp(A(this,Je),t);if(r&&r.type==="label")return{textVisible:r.components[0].textVisible}}setState(e,t){var r,i,n,a,o,s,l;if(typeof e=="object"&&t==null){"hoverColor"in e&&(Cx(e.hoverColor)?A(this,Je).hoverColor=(r=e.hoverColor)!=null?r:A(this,Je).hoverColor:rt.warn('Failed to update global hover color. Invalid color "'.concat(e.hoverColor,'".'))),"text3dHoverColor"in e&&(A(this,Je).text3dHoverColor=(i=e.text3dHoverColor)!=null?i:A(this,Je).text3dHoverColor);return}let u=cp(A(this,Je),e);if(u!=null){if(u.type==="custom-geometry"){let c=A(this,Je).geometry3DMap.get(u.id);if(c instanceof ln&&c.components[0]instanceof j6){let h=t;hc(u,A(this,Je),h.visible),_y(u,A(this,Je),h.altitude),h6(u,h.position,this.convertTo3DMapPosition,A(this,at).panBoundsSystem),d6(u,this.getParentContainer(h.parent,!1)),io(u,h.interactive,A(this,Je))&&A(this,la).call(this)}}else if(u.type==="path"){let c=t;io(u,c.interactive,A(this,Je))&&A(this,la).call(this),_y(u,A(this,Je),c.verticalOffset),Tie(u,A(this,Je),c)}else if(u.type==="model"){let c=t;io(u,c.interactive,A(this,Je))&&A(this,la).call(this),hc(u,A(this,Je),c.visible),kie(u,c,this.convertTo3DMapPosition,A(this,at).panBoundsSystem),Rie(u,c)}else if(u.type==="group-container"){let c=t;hc(u,A(this,Je),c.visible)&&(A(this,at).pathSystem.verticalDistanceDirty=!0,A(this,at).geometryInFocusSystem.focusablesDirty=!0),_y(u,A(this,Je),c.altitude)&&(A(this,at).pathSystem.verticalDistanceDirty=!0),io(u,c.interactive,A(this,Je))&&A(this,la).call(this),x_(u,A(this,Je),c.opacity)&&(A(this,at).outlineInterpolationSystem.outlineOpacitiesDirty=!0),c.preloadGeometry&&u.userData.preloadGeometry!==!0&&(u.userData.preloadGeometry=!0,A(this,at).outlineInterpolationSystem.geometries3DDirty=!0),DC(u,c.focusable)&&(A(this,at).geometryInFocusSystem.focusablesDirty=!0)}else if(u.type==="geometry-group"){let c=t;hc(u,A(this,Je),c.visible),mie(u,A(this,Je),c),PC(u,A(this,Je),c.outline),c.height!=null&&CC(u,A(this,Je),c.height),c.altitude!=null&&(u.position.z=c.altitude),f6(u,A(this,Je),c)&&(A(this,at).textureSystem.dirty=!0),f6(u,A(this,Je),c),gie(u,A(this,Je),c.shading),x_(u,A(this,Je),c.opacity)&&(A(this,at).outlineInterpolationSystem.outlineOpacitiesDirty=!0),io(u,c.interactive,A(this,Je))&&(A(this,la).call(this),A(this,yl).call(this)),kC(u,A(this,Je),c.side),g6(u,{maskId:c.maskId,enabled:c.maskEnabled,effect:c.maskEffect,mode:c.maskMode}),m6(u,A(this,Je),{effectStart:c.effectStart,effectDistance:c.effectDistance,darkenAmount:c.darkenAmount,darkenUseDepth:c.darkenUseDepth,desaturateAmount:c.desaturateAmount,desaturateUseDepth:c.desaturateUseDepth,washOutAmount:c.washOutAmount,washOutUseDepth:c.washOutUseDepth}),c.position!=null&&(u.userData.centroid=[c.position[0],c.position[1]],u.userData.positionDirty=!0)}else if(u.type==="geometry"){if(u.components[0]instanceof oo){let c=t;if(hc(u,A(this,Je),c.visible)&&A(this,la).call(this),PC(u,A(this,Je),c.outline),yie(u,c),DC(u,c.focusable)&&(A(this,at).geometryInFocusSystem.focusablesDirty=!0),Cie(u,c.renderOrder)&&(A(this,at).meshDetachmentSystem.dirty=!0),Iie(u,c.opacity)&&(A(this,at).meshDetachmentSystem.dirty=!0,A(this,at).interactionSystem.dirty3D=!0,A(this,at).outlineInterpolationSystem.outlineOpacitiesDirty=!0),p6(u,c.flipImageToFaceCamera),Mie(u,c.enableImageCollisions),_y(u,A(this,Je),c.altitude)){let h=u.components[1],d=((n=h.altitude)!=null?n:0)+((a=h.height)!=null?a:0);A(this,at).panBoundsSystem.expandBoundsIfOutside(new fe(0,0,d)),A(this,at).shadowsSystem&&(A(this,at).shadowsSystem.needsRender=!0)}if(c.height!=null&&CC(u,A(this,Je),c.height)){let h=u.components[1],d=((o=h.altitude)!=null?o:0)+((s=h.height)!=null?s:0);A(this,at).panBoundsSystem.expandBoundsIfOutside(new fe(0,0,d)),A(this,at).shadowsSystem&&(A(this,at).shadowsSystem.needsRender=!0)}A6(u,c)&&(A(this,at).meshDetachmentSystem.dirty=!0,A(this,at).textureSystem.dirty=!0),BC(u,c,(l=A(this,Je).outlinesOptions)==null?void 0:l.darkenFactor),wie(u,c.hoverColor),io(u,c.interactive,A(this,Je))&&(A(this,at).interactionSystem.dirty3D=!0),Eie(u,c.hovered),kC(u,A(this,Je),c.side),Bie(u,c)}}else if(u.type==="label"||u.type==="marker"){let c=t;_ie(u,c,A(this,Je)),vie(u,c,A(this,Je))&&(A(this,yl).call(this),A(this,at).twoDEntitySystem.markDirty()),h6(u,c.position,this.convertTo3DMapPosition,A(this,at).panBoundsSystem),d6(u,this.getParentContainer(c.parent,!1))&&(A(this,yl).call(this),A(this,at).panBoundsSystem.dirty=!0),TC(u,c.enabled),hc(u,A(this,Je),c.visible)}else if(u.type==="image"){let c=t;hc(u,A(this,Je),c.visible),x_(u,A(this,Je),c.opacity),p6(u,c.flipImageToFaceCamera)}else if(u.type==="text3d"){let c=t;Die(u,A(this,Je),c)}this.render()}}convertTo3DMapPosition(e,t,r=0,i){var n,a,o,s,l;if(Array.isArray(e))return this.convertTo3DMapPosition(e[1],e[0],(n=e[2])!=null?n:r,typeof t=="function"?t:void 0);if(typeof t!="number")throw new Error("convertTo3DMapPosition failed: longitude must be a number");let{x:u,y:c}=b6((o=(a=A(this,Je).center)==null?void 0:a[1])!=null?o:0,(l=(s=A(this,Je).center)==null?void 0:s[0])!=null?l:0,e,t);return i?(i.set(u,c,r),i):new fe(u,c,r)}get backgroundColor(){return typeof A(this,Ba).backgroundColor=="string"?A(this,Ba).backgroundColor:"#".concat(A(this,Ba).backgroundColor.getHexString())}get backgroundAlpha(){return A(this,Ba).backgroundAlpha}getThreeRenderer(){return A(this,Ba)}getCenter(e){let t=Array.isArray(e)?e:this.getBoundingArea(e);return t?Wie(t):void 0}isInView(e){let t=cp(A(this,Je),e);if(A(this,BB).identity().multiply(A(this,Yn).projectionMatrix).multiply(A(this,Yn).matrixWorldInverse),A(this,Uy).setFromProjectionMatrix(A(this,BB)),t instanceof iA)return A(this,Uy).containsPoint(t.position);if(t instanceof ln){let r=t==null?void 0:t.components[0];if(r instanceof j6||r instanceof fB)return A(this,Uy).containsPoint(this.convertTo3DMapPosition(r.feature.geometry.coordinates));if(r instanceof oo){let i=new Ei(this.convertTo3DMapPosition(r.featureBbox[1],r.featureBbox[0],0),this.convertTo3DMapPosition(r.featureBbox[3],r.featureBbox[2],0));return A(this,Uy).intersectsBox(i)}}return!1}queryGeometry2DInView(e){let{screenOffsets:t,fullyContains:r}=e!=null?e:{},[i,n,a,o]=Jie(this.container,t),s=new bp(i,n,a,o);return A(this,at).twoDEntitySystem.visibleCollidersQTree.queryRect(s).filter(l=>r?s.contains(l):s.intersects(l)).map(l=>A(this,Je).geometry2DMap.get(l.userData.entityId)).filter(l=>l!=null).filter(l=>l.components[0]instanceof sp||l.components[0]instanceof lp).map(l=>l.id.toString())}onMapLibreEvent(e,t){if(!this.map){rt.warn('Tried to add event listener "'.concat(e,'" but MapLibre map is not initialized.'));return}let r=this.map.on(e,t);r!=null&&r.unsubscribe&&this.onAbort(()=>r.unsubscribe())}offMapLibreEvent(e,t){this.map&&this.map.off(e,t)}getSystems(){return A(this,at)}getInternalState(){return A(this,Je)}getInternalTweenGroup(){return A(this,Je).internalTweenGroup}getExternalTweenGroup(){return A(this,Je).externalTweenGroup}computeMinZOffsetBetweenContainers(e,t,r){if(!e||!t)return-1;K_(e,"group-container"),K_(t,"group-container"),e.updateMatrixWorld(!0),t.updateMatrixWorld(!0);let i=zC(e,this.getThreeCamera()),n=t.clone(!0);xh(n,!0),n.updateMatrixWorld();let a=zC(n,this.getThreeCamera());if(!vy(i)||!vy(a))return-1;let o=0,s;r&&this.container.querySelectorAll(".debug-box").forEach(l=>l.remove());do{if(o>1e4)return-1;if(o+=20,n.setAltitude(o),a.makeEmpty(),zC(n,A(this,Yn),a),s=i.intersectsBox(a),r){let l=I6(i,"blue",this.container),u=I6(a,s?"red":"green",this.container);l.classList.add("debug-box"),u.classList.add("debug-box")}}while(s);return o}};Hn=new WeakMap,Yn=new WeakMap,Fy=new WeakMap,zy=new WeakMap,N_=new WeakMap,_A=new WeakMap,Ly=new WeakMap,Oy=new WeakMap,mc=new WeakSet,P8=function(e){var t;A(this,xp)!=="outdoors-overlay"&&((t=this.map)==null||t.setPixelRatio(e)),A(this,Je).pixelRatio=this.resolutionScale},Je=new WeakMap,Aa=new WeakMap,bA=new WeakMap,fs=new WeakMap,Ba=new WeakMap,at=new WeakMap,D8=new WeakMap,yl=new WeakMap,la=new WeakMap,k8=new WeakMap,Ny=new WeakMap,$ae=function(){xe(this,Aa,document.createElement("div")),A(this,Aa).classList.add("mappedin__smart-collision-engine__container"),xe(this,bA,document.createElement("canvas")),A(this,bA).classList.add("mappedin__smart-collision-engine-debug__container"),this.container.appendChild(A(this,Aa)),xe(this,fs,document.createElement("canvas")),A(this,fs).classList.add("mappedin__smart-collision-engine__container"),A(this,fs).width=A(this,Aa).clientWidth*this.resolutionScale,A(this,fs).height=A(this,Aa).clientHeight*this.resolutionScale,A(this,fs).style.width=A(this,Aa).clientWidth+"px",A(this,fs).style.height=A(this,Aa).clientHeight+"px",A(this,Aa).appendChild(A(this,bA)),A(this,Aa).appendChild(A(this,fs)),A(this,bA).width=A(this,Aa).clientWidth,A(this,bA).height=A(this,Aa).clientHeight,A(this,fs).width=A(this,Aa).clientWidth*this.resolutionScale,A(this,fs).height=A(this,Aa).clientHeight*this.resolutionScale,A(this,fs).style.width=A(this,Aa).clientWidth+"px",A(this,fs).style.height=A(this,Aa).clientHeight+"px"},eoe=function(){A(this,at).twoDEntitySystem.markDirty()},xp=new WeakMap,R8=new WeakMap,MB=new WeakMap,F8=new WeakMap,z8=new WeakMap,U_=new WeakMap,Q_=new WeakMap,L8=new WeakMap,SB=new WeakMap,IB=new WeakMap,CB=new WeakMap,O8=function(e,t,r,i){let n=new iA(t,this.convertTo3DMapPosition(e[1],e[0],e[2]||0),i);return n.components[2]=new wQe(r!=null?r:A(this,at).occlusion2DSystem.backgroundId),A(this,Je).geometry2DMap.set(n.id,n),n},Uy=new WeakMap,BB=new WeakMap,TB=new WeakMap,gp=new WeakMap,yp=new WeakMap,N8=function(){return Qe(this,null,function*(){return QB.load(qNe).then(e=>{var t;return A(this,Hn)&&((t=A(this,Hn).environment)==null||t.dispose(),e.mapping=pv,A(this,Hn).environment=e,this.render()),e})})},U8=new WeakMap,Di=new WeakMap,j_=new WeakMap,PB=new WeakMap;d7e=new fe,G_=h7e;H();H();jB=class extends Ki{constructor(e,t){super(),I(this,"gl"),I(this,"options"),I(this,"el",document.createElement("div")),I(this,"core"),I(this,"origin"),I(this,"map"),I(this,"layer"),I(this,"handleStyleChange",()=>{!this.map||!this.layer||this.map.getLayer(this.layer.id)||(this.map.addLayer(this.layer),this.core.camera.setMinZoomLevel(this.map.getMinZoom()),this.core.camera.setMaxZoomLevel(this.map.getMaxZoom()),this.core.camera.setMinPitch(this.map.getMinPitch()),this.core.camera.setMaxPitch(this.map.getMaxPitch()))}),I(this,"handleMove",()=>{if(!this.map)return;let[r,i]=this.map.getCenter().toArray();this.core.getSystems().cameraSystem.setCenter(r,i),this.core.getSystems().cameraSystem.setZoomLevel(this.map.getZoom()),this.core.getSystems().cameraSystem.setRotation(Zr.degToRad(this.map.getBearing())),this.core.getSystems().cameraSystem.setTilt(Zr.degToRad(this.map.getPitch()))}),I(this,"handleError",r=>{rt.warn(r)}),this.origin=e,this.options=t}onAdd(e){this.origin=this.origin||e.getCenter().toArray(),this.gl=e.painter.context.gl,this.core=new G_(e._container,bt(ze({},this.options),{center:this.origin,zoomLevel:e.getZoom(),pitch:e.getPitch(),bearing:e.getBearing(),gl:this.gl,map:e,mode:"outdoors-overlay"})),this.map=e,this.core.camera.setMinZoomLevel(e.getMinZoom()),this.core.camera.setMaxZoomLevel(e.getMaxZoom()),this.core.camera.setMinPitch(e.getMinPitch()),this.core.camera.setMaxPitch(e.getMaxPitch()),this.map.on("error",this.handleError);let t=Gi.fromLngLat(this.origin,0);return this.layer=$U(t,this.core.viewCamera,()=>{this.core.renderSync()}),this.map.on("styledata",this.handleStyleChange),this.map.on("move",this.handleMove),this.handleStyleChange(),this.el}onRemove(){this.map&&(this.map.off("styledata",this.handleStyleChange),this.map.off("move",this.handleMove),this.map.off("error",this.handleError),this.layer&&this.map.removeLayer(this.layer.id)),this.layer=void 0,this.map=void 0,this.core&&this.core.destroy(),this.core=void 0}};H();H();H();H();H();H();Cp=class{constructor({origin:e,destination:t,distance:r=0,angle:i=0,pathWeight:n=0,multiplicativeDistanceWeightScaling:a=!0}){if(I(this,"origin"),I(this,"destination"),I(this,"distance"),I(this,"angle"),I(this,"weight"),this.origin=e,this.destination=t,this.distance=r,this.angle=i,this.weight=n||0,a?e.properties.floor===t.properties.floor&&(this.weight=(this.weight>=0?this.distance*this.weight:0)+this.distance):e.properties.map===t.properties.map&&(this.weight=this.weight>=0?this.distance+this.weight:0),isNaN(this.angle))throw new Error("Invalid angle: Expected a numeric value, but received NaN.")}};H();H();H();H();H();H();H();H();H();H();iae=111e3;H();q8=.4,m7e=class{constructor({nodes:e,groupBy:t,multiplicativeDistanceWeightScaling:r}){he(this,gc),I(this,"edges",{}),I(this,"nodesById"),I(this,"nodesByGroup",new Map),he(this,Qy),I(this,"hasLineOfSight",(n,a,o=[],s=q8)=>CA({type:"Feature",properties:{id:"origin",neighbors:[]},geometry:{type:"Point",coordinates:n}},{type:"Feature",properties:{id:"destination",neighbors:[]},geometry:{type:"Point",coordinates:a}},o,s)===!0),he(this,j8,(n,a)=>{let o=0;for(let s of a)(!s[A(this,Qy)]||s[A(this,Qy)]===n.properties[A(this,Qy)])&&Ip(n.geometry.coordinates,s.geometry.geometry)&&(o+=Math.max(0,s.cost));return o}),xe(this,Qy,t);let{features:i}=e;this.nodesById=yt(this,gc,roe).call(this,i),yt(this,gc,ioe).call(this),yt(this,gc,noe).call(this,i,t,{multiplicativeDistanceWeightScaling:r})}getShortestEuclideanDistance(e,t){return t.reduce((r,i)=>{let n=YUe(e.geometry.coordinates,i.geometry.coordinates);return Math.min(r,n)},Number.MAX_VALUE)}dijkstraFindWithinTravelDistance(e,t,r,i,n,a){var o;let s=this.nodesById[e];if(!s)return[];let l=[],u={},c={},h=new Set,d=[];for(l.push({node:s,distance:0}),u[s.properties.id]=null,c[s.properties.id]=0;l.length>0;){l.sort((g,v)=>g.distance-v.distance);let p=l.shift();if(!p)break;let f=p.node,m=p.distance;if(!h.has(f.properties.id)){if(h.add(f.properties.id),d.length>=a)break;f.properties.id!=null&&r.includes((o=f.properties.id)==null?void 0:o.toString())&&(n?this.hasLineOfSight(s.geometry.coordinates,f.geometry.coordinates,i)&&d.push({feature:f,distance:m}):d.push({feature:f,distance:m}));for(let g of this.edges[f.properties.id]){let v=g.destination,_=m+g.distance,x=c[f.properties.id]+g.weight;_>t||h.has(v.properties.id)||c[v.properties.id]!==void 0&&x>=c[v.properties.id]||(c[v.properties.id]=x,u[v.properties.id]=g,l.push({node:v,distance:_}))}}}return d.sort((p,f)=>p.distance-f.distance)}aStar({originIds:e,destinationNodeIds:t,disabledConnectionNodeIds:r,zones:i,overrideEdgeWeights:n,disabledNodeIds:a}){var o;let s=yt(this,gc,Q8).call(this,e),l=yt(this,gc,Q8).call(this,t);if(s.length===0||l.length===0)return[];let{frontier:u,cameFrom:c,costSoFar:h}=yt(this,gc,aoe).call(this,s,l);for(;u.length>0;){let d=u.shift();if(!d)break;if(yt(this,gc,ooe).call(this,d.origin,l))return yt(this,gc,soe).call(this,c,d.origin.properties.id);for(let p of this.edges[d.origin.properties.id]){let f=(o=n==null?void 0:n.get(p))!=null?o:p.weight,m=p.destination.properties.map!==p.origin.properties.map,g=r==null?void 0:r.has(p.destination.properties.id);if(r!=null&&r.has(p.origin.properties.id)&&(m||g)||a!=null&&a.has(p.origin.properties.id))continue;let v=h[d.origin.properties.id]+f+A(this,j8).call(this,p.destination,i);if(v!==1/0&&(h[p.destination.properties.id]==null||v<h[p.destination.properties.id])){let _=v+this.getShortestEuclideanDistance(p.destination,l);h[p.destination.properties.id]=v,c[p.destination.properties.id]=p,u.push({origin:p.destination,priority:_})}}u.sort((p,f)=>p.priority-f.priority)}return[]}};Qy=new WeakMap,gc=new WeakSet,Q8=function(e){return e.map(t=>this.nodesById[t]).filter(Boolean)},roe=function(e){return e.reduce((t,r)=>(t[r.properties.id]=r,t),{})},ioe=function(){for(let e in this.nodesById)this.nodesById.hasOwnProperty(e)&&(this.nodesById[e].properties.neighbors=this.nodesById[e].properties.neighbors.filter(({id:t})=>!!this.nodesById[t]))},noe=function(e,t,r){e.forEach(i=>{let n=t==="default"?t:i.properties[t];this.nodesByGroup.has(n)||this.nodesByGroup.set(n,[]),this.nodesByGroup.get(n).push(i),this.edges[i.properties.id]=i.properties.neighbors.map(({id:a,weight:o})=>{let s=this.nodesById[a],l=So(i.geometry.coordinates,s.geometry.coordinates),u=cu(i.geometry.coordinates,s.geometry.coordinates);return new Cp({origin:i,destination:s,pathWeight:o,distance:l,angle:u,multiplicativeDistanceWeightScaling:r==null?void 0:r.multiplicativeDistanceWeightScaling})})})},aoe=function(e,t){let r=[],i={},n={};return e.forEach(a=>{let o=this.getShortestEuclideanDistance(a,t);r.push({origin:a,priority:o}),i[a.properties.id]=null,n[a.properties.id]=0}),r.sort((a,o)=>a.priority-o.priority),{frontier:r,cameFrom:i,costSoFar:n}},ooe=function(e,t){return t.some(r=>r.properties.id===e.properties.id)},soe=function(e,t){let r=[],i=e[t];for(;i;)r.push(i),i=e[i.origin.properties.id];return r.reverse()},j8=new WeakMap;H();H();v7e=qo(hae());H();x7e=EN("Navigator");H();_7e=.5;H();H();S7e=qo(hae());H();H();r8={accessible:"accessible",outdoors:"outdoors",public:"public"};H();H();H();B7e=e=>{if(e==="space"||e==="obstruction"||e==="entrance")return{}},T7e=/\\.json|\\.geojson$/,eB=(e,t,r)=>{let i=e[t];if(typeof i!="object"||Object.keys(i).length===0)return B7e(t);let n={};for(let[a,o]of Object.entries(i)){let s=a.replace(T7e,"");n[s]=JSON.parse(r(o))}return n},P7e=["floorstack.json","styles.json","shapes.json","mapstack.json","floor.geojson","tileset.json","location.json","category.json","navigationFlags.json","annotation-symbols.json"],D7e=P7e,k7e=["annotation","textAreas","enterprise","floorImages","shapeInstances","modelInstances","window","area","facade"],R7e=k7e,$8=e=>{let t=new TextDecoder("utf-8"),r=t.decode.bind(t),i={"manifest.geojson":JSON.parse(r(e["manifest.geojson"])),"mapstack.geojson":JSON.parse(r(e["mapstack.geojson"])),"map.geojson":JSON.parse(r(e["map.geojson"])),"node.geojson":JSON.parse(r(e["node.geojson"])),"connection.json":JSON.parse(r(e["connection.json"])),space:eB(e,"space",r),obstruction:eB(e,"obstruction",r),entrance:eB(e,"entrance",r)};for(let n of D7e)e[n]&&(i[n]=JSON.parse(r(e[n])));for(let n of R7e)e[n]&&(i[n]=eB(e,n,r));return i};H();H();H();eQ=["agriculture","airport","casino","city-district","convention-center","entertainment","event-centre","first-responder-building","government-building","grocery-store","healthcare","higher-education","hotel","library","manufacturing","medical-centre","mixed-use","multifamily","museum","office-building","oil-and-energy","other","parking-facility","religious-institution","resort","retail-store","schools-k-12","shopping-mall","stadium-or-arena","storage-facility","theme-park","transit","transportation-hub","warehousing"],ydt=[...eQ,"unknown"],F7e=Object.freeze(Object.fromEntries([...eQ,"unknown"].map(e=>[e,e])));H();tQ=["reference-point","checkpoint","checkpoint-passport","parent"],vdt=[...tQ,"unknown"],xdt=Object.freeze(Object.fromEntries([...tQ,"unknown"].map(e=>[e,e]))),rQ=["closed-temporarily","new","pop-up","coming-soon","relocated"],_dt=[...rQ,"unknown"],bdt=Object.freeze(Object.fromEntries([...rQ,"unknown"].map(e=>[e,e])));H();iQ=["left","center","right"],wdt=[...iQ,"unknown"],Edt=Object.freeze(Object.fromEntries([...iQ,"unknown"].map(e=>[e,e])));H();nQ=["near","center"],Mdt=[...nQ,"unknown"],Sdt=Object.freeze(Object.fromEntries([...nQ,"unknown"].map(e=>[e,e])));H();aQ=["top","side"],Idt=[...aQ,"unknown"],Cdt=Object.freeze(Object.fromEntries([...aQ,"unknown"].map(e=>[e,e]))),oQ=["inside","outside","both"],Bdt=[...oQ,"unknown"],Tdt=Object.freeze(Object.fromEntries([...oQ,"unknown"].map(e=>[e,e])));H();sQ=["elevator","escalator","travelator","stairs","door","ramp","ladder"],Pdt=[...sQ,"unknown"],uoe=Object.freeze(Object.fromEntries([...sQ,"unknown"].map(e=>[e,e])));H();lQ=["room","hallway","wall","object","poi","area","window"],Ddt=[...lQ,"unknown"],kdt=Object.freeze(Object.fromEntries([...lQ,"unknown"].map(e=>[e,e])));H();H();coe=class{constructor(e){I(this,"_value"),this._value=e}[Symbol.iterator](){return this}next(){if(this._value==null)return{done:!0,value:void 0};let e=this._value;return this._value=null,{done:!1,value:e}}},hoe=class{constructor(e){I(this,"_tag","Some"),I(this,"_value"),this._value=e}get value(){return this._value}isSome(){return!0}isSomeAnd(e){return e(this.value)}isNone(){return!1}equals(e){return e.isSome()&&e.value===this.value}expect(e){return this.value}unwrap(){return this.value}unwrapOr(e){return this.value}unwrapOrElse(e){return this.value}inspect(e){return e(this.value),this}inspectNone(e){return this}map(e){return aae(e(this.value))}mapAsync(e){return e(this.value).then(t=>aae(t))}mapOr(e,t){return this.map(e).unwrapOr(t)}mapOrAsync(e,t){return this.mapAsync(e).then(r=>r.unwrapOr(t))}mapOrElse(e,t){return this.map(e).unwrapOrElse(t)}mapOrElseAsync(e,t){return this.mapAsync(e).then(r=>r.unwrapOrElse(t))}and(e){return e}andThen(e){return e(this.value)}andThenAsync(e){return e(this.value)}filter(e){return e(this.value)?this:IA()}or(e){return this}orElse(e){return this}xor(e){return e.isSome()?IA():this}toString(){return"Some(".concat(this.value,")")}okOr(e){return BA(this.value)}okOrElse(e){return BA(this.value)}iter(){return new coe(this.value)}[Symbol.iterator](){return this.iter()}zip(e){return e.isSome()?tb([this.value,e.value]):IA()}zipWith(e,t){return e.isSome()?tb(t(this.value,e.value)):IA()}get[Symbol.toStringTag](){return"Some"}},doe=class{constructor(){I(this,"_tag","None")}get value(){return null}isSome(){return!1}isSomeAnd(e){return!1}isNone(){return!0}equals(e){return e.isNone()}expect(e){throw new Error(e)}unwrap(){throw new Error("Tried to unwrap a None value!")}unwrapOr(e){return e}unwrapOrElse(e){return e()}inspect(e){return this}inspectNone(e){return e(),this}map(e){return this}mapAsync(e){return Promise.resolve(this)}mapOr(e,t){return t}mapOrAsync(e,t){return Promise.resolve(t)}mapOrElse(e,t){return t()}mapOrElseAsync(e,t){return t()}and(e){return this}andThen(e){return this}andThenAsync(e){return Promise.resolve(this)}filter(e){return this}or(e){return e}orElse(e){return e()}xor(e){return e}toString(){return"None"}okOr(e){return OB(e)}okOrElse(e){return OB(e())}iter(){return new coe(null)}[Symbol.iterator](){return this.iter()}zip(e){return this}zipWith(e,t){return this}get[Symbol.toStringTag](){return"None"}},tb=e=>new hoe(e),IA=()=>new doe,aae=e=>e instanceof hoe||e instanceof doe?e:e==null?IA():tb(e),poe=class{constructor(e){I(this,"_value"),this._value=e}[Symbol.iterator](){return this}next(){if(this._value==null)return{done:!0,value:void 0};let e=this._value;return this._value=null,{done:!1,value:e}}},z7e=class{constructor(e){I(this,"_tag","Ok"),I(this,"_value"),this._value=e}get value(){return this._value}get error(){return null}isOk(){return!0}isOkAnd(e){return e(this.value)}isErr(){return!1}isErrAnd(e){return!1}ok(){return tb(this.value)}err(){return IA()}expect(e){return this.value}expectErr(e){throw new Error(e)}unwrap(){return this.value}unwrapOr(e){return this.value}unwrapOrElse(e){return this.value}inspect(e){return e(this.value),this}inspectErr(){return this}map(e){return BA(e(this.value))}mapAsync(e){return Qe(this,null,function*(){return e(this.value).then(BA)})}mapOr(e,t){return e(this.value)}mapOrAsync(e,t){return Qe(this,null,function*(){return e(this.value)})}mapOrElse(e,t){return e(this.value)}mapOrElseAsync(e,t){return Qe(this,null,function*(){return e(this.value)})}mapErr(e){return this}iter(){return new poe(this.value)}[Symbol.iterator](){return this.iter()}and(e){return e}andThen(e){return e(this.value)}or(e){return this}orElse(e){return this}andThenAsync(e){return Qe(this,null,function*(){return e(this.value)})}toString(){return"Ok(".concat(this.value,")")}get[Symbol.toStringTag](){return"Ok"}},L7e=class foe{constructor(t){I(this,"_tag","Err"),I(this,"_error"),this._error=t}get value(){return null}get error(){return this._error}isOk(){return!1}isOkAnd(t){return!1}isErr(){return!0}isErrAnd(t){return t(this.error)}ok(){return IA()}err(){return tb(this.error)}expect(t){throw new Error(t)}expectErr(t){return this.error}unwrap(){throw this.error}unwrapOr(t){return t}unwrapOrElse(t){return t()}inspect(){return this}inspectErr(t){return t(this.error),this}map(t){return this}iter(){return new poe(null)}[Symbol.iterator](){return this.iter()}mapAsync(t){return Qe(this,null,function*(){return this})}mapOr(t,r){return r}mapOrAsync(t,r){return Qe(this,null,function*(){return r})}mapOrElse(t,r){return r()}mapOrElseAsync(t,r){return Qe(this,null,function*(){return r()})}mapErr(t){return new foe(t(this.error))}and(t){return this}andThen(t){return this}andThenAsync(t){return Qe(this,null,function*(){return this})}or(t){return t}orElse(t){return t(this.error)}toString(){return"Err(".concat(this.error,")")}get[Symbol.toStringTag](){return"Err"}},BA=e=>new z7e(e),OB=e=>new L7e(e);H();Us=Uint8Array,Hy=Uint16Array,O7e=Int32Array,Aoe=new Us([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),moe=new Us([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),N7e=new Us([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),goe=function(e,t){for(var r=new Hy(31),i=0;i<31;++i)r[i]=t+=1<<e[i-1];for(var n=new O7e(r[30]),i=1;i<30;++i)for(var a=r[i];a<r[i+1];++a)n[a]=a-r[i]<<5|i;return{b:r,r:n}},yoe=goe(Aoe,2),voe=yoe.b,U7e=yoe.r;voe[28]=258,U7e[258]=28;xoe=goe(moe,0),Q7e=xoe.b,Rdt=xoe.r,G8=new Hy(32768);for(Oi=0;Oi<32768;++Oi)Sh=(Oi&43690)>>1|(Oi&21845)<<1,Sh=(Sh&52428)>>2|(Sh&13107)<<2,Sh=(Sh&61680)>>4|(Sh&3855)<<4,G8[Oi]=((Sh&65280)>>8|(Sh&255)<<8)>>1;J_=(function(e,t,r){for(var i=e.length,n=0,a=new Hy(t);n<i;++n)e[n]&&++a[e[n]-1];var o=new Hy(t);for(n=1;n<t;++n)o[n]=o[n-1]+a[n-1]<<1;var s;if(r){s=new Hy(1<<t);var l=15-t;for(n=0;n<i;++n)if(e[n])for(var u=n<<4|e[n],c=t-e[n],h=o[e[n]-1]++<<c,d=h|(1<<c)-1;h<=d;++h)s[G8[h]>>l]=u}else for(s=new Hy(i),n=0;n<i;++n)e[n]&&(s[n]=G8[o[e[n]-1]++]>>15-e[n]);return s}),nb=new Us(288);for(Oi=0;Oi<144;++Oi)nb[Oi]=8;for(Oi=144;Oi<256;++Oi)nb[Oi]=9;for(Oi=256;Oi<280;++Oi)nb[Oi]=7;for(Oi=280;Oi<288;++Oi)nb[Oi]=8;_oe=new Us(32);for(Oi=0;Oi<32;++Oi)_oe[Oi]=5;j7e=J_(nb,9,1),G7e=J_(_oe,5,1),i8=function(e){for(var t=e[0],r=1;r<e.length;++r)e[r]>t&&(t=e[r]);return t},ou=function(e,t,r){var i=t/8|0;return(e[i]|e[i+1]<<8)>>(t&7)&r},n8=function(e,t){var r=t/8|0;return(e[r]|e[r+1]<<8|e[r+2]<<16)>>(t&7)},V7e=function(e){return(e+7)/8|0},uQ=function(e,t,r){return(t==null||t<0)&&(t=0),(r==null||r>e.length)&&(r=e.length),new Us(e.subarray(t,r))},Y7e=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],vl=function(e,t,r){var i=new Error(t||Y7e[e]);if(i.code=e,Error.captureStackTrace&&Error.captureStackTrace(i,vl),!r)throw i;return i},H7e=function(e,t,r,i){var n=e.length,a=i?i.length:0;if(!n||t.f&&!t.l)return r||new Us(0);var o=!r,s=o||t.i!=2,l=t.i;o&&(r=new Us(n*3));var u=function(Me){var Ce=r.length;if(Me>Ce){var oe=new Us(Math.max(Ce*2,Me));oe.set(r),r=oe}},c=t.f||0,h=t.p||0,d=t.b||0,p=t.l,f=t.d,m=t.m,g=t.n,v=n*8;do{if(!p){c=ou(e,h,1);var _=ou(e,h+1,3);if(h+=3,_)if(_==1)p=j7e,f=G7e,m=9,g=5;else if(_==2){var x=ou(e,h,31)+257,b=ou(e,h+10,15)+4,E=x+ou(e,h+5,31)+1;h+=14;for(var M=new Us(E),S=new Us(19),D=0;D<b;++D)S[N7e[D]]=ou(e,h+D*3,7);h+=b*3;for(var T=i8(S),P=(1<<T)-1,k=J_(S,T,1),D=0;D<E;){var R=k[ou(e,h,P)];h+=R&15;var F=R>>4;if(F<16)M[D++]=F;else{var B=0,z=0;for(F==16?(z=3+ou(e,h,3),h+=2,B=M[D-1]):F==17?(z=3+ou(e,h,7),h+=3):F==18&&(z=11+ou(e,h,127),h+=7);z--;)M[D++]=B}}var O=M.subarray(0,x),j=M.subarray(x);m=i8(O),g=i8(j),p=J_(O,m,1),f=J_(j,g,1)}else vl(1);else{var F=V7e(h)+4,Y=e[F-4]|e[F-3]<<8,Z=F+Y;if(Z>n){l&&vl(0);break}s&&u(d+Y),r.set(e.subarray(F,Z),d),t.b=d+=Y,t.p=h=Z*8,t.f=c;continue}if(h>v){l&&vl(0);break}}s&&u(d+131072);for(var ne=(1<<m)-1,ie=(1<<g)-1,le=h;;le=h){var B=p[n8(e,h)&ne],X=B>>4;if(h+=B&15,h>v){l&&vl(0);break}if(B||vl(2),X<256)r[d++]=X;else if(X==256){le=h,p=null;break}else{var ce=X-254;if(X>264){var D=X-257,ge=Aoe[D];ce=ou(e,h,(1<<ge)-1)+voe[D],h+=ge}var be=f[n8(e,h)&ie],_e=be>>4;be||vl(3),h+=be&15;var j=Q7e[_e];if(_e>3){var ge=moe[_e];j+=n8(e,h)&(1<<ge)-1,h+=ge}if(h>v){l&&vl(0);break}s&&u(d+131072);var ke=d+ce;if(d<j){var Ye=a-j,We=Math.min(j,ke);for(Ye+d<0&&vl(3);d<We;++d)r[d]=i[Ye+d]}for(;d<ke;++d)r[d]=r[d-j]}}t.l=p,t.p=le,t.b=d,t.f=c,p&&(c=1,t.m=m,t.d=f,t.n=g)}while(!c);return d!=r.length&&o?uQ(r,0,d):r.subarray(0,d)},W7e=new Us(0),_c=function(e,t){return e[t]|e[t+1]<<8},uu=function(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0},a8=function(e,t){return uu(e,t)+uu(e,t+4)*4294967296};V8=typeof TextDecoder<"u"&&new TextDecoder,X7e=0;try{V8.decode(W7e,{stream:!0}),X7e=1}catch(e){}J7e=function(e){for(var t="",r=0;;){var i=e[r++],n=(i>127)+(i>223)+(i>239);if(r+n>e.length)return{s:t,r:uQ(e,r-1)};n?n==3?(i=((i&15)<<18|(e[r++]&63)<<12|(e[r++]&63)<<6|e[r++]&63)-65536,t+=String.fromCharCode(55296|i>>10,56320|i&1023)):n&1?t+=String.fromCharCode((i&31)<<6|e[r++]&63):t+=String.fromCharCode((i&15)<<12|(e[r++]&63)<<6|e[r++]&63):t+=String.fromCharCode(i)}};K7e=function(e,t){return t+30+_c(e,t+26)+_c(e,t+28)},q7e=function(e,t,r){var i=_c(e,t+28),n=boe(e.subarray(t+46,t+46+i),!(_c(e,t+8)&2048)),a=t+46+i,o=uu(e,t+20),s=r&&o==4294967295?$7e(e,a):[o,uu(e,t+24),uu(e,t+42)],l=s[0],u=s[1],c=s[2];return[_c(e,t+10),l,u,n,a+_c(e,t+30)+_c(e,t+32),c]},$7e=function(e,t){for(;_c(e,t)!=1;t+=4+_c(e,t+2));return[a8(e,t+12),a8(e,t+4),a8(e,t+20)]};H();H();H();H();bc=e=>Object.entries(e);H();Y8=e=>Object.keys(e);H();H();H();H();sae={accessible:"accessible",outdoors:"outdoors",public:"public"};H();yje=["facebook","instagram","twitter"];H();vje=e=>"fc_".concat(e.slice(3));H();H();H();H();H();Eje=qo(KNe(),1),Mje=e=>{let t=e.geometry.coordinates[0],r=0;for(let i=0;i<t.length-1;i++)r+=t[i][0]*t[i+1][1]-t[i+1][0]*t[i][1];return Math.abs(r/2)},Sje=(e,t)=>{let[r,i]=e,n=t.geometry.coordinates[0],a=!1;for(let o=0,s=n.length-1;o<n.length;s=o++){let[l,u]=n[o],[c,h]=n[s];u>i!=h>i&&r<(c-l)*(i-u)/(h-u)+l&&(a=!a)}return a},Ije=e=>{let t=e.geometry.coordinates[0],r=0,i=0;for(let n=0;n<t.length-1;n++)r+=t[n][0],i+=t[n][1];return{geometry:{coordinates:[r/(t.length-1),i/(t.length-1)]}}},Cje=e=>{let t=Mje(e),r=Number.isFinite(t)?Math.max(t,1):1;return Math.sqrt(r)*1e-6},cQ=e=>{try{let t=Ije(e).geometry.coordinates;if(!Sje(t,e)){let r=(0,Eje.default)(e.geometry.coordinates,Cje(e));return BA([r[0],r[1]])}return BA(t)}catch(t){return OB(new Error("Unable to calculate center of polygon"))}};H();H();H();H();ta=e=>JSON.parse(boe(e)),Vje=/^geometry\\/(.+)\\.geojson$/,Yje=/^nodes\\/(.+)\\.(geo)?json$/,Hje=/^floorImages\\/(.+)\\.geojson$/,Wje=/^facade\\/(.+)\\.json$/,Zje=/^walkable\\/(.+)\\.json$/,Xje=/^nonwalkable\\/(.+)\\.json$/,Jje=/^kinds\\/(.+)\\.json$/,Kje=/^annotations\\/(.+)\\.json$/,qje=/^cms\\/(?:([^/]+)\\/)?([^/]+)\\.(?:json|geojson)$/,$je=[(e,t)=>e==="manifest.geojson"?{manifest:ta(t)}:void 0,(e,t)=>e==="floors.geojson"?{floors:ta(t)}:void 0,(e,t)=>{let r=e.match(Vje);return r?{geometry:{[r[1]]:ta(t)}}:void 0},(e,t)=>e==="connections.json"?{connections:ta(t)}:void 0,(e,t)=>e==="navigationFlags.json"?{navigationFlags:ta(t)}:void 0,(e,t)=>{let r=e.match(Yje);return r?{nodes:{[r[1]]:ta(t)}}:void 0},(e,t)=>e==="default-style.json"?{defaultStyle:ta(t)}:void 0,(e,t)=>e==="floor-stacks.json"?{floorStacks:ta(t)}:void 0,(e,t)=>e==="outdoors.json"?{outdoors:ta(t)}:void 0,(e,t)=>e==="tileset.json"?{tileset:ta(t)}:void 0,(e,t)=>{let r=e.match(Hje);return r?{floorImages:{[r[1]]:ta(t)}}:void 0},(e,t)=>{let r=e.match(Wje);return r?{facade:{[r[1]]:ta(t)}}:void 0},(e,t)=>{let r=e.match(Zje);return r?{walkable:{[r[1]]:ta(t)}}:void 0},(e,t)=>{let r=e.match(Xje);return r?{nonwalkable:{[r[1]]:ta(t)}}:void 0},(e,t)=>{let r=e.match(Jje);return r?{kinds:{[r[1]]:ta(t)}}:void 0},(e,t)=>e==="annotation-symbols.json"?{annotationSymbols:ta(t)}:void 0,(e,t)=>{let r=e.match(Kje);return r?{annotations:{[r[1]]:ta(t)}}:void 0},(e,t)=>e==="locations.json"?{locations:ta(t)}:void 0,(e,t)=>e==="location-categories.json"?{locationCategories:ta(t)}:void 0,(e,t)=>e==="location-instances.json"?{locationInstances:ta(t)}:void 0,(e,t)=>{let r=e.match(qje);if(!r)return;let[,i,n]=r;return i==="floorText"||i==="textures"||i==="textAreas"?{cms:{[i]:{[n]:ta(t)}}}:{cms:{[n]:ta(t)}}}],e9e=new Set(sQ),t9e=new Set(lQ),r9e=new Set(eQ),i9e=new Set(rQ),n9e=new Set(tQ),a9e=new Set(iQ),o9e=new Set(nQ),s9e=new Set(aQ),l9e=new Set(oQ);Moe={decompressUnsafeSync:e=>rB(e),decompressUnsafe:e=>Promise.resolve(rB(e)),decompressSync:e=>rB(e),decompress:e=>Promise.resolve(rB(e))},GB=class{constructor({nodes:e,geojsonCollection:t,groupBy:r="default",multiplicativeDistanceWeightScaling:i,flagDeclarations:n,getDoorByNodeId:a}){I(this,"groupBy"),I(this,"graph"),I(this,"geometryEdgesByMapId",new Map),I(this,"flagDeclarations",{}),I(this,"getDoorByNodeId"),I(this,"disabledNodeIds"),I(this,"generatePath",s=>{let{destination:l}=s[s.length-1],u={type:"FeatureCollection",features:[]};for(let h=0;h<s.length;h++){let{origin:d,destination:p}=s[h],f={id:d.properties.id,angle:s[h].angle,distance:s[h].distance,destination:p.properties.id,edges:this.graph.edges[d.properties.id]};this.groupBy!=="default"&&(f.groupBy=d.properties[this.groupBy]),u.features.push({type:"Feature",geometry:{type:"Point",coordinates:[d.geometry.coordinates[0],d.geometry.coordinates[1]]},properties:f})}let c={id:l.properties.id,edges:this.graph.edges[l.properties.id]};return this.groupBy!=="default"&&(c.groupBy=l.properties[this.groupBy]),u.features.push({type:"Feature",geometry:{type:"Point",coordinates:[l.geometry.coordinates[0],l.geometry.coordinates[1]]},properties:c}),u}),I(this,"findNearestNodesOnGraph",(s,l,u,c,h=!1,d=1/0)=>{var p;return this.graph.dijkstraFindWithinTravelDistance(s,l,c,(p=this.geometryEdgesByMapId.get(u))!=null?p:[],h,d)}),I(this,"hasLineOfSight",(s,l,u,c)=>this.graph.hasLineOfSight(s,l,this.geometryEdgesByMapId.get(u),c)),I(this,"getDistance",(s,l)=>So(s,l)),I(this,"getAngle",(s,l)=>cu(s,l)),this.groupBy=r,this.graph=new m7e({nodes:e,groupBy:this.groupBy,multiplicativeDistanceWeightScaling:i});let o=(t==null?void 0:t.features)||[];this.flagDeclarations=n!=null?n:{},this.getDoorByNodeId=a,this.disabledNodeIds=this.getDisabledNodeIds(),o.forEach(s=>{let l=null;if(s.geometry.type==="LineString"?l=s.geometry.coordinates:s.geometry.type==="Polygon"&&(l=s.geometry.coordinates.flat()),l){let u=this.groupBy==="default"?this.groupBy:s.properties[this.groupBy];this.geometryEdgesByMapId.has(u)||this.geometryEdgesByMapId.set(u,[]),l.forEach((c,h)=>{this.geometryEdgesByMapId.get(u).push([c,l[h+1]||l[0]])})}})}getDisabledNodeIds(){let e=new Set;if(r8.public in this.flagDeclarations)for(let t in this.graph.nodesById)loe(this.graph.nodesById[t].properties.flags,this.flagDeclarations[r8.public].index,this.flagDeclarations[r8.public].bit)||e.add(t);return e}getDirections({zones:e,originIds:t,from:r,to:i,destinationNodeIds:n,disabledConnectionNodeIds:a,simplify:o,multiplicativeDistanceWeightScaling:s,overrideEdgeWeights:l}){var u;let c=(u=o==null?void 0:o.enabled)!=null?u:!0,h=e!=null?e:[],d=this.graph.aStar({originIds:t,destinationNodeIds:n,zones:h,disabledConnectionNodeIds:new Set(a),overrideEdgeWeights:l,disabledNodeIds:this.disabledNodeIds});if(d.length===0)return{type:"FeatureCollection",features:[]};if((o==null?void 0:o.__EXPERIMENTAL_METHOD)!=="greedy-los"&&r&&i&&r.length===1&&i.length===1){let p=new Cp({origin:r[0],destination:d[0].origin,distance:So(r[0].geometry.coordinates,d[0].origin.geometry.coordinates),angle:cu(r[0].geometry.coordinates,d[0].origin.geometry.coordinates),multiplicativeDistanceWeightScaling:s}),f=d.slice(),m=new Cp({origin:d[d.length-1].destination,destination:i[0],distance:So(d[d.length-1].destination.geometry.coordinates,i[0].geometry.coordinates),angle:cu(d[d.length-1].destination.geometry.coordinates,i[0].geometry.coordinates),multiplicativeDistanceWeightScaling:s});f.unshift(p),f.push(m),d=f}return c&&(d=this.simplifyAllSteps(d,o,s)),this.generatePath(d)}simplifyAllSteps(e,t={enabled:!0,__EXPERIMENTAL_METHOD:"greedy-los"},r){var i,n,a,o;let s=[],l=[e[0]],u=(i=t.__EXPERIMENTAL_METHOD)!=null?i:"greedy-los",c=(n=t.radius)!=null?n:q8,h=u==="dp-optimal"?this.simplifyStepsWithDPMethod.bind(this):u==="rdp"?this.simplifyStepsImprovedWithSimplifyBeforeLoSChecks.bind(this):this.simplifySteps.bind(this);for(let m=1;m<e.length;m++)if(this.groupBy!=="default"&&e[m].origin.properties[this.groupBy]!==e[m-1].origin.properties[this.groupBy]){let g=e[m-1].origin.properties[this.groupBy],v=(a=this.geometryEdgesByMapId.get(g))!=null?a:[];s.push(...h(l,v,c,r,t)),l=[e[m]]}else l.push(e[m]);let d=e[e.length-1],p=this.groupBy==="default"?this.groupBy:d.origin.properties[this.groupBy],f=(o=this.geometryEdgesByMapId.get(p))!=null?o:[];return s.push(...h(l,f,c,r,t)),s}simplifySteps(e,t,r,i,n){return M7e(e,t,r,this.flagDeclarations,i)}simplifyStepsImprovedWithSimplifyBeforeLoSChecks(e,t,r,i,n){var a;if(e.length<3)return e;e=w7e(e,this.getDoorByNodeId,i,t);let o=(n==null?void 0:n.__EXPERIMENTAL_METHOD)==="rdp"&&(a=n.mustIncludeDoorBufferNodes)!=null?a:!0;return E7e(e,t,i,o)}simplifyStepsWithDPMethod(e,t,r,i,n){var a;if(e.length<3)return e;let o=new Set;(n==null?void 0:n.__EXPERIMENTAL_METHOD)==="dp-optimal"&&(a=n.includeDoorBufferNodes)!=null&&a&&(o=I7e(e,this.getDoorByNodeId));for(let u=0;u<e.length-1;u++){let c=e[u].origin.properties.floor,h=e[u+1].origin.properties.floor;c!==h&&(e[u].origin.properties.preventSmoothing||(e[u].origin.properties.preventSmoothing=!0,o.add(e[u].origin.properties.id)),e[u+1].origin.properties.preventSmoothing||(e[u+1].origin.properties.preventSmoothing=!0,o.add(e[u+1].origin.properties.id)))}let s=e[e.length-1];s.origin.properties.floor!==s.destination.properties.floor&&(s.origin.properties.preventSmoothing||(s.origin.properties.preventSmoothing=!0,o.add(s.origin.properties.id)));let l=y7e(e,t,i,r);for(let u of e)o.has(u.origin.properties.id)&&delete u.origin.properties.preventSmoothing,o.has(u.destination.properties.id)&&delete u.destination.properties.preventSmoothing;return l}},s8="https://tiles-cdn.mappedin.com/styles/mappedin/style.json",h9e="https://auth.mappedin.com/oauth2/token"});var Noe={};Ra(Noe,{InternalSearch:()=>M9e,removeAccents:()=>JB});function S9e(e,{placesResult:t,locationsResult:r,categoriesResult:i}){let n=t.reduce((s,{id:l,match:u,score:c,__type:h})=>{let d=e.getById(h,l);return d!=null&&!js.is(d)&&!Tp.is(d)&&!Za.is(d)&&!ma.is(d)&&!xl.is(d)&&s.push({type:d.__type,match:u,score:c,item:d}),s},[]),a;if(r){a=[];for(let{id:s,match:l,score:u}of r){let c=e.getById("enterprise-location",s);c&&a.push({type:c.__type,match:l,score:u,item:c})}}let o;if(i){o=[];for(let{id:s,match:l,score:u}of i){let c=e.getById("enterprise-category",s);c&&o.push({type:c.__type,match:l,score:u,item:c})}}return{places:n,enterpriseLocations:a,enterpriseCategories:o}}function JB(e){return e.normalize("NFD").replace(/[\\u0300-\\u036f|\\u2019|\\u0027|\\']/g,"").toLowerCase()}function C9e(e){let t=new WB({fields:["name","description"],storeFields:["id","__type"],searchOptions:{fuzzy:.2,prefix:!0,boost:{name:2},combineWith:"AND"},extractField:(o,s)=>{let l=o[s];return typeof l=="string"?JB(l):o[s]},processTerm:o=>P9e.has(o)?"":o.toLowerCase()}),r=e.getByType("enterprise-location"),i;r&&(i=new WB({fields:["name","tags","description"],storeFields:["id","__type"],searchOptions:{combineWith:"OR",prefix:!0,fuzzy:.2,boost:{name:3,tags:2,description:1}},extractField:(o,s)=>Array.isArray(o[s])?o[s].join(" "):typeof o[s]=="string"?JB(o[s]):o[s]}));let n=e.getByType("enterprise-category"),a;return n&&(a=new WB({fields:["name","description","locations.name"],storeFields:["id","__type"],extractField(o,s){return s==="locations.name"?o.locations.reduce((l,u)=>l+" ".concat(Toe," ")+u.name,"")+" ".concat(Toe):typeof o[s]=="string"?JB(o[s]):o[s]},searchOptions:{combineWith:"OR",prefix:!0,fuzzy:.2,boost:{name:2,"locations.name":2}}})),{enterpriseCategories:a,enterpriseLocations:i,places:t}}var d9e,p9e,Poe,Doe,dQ,Xy,f9e,koe,pQ,KB,yQ,fQ,A9e,Roe,Foe,bQ,wQ,zoe,m9e,WB,AQ,g9e,y9e,v9e,x9e,mQ,Soe,_9e,vQ,xQ,gQ,b9e,Ioe,Coe,Boe,YB,HB,Loe,w9e,E9e,XB,_Q,Ooe,M9e,I9e,B9e,T9e,P9e,Toe,Uoe=Ot(()=>{"use strict";qB();Zy();Rd();rh();nl();ws();Ji();d9e=Kr((e,t)=>{H();var r=200,i="__lodash_hash_undefined__",n=800,a=16,o=9007199254740991,s="[object Arguments]",l="[object Array]",u="[object AsyncFunction]",c="[object Boolean]",h="[object Date]",d="[object Error]",p="[object Function]",f="[object GeneratorFunction]",m="[object Map]",g="[object Number]",v="[object Null]",_="[object Object]",x="[object Proxy]",b="[object RegExp]",E="[object Set]",M="[object String]",S="[object Undefined]",D="[object WeakMap]",T="[object ArrayBuffer]",P="[object DataView]",k="[object Float32Array]",R="[object Float64Array]",F="[object Int8Array]",B="[object Int16Array]",z="[object Int32Array]",O="[object Uint8Array]",j="[object Uint8ClampedArray]",Y="[object Uint16Array]",Z="[object Uint32Array]",ne=/[\\\\^$.*+?()[\\]{}|]/g,ie=/^\\[object .+?Constructor\\]$/,le=/^(?:0|[1-9]\\d*)$/,X={};X[k]=X[R]=X[F]=X[B]=X[z]=X[O]=X[j]=X[Y]=X[Z]=!0,X[s]=X[l]=X[T]=X[c]=X[P]=X[h]=X[d]=X[p]=X[m]=X[g]=X[_]=X[b]=X[E]=X[M]=X[D]=!1;var ce=typeof global=="object"&&global&&global.Object===Object&&global,ge=typeof self=="object"&&self&&self.Object===Object&&self,be=ce||ge||Function("return this")(),_e=typeof e=="object"&&e&&!e.nodeType&&e,ke=_e&&typeof t=="object"&&t&&!t.nodeType&&t,Ye=ke&&ke.exports===_e,We=Ye&&ce.process,Me=(function(){try{var U=ke&&ke.require&&ke.require("util").types;return U||We&&We.binding&&We.binding("util")}catch(de){}})(),Ce=Me&&Me.isTypedArray;function oe(U,de,Fe){switch(Fe.length){case 0:return U.call(de);case 1:return U.call(de,Fe[0]);case 2:return U.call(de,Fe[0],Fe[1]);case 3:return U.call(de,Fe[0],Fe[1],Fe[2])}return U.apply(de,Fe)}function it(U,de){for(var Fe=-1,mt=Array(U);++Fe<U;)mt[Fe]=de(Fe);return mt}function Oe(U){return function(de){return U(de)}}function Ke(U,de){return U==null?void 0:U[de]}function Le(U,de){return function(Fe){return U(de(Fe))}}var Ze=Array.prototype,ut=Function.prototype,et=Object.prototype,te=be["__core-js_shared__"],K=ut.toString,ve=et.hasOwnProperty,je=(function(){var U=/[^.]+$/.exec(te&&te.keys&&te.keys.IE_PROTO||"");return U?"Symbol(src)_1."+U:""})(),Ne=et.toString,Ue=K.call(Object),ft=RegExp("^"+K.call(ve).replace(ne,"\\\\$&").replace(/hasOwnProperty|(function).*?(?=\\\\\\()| for .+?(?=\\\\\\])/g,"$1.*?")+"$"),ot=Ye?be.Buffer:void 0,Ae=be.Symbol,Q=be.Uint8Array,G=ot?ot.allocUnsafe:void 0,W=Le(Object.getPrototypeOf,Object),re=Object.create,$=et.propertyIsEnumerable,me=Ze.splice,ye=Ae?Ae.toStringTag:void 0,Be=(function(){try{var U=tn(Object,"defineProperty");return U({},"",{}),U}catch(de){}})(),Ge=ot?ot.isBuffer:void 0,ue=Math.max,pe=Date.now,we=tn(be,"Map"),Ie=tn(Object,"create"),nt=(function(){function U(){}return function(de){if(!fi(de))return{};if(re)return re(de);U.prototype=de;var Fe=new U;return U.prototype=void 0,Fe}})();function lt(U){var de=-1,Fe=U==null?0:U.length;for(this.clear();++de<Fe;){var mt=U[de];this.set(mt[0],mt[1])}}function $e(){this.__data__=Ie?Ie(null):{},this.size=0}function He(U){var de=this.has(U)&&delete this.__data__[U];return this.size-=de?1:0,de}function wt(U){var de=this.__data__;if(Ie){var Fe=de[U];return Fe===i?void 0:Fe}return ve.call(de,U)?de[U]:void 0}function Yt(U){var de=this.__data__;return Ie?de[U]!==void 0:ve.call(de,U)}function ur(U,de){var Fe=this.__data__;return this.size+=this.has(U)?0:1,Fe[U]=Ie&&de===void 0?i:de,this}lt.prototype.clear=$e,lt.prototype.delete=He,lt.prototype.get=wt,lt.prototype.has=Yt,lt.prototype.set=ur;function Qt(U){var de=-1,Fe=U==null?0:U.length;for(this.clear();++de<Fe;){var mt=U[de];this.set(mt[0],mt[1])}}function Lr(){this.__data__=[],this.size=0}function Vr(U){var de=this.__data__,Fe=Ee(de,U);if(Fe<0)return!1;var mt=de.length-1;return Fe==mt?de.pop():me.call(de,Fe,1),--this.size,!0}function Dr(U){var de=this.__data__,Fe=Ee(de,U);return Fe<0?void 0:de[Fe][1]}function Xr(U){return Ee(this.__data__,U)>-1}function yi(U,de){var Fe=this.__data__,mt=Ee(Fe,U);return mt<0?(++this.size,Fe.push([U,de])):Fe[mt][1]=de,this}Qt.prototype.clear=Lr,Qt.prototype.delete=Vr,Qt.prototype.get=Dr,Qt.prototype.has=Xr,Qt.prototype.set=yi;function Mr(U){var de=-1,Fe=U==null?0:U.length;for(this.clear();++de<Fe;){var mt=U[de];this.set(mt[0],mt[1])}}function Yr(){this.size=0,this.__data__={hash:new lt,map:new(we||Qt),string:new lt}}function vi(U){var de=Nt(this,U).delete(U);return this.size-=de?1:0,de}function Ri(U){return Nt(this,U).get(U)}function va(U){return Nt(this,U).has(U)}function xa(U,de){var Fe=Nt(this,U),mt=Fe.size;return Fe.set(U,de),this.size+=Fe.size==mt?0:1,this}Mr.prototype.clear=Yr,Mr.prototype.delete=vi,Mr.prototype.get=Ri,Mr.prototype.has=va,Mr.prototype.set=xa;function Bi(U){var de=this.__data__=new Qt(U);this.size=de.size}function co(){this.__data__=new Qt,this.size=0}function qa(U){var de=this.__data__,Fe=de.delete(U);return this.size=de.size,Fe}function Pe(U){return this.__data__.get(U)}function Vt(U){return this.__data__.has(U)}function ee(U,de){var Fe=this.__data__;if(Fe instanceof Qt){var mt=Fe.__data__;if(!we||mt.length<r-1)return mt.push([U,de]),this.size=++Fe.size,this;Fe=this.__data__=new Mr(mt)}return Fe.set(U,de),this.size=Fe.size,this}Bi.prototype.clear=co,Bi.prototype.delete=qa,Bi.prototype.get=Pe,Bi.prototype.has=Vt,Bi.prototype.set=ee;function Re(U,de){var Fe=Et(U),mt=!Fe&&$t(U),Ut=!Fe&&!mt&&_r(U),Mt=!Fe&&!mt&&!Ut&&eo(U),Ht=Fe||mt||Ut||Mt,Jt=Ht?it(U.length,String):[],xr=Jt.length;for(var Yi in U)(de||ve.call(U,Yi))&&!(Ht&&(Yi=="length"||Ut&&(Yi=="offset"||Yi=="parent")||Mt&&(Yi=="buffer"||Yi=="byteLength"||Yi=="byteOffset")||Pn(Yi,xr)))&&Jt.push(Yi);return Jt}function qe(U,de,Fe){(Fe!==void 0&&!xt(U[de],Fe)||Fe===void 0&&!(de in U))&&At(U,de,Fe)}function Xe(U,de,Fe){var mt=U[de];(!(ve.call(U,de)&&xt(mt,Fe))||Fe===void 0&&!(de in U))&&At(U,de,Fe)}function Ee(U,de){for(var Fe=U.length;Fe--;)if(xt(U[Fe][0],de))return Fe;return-1}function At(U,de,Fe){de=="__proto__"&&Be?Be(U,de,{configurable:!0,enumerable:!0,value:Fe,writable:!0}):U[de]=Fe}var Lt=dn();function Bt(U){return U==null?U===void 0?S:v:ye&&ye in Object(U)?pn(U):N(U)}function Ft(U){return Dn(U)&&Bt(U)==s}function hr(U){if(!fi(U)||w(U))return!1;var de=ci(U)?ft:ie;return de.test(st(U))}function rr(U){return Dn(U)&&si(U.length)&&!!X[Bt(U)]}function fr(U){if(!fi(U))return L(U);var de=C(U),Fe=[];for(var mt in U)mt=="constructor"&&(de||!ve.call(U,mt))||Fe.push(mt);return Fe}function Br(U,de,Fe,mt,Ut){U!==de&&Lt(de,function(Mt,Ht){if(Ut||(Ut=new Bi),fi(Mt))Jr(U,de,Ht,Fe,Br,mt,Ut);else{var Jt=mt?mt(se(U,Ht),Mt,Ht+"",U,de,Ut):void 0;Jt===void 0&&(Jt=Mt),qe(U,Ht,Jt)}},Cu)}function Jr(U,de,Fe,mt,Ut,Mt,Ht){var Jt=se(U,Fe),xr=se(de,Fe),Yi=Ht.get(xr);if(Yi){qe(U,Fe,Yi);return}var fn=Mt?Mt(Jt,xr,Fe+"",U,de,Ht):void 0,ho=fn===void 0;if(ho){var Dl=Et(xr),ka=!Dl&&_r(xr),Jo=!Dl&&!ka&&eo(xr);fn=xr,Dl||ka||Jo?Et(Jt)?fn=Jt:nr(Jt)?fn=ca(Jt):ka?(ho=!1,fn=oi(xr,!0)):Jo?(ho=!1,fn=Qi(xr,!0)):fn=[]:_s(xr)||$t(xr)?(fn=Jt,$t(Jt)?fn=Tl(Jt):(!fi(Jt)||ci(Jt))&&(fn=bi(xr))):ho=!1}ho&&(Ht.set(xr,fn),Ut(fn,xr,mt,Mt,Ht),Ht.delete(xr)),qe(U,Fe,fn)}function _i(U,de){return Se(q(U,de,V),U+"")}var ai=Be?function(U,de){return Be(U,"toString",{configurable:!0,enumerable:!1,value:qs(de),writable:!0})}:V;function oi(U,de){if(de)return U.slice();var Fe=U.length,mt=G?G(Fe):new U.constructor(Fe);return U.copy(mt),mt}function sr(U){var de=new U.constructor(U.byteLength);return new Q(de).set(new Q(U)),de}function Qi(U,de){var Fe=de?sr(U.buffer):U.buffer;return new U.constructor(Fe,U.byteOffset,U.length)}function ca(U,de){var Fe=-1,mt=U.length;for(de||(de=Array(mt));++Fe<mt;)de[Fe]=U[Fe];return de}function Hr(U,de,Fe,mt){var Ut=!Fe;Fe||(Fe={});for(var Mt=-1,Ht=de.length;++Mt<Ht;){var Jt=de[Mt],xr=mt?mt(Fe[Jt],U[Jt],Jt,Fe,U):void 0;xr===void 0&&(xr=U[Jt]),Ut?At(Fe,Jt,xr):Xe(Fe,Jt,xr)}return Fe}function _a(U){return _i(function(de,Fe){var mt=-1,Ut=Fe.length,Mt=Ut>1?Fe[Ut-1]:void 0,Ht=Ut>2?Fe[2]:void 0;for(Mt=U.length>3&&typeof Mt=="function"?(Ut--,Mt):void 0,Ht&&$a(Fe[0],Fe[1],Ht)&&(Mt=Ut<3?void 0:Mt,Ut=1),de=Object(de);++mt<Ut;){var Jt=Fe[mt];Jt&&U(de,Jt,mt,Mt)}return de})}function dn(U){return function(de,Fe,mt){for(var Ut=-1,Mt=Object(de),Ht=mt(de),Jt=Ht.length;Jt--;){var xr=Ht[U?Jt:++Ut];if(Fe(Mt[xr],xr,Mt)===!1)break}return de}}function vn(U,de,Fe,mt,Ut,Mt){return fi(U)&&fi(de)&&(Mt.set(de,U),Br(U,de,void 0,vn,Mt),Mt.delete(de)),U}function Nt(U,de){var Fe=U.__data__;return y(de)?Fe[typeof de=="string"?"string":"hash"]:Fe.map}function tn(U,de){var Fe=Ke(U,de);return hr(Fe)?Fe:void 0}function pn(U){var de=ve.call(U,ye),Fe=U[ye];try{U[ye]=void 0;var mt=!0}catch(Mt){}var Ut=Ne.call(U);return mt&&(de?U[ye]=Fe:delete U[ye]),Ut}function bi(U){return typeof U.constructor=="function"&&!C(U)?nt(W(U)):{}}function Pn(U,de){var Fe=typeof U;return de=de==null?o:de,!!de&&(Fe=="number"||Fe!="symbol"&&le.test(U))&&U>-1&&U%1==0&&U<de}function $a(U,de,Fe){if(!fi(Fe))return!1;var mt=typeof de;return(mt=="number"?ar(Fe)&&Pn(de,Fe.length):mt=="string"&&de in Fe)?xt(Fe[de],U):!1}function y(U){var de=typeof U;return de=="string"||de=="number"||de=="symbol"||de=="boolean"?U!=="__proto__":U===null}function w(U){return!!je&&je in U}function C(U){var de=U&&U.constructor,Fe=typeof de=="function"&&de.prototype||et;return U===Fe}function L(U){var de=[];if(U!=null)for(var Fe in Object(U))de.push(Fe);return de}function N(U){return Ne.call(U)}function q(U,de,Fe){return de=ue(de===void 0?U.length-1:de,0),function(){for(var mt=arguments,Ut=-1,Mt=ue(mt.length-de,0),Ht=Array(Mt);++Ut<Mt;)Ht[Ut]=mt[de+Ut];Ut=-1;for(var Jt=Array(de+1);++Ut<de;)Jt[Ut]=mt[Ut];return Jt[de]=Fe(Ht),oe(U,this,Jt)}}function se(U,de){if(!(de==="constructor"&&typeof U[de]=="function")&&de!="__proto__")return U[de]}var Se=Ve(ai);function Ve(U){var de=0,Fe=0;return function(){var mt=pe(),Ut=a-(mt-Fe);if(Fe=mt,Ut>0){if(++de>=n)return arguments[0]}else de=0;return U.apply(void 0,arguments)}}function st(U){if(U!=null){try{return K.call(U)}catch(de){}try{return U+""}catch(de){}}return""}function xt(U,de){return U===de||U!==U&&de!==de}var $t=Ft((function(){return arguments})())?Ft:function(U){return Dn(U)&&ve.call(U,"callee")&&!$.call(U,"callee")},Et=Array.isArray;function ar(U){return U!=null&&si(U.length)&&!ci(U)}function nr(U){return Dn(U)&&ar(U)}var _r=Ge||ae;function ci(U){if(!fi(U))return!1;var de=Bt(U);return de==p||de==f||de==u||de==x}function si(U){return typeof U=="number"&&U>-1&&U%1==0&&U<=o}function fi(U){var de=typeof U;return U!=null&&(de=="object"||de=="function")}function Dn(U){return U!=null&&typeof U=="object"}function _s(U){if(!Dn(U)||Bt(U)!=_)return!1;var de=W(U);if(de===null)return!0;var Fe=ve.call(de,"constructor")&&de.constructor;return typeof Fe=="function"&&Fe instanceof Fe&&K.call(Fe)==Ue}var eo=Ce?Oe(Ce):rr;function Tl(U){return Hr(U,Cu(U))}var Vc=_i(function(U){return U.push(void 0,vn),oe(Pl,void 0,U)});function Cu(U){return ar(U)?Re(U,!0):fr(U)}var Pl=_a(function(U,de,Fe,mt){Br(U,de,Fe,mt)});function qs(U){return function(){return U}}function V(U){return U}function ae(){return!1}t.exports=Vc});H();H();p9e="ENTRIES",Poe="KEYS",Doe="VALUES",dQ=class{constructor(e,t){let r=e._tree,i=Array.from(r.keys());this.set=e,this._type=t,this._path=i.length>0?[{node:r,keys:i}]:[]}next(){let e=this.dive();return this.backtrack(),e}dive(){if(this._path.length===0)return{done:!0,value:void 0};let{node:e,keys:t}=Xy(this._path);if(Xy(t)==="")return{done:!1,value:this.result()};let r=e.get(Xy(t));return this._path.push({node:r,keys:Array.from(r.keys())}),this.dive()}backtrack(){if(this._path.length===0)return;let e=Xy(this._path).keys;e.pop(),!(e.length>0)&&(this._path.pop(),this.backtrack())}key(){return this.set._prefix+this._path.map(({keys:e})=>Xy(e)).filter(e=>e!=="").join("")}value(){return Xy(this._path).node.get("")}result(){switch(this._type){case Doe:return this.value();case Poe:return this.key();default:return[this.key(),this.value()]}}[Symbol.iterator](){return this}},Xy=e=>e[e.length-1],f9e=(e,t,r)=>{let i=new Map;if(t===void 0)return i;let n=t.length+1,a=n+r,o=new Uint8Array(a*n).fill(r+1);for(let s=0;s<n;++s)o[s]=s;for(let s=1;s<a;++s)o[s*n]=s;return koe(e,t,r,i,o,1,n,""),i},koe=(e,t,r,i,n,a,o,s)=>{let l=a*o;e:for(let u of e.keys())if(u===""){let c=n[l-1];c<=r&&i.set(s,[e.get(u),c])}else{let c=a;for(let h=0;h<u.length;++h,++c){let d=u[h],p=o*c,f=p-o,m=n[p],g=Math.max(0,c-r-1),v=Math.min(o-1,c+r);for(let _=g;_<v;++_){let x=d!==t[_],b=n[f+_]+ +x,E=n[f+_+1]+1,M=n[p+_]+1,S=n[p+_+1]=Math.min(b,E,M);S<m&&(m=S)}if(m>r)continue e}koe(e.get(u),t,r,i,n,c,o,s+u)}},pQ=class ab{constructor(t=new Map,r=""){this._size=void 0,this._tree=t,this._prefix=r}atPrefix(t){if(!t.startsWith(this._prefix))throw new Error("Mismatched prefix");let[r,i]=KB(this._tree,t.slice(this._prefix.length));if(r===void 0){let[n,a]=bQ(i);for(let o of n.keys())if(o!==""&&o.startsWith(a)){let s=new Map;return s.set(o.slice(a.length),n.get(o)),new ab(s,t)}}return new ab(r,t)}clear(){this._size=void 0,this._tree.clear()}delete(t){return this._size=void 0,A9e(this._tree,t)}entries(){return new dQ(this,p9e)}forEach(t){for(let[r,i]of this)t(r,i,this)}fuzzyGet(t,r){return f9e(this._tree,t,r)}get(t){let r=yQ(this._tree,t);return r!==void 0?r.get(""):void 0}has(t){let r=yQ(this._tree,t);return r!==void 0&&r.has("")}keys(){return new dQ(this,Poe)}set(t,r){if(typeof t!="string")throw new Error("key must be a string");return this._size=void 0,fQ(this._tree,t).set("",r),this}get size(){if(this._size)return this._size;this._size=0;let t=this.entries();for(;!t.next().done;)this._size+=1;return this._size}update(t,r){if(typeof t!="string")throw new Error("key must be a string");this._size=void 0;let i=fQ(this._tree,t);return i.set("",r(i.get(""))),this}fetch(t,r){if(typeof t!="string")throw new Error("key must be a string");this._size=void 0;let i=fQ(this._tree,t),n=i.get("");return n===void 0&&i.set("",n=r()),n}values(){return new dQ(this,Doe)}[Symbol.iterator](){return this.entries()}static from(t){let r=new ab;for(let[i,n]of t)r.set(i,n);return r}static fromObject(t){return ab.from(Object.entries(t))}},KB=(e,t,r=[])=>{if(t.length===0||e==null)return[e,r];for(let i of e.keys())if(i!==""&&t.startsWith(i))return r.push([e,i]),KB(e.get(i),t.slice(i.length),r);return r.push([e,t]),KB(void 0,"",r)},yQ=(e,t)=>{if(t.length===0||e==null)return e;for(let r of e.keys())if(r!==""&&t.startsWith(r))return yQ(e.get(r),t.slice(r.length))},fQ=(e,t)=>{let r=t.length;e:for(let i=0;e&&i<r;){for(let a of e.keys())if(a!==""&&t[i]===a[0]){let o=Math.min(r-i,a.length),s=1;for(;s<o&&t[i+s]===a[s];)++s;let l=e.get(a);if(s===a.length)e=l;else{let u=new Map;u.set(a.slice(s),l),e.set(t.slice(i,i+s),u),e.delete(a),e=u}i+=s;continue e}let n=new Map;return e.set(t.slice(i),n),n}return e},A9e=(e,t)=>{let[r,i]=KB(e,t);if(r!==void 0){if(r.delete(""),r.size===0)Roe(i);else if(r.size===1){let[n,a]=r.entries().next().value;Foe(i,n,a)}}},Roe=e=>{if(e.length===0)return;let[t,r]=bQ(e);if(t.delete(r),t.size===0)Roe(e.slice(0,-1));else if(t.size===1){let[i,n]=t.entries().next().value;i!==""&&Foe(e.slice(0,-1),i,n)}},Foe=(e,t,r)=>{if(e.length===0)return;let[i,n]=bQ(e);i.set(n+t,r),i.delete(n)},bQ=e=>e[e.length-1],wQ="or",zoe="and",m9e="and_not",WB=class ZB{constructor(t){if((t==null?void 0:t.fields)==null)throw new Error('MiniSearch: option "fields" must be provided');let r=t.autoVacuum==null||t.autoVacuum===!0?gQ:t.autoVacuum;this._options=bt(ze(ze({},mQ),t),{autoVacuum:r,searchOptions:ze(ze({},Soe),t.searchOptions||{}),autoSuggestOptions:ze(ze({},_9e),t.autoSuggestOptions||{})}),this._index=new pQ,this._documentCount=0,this._documentIds=new Map,this._idToShortId=new Map,this._fieldIds={},this._fieldLength=new Map,this._avgFieldLength=[],this._nextId=0,this._storedFields=new Map,this._dirtCount=0,this._currentVacuum=null,this._enqueuedVacuum=null,this._enqueuedVacuumConditions=xQ,this.addFields(this._options.fields)}add(t){let{extractField:r,stringifyField:i,tokenize:n,processTerm:a,fields:o,idField:s}=this._options,l=r(t,s);if(l==null)throw new Error('MiniSearch: document does not have ID field "'.concat(s,'"'));if(this._idToShortId.has(l))throw new Error("MiniSearch: duplicate ID ".concat(l));let u=this.addDocumentId(l);this.saveStoredFields(u,t);for(let c of o){let h=r(t,c);if(h==null)continue;let d=n(i(h,c),c),p=this._fieldIds[c],f=new Set(d).size;this.addFieldLength(u,p,this._documentCount-1,f);for(let m of d){let g=a(m,c);if(Array.isArray(g))for(let v of g)this.addTerm(p,u,v);else g&&this.addTerm(p,u,g)}}}addAll(t){for(let r of t)this.add(r)}addAllAsync(t,r={}){let{chunkSize:i=10}=r,n={chunk:[],promise:Promise.resolve()},{chunk:a,promise:o}=t.reduce(({chunk:s,promise:l},u,c)=>(s.push(u),(c+1)%i===0?{chunk:[],promise:l.then(()=>new Promise(h=>setTimeout(h,0))).then(()=>this.addAll(s))}:{chunk:s,promise:l}),n);return o.then(()=>this.addAll(a))}remove(t){let{tokenize:r,processTerm:i,extractField:n,stringifyField:a,fields:o,idField:s}=this._options,l=n(t,s);if(l==null)throw new Error('MiniSearch: document does not have ID field "'.concat(s,'"'));let u=this._idToShortId.get(l);if(u==null)throw new Error("MiniSearch: cannot remove document with ID ".concat(l,": it is not in the index"));for(let c of o){let h=n(t,c);if(h==null)continue;let d=r(a(h,c),c),p=this._fieldIds[c],f=new Set(d).size;this.removeFieldLength(u,p,this._documentCount,f);for(let m of d){let g=i(m,c);if(Array.isArray(g))for(let v of g)this.removeTerm(p,u,v);else g&&this.removeTerm(p,u,g)}}this._storedFields.delete(u),this._documentIds.delete(u),this._idToShortId.delete(l),this._fieldLength.delete(u),this._documentCount-=1}removeAll(t){if(t)for(let r of t)this.remove(r);else{if(arguments.length>0)throw new Error("Expected documents to be present. Omit the argument to remove all documents.");this._index=new pQ,this._documentCount=0,this._documentIds=new Map,this._idToShortId=new Map,this._fieldLength=new Map,this._avgFieldLength=[],this._storedFields=new Map,this._nextId=0}}discard(t){let r=this._idToShortId.get(t);if(r==null)throw new Error("MiniSearch: cannot discard document with ID ".concat(t,": it is not in the index"));this._idToShortId.delete(t),this._documentIds.delete(r),this._storedFields.delete(r),(this._fieldLength.get(r)||[]).forEach((i,n)=>{this.removeFieldLength(r,n,this._documentCount,i)}),this._fieldLength.delete(r),this._documentCount-=1,this._dirtCount+=1,this.maybeAutoVacuum()}maybeAutoVacuum(){if(this._options.autoVacuum===!1)return;let{minDirtFactor:t,minDirtCount:r,batchSize:i,batchWait:n}=this._options.autoVacuum;this.conditionalVacuum({batchSize:i,batchWait:n},{minDirtCount:r,minDirtFactor:t})}discardAll(t){let r=this._options.autoVacuum;try{this._options.autoVacuum=!1;for(let i of t)this.discard(i)}finally{this._options.autoVacuum=r}this.maybeAutoVacuum()}replace(t){let{idField:r,extractField:i}=this._options,n=i(t,r);this.discard(n),this.add(t)}vacuum(t={}){return this.conditionalVacuum(t)}conditionalVacuum(t,r){return this._currentVacuum?(this._enqueuedVacuumConditions=this._enqueuedVacuumConditions&&r,this._enqueuedVacuum!=null?this._enqueuedVacuum:(this._enqueuedVacuum=this._currentVacuum.then(()=>{let i=this._enqueuedVacuumConditions;return this._enqueuedVacuumConditions=xQ,this.performVacuuming(t,i)}),this._enqueuedVacuum)):this.vacuumConditionsMet(r)===!1?Promise.resolve():(this._currentVacuum=this.performVacuuming(t),this._currentVacuum)}performVacuuming(t,r){return Qe(this,null,function*(){let i=this._dirtCount;if(this.vacuumConditionsMet(r)){let n=t.batchSize||vQ.batchSize,a=t.batchWait||vQ.batchWait,o=1;for(let[s,l]of this._index){for(let[u,c]of l)for(let[h]of c)this._documentIds.has(h)||(c.size<=1?l.delete(u):c.delete(h));this._index.get(s).size===0&&this._index.delete(s),o%n===0&&(yield new Promise(u=>setTimeout(u,a))),o+=1}this._dirtCount-=i}yield null,this._currentVacuum=this._enqueuedVacuum,this._enqueuedVacuum=null})}vacuumConditionsMet(t){if(t==null)return!0;let{minDirtCount:r,minDirtFactor:i}=t;return r=r||gQ.minDirtCount,i=i||gQ.minDirtFactor,this.dirtCount>=r&&this.dirtFactor>=i}get isVacuuming(){return this._currentVacuum!=null}get dirtCount(){return this._dirtCount}get dirtFactor(){return this._dirtCount/(1+this._documentCount+this._dirtCount)}has(t){return this._idToShortId.has(t)}getStoredFields(t){let r=this._idToShortId.get(t);if(r!=null)return this._storedFields.get(r)}search(t,r={}){let{searchOptions:i}=this._options,n=ze(ze({},i),r),a=this.executeQuery(t,r),o=[];for(let[s,{score:l,terms:u,match:c}]of a){let h=u.length||1,d={id:this._documentIds.get(s),score:l*h,terms:Object.keys(c),queryTerms:u,match:c};Object.assign(d,this._storedFields.get(s)),(n.filter==null||n.filter(d))&&o.push(d)}return t===ZB.wildcard&&n.boostDocument==null||o.sort(Coe),o}autoSuggest(t,r={}){r=ze(ze({},this._options.autoSuggestOptions),r);let i=new Map;for(let{score:a,terms:o}of this.search(t,r)){let s=o.join(" "),l=i.get(s);l!=null?(l.score+=a,l.count+=1):i.set(s,{score:a,terms:o,count:1})}let n=[];for(let[a,{score:o,terms:s,count:l}]of i)n.push({suggestion:a,terms:s,score:o/l});return n.sort(Coe),n}get documentCount(){return this._documentCount}get termCount(){return this._index.size}static loadJSON(t,r){if(r==null)throw new Error("MiniSearch: loadJSON should be given the same options used when serializing the index");return this.loadJS(JSON.parse(t),r)}static loadJSONAsync(t,r){return Qe(this,null,function*(){if(r==null)throw new Error("MiniSearch: loadJSON should be given the same options used when serializing the index");return this.loadJSAsync(JSON.parse(t),r)})}static getDefault(t){if(mQ.hasOwnProperty(t))return AQ(mQ,t);throw new Error('MiniSearch: unknown option "'.concat(t,'"'))}static loadJS(t,r){let{index:i,documentIds:n,fieldLength:a,storedFields:o,serializationVersion:s}=t,l=this.instantiateMiniSearch(t,r);l._documentIds=YB(n),l._fieldLength=YB(a),l._storedFields=YB(o);for(let[u,c]of l._documentIds)l._idToShortId.set(c,u);for(let[u,c]of i){let h=new Map;for(let d of Object.keys(c)){let p=c[d];s===1&&(p=p.ds),h.set(parseInt(d,10),YB(p))}l._index.set(u,h)}return l}static loadJSAsync(t,r){return Qe(this,null,function*(){let{index:i,documentIds:n,fieldLength:a,storedFields:o,serializationVersion:s}=t,l=this.instantiateMiniSearch(t,r);l._documentIds=yield HB(n),l._fieldLength=yield HB(a),l._storedFields=yield HB(o);for(let[c,h]of l._documentIds)l._idToShortId.set(h,c);let u=0;for(let[c,h]of i){let d=new Map;for(let p of Object.keys(h)){let f=h[p];s===1&&(f=f.ds),d.set(parseInt(p,10),yield HB(f))}++u%1e3===0&&(yield Loe(0)),l._index.set(c,d)}return l})}static instantiateMiniSearch(t,r){let{documentCount:i,nextId:n,fieldIds:a,averageFieldLength:o,dirtCount:s,serializationVersion:l}=t;if(l!==1&&l!==2)throw new Error("MiniSearch: cannot deserialize an index created with an incompatible version");let u=new ZB(r);return u._documentCount=i,u._nextId=n,u._idToShortId=new Map,u._fieldIds=a,u._avgFieldLength=o,u._dirtCount=s||0,u._index=new pQ,u}executeQuery(t,r={}){if(t===ZB.wildcard)return this.executeWildcardQuery(r);if(typeof t!="string"){let c=bt(ze(ze({},r),t),{queries:void 0}),h=t.queries.map(d=>this.executeQuery(d,c));return this.combineResults(h,c.combineWith)}let{tokenize:i,processTerm:n,searchOptions:a}=this._options,o=ze(ze({tokenize:i,processTerm:n},a),r),{tokenize:s,processTerm:l}=o,u=s(t).flatMap(c=>l(c)).filter(c=>!!c).map(x9e(o)).map(c=>this.executeQuerySpec(c,o));return this.combineResults(u,o.combineWith)}executeQuerySpec(t,r){let i=ze(ze({},this._options.searchOptions),r),n=(i.fields||this._options.fields).reduce((m,g)=>bt(ze({},m),{[g]:AQ(i.boost,g)||1}),{}),{boostDocument:a,weights:o,maxFuzzy:s,bm25:l}=i,{fuzzy:u,prefix:c}=ze(ze({},Soe.weights),o),h=this._index.get(t.term),d=this.termResults(t.term,t.term,1,t.termBoost,h,n,a,l),p,f;if(t.prefix&&(p=this._index.atPrefix(t.term)),t.fuzzy){let m=t.fuzzy===!0?.2:t.fuzzy,g=m<1?Math.min(s,Math.round(t.term.length*m)):m;g&&(f=this._index.fuzzyGet(t.term,g))}if(p)for(let[m,g]of p){let v=m.length-t.term.length;if(!v)continue;f==null||f.delete(m);let _=c*m.length/(m.length+.3*v);this.termResults(t.term,m,_,t.termBoost,g,n,a,l,d)}if(f)for(let m of f.keys()){let[g,v]=f.get(m);if(!v)continue;let _=u*m.length/(m.length+v);this.termResults(t.term,m,_,t.termBoost,g,n,a,l,d)}return d}executeWildcardQuery(t){let r=new Map,i=ze(ze({},this._options.searchOptions),t);for(let[n,a]of this._documentIds){let o=i.boostDocument?i.boostDocument(a,"",this._storedFields.get(n)):1;r.set(n,{score:o,terms:[],match:{}})}return r}combineResults(t,r=wQ){if(t.length===0)return new Map;let i=r.toLowerCase(),n=g9e[i];if(!n)throw new Error("Invalid combination operator: ".concat(r));return t.reduce(n)||new Map}toJSON(){let t=[];for(let[r,i]of this._index){let n={};for(let[a,o]of i)n[a]=Object.fromEntries(o);t.push([r,n])}return{documentCount:this._documentCount,nextId:this._nextId,documentIds:Object.fromEntries(this._documentIds),fieldIds:this._fieldIds,fieldLength:Object.fromEntries(this._fieldLength),averageFieldLength:this._avgFieldLength,storedFields:Object.fromEntries(this._storedFields),dirtCount:this._dirtCount,index:t,serializationVersion:2}}termResults(t,r,i,n,a,o,s,l,u=new Map){if(a==null)return u;for(let c of Object.keys(o)){let h=o[c],d=this._fieldIds[c],p=a.get(d);if(p==null)continue;let f=p.size,m=this._avgFieldLength[d];for(let g of p.keys()){if(!this._documentIds.has(g)){this.removeTerm(d,g,r),f-=1;continue}let v=s?s(this._documentIds.get(g),r,this._storedFields.get(g)):1;if(!v)continue;let _=p.get(g),x=this._fieldLength.get(g)[d],b=v9e(_,f,this._documentCount,x,m,l),E=i*n*h*v*b,M=u.get(g);if(M){M.score+=E,b9e(M.terms,t);let S=AQ(M.match,r);S?S.push(c):M.match[r]=[c]}else u.set(g,{score:E,terms:[t],match:{[r]:[c]}})}}return u}addTerm(t,r,i){let n=this._index.fetch(i,Boe),a=n.get(t);if(a==null)a=new Map,a.set(r,1),n.set(t,a);else{let o=a.get(r);a.set(r,(o||0)+1)}}removeTerm(t,r,i){if(!this._index.has(i)){this.warnDocumentChanged(r,t,i);return}let n=this._index.fetch(i,Boe),a=n.get(t);a==null||a.get(r)==null?this.warnDocumentChanged(r,t,i):a.get(r)<=1?a.size<=1?n.delete(t):a.delete(r):a.set(r,a.get(r)-1),this._index.get(i).size===0&&this._index.delete(i)}warnDocumentChanged(t,r,i){for(let n of Object.keys(this._fieldIds))if(this._fieldIds[n]===r){this._options.logger("warn","MiniSearch: document with ID ".concat(this._documentIds.get(t),' has changed before removal: term "').concat(i,'" was not present in field "').concat(n,'". Removing a document after it has changed can corrupt the index!'),"version_conflict");return}}addDocumentId(t){let r=this._nextId;return this._idToShortId.set(t,r),this._documentIds.set(r,t),this._documentCount+=1,this._nextId+=1,r}addFields(t){for(let r=0;r<t.length;r++)this._fieldIds[t[r]]=r}addFieldLength(t,r,i,n){let a=this._fieldLength.get(t);a==null&&this._fieldLength.set(t,a=[]),a[r]=n;let o=(this._avgFieldLength[r]||0)*i+n;this._avgFieldLength[r]=o/(i+1)}removeFieldLength(t,r,i,n){if(i===1){this._avgFieldLength[r]=0;return}let a=this._avgFieldLength[r]*i-n;this._avgFieldLength[r]=a/(i-1)}saveStoredFields(t,r){let{storeFields:i,extractField:n}=this._options;if(i==null||i.length===0)return;let a=this._storedFields.get(t);a==null&&this._storedFields.set(t,a={});for(let o of i){let s=n(r,o);s!==void 0&&(a[o]=s)}}};WB.wildcard=Symbol("*");AQ=(e,t)=>Object.prototype.hasOwnProperty.call(e,t)?e[t]:void 0,g9e={[wQ]:(e,t)=>{for(let r of t.keys()){let i=e.get(r);if(i==null)e.set(r,t.get(r));else{let{score:n,terms:a,match:o}=t.get(r);i.score=i.score+n,i.match=Object.assign(i.match,o),Ioe(i.terms,a)}}return e},[zoe]:(e,t)=>{let r=new Map;for(let i of t.keys()){let n=e.get(i);if(n==null)continue;let{score:a,terms:o,match:s}=t.get(i);Ioe(n.terms,o),r.set(i,{score:n.score+a,terms:n.terms,match:Object.assign(n.match,s)})}return r},[m9e]:(e,t)=>{for(let r of t.keys())e.delete(r);return e}},y9e={k:1.2,b:.7,d:.5},v9e=(e,t,r,i,n,a)=>{let{k:o,b:s,d:l}=a;return Math.log(1+(r-t+.5)/(t+.5))*(l+e*(o+1)/(e+o*(1-s+s*i/n)))},x9e=e=>(t,r,i)=>{let n=typeof e.fuzzy=="function"?e.fuzzy(t,r,i):e.fuzzy||!1,a=typeof e.prefix=="function"?e.prefix(t,r,i):e.prefix===!0,o=typeof e.boostTerm=="function"?e.boostTerm(t,r,i):1;return{term:t,fuzzy:n,prefix:a,termBoost:o}},mQ={idField:"id",extractField:(e,t)=>e[t],stringifyField:(e,t)=>e.toString(),tokenize:e=>e.split(w9e),processTerm:e=>e.toLowerCase(),fields:void 0,searchOptions:void 0,storeFields:[],logger:(e,t)=>{typeof(console==null?void 0:console[e])=="function"&&console[e](t)},autoVacuum:!0},Soe={combineWith:wQ,prefix:!1,fuzzy:!1,maxFuzzy:6,boost:{},weights:{fuzzy:.45,prefix:.375},bm25:y9e},_9e={combineWith:zoe,prefix:(e,t,r)=>t===r.length-1},vQ={batchSize:1e3,batchWait:10},xQ={minDirtFactor:.1,minDirtCount:20},gQ=ze(ze({},vQ),xQ),b9e=(e,t)=>{e.includes(t)||e.push(t)},Ioe=(e,t)=>{for(let r of t)e.includes(r)||e.push(r)},Coe=({score:e},{score:t})=>t-e,Boe=()=>new Map,YB=e=>{let t=new Map;for(let r of Object.keys(e))t.set(parseInt(r,10),e[r]);return t},HB=e=>Qe(null,null,function*(){let t=new Map,r=0;for(let i of Object.keys(e))t.set(parseInt(i,10),e[i]),++r%1e3===0&&(yield Loe(0));return t}),Loe=e=>new Promise(t=>setTimeout(t,e)),w9e=new RegExp("[\\\\n\\\\r\\\\p{Z}\\\\p{P}]+","u"),E9e=qo(d9e(),1),M9e=class{constructor(e){he(this,_Q),I(this,"mapData"),I(this,"indexes"),I(this,"ready"),he(this,XB),this.mapData=e,this.indexes=C9e(e),this.ready=this.populate(),xe(this,XB,oc(yt(this,_Q,Ooe).bind(this),2e3))}populate(){return Qe(this,null,function*(){let{places:e,enterpriseLocations:t,enterpriseCategories:r}=this.indexes,i=this.mapData,n=[];return e.removeAll(),n=n.concat([e.addAllAsync(i.getByType("space")),e.addAllAsync(i.getByType("point-of-interest")),e.addAllAsync(i.getByType("object")),e.addAllAsync(i.getByType("connection")),e.addAllAsync(i.getByType("floor")),e.addAllAsync(i.getByType("door")),e.addAllAsync(i.getByType("annotation")),e.addAllAsync(i.getByType("area"))]),t&&(t==null||t.removeAll(),n.push(t.addAllAsync(i.getByType("enterprise-location")))),r&&(r==null||r.removeAll(),n.push(r.addAllAsync(i.getByType("enterprise-category")))),Promise.all(n)})}search(r){return Qe(this,arguments,function*(e,t={}){var i,n;yield this.ready,B9e.parse(t);let a=(0,E9e.default)({},t,I9e),o=this.indexes.places.search(e,{fields:Object.keys(a.places.fields).filter(c=>a.places.fields[c])});a.places.limit&&(o=o.slice(0,a.places.limit));let s=(i=this.indexes.enterpriseLocations)==null?void 0:i.search(e,{fields:Object.keys(a.enterpriseLocations.fields).filter(c=>a.enterpriseLocations.fields[c])});s&&a.enterpriseLocations.limit&&(s=s.slice(0,a.enterpriseLocations.limit));let l=(n=this.indexes.enterpriseCategories)==null?void 0:n.search(e,{fields:Object.keys(a.enterpriseCategories.fields).filter(c=>a.enterpriseCategories.fields[c])});l&&a.enterpriseCategories.limit&&(l=l.slice(0,a.enterpriseCategories.limit));let u=S9e(this.mapData,{placesResult:o,locationsResult:s,categoriesResult:l});return A(this,XB).call(this,e),u})}suggest(r){return Qe(this,arguments,function*(e,t={}){yield this.ready,T9e.parse(t);let i=[],{places:{enabled:n=!0}={},enterpriseLocations:{enabled:a=!0}={}}=t;a&&this.indexes.enterpriseLocations&&this.indexes.enterpriseLocations.autoSuggest(e,{fields:["name","tags"],combineWith:"AND",prefix:!0,boost:{name:2,tags:1}}).forEach(l=>i.push(l)),n&&this.indexes.places.autoSuggest(e,{fields:["name"],combineWith:"AND",prefix:!0}).forEach(l=>i.push(l));let o=new Map;i.forEach(l=>{let u=o.get(l.suggestion);(!u||l.score>u.score)&&o.set(l.suggestion,l)});let s=Array.from(o.values());return s.sort((l,u)=>u.score-l.score),this.mapData.Analytics.capture("$query-suggest",{query:e,suggestions:s.map(l=>l.suggestion)}),s})}};XB=new WeakMap,_Q=new WeakSet,Ooe=function(e){this.mapData.Analytics.capture("$query-search",{query:e})};I9e={places:{fields:{name:!0,description:!0}},enterpriseCategories:{fields:{name:!0,description:!1,"locations.name":!0}},enterpriseLocations:{fields:{name:!0,tags:!0,description:!0}}};B9e=J.object({places:J.object({fields:J.object({name:J.boolean().optional(),description:J.boolean().optional()}).optional(),limit:J.number().positive().optional()}).optional(),enterpriseCategories:J.object({fields:J.object({name:J.boolean().optional(),description:J.boolean().optional(),"locations.name":J.boolean().optional()}).optional(),limit:J.number().positive().optional()}).optional(),enterpriseLocations:J.object({fields:J.object({name:J.boolean().optional(),tags:J.boolean().optional(),description:J.boolean().optional()}).optional(),limit:J.number().positive().optional()}).optional()}),T9e=J.object({places:J.object({enabled:J.boolean().optional()}).optional(),enterpriseLocations:J.object({enabled:J.boolean().optional()}).optional()}),P9e=new Set(["the","an","and","or","of","in","on","at","to","from","with","by","for"]),Toe=""});var Qoe={};Ra(Qoe,{ANIMATION_TWEENS:()=>q_,ATTRIBUTION_POSITIONS:()=>RB,COLLISION_WORKER_PATH:()=>CI,DEFAULT_PATH_SMOOTHING:()=>bh,MAPLIBRE_WORKER_PATH:()=>BI,MAPPEDIN_LAYER_ID:()=>KU,MapLibreOverlay:()=>jB,Navigator:()=>GB,TEXT3D_STYLE_UPDATE_PROPS:()=>v6,collisionWorkerUrl:()=>rp,configureWorker:()=>l6,createRenderer:()=>VB,debounce:()=>oc,enableTestMode:()=>Aae,interpolate:()=>SI,mountSceneGraphVisualizer:()=>toe,preloadFont:()=>_C,setCollisionWorkerUrl:()=>$x});var joe=Ot(()=>{"use strict";Zy();Rd();rh();nl();ws()});var Zoe={};Ra(Zoe,{Inspector:()=>yGe});function SQ(e){let t,r;return(t=e.match(/(#|0x)?([a-f0-9]{6})/i))?r=t[2]:(t=e.match(/rgb\\(\\s*(\\d*)\\s*,\\s*(\\d*)\\s*,\\s*(\\d*)\\s*\\)/))?r=parseInt(t[1]).toString(16).padStart(2,0)+parseInt(t[2]).toString(16).padStart(2,0)+parseInt(t[3]).toString(16).padStart(2,0):(t=e.match(/^#?([a-f0-9])([a-f0-9])([a-f0-9])$/i))&&(r=t[1]+t[1]+t[2]+t[2]+t[3]+t[3]),r?"#"+r:!1}function L9e(e){return z9e.find(t=>t.match(e))}function G9e(e){let t=document.createElement("style");t.innerHTML=e;let r=document.querySelector("head link[rel=stylesheet], head style");r?document.head.insertBefore(t,r):document.head.appendChild(t)}function Y9e(e){let t;for(t of e)t()}function Woe(e,t,r){let i={id:t.id,__type:t.__type},n=r.addFolder("".concat(t.type,"-").concat(t.id));for(let a in t){if(a==="visible"&&n.add(t,a).onChange(o=>{e.updateState(i,{[a]:o})}),a==="color"||a==="hoverColor"){t[a]=wc(t[a]),n.addColor(t,a).onChange(o=>{e.updateState(i,{[a]:o})});continue}if(a==="height"){n.add(t,a,0,20,1).onChange(o=>{e.updateState(i,{[a]:o})});continue}if(a==="texture"&&t.texture){n.addFolder("Texture - side").add(t.texture,"url").onChange(o=>{e.updateState(i,{texture:{url:o}})});continue}if(a==="topTexture"&&t.topTexture){n.addFolder("Texture - top").add(t.topTexture,"url").onChange(o=>{e.updateState(i,{topTexture:{url:o}})});continue}if(a==="opacity"){n.add(t,a,0,1,.1).onChange(o=>{e.updateState(i,{[a]:o})});continue}if(a==="altitude"){n.add(t,a,0,100,1).onChange(o=>{e.updateState(i,{[a]:o})});continue}H9e.includes(a)&&n.add(t,a).onChange(o=>{e.updateState(i,{[a]:o})})}return t.isInView&&(n.add(t,"isInView").listen().disable(),n.add(t,"isInViewCheck")),{cleanup(){n.destroy()}}}function W9e(){let e=[];function t(n,a){var o;let s=Object.values(n.getMapData())[0],l=a;if(l&&ua.is(l)){let u=(o=s.getByType("enterprise-location"))==null?void 0:o.find(c=>c.spaces.some(h=>h.id===l.id));u&&(l=u)}return l}function r(n,a){return Qe(this,null,function*(){return a instanceof xl?n.Camera.focusOn(a.locations.flatMap(o=>o.spaces),ob):a instanceof ma?n.Camera.focusOn(a.spaces,ob):n.Camera.focusOn(a,ob)})}function i(n,a,{focus:o=!1}={}){if(!window.enableHighlightCard)return()=>{};let s=t(n,a),l=document.createElement("div");if(l.style.cssText=\`
|
|
6193
6193
|
position: absolute;
|
|
6194
6194
|
top: 20px;
|
|
6195
6195
|
left: 20px;
|
|
@@ -6921,7 +6921,7 @@ See https://handlebarsjs.com/api-reference/runtime-options.html#options-to-contr
|
|
|
6921
6921
|
</div>
|
|
6922
6922
|
</div>
|
|
6923
6923
|
</div>\`):"",\`
|
|
6924
|
-
</div>\`)};H();sce=63710088e-1,oT=new WeakMap,vWe=e=>Qe(null,null,function*(){return new Promise(t=>setTimeout(t,e))});Ese=.01,Mse=.02,uce={drawDuration:1e3,color:"#40A9FF",interactive:!1,accentColor:"blue",width:{on:"zoom-level",input:[17,22],output:[2,.5]},displayArrowsOnPath:!1,animateArrowsOnPath:!1},wWe={drawDuration:1e3,color:"#B3DDFF",interactive:!1,accentColor:"#40A9FF",width:{on:"zoom-level",input:[17,22],output:[2,.5]},displayArrowsOnPath:!1,animateArrowsOnPath:!1},Op={setMapOnConnectionClick:!0,setMapToDeparture:!0,createMarkers:{departure:!0,destination:!0,connection:!0},pathOptions:uce,inactivePathOptions:wWe,markerOptions:{departureColor:oce,destinationColor:ace},animatePathDrawing:!0};EWe=bt(ze({},Op),{connectionPathOptions:cce(uce)}),MWe=class{constructor(e){he(this,en),he(this,jp,new Map),he(this,wu,new Map),he(this,ki),he(this,ni,EWe),he(this,Gp),he(this,C0),he(this,ga,[]),he(this,Ws),he(this,_u,new Map),he(this,HA,new Map),he(this,Hb,t=>{var r;if((r=A(this,ni).createMarkers)!=null&&r.connection&&t.markers!=null&&t.markers.length>0){let{instruction:i}=A(this,jp).get(t.markers[0].id);i!=null&&i.action.toFloor&&(A(this,ni).setMapOnConnectionClick&&A(this,ki).setFloor(i.action.toFloor.id,"navigation-connection-click"),A(this,ki).publish("navigation-connection-click",{instruction:i,fromFloor:i.action.fromFloor,toFloor:i.action.toFloor}))}}),xe(this,ki,e)}get isMultiFloor(){if(!A(this,ga).length)return!1;let e=new Set;for(let t of A(this,ga))for(let r of t.coordinates)if(r.floorId&&(e.add(r.floorId),e.size>1))return!0;return!1}getPathById(e){return A(this,wu).get(e)}getMarkerById(e){return A(this,jp).get(e)}get paths(){let e=new Set;return A(this,wu).forEach(t=>e.add(t)),Array.from(e)}get activeDirections(){return A(this,HA).get(A(this,Ws))}get activePath(){if(A(this,Ws))return A(this,wu).get(A(this,Ws).id)}get floorStacks(){let e=A(this,ki).getMapData();if(!A(this,ga).length||!e)return[];let t=new Set;for(let r of A(this,ga))for(let i of r.coordinates)if(i.floorId){let n=e.getById("floor",i.floorId);n&&t.add(n.floorStack)}return Array.from(t)}get floors(){let e=A(this,ki).getMapData();if(!A(this,ga).length||!e)return[];let t=new Set;for(let r of A(this,ga))for(let i of r.coordinates)if(i.floorId){let n=e.getById("floor",i.floorId);n&&t.add(n)}return Array.from(t)}setActivePathByIndex(e){let t=A(this,ga)[e];if(!A(this,ga).length){rt.warn("Cannot set an active path before drawing. Call Navigation.draw() first.");return}if(!A(this,ga)[e]){rt.warn("Direction #".concat(e," does not exist"));return}let r=A(this,_u).get(t);if(!r){rt.warn("The direction is not a part of muli-direcional path");return}yt(this,en,lP).call(this,r)}setActivePath(e){if(!A(this,ga).length){rt.warn("Cannot set an active path before drawing. Call Navigation.draw() first.");return}if(!A(this,HA).get(e)){rt.warn('Path "'.concat(e.id,'" is not a part of muli-direcional path'));return}yt(this,en,lP).call(this,e)}setActivePathByDirections(e){if(!A(this,ga).length){rt.warn("[setActivePathByDirections] Cannot set an active path before drawing. Call Navigation.draw() first.");return}let t=A(this,_u).get(e);if(!t){let r=A(this,ga).find(i=>i.id===e.id);if(!r){rt.warn("[setActivePathByDirections] Cannot find directions for id");return}t=A(this,_u).get(r)}if(!t){rt.warn("[setActivePathByDirections] Cannot find path for directions");return}yt(this,en,lP).call(this,t)}clearHighlightedPathSection(){for(let e of this.paths)for(let t of e.segments)A(this,ki).updateState(t,{highlightCompleteFraction:0})}highlightPathSection(e,t,r){var i;let n=(i=r==null?void 0:r.animationDuration)!=null?i:1500,a=A(this,ki).getMapData().mapCenter,o=lce(this.paths,e,t,a);if(!o)return;this.clearHighlightedPathSection();let s=o.map(c=>{var h,d;return A(this,ki).updateState(c.segment,{highlightStartFraction:c.startHighlightFraction,highlightEndFraction:c.endHighlightFraction,highlightColor:(h=r==null?void 0:r.color)!=null?h:"red",highlightWidthMultiplier:(d=r==null?void 0:r.widthMultiplier)!=null?d:1}),new tp({fraction:0}).to({fraction:1},n).onUpdate(p=>{A(this,ki).updateState(c.segment,{highlightCompleteFraction:p.fraction})})}),l=()=>{},u=new Promise(c=>{l=c});return s.length>0&&(s.forEach((c,h)=>{h<s.length-1&&c.chain(s[h+1]),A(this,ki).tweenGroup().add(s[h])}),s[0].start(),s[s.length-1].onComplete(()=>{A(this,ki).tweenGroup().remove(s[s.length-1]),l()})),{animation:u}}drawSync(e,t={}){var r,i,n;A(this,C0)&&this.clear(),xe(this,C0,!0),yt(this,en,M7).call(this,t);let a=Array.isArray(e)?e:[e],o=a[0],s=a[a.length-1],l=o.coordinates[0];xe(this,ga,a),l.floorId&&A(this,ni).setMapToDeparture&&A(this,ki).setFloor(l.floorId),(r=A(this,ni).createMarkers)!=null&&r.departure&&yt(this,en,F0).call(this,"departure",o.instructions[0]);for(let u=0;u<a.length;u++){let c=a[u],h=u?ze({},A(this,ni).inactivePathOptions):ze({},A(this,ni).pathOptions);if(c.coordinates.length<2){rt.warn("Directions must have at least 2 coordinates");return}let d=bt(ze({},A(this,ni).connectionPathOptions),{animateDrawing:A(this,ni).animatePathDrawing,verticalOffset:yt(this,en,Vb).call(this,u===0?"active":"inactive")}),p=yt(this,en,E7).call(this,c.coordinates,bt(ze({},h),{animateDrawing:A(this,ni).animatePathDrawing,verticalOffset:yt(this,en,Vb).call(this,u===0?"active":"inactive")}),d);A(this,_u).set(c,p),A(this,HA).set(p,c),(i=A(this,ni).createMarkers)!=null&&i.connection&&yt(this,en,S7).call(this,c.instructions,"connection"),u===0&&(xe(this,Ws,A(this,_u).get(A(this,ga)[0])),A(this,ki).externalPubSub.on("click",A(this,Hb)))}(n=A(this,ni).createMarkers)!=null&&n.destination&&yt(this,en,F0).call(this,"destination",s.instructions[s.instructions.length-1]),A(this,ki).mapObjects.forEach(u=>{u.processFloorChange(u.currentFloorId)}),yt(this,en,Yb).call(this)}draw(r){return Qe(this,arguments,function*(e,t={}){A(this,Gp)&&this.clear(),yt(this,en,M7).call(this,t);let i=Array.isArray(e)?e:[e],n=i[0].coordinates[0];return xe(this,ga,i),n.floorId&&A(this,ni).setMapToDeparture&&A(this,ki).setFloor(n.floorId),yt(this,en,hce).call(this,i)})}clear(){A(this,jp).forEach(e=>{e!=null&&e.marker&&A(this,ki).currentMap.Markers.remove(e.marker.id.toString())}),A(this,jp).clear(),A(this,wu).forEach(e=>{A(this,ki).currentMap.Paths.remove(e.segments.map(t=>t.id.toString()))}),A(this,wu).clear(),A(this,Gp)&&(A(this,Gp).cancel(),xe(this,Gp,void 0)),A(this,C0)&&xe(this,C0,!1),xe(this,ga,[]),A(this,_u).clear(),A(this,HA).clear(),xe(this,Ws,void 0),A(this,ki).externalPubSub.off("click",A(this,Hb)),A(this,ki).mapObjects.forEach(e=>{e.processFloorChange(e.currentFloorId)}),yt(this,en,Yb).call(this)}};jp=new WeakMap,wu=new WeakMap,ki=new WeakMap,ni=new WeakMap,Gp=new WeakMap,C0=new WeakMap,ga=new WeakMap,Ws=new WeakMap,_u=new WeakMap,HA=new WeakMap,en=new WeakSet,Sse=function(e){return e!=null&&["TakeConnection","ExitConnection","TakeVortex","ExitVortex"].includes(e.type)},Ise=function(){if(!A(this,Ws))return;let e=A(this,wu).get(A(this,Ws).id);if(e){for(let t of A(this,wu).values())if(t.id.includes("internal-"))if(t.id===A(this,Ws).id)for(let r of e.segments)A(this,ki).updateState(r,{verticalOffset:Mse});else A(this,ki).updateState(t,{verticalOffset:Ese})}},E7=function(e,t,r){var i,n;let a=(n=(i=t.id)==null?void 0:i.toString())!=null?n:Pi(),o=A(this,ki).currentMap.Paths.add(e,t,r),s=new Gb(a,o.animation,e,o.paths);A(this,wu).set(a,s);for(let l of o.paths)A(this,wu).set(l.id.toString(),s);return s},zQ=function(e,t,r=!1){let i=A(this,ni).markerOptions.animated,n=A(this,ki).currentMap.Markers.add(e.coordinate,t,{interactive:r,placement:"top",rank:"always-visible",animated:i}),a=A(this,ki).currentMap.Markers.getContentEl(n.id.toString());if(!a)throw new Error("marker component should exist");return new CP(n.id.toString(),a,e.coordinate)},Vb=function(e){var t,r,i,n;return e==="active"?Mse+((r=(t=A(this,ni).pathOptions)==null?void 0:t.verticalOffset)!=null?r:0):Ese+((n=(i=A(this,ni).inactivePathOptions)==null?void 0:i.verticalOffset)!=null?n:0)},hce=function(e){let t=e[0],r=e[e.length-1],i=!1;return xe(this,Gp,{promise:new Promise(n=>Qe(this,null,function*(){var a,o,s;if(Fi.env.NODE_ENV!=="test"&&(yield vWe(500)),i||!e.length){n();return}(a=A(this,ni).createMarkers)!=null&&a.departure&&yt(this,en,F0).call(this,"departure",t.instructions[0]);for(let l=0;l<e.length;l++){let u=e[l],c=l===0?ze({},A(this,ni).pathOptions):ze({},A(this,ni).inactivePathOptions);if(u.coordinates.length<2){rt.warn("Directions must have at least 2 coordinates"),n();return}let h=bt(ze({},A(this,ni).connectionPathOptions),{animateDrawing:A(this,ni).animatePathDrawing,verticalOffset:yt(this,en,Vb).call(this,l===0?"active":"inactive")}),d=yt(this,en,E7).call(this,u.coordinates,bt(ze({},c),{animateDrawing:A(this,ni).animatePathDrawing,verticalOffset:yt(this,en,Vb).call(this,l===0?"active":"inactive")}),h);if(A(this,_u).set(u,d),A(this,HA).set(d,u),l===0&&(xe(this,Ws,A(this,_u).get(A(this,ga)[0])),A(this,ki).externalPubSub.on("click",A(this,Hb))),Fi.env.NODE_ENV!=="test"&&(yield d.animation),i){n();return}(o=A(this,ni).createMarkers)!=null&&o.connection&&yt(this,en,S7).call(this,u.instructions,"connection")}if((s=A(this,ni).createMarkers)!=null&&s.destination&&yt(this,en,F0).call(this,"destination",r.instructions[r.instructions.length-1]),i){n();return}A(this,ki).mapObjects.forEach(l=>{l.processFloorChange(l.currentFloorId)}),yt(this,en,Yb).call(this),n()})),cancel:()=>{i=!0}}),A(this,Gp).promise},M7=function(e){var t,r,i;let n=ze(ze({},Op.pathOptions),e.pathOptions);xe(this,ni,{setMapOnConnectionClick:(t=e.setMapOnConnectionClick)!=null?t:Op.setMapOnConnectionClick,setMapToDeparture:(r=e.setMapToDeparture)!=null?r:Op.setMapToDeparture,pathOptions:n,inactivePathOptions:ze(ze({},Op.inactivePathOptions),e.inactivePathOptions),connectionPathOptions:cce(n),createMarkers:ze(ze({},Op.createMarkers),e.createMarkers),markerOptions:ze(ze({},Op.markerOptions),e.markerOptions),animatePathDrawing:(i=e.animatePathDrawing)!=null?i:Op.animatePathDrawing})},Yb=function(){A(this,ki).publish("navigation-state-change",{isMultiFloor:this.isMultiFloor,floorStacks:this.floorStacks,floors:this.floors,activeDirections:this.activeDirections,activePath:this.activePath,paths:this.paths})},lP=function(e){xe(this,Ws,e),A(this,ga).forEach(t=>{let r=A(this,_u).get(t);if(r){let i=r.id===A(this,Ws).id?ze({},A(this,ni).pathOptions):ze({},A(this,ni).inactivePathOptions);A(this,ki).updateState(r,i)}}),A(this,ki).publish("navigation-active-path-change",{directions:this.activeDirections,path:this.activePath}),yt(this,en,Ise).call(this),yt(this,en,Yb).call(this)},F0=function(e,t){var r,i,n,a,o;if(e==="connection"&&t){let s=t.action.type==="ExitConnection"?A(this,ni).markerOptions.departureColor:A(this,ni).markerOptions.destinationColor,l;typeof((r=A(this,ni).createMarkers)==null?void 0:r.connection)=="function"?(l=A(this,ni).createMarkers.connection(t),A(this,ki).updateState(l,{interactive:!0})):l=yt(this,en,zQ).call(this,t,yWe({type:(n=(i=t.action.connection)==null?void 0:i.type)!=null?n:t.action.connectionType,color:s,direction:t.action.direction,animated:A(this,ni).markerOptions.animated}),!0),A(this,jp).set(l.id,{instruction:t,marker:l})}else{let s=e==="departure"?A(this,ni).markerOptions.departureColor:A(this,ni).markerOptions.destinationColor,l;typeof((a=A(this,ni).createMarkers)==null?void 0:a.departure)=="function"&&e==="departure"?l=A(this,ni).createMarkers.departure(t):typeof((o=A(this,ni).createMarkers)==null?void 0:o.destination)=="function"&&e==="destination"?l=A(this,ni).createMarkers.destination(t):l=yt(this,en,zQ).call(this,t,mWe({type:e,color:s,animated:A(this,ni).markerOptions.animated})),A(this,jp).set(l.id,{instruction:t,marker:l})}},S7=function(e,t){e.filter(r=>yt(this,en,Sse).call(this,r.action)).forEach(r=>{yt(this,en,F0).call(this,t,r)})},Hb=new WeakMap;H();SWe=class{constructor(e){he(this,ZA),he(this,Cr),he(this,PP),I(this,"interactions",{set:t=>{(t==null?void 0:t.pan)!=null&&(A(this,Cr).getSystems().cameraSystem.enablePan=t.pan),(t==null?void 0:t.zoom)!=null&&(A(this,Cr).getSystems().cameraSystem.enableZoom=t.zoom),(t==null?void 0:t.bearingAndPitch)!=null&&(A(this,Cr).getSystems().cameraSystem.enableRotate=t.bearingAndPitch)},enable:()=>{A(this,Cr).getSystems().cameraSystem.enablePan=!0,A(this,Cr).getSystems().cameraSystem.enableZoom=!0,A(this,Cr).getSystems().cameraSystem.enableRotate=!0},disable:()=>{A(this,Cr).getSystems().cameraSystem.enablePan=!1,A(this,Cr).getSystems().cameraSystem.enableZoom=!1,A(this,Cr).getSystems().cameraSystem.enableRotate=!1}}),I(this,"setMinPitch",t=>{A(this,Cr).camera.setMinPitch(t)}),I(this,"setMaxPitch",t=>{A(this,Cr).camera.setMaxPitch(t)}),I(this,"setMinZoomLevel",t=>{A(this,Cr).camera.setMinZoomLevel(t,!0)}),I(this,"setMaxZoomLevel",t=>{A(this,Cr).camera.setMaxZoomLevel(t)}),xe(this,PP,e),xe(this,Cr,e.core)}setScreenOffsets(e){A(this,Cr).camera.setInsetPadding(e)}get screenOffsets(){return A(this,Cr).camera.insetsPadding}get panMode(){return A(this,Cr).camera.panMode}setPanMode(e){if(e!=="default"&&e!=="elevation")throw new Error("Invalid pan mode");e!==this.panMode&&A(this,Cr).camera.setPanMode(e)}getFocusOnTransform(e,t){var r,i,n;let a=A(this,Cr).camera.getCameraFrameForCoordinates(yt(this,ZA,I7).call(this,e),{pitch:t==null?void 0:t.pitch,bearing:t==null?void 0:t.bearing,padding:(t==null?void 0:t.screenOffsets)||this.screenOffsets,maxZoomLevel:t==null?void 0:t.maxZoomLevel,verticalPadding:(r=t==null?void 0:t.axisAlignedPadding)==null?void 0:r.vertical,minZoomLevel:t==null?void 0:t.minZoomLevel,duration:t==null?void 0:t.duration,easing:t==null?void 0:t.easing});return{center:new Tr(a.center[1],a.center[0]),zoomLevel:a.zoomLevel,bearing:(i=t==null?void 0:t.bearing)!=null?i:this.bearing,pitch:(n=t==null?void 0:t.pitch)!=null?n:this.pitch}}focusOn(e,t){var r;return A(this,Cr).camera.focusOn(yt(this,ZA,I7).call(this,e),{pitch:t==null?void 0:t.pitch,bearing:t==null?void 0:t.bearing,padding:(t==null?void 0:t.screenOffsets)||this.screenOffsets,maxZoomLevel:t==null?void 0:t.maxZoomLevel,minZoomLevel:t==null?void 0:t.minZoomLevel,duration:t==null?void 0:t.duration,verticalPadding:(r=t==null?void 0:t.axisAlignedPadding)==null?void 0:r.vertical,easing:t==null?void 0:t.easing})}animateTo(e,t){var r;let{center:i,zoomLevel:n,bearing:a,pitch:o}=e,s=i!=null?i:this.center;return A(this,Cr).camera.animateTo({center:i!=null?[s.longitude,s.latitude,A(this,Cr).camera.elevation]:void 0,zoomLevel:n,bearing:a,pitch:o,duration:(r=t==null?void 0:t.duration)!=null?r:600,easing:t==null?void 0:t.easing})}set(e){let{center:t=this.center,zoomLevel:r=this.zoomLevel,bearing:i=this.bearing,pitch:n=this.pitch}=e,a=[t.longitude,t.latitude];A(this,Cr).camera.setCenter(a),A(this,Cr).camera.setZoomLevel(r),A(this,Cr).camera.setBearing(i),A(this,Cr).camera.setPitch(n)}get center(){let e=A(this,Cr).camera.center;return new Tr(e[1],e[0],void 0)}setAutoMinZoomLevel(e){A(this,Cr).camera.setAutoMinZoomLevel(e)}get autoMinZoomLevel(){return A(this,Cr).camera.autoMinZoomLevel}get zoomLevel(){return A(this,Cr).camera.zoomLevel}get pitch(){return A(this,Cr).camera.pitch}get minPitch(){return A(this,Cr).camera.minPitch}get maxPitch(){return A(this,Cr).camera.maxPitch}get bearing(){let e=A(this,Cr).camera.bearing;return(e<0?e+360:e)%360}get minZoomLevel(){return A(this,Cr).camera.minZoomLevel}get maxZoomLevel(){return A(this,Cr).camera.maxZoomLevel}setElevation(e){A(this,Cr).camera.setElevation(e)}get elevation(){return A(this,Cr).camera.elevation}animateElevation(e,t){return A(this,Cr).camera.animateElevation(e,t)}get bounds(){return kue(A(this,Cr).getSystems().cameraSystem.panBounds,A(this,Cr).convert3DMapPositionToCoordinate)}get isAnimating(){return A(this,Cr).camera.isAnimating}cancelAnimation(){A(this,Cr).camera.cancelAnimation()}updateFacadesInView(){A(this,Cr).getSystems().geometryInFocusSystem.compute()}};Cr=new WeakMap,PP=new WeakMap,ZA=new WeakSet,lT=function(e){var t,r,i,n,a,o;let s=A(this,Cr).camera.elevation;return Tr.is(e)&&e.floorId!=null?(r=(t=A(this,Cr).getState(e.floorId))==null?void 0:t.altitude)!=null?r:s:xs.is(e)?(n=(i=A(this,Cr).getState(e.id))==null?void 0:i.altitude)!=null?n:s:"floor"in e&&xs.is(e.floor)&&(o=(a=A(this,Cr).getState(e.floor.id))==null?void 0:a.altitude)!=null?o:s},I7=function(e){var t;let r=[],i=(Array.isArray(e)?e:[e]).flatMap(n=>{var a;return(a=n==null?void 0:n.focusTarget)!=null?a:[n]});for(let n of i)if(n!=null)if(Tr.is(n)){let a=yt(this,ZA,lT).call(this,n);r.push([n.longitude,n.latitude,a])}else if((n==null?void 0:n.id)!=null){let a=yt(this,ZA,lT).call(this,n);if(xs.is(n)&&(t=A(this,PP).getMapDataInternal())!=null&&t.enterpriseMode){r.push(n.id);continue}else if("geoJSON"in n&&n.geoJSON.geometry.coordinates.length>0){A_(n.geoJSON,s=>{r.push([s[0],s[1],a])});continue}let o=A(this,Cr).getBoundingArea(n.id);if(o)r.push(...o.map(s=>[s[0],s[1],a]));else if("geoJSONBoundingBox"in n){let s=yt(this,ZA,lT).call(this,n);if(n.geoJSONBoundingBox!=null){let l=[[n.geoJSONBoundingBox[0],n.geoJSONBoundingBox[1],s],[n.geoJSONBoundingBox[2],n.geoJSONBoundingBox[3],s]];r.push(...l)}}}else KVe(n)&&r.push(n);return r};H();IWe=class{constructor({currentMapGetter:e}){he(this,Fb),xe(this,Fb,e)}get currentMap(){return A(this,Fb).call(this)}getCurrentSceneGLTF(e){return Qe(this,null,function*(){let t=A(this,Fb).call(this);return t?t==null?void 0:t.Exporter.getCurrentSceneGLTF(e):(rt.error("There is no map to export. Please load a map first."),new Blob)})}};Fb=new WeakMap;H();CWe=class{constructor({currentMapGetter:e}){he(this,Tc,new Map),he(this,uP),xe(this,uP,e)}get currentMap(){return A(this,uP).call(this)}getAll(){return Array.from(A(this,Tc).values()).map(e=>e.label)}getById(e){return A(this,Tc).get(e)}add(e,t,r){let i=e.anchorTarget,n=this.currentMap;if(!n)throw new Error("currentMap should exist");let a=n.Labels.add(i,t,bt(ze({},r),{attachTo:q7(e),rank:(r==null?void 0:r.rank)==null||(r==null?void 0:r.rank)==="initial"?"medium":r.rank})),o=new IP(a.id.toString(),t,e);return A(this,Tc).set(o.id,{label:o,entityId:o.id}),o}__EXPERIMENTAL__all(e){var t;let r=[];return(t=this.currentMap)==null||t.Labels.all({onCreate:(i,n,a)=>{let o=new IP(i.toString(),n,a);A(this,Tc).set(o.id,{label:o,entityId:o.id}),r.push(o)},labelOptions:e}),r}remove(e){var t;let r=A(this,Tc).get(e.id);r&&((t=this.currentMap)==null||t.Labels.remove(r),A(this,Tc).delete(e.id.toString()))}removeAll(){let e=[];return A(this,Tc).forEach(({label:t})=>{this.remove(t),e.push(t),A(this,Tc).delete(t.id.toString())}),e}};Tc=new WeakMap,uP=new WeakMap;H();H();H();H();BWe=qo(Mle(),1);PWe=TWe,Cse=.2,Bse=.1,zb=251,DWe=!1;Dse=class{constructor(e,t,r,i){I(this,"renderer"),I(this,"mapObject"),I(this,"config"),I(this,"wallsId"),I(this,"maskedWallsId"),I(this,"voidWallsId"),I(this,"maskedVoidWallsId"),I(this,"ceilingId"),I(this,"ceilingMaskId"),I(this,"basementMaskId"),I(this,"footprintColor"),I(this,"layer"),I(this,"groupContainer");var n;this.renderer=e,this.mapObject=t,this.config=i;let a=$A;if(i.obstructions!=null&&i.obstructions.features.length>0){let o=i.obstructions.features.filter(s=>{var l;return s.geometry.type==="LineString"&&((l=s.properties.kind)==null?void 0:l.toLowerCase())==="wall"&&s.properties.footprintComponent===!0});if(o!=null&&o.length>0){let s=i.styleMap[(n=o[0].properties)==null?void 0:n.id];s!=null&&(a=s)}}this.footprintColor=a.color,this.groupContainer=this.renderer.addGroupContainer("Footprint-".concat(i.floorId),{visible:!1},r),this.layer=this.renderer.addGroupContainer("".concat(a7,"-").concat(i.floorId),{visible:!1},this.groupContainer.id.toString())}getFloorAltitudes(){return this.mapObject.getFloorStackAltitudeData(this.config.floorStackId)}getVisualHeight(){var e,t;if(this.config.fixedHeight!=null)return this.config.fixedHeight;let r=((e=this.getFloorAltitudes())!=null?e:new Map).get(this.config.elevation);return(t=r==null?void 0:r.visualHeight)!=null?t:0}get footprintGeometry(){return this.config.footprintGeometry}buildWalls(){let e=Pse(this.config.footprintGeometry.geometry,{id:"Footprint-Floor-".concat(this.config.floorId)}).geometry.coordinates.map((n,a)=>({type:"Feature",geometry:{type:"LineString",coordinates:n},properties:{id:"Footprint-Floor-Section-".concat(this.config.floorId,"-").concat(a)}})),t=this.getVisualHeight(),r="front";this.wallsId="Footprint-Walls-".concat(this.config.floorId);let i={color:this.footprintColor,height:t,altitude:0,width:Bse,outline:!1,visible:!0,opacity:1,side:r,renderOrder:2};this.config.elevation<0&&(i.__EXPERIMENTAL_maskMode="masked-object",i.__EXPERIMENTAL_maskEffect="reveal",i.__EXPERIMENTAL_maskEnabled=!0,i.__EXPERIMENTAL_maskId=zb),this.renderer.addGeometryGroup(this.wallsId,{features:e},i,this.groupContainer)}buildVoidWalls(e){if(!e||e.length===0)return;let t=[],r=0;for(let o of e){let s=Pse(o.geometry,{id:"Void-Wall-".concat(this.config.floorId,"-").concat(r)});for(let l of s.geometry.coordinates)t.push({type:"Feature",geometry:{type:"LineString",coordinates:l},properties:{id:"Void-Wall-Section-".concat(this.config.floorId,"-").concat(r)}}),r++}if(t.length===0)return;let i=this.getVisualHeight(),n="front";this.voidWallsId="Void-Walls-".concat(this.config.floorId);let a={color:this.footprintColor,height:i,altitude:0,width:Bse,outline:!1,visible:!0,opacity:1,side:n,renderOrder:2};this.config.elevation<0&&(a.__EXPERIMENTAL_maskMode="masked-object",a.__EXPERIMENTAL_maskEffect="reveal",a.__EXPERIMENTAL_maskEnabled=!0,a.__EXPERIMENTAL_maskId=zb),this.renderer.addGeometryGroup(this.voidWallsId,{features:t},a,this.groupContainer)}buildCeiling(e){let t=ze({},this.config.footprintGeometry);t=kse(t),(e==null?void 0:e.length)>0&&(t=kWe(t,e));let r="front";this.ceilingId="Ceiling-".concat(this.config.floorId);let i=this.getVisualHeight(),n={color:this.footprintColor,height:-Cse,altitude:i,visible:!0,outline:!1,opacity:1,side:r};this.config.elevation<0&&(n.__EXPERIMENTAL_maskMode="masked-object",n.__EXPERIMENTAL_maskEffect="reveal",n.__EXPERIMENTAL_maskEnabled=!0,n.__EXPERIMENTAL_maskId=zb),this.renderer.addGeometryGroup(this.ceilingId,{features:[bt(ze({},t),{properties:{id:"Footprint-Ceiling-".concat(this.config.floorId),externalId:this.config.externalId,elevation:this.config.elevation}})]},n,this.groupContainer)}buildBasementMask(){let e=this.config.footprintGeometry;e=kse(e),this.basementMaskId="Footprint-Basement-Mask-".concat(this.config.floorId),this.renderer.addGeometryGroup(this.basementMaskId,{features:[bt(ze({},e),{properties:{id:"Footprint-Basement-Mask-Geometry-".concat(this.config.floorId)}})]},{color:Rse(-1),altitude:0,visible:!1,height:.01,outline:!1,__EXPERIMENTAL_maskEnabled:!0,__EXPERIMENTAL_maskMode:"mask",__EXPERIMENTAL_maskId:zb},"outdoors-container"),DWe&&this.renderer.addGeometryGroup(this.basementMaskId+"debug",{features:[bt(ze({},e),{properties:{id:"Footprint-Basement-Mask-Geometry-".concat(this.config.floorId,"-debug")}})]},{color:Rse(-1),altitude:0,opacity:.5,visible:!1,height:.01,outline:!1},"outdoors-container")}update(e){var t;if(e.basementMaskEnabled!==void 0&&this.basementMaskId&&(this.renderer.setState(this.basementMaskId,{visible:e.basementMaskEnabled}),this.renderer.setState(this.basementMaskId+"debug",{visible:e.basementMaskEnabled})),(t=this.config.multiFloorView)!=null&&t.footprintsHidden)return;let r={};e.altitude!==void 0&&(r.altitude=e.altitude),e.visible!==void 0&&(r.visible=e.visible),Object.keys(r).length>0&&this.renderer.setState(this.groupContainer.id,r);let i={};e.opacity!==void 0&&(i.opacity=e.opacity),e.side!==void 0&&(i.side=e.side),e.color!==void 0&&(i.color=e.color),e.outline!==void 0&&(i.outline=e.outline);let n={};if(e.height!==void 0&&(i.height=e.height,n.altitude=e.height),this.wallsId&&Object.keys(i).length>0&&this.renderer.setState(this.wallsId,i),this.voidWallsId&&Object.keys(i).length>0&&this.renderer.setState(this.voidWallsId,i),this.maskedWallsId&&Object.keys(i).length>0){let a=i,{outline:o}=a,s=Co(a,["outline"]);Object.keys(s).length>0&&this.renderer.setState(this.maskedWallsId,s)}if(this.maskedVoidWallsId&&Object.keys(i).length>0){let a=i,{outline:o}=a,s=Co(a,["outline"]);Object.keys(s).length>0&&this.renderer.setState(this.maskedVoidWallsId,s)}if(e.opacity!==void 0&&(n.opacity=e.opacity),e.color!==void 0&&(n.color=e.color),e.ceilingVisible!==void 0&&(n.visible=e.ceilingVisible),e.outline!==void 0&&(n.outline=e.outline),this.ceilingId&&Object.keys(n).length>0&&this.renderer.setState(this.ceilingId,n),this.ceilingMaskId&&Object.keys(n).length>0){let a=n,{outline:o}=a,s=Co(a,["outline"]);Object.keys(s).length>0&&this.renderer.setState(this.ceilingMaskId,s)}}getState(){var e,t;let r=this.renderer.getState(this.groupContainer.id),i=r.altitude,n=r.visible,a=this.ceilingId?this.renderer.getState(this.ceilingId):void 0,o=a==null?void 0:a.visible,s=(e=a==null?void 0:a.height)!=null?e:Cse,l=this.basementMaskId?(t=this.renderer.getState(this.basementMaskId))==null?void 0:t.visible:void 0;if(this.wallsId){let u=this.renderer.getState(this.wallsId),c=u.height;return{altitude:i,visible:n,opacity:u.opacity,side:u.side,color:u.color,height:c,ceilingVisible:o,basementMaskEnabled:l,outline:u.outline,ceilingThickness:s}}return{altitude:i,visible:n,ceilingVisible:o,basementMaskEnabled:l,ceilingThickness:s}}};Rse=e=>e===0?"red":e===-1?"blue":e===-2?"green":"black",RWe={color:"#ffffff",opacity:1},$A={altitude:0,height:1,color:"#ffffff",opacity:1,width:.15},Fse={opacity:.25,color:"#a7d1ec",height:.8,width:.05,altitude:.1,cap:"square",visible:!1},LQ={color:"red",opacity:.2,height:$A.height+.1,visible:!0,borderVisible:!1},zse=.5,du=class{constructor(e,t,r=new Map){I(this,"containerId"),I(this,"layers"),I(this,"renderer"),this.containerId=t,this.layers=r,this.renderer=e}get visible(){var e;return((e=this.renderer.getState(this.containerId))==null?void 0:e.visible)===!0}setVisible(e){this.visible!==e&&this.renderer.setState(this.containerId,{visible:e})}},Lse=0,Ose=class{constructor(e,t,r,i,n,a,o,s){I(this,"id"),I(this,"name"),I(this,"elevation"),I(this,"maxHeight"),I(this,"containerId"),I(this,"externalId"),I(this,"metadata"),I(this,"shortName"),I(this,"subtitle"),I(this,"occluderId"),I(this,"loaded",!1),I(this,"styleMap",{}),I(this,"obstructions"),I(this,"entrances"),I(this,"spaces"),I(this,"floorImages"),I(this,"floorText"),I(this,"areas"),I(this,"renderer"),I(this,"mapObject"),I(this,"options"),I(this,"layers",new Map),I(this,"footprint"),I(this,"ceiling"),I(this,"floorStackId"),I(this,"multiFloorView"),I(this,"mapDataInternal"),I(this,"_computedMaxHeight"),I(this,"facadesByStyleId",new Map),I(this,"footprintObject"),I(this,"gapFootprintObject"),he(this,B0),I(this,"load",(m=!1)=>{var g,v,_,x,b,E,M,S,D,T,P,k,R,F,B,z,O,j;if(this.loaded)return this;((g=this.footprint)==null?void 0:g.geometry)==null&&((v=this.obstructions)==null?void 0:v.features.length)===0&&((_=this.spaces)==null?void 0:_.features.length)===0&&rt.warn("Floor ".concat(this.id," exists in the data but contains no geometry.")),this.loaded=!0;let Y=this.renderer.addGroupContainer("".concat(N0,"-").concat(this.id),{},this.id);this.layers.set(N0,new du(this.renderer,Y.id.toString()));let Z=this.renderer.addGroupContainer("".concat(qA,"-").concat(this.id),{},this.id);this.layers.set(qA,new du(this.renderer,Z.id.toString()));let ne=this.renderer.addGroupContainer("".concat(Da,"-").concat(this.id),{focusable:m},this.id);this.layers.set(Da,new du(this.renderer,ne.id.toString()));let ie=this.renderer.addGroupContainer("".concat(U0,"-").concat(this.id),{},this.id);this.layers.set(U0,new du(this.renderer,ie.id.toString()));let le=this.renderer.addGroupContainer("".concat(Q0,"-").concat(this.id),{},this.id);if(this.layers.set(Q0,new du(this.renderer,le.id.toString())),(x=this.multiFloorView)!=null&&x.__EXPERIMENTAL_DEBUG_showVoids){let X=0;for(let ce of this.voids)this.renderer.addGeometryGroup("Void-".concat(this.id,"-").concat(X),{features:[ce]},{color:"red"},ne),X++}if((b=this.multiFloorView)!=null&&b.__EXPERIMENTAL_DEBUG_showOpenToBelow){let X=0;for(let ce of this.spacesOpenToBelow)this.renderer.addGeometryGroup("SpacesOpenToBelow-".concat(this.id,"-").concat(X),{features:[ce]},{color:"blue"},ne),X++}if(this.spaces!=null&&this.spaces.features.length>0){let X=[],ce=new Map,ge=(E=this.multiFloorView)==null?void 0:E.__EXPERIMENTAL_excludeSpaceIdsInAutoHeightCalculation,be=ge!=null&&ge.length>0?new Set(ge):void 0;for(let Ye of this.spaces.features){if(Ye.geometry.type!=="Polygon")continue;let We=(M=Ye.properties.kind)==null?void 0:M.toLowerCase();if(We==="void"||We==="otb")continue;let Me=this.styleMap[Ye.properties.id];if(Me!=null&&"height"in Me&&(Me==null?void 0:Me.height)!=null&&(be==null||!be.has(Ye.properties.id))){let oe=((S=Me.altitude)!=null?S:0)+Me.height;(this._computedMaxHeight==null||oe>this._computedMaxHeight)&&(this._computedMaxHeight=oe)}let Ce=(D=this.mapDataInternal)==null?void 0:D.facadesBySpaceId[Ye.properties.id];if(Ce){let oe=ce.get(Ce.id);oe==null&&(oe=[],ce.set(Ce.id,oe)),oe.push(Ye)}else X.push(Ye)}let _e=this.renderer.addGroupContainer("spaces-".concat(this.id),{},ne),ke=this.renderer.addGeometryGroup("Spaces-".concat(this.id,"-0"),{features:X},Ye=>{var We;return((We=Ye==null?void 0:Ye.properties)==null?void 0:We.id)!=null&&this.styleMap[Ye.properties.id]!=null?ub(this.styleMap[Ye.properties.id],this.options):RWe},_e);if(this.layers.get(Da).layers.set("Spaces",ke.id.toString()),ce.size>0){let Ye=this.renderer.addGroupContainer("".concat(jb,"-").concat(this.id),{},this.id);this.layers.set(jb,new du(this.renderer,Ye.id.toString()));for(let[We,Me]of ce){let Ce=this.renderer.addGroupContainer(We,{focusable:!0},Ye),oe=this.renderer.addGroupContainer("".concat(We,"-geometry"),{},Ce),it=cse(Me,this.styleMap),Oe=0;for(let[Ke,Le]of it){let Ze=this.renderer.addGeometryGroup("Facades-".concat(this.id,"-").concat(We,"-").concat(Oe),{features:Le},bt(ze({},ub(Ke,this.options)),{renderOrder:3}),oe);Oe++;let ut=Ke.id||Ze.id.toString();this.layers.get(jb).layers.set("".concat(We,"-").concat(ut),Ze.id.toString()),this.facadesByStyleId.has(ut)?(T=this.facadesByStyleId.get(ut))==null||T.push(We):this.facadesByStyleId.set(ut,[We])}}}}if(((P=this.footprint)==null?void 0:P.geometry)!=null&&this.footprint.geometry.coordinates.length>0&&this.styleMap!=null&&(this.footprintObject=new Dse(this.renderer,this.mapObject,this.id,{floorId:this.id,externalId:this.externalId,elevation:this.elevation,floorStackId:this.floorStackId,footprintGeometry:this.footprint,obstructions:this.obstructions,styleMap:this.styleMap,multiFloorView:this.multiFloorView}),this.layers.set(a7,new du(this.renderer,this.footprintObject.layer.id.toString())),this.footprint=fHe(this.footprint)),this.obstructions!=null&&this.obstructions.features.length>0){let X=this.obstructions.features.filter(Ce=>Ce.geometry.type==="Polygon"&&(Ce.properties.kind==="object"||Ce.properties.kind==="unknown")),ce=cse(X,this.styleMap),ge=this.renderer.addGroupContainer("objects-".concat(this.id),{},ne),be=0;for(let[Ce,oe]of ce){let it=this.renderer.addGeometryGroup("Objects-".concat(this.id,"-").concat(be),{features:oe},ub(Ce,this.options),ge);be++;let Oe=ge.id.toString();this.layers.get(Da).layers.set(Ce.id||Oe,it.id.toString())}let _e=this.obstructions.features.filter(Ce=>{var oe;return Ce.geometry.type==="LineString"&&((oe=Ce.properties.kind)==null?void 0:oe.toLowerCase())==="wall"&&Ce.properties.footprintComponent===!1}),ke=this.obstructions.features.filter(Ce=>{var oe;return Ce.geometry.type==="LineString"&&((oe=Ce.properties.kind)==null?void 0:oe.toLowerCase())==="wall"&&Ce.properties.footprintComponent===!0}),Ye=this.entrances,We=$A,Me=$A;if(_e!=null&&_e.length>0){let Ce=this.styleMap[(k=_e[0].properties)==null?void 0:k.id];Ce!=null&&(We=ze({},Ce)),Me=We;let{walls:oe,entrances:it}=use(_e,(Ye==null?void 0:Ye.features)||[]),Oe=Math.max(We.height-.11,zse),Ke=bt(ze({},Fse),{height:Oe}),Le=this.renderer.addGeometryGroup("InteriorDoors-".concat(this.id),it,Ke,ne);this.layers.get(Da).layers.set(V7,Le.id.toString());let Ze=this.renderer.addGeometryGroup("Walls-".concat(this.id),{features:[oe]},ub(We,this.options),ne);this.layers.get(Da).layers.set(LP,Ze.id.toString())}if(ke!=null&&ke.length>0){let Ce=this.styleMap[(R=ke[0].properties)==null?void 0:R.id];Ce!=null&&(Me=bt(ze({},Ce),{id:O0}));let{walls:oe,entrances:it}=use(ke,(Ye==null?void 0:Ye.features)||[]),Oe=Math.max(Me.height-.11,zse),Ke=bt(ze({},Fse),{height:Oe}),Le=this.renderer.addGeometryGroup("ExteriorDoors-".concat(this.id),it,Ke,ne);this.layers.get(Da).layers.set(Y7,Le.id.toString());let Ze=this.renderer.addGeometryGroup("ExteriorWalls-".concat(this.id),{features:[oe]},ub(Me,this.options),ne);this.layers.get(Da).layers.set(O0,Ze.id.toString())}}if(this.floorImages!=null){let X=this.renderer.addGroupContainer("images-".concat(this.id),{},this.id);for(let ce of this.floorImages.features||[]){let ge="anchorId"in ce.properties?ce.properties.anchorId:null,be=ge==null,_e=ge!=null&&this.mapDataInternal!=null&&this.mapDataInternal.pointsOfInterestById[ge]!=null;if(be||_e){let ke=hHe(ce,Lse),Ye=(((F=ce.properties.rotation)!=null?F:0)%360+360)%360;if(_e){let We=new Tr({latitude:ce.geometry.coordinates[1],longitude:ce.geometry.coordinates[0],floorId:this.id});this.mapDataInternal.Query.at(We).then(Me=>{var Ce,oe,it;let Oe=0;for(let Ke of Me)if(ua.is(Ke)){let Le=(oe=(Ce=this.renderer.getState(Ke.id))==null?void 0:Ce.height)!=null?oe:0;Le>Oe&&(Oe=Le)}this.mapObject.api.Image3D.add(new Tr({latitude:ce.geometry.coordinates[1],longitude:ce.geometry.coordinates[0],floorId:this.id,verticalOffset:Oe}),ce.properties.path,bt(ze({id:ke,flipImageToFaceCamera:(it=this.options.flipImagesToFaceCamera)!=null?it:!0},ce.properties),{rotation:Ye}))})}else this.mapObject.api.Image3D.add(new Tr({latitude:ce.geometry.coordinates[1],longitude:ce.geometry.coordinates[0],floorId:this.id}),ce.properties.path,bt(ze({id:ke,flipImageToFaceCamera:(B=this.options.flipImagesToFaceCamera)!=null?B:!0},ce.properties),{rotation:Ye}));Lse++}}this.layers.set(H7,new du(this.renderer,X.id.toString()))}if(this.floorText!=null)for(let X of this.floorText.features||[]){let ce=0;"geometryId"in X.properties?ce=(O=(z=this.renderer.getState(X.properties.geometryId))==null?void 0:z.height)!=null?O:0:ce=(j=X.properties.verticalOffset)!=null?j:0,this.renderer.addText3D(Pi(),bt(ze({},X),{properties:bt(ze({},X.properties),{verticalOffset:ce})}),{appearance:{flipToFaceCamera:!1}},this.id)}if(this.areas!=null){let X=this.renderer.addGroupContainer("areas-".concat(this.id),{},this.id);this.layers.set(EP,new du(this.renderer,X.id.toString()));let ce=this.renderer.addGeometryGroup("Areas-".concat(this.id),{features:this.areas.features},{color:LQ.color,height:LQ.height},X);for(let ge of this.areas.features||[])this.renderer.setState(ge.properties.id,bt(ze({},LQ),{visible:!1}));this.layers.get(EP).layers.set(ce.id.toString(),ce.id.toString())}return this.renderer.render(),this});var l,u,c,h,d,p;this.mapObject=r,this.renderer=r.renderer,this.id=t.id,this.options=n;let f=this.renderer.addGroupContainer(this.id,{visible:!1,interactive:!0,preloadGeometry:(l=n.preloadFloors)==null?void 0:l.map(m=>m.id).includes(t.id)},e);if(this.containerId=f.id.toString(),this.externalId=t.externalId,this.metadata=t.metadata,this.shortName=t.shortName,this.subtitle=t.subtitle,this.name=t.name,this.maxHeight=t.maxHeight,this.elevation=t.elevation,a!=null&&o!=null){this.styleMap=o,this.spaces=a.space[this.id],this.entrances=a.entrance[this.id],this.areas=(u=a.area)==null?void 0:u[this.id],this.obstructions=a.obstruction[this.id],this.floorImages=(c=a.floorImages)==null?void 0:c[this.id],this.floorText=(d=(h=a.enterprise)==null?void 0:h.floorText)==null?void 0:d[this.id];let m=(p=a["floor.geojson"])==null?void 0:p.features.find(g=>g.properties.id===t.id);m&&m.geometry!=null&&m.geometry.coordinates.length>0&&(this.footprint=m)}this.floorStackId=e,this.multiFloorView=i,this.mapDataInternal=s}get geometryMaxHeight(){return this._computedMaxHeight}get spacesOpenToBelowEnabled(){var e,t;return(t=(e=this.multiFloorView)==null?void 0:e.spacesOpenToBelowEnabled)!=null?t:!1}get voids(){var e,t,r,i;return(i=(r=(t=(e=this.mapDataInternal)==null?void 0:e.voidsByFloorId[this.id])==null?void 0:t.voids)==null?void 0:r.features)!=null?i:[]}get spacesOpenToBelow(){var e,t;if(!this.spaces)return[];let r=[];for(let i of this.spaces.features)i.geometry.type==="Polygon"&&(((e=i.properties.kind)==null?void 0:e.toLowerCase())==="void"||((t=i.properties.kind)==null?void 0:t.toLowerCase())==="otb")&&r.push(i);return r}get geoJSONBoundingBox(){if(A(this,B0))return A(this,B0);if(!this.footprint){rt.warn("Attempting to get bounding box with no footprint for floor ".concat(this.id));return}return xe(this,B0,uHe(this.footprint)),A(this,B0)}addOccluder(){var e;if(((e=this.footprint)==null?void 0:e.geometry)==null)return;let t=this.renderer.addGroupContainer("".concat(wP,"-").concat(this.id),{},this.id),r=new du(this.renderer,t.id.toString());this.layers.set(wP,r),this.occluderId=this.renderer.addOccluder(this.footprint,r.containerId)}get hasFacadeGeometry(){return this.facadesByStyleId.size>0}get visible(){return this.renderer.getState(this.containerId).visible}setVisible(e){this.renderer.setState(this.containerId,{visible:e})}buildCeiling(e){this.footprintObject&&this.footprintObject.buildCeiling(e)}buildBasementMask(){this.footprintObject&&this.footprintObject.buildBasementMask()}buildGapFootprint(e,t){var r;((r=this.footprint)==null?void 0:r.geometry)!=null&&(this.gapFootprintObject=new Dse(this.renderer,this.mapObject,this.id,{floorId:"gap-below-".concat(this.id),externalId:this.externalId,elevation:this.elevation,floorStackId:this.floorStackId,footprintGeometry:this.footprint,obstructions:void 0,styleMap:{},multiFloorView:this.multiFloorView,fixedHeight:e}),this.gapFootprintObject.buildWalls(),this.gapFootprintObject.buildCeiling(t),this.gapFootprintObject.update({altitude:-e,visible:!1}))}getFootprintStyle(){var e;let t=$A;if(this.obstructions!=null&&this.obstructions.features.length>0){let r=this.obstructions.features.filter(i=>{var n;return i.geometry.type==="LineString"&&((n=i.properties.kind)==null?void 0:n.toLowerCase())==="wall"&&i.properties.footprintComponent===!0});r!=null&&r.length>0&&(t=this.styleMap[(e=r[0].properties)==null?void 0:e.id])}return t}buildFootprint(){if(!this.footprintObject)return;this.footprintObject.buildWalls(),this.footprintObject.buildVoidWalls(this.voids);let e=new du(this.renderer,this.footprintObject.layer.id.toString());this.layers.set(a7,e)}setBatchedTextVisible(e){let t=this.renderer.getInternalState().geometry3DMap.get(this.id);if(t&&t instanceof Vi){let r=this.renderer.getSystems().text3DSystem.batchedTextMap.get(t);r&&r.then(i=>{i.visible=e})}}};B0=new WeakMap;H();Nse=class{constructor(e,t,r,i){I(this,"id"),I(this,"externalId"),I(this,"name"),I(this,"type"),I(this,"floorIds"),I(this,"defaultFloorId"),I(this,"floorObjects",[]),I(this,"floorObjectsByElevation",new Map),I(this,"metadata"),I(this,"containerId"),I(this,"facade"),I(this,"renderer"),I(this,"altitudeMap",new Map),he(this,Lb);var n;this.id=e.id,this.externalId=e.externalId,this.name=e.name,this.type=e.type,this.metadata=e.metadata,this.floorIds=(n=e.floors)!=null?n:e.maps,this.defaultFloorId=e.defaultFloor;let a=r.addGroupContainer(this.id,{visible:!0,interactive:!0},t);this.containerId=a.id.toString(),this.facade=i,this.renderer=r}get defaultFloor(){if(A(this,Lb)==null){if(this.floorObjects.length===0)throw new no("No floors in floor stack (".concat(this.id,"). Could not get default floor."));let e;this.defaultFloorId&&(e=this.floorObjects.find(t=>t.id===this.defaultFloorId)),e||(e=this.floorObjects.reduce((t,r)=>Math.abs(r.elevation)<Math.abs(t.elevation)?r:t)),xe(this,Lb,e)}return A(this,Lb)}get isOutdoors(){var e;return((e=this.type)==null?void 0:e.toLowerCase())==="outdoor"?!0:this.facade!=null?!1:this.floorObjects.some(t=>t.hasFacadeGeometry)}addFloor(e){if(this.floorObjectsByElevation.has(e.elevation)){rt.error("Floor with same elevation ".concat(e.elevation," already exists in Stack (").concat(this.id,"). Floor (").concat(e.id,") will not be added."));return}this.floorObjects.push(e),this.floorObjectsByElevation.set(e.elevation,e)}loadAllFloors(e){this.floorObjects.sort((t,r)=>t.elevation-r.elevation);for(let t of this.floorObjects)t.load(this.facade!=null),!this.isOutdoors&&!t.hasFacadeGeometry&&t.footprint!=null&&t.addOccluder();if(this.altitudeMap=dHe(this.floorObjects,e==null?void 0:e.floorGap,e==null?void 0:e.floorGapMultiplier,e==null?void 0:e.floorGapFallback,e==null?void 0:e.__EXPERIMENTAL_disableGapFilling),e!=null&&e.enabled)for(let t of this.floorObjects){let r=this.altitudeMap.get(t.elevation);r&&this.renderer.setState(t.id,{altitude:r.altitude})}if(!this.isOutdoors){for(let t of this.floorObjects){let r=this.floorObjectsByElevation.get(t.elevation+1),i=[];if(t.spacesOpenToBelowEnabled){for(let n of t.voids)i.push(n);if(r)for(let n of r.spacesOpenToBelow)i.push(n)}t.buildCeiling(i),t.buildFootprint(),t.elevation<=0&&t.buildBasementMask()}if(e!=null&&e.enabled&&!e.__EXPERIMENTAL_disableGapFilling){let t=pHe(this.floorObjects,this.altitudeMap,e.floorGap,e.floorGapMultiplier,e.floorGapFallback);for(let r of t){let i=this.floorObjectsByElevation.get(r.floorAboveElevation);if(!i)continue;let n=i.spacesOpenToBelow;i.buildGapFootprint(r.height,n)}}}}};Lb=new WeakMap;H();FWe=5,zWe="#ffffff";H();H();Use="path",pu={color:"#4b90e2",width:1,completeFraction:0,visible:!0,verticalOffset:.1,xrayOpacity:.25,__EXPERIMENTAL_SMOOTHING_TENSION:SN.tension,__EXPERIMENTAL_SMOOTHING_CORNER_RADIUS:SN.cornerRadius,dashed:!1,__EXPERIMENTAL_ENDCAP_EXTENSION:[.5,.5],__EXPERIMENTAL_BILLBOARDING:!1,__EXPERIMENTAL_PREVENT_SELF_OVERLAP:!1},nj=dt.object({type:dt.literal(Use).default(Use),color:dt.string().default(pu.color),width:dt.union([dt.number(),dt.any()]),completeFraction:dt.number().default(pu.completeFraction),visible:dt.boolean().default(pu.visible),verticalOffset:dt.number().default(pu.verticalOffset),highlightStartFraction:dt.number().default(0),highlightEndFraction:dt.number().default(0),highlightColor:dt.string().default("red"),highlightWidthMultiplier:dt.number().default(1.1),highlightCompleteFraction:dt.number().default(1),xrayOpacity:dt.number().min(0).max(1).default(pu.xrayOpacity),__EXPERIMENTAL_SMOOTHING_TENSION:dt.number().default(pu.__EXPERIMENTAL_SMOOTHING_TENSION),__EXPERIMENTAL_SMOOTHING_CORNER_RADIUS:dt.number().default(pu.__EXPERIMENTAL_SMOOTHING_CORNER_RADIUS),dashed:dt.boolean().default(pu.dashed),__EXPERIMENTAL_DASH_OPTIONS:dt.discriminatedUnion("__EXPERIMENTAL_DASH_MODE",[dt.object({__EXPERIMENTAL_DASH_MODE:dt.literal("length-scaling"),__EXPERIMENTAL_DASH_LENGTH:dt.number().min(0).max(1).default(.1),__EXPERIMENTAL_DASH_GAP:dt.number().min(0).max(1).default(.1)}),dt.object({__EXPERIMENTAL_DASH_MODE:dt.literal("width-scaling"),__EXPERIMENTAL_DASH_SIZE:dt.number().min(0).default(3),__EXPERIMENTAL_GAP_SIZE:dt.number().min(0).default(2)}),dt.object({__EXPERIMENTAL_DASH_MODE:dt.literal("absolute"),__EXPERIMENTAL_DASH_METERS:dt.number().min(0).default(1),__EXPERIMENTAL_GAP_METERS:dt.number().min(0).default(.5)})]).optional(),__EXPERIMENTAL_GEOMETRY:dt.enum(["tube","ribbon"]).default("tube"),__EXPERIMENTAL_ENDCAP_EXTENSION:dt.tuple([dt.number(),dt.number()]).default(pu.__EXPERIMENTAL_ENDCAP_EXTENSION),__EXPERIMENTAL_BILLBOARDING:dt.boolean().default(pu.__EXPERIMENTAL_BILLBOARDING),__EXPERIMENTAL_BORDER:dt.object({enabled:dt.boolean(),color:dt.custom(e=>typeof e=="string"),width:dt.number().optional()}).optional(),__EXPERIMENTAL_PREVENT_SELF_OVERLAP:dt.boolean().default(pu.__EXPERIMENTAL_PREVENT_SELF_OVERLAP)}),Qse=nj.partial(),Sft=dt.strictObject(nj.shape);jse=class extends Ki{constructor(e,t,r,i){var n,a,o,s;super(),I(this,"floorStacksById",new Map),I(this,"floorsById",new Map),I(this,"startingFloorId",""),I(this,"currentFloorId",""),I(this,"currentFloorStackId",""),I(this,"outdoorFloorStacks",new Set),I(this,"id"),I(this,"renderer"),I(this,"api"),I(this,"mvf"),I(this,"options",{}),I(this,"styleMap"),I(this,"animations",new Map),I(this,"Models",{add:(h,d,p)=>{var f;let m=p,{floorId:g,scale:v}=m,_=Co(m,["floorId","scale"]),x=g?this.floorsById.get(g):void 0,b=x==null?void 0:x.layers.get(Q0),E=ze({},_);v!=null&&(E.scale=Array.isArray(p.scale)?p.scale:[p.scale,p.scale,p.scale]);let M=this.renderer.addModelGroup(h,{type:"FeatureCollection",features:d.map(S=>({type:"Feature",properties:{id:Pi(),rotation:p.rotation,scale:E.scale,interactive:p.interactive},geometry:{type:"Point",coordinates:Rc(S)}}))},E,{parent:(f=b==null?void 0:b.containerId)!=null?f:x==null?void 0:x.id});if(M==null)throw new no("error creating model");return this.renderer.getState(M).children},remove:(h,d)=>{this.renderer.remove(h)}}),I(this,"Image3D",{add:(h,d,p)=>{var f;let m=p,{floorId:g,flipImageToFaceCamera:v,maxImageSize:_}=m,x=Co(m,["floorId","flipImageToFaceCamera","maxImageSize"]),b=g?this.floorsById.get(g):this.currentFloor,E={type:"Feature",properties:x,geometry:{type:"Point",coordinates:h}};return this.renderer.addImage((f=p.id)!=null?f:Pi(),E,{url:d,flipImageToFaceCamera:v!=null?v:!1,maxImageSize:_},b.id)},remove:h=>{this.renderer.remove(h)},removeAll:()=>{}}),I(this,"Markers",{add:(h,d,p)=>{let f=QT(h,this.floorsById,this.api.mapObjects[0].floorsById.get("default-floor")),m=p,{attachTo:g}=m,v=Co(m,["attachTo"]),_=v;v.rank==="initial"&&(_.rank="medium");let x=f.layers.get(qA),b=this.renderer.addMarker2D(Rc(h),d,bt(ze({},_),{occluderId:f==null?void 0:f.occluderId,attachTo:g}),x==null?void 0:x.containerId);if(!b)throw new no("Failed to create Marker");return b},remove:h=>{this.renderer.remove(h)},getContentEl:h=>{let d=this.renderer.getState(h);if((d==null?void 0:d.type)==="marker")return d.element},removeAll:()=>{},setPosition:(h,d,p)=>{var f;let m=this.renderer.getState(h),g=p?this.floorsById.get(p):this.currentFloor;if(!m){rt.error('Failed to retrieve state for Marker with id "'.concat(h,'".'));return}if(m.type!=="marker"){rt.error('Geometry with id "'.concat(h,'" is not of type "marker".'));return}this.renderer.setState(m,{position:d,parent:(f=g==null?void 0:g.layers.get(qA))==null?void 0:f.containerId})},animateTo:(h,d,p,f)=>{let m=this.renderer.getState(h),g=p?this.floorsById.get(p):this.currentFloor;if(!m)return rt.error('Failed to retrieve state for Marker with id "'.concat(h,'".')),Promise.resolve();if(m.type!=="marker")return rt.error('Geometry with id "'.concat(h,'" is not of type "marker".')),Promise.resolve();let v=ze({duration:1e3,easing:"ease-in-out"},f);this.cancelAnimation(h);let _=new tp({lon:m.position[0],lat:m.position[1]}).to({lon:d[0],lat:d[1]},v.duration).easing(fy[v.easing]).onUpdate(({lon:x,lat:b})=>{var E;if(!this.renderer.getState(h))this.cancelAnimation(h);else{let M=(E=g==null?void 0:g.layers.get(qA))==null?void 0:E.containerId;M&&this.Markers.setPosition(h,[x,b],M)}}).start();return this.renderer.getInternalTweenGroup().add(_),this.renderer.render(),this.animations.set(h,_),dse(_).then(()=>{this.animations.delete(h)})}}),I(this,"Exporter",{getCurrentSceneGLTF:h=>Qe(this,null,function*(){return this.renderer.getCurrentSceneGLTF(h)})}),I(this,"Shapes",{add:(h,d,p)=>{let f=p!=null&&p.floorId?this.floorsById.get(p==null?void 0:p.floorId):this.currentFloor,m="shape-"+Pi();return this.renderer.addGeometryGroup(m,h,d,f.id),m},remove:h=>(this.renderer.remove(h.id),h.id)}),I(this,"Text3D",{label:(h,d,p)=>{var f;if(!((f=this.api.getMapDataInternal())!=null&&f.enterpriseMode)){rt.warn("Enterprise mode is not enabled, skipping label creation");return}let m=Gse(this.renderer,h,d,p);if(m)return{textInfo:m,target:h}},labelAll:(h={})=>{var d;if(!((d=this.api.getMapDataInternal())!=null&&d.enterpriseMode))return rt.warn("Enterprise mode is not enabled, skipping label creation"),[];let p=this.api.getMapData();if(!p)return[];let f=[];return p.getByType("space").forEach(m=>{var g,v;if(m.enterpriseLocations[0]){let _=Gse(this.renderer,m,(v=(g=m.enterpriseLocations[0])==null?void 0:g.name)!=null?v:m.name,h);_&&f.push({textInfo:_,target:m})}}),f},add:(h,d,p)=>{var f;let{rotation:m=0,appearance:g}=p,{fontSize:v=12,color:_="black",font:x=""}=g!=null?g:{},b=QT(h,this.floorsById,this.api.mapObjects[0].floorsById.get("default-floor")),E={type:"Feature",properties:{text:d,rotation:m,verticalOffset:(f=h.verticalOffset)!=null?f:0,fontSize:v,color:_,align:"center",visible:!0,fontFamily:x},geometry:{type:"Point",coordinates:Rc(h)}},M=Pi();return this.renderer.addText3D(M,E,{appearance:bt(ze({},g),{fontSize:v,color:_,font:x||void 0})},b.id)},remove:h=>(this.renderer.remove(h),h)}),I(this,"Labels",{all:({onCreate:h,labelOptions:d={}})=>{for(let p of Object.entries(this.mvf.space)){let[f,m]=p;m&&m.features.forEach(g=>{var v,_,x,b;let E=(v=this.api.getMapData())==null?void 0:v.getById("space",g.properties.id);if(!E)return;let M=(_=this.styleMap[g.properties.id])==null?void 0:_.showImage,S=(x=g.properties.details)==null?void 0:x.images,D=M&&(b=S==null?void 0:S[0])!=null&&b.url?{icon:S[0].url}:{},T=ze({icon:D.icon},d.appearance),P=(f?this.floorsById.get(f):this.currentFloor).layers.get(N0);if(g.properties.center&&E.name!==""){let k=this.renderer.addLabel2D(g.properties.center,E.name,bt(ze({id:g.properties.id+"-label"},d),{appearance:T,rank:d.rank,attachTo:q7(E)}),ua.is(E)?E.id:P==null?void 0:P.containerId);k&&h(k.id,E.name,E)}})}},add:(h,d,p={})=>{let f=p,{attachTo:m}=f,g=Co(f,["attachTo"]),v=QT(h,this.floorsById,this.api.mapObjects[0].floorsById.get("default-floor")),_=v.layers.get(N0),x=this.renderer.addLabel2D(Rc(h),d,bt(ze({},g),{occluderId:v.occluderId,attachTo:m}),_==null?void 0:_.containerId);if(!x)throw new no("label creating failed");return x},remove:({entityId:h})=>{this.renderer.remove(h)},removeAll:()=>{}}),I(this,"Paths",{add:(h,d,p)=>{var f,m;let g=d?DP(d):void 0,v=(f=d==null?void 0:d.animateDrawing)!=null?f:!0,_=[],x=h[0].floorId||"root",b=0;for(let M of h){let S=(m=M.floorId)!=null?m:x,{latitude:D,longitude:T}=M;S!==x&&(b++,x=S),_[b]==null&&_.push({floorId:S,coordinates:[]});let P=M.floorId===S?M:new Tr({longitude:T,latitude:D,floorId:S});_[b].coordinates.push(P)}let E=_.reduce((M,{floorId:S,coordinates:D},T)=>{var P,k,R,F,B,z,O,j,Y;if(T!==0){let ie=_[T-1],le=ie.coordinates[ie.coordinates.length-1],X=D[0],ce=Rc(le),ge=Rc(X),be=this.floorsById.get(ie.floorId),_e=this.floorsById.get(S),ke=be==null?void 0:be.floorStackId,Ye=_e==null?void 0:_e.floorStackId,We=ke?this.getFloorStackAltitudeData(ke):void 0,Me=Ye?this.getFloorStackAltitudeData(Ye):void 0,Ce=(R=(k=We==null?void 0:We.get((P=be==null?void 0:be.elevation)!=null?P:0))==null?void 0:k.altitude)!=null?R:0,oe=(z=(B=Me==null?void 0:Me.get((F=_e==null?void 0:_e.elevation)!=null?F:0))==null?void 0:B.altitude)!=null?z:0,it=(O=p==null?void 0:p.__EXPERIMENTAL_JUNCTION_INSET)!=null?O:0;nHe(ce,ge,it,Ce,oe);let Oe=rHe(p==null?void 0:p.__EXPERIMENTAL_BILLBOARDING,Ce,oe,ce,ge),Ke=p?bt(ze({},p),{__EXPERIMENTAL_BILLBOARDING:Oe}):g,Le=Ke?DP(Ke):g,Ze=this.renderer.addPath({type:"FeatureCollection",features:[{type:"Feature",properties:{parentId:ie.floorId},geometry:{type:"Point",coordinates:ce}},{type:"Feature",properties:{parentId:S},geometry:{type:"Point",coordinates:ge}}]},Le,this.id);Ze&&(v&&this.renderer.setState(Ze.id,{completeFraction:0}),M.push(bt(ze({},Ze),{coordinates:[le,X]})))}if(D.length<2)return M;let Z=(Y=(j=this.floorsById.get(S))==null?void 0:j.layers.get(U0))==null?void 0:Y.containerId,ne=this.renderer.addPath({type:"FeatureCollection",features:D.map(ie=>({type:"Feature",properties:{},geometry:{type:"Point",coordinates:Rc(ie)}}))},g,Z!=null?Z:S);return ne&&(v&&this.renderer.setState(ne.id,{completeFraction:0}),M.push(bt(ze({},ne),{coordinates:D}))),M},[]);if(v){let M=[],S=this.api.getMapData();return E.forEach(D=>{var T;let P=cHe(D,S,this.api);M.push(new tp({fraction:0}).to({fraction:1},P?(T=d==null?void 0:d.drawDuration)!=null?T:1500:0).onUpdate(k=>{this.renderer.setState(D.id,{completeFraction:k.fraction})}))}),M.forEach((D,T)=>{T<M.length-1&&D.chain(M[T+1]),this.renderer.getInternalTweenGroup().add(D)}),M[0].start(),this.renderer.render(),this.animations.set(E[0].id.toString(),M[0]),{paths:E,animation:dse(M[M.length-1]).then(()=>{this.animations.delete(E[0].id.toString())})}}else return{paths:E,animation:Promise.resolve()}},remove:h=>{h.forEach(d=>{this.cancelAnimation(d),this.renderer.remove(d)})}}),he(this,$i,{enabled:!1,floorGap:"auto",updateCameraElevationOnFloorChange:!0,footprintColor:$A.color,footprintOpacity:void 0,footprintOutline:!0,spacesOpenToBelowEnabled:!1}),this.renderer=i.core,this.api=i,this.id=e,this.renderer.addGroupContainer(e,{},"root"),this.options=r!=null?r:{},this.mvf=(n=t==null?void 0:t.mvf)!=null?n:{};let l=lHe(this.mvf["styles.json"]||{});if(this.styleMap=l,xe(this,$i,ze(ze({},A(this,$i)),r==null?void 0:r.multiFloorView)),!t){this.id!=="outdoors-container"&&rt.warn("Map (".concat(this.id,") created with no data."));let h=new Nse({id:"default-stack",externalId:"default-stack",name:"Default Stack",maps:["default-floor"]},this.id,this.renderer);this.floorStacksById.set(h.id,h),this.currentFloorStackId=h.id;let d=new Ose(h.id,{id:"default-floor",externalId:"default-floor",name:"Default Floor",elevation:0},this,A(this,$i),r!=null?r:{});this.floorsById.set(d.id,d),h.addFloor(d),this.setFloor(d.id);return}let u=t.getMVFFeatureByType("floor-stack");if(u==null||u.length===0)throw new no("MVF does not contain any Floor Stacks.");for(let h of u){let d=new Nse(h,this.id,this.renderer,(a=this.mvf.facade)==null?void 0:a[h.id]);for(let p of d.floorIds){let f=t.getMVFFeatureById("floor",p);if(f!=null){let m=new Ose(d.id,f,this,A(this,$i),r!=null?r:{},this.mvf,l,t);this.floorsById.set(m.id,m),d.addFloor(m)}}if(d.floorObjects.length<1){rt.warn("Floor stack ".concat(h.id," has no floors. It will not be loaded."));continue}this.floorStacksById.set(h.id,d),this.currentFloorStackId||(this.currentFloorStackId=h.id)}for(let[h]of Object.entries(t.facadesBySpaceId)){let d=t.getById("space",h);d&&(this.outdoorFloorStacks.add(d.floor.floorStack.id),(o=this.floorsById.get(d.floor.id))==null||o.setVisible(!0))}let c=(s=this.mvf.enterprise)==null?void 0:s.venue.defaultMap;if(r!=null&&r.initialFloor){let h=i7(r.initialFloor);h&&this.floorsById.has(h)?c=h:rt.error("Invalid initial floor specified (".concat(r.initialFloor,"), using default behavior instead"))}c||(c=this.currentFloorStack.defaultFloor.id),this.startingFloorId=c}get currentFloorStack(){let e=this.floorStacksById.get(this.currentFloorStackId);if(!e)throw new no('Current floor stack with id "'.concat(this.currentFloorStackId,'" not found'));return e}setFloorStack(e,t){if(this.currentFloorStackId===e)return;let r=this.floorStacksById.get(e);if(r==null){rt.error("Invalid floor stack passed to setFloorStack (".concat(e,"), the floor stack was not changed. Current floor stack is still ").concat(this.currentFloorStack.id,"."));return}if(r.floorObjects.length===0){rt.error("Floor stack (".concat(e,") has no floors. The floor stack was not changed. Current floor stack is still ").concat(this.currentFloorStack.id,"."));return}this.setFloor(r.defaultFloor.id,t)}get currentFloor(){let e=this.floorsById.get(this.currentFloorId);if(!e)throw new no('Floor with id "'.concat(this.currentFloorId,'" not found'));return e}get floors(){return Array.from(this.floorsById.values())}processFloorChange(e){var t,r,i,n,a,o,s,l,u,c,h,d,p;if(this.api.manualFloorVisibility===!0)return;let f=(t=this.api.getMapDataInternal())==null?void 0:t.getById("floor",e),m=(r=this.api.getMapDataInternal())==null?void 0:r.getById("floor-stack",this.currentFloorStackId);if(f&&m){let g=f.floorStack.id===(m==null?void 0:m.id),v=(i=this.api.getMapDataInternal())==null?void 0:i.getById("floor-stack",f.floorStack.id);if((n=A(this,$i))!=null&&n.enabled&&v){if(!g)for(let x of this.floorStacksById.values())x.id===v.id||x.isOutdoors||x.floorObjects.forEach(b=>{b.setVisible(!1)});let _=ij(v.floors,f,((o=(a=this.api.Navigation)==null?void 0:a.floors)==null?void 0:o.map(x=>x.id))||[],this.getFloorStackAltitudeData(v.id),{color:(s=A(this,$i).footprintColor)!=null?s:$A.color,opacity:A(this,$i).footprintOpacity,outline:(l=A(this,$i).footprintOutline)!=null?l:!0,spacesOpenToBelowEnabled:(u=A(this,$i).spacesOpenToBelowEnabled)!=null?u:!1,spacesOpenToBelowVisualEffectEnabled:A(this,$i).spacesOpenToBelowVisualEffectEnabled,spacesOpenToBelowVisualEffectDarkenAmount:A(this,$i).spacesOpenToBelowVisualEffectDarkenAmount,spacesOpenToBelowVisualEffectDarkenUseDepth:A(this,$i).spacesOpenToBelowVisualEffectDarkenUseDepth,spacesOpenToBelowVisualEffectDesaturateAmount:A(this,$i).spacesOpenToBelowVisualEffectDesaturateAmount,spacesOpenToBelowVisualEffectDesaturateUseDepth:A(this,$i).spacesOpenToBelowVisualEffectDesaturateUseDepth,spacesOpenToBelowVisualEffectWashOutAmount:A(this,$i).spacesOpenToBelowVisualEffectWashOutAmount,spacesOpenToBelowVisualEffectWashOutUseDepth:A(this,$i).spacesOpenToBelowVisualEffectWashOutUseDepth});if((h=(c=this.api)==null?void 0:c.Outdoor)==null||h.setOpacity(_.outdoorOpacity),_.floorStates.forEach(x=>{var b;if(x.floor){let E=(b=this.api.getMapData())==null?void 0:b.getById("floor",x.floor.id);E&&this.api.updateState(E,x.state)}}),A(this,$i).updateCameraElevationOnFloorChange){let x=this.getFloorStackAltitudeData(v.id);this.api.Camera.setElevation((p=(d=x.get(f.elevation))==null?void 0:d.altitude)!=null?p:0)}}else for(let _ of this.floorStacksById.values())_.floorObjects.forEach(x=>{x.id!==e&&x.setVisible(!1)})}}updateMultiFloorViewEffects(e){xe(this,$i,ze(ze({},A(this,$i)),e)),this.processFloorChange(this.currentFloorId)}getMultiFloorViewEffects(){var e,t,r,i,n,a,o;return{spacesOpenToBelowVisualEffectEnabled:(e=A(this,$i).spacesOpenToBelowVisualEffectEnabled)!=null?e:!0,spacesOpenToBelowVisualEffectDarkenAmount:(t=A(this,$i).spacesOpenToBelowVisualEffectDarkenAmount)!=null?t:.2,spacesOpenToBelowVisualEffectDarkenUseDepth:(r=A(this,$i).spacesOpenToBelowVisualEffectDarkenUseDepth)!=null?r:!0,spacesOpenToBelowVisualEffectDesaturateAmount:(i=A(this,$i).spacesOpenToBelowVisualEffectDesaturateAmount)!=null?i:0,spacesOpenToBelowVisualEffectDesaturateUseDepth:(n=A(this,$i).spacesOpenToBelowVisualEffectDesaturateUseDepth)!=null?n:!0,spacesOpenToBelowVisualEffectWashOutAmount:(a=A(this,$i).spacesOpenToBelowVisualEffectWashOutAmount)!=null?a:0,spacesOpenToBelowVisualEffectWashOutUseDepth:(o=A(this,$i).spacesOpenToBelowVisualEffectWashOutUseDepth)!=null?o:!1}}setFloor(e,t){if(this.currentFloorId===e)return;if(!this.floorsById.get(e)){rt.error("Invalid floor passed to setFloor (".concat(e,"), the floor was not changed. Current floor is still ").concat(this.currentFloor.id));return}let r=this.currentFloorId;this.publish("floor-change-start",{previousFloorId:r,floorId:e,reason:t}),this.currentFloorStack&&this.processFloorChange(e),this.currentFloorId=e,this.currentFloorStackId=this.currentFloor.floorStackId,this.currentFloor.setVisible(!0),this.updateOutdoorPathLayerVisibility(),this.publish("floor-change",{reason:t,floorId:this.currentFloor.id,previousFloorId:r})}updateOutdoorPathLayerVisibility(){var e;let t=this.api.hidePathsNotOnCurrentFloor===!0&&!((e=this.options.multiFloorView)!=null&&e.enabled);for(let r of this.floorsById.values()){let i=this.floorStacksById.get(r.floorStackId);if(!(i!=null&&i.isOutdoors))continue;let n=r.layers.get(U0);if(!n)continue;let a=!t||r.id===this.currentFloor.id;n.setVisible(a)}}getFloorStackAltitudeData(e){var t,r;return(r=(t=this.floorStacksById.get(e))==null?void 0:t.altitudeMap)!=null?r:new Map}cancelAnimation(e){let t=this.animations.get(e);t&&(t.stop(),this.animations.delete(e),this.renderer.getInternalTweenGroup().remove(t))}loadAllFloors(){for(let e of this.floorStacksById.values())e.loadAllFloors(A(this,$i))}};$i=new WeakMap;H();UWe=class{constructor({currentMapGetter:e}){he(this,mu,new Map),he(this,cP),xe(this,cP,e)}get currentMap(){return A(this,cP).call(this)}getAll(){return Array.from(A(this,mu).values()).map(({marker:e})=>e)}getById(e){return A(this,mu).get(e)}add(e,t,r){var i;let n=e.anchorTarget;if(!n)throw new Error("get coordinate failed");let a=this.currentMap;if(!a)throw new Error("currentMap should exist");let o=a.Markers.add(n,t,bt(ze({},r),{rank:(r==null?void 0:r.rank)||"medium",dynamicResize:(i=r==null?void 0:r.dynamicResize)!=null?i:!0,attachTo:q7(e)}));if(o==null)throw new Error("error creating marker");let s=a.Markers.getContentEl(o.id.toString());if(!s)throw new Error("marker component should exist");let l=new CP(o.id.toString(),s,e);return A(this,mu).set(l.id,{marker:l,entityId:o.id.toString()}),l}remove(e){var t;let r=A(this,mu).get(e.id);r&&((t=this.currentMap)==null||t.Markers.remove(r.entityId),A(this,mu).delete(e.id.toString()))}removeAll(){let e=[];return A(this,mu).forEach(({marker:t})=>{this.remove(t),e.push(t),A(this,mu).delete(t.id.toString())}),e}setPosition(e,t){var r;let i=t.anchorTarget;if(!i){rt.error("Cannot determine coordinate from target.");return}let n=this.currentMap;if(!n){rt.error("Cannot determine the current map.");return}let a=A(this,mu).get(e.id);if(!a){rt.error('Cannot find the Marker with id "'.concat(e.id,'".'));return}n.Markers.setPosition(a.entityId,Rc(i),(r=i.floorId)!=null?r:n.currentFloorId),a.marker.updateTarget(t)}animateTo(e,t,r){var i;let n=t.anchorTarget;if(!n)return rt.error("Cannot determine coordinate from target."),Promise.resolve();let a=this.currentMap;if(!a)return rt.error("Cannot determine the current map."),Promise.resolve();let o=A(this,mu).get(e.id);return o?(o.marker.updateTarget(t),a.Markers.animateTo(o.entityId,Rc(n),(i=n.floorId)!=null?i:a.currentFloorId,r)):(rt.error('Cannot find the Marker with id "'.concat(e.id,'".')),Promise.resolve())}};mu=new WeakMap,cP=new WeakMap;H();QWe=class{constructor({currentMapGetter:e,mapDataInternalGetter:t}){he(this,C7),he(this,Np,new Map),he(this,hP),he(this,Wb),xe(this,hP,e),xe(this,Wb,t)}get currentMap(){return A(this,hP).call(this)}getById(e){return A(this,Np).get(e)}add(e,t,r){var i,n,a;let o=e.anchorTarget;if(!o)throw new Error("Target does not implement IAnchorable.");let s=this.currentMap;if(!s)throw new Error("currentMap should exist");let l=s.Image3D.add(Rc(o),t,bt(ze({},r),{floorId:o.floorId,verticalOffset:o.verticalOffset+((i=r.verticalOffset)!=null?i:0)}));if(!l)throw new Error("image component should exist");let u=(n=A(this,Wb))==null?void 0:n.call(this),c=new $b(l.id.toString(),t,e,u==null?void 0:u.tokenManager);if(A(this,Np).set(c.id,{image:c,entityId:l.id.toString(),anchorId:r.anchorId}),r.anchorId!=null&&u!=null){let h=(a=u.floorImagesByAnchorId.get(r.anchorId))!=null?a:[];h.push(c),u.floorImagesByAnchorId.set(r.anchorId,h)}return c}remove(e){var t;let r=A(this,Np).get(e.id);r&&((t=this.currentMap)==null||t.Image3D.remove(r.entityId),A(this,Np).delete(e.id),yt(this,C7,Ace).call(this,r.anchorId,e))}removeAll(){let e=[];return A(this,Np).forEach(({image:t})=>{this.remove(t),e.push(t),A(this,Np).delete(t.id.toString())}),e}};Np=new WeakMap,hP=new WeakMap,Wb=new WeakMap,C7=new WeakSet,Ace=function(e,t){var r,i;if(e==null)return;let n=(i=(r=A(this,Wb))==null?void 0:r.call(this))==null?void 0:i.floorImagesByAnchorId;if(n==null)return;let a=n.get(e);if(a==null)return;let o=a.filter(s=>s!==t);o.length===0?n.delete(e):n.set(e,o)};H();jWe=class{constructor({currentMapGetter:e,mapDataInternalGetter:t}){he(this,Nh,new Map),he(this,dP),he(this,pP),xe(this,dP,e),xe(this,pP,t)}get currentMap(){return A(this,dP).call(this)}getById(e){return A(this,Nh).get(e)}add(e,t,r){let i=[e],n=i.reduce((s,l)=>{var u,c;if(!l)return rt.error("Cannot determine coordinate from options."),s;let h=(u=QT(l,this.currentMap.floorsById,this.currentMap.floorsById.get("default-floor")))==null?void 0:u.id;return s.has(h)||s.set(h,[]),(c=s.get(h))==null||c.push(l),s},new Map);if(!i.length)throw new Error("targets should not be empty when adding a model");let a=this.currentMap;if(!a)throw new Error("currentMap should exist");let o=[];return n.forEach((s,l)=>{var u;let c=Pi();a.Models.add(c,s,bt(ze({},r),{url:t,floorId:l,verticalOffset:s[0].verticalOffset+((u=r==null?void 0:r.verticalOffset)!=null?u:0)})).forEach(h=>{let d=new ece(h.toString(),c,s[0]);A(this,Nh).set(d.id,{model:d,entityId:h.toString(),groupId:c}),o.push(d)})}),o[0]}all(){var e,t,r;let i=(e=A(this,pP))==null?void 0:e.call(this);if(!i)return[];let n=i.getByType("enterprise-venue");if(!n)return[];let a=(t=n.extra)==null?void 0:t.models;if(!((r=a==null?void 0:a.models)!=null&&r.length))return[];let o=[];for(let s of a.models){if(!(s!=null&&s.url)||!s.coordinate||!i.getById("floor",s.coordinate.floorId))continue;let l=new Tr({latitude:s.coordinate.latitude,longitude:s.coordinate.longitude,floorId:s.coordinate.floorId,verticalOffset:s.coordinate.verticalOffset}),u=this.add(l,s.url,{visible:!0,rotation:s.rotation,scale:s.scale,material:{Default:{color:s.color},Fabric:{color:s.color}},EXPERIMENTAL_clippingEnabled:!!s.manifolded});o.push(u)}return o}remove(e){var t;let r=A(this,Nh).get(e.id);r&&((t=this.currentMap)==null||t.Models.remove(r.entityId,r.groupId),A(this,Nh).delete(e.id.toString()))}removeAll(){let e=[];return A(this,Nh).forEach(({model:t})=>{var r;let i=A(this,Nh).get(t.id);i&&(e.push(t),(r=this.currentMap)==null||r.Models.remove(i.entityId,i.groupId),A(this,Nh).delete(t.id.toString()))}),e}};Nh=new WeakMap,dP=new WeakMap,pP=new WeakMap;H();GWe=class{constructor({currentMapGetter:e}){he(this,Pc,new Map),he(this,fP),xe(this,fP,e)}get currentMap(){return A(this,fP).call(this)}getById(e){var t;return(t=A(this,Pc).get(e))==null?void 0:t.path}add(e,t){let r=this.currentMap;if(!r)throw new Error("currentMap should exist");let i=r.Paths.add(e,t),n=i.paths.map(o=>o.id.toString()),a=new Gb((t==null?void 0:t.id)||Pi(),i.animation,e,i.paths);for(let o of n)A(this,Pc).set(o,{path:a,entityIds:n});return A(this,Pc).set(a.id,{path:a,entityIds:n}),a}highlightPathSection(e,t,r,i){var n,a,o,s;let l=(a=(n=this.currentMap)==null?void 0:n.api.getMapData())==null?void 0:a.mapCenter;if(!l)return;let u=lce([e],t,r,l);if(!u)return;let c=(o=i==null?void 0:i.animationDuration)!=null?o:1500,h=()=>{},d=new Promise(f=>{h=f}),p=new tp({fraction:0}).to({fraction:1},c).onUpdate(f=>{var m;for(let g of u)(m=this.currentMap)==null||m.api.updateState(g.segment,{highlightCompleteFraction:f.fraction})}).onStart(()=>{var f,m,g;for(let v of u)(g=this.currentMap)==null||g.api.updateState(v.segment,{highlightStartFraction:v.startHighlightFraction,highlightEndFraction:v.endHighlightFraction,highlightColor:(f=i==null?void 0:i.color)!=null?f:"red",highlightWidthMultiplier:(m=i==null?void 0:i.widthMultiplier)!=null?m:1})}).onComplete(()=>{var f;h(),(f=this.currentMap)==null||f.api.removeTween(p)});return(s=this.currentMap)==null||s.api.tweenGroup().add(p),p.start(),{animation:d}}clearHighlightedPathSection(e){var t;(t=this.currentMap)==null||t.api.updateState(e,{highlightCompleteFraction:0,highlightStartFraction:0,highlightEndFraction:0})}clearAllHighlightedPathSections(){for(let e of A(this,Pc).values())this.clearHighlightedPathSection(e.path)}remove(e){var t;let r=A(this,Pc).get(e.id);r&&((t=this.currentMap)==null||t.Paths.remove(r.entityIds),A(this,Pc).delete(e.id),r.entityIds.forEach(i=>A(this,Pc).delete(i)))}removeAll(){let e=[];return A(this,Pc).forEach(({path:t})=>{this.remove(t),e.push(t)}),e}};Pc=new WeakMap,fP=new WeakMap;H();VWe=class{constructor({currentMapGetter:e}){he(this,Up,new Map),he(this,AP),xe(this,AP,e)}get currentMap(){return A(this,AP).call(this)}getById(e){return A(this,Up).get(e)}add(e,t,r){let i=this.currentMap;if(!i)throw new Error("currentMap should exist");let n=i.Shapes.add(e,t||{},{floorId:r==null?void 0:r.id}),a=new oP(n);return A(this,Up).set(a.id,a),a}remove(e){var t;A(this,Up).get(e.id)&&((t=this.currentMap)==null||t.Shapes.remove(e),A(this,Up).delete(e.id.toString()))}removeAll(){let e=[];return A(this,Up).forEach(t=>{this.remove(t),e.push(t.id),A(this,Up).delete(t.id.toString())}),e}};Up=new WeakMap,AP=new WeakMap;H();YWe=class{constructor({currentMapGetter:e}){he(this,mP),xe(this,mP,e)}get currentMap(){return A(this,mP).call(this)}setFromStyleCollection(e){var t,r,i,n,a;for(let o in e)for(let s of((t=this.currentMap)==null?void 0:t.floors)||[]){if(e[o]==null||!s.layers.has(Da))continue;let l=s.layers.get(Da);for(let h of Object.values(e))if(h&&"polygons"in h&&"color"in h)for(let d of h.polygons)(r=this.currentMap)==null||r.renderer.setState(d,{color:h.color});if(l!=null&&l.layers.has(o)&&"color"in e[o]){let h=l.layers.get(o);h&&((i=this.currentMap)==null||i.renderer.setState(h,{color:e[o].color}))}if(l&&o===LP&&!(O0 in e)){let h=l.layers.get(O0);h&&"color"in e[o]&&((n=this.currentMap)==null||n.renderer.setState(h,{color:e[o].color}))}if(!s.layers.has(jb))continue;let u=s.layers.get(jb),c=s.facadesByStyleId.get(o);if(c&&c.length>0)for(let h of c){let d=u.layers.get("".concat(h,"-").concat(o));d&&"color"in e[o]&&((a=this.currentMap)==null||a.renderer.setState(d,{color:e[o].color}))}}}};mP=new WeakMap;H();OQ={opacity:1},HWe=class{constructor(e,t){he(this,Ob),he(this,Go),he(this,gP,[]),he(this,yP,{opacity:"initial"}),he(this,XA,{opacity:new Map}),he(this,Qp,new Set),xe(this,Go,e),xe(this,gP,t||[]);let r=A(this,Go).map;r&&r.on("idle",()=>{A(this,XA).opacity.size||yt(this,Ob,B7).call(this,r)})}setStyle(e){var t,r;if(A(this,Go).map){(t=A(this,Go).map)==null||t.setStyle(e),A(this,Qp).size&&(A(this,Qp).clear(),this.hide()),yt(this,Ob,mce).call(this),yt(this,Ob,B7).call(this,A(this,Go).map),this.setOpacity(A(this,yP).opacity),(r=A(this,Go).map)==null||r.moveLayer(KJ);for(let[i,n]of A(this,gP)||[])A(this,Go).hideOutdoorLayersIntersectingPolygons(i,n)}}get map(){return A(this,Go).map}get enabled(){return!!A(this,Go).map}get visible(){return A(this,Qp).size===0}show(){let e=A(this,Go).map;if(!e)return;let t=e.getStyle().layers;t&&(t.forEach(r=>{A(this,Qp).has(r.id)&&e.setLayoutProperty(r.id,"visibility","visible")}),A(this,Qp).clear())}hide(e=[]){let t=A(this,Go).map;if(!t)return;let r=t.getStyle().layers;r&&r.forEach(i=>{let n=t.getLayoutProperty(i.id,"visibility");!e.includes(i.id)&&n!=="none"&&(t.setLayoutProperty(i.id,"visibility","none"),A(this,Qp).add(i.id))})}setOpacity(e,t=[]){var r,i,n;let a=A(this,Go).map;if(!a)return;let o=(n=(i=(r=A(this,Go).map)==null?void 0:r.getStyle)==null?void 0:i.call(r))==null?void 0:n.layers;o&&a.once("idle",()=>{o.forEach(s=>{let l=a.getLayoutProperty(s.id,"visibility");if(!t.includes(s.id)&&l!=="none")try{let u=A(this,XA).opacity.get(s.id);u!==void 0&&(s.id==="background"||(s.type==="symbol"?(a.setPaintProperty(s.id,"icon-opacity",e==="initial"?u[0]:e),a.setPaintProperty(s.id,"text-opacity",e==="initial"?u[1]:e)):a.setPaintProperty(s.id,"".concat(s.type,"-opacity"),e==="initial"?u[0]:e)),A(this,yP).opacity=e)}catch(u){rt.warn("Error setting opacity:",u)}})})}};Go=new WeakMap,gP=new WeakMap,yP=new WeakMap,XA=new WeakMap,Qp=new WeakMap,Ob=new WeakSet,B7=function(e){let t=e.getStyle().layers;t&&t.forEach(r=>{var i,n,a;e.getLayoutProperty(r.id,"visibility")!=="none"&&(r.id==="background"||(r.type==="symbol"?A(this,XA).opacity.set(r.id,[(i=e.getPaintProperty(r.id,"icon-opacity"))!=null?i:OQ.opacity,(n=e.getPaintProperty(r.id,"text-opacity"))!=null?n:OQ.opacity]):A(this,XA).opacity.set(r.id,[(a=e.getPaintProperty(r.id,"".concat(r.type,"-opacity")))!=null?a:OQ.opacity,void 0])))})},mce=function(){Object.values(A(this,XA)).forEach(e=>e.clear())};H();WWe=class{constructor({currentMapGetter:e}){he(this,Uh),he(this,Qh,new Map),he(this,Dc,new Map),xe(this,Uh,e)}labelAll(e={}){var t,r;let i=[],n=new Set;return(r=(t=A(this,Uh).call(this))==null?void 0:t.Text3D.labelAll(e))==null||r.forEach(({textInfo:a,target:o})=>{let s=a.id.toString(),l=A(this,Dc).get(s);if(l){n.has(s)||i.push(l.text3DView),n.add(s);return}n.add(s);let u=new sP(s,o);A(this,Qh).set(u.id,{targetId:o.id,text3d:s,text3DView:u}),A(this,Dc).set(s,{text3DView:u}),i.push(u)}),i}label(e,t,r={}){var i;if(A(this,Uh).call(this))if(ua.is(e)){let n=(i=A(this,Uh).call(this))==null?void 0:i.Text3D.label(e,t,r);if(!n)return;let a=n.textInfo.id.toString(),o=A(this,Dc).get(a);if(o)return o.text3DView;let s=new sP(a,n.target);return A(this,Qh).set(s.id,{targetId:n.target.id,text3d:a,text3DView:s}),A(this,Dc).set(a,{text3DView:s}),s}else throw new Error("Non-space target is not supported")}add(e,t,r={}){let i=A(this,Uh).call(this);if(!i)throw new Error("Current map not found.");if(!Tr.is(e))throw new Error("Target must be a Coordinate");let n=e.anchorTarget,a=i.Text3D.add(n,t,r);if(!a)throw new Error("Failed to add Text3D.");let o=a.id.toString(),s=A(this,Dc).get(o);if(s)return rt.warn("Text3DView with ID ".concat(o," already exists. A new Text3DView will not be created. Returning existing. ")),s.text3DView;let l=new sP(o,e);return A(this,Qh).set(l.id,{targetId:e.id,text3d:o,text3DView:l}),A(this,Dc).set(o,{text3DView:l}),l}remove(e){var t;let r=typeof e=="string"?e:e.id,i=A(this,Qh).get(r);i&&((t=A(this,Uh).call(this))==null||t.Text3D.remove(i.text3d),A(this,Qh).delete(r),A(this,Dc).delete(i.text3d))}removeAll(){A(this,Qh).forEach(e=>{var t;(t=A(this,Uh).call(this))==null||t.Text3D.remove(e.text3d)}),A(this,Qh).clear(),A(this,Dc).clear()}};Uh=new WeakMap,Qh=new WeakMap,Dc=new WeakMap;H();H();Vse="doors",aj=dt.object({type:dt.literal(Vse).default(Vse),color:dt.string().default("#ffffff"),topColor:dt.string().optional(),texture:dt.object({url:dt.string().optional()}).optional(),topTexture:dt.object({url:dt.string().optional()}).optional(),visible:dt.boolean().default(!1),opacity:dt.number().default(1)}),NQ=aj.partial(),Cft=dt.strictObject(aj.shape);H();Yse="facade",oj=J.object({type:J.literal(Yse).default(Yse),opacity:J.number().default(1),visible:J.boolean().default(!0)}),XWe=oj.partial(),Tft=J.strictObject(oj.shape);H();Mu="floor",Hse="".concat(Mu,".footprint"),Wse="".concat(Mu,".geometry"),Zse="".concat(Mu,".labels"),Xse="".concat(Mu,".markers"),Jse="".concat(Mu,".images"),Kse="".concat(Mu,".occlusion"),qse="".concat(Mu,".paths"),$se="".concat(Mu,".areas"),ele="".concat(Mu,".models"),j0=J.object({type:J.literal(Hse).default(Hse),altitude:J.number().default(0),visible:J.boolean().default(!1),height:J.number().default(0),opacity:J.number().default(1),side:J.enum(["double","front","back"]).default("double"),color:J.string().default("#ffffff"),ceilingVisible:J.boolean().default(!0),basementMaskEnabled:J.boolean().default(!1),outline:J.boolean().default(!0),ceilingThickness:J.number().default(.2)}),Dft=j0.partial(),OP=J.object({type:J.literal(Wse).default(Wse),opacity:J.number().default(1),visible:J.boolean().default(!0),maskId:J.number().nullable().default(null),maskEffect:J.enum(["hide","reveal"]).default("hide"),maskMode:J.enum(["mask","masked-object"]).default("mask"),maskEnabled:J.boolean().default(!1),effectStart:J.number().default(0),effectDistance:J.number().default(0),darkenAmount:J.number().default(0),darkenUseDepth:J.boolean().default(!0),desaturateAmount:J.number().default(0),desaturateUseDepth:J.boolean().default(!0),washOutAmount:J.number().default(0),washOutUseDepth:J.boolean().default(!1)}),KWe=OP.partial(),NP=J.object({type:J.literal(Zse).default(Zse),enabled:J.boolean().default(!0)}),qWe=NP.partial(),UP=J.object({type:J.literal(Xse).default(Xse),enabled:J.boolean().default(!0)}),$We=UP.partial(),QP=J.object({type:J.literal(Jse).default(Jse),visible:J.boolean().default(!0),collisionsEnabled:J.boolean().default(!1)}),eZe=QP.partial(),jP=J.object({type:J.literal(Kse).default(Kse),enabled:J.boolean().default(!0)}),tZe=jP.partial(),GP=J.object({type:J.literal(qse).default(qse),visible:J.boolean().default(!0)}),rZe=GP.partial(),VP=J.object({type:J.literal(Mu).default(Mu),visible:J.boolean().default(!1),altitude:J.number().default(0)}),YP=J.object({type:J.literal($se).default($se),visible:J.boolean().default(!0)}),iZe=YP.partial(),HP=J.object({visible:J.boolean().default(!0)}),nZe=HP.partial(),WP=J.object({type:J.literal(ele).default(ele),visible:J.boolean().default(!0)}),aZe=WP.partial(),oZe=J.object(bt(ze({},VP.shape),{geometry:OP,labels:NP,markers:UP,images:QP,footprint:j0,occlusion:jP,paths:GP,areas:YP,text3d:HP,models:WP})),sZe=VP.partial(),kft=J.object(bt(ze({},VP.shape),{geometry:OP.partial(),labels:NP.partial(),markers:UP.partial(),images:QP.partial(),footprint:j0.partial(),occlusion:jP.partial(),paths:GP.partial(),areas:YP.partial(),text3d:HP.partial(),models:WP.partial()})).partial(),Rft=J.strictObject(bt(ze({},VP.shape),{geometry:J.strictObject(OP.shape),labels:J.strictObject(NP.shape),markers:J.strictObject(UP.shape),images:J.strictObject(QP.shape),footprint:J.strictObject(j0.shape),occlusion:J.strictObject(jP.shape),paths:J.strictObject(GP.shape),areas:J.strictObject(YP.shape),text3d:J.strictObject(HP.shape),models:J.strictObject(WP.shape)}));H();tle="geometry",sj=J.object({type:J.literal(tle).default(tle),visible:J.boolean().default(!0),color:J.union([J.string(),J.literal("initial")]).default("#ffffff"),topColor:J.union([J.string(),J.literal("initial")]).optional(),hoverColor:J.union([J.string(),J.literal("initial")]).optional(),interactive:J.boolean().default(!1),opacity:J.number().default(1),height:J.number().default(0),altitude:J.number().default(0),texture:J.object({url:J.string()}).optional(),topTexture:J.object({url:J.string()}).optional(),flipImageToFaceCamera:J.boolean().default(!1),enableImageCollisions:J.boolean().default(!1),borderVisible:J.boolean().default(!1),borderColor:J.string().optional(),borderWidth:J.number().optional()}),rle=sj.partial(),zft=J.strictObject(sj.shape);H();Jy="label",hZe=dt.object({type:dt.literal(Jy).default(Jy),text:dt.string(),rank:dt.custom(e=>mC.safeParse(e).success||e==="initial"),appearance:dt.custom(e=>a6.safeParse(e).success),interactive:dt.boolean().default(!1),enabled:dt.boolean().default(!0),textPlacement:dt.union([dt.enum(yC),dt.array(dt.enum(yC))]).default(g_),occlude:dt.boolean().default(!0)}),dZe=hZe.partial();H();lb="marker",AZe=dt.object({type:dt.literal(lb).default(lb),rank:dt.custom(e=>mC.safeParse(e).success||e==="initial"),placement:dt.union([dt.enum(vC),dt.array(dt.enum(vC))]).optional(),interactive:dt.union([dt.boolean(),dt.literal("pointer-events-auto")]).default(!1),dynamicResize:dt.boolean().default(!0),enabled:dt.boolean().default(!0),zIndex:dt.number().optional(),lowPriorityPin:dt.object({enabled:dt.boolean().optional(),size:dt.number().positive().optional(),color:dt.string().optional()}).optional(),element:dt.custom(e=>e instanceof HTMLElement,{error:"Must be an HTMLElement instance"}),contentHTML:dt.string(),occlude:dt.boolean().default(!0)}),mZe=AZe.omit({element:!0}).partial();H();ile="shape",lj=J.object({type:J.literal(ile).default(ile),visible:J.boolean().default(!0),altitude:J.number().default(0),color:J.string().default("#ffffff"),height:J.number().default(0),opacity:J.number().default(1),interactive:J.boolean().default(!1),bevel:J.object({enabled:J.boolean().optional(),thickness:J.number().optional(),size:J.number().optional(),offset:J.number().optional(),segments:J.number().optional()}).optional(),position:J.custom(e=>Tr.is(e))}),yce=lj.partial(),Uft=J.strictObject(lj.shape);H();nle="text3d",vce=dt.object({type:dt.literal(nle).default(nle),position:dt.custom(e=>e instanceof Tr,{error:"Must be a Coordinate instance"})}),xce=CN.extend(ze({},vce.shape)),_Ze=iK.extend(ze({},vce.shape)).partial(),jft=dt.strictObject(xce.shape);H();ale="walls",uj=dt.object({type:dt.literal(ale).default(ale),color:dt.string().default("#ffffff"),topColor:dt.string().optional(),texture:dt.object({url:dt.string()}).or(dt.undefined()),topTexture:dt.object({url:dt.string()}).or(dt.undefined()),visible:dt.boolean().default(!0),height:dt.number().default(0),opacity:dt.number().default(1)}),ole=uj.partial(),Vft=dt.strictObject(uj.shape);H();T7="image3d",EZe=J.object({type:J.literal(T7).default(T7),visible:J.boolean().default(!0),opacity:J.number().min(0).max(1).default(1),position:J.custom(e=>e instanceof Tr,{error:"Must be a Coordinate instance"}),width:J.number().default(1),height:J.number().default(1),rotation:J.number().default(0),verticalOffset:J.number().default(0),flipImagesToFaceCamera:J.boolean().default(!1)}),MZe=EZe.partial();H();lle="model",cj=tK.extend({type:J.literal(lle).default(lle),color:J.string().optional(),position:J.custom(e=>Tr.is(e),{error:"Expected a Coordinate"}),visible:J.boolean().default(!0),rotation:J.tuple([J.number(),J.number(),J.number()]).default([0,0,0]),scale:J.tuple([J.number(),J.number(),J.number()]).default([1,1,1]),verticalOffset:J.number().default(0),opacity:J.number().default(1),material:J.record(J.string(),rK).optional(),interactive:J.boolean().default(!1),clippingPlaneZOffset:J.custom(e=>typeof e=="number"&&!Number.isNaN(e),{message:"Must be a valid number (including Infinity)"}).default(1/0),clippingPlaneTopColor:J.string().default("#E67B5B"),clippingPlaneTopVisible:J.boolean().default(!0)}),IZe=cj.extend({scale:J.union([J.number(),J.tuple([J.number(),J.number(),J.number()])]),rotation:J.union([J.number(),J.tuple([J.number(),J.number(),J.number()])])}).partial(),Wft=J.strictObject(cj.shape);H();H();H();hj=qo(RGe());hj.registerHelper({});hj.registerPartial({});BZe=hj.template({compiler:[8,">= 4.3.0"],main:function(e,t,r,i,n){var a=e.lambda,o=e.escapeExpression,s=e.lookupProperty||function(l,u){if(Object.prototype.hasOwnProperty.call(l,u))return l[u]};return\`<div class='mappedin-annotation-marker'>
|
|
6924
|
+
</div>\`)};H();sce=63710088e-1,oT=new WeakMap,vWe=e=>Qe(null,null,function*(){return new Promise(t=>setTimeout(t,e))});Ese=.01,Mse=.02,uce={drawDuration:1e3,color:"#40A9FF",interactive:!1,accentColor:"blue",width:{on:"zoom-level",input:[17,22],output:[2,.5]},displayArrowsOnPath:!1,animateArrowsOnPath:!1},wWe={drawDuration:1e3,color:"#B3DDFF",interactive:!1,accentColor:"#40A9FF",width:{on:"zoom-level",input:[17,22],output:[2,.5]},displayArrowsOnPath:!1,animateArrowsOnPath:!1},Op={setMapOnConnectionClick:!0,setMapToDeparture:!0,createMarkers:{departure:!0,destination:!0,connection:!0},pathOptions:uce,inactivePathOptions:wWe,markerOptions:{departureColor:oce,destinationColor:ace},animatePathDrawing:!0};EWe=bt(ze({},Op),{connectionPathOptions:cce(uce)}),MWe=class{constructor(e){he(this,en),he(this,jp,new Map),he(this,wu,new Map),he(this,ki),he(this,ni,EWe),he(this,Gp),he(this,C0),he(this,ga,[]),he(this,Ws),he(this,_u,new Map),he(this,HA,new Map),he(this,Hb,t=>{var r;if((r=A(this,ni).createMarkers)!=null&&r.connection&&t.markers!=null&&t.markers.length>0){let{instruction:i}=A(this,jp).get(t.markers[0].id);i!=null&&i.action.toFloor&&(A(this,ni).setMapOnConnectionClick&&A(this,ki).setFloor(i.action.toFloor.id,"navigation-connection-click"),A(this,ki).publish("navigation-connection-click",{instruction:i,fromFloor:i.action.fromFloor,toFloor:i.action.toFloor}))}}),xe(this,ki,e)}get isMultiFloor(){if(!A(this,ga).length)return!1;let e=new Set;for(let t of A(this,ga))for(let r of t.coordinates)if(r.floorId&&(e.add(r.floorId),e.size>1))return!0;return!1}getPathById(e){return A(this,wu).get(e)}getMarkerById(e){return A(this,jp).get(e)}get paths(){let e=new Set;return A(this,wu).forEach(t=>e.add(t)),Array.from(e)}get activeDirections(){return A(this,HA).get(A(this,Ws))}get activePath(){if(A(this,Ws))return A(this,wu).get(A(this,Ws).id)}get floorStacks(){let e=A(this,ki).getMapData();if(!A(this,ga).length||!e)return[];let t=new Set;for(let r of A(this,ga))for(let i of r.coordinates)if(i.floorId){let n=e.getById("floor",i.floorId);n&&t.add(n.floorStack)}return Array.from(t)}get floors(){let e=A(this,ki).getMapData();if(!A(this,ga).length||!e)return[];let t=new Set;for(let r of A(this,ga))for(let i of r.coordinates)if(i.floorId){let n=e.getById("floor",i.floorId);n&&t.add(n)}return Array.from(t)}setActivePathByIndex(e){let t=A(this,ga)[e];if(!A(this,ga).length){rt.warn("Cannot set an active path before drawing. Call Navigation.draw() first.");return}if(!A(this,ga)[e]){rt.warn("Direction #".concat(e," does not exist"));return}let r=A(this,_u).get(t);if(!r){rt.warn("The direction is not a part of muli-direcional path");return}yt(this,en,lP).call(this,r)}setActivePath(e){if(!A(this,ga).length){rt.warn("Cannot set an active path before drawing. Call Navigation.draw() first.");return}if(!A(this,HA).get(e)){rt.warn('Path "'.concat(e.id,'" is not a part of muli-direcional path'));return}yt(this,en,lP).call(this,e)}setActivePathByDirections(e){if(!A(this,ga).length){rt.warn("[setActivePathByDirections] Cannot set an active path before drawing. Call Navigation.draw() first.");return}let t=A(this,_u).get(e);if(!t){let r=A(this,ga).find(i=>i.id===e.id);if(!r){rt.warn("[setActivePathByDirections] Cannot find directions for id");return}t=A(this,_u).get(r)}if(!t){rt.warn("[setActivePathByDirections] Cannot find path for directions");return}yt(this,en,lP).call(this,t)}clearHighlightedPathSection(){for(let e of this.paths)for(let t of e.segments)A(this,ki).updateState(t,{highlightCompleteFraction:0})}highlightPathSection(e,t,r){var i;let n=(i=r==null?void 0:r.animationDuration)!=null?i:1500,a=A(this,ki).getMapData().mapCenter,o=lce(this.paths,e,t,a);if(!o)return;this.clearHighlightedPathSection();let s=o.map(c=>{var h,d;return A(this,ki).updateState(c.segment,{highlightStartFraction:c.startHighlightFraction,highlightEndFraction:c.endHighlightFraction,highlightColor:(h=r==null?void 0:r.color)!=null?h:"red",highlightWidthMultiplier:(d=r==null?void 0:r.widthMultiplier)!=null?d:1}),new tp({fraction:0}).to({fraction:1},n).onUpdate(p=>{A(this,ki).updateState(c.segment,{highlightCompleteFraction:p.fraction})})}),l=()=>{},u=new Promise(c=>{l=c});return s.length>0&&(s.forEach((c,h)=>{h<s.length-1&&c.chain(s[h+1]),A(this,ki).tweenGroup().add(s[h])}),s[0].start(),s[s.length-1].onComplete(()=>{A(this,ki).tweenGroup().remove(s[s.length-1]),l()})),{animation:u}}drawSync(e,t={}){var r,i,n;A(this,C0)&&this.clear(),xe(this,C0,!0),yt(this,en,M7).call(this,t);let a=Array.isArray(e)?e:[e],o=a[0],s=a[a.length-1],l=o.coordinates[0];xe(this,ga,a),l.floorId&&A(this,ni).setMapToDeparture&&A(this,ki).setFloor(l.floorId),(r=A(this,ni).createMarkers)!=null&&r.departure&&yt(this,en,F0).call(this,"departure",o.instructions[0]);for(let u=0;u<a.length;u++){let c=a[u],h=u?ze({},A(this,ni).inactivePathOptions):ze({},A(this,ni).pathOptions);if(c.coordinates.length<2){rt.warn("Directions must have at least 2 coordinates");return}let d=bt(ze({},A(this,ni).connectionPathOptions),{animateDrawing:A(this,ni).animatePathDrawing,verticalOffset:yt(this,en,Vb).call(this,u===0?"active":"inactive")}),p=yt(this,en,E7).call(this,c.coordinates,bt(ze({},h),{animateDrawing:A(this,ni).animatePathDrawing,verticalOffset:yt(this,en,Vb).call(this,u===0?"active":"inactive")}),d);A(this,_u).set(c,p),A(this,HA).set(p,c),(i=A(this,ni).createMarkers)!=null&&i.connection&&yt(this,en,S7).call(this,c.instructions,"connection"),u===0&&(xe(this,Ws,A(this,_u).get(A(this,ga)[0])),A(this,ki).externalPubSub.on("click",A(this,Hb)))}(n=A(this,ni).createMarkers)!=null&&n.destination&&yt(this,en,F0).call(this,"destination",s.instructions[s.instructions.length-1]),A(this,ki).mapObjects.forEach(u=>{u.processFloorChange(u.currentFloorId)}),yt(this,en,Yb).call(this)}draw(r){return Qe(this,arguments,function*(e,t={}){A(this,Gp)&&this.clear(),yt(this,en,M7).call(this,t);let i=Array.isArray(e)?e:[e],n=i[0].coordinates[0];return xe(this,ga,i),n.floorId&&A(this,ni).setMapToDeparture&&A(this,ki).setFloor(n.floorId),yt(this,en,hce).call(this,i)})}clear(){A(this,jp).forEach(e=>{e!=null&&e.marker&&A(this,ki).currentMap.Markers.remove(e.marker.id.toString())}),A(this,jp).clear(),A(this,wu).forEach(e=>{A(this,ki).currentMap.Paths.remove(e.segments.map(t=>t.id.toString()))}),A(this,wu).clear(),A(this,Gp)&&(A(this,Gp).cancel(),xe(this,Gp,void 0)),A(this,C0)&&xe(this,C0,!1),xe(this,ga,[]),A(this,_u).clear(),A(this,HA).clear(),xe(this,Ws,void 0),A(this,ki).externalPubSub.off("click",A(this,Hb)),A(this,ki).mapObjects.forEach(e=>{e.processFloorChange(e.currentFloorId)}),yt(this,en,Yb).call(this)}};jp=new WeakMap,wu=new WeakMap,ki=new WeakMap,ni=new WeakMap,Gp=new WeakMap,C0=new WeakMap,ga=new WeakMap,Ws=new WeakMap,_u=new WeakMap,HA=new WeakMap,en=new WeakSet,Sse=function(e){return e!=null&&["TakeConnection","ExitConnection","TakeVortex","ExitVortex"].includes(e.type)},Ise=function(){if(!A(this,Ws))return;let e=A(this,wu).get(A(this,Ws).id);if(e){for(let t of A(this,wu).values())if(t.id.includes("internal-"))if(t.id===A(this,Ws).id)for(let r of e.segments)A(this,ki).updateState(r,{verticalOffset:Mse});else A(this,ki).updateState(t,{verticalOffset:Ese})}},E7=function(e,t,r){var i,n;let a=(n=(i=t.id)==null?void 0:i.toString())!=null?n:Pi(),o=A(this,ki).currentMap.Paths.add(e,t,r),s=new Gb(a,o.animation,e,o.paths);A(this,wu).set(a,s);for(let l of o.paths)A(this,wu).set(l.id.toString(),s);return s},zQ=function(e,t,r=!1){let i=A(this,ni).markerOptions.animated,n=A(this,ki).currentMap.Markers.add(e.coordinate,t,{interactive:r,placement:"top",rank:"always-visible",animated:i}),a=A(this,ki).currentMap.Markers.getContentEl(n.id.toString());if(!a)throw new Error("marker component should exist");return new CP(n.id.toString(),a,e.coordinate)},Vb=function(e){var t,r,i,n;return e==="active"?Mse+((r=(t=A(this,ni).pathOptions)==null?void 0:t.verticalOffset)!=null?r:0):Ese+((n=(i=A(this,ni).inactivePathOptions)==null?void 0:i.verticalOffset)!=null?n:0)},hce=function(e){let t=e[0],r=e[e.length-1],i=!1;return xe(this,Gp,{promise:new Promise(n=>Qe(this,null,function*(){var a,o,s;if(Fi.env.NODE_ENV!=="test"&&(yield vWe(500)),i||!e.length){n();return}(a=A(this,ni).createMarkers)!=null&&a.departure&&yt(this,en,F0).call(this,"departure",t.instructions[0]);for(let l=0;l<e.length;l++){let u=e[l],c=l===0?ze({},A(this,ni).pathOptions):ze({},A(this,ni).inactivePathOptions);if(u.coordinates.length<2){rt.warn("Directions must have at least 2 coordinates"),n();return}let h=bt(ze({},A(this,ni).connectionPathOptions),{animateDrawing:A(this,ni).animatePathDrawing,verticalOffset:yt(this,en,Vb).call(this,l===0?"active":"inactive")}),d=yt(this,en,E7).call(this,u.coordinates,bt(ze({},c),{animateDrawing:A(this,ni).animatePathDrawing,verticalOffset:yt(this,en,Vb).call(this,l===0?"active":"inactive")}),h);if(A(this,_u).set(u,d),A(this,HA).set(d,u),l===0&&(xe(this,Ws,A(this,_u).get(A(this,ga)[0])),A(this,ki).externalPubSub.on("click",A(this,Hb))),Fi.env.NODE_ENV!=="test"&&(yield d.animation),i){n();return}(o=A(this,ni).createMarkers)!=null&&o.connection&&yt(this,en,S7).call(this,u.instructions,"connection")}if((s=A(this,ni).createMarkers)!=null&&s.destination&&yt(this,en,F0).call(this,"destination",r.instructions[r.instructions.length-1]),i){n();return}A(this,ki).mapObjects.forEach(l=>{l.processFloorChange(l.currentFloorId)}),yt(this,en,Yb).call(this),n()})),cancel:()=>{i=!0}}),A(this,Gp).promise},M7=function(e){var t,r,i;let n=ze(ze({},Op.pathOptions),e.pathOptions);xe(this,ni,{setMapOnConnectionClick:(t=e.setMapOnConnectionClick)!=null?t:Op.setMapOnConnectionClick,setMapToDeparture:(r=e.setMapToDeparture)!=null?r:Op.setMapToDeparture,pathOptions:n,inactivePathOptions:ze(ze({},Op.inactivePathOptions),e.inactivePathOptions),connectionPathOptions:cce(n),createMarkers:ze(ze({},Op.createMarkers),e.createMarkers),markerOptions:ze(ze({},Op.markerOptions),e.markerOptions),animatePathDrawing:(i=e.animatePathDrawing)!=null?i:Op.animatePathDrawing})},Yb=function(){A(this,ki).publish("navigation-state-change",{isMultiFloor:this.isMultiFloor,floorStacks:this.floorStacks,floors:this.floors,activeDirections:this.activeDirections,activePath:this.activePath,paths:this.paths})},lP=function(e){xe(this,Ws,e),A(this,ga).forEach(t=>{let r=A(this,_u).get(t);if(r){let i=r.id===A(this,Ws).id?ze({},A(this,ni).pathOptions):ze({},A(this,ni).inactivePathOptions);A(this,ki).updateState(r,i)}}),A(this,ki).publish("navigation-active-path-change",{directions:this.activeDirections,path:this.activePath}),yt(this,en,Ise).call(this),yt(this,en,Yb).call(this)},F0=function(e,t){var r,i,n,a,o;if(e==="connection"&&t){let s=t.action.type==="ExitConnection"?A(this,ni).markerOptions.departureColor:A(this,ni).markerOptions.destinationColor,l;typeof((r=A(this,ni).createMarkers)==null?void 0:r.connection)=="function"?(l=A(this,ni).createMarkers.connection(t),A(this,ki).updateState(l,{interactive:!0})):l=yt(this,en,zQ).call(this,t,yWe({type:(n=(i=t.action.connection)==null?void 0:i.type)!=null?n:t.action.connectionType,color:s,direction:t.action.direction,animated:A(this,ni).markerOptions.animated}),!0),A(this,jp).set(l.id,{instruction:t,marker:l})}else{let s=e==="departure"?A(this,ni).markerOptions.departureColor:A(this,ni).markerOptions.destinationColor,l;typeof((a=A(this,ni).createMarkers)==null?void 0:a.departure)=="function"&&e==="departure"?l=A(this,ni).createMarkers.departure(t):typeof((o=A(this,ni).createMarkers)==null?void 0:o.destination)=="function"&&e==="destination"?l=A(this,ni).createMarkers.destination(t):l=yt(this,en,zQ).call(this,t,mWe({type:e,color:s,animated:A(this,ni).markerOptions.animated})),A(this,jp).set(l.id,{instruction:t,marker:l})}},S7=function(e,t){e.filter(r=>yt(this,en,Sse).call(this,r.action)).forEach(r=>{yt(this,en,F0).call(this,t,r)})},Hb=new WeakMap;H();SWe=class{constructor(e){he(this,ZA),he(this,Cr),he(this,PP),I(this,"interactions",{set:t=>{(t==null?void 0:t.pan)!=null&&(A(this,Cr).getSystems().cameraSystem.enablePan=t.pan),(t==null?void 0:t.zoom)!=null&&(A(this,Cr).getSystems().cameraSystem.enableZoom=t.zoom),(t==null?void 0:t.bearingAndPitch)!=null&&(A(this,Cr).getSystems().cameraSystem.enableRotate=t.bearingAndPitch)},enable:()=>{A(this,Cr).getSystems().cameraSystem.enablePan=!0,A(this,Cr).getSystems().cameraSystem.enableZoom=!0,A(this,Cr).getSystems().cameraSystem.enableRotate=!0},disable:()=>{A(this,Cr).getSystems().cameraSystem.enablePan=!1,A(this,Cr).getSystems().cameraSystem.enableZoom=!1,A(this,Cr).getSystems().cameraSystem.enableRotate=!1}}),I(this,"setMinPitch",t=>{A(this,Cr).camera.setMinPitch(t)}),I(this,"setMaxPitch",t=>{A(this,Cr).camera.setMaxPitch(t)}),I(this,"setMinZoomLevel",t=>{A(this,Cr).camera.setMinZoomLevel(t,!0)}),I(this,"setMaxZoomLevel",t=>{A(this,Cr).camera.setMaxZoomLevel(t)}),xe(this,PP,e),xe(this,Cr,e.core)}setScreenOffsets(e){A(this,Cr).camera.setInsetPadding(e)}get screenOffsets(){return A(this,Cr).camera.insetsPadding}get panMode(){return A(this,Cr).camera.panMode}setPanMode(e){if(e!=="default"&&e!=="elevation")throw new Error("Invalid pan mode");e!==this.panMode&&A(this,Cr).camera.setPanMode(e)}getFocusOnTransform(e,t){var r,i,n;let a=A(this,Cr).camera.getCameraFrameForCoordinates(yt(this,ZA,I7).call(this,e),{pitch:t==null?void 0:t.pitch,bearing:t==null?void 0:t.bearing,padding:(t==null?void 0:t.screenOffsets)||this.screenOffsets,maxZoomLevel:t==null?void 0:t.maxZoomLevel,verticalPadding:(r=t==null?void 0:t.axisAlignedPadding)==null?void 0:r.vertical,minZoomLevel:t==null?void 0:t.minZoomLevel,duration:t==null?void 0:t.duration,easing:t==null?void 0:t.easing});return{center:new Tr(a.center[1],a.center[0]),zoomLevel:a.zoomLevel,bearing:(i=t==null?void 0:t.bearing)!=null?i:this.bearing,pitch:(n=t==null?void 0:t.pitch)!=null?n:this.pitch}}focusOn(e,t){var r;return A(this,Cr).camera.focusOn(yt(this,ZA,I7).call(this,e),{pitch:t==null?void 0:t.pitch,bearing:t==null?void 0:t.bearing,padding:(t==null?void 0:t.screenOffsets)||this.screenOffsets,maxZoomLevel:t==null?void 0:t.maxZoomLevel,minZoomLevel:t==null?void 0:t.minZoomLevel,duration:t==null?void 0:t.duration,verticalPadding:(r=t==null?void 0:t.axisAlignedPadding)==null?void 0:r.vertical,easing:t==null?void 0:t.easing})}animateTo(e,t){var r;let{center:i,zoomLevel:n,bearing:a,pitch:o}=e,s=i!=null?i:this.center;return A(this,Cr).camera.animateTo({center:i!=null?[s.longitude,s.latitude,A(this,Cr).camera.elevation]:void 0,zoomLevel:n,bearing:a,pitch:o,duration:(r=t==null?void 0:t.duration)!=null?r:600,easing:t==null?void 0:t.easing})}set(e){let{center:t=this.center,zoomLevel:r=this.zoomLevel,bearing:i=this.bearing,pitch:n=this.pitch}=e,a=[t.longitude,t.latitude];A(this,Cr).camera.setCenter(a),A(this,Cr).camera.setZoomLevel(r),A(this,Cr).camera.setBearing(i),A(this,Cr).camera.setPitch(n)}get center(){let e=A(this,Cr).camera.center;return new Tr(e[1],e[0],void 0)}setAutoMinZoomLevel(e){A(this,Cr).camera.setAutoMinZoomLevel(e)}get autoMinZoomLevel(){return A(this,Cr).camera.autoMinZoomLevel}get zoomLevel(){return A(this,Cr).camera.zoomLevel}get pitch(){return A(this,Cr).camera.pitch}get minPitch(){return A(this,Cr).camera.minPitch}get maxPitch(){return A(this,Cr).camera.maxPitch}get bearing(){let e=A(this,Cr).camera.bearing;return(e<0?e+360:e)%360}get minZoomLevel(){return A(this,Cr).camera.minZoomLevel}get maxZoomLevel(){return A(this,Cr).camera.maxZoomLevel}setElevation(e){A(this,Cr).camera.setElevation(e)}get elevation(){return A(this,Cr).camera.elevation}animateElevation(e,t){return A(this,Cr).camera.animateElevation(e,t)}get bounds(){return kue(A(this,Cr).getSystems().cameraSystem.panBounds,A(this,Cr).convert3DMapPositionToCoordinate)}get isAnimating(){return A(this,Cr).camera.isAnimating}cancelAnimation(){A(this,Cr).camera.cancelAnimation()}updateFacadesInView(){A(this,Cr).getSystems().geometryInFocusSystem.compute()}};Cr=new WeakMap,PP=new WeakMap,ZA=new WeakSet,lT=function(e){var t,r,i,n,a,o;let s=A(this,Cr).camera.elevation;return Tr.is(e)&&e.floorId!=null?(r=(t=A(this,Cr).getState(e.floorId))==null?void 0:t.altitude)!=null?r:s:xs.is(e)?(n=(i=A(this,Cr).getState(e.id))==null?void 0:i.altitude)!=null?n:s:"floor"in e&&xs.is(e.floor)&&(o=(a=A(this,Cr).getState(e.floor.id))==null?void 0:a.altitude)!=null?o:s},I7=function(e){var t;let r=[],i=(Array.isArray(e)?e:[e]).flatMap(n=>{var a;return(a=n==null?void 0:n.focusTarget)!=null?a:[n]});for(let n of i)if(n!=null)if(Tr.is(n)){let a=yt(this,ZA,lT).call(this,n);r.push([n.longitude,n.latitude,a])}else if((n==null?void 0:n.id)!=null){let a=yt(this,ZA,lT).call(this,n);if(xs.is(n)&&(t=A(this,PP).getMapDataInternal())!=null&&t.enterpriseMode){r.push(n.id);continue}else if("geoJSON"in n&&n.geoJSON.geometry.coordinates.length>0){A_(n.geoJSON,s=>{r.push([s[0],s[1],a])});continue}let o=A(this,Cr).getBoundingArea(n.id);if(o)r.push(...o.map(s=>[s[0],s[1],a]));else if("geoJSONBoundingBox"in n){let s=yt(this,ZA,lT).call(this,n);if(n.geoJSONBoundingBox!=null){let l=[[n.geoJSONBoundingBox[0],n.geoJSONBoundingBox[1],s],[n.geoJSONBoundingBox[2],n.geoJSONBoundingBox[3],s]];r.push(...l)}}}else KVe(n)&&r.push(n);return r};H();IWe=class{constructor({currentMapGetter:e}){he(this,Fb),xe(this,Fb,e)}get currentMap(){return A(this,Fb).call(this)}getCurrentSceneGLTF(e){return Qe(this,null,function*(){let t=A(this,Fb).call(this);return t?t==null?void 0:t.Exporter.getCurrentSceneGLTF(e):(rt.error("There is no map to export. Please load a map first."),new Blob)})}};Fb=new WeakMap;H();CWe=class{constructor({currentMapGetter:e}){he(this,Tc,new Map),he(this,uP),xe(this,uP,e)}get currentMap(){return A(this,uP).call(this)}getAll(){return Array.from(A(this,Tc).values()).map(e=>e.label)}getById(e){return A(this,Tc).get(e)}add(e,t,r){let i=e.anchorTarget,n=this.currentMap;if(!n)throw new Error("currentMap should exist");let a=n.Labels.add(i,t,bt(ze({},r),{attachTo:q7(e),rank:(r==null?void 0:r.rank)==null||(r==null?void 0:r.rank)==="initial"?"medium":r.rank})),o=new IP(a.id.toString(),t,e);return A(this,Tc).set(o.id,{label:o,entityId:o.id}),o}__EXPERIMENTAL__all(e){var t;let r=[];return(t=this.currentMap)==null||t.Labels.all({onCreate:(i,n,a)=>{let o=new IP(i.toString(),n,a);A(this,Tc).set(o.id,{label:o,entityId:o.id}),r.push(o)},labelOptions:e}),r}remove(e){var t;let r=A(this,Tc).get(e.id);r&&((t=this.currentMap)==null||t.Labels.remove(r),A(this,Tc).delete(e.id.toString()))}removeAll(){let e=[];return A(this,Tc).forEach(({label:t})=>{this.remove(t),e.push(t),A(this,Tc).delete(t.id.toString())}),e}};Tc=new WeakMap,uP=new WeakMap;H();H();H();H();BWe=qo(Mle(),1);PWe=TWe,Cse=.2,Bse=.1,zb=251,DWe=!1;Dse=class{constructor(e,t,r,i){I(this,"renderer"),I(this,"mapObject"),I(this,"config"),I(this,"wallsId"),I(this,"maskedWallsId"),I(this,"voidWallsId"),I(this,"maskedVoidWallsId"),I(this,"ceilingId"),I(this,"ceilingMaskId"),I(this,"basementMaskId"),I(this,"footprintColor"),I(this,"layer"),I(this,"groupContainer");var n;this.renderer=e,this.mapObject=t,this.config=i;let a=$A;if(i.obstructions!=null&&i.obstructions.features.length>0){let o=i.obstructions.features.filter(s=>{var l;return s.geometry.type==="LineString"&&((l=s.properties.kind)==null?void 0:l.toLowerCase())==="wall"&&s.properties.footprintComponent===!0});if(o!=null&&o.length>0){let s=i.styleMap[(n=o[0].properties)==null?void 0:n.id];s!=null&&(a=s)}}this.footprintColor=a.color,this.groupContainer=this.renderer.addGroupContainer("Footprint-".concat(i.floorId),{visible:!1},r),this.layer=this.renderer.addGroupContainer("".concat(a7,"-").concat(i.floorId),{visible:!1},this.groupContainer.id.toString())}getFloorAltitudes(){return this.mapObject.getFloorStackAltitudeData(this.config.floorStackId)}getVisualHeight(){var e,t;if(this.config.fixedHeight!=null)return this.config.fixedHeight;let r=((e=this.getFloorAltitudes())!=null?e:new Map).get(this.config.elevation);return(t=r==null?void 0:r.visualHeight)!=null?t:0}get footprintGeometry(){return this.config.footprintGeometry}buildWalls(){let e=Pse(this.config.footprintGeometry.geometry,{id:"Footprint-Floor-".concat(this.config.floorId)}).geometry.coordinates.map((n,a)=>({type:"Feature",geometry:{type:"LineString",coordinates:n},properties:{id:"Footprint-Floor-Section-".concat(this.config.floorId,"-").concat(a)}})),t=this.getVisualHeight(),r="front";this.wallsId="Footprint-Walls-".concat(this.config.floorId);let i={color:this.footprintColor,height:t,altitude:0,width:Bse,outline:!1,visible:!0,opacity:1,side:r,renderOrder:2};this.config.elevation<0&&(i.__EXPERIMENTAL_maskMode="masked-object",i.__EXPERIMENTAL_maskEffect="reveal",i.__EXPERIMENTAL_maskEnabled=!0,i.__EXPERIMENTAL_maskId=zb),this.renderer.addGeometryGroup(this.wallsId,{features:e},i,this.groupContainer)}buildVoidWalls(e){if(!e||e.length===0)return;let t=[],r=0;for(let o of e){let s=Pse(o.geometry,{id:"Void-Wall-".concat(this.config.floorId,"-").concat(r)});for(let l of s.geometry.coordinates)t.push({type:"Feature",geometry:{type:"LineString",coordinates:l},properties:{id:"Void-Wall-Section-".concat(this.config.floorId,"-").concat(r)}}),r++}if(t.length===0)return;let i=this.getVisualHeight(),n="front";this.voidWallsId="Void-Walls-".concat(this.config.floorId);let a={color:this.footprintColor,height:i,altitude:0,width:Bse,outline:!1,visible:!0,opacity:1,side:n,renderOrder:2};this.config.elevation<0&&(a.__EXPERIMENTAL_maskMode="masked-object",a.__EXPERIMENTAL_maskEffect="reveal",a.__EXPERIMENTAL_maskEnabled=!0,a.__EXPERIMENTAL_maskId=zb),this.renderer.addGeometryGroup(this.voidWallsId,{features:t},a,this.groupContainer)}buildCeiling(e){let t=ze({},this.config.footprintGeometry);t=kse(t),(e==null?void 0:e.length)>0&&(t=kWe(t,e));let r="front";this.ceilingId="Ceiling-".concat(this.config.floorId);let i=this.getVisualHeight(),n={color:this.footprintColor,height:-Cse,altitude:i,visible:!0,outline:!1,opacity:1,side:r};this.config.elevation<0&&(n.__EXPERIMENTAL_maskMode="masked-object",n.__EXPERIMENTAL_maskEffect="reveal",n.__EXPERIMENTAL_maskEnabled=!0,n.__EXPERIMENTAL_maskId=zb),this.renderer.addGeometryGroup(this.ceilingId,{features:[bt(ze({},t),{properties:{id:"Footprint-Ceiling-".concat(this.config.floorId),externalId:this.config.externalId,elevation:this.config.elevation}})]},n,this.groupContainer)}buildBasementMask(){let e=this.config.footprintGeometry;e=kse(e),this.basementMaskId="Footprint-Basement-Mask-".concat(this.config.floorId),this.renderer.addGeometryGroup(this.basementMaskId,{features:[bt(ze({},e),{properties:{id:"Footprint-Basement-Mask-Geometry-".concat(this.config.floorId)}})]},{color:Rse(-1),altitude:0,visible:!1,height:.01,outline:!1,__EXPERIMENTAL_maskEnabled:!0,__EXPERIMENTAL_maskMode:"mask",__EXPERIMENTAL_maskId:zb},"outdoors-container"),DWe&&this.renderer.addGeometryGroup(this.basementMaskId+"debug",{features:[bt(ze({},e),{properties:{id:"Footprint-Basement-Mask-Geometry-".concat(this.config.floorId,"-debug")}})]},{color:Rse(-1),altitude:0,opacity:.5,visible:!1,height:.01,outline:!1},"outdoors-container")}update(e){var t;if(e.basementMaskEnabled!==void 0&&this.basementMaskId&&(this.renderer.setState(this.basementMaskId,{visible:e.basementMaskEnabled}),this.renderer.setState(this.basementMaskId+"debug",{visible:e.basementMaskEnabled})),(t=this.config.multiFloorView)!=null&&t.footprintsHidden)return;let r={};e.altitude!==void 0&&(r.altitude=e.altitude),e.visible!==void 0&&(r.visible=e.visible),Object.keys(r).length>0&&this.renderer.setState(this.groupContainer.id,r);let i={};e.opacity!==void 0&&(i.opacity=e.opacity),e.side!==void 0&&(i.side=e.side),e.color!==void 0&&(i.color=e.color),e.outline!==void 0&&(i.outline=e.outline);let n={};if(e.height!==void 0&&(i.height=e.height,n.altitude=e.height),this.wallsId&&Object.keys(i).length>0&&this.renderer.setState(this.wallsId,i),this.voidWallsId&&Object.keys(i).length>0&&this.renderer.setState(this.voidWallsId,i),this.maskedWallsId&&Object.keys(i).length>0){let a=i,{outline:o}=a,s=Co(a,["outline"]);Object.keys(s).length>0&&this.renderer.setState(this.maskedWallsId,s)}if(this.maskedVoidWallsId&&Object.keys(i).length>0){let a=i,{outline:o}=a,s=Co(a,["outline"]);Object.keys(s).length>0&&this.renderer.setState(this.maskedVoidWallsId,s)}if(e.opacity!==void 0&&(n.opacity=e.opacity),e.color!==void 0&&(n.color=e.color),e.ceilingVisible!==void 0&&(n.visible=e.ceilingVisible),e.outline!==void 0&&(n.outline=e.outline),this.ceilingId&&Object.keys(n).length>0&&this.renderer.setState(this.ceilingId,n),this.ceilingMaskId&&Object.keys(n).length>0){let a=n,{outline:o}=a,s=Co(a,["outline"]);Object.keys(s).length>0&&this.renderer.setState(this.ceilingMaskId,s)}}getState(){var e,t;let r=this.renderer.getState(this.groupContainer.id),i=r.altitude,n=r.visible,a=this.ceilingId?this.renderer.getState(this.ceilingId):void 0,o=a==null?void 0:a.visible,s=(e=a==null?void 0:a.height)!=null?e:Cse,l=this.basementMaskId?(t=this.renderer.getState(this.basementMaskId))==null?void 0:t.visible:void 0;if(this.wallsId){let u=this.renderer.getState(this.wallsId),c=u.height;return{altitude:i,visible:n,opacity:u.opacity,side:u.side,color:u.color,height:c,ceilingVisible:o,basementMaskEnabled:l,outline:u.outline,ceilingThickness:s}}return{altitude:i,visible:n,ceilingVisible:o,basementMaskEnabled:l,ceilingThickness:s}}};Rse=e=>e===0?"red":e===-1?"blue":e===-2?"green":"black",RWe={color:"#ffffff",opacity:1},$A={altitude:0,height:1,color:"#ffffff",opacity:1,width:.15},Fse={opacity:.25,color:"#a7d1ec",height:.8,width:.05,altitude:.1,cap:"square",visible:!1},LQ={color:"red",opacity:.2,height:$A.height+.1,visible:!0,borderVisible:!1},zse=.5,du=class{constructor(e,t,r=new Map){I(this,"containerId"),I(this,"layers"),I(this,"renderer"),this.containerId=t,this.layers=r,this.renderer=e}get visible(){var e;return((e=this.renderer.getState(this.containerId))==null?void 0:e.visible)===!0}setVisible(e){this.visible!==e&&this.renderer.setState(this.containerId,{visible:e})}},Lse=0,Ose=class{constructor(e,t,r,i,n,a,o,s){I(this,"id"),I(this,"name"),I(this,"elevation"),I(this,"maxHeight"),I(this,"containerId"),I(this,"externalId"),I(this,"metadata"),I(this,"shortName"),I(this,"subtitle"),I(this,"occluderId"),I(this,"loaded",!1),I(this,"styleMap",{}),I(this,"obstructions"),I(this,"entrances"),I(this,"spaces"),I(this,"floorImages"),I(this,"floorText"),I(this,"areas"),I(this,"renderer"),I(this,"mapObject"),I(this,"options"),I(this,"layers",new Map),I(this,"footprint"),I(this,"ceiling"),I(this,"floorStackId"),I(this,"multiFloorView"),I(this,"mapDataInternal"),I(this,"_computedMaxHeight"),I(this,"facadesByStyleId",new Map),I(this,"footprintObject"),I(this,"gapFootprintObject"),he(this,B0),I(this,"load",(m=!1)=>{var g,v,_,x,b,E,M,S,D,T,P,k,R,F,B,z,O,j;if(this.loaded)return this;((g=this.footprint)==null?void 0:g.geometry)==null&&((v=this.obstructions)==null?void 0:v.features.length)===0&&((_=this.spaces)==null?void 0:_.features.length)===0&&rt.warn("Floor ".concat(this.id," exists in the data but contains no geometry.")),this.loaded=!0;let Y=this.renderer.addGroupContainer("".concat(N0,"-").concat(this.id),{},this.id);this.layers.set(N0,new du(this.renderer,Y.id.toString()));let Z=this.renderer.addGroupContainer("".concat(qA,"-").concat(this.id),{},this.id);this.layers.set(qA,new du(this.renderer,Z.id.toString()));let ne=this.renderer.addGroupContainer("".concat(Da,"-").concat(this.id),{focusable:m},this.id);this.layers.set(Da,new du(this.renderer,ne.id.toString()));let ie=this.renderer.addGroupContainer("".concat(U0,"-").concat(this.id),{},this.id);this.layers.set(U0,new du(this.renderer,ie.id.toString()));let le=this.renderer.addGroupContainer("".concat(Q0,"-").concat(this.id),{},this.id);if(this.layers.set(Q0,new du(this.renderer,le.id.toString())),(x=this.multiFloorView)!=null&&x.__EXPERIMENTAL_DEBUG_showVoids){let X=0;for(let ce of this.voids)this.renderer.addGeometryGroup("Void-".concat(this.id,"-").concat(X),{features:[ce]},{color:"red"},ne),X++}if((b=this.multiFloorView)!=null&&b.__EXPERIMENTAL_DEBUG_showOpenToBelow){let X=0;for(let ce of this.spacesOpenToBelow)this.renderer.addGeometryGroup("SpacesOpenToBelow-".concat(this.id,"-").concat(X),{features:[ce]},{color:"blue"},ne),X++}if(this.spaces!=null&&this.spaces.features.length>0){let X=[],ce=new Map,ge=(E=this.multiFloorView)==null?void 0:E.__EXPERIMENTAL_excludeSpaceIdsInAutoHeightCalculation,be=ge!=null&&ge.length>0?new Set(ge):void 0;for(let Ye of this.spaces.features){if(Ye.geometry.type!=="Polygon")continue;let We=(M=Ye.properties.kind)==null?void 0:M.toLowerCase();if(We==="void"||We==="otb")continue;let Me=this.styleMap[Ye.properties.id];if(Me!=null&&"height"in Me&&(Me==null?void 0:Me.height)!=null&&(be==null||!be.has(Ye.properties.id))){let oe=((S=Me.altitude)!=null?S:0)+Me.height;(this._computedMaxHeight==null||oe>this._computedMaxHeight)&&(this._computedMaxHeight=oe)}let Ce=(D=this.mapDataInternal)==null?void 0:D.facadesBySpaceId[Ye.properties.id];if(Ce){let oe=ce.get(Ce.id);oe==null&&(oe=[],ce.set(Ce.id,oe)),oe.push(Ye)}else X.push(Ye)}let _e=this.renderer.addGroupContainer("spaces-".concat(this.id),{},ne),ke=this.renderer.addGeometryGroup("Spaces-".concat(this.id,"-0"),{features:X},Ye=>{var We;return((We=Ye==null?void 0:Ye.properties)==null?void 0:We.id)!=null&&this.styleMap[Ye.properties.id]!=null?ub(this.styleMap[Ye.properties.id],this.options):RWe},_e);if(this.layers.get(Da).layers.set("Spaces",ke.id.toString()),ce.size>0){let Ye=this.renderer.addGroupContainer("".concat(jb,"-").concat(this.id),{},this.id);this.layers.set(jb,new du(this.renderer,Ye.id.toString()));for(let[We,Me]of ce){let Ce=this.renderer.addGroupContainer(We,{focusable:!0},Ye),oe=this.renderer.addGroupContainer("".concat(We,"-geometry"),{},Ce),it=cse(Me,this.styleMap),Oe=0;for(let[Ke,Le]of it){let Ze=this.renderer.addGeometryGroup("Facades-".concat(this.id,"-").concat(We,"-").concat(Oe),{features:Le},bt(ze({},ub(Ke,this.options)),{renderOrder:3}),oe);Oe++;let ut=Ke.id||Ze.id.toString();this.layers.get(jb).layers.set("".concat(We,"-").concat(ut),Ze.id.toString()),this.facadesByStyleId.has(ut)?(T=this.facadesByStyleId.get(ut))==null||T.push(We):this.facadesByStyleId.set(ut,[We])}}}}if(((P=this.footprint)==null?void 0:P.geometry)!=null&&this.footprint.geometry.coordinates.length>0&&this.styleMap!=null&&(this.footprintObject=new Dse(this.renderer,this.mapObject,this.id,{floorId:this.id,externalId:this.externalId,elevation:this.elevation,floorStackId:this.floorStackId,footprintGeometry:this.footprint,obstructions:this.obstructions,styleMap:this.styleMap,multiFloorView:this.multiFloorView}),this.layers.set(a7,new du(this.renderer,this.footprintObject.layer.id.toString())),this.footprint=fHe(this.footprint)),this.obstructions!=null&&this.obstructions.features.length>0){let X=this.obstructions.features.filter(Ce=>Ce.geometry.type==="Polygon"&&(Ce.properties.kind==="object"||Ce.properties.kind==="unknown")),ce=cse(X,this.styleMap),ge=this.renderer.addGroupContainer("objects-".concat(this.id),{},ne),be=0;for(let[Ce,oe]of ce){let it=this.renderer.addGeometryGroup("Objects-".concat(this.id,"-").concat(be),{features:oe},ub(Ce,this.options),ge);be++;let Oe=ge.id.toString();this.layers.get(Da).layers.set(Ce.id||Oe,it.id.toString())}let _e=this.obstructions.features.filter(Ce=>{var oe;return Ce.geometry.type==="LineString"&&((oe=Ce.properties.kind)==null?void 0:oe.toLowerCase())==="wall"&&Ce.properties.footprintComponent===!1}),ke=this.obstructions.features.filter(Ce=>{var oe;return Ce.geometry.type==="LineString"&&((oe=Ce.properties.kind)==null?void 0:oe.toLowerCase())==="wall"&&Ce.properties.footprintComponent===!0}),Ye=this.entrances,We=$A,Me=$A;if(_e!=null&&_e.length>0){let Ce=this.styleMap[(k=_e[0].properties)==null?void 0:k.id];Ce!=null&&(We=ze({},Ce)),Me=We;let{walls:oe,entrances:it}=use(_e,(Ye==null?void 0:Ye.features)||[]),Oe=Math.max(We.height-.11,zse),Ke=bt(ze({},Fse),{height:Oe}),Le=this.renderer.addGeometryGroup("InteriorDoors-".concat(this.id),it,Ke,ne);this.layers.get(Da).layers.set(V7,Le.id.toString());let Ze=this.renderer.addGeometryGroup("Walls-".concat(this.id),{features:[oe]},ub(We,this.options),ne);this.layers.get(Da).layers.set(LP,Ze.id.toString())}if(ke!=null&&ke.length>0){let Ce=this.styleMap[(R=ke[0].properties)==null?void 0:R.id];Ce!=null&&(Me=bt(ze({},Ce),{id:O0}));let{walls:oe,entrances:it}=use(ke,(Ye==null?void 0:Ye.features)||[]),Oe=Math.max(Me.height-.11,zse),Ke=bt(ze({},Fse),{height:Oe}),Le=this.renderer.addGeometryGroup("ExteriorDoors-".concat(this.id),it,Ke,ne);this.layers.get(Da).layers.set(Y7,Le.id.toString());let Ze=this.renderer.addGeometryGroup("ExteriorWalls-".concat(this.id),{features:[oe]},ub(Me,this.options),ne);this.layers.get(Da).layers.set(O0,Ze.id.toString())}}if(this.floorImages!=null){let X=this.renderer.addGroupContainer("images-".concat(this.id),{},this.id);for(let ce of this.floorImages.features||[]){let ge="anchorId"in ce.properties?ce.properties.anchorId:null,be=ge==null,_e=ge!=null&&this.mapDataInternal!=null&&this.mapDataInternal.pointsOfInterestById[ge]!=null;if(be||_e){let ke=hHe(ce,Lse),Ye=(((F=ce.properties.rotation)!=null?F:0)%360+360)%360;if(_e){let We=new Tr({latitude:ce.geometry.coordinates[1],longitude:ce.geometry.coordinates[0],floorId:this.id});this.mapDataInternal.Query.at(We).then(Me=>{var Ce,oe,it;let Oe=0;for(let Ke of Me)if(ua.is(Ke)){let Le=(oe=(Ce=this.renderer.getState(Ke.id))==null?void 0:Ce.height)!=null?oe:0;Le>Oe&&(Oe=Le)}this.mapObject.api.Image3D.add(new Tr({latitude:ce.geometry.coordinates[1],longitude:ce.geometry.coordinates[0],floorId:this.id,verticalOffset:Oe}),ce.properties.path,bt(ze({id:ke,flipImageToFaceCamera:(it=this.options.flipImagesToFaceCamera)!=null?it:!0},ce.properties),{rotation:Ye}))})}else this.mapObject.api.Image3D.add(new Tr({latitude:ce.geometry.coordinates[1],longitude:ce.geometry.coordinates[0],floorId:this.id}),ce.properties.path,bt(ze({id:ke,flipImageToFaceCamera:(B=this.options.flipImagesToFaceCamera)!=null?B:!0},ce.properties),{rotation:Ye}));Lse++}}this.layers.set(H7,new du(this.renderer,X.id.toString()))}if(this.floorText!=null)for(let X of this.floorText.features||[]){let ce=0;"geometryId"in X.properties?ce=(O=(z=this.renderer.getState(X.properties.geometryId))==null?void 0:z.height)!=null?O:0:ce=(j=X.properties.verticalOffset)!=null?j:0,this.renderer.addText3D(Pi(),bt(ze({},X),{properties:bt(ze({},X.properties),{verticalOffset:ce})}),{appearance:{flipToFaceCamera:!1}},this.id)}if(this.areas!=null){let X=this.renderer.addGroupContainer("areas-".concat(this.id),{},this.id);this.layers.set(EP,new du(this.renderer,X.id.toString()));let ce=this.renderer.addGeometryGroup("Areas-".concat(this.id),{features:this.areas.features},{color:LQ.color,height:LQ.height},X);for(let ge of this.areas.features||[])this.renderer.setState(ge.properties.id,bt(ze({},LQ),{visible:!1}));this.layers.get(EP).layers.set(ce.id.toString(),ce.id.toString())}return this.renderer.render(),this});var l,u,c,h,d,p;this.mapObject=r,this.renderer=r.renderer,this.id=t.id,this.options=n;let f=this.renderer.addGroupContainer(this.id,{visible:!1,interactive:!0,preloadGeometry:(l=n.preloadFloors)==null?void 0:l.map(m=>m.id).includes(t.id)},e);if(this.containerId=f.id.toString(),this.externalId=t.externalId,this.metadata=t.metadata,this.shortName=t.shortName,this.subtitle=t.subtitle,this.name=t.name,this.maxHeight=t.maxHeight,this.elevation=t.elevation,a!=null&&o!=null){this.styleMap=o,this.spaces=a.space[this.id],this.entrances=a.entrance[this.id],this.areas=(u=a.area)==null?void 0:u[this.id],this.obstructions=a.obstruction[this.id],this.floorImages=(c=a.floorImages)==null?void 0:c[this.id],this.floorText=(d=(h=a.enterprise)==null?void 0:h.floorText)==null?void 0:d[this.id];let m=(p=a["floor.geojson"])==null?void 0:p.features.find(g=>g.properties.id===t.id);m&&m.geometry!=null&&m.geometry.coordinates.length>0&&(this.footprint=m)}this.floorStackId=e,this.multiFloorView=i,this.mapDataInternal=s}get geometryMaxHeight(){return this._computedMaxHeight}get spacesOpenToBelowEnabled(){var e,t;return(t=(e=this.multiFloorView)==null?void 0:e.spacesOpenToBelowEnabled)!=null?t:!1}get voids(){var e,t,r,i;return(i=(r=(t=(e=this.mapDataInternal)==null?void 0:e.voidsByFloorId[this.id])==null?void 0:t.voids)==null?void 0:r.features)!=null?i:[]}get spacesOpenToBelow(){var e,t;if(!this.spaces)return[];let r=[];for(let i of this.spaces.features)i.geometry.type==="Polygon"&&(((e=i.properties.kind)==null?void 0:e.toLowerCase())==="void"||((t=i.properties.kind)==null?void 0:t.toLowerCase())==="otb")&&r.push(i);return r}get geoJSONBoundingBox(){if(A(this,B0))return A(this,B0);if(!this.footprint){rt.warn("Attempting to get bounding box with no footprint for floor ".concat(this.id));return}return xe(this,B0,uHe(this.footprint)),A(this,B0)}addOccluder(){var e;if(((e=this.footprint)==null?void 0:e.geometry)==null)return;let t=this.renderer.addGroupContainer("".concat(wP,"-").concat(this.id),{},this.id),r=new du(this.renderer,t.id.toString());this.layers.set(wP,r),this.occluderId=this.renderer.addOccluder(this.footprint,r.containerId)}get hasFacadeGeometry(){return this.facadesByStyleId.size>0}get visible(){return this.renderer.getState(this.containerId).visible}setVisible(e){this.renderer.setState(this.containerId,{visible:e})}buildCeiling(e){this.footprintObject&&this.footprintObject.buildCeiling(e)}buildBasementMask(){this.footprintObject&&this.footprintObject.buildBasementMask()}buildGapFootprint(e,t){var r;((r=this.footprint)==null?void 0:r.geometry)!=null&&(this.gapFootprintObject=new Dse(this.renderer,this.mapObject,this.id,{floorId:"gap-below-".concat(this.id),externalId:this.externalId,elevation:this.elevation,floorStackId:this.floorStackId,footprintGeometry:this.footprint,obstructions:void 0,styleMap:{},multiFloorView:this.multiFloorView,fixedHeight:e}),this.gapFootprintObject.buildWalls(),this.gapFootprintObject.buildCeiling(t),this.gapFootprintObject.update({altitude:-e,visible:!1}))}getFootprintStyle(){var e;let t=$A;if(this.obstructions!=null&&this.obstructions.features.length>0){let r=this.obstructions.features.filter(i=>{var n;return i.geometry.type==="LineString"&&((n=i.properties.kind)==null?void 0:n.toLowerCase())==="wall"&&i.properties.footprintComponent===!0});r!=null&&r.length>0&&(t=this.styleMap[(e=r[0].properties)==null?void 0:e.id])}return t}buildFootprint(){if(!this.footprintObject)return;this.footprintObject.buildWalls(),this.footprintObject.buildVoidWalls(this.voids);let e=new du(this.renderer,this.footprintObject.layer.id.toString());this.layers.set(a7,e)}setBatchedTextVisible(e){let t=this.renderer.getInternalState().geometry3DMap.get(this.id);if(t&&t instanceof Vi){let r=this.renderer.getSystems().text3DSystem.batchedTextMap.get(t);r&&r.then(i=>{i.visible=e})}}};B0=new WeakMap;H();Nse=class{constructor(e,t,r,i){I(this,"id"),I(this,"externalId"),I(this,"name"),I(this,"type"),I(this,"floorIds"),I(this,"defaultFloorId"),I(this,"floorObjects",[]),I(this,"floorObjectsByElevation",new Map),I(this,"metadata"),I(this,"containerId"),I(this,"facade"),I(this,"renderer"),I(this,"altitudeMap",new Map),he(this,Lb);var n;this.id=e.id,this.externalId=e.externalId,this.name=e.name,this.type=e.type,this.metadata=e.metadata,this.floorIds=(n=e.floors)!=null?n:e.maps,this.defaultFloorId=e.defaultFloor;let a=r.addGroupContainer(this.id,{visible:!0,interactive:!0},t);this.containerId=a.id.toString(),this.facade=i,this.renderer=r}get defaultFloor(){if(A(this,Lb)==null){if(this.floorObjects.length===0)throw new no("No floors in floor stack (".concat(this.id,"). Could not get default floor."));let e;this.defaultFloorId&&(e=this.floorObjects.find(t=>t.id===this.defaultFloorId)),e||(e=this.floorObjects.reduce((t,r)=>Math.abs(r.elevation)<Math.abs(t.elevation)?r:t)),xe(this,Lb,e)}return A(this,Lb)}get isOutdoors(){var e;return((e=this.type)==null?void 0:e.toLowerCase())==="outdoor"?!0:this.facade!=null?!1:this.floorObjects.some(t=>t.hasFacadeGeometry)}addFloor(e){if(this.floorObjectsByElevation.has(e.elevation)){rt.error("Floor with same elevation ".concat(e.elevation," already exists in Stack (").concat(this.id,"). Floor (").concat(e.id,") will not be added."));return}this.floorObjects.push(e),this.floorObjectsByElevation.set(e.elevation,e)}loadAllFloors(e){this.floorObjects.sort((t,r)=>t.elevation-r.elevation);for(let t of this.floorObjects)t.load(this.facade!=null),!this.isOutdoors&&!t.hasFacadeGeometry&&t.footprint!=null&&t.addOccluder();if(this.altitudeMap=dHe(this.floorObjects,e==null?void 0:e.floorGap,e==null?void 0:e.floorGapMultiplier,e==null?void 0:e.floorGapFallback,e==null?void 0:e.__EXPERIMENTAL_disableGapFilling),e!=null&&e.enabled)for(let t of this.floorObjects){let r=this.altitudeMap.get(t.elevation);r&&this.renderer.setState(t.id,{altitude:r.altitude})}if(!this.isOutdoors){for(let t of this.floorObjects){let r=this.floorObjectsByElevation.get(t.elevation+1),i=[];if(t.spacesOpenToBelowEnabled){for(let n of t.voids)i.push(n);if(r)for(let n of r.spacesOpenToBelow)i.push(n)}t.buildCeiling(i),t.buildFootprint(),t.elevation<=0&&t.buildBasementMask()}if(e!=null&&e.enabled&&!e.__EXPERIMENTAL_disableGapFilling){let t=pHe(this.floorObjects,this.altitudeMap,e.floorGap,e.floorGapMultiplier,e.floorGapFallback);for(let r of t){let i=this.floorObjectsByElevation.get(r.floorAboveElevation);if(!i)continue;let n=i.spacesOpenToBelow;i.buildGapFootprint(r.height,n)}}}}};Lb=new WeakMap;H();FWe=5,zWe="#ffffff";H();H();Use="path",pu={color:"#4b90e2",width:1,completeFraction:0,visible:!0,verticalOffset:.1,xrayOpacity:.25,__EXPERIMENTAL_SMOOTHING_TENSION:SN.tension,__EXPERIMENTAL_SMOOTHING_CORNER_RADIUS:SN.cornerRadius,dashed:!1,__EXPERIMENTAL_ENDCAP_EXTENSION:[.5,.5],__EXPERIMENTAL_BILLBOARDING:!1,__EXPERIMENTAL_PREVENT_SELF_OVERLAP:!1},nj=dt.object({type:dt.literal(Use).default(Use),color:dt.string().default(pu.color),width:dt.union([dt.number(),dt.any()]),completeFraction:dt.number().default(pu.completeFraction),visible:dt.boolean().default(pu.visible),verticalOffset:dt.number().default(pu.verticalOffset),highlightStartFraction:dt.number().default(0),highlightEndFraction:dt.number().default(0),highlightColor:dt.string().default("red"),highlightWidthMultiplier:dt.number().default(1.1),highlightCompleteFraction:dt.number().default(1),xrayOpacity:dt.number().min(0).max(1).default(pu.xrayOpacity),__EXPERIMENTAL_SMOOTHING_TENSION:dt.number().default(pu.__EXPERIMENTAL_SMOOTHING_TENSION),__EXPERIMENTAL_SMOOTHING_CORNER_RADIUS:dt.number().default(pu.__EXPERIMENTAL_SMOOTHING_CORNER_RADIUS),dashed:dt.boolean().default(pu.dashed),__EXPERIMENTAL_DASH_OPTIONS:dt.discriminatedUnion("__EXPERIMENTAL_DASH_MODE",[dt.object({__EXPERIMENTAL_DASH_MODE:dt.literal("length-scaling"),__EXPERIMENTAL_DASH_LENGTH:dt.number().min(0).max(1).default(.1),__EXPERIMENTAL_DASH_GAP:dt.number().min(0).max(1).default(.1)}),dt.object({__EXPERIMENTAL_DASH_MODE:dt.literal("width-scaling"),__EXPERIMENTAL_DASH_SIZE:dt.number().min(0).default(3),__EXPERIMENTAL_GAP_SIZE:dt.number().min(0).default(2)}),dt.object({__EXPERIMENTAL_DASH_MODE:dt.literal("absolute"),__EXPERIMENTAL_DASH_METERS:dt.number().min(0).default(1),__EXPERIMENTAL_GAP_METERS:dt.number().min(0).default(.5)})]).optional(),__EXPERIMENTAL_GEOMETRY:dt.enum(["tube","ribbon"]).default("tube"),__EXPERIMENTAL_ENDCAP_EXTENSION:dt.tuple([dt.number(),dt.number()]).default(pu.__EXPERIMENTAL_ENDCAP_EXTENSION),__EXPERIMENTAL_BILLBOARDING:dt.boolean().default(pu.__EXPERIMENTAL_BILLBOARDING),__EXPERIMENTAL_BORDER:dt.object({enabled:dt.boolean(),color:dt.custom(e=>typeof e=="string"),width:dt.number().optional()}).optional(),__EXPERIMENTAL_PREVENT_SELF_OVERLAP:dt.boolean().default(pu.__EXPERIMENTAL_PREVENT_SELF_OVERLAP)}),Qse=nj.partial(),Sft=dt.strictObject(nj.shape);jse=class extends Ki{constructor(e,t,r,i){var n,a,o,s;super(),I(this,"floorStacksById",new Map),I(this,"floorsById",new Map),I(this,"startingFloorId",""),I(this,"currentFloorId",""),I(this,"currentFloorStackId",""),I(this,"outdoorFloorStacks",new Set),I(this,"id"),I(this,"renderer"),I(this,"api"),I(this,"mvf"),I(this,"options",{}),I(this,"styleMap"),I(this,"animations",new Map),I(this,"Models",{add:(h,d,p)=>{var f;let m=p,{floorId:g,scale:v}=m,_=Co(m,["floorId","scale"]),x=g?this.floorsById.get(g):void 0,b=x==null?void 0:x.layers.get(Q0),E=ze({},_);v!=null&&(E.scale=Array.isArray(p.scale)?p.scale:[p.scale,p.scale,p.scale]);let M=this.renderer.addModelGroup(h,{type:"FeatureCollection",features:d.map(S=>({type:"Feature",properties:{id:Pi(),rotation:p.rotation,scale:E.scale,interactive:p.interactive},geometry:{type:"Point",coordinates:Rc(S)}}))},E,{parent:(f=b==null?void 0:b.containerId)!=null?f:x==null?void 0:x.id});if(M==null)throw new no("error creating model");return this.renderer.getState(M).children},remove:(h,d)=>{this.renderer.remove(h)}}),I(this,"Image3D",{add:(h,d,p)=>{var f;let m=p,{floorId:g,flipImageToFaceCamera:v,maxImageSize:_}=m,x=Co(m,["floorId","flipImageToFaceCamera","maxImageSize"]),b=g?this.floorsById.get(g):this.currentFloor,E={type:"Feature",properties:x,geometry:{type:"Point",coordinates:h}};return this.renderer.addImage((f=p.id)!=null?f:Pi(),E,{url:d,flipImageToFaceCamera:v!=null?v:!1,maxImageSize:_},b.id)},remove:h=>{this.renderer.remove(h)},removeAll:()=>{}}),I(this,"Markers",{add:(h,d,p)=>{let f=QT(h,this.floorsById,this.api.mapObjects[0].floorsById.get("default-floor")),m=p,{attachTo:g}=m,v=Co(m,["attachTo"]),_=v;v.rank==="initial"&&(_.rank="medium");let x=f.layers.get(qA),b=this.renderer.addMarker2D(Rc(h),d,bt(ze({},_),{occluderId:f==null?void 0:f.occluderId,attachTo:g}),x==null?void 0:x.containerId);if(!b)throw new no("Failed to create Marker");return b},remove:h=>{this.renderer.remove(h)},getContentEl:h=>{let d=this.renderer.getState(h);if((d==null?void 0:d.type)==="marker")return d.element},removeAll:()=>{},setPosition:(h,d,p)=>{var f;let m=this.renderer.getState(h),g=p?this.floorsById.get(p):this.currentFloor;if(!m){rt.error('Failed to retrieve state for Marker with id "'.concat(h,'".'));return}if(m.type!=="marker"){rt.error('Geometry with id "'.concat(h,'" is not of type "marker".'));return}this.renderer.setState(m,{position:d,parent:(f=g==null?void 0:g.layers.get(qA))==null?void 0:f.containerId})},animateTo:(h,d,p,f)=>{let m=this.renderer.getState(h),g=p?this.floorsById.get(p):this.currentFloor;if(!m)return rt.error('Failed to retrieve state for Marker with id "'.concat(h,'".')),Promise.resolve();if(m.type!=="marker")return rt.error('Geometry with id "'.concat(h,'" is not of type "marker".')),Promise.resolve();let v=ze({duration:1e3,easing:"ease-in-out"},f);this.cancelAnimation(h);let _=new tp({lon:m.position[0],lat:m.position[1]}).to({lon:d[0],lat:d[1]},v.duration).easing(fy[v.easing]).onUpdate(({lon:x,lat:b})=>{var E;if(!this.renderer.getState(h))this.cancelAnimation(h);else{let M=(E=g==null?void 0:g.layers.get(qA))==null?void 0:E.containerId;M&&this.Markers.setPosition(h,[x,b],M)}}).start();return this.renderer.getInternalTweenGroup().add(_),this.renderer.render(),this.animations.set(h,_),dse(_).then(()=>{this.animations.delete(h)})}}),I(this,"Exporter",{getCurrentSceneGLTF:h=>Qe(this,null,function*(){return this.renderer.getCurrentSceneGLTF(h)})}),I(this,"Shapes",{add:(h,d,p)=>{let f=p!=null&&p.floorId?this.floorsById.get(p==null?void 0:p.floorId):this.currentFloor,m="shape-"+Pi();return this.renderer.addGeometryGroup(m,h,d,f.id),m},remove:h=>(this.renderer.remove(h.id),h.id)}),I(this,"Text3D",{label:(h,d,p)=>{var f;if(!((f=this.api.getMapDataInternal())!=null&&f.enterpriseMode)){rt.warn("Enterprise mode is not enabled, skipping label creation");return}let m=Gse(this.renderer,h,d,p);if(m)return{textInfo:m,target:h}},labelAll:(h={})=>{var d;if(!((d=this.api.getMapDataInternal())!=null&&d.enterpriseMode))return rt.warn("Enterprise mode is not enabled, skipping label creation"),[];let p=this.api.getMapData();if(!p)return[];let f=[];return p.getByType("space").forEach(m=>{var g,v;if(m.enterpriseLocations[0]){let _=Gse(this.renderer,m,(v=(g=m.enterpriseLocations[0])==null?void 0:g.name)!=null?v:m.name,h);_&&f.push({textInfo:_,target:m})}}),f},add:(h,d,p)=>{var f;let{rotation:m=0,appearance:g}=p,{fontSize:v=12,color:_="black",font:x=""}=g!=null?g:{},b=QT(h,this.floorsById,this.api.mapObjects[0].floorsById.get("default-floor")),E={type:"Feature",properties:{text:d,rotation:m,verticalOffset:(f=h.verticalOffset)!=null?f:0,fontSize:v,color:_,align:"center",visible:!0,fontFamily:x},geometry:{type:"Point",coordinates:Rc(h)}},M=Pi();return this.renderer.addText3D(M,E,{appearance:bt(ze({},g),{fontSize:v,color:_,font:x||void 0})},b.id)},remove:h=>(this.renderer.remove(h),h)}),I(this,"Labels",{all:({onCreate:h,labelOptions:d={}})=>{for(let p of Object.entries(this.mvf.space)){let[f,m]=p;m&&m.features.forEach(g=>{var v,_,x,b;let E=(v=this.api.getMapData())==null?void 0:v.getById("space",g.properties.id);if(!E)return;let M=(_=this.styleMap[g.properties.id])==null?void 0:_.showImage,S=(x=g.properties.details)==null?void 0:x.images,D=M&&(b=S==null?void 0:S[0])!=null&&b.url?{icon:S[0].url}:{},T=ze({icon:D.icon},d.appearance),P=(f?this.floorsById.get(f):this.currentFloor).layers.get(N0);if(g.properties.center&&E.name!==""){let k=this.renderer.addLabel2D(g.properties.center,E.name,bt(ze({id:g.properties.id+"-label"},d),{appearance:T,rank:d.rank,attachTo:q7(E)}),ua.is(E)?E.id:P==null?void 0:P.containerId);k&&h(k.id,E.name,E)}})}},add:(h,d,p={})=>{let f=p,{attachTo:m}=f,g=Co(f,["attachTo"]),v=QT(h,this.floorsById,this.api.mapObjects[0].floorsById.get("default-floor")),_=v.layers.get(N0),x=this.renderer.addLabel2D(Rc(h),d,bt(ze({},g),{occluderId:v.occluderId,attachTo:m}),_==null?void 0:_.containerId);if(!x)throw new no("label creating failed");return x},remove:({entityId:h})=>{this.renderer.remove(h)},removeAll:()=>{}}),I(this,"Paths",{add:(h,d,p)=>{var f,m;let g=d?DP(d):void 0,v=(f=d==null?void 0:d.animateDrawing)!=null?f:!0,_=[],x=h[0].floorId||"root",b=0;for(let M of h){let S=(m=M.floorId)!=null?m:x,{latitude:D,longitude:T}=M;S!==x&&(b++,x=S),_[b]==null&&_.push({floorId:S,coordinates:[]});let P=M.floorId===S?M:new Tr({longitude:T,latitude:D,floorId:S});_[b].coordinates.push(P)}let E=_.reduce((M,{floorId:S,coordinates:D},T)=>{var P,k,R,F,B,z,O,j,Y;if(T!==0){let ie=_[T-1],le=ie.coordinates[ie.coordinates.length-1],X=D[0],ce=Rc(le),ge=Rc(X),be=this.floorsById.get(ie.floorId),_e=this.floorsById.get(S),ke=be==null?void 0:be.floorStackId,Ye=_e==null?void 0:_e.floorStackId,We=ke?this.getFloorStackAltitudeData(ke):void 0,Me=Ye?this.getFloorStackAltitudeData(Ye):void 0,Ce=(R=(k=We==null?void 0:We.get((P=be==null?void 0:be.elevation)!=null?P:0))==null?void 0:k.altitude)!=null?R:0,oe=(z=(B=Me==null?void 0:Me.get((F=_e==null?void 0:_e.elevation)!=null?F:0))==null?void 0:B.altitude)!=null?z:0,it=(O=p==null?void 0:p.__EXPERIMENTAL_JUNCTION_INSET)!=null?O:0;nHe(ce,ge,it,Ce,oe);let Oe=rHe(p==null?void 0:p.__EXPERIMENTAL_BILLBOARDING,Ce,oe,ce,ge),Ke=p?bt(ze({},p),{__EXPERIMENTAL_BILLBOARDING:Oe}):g,Le=Ke?DP(Ke):g,Ze=this.renderer.addPath({type:"FeatureCollection",features:[{type:"Feature",properties:{parentId:ie.floorId},geometry:{type:"Point",coordinates:ce}},{type:"Feature",properties:{parentId:S},geometry:{type:"Point",coordinates:ge}}]},Le,this.id);Ze&&(v&&this.renderer.setState(Ze.id,{completeFraction:0}),M.push(bt(ze({},Ze),{coordinates:[le,X]})))}if(D.length<2)return M;let Z=(Y=(j=this.floorsById.get(S))==null?void 0:j.layers.get(U0))==null?void 0:Y.containerId,ne=this.renderer.addPath({type:"FeatureCollection",features:D.map(ie=>({type:"Feature",properties:{},geometry:{type:"Point",coordinates:Rc(ie)}}))},g,Z!=null?Z:S);return ne&&(v&&this.renderer.setState(ne.id,{completeFraction:0}),M.push(bt(ze({},ne),{coordinates:D}))),M},[]);if(v){let M=[],S=this.api.getMapData();return E.forEach(D=>{var T;let P=cHe(D,S,this.api);M.push(new tp({fraction:0}).to({fraction:1},P?(T=d==null?void 0:d.drawDuration)!=null?T:1500:0).onUpdate(k=>{this.renderer.setState(D.id,{completeFraction:k.fraction})}))}),M.forEach((D,T)=>{T<M.length-1&&D.chain(M[T+1]),this.renderer.getInternalTweenGroup().add(D)}),M[0].start(),this.renderer.render(),this.animations.set(E[0].id.toString(),M[0]),{paths:E,animation:dse(M[M.length-1]).then(()=>{this.animations.delete(E[0].id.toString())})}}else return{paths:E,animation:Promise.resolve()}},remove:h=>{h.forEach(d=>{this.cancelAnimation(d),this.renderer.remove(d)})}}),he(this,$i,{enabled:!1,floorGap:"auto",updateCameraElevationOnFloorChange:!0,footprintColor:$A.color,footprintOpacity:void 0,footprintOutline:!0,spacesOpenToBelowEnabled:!1}),this.renderer=i.core,this.api=i,this.id=e,this.renderer.addGroupContainer(e,{},"root"),this.options=r!=null?r:{},this.mvf=(n=t==null?void 0:t.mvf)!=null?n:{};let l=lHe(this.mvf["styles.json"]||{});if(this.styleMap=l,xe(this,$i,ze(ze({},A(this,$i)),r==null?void 0:r.multiFloorView)),!t){this.id!=="outdoors-container"&&rt.warn("Map (".concat(this.id,") created with no data."));let h=new Nse({id:"default-stack",externalId:"default-stack",name:"Default Stack",maps:["default-floor"]},this.id,this.renderer);this.floorStacksById.set(h.id,h),this.currentFloorStackId=h.id;let d=new Ose(h.id,{id:"default-floor",externalId:"default-floor",name:"Default Floor",elevation:0},this,A(this,$i),r!=null?r:{});this.floorsById.set(d.id,d),h.addFloor(d),this.setFloor(d.id);return}let u=t.getMVFFeatureByType("floor-stack");if(u==null||u.length===0)throw new no("MVF does not contain any Floor Stacks.");for(let h of u){let d=new Nse(h,this.id,this.renderer,(a=this.mvf.facade)==null?void 0:a[h.id]);for(let p of d.floorIds){let f=t.getMVFFeatureById("floor",p);if(f!=null){let m=new Ose(d.id,f,this,A(this,$i),r!=null?r:{},this.mvf,l,t);this.floorsById.set(m.id,m),d.addFloor(m)}}if(d.floorObjects.length<1){rt.warn("Floor stack ".concat(h.id," has no floors. It will not be loaded."));continue}this.floorStacksById.set(h.id,d),this.currentFloorStackId||(this.currentFloorStackId=h.id)}for(let[h]of Object.entries(t.facadesBySpaceId)){let d=t.getById("space",h);d&&(this.outdoorFloorStacks.add(d.floor.floorStack.id),(o=this.floorsById.get(d.floor.id))==null||o.setVisible(!0))}let c=(s=this.mvf.enterprise)==null?void 0:s.venue.defaultMap;if(r!=null&&r.initialFloor){let h=i7(r.initialFloor);h&&this.floorsById.has(h)?c=h:rt.error("Invalid initial floor specified (".concat(r.initialFloor,"), using default behavior instead"))}c||(c=this.currentFloorStack.defaultFloor.id),this.startingFloorId=c}get currentFloorStack(){let e=this.floorStacksById.get(this.currentFloorStackId);if(!e)throw new no('Current floor stack with id "'.concat(this.currentFloorStackId,'" not found'));return e}setFloorStack(e,t){if(this.currentFloorStackId===e)return;let r=this.floorStacksById.get(e);if(r==null){rt.error("Invalid floor stack passed to setFloorStack (".concat(e,"), the floor stack was not changed. Current floor stack is still ").concat(this.currentFloorStack.id,"."));return}if(r.floorObjects.length===0){rt.error("Floor stack (".concat(e,") has no floors. The floor stack was not changed. Current floor stack is still ").concat(this.currentFloorStack.id,"."));return}this.setFloor(r.defaultFloor.id,t)}get currentFloor(){let e=this.floorsById.get(this.currentFloorId);if(!e)throw new no('Floor with id "'.concat(this.currentFloorId,'" not found'));return e}get floors(){return Array.from(this.floorsById.values())}processFloorChange(e){var t,r,i,n,a,o,s,l,u,c,h,d,p;if(this.api.manualFloorVisibility===!0)return;let f=(t=this.api.getMapDataInternal())==null?void 0:t.getById("floor",e),m=(r=this.api.getMapDataInternal())==null?void 0:r.getById("floor-stack",this.currentFloorStackId);if(f&&m){let g=f.floorStack.id===(m==null?void 0:m.id),v=(i=this.api.getMapDataInternal())==null?void 0:i.getById("floor-stack",f.floorStack.id);if((n=A(this,$i))!=null&&n.enabled&&v){if(!g)for(let x of this.floorStacksById.values())x.id!==v.id&&x.floorObjects.forEach(b=>{b.setVisible(!1)});let _=ij(v.floors,f,((o=(a=this.api.Navigation)==null?void 0:a.floors)==null?void 0:o.map(x=>x.id))||[],this.getFloorStackAltitudeData(v.id),{color:(s=A(this,$i).footprintColor)!=null?s:$A.color,opacity:A(this,$i).footprintOpacity,outline:(l=A(this,$i).footprintOutline)!=null?l:!0,spacesOpenToBelowEnabled:(u=A(this,$i).spacesOpenToBelowEnabled)!=null?u:!1,spacesOpenToBelowVisualEffectEnabled:A(this,$i).spacesOpenToBelowVisualEffectEnabled,spacesOpenToBelowVisualEffectDarkenAmount:A(this,$i).spacesOpenToBelowVisualEffectDarkenAmount,spacesOpenToBelowVisualEffectDarkenUseDepth:A(this,$i).spacesOpenToBelowVisualEffectDarkenUseDepth,spacesOpenToBelowVisualEffectDesaturateAmount:A(this,$i).spacesOpenToBelowVisualEffectDesaturateAmount,spacesOpenToBelowVisualEffectDesaturateUseDepth:A(this,$i).spacesOpenToBelowVisualEffectDesaturateUseDepth,spacesOpenToBelowVisualEffectWashOutAmount:A(this,$i).spacesOpenToBelowVisualEffectWashOutAmount,spacesOpenToBelowVisualEffectWashOutUseDepth:A(this,$i).spacesOpenToBelowVisualEffectWashOutUseDepth});if((h=(c=this.api)==null?void 0:c.Outdoor)==null||h.setOpacity(_.outdoorOpacity),_.floorStates.forEach(x=>{var b;if(x.floor){let E=(b=this.api.getMapData())==null?void 0:b.getById("floor",x.floor.id);E&&this.api.updateState(E,x.state)}}),A(this,$i).updateCameraElevationOnFloorChange){let x=this.getFloorStackAltitudeData(v.id);this.api.Camera.setElevation((p=(d=x.get(f.elevation))==null?void 0:d.altitude)!=null?p:0)}}else for(let _ of this.floorStacksById.values())_.floorObjects.forEach(x=>{x.id!==e&&x.setVisible(!1)})}}updateMultiFloorViewEffects(e){xe(this,$i,ze(ze({},A(this,$i)),e)),this.processFloorChange(this.currentFloorId)}getMultiFloorViewEffects(){var e,t,r,i,n,a,o;return{spacesOpenToBelowVisualEffectEnabled:(e=A(this,$i).spacesOpenToBelowVisualEffectEnabled)!=null?e:!0,spacesOpenToBelowVisualEffectDarkenAmount:(t=A(this,$i).spacesOpenToBelowVisualEffectDarkenAmount)!=null?t:.2,spacesOpenToBelowVisualEffectDarkenUseDepth:(r=A(this,$i).spacesOpenToBelowVisualEffectDarkenUseDepth)!=null?r:!0,spacesOpenToBelowVisualEffectDesaturateAmount:(i=A(this,$i).spacesOpenToBelowVisualEffectDesaturateAmount)!=null?i:0,spacesOpenToBelowVisualEffectDesaturateUseDepth:(n=A(this,$i).spacesOpenToBelowVisualEffectDesaturateUseDepth)!=null?n:!0,spacesOpenToBelowVisualEffectWashOutAmount:(a=A(this,$i).spacesOpenToBelowVisualEffectWashOutAmount)!=null?a:0,spacesOpenToBelowVisualEffectWashOutUseDepth:(o=A(this,$i).spacesOpenToBelowVisualEffectWashOutUseDepth)!=null?o:!1}}setFloor(e,t){if(this.currentFloorId===e)return;if(!this.floorsById.get(e)){rt.error("Invalid floor passed to setFloor (".concat(e,"), the floor was not changed. Current floor is still ").concat(this.currentFloor.id));return}let r=this.currentFloorId;this.publish("floor-change-start",{previousFloorId:r,floorId:e,reason:t}),this.currentFloorStack&&this.processFloorChange(e),this.currentFloorId=e,this.currentFloorStackId=this.currentFloor.floorStackId,this.currentFloor.setVisible(!0),this.updateOutdoorPathLayerVisibility(),this.publish("floor-change",{reason:t,floorId:this.currentFloor.id,previousFloorId:r})}updateOutdoorPathLayerVisibility(){var e;let t=this.api.hidePathsNotOnCurrentFloor===!0&&!((e=this.options.multiFloorView)!=null&&e.enabled);for(let r of this.floorsById.values()){let i=this.floorStacksById.get(r.floorStackId);if(!(i!=null&&i.isOutdoors))continue;let n=r.layers.get(U0);if(!n)continue;let a=!t||r.id===this.currentFloor.id;n.setVisible(a)}}getFloorStackAltitudeData(e){var t,r;return(r=(t=this.floorStacksById.get(e))==null?void 0:t.altitudeMap)!=null?r:new Map}cancelAnimation(e){let t=this.animations.get(e);t&&(t.stop(),this.animations.delete(e),this.renderer.getInternalTweenGroup().remove(t))}loadAllFloors(){for(let e of this.floorStacksById.values())e.loadAllFloors(A(this,$i))}};$i=new WeakMap;H();UWe=class{constructor({currentMapGetter:e}){he(this,mu,new Map),he(this,cP),xe(this,cP,e)}get currentMap(){return A(this,cP).call(this)}getAll(){return Array.from(A(this,mu).values()).map(({marker:e})=>e)}getById(e){return A(this,mu).get(e)}add(e,t,r){var i;let n=e.anchorTarget;if(!n)throw new Error("get coordinate failed");let a=this.currentMap;if(!a)throw new Error("currentMap should exist");let o=a.Markers.add(n,t,bt(ze({},r),{rank:(r==null?void 0:r.rank)||"medium",dynamicResize:(i=r==null?void 0:r.dynamicResize)!=null?i:!0,attachTo:q7(e)}));if(o==null)throw new Error("error creating marker");let s=a.Markers.getContentEl(o.id.toString());if(!s)throw new Error("marker component should exist");let l=new CP(o.id.toString(),s,e);return A(this,mu).set(l.id,{marker:l,entityId:o.id.toString()}),l}remove(e){var t;let r=A(this,mu).get(e.id);r&&((t=this.currentMap)==null||t.Markers.remove(r.entityId),A(this,mu).delete(e.id.toString()))}removeAll(){let e=[];return A(this,mu).forEach(({marker:t})=>{this.remove(t),e.push(t),A(this,mu).delete(t.id.toString())}),e}setPosition(e,t){var r;let i=t.anchorTarget;if(!i){rt.error("Cannot determine coordinate from target.");return}let n=this.currentMap;if(!n){rt.error("Cannot determine the current map.");return}let a=A(this,mu).get(e.id);if(!a){rt.error('Cannot find the Marker with id "'.concat(e.id,'".'));return}n.Markers.setPosition(a.entityId,Rc(i),(r=i.floorId)!=null?r:n.currentFloorId),a.marker.updateTarget(t)}animateTo(e,t,r){var i;let n=t.anchorTarget;if(!n)return rt.error("Cannot determine coordinate from target."),Promise.resolve();let a=this.currentMap;if(!a)return rt.error("Cannot determine the current map."),Promise.resolve();let o=A(this,mu).get(e.id);return o?(o.marker.updateTarget(t),a.Markers.animateTo(o.entityId,Rc(n),(i=n.floorId)!=null?i:a.currentFloorId,r)):(rt.error('Cannot find the Marker with id "'.concat(e.id,'".')),Promise.resolve())}};mu=new WeakMap,cP=new WeakMap;H();QWe=class{constructor({currentMapGetter:e,mapDataInternalGetter:t}){he(this,C7),he(this,Np,new Map),he(this,hP),he(this,Wb),xe(this,hP,e),xe(this,Wb,t)}get currentMap(){return A(this,hP).call(this)}getById(e){return A(this,Np).get(e)}add(e,t,r){var i,n,a;let o=e.anchorTarget;if(!o)throw new Error("Target does not implement IAnchorable.");let s=this.currentMap;if(!s)throw new Error("currentMap should exist");let l=s.Image3D.add(Rc(o),t,bt(ze({},r),{floorId:o.floorId,verticalOffset:o.verticalOffset+((i=r.verticalOffset)!=null?i:0)}));if(!l)throw new Error("image component should exist");let u=(n=A(this,Wb))==null?void 0:n.call(this),c=new $b(l.id.toString(),t,e,u==null?void 0:u.tokenManager);if(A(this,Np).set(c.id,{image:c,entityId:l.id.toString(),anchorId:r.anchorId}),r.anchorId!=null&&u!=null){let h=(a=u.floorImagesByAnchorId.get(r.anchorId))!=null?a:[];h.push(c),u.floorImagesByAnchorId.set(r.anchorId,h)}return c}remove(e){var t;let r=A(this,Np).get(e.id);r&&((t=this.currentMap)==null||t.Image3D.remove(r.entityId),A(this,Np).delete(e.id),yt(this,C7,Ace).call(this,r.anchorId,e))}removeAll(){let e=[];return A(this,Np).forEach(({image:t})=>{this.remove(t),e.push(t),A(this,Np).delete(t.id.toString())}),e}};Np=new WeakMap,hP=new WeakMap,Wb=new WeakMap,C7=new WeakSet,Ace=function(e,t){var r,i;if(e==null)return;let n=(i=(r=A(this,Wb))==null?void 0:r.call(this))==null?void 0:i.floorImagesByAnchorId;if(n==null)return;let a=n.get(e);if(a==null)return;let o=a.filter(s=>s!==t);o.length===0?n.delete(e):n.set(e,o)};H();jWe=class{constructor({currentMapGetter:e,mapDataInternalGetter:t}){he(this,Nh,new Map),he(this,dP),he(this,pP),xe(this,dP,e),xe(this,pP,t)}get currentMap(){return A(this,dP).call(this)}getById(e){return A(this,Nh).get(e)}add(e,t,r){let i=[e],n=i.reduce((s,l)=>{var u,c;if(!l)return rt.error("Cannot determine coordinate from options."),s;let h=(u=QT(l,this.currentMap.floorsById,this.currentMap.floorsById.get("default-floor")))==null?void 0:u.id;return s.has(h)||s.set(h,[]),(c=s.get(h))==null||c.push(l),s},new Map);if(!i.length)throw new Error("targets should not be empty when adding a model");let a=this.currentMap;if(!a)throw new Error("currentMap should exist");let o=[];return n.forEach((s,l)=>{var u;let c=Pi();a.Models.add(c,s,bt(ze({},r),{url:t,floorId:l,verticalOffset:s[0].verticalOffset+((u=r==null?void 0:r.verticalOffset)!=null?u:0)})).forEach(h=>{let d=new ece(h.toString(),c,s[0]);A(this,Nh).set(d.id,{model:d,entityId:h.toString(),groupId:c}),o.push(d)})}),o[0]}all(){var e,t,r;let i=(e=A(this,pP))==null?void 0:e.call(this);if(!i)return[];let n=i.getByType("enterprise-venue");if(!n)return[];let a=(t=n.extra)==null?void 0:t.models;if(!((r=a==null?void 0:a.models)!=null&&r.length))return[];let o=[];for(let s of a.models){if(!(s!=null&&s.url)||!s.coordinate||!i.getById("floor",s.coordinate.floorId))continue;let l=new Tr({latitude:s.coordinate.latitude,longitude:s.coordinate.longitude,floorId:s.coordinate.floorId,verticalOffset:s.coordinate.verticalOffset}),u=this.add(l,s.url,{visible:!0,rotation:s.rotation,scale:s.scale,material:{Default:{color:s.color},Fabric:{color:s.color}},EXPERIMENTAL_clippingEnabled:!!s.manifolded});o.push(u)}return o}remove(e){var t;let r=A(this,Nh).get(e.id);r&&((t=this.currentMap)==null||t.Models.remove(r.entityId,r.groupId),A(this,Nh).delete(e.id.toString()))}removeAll(){let e=[];return A(this,Nh).forEach(({model:t})=>{var r;let i=A(this,Nh).get(t.id);i&&(e.push(t),(r=this.currentMap)==null||r.Models.remove(i.entityId,i.groupId),A(this,Nh).delete(t.id.toString()))}),e}};Nh=new WeakMap,dP=new WeakMap,pP=new WeakMap;H();GWe=class{constructor({currentMapGetter:e}){he(this,Pc,new Map),he(this,fP),xe(this,fP,e)}get currentMap(){return A(this,fP).call(this)}getById(e){var t;return(t=A(this,Pc).get(e))==null?void 0:t.path}add(e,t){let r=this.currentMap;if(!r)throw new Error("currentMap should exist");let i=r.Paths.add(e,t),n=i.paths.map(o=>o.id.toString()),a=new Gb((t==null?void 0:t.id)||Pi(),i.animation,e,i.paths);for(let o of n)A(this,Pc).set(o,{path:a,entityIds:n});return A(this,Pc).set(a.id,{path:a,entityIds:n}),a}highlightPathSection(e,t,r,i){var n,a,o,s;let l=(a=(n=this.currentMap)==null?void 0:n.api.getMapData())==null?void 0:a.mapCenter;if(!l)return;let u=lce([e],t,r,l);if(!u)return;let c=(o=i==null?void 0:i.animationDuration)!=null?o:1500,h=()=>{},d=new Promise(f=>{h=f}),p=new tp({fraction:0}).to({fraction:1},c).onUpdate(f=>{var m;for(let g of u)(m=this.currentMap)==null||m.api.updateState(g.segment,{highlightCompleteFraction:f.fraction})}).onStart(()=>{var f,m,g;for(let v of u)(g=this.currentMap)==null||g.api.updateState(v.segment,{highlightStartFraction:v.startHighlightFraction,highlightEndFraction:v.endHighlightFraction,highlightColor:(f=i==null?void 0:i.color)!=null?f:"red",highlightWidthMultiplier:(m=i==null?void 0:i.widthMultiplier)!=null?m:1})}).onComplete(()=>{var f;h(),(f=this.currentMap)==null||f.api.removeTween(p)});return(s=this.currentMap)==null||s.api.tweenGroup().add(p),p.start(),{animation:d}}clearHighlightedPathSection(e){var t;(t=this.currentMap)==null||t.api.updateState(e,{highlightCompleteFraction:0,highlightStartFraction:0,highlightEndFraction:0})}clearAllHighlightedPathSections(){for(let e of A(this,Pc).values())this.clearHighlightedPathSection(e.path)}remove(e){var t;let r=A(this,Pc).get(e.id);r&&((t=this.currentMap)==null||t.Paths.remove(r.entityIds),A(this,Pc).delete(e.id),r.entityIds.forEach(i=>A(this,Pc).delete(i)))}removeAll(){let e=[];return A(this,Pc).forEach(({path:t})=>{this.remove(t),e.push(t)}),e}};Pc=new WeakMap,fP=new WeakMap;H();VWe=class{constructor({currentMapGetter:e}){he(this,Up,new Map),he(this,AP),xe(this,AP,e)}get currentMap(){return A(this,AP).call(this)}getById(e){return A(this,Up).get(e)}add(e,t,r){let i=this.currentMap;if(!i)throw new Error("currentMap should exist");let n=i.Shapes.add(e,t||{},{floorId:r==null?void 0:r.id}),a=new oP(n);return A(this,Up).set(a.id,a),a}remove(e){var t;A(this,Up).get(e.id)&&((t=this.currentMap)==null||t.Shapes.remove(e),A(this,Up).delete(e.id.toString()))}removeAll(){let e=[];return A(this,Up).forEach(t=>{this.remove(t),e.push(t.id),A(this,Up).delete(t.id.toString())}),e}};Up=new WeakMap,AP=new WeakMap;H();YWe=class{constructor({currentMapGetter:e}){he(this,mP),xe(this,mP,e)}get currentMap(){return A(this,mP).call(this)}setFromStyleCollection(e){var t,r,i,n,a;for(let o in e)for(let s of((t=this.currentMap)==null?void 0:t.floors)||[]){if(e[o]==null||!s.layers.has(Da))continue;let l=s.layers.get(Da);for(let h of Object.values(e))if(h&&"polygons"in h&&"color"in h)for(let d of h.polygons)(r=this.currentMap)==null||r.renderer.setState(d,{color:h.color});if(l!=null&&l.layers.has(o)&&"color"in e[o]){let h=l.layers.get(o);h&&((i=this.currentMap)==null||i.renderer.setState(h,{color:e[o].color}))}if(l&&o===LP&&!(O0 in e)){let h=l.layers.get(O0);h&&"color"in e[o]&&((n=this.currentMap)==null||n.renderer.setState(h,{color:e[o].color}))}if(!s.layers.has(jb))continue;let u=s.layers.get(jb),c=s.facadesByStyleId.get(o);if(c&&c.length>0)for(let h of c){let d=u.layers.get("".concat(h,"-").concat(o));d&&"color"in e[o]&&((a=this.currentMap)==null||a.renderer.setState(d,{color:e[o].color}))}}}};mP=new WeakMap;H();OQ={opacity:1},HWe=class{constructor(e,t){he(this,Ob),he(this,Go),he(this,gP,[]),he(this,yP,{opacity:"initial"}),he(this,XA,{opacity:new Map}),he(this,Qp,new Set),xe(this,Go,e),xe(this,gP,t||[]);let r=A(this,Go).map;r&&r.on("idle",()=>{A(this,XA).opacity.size||yt(this,Ob,B7).call(this,r)})}setStyle(e){var t,r;if(A(this,Go).map){(t=A(this,Go).map)==null||t.setStyle(e),A(this,Qp).size&&(A(this,Qp).clear(),this.hide()),yt(this,Ob,mce).call(this),yt(this,Ob,B7).call(this,A(this,Go).map),this.setOpacity(A(this,yP).opacity),(r=A(this,Go).map)==null||r.moveLayer(KJ);for(let[i,n]of A(this,gP)||[])A(this,Go).hideOutdoorLayersIntersectingPolygons(i,n)}}get map(){return A(this,Go).map}get enabled(){return!!A(this,Go).map}get visible(){return A(this,Qp).size===0}show(){let e=A(this,Go).map;if(!e)return;let t=e.getStyle().layers;t&&(t.forEach(r=>{A(this,Qp).has(r.id)&&e.setLayoutProperty(r.id,"visibility","visible")}),A(this,Qp).clear())}hide(e=[]){let t=A(this,Go).map;if(!t)return;let r=t.getStyle().layers;r&&r.forEach(i=>{let n=t.getLayoutProperty(i.id,"visibility");!e.includes(i.id)&&n!=="none"&&(t.setLayoutProperty(i.id,"visibility","none"),A(this,Qp).add(i.id))})}setOpacity(e,t=[]){var r,i,n;let a=A(this,Go).map;if(!a)return;let o=(n=(i=(r=A(this,Go).map)==null?void 0:r.getStyle)==null?void 0:i.call(r))==null?void 0:n.layers;o&&a.once("idle",()=>{o.forEach(s=>{let l=a.getLayoutProperty(s.id,"visibility");if(!t.includes(s.id)&&l!=="none")try{let u=A(this,XA).opacity.get(s.id);u!==void 0&&(s.id==="background"||(s.type==="symbol"?(a.setPaintProperty(s.id,"icon-opacity",e==="initial"?u[0]:e),a.setPaintProperty(s.id,"text-opacity",e==="initial"?u[1]:e)):a.setPaintProperty(s.id,"".concat(s.type,"-opacity"),e==="initial"?u[0]:e)),A(this,yP).opacity=e)}catch(u){rt.warn("Error setting opacity:",u)}})})}};Go=new WeakMap,gP=new WeakMap,yP=new WeakMap,XA=new WeakMap,Qp=new WeakMap,Ob=new WeakSet,B7=function(e){let t=e.getStyle().layers;t&&t.forEach(r=>{var i,n,a;e.getLayoutProperty(r.id,"visibility")!=="none"&&(r.id==="background"||(r.type==="symbol"?A(this,XA).opacity.set(r.id,[(i=e.getPaintProperty(r.id,"icon-opacity"))!=null?i:OQ.opacity,(n=e.getPaintProperty(r.id,"text-opacity"))!=null?n:OQ.opacity]):A(this,XA).opacity.set(r.id,[(a=e.getPaintProperty(r.id,"".concat(r.type,"-opacity")))!=null?a:OQ.opacity,void 0])))})},mce=function(){Object.values(A(this,XA)).forEach(e=>e.clear())};H();WWe=class{constructor({currentMapGetter:e}){he(this,Uh),he(this,Qh,new Map),he(this,Dc,new Map),xe(this,Uh,e)}labelAll(e={}){var t,r;let i=[],n=new Set;return(r=(t=A(this,Uh).call(this))==null?void 0:t.Text3D.labelAll(e))==null||r.forEach(({textInfo:a,target:o})=>{let s=a.id.toString(),l=A(this,Dc).get(s);if(l){n.has(s)||i.push(l.text3DView),n.add(s);return}n.add(s);let u=new sP(s,o);A(this,Qh).set(u.id,{targetId:o.id,text3d:s,text3DView:u}),A(this,Dc).set(s,{text3DView:u}),i.push(u)}),i}label(e,t,r={}){var i;if(A(this,Uh).call(this))if(ua.is(e)){let n=(i=A(this,Uh).call(this))==null?void 0:i.Text3D.label(e,t,r);if(!n)return;let a=n.textInfo.id.toString(),o=A(this,Dc).get(a);if(o)return o.text3DView;let s=new sP(a,n.target);return A(this,Qh).set(s.id,{targetId:n.target.id,text3d:a,text3DView:s}),A(this,Dc).set(a,{text3DView:s}),s}else throw new Error("Non-space target is not supported")}add(e,t,r={}){let i=A(this,Uh).call(this);if(!i)throw new Error("Current map not found.");if(!Tr.is(e))throw new Error("Target must be a Coordinate");let n=e.anchorTarget,a=i.Text3D.add(n,t,r);if(!a)throw new Error("Failed to add Text3D.");let o=a.id.toString(),s=A(this,Dc).get(o);if(s)return rt.warn("Text3DView with ID ".concat(o," already exists. A new Text3DView will not be created. Returning existing. ")),s.text3DView;let l=new sP(o,e);return A(this,Qh).set(l.id,{targetId:e.id,text3d:o,text3DView:l}),A(this,Dc).set(o,{text3DView:l}),l}remove(e){var t;let r=typeof e=="string"?e:e.id,i=A(this,Qh).get(r);i&&((t=A(this,Uh).call(this))==null||t.Text3D.remove(i.text3d),A(this,Qh).delete(r),A(this,Dc).delete(i.text3d))}removeAll(){A(this,Qh).forEach(e=>{var t;(t=A(this,Uh).call(this))==null||t.Text3D.remove(e.text3d)}),A(this,Qh).clear(),A(this,Dc).clear()}};Uh=new WeakMap,Qh=new WeakMap,Dc=new WeakMap;H();H();Vse="doors",aj=dt.object({type:dt.literal(Vse).default(Vse),color:dt.string().default("#ffffff"),topColor:dt.string().optional(),texture:dt.object({url:dt.string().optional()}).optional(),topTexture:dt.object({url:dt.string().optional()}).optional(),visible:dt.boolean().default(!1),opacity:dt.number().default(1)}),NQ=aj.partial(),Cft=dt.strictObject(aj.shape);H();Yse="facade",oj=J.object({type:J.literal(Yse).default(Yse),opacity:J.number().default(1),visible:J.boolean().default(!0)}),XWe=oj.partial(),Tft=J.strictObject(oj.shape);H();Mu="floor",Hse="".concat(Mu,".footprint"),Wse="".concat(Mu,".geometry"),Zse="".concat(Mu,".labels"),Xse="".concat(Mu,".markers"),Jse="".concat(Mu,".images"),Kse="".concat(Mu,".occlusion"),qse="".concat(Mu,".paths"),$se="".concat(Mu,".areas"),ele="".concat(Mu,".models"),j0=J.object({type:J.literal(Hse).default(Hse),altitude:J.number().default(0),visible:J.boolean().default(!1),height:J.number().default(0),opacity:J.number().default(1),side:J.enum(["double","front","back"]).default("double"),color:J.string().default("#ffffff"),ceilingVisible:J.boolean().default(!0),basementMaskEnabled:J.boolean().default(!1),outline:J.boolean().default(!0),ceilingThickness:J.number().default(.2)}),Dft=j0.partial(),OP=J.object({type:J.literal(Wse).default(Wse),opacity:J.number().default(1),visible:J.boolean().default(!0),maskId:J.number().nullable().default(null),maskEffect:J.enum(["hide","reveal"]).default("hide"),maskMode:J.enum(["mask","masked-object"]).default("mask"),maskEnabled:J.boolean().default(!1),effectStart:J.number().default(0),effectDistance:J.number().default(0),darkenAmount:J.number().default(0),darkenUseDepth:J.boolean().default(!0),desaturateAmount:J.number().default(0),desaturateUseDepth:J.boolean().default(!0),washOutAmount:J.number().default(0),washOutUseDepth:J.boolean().default(!1)}),KWe=OP.partial(),NP=J.object({type:J.literal(Zse).default(Zse),enabled:J.boolean().default(!0)}),qWe=NP.partial(),UP=J.object({type:J.literal(Xse).default(Xse),enabled:J.boolean().default(!0)}),$We=UP.partial(),QP=J.object({type:J.literal(Jse).default(Jse),visible:J.boolean().default(!0),collisionsEnabled:J.boolean().default(!1)}),eZe=QP.partial(),jP=J.object({type:J.literal(Kse).default(Kse),enabled:J.boolean().default(!0)}),tZe=jP.partial(),GP=J.object({type:J.literal(qse).default(qse),visible:J.boolean().default(!0)}),rZe=GP.partial(),VP=J.object({type:J.literal(Mu).default(Mu),visible:J.boolean().default(!1),altitude:J.number().default(0)}),YP=J.object({type:J.literal($se).default($se),visible:J.boolean().default(!0)}),iZe=YP.partial(),HP=J.object({visible:J.boolean().default(!0)}),nZe=HP.partial(),WP=J.object({type:J.literal(ele).default(ele),visible:J.boolean().default(!0)}),aZe=WP.partial(),oZe=J.object(bt(ze({},VP.shape),{geometry:OP,labels:NP,markers:UP,images:QP,footprint:j0,occlusion:jP,paths:GP,areas:YP,text3d:HP,models:WP})),sZe=VP.partial(),kft=J.object(bt(ze({},VP.shape),{geometry:OP.partial(),labels:NP.partial(),markers:UP.partial(),images:QP.partial(),footprint:j0.partial(),occlusion:jP.partial(),paths:GP.partial(),areas:YP.partial(),text3d:HP.partial(),models:WP.partial()})).partial(),Rft=J.strictObject(bt(ze({},VP.shape),{geometry:J.strictObject(OP.shape),labels:J.strictObject(NP.shape),markers:J.strictObject(UP.shape),images:J.strictObject(QP.shape),footprint:J.strictObject(j0.shape),occlusion:J.strictObject(jP.shape),paths:J.strictObject(GP.shape),areas:J.strictObject(YP.shape),text3d:J.strictObject(HP.shape),models:J.strictObject(WP.shape)}));H();tle="geometry",sj=J.object({type:J.literal(tle).default(tle),visible:J.boolean().default(!0),color:J.union([J.string(),J.literal("initial")]).default("#ffffff"),topColor:J.union([J.string(),J.literal("initial")]).optional(),hoverColor:J.union([J.string(),J.literal("initial")]).optional(),interactive:J.boolean().default(!1),opacity:J.number().default(1),height:J.number().default(0),altitude:J.number().default(0),texture:J.object({url:J.string()}).optional(),topTexture:J.object({url:J.string()}).optional(),flipImageToFaceCamera:J.boolean().default(!1),enableImageCollisions:J.boolean().default(!1),borderVisible:J.boolean().default(!1),borderColor:J.string().optional(),borderWidth:J.number().optional()}),rle=sj.partial(),zft=J.strictObject(sj.shape);H();Jy="label",hZe=dt.object({type:dt.literal(Jy).default(Jy),text:dt.string(),rank:dt.custom(e=>mC.safeParse(e).success||e==="initial"),appearance:dt.custom(e=>a6.safeParse(e).success),interactive:dt.boolean().default(!1),enabled:dt.boolean().default(!0),textPlacement:dt.union([dt.enum(yC),dt.array(dt.enum(yC))]).default(g_),occlude:dt.boolean().default(!0)}),dZe=hZe.partial();H();lb="marker",AZe=dt.object({type:dt.literal(lb).default(lb),rank:dt.custom(e=>mC.safeParse(e).success||e==="initial"),placement:dt.union([dt.enum(vC),dt.array(dt.enum(vC))]).optional(),interactive:dt.union([dt.boolean(),dt.literal("pointer-events-auto")]).default(!1),dynamicResize:dt.boolean().default(!0),enabled:dt.boolean().default(!0),zIndex:dt.number().optional(),lowPriorityPin:dt.object({enabled:dt.boolean().optional(),size:dt.number().positive().optional(),color:dt.string().optional()}).optional(),element:dt.custom(e=>e instanceof HTMLElement,{error:"Must be an HTMLElement instance"}),contentHTML:dt.string(),occlude:dt.boolean().default(!0)}),mZe=AZe.omit({element:!0}).partial();H();ile="shape",lj=J.object({type:J.literal(ile).default(ile),visible:J.boolean().default(!0),altitude:J.number().default(0),color:J.string().default("#ffffff"),height:J.number().default(0),opacity:J.number().default(1),interactive:J.boolean().default(!1),bevel:J.object({enabled:J.boolean().optional(),thickness:J.number().optional(),size:J.number().optional(),offset:J.number().optional(),segments:J.number().optional()}).optional(),position:J.custom(e=>Tr.is(e))}),yce=lj.partial(),Uft=J.strictObject(lj.shape);H();nle="text3d",vce=dt.object({type:dt.literal(nle).default(nle),position:dt.custom(e=>e instanceof Tr,{error:"Must be a Coordinate instance"})}),xce=CN.extend(ze({},vce.shape)),_Ze=iK.extend(ze({},vce.shape)).partial(),jft=dt.strictObject(xce.shape);H();ale="walls",uj=dt.object({type:dt.literal(ale).default(ale),color:dt.string().default("#ffffff"),topColor:dt.string().optional(),texture:dt.object({url:dt.string()}).or(dt.undefined()),topTexture:dt.object({url:dt.string()}).or(dt.undefined()),visible:dt.boolean().default(!0),height:dt.number().default(0),opacity:dt.number().default(1)}),ole=uj.partial(),Vft=dt.strictObject(uj.shape);H();T7="image3d",EZe=J.object({type:J.literal(T7).default(T7),visible:J.boolean().default(!0),opacity:J.number().min(0).max(1).default(1),position:J.custom(e=>e instanceof Tr,{error:"Must be a Coordinate instance"}),width:J.number().default(1),height:J.number().default(1),rotation:J.number().default(0),verticalOffset:J.number().default(0),flipImagesToFaceCamera:J.boolean().default(!1)}),MZe=EZe.partial();H();lle="model",cj=tK.extend({type:J.literal(lle).default(lle),color:J.string().optional(),position:J.custom(e=>Tr.is(e),{error:"Expected a Coordinate"}),visible:J.boolean().default(!0),rotation:J.tuple([J.number(),J.number(),J.number()]).default([0,0,0]),scale:J.tuple([J.number(),J.number(),J.number()]).default([1,1,1]),verticalOffset:J.number().default(0),opacity:J.number().default(1),material:J.record(J.string(),rK).optional(),interactive:J.boolean().default(!1),clippingPlaneZOffset:J.custom(e=>typeof e=="number"&&!Number.isNaN(e),{message:"Must be a valid number (including Infinity)"}).default(1/0),clippingPlaneTopColor:J.string().default("#E67B5B"),clippingPlaneTopVisible:J.boolean().default(!0)}),IZe=cj.extend({scale:J.union([J.number(),J.tuple([J.number(),J.number(),J.number()])]),rotation:J.union([J.number(),J.tuple([J.number(),J.number(),J.number()])])}).partial(),Wft=J.strictObject(cj.shape);H();H();H();hj=qo(RGe());hj.registerHelper({});hj.registerPartial({});BZe=hj.template({compiler:[8,">= 4.3.0"],main:function(e,t,r,i,n){var a=e.lambda,o=e.escapeExpression,s=e.lookupProperty||function(l,u){if(Object.prototype.hasOwnProperty.call(l,u))return l[u]};return\`<div class='mappedin-annotation-marker'>
|
|
6925
6925
|
<div style='width: \`+o(a(t!=null?s(t,"size"):t,t))+"px; height: "+o(a(t!=null?s(t,"size"):t,t))+\`px'>
|
|
6926
6926
|
<img src='\`+o(a(t!=null?s(t,"icon"):t,t))+"' alt='"+o(a(t!=null?s(t,"name"):t,t))+"' width='"+o(a(t!=null?s(t,"size"):t,t))+"' height='"+o(a(t!=null?s(t,"size"):t,t))+\`' />
|
|
6927
6927
|
</div>
|
|
@@ -10913,7 +10913,7 @@ void main() {
|
|
|
10913
10913
|
#include <fog_fragment>
|
|
10914
10914
|
}`,pt={alphahash_fragment:p5,alphahash_pars_fragment:f5,alphamap_fragment:m5,alphamap_pars_fragment:g5,alphatest_fragment:A5,alphatest_pars_fragment:y5,aomap_fragment:v5,aomap_pars_fragment:x5,batching_pars_vertex:_5,batching_vertex:b5,begin_vertex:w5,beginnormal_vertex:E5,bsdfs:C5,iridescence_fragment:M5,bumpmap_pars_fragment:S5,clipping_planes_fragment:I5,clipping_planes_pars_fragment:B5,clipping_planes_pars_vertex:D5,clipping_planes_vertex:T5,color_fragment:P5,color_pars_fragment:k5,color_pars_vertex:F5,color_vertex:R5,common:L5,cube_uv_reflection_fragment:z5,defaultnormal_vertex:O5,displacementmap_pars_vertex:N5,displacementmap_vertex:U5,emissivemap_fragment:j5,emissivemap_pars_fragment:V5,colorspace_fragment:Q5,colorspace_pars_fragment:G5,envmap_fragment:Y5,envmap_common_pars_fragment:H5,envmap_pars_fragment:W5,envmap_pars_vertex:$5,envmap_physical_pars_fragment:ak,envmap_vertex:Z5,fog_vertex:X5,fog_pars_vertex:J5,fog_fragment:q5,fog_pars_fragment:K5,gradientmap_pars_fragment:ek,lightmap_pars_fragment:tk,lights_lambert_fragment:rk,lights_lambert_pars_fragment:ik,lights_pars_begin:nk,lights_toon_fragment:ok,lights_toon_pars_fragment:sk,lights_phong_fragment:lk,lights_phong_pars_fragment:uk,lights_physical_fragment:ck,lights_physical_pars_fragment:hk,lights_fragment_begin:dk,lights_fragment_maps:pk,lights_fragment_end:fk,logdepthbuf_fragment:mk,logdepthbuf_pars_fragment:gk,logdepthbuf_pars_vertex:Ak,logdepthbuf_vertex:yk,map_fragment:vk,map_pars_fragment:xk,map_particle_fragment:_k,map_particle_pars_fragment:bk,metalnessmap_fragment:wk,metalnessmap_pars_fragment:Ek,morphinstance_vertex:Ck,morphcolor_vertex:Mk,morphnormal_vertex:Sk,morphtarget_pars_vertex:Ik,morphtarget_vertex:Bk,normal_fragment_begin:Dk,normal_fragment_maps:Tk,normal_pars_fragment:Pk,normal_pars_vertex:kk,normal_vertex:Fk,normalmap_pars_fragment:Rk,clearcoat_normal_fragment_begin:Lk,clearcoat_normal_fragment_maps:zk,clearcoat_pars_fragment:Ok,iridescence_pars_fragment:Nk,opaque_fragment:Uk,packing:jk,premultiplied_alpha_fragment:Vk,project_vertex:Qk,dithering_fragment:Gk,dithering_pars_fragment:Yk,roughnessmap_fragment:Hk,roughnessmap_pars_fragment:Wk,shadowmap_pars_fragment:$k,shadowmap_pars_vertex:Zk,shadowmap_vertex:Xk,shadowmask_pars_fragment:Jk,skinbase_vertex:qk,skinning_pars_vertex:Kk,skinning_vertex:eF,skinnormal_vertex:tF,specularmap_fragment:rF,specularmap_pars_fragment:iF,tonemapping_fragment:nF,tonemapping_pars_fragment:aF,transmission_fragment:oF,transmission_pars_fragment:sF,uv_pars_fragment:lF,uv_pars_vertex:uF,uv_vertex:cF,worldpos_vertex:hF,background_vert:dF,background_frag:pF,backgroundCube_vert:fF,backgroundCube_frag:mF,cube_vert:gF,cube_frag:AF,depth_vert:yF,depth_frag:vF,distanceRGBA_vert:xF,distanceRGBA_frag:_F,equirect_vert:bF,equirect_frag:wF,linedashed_vert:EF,linedashed_frag:CF,meshbasic_vert:MF,meshbasic_frag:SF,meshlambert_vert:IF,meshlambert_frag:BF,meshmatcap_vert:DF,meshmatcap_frag:TF,meshnormal_vert:PF,meshnormal_frag:kF,meshphong_vert:FF,meshphong_frag:RF,meshphysical_vert:LF,meshphysical_frag:zF,meshtoon_vert:OF,meshtoon_frag:NF,points_vert:UF,points_frag:jF,shadow_vert:VF,shadow_frag:QF,sprite_vert:GF,sprite_frag:YF},Me={common:{diffuse:{value:new ai(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new At},alphaMap:{value:null},alphaMapTransform:{value:new At},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new At}},envmap:{envMap:{value:null},envMapRotation:{value:new At},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new At}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new At}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new At},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new At},normalScale:{value:new bo(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new At},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new At}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new At}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new At}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new ai(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new ai(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new At},alphaTest:{value:0},uvTransform:{value:new At}},sprite:{diffuse:{value:new ai(16777215)},opacity:{value:1},center:{value:new bo(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new At},alphaMap:{value:null},alphaMapTransform:{value:new At},alphaTest:{value:0}}},mb={basic:{uniforms:ji([Me.common,Me.specularmap,Me.envmap,Me.aomap,Me.lightmap,Me.fog]),vertexShader:pt.meshbasic_vert,fragmentShader:pt.meshbasic_frag},lambert:{uniforms:ji([Me.common,Me.specularmap,Me.envmap,Me.aomap,Me.lightmap,Me.emissivemap,Me.bumpmap,Me.normalmap,Me.displacementmap,Me.fog,Me.lights,{emissive:{value:new ai(0)}}]),vertexShader:pt.meshlambert_vert,fragmentShader:pt.meshlambert_frag},phong:{uniforms:ji([Me.common,Me.specularmap,Me.envmap,Me.aomap,Me.lightmap,Me.emissivemap,Me.bumpmap,Me.normalmap,Me.displacementmap,Me.fog,Me.lights,{emissive:{value:new ai(0)},specular:{value:new ai(1118481)},shininess:{value:30}}]),vertexShader:pt.meshphong_vert,fragmentShader:pt.meshphong_frag},standard:{uniforms:ji([Me.common,Me.envmap,Me.aomap,Me.lightmap,Me.emissivemap,Me.bumpmap,Me.normalmap,Me.displacementmap,Me.roughnessmap,Me.metalnessmap,Me.fog,Me.lights,{emissive:{value:new ai(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:pt.meshphysical_vert,fragmentShader:pt.meshphysical_frag},toon:{uniforms:ji([Me.common,Me.aomap,Me.lightmap,Me.emissivemap,Me.bumpmap,Me.normalmap,Me.displacementmap,Me.gradientmap,Me.fog,Me.lights,{emissive:{value:new ai(0)}}]),vertexShader:pt.meshtoon_vert,fragmentShader:pt.meshtoon_frag},matcap:{uniforms:ji([Me.common,Me.bumpmap,Me.normalmap,Me.displacementmap,Me.fog,{matcap:{value:null}}]),vertexShader:pt.meshmatcap_vert,fragmentShader:pt.meshmatcap_frag},points:{uniforms:ji([Me.points,Me.fog]),vertexShader:pt.points_vert,fragmentShader:pt.points_frag},dashed:{uniforms:ji([Me.common,Me.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:pt.linedashed_vert,fragmentShader:pt.linedashed_frag},depth:{uniforms:ji([Me.common,Me.displacementmap]),vertexShader:pt.depth_vert,fragmentShader:pt.depth_frag},normal:{uniforms:ji([Me.common,Me.bumpmap,Me.normalmap,Me.displacementmap,{opacity:{value:1}}]),vertexShader:pt.meshnormal_vert,fragmentShader:pt.meshnormal_frag},sprite:{uniforms:ji([Me.sprite,Me.fog]),vertexShader:pt.sprite_vert,fragmentShader:pt.sprite_frag},background:{uniforms:{uvTransform:{value:new At},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:pt.background_vert,fragmentShader:pt.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new At}},vertexShader:pt.backgroundCube_vert,fragmentShader:pt.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:pt.cube_vert,fragmentShader:pt.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:pt.equirect_vert,fragmentShader:pt.equirect_frag},distanceRGBA:{uniforms:ji([Me.common,Me.displacementmap,{referencePosition:{value:new Ee},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:pt.distanceRGBA_vert,fragmentShader:pt.distanceRGBA_frag},shadow:{uniforms:ji([Me.lights,Me.fog,{color:{value:new ai(0)},opacity:{value:1}}]),vertexShader:pt.shadow_vert,fragmentShader:pt.shadow_frag}},mb.physical={uniforms:ji([mb.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new At},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new At},clearcoatNormalScale:{value:new bo(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new At},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new At},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new At},sheen:{value:0},sheenColor:{value:new ai(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new At},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new At},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new At},transmissionSamplerSize:{value:new bo},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new At},attenuationDistance:{value:0},attenuationColor:{value:new ai(0)},specularColor:{value:new ai(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new At},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new At},anisotropyVector:{value:new bo},anisotropyMap:{value:null},anisotropyMapTransform:{value:new At}}]),vertexShader:pt.meshphysical_vert,fragmentShader:pt.meshphysical_frag},Gs=(1+Math.sqrt(5))/2,Yl=1/Gs,Nle=[new Ee(-Gs,Yl,0),new Ee(Gs,Yl,0),new Ee(-Yl,0,Gs),new Ee(Yl,0,Gs),new Ee(0,Gs,-Yl),new Ee(0,Gs,Yl),new Ee(-1,1,-1),new Ee(1,1,-1),new Ee(-1,1,1),new Ee(1,1,1)],Ule=new Float32Array(16),jle=new Float32Array(9),Vle=new Float32Array(4),Qle={[K4]:eC,[tC]:aC,[iC]:oC,[rC]:nC,[eC]:K4,[aC]:tC,[oC]:iC,[nC]:rC}}),Gle=M(()=>{"use strict";im()}),Yle,i$=M(()=>{"use strict";vn(),Yle=new Set(Object.keys(ai.NAMES))}),Hle=M(()=>{"use strict"});function MB(e){return Math.min(5,Math.max(2,e))}function gb(e){if(typeof e=="number")return MB(e);let t=IB.indexOf(e);return t===-1?3:t}function Wle(e){let t=MB(e);return IB[t]}function Yf(e){"@babel/helpers - typeof";return Yf=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Yf(e)}function ke(e,t){if(e=e||"",t=t||{},e instanceof ke)return e;if(!(this instanceof ke))return new ke(e,t);var r=n$(e);this._originalInput=e,this._r=r.r,this._g=r.g,this._b=r.b,this._a=r.a,this._roundA=Math.round(100*this._a)/100,this._format=t.format||r.format,this._gradientType=t.gradientType,this._r<1&&(this._r=Math.round(this._r)),this._g<1&&(this._g=Math.round(this._g)),this._b<1&&(this._b=Math.round(this._b)),this._ok=r.ok}function n$(e){var t={r:0,g:0,b:0},r=1,i=null,n=null,a=null,o=!1,s=!1;return typeof e=="string"&&(e=c$(e)),Yf(e)=="object"&&(xo(e.r)&&xo(e.g)&&xo(e.b)?(t=a$(e.r,e.g,e.b),o=!0,s=String(e.r).substr(-1)==="%"?"prgb":"rgb"):xo(e.h)&&xo(e.s)&&xo(e.v)?(i=mh(e.s),n=mh(e.v),t=s$(e.h,i,n),o=!0,s="hsv"):xo(e.h)&&xo(e.s)&&xo(e.l)&&(i=mh(e.s),a=mh(e.l),t=o$(e.h,i,a),o=!0,s="hsl"),e.hasOwnProperty("a")&&(r=e.a)),r=gC(r),{ok:o,format:e.format||s,r:Math.min(255,Math.max(t.r,0)),g:Math.min(255,Math.max(t.g,0)),b:Math.min(255,Math.max(t.b,0)),a:r}}function a$(e,t,r){return{r:pr(e,255)*255,g:pr(t,255)*255,b:pr(r,255)*255}}function Ab(e,t,r){e=pr(e,255),t=pr(t,255),r=pr(r,255);var i=Math.max(e,t,r),n=Math.min(e,t,r),a,o,s=(i+n)/2;if(i==n)a=o=0;else{var l=i-n;switch(o=s>.5?l/(2-i-n):l/(i+n),i){case e:a=(t-r)/l+(t<r?6:0);break;case t:a=(r-e)/l+2;break;case r:a=(e-t)/l+4;break}a/=6}return{h:a,s:o,l:s}}function o$(e,t,r){var i,n,a;e=pr(e,360),t=pr(t,100),r=pr(r,100);function o(u,c,d){return d<0&&(d+=1),d>1&&(d-=1),d<1/6?u+(c-u)*6*d:d<1/2?c:d<2/3?u+(c-u)*(2/3-d)*6:u}if(Y(o,"hue2rgb"),t===0)i=n=a=r;else{var s=r<.5?r*(1+t):r+t-r*t,l=2*r-s;i=o(l,s,e+1/3),n=o(l,s,e),a=o(l,s,e-1/3)}return{r:i*255,g:n*255,b:a*255}}function yb(e,t,r){e=pr(e,255),t=pr(t,255),r=pr(r,255);var i=Math.max(e,t,r),n=Math.min(e,t,r),a,o,s=i,l=i-n;if(o=i===0?0:l/i,i==n)a=0;else{switch(i){case e:a=(t-r)/l+(t<r?6:0);break;case t:a=(r-e)/l+2;break;case r:a=(e-t)/l+4;break}a/=6}return{h:a,s:o,v:s}}function s$(e,t,r){e=pr(e,360)*6,t=pr(t,100),r=pr(r,100);var i=Math.floor(e),n=e-i,a=r*(1-t),o=r*(1-n*t),s=r*(1-(1-n)*t),l=i%6,u=[r,o,a,a,s,r][l],c=[s,r,r,o,a,a][l],d=[a,a,s,r,r,o][l];return{r:u*255,g:c*255,b:d*255}}function vb(e,t,r,i){var n=[ea(Math.round(e).toString(16)),ea(Math.round(t).toString(16)),ea(Math.round(r).toString(16))];return i&&n[0].charAt(0)==n[0].charAt(1)&&n[1].charAt(0)==n[1].charAt(1)&&n[2].charAt(0)==n[2].charAt(1)?n[0].charAt(0)+n[1].charAt(0)+n[2].charAt(0):n.join("")}function HF(e,t,r,i,n){var a=[ea(Math.round(e).toString(16)),ea(Math.round(t).toString(16)),ea(Math.round(r).toString(16)),ea(SB(i))];return n&&a[0].charAt(0)==a[0].charAt(1)&&a[1].charAt(0)==a[1].charAt(1)&&a[2].charAt(0)==a[2].charAt(1)&&a[3].charAt(0)==a[3].charAt(1)?a[0].charAt(0)+a[1].charAt(0)+a[2].charAt(0)+a[3].charAt(0):a.join("")}function xb(e,t,r,i){var n=[ea(SB(i)),ea(Math.round(e).toString(16)),ea(Math.round(t).toString(16)),ea(Math.round(r).toString(16))];return n.join("")}function WF(e,t){t=t===0?0:t||10;var r=ke(e).toHsl();return r.s-=t/100,r.s=Am(r.s),ke(r)}function $F(e,t){t=t===0?0:t||10;var r=ke(e).toHsl();return r.s+=t/100,r.s=Am(r.s),ke(r)}function ZF(e){return ke(e).desaturate(100)}function XF(e,t){t=t===0?0:t||10;var r=ke(e).toHsl();return r.l+=t/100,r.l=Am(r.l),ke(r)}function JF(e,t){t=t===0?0:t||10;var r=ke(e).toRgb();return r.r=Math.max(0,Math.min(255,r.r-Math.round(255*-(t/100)))),r.g=Math.max(0,Math.min(255,r.g-Math.round(255*-(t/100)))),r.b=Math.max(0,Math.min(255,r.b-Math.round(255*-(t/100)))),ke(r)}function qF(e,t){t=t===0?0:t||10;var r=ke(e).toHsl();return r.l-=t/100,r.l=Am(r.l),ke(r)}function KF(e,t){var r=ke(e).toHsl(),i=(r.h+t)%360;return r.h=i<0?360+i:i,ke(r)}function eR(e){var t=ke(e).toHsl();return t.h=(t.h+180)%360,ke(t)}function _b(e,t){if(isNaN(t)||t<=0)throw new Error("Argument to polyad must be a positive number");for(var r=ke(e).toHsl(),i=[ke(e)],n=360/t,a=1;a<t;a++)i.push(ke({h:(r.h+a*n)%360,s:r.s,l:r.l}));return i}function tR(e){var t=ke(e).toHsl(),r=t.h;return[ke(e),ke({h:(r+72)%360,s:t.s,l:t.l}),ke({h:(r+216)%360,s:t.s,l:t.l})]}function rR(e,t,r){t=t||6,r=r||30;var i=ke(e).toHsl(),n=360/r,a=[ke(e)];for(i.h=(i.h-(n*t>>1)+720)%360;--t;)i.h=(i.h+n)%360,a.push(ke(i));return a}function iR(e,t){t=t||6;for(var r=ke(e).toHsv(),i=r.h,n=r.s,a=r.v,o=[],s=1/t;t--;)o.push(ke({h:i,s:n,v:a})),a=(a+s)%1;return o}function nR(e){var t={};for(var r in e)e.hasOwnProperty(r)&&(t[e[r]]=r);return t}function gC(e){return e=parseFloat(e),(isNaN(e)||e<0||e>1)&&(e=1),e}function pr(e,t){l$(e)&&(e="100%");var r=u$(e);return e=Math.min(t,Math.max(0,parseFloat(e))),r&&(e=parseInt(e*t,10)/100),Math.abs(e-t)<1e-6?1:e%t/parseFloat(t)}function Am(e){return Math.min(1,Math.max(0,e))}function Xi(e){return parseInt(e,16)}function l$(e){return typeof e=="string"&&e.indexOf(".")!=-1&&parseFloat(e)===1}function u$(e){return typeof e=="string"&&e.indexOf("%")!=-1}function ea(e){return e.length==1?"0"+e:""+e}function mh(e){return e<=1&&(e=e*100+"%"),e}function SB(e){return Math.round(parseFloat(e)*255).toString(16)}function AC(e){return Xi(e)/255}function xo(e){return!!Yn.CSS_UNIT.exec(e)}function c$(e){e=e.replace(f$,"").replace(m$,"").toLowerCase();var t=!1;if(Gy[e])e=Gy[e],t=!0;else if(e=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var r;return(r=Yn.rgb.exec(e))?{r:r[1],g:r[2],b:r[3]}:(r=Yn.rgba.exec(e))?{r:r[1],g:r[2],b:r[3],a:r[4]}:(r=Yn.hsl.exec(e))?{h:r[1],s:r[2],l:r[3]}:(r=Yn.hsla.exec(e))?{h:r[1],s:r[2],l:r[3],a:r[4]}:(r=Yn.hsv.exec(e))?{h:r[1],s:r[2],v:r[3]}:(r=Yn.hsva.exec(e))?{h:r[1],s:r[2],v:r[3],a:r[4]}:(r=Yn.hex8.exec(e))?{r:Xi(r[1]),g:Xi(r[2]),b:Xi(r[3]),a:AC(r[4]),format:t?"name":"hex8"}:(r=Yn.hex6.exec(e))?{r:Xi(r[1]),g:Xi(r[2]),b:Xi(r[3]),format:t?"name":"hex"}:(r=Yn.hex4.exec(e))?{r:Xi(r[1]+""+r[1]),g:Xi(r[2]+""+r[2]),b:Xi(r[3]+""+r[3]),a:AC(r[4]+""+r[4]),format:t?"name":"hex8"}:(r=Yn.hex3.exec(e))?{r:Xi(r[1]+""+r[1]),g:Xi(r[2]+""+r[2]),b:Xi(r[3]+""+r[3]),format:t?"name":"hex"}:!1}function aR(e){var t,r;return e=e||{level:"AA",size:"small"},t=(e.level||"AA").toUpperCase(),r=(e.size||"small").toLowerCase(),t!=="AA"&&t!=="AAA"&&(t="AA"),r!=="small"&&r!=="large"&&(r="small"),{level:t,size:r}}function oR(e,t){return t.x+t.w<e.x+e.w&&t.x>e.x&&t.y>e.y&&t.y+t.h<e.y+e.h}function sR(e,t){let[r,i]=t;return r>=e.x&&r<=e.x+e.w&&i>=e.y&&i<=e.y+e.h}function lR(e,t){let r=t.x,i=t.y,n=t.x+t.w,a=t.y+t.h,o=e.x,s=e.y,l=e.x+e.w,u=e.y+e.h;return r<l&&o<n&&i<u&&s<a}function qo(e,t){for(let r=0;r<t.length;r++)e.push(t[r])}function uR(e,t,r,i,n,a,o="-1"){var s,l;let u=1/0,c=1/0,d=-1/0,f=-1/0,m=new rr(-Sp,0,5,r),g=new rr(-Sp,0,t,5),y=new rr(t-5,0,t+Sp,r),_=new rr(0,r-5,t,r+Sp),w=h$(t,r,i,n,a),I=[m,g,y,_],k=new rr(-cn,-cn,t+cn*2,r+cn*2);for(let Q of e){let $,B;for(let U=0;U<Q.bboxes.length;U++){if(Q.bboxes[U]==null||($=Q.bboxes[U].boundingBox,B=Q.bboxes[U].index,Q.lockedToStrategyIndex!==-1&&B!==Q.lockedToStrategyIndex))continue;let[X,ne,ce,xe]=$,[Be,Oe,at,oe]=[Q.y-X,Q.y+ne,Q.x-ce,Q.x+xe],bt=at,Je=Be,lt=oe-at,Nt=Oe-Be;u=Math.min(u,bt)-cn,c=Math.min(c,Je)-cn,d=Math.max(d,bt+lt)+cn,f=Math.max(f,Je+Nt)+cn,Q.bboxes[U].boundingRect=new rr(bt,Je,lt,Nt)}}let D=new Xc(new rr(u,c,d-u,f-c)),S={msgId:o,colliders:new Array(e.length),staticColliders:[],debug:[]},L=0;for(let Q=0;Q<e.length;Q++){let $=e[Q];((l=(s=$.bboxes)==null?void 0:s[0])==null?void 0:l.index)===xC&&(S.staticColliders.push($.bboxes[0].boundingRect),D.insert($.bboxes[0].boundingRect),L++)}e=e.slice(L,e.length);let z=-cn,N=t+cn,H=-cn,q=r+cn,V;for(let Q=0;Q<e.length;Q++){V=e[Q];let $=V.x<z||V.x>N||V.y<H||V.y>q?1:0;if(S.colliders[Q]=[-1,$],V.enabledAndVisible){let[B,U,X]=[1/0,-1,void 0];for(let{index:ne,boundingRect:ce}of V.bboxes){if(ce==null)continue;let xe=[];if(xe=D.queryRect(ce).filter(Be=>ce.intersects(Be)),V.shouldCollideWithScreenEdges)for(let Be of I)ce.intersects(Be)&&xe.push(Be);if(ce.intersects(w)){S.colliders[Q]=[-1,$,ce];break}if(xe.length<B&&(X=ce,U=ne,B=xe.length),xe.length===0){D.insert(ce),S.colliders[Q]=[ne,k.contains(ce)?0:1,ce];break}}V.rank===5&&X!=null&&(D.insert(X),S.colliders[Q]=[U,k.contains(X)?0:1,X])}}return S}function h$(e,t,r,i,n){switch(n){case"top-left":return new rr(0,0,r,i);case"top-right":return new rr(e-r,0,r,i);case"bottom-left":return new rr(0,t-i,r,i);case"bottom-right":return new rr(e-r,t-i,r,i);case"center":return new rr((e-r)/2,(t-i)/2,r,i);case"top":return new rr((e-r)/2,0,r,i);case"bottom":return new rr((e-r)/2,t-i,r,i);case"left":return new rr(0,(t-i)/2,r,i);case"right":return new rr(e-r,(t-i)/2,r,i);default:return new rr(0,t-i,r,i)}}function cR(e){let t=e[0].map(r=>{let i=r[0].map(n=>({index:n[4],boundingBox:[n[0],n[1],n[2],n[3]]}));return{enabledAndVisible:r[1]===1,rank:r[2]===1?5:0,x:r[3],y:r[4],shouldCollideWithScreenEdges:r[5]===1,bboxes:i,lockedToStrategyIndex:r[6]}});return{msgId:"-1",totalWidth:e[3],totalHeight:e[2],watermarkWidth:e[4],watermarkHeight:e[5],watermarkPosition:e[6],colliders:t,devicePixelRatio:e[1]}}function hR(e="",{prefix:t=_C}={}){let r="".concat(t).concat(e?"-".concat(e):""),i=Y((n,a)=>{if(typeof window<"u"&&window.rnDebug){let o=a.map(s=>s instanceof Error&&s.stack?"".concat(s.message,`
|
|
10915
10915
|
`).concat(s.stack):s);window.rnDebug("".concat(e," ").concat(n,": ").concat(o.join(" ")))}},"rnDebug");return{logState:p$.env.NODE_ENV==="test"?3:0,log(...n){this.logState<=0&&(console.log(r,...n),i("log",n))},warn(...n){this.logState<=1&&(console.warn(r,...n),i("warn",n))},error(...n){this.logState<=2&&(console.error(r,...n),i("error",n))},assert(...n){console.assert(...n)},time(n){console.time(n)},timeEnd(n){console.timeEnd(n)},setLevel(n){0<=n&&n<=3&&(this.logState=n)}}}function dR(e,t){return"".concat(t," ").concat(e)}function pR(e,t,r,i,n,a=FA){if(t===r)return n;e=Math.max(t,Math.min(e,r));let o=(e-Math.min(t,r))/Math.abs(r-t),s=typeof a=="function"?a(o):BB[a](o);return i+s*(n-i)}function d$(e,t){let r=0;if(t.length<2)return r;let i=t[0]<t[1]?(n,a)=>n>a:(n,a)=>n<a;for(;r<t.length-1&&i(e,t[r+1]);)r++;return r>t.length-2?Math.max(0,t.length-2):r}function fR(e,t,r,i="ease-in"){if(t.length!==r.length)throw new g$("Input and output ranges must have the same number of values.");e=Math.max(t[0],Math.min(e,t[t.length-1]));let n=d$(e,t),a=(e-t[n])/(t[n+1]-t[n]),o=typeof i=="function"?i(a):BB[i](a);return r[n]+o*(r[n+1]-r[n])}function mR(e){let t=new Image;return e&&(/<svg[\s\S]*>/i.test(e)?t.src="data:image/svg+xml;base64,".concat(btoa(e)):t.src=e),t}function bb(e){return(e*100|0)/100}function gR(e,t=0){let r=3735928559^t,i=1103547991^t;for(let n=0,a;n<e.length;n++)a=e.charCodeAt(n),r=Math.imul(r^a,2654435761),i=Math.imul(i^a,1597334677);return r=Math.imul(r^r>>>16,2246822507)^Math.imul(i^i>>>13,3266489909),i=Math.imul(i^i>>>16,2246822507)^Math.imul(r^r>>>13,3266489909),4294967296*(2097151&i)+(r>>>0)}var AR,Fd,yR,vR,wb,xR,Eb,_R,Cb,S0,Mb,Y,bR,wR,ER,CR,te,I0,ae,It,Ke,B0,MR,p$,ot,SR,IR,D0,Sb,U1,IB,BR,DR,f$,m$,Gy,TR,Yn,kr,Hl,Yy,Hy,PR,kR,yC,FR,vC,RR,$le,Zle,Xle,Ib,LR,Bb,Rd,Db,T0,Tb,Pb,zR,tr,Wy,OR,NR,P0,k0,kb,rr,Fb,Xc,Rb,Ld,xC,cn,Sp,Lb,zd,zb,F0,xc,_c,Od,sr,Ys,Ob,UR,Nb,jR,VR,QR,_C,GR,YR,Ub,g$,FA,HR,jb,WR,$R,BB,ZR,Vb,Qb,XR,JR,Gb,qR,Yb,KR,eL,Hb,tL,Wb,rL,$b,iL,Nd,Sr,bc,R0,va,wc,Qi,Ec,Ko,Cc,Ud,Hs,Wl,ao,oo,so,lo,uo,L0,z0,O0,nL,aL,Zb,N0,Xb,Jb,oL,pl=M(()=>{"use strict";ar(),ar(),AR=Object.create,Fd=Object.defineProperty,yR=Object.getOwnPropertyDescriptor,vR=Object.getOwnPropertyNames,wb=Object.getOwnPropertySymbols,xR=Object.getPrototypeOf,Eb=Object.prototype.hasOwnProperty,_R=Object.prototype.propertyIsEnumerable,Cb=e=>{throw TypeError(e)},S0=(e,t,r)=>t in e?Fd(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Mb=(e,t)=>{for(var r in t||(t={}))Eb.call(t,r)&&S0(e,r,t[r]);if(wb)for(var r of wb(t))_R.call(t,r)&&S0(e,r,t[r]);return e},Y=(e,t)=>Fd(e,"name",{value:t,configurable:!0}),bR=(e,t)=>()=>(e&&(t=e(e=0)),t),wR=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),ER=(e,t,r,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of vR(t))!Eb.call(e,n)&&n!==r&&Fd(e,n,{get:()=>t[n],enumerable:!(i=yR(t,n))||i.enumerable});return e},CR=(e,t,r)=>(r=e!=null?AR(xR(e)):{},ER(t||!e||!e.__esModule?Fd(r,"default",{value:e,enumerable:!0}):r,e)),te=(e,t,r)=>S0(e,typeof t!="symbol"?t+"":t,r),I0=(e,t,r)=>t.has(e)||Cb("Cannot "+r),ae=(e,t,r)=>(I0(e,t,"read from private field"),r?r.call(e):t.get(e)),It=(e,t,r)=>t.has(e)?Cb("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),Ke=(e,t,r,i)=>(I0(e,t,"write to private field"),i?i.call(e,r):t.set(e,r),r),B0=(e,t,r)=>(I0(e,t,"access private method"),r),MR=(e,t,r,i)=>({set _(n){Ke(e,t,n,r)},get _(){return ae(e,t,i)}}),ot=bR(()=>{p$={env:{NODE_ENV:"production",npm_package_version:"0.1.0"}}}),SR=wR((e,t)=>{ot();var r=200,i="__lodash_hash_undefined__",n=800,a=16,o=9007199254740991,s="[object Arguments]",l="[object Array]",u="[object AsyncFunction]",c="[object Boolean]",d="[object Date]",f="[object Error]",m="[object Function]",g="[object GeneratorFunction]",y="[object Map]",_="[object Number]",w="[object Null]",I="[object Object]",k="[object Proxy]",D="[object RegExp]",S="[object Set]",L="[object String]",z="[object Undefined]",N="[object WeakMap]",H="[object ArrayBuffer]",q="[object DataView]",V="[object Float32Array]",Q="[object Float64Array]",$="[object Int8Array]",B="[object Int16Array]",U="[object Int32Array]",X="[object Uint8Array]",ne="[object Uint8ClampedArray]",ce="[object Uint16Array]",xe="[object Uint32Array]",Be=/[\\^$.*+?()[\]{}|]/g,Oe=/^\[object .+?Constructor\]$/,at=/^(?:0|[1-9]\d*)$/,oe={};oe[V]=oe[Q]=oe[$]=oe[B]=oe[U]=oe[X]=oe[ne]=oe[ce]=oe[xe]=!0,oe[s]=oe[l]=oe[H]=oe[c]=oe[q]=oe[d]=oe[f]=oe[m]=oe[y]=oe[_]=oe[I]=oe[D]=oe[S]=oe[L]=oe[N]=!1;var bt=typeof global=="object"&&global&&global.Object===Object&&global,Je=typeof self=="object"&&self&&self.Object===Object&&self,lt=bt||Je||Function("return this")(),Nt=typeof e=="object"&&e&&!e.nodeType&&e,Ne=Nt&&typeof t=="object"&&t&&!t.nodeType&&t,Ze=Ne&&Ne.exports===Nt,Le=Ze&&bt.process,or=(function(){try{var C=Ne&&Ne.require&&Ne.require("util").types;return C||Le&&Le.binding&&Le.binding("util")}catch{}})(),Jt=or&&or.isTypedArray;function Lr(C,R,E){switch(E.length){case 0:return C.call(R);case 1:return C.call(R,E[0]);case 2:return C.call(R,E[0],E[1]);case 3:return C.call(R,E[0],E[1],E[2])}return C.apply(R,E)}Y(Lr,"apply");function Yr(C,R){for(var E=-1,O=Array(C);++E<C;)O[E]=R(E);return O}Y(Yr,"baseTimes");function Fi(C){return function(R){return C(R)}}Y(Fi,"baseUnary");function _n(C,R){return C?.[R]}Y(_n,"getValue");function Br(C,R){return function(E){return C(R(E))}}Y(Br,"overArg");var bn=Array.prototype,wn=Function.prototype,zr=Object.prototype,si=lt["__core-js_shared__"],Hr=wn.toString,yt=zr.hasOwnProperty,li=(function(){var C=/[^.]+$/.exec(si&&si.keys&&si.keys.IE_PROTO||"");return C?"Symbol(src)_1."+C:""})(),qr=zr.toString,Ri=Hr.call(Object),Ga=RegExp("^"+Hr.call(yt).replace(Be,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Or=Ze?lt.Buffer:void 0,en=lt.Symbol,Li=lt.Uint8Array,tn=Or?Or.allocUnsafe:void 0,_i=Br(Object.getPrototypeOf,Object),bi=Object.create,Kr=zr.propertyIsEnumerable,zi=bn.splice,Rt=en?en.toStringTag:void 0,Pr=(function(){try{var C=Qe(Object,"defineProperty");return C({},"",{}),C}catch{}})(),Fo=Or?Or.isBuffer:void 0,wi=Math.max,En=Date.now,Cn=Qe(lt,"Map"),Ht=Qe(Object,"create"),Ro=(function(){function C(){}return Y(C,"object"),function(R){if(!_t(R))return{};if(bi)return bi(R);C.prototype=R;var E=new C;return C.prototype=void 0,E}})();function Lt(C){var R=-1,E=C==null?0:C.length;for(this.clear();++R<E;){var O=C[R];this.set(O[0],O[1])}}Y(Lt,"Hash");function Wt(){this.__data__=Ht?Ht(null):{},this.size=0}Y(Wt,"hashClear");function ui(C){var R=this.has(C)&&delete this.__data__[C];return this.size-=R?1:0,R}Y(ui,"hashDelete");function Ya(C){var R=this.__data__;if(Ht){var E=R[C];return E===i?void 0:E}return yt.call(R,C)?R[C]:void 0}Y(Ya,"hashGet");function oa(C){var R=this.__data__;return Ht?R[C]!==void 0:yt.call(R,C)}Y(oa,"hashHas");function Mn(C,R){var E=this.__data__;return this.size+=this.has(C)?0:1,E[C]=Ht&&R===void 0?i:R,this}Y(Mn,"hashSet"),Lt.prototype.clear=Wt,Lt.prototype.delete=ui,Lt.prototype.get=Ya,Lt.prototype.has=oa,Lt.prototype.set=Mn;function vt(C){var R=-1,E=C==null?0:C.length;for(this.clear();++R<E;){var O=C[R];this.set(O[0],O[1])}}Y(vt,"ListCache");function sa(){this.__data__=[],this.size=0}Y(sa,"listCacheClear");function Ha(C){var R=this.__data__,E=Ut(R,C);if(E<0)return!1;var O=R.length-1;return E==O?R.pop():zi.call(R,E,1),--this.size,!0}Y(Ha,"listCacheDelete");function ci(C){var R=this.__data__,E=Ut(R,C);return E<0?void 0:R[E][1]}Y(ci,"listCacheGet");function Ei(C){return Ut(this.__data__,C)>-1}Y(Ei,"listCacheHas");function la(C,R){var E=this.__data__,O=Ut(E,C);return O<0?(++this.size,E.push([C,R])):E[O][1]=R,this}Y(la,"listCacheSet"),vt.prototype.clear=sa,vt.prototype.delete=Ha,vt.prototype.get=ci,vt.prototype.has=Ei,vt.prototype.set=la;function qt(C){var R=-1,E=C==null?0:C.length;for(this.clear();++R<E;){var O=C[R];this.set(O[0],O[1])}}Y(qt,"MapCache");function Sn(){this.size=0,this.__data__={hash:new Lt,map:new(Cn||vt),string:new Lt}}Y(Sn,"mapCacheClear");function ua(C){var R=Mi(this,C).delete(C);return this.size-=R?1:0,R}Y(ua,"mapCacheDelete");function Wr(C){return Mi(this,C).get(C)}Y(Wr,"mapCacheGet");function ca(C){return Mi(this,C).has(C)}Y(ca,"mapCacheHas");function ha(C,R){var E=Mi(this,C),O=E.size;return E.set(C,R),this.size+=E.size==O?0:1,this}Y(ha,"mapCacheSet"),qt.prototype.clear=Sn,qt.prototype.delete=ua,qt.prototype.get=Wr,qt.prototype.has=ca,qt.prototype.set=ha;function Kt(C){var R=this.__data__=new vt(C);this.size=R.size}Y(Kt,"Stack");function da(){this.__data__=new vt,this.size=0}Y(da,"stackClear");function Wa(C){var R=this.__data__,E=R.delete(C);return this.size=R.size,E}Y(Wa,"stackDelete");function W(C){return this.__data__.get(C)}Y(W,"stackGet");function _e(C){return this.__data__.has(C)}Y(_e,"stackHas");function Ae(C,R){var E=this.__data__;if(E instanceof vt){var O=E.__data__;if(!Cn||O.length<r-1)return O.push([C,R]),this.size=++E.size,this;E=this.__data__=new qt(O)}return E.set(C,R),this.size=E.size,this}Y(Ae,"stackSet"),Kt.prototype.clear=da,Kt.prototype.delete=Wa,Kt.prototype.get=W,Kt.prototype.has=_e,Kt.prototype.set=Ae;function dt(C,R){var E=Se(C),O=!E&&le(C),Z=!E&&!O&&De(C),se=!E&&!O&&!Z&&Oo(C),ve=E||O||Z||se,de=ve?Yr(C.length,String):[],Ce=de.length;for(var Pe in C)(R||yt.call(C,Pe))&&!(ve&&(Pe=="length"||Z&&(Pe=="offset"||Pe=="parent")||se&&(Pe=="buffer"||Pe=="byteLength"||Pe=="byteOffset")||$a(Pe,Ce)))&&de.push(Pe);return de}Y(dt,"arrayLikeKeys");function Mt(C,R,E){(E!==void 0&&!ee(C[R],E)||E===void 0&&!(R in C))&&er(C,R,E)}Y(Mt,"assignMergeValue");function xt(C,R,E){var O=C[R];(!(yt.call(C,R)&&ee(O,E))||E===void 0&&!(R in C))&&er(C,R,E)}Y(xt,"assignValue");function Ut(C,R){for(var E=C.length;E--;)if(ee(C[E][0],R))return E;return-1}Y(Ut,"assocIndexOf");function er(C,R,E){R=="__proto__"&&Pr?Pr(C,R,{configurable:!0,enumerable:!0,value:E,writable:!0}):C[R]=E}Y(er,"baseAssignValue");var $r=Bs();function Dr(C){return C==null?C===void 0?z:w:Rt&&Rt in Object(C)?rn(C):v(C)}Y(Dr,"baseGetTag");function jt(C){return wt(C)&&Dr(C)==s}Y(jt,"baseIsArguments");function pa(C){if(!_t(C)||h(C))return!1;var R=He(C)?Ga:Oe;return R.test(J(C))}Y(pa,"baseIsNative");function Ci(C){return wt(C)&&St(C.length)&&!!oe[Dr(C)]}Y(Ci,"baseIsTypedArray");function bs(C){if(!_t(C))return A(C);var R=p(C),E=[];for(var O in C)O=="constructor"&&(R||!yt.call(C,O))||E.push(O);return E}Y(bs,"baseKeysIn");function In(C,R,E,O,Z){C!==R&&$r(R,function(se,ve){if(Z||(Z=new Kt),_t(se))ws(C,R,ve,E,In,O,Z);else{var de=O?O(T(C,ve),se,ve+"",C,R,Z):void 0;de===void 0&&(de=se),Mt(C,ve,de)}},Ps)}Y(In,"baseMerge");function ws(C,R,E,O,Z,se,ve){var de=T(C,E),Ce=T(R,E),Pe=ve.get(Ce);if(Pe){Mt(C,E,Pe);return}var Ge=se?se(de,Ce,E+"",C,R,ve):void 0,fr=Ge===void 0;if(fr){var Tr=Se(Ce),nn=!Tr&&De(Ce),No=!Tr&&!nn&&Oo(Ce);Ge=Ce,Tr||nn||No?Se(de)?Ge=de:Te(de)?Ge=Ss(de):nn?(fr=!1,Ge=Es(Ce,!0)):No?(fr=!1,Ge=Ms(Ce,!0)):Ge=[]:Bn(Ce)||le(Ce)?(Ge=de,le(de)?Ge=Oi(de):(!_t(de)||He(de))&&(Ge=Ds(Ce))):fr=!1}fr&&(ve.set(Ce,Ge),Z(Ge,Ce,O,se,ve),ve.delete(Ce)),Mt(C,E,Ge)}Y(ws,"baseMergeDeep");function Lo(C,R){return F(b(C,R,ks),C+"")}Y(Lo,"baseRest");var Cl=Pr?function(C,R){return Pr(C,"toString",{configurable:!0,enumerable:!1,value:Ml(R),writable:!0})}:ks;function Es(C,R){if(R)return C.slice();var E=C.length,O=tn?tn(E):new C.constructor(E);return C.copy(O),O}Y(Es,"cloneBuffer");function Cs(C){var R=new C.constructor(C.byteLength);return new Li(R).set(new Li(C)),R}Y(Cs,"cloneArrayBuffer");function Ms(C,R){var E=R?Cs(C.buffer):C.buffer;return new C.constructor(E,C.byteOffset,C.length)}Y(Ms,"cloneTypedArray");function Ss(C,R){var E=-1,O=C.length;for(R||(R=Array(O));++E<O;)R[E]=C[E];return R}Y(Ss,"copyArray");function Mr(C,R,E,O){var Z=!E;E||(E={});for(var se=-1,ve=R.length;++se<ve;){var de=R[se],Ce=O?O(E[de],C[de],de,E,C):void 0;Ce===void 0&&(Ce=C[de]),Z?er(E,de,Ce):xt(E,de,Ce)}return E}Y(Mr,"copyObject");function Is(C){return Lo(function(R,E){var O=-1,Z=E.length,se=Z>1?E[Z-1]:void 0,ve=Z>2?E[2]:void 0;for(se=C.length>3&&typeof se=="function"?(Z--,se):void 0,ve&&zo(E[0],E[1],ve)&&(se=Z<3?void 0:se,Z=1),R=Object(R);++O<Z;){var de=E[O];de&&C(R,de,O,se)}return R})}Y(Is,"createAssigner");function Bs(C){return function(R,E,O){for(var Z=-1,se=Object(R),ve=O(R),de=ve.length;de--;){var Ce=ve[C?de:++Z];if(E(se[Ce],Ce,se)===!1)break}return R}}Y(Bs,"createBaseFor");function Mi(C,R){var E=C.__data__;return Ts(R)?E[typeof R=="string"?"string":"hash"]:E.map}Y(Mi,"getMapData");function Qe(C,R){var E=_n(C,R);return pa(E)?E:void 0}Y(Qe,"getNative");function rn(C){var R=yt.call(C,Rt),E=C[Rt];try{C[Rt]=void 0;var O=!0}catch{}var Z=qr.call(C);return O&&(R?C[Rt]=E:delete C[Rt]),Z}Y(rn,"getRawTag");function Ds(C){return typeof C.constructor=="function"&&!p(C)?Ro(_i(C)):{}}Y(Ds,"initCloneObject");function $a(C,R){var E=typeof C;return R=R??o,!!R&&(E=="number"||E!="symbol"&&at.test(C))&&C>-1&&C%1==0&&C<R}Y($a,"isIndex");function zo(C,R,E){if(!_t(E))return!1;var O=typeof R;return(O=="number"?he(E)&&$a(R,E.length):O=="string"&&R in E)?ee(E[R],C):!1}Y(zo,"isIterateeCall");function Ts(C){var R=typeof C;return R=="string"||R=="number"||R=="symbol"||R=="boolean"?C!=="__proto__":C===null}Y(Ts,"isKeyable");function h(C){return!!li&&li in C}Y(h,"isMasked");function p(C){var R=C&&C.constructor,E=typeof R=="function"&&R.prototype||zr;return C===E}Y(p,"isPrototype");function A(C){var R=[];if(C!=null)for(var E in Object(C))R.push(E);return R}Y(A,"nativeKeysIn");function v(C){return qr.call(C)}Y(v,"objectToString");function b(C,R,E){return R=wi(R===void 0?C.length-1:R,0),function(){for(var O=arguments,Z=-1,se=wi(O.length-R,0),ve=Array(se);++Z<se;)ve[Z]=O[R+Z];Z=-1;for(var de=Array(R+1);++Z<R;)de[Z]=O[Z];return de[R]=E(ve),Lr(C,this,de)}}Y(b,"overRest");function T(C,R){if(!(R==="constructor"&&typeof C[R]=="function")&&R!="__proto__")return C[R]}Y(T,"safeGet");var F=G(Cl);function G(C){var R=0,E=0;return function(){var O=En(),Z=a-(O-E);if(E=O,Z>0){if(++R>=n)return arguments[0]}else R=0;return C.apply(void 0,arguments)}}Y(G,"shortOut");function J(C){if(C!=null){try{return Hr.call(C)}catch{}try{return C+""}catch{}}return""}Y(J,"toSource");function ee(C,R){return C===R||C!==C&&R!==R}Y(ee,"eq");var le=jt((function(){return arguments})())?jt:function(C){return wt(C)&&yt.call(C,"callee")&&!Kr.call(C,"callee")},Se=Array.isArray;function he(C){return C!=null&&St(C.length)&&!He(C)}Y(he,"isArrayLike");function Te(C){return wt(C)&&he(C)}Y(Te,"isArrayLikeObject");var De=Fo||zu;function He(C){if(!_t(C))return!1;var R=Dr(C);return R==m||R==g||R==u||R==k}Y(He,"isFunction");function St(C){return typeof C=="number"&&C>-1&&C%1==0&&C<=o}Y(St,"isLength");function _t(C){var R=typeof C;return C!=null&&(R=="object"||R=="function")}Y(_t,"isObject");function wt(C){return C!=null&&typeof C=="object"}Y(wt,"isObjectLike");function Bn(C){if(!wt(C)||Dr(C)!=I)return!1;var R=_i(C);if(R===null)return!0;var E=yt.call(R,"constructor")&&R.constructor;return typeof E=="function"&&E instanceof E&&Hr.call(E)==Ri}Y(Bn,"isPlainObject");var Oo=Jt?Fi(Jt):Ci;function Oi(C){return Mr(C,Ps(C))}Y(Oi,"toPlainObject");function Ps(C){return he(C)?dt(C,!0):bs(C)}Y(Ps,"keysIn");var Kh=Is(function(C,R,E){In(C,R,E)});function Ml(C){return function(){return C}}Y(Ml,"constant");function ks(C){return C}Y(ks,"identity");function zu(){return!1}Y(zu,"stubFalse"),t.exports=Kh}),ot(),ot(),IR=class{constructor(e,t,r=0,i){te(this,"id"),te(this,"type"),te(this,"component"),te(this,"worldPosition"),te(this,"verticalOffset"),te(this,"disposed",!1),te(this,"positionDirty",!0),te(this,"parentId"),this.id=e.id,this.component=e,this.type=e.type,this.worldPosition={x:t.x,y:t.y,z:t.z+r},this.verticalOffset=r,this.parentId=i}updatePosition(e,t,r){this.worldPosition.x=e,this.worldPosition.y=t,this.worldPosition.z=r,this.positionDirty=!0}setAltitude(e){this.worldPosition.z=e,this.positionDirty=!0}},Y(IR,"Entity2D"),ot(),ot(),ot(),D0=[0,4,6,8,10],Sb=Y(()=>{let e=new Array(16).fill(0),t=Math.random()*4294967296;for(let i=0;i<e.length;i++)i>0&&(i&3)===0&&(t=Math.random()*4294967296),e[i]=t>>>((i&3)<<3)&255;let r=e.map(i=>i.toString(16).padStart(2,"0"));return r[6]="4"+r[6][1],r[8]=["8","9","a","b"].includes(r[7][0])?r[7]:"a"+r[7][1],D0.map((i,n)=>r.slice(i,n===D0.length-1?void 0:D0[n+1]).join("")).join("-")},"randomId"),ot(),ot(),U1=P.union([P.enum(["low","medium","high","always-visible"]),P.number()]),IB=["","","low","medium","high","always-visible"],Y(MB,"clampTierNumber"),Y(gb,"convertCollisionRankingTierToNumber"),Y(Wle,"convertNumberToCollisionRankingTier"),ot(),BR=(e=>(e[e.ACTIVE=1]="ACTIVE",e[e.INACTIVE=.5]="INACTIVE",e[e.HIDDEN=0]="HIDDEN",e))(BR||{}),DR=(e=>(e.LEFT="left",e.CENTER="center",e.RIGHT="right",e))(DR||{}),ot(),ot(),Y(Yf,"_typeof"),f$=/^\s+/,m$=/\s+$/,Y(ke,"tinycolor"),ke.prototype={isDark:Y(function(){return this.getBrightness()<128},"isDark"),isLight:Y(function(){return!this.isDark()},"isLight"),isValid:Y(function(){return this._ok},"isValid"),getOriginalInput:Y(function(){return this._originalInput},"getOriginalInput"),getFormat:Y(function(){return this._format},"getFormat"),getAlpha:Y(function(){return this._a},"getAlpha"),getBrightness:Y(function(){var e=this.toRgb();return(e.r*299+e.g*587+e.b*114)/1e3},"getBrightness"),getLuminance:Y(function(){var e=this.toRgb(),t,r,i,n,a,o;return t=e.r/255,r=e.g/255,i=e.b/255,t<=.03928?n=t/12.92:n=Math.pow((t+.055)/1.055,2.4),r<=.03928?a=r/12.92:a=Math.pow((r+.055)/1.055,2.4),i<=.03928?o=i/12.92:o=Math.pow((i+.055)/1.055,2.4),.2126*n+.7152*a+.0722*o},"getLuminance"),setAlpha:Y(function(e){return this._a=gC(e),this._roundA=Math.round(100*this._a)/100,this},"setAlpha"),toHsv:Y(function(){var e=yb(this._r,this._g,this._b);return{h:e.h*360,s:e.s,v:e.v,a:this._a}},"toHsv"),toHsvString:Y(function(){var e=yb(this._r,this._g,this._b),t=Math.round(e.h*360),r=Math.round(e.s*100),i=Math.round(e.v*100);return this._a==1?"hsv("+t+", "+r+"%, "+i+"%)":"hsva("+t+", "+r+"%, "+i+"%, "+this._roundA+")"},"toHsvString"),toHsl:Y(function(){var e=Ab(this._r,this._g,this._b);return{h:e.h*360,s:e.s,l:e.l,a:this._a}},"toHsl"),toHslString:Y(function(){var e=Ab(this._r,this._g,this._b),t=Math.round(e.h*360),r=Math.round(e.s*100),i=Math.round(e.l*100);return this._a==1?"hsl("+t+", "+r+"%, "+i+"%)":"hsla("+t+", "+r+"%, "+i+"%, "+this._roundA+")"},"toHslString"),toHex:Y(function(e){return vb(this._r,this._g,this._b,e)},"toHex"),toHexString:Y(function(e){return"#"+this.toHex(e)},"toHexString"),toHex8:Y(function(e){return HF(this._r,this._g,this._b,this._a,e)},"toHex8"),toHex8String:Y(function(e){return"#"+this.toHex8(e)},"toHex8String"),toRgb:Y(function(){return{r:Math.round(this._r),g:Math.round(this._g),b:Math.round(this._b),a:this._a}},"toRgb"),toRgbString:Y(function(){return this._a==1?"rgb("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+")":"rgba("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+", "+this._roundA+")"},"toRgbString"),toPercentageRgb:Y(function(){return{r:Math.round(pr(this._r,255)*100)+"%",g:Math.round(pr(this._g,255)*100)+"%",b:Math.round(pr(this._b,255)*100)+"%",a:this._a}},"toPercentageRgb"),toPercentageRgbString:Y(function(){return this._a==1?"rgb("+Math.round(pr(this._r,255)*100)+"%, "+Math.round(pr(this._g,255)*100)+"%, "+Math.round(pr(this._b,255)*100)+"%)":"rgba("+Math.round(pr(this._r,255)*100)+"%, "+Math.round(pr(this._g,255)*100)+"%, "+Math.round(pr(this._b,255)*100)+"%, "+this._roundA+")"},"toPercentageRgbString"),toName:Y(function(){return this._a===0?"transparent":this._a<1?!1:TR[vb(this._r,this._g,this._b,!0)]||!1},"toName"),toFilter:Y(function(e){var t="#"+xb(this._r,this._g,this._b,this._a),r=t,i=this._gradientType?"GradientType = 1, ":"";if(e){var n=ke(e);r="#"+xb(n._r,n._g,n._b,n._a)}return"progid:DXImageTransform.Microsoft.gradient("+i+"startColorstr="+t+",endColorstr="+r+")"},"toFilter"),toString:Y(function(e){var t=!!e;e=e||this._format;var r=!1,i=this._a<1&&this._a>=0,n=!t&&i&&(e==="hex"||e==="hex6"||e==="hex3"||e==="hex4"||e==="hex8"||e==="name");return n?e==="name"&&this._a===0?this.toName():this.toRgbString():(e==="rgb"&&(r=this.toRgbString()),e==="prgb"&&(r=this.toPercentageRgbString()),(e==="hex"||e==="hex6")&&(r=this.toHexString()),e==="hex3"&&(r=this.toHexString(!0)),e==="hex4"&&(r=this.toHex8String(!0)),e==="hex8"&&(r=this.toHex8String()),e==="name"&&(r=this.toName()),e==="hsl"&&(r=this.toHslString()),e==="hsv"&&(r=this.toHsvString()),r||this.toHexString())},"toString"),clone:Y(function(){return ke(this.toString())},"clone"),_applyModification:Y(function(e,t){var r=e.apply(null,[this].concat([].slice.call(t)));return this._r=r._r,this._g=r._g,this._b=r._b,this.setAlpha(r._a),this},"_applyModification"),lighten:Y(function(){return this._applyModification(XF,arguments)},"lighten"),brighten:Y(function(){return this._applyModification(JF,arguments)},"brighten"),darken:Y(function(){return this._applyModification(qF,arguments)},"darken"),desaturate:Y(function(){return this._applyModification(WF,arguments)},"desaturate"),saturate:Y(function(){return this._applyModification($F,arguments)},"saturate"),greyscale:Y(function(){return this._applyModification(ZF,arguments)},"greyscale"),spin:Y(function(){return this._applyModification(KF,arguments)},"spin"),_applyCombination:Y(function(e,t){return e.apply(null,[this].concat([].slice.call(t)))},"_applyCombination"),analogous:Y(function(){return this._applyCombination(rR,arguments)},"analogous"),complement:Y(function(){return this._applyCombination(eR,arguments)},"complement"),monochromatic:Y(function(){return this._applyCombination(iR,arguments)},"monochromatic"),splitcomplement:Y(function(){return this._applyCombination(tR,arguments)},"splitcomplement"),triad:Y(function(){return this._applyCombination(_b,[3])},"triad"),tetrad:Y(function(){return this._applyCombination(_b,[4])},"tetrad")},ke.fromRatio=function(e,t){if(Yf(e)=="object"){var r={};for(var i in e)e.hasOwnProperty(i)&&(i==="a"?r[i]=e[i]:r[i]=mh(e[i]));e=r}return ke(e,t)},Y(n$,"inputToRGB"),Y(a$,"rgbToRgb"),Y(Ab,"rgbToHsl"),Y(o$,"hslToRgb"),Y(yb,"rgbToHsv"),Y(s$,"hsvToRgb"),Y(vb,"rgbToHex"),Y(HF,"rgbaToHex"),Y(xb,"rgbaToArgbHex"),ke.equals=function(e,t){return!e||!t?!1:ke(e).toRgbString()==ke(t).toRgbString()},ke.random=function(){return ke.fromRatio({r:Math.random(),g:Math.random(),b:Math.random()})},Y(WF,"_desaturate"),Y($F,"_saturate"),Y(ZF,"_greyscale"),Y(XF,"_lighten"),Y(JF,"_brighten"),Y(qF,"_darken"),Y(KF,"_spin"),Y(eR,"_complement"),Y(_b,"polyad"),Y(tR,"_splitcomplement"),Y(rR,"_analogous"),Y(iR,"_monochromatic"),ke.mix=function(e,t,r){r=r===0?0:r||50;var i=ke(e).toRgb(),n=ke(t).toRgb(),a=r/100,o={r:(n.r-i.r)*a+i.r,g:(n.g-i.g)*a+i.g,b:(n.b-i.b)*a+i.b,a:(n.a-i.a)*a+i.a};return ke(o)},ke.readability=function(e,t){var r=ke(e),i=ke(t);return(Math.max(r.getLuminance(),i.getLuminance())+.05)/(Math.min(r.getLuminance(),i.getLuminance())+.05)},ke.isReadable=function(e,t,r){var i=ke.readability(e,t),n,a;switch(a=!1,n=aR(r),n.level+n.size){case"AAsmall":case"AAAlarge":a=i>=4.5;break;case"AAlarge":a=i>=3;break;case"AAAsmall":a=i>=7;break}return a},ke.mostReadable=function(e,t,r){var i=null,n=0,a,o,s,l;r=r||{},o=r.includeFallbackColors,s=r.level,l=r.size;for(var u=0;u<t.length;u++)a=ke.readability(e,t[u]),a>n&&(n=a,i=ke(t[u]));return ke.isReadable(e,i,{level:s,size:l})||!o?i:(r.includeFallbackColors=!1,ke.mostReadable(e,["#fff","#000"],r))},Gy=ke.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},TR=ke.hexNames=nR(Gy),Y(nR,"flip"),Y(gC,"boundAlpha"),Y(pr,"bound01"),Y(Am,"clamp01"),Y(Xi,"parseIntFromHex"),Y(l$,"isOnePointZero"),Y(u$,"isPercentage"),Y(ea,"pad2"),Y(mh,"convertToPercentage"),Y(SB,"convertDecimalToHex"),Y(AC,"convertHexToDecimal"),Yn=(function(){var e="[-\\+]?\\d+%?",t="[-\\+]?\\d*\\.\\d+%?",r="(?:"+t+")|(?:"+e+")",i="[\\s|\\(]+("+r+")[,|\\s]+("+r+")[,|\\s]+("+r+")\\s*\\)?",n="[\\s|\\(]+("+r+")[,|\\s]+("+r+")[,|\\s]+("+r+")[,|\\s]+("+r+")\\s*\\)?";return{CSS_UNIT:new RegExp(r),rgb:new RegExp("rgb"+i),rgba:new RegExp("rgba"+n),hsl:new RegExp("hsl"+i),hsla:new RegExp("hsla"+n),hsv:new RegExp("hsv"+i),hsva:new RegExp("hsva"+n),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/}})(),Y(xo,"isValidCSSUnit"),Y(c$,"stringInputToObject"),Y(aR,"validateWCAG2Parms"),kr={RIGHT:"right",LEFT:"left",TOP:"top",HIDDEN:"hidden",CENTER:"center"},Hl="low-priority",Yy=Object.values(kr),Hy=[kr.RIGHT,kr.LEFT,kr.TOP,kr.HIDDEN],PR=P.string(),kR=P.object({on:P.literal("zoom-level"),input:P.tuple([P.number()]).rest(P.number()),output:P.tuple([P.number()]).rest(P.number()),easing:PR.default("linear")}).refine(e=>e.input.length===e.output.length,{message:"input and output must have the same length"}),yC=P.object({margin:P.number().min(6).default(6),maxLines:P.number().min(1).default(2),textSize:P.number().min(0).default(11.5),maxWidth:P.number().min(0).default(150),lineHeight:P.number().min(0).default(1.2),color:P.string().default("#333"),outlineColor:P.string().default("white"),textColor:P.string().optional(),textOutlineColor:P.string().optional(),pinColor:P.string().optional(),pinOutlineColor:P.string().optional(),pinColorInactive:P.string().optional(),pinOutlineColorInactive:P.string().optional(),icon:P.string().optional(),iconSize:P.number().min(0).default(20),iconScale:P.union([P.number(),kR]).default(1),iconPadding:P.number().min(0).default(2),iconFit:P.enum(["fill","contain","cover"]).default("cover"),iconOverflow:P.enum(["visible","hidden"]).default("hidden"),iconVisible:P.union([P.boolean(),P.number()]).default(!0),opacity:P.number().min(0).max(1).default(1)}),FR=Y(e=>{var t,r;let i=Mb({},e);i.color!=null&&(i.textColor==null&&(i.textColor=i.color),i.pinColor==null&&(i.pinColor=i.color)),i.outlineColor!=null&&(i.textOutlineColor==null&&(i.textOutlineColor=i.outlineColor),i.pinOutlineColor==null&&(i.pinOutlineColor=i.outlineColor));let n=(t=i.pinColor)!=null?t:i.color,a=(r=i.pinOutlineColor)!=null?r:i.outlineColor;return n!=null&&i.pinColorInactive==null&&(i.pinColorInactive=ke(n).toRgbString()),a!=null&&i.pinOutlineColorInactive==null&&(i.pinOutlineColorInactive=ke(a).toRgbString()),i},"applyLabelAppearanceShorthands"),vC=yC.transform(e=>FR(e)),RR=Y(e=>vC.parse(e),"parseLabelAppearance"),$le=Y((e,t)=>["color","outlineColor","maxLines","lineHeight","textSize","maxWidth","textColor","textOutlineColor"].some(r=>t[r]!=null&&e[r]!==t[r]),"isOneOfTextDirtyOptions"),Zle=Y((e,t)=>["color","outlineColor","icon","iconSize","iconScale","iconVisible","iconPadding","pinColor","pinOutlineColor","pinColorInactive","pinOutlineColorInactive"].some(r=>t[r]!=null&&e[r]!==t[r]),"isOneOfPinDirtyOptions"),Xle=Y((e,t)=>{var r,i;return t.textPlacement!=null&&e.textPlacement!==t.textPlacement||((r=t.appearance)==null?void 0:r.margin)!=null&&((i=e.appearance)==null?void 0:i.margin)!==t.appearance.margin},"isOneOfColliderDirtyOptions"),Ib=4,LR=6,Bb=6.5,Rd=Bb/2,Db=[Rd,Rd,Rd,Rd],T0=class bC{constructor(t,r,i){te(this,"lines",0),te(this,"id"),te(this,"rank"),te(this,"type","label"),te(this,"initialRank"),te(this,"contextConfigured",!1),te(this,"fillText"),te(this,"newStyle",{}),te(this,"currentOpacity",0),te(this,"visibilityNeedsUpdate",!1),te(this,"activePlacement",kr.RIGHT),te(this,"text"),te(this,"style",{top:0,left:0,textLabelVisible:!0,pinVisibility:1,textAlign:"left"}),te(this,"projection",{x:0,y:0}),te(this,"labelCacheId"),te(this,"_cache",{}),te(this,"appearance"),te(this,"options"),te(this,"visible",!0),te(this,"enabled",!0),te(this,"interactive",!1),te(this,"isOccluded",!1),te(this,"offscreen",!1),te(this,"canShow",!1),te(this,"activeBoundingBox",{x:0,y:0,w:0,h:0}),te(this,"dimensions",{width:0,height:0}),te(this,"currentStrategyIndex",-1),te(this,"totalPinSize",0),te(this,"iconScale",1),te(this,"iconPadding"),te(this,"dirty",!0),te(this,"textDirty",!0),te(this,"pinDirty",!0),te(this,"attachedDirty",!0),te(this,"collisionDirty",!0),te(this,"lastTextAlign"),te(this,"imageHash"),te(this,"pinSize",0),te(this,"iconVisible",!1),te(this,"dp"),te(this,"_cachedStrategies",null),te(this,"animate",!0),te(this,"onStrategySelected",Y(l=>{var u;if(this.currentStrategyIndex===l)return;this.currentStrategyIndex=l;let c=this.strategies[l];if(this.activePlacement=(u=c?.name)!=null?u:this.activePlacement,c){c.onStrategySelected();let d=this.style;this.style=this.newStyle,this.newStyle=d}},"onStrategySelected")),te(this,"packedMessage",{x:0,y:0,enabled:!1,rank:0,bboxes:[],shouldCollideWithScreenEdges:!1,lockedToStrategyIndex:-1});var n,a,o;if(this.id=(n=r.id)!=null?n:Sb(),this.options=r??{},this.text=t,this.dp=(l=1)=>l*i,typeof r.rank=="string")this.rank=gb(r.rank),this.initialRank=this.rank;else if(r.rank!=null&&r.rank>0)this.rank=r.rank,this.initialRank=r.rank;else{let l=Math.trunc(bC.testId*10)/10;bC.testId+=.001,this.rank=l,this.initialRank=l}this.options.textPlacement=(a=r.textPlacement)!=null?a:Hy;let s=RR((o=r.appearance)!=null?o:{});this.appearance=s,this.iconPadding=s.iconPadding}get scaledPinSize(){return this.totalPinSize*this.iconScale}get scaledIconPadding(){return this.appearance.iconPadding*this.iconScale}get textVisible(){return this.offscreen||!this.visible||!this.canShow||!this.enabled?!1:this.style.textLabelVisible===!0&&this.style.textAlign!=null&&this.style.left!=null&&this.style.top!=null}calculatePinSize(){let t=this.dp();this.iconVisible&&typeof this.appearance.iconSize<"u"&&this.imageHash?this.pinSize=this.dp(this.appearance.iconSize):this.pinSize=this.dp(Bb),this.totalPinSize=Math.ceil((this.pinSize+2.5)/t)}getNoTextBbox(t){let r=this.scaledPinSize/2+t;return[r,r,r,r]}getHiddenTextPlacementBbox(t){return this.iconVisible?this.getNoTextBbox(t):Db}getBoundingBoxForPlacement(t){let{width:r,height:i}=this.dimensions,{margin:n}=this.appearance,a=Math.max(LR,n);if(this.text==="")return this.getNoTextBbox(a);let o=Math.max(this.scaledPinSize,i);switch(t){case kr.RIGHT:return[o/2+a,o/2+a,this.scaledPinSize/2+a,this.scaledPinSize/2+r+a];case kr.LEFT:return[o/2+a,o/2+a,this.scaledPinSize/2+r+a,this.scaledPinSize/2+a];case kr.TOP:{let s=this.dp();return[i+this.scaledPinSize/2/s+a,this.scaledPinSize/2+a,r/2+a,r/2+a]}case kr.CENTER:return[i/2+a,i/2+a,r/2+a,r/2+a];case kr.HIDDEN:return this.getHiddenTextPlacementBbox(a);case Hl:return Db;default:return this.getNoTextBbox(a)}}getStrategyStyleForPlacement(t){let{width:r,height:i}=this.dimensions;switch(t){case kr.TOP:this.newStyle.pinVisibility=1,this.newStyle.textAlign="center",this.newStyle.textLabelVisible=!0,this.newStyle.top=-i-this.scaledPinSize/2,this.newStyle.left=-r/2;return;case kr.LEFT:this.newStyle.textAlign="right",this.newStyle.pinVisibility=1,this.newStyle.top=-i/2,this.newStyle.left=-r-this.scaledPinSize/2-Ib,this.newStyle.textLabelVisible=!0;return;case kr.RIGHT:this.newStyle.textAlign="left",this.newStyle.pinVisibility=1,this.newStyle.top=-i/2,this.newStyle.left=this.scaledPinSize/2+Ib,this.newStyle.textLabelVisible=!0;return;case kr.CENTER:this.newStyle.pinVisibility=0,this.newStyle.textAlign="center",this.newStyle.textLabelVisible=!0,this.newStyle.top=-i/2,this.newStyle.left=-r/2;return;case kr.HIDDEN:this.newStyle.pinVisibility=this.iconVisible?1:.5,this.newStyle.textLabelVisible=!1,this.newStyle.top=0,this.newStyle.left=0;return;case Hl:default:this.newStyle.pinVisibility=.5,this.newStyle.textLabelVisible=!1,this.newStyle.top=0,this.newStyle.left=0;return}}invalidateStrategies(){this._cachedStrategies=null}get strategies(){if(this._cachedStrategies)return this._cachedStrategies;let t=Array.isArray(this.options.textPlacement)?this.options.textPlacement:[this.options.textPlacement],r=[],i=!1;for(let n of t)this.options.rank==="always-visible"&&n===kr.HIDDEN&&t.length>1||(r.push({name:n,getBoundingBox:Y(()=>this.getBoundingBoxForPlacement(n),"getBoundingBox"),onStrategySelected:Y(()=>this.getStrategyStyleForPlacement(n),"onStrategySelected")}),n===kr.HIDDEN&&(i=!0));return i&&r.push({name:Hl,getBoundingBox:Y(()=>this.getBoundingBoxForPlacement(Hl),"getBoundingBox"),onStrategySelected:Y(()=>this.getStrategyStyleForPlacement(Hl),"onStrategySelected")}),this._cachedStrategies=r,r}recomputeCurrentStrategy(t=this.iconScale){let r=this.iconScale!==t;if(r||this.dirty){let i=this.pinDirty,n=this.strategies[this.currentStrategyIndex];if(this.iconScale=t,this.collisionDirty=!0,r&&!i&&this.calculatePinSize(),n){n.onStrategySelected();let a=this.style;this.style=this.newStyle,this.newStyle=a}this.dirty=!1}}toPackedMessage(t=!1){var r;let i=this.strategies[this.currentStrategyIndex],n=this.currentStrategyIndex!=null&&this.currentStrategyIndex!==-1&&this.text!==""&&i!=null&&i.name!==kr.HIDDEN&&i.name!==Hl;if(this.visible&&t&&this.collisionDirty===!1&&n?this.packedMessage.lockedToStrategyIndex=this.currentStrategyIndex:this.packedMessage.lockedToStrategyIndex=-1,this.packedMessage.x=this.projection.x,this.packedMessage.y=this.projection.y,this.packedMessage.enabled=this.enabled,this.packedMessage.rank=this.rank,n&&this.currentStrategyIndex!==((r=this.packedMessage.bboxes[0])==null?void 0:r[4])){let l=this.packedMessage.bboxes;for(let u=1;u<l.length;u++)if(l[u][4]===this.currentStrategyIndex){let c=l[0];l[0]=l[u],l[u]=c;break}}if(!this.collisionDirty)return this.packedMessage;let a=[],o=this.strategies,s=-1;for(let l=0;l<o.length;l++){let u=o[l].getBoundingBox();a.push([u[0],u[1],u[2],u[3],l]),n&&l===this.currentStrategyIndex&&(s=a.length-1)}if(s>0){let l=a[0];a[0]=a[s],a[s]=l}return this.packedMessage.bboxes=a,this.packedMessage.shouldCollideWithScreenEdges=!1,this.collisionDirty=!1,this.packedMessage}destroy(){}},Y(T0,"LabelComponent"),te(T0,"testId",0),Tb=T0,Pb=Tb,ot(),zR=CR(SR()),ot(),tr={TOP:"top",BOTTOM:"bottom",LEFT:"left",RIGHT:"right",CENTER:"center",TOP_LEFT:"top-left",TOP_RIGHT:"top-right",BOTTOM_LEFT:"bottom-left",BOTTOM_RIGHT:"bottom-right",HIDDEN:"hidden"},Wy=Object.values(tr),OR=[tr.CENTER,tr.HIDDEN],NR=Object.freeze({size:8,color:"#666"}),P0=class wC{constructor(t,r={}){te(this,"id"),te(this,"type","marker"),te(this,"rank",0),te(this,"initialRank",0),te(this,"activePlacement","center"),te(this,"pointerEvents","none"),te(this,"options",{rank:"low",interactive:!1,id:"",placement:OR,dynamicResize:!1,occlude:!0,occluderId:0,zIndex:void 0,verticalOffset:0,lowPriorityPin:Mb({},NR)}),te(this,"projection",{x:0,y:0}),te(this,"enabled",!0),te(this,"interactive",!1),te(this,"canShow",!1),te(this,"visible",!0),te(this,"isOccluded",!1),te(this,"offscreen",!1),te(this,"strategyIndex",-1),te(this,"activeBoundingBox",{x:0,y:0,w:0,h:0}),te(this,"dimensions",{width:0,height:0}),te(this,"markerContainer"),te(this,"containerEl"),te(this,"contentEl",null),te(this,"contentHtml",""),te(this,"style",{top:"0px",left:"0px"}),te(this,"dirty",!1),te(this,"attachedDirty",!0),te(this,"collisionDirty",!0),te(this,"visibilityNeedsUpdate","show"),te(this,"animation",null),te(this,"currentStrategyIndex",-1),te(this,"onStrategySelected",Y((s,l=!1)=>{var u;if(this.currentStrategyIndex===s&&!l)return;this.currentStrategyIndex=s;let c=this.strategies[s];if(this.activePlacement=(u=c?.name)!=null?u:"center",this.activePlacement===tr.HIDDEN){this.markerContainer.setAttribute("data-placement",tr.HIDDEN);let d=this.options.lowPriorityPin,f=d.size,m=d.color;this.markerContainer.style.setProperty("--mappedin-pin-size","".concat(f,"px")),this.markerContainer.style.setProperty("--pin-color",m),this.markerContainer.style.opacity="0.6",this.style.top=-f/2+"px",this.style.left=-f/2+"px"}else{this.markerContainer.setAttribute("data-placement",this.activePlacement),this.markerContainer.style.removeProperty("--mappedin-pin-size"),this.markerContainer.style.removeProperty("--pin-color"),this.markerContainer.style.opacity="1";let{width:d,height:f}=this.dimensions,m=-f/2+"px",g=-d/2+"px";switch(this.style.top=m,this.style.left=g,this.activePlacement){case tr.TOP:this.style.top=-f+"px";break;case tr.BOTTOM:this.style.top="0px";break;case tr.LEFT:this.style.left=-d+"px";break;case tr.RIGHT:this.style.left="0px";break;case tr.TOP_LEFT:this.style.top=-f+"px",this.style.left=-d+"px";break;case tr.TOP_RIGHT:this.style.top=-f+"px",this.style.left="0px";break;case tr.BOTTOM_LEFT:this.style.top="0px",this.style.left=-d+"px";break;case tr.BOTTOM_RIGHT:this.style.top="0px",this.style.left="0px";break;case tr.CENTER:default:this.style.top=m,this.style.left=g}}this.markerContainer.style.top=this.style.top,this.markerContainer.style.left=this.style.left},"onStrategySelected")),te(this,"_cachedStrategies",null),te(this,"packedMessage",{x:0,y:0,enabled:!1,rank:0,bboxes:[],lockedToStrategyIndex:-1,shouldCollideWithScreenEdges:!0}),te(this,"_cachedLowPriorityPinIndex",null);var i,n,a,o;if(this.id=r?.id||Sb(),this.options=(0,zR.default)(this.options,r),this.options.placement=(i=r.placement)!=null?i:this.options.placement,typeof r.rank=="string")this.rank=gb(r.rank);else if(r.rank!=null&&r.rank>0)this.rank=r.rank;else{let s=Math.trunc(wC.testId*10)/10;wC.testId+=.001,this.rank=s}typeof r.interactive=="string"&&(this.pointerEvents=r.interactive==="pointer-events-auto"?"auto":"none"),this.contentHtml=t,this.initialRank=this.rank,this.markerContainer=document.createElement("div"),this.markerContainer.className="mappedin-marker",this.markerContainer.style.opacity="0",this.markerContainer.innerHTML='<div class="mappedin-marker-content">'.concat(this.contentHtml,"</div>"),this.markerContainer.setAttribute("data-marker-id",this.id.toString()),this.containerEl=(n=this.markerContainer.firstElementChild)!=null?n:null,this.contentEl=(o=(a=this.markerContainer.firstElementChild)==null?void 0:a.firstElementChild)!=null?o:null}updateDimensionsIfZeroWidthHeight(t,r){this.dimensions.width===0&&this.dimensions.height===0&&this.updateDimensions(t,r)}updateDimensions(t,r){if(t!=null&&r!=null)this.dimensions={width:t,height:r};else{let{width:i,height:n}=this.markerContainer.getBoundingClientRect();this.dimensions={width:i,height:n}}this.currentStrategyIndex=-1,this.invalidateStrategies()}invalidateStrategies(){this._cachedStrategies=null,this._cachedLowPriorityPinIndex=null}getBoundingBoxForPlacement(t){let{width:r,height:i}=this.dimensions;switch(t){case tr.TOP:return[i+4,4,r/2+4,r/2+4];case tr.BOTTOM:return[4,i+4,r/2+4,r/2+4];case tr.LEFT:return[i/2+4,i/2+4,r+4,4];case tr.RIGHT:return[i/2+4,i/2+4,4,r+4];case tr.TOP_LEFT:return[i+4,4,r+4,4];case tr.TOP_RIGHT:return[i+4,4,4,r+4];case tr.BOTTOM_LEFT:return[4,i+4,r+4,4];case tr.BOTTOM_RIGHT:return[4,i+4,4,r+4];case tr.HIDDEN:{let n=Math.max(2,2),a=this.options.lowPriorityPin.size/2+n;return[a,a,a,a]}default:return[i/2+4,i/2+4,r/2+4,r/2+4]}}get strategies(){if(this._cachedStrategies)return this._cachedStrategies;let{width:t,height:r}=this.dimensions;if(t===0||r===0)return[];let i=Array.isArray(this.options.placement)?this.options.placement:[this.options.placement],n=[];for(let a of i)this.options.rank==="always-visible"&&a===tr.HIDDEN&&i.length>1||n.push({name:a,getBoundingBox:Y(()=>this.getBoundingBoxForPlacement(a),"getBoundingBox")});return this._cachedStrategies=n,n}toPackedMessage(t=!1){var r;this.packedMessage.x=this.projection.x,this.packedMessage.y=this.projection.y,this.packedMessage.enabled=this.enabled,this.packedMessage.rank=this.rank,this.packedMessage.shouldCollideWithScreenEdges=!0;let i=this.currentStrategyIndex!==-1&&this.currentStrategyIndex!==this.lowPriorityPinStrategyIndex;if(this.visible&&t&&i&&this.collisionDirty===!1?this.packedMessage.lockedToStrategyIndex=this.currentStrategyIndex:this.packedMessage.lockedToStrategyIndex=-1,i&&this.currentStrategyIndex!==((r=this.packedMessage.bboxes[0])==null?void 0:r[4])){let s=this.packedMessage.bboxes;for(let l=1;l<s.length;l++)if(s[l][4]===this.currentStrategyIndex){let u=s[0];s[0]=s[l],s[l]=u;break}}if(!this.collisionDirty)return this.packedMessage;let n=[],a=this.strategies,o=-1;for(let s=0;s<a.length;s++){let l=a[s].getBoundingBox();n.push([l[0],l[1],l[2],l[3],s]),s===this.currentStrategyIndex&&i&&(o=n.length-1)}if(o>0){let s=n[0];n[0]=n[o],n[o]=s}return this.packedMessage.bboxes=n,this.collisionDirty=!1,this.packedMessage}get lowPriorityPinStrategyIndex(){return this._cachedLowPriorityPinIndex!=null?this._cachedLowPriorityPinIndex:this.options.rank==="always-visible"?(this._cachedLowPriorityPinIndex=-1,-1):(this._cachedLowPriorityPinIndex=this.strategies.findIndex(t=>t.name===tr.HIDDEN),this._cachedLowPriorityPinIndex)}destroy(){}},Y(P0,"MarkerComponent"),te(P0,"testId",0),k0=P0,ot(),ot(),ot(),ot(),ot(),ot(),Y(oR,"contains"),ot(),Y(sR,"intersectPoint"),ot(),Y(lR,"intersects"),ot(),Y(qo,"appendItems"),ot(),kb=class{constructor(e,t,r,i,n){te(this,"x"),te(this,"y"),te(this,"w"),te(this,"h"),te(this,"userData"),this.userData=typeof n>"u"?null:n,this.x=e,this.y=t,this.w=r,this.h=i}contains(e){return e===this?!1:oR(this,e)}intersects(e){return lR(this,e)}intersectsPoint(e){return sR(this,e)}draw(e){e.fillStyle="rgba(123,222,26, 0.8)",e.fillRect(this.x,this.y,this.w,this.h)}},Y(kb,"Rectangle"),rr=kb,Fb=class Ip{constructor(t,r){te(this,"topLeft"),te(this,"topRight"),te(this,"bottomLeft"),te(this,"bottomRight"),te(this,"divided",!1),te(this,"boundary"),te(this,"capacity",16),te(this,"objects",[]),te(this,"parent"),this.parent=r,this.boundary=t}getSize(){return this.divided?this.objects.length+this.topLeft.getSize()+this.topRight.getSize()+this.bottomLeft.getSize()+this.bottomRight.getSize():this.objects.length}subdivide(){let{x:t,y:r,w:i,h:n}=this.boundary;this.topLeft=new Ip(new rr(t,r,i/2,n/2),this),this.topRight=new Ip(new rr(t+i/2,r,i/2,n/2),this),this.bottomLeft=new Ip(new rr(t,r+n/2,i/2,n/2),this),this.bottomRight=new Ip(new rr(t+i/2,r+n/2,i/2,n/2),this),this.divided=!0}queryRect(t){let r=[];if(this.boundary.intersects(t))r.push(...this.objects);else return[];return this.divided&&(qo(r,this.topLeft.queryRect(t)),qo(r,this.topRight.queryRect(t)),qo(r,this.bottomLeft.queryRect(t)),qo(r,this.bottomRight.queryRect(t))),r}queryPoint(t){let r=[];if(this.boundary.intersectsPoint(t))r.push(...this.objects);else return[];return this.divided&&(qo(r,this.topLeft.queryPoint(t)),qo(r,this.topRight.queryPoint(t)),qo(r,this.bottomLeft.queryPoint(t)),qo(r,this.bottomRight.queryPoint(t))),r}insert(t){return(this.parent?!this.boundary.contains(t):!this.boundary.intersects(t))?!1:this.objects.length<this.capacity?(this.objects.push(t),!0):(this.divided||this.subdivide(),(this.topLeft.insert(t)||this.topRight.insert(t)||this.bottomLeft.insert(t)||this.bottomRight.insert(t))===!1&&this.objects.push(t),!0)}drawObjects(t){this.objects.forEach(r=>r.draw(t)),this.divided&&(this.topLeft.drawObjects(t),this.topRight.drawObjects(t),this.bottomLeft.drawObjects(t),this.bottomRight.drawObjects(t))}draw(t){t.rect(this.boundary.x,this.boundary.y,this.boundary.w,this.boundary.h),this.divided&&(this.topLeft.draw(t),this.topRight.draw(t),this.bottomLeft.draw(t),this.bottomRight.draw(t)),t.strokeStyle="black",t.lineWidth=4,t.stroke()}},Y(Fb,"QuadTree"),Xc=Fb,ot(),Rb=class{constructor(){te(this,"_subscribers",{}),te(this,"_abortController",new AbortController),te(this,"_cleanupFunctions",[])}get signal(){return this._abortController.signal}publish(e,t){!this._subscribers||!this._subscribers[e]||this.signal.aborted||this._subscribers[e].forEach(function(r){typeof r=="function"&&r(t)})}onAbort(e){this.signal.addEventListener("abort",()=>e(),{once:!0})}on(e,t,r){let i=r?.signal;if(i!=null&&i.aborted||this._abortController&&this._abortController.signal.aborted)return()=>{};this._subscribers||(this._subscribers={}),this._subscribers[e]=this._subscribers[e]||[],this._subscribers[e].push(t);let n=Y(()=>this.off(e,t),"cleanup");return i&&i.addEventListener("abort",n,{once:!0}),this._cleanupFunctions.push(n),n}off(e,t){if(!this._subscribers||this._subscribers[e]==null||this.signal.aborted)return;let r=this._subscribers[e].indexOf(t);r!==-1&&this._subscribers[e].splice(r,1)}destroy(){if(!this.signal.aborted){for(let e of this._cleanupFunctions)e();this._cleanupFunctions=[],this._subscribers={},this._abortController.abort()}}},Y(Rb,"PubSub"),Ld=Rb,ot(),xC=9,cn=200,Sp=10,Y(uR,"processColliders"),Y(h$,"getWatermarkBoundary"),ot(),ot(),Y(cR,"unpackMessage"),Lb=class{constructor(){te(this,"onerror",Y(()=>{},"onerror")),te(this,"onmessage",Y(()=>{},"onmessage")),te(this,"postMessage",Y(e=>{let t=cR(e);this.onmessage({data:uR(t.colliders,t.totalWidth,t.totalHeight,t.watermarkWidth,t.watermarkHeight,t.watermarkPosition,t.msgId)})},"postMessage")),te(this,"terminate",Y(()=>{},"terminate"))}},Y(Lb,"SyncWorker"),zd=Lb,ot(),zb=`"use strict";(()=>{var ne=Object.defineProperty;var oe=(n,e,t)=>e in n?ne(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var u=(n,e,t)=>oe(n,typeof e!="symbol"?e+"":e,t);function O(n,e){return e.x+e.w<n.x+n.w&&e.x>n.x&&e.y>n.y&&e.y+e.h<n.y+n.h}function Q(n,e){let[t,o]=e;return t>=n.x&&t<=n.x+n.w&&o>=n.y&&o<=n.y+n.h}function Y(n,e){let t=e.x,o=e.y,r=e.x+e.w,h=e.y+e.h,L=n.x,m=n.y,x=n.x+n.w,T=n.y+n.h;return t<x&&L<r&&o<T&&m<h}function f(n,e){for(let t=0;t<e.length;t++)n.push(e[t])}var i=class{constructor(e,t,o,r,h){u(this,"x");u(this,"y");u(this,"w");u(this,"h");u(this,"userData");this.userData=typeof h>"u"?null:h,this.x=e,this.y=t,this.w=o,this.h=r}contains(e){return e===this?!1:O(this,e)}intersects(e){return Y(this,e)}intersectsPoint(e){return Q(this,e)}draw(e){e.fillStyle="rgba(123,222,26, 0.8)",e.fillRect(this.x,this.y,this.w,this.h)}};var S=class n{constructor(e,t){u(this,"topLeft");u(this,"topRight");u(this,"bottomLeft");u(this,"bottomRight");u(this,"divided",!1);u(this,"boundary");u(this,"capacity",16);u(this,"objects",[]);u(this,"parent");this.parent=t,this.boundary=e}getSize(){return this.divided?this.objects.length+this.topLeft.getSize()+this.topRight.getSize()+this.bottomLeft.getSize()+this.bottomRight.getSize():this.objects.length}subdivide(){let{x:e,y:t,w:o,h:r}=this.boundary;this.topLeft=new n(new i(e,t,o/2,r/2),this),this.topRight=new n(new i(e+o/2,t,o/2,r/2),this),this.bottomLeft=new n(new i(e,t+r/2,o/2,r/2),this),this.bottomRight=new n(new i(e+o/2,t+r/2,o/2,r/2),this),this.divided=!0}queryRect(e){let t=[];if(this.boundary.intersects(e))t.push(...this.objects);else return[];return this.divided&&(f(t,this.topLeft.queryRect(e)),f(t,this.topRight.queryRect(e)),f(t,this.bottomLeft.queryRect(e)),f(t,this.bottomRight.queryRect(e))),t}queryPoint(e){let t=[];if(this.boundary.intersectsPoint(e))t.push(...this.objects);else return[];return this.divided&&(f(t,this.topLeft.queryPoint(e)),f(t,this.topRight.queryPoint(e)),f(t,this.bottomLeft.queryPoint(e)),f(t,this.bottomRight.queryPoint(e))),t}insert(e){return(this.parent?!this.boundary.contains(e):!this.boundary.intersects(e))?!1:this.objects.length<this.capacity?(this.objects.push(e),!0):(this.divided||this.subdivide(),(this.topLeft.insert(e)||this.topRight.insert(e)||this.bottomLeft.insert(e)||this.bottomRight.insert(e))===!1&&this.objects.push(e),!0)}drawObjects(e){this.objects.forEach(t=>t.draw(e)),this.divided&&(this.topLeft.drawObjects(e),this.topRight.drawObjects(e),this.bottomLeft.drawObjects(e),this.bottomRight.drawObjects(e))}draw(e){e.rect(this.boundary.x,this.boundary.y,this.boundary.w,this.boundary.h),this.divided&&(this.topLeft.draw(e),this.topRight.draw(e),this.bottomLeft.draw(e),this.bottomRight.draw(e)),e.strokeStyle="black",e.lineWidth=4,e.stroke()}};var ie=9,l=200,C=10;function K(n,e,t,o,r,h,L="-1"){var j,N;let m=1/0,x=1/0,T=-1/0,B=-1/0,F=new i(-C,0,5,t),k=new i(-C,0,e,5),U=new i(e-5,0,e+C,t),G=new i(0,t-5,e,t+C),J=se(e,t,o,r,h),Z=[F,k,U,G],M=new i(-l,-l,e+l*2,t+l*2);for(let s of n){let b,I;for(let p=0;p<s.bboxes.length;p++){if(s.bboxes[p]==null||(b=s.bboxes[p].boundingBox,I=s.bboxes[p].index,s.lockedToStrategyIndex!==-1&&I!==s.lockedToStrategyIndex))continue;let[a,P,c,y]=b,[E,g,z,te]=[s.y-a,s.y+P,s.x-c,s.x+y],v=z,D=E,q=te-z,X=g-E;m=Math.min(m,v)-l,x=Math.min(x,D)-l,T=Math.max(T,v+q)+l,B=Math.max(B,D+X)+l,s.bboxes[p].boundingRect=new i(v,D,q,X)}}let w=new S(new i(m,x,T-m,B-x)),R={msgId:L,colliders:new Array(n.length),staticColliders:[],debug:[]},_=0;for(let s=0;s<n.length;s++){let b=n[s];((N=(j=b.bboxes)==null?void 0:j[0])==null?void 0:N.index)===ie&&(R.staticColliders.push(b.bboxes[0].boundingRect),w.insert(b.bboxes[0].boundingRect),_++)}n=n.slice(_,n.length);let $=-l,W=e+l,H=-l,ee=t+l,d;for(let s=0;s<n.length;s++){d=n[s];let b=d.x<$||d.x>W||d.y<H||d.y>ee?1:0;if(R.colliders[s]=[-1,b],d.enabledAndVisible){let[I,p,a]=[1/0,-1,void 0];for(let{index:P,boundingRect:c}of d.bboxes){if(c==null)continue;let y=[];if(y=w.queryRect(c).filter(g=>c.intersects(g)),d.shouldCollideWithScreenEdges)for(let g of Z)c.intersects(g)&&y.push(g);if(c.intersects(J)){R.colliders[s]=[-1,b,c];break}if(y.length<I&&(a=c,p=P,I=y.length),y.length===0){w.insert(c),R.colliders[s]=[P,M.contains(c)?0:1,c];break}}d.rank===5&&a!=null&&(w.insert(a),R.colliders[s]=[p,M.contains(a)?0:1,a])}}return R}function se(n,e,t,o,r){switch(r){case"top-left":return new i(0,0,t,o);case"top-right":return new i(n-t,0,t,o);case"bottom-left":return new i(0,e-o,t,o);case"bottom-right":return new i(n-t,e-o,t,o);case"center":return new i((n-t)/2,(e-o)/2,t,o);case"top":return new i((n-t)/2,0,t,o);case"bottom":return new i((n-t)/2,e-o,t,o);case"left":return new i(0,(e-o)/2,t,o);case"right":return new i(n-t,(e-o)/2,t,o);default:return new i(0,e-o,t,o)}}function V(n){let e=n[0].map(t=>{let o=t[0].map(r=>({index:r[4],boundingBox:[r[0],r[1],r[2],r[3]]}));return{enabledAndVisible:t[1]===1,rank:t[2]===1?5:0,x:t[3],y:t[4],shouldCollideWithScreenEdges:t[5]===1,bboxes:o,lockedToStrategyIndex:t[6]}});return{msgId:"-1",totalWidth:n[3],totalHeight:n[2],watermarkWidth:n[4],watermarkHeight:n[5],watermarkPosition:n[6],colliders:e,devicePixelRatio:n[1]}}self.onmessage=n=>{let e=V(n.data);self.postMessage(K(e.colliders,e.totalWidth,e.totalHeight,e.watermarkWidth,e.watermarkHeight,e.watermarkPosition,e.msgId))};})();
|
|
10916
|
-
`,Nb=class extends Ld{constructor(e,t,r,i,n=!0,a){if(super(),It(this,Ob),te(this,"worker"),te(this,"collidersDirty",!0),te(this,"packedMessage",[[],0,0,0,0,0,"bottom-left"]),te(this,"visibleCollidersQTree",new Xc(new rr(0,0,0,0))),te(this,"interactiveCollidersQTree",new Xc(new rr(0,0,0,0))),It(this,F0),It(this,xc),It(this,_c),It(this,Od,!1),It(this,sr,null),It(this,Ys,null),te(this,"working",!1),te(this,"componentArray",[]),te(this,"update",Y((o,s,l="bottom-left",u=!1,c=[])=>{let d=!1;if(this.collidersDirty){this.packedMessage=[[],0,0,0,0,0,"bottom-left"],this.componentArray=[];for(let w of ae(this,F0).entities)this.componentArray.push(w.component);this.resize(o,s,l),this.collidersDirty=!1,d=!0}else for(let w=0;w<this.componentArray.length;w++)if(this.componentArray[w].collisionDirty){d=!0;break}d&&this.componentArray.sort((w,I)=>I.rank-w.rank);let f=this.packedMessage[0],m=c.length+this.componentArray.length,g=u;f.length=m;let y=0,_;for(let w=0;w<c.length;w++){let I=c[w];f[y]==null&&(f[y]=[[],0,0,0,0,0,-1]),_=f[y],_[0]=[[I.h/2,I.h/2,I.w/2,I.w/2,xC]],_[1]=1,_[2]=1,_[3]=I.x,_[4]=I.y,_[5]=0,_[6]=-1,y++}for(let w=0;w<this.componentArray.length;w++){let I=this.componentArray[w],k=I.toPackedMessage(g);f[y]==null&&(f[y]=[[],0,0,0,0,0,-1]),_=f[y],_[0]=k.bboxes,_[1]=k.enabled&&I.visible&&!I.isOccluded?1:0,_[2]=k.rank===5?1:0,_[3]=k.x,_[4]=k.y,_[5]=k.shouldCollideWithScreenEdges?1:0,_[6]=k.lockedToStrategyIndex,y++}this.working||(this.working=!0,this.worker.postMessage(this.packedMessage))},"update")),te(this,"resolve",Y(o=>{if(this.working=!1,this.collidersDirty||!o.data)return;let s=o.data.colliders,l=-1,u,c,d=new rr(0,0,ae(this,xc),ae(this,_c));this.visibleCollidersQTree=new Xc(d),this.interactiveCollidersQTree=new Xc(d);for(let f=0;f<this.componentArray.length;f++){let m=this.componentArray[f];if(s[f]==null)continue;l=s[f][0],u=s[f][2];let g=m.offscreen,y=s[f][1]===1;m.offscreen=y,l!==-1&&u!=null?(c=new rr(u.x,u.y,u.w,u.h,{entityId:m.id}),this.visibleCollidersQTree.insert(c),m.interactive&&this.interactiveCollidersQTree.insert(c),(m.canShow===!1||m.visibilityNeedsUpdate!==!1||g&&!y)&&"visibilityNeedsUpdate"in m&&(m.visibilityNeedsUpdate="show"),l!==-1&&l!==m.currentStrategyIndex&&(m.activeBoundingBox=c,m.onStrategySelected(l))):((m.canShow===!0||m.visibilityNeedsUpdate!==!1)&&"visibilityNeedsUpdate"in m&&(m.visibilityNeedsUpdate="hide"),l!==-1&&l!==m.currentStrategyIndex&&m.onStrategySelected(l))}B0(this,Ob,UR).call(this),this.publish("visibility-changed")},"resolve")),te(this,"destroy",Y(()=>{var o;this.worker.terminate(),(o=ae(this,sr))==null||o.remove()},"destroy")),Ke(this,F0,e),Ke(this,xc,t),Ke(this,_c,r),!n)this.worker=new zd;else if(i)this.worker=new Worker(i);else if(zb)try{this.worker=new Worker(URL.createObjectURL(new Blob([zb])))}catch{this.worker=new zd}else this.worker=new zd;this.worker.onerror=()=>{this.working=!1,this.worker=new zd,this.worker.onmessage=o=>this.resolve(o)},this.worker.onmessage=o=>this.resolve(o),a&&(Ke(this,sr,document.createElement("canvas")),ae(this,sr).style.cssText="position:absolute;top:0;left:0;pointer-events:none;z-index:0;display:none;",ae(this,sr).width=t,ae(this,sr).height=r,ae(this,sr).style.width=t+"px",ae(this,sr).style.height=r+"px",a.appendChild(ae(this,sr)),Ke(this,Ys,ae(this,sr).getContext("2d")))}resizeCanvas(e,t){Ke(this,xc,e),Ke(this,_c,t),ae(this,sr)&&(ae(this,sr).width=e,ae(this,sr).height=t,ae(this,sr).style.width=e+"px",ae(this,sr).style.height=t+"px")}resize(e,t,r){this.packedMessage[6]=r,this.packedMessage[5]=t,this.packedMessage[4]=e,this.packedMessage[3]=ae(this,xc),this.packedMessage[2]=ae(this,_c)}showCollisionBoxes(){Ke(this,Od,!0),ae(this,sr)&&(ae(this,sr).style.display="block")}hideCollisionBoxes(){Ke(this,Od,!1),ae(this,Ys)&&ae(this,sr)&&(ae(this,Ys).clearRect(0,0,ae(this,sr).width,ae(this,sr).height),ae(this,sr).style.display="none")}},F0=new WeakMap,xc=new WeakMap,_c=new WeakMap,Od=new WeakMap,sr=new WeakMap,Ys=new WeakMap,Ob=new WeakSet,UR=Y(function(){!ae(this,Od)||!ae(this,Ys)||!ae(this,sr)||(ae(this,Ys).clearRect(0,0,ae(this,sr).width,ae(this,sr).height),this.visibleCollidersQTree.drawObjects(ae(this,Ys)))},"#drawDebug"),Y(Nb,"CollisionSystem"),jR=Nb,ot(),ot(),ot(),VR=Y((function(){let e,t;return r=>{if((!t||!t)&&(e=document.createElement("canvas"),e.width=500*r,e.height=500*r,e.style.width="500px",e.style.height="500px",t=e.getContext("2d")),!t)throw new Error("Could not get 2D context");return{measureCanvas:e,measureCanvasContext:t}}}),"createMeasureCanvasContext")(),QR=Y(({text:e,size:t,maxWidth:r,pixelRatio:i,maxLines:n=2,lineHeight:a=1.2,options:o={strokeText:!0}})=>{let s="bold ".concat(t*i,"px 'InterUI-Regular', Helvetica Neue, Arial, sans-serif"),{measureCanvasContext:l}=VR(i);l.font=s;let u=[],c=e.split(" "),d=0,f=0,m=0;for(;f<c.length;){let _=c[f];if(d===n&&d>0){u[d-1]+="...";break}if(u[d]==null&&(u[d]=_,f++),c.length===1){u[d]=_;break}if(c[f]==null)break;let{width:w}=l.measureText(u[d]+" "+c[f]);w<=r*i?(u[d]+=" "+c[f],f++):d++}u.forEach(_=>{let{width:w}=l.measureText(_);m=Math.max(w,m)});let g=t*i*a,y=u.length*g;return{maxWidth:m,maxHeight:y,lines:u.length,draw:Y((_,w,I)=>{u.length===1?(o.strokeText&&_.strokeText(u[0],w,I),_.fillText(u[0],w,I)):(o.strokeText&&(_.strokeText(u[0],w,I-g/2),_.strokeText(u[1],w,I+g/2)),_.fillText(u[0],w,I-g/2),_.fillText(u[1],w,I+g/2))},"draw")}},"shaveText"),ot(),_C="[MappedinJS]",Y(hR,"createLogger"),GR=hR(),YR=GR,ot(),ot(),Y(dR,"formatMessage"),Ub=class extends Error{constructor(e,t=_C){super(dR(e,t)),this.name="MappedinError"}},Y(Ub,"MappedinError"),g$=Ub,FA=Y(e=>e,"linearEase"),HR=Y(e=>e*e,"quadEaseIn"),jb=Y(e=>1-Math.cos(e*Math.PI/2),"easeIn"),WR=Y(e=>1-(1-e)*(1-e),"quadEaseOut"),$R=Y(e=>1-Math.pow(1-e,3),"cubicEaseOut"),BB={linear:FA,"ease-in":HR,"ease-out":WR,"ease-in-out":jb,"ease-out-cubic":$R},Y(pR,"interpolate"),Y(d$,"getInterpolationBreakpoint"),Y(fR,"interpolateMulti"),ot(),ZR=(()=>{let e;return{getDeviceType(){if(e)return e;let{userAgent:t,platform:r,maxTouchPoints:i}=window.navigator,n=/(iphone|ipod|ipad)/i.test(t),a=r==="iPad"||r.indexOf("Mac")===0&&i>0&&!window.MSStream,o=/android/i.test(t);return e={isIpad:a,isMobile:o||n||a,isIOS:n,isAndroid:o,isSafari12:/Version\/12.+Safari/.test(t),isFirefox:/Firefox/.test(t),isWindows:/windows/i.test(t)},e},_reset(){e=void 0}}})(),Vb=ZR.getDeviceType,Qb=(()=>{let e,t,r;function i(){if(t!==void 0)return t;e||(e=document.createElement("canvas"));let a=e.getContext("webgl")||e.getContext("experimental-webgl");if(!a)return t;try{let o=Vb().isFirefox?null:a.getExtension("WEBGL_debug_renderer_info");return t=o?a.getParameter(o.UNMASKED_RENDERER_WEBGL):a.getParameter(a.RENDERER),t}catch{let o=new Error("Failed getting device info");throw o.name="FailedGettingDeviceInfo",o}}Y(i,"getInfo");function n(){var a,o;if(!Vb().isWindows)return!1;if(r!==void 0)return r;let s=(o=(a=XR())==null?void 0:a.toLowerCase())!=null?o:"";return r=s.includes("intel")&&(s.includes("uhd")||s.includes("iris")),r}return Y(n,"shouldDisableOffscreenCanvas"),{getInfo:i,shouldDisableOffscreenCanvas:n,_setCanvas(a){e=a,t=void 0,r=void 0}}})(),XR=Qb.getInfo,JR=Qb.shouldDisableOffscreenCanvas,ot(),Y(mR,"createImage"),Y(bb,"fastTrunc"),Y(gR,"cyrb53"),Gb=class extends Ld{constructor(e,t,r){super(),te(this,"dirty",!1),te(this,"state"),te(this,"colliderContext"),te(this,"colliderCanvas"),te(this,"transformRequestFunc"),te(this,"transformRequest",Y(async i=>this.transformRequestFunc?await this.transformRequestFunc(i):{url:i},"transformRequest")),te(this,"pinCache",{}),te(this,"imageCache",{}),te(this,"imagePromiseCache",{}),te(this,"imageDimensionsCache",{}),te(this,"textCache",{}),te(this,"update",Y(i=>{let n=this.state.pixelRatio;this.colliderContext.clearRect(0,0,this.colliderCanvas.width,this.colliderCanvas.height);let a,o,s,l,u,c;for(let d of this.state.entities)if(d?.component instanceof Pb&&!d.disposed){if(c=d.component,u=c.appearance.iconVisible,c.appearance.icon!=null&&u!=null){let m=typeof u=="boolean"?u:i>=u;m!==c.iconVisible&&(c.iconVisible=m,c.dirty=!0)}if((c.pinDirty||c.dirty||this.dirty)&&c.calculatePinSize(),c.offscreen||!c.visible)continue;if(o={active:c.appearance.pinColor,inactive:c.appearance.pinColorInactive},s={active:c.appearance.pinOutlineColor,inactive:c.appearance.pinOutlineColorInactive},l=bb(c.pinSize),a="".concat(o.active,"-").concat(o.inactive,"-").concat(s.active,"-").concat(s.inactive,"-").concat(l,"-").concat(c.iconVisible),c.labelCacheId=a,(!this.pinCache[a]||this.dirty)&&(this.prepare(c,a,this.colliderContext),c.dirty=!0),(c.appearance.icon&&(!c.imageHash||c.pinDirty)||this.dirty)&&this.cacheImage(c),this.textCache[c.id]==null||c.textDirty||this.dirty){c.dirty=!0,this.textCache[c.id]={};let{textDrawFn:m,width:g,height:y}=this.processText(c.text,c.appearance.textSize,c.appearance.maxWidth,c.appearance.maxLines,c.appearance.lineHeight),_=["left","center","right"];for(let w of _)this.textCache[c.id][w]=this.textToCanvas(m,c.appearance.textSize,w,g,y,c.appearance.textColor,c.appearance.textOutlineColor);c.dimensions={width:Math.ceil(g/n),height:Math.ceil(y/n)}}let f=1;if(c.appearance.iconScale)if(typeof c.appearance.iconScale=="number")f=c.appearance.iconScale;else{let{on:m,input:g,output:y,easing:_}=c.appearance.iconScale;m==="zoom-level"?f=bb(fR(i,g,y,_??"linear")):YR.warn("Unsupported interpolation property: ".concat(m))}c.recomputeCurrentStrategy(c.iconVisible?f:1),c.canShow&&(c.enabled||c.visibilityNeedsUpdate!==!1)&&this.draw(c,a,this.colliderContext),c.textDirty=!1,c.pinDirty=!1}this.dirty=!1},"update")),te(this,"processText",Y((i,n,a,o,s)=>{let l=this.state.pixelRatio,{draw:u,maxWidth:c,maxHeight:d}=QR({text:i,size:n,pixelRatio:l,maxWidth:a,maxLines:o,lineHeight:s});return{textDrawFn:u,width:c+2.5*l*2,height:d+2.5*l*2}},"processText")),te(this,"textToCanvas",Y((i,n,a,o,s,l,u)=>{let c=this.state.pixelRatio,d,f=o,m=s;window.OffscreenCanvas!=null&&!JR()?d=new OffscreenCanvas(f,m):(d=document.createElement("canvas"),d.width=f,d.height=m,d.style.width=f+"px",d.style.height=m+"px");let g=d.getContext("2d",{willReadFrequently:!0});if(!g)return;let y=2.5*c;g.textAlign=a,g.font="bold ".concat(n*c,"px 'InterUI-Regular', Helvetica Neue, Arial, sans-serif"),g.textBaseline="middle",g.lineJoin="miter",g.miterLimit=2,g.strokeStyle="white",g.lineWidth=y,g.fillStyle=l,g.strokeStyle=u;let _=a==="left"?y/2:a==="center"?f/2:f-y/2;return i(g,_,(m+y/2)/2),d},"textToCanvas")),te(this,"cacheImage",Y(i=>{if(!i.appearance.icon)return;let n=gR(i.appearance.icon);this.imagePromiseCache[n]||(this.imagePromiseCache[n]=new Promise(a=>{this.transformRequest(i.appearance.icon).then(o=>{let s=mR(o.url);s.onload=()=>{this.imageCache[n]=s,this.publish("img:loaded"),a(s)}})})),i.imageHash!==n&&(i.imageHash=n,this.imagePromiseCache[n].then(()=>{i.dirty=!0}))},"cacheImage")),te(this,"createPinCanvas",Y((i,n,a,o,s=1)=>{let l,u=this.state.pixelRatio,c=i.totalPinSize*2*u*s;window.OffscreenCanvas!=null?l=new OffscreenCanvas(c,c):(l=document.createElement("canvas"),l.width=c,l.height=c,l.style.width=c/u+"px",l.style.height=c/u+"px");let d=l.getContext("2d");return d.shadowColor="rgba(0,0,0,0.3)",d.shadowOffsetY=2*u,d.shadowBlur=5*u,d.beginPath(),d.arc(c/2,c/2,(n/2+2.5*u/2)*s,0,2*Math.PI),d.fillStyle=a,d.fill(),d.beginPath(),d.arc(c/2,c/2,n/2*s,0,2*Math.PI),d.shadowColor="transparent",d.fillStyle=o,d.fill(),l},"createPinCanvas")),te(this,"prepare",Y((i,n,a)=>{let o=this.state.pixelRatio;a.lineWidth=4*o;let s=typeof i.appearance.iconScale=="number"?[i.appearance.iconScale]:i.appearance.iconScale==null?[]:i.appearance.iconScale.output,l=s.length>0?Math.max(...s):void 0,u=this.createPinCanvas(i,i.pinSize,i.appearance.pinOutlineColor,i.appearance.pinColor,l),c=this.createPinCanvas(i,3.5*o,i.appearance.pinOutlineColorInactive,i.appearance.pinColorInactive,l);this.pinCache[n]=[u,c]},"prepare")),this.state=e,this.colliderCanvas=t,this.colliderContext=t.getContext("2d"),this.transformRequestFunc=r}draw(e,t,r){var i;if(!e.canShow||!e.visible)return;r.save(),r.globalAlpha=e.currentOpacity;let n=this.state.pixelRatio,a=e.projection.x*n,o=e.projection.y*n,s=e.style.pinVisibility===1?this.pinCache[t][0]:this.pinCache[t][1],l=e.style.pinVisibility===1?e.scaledPinSize*n:e.totalPinSize*n;if(e.style.pinVisibility!==0&&r.drawImage(s,a-l,o-l,l*2,l*2),e.appearance.icon&&e.iconVisible&&e.imageHash&&e.appearance.iconSize&&this.imageCache[e.imageHash]&&e.style.pinVisibility===1){let u=this.imageCache[e.imageHash],c=(e.scaledPinSize-e.scaledIconPadding)*n,d=e.appearance.iconFit,f=c,m=c,g="".concat(e.imageHash,"_").concat(d);if(this.imageDimensionsCache[g])f=this.imageDimensionsCache[g].width,m=this.imageDimensionsCache[g].height;else{let y=u.width*n,_=u.height*n;if(d==="contain"){let w=Math.sqrt(y**2+_**2),I=c/w;f=y*I,m=_*I}if(d==="cover"){let w=c/y,I=c/_,k=Math.max(w,I);f=y*k,m=_*k}}r.save(),r.beginPath(),r.arc(a,o,c/2,0,2*Math.PI),r.closePath(),((i=e?.appearance)==null?void 0:i.iconOverflow)!=="visible"&&r.clip(),r.drawImage(u,a-f/2,o-m/2,f,m),r.restore()}e.style.textLabelVisible&&e.style.textAlign!=null&&e.style.left!=null&&e.style.top!=null&&r.drawImage(this.textCache[e.id][e.style.textAlign],a+e.style.left*n,o+e.style.top*n),r.restore()}},Y(Gb,"TwoDDrawSystem"),qR=Gb,ot(),Yb=class extends Ld{constructor(e){super(),te(this,"state"),te(this,"animating",new Map),te(this,"isAnimating",!1),te(this,"startTime",-1),te(this,"showDuration",300),te(this,"hideDuration",250),te(this,"update",Y(()=>{var t;this.animating.clear();for(let r of this.state.entities){let i=r.component;i instanceof Pb&&(i.visibilityNeedsUpdate==="show"?(i.canShow=!0,this.animating.set(i,[i.currentOpacity,(t=i.appearance.opacity)!=null?t:1])):i.visibilityNeedsUpdate==="hide"&&this.animating.set(i,[i.currentOpacity,0]))}this.startTime=performance.now(),this.publish("animate:2d")},"update")),te(this,"playAnimations"),this.state=e,this.playAnimations=this._playAnimations}_playAnimations(){let e=performance.now();for(let[t,[r,i]]of this.animating.entries()){let n=i===1?this.showDuration:this.hideDuration,a=(e-this.startTime)/n;t.currentOpacity=pR(a,0,1,r,i,i===0?FA:jb),e-this.startTime>=n&&(i===1?t.canShow=!0:i===0&&(t.canShow=!1),t.visibilityNeedsUpdate=!1,this.animating.delete(t))}this.publish("draw:2d"),this.animating.size>0&&this.publish("animate:2d")}},Y(Yb,"TwoDVisibilitySystem"),KR=Yb,ot(),eL=["running","paused"],Hb=class{constructor(e){te(this,"state"),this.state=e}update(e){let t;for(let r of this.state.entities)if(r&&(t=r.component,t&&"containerEl"in t&&t.markerContainer!=null)){let i=t;i.visibilityNeedsUpdate!==!1&&(i.visibilityNeedsUpdate==="show"?i.canShow=!0:i.canShow=!1),i.offscreen&&(i.animation&&(i.animation.cancel(),i.animation=null),i.markerContainer.style.opacity="0");let n=i.animation!=null&&(i.animation.pending===!0||eL.includes(i.animation.playState));if((i.canShow&&i.visible===!0||n)&&!i.offscreen&&(i.markerContainer.style.transform="translate3D(".concat(i.projection.x,"px, ").concat(i.projection.y,"px, 0px)")),i.canShow===!0&&i.visible===!0&&!i.offscreen?i.markerContainer.style.pointerEvents=e?"none":i.pointerEvents:i.markerContainer.style.pointerEvents="none",i.currentStrategyIndex===-1&&i.visible&&i.visibilityNeedsUpdate==="show")continue;i.visibilityNeedsUpdate!==!1&&!i.offscreen&&(i.visibilityNeedsUpdate==="show"&&(i.markerContainer.style.opacity="0"),i.animation&&i.animation.cancel(),i.animation=i.markerContainer.animate([{opacity:i.canShow&&i.visible?"1":"0"}],{duration:300,easing:"ease-in-out",fill:"forwards"}),i.visibilityNeedsUpdate=!1)}}},Y(Hb,"DOMDrawSystem"),tL=Hb,ot(),Wb=class{constructor(e,t){te(this,"state"),te(this,"dirty",!0),te(this,"domTree"),this.state=e,this.domTree=t}update(){var e;if(this.dirty){for(let t of Array.from(this.domTree.children)){let r=(e=t.userData)==null?void 0:e.entityId,i=r!=null?this.state.entityMap.get(r):void 0;if(i){let n=i.component;(!n.enabled||!n.visible||!this.state.entityIds.has(r))&&this.domTree.removeChild(t)}else this.domTree.removeChild(t)}for(let t of this.state.entities){let r=t.component;r instanceof k0&&r.enabled&&r.markerContainer&&!this.domTree.contains(r.markerContainer)&&(r.markerContainer.userData={entityId:t.id},this.domTree.appendChild(r.markerContainer),r.updateDimensionsIfZeroWidthHeight())}this.dirty=!1}}},Y(Wb,"DOMVisibilitySystem"),rL=Wb,ot(),$b=class extends Ld{constructor(e,t){super(),te(this,"state"),te(this,"dirty",!0),te(this,"domTree"),te(this,"observers",new Map),te(this,"updateDimensions",Y(r=>{var i;for(let n of r){let a=(i=n.target.parentElement)==null?void 0:i.getAttribute("data-marker-id");if(a){let o=this.state.entityMap.get(a);if(o){let s=o.component;s instanceof k0&&(s.updateDimensions(n.contentRect.width,n.contentRect.height),s.collisionDirty=!0)}}}this.publish("dimensions-update")},"updateDimensions")),this.state=e,this.domTree=t}setupObserver(){var e;for(let t of this.observers.values())t.disconnect();this.observers.clear();for(let t of this.domTree.children){let r=t.getAttribute("data-marker-id");if(r!=null){let i=this.state.entityMap.get(r);if(i){let n=i.component;if((e=n.options)!=null&&e.dynamicResize){let a=new ResizeObserver(this.updateDimensions);a.observe(n.containerEl),this.observers.set(t.userData.entityId,a)}}}}}update(){this.dirty&&(this.setupObserver(),this.dirty=!1)}destroy(){for(let e of this.observers.values())e.disconnect();this.observers.clear()}},Y($b,"DOMResizeSystem"),iL=$b,Nd=9,oL=class{constructor(e,t,r,i={}){It(this,O0),It(this,Sr),It(this,bc),It(this,R0),It(this,va),It(this,wc),It(this,Qi),It(this,Ec),It(this,Ko),It(this,Cc),It(this,Ud),It(this,Hs),It(this,Wl,Nd),It(this,ao,null),It(this,oo,null),It(this,so,null),It(this,lo,null),te(this,"collidersNeedRecomputing",!0),It(this,uo),It(this,L0,0),It(this,z0,[]),It(this,Zb,Y(()=>{ae(this,lo)&&(cancelAnimationFrame(ae(this,lo)),Ke(this,lo,null)),Ke(this,lo,requestAnimationFrame(()=>{Ke(this,lo,null),ae(this,Ko).update(),ae(this,N0).call(this)}))},"#onVisibilityChanged")),It(this,N0,Y(()=>{Ke(this,oo,requestAnimationFrame(()=>{Ke(this,oo,null),ae(this,Ec).update(ae(this,L0)),ae(this,Cc).update(!1)}))},"#draw2DEntities")),It(this,Xb,Y(()=>{ae(this,N0).call(this)},"#onDraw2D")),It(this,Jb,Y(()=>{ae(this,so)&&(cancelAnimationFrame(ae(this,so)),Ke(this,so,null)),Ke(this,so,requestAnimationFrame(()=>{Ke(this,so,null),ae(this,Ko).playAnimations()}))},"#onAnimate2D"));var n,a;Ke(this,Sr,t),Ke(this,bc,e),Ke(this,R0,r),Ke(this,uo,(n=i.watermark)!=null?n:{width:0,height:0,position:"bottom-left"}),Ke(this,va,document.createElement("canvas")),ae(this,va).style.cssText="position:absolute;top:0;left:0;width:100%;height:100%;pointer-events:none;z-index:1;",e.appendChild(ae(this,va));let o=document.createElement("div");o.classList.add("mappedin-2d-entities"),Object.assign(o.style,{position:"absolute",top:"0",left:"0",bottom:"0",right:"0",overflow:"hidden",pointerEvents:"none",zIndex:"2",transformStyle:"preserve-3d"}),e.appendChild(o),Ke(this,wc,o),this.resize(),Ke(this,Qi,new jR(t,ae(this,bc).clientWidth,ae(this,bc).clientHeight,i.workerUrl,(a=i.useCollisionWorker)!=null?a:!0,e)),Ke(this,Ec,new qR(t,ae(this,va),i.transformImageRequest)),Ke(this,Ko,new KR(t)),Ke(this,Cc,new tL(t)),Ke(this,Ud,new rL(t,ae(this,wc))),Ke(this,Hs,new iL(t,ae(this,wc))),ae(this,Qi).on("visibility-changed",ae(this,Zb),{signal:ae(this,Qi).signal}),ae(this,Ko).on("draw:2d",ae(this,Xb),{signal:ae(this,Ko).signal}),ae(this,Ko).on("animate:2d",ae(this,Jb),{signal:ae(this,Ko).signal}),ae(this,Hs).on("dimensions-update",()=>{ae(this,Qi).collidersDirty=!0,B0(this,O0,aL).call(this)},{signal:ae(this,Hs).signal})}get collisionSystem(){return ae(this,Qi)}get drawSystem(){return ae(this,Ec)}get domDrawSystem(){return ae(this,Cc)}registerEntity(e){ae(this,Sr).entityMap.set(e.id,e)}addEntity(e){ae(this,Sr).entityMap.set(e.id,e),ae(this,Sr).entities.add(e),ae(this,Sr).entityIds.add(e.id)}activateEntity(e){ae(this,Sr).entities.add(e),ae(this,Sr).entityIds.add(e.id)}deactivateEntity(e){ae(this,Sr).entities.delete(e),ae(this,Sr).entityIds.delete(e.id)}removeEntity(e){ae(this,Sr).entities.delete(e),ae(this,Sr).entityMap.delete(e.id),ae(this,Sr).entityIds.delete(e.id)}clearEntities(){ae(this,Sr).entities.clear(),ae(this,Sr).entityMap.clear(),ae(this,Sr).entityIds.clear()}getEntity(e){return ae(this,Sr).entityMap.get(e)}hasActiveEntity(e){return ae(this,Sr).entities.has(e)}resize(){var e;let{clientWidth:t,clientHeight:r}=ae(this,bc),i=ae(this,Sr).pixelRatio;ae(this,va).width=t*i,ae(this,va).height=r*i,ae(this,va).style.width=t+"px",ae(this,va).style.height=r+"px",(e=ae(this,Qi))==null||e.resizeCanvas(t,r)}update(e,t,r=!1,i=[]){Ke(this,L0,e),Ke(this,z0,i),B0(this,O0,nL).call(this),ae(this,Ud).update(),ae(this,Hs).update(),ae(this,oo)&&(cancelAnimationFrame(ae(this,oo)),Ke(this,oo,null)),ae(this,Ec).update(e),ae(this,Cc).update(t);let n=this.collidersNeedRecomputing,a=!n&&r;n&&Ke(this,Wl,Nd),MR(this,Wl)._++,ae(this,Wl)>=Nd&&(Ke(this,Wl,0),ae(this,Qi).update(ae(this,uo).width,ae(this,uo).height,ae(this,uo).position,a,i)),this.collidersNeedRecomputing=!1}updateWatermark(e){Ke(this,uo,e)}markDirty(){ae(this,Ud).dirty=!0,ae(this,Hs).dirty=!0,ae(this,Qi).collidersDirty=!0,this.collidersNeedRecomputing=!0,Ke(this,Wl,Nd)}cancelPendingFrames(){ae(this,ao)&&(cancelAnimationFrame(ae(this,ao)),Ke(this,ao,null)),ae(this,oo)&&(cancelAnimationFrame(ae(this,oo)),Ke(this,oo,null)),ae(this,so)&&(cancelAnimationFrame(ae(this,so)),Ke(this,so,null)),ae(this,lo)&&(cancelAnimationFrame(ae(this,lo)),Ke(this,lo,null))}createLabel(e,t){return new Tb(e,t,ae(this,Sr).pixelRatio)}createMarker(e,t={}){return new k0(e,t)}showCollisionBoxes(){ae(this,Qi).showCollisionBoxes()}hideCollisionBoxes(){ae(this,Qi).hideCollisionBoxes()}destroy(){this.cancelPendingFrames(),ae(this,Qi).destroy(),ae(this,Hs).destroy(),ae(this,va).remove(),ae(this,wc).remove()}},Sr=new WeakMap,bc=new WeakMap,R0=new WeakMap,va=new WeakMap,wc=new WeakMap,Qi=new WeakMap,Ec=new WeakMap,Ko=new WeakMap,Cc=new WeakMap,Ud=new WeakMap,Hs=new WeakMap,Wl=new WeakMap,ao=new WeakMap,oo=new WeakMap,so=new WeakMap,lo=new WeakMap,uo=new WeakMap,L0=new WeakMap,z0=new WeakMap,O0=new WeakSet,nL=Y(function(){for(let e of ae(this,Sr).entities){let t=e.worldPosition,r=ae(this,R0).call(this,t.x,t.y,t.z);r?(e.component.projection.x=r.x,e.component.projection.y=r.y,e.component.offscreen=!1):e.component.offscreen=!0}},"#projectEntities"),aL=Y(function(){ae(this,ao)&&(cancelAnimationFrame(ae(this,ao)),Ke(this,ao,null)),Ke(this,ao,requestAnimationFrame(()=>{Ke(this,ao,null),ae(this,Qi).update(ae(this,uo).width,ae(this,uo).height,ae(this,uo).position,!1,ae(this,z0))}))},"#scheduleCollisionUpdate"),Zb=new WeakMap,N0=new WeakMap,Xb=new WeakMap,Jb=new WeakMap,Y(oL,"TwoDPipeline")}),qb,Kb,Jle,qle,A$=M(()=>{"use strict";ar(),pl(),qb=Yy,Kb=Wy,Jle=P.object({rank:U1.optional(),appearance:vC.optional(),interactive:P.boolean().default(!1),textPlacement:P.union([P.enum(qb),P.array(P.enum(qb))]).default(Hy),occlude:P.boolean().default(!0)}),qle=P.object({rank:P.union([P.enum(["low","medium","high","always-visible"]),P.number()]).optional(),interactive:P.union([P.boolean(),P.literal("pointer-events-auto")]).optional(),id:P.string().optional(),placement:P.union([P.enum(Kb),P.array(P.enum(Kb))]).optional(),dynamicResize:P.boolean().optional(),zIndex:P.number().optional(),lowPriorityPin:P.object({size:P.number().positive().optional(),color:P.string().optional()}).optional()})});function y$(){return Bw==null&&(Bw=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function"),Bw}function Kle(){if(J0==null&&(J0=!1,y$())){let e=new OffscreenCanvas(5,5).getContext("2d",{willReadFrequently:!0});if(e){for(let r=0;r<25;r++){let i=r*4;e.fillStyle=`rgb(${i},${i+1},${i+2})`,e.fillRect(r%5,Math.floor(r/5),1,1)}let t=e.getImageData(0,0,5,5).data;for(let r=0;r<100;r++)if(r%4!==3&&t[r]!==r){J0=!0;break}}}return J0||!1}function eue(){var e=new zt(4);return zt!=Float32Array&&(e[1]=0,e[2]=0),e[0]=1,e[3]=1,e}function tue(e){var t=new zt(4);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t}function rue(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e}function iue(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=1,e}function nue(e,t,r,i){var n=new zt(4);return n[0]=e,n[1]=t,n[2]=r,n[3]=i,n}function aue(e,t,r,i,n){return e[0]=t,e[1]=r,e[2]=i,e[3]=n,e}function oue(e,t){if(e===t){var r=t[1];e[1]=t[2],e[2]=r}else e[0]=t[0],e[1]=t[2],e[2]=t[1],e[3]=t[3];return e}function sue(e,t){var r=t[0],i=t[1],n=t[2],a=t[3],o=r*a-n*i;return o?(o=1/o,e[0]=a*o,e[1]=-i*o,e[2]=-n*o,e[3]=r*o,e):null}function lue(e,t){var r=t[0];return e[0]=t[3],e[1]=-t[1],e[2]=-t[2],e[3]=r,e}function uue(e){return e[0]*e[3]-e[2]*e[1]}function sL(e,t,r){var i=t[0],n=t[1],a=t[2],o=t[3],s=r[0],l=r[1],u=r[2],c=r[3];return e[0]=i*s+a*l,e[1]=n*s+o*l,e[2]=i*u+a*c,e[3]=n*u+o*c,e}function cue(e,t,r){var i=t[0],n=t[1],a=t[2],o=t[3],s=Math.sin(r),l=Math.cos(r);return e[0]=i*l+a*s,e[1]=n*l+o*s,e[2]=i*-s+a*l,e[3]=n*-s+o*l,e}function hue(e,t,r){var i=t[0],n=t[1],a=t[2],o=t[3],s=r[0],l=r[1];return e[0]=i*s,e[1]=n*s,e[2]=a*l,e[3]=o*l,e}function due(e,t){var r=Math.sin(t),i=Math.cos(t);return e[0]=i,e[1]=r,e[2]=-r,e[3]=i,e}function pue(e,t){return e[0]=t[0],e[1]=0,e[2]=0,e[3]=t[1],e}function fue(e){return"mat2("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+")"}function mue(e){return Math.hypot(e[0],e[1],e[2],e[3])}function gue(e,t,r,i){return e[2]=i[2]/i[0],r[0]=i[0],r[1]=i[1],r[3]=i[3]-e[2]*r[1],[e,t,r]}function Aue(e,t,r){return e[0]=t[0]+r[0],e[1]=t[1]+r[1],e[2]=t[2]+r[2],e[3]=t[3]+r[3],e}function lL(e,t,r){return e[0]=t[0]-r[0],e[1]=t[1]-r[1],e[2]=t[2]-r[2],e[3]=t[3]-r[3],e}function yue(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]}function vue(e,t){var r=e[0],i=e[1],n=e[2],a=e[3],o=t[0],s=t[1],l=t[2],u=t[3];return Math.abs(r-o)<=qe*Math.max(1,Math.abs(r),Math.abs(o))&&Math.abs(i-s)<=qe*Math.max(1,Math.abs(i),Math.abs(s))&&Math.abs(n-l)<=qe*Math.max(1,Math.abs(n),Math.abs(l))&&Math.abs(a-u)<=qe*Math.max(1,Math.abs(a),Math.abs(u))}function xue(e,t,r){return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e[3]=t[3]*r,e}function _ue(e,t,r,i){return e[0]=t[0]+r[0]*i,e[1]=t[1]+r[1]*i,e[2]=t[2]+r[2]*i,e[3]=t[3]+r[3]*i,e}function uL(){var e=new zt(9);return zt!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[5]=0,e[6]=0,e[7]=0),e[0]=1,e[4]=1,e[8]=1,e}function bue(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[4],e[4]=t[5],e[5]=t[6],e[6]=t[8],e[7]=t[9],e[8]=t[10],e}function wue(e){var t=new zt(9);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t}function Eue(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e}function Cue(e,t,r,i,n,a,o,s,l){var u=new zt(9);return u[0]=e,u[1]=t,u[2]=r,u[3]=i,u[4]=n,u[5]=a,u[6]=o,u[7]=s,u[8]=l,u}function Mue(e,t,r,i,n,a,o,s,l,u){return e[0]=t,e[1]=r,e[2]=i,e[3]=n,e[4]=a,e[5]=o,e[6]=s,e[7]=l,e[8]=u,e}function Sue(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=1,e[5]=0,e[6]=0,e[7]=0,e[8]=1,e}function Iue(e,t){if(e===t){var r=t[1],i=t[2],n=t[5];e[1]=t[3],e[2]=t[6],e[3]=r,e[5]=t[7],e[6]=i,e[7]=n}else e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8];return e}function Bue(e,t){var r=t[0],i=t[1],n=t[2],a=t[3],o=t[4],s=t[5],l=t[6],u=t[7],c=t[8],d=c*o-s*u,f=-c*a+s*l,m=u*a-o*l,g=r*d+i*f+n*m;return g?(g=1/g,e[0]=d*g,e[1]=(-c*i+n*u)*g,e[2]=(s*i-n*o)*g,e[3]=f*g,e[4]=(c*r-n*l)*g,e[5]=(-s*r+n*a)*g,e[6]=m*g,e[7]=(-u*r+i*l)*g,e[8]=(o*r-i*a)*g,e):null}function Due(e,t){var r=t[0],i=t[1],n=t[2],a=t[3],o=t[4],s=t[5],l=t[6],u=t[7],c=t[8];return e[0]=o*c-s*u,e[1]=n*u-i*c,e[2]=i*s-n*o,e[3]=s*l-a*c,e[4]=r*c-n*l,e[5]=n*a-r*s,e[6]=a*u-o*l,e[7]=i*l-r*u,e[8]=r*o-i*a,e}function Tue(e){var t=e[0],r=e[1],i=e[2],n=e[3],a=e[4],o=e[5],s=e[6],l=e[7],u=e[8];return t*(u*a-o*l)+r*(-u*n+o*s)+i*(l*n-a*s)}function cL(e,t,r){var i=t[0],n=t[1],a=t[2],o=t[3],s=t[4],l=t[5],u=t[6],c=t[7],d=t[8],f=r[0],m=r[1],g=r[2],y=r[3],_=r[4],w=r[5],I=r[6],k=r[7],D=r[8];return e[0]=f*i+m*o+g*u,e[1]=f*n+m*s+g*c,e[2]=f*a+m*l+g*d,e[3]=y*i+_*o+w*u,e[4]=y*n+_*s+w*c,e[5]=y*a+_*l+w*d,e[6]=I*i+k*o+D*u,e[7]=I*n+k*s+D*c,e[8]=I*a+k*l+D*d,e}function Pue(e,t,r){var i=t[0],n=t[1],a=t[2],o=t[3],s=t[4],l=t[5],u=t[6],c=t[7],d=t[8],f=r[0],m=r[1];return e[0]=i,e[1]=n,e[2]=a,e[3]=o,e[4]=s,e[5]=l,e[6]=f*i+m*o+u,e[7]=f*n+m*s+c,e[8]=f*a+m*l+d,e}function kue(e,t,r){var i=t[0],n=t[1],a=t[2],o=t[3],s=t[4],l=t[5],u=t[6],c=t[7],d=t[8],f=Math.sin(r),m=Math.cos(r);return e[0]=m*i+f*o,e[1]=m*n+f*s,e[2]=m*a+f*l,e[3]=m*o-f*i,e[4]=m*s-f*n,e[5]=m*l-f*a,e[6]=u,e[7]=c,e[8]=d,e}function Fue(e,t,r){var i=r[0],n=r[1];return e[0]=i*t[0],e[1]=i*t[1],e[2]=i*t[2],e[3]=n*t[3],e[4]=n*t[4],e[5]=n*t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e}function Rue(e,t){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=1,e[5]=0,e[6]=t[0],e[7]=t[1],e[8]=1,e}function Lue(e,t){var r=Math.sin(t),i=Math.cos(t);return e[0]=i,e[1]=r,e[2]=0,e[3]=-r,e[4]=i,e[5]=0,e[6]=0,e[7]=0,e[8]=1,e}function zue(e,t){return e[0]=t[0],e[1]=0,e[2]=0,e[3]=0,e[4]=t[1],e[5]=0,e[6]=0,e[7]=0,e[8]=1,e}function Oue(e,t){return e[0]=t[0],e[1]=t[1],e[2]=0,e[3]=t[2],e[4]=t[3],e[5]=0,e[6]=t[4],e[7]=t[5],e[8]=1,e}function Nue(e,t){var r=t[0],i=t[1],n=t[2],a=t[3],o=r+r,s=i+i,l=n+n,u=r*o,c=i*o,d=i*s,f=n*o,m=n*s,g=n*l,y=a*o,_=a*s,w=a*l;return e[0]=1-d-g,e[3]=c-w,e[6]=f+_,e[1]=c+w,e[4]=1-u-g,e[7]=m-y,e[2]=f-_,e[5]=m+y,e[8]=1-u-d,e}function Uue(e,t){var r=t[0],i=t[1],n=t[2],a=t[3],o=t[4],s=t[5],l=t[6],u=t[7],c=t[8],d=t[9],f=t[10],m=t[11],g=t[12],y=t[13],_=t[14],w=t[15],I=r*s-i*o,k=r*l-n*o,D=r*u-a*o,S=i*l-n*s,L=i*u-a*s,z=n*u-a*l,N=c*y-d*g,H=c*_-f*g,q=c*w-m*g,V=d*_-f*y,Q=d*w-m*y,$=f*w-m*_,B=I*$-k*Q+D*V+S*q-L*H+z*N;return B?(B=1/B,e[0]=(s*$-l*Q+u*V)*B,e[1]=(l*q-o*$-u*H)*B,e[2]=(o*Q-s*q+u*N)*B,e[3]=(n*Q-i*$-a*V)*B,e[4]=(r*$-n*q+a*H)*B,e[5]=(i*q-r*Q-a*N)*B,e[6]=(y*z-_*L+w*S)*B,e[7]=(_*D-g*z-w*k)*B,e[8]=(g*L-y*D+w*I)*B,e):null}function jue(e,t,r){return e[0]=2/t,e[1]=0,e[2]=0,e[3]=0,e[4]=-2/r,e[5]=0,e[6]=-1,e[7]=1,e[8]=1,e}function Vue(e){return"mat3("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+", "+e[4]+", "+e[5]+", "+e[6]+", "+e[7]+", "+e[8]+")"}function Que(e){return Math.hypot(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])}function Gue(e,t,r){return e[0]=t[0]+r[0],e[1]=t[1]+r[1],e[2]=t[2]+r[2],e[3]=t[3]+r[3],e[4]=t[4]+r[4],e[5]=t[5]+r[5],e[6]=t[6]+r[6],e[7]=t[7]+r[7],e[8]=t[8]+r[8],e}function hL(e,t,r){return e[0]=t[0]-r[0],e[1]=t[1]-r[1],e[2]=t[2]-r[2],e[3]=t[3]-r[3],e[4]=t[4]-r[4],e[5]=t[5]-r[5],e[6]=t[6]-r[6],e[7]=t[7]-r[7],e[8]=t[8]-r[8],e}function Yue(e,t,r){return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e[3]=t[3]*r,e[4]=t[4]*r,e[5]=t[5]*r,e[6]=t[6]*r,e[7]=t[7]*r,e[8]=t[8]*r,e}function Hue(e,t,r,i){return e[0]=t[0]+r[0]*i,e[1]=t[1]+r[1]*i,e[2]=t[2]+r[2]*i,e[3]=t[3]+r[3]*i,e[4]=t[4]+r[4]*i,e[5]=t[5]+r[5]*i,e[6]=t[6]+r[6]*i,e[7]=t[7]+r[7]*i,e[8]=t[8]+r[8]*i,e}function Wue(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]&&e[4]===t[4]&&e[5]===t[5]&&e[6]===t[6]&&e[7]===t[7]&&e[8]===t[8]}function $ue(e,t){var r=e[0],i=e[1],n=e[2],a=e[3],o=e[4],s=e[5],l=e[6],u=e[7],c=e[8],d=t[0],f=t[1],m=t[2],g=t[3],y=t[4],_=t[5],w=t[6],I=t[7],k=t[8];return Math.abs(r-d)<=qe*Math.max(1,Math.abs(r),Math.abs(d))&&Math.abs(i-f)<=qe*Math.max(1,Math.abs(i),Math.abs(f))&&Math.abs(n-m)<=qe*Math.max(1,Math.abs(n),Math.abs(m))&&Math.abs(a-g)<=qe*Math.max(1,Math.abs(a),Math.abs(g))&&Math.abs(o-y)<=qe*Math.max(1,Math.abs(o),Math.abs(y))&&Math.abs(s-_)<=qe*Math.max(1,Math.abs(s),Math.abs(_))&&Math.abs(l-w)<=qe*Math.max(1,Math.abs(l),Math.abs(w))&&Math.abs(u-I)<=qe*Math.max(1,Math.abs(u),Math.abs(I))&&Math.abs(c-k)<=qe*Math.max(1,Math.abs(c),Math.abs(k))}function Zue(){var e=new zt(16);return zt!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0),e[0]=1,e[5]=1,e[10]=1,e[15]=1,e}function Xue(e){var t=new zt(16);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t}function Jue(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function que(e,t,r,i,n,a,o,s,l,u,c,d,f,m,g,y){var _=new zt(16);return _[0]=e,_[1]=t,_[2]=r,_[3]=i,_[4]=n,_[5]=a,_[6]=o,_[7]=s,_[8]=l,_[9]=u,_[10]=c,_[11]=d,_[12]=f,_[13]=m,_[14]=g,_[15]=y,_}function Kue(e,t,r,i,n,a,o,s,l,u,c,d,f,m,g,y,_){return e[0]=t,e[1]=r,e[2]=i,e[3]=n,e[4]=a,e[5]=o,e[6]=s,e[7]=l,e[8]=u,e[9]=c,e[10]=d,e[11]=f,e[12]=m,e[13]=g,e[14]=y,e[15]=_,e}function v$(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function ece(e,t){if(e===t){var r=t[1],i=t[2],n=t[3],a=t[6],o=t[7],s=t[11];e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=r,e[6]=t[9],e[7]=t[13],e[8]=i,e[9]=a,e[11]=t[14],e[12]=n,e[13]=o,e[14]=s}else e[0]=t[0],e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=t[1],e[5]=t[5],e[6]=t[9],e[7]=t[13],e[8]=t[2],e[9]=t[6],e[10]=t[10],e[11]=t[14],e[12]=t[3],e[13]=t[7],e[14]=t[11],e[15]=t[15];return e}function tce(e,t){var r=t[0],i=t[1],n=t[2],a=t[3],o=t[4],s=t[5],l=t[6],u=t[7],c=t[8],d=t[9],f=t[10],m=t[11],g=t[12],y=t[13],_=t[14],w=t[15],I=r*s-i*o,k=r*l-n*o,D=r*u-a*o,S=i*l-n*s,L=i*u-a*s,z=n*u-a*l,N=c*y-d*g,H=c*_-f*g,q=c*w-m*g,V=d*_-f*y,Q=d*w-m*y,$=f*w-m*_,B=I*$-k*Q+D*V+S*q-L*H+z*N;return B?(B=1/B,e[0]=(s*$-l*Q+u*V)*B,e[1]=(n*Q-i*$-a*V)*B,e[2]=(y*z-_*L+w*S)*B,e[3]=(f*L-d*z-m*S)*B,e[4]=(l*q-o*$-u*H)*B,e[5]=(r*$-n*q+a*H)*B,e[6]=(_*D-g*z-w*k)*B,e[7]=(c*z-f*D+m*k)*B,e[8]=(o*Q-s*q+u*N)*B,e[9]=(i*q-r*Q-a*N)*B,e[10]=(g*L-y*D+w*I)*B,e[11]=(d*D-c*L-m*I)*B,e[12]=(s*H-o*V-l*N)*B,e[13]=(r*V-i*H+n*N)*B,e[14]=(y*k-g*S-_*I)*B,e[15]=(c*S-d*k+f*I)*B,e):null}function rce(e,t){var r=t[0],i=t[1],n=t[2],a=t[3],o=t[4],s=t[5],l=t[6],u=t[7],c=t[8],d=t[9],f=t[10],m=t[11],g=t[12],y=t[13],_=t[14],w=t[15];return e[0]=s*(f*w-m*_)-d*(l*w-u*_)+y*(l*m-u*f),e[1]=-(i*(f*w-m*_)-d*(n*w-a*_)+y*(n*m-a*f)),e[2]=i*(l*w-u*_)-s*(n*w-a*_)+y*(n*u-a*l),e[3]=-(i*(l*m-u*f)-s*(n*m-a*f)+d*(n*u-a*l)),e[4]=-(o*(f*w-m*_)-c*(l*w-u*_)+g*(l*m-u*f)),e[5]=r*(f*w-m*_)-c*(n*w-a*_)+g*(n*m-a*f),e[6]=-(r*(l*w-u*_)-o*(n*w-a*_)+g*(n*u-a*l)),e[7]=r*(l*m-u*f)-o*(n*m-a*f)+c*(n*u-a*l),e[8]=o*(d*w-m*y)-c*(s*w-u*y)+g*(s*m-u*d),e[9]=-(r*(d*w-m*y)-c*(i*w-a*y)+g*(i*m-a*d)),e[10]=r*(s*w-u*y)-o*(i*w-a*y)+g*(i*u-a*s),e[11]=-(r*(s*m-u*d)-o*(i*m-a*d)+c*(i*u-a*s)),e[12]=-(o*(d*_-f*y)-c*(s*_-l*y)+g*(s*f-l*d)),e[13]=r*(d*_-f*y)-c*(i*_-n*y)+g*(i*f-n*d),e[14]=-(r*(s*_-l*y)-o*(i*_-n*y)+g*(i*l-n*s)),e[15]=r*(s*f-l*d)-o*(i*f-n*d)+c*(i*l-n*s),e}function ice(e){var t=e[0],r=e[1],i=e[2],n=e[3],a=e[4],o=e[5],s=e[6],l=e[7],u=e[8],c=e[9],d=e[10],f=e[11],m=e[12],g=e[13],y=e[14],_=e[15],w=t*o-r*a,I=t*s-i*a,k=t*l-n*a,D=r*s-i*o,S=r*l-n*o,L=i*l-n*s,z=u*g-c*m,N=u*y-d*m,H=u*_-f*m,q=c*y-d*g,V=c*_-f*g,Q=d*_-f*y;return w*Q-I*V+k*q+D*H-S*N+L*z}function dL(e,t,r){var i=t[0],n=t[1],a=t[2],o=t[3],s=t[4],l=t[5],u=t[6],c=t[7],d=t[8],f=t[9],m=t[10],g=t[11],y=t[12],_=t[13],w=t[14],I=t[15],k=r[0],D=r[1],S=r[2],L=r[3];return e[0]=k*i+D*s+S*d+L*y,e[1]=k*n+D*l+S*f+L*_,e[2]=k*a+D*u+S*m+L*w,e[3]=k*o+D*c+S*g+L*I,k=r[4],D=r[5],S=r[6],L=r[7],e[4]=k*i+D*s+S*d+L*y,e[5]=k*n+D*l+S*f+L*_,e[6]=k*a+D*u+S*m+L*w,e[7]=k*o+D*c+S*g+L*I,k=r[8],D=r[9],S=r[10],L=r[11],e[8]=k*i+D*s+S*d+L*y,e[9]=k*n+D*l+S*f+L*_,e[10]=k*a+D*u+S*m+L*w,e[11]=k*o+D*c+S*g+L*I,k=r[12],D=r[13],S=r[14],L=r[15],e[12]=k*i+D*s+S*d+L*y,e[13]=k*n+D*l+S*f+L*_,e[14]=k*a+D*u+S*m+L*w,e[15]=k*o+D*c+S*g+L*I,e}function nce(e,t,r){var i=r[0],n=r[1],a=r[2],o,s,l,u,c,d,f,m,g,y,_,w;return t===e?(e[12]=t[0]*i+t[4]*n+t[8]*a+t[12],e[13]=t[1]*i+t[5]*n+t[9]*a+t[13],e[14]=t[2]*i+t[6]*n+t[10]*a+t[14],e[15]=t[3]*i+t[7]*n+t[11]*a+t[15]):(o=t[0],s=t[1],l=t[2],u=t[3],c=t[4],d=t[5],f=t[6],m=t[7],g=t[8],y=t[9],_=t[10],w=t[11],e[0]=o,e[1]=s,e[2]=l,e[3]=u,e[4]=c,e[5]=d,e[6]=f,e[7]=m,e[8]=g,e[9]=y,e[10]=_,e[11]=w,e[12]=o*i+c*n+g*a+t[12],e[13]=s*i+d*n+y*a+t[13],e[14]=l*i+f*n+_*a+t[14],e[15]=u*i+m*n+w*a+t[15]),e}function ace(e,t,r){var i=r[0],n=r[1],a=r[2];return e[0]=t[0]*i,e[1]=t[1]*i,e[2]=t[2]*i,e[3]=t[3]*i,e[4]=t[4]*n,e[5]=t[5]*n,e[6]=t[6]*n,e[7]=t[7]*n,e[8]=t[8]*a,e[9]=t[9]*a,e[10]=t[10]*a,e[11]=t[11]*a,e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function oce(e,t,r,i){var n=i[0],a=i[1],o=i[2],s=Math.hypot(n,a,o),l,u,c,d,f,m,g,y,_,w,I,k,D,S,L,z,N,H,q,V,Q,$,B,U;return s<qe?null:(s=1/s,n*=s,a*=s,o*=s,l=Math.sin(r),u=Math.cos(r),c=1-u,d=t[0],f=t[1],m=t[2],g=t[3],y=t[4],_=t[5],w=t[6],I=t[7],k=t[8],D=t[9],S=t[10],L=t[11],z=n*n*c+u,N=a*n*c+o*l,H=o*n*c-a*l,q=n*a*c-o*l,V=a*a*c+u,Q=o*a*c+n*l,$=n*o*c+a*l,B=a*o*c-n*l,U=o*o*c+u,e[0]=d*z+y*N+k*H,e[1]=f*z+_*N+D*H,e[2]=m*z+w*N+S*H,e[3]=g*z+I*N+L*H,e[4]=d*q+y*V+k*Q,e[5]=f*q+_*V+D*Q,e[6]=m*q+w*V+S*Q,e[7]=g*q+I*V+L*Q,e[8]=d*$+y*B+k*U,e[9]=f*$+_*B+D*U,e[10]=m*$+w*B+S*U,e[11]=g*$+I*B+L*U,t!==e&&(e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e)}function sce(e,t,r){var i=Math.sin(r),n=Math.cos(r),a=t[4],o=t[5],s=t[6],l=t[7],u=t[8],c=t[9],d=t[10],f=t[11];return t!==e&&(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[4]=a*n+u*i,e[5]=o*n+c*i,e[6]=s*n+d*i,e[7]=l*n+f*i,e[8]=u*n-a*i,e[9]=c*n-o*i,e[10]=d*n-s*i,e[11]=f*n-l*i,e}function lce(e,t,r){var i=Math.sin(r),n=Math.cos(r),a=t[0],o=t[1],s=t[2],l=t[3],u=t[8],c=t[9],d=t[10],f=t[11];return t!==e&&(e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=a*n-u*i,e[1]=o*n-c*i,e[2]=s*n-d*i,e[3]=l*n-f*i,e[8]=a*i+u*n,e[9]=o*i+c*n,e[10]=s*i+d*n,e[11]=l*i+f*n,e}function uce(e,t,r){var i=Math.sin(r),n=Math.cos(r),a=t[0],o=t[1],s=t[2],l=t[3],u=t[4],c=t[5],d=t[6],f=t[7];return t!==e&&(e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=a*n+u*i,e[1]=o*n+c*i,e[2]=s*n+d*i,e[3]=l*n+f*i,e[4]=u*n-a*i,e[5]=c*n-o*i,e[6]=d*n-s*i,e[7]=f*n-l*i,e}function cce(e,t){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=t[0],e[13]=t[1],e[14]=t[2],e[15]=1,e}function hce(e,t){return e[0]=t[0],e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=t[1],e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=t[2],e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function dce(e,t,r){var i=r[0],n=r[1],a=r[2],o=Math.hypot(i,n,a),s,l,u;return o<qe?null:(o=1/o,i*=o,n*=o,a*=o,s=Math.sin(t),l=Math.cos(t),u=1-l,e[0]=i*i*u+l,e[1]=n*i*u+a*s,e[2]=a*i*u-n*s,e[3]=0,e[4]=i*n*u-a*s,e[5]=n*n*u+l,e[6]=a*n*u+i*s,e[7]=0,e[8]=i*a*u+n*s,e[9]=n*a*u-i*s,e[10]=a*a*u+l,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e)}function pce(e,t){var r=Math.sin(t),i=Math.cos(t);return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=i,e[6]=r,e[7]=0,e[8]=0,e[9]=-r,e[10]=i,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function fce(e,t){var r=Math.sin(t),i=Math.cos(t);return e[0]=i,e[1]=0,e[2]=-r,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=r,e[9]=0,e[10]=i,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function mce(e,t){var r=Math.sin(t),i=Math.cos(t);return e[0]=i,e[1]=r,e[2]=0,e[3]=0,e[4]=-r,e[5]=i,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function x$(e,t,r){var i=t[0],n=t[1],a=t[2],o=t[3],s=i+i,l=n+n,u=a+a,c=i*s,d=i*l,f=i*u,m=n*l,g=n*u,y=a*u,_=o*s,w=o*l,I=o*u;return e[0]=1-(m+y),e[1]=d+I,e[2]=f-w,e[3]=0,e[4]=d-I,e[5]=1-(c+y),e[6]=g+_,e[7]=0,e[8]=f+w,e[9]=g-_,e[10]=1-(c+m),e[11]=0,e[12]=r[0],e[13]=r[1],e[14]=r[2],e[15]=1,e}function gce(e,t){var r=new zt(3),i=-t[0],n=-t[1],a=-t[2],o=t[3],s=t[4],l=t[5],u=t[6],c=t[7],d=i*i+n*n+a*a+o*o;return d>0?(r[0]=(s*o+c*i+l*a-u*n)*2/d,r[1]=(l*o+c*n+u*i-s*a)*2/d,r[2]=(u*o+c*a+s*n-l*i)*2/d):(r[0]=(s*o+c*i+l*a-u*n)*2,r[1]=(l*o+c*n+u*i-s*a)*2,r[2]=(u*o+c*a+s*n-l*i)*2),x$(e,t,r),e}function Ace(e,t){return e[0]=t[12],e[1]=t[13],e[2]=t[14],e}function _$(e,t){var r=t[0],i=t[1],n=t[2],a=t[4],o=t[5],s=t[6],l=t[8],u=t[9],c=t[10];return e[0]=Math.hypot(r,i,n),e[1]=Math.hypot(a,o,s),e[2]=Math.hypot(l,u,c),e}function yce(e,t){var r=new zt(3);_$(r,t);var i=1/r[0],n=1/r[1],a=1/r[2],o=t[0]*i,s=t[1]*n,l=t[2]*a,u=t[4]*i,c=t[5]*n,d=t[6]*a,f=t[8]*i,m=t[9]*n,g=t[10]*a,y=o+c+g,_=0;return y>0?(_=Math.sqrt(y+1)*2,e[3]=.25*_,e[0]=(d-m)/_,e[1]=(f-l)/_,e[2]=(s-u)/_):o>c&&o>g?(_=Math.sqrt(1+o-c-g)*2,e[3]=(d-m)/_,e[0]=.25*_,e[1]=(s+u)/_,e[2]=(f+l)/_):c>g?(_=Math.sqrt(1+c-o-g)*2,e[3]=(f-l)/_,e[0]=(s+u)/_,e[1]=.25*_,e[2]=(d+m)/_):(_=Math.sqrt(1+g-o-c)*2,e[3]=(s-u)/_,e[0]=(f+l)/_,e[1]=(d+m)/_,e[2]=.25*_),e}function vce(e,t,r,i){var n=t[0],a=t[1],o=t[2],s=t[3],l=n+n,u=a+a,c=o+o,d=n*l,f=n*u,m=n*c,g=a*u,y=a*c,_=o*c,w=s*l,I=s*u,k=s*c,D=i[0],S=i[1],L=i[2];return e[0]=(1-(g+_))*D,e[1]=(f+k)*D,e[2]=(m-I)*D,e[3]=0,e[4]=(f-k)*S,e[5]=(1-(d+_))*S,e[6]=(y+w)*S,e[7]=0,e[8]=(m+I)*L,e[9]=(y-w)*L,e[10]=(1-(d+g))*L,e[11]=0,e[12]=r[0],e[13]=r[1],e[14]=r[2],e[15]=1,e}function xce(e,t,r,i,n){var a=t[0],o=t[1],s=t[2],l=t[3],u=a+a,c=o+o,d=s+s,f=a*u,m=a*c,g=a*d,y=o*c,_=o*d,w=s*d,I=l*u,k=l*c,D=l*d,S=i[0],L=i[1],z=i[2],N=n[0],H=n[1],q=n[2],V=(1-(y+w))*S,Q=(m+D)*S,$=(g-k)*S,B=(m-D)*L,U=(1-(f+w))*L,X=(_+I)*L,ne=(g+k)*z,ce=(_-I)*z,xe=(1-(f+y))*z;return e[0]=V,e[1]=Q,e[2]=$,e[3]=0,e[4]=B,e[5]=U,e[6]=X,e[7]=0,e[8]=ne,e[9]=ce,e[10]=xe,e[11]=0,e[12]=r[0]+N-(V*N+B*H+ne*q),e[13]=r[1]+H-(Q*N+U*H+ce*q),e[14]=r[2]+q-($*N+X*H+xe*q),e[15]=1,e}function _ce(e,t){var r=t[0],i=t[1],n=t[2],a=t[3],o=r+r,s=i+i,l=n+n,u=r*o,c=i*o,d=i*s,f=n*o,m=n*s,g=n*l,y=a*o,_=a*s,w=a*l;return e[0]=1-d-g,e[1]=c+w,e[2]=f-_,e[3]=0,e[4]=c-w,e[5]=1-u-g,e[6]=m+y,e[7]=0,e[8]=f+_,e[9]=m-y,e[10]=1-u-d,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function bce(e,t,r,i,n,a,o){var s=1/(r-t),l=1/(n-i),u=1/(a-o);return e[0]=a*2*s,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=a*2*l,e[6]=0,e[7]=0,e[8]=(r+t)*s,e[9]=(n+i)*l,e[10]=(o+a)*u,e[11]=-1,e[12]=0,e[13]=0,e[14]=o*a*2*u,e[15]=0,e}function pL(e,t,r,i,n){var a=1/Math.tan(t/2),o;return e[0]=a/r,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=a,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,n!=null&&n!==1/0?(o=1/(i-n),e[10]=(n+i)*o,e[14]=2*n*i*o):(e[10]=-1,e[14]=-2*i),e}function wce(e,t,r,i,n){var a=1/Math.tan(t/2),o;return e[0]=a/r,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=a,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,n!=null&&n!==1/0?(o=1/(i-n),e[10]=n*o,e[14]=n*i*o):(e[10]=-1,e[14]=-i),e}function Ece(e,t,r,i){var n=Math.tan(t.upDegrees*Math.PI/180),a=Math.tan(t.downDegrees*Math.PI/180),o=Math.tan(t.leftDegrees*Math.PI/180),s=Math.tan(t.rightDegrees*Math.PI/180),l=2/(o+s),u=2/(n+a);return e[0]=l,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=u,e[6]=0,e[7]=0,e[8]=-((o-s)*l*.5),e[9]=(n-a)*u*.5,e[10]=i/(r-i),e[11]=-1,e[12]=0,e[13]=0,e[14]=i*r/(r-i),e[15]=0,e}function fL(e,t,r,i,n,a,o){var s=1/(t-r),l=1/(i-n),u=1/(a-o);return e[0]=-2*s,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*l,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=2*u,e[11]=0,e[12]=(t+r)*s,e[13]=(n+i)*l,e[14]=(o+a)*u,e[15]=1,e}function Cce(e,t,r,i,n,a,o){var s=1/(t-r),l=1/(i-n),u=1/(a-o);return e[0]=-2*s,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*l,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=u,e[11]=0,e[12]=(t+r)*s,e[13]=(n+i)*l,e[14]=a*u,e[15]=1,e}function Mce(e,t,r,i){var n,a,o,s,l,u,c,d,f,m,g=t[0],y=t[1],_=t[2],w=i[0],I=i[1],k=i[2],D=r[0],S=r[1],L=r[2];return Math.abs(g-D)<qe&&Math.abs(y-S)<qe&&Math.abs(_-L)<qe?v$(e):(c=g-D,d=y-S,f=_-L,m=1/Math.hypot(c,d,f),c*=m,d*=m,f*=m,n=I*f-k*d,a=k*c-w*f,o=w*d-I*c,m=Math.hypot(n,a,o),m?(m=1/m,n*=m,a*=m,o*=m):(n=0,a=0,o=0),s=d*o-f*a,l=f*n-c*o,u=c*a-d*n,m=Math.hypot(s,l,u),m?(m=1/m,s*=m,l*=m,u*=m):(s=0,l=0,u=0),e[0]=n,e[1]=s,e[2]=c,e[3]=0,e[4]=a,e[5]=l,e[6]=d,e[7]=0,e[8]=o,e[9]=u,e[10]=f,e[11]=0,e[12]=-(n*g+a*y+o*_),e[13]=-(s*g+l*y+u*_),e[14]=-(c*g+d*y+f*_),e[15]=1,e)}function Sce(e,t,r,i){var n=t[0],a=t[1],o=t[2],s=i[0],l=i[1],u=i[2],c=n-r[0],d=a-r[1],f=o-r[2],m=c*c+d*d+f*f;m>0&&(m=1/Math.sqrt(m),c*=m,d*=m,f*=m);var g=l*f-u*d,y=u*c-s*f,_=s*d-l*c;return m=g*g+y*y+_*_,m>0&&(m=1/Math.sqrt(m),g*=m,y*=m,_*=m),e[0]=g,e[1]=y,e[2]=_,e[3]=0,e[4]=d*_-f*y,e[5]=f*g-c*_,e[6]=c*y-d*g,e[7]=0,e[8]=c,e[9]=d,e[10]=f,e[11]=0,e[12]=n,e[13]=a,e[14]=o,e[15]=1,e}function Ice(e){return"mat4("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+", "+e[4]+", "+e[5]+", "+e[6]+", "+e[7]+", "+e[8]+", "+e[9]+", "+e[10]+", "+e[11]+", "+e[12]+", "+e[13]+", "+e[14]+", "+e[15]+")"}function Bce(e){return Math.hypot(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15])}function Dce(e,t,r){return e[0]=t[0]+r[0],e[1]=t[1]+r[1],e[2]=t[2]+r[2],e[3]=t[3]+r[3],e[4]=t[4]+r[4],e[5]=t[5]+r[5],e[6]=t[6]+r[6],e[7]=t[7]+r[7],e[8]=t[8]+r[8],e[9]=t[9]+r[9],e[10]=t[10]+r[10],e[11]=t[11]+r[11],e[12]=t[12]+r[12],e[13]=t[13]+r[13],e[14]=t[14]+r[14],e[15]=t[15]+r[15],e}function mL(e,t,r){return e[0]=t[0]-r[0],e[1]=t[1]-r[1],e[2]=t[2]-r[2],e[3]=t[3]-r[3],e[4]=t[4]-r[4],e[5]=t[5]-r[5],e[6]=t[6]-r[6],e[7]=t[7]-r[7],e[8]=t[8]-r[8],e[9]=t[9]-r[9],e[10]=t[10]-r[10],e[11]=t[11]-r[11],e[12]=t[12]-r[12],e[13]=t[13]-r[13],e[14]=t[14]-r[14],e[15]=t[15]-r[15],e}function Tce(e,t,r){return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e[3]=t[3]*r,e[4]=t[4]*r,e[5]=t[5]*r,e[6]=t[6]*r,e[7]=t[7]*r,e[8]=t[8]*r,e[9]=t[9]*r,e[10]=t[10]*r,e[11]=t[11]*r,e[12]=t[12]*r,e[13]=t[13]*r,e[14]=t[14]*r,e[15]=t[15]*r,e}function Pce(e,t,r,i){return e[0]=t[0]+r[0]*i,e[1]=t[1]+r[1]*i,e[2]=t[2]+r[2]*i,e[3]=t[3]+r[3]*i,e[4]=t[4]+r[4]*i,e[5]=t[5]+r[5]*i,e[6]=t[6]+r[6]*i,e[7]=t[7]+r[7]*i,e[8]=t[8]+r[8]*i,e[9]=t[9]+r[9]*i,e[10]=t[10]+r[10]*i,e[11]=t[11]+r[11]*i,e[12]=t[12]+r[12]*i,e[13]=t[13]+r[13]*i,e[14]=t[14]+r[14]*i,e[15]=t[15]+r[15]*i,e}function kce(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]&&e[4]===t[4]&&e[5]===t[5]&&e[6]===t[6]&&e[7]===t[7]&&e[8]===t[8]&&e[9]===t[9]&&e[10]===t[10]&&e[11]===t[11]&&e[12]===t[12]&&e[13]===t[13]&&e[14]===t[14]&&e[15]===t[15]}function Fce(e,t){var r=e[0],i=e[1],n=e[2],a=e[3],o=e[4],s=e[5],l=e[6],u=e[7],c=e[8],d=e[9],f=e[10],m=e[11],g=e[12],y=e[13],_=e[14],w=e[15],I=t[0],k=t[1],D=t[2],S=t[3],L=t[4],z=t[5],N=t[6],H=t[7],q=t[8],V=t[9],Q=t[10],$=t[11],B=t[12],U=t[13],X=t[14],ne=t[15];return Math.abs(r-I)<=qe*Math.max(1,Math.abs(r),Math.abs(I))&&Math.abs(i-k)<=qe*Math.max(1,Math.abs(i),Math.abs(k))&&Math.abs(n-D)<=qe*Math.max(1,Math.abs(n),Math.abs(D))&&Math.abs(a-S)<=qe*Math.max(1,Math.abs(a),Math.abs(S))&&Math.abs(o-L)<=qe*Math.max(1,Math.abs(o),Math.abs(L))&&Math.abs(s-z)<=qe*Math.max(1,Math.abs(s),Math.abs(z))&&Math.abs(l-N)<=qe*Math.max(1,Math.abs(l),Math.abs(N))&&Math.abs(u-H)<=qe*Math.max(1,Math.abs(u),Math.abs(H))&&Math.abs(c-q)<=qe*Math.max(1,Math.abs(c),Math.abs(q))&&Math.abs(d-V)<=qe*Math.max(1,Math.abs(d),Math.abs(V))&&Math.abs(f-Q)<=qe*Math.max(1,Math.abs(f),Math.abs(Q))&&Math.abs(m-$)<=qe*Math.max(1,Math.abs(m),Math.abs($))&&Math.abs(g-B)<=qe*Math.max(1,Math.abs(g),Math.abs(B))&&Math.abs(y-U)<=qe*Math.max(1,Math.abs(y),Math.abs(U))&&Math.abs(_-X)<=qe*Math.max(1,Math.abs(_),Math.abs(X))&&Math.abs(w-ne)<=qe*Math.max(1,Math.abs(w),Math.abs(ne))}function ew(){var e=new zt(3);return zt!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function Rce(e){var t=new zt(3);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t}function gL(e){var t=e[0],r=e[1],i=e[2];return Math.hypot(t,r,i)}function tw(e,t,r){var i=new zt(3);return i[0]=e,i[1]=t,i[2]=r,i}function Lce(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e}function zce(e,t,r,i){return e[0]=t,e[1]=r,e[2]=i,e}function Oce(e,t,r){return e[0]=t[0]+r[0],e[1]=t[1]+r[1],e[2]=t[2]+r[2],e}function AL(e,t,r){return e[0]=t[0]-r[0],e[1]=t[1]-r[1],e[2]=t[2]-r[2],e}function yL(e,t,r){return e[0]=t[0]*r[0],e[1]=t[1]*r[1],e[2]=t[2]*r[2],e}function vL(e,t,r){return e[0]=t[0]/r[0],e[1]=t[1]/r[1],e[2]=t[2]/r[2],e}function Nce(e,t){return e[0]=Math.ceil(t[0]),e[1]=Math.ceil(t[1]),e[2]=Math.ceil(t[2]),e}function Uce(e,t){return e[0]=Math.floor(t[0]),e[1]=Math.floor(t[1]),e[2]=Math.floor(t[2]),e}function jce(e,t,r){return e[0]=Math.min(t[0],r[0]),e[1]=Math.min(t[1],r[1]),e[2]=Math.min(t[2],r[2]),e}function Vce(e,t,r){return e[0]=Math.max(t[0],r[0]),e[1]=Math.max(t[1],r[1]),e[2]=Math.max(t[2],r[2]),e}function Qce(e,t){return e[0]=Math.round(t[0]),e[1]=Math.round(t[1]),e[2]=Math.round(t[2]),e}function Gce(e,t,r){return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e}function Yce(e,t,r,i){return e[0]=t[0]+r[0]*i,e[1]=t[1]+r[1]*i,e[2]=t[2]+r[2]*i,e}function xL(e,t){var r=t[0]-e[0],i=t[1]-e[1],n=t[2]-e[2];return Math.hypot(r,i,n)}function _L(e,t){var r=t[0]-e[0],i=t[1]-e[1],n=t[2]-e[2];return r*r+i*i+n*n}function bL(e){var t=e[0],r=e[1],i=e[2];return t*t+r*r+i*i}function Hce(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e}function Wce(e,t){return e[0]=1/t[0],e[1]=1/t[1],e[2]=1/t[2],e}function wL(e,t){var r=t[0],i=t[1],n=t[2],a=r*r+i*i+n*n;return a>0&&(a=1/Math.sqrt(a)),e[0]=t[0]*a,e[1]=t[1]*a,e[2]=t[2]*a,e}function EC(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function U0(e,t,r){var i=t[0],n=t[1],a=t[2],o=r[0],s=r[1],l=r[2];return e[0]=n*l-a*s,e[1]=a*o-i*l,e[2]=i*s-n*o,e}function $ce(e,t,r,i){var n=t[0],a=t[1],o=t[2];return e[0]=n+i*(r[0]-n),e[1]=a+i*(r[1]-a),e[2]=o+i*(r[2]-o),e}function Zce(e,t,r,i,n,a){var o=a*a,s=o*(2*a-3)+1,l=o*(a-2)+a,u=o*(a-1),c=o*(3-2*a);return e[0]=t[0]*s+r[0]*l+i[0]*u+n[0]*c,e[1]=t[1]*s+r[1]*l+i[1]*u+n[1]*c,e[2]=t[2]*s+r[2]*l+i[2]*u+n[2]*c,e}function Xce(e,t,r,i,n,a){var o=1-a,s=o*o,l=a*a,u=s*o,c=3*a*s,d=3*l*o,f=l*a;return e[0]=t[0]*u+r[0]*c+i[0]*d+n[0]*f,e[1]=t[1]*u+r[1]*c+i[1]*d+n[1]*f,e[2]=t[2]*u+r[2]*c+i[2]*d+n[2]*f,e}function Jce(e,t){t=t||1;var r=Ra()*2*Math.PI,i=Ra()*2-1,n=Math.sqrt(1-i*i)*t;return e[0]=Math.cos(r)*n,e[1]=Math.sin(r)*n,e[2]=i*t,e}function qce(e,t,r){var i=t[0],n=t[1],a=t[2],o=r[3]*i+r[7]*n+r[11]*a+r[15];return o=o||1,e[0]=(r[0]*i+r[4]*n+r[8]*a+r[12])/o,e[1]=(r[1]*i+r[5]*n+r[9]*a+r[13])/o,e[2]=(r[2]*i+r[6]*n+r[10]*a+r[14])/o,e}function Kce(e,t,r){var i=t[0],n=t[1],a=t[2];return e[0]=i*r[0]+n*r[3]+a*r[6],e[1]=i*r[1]+n*r[4]+a*r[7],e[2]=i*r[2]+n*r[5]+a*r[8],e}function ehe(e,t,r){var i=r[0],n=r[1],a=r[2],o=r[3],s=t[0],l=t[1],u=t[2],c=n*u-a*l,d=a*s-i*u,f=i*l-n*s,m=n*f-a*d,g=a*c-i*f,y=i*d-n*c,_=o*2;return c*=_,d*=_,f*=_,m*=2,g*=2,y*=2,e[0]=s+c+m,e[1]=l+d+g,e[2]=u+f+y,e}function the(e,t,r,i){var n=[],a=[];return n[0]=t[0]-r[0],n[1]=t[1]-r[1],n[2]=t[2]-r[2],a[0]=n[0],a[1]=n[1]*Math.cos(i)-n[2]*Math.sin(i),a[2]=n[1]*Math.sin(i)+n[2]*Math.cos(i),e[0]=a[0]+r[0],e[1]=a[1]+r[1],e[2]=a[2]+r[2],e}function rhe(e,t,r,i){var n=[],a=[];return n[0]=t[0]-r[0],n[1]=t[1]-r[1],n[2]=t[2]-r[2],a[0]=n[2]*Math.sin(i)+n[0]*Math.cos(i),a[1]=n[1],a[2]=n[2]*Math.cos(i)-n[0]*Math.sin(i),e[0]=a[0]+r[0],e[1]=a[1]+r[1],e[2]=a[2]+r[2],e}function ihe(e,t,r,i){var n=[],a=[];return n[0]=t[0]-r[0],n[1]=t[1]-r[1],n[2]=t[2]-r[2],a[0]=n[0]*Math.cos(i)-n[1]*Math.sin(i),a[1]=n[0]*Math.sin(i)+n[1]*Math.cos(i),a[2]=n[2],e[0]=a[0]+r[0],e[1]=a[1]+r[1],e[2]=a[2]+r[2],e}function nhe(e,t){var r=e[0],i=e[1],n=e[2],a=t[0],o=t[1],s=t[2],l=Math.sqrt(r*r+i*i+n*n),u=Math.sqrt(a*a+o*o+s*s),c=l*u,d=c&&EC(e,t)/c;return Math.acos(Math.min(Math.max(d,-1),1))}function ahe(e){return e[0]=0,e[1]=0,e[2]=0,e}function ohe(e){return"vec3("+e[0]+", "+e[1]+", "+e[2]+")"}function she(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]}function lhe(e,t){var r=e[0],i=e[1],n=e[2],a=t[0],o=t[1],s=t[2];return Math.abs(r-a)<=qe*Math.max(1,Math.abs(r),Math.abs(a))&&Math.abs(i-o)<=qe*Math.max(1,Math.abs(i),Math.abs(o))&&Math.abs(n-s)<=qe*Math.max(1,Math.abs(n),Math.abs(s))}function EL(){var e=new zt(4);return zt!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0,e[3]=0),e}function CL(e){var t=new zt(4);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t}function ML(e,t,r,i){var n=new zt(4);return n[0]=e,n[1]=t,n[2]=r,n[3]=i,n}function SL(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e}function IL(e,t,r,i,n){return e[0]=t,e[1]=r,e[2]=i,e[3]=n,e}function BL(e,t,r){return e[0]=t[0]+r[0],e[1]=t[1]+r[1],e[2]=t[2]+r[2],e[3]=t[3]+r[3],e}function DL(e,t,r){return e[0]=t[0]-r[0],e[1]=t[1]-r[1],e[2]=t[2]-r[2],e[3]=t[3]-r[3],e}function TL(e,t,r){return e[0]=t[0]*r[0],e[1]=t[1]*r[1],e[2]=t[2]*r[2],e[3]=t[3]*r[3],e}function PL(e,t,r){return e[0]=t[0]/r[0],e[1]=t[1]/r[1],e[2]=t[2]/r[2],e[3]=t[3]/r[3],e}function uhe(e,t){return e[0]=Math.ceil(t[0]),e[1]=Math.ceil(t[1]),e[2]=Math.ceil(t[2]),e[3]=Math.ceil(t[3]),e}function che(e,t){return e[0]=Math.floor(t[0]),e[1]=Math.floor(t[1]),e[2]=Math.floor(t[2]),e[3]=Math.floor(t[3]),e}function hhe(e,t,r){return e[0]=Math.min(t[0],r[0]),e[1]=Math.min(t[1],r[1]),e[2]=Math.min(t[2],r[2]),e[3]=Math.min(t[3],r[3]),e}function dhe(e,t,r){return e[0]=Math.max(t[0],r[0]),e[1]=Math.max(t[1],r[1]),e[2]=Math.max(t[2],r[2]),e[3]=Math.max(t[3],r[3]),e}function phe(e,t){return e[0]=Math.round(t[0]),e[1]=Math.round(t[1]),e[2]=Math.round(t[2]),e[3]=Math.round(t[3]),e}function kL(e,t,r){return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e[3]=t[3]*r,e}function fhe(e,t,r,i){return e[0]=t[0]+r[0]*i,e[1]=t[1]+r[1]*i,e[2]=t[2]+r[2]*i,e[3]=t[3]+r[3]*i,e}function FL(e,t){var r=t[0]-e[0],i=t[1]-e[1],n=t[2]-e[2],a=t[3]-e[3];return Math.hypot(r,i,n,a)}function RL(e,t){var r=t[0]-e[0],i=t[1]-e[1],n=t[2]-e[2],a=t[3]-e[3];return r*r+i*i+n*n+a*a}function rw(e){var t=e[0],r=e[1],i=e[2],n=e[3];return Math.hypot(t,r,i,n)}function iw(e){var t=e[0],r=e[1],i=e[2],n=e[3];return t*t+r*r+i*i+n*n}function mhe(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=-t[3],e}function ghe(e,t){return e[0]=1/t[0],e[1]=1/t[1],e[2]=1/t[2],e[3]=1/t[3],e}function LL(e,t){var r=t[0],i=t[1],n=t[2],a=t[3],o=r*r+i*i+n*n+a*a;return o>0&&(o=1/Math.sqrt(o)),e[0]=r*o,e[1]=i*o,e[2]=n*o,e[3]=a*o,e}function zL(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]*t[3]}function Ahe(e,t,r,i){var n=r[0]*i[1]-r[1]*i[0],a=r[0]*i[2]-r[2]*i[0],o=r[0]*i[3]-r[3]*i[0],s=r[1]*i[2]-r[2]*i[1],l=r[1]*i[3]-r[3]*i[1],u=r[2]*i[3]-r[3]*i[2],c=t[0],d=t[1],f=t[2],m=t[3];return e[0]=d*u-f*l+m*s,e[1]=-(c*u)+f*o-m*a,e[2]=c*l-d*o+m*n,e[3]=-(c*s)+d*a-f*n,e}function OL(e,t,r,i){var n=t[0],a=t[1],o=t[2],s=t[3];return e[0]=n+i*(r[0]-n),e[1]=a+i*(r[1]-a),e[2]=o+i*(r[2]-o),e[3]=s+i*(r[3]-s),e}function yhe(e,t){t=t||1;var r,i,n,a,o,s;do r=Ra()*2-1,i=Ra()*2-1,o=r*r+i*i;while(o>=1);do n=Ra()*2-1,a=Ra()*2-1,s=n*n+a*a;while(s>=1);var l=Math.sqrt((1-o)/s);return e[0]=t*r,e[1]=t*i,e[2]=t*n*l,e[3]=t*a*l,e}function vhe(e,t,r){var i=t[0],n=t[1],a=t[2],o=t[3];return e[0]=r[0]*i+r[4]*n+r[8]*a+r[12]*o,e[1]=r[1]*i+r[5]*n+r[9]*a+r[13]*o,e[2]=r[2]*i+r[6]*n+r[10]*a+r[14]*o,e[3]=r[3]*i+r[7]*n+r[11]*a+r[15]*o,e}function xhe(e,t,r){var i=t[0],n=t[1],a=t[2],o=r[0],s=r[1],l=r[2],u=r[3],c=u*i+s*a-l*n,d=u*n+l*i-o*a,f=u*a+o*n-s*i,m=-o*i-s*n-l*a;return e[0]=c*u+m*-o+d*-l-f*-s,e[1]=d*u+m*-s+f*-o-c*-l,e[2]=f*u+m*-l+c*-s-d*-o,e[3]=t[3],e}function _he(e){return e[0]=0,e[1]=0,e[2]=0,e[3]=0,e}function bhe(e){return"vec4("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+")"}function NL(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]}function UL(e,t){var r=e[0],i=e[1],n=e[2],a=e[3],o=t[0],s=t[1],l=t[2],u=t[3];return Math.abs(r-o)<=qe*Math.max(1,Math.abs(r),Math.abs(o))&&Math.abs(i-s)<=qe*Math.max(1,Math.abs(i),Math.abs(s))&&Math.abs(n-l)<=qe*Math.max(1,Math.abs(n),Math.abs(l))&&Math.abs(a-u)<=qe*Math.max(1,Math.abs(a),Math.abs(u))}function nw(){var e=new zt(4);return zt!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e[3]=1,e}function whe(e){return e[0]=0,e[1]=0,e[2]=0,e[3]=1,e}function jL(e,t,r){r=r*.5;var i=Math.sin(r);return e[0]=i*t[0],e[1]=i*t[1],e[2]=i*t[2],e[3]=Math.cos(r),e}function Ehe(e,t){var r=Math.acos(t[3])*2,i=Math.sin(r/2);return i>qe?(e[0]=t[0]/i,e[1]=t[1]/i,e[2]=t[2]/i):(e[0]=1,e[1]=0,e[2]=0),r}function Che(e,t){var r=UC(e,t);return Math.acos(2*r*r-1)}function VL(e,t,r){var i=t[0],n=t[1],a=t[2],o=t[3],s=r[0],l=r[1],u=r[2],c=r[3];return e[0]=i*c+o*s+n*u-a*l,e[1]=n*c+o*l+a*s-i*u,e[2]=a*c+o*u+i*l-n*s,e[3]=o*c-i*s-n*l-a*u,e}function Mhe(e,t,r){r*=.5;var i=t[0],n=t[1],a=t[2],o=t[3],s=Math.sin(r),l=Math.cos(r);return e[0]=i*l+o*s,e[1]=n*l+a*s,e[2]=a*l-n*s,e[3]=o*l-i*s,e}function She(e,t,r){r*=.5;var i=t[0],n=t[1],a=t[2],o=t[3],s=Math.sin(r),l=Math.cos(r);return e[0]=i*l-a*s,e[1]=n*l+o*s,e[2]=a*l+i*s,e[3]=o*l-n*s,e}function Ihe(e,t,r){r*=.5;var i=t[0],n=t[1],a=t[2],o=t[3],s=Math.sin(r),l=Math.cos(r);return e[0]=i*l+n*s,e[1]=n*l-i*s,e[2]=a*l+o*s,e[3]=o*l-a*s,e}function Bhe(e,t){var r=t[0],i=t[1],n=t[2];return e[0]=r,e[1]=i,e[2]=n,e[3]=Math.sqrt(Math.abs(1-r*r-i*i-n*n)),e}function b$(e,t){var r=t[0],i=t[1],n=t[2],a=t[3],o=Math.sqrt(r*r+i*i+n*n),s=Math.exp(a),l=o>0?s*Math.sin(o)/o:0;return e[0]=r*l,e[1]=i*l,e[2]=n*l,e[3]=s*Math.cos(o),e}function w$(e,t){var r=t[0],i=t[1],n=t[2],a=t[3],o=Math.sqrt(r*r+i*i+n*n),s=o>0?Math.atan2(o,a)/o:0;return e[0]=r*s,e[1]=i*s,e[2]=n*s,e[3]=.5*Math.log(r*r+i*i+n*n+a*a),e}function Dhe(e,t,r){return w$(e,t),NC(e,e,r),b$(e,e),e}function j0(e,t,r,i){var n=t[0],a=t[1],o=t[2],s=t[3],l=r[0],u=r[1],c=r[2],d=r[3],f,m,g,y,_;return m=n*l+a*u+o*c+s*d,m<0&&(m=-m,l=-l,u=-u,c=-c,d=-d),1-m>qe?(f=Math.acos(m),g=Math.sin(f),y=Math.sin((1-i)*f)/g,_=Math.sin(i*f)/g):(y=1-i,_=i),e[0]=y*n+_*l,e[1]=y*a+_*u,e[2]=y*o+_*c,e[3]=y*s+_*d,e}function The(e){var t=Ra(),r=Ra(),i=Ra(),n=Math.sqrt(1-t),a=Math.sqrt(t);return e[0]=n*Math.sin(2*Math.PI*r),e[1]=n*Math.cos(2*Math.PI*r),e[2]=a*Math.sin(2*Math.PI*i),e[3]=a*Math.cos(2*Math.PI*i),e}function Phe(e,t){var r=t[0],i=t[1],n=t[2],a=t[3],o=r*r+i*i+n*n+a*a,s=o?1/o:0;return e[0]=-r*s,e[1]=-i*s,e[2]=-n*s,e[3]=a*s,e}function khe(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=t[3],e}function QL(e,t){var r=t[0]+t[4]+t[8],i;if(r>0)i=Math.sqrt(r+1),e[3]=.5*i,i=.5/i,e[0]=(t[5]-t[7])*i,e[1]=(t[6]-t[2])*i,e[2]=(t[1]-t[3])*i;else{var n=0;t[4]>t[0]&&(n=1),t[8]>t[n*3+n]&&(n=2);var a=(n+1)%3,o=(n+2)%3;i=Math.sqrt(t[n*3+n]-t[a*3+a]-t[o*3+o]+1),e[n]=.5*i,i=.5/i,e[3]=(t[a*3+o]-t[o*3+a])*i,e[a]=(t[a*3+n]+t[n*3+a])*i,e[o]=(t[o*3+n]+t[n*3+o])*i}return e}function Fhe(e,t,r,i){var n=.5*Math.PI/180;t*=n,r*=n,i*=n;var a=Math.sin(t),o=Math.cos(t),s=Math.sin(r),l=Math.cos(r),u=Math.sin(i),c=Math.cos(i);return e[0]=a*l*c-o*s*u,e[1]=o*s*c+a*l*u,e[2]=o*l*u-a*s*c,e[3]=o*l*c+a*s*u,e}function Rhe(e){return"quat("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+")"}function GL(){var e=new zt(2);return zt!=Float32Array&&(e[0]=0,e[1]=0),e}function Lhe(e){var t=new zt(2);return t[0]=e[0],t[1]=e[1],t}function zhe(e,t){var r=new zt(2);return r[0]=e,r[1]=t,r}function Ohe(e,t){return e[0]=t[0],e[1]=t[1],e}function Nhe(e,t,r){return e[0]=t,e[1]=r,e}function Uhe(e,t,r){return e[0]=t[0]+r[0],e[1]=t[1]+r[1],e}function YL(e,t,r){return e[0]=t[0]-r[0],e[1]=t[1]-r[1],e}function HL(e,t,r){return e[0]=t[0]*r[0],e[1]=t[1]*r[1],e}function WL(e,t,r){return e[0]=t[0]/r[0],e[1]=t[1]/r[1],e}function jhe(e,t){return e[0]=Math.ceil(t[0]),e[1]=Math.ceil(t[1]),e}function Vhe(e,t){return e[0]=Math.floor(t[0]),e[1]=Math.floor(t[1]),e}function Qhe(e,t,r){return e[0]=Math.min(t[0],r[0]),e[1]=Math.min(t[1],r[1]),e}function Ghe(e,t,r){return e[0]=Math.max(t[0],r[0]),e[1]=Math.max(t[1],r[1]),e}function Yhe(e,t){return e[0]=Math.round(t[0]),e[1]=Math.round(t[1]),e}function Hhe(e,t,r){return e[0]=t[0]*r,e[1]=t[1]*r,e}function Whe(e,t,r,i){return e[0]=t[0]+r[0]*i,e[1]=t[1]+r[1]*i,e}function $L(e,t){var r=t[0]-e[0],i=t[1]-e[1];return Math.hypot(r,i)}function ZL(e,t){var r=t[0]-e[0],i=t[1]-e[1];return r*r+i*i}function XL(e){var t=e[0],r=e[1];return Math.hypot(t,r)}function JL(e){var t=e[0],r=e[1];return t*t+r*r}function $he(e,t){return e[0]=-t[0],e[1]=-t[1],e}function Zhe(e,t){return e[0]=1/t[0],e[1]=1/t[1],e}function Xhe(e,t){var r=t[0],i=t[1],n=r*r+i*i;return n>0&&(n=1/Math.sqrt(n)),e[0]=t[0]*n,e[1]=t[1]*n,e}function Jhe(e,t){return e[0]*t[0]+e[1]*t[1]}function qhe(e,t,r){var i=t[0]*r[1]-t[1]*r[0];return e[0]=e[1]=0,e[2]=i,e}function Khe(e,t,r,i){var n=t[0],a=t[1];return e[0]=n+i*(r[0]-n),e[1]=a+i*(r[1]-a),e}function ede(e,t){t=t||1;var r=Ra()*2*Math.PI;return e[0]=Math.cos(r)*t,e[1]=Math.sin(r)*t,e}function tde(e,t,r){var i=t[0],n=t[1];return e[0]=r[0]*i+r[2]*n,e[1]=r[1]*i+r[3]*n,e}function rde(e,t,r){var i=t[0],n=t[1];return e[0]=r[0]*i+r[2]*n+r[4],e[1]=r[1]*i+r[3]*n+r[5],e}function ide(e,t,r){var i=t[0],n=t[1];return e[0]=r[0]*i+r[3]*n+r[6],e[1]=r[1]*i+r[4]*n+r[7],e}function nde(e,t,r){var i=t[0],n=t[1];return e[0]=r[0]*i+r[4]*n+r[12],e[1]=r[1]*i+r[5]*n+r[13],e}function ade(e,t,r,i){var n=t[0]-r[0],a=t[1]-r[1],o=Math.sin(i),s=Math.cos(i);return e[0]=n*s-a*o+r[0],e[1]=n*o+a*s+r[1],e}function ode(e,t){var r=e[0],i=e[1],n=t[0],a=t[1],o=Math.sqrt(r*r+i*i)*Math.sqrt(n*n+a*a),s=o&&(r*n+i*a)/o;return Math.acos(Math.min(Math.max(s,-1),1))}function sde(e){return e[0]=0,e[1]=0,e}function lde(e){return"vec2("+e[0]+", "+e[1]+")"}function ude(e,t){return e[0]===t[0]&&e[1]===t[1]}function cde(e,t){var r=e[0],i=e[1],n=t[0],a=t[1];return Math.abs(r-n)<=qe*Math.max(1,Math.abs(r),Math.abs(n))&&Math.abs(i-a)<=qe*Math.max(1,Math.abs(i),Math.abs(a))}function hde(e){if(e<=0)return 0;if(e>=1)return 1;let t=e*e,r=t*e;return 4*(e<.5?r:3*(e-t)+r-.75)}function qL(e,t,r,i){let n=new nZ.default(e,t,r,i);return a=>n.solve(a)}function Hf(e,t,r){return Math.min(r,Math.max(t,e))}function dde(e,t,r){let i=r-t,n=((e-t)%i+i)%i+t;return n===t?r:n}function pde(e,t){let r=[];for(let i in e)i in t||r.push(i);return r}function Ct(e,...t){for(let r of t)for(let i in r)e[i]=r[i];return e}function CC(e,t){let r={};for(let i=0;i<t.length;i++){let n=t[i];n in e&&(r[n]=e[n])}return r}function fde(){return aZ++}function gh(e){return Math.log(e)/Math.LN2}function mde(e,t,r){let i={};for(let n in e)i[n]=t.call(r||this,e[n],n,e);return i}function Bp(e){VC[e]||(typeof console<"u"&&console.warn(e),VC[e]=!0)}function V0(e,t,r){return(r.y-e.y)*(t.x-e.x)>(t.y-e.y)*(r.x-e.x)}function Mc(e){return typeof WorkerGlobalScope<"u"&&typeof e<"u"&&e instanceof WorkerGlobalScope}function gde(e){let t=/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,r={};if(e.replace(t,(i,n,a,o)=>{let s=a||o;return r[n]=s?s.toLowerCase():!0,""}),r["max-age"]){let i=parseInt(r["max-age"],10);isNaN(i)?delete r["max-age"]:r["max-age"]=i}return r}function Ade(e){if(LA==null){let t=e.navigator?e.navigator.userAgent:null;LA=!!e.safari||!!(t&&(/\b(iPad|iPhone|iPod)\b/.test(t)||t.match("Safari")&&!t.match("Chrome")))}return LA}function Ah(e){return typeof ImageBitmap<"u"&&e instanceof ImageBitmap}function yde(e,t,r,i,n){let a=Math.max(-t,0)*4,o=(Math.max(0,r)-r)*i*4+a,s=i*4,l=Math.max(0,t),u=Math.max(0,r),c=Math.min(e.width,t+i),d=Math.min(e.height,r+n);return{rect:{x:l,y:u,width:c-l,height:d-u},layout:[{offset:o,stride:s}]}}async function vde(e,t,r,i,n){if(typeof VideoFrame>"u")throw new Error("VideoFrame not supported");let a=new VideoFrame(e,{timestamp:0});try{let o=a?.format;if(!o||!(o.startsWith("BGR")||o.startsWith("RGB")))throw new Error(`Unrecognized format ${o}`);let s=o.startsWith("BGR"),l=new Uint8ClampedArray(i*n*4);if(await a.copyTo(l,yde(e,t,r,i,n)),s)for(let u=0;u<l.length;u+=4){let c=l[u];l[u]=l[u+2],l[u+2]=c}return l}finally{a.close()}}function aw(e,t,r,i){return e.addEventListener(t,r,i),{unsubscribe:()=>{e.removeEventListener(t,r,i)}}}function $l(e){return e*Math.PI/180}function $y(){return new Error(oZ)}function KL(e){return tl.REGISTERED_PROTOCOLS[e.substring(0,e.indexOf("://"))]}async function xde(e,t){let r=new Request(e.url,{method:e.method||"GET",body:e.body,credentials:e.credentials,headers:e.headers,cache:e.cache,referrer:GC(),signal:t.signal});e.type==="json"&&!r.headers.has("Accept")&&r.headers.set("Accept","application/json");let i;try{i=await fetch(r)}catch(o){throw new em(0,o.message,e.url,new Blob)}if(!i.ok){let o=await i.blob();throw new em(i.status,i.statusText,e.url,o)}let n;e.type==="arrayBuffer"||e.type==="image"?n=i.arrayBuffer():e.type==="json"?n=i.json():n=i.text();let a=await n;if(t.signal.aborted)throw $y();return{data:a,cacheControl:i.headers.get("Cache-Control"),expires:i.headers.get("Expires")}}function _de(e,t){return new Promise((r,i)=>{let n=new XMLHttpRequest;n.open(e.method||"GET",e.url,!0),(e.type==="arrayBuffer"||e.type==="image")&&(n.responseType="arraybuffer");for(let a in e.headers)n.setRequestHeader(a,e.headers[a]);e.type==="json"&&(n.responseType="text",e.headers?.Accept||n.setRequestHeader("Accept","application/json")),n.withCredentials=e.credentials==="include",n.onerror=()=>{i(new Error(n.statusText))},n.onload=()=>{if(!t.signal.aborted)if((n.status>=200&&n.status<300||n.status===0)&&n.response!==null){let a=n.response;if(e.type==="json")try{a=JSON.parse(n.response)}catch(o){i(o);return}r({data:a,cacheControl:n.getResponseHeader("Cache-Control"),expires:n.getResponseHeader("Expires")})}else{let a=new Blob([n.response],{type:n.getResponseHeader("Content-Type")});i(new em(n.status,n.statusText,e.url,a))}},t.signal.addEventListener("abort",()=>{n.abort(),i($y())}),n.send(e.body)})}function ez(e){if(!e||e.indexOf("://")<=0||e.indexOf("data:image/")===0||e.indexOf("blob:")===0)return!0;let t=new URL(e),r=window.location;return t.protocol===r.protocol&&t.host===r.host}function bde(e){iv||!yh||(HC?E$(e):Pp=e)}function E$(e){let t=e.createTexture();e.bindTexture(e.TEXTURE_2D,t);try{if(e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,yh),e.isContextLost())return;YC.supported=!0}catch{}e.deleteTexture(t),iv=!0}function tz(e,t,r){r[e]&&r[e].indexOf(t)!==-1||(r[e]=r[e]||[],r[e].push(t))}function ow(e,t,r){if(r&&r[e]){let i=r[e].indexOf(t);i!==-1&&r[e].splice(i,1)}}function jh(e,...t){for(let r of t)for(let i in r)e[i]=r[i];return e}function dn(e,t){return{kind:"array",itemType:e,N:t}}function Ar(e){if(e.kind==="array"){let t=Ar(e.itemType);return typeof e.N=="number"?`array<${t}, ${e.N}>`:e.itemType.kind==="value"?"array":`array<${t}>`}else return e.kind}function Kp(e,t){if(t.kind==="error")return null;if(e.kind==="array"){if(t.kind==="array"&&(t.N===0&&t.itemType.kind==="value"||!Kp(e.itemType,t.itemType))&&(typeof e.N!="number"||e.N===t.N))return null}else{if(e.kind===t.kind)return null;if(e.kind==="value"){for(let r of uZ)if(!Kp(r,t))return null}}return`Expected ${Ar(e)} but found ${Ar(t)} instead.`}function sw(e,t){return t.some(r=>r.kind===e.kind)}function Zl(e,t){return t.some(r=>r==="null"?e===null:r==="array"?Array.isArray(e):r==="object"?e&&!Array.isArray(e)&&typeof e=="object":r===typeof e)}function Ws(e,t){return e.kind==="array"&&t.kind==="array"?e.itemType.kind===t.itemType.kind&&typeof e.N=="number":e.kind===t.kind}function C$(e){return e=e%360,e<0&&(e+=360),e}function M$([e,t,r,i]){e=lw(e),t=lw(t),r=lw(r);let n,a,o=uw((.2225045*e+.7168786*t+.0606169*r)/jB);e===t&&t===r?n=a=o:(n=uw((.4360747*e+.3850649*t+.1430804*r)/UB),a=uw((.0139322*e+.0971045*t+.7141733*r)/VB));let s=116*o-16;return[s<0?0:s,500*(n-o),200*(o-a),i]}function lw(e){return e<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)}function uw(e){return e>cZ?Math.pow(e,1/3):e/GB+QB}function S$([e,t,r,i]){let n=(e+16)/116,a=isNaN(t)?n:n+t/500,o=isNaN(r)?n:n-r/200;return n=jB*hw(n),a=UB*hw(a),o=VB*hw(o),[cw(3.1338561*a-1.6168667*n-.4906146*o),cw(-.9787684*a+1.9161415*n+.033454*o),cw(.0719453*a-.2289914*n+1.4052427*o),i]}function cw(e){return e=e<=.00304?12.92*e:1.055*Math.pow(e,1/2.4)-.055,e<0?0:e>1?1:e}function hw(e){return e>du?e*e*e:GB*(e-QB)}function wde(e){let[t,r,i,n]=M$(e),a=Math.sqrt(r*r+i*i);return[Math.round(a*1e4)?C$(Math.atan2(i,r)*dZ):NaN,a,t,n]}function Ede([e,t,r,i]){return e=isNaN(e)?0:e*hZ,S$([r,Math.cos(e)*t,Math.sin(e)*t,i])}function Cde([e,t,r,i]){e=C$(e),t/=100,r/=100;function n(a){let o=(a+e/30)%12,s=t*Math.min(r,1-r);return r-s*Math.max(-1,Math.min(o-3,9-o,1))}return[n(0),n(8),n(4),i]}function ef(e,t){return pZ(e,t)?e[t]:void 0}function Mde(e){if(e=e.toLowerCase().trim(),e==="transparent")return[0,0,0,0];let t=ef(fZ,e);if(t){let[n,a,o]=t;return[n/255,a/255,o/255,1]}if(e.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(e)){let n=e.length<6?1:2,a=1;return[Q0(e.slice(a,a+=n)),Q0(e.slice(a,a+=n)),Q0(e.slice(a,a+=n)),Q0(e.slice(a,a+n)||"ff")]}if(e.startsWith("rgb")){let n=/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/,a=e.match(n);if(a){let[o,s,l,u,c,d,f,m,g,y,_,w]=a,I=[u||" ",f||" ",y].join("");if(I===" "||I===" /"||I===",,"||I===",,,"){let k=[l,d,g].join(""),D=k==="%%%"?100:k===""?255:0;if(D){let S=[Jc(+s/D,0,1),Jc(+c/D,0,1),Jc(+m/D,0,1),_?rz(+_,w):1];if(iz(S))return S}}return}}let r=/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/,i=e.match(r);if(i){let[n,a,o,s,l,u,c,d,f]=i,m=[o||" ",l||" ",c].join("");if(m===" "||m===" /"||m===",,"||m===",,,"){let g=[+a,Jc(+s,0,100),Jc(+u,0,100),d?rz(+d,f):1];if(iz(g))return Cde(g)}}}function Q0(e){return parseInt(e.padEnd(2,e),16)/255}function rz(e,t){return Jc(t?e/100:e,0,1)}function Jc(e,t,r){return Math.min(Math.max(t,e),r)}function iz(e){return!e.some(Number.isNaN)}function el(e,t,r){return e+r*(t-e)}function Sc(e,t,r){return e.map((i,n)=>el(i,t[n],r))}function Sde(e){return e==="rgb"||e==="hcl"||e==="lab"}function I$(e,t,r,i){return typeof e=="number"&&e>=0&&e<=255&&typeof t=="number"&&t>=0&&t<=255&&typeof r=="number"&&r>=0&&r<=255?typeof i>"u"||typeof i=="number"&&i>=0&&i<=1?null:`Invalid rgba value [${[e,t,r,i].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof i=="number"?[e,t,r,i]:[e,t,r]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function tf(e){if(e===null||typeof e=="string"||typeof e=="boolean"||typeof e=="number"||e instanceof Tu||e instanceof ht||e instanceof nv||e instanceof ls||e instanceof La||e instanceof za||e instanceof mn||e instanceof hs||e instanceof Da)return!0;if(Array.isArray(e)){for(let t of e)if(!tf(t))return!1;return!0}else if(typeof e=="object"){for(let t in e)if(!tf(e[t]))return!1;return!0}else return!1}function Fr(e){if(e===null)return Kc;if(typeof e=="string")return st;if(typeof e=="boolean")return nt;if(typeof e=="number")return ye;if(e instanceof ht)return Ia;if(e instanceof Tu)return of;if(e instanceof nv)return sf;if(e instanceof ls)return lf;if(e instanceof La)return uf;if(e instanceof za)return cf;if(e instanceof mn)return vh;if(e instanceof hs)return hf;if(e instanceof Da)return xh;if(Array.isArray(e)){let t=e.length,r;for(let i of e){let n=Fr(i);if(!r)r=n;else{if(r===n)continue;r=rt;break}}return dn(r||rt,t)}else return nl}function jd(e){let t=typeof e;return e===null?"":t==="string"||t==="number"||t==="boolean"?String(e):e instanceof ht||e instanceof Tu||e instanceof ls||e instanceof La||e instanceof za||e instanceof mn||e instanceof hs||e instanceof Da?e.toString():JSON.stringify(e)}function Zy(e,t){let r=e.length-1,i=0,n=r,a=0,o,s;for(;i<=n;)if(a=Math.floor((i+n)/2),o=e[a],s=e[a+1],o<=t){if(a===r||t<s)return a;i=a+1}else if(o>t)n=a-1;else throw new gr("Input is not a number.");return 0}function Ide(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Bde(){if(q8)return Ow;q8=1,Ow=e;function e(t,r,i,n){this.cx=3*t,this.bx=3*(i-t)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*r,this.by=3*(n-r)-this.cy,this.ay=1-this.cy-this.by,this.p1x=t,this.p1y=r,this.p2x=i,this.p2y=n}return e.prototype={sampleCurveX:function(t){return((this.ax*t+this.bx)*t+this.cx)*t},sampleCurveY:function(t){return((this.ay*t+this.by)*t+this.cy)*t},sampleCurveDerivativeX:function(t){return(3*this.ax*t+2*this.bx)*t+this.cx},solveCurveX:function(t,r){if(r===void 0&&(r=1e-6),t<0)return 0;if(t>1)return 1;for(var i=t,n=0;n<8;n++){var a=this.sampleCurveX(i)-t;if(Math.abs(a)<r)return i;var o=this.sampleCurveDerivativeX(i);if(Math.abs(o)<1e-6)break;i=i-a/o}var s=0,l=1;for(i=t,n=0;n<20&&(a=this.sampleCurveX(i),!(Math.abs(a-t)<r));n++)t>a?s=i:l=i,i=(l-s)*.5+s;return i},solve:function(t,r){return this.sampleCurveY(this.solveCurveX(t,r))}},Ow}function dw(e,t,r,i){let n=i-r,a=e-r;return n===0?0:t===1?a/n:(Math.pow(t,a)-1)/(Math.pow(t,n)-1)}function nz(e,t){return e==="=="||e==="!="?t.kind==="boolean"||t.kind==="string"||t.kind==="number"||t.kind==="null"||t.kind==="value":t.kind==="string"||t.kind==="number"||t.kind==="value"}function Dde(e,t,r){return t===r}function Tde(e,t,r){return t!==r}function Pde(e,t,r){return t<r}function kde(e,t,r){return t>r}function Fde(e,t,r){return t<=r}function Rde(e,t,r){return t>=r}function B$(e,t,r,i){return i.compare(t,r)===0}function Lde(e,t,r,i){return!B$(e,t,r,i)}function zde(e,t,r,i){return i.compare(t,r)<0}function Ode(e,t,r,i){return i.compare(t,r)>0}function Nde(e,t,r,i){return i.compare(t,r)<=0}function Ude(e,t,r,i){return i.compare(t,r)>=0}function Ic(e,t,r){let i=e!=="=="&&e!=="!=";return class D${constructor(a,o,s){this.type=nt,this.lhs=a,this.rhs=o,this.collator=s,this.hasUntypedArgument=a.type.kind==="value"||o.type.kind==="value"}static parse(a,o){if(a.length!==3&&a.length!==4)return o.error("Expected two or three arguments.");let s=a[0],l=o.parse(a[1],1,rt);if(!l)return null;if(!nz(s,l.type))return o.concat(1).error(`"${s}" comparisons are not supported for type '${Ar(l.type)}'.`);let u=o.parse(a[2],2,rt);if(!u)return null;if(!nz(s,u.type))return o.concat(2).error(`"${s}" comparisons are not supported for type '${Ar(u.type)}'.`);if(l.type.kind!==u.type.kind&&l.type.kind!=="value"&&u.type.kind!=="value")return o.error(`Cannot compare types '${Ar(l.type)}' and '${Ar(u.type)}'.`);i&&(l.type.kind==="value"&&u.type.kind!=="value"?l=new _o(u.type,[l]):l.type.kind!=="value"&&u.type.kind==="value"&&(u=new _o(l.type,[u])));let c=null;if(a.length===4){if(l.type.kind!=="string"&&u.type.kind!=="string"&&l.type.kind!=="value"&&u.type.kind!=="value")return o.error("Cannot use collator to compare non-string types.");if(c=o.parse(a[3],3,sf),!c)return null}return new D$(l,u,c)}evaluate(a){let o=this.lhs.evaluate(a),s=this.rhs.evaluate(a);if(i&&this.hasUntypedArgument){let l=Fr(o),u=Fr(s);if(l.kind!==u.kind||!(l.kind==="string"||l.kind==="number"))throw new gr(`Expected arguments for "${e}" to be (string, string) or (number, number), but found (${l.kind}, ${u.kind}) instead.`)}if(this.collator&&!i&&this.hasUntypedArgument){let l=Fr(o),u=Fr(s);if(l.kind!=="string"||u.kind!=="string")return t(a,o,s)}return this.collator?r(a,o,s,this.collator.evaluate(a)):t(a,o,s)}eachChild(a){a(this.lhs),a(this.rhs),this.collator&&a(this.collator)}outputDefined(){return!0}}}function jde(e,t){let r=Vde(e[0]),i=Gde(e[1]),n=Math.pow(2,t.z);return[Math.round(r*n*Na),Math.round(i*n*Na)]}function DB(e,t){let r=Math.pow(2,t.z),i=(e[0]/Na+t.x)/r,n=(e[1]/Na+t.y)/r;return[Qde(i),Yde(n)]}function Vde(e){return(180+e)/360}function Qde(e){return e*360-180}function Gde(e){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+e*Math.PI/360)))/360}function Yde(e){return 360/Math.PI*Math.atan(Math.exp((180-e*360)*Math.PI/180))-90}function ym(e,t){e[0]=Math.min(e[0],t[0]),e[1]=Math.min(e[1],t[1]),e[2]=Math.max(e[2],t[0]),e[3]=Math.max(e[3],t[1])}function Wf(e,t){return!(e[0]<=t[0]||e[2]>=t[2]||e[1]<=t[1]||e[3]>=t[3])}function Hde(e,t,r){return t[1]>e[1]!=r[1]>e[1]&&e[0]<(r[0]-t[0])*(e[1]-t[1])/(r[1]-t[1])+t[0]}function Wde(e,t,r){let i=e[0]-t[0],n=e[1]-t[1],a=e[0]-r[0],o=e[1]-r[1];return i*o-a*n===0&&i*a<=0&&n*o<=0}function j1(e,t,r,i){let n=[t[0]-e[0],t[1]-e[1]],a=[i[0]-r[0],i[1]-r[1]];return Jde(a,n)===0?!1:!!(az(e,t,r,i)&&az(r,i,e,t))}function $de(e,t,r){for(let i of r)for(let n=0;n<i.length-1;++n)if(j1(e,t,i[n],i[n+1]))return!0;return!1}function Xh(e,t,r=!1){let i=!1;for(let n of t)for(let a=0;a<n.length-1;a++){if(Wde(e,n[a],n[a+1]))return r;Hde(e,n[a],n[a+1])&&(i=!i)}return i}function Zde(e,t){for(let r of t)if(Xh(e,r))return!0;return!1}function T$(e,t){for(let r of e)if(!Xh(r,t))return!1;for(let r=0;r<e.length-1;++r)if($de(e[r],e[r+1],t))return!1;return!0}function Xde(e,t){for(let r of t)if(T$(e,r))return!0;return!1}function Jde(e,t){return e[0]*t[1]-e[1]*t[0]}function az(e,t,r,i){let n=e[0]-r[0],a=e[1]-r[1],o=t[0]-r[0],s=t[1]-r[1],l=i[0]-r[0],u=i[1]-r[1],c=n*u-l*a,d=o*u-l*s;return c>0&&d<0||c<0&&d>0}function TB(e,t,r){let i=[];for(let n=0;n<e.length;n++){let a=[];for(let o=0;o<e[n].length;o++){let s=jde(e[n][o],r);ym(t,s),a.push(s)}i.push(a)}return i}function P$(e,t,r){let i=[];for(let n=0;n<e.length;n++){let a=TB(e[n],t,r);i.push(a)}return i}function k$(e,t,r,i){if(e[0]<r[0]||e[0]>r[2]){let n=i*.5,a=e[0]-r[0]>n?-i:r[0]-e[0]>n?i:0;a===0&&(a=e[0]-r[2]>n?-i:r[2]-e[0]>n?i:0),e[0]+=a}ym(t,e)}function qde(e){e[0]=e[1]=1/0,e[2]=e[3]=-1/0}function oz(e,t,r,i){let n=Math.pow(2,i.z)*Na,a=[i.x*Na,i.y*Na],o=[];for(let s of e)for(let l of s){let u=[l.x+a[0],l.y+a[1]];k$(u,t,r,n),o.push(u)}return o}function sz(e,t,r,i){let n=Math.pow(2,i.z)*Na,a=[i.x*Na,i.y*Na],o=[];for(let s of e){let l=[];for(let u of s){let c=[u.x+a[0],u.y+a[1]];ym(t,c),l.push(c)}o.push(l)}if(t[2]-t[0]<=n/2){qde(t);for(let s of o)for(let l of s)k$(l,t,r,n)}return o}function Kde(e,t){let r=[1/0,1/0,-1/0,-1/0],i=[1/0,1/0,-1/0,-1/0],n=e.canonicalID();if(t.type==="Polygon"){let a=TB(t.coordinates,i,n),o=oz(e.geometry(),r,i,n);if(!Wf(r,i))return!1;for(let s of o)if(!Xh(s,a))return!1}if(t.type==="MultiPolygon"){let a=P$(t.coordinates,i,n),o=oz(e.geometry(),r,i,n);if(!Wf(r,i))return!1;for(let s of o)if(!Zde(s,a))return!1}return!0}function epe(e,t){let r=[1/0,1/0,-1/0,-1/0],i=[1/0,1/0,-1/0,-1/0],n=e.canonicalID();if(t.type==="Polygon"){let a=TB(t.coordinates,i,n),o=sz(e.geometry(),r,i,n);if(!Wf(r,i))return!1;for(let s of o)if(!T$(s,a))return!1}if(t.type==="MultiPolygon"){let a=P$(t.coordinates,i,n),o=sz(e.geometry(),r,i,n);if(!Wf(r,i))return!1;for(let s of o)if(!Xde(s,a))return!1}return!0}function F$(e,t,r=0,i=e.length-1,n=tpe){for(;i>r;){if(i-r>600){let l=i-r+1,u=t-r+1,c=Math.log(l),d=.5*Math.exp(2*c/3),f=.5*Math.sqrt(c*d*(l-d)/l)*(u-l/2<0?-1:1),m=Math.max(r,Math.floor(t-u*d/l+f)),g=Math.min(i,Math.floor(t+(l-u)*d/l+f));F$(e,t,m,g,n)}let a=e[t],o=r,s=i;for(Vd(e,r,t),n(e[i],a)>0&&Vd(e,r,i);o<s;){for(Vd(e,o,s),o++,s--;n(e[o],a)<0;)o++;for(;n(e[s],a)>0;)s--}n(e[r],a)===0?Vd(e,r,s):(s++,Vd(e,s,i)),s<=t&&(r=s+1),t<=s&&(i=s-1)}}function Vd(e,t,r){let i=e[t];e[t]=e[r],e[r]=i}function tpe(e,t){return e<t?-1:e>t?1:0}function MC(e,t){if(e.length<=1)return[e];let r=[],i,n;for(let a of e){let o=ipe(a);o!==0&&(a.area=Math.abs(o),n===void 0&&(n=o<0),n===o<0?(i&&r.push(i),i=[a]):i.push(a))}if(i&&r.push(i),t>1)for(let a=0;a<r.length;a++)r[a].length<=t||(F$(r[a],t,1,r[a].length-1,rpe),r[a]=r[a].slice(0,t));return r}function rpe(e,t){return t.area-e.area}function ipe(e){let t=0;for(let r=0,i=e.length,n=i-1,a,o;r<i;n=r++)a=e[r],o=e[n],t+=(o.x-a.x)*(a.y+o.y);return t}function R$(e,t){return t[0]-e[0]}function Xy(e){return e[1]-e[0]+1}function fs(e,t){return e[1]>=e[0]&&e[1]<t}function SC(e,t){if(e[0]>e[1])return[null,null];let r=Xy(e);if(t){if(r===2)return[e,null];let n=Math.floor(r/2);return[[e[0],e[0]+n],[e[0]+n,e[1]]]}if(r===1)return[e,null];let i=Math.floor(r/2)-1;return[[e[0],e[0]+i],[e[0]+i+1,e[1]]]}function IC(e,t){if(!fs(t,e.length))return[1/0,1/0,-1/0,-1/0];let r=[1/0,1/0,-1/0,-1/0];for(let i=t[0];i<=t[1];++i)ym(r,e[i]);return r}function BC(e){let t=[1/0,1/0,-1/0,-1/0];for(let r of e)for(let i of r)ym(t,i);return t}function lz(e){return e[0]!==-1/0&&e[1]!==-1/0&&e[2]!==1/0&&e[3]!==1/0}function PB(e,t,r){if(!lz(e)||!lz(t))return NaN;let i=0,n=0;return e[2]<t[0]&&(i=t[0]-e[2]),e[0]>t[2]&&(i=e[0]-t[2]),e[1]>t[3]&&(n=e[1]-t[3]),e[3]<t[1]&&(n=t[1]-e[3]),r.distance([0,0],[i,n])}function xu(e,t,r){let i=r.pointOnLine(t,e);return r.distance(e,i.point)}function kB(e,t,r,i,n){let a=Math.min(xu(e,[r,i],n),xu(t,[r,i],n)),o=Math.min(xu(r,[e,t],n),xu(i,[e,t],n));return Math.min(a,o)}function npe(e,t,r,i,n){if(!(fs(t,e.length)&&fs(i,r.length)))return 1/0;let a=1/0;for(let o=t[0];o<t[1];++o){let s=e[o],l=e[o+1];for(let u=i[0];u<i[1];++u){let c=r[u],d=r[u+1];if(j1(s,l,c,d))return 0;a=Math.min(a,kB(s,l,c,d,n))}}return a}function ape(e,t,r,i,n){if(!(fs(t,e.length)&&fs(i,r.length)))return NaN;let a=1/0;for(let o=t[0];o<=t[1];++o)for(let s=i[0];s<=i[1];++s)if(a=Math.min(a,n.distance(e[o],r[s])),a===0)return a;return a}function ope(e,t,r){if(Xh(e,t,!0))return 0;let i=1/0;for(let n of t){let a=n[0],o=n[n.length-1];if(a!==o&&(i=Math.min(i,xu(e,[o,a],r)),i===0))return i;let s=r.pointOnLine(n,e);if(i=Math.min(i,r.distance(e,s.point)),i===0)return i}return i}function spe(e,t,r,i){if(!fs(t,e.length))return NaN;for(let a=t[0];a<=t[1];++a)if(Xh(e[a],r,!0))return 0;let n=1/0;for(let a=t[0];a<t[1];++a){let o=e[a],s=e[a+1];for(let l of r)for(let u=0,c=l.length,d=c-1;u<c;d=u++){let f=l[d],m=l[u];if(j1(o,s,f,m))return 0;n=Math.min(n,kB(o,s,f,m,i))}}return n}function uz(e,t){for(let r of e)for(let i of r)if(Xh(i,t,!0))return!0;return!1}function lpe(e,t,r,i=1/0){let n=BC(e),a=BC(t);if(i!==1/0&&PB(n,a,r)>=i)return i;if(Wf(n,a)){if(uz(e,t))return 0}else if(uz(t,e))return 0;let o=1/0;for(let s of e)for(let l=0,u=s.length,c=u-1;l<u;c=l++){let d=s[c],f=s[l];for(let m of t)for(let g=0,y=m.length,_=y-1;g<y;_=g++){let w=m[_],I=m[g];if(j1(d,f,w,I))return 0;o=Math.min(o,kB(d,f,w,I,r))}}return o}function cz(e,t,r,i,n,a){if(!a)return;let o=PB(IC(i,a),n,r);o<t&&e.push([o,a,[0,0]])}function G0(e,t,r,i,n,a,o){if(!a||!o)return;let s=PB(IC(i,a),IC(n,o),r);s<t&&e.push([s,a,o])}function Jy(e,t,r,i,n=1/0){let a=Math.min(i.distance(e[0],r[0][0]),n);if(a===0)return a;let o=new YB([[0,[0,e.length-1],[0,0]]],R$),s=BC(r);for(;o.length>0;){let l=o.pop();if(l[0]>=a)continue;let u=l[1],c=t?sv:ov;if(Xy(u)<=c){if(!fs(u,e.length))return NaN;if(t){let d=spe(e,u,r,i);if(isNaN(d)||d===0)return d;a=Math.min(a,d)}else for(let d=u[0];d<=u[1];++d){let f=ope(e[d],r,i);if(a=Math.min(a,f),a===0)return 0}}else{let d=SC(u,t);cz(o,a,i,e,s,d[0]),cz(o,a,i,e,s,d[1])}}return a}function qy(e,t,r,i,n,a=1/0){let o=Math.min(a,n.distance(e[0],r[0]));if(o===0)return o;let s=new YB([[0,[0,e.length-1],[0,r.length-1]]],R$);for(;s.length>0;){let l=s.pop();if(l[0]>=o)continue;let u=l[1],c=l[2],d=t?sv:ov,f=i?sv:ov;if(Xy(u)<=d&&Xy(c)<=f){if(!fs(u,e.length)&&fs(c,r.length))return NaN;let m;if(t&&i)m=npe(e,u,r,c,n),o=Math.min(o,m);else if(t&&!i){let g=e.slice(u[0],u[1]+1);for(let y=c[0];y<=c[1];++y)if(m=xu(r[y],g,n),o=Math.min(o,m),o===0)return o}else if(!t&&i){let g=r.slice(c[0],c[1]+1);for(let y=u[0];y<=u[1];++y)if(m=xu(e[y],g,n),o=Math.min(o,m),o===0)return o}else m=ape(e,u,r,c,n),o=Math.min(o,m)}else{let m=SC(u,t),g=SC(c,i);G0(s,o,n,e,r,m[0],g[0]),G0(s,o,n,e,r,m[0],g[1]),G0(s,o,n,e,r,m[1],g[0]),G0(s,o,n,e,r,m[1],g[1])}}return o}function upe(e,t){let r=e.geometry(),i=r.flat().map(o=>DB([o.x,o.y],e.canonical));if(r.length===0)return NaN;let n=new H1(i[0][1]),a=1/0;for(let o of t){switch(o.type){case"Point":a=Math.min(a,qy(i,!1,[o.coordinates],!1,n,a));break;case"LineString":a=Math.min(a,qy(i,!1,o.coordinates,!0,n,a));break;case"Polygon":a=Math.min(a,Jy(i,!1,o.coordinates,n,a));break}if(a===0)return a}return a}function cpe(e,t){let r=e.geometry(),i=r.flat().map(o=>DB([o.x,o.y],e.canonical));if(r.length===0)return NaN;let n=new H1(i[0][1]),a=1/0;for(let o of t){switch(o.type){case"Point":a=Math.min(a,qy(i,!0,[o.coordinates],!1,n,a));break;case"LineString":a=Math.min(a,qy(i,!0,o.coordinates,!0,n,a));break;case"Polygon":a=Math.min(a,Jy(i,!0,o.coordinates,n,a));break}if(a===0)return a}return a}function hpe(e,t){let r=e.geometry();if(r.length===0||r[0].length===0)return NaN;let i=MC(r,0).map(o=>o.map(s=>s.map(l=>DB([l.x,l.y],e.canonical)))),n=new H1(i[0][0][0][1]),a=1/0;for(let o of t)for(let s of i){switch(o.type){case"Point":a=Math.min(a,Jy([o.coordinates],!1,s,n,a));break;case"LineString":a=Math.min(a,Jy(o.coordinates,!0,s,n,a));break;case"Polygon":a=Math.min(a,lpe(s,o.coordinates,n,a));break}if(a===0)return a}return a}function pw(e){return e.type==="MultiPolygon"?e.coordinates.map(t=>({type:"Polygon",coordinates:t})):e.type==="MultiLineString"?e.coordinates.map(t=>({type:"LineString",coordinates:t})):e.type==="MultiPoint"?e.coordinates.map(t=>({type:"Point",coordinates:t})):[e]}function hz(e,[t,r,i,n]){t=t.evaluate(e),r=r.evaluate(e),i=i.evaluate(e);let a=n?n.evaluate(e):1,o=I$(t,r,i,a);if(o)throw new gr(o);return new ht(t/255,r/255,i/255,a,!1)}function dz(e,t){return e in t}function fw(e,t){let r=t[e];return typeof r>"u"?null:r}function dpe(e,t,r,i){for(;r<=i;){let n=r+i>>1;if(t[n]===e)return!0;t[n]>e?i=n-1:r=n+1}return!1}function Xl(e){return{type:e}}function ppe(e){return Array.isArray(e)?`(${e.map(Ar).join(", ")})`:`(${Ar(e.type)}...)`}function Ky(e){if(e instanceof ZC)return Ky(e.boundExpression);if(e instanceof hl&&e.name==="error"||e instanceof qC||e instanceof av||e instanceof lv||e instanceof uv)return!1;let t=e instanceof pu||e instanceof _o,r=!0;return e.eachChild(i=>{t?r=r&&Ky(i):r=r&&i instanceof kp}),r?V1(e)&&Q1(e,["zoom","heatmap-density","elevation","line-progress","accumulated","is-supported-script"]):!1}function V1(e){if(e instanceof hl&&(e.name==="get"&&e.args.length===1||e.name==="feature-state"||e.name==="has"&&e.args.length===1||e.name==="properties"||e.name==="geometry-type"||e.name==="id"||/^filter-/.test(e.name))||e instanceof av||e instanceof lv)return!1;let t=!0;return e.eachChild(r=>{t&&!V1(r)&&(t=!1)}),t}function $f(e){if(e instanceof hl&&e.name==="feature-state")return!1;let t=!0;return e.eachChild(r=>{t&&!$f(r)&&(t=!1)}),t}function Q1(e,t){if(e instanceof hl&&t.indexOf(e.name)>=0)return!1;let r=!0;return e.eachChild(i=>{r&&!Q1(i,t)&&(r=!1)}),r}function DC(e){return{result:"success",value:e}}function qc(e){return{result:"error",value:e}}function Zf(e){return e["property-type"]==="data-driven"||e["property-type"]==="cross-faded-data-driven"}function L$(e){return!!e.expression&&e.expression.parameters.indexOf("zoom")>-1}function FB(e){return!!e.expression&&e.expression.interpolated}function ut(e){return e instanceof Number?"number":e instanceof String?"string":e instanceof Boolean?"boolean":Array.isArray(e)?"array":e===null?"null":typeof e}function G1(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&Fr(e)===nl}function fpe(e){return e}function mpe(e){switch(e.type){case"color":return ht.parse;case"padding":return La.parse;case"numberArray":return za.parse;case"colorArray":return mn.parse;default:return null}}function gpe(e){switch(e){case"exponential":return O$;case"interval":return ype;case"categorical":return Ape;case"identity":return vpe;default:throw new Error(`Unknown function type "${e}"`)}}function z$(e,t){let r=e.stops&&typeof e.stops[0][0]=="object",i=r||e.property!==void 0,n=r||!i,a=e.type||(FB(t)?"exponential":"interval"),o=mpe(t);if(o&&(e=jh({},e),e.stops&&(e.stops=e.stops.map(c=>[c[0],o(c[1])])),e.default?e.default=o(e.default):e.default=o(t.default)),e.colorSpace&&!Sde(e.colorSpace))throw new Error(`Unknown color space: "${e.colorSpace}"`);let s=gpe(a),l,u;if(a==="categorical"){l=Object.create(null);for(let c of e.stops)l[c[0]]=c[1];u=typeof e.stops[0][0]}if(r){let c={},d=[];for(let g=0;g<e.stops.length;g++){let y=e.stops[g],_=y[0].zoom;c[_]===void 0&&(c[_]={zoom:_,type:e.type,property:e.property,default:e.default,stops:[]},d.push(_)),c[_].stops.push([y[0].value,y[1]])}let f=[];for(let g of d)f.push([c[g].zoom,z$(c[g],t)]);let m={name:"linear"};return{kind:"composite",interpolationType:m,interpolationFactor:wo.interpolationFactor.bind(void 0,m),zoomStops:f.map(g=>g[0]),evaluate({zoom:g},y){return O$({stops:f,base:e.base},t,g).evaluate(g,y)}}}else if(n){let c=a==="exponential"?{name:"exponential",base:e.base!==void 0?e.base:1}:null;return{kind:"camera",interpolationType:c,interpolationFactor:wo.interpolationFactor.bind(void 0,c),zoomStops:e.stops.map(d=>d[0]),evaluate:({zoom:d})=>s(e,t,d,l,u)}}else return{kind:"source",evaluate(c,d){let f=d&&d.properties?d.properties[e.property]:void 0;return f===void 0?vm(e.default,t.default):s(e,t,f,l,u)}}}function vm(e,t,r){if(e!==void 0)return e;if(t!==void 0)return t;if(r!==void 0)return r}function Ape(e,t,r,i,n){let a=typeof r===n?i[r]:void 0;return vm(a,e.default,t.default)}function ype(e,t,r){if(ut(r)!=="number")return vm(e.default,t.default);let i=e.stops.length;if(i===1||r<=e.stops[0][0])return e.stops[0][1];if(r>=e.stops[i-1][0])return e.stops[i-1][1];let n=Zy(e.stops.map(a=>a[0]),r);return e.stops[n][1]}function O$(e,t,r){let i=e.base!==void 0?e.base:1;if(ut(r)!=="number")return vm(e.default,t.default);let n=e.stops.length;if(n===1||r<=e.stops[0][0])return e.stops[0][1];if(r>=e.stops[n-1][0])return e.stops[n-1][1];let a=Zy(e.stops.map(c=>c[0]),r),o=xpe(r,i,e.stops[a][0],e.stops[a+1][0]),s=e.stops[a][1],l=e.stops[a+1][1],u=NA[t.type]||fpe;return typeof s.evaluate=="function"?{evaluate(...c){let d=s.evaluate.apply(void 0,c),f=l.evaluate.apply(void 0,c);if(!(d===void 0||f===void 0))return u(d,f,o,e.colorSpace)}}:u(s,l,o,e.colorSpace)}function vpe(e,t,r){switch(t.type){case"color":r=ht.parse(r);break;case"formatted":r=ls.fromString(r.toString());break;case"resolvedImage":r=Da.fromString(r.toString());break;case"padding":r=La.parse(r);break;case"colorArray":r=mn.parse(r);break;case"numberArray":r=za.parse(r);break;default:ut(r)!==t.type&&(t.type!=="enum"||!t.values[r])&&(r=void 0)}return vm(r,e.default,t.default)}function xpe(e,t,r,i){let n=i-r,a=e-r;return n===0?0:t===1?a/n:(Math.pow(t,a)-1)/(Math.pow(t,n)-1)}function RB(e){return Array.isArray(e)&&e.length>0&&typeof e[0]=="string"&&e[0]in mu}function LB(e,t){let r=new WC(mu,Ky,[],t?bpe(t):void 0),i=r.parse(e,void 0,void 0,void 0,t&&t.type==="string"?{typeAnnotation:"coerce"}:void 0);return i?DC(new KC(i,t)):qc(r.errors)}function N$(e,t){let r=LB(e,t);if(r.result==="error")return r;let i=r.value.expression,n=V1(i);if(!n&&!Zf(t))return qc([new ka("","data expressions not supported")]);let a=Q1(i,["zoom"]);if(!a&&!L$(t))return qc([new ka("","zoom expressions not supported")]);let o=RA(i);if(!o&&!a)return qc([new ka("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')]);if(o instanceof ka)return qc([o]);if(o instanceof wo&&!FB(t))return qc([new ka("",'"interpolate" expressions cannot be used with this property')]);if(!o)return DC(n?new cv("constant",r.value):new cv("source",r.value));let s=o instanceof wo?o.interpolation:void 0;return DC(n?new hv("camera",r.value,o.labels,s):new hv("composite",r.value,o.labels,s))}function _pe(e,t){if(G1(e))return new eM(e,t);if(RB(e)){let r=N$(e,t);if(r.result==="error")throw new Error(r.value.map(i=>`${i.key}: ${i.message}`).join(", "));return r.value}else{let r=e;return t.type==="color"&&typeof e=="string"?r=ht.parse(e):t.type==="padding"&&(typeof e=="number"||Array.isArray(e))?r=La.parse(e):t.type==="numberArray"&&(typeof e=="number"||Array.isArray(e))?r=za.parse(e):t.type==="colorArray"&&(typeof e=="string"||Array.isArray(e))?r=mn.parse(e):t.type==="variableAnchorOffsetCollection"&&Array.isArray(e)?r=hs.parse(e):t.type==="projectionDefinition"&&typeof e=="string"&&(r=Tu.parse(e)),{globalStateRefs:new Set,kind:"constant",evaluate:()=>r}}}function RA(e){let t=null;if(e instanceof $C)t=RA(e.result);else if(e instanceof JC){for(let r of e.args)if(t=RA(r),t)break}else(e instanceof XC||e instanceof wo)&&e.input instanceof hl&&e.input.name==="zoom"&&(t=e);return t instanceof ka||e.eachChild(r=>{let i=RA(r);i instanceof ka?t=i:!t&&i?t=new ka("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):t&&i&&t!==i&&(t=new ka("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),t}function ev(e,t=new Set){return e instanceof uv&&t.add(e.key),e.eachChild(r=>{ev(r,t)}),t}function bpe(e){let t={color:Ia,string:st,number:ye,enum:st,boolean:nt,formatted:lf,padding:uf,numberArray:cf,colorArray:vh,projectionDefinition:of,resolvedImage:xh,variableAnchorOffsetCollection:hf};return e.type==="array"?dn(t[e.value]||rt,e.length):t[e.type]}function wpe(e){if(e.type==="color"&&G1(e.default))return new ht(0,0,0,0);switch(e.type){case"color":return ht.parse(e.default)||null;case"padding":return La.parse(e.default)||null;case"numberArray":return za.parse(e.default)||null;case"colorArray":return mn.parse(e.default)||null;case"variableAnchorOffsetCollection":return hs.parse(e.default)||null;case"projectionDefinition":return Tu.parse(e.default)||null;default:return e.default===void 0?null:e.default}}function zB(e){if(e===!0||e===!1)return!0;if(!Array.isArray(e)||e.length===0)return!1;switch(e[0]){case"has":return e.length>=2&&e[1]!=="$id"&&e[1]!=="$type";case"in":return e.length>=3&&(typeof e[1]!="string"||Array.isArray(e[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return e.length!==3||Array.isArray(e[1])||Array.isArray(e[2]);case"any":case"all":for(let t of e.slice(1))if(!zB(t)&&typeof t!="boolean")return!1;return!0;default:return!0}}function mw(e){if(e==null)return{filter:()=>!0,needGeometry:!1,getGlobalStateRefs:()=>new Set};zB(e)||(e=tv(e));let t=LB(e,mZ);if(t.result==="error")throw new Error(t.value.map(r=>`${r.key}: ${r.message}`).join(", "));{let r=U$(e);return{filter:(i,n,a)=>t.value.evaluate(i,n,{},a),needGeometry:r,getGlobalStateRefs:()=>ev(t.value.expression)}}}function Epe(e,t){return e<t?-1:e>t?1:0}function U$(e){if(!Array.isArray(e))return!1;if(e[0]==="within"||e[0]==="distance")return!0;for(let t=1;t<e.length;t++)if(U$(e[t]))return!0;return!1}function tv(e){if(!e)return!0;let t=e[0];return e.length<=1?t!=="any":t==="=="?gw(e[1],e[2],"=="):t==="!="?Y0(gw(e[1],e[2],"==")):t==="<"||t===">"||t==="<="||t===">="?gw(e[1],e[2],t):t==="any"?Cpe(e.slice(1)):t==="all"?["all"].concat(e.slice(1).map(tv)):t==="none"?["all"].concat(e.slice(1).map(tv).map(Y0)):t==="in"?pz(e[1],e.slice(2)):t==="!in"?Y0(pz(e[1],e.slice(2))):t==="has"?fz(e[1]):t==="!has"?Y0(fz(e[1])):!0}function gw(e,t,r){switch(e){case"$type":return[`filter-type-${r}`,t];case"$id":return[`filter-id-${r}`,t];default:return[`filter-${r}`,e,t]}}function Cpe(e){return["any"].concat(e.map(tv))}function pz(e,t){if(t.length===0)return!1;switch(e){case"$type":return["filter-type-in",["literal",t]];case"$id":return["filter-id-in",["literal",t]];default:return t.length>200&&!t.some(r=>typeof r!=typeof t[0])?["filter-in-large",e,["literal",t.sort(Epe)]]:["filter-in-small",e,["literal",t]]}}function fz(e){switch(e){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",e]}}function Y0(e){return["!",e]}function Mpe(){let e={},t=fn.$version;for(let r in fn.$root){let i=fn.$root[r];if(i.required){let n=null;r==="version"?n=t:i.type==="array"?n=[]:n={},n!=null&&(e[r]=n)}}return e}function j$(e){let t=e.key,r=e.value;return r?[new pe(t,r,"constants have been deprecated as of v8")]:[]}function Ir(e){return e instanceof Number||e instanceof String||e instanceof Boolean?e.valueOf():e}function Iu(e){if(Array.isArray(e))return e.map(Iu);if(e instanceof Object&&!(e instanceof Number||e instanceof String||e instanceof Boolean)){let t={};for(let r in e)t[r]=Iu(e[r]);return t}return Ir(e)}function ta(e){let t=e.key,r=e.value,i=e.valueSpec||{},n=e.objectElementValidators||{},a=e.style,o=e.styleSpec,s=e.validateSpec,l=[],u=ut(r);if(u!=="object")return[new pe(t,r,`object expected, ${u} found`)];for(let c in r){let d=c.split(".")[0],f=ef(i,d)||i["*"],m;if(ef(n,d))m=n[d];else if(ef(i,d))m=s;else if(n["*"])m=n["*"];else if(i["*"])m=s;else{l.push(new pe(t,r[c],`unknown property "${c}"`));continue}l=l.concat(m({key:(t&&`${t}.`)+c,value:r[c],valueSpec:f,style:a,styleSpec:o,object:r,objectKey:c,validateSpec:s},r))}for(let c in i)n[c]||i[c].required&&i[c].default===void 0&&r[c]===void 0&&l.push(new pe(t,r,`missing required property "${c}"`));return l}function OB(e){let t=e.value,r=e.valueSpec,i=e.validateSpec,n=e.style,a=e.styleSpec,o=e.key,s=e.arrayElementValidator||i;if(ut(t)!=="array")return[new pe(o,t,`array expected, ${ut(t)} found`)];if(r.length&&t.length!==r.length)return[new pe(o,t,`array length ${r.length} expected, length ${t.length} found`)];if(r["min-length"]&&t.length<r["min-length"])return[new pe(o,t,`array length at least ${r["min-length"]} expected, length ${t.length} found`)];let l={type:r.value,values:r.values};a.$version<7&&(l.function=r.function),ut(r.value)==="object"&&(l=r.value);let u=[];for(let c=0;c<t.length;c++)u=u.concat(s({array:t,arrayIndex:c,value:t[c],valueSpec:l,validateSpec:e.validateSpec,style:n,styleSpec:a,key:`${o}[${c}]`}));return u}function Y1(e){let t=e.key,r=e.value,i=e.valueSpec,n=ut(r);return n==="number"&&r!==r&&(n="NaN"),n!=="number"?[new pe(t,r,`number expected, ${n} found`)]:"minimum"in i&&r<i.minimum?[new pe(t,r,`${r} is less than the minimum value ${i.minimum}`)]:"maximum"in i&&r>i.maximum?[new pe(t,r,`${r} is greater than the maximum value ${i.maximum}`)]:[]}function V$(e){let t=e.valueSpec,r=Ir(e.value.type),i,n={},a,o,s=r!=="categorical"&&e.value.property===void 0,l=!s,u=ut(e.value.stops)==="array"&&ut(e.value.stops[0])==="array"&&ut(e.value.stops[0][0])==="object",c=ta({key:e.key,value:e.value,valueSpec:e.styleSpec.function,validateSpec:e.validateSpec,style:e.style,styleSpec:e.styleSpec,objectElementValidators:{stops:d,default:g}});return r==="identity"&&s&&c.push(new pe(e.key,e.value,'missing required property "property"')),r!=="identity"&&!e.value.stops&&c.push(new pe(e.key,e.value,'missing required property "stops"')),r==="exponential"&&e.valueSpec.expression&&!FB(e.valueSpec)&&c.push(new pe(e.key,e.value,"exponential functions not supported")),e.styleSpec.$version>=8&&(l&&!Zf(e.valueSpec)?c.push(new pe(e.key,e.value,"property functions not supported")):s&&!L$(e.valueSpec)&&c.push(new pe(e.key,e.value,"zoom functions not supported"))),(r==="categorical"||u)&&e.value.property===void 0&&c.push(new pe(e.key,e.value,'"property" property is required')),c;function d(y){if(r==="identity")return[new pe(y.key,y.value,'identity function may not have a "stops" property')];let _=[],w=y.value;return _=_.concat(OB({key:y.key,value:w,valueSpec:y.valueSpec,validateSpec:y.validateSpec,style:y.style,styleSpec:y.styleSpec,arrayElementValidator:f})),ut(w)==="array"&&w.length===0&&_.push(new pe(y.key,w,"array must have at least one stop")),_}function f(y){let _=[],w=y.value,I=y.key;if(ut(w)!=="array")return[new pe(I,w,`array expected, ${ut(w)} found`)];if(w.length!==2)return[new pe(I,w,`array length 2 expected, length ${w.length} found`)];if(u){if(ut(w[0])!=="object")return[new pe(I,w,`object expected, ${ut(w[0])} found`)];if(w[0].zoom===void 0)return[new pe(I,w,"object stop key must have zoom")];if(w[0].value===void 0)return[new pe(I,w,"object stop key must have value")];if(o&&o>Ir(w[0].zoom))return[new pe(I,w[0].zoom,"stop zoom values must appear in ascending order")];Ir(w[0].zoom)!==o&&(o=Ir(w[0].zoom),a=void 0,n={}),_=_.concat(ta({key:`${I}[0]`,value:w[0],valueSpec:{zoom:{}},validateSpec:y.validateSpec,style:y.style,styleSpec:y.styleSpec,objectElementValidators:{zoom:Y1,value:m}}))}else _=_.concat(m({key:`${I}[0]`,value:w[0],validateSpec:y.validateSpec,style:y.style,styleSpec:y.styleSpec},w));return RB(Iu(w[1]))?_.concat([new pe(`${I}[1]`,w[1],"expressions are not allowed in function stops.")]):_.concat(y.validateSpec({key:`${I}[1]`,value:w[1],valueSpec:t,validateSpec:y.validateSpec,style:y.style,styleSpec:y.styleSpec}))}function m(y,_){let w=ut(y.value),I=Ir(y.value),k=y.value!==null?y.value:_;if(!i)i=w;else if(w!==i)return[new pe(y.key,k,`${w} stop domain type must match previous stop domain type ${i}`)];if(w!=="number"&&w!=="string"&&w!=="boolean")return[new pe(y.key,k,"stop domain value must be a number, string, or boolean")];if(w!=="number"&&r!=="categorical"){let D=`number expected, ${w} found`;return Zf(t)&&r===void 0&&(D+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new pe(y.key,k,D)]}return r==="categorical"&&w==="number"&&(!isFinite(I)||Math.floor(I)!==I)?[new pe(y.key,k,`integer expected, found ${I}`)]:r!=="categorical"&&w==="number"&&a!==void 0&&I<a?[new pe(y.key,k,"stop domain values must appear in ascending order")]:(a=I,r==="categorical"&&I in n?[new pe(y.key,k,"stop domain values must be unique")]:(n[I]=!0,[]))}function g(y){return y.validateSpec({key:y.key,value:y.value,valueSpec:t,validateSpec:y.validateSpec,style:y.style,styleSpec:y.styleSpec})}}function Vh(e){let t=(e.expressionContext==="property"?N$:LB)(Iu(e.value),e.valueSpec);if(t.result==="error")return t.value.map(i=>new pe(`${e.key}${i.key}`,e.value,i.message));let r=t.value.expression||t.value._styleExpression.expression;if(e.expressionContext==="property"&&e.propertyKey==="text-font"&&!r.outputDefined())return[new pe(e.key,e.value,`Invalid data expression for "${e.propertyKey}". Output values must be contained as literals within the expression.`)];if(e.expressionContext==="property"&&e.propertyType==="layout"&&!$f(r))return[new pe(e.key,e.value,'"feature-state" data expressions are not supported with layout properties.')];if(e.expressionContext==="filter"&&!$f(r))return[new pe(e.key,e.value,'"feature-state" data expressions are not supported with filters.')];if(e.expressionContext&&e.expressionContext.indexOf("cluster")===0){if(!Q1(r,["zoom","feature-state"]))return[new pe(e.key,e.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(e.expressionContext==="cluster-initial"&&!V1(r))return[new pe(e.key,e.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function Spe(e){let t=e.value,r=e.key,i=ut(t);return i!=="boolean"?[new pe(r,t,`boolean expected, ${i} found`)]:[]}function TC(e){let t=e.key,r=e.value,i=ut(r);return i!=="string"?[new pe(t,r,`color expected, ${i} found`)]:ht.parse(String(r))?[]:[new pe(t,r,`color expected, "${r}" found`)]}function Xf(e){let t=e.key,r=e.value,i=e.valueSpec,n=[];return Array.isArray(i.values)?i.values.indexOf(Ir(r))===-1&&n.push(new pe(t,r,`expected one of [${i.values.join(", ")}], ${JSON.stringify(r)} found`)):Object.keys(i.values).indexOf(Ir(r))===-1&&n.push(new pe(t,r,`expected one of [${Object.keys(i.values).join(", ")}], ${JSON.stringify(r)} found`)),n}function PC(e){return zB(Iu(e.value))?Vh(jh({},e,{expressionContext:"filter",valueSpec:{value:"boolean"}})):Q$(e)}function Q$(e){let t=e.value,r=e.key;if(ut(t)!=="array")return[new pe(r,t,`array expected, ${ut(t)} found`)];let i=e.styleSpec,n,a=[];if(t.length<1)return[new pe(r,t,"filter array must have at least 1 element")];switch(a=a.concat(Xf({key:`${r}[0]`,value:t[0],valueSpec:i.filter_operator,style:e.style,styleSpec:e.styleSpec})),Ir(t[0])){case"<":case"<=":case">":case">=":t.length>=2&&Ir(t[1])==="$type"&&a.push(new pe(r,t,`"$type" cannot be use with operator "${t[0]}"`));case"==":case"!=":t.length!==3&&a.push(new pe(r,t,`filter array for operator "${t[0]}" must have 3 elements`));case"in":case"!in":t.length>=2&&(n=ut(t[1]),n!=="string"&&a.push(new pe(`${r}[1]`,t[1],`string expected, ${n} found`)));for(let o=2;o<t.length;o++)n=ut(t[o]),Ir(t[1])==="$type"?a=a.concat(Xf({key:`${r}[${o}]`,value:t[o],valueSpec:i.geometry_type,style:e.style,styleSpec:e.styleSpec})):n!=="string"&&n!=="number"&&n!=="boolean"&&a.push(new pe(`${r}[${o}]`,t[o],`string, number, or boolean expected, ${n} found`));break;case"any":case"all":case"none":for(let o=1;o<t.length;o++)a=a.concat(Q$({key:`${r}[${o}]`,value:t[o],style:e.style,styleSpec:e.styleSpec}));break;case"has":case"!has":n=ut(t[1]),t.length!==2?a.push(new pe(r,t,`filter array for "${t[0]}" operator must have 2 elements`)):n!=="string"&&a.push(new pe(`${r}[1]`,t[1],`string expected, ${n} found`));break}return a}function G$(e,t){let r=e.key,i=e.validateSpec,n=e.style,a=e.styleSpec,o=e.value,s=e.objectKey,l=a[`${t}_${e.layerType}`];if(!l)return[];let u=s.match(/^(.*)-transition$/);if(t==="paint"&&u&&l[u[1]]&&l[u[1]].transition)return i({key:r,value:o,valueSpec:a.transition,style:n,styleSpec:a});let c=e.valueSpec||l[s];if(!c)return[new pe(r,o,`unknown property "${s}"`)];let d;if(ut(o)==="string"&&Zf(c)&&!c.tokens&&(d=/^{([^}]+)}$/.exec(o)))return[new pe(r,o,`"${s}" does not support interpolation syntax
|
|
10916
|
+
`,Nb=class extends Ld{constructor(e,t,r,i,n=!0,a){if(super(),It(this,Ob),te(this,"worker"),te(this,"collidersDirty",!0),te(this,"packedMessage",[[],0,0,0,0,0,"bottom-left"]),te(this,"visibleCollidersQTree",new Xc(new rr(0,0,0,0))),te(this,"interactiveCollidersQTree",new Xc(new rr(0,0,0,0))),It(this,F0),It(this,xc),It(this,_c),It(this,Od,!1),It(this,sr,null),It(this,Ys,null),te(this,"working",!1),te(this,"componentArray",[]),te(this,"update",Y((o,s,l="bottom-left",u=!1,c=[])=>{let d=!1;if(this.collidersDirty){this.packedMessage=[[],0,0,0,0,0,"bottom-left"],this.componentArray=[];for(let w of ae(this,F0).entities)this.componentArray.push(w.component);this.resize(o,s,l),this.collidersDirty=!1,d=!0}else for(let w=0;w<this.componentArray.length;w++)if(this.componentArray[w].collisionDirty){d=!0;break}d&&this.componentArray.sort((w,I)=>I.rank-w.rank);let f=this.packedMessage[0],m=c.length+this.componentArray.length,g=u;f.length=m;let y=0,_;for(let w=0;w<c.length;w++){let I=c[w];f[y]==null&&(f[y]=[[],0,0,0,0,0,-1]),_=f[y],_[0]=[[I.h/2,I.h/2,I.w/2,I.w/2,xC]],_[1]=1,_[2]=1,_[3]=I.x,_[4]=I.y,_[5]=0,_[6]=-1,y++}for(let w=0;w<this.componentArray.length;w++){let I=this.componentArray[w],k=I.toPackedMessage(g);f[y]==null&&(f[y]=[[],0,0,0,0,0,-1]),_=f[y],_[0]=k.bboxes,_[1]=k.enabled&&I.visible&&(k.rank===5||!I.isOccluded)?1:0,_[2]=k.rank===5?1:0,_[3]=k.x,_[4]=k.y,_[5]=k.shouldCollideWithScreenEdges?1:0,_[6]=k.lockedToStrategyIndex,y++}this.working||(this.working=!0,this.worker.postMessage(this.packedMessage))},"update")),te(this,"resolve",Y(o=>{if(this.working=!1,this.collidersDirty||!o.data)return;let s=o.data.colliders,l=-1,u,c,d=new rr(0,0,ae(this,xc),ae(this,_c));this.visibleCollidersQTree=new Xc(d),this.interactiveCollidersQTree=new Xc(d);for(let f=0;f<this.componentArray.length;f++){let m=this.componentArray[f];if(s[f]==null)continue;l=s[f][0],u=s[f][2];let g=m.offscreen,y=s[f][1]===1;m.offscreen=y,l!==-1&&u!=null?(c=new rr(u.x,u.y,u.w,u.h,{entityId:m.id}),this.visibleCollidersQTree.insert(c),m.interactive&&this.interactiveCollidersQTree.insert(c),(m.canShow===!1||m.visibilityNeedsUpdate!==!1||g&&!y)&&"visibilityNeedsUpdate"in m&&(m.visibilityNeedsUpdate="show"),l!==-1&&l!==m.currentStrategyIndex&&(m.activeBoundingBox=c,m.onStrategySelected(l))):((m.canShow===!0||m.visibilityNeedsUpdate!==!1)&&"visibilityNeedsUpdate"in m&&(m.visibilityNeedsUpdate="hide"),l!==-1&&l!==m.currentStrategyIndex&&m.onStrategySelected(l))}B0(this,Ob,UR).call(this),this.publish("visibility-changed")},"resolve")),te(this,"destroy",Y(()=>{var o;this.worker.terminate(),(o=ae(this,sr))==null||o.remove()},"destroy")),Ke(this,F0,e),Ke(this,xc,t),Ke(this,_c,r),!n)this.worker=new zd;else if(i)this.worker=new Worker(i);else if(zb)try{this.worker=new Worker(URL.createObjectURL(new Blob([zb])))}catch{this.worker=new zd}else this.worker=new zd;this.worker.onerror=()=>{this.working=!1,this.worker=new zd,this.worker.onmessage=o=>this.resolve(o)},this.worker.onmessage=o=>this.resolve(o),a&&(Ke(this,sr,document.createElement("canvas")),ae(this,sr).style.cssText="position:absolute;top:0;left:0;pointer-events:none;z-index:0;display:none;",ae(this,sr).width=t,ae(this,sr).height=r,ae(this,sr).style.width=t+"px",ae(this,sr).style.height=r+"px",a.appendChild(ae(this,sr)),Ke(this,Ys,ae(this,sr).getContext("2d")))}resizeCanvas(e,t){Ke(this,xc,e),Ke(this,_c,t),ae(this,sr)&&(ae(this,sr).width=e,ae(this,sr).height=t,ae(this,sr).style.width=e+"px",ae(this,sr).style.height=t+"px")}resize(e,t,r){this.packedMessage[6]=r,this.packedMessage[5]=t,this.packedMessage[4]=e,this.packedMessage[3]=ae(this,xc),this.packedMessage[2]=ae(this,_c)}showCollisionBoxes(){Ke(this,Od,!0),ae(this,sr)&&(ae(this,sr).style.display="block")}hideCollisionBoxes(){Ke(this,Od,!1),ae(this,Ys)&&ae(this,sr)&&(ae(this,Ys).clearRect(0,0,ae(this,sr).width,ae(this,sr).height),ae(this,sr).style.display="none")}},F0=new WeakMap,xc=new WeakMap,_c=new WeakMap,Od=new WeakMap,sr=new WeakMap,Ys=new WeakMap,Ob=new WeakSet,UR=Y(function(){!ae(this,Od)||!ae(this,Ys)||!ae(this,sr)||(ae(this,Ys).clearRect(0,0,ae(this,sr).width,ae(this,sr).height),this.visibleCollidersQTree.drawObjects(ae(this,Ys)))},"#drawDebug"),Y(Nb,"CollisionSystem"),jR=Nb,ot(),ot(),ot(),VR=Y((function(){let e,t;return r=>{if((!t||!t)&&(e=document.createElement("canvas"),e.width=500*r,e.height=500*r,e.style.width="500px",e.style.height="500px",t=e.getContext("2d")),!t)throw new Error("Could not get 2D context");return{measureCanvas:e,measureCanvasContext:t}}}),"createMeasureCanvasContext")(),QR=Y(({text:e,size:t,maxWidth:r,pixelRatio:i,maxLines:n=2,lineHeight:a=1.2,options:o={strokeText:!0}})=>{let s="bold ".concat(t*i,"px 'InterUI-Regular', Helvetica Neue, Arial, sans-serif"),{measureCanvasContext:l}=VR(i);l.font=s;let u=[],c=e.split(" "),d=0,f=0,m=0;for(;f<c.length;){let _=c[f];if(d===n&&d>0){u[d-1]+="...";break}if(u[d]==null&&(u[d]=_,f++),c.length===1){u[d]=_;break}if(c[f]==null)break;let{width:w}=l.measureText(u[d]+" "+c[f]);w<=r*i?(u[d]+=" "+c[f],f++):d++}u.forEach(_=>{let{width:w}=l.measureText(_);m=Math.max(w,m)});let g=t*i*a,y=u.length*g;return{maxWidth:m,maxHeight:y,lines:u.length,draw:Y((_,w,I)=>{u.length===1?(o.strokeText&&_.strokeText(u[0],w,I),_.fillText(u[0],w,I)):(o.strokeText&&(_.strokeText(u[0],w,I-g/2),_.strokeText(u[1],w,I+g/2)),_.fillText(u[0],w,I-g/2),_.fillText(u[1],w,I+g/2))},"draw")}},"shaveText"),ot(),_C="[MappedinJS]",Y(hR,"createLogger"),GR=hR(),YR=GR,ot(),ot(),Y(dR,"formatMessage"),Ub=class extends Error{constructor(e,t=_C){super(dR(e,t)),this.name="MappedinError"}},Y(Ub,"MappedinError"),g$=Ub,FA=Y(e=>e,"linearEase"),HR=Y(e=>e*e,"quadEaseIn"),jb=Y(e=>1-Math.cos(e*Math.PI/2),"easeIn"),WR=Y(e=>1-(1-e)*(1-e),"quadEaseOut"),$R=Y(e=>1-Math.pow(1-e,3),"cubicEaseOut"),BB={linear:FA,"ease-in":HR,"ease-out":WR,"ease-in-out":jb,"ease-out-cubic":$R},Y(pR,"interpolate"),Y(d$,"getInterpolationBreakpoint"),Y(fR,"interpolateMulti"),ot(),ZR=(()=>{let e;return{getDeviceType(){if(e)return e;let{userAgent:t,platform:r,maxTouchPoints:i}=window.navigator,n=/(iphone|ipod|ipad)/i.test(t),a=r==="iPad"||r.indexOf("Mac")===0&&i>0&&!window.MSStream,o=/android/i.test(t);return e={isIpad:a,isMobile:o||n||a,isIOS:n,isAndroid:o,isSafari12:/Version\/12.+Safari/.test(t),isFirefox:/Firefox/.test(t),isWindows:/windows/i.test(t)},e},_reset(){e=void 0}}})(),Vb=ZR.getDeviceType,Qb=(()=>{let e,t,r;function i(){if(t!==void 0)return t;e||(e=document.createElement("canvas"));let a=e.getContext("webgl")||e.getContext("experimental-webgl");if(!a)return t;try{let o=Vb().isFirefox?null:a.getExtension("WEBGL_debug_renderer_info");return t=o?a.getParameter(o.UNMASKED_RENDERER_WEBGL):a.getParameter(a.RENDERER),t}catch{let o=new Error("Failed getting device info");throw o.name="FailedGettingDeviceInfo",o}}Y(i,"getInfo");function n(){var a,o;if(!Vb().isWindows)return!1;if(r!==void 0)return r;let s=(o=(a=XR())==null?void 0:a.toLowerCase())!=null?o:"";return r=s.includes("intel")&&(s.includes("uhd")||s.includes("iris")),r}return Y(n,"shouldDisableOffscreenCanvas"),{getInfo:i,shouldDisableOffscreenCanvas:n,_setCanvas(a){e=a,t=void 0,r=void 0}}})(),XR=Qb.getInfo,JR=Qb.shouldDisableOffscreenCanvas,ot(),Y(mR,"createImage"),Y(bb,"fastTrunc"),Y(gR,"cyrb53"),Gb=class extends Ld{constructor(e,t,r){super(),te(this,"dirty",!1),te(this,"state"),te(this,"colliderContext"),te(this,"colliderCanvas"),te(this,"transformRequestFunc"),te(this,"transformRequest",Y(async i=>this.transformRequestFunc?await this.transformRequestFunc(i):{url:i},"transformRequest")),te(this,"pinCache",{}),te(this,"imageCache",{}),te(this,"imagePromiseCache",{}),te(this,"imageDimensionsCache",{}),te(this,"textCache",{}),te(this,"update",Y(i=>{let n=this.state.pixelRatio;this.colliderContext.clearRect(0,0,this.colliderCanvas.width,this.colliderCanvas.height);let a,o,s,l,u,c;for(let d of this.state.entities)if(d?.component instanceof Pb&&!d.disposed){if(c=d.component,u=c.appearance.iconVisible,c.appearance.icon!=null&&u!=null){let m=typeof u=="boolean"?u:i>=u;m!==c.iconVisible&&(c.iconVisible=m,c.dirty=!0)}if((c.pinDirty||c.dirty||this.dirty)&&c.calculatePinSize(),c.offscreen||!c.visible)continue;if(o={active:c.appearance.pinColor,inactive:c.appearance.pinColorInactive},s={active:c.appearance.pinOutlineColor,inactive:c.appearance.pinOutlineColorInactive},l=bb(c.pinSize),a="".concat(o.active,"-").concat(o.inactive,"-").concat(s.active,"-").concat(s.inactive,"-").concat(l,"-").concat(c.iconVisible),c.labelCacheId=a,(!this.pinCache[a]||this.dirty)&&(this.prepare(c,a,this.colliderContext),c.dirty=!0),(c.appearance.icon&&(!c.imageHash||c.pinDirty)||this.dirty)&&this.cacheImage(c),this.textCache[c.id]==null||c.textDirty||this.dirty){c.dirty=!0,this.textCache[c.id]={};let{textDrawFn:m,width:g,height:y}=this.processText(c.text,c.appearance.textSize,c.appearance.maxWidth,c.appearance.maxLines,c.appearance.lineHeight),_=["left","center","right"];for(let w of _)this.textCache[c.id][w]=this.textToCanvas(m,c.appearance.textSize,w,g,y,c.appearance.textColor,c.appearance.textOutlineColor);c.dimensions={width:Math.ceil(g/n),height:Math.ceil(y/n)}}let f=1;if(c.appearance.iconScale)if(typeof c.appearance.iconScale=="number")f=c.appearance.iconScale;else{let{on:m,input:g,output:y,easing:_}=c.appearance.iconScale;m==="zoom-level"?f=bb(fR(i,g,y,_??"linear")):YR.warn("Unsupported interpolation property: ".concat(m))}c.recomputeCurrentStrategy(c.iconVisible?f:1),c.canShow&&(c.enabled||c.visibilityNeedsUpdate!==!1)&&this.draw(c,a,this.colliderContext),c.textDirty=!1,c.pinDirty=!1}this.dirty=!1},"update")),te(this,"processText",Y((i,n,a,o,s)=>{let l=this.state.pixelRatio,{draw:u,maxWidth:c,maxHeight:d}=QR({text:i,size:n,pixelRatio:l,maxWidth:a,maxLines:o,lineHeight:s});return{textDrawFn:u,width:c+2.5*l*2,height:d+2.5*l*2}},"processText")),te(this,"textToCanvas",Y((i,n,a,o,s,l,u)=>{let c=this.state.pixelRatio,d,f=o,m=s;window.OffscreenCanvas!=null&&!JR()?d=new OffscreenCanvas(f,m):(d=document.createElement("canvas"),d.width=f,d.height=m,d.style.width=f+"px",d.style.height=m+"px");let g=d.getContext("2d",{willReadFrequently:!0});if(!g)return;let y=2.5*c;g.textAlign=a,g.font="bold ".concat(n*c,"px 'InterUI-Regular', Helvetica Neue, Arial, sans-serif"),g.textBaseline="middle",g.lineJoin="miter",g.miterLimit=2,g.strokeStyle="white",g.lineWidth=y,g.fillStyle=l,g.strokeStyle=u;let _=a==="left"?y/2:a==="center"?f/2:f-y/2;return i(g,_,(m+y/2)/2),d},"textToCanvas")),te(this,"cacheImage",Y(i=>{if(!i.appearance.icon)return;let n=gR(i.appearance.icon);this.imagePromiseCache[n]||(this.imagePromiseCache[n]=new Promise(a=>{this.transformRequest(i.appearance.icon).then(o=>{let s=mR(o.url);s.onload=()=>{this.imageCache[n]=s,this.publish("img:loaded"),a(s)}})})),i.imageHash!==n&&(i.imageHash=n,this.imagePromiseCache[n].then(()=>{i.dirty=!0}))},"cacheImage")),te(this,"createPinCanvas",Y((i,n,a,o,s=1)=>{let l,u=this.state.pixelRatio,c=i.totalPinSize*2*u*s;window.OffscreenCanvas!=null?l=new OffscreenCanvas(c,c):(l=document.createElement("canvas"),l.width=c,l.height=c,l.style.width=c/u+"px",l.style.height=c/u+"px");let d=l.getContext("2d");return d.shadowColor="rgba(0,0,0,0.3)",d.shadowOffsetY=2*u,d.shadowBlur=5*u,d.beginPath(),d.arc(c/2,c/2,(n/2+2.5*u/2)*s,0,2*Math.PI),d.fillStyle=a,d.fill(),d.beginPath(),d.arc(c/2,c/2,n/2*s,0,2*Math.PI),d.shadowColor="transparent",d.fillStyle=o,d.fill(),l},"createPinCanvas")),te(this,"prepare",Y((i,n,a)=>{let o=this.state.pixelRatio;a.lineWidth=4*o;let s=typeof i.appearance.iconScale=="number"?[i.appearance.iconScale]:i.appearance.iconScale==null?[]:i.appearance.iconScale.output,l=s.length>0?Math.max(...s):void 0,u=this.createPinCanvas(i,i.pinSize,i.appearance.pinOutlineColor,i.appearance.pinColor,l),c=this.createPinCanvas(i,3.5*o,i.appearance.pinOutlineColorInactive,i.appearance.pinColorInactive,l);this.pinCache[n]=[u,c]},"prepare")),this.state=e,this.colliderCanvas=t,this.colliderContext=t.getContext("2d"),this.transformRequestFunc=r}draw(e,t,r){var i;if(!e.canShow||!e.visible)return;r.save(),r.globalAlpha=e.currentOpacity;let n=this.state.pixelRatio,a=e.projection.x*n,o=e.projection.y*n,s=e.style.pinVisibility===1?this.pinCache[t][0]:this.pinCache[t][1],l=e.style.pinVisibility===1?e.scaledPinSize*n:e.totalPinSize*n;if(e.style.pinVisibility!==0&&r.drawImage(s,a-l,o-l,l*2,l*2),e.appearance.icon&&e.iconVisible&&e.imageHash&&e.appearance.iconSize&&this.imageCache[e.imageHash]&&e.style.pinVisibility===1){let u=this.imageCache[e.imageHash],c=(e.scaledPinSize-e.scaledIconPadding)*n,d=e.appearance.iconFit,f=c,m=c,g="".concat(e.imageHash,"_").concat(d);if(this.imageDimensionsCache[g])f=this.imageDimensionsCache[g].width,m=this.imageDimensionsCache[g].height;else{let y=u.width*n,_=u.height*n;if(d==="contain"){let w=Math.sqrt(y**2+_**2),I=c/w;f=y*I,m=_*I}if(d==="cover"){let w=c/y,I=c/_,k=Math.max(w,I);f=y*k,m=_*k}}r.save(),r.beginPath(),r.arc(a,o,c/2,0,2*Math.PI),r.closePath(),((i=e?.appearance)==null?void 0:i.iconOverflow)!=="visible"&&r.clip(),r.drawImage(u,a-f/2,o-m/2,f,m),r.restore()}e.style.textLabelVisible&&e.style.textAlign!=null&&e.style.left!=null&&e.style.top!=null&&r.drawImage(this.textCache[e.id][e.style.textAlign],a+e.style.left*n,o+e.style.top*n),r.restore()}},Y(Gb,"TwoDDrawSystem"),qR=Gb,ot(),Yb=class extends Ld{constructor(e){super(),te(this,"state"),te(this,"animating",new Map),te(this,"isAnimating",!1),te(this,"startTime",-1),te(this,"showDuration",300),te(this,"hideDuration",250),te(this,"update",Y(()=>{var t;this.animating.clear();for(let r of this.state.entities){let i=r.component;i instanceof Pb&&(i.visibilityNeedsUpdate==="show"?(i.canShow=!0,this.animating.set(i,[i.currentOpacity,(t=i.appearance.opacity)!=null?t:1])):i.visibilityNeedsUpdate==="hide"&&this.animating.set(i,[i.currentOpacity,0]))}this.startTime=performance.now(),this.publish("animate:2d")},"update")),te(this,"playAnimations"),this.state=e,this.playAnimations=this._playAnimations}_playAnimations(){let e=performance.now();for(let[t,[r,i]]of this.animating.entries()){let n=i===1?this.showDuration:this.hideDuration,a=(e-this.startTime)/n;t.currentOpacity=pR(a,0,1,r,i,i===0?FA:jb),e-this.startTime>=n&&(i===1?t.canShow=!0:i===0&&(t.canShow=!1),t.visibilityNeedsUpdate=!1,this.animating.delete(t))}this.publish("draw:2d"),this.animating.size>0&&this.publish("animate:2d")}},Y(Yb,"TwoDVisibilitySystem"),KR=Yb,ot(),eL=["running","paused"],Hb=class{constructor(e){te(this,"state"),this.state=e}update(e){let t;for(let r of this.state.entities)if(r&&(t=r.component,t&&"containerEl"in t&&t.markerContainer!=null)){let i=t;i.visibilityNeedsUpdate!==!1&&(i.visibilityNeedsUpdate==="show"?i.canShow=!0:i.canShow=!1),i.offscreen&&(i.animation&&(i.animation.cancel(),i.animation=null),i.markerContainer.style.opacity="0");let n=i.animation!=null&&(i.animation.pending===!0||eL.includes(i.animation.playState));if((i.canShow&&i.visible===!0||n)&&!i.offscreen&&(i.markerContainer.style.transform="translate3D(".concat(i.projection.x,"px, ").concat(i.projection.y,"px, 0px)")),i.canShow===!0&&i.visible===!0&&!i.offscreen?i.markerContainer.style.pointerEvents=e?"none":i.pointerEvents:i.markerContainer.style.pointerEvents="none",i.currentStrategyIndex===-1&&i.visible&&i.visibilityNeedsUpdate==="show")continue;i.visibilityNeedsUpdate!==!1&&!i.offscreen&&(i.visibilityNeedsUpdate==="show"&&(i.markerContainer.style.opacity="0"),i.animation&&i.animation.cancel(),i.animation=i.markerContainer.animate([{opacity:i.canShow&&i.visible?"1":"0"}],{duration:300,easing:"ease-in-out",fill:"forwards"}),i.visibilityNeedsUpdate=!1)}}},Y(Hb,"DOMDrawSystem"),tL=Hb,ot(),Wb=class{constructor(e,t){te(this,"state"),te(this,"dirty",!0),te(this,"domTree"),this.state=e,this.domTree=t}update(){var e;if(this.dirty){for(let t of Array.from(this.domTree.children)){let r=(e=t.userData)==null?void 0:e.entityId,i=r!=null?this.state.entityMap.get(r):void 0;if(i){let n=i.component;(!n.enabled||!n.visible||!this.state.entityIds.has(r))&&this.domTree.removeChild(t)}else this.domTree.removeChild(t)}for(let t of this.state.entities){let r=t.component;r instanceof k0&&r.enabled&&r.markerContainer&&!this.domTree.contains(r.markerContainer)&&(r.markerContainer.userData={entityId:t.id},this.domTree.appendChild(r.markerContainer),r.updateDimensionsIfZeroWidthHeight())}this.dirty=!1}}},Y(Wb,"DOMVisibilitySystem"),rL=Wb,ot(),$b=class extends Ld{constructor(e,t){super(),te(this,"state"),te(this,"dirty",!0),te(this,"domTree"),te(this,"observers",new Map),te(this,"updateDimensions",Y(r=>{var i;for(let n of r){let a=(i=n.target.parentElement)==null?void 0:i.getAttribute("data-marker-id");if(a){let o=this.state.entityMap.get(a);if(o){let s=o.component;s instanceof k0&&(s.updateDimensions(n.contentRect.width,n.contentRect.height),s.collisionDirty=!0)}}}this.publish("dimensions-update")},"updateDimensions")),this.state=e,this.domTree=t}setupObserver(){var e;for(let t of this.observers.values())t.disconnect();this.observers.clear();for(let t of this.domTree.children){let r=t.getAttribute("data-marker-id");if(r!=null){let i=this.state.entityMap.get(r);if(i){let n=i.component;if((e=n.options)!=null&&e.dynamicResize){let a=new ResizeObserver(this.updateDimensions);a.observe(n.containerEl),this.observers.set(t.userData.entityId,a)}}}}}update(){this.dirty&&(this.setupObserver(),this.dirty=!1)}destroy(){for(let e of this.observers.values())e.disconnect();this.observers.clear()}},Y($b,"DOMResizeSystem"),iL=$b,Nd=9,oL=class{constructor(e,t,r,i={}){It(this,O0),It(this,Sr),It(this,bc),It(this,R0),It(this,va),It(this,wc),It(this,Qi),It(this,Ec),It(this,Ko),It(this,Cc),It(this,Ud),It(this,Hs),It(this,Wl,Nd),It(this,ao,null),It(this,oo,null),It(this,so,null),It(this,lo,null),te(this,"collidersNeedRecomputing",!0),It(this,uo),It(this,L0,0),It(this,z0,[]),It(this,Zb,Y(()=>{ae(this,lo)&&(cancelAnimationFrame(ae(this,lo)),Ke(this,lo,null)),Ke(this,lo,requestAnimationFrame(()=>{Ke(this,lo,null),ae(this,Ko).update(),ae(this,N0).call(this)}))},"#onVisibilityChanged")),It(this,N0,Y(()=>{Ke(this,oo,requestAnimationFrame(()=>{Ke(this,oo,null),ae(this,Ec).update(ae(this,L0)),ae(this,Cc).update(!1)}))},"#draw2DEntities")),It(this,Xb,Y(()=>{ae(this,N0).call(this)},"#onDraw2D")),It(this,Jb,Y(()=>{ae(this,so)&&(cancelAnimationFrame(ae(this,so)),Ke(this,so,null)),Ke(this,so,requestAnimationFrame(()=>{Ke(this,so,null),ae(this,Ko).playAnimations()}))},"#onAnimate2D"));var n,a;Ke(this,Sr,t),Ke(this,bc,e),Ke(this,R0,r),Ke(this,uo,(n=i.watermark)!=null?n:{width:0,height:0,position:"bottom-left"}),Ke(this,va,document.createElement("canvas")),ae(this,va).style.cssText="position:absolute;top:0;left:0;width:100%;height:100%;pointer-events:none;z-index:1;",e.appendChild(ae(this,va));let o=document.createElement("div");o.classList.add("mappedin-2d-entities"),Object.assign(o.style,{position:"absolute",top:"0",left:"0",bottom:"0",right:"0",overflow:"hidden",pointerEvents:"none",zIndex:"2",transformStyle:"preserve-3d"}),e.appendChild(o),Ke(this,wc,o),this.resize(),Ke(this,Qi,new jR(t,ae(this,bc).clientWidth,ae(this,bc).clientHeight,i.workerUrl,(a=i.useCollisionWorker)!=null?a:!0,e)),Ke(this,Ec,new qR(t,ae(this,va),i.transformImageRequest)),Ke(this,Ko,new KR(t)),Ke(this,Cc,new tL(t)),Ke(this,Ud,new rL(t,ae(this,wc))),Ke(this,Hs,new iL(t,ae(this,wc))),ae(this,Qi).on("visibility-changed",ae(this,Zb),{signal:ae(this,Qi).signal}),ae(this,Ko).on("draw:2d",ae(this,Xb),{signal:ae(this,Ko).signal}),ae(this,Ko).on("animate:2d",ae(this,Jb),{signal:ae(this,Ko).signal}),ae(this,Hs).on("dimensions-update",()=>{ae(this,Qi).collidersDirty=!0,B0(this,O0,aL).call(this)},{signal:ae(this,Hs).signal})}get collisionSystem(){return ae(this,Qi)}get drawSystem(){return ae(this,Ec)}get domDrawSystem(){return ae(this,Cc)}registerEntity(e){ae(this,Sr).entityMap.set(e.id,e)}addEntity(e){ae(this,Sr).entityMap.set(e.id,e),ae(this,Sr).entities.add(e),ae(this,Sr).entityIds.add(e.id)}activateEntity(e){ae(this,Sr).entities.add(e),ae(this,Sr).entityIds.add(e.id)}deactivateEntity(e){ae(this,Sr).entities.delete(e),ae(this,Sr).entityIds.delete(e.id)}removeEntity(e){ae(this,Sr).entities.delete(e),ae(this,Sr).entityMap.delete(e.id),ae(this,Sr).entityIds.delete(e.id)}clearEntities(){ae(this,Sr).entities.clear(),ae(this,Sr).entityMap.clear(),ae(this,Sr).entityIds.clear()}getEntity(e){return ae(this,Sr).entityMap.get(e)}hasActiveEntity(e){return ae(this,Sr).entities.has(e)}resize(){var e;let{clientWidth:t,clientHeight:r}=ae(this,bc),i=ae(this,Sr).pixelRatio;ae(this,va).width=t*i,ae(this,va).height=r*i,ae(this,va).style.width=t+"px",ae(this,va).style.height=r+"px",(e=ae(this,Qi))==null||e.resizeCanvas(t,r)}update(e,t,r=!1,i=[]){Ke(this,L0,e),Ke(this,z0,i),B0(this,O0,nL).call(this),ae(this,Ud).update(),ae(this,Hs).update(),ae(this,oo)&&(cancelAnimationFrame(ae(this,oo)),Ke(this,oo,null)),ae(this,Ec).update(e),ae(this,Cc).update(t);let n=this.collidersNeedRecomputing,a=!n&&r;n&&Ke(this,Wl,Nd),MR(this,Wl)._++,ae(this,Wl)>=Nd&&(Ke(this,Wl,0),ae(this,Qi).update(ae(this,uo).width,ae(this,uo).height,ae(this,uo).position,a,i)),this.collidersNeedRecomputing=!1}updateWatermark(e){Ke(this,uo,e)}markDirty(){ae(this,Ud).dirty=!0,ae(this,Hs).dirty=!0,ae(this,Qi).collidersDirty=!0,this.collidersNeedRecomputing=!0,Ke(this,Wl,Nd)}cancelPendingFrames(){ae(this,ao)&&(cancelAnimationFrame(ae(this,ao)),Ke(this,ao,null)),ae(this,oo)&&(cancelAnimationFrame(ae(this,oo)),Ke(this,oo,null)),ae(this,so)&&(cancelAnimationFrame(ae(this,so)),Ke(this,so,null)),ae(this,lo)&&(cancelAnimationFrame(ae(this,lo)),Ke(this,lo,null))}createLabel(e,t){return new Tb(e,t,ae(this,Sr).pixelRatio)}createMarker(e,t={}){return new k0(e,t)}showCollisionBoxes(){ae(this,Qi).showCollisionBoxes()}hideCollisionBoxes(){ae(this,Qi).hideCollisionBoxes()}destroy(){this.cancelPendingFrames(),ae(this,Qi).destroy(),ae(this,Hs).destroy(),ae(this,va).remove(),ae(this,wc).remove()}},Sr=new WeakMap,bc=new WeakMap,R0=new WeakMap,va=new WeakMap,wc=new WeakMap,Qi=new WeakMap,Ec=new WeakMap,Ko=new WeakMap,Cc=new WeakMap,Ud=new WeakMap,Hs=new WeakMap,Wl=new WeakMap,ao=new WeakMap,oo=new WeakMap,so=new WeakMap,lo=new WeakMap,uo=new WeakMap,L0=new WeakMap,z0=new WeakMap,O0=new WeakSet,nL=Y(function(){for(let e of ae(this,Sr).entities){let t=e.worldPosition,r=ae(this,R0).call(this,t.x,t.y,t.z);r?(e.component.projection.x=r.x,e.component.projection.y=r.y,e.component.offscreen=!1):e.component.offscreen=!0}},"#projectEntities"),aL=Y(function(){ae(this,ao)&&(cancelAnimationFrame(ae(this,ao)),Ke(this,ao,null)),Ke(this,ao,requestAnimationFrame(()=>{Ke(this,ao,null),ae(this,Qi).update(ae(this,uo).width,ae(this,uo).height,ae(this,uo).position,!1,ae(this,z0))}))},"#scheduleCollisionUpdate"),Zb=new WeakMap,N0=new WeakMap,Xb=new WeakMap,Jb=new WeakMap,Y(oL,"TwoDPipeline")}),qb,Kb,Jle,qle,A$=M(()=>{"use strict";ar(),pl(),qb=Yy,Kb=Wy,Jle=P.object({rank:U1.optional(),appearance:vC.optional(),interactive:P.boolean().default(!1),textPlacement:P.union([P.enum(qb),P.array(P.enum(qb))]).default(Hy),occlude:P.boolean().default(!0)}),qle=P.object({rank:P.union([P.enum(["low","medium","high","always-visible"]),P.number()]).optional(),interactive:P.union([P.boolean(),P.literal("pointer-events-auto")]).optional(),id:P.string().optional(),placement:P.union([P.enum(Kb),P.array(P.enum(Kb))]).optional(),dynamicResize:P.boolean().optional(),zIndex:P.number().optional(),lowPriorityPin:P.object({size:P.number().positive().optional(),color:P.string().optional()}).optional()})});function y$(){return Bw==null&&(Bw=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function"),Bw}function Kle(){if(J0==null&&(J0=!1,y$())){let e=new OffscreenCanvas(5,5).getContext("2d",{willReadFrequently:!0});if(e){for(let r=0;r<25;r++){let i=r*4;e.fillStyle=`rgb(${i},${i+1},${i+2})`,e.fillRect(r%5,Math.floor(r/5),1,1)}let t=e.getImageData(0,0,5,5).data;for(let r=0;r<100;r++)if(r%4!==3&&t[r]!==r){J0=!0;break}}}return J0||!1}function eue(){var e=new zt(4);return zt!=Float32Array&&(e[1]=0,e[2]=0),e[0]=1,e[3]=1,e}function tue(e){var t=new zt(4);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t}function rue(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e}function iue(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=1,e}function nue(e,t,r,i){var n=new zt(4);return n[0]=e,n[1]=t,n[2]=r,n[3]=i,n}function aue(e,t,r,i,n){return e[0]=t,e[1]=r,e[2]=i,e[3]=n,e}function oue(e,t){if(e===t){var r=t[1];e[1]=t[2],e[2]=r}else e[0]=t[0],e[1]=t[2],e[2]=t[1],e[3]=t[3];return e}function sue(e,t){var r=t[0],i=t[1],n=t[2],a=t[3],o=r*a-n*i;return o?(o=1/o,e[0]=a*o,e[1]=-i*o,e[2]=-n*o,e[3]=r*o,e):null}function lue(e,t){var r=t[0];return e[0]=t[3],e[1]=-t[1],e[2]=-t[2],e[3]=r,e}function uue(e){return e[0]*e[3]-e[2]*e[1]}function sL(e,t,r){var i=t[0],n=t[1],a=t[2],o=t[3],s=r[0],l=r[1],u=r[2],c=r[3];return e[0]=i*s+a*l,e[1]=n*s+o*l,e[2]=i*u+a*c,e[3]=n*u+o*c,e}function cue(e,t,r){var i=t[0],n=t[1],a=t[2],o=t[3],s=Math.sin(r),l=Math.cos(r);return e[0]=i*l+a*s,e[1]=n*l+o*s,e[2]=i*-s+a*l,e[3]=n*-s+o*l,e}function hue(e,t,r){var i=t[0],n=t[1],a=t[2],o=t[3],s=r[0],l=r[1];return e[0]=i*s,e[1]=n*s,e[2]=a*l,e[3]=o*l,e}function due(e,t){var r=Math.sin(t),i=Math.cos(t);return e[0]=i,e[1]=r,e[2]=-r,e[3]=i,e}function pue(e,t){return e[0]=t[0],e[1]=0,e[2]=0,e[3]=t[1],e}function fue(e){return"mat2("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+")"}function mue(e){return Math.hypot(e[0],e[1],e[2],e[3])}function gue(e,t,r,i){return e[2]=i[2]/i[0],r[0]=i[0],r[1]=i[1],r[3]=i[3]-e[2]*r[1],[e,t,r]}function Aue(e,t,r){return e[0]=t[0]+r[0],e[1]=t[1]+r[1],e[2]=t[2]+r[2],e[3]=t[3]+r[3],e}function lL(e,t,r){return e[0]=t[0]-r[0],e[1]=t[1]-r[1],e[2]=t[2]-r[2],e[3]=t[3]-r[3],e}function yue(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]}function vue(e,t){var r=e[0],i=e[1],n=e[2],a=e[3],o=t[0],s=t[1],l=t[2],u=t[3];return Math.abs(r-o)<=qe*Math.max(1,Math.abs(r),Math.abs(o))&&Math.abs(i-s)<=qe*Math.max(1,Math.abs(i),Math.abs(s))&&Math.abs(n-l)<=qe*Math.max(1,Math.abs(n),Math.abs(l))&&Math.abs(a-u)<=qe*Math.max(1,Math.abs(a),Math.abs(u))}function xue(e,t,r){return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e[3]=t[3]*r,e}function _ue(e,t,r,i){return e[0]=t[0]+r[0]*i,e[1]=t[1]+r[1]*i,e[2]=t[2]+r[2]*i,e[3]=t[3]+r[3]*i,e}function uL(){var e=new zt(9);return zt!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[5]=0,e[6]=0,e[7]=0),e[0]=1,e[4]=1,e[8]=1,e}function bue(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[4],e[4]=t[5],e[5]=t[6],e[6]=t[8],e[7]=t[9],e[8]=t[10],e}function wue(e){var t=new zt(9);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t}function Eue(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e}function Cue(e,t,r,i,n,a,o,s,l){var u=new zt(9);return u[0]=e,u[1]=t,u[2]=r,u[3]=i,u[4]=n,u[5]=a,u[6]=o,u[7]=s,u[8]=l,u}function Mue(e,t,r,i,n,a,o,s,l,u){return e[0]=t,e[1]=r,e[2]=i,e[3]=n,e[4]=a,e[5]=o,e[6]=s,e[7]=l,e[8]=u,e}function Sue(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=1,e[5]=0,e[6]=0,e[7]=0,e[8]=1,e}function Iue(e,t){if(e===t){var r=t[1],i=t[2],n=t[5];e[1]=t[3],e[2]=t[6],e[3]=r,e[5]=t[7],e[6]=i,e[7]=n}else e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8];return e}function Bue(e,t){var r=t[0],i=t[1],n=t[2],a=t[3],o=t[4],s=t[5],l=t[6],u=t[7],c=t[8],d=c*o-s*u,f=-c*a+s*l,m=u*a-o*l,g=r*d+i*f+n*m;return g?(g=1/g,e[0]=d*g,e[1]=(-c*i+n*u)*g,e[2]=(s*i-n*o)*g,e[3]=f*g,e[4]=(c*r-n*l)*g,e[5]=(-s*r+n*a)*g,e[6]=m*g,e[7]=(-u*r+i*l)*g,e[8]=(o*r-i*a)*g,e):null}function Due(e,t){var r=t[0],i=t[1],n=t[2],a=t[3],o=t[4],s=t[5],l=t[6],u=t[7],c=t[8];return e[0]=o*c-s*u,e[1]=n*u-i*c,e[2]=i*s-n*o,e[3]=s*l-a*c,e[4]=r*c-n*l,e[5]=n*a-r*s,e[6]=a*u-o*l,e[7]=i*l-r*u,e[8]=r*o-i*a,e}function Tue(e){var t=e[0],r=e[1],i=e[2],n=e[3],a=e[4],o=e[5],s=e[6],l=e[7],u=e[8];return t*(u*a-o*l)+r*(-u*n+o*s)+i*(l*n-a*s)}function cL(e,t,r){var i=t[0],n=t[1],a=t[2],o=t[3],s=t[4],l=t[5],u=t[6],c=t[7],d=t[8],f=r[0],m=r[1],g=r[2],y=r[3],_=r[4],w=r[5],I=r[6],k=r[7],D=r[8];return e[0]=f*i+m*o+g*u,e[1]=f*n+m*s+g*c,e[2]=f*a+m*l+g*d,e[3]=y*i+_*o+w*u,e[4]=y*n+_*s+w*c,e[5]=y*a+_*l+w*d,e[6]=I*i+k*o+D*u,e[7]=I*n+k*s+D*c,e[8]=I*a+k*l+D*d,e}function Pue(e,t,r){var i=t[0],n=t[1],a=t[2],o=t[3],s=t[4],l=t[5],u=t[6],c=t[7],d=t[8],f=r[0],m=r[1];return e[0]=i,e[1]=n,e[2]=a,e[3]=o,e[4]=s,e[5]=l,e[6]=f*i+m*o+u,e[7]=f*n+m*s+c,e[8]=f*a+m*l+d,e}function kue(e,t,r){var i=t[0],n=t[1],a=t[2],o=t[3],s=t[4],l=t[5],u=t[6],c=t[7],d=t[8],f=Math.sin(r),m=Math.cos(r);return e[0]=m*i+f*o,e[1]=m*n+f*s,e[2]=m*a+f*l,e[3]=m*o-f*i,e[4]=m*s-f*n,e[5]=m*l-f*a,e[6]=u,e[7]=c,e[8]=d,e}function Fue(e,t,r){var i=r[0],n=r[1];return e[0]=i*t[0],e[1]=i*t[1],e[2]=i*t[2],e[3]=n*t[3],e[4]=n*t[4],e[5]=n*t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e}function Rue(e,t){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=1,e[5]=0,e[6]=t[0],e[7]=t[1],e[8]=1,e}function Lue(e,t){var r=Math.sin(t),i=Math.cos(t);return e[0]=i,e[1]=r,e[2]=0,e[3]=-r,e[4]=i,e[5]=0,e[6]=0,e[7]=0,e[8]=1,e}function zue(e,t){return e[0]=t[0],e[1]=0,e[2]=0,e[3]=0,e[4]=t[1],e[5]=0,e[6]=0,e[7]=0,e[8]=1,e}function Oue(e,t){return e[0]=t[0],e[1]=t[1],e[2]=0,e[3]=t[2],e[4]=t[3],e[5]=0,e[6]=t[4],e[7]=t[5],e[8]=1,e}function Nue(e,t){var r=t[0],i=t[1],n=t[2],a=t[3],o=r+r,s=i+i,l=n+n,u=r*o,c=i*o,d=i*s,f=n*o,m=n*s,g=n*l,y=a*o,_=a*s,w=a*l;return e[0]=1-d-g,e[3]=c-w,e[6]=f+_,e[1]=c+w,e[4]=1-u-g,e[7]=m-y,e[2]=f-_,e[5]=m+y,e[8]=1-u-d,e}function Uue(e,t){var r=t[0],i=t[1],n=t[2],a=t[3],o=t[4],s=t[5],l=t[6],u=t[7],c=t[8],d=t[9],f=t[10],m=t[11],g=t[12],y=t[13],_=t[14],w=t[15],I=r*s-i*o,k=r*l-n*o,D=r*u-a*o,S=i*l-n*s,L=i*u-a*s,z=n*u-a*l,N=c*y-d*g,H=c*_-f*g,q=c*w-m*g,V=d*_-f*y,Q=d*w-m*y,$=f*w-m*_,B=I*$-k*Q+D*V+S*q-L*H+z*N;return B?(B=1/B,e[0]=(s*$-l*Q+u*V)*B,e[1]=(l*q-o*$-u*H)*B,e[2]=(o*Q-s*q+u*N)*B,e[3]=(n*Q-i*$-a*V)*B,e[4]=(r*$-n*q+a*H)*B,e[5]=(i*q-r*Q-a*N)*B,e[6]=(y*z-_*L+w*S)*B,e[7]=(_*D-g*z-w*k)*B,e[8]=(g*L-y*D+w*I)*B,e):null}function jue(e,t,r){return e[0]=2/t,e[1]=0,e[2]=0,e[3]=0,e[4]=-2/r,e[5]=0,e[6]=-1,e[7]=1,e[8]=1,e}function Vue(e){return"mat3("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+", "+e[4]+", "+e[5]+", "+e[6]+", "+e[7]+", "+e[8]+")"}function Que(e){return Math.hypot(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])}function Gue(e,t,r){return e[0]=t[0]+r[0],e[1]=t[1]+r[1],e[2]=t[2]+r[2],e[3]=t[3]+r[3],e[4]=t[4]+r[4],e[5]=t[5]+r[5],e[6]=t[6]+r[6],e[7]=t[7]+r[7],e[8]=t[8]+r[8],e}function hL(e,t,r){return e[0]=t[0]-r[0],e[1]=t[1]-r[1],e[2]=t[2]-r[2],e[3]=t[3]-r[3],e[4]=t[4]-r[4],e[5]=t[5]-r[5],e[6]=t[6]-r[6],e[7]=t[7]-r[7],e[8]=t[8]-r[8],e}function Yue(e,t,r){return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e[3]=t[3]*r,e[4]=t[4]*r,e[5]=t[5]*r,e[6]=t[6]*r,e[7]=t[7]*r,e[8]=t[8]*r,e}function Hue(e,t,r,i){return e[0]=t[0]+r[0]*i,e[1]=t[1]+r[1]*i,e[2]=t[2]+r[2]*i,e[3]=t[3]+r[3]*i,e[4]=t[4]+r[4]*i,e[5]=t[5]+r[5]*i,e[6]=t[6]+r[6]*i,e[7]=t[7]+r[7]*i,e[8]=t[8]+r[8]*i,e}function Wue(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]&&e[4]===t[4]&&e[5]===t[5]&&e[6]===t[6]&&e[7]===t[7]&&e[8]===t[8]}function $ue(e,t){var r=e[0],i=e[1],n=e[2],a=e[3],o=e[4],s=e[5],l=e[6],u=e[7],c=e[8],d=t[0],f=t[1],m=t[2],g=t[3],y=t[4],_=t[5],w=t[6],I=t[7],k=t[8];return Math.abs(r-d)<=qe*Math.max(1,Math.abs(r),Math.abs(d))&&Math.abs(i-f)<=qe*Math.max(1,Math.abs(i),Math.abs(f))&&Math.abs(n-m)<=qe*Math.max(1,Math.abs(n),Math.abs(m))&&Math.abs(a-g)<=qe*Math.max(1,Math.abs(a),Math.abs(g))&&Math.abs(o-y)<=qe*Math.max(1,Math.abs(o),Math.abs(y))&&Math.abs(s-_)<=qe*Math.max(1,Math.abs(s),Math.abs(_))&&Math.abs(l-w)<=qe*Math.max(1,Math.abs(l),Math.abs(w))&&Math.abs(u-I)<=qe*Math.max(1,Math.abs(u),Math.abs(I))&&Math.abs(c-k)<=qe*Math.max(1,Math.abs(c),Math.abs(k))}function Zue(){var e=new zt(16);return zt!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0),e[0]=1,e[5]=1,e[10]=1,e[15]=1,e}function Xue(e){var t=new zt(16);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t}function Jue(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function que(e,t,r,i,n,a,o,s,l,u,c,d,f,m,g,y){var _=new zt(16);return _[0]=e,_[1]=t,_[2]=r,_[3]=i,_[4]=n,_[5]=a,_[6]=o,_[7]=s,_[8]=l,_[9]=u,_[10]=c,_[11]=d,_[12]=f,_[13]=m,_[14]=g,_[15]=y,_}function Kue(e,t,r,i,n,a,o,s,l,u,c,d,f,m,g,y,_){return e[0]=t,e[1]=r,e[2]=i,e[3]=n,e[4]=a,e[5]=o,e[6]=s,e[7]=l,e[8]=u,e[9]=c,e[10]=d,e[11]=f,e[12]=m,e[13]=g,e[14]=y,e[15]=_,e}function v$(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function ece(e,t){if(e===t){var r=t[1],i=t[2],n=t[3],a=t[6],o=t[7],s=t[11];e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=r,e[6]=t[9],e[7]=t[13],e[8]=i,e[9]=a,e[11]=t[14],e[12]=n,e[13]=o,e[14]=s}else e[0]=t[0],e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=t[1],e[5]=t[5],e[6]=t[9],e[7]=t[13],e[8]=t[2],e[9]=t[6],e[10]=t[10],e[11]=t[14],e[12]=t[3],e[13]=t[7],e[14]=t[11],e[15]=t[15];return e}function tce(e,t){var r=t[0],i=t[1],n=t[2],a=t[3],o=t[4],s=t[5],l=t[6],u=t[7],c=t[8],d=t[9],f=t[10],m=t[11],g=t[12],y=t[13],_=t[14],w=t[15],I=r*s-i*o,k=r*l-n*o,D=r*u-a*o,S=i*l-n*s,L=i*u-a*s,z=n*u-a*l,N=c*y-d*g,H=c*_-f*g,q=c*w-m*g,V=d*_-f*y,Q=d*w-m*y,$=f*w-m*_,B=I*$-k*Q+D*V+S*q-L*H+z*N;return B?(B=1/B,e[0]=(s*$-l*Q+u*V)*B,e[1]=(n*Q-i*$-a*V)*B,e[2]=(y*z-_*L+w*S)*B,e[3]=(f*L-d*z-m*S)*B,e[4]=(l*q-o*$-u*H)*B,e[5]=(r*$-n*q+a*H)*B,e[6]=(_*D-g*z-w*k)*B,e[7]=(c*z-f*D+m*k)*B,e[8]=(o*Q-s*q+u*N)*B,e[9]=(i*q-r*Q-a*N)*B,e[10]=(g*L-y*D+w*I)*B,e[11]=(d*D-c*L-m*I)*B,e[12]=(s*H-o*V-l*N)*B,e[13]=(r*V-i*H+n*N)*B,e[14]=(y*k-g*S-_*I)*B,e[15]=(c*S-d*k+f*I)*B,e):null}function rce(e,t){var r=t[0],i=t[1],n=t[2],a=t[3],o=t[4],s=t[5],l=t[6],u=t[7],c=t[8],d=t[9],f=t[10],m=t[11],g=t[12],y=t[13],_=t[14],w=t[15];return e[0]=s*(f*w-m*_)-d*(l*w-u*_)+y*(l*m-u*f),e[1]=-(i*(f*w-m*_)-d*(n*w-a*_)+y*(n*m-a*f)),e[2]=i*(l*w-u*_)-s*(n*w-a*_)+y*(n*u-a*l),e[3]=-(i*(l*m-u*f)-s*(n*m-a*f)+d*(n*u-a*l)),e[4]=-(o*(f*w-m*_)-c*(l*w-u*_)+g*(l*m-u*f)),e[5]=r*(f*w-m*_)-c*(n*w-a*_)+g*(n*m-a*f),e[6]=-(r*(l*w-u*_)-o*(n*w-a*_)+g*(n*u-a*l)),e[7]=r*(l*m-u*f)-o*(n*m-a*f)+c*(n*u-a*l),e[8]=o*(d*w-m*y)-c*(s*w-u*y)+g*(s*m-u*d),e[9]=-(r*(d*w-m*y)-c*(i*w-a*y)+g*(i*m-a*d)),e[10]=r*(s*w-u*y)-o*(i*w-a*y)+g*(i*u-a*s),e[11]=-(r*(s*m-u*d)-o*(i*m-a*d)+c*(i*u-a*s)),e[12]=-(o*(d*_-f*y)-c*(s*_-l*y)+g*(s*f-l*d)),e[13]=r*(d*_-f*y)-c*(i*_-n*y)+g*(i*f-n*d),e[14]=-(r*(s*_-l*y)-o*(i*_-n*y)+g*(i*l-n*s)),e[15]=r*(s*f-l*d)-o*(i*f-n*d)+c*(i*l-n*s),e}function ice(e){var t=e[0],r=e[1],i=e[2],n=e[3],a=e[4],o=e[5],s=e[6],l=e[7],u=e[8],c=e[9],d=e[10],f=e[11],m=e[12],g=e[13],y=e[14],_=e[15],w=t*o-r*a,I=t*s-i*a,k=t*l-n*a,D=r*s-i*o,S=r*l-n*o,L=i*l-n*s,z=u*g-c*m,N=u*y-d*m,H=u*_-f*m,q=c*y-d*g,V=c*_-f*g,Q=d*_-f*y;return w*Q-I*V+k*q+D*H-S*N+L*z}function dL(e,t,r){var i=t[0],n=t[1],a=t[2],o=t[3],s=t[4],l=t[5],u=t[6],c=t[7],d=t[8],f=t[9],m=t[10],g=t[11],y=t[12],_=t[13],w=t[14],I=t[15],k=r[0],D=r[1],S=r[2],L=r[3];return e[0]=k*i+D*s+S*d+L*y,e[1]=k*n+D*l+S*f+L*_,e[2]=k*a+D*u+S*m+L*w,e[3]=k*o+D*c+S*g+L*I,k=r[4],D=r[5],S=r[6],L=r[7],e[4]=k*i+D*s+S*d+L*y,e[5]=k*n+D*l+S*f+L*_,e[6]=k*a+D*u+S*m+L*w,e[7]=k*o+D*c+S*g+L*I,k=r[8],D=r[9],S=r[10],L=r[11],e[8]=k*i+D*s+S*d+L*y,e[9]=k*n+D*l+S*f+L*_,e[10]=k*a+D*u+S*m+L*w,e[11]=k*o+D*c+S*g+L*I,k=r[12],D=r[13],S=r[14],L=r[15],e[12]=k*i+D*s+S*d+L*y,e[13]=k*n+D*l+S*f+L*_,e[14]=k*a+D*u+S*m+L*w,e[15]=k*o+D*c+S*g+L*I,e}function nce(e,t,r){var i=r[0],n=r[1],a=r[2],o,s,l,u,c,d,f,m,g,y,_,w;return t===e?(e[12]=t[0]*i+t[4]*n+t[8]*a+t[12],e[13]=t[1]*i+t[5]*n+t[9]*a+t[13],e[14]=t[2]*i+t[6]*n+t[10]*a+t[14],e[15]=t[3]*i+t[7]*n+t[11]*a+t[15]):(o=t[0],s=t[1],l=t[2],u=t[3],c=t[4],d=t[5],f=t[6],m=t[7],g=t[8],y=t[9],_=t[10],w=t[11],e[0]=o,e[1]=s,e[2]=l,e[3]=u,e[4]=c,e[5]=d,e[6]=f,e[7]=m,e[8]=g,e[9]=y,e[10]=_,e[11]=w,e[12]=o*i+c*n+g*a+t[12],e[13]=s*i+d*n+y*a+t[13],e[14]=l*i+f*n+_*a+t[14],e[15]=u*i+m*n+w*a+t[15]),e}function ace(e,t,r){var i=r[0],n=r[1],a=r[2];return e[0]=t[0]*i,e[1]=t[1]*i,e[2]=t[2]*i,e[3]=t[3]*i,e[4]=t[4]*n,e[5]=t[5]*n,e[6]=t[6]*n,e[7]=t[7]*n,e[8]=t[8]*a,e[9]=t[9]*a,e[10]=t[10]*a,e[11]=t[11]*a,e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function oce(e,t,r,i){var n=i[0],a=i[1],o=i[2],s=Math.hypot(n,a,o),l,u,c,d,f,m,g,y,_,w,I,k,D,S,L,z,N,H,q,V,Q,$,B,U;return s<qe?null:(s=1/s,n*=s,a*=s,o*=s,l=Math.sin(r),u=Math.cos(r),c=1-u,d=t[0],f=t[1],m=t[2],g=t[3],y=t[4],_=t[5],w=t[6],I=t[7],k=t[8],D=t[9],S=t[10],L=t[11],z=n*n*c+u,N=a*n*c+o*l,H=o*n*c-a*l,q=n*a*c-o*l,V=a*a*c+u,Q=o*a*c+n*l,$=n*o*c+a*l,B=a*o*c-n*l,U=o*o*c+u,e[0]=d*z+y*N+k*H,e[1]=f*z+_*N+D*H,e[2]=m*z+w*N+S*H,e[3]=g*z+I*N+L*H,e[4]=d*q+y*V+k*Q,e[5]=f*q+_*V+D*Q,e[6]=m*q+w*V+S*Q,e[7]=g*q+I*V+L*Q,e[8]=d*$+y*B+k*U,e[9]=f*$+_*B+D*U,e[10]=m*$+w*B+S*U,e[11]=g*$+I*B+L*U,t!==e&&(e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e)}function sce(e,t,r){var i=Math.sin(r),n=Math.cos(r),a=t[4],o=t[5],s=t[6],l=t[7],u=t[8],c=t[9],d=t[10],f=t[11];return t!==e&&(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[4]=a*n+u*i,e[5]=o*n+c*i,e[6]=s*n+d*i,e[7]=l*n+f*i,e[8]=u*n-a*i,e[9]=c*n-o*i,e[10]=d*n-s*i,e[11]=f*n-l*i,e}function lce(e,t,r){var i=Math.sin(r),n=Math.cos(r),a=t[0],o=t[1],s=t[2],l=t[3],u=t[8],c=t[9],d=t[10],f=t[11];return t!==e&&(e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=a*n-u*i,e[1]=o*n-c*i,e[2]=s*n-d*i,e[3]=l*n-f*i,e[8]=a*i+u*n,e[9]=o*i+c*n,e[10]=s*i+d*n,e[11]=l*i+f*n,e}function uce(e,t,r){var i=Math.sin(r),n=Math.cos(r),a=t[0],o=t[1],s=t[2],l=t[3],u=t[4],c=t[5],d=t[6],f=t[7];return t!==e&&(e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=a*n+u*i,e[1]=o*n+c*i,e[2]=s*n+d*i,e[3]=l*n+f*i,e[4]=u*n-a*i,e[5]=c*n-o*i,e[6]=d*n-s*i,e[7]=f*n-l*i,e}function cce(e,t){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=t[0],e[13]=t[1],e[14]=t[2],e[15]=1,e}function hce(e,t){return e[0]=t[0],e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=t[1],e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=t[2],e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function dce(e,t,r){var i=r[0],n=r[1],a=r[2],o=Math.hypot(i,n,a),s,l,u;return o<qe?null:(o=1/o,i*=o,n*=o,a*=o,s=Math.sin(t),l=Math.cos(t),u=1-l,e[0]=i*i*u+l,e[1]=n*i*u+a*s,e[2]=a*i*u-n*s,e[3]=0,e[4]=i*n*u-a*s,e[5]=n*n*u+l,e[6]=a*n*u+i*s,e[7]=0,e[8]=i*a*u+n*s,e[9]=n*a*u-i*s,e[10]=a*a*u+l,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e)}function pce(e,t){var r=Math.sin(t),i=Math.cos(t);return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=i,e[6]=r,e[7]=0,e[8]=0,e[9]=-r,e[10]=i,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function fce(e,t){var r=Math.sin(t),i=Math.cos(t);return e[0]=i,e[1]=0,e[2]=-r,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=r,e[9]=0,e[10]=i,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function mce(e,t){var r=Math.sin(t),i=Math.cos(t);return e[0]=i,e[1]=r,e[2]=0,e[3]=0,e[4]=-r,e[5]=i,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function x$(e,t,r){var i=t[0],n=t[1],a=t[2],o=t[3],s=i+i,l=n+n,u=a+a,c=i*s,d=i*l,f=i*u,m=n*l,g=n*u,y=a*u,_=o*s,w=o*l,I=o*u;return e[0]=1-(m+y),e[1]=d+I,e[2]=f-w,e[3]=0,e[4]=d-I,e[5]=1-(c+y),e[6]=g+_,e[7]=0,e[8]=f+w,e[9]=g-_,e[10]=1-(c+m),e[11]=0,e[12]=r[0],e[13]=r[1],e[14]=r[2],e[15]=1,e}function gce(e,t){var r=new zt(3),i=-t[0],n=-t[1],a=-t[2],o=t[3],s=t[4],l=t[5],u=t[6],c=t[7],d=i*i+n*n+a*a+o*o;return d>0?(r[0]=(s*o+c*i+l*a-u*n)*2/d,r[1]=(l*o+c*n+u*i-s*a)*2/d,r[2]=(u*o+c*a+s*n-l*i)*2/d):(r[0]=(s*o+c*i+l*a-u*n)*2,r[1]=(l*o+c*n+u*i-s*a)*2,r[2]=(u*o+c*a+s*n-l*i)*2),x$(e,t,r),e}function Ace(e,t){return e[0]=t[12],e[1]=t[13],e[2]=t[14],e}function _$(e,t){var r=t[0],i=t[1],n=t[2],a=t[4],o=t[5],s=t[6],l=t[8],u=t[9],c=t[10];return e[0]=Math.hypot(r,i,n),e[1]=Math.hypot(a,o,s),e[2]=Math.hypot(l,u,c),e}function yce(e,t){var r=new zt(3);_$(r,t);var i=1/r[0],n=1/r[1],a=1/r[2],o=t[0]*i,s=t[1]*n,l=t[2]*a,u=t[4]*i,c=t[5]*n,d=t[6]*a,f=t[8]*i,m=t[9]*n,g=t[10]*a,y=o+c+g,_=0;return y>0?(_=Math.sqrt(y+1)*2,e[3]=.25*_,e[0]=(d-m)/_,e[1]=(f-l)/_,e[2]=(s-u)/_):o>c&&o>g?(_=Math.sqrt(1+o-c-g)*2,e[3]=(d-m)/_,e[0]=.25*_,e[1]=(s+u)/_,e[2]=(f+l)/_):c>g?(_=Math.sqrt(1+c-o-g)*2,e[3]=(f-l)/_,e[0]=(s+u)/_,e[1]=.25*_,e[2]=(d+m)/_):(_=Math.sqrt(1+g-o-c)*2,e[3]=(s-u)/_,e[0]=(f+l)/_,e[1]=(d+m)/_,e[2]=.25*_),e}function vce(e,t,r,i){var n=t[0],a=t[1],o=t[2],s=t[3],l=n+n,u=a+a,c=o+o,d=n*l,f=n*u,m=n*c,g=a*u,y=a*c,_=o*c,w=s*l,I=s*u,k=s*c,D=i[0],S=i[1],L=i[2];return e[0]=(1-(g+_))*D,e[1]=(f+k)*D,e[2]=(m-I)*D,e[3]=0,e[4]=(f-k)*S,e[5]=(1-(d+_))*S,e[6]=(y+w)*S,e[7]=0,e[8]=(m+I)*L,e[9]=(y-w)*L,e[10]=(1-(d+g))*L,e[11]=0,e[12]=r[0],e[13]=r[1],e[14]=r[2],e[15]=1,e}function xce(e,t,r,i,n){var a=t[0],o=t[1],s=t[2],l=t[3],u=a+a,c=o+o,d=s+s,f=a*u,m=a*c,g=a*d,y=o*c,_=o*d,w=s*d,I=l*u,k=l*c,D=l*d,S=i[0],L=i[1],z=i[2],N=n[0],H=n[1],q=n[2],V=(1-(y+w))*S,Q=(m+D)*S,$=(g-k)*S,B=(m-D)*L,U=(1-(f+w))*L,X=(_+I)*L,ne=(g+k)*z,ce=(_-I)*z,xe=(1-(f+y))*z;return e[0]=V,e[1]=Q,e[2]=$,e[3]=0,e[4]=B,e[5]=U,e[6]=X,e[7]=0,e[8]=ne,e[9]=ce,e[10]=xe,e[11]=0,e[12]=r[0]+N-(V*N+B*H+ne*q),e[13]=r[1]+H-(Q*N+U*H+ce*q),e[14]=r[2]+q-($*N+X*H+xe*q),e[15]=1,e}function _ce(e,t){var r=t[0],i=t[1],n=t[2],a=t[3],o=r+r,s=i+i,l=n+n,u=r*o,c=i*o,d=i*s,f=n*o,m=n*s,g=n*l,y=a*o,_=a*s,w=a*l;return e[0]=1-d-g,e[1]=c+w,e[2]=f-_,e[3]=0,e[4]=c-w,e[5]=1-u-g,e[6]=m+y,e[7]=0,e[8]=f+_,e[9]=m-y,e[10]=1-u-d,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function bce(e,t,r,i,n,a,o){var s=1/(r-t),l=1/(n-i),u=1/(a-o);return e[0]=a*2*s,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=a*2*l,e[6]=0,e[7]=0,e[8]=(r+t)*s,e[9]=(n+i)*l,e[10]=(o+a)*u,e[11]=-1,e[12]=0,e[13]=0,e[14]=o*a*2*u,e[15]=0,e}function pL(e,t,r,i,n){var a=1/Math.tan(t/2),o;return e[0]=a/r,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=a,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,n!=null&&n!==1/0?(o=1/(i-n),e[10]=(n+i)*o,e[14]=2*n*i*o):(e[10]=-1,e[14]=-2*i),e}function wce(e,t,r,i,n){var a=1/Math.tan(t/2),o;return e[0]=a/r,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=a,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,n!=null&&n!==1/0?(o=1/(i-n),e[10]=n*o,e[14]=n*i*o):(e[10]=-1,e[14]=-i),e}function Ece(e,t,r,i){var n=Math.tan(t.upDegrees*Math.PI/180),a=Math.tan(t.downDegrees*Math.PI/180),o=Math.tan(t.leftDegrees*Math.PI/180),s=Math.tan(t.rightDegrees*Math.PI/180),l=2/(o+s),u=2/(n+a);return e[0]=l,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=u,e[6]=0,e[7]=0,e[8]=-((o-s)*l*.5),e[9]=(n-a)*u*.5,e[10]=i/(r-i),e[11]=-1,e[12]=0,e[13]=0,e[14]=i*r/(r-i),e[15]=0,e}function fL(e,t,r,i,n,a,o){var s=1/(t-r),l=1/(i-n),u=1/(a-o);return e[0]=-2*s,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*l,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=2*u,e[11]=0,e[12]=(t+r)*s,e[13]=(n+i)*l,e[14]=(o+a)*u,e[15]=1,e}function Cce(e,t,r,i,n,a,o){var s=1/(t-r),l=1/(i-n),u=1/(a-o);return e[0]=-2*s,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*l,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=u,e[11]=0,e[12]=(t+r)*s,e[13]=(n+i)*l,e[14]=a*u,e[15]=1,e}function Mce(e,t,r,i){var n,a,o,s,l,u,c,d,f,m,g=t[0],y=t[1],_=t[2],w=i[0],I=i[1],k=i[2],D=r[0],S=r[1],L=r[2];return Math.abs(g-D)<qe&&Math.abs(y-S)<qe&&Math.abs(_-L)<qe?v$(e):(c=g-D,d=y-S,f=_-L,m=1/Math.hypot(c,d,f),c*=m,d*=m,f*=m,n=I*f-k*d,a=k*c-w*f,o=w*d-I*c,m=Math.hypot(n,a,o),m?(m=1/m,n*=m,a*=m,o*=m):(n=0,a=0,o=0),s=d*o-f*a,l=f*n-c*o,u=c*a-d*n,m=Math.hypot(s,l,u),m?(m=1/m,s*=m,l*=m,u*=m):(s=0,l=0,u=0),e[0]=n,e[1]=s,e[2]=c,e[3]=0,e[4]=a,e[5]=l,e[6]=d,e[7]=0,e[8]=o,e[9]=u,e[10]=f,e[11]=0,e[12]=-(n*g+a*y+o*_),e[13]=-(s*g+l*y+u*_),e[14]=-(c*g+d*y+f*_),e[15]=1,e)}function Sce(e,t,r,i){var n=t[0],a=t[1],o=t[2],s=i[0],l=i[1],u=i[2],c=n-r[0],d=a-r[1],f=o-r[2],m=c*c+d*d+f*f;m>0&&(m=1/Math.sqrt(m),c*=m,d*=m,f*=m);var g=l*f-u*d,y=u*c-s*f,_=s*d-l*c;return m=g*g+y*y+_*_,m>0&&(m=1/Math.sqrt(m),g*=m,y*=m,_*=m),e[0]=g,e[1]=y,e[2]=_,e[3]=0,e[4]=d*_-f*y,e[5]=f*g-c*_,e[6]=c*y-d*g,e[7]=0,e[8]=c,e[9]=d,e[10]=f,e[11]=0,e[12]=n,e[13]=a,e[14]=o,e[15]=1,e}function Ice(e){return"mat4("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+", "+e[4]+", "+e[5]+", "+e[6]+", "+e[7]+", "+e[8]+", "+e[9]+", "+e[10]+", "+e[11]+", "+e[12]+", "+e[13]+", "+e[14]+", "+e[15]+")"}function Bce(e){return Math.hypot(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15])}function Dce(e,t,r){return e[0]=t[0]+r[0],e[1]=t[1]+r[1],e[2]=t[2]+r[2],e[3]=t[3]+r[3],e[4]=t[4]+r[4],e[5]=t[5]+r[5],e[6]=t[6]+r[6],e[7]=t[7]+r[7],e[8]=t[8]+r[8],e[9]=t[9]+r[9],e[10]=t[10]+r[10],e[11]=t[11]+r[11],e[12]=t[12]+r[12],e[13]=t[13]+r[13],e[14]=t[14]+r[14],e[15]=t[15]+r[15],e}function mL(e,t,r){return e[0]=t[0]-r[0],e[1]=t[1]-r[1],e[2]=t[2]-r[2],e[3]=t[3]-r[3],e[4]=t[4]-r[4],e[5]=t[5]-r[5],e[6]=t[6]-r[6],e[7]=t[7]-r[7],e[8]=t[8]-r[8],e[9]=t[9]-r[9],e[10]=t[10]-r[10],e[11]=t[11]-r[11],e[12]=t[12]-r[12],e[13]=t[13]-r[13],e[14]=t[14]-r[14],e[15]=t[15]-r[15],e}function Tce(e,t,r){return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e[3]=t[3]*r,e[4]=t[4]*r,e[5]=t[5]*r,e[6]=t[6]*r,e[7]=t[7]*r,e[8]=t[8]*r,e[9]=t[9]*r,e[10]=t[10]*r,e[11]=t[11]*r,e[12]=t[12]*r,e[13]=t[13]*r,e[14]=t[14]*r,e[15]=t[15]*r,e}function Pce(e,t,r,i){return e[0]=t[0]+r[0]*i,e[1]=t[1]+r[1]*i,e[2]=t[2]+r[2]*i,e[3]=t[3]+r[3]*i,e[4]=t[4]+r[4]*i,e[5]=t[5]+r[5]*i,e[6]=t[6]+r[6]*i,e[7]=t[7]+r[7]*i,e[8]=t[8]+r[8]*i,e[9]=t[9]+r[9]*i,e[10]=t[10]+r[10]*i,e[11]=t[11]+r[11]*i,e[12]=t[12]+r[12]*i,e[13]=t[13]+r[13]*i,e[14]=t[14]+r[14]*i,e[15]=t[15]+r[15]*i,e}function kce(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]&&e[4]===t[4]&&e[5]===t[5]&&e[6]===t[6]&&e[7]===t[7]&&e[8]===t[8]&&e[9]===t[9]&&e[10]===t[10]&&e[11]===t[11]&&e[12]===t[12]&&e[13]===t[13]&&e[14]===t[14]&&e[15]===t[15]}function Fce(e,t){var r=e[0],i=e[1],n=e[2],a=e[3],o=e[4],s=e[5],l=e[6],u=e[7],c=e[8],d=e[9],f=e[10],m=e[11],g=e[12],y=e[13],_=e[14],w=e[15],I=t[0],k=t[1],D=t[2],S=t[3],L=t[4],z=t[5],N=t[6],H=t[7],q=t[8],V=t[9],Q=t[10],$=t[11],B=t[12],U=t[13],X=t[14],ne=t[15];return Math.abs(r-I)<=qe*Math.max(1,Math.abs(r),Math.abs(I))&&Math.abs(i-k)<=qe*Math.max(1,Math.abs(i),Math.abs(k))&&Math.abs(n-D)<=qe*Math.max(1,Math.abs(n),Math.abs(D))&&Math.abs(a-S)<=qe*Math.max(1,Math.abs(a),Math.abs(S))&&Math.abs(o-L)<=qe*Math.max(1,Math.abs(o),Math.abs(L))&&Math.abs(s-z)<=qe*Math.max(1,Math.abs(s),Math.abs(z))&&Math.abs(l-N)<=qe*Math.max(1,Math.abs(l),Math.abs(N))&&Math.abs(u-H)<=qe*Math.max(1,Math.abs(u),Math.abs(H))&&Math.abs(c-q)<=qe*Math.max(1,Math.abs(c),Math.abs(q))&&Math.abs(d-V)<=qe*Math.max(1,Math.abs(d),Math.abs(V))&&Math.abs(f-Q)<=qe*Math.max(1,Math.abs(f),Math.abs(Q))&&Math.abs(m-$)<=qe*Math.max(1,Math.abs(m),Math.abs($))&&Math.abs(g-B)<=qe*Math.max(1,Math.abs(g),Math.abs(B))&&Math.abs(y-U)<=qe*Math.max(1,Math.abs(y),Math.abs(U))&&Math.abs(_-X)<=qe*Math.max(1,Math.abs(_),Math.abs(X))&&Math.abs(w-ne)<=qe*Math.max(1,Math.abs(w),Math.abs(ne))}function ew(){var e=new zt(3);return zt!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function Rce(e){var t=new zt(3);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t}function gL(e){var t=e[0],r=e[1],i=e[2];return Math.hypot(t,r,i)}function tw(e,t,r){var i=new zt(3);return i[0]=e,i[1]=t,i[2]=r,i}function Lce(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e}function zce(e,t,r,i){return e[0]=t,e[1]=r,e[2]=i,e}function Oce(e,t,r){return e[0]=t[0]+r[0],e[1]=t[1]+r[1],e[2]=t[2]+r[2],e}function AL(e,t,r){return e[0]=t[0]-r[0],e[1]=t[1]-r[1],e[2]=t[2]-r[2],e}function yL(e,t,r){return e[0]=t[0]*r[0],e[1]=t[1]*r[1],e[2]=t[2]*r[2],e}function vL(e,t,r){return e[0]=t[0]/r[0],e[1]=t[1]/r[1],e[2]=t[2]/r[2],e}function Nce(e,t){return e[0]=Math.ceil(t[0]),e[1]=Math.ceil(t[1]),e[2]=Math.ceil(t[2]),e}function Uce(e,t){return e[0]=Math.floor(t[0]),e[1]=Math.floor(t[1]),e[2]=Math.floor(t[2]),e}function jce(e,t,r){return e[0]=Math.min(t[0],r[0]),e[1]=Math.min(t[1],r[1]),e[2]=Math.min(t[2],r[2]),e}function Vce(e,t,r){return e[0]=Math.max(t[0],r[0]),e[1]=Math.max(t[1],r[1]),e[2]=Math.max(t[2],r[2]),e}function Qce(e,t){return e[0]=Math.round(t[0]),e[1]=Math.round(t[1]),e[2]=Math.round(t[2]),e}function Gce(e,t,r){return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e}function Yce(e,t,r,i){return e[0]=t[0]+r[0]*i,e[1]=t[1]+r[1]*i,e[2]=t[2]+r[2]*i,e}function xL(e,t){var r=t[0]-e[0],i=t[1]-e[1],n=t[2]-e[2];return Math.hypot(r,i,n)}function _L(e,t){var r=t[0]-e[0],i=t[1]-e[1],n=t[2]-e[2];return r*r+i*i+n*n}function bL(e){var t=e[0],r=e[1],i=e[2];return t*t+r*r+i*i}function Hce(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e}function Wce(e,t){return e[0]=1/t[0],e[1]=1/t[1],e[2]=1/t[2],e}function wL(e,t){var r=t[0],i=t[1],n=t[2],a=r*r+i*i+n*n;return a>0&&(a=1/Math.sqrt(a)),e[0]=t[0]*a,e[1]=t[1]*a,e[2]=t[2]*a,e}function EC(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function U0(e,t,r){var i=t[0],n=t[1],a=t[2],o=r[0],s=r[1],l=r[2];return e[0]=n*l-a*s,e[1]=a*o-i*l,e[2]=i*s-n*o,e}function $ce(e,t,r,i){var n=t[0],a=t[1],o=t[2];return e[0]=n+i*(r[0]-n),e[1]=a+i*(r[1]-a),e[2]=o+i*(r[2]-o),e}function Zce(e,t,r,i,n,a){var o=a*a,s=o*(2*a-3)+1,l=o*(a-2)+a,u=o*(a-1),c=o*(3-2*a);return e[0]=t[0]*s+r[0]*l+i[0]*u+n[0]*c,e[1]=t[1]*s+r[1]*l+i[1]*u+n[1]*c,e[2]=t[2]*s+r[2]*l+i[2]*u+n[2]*c,e}function Xce(e,t,r,i,n,a){var o=1-a,s=o*o,l=a*a,u=s*o,c=3*a*s,d=3*l*o,f=l*a;return e[0]=t[0]*u+r[0]*c+i[0]*d+n[0]*f,e[1]=t[1]*u+r[1]*c+i[1]*d+n[1]*f,e[2]=t[2]*u+r[2]*c+i[2]*d+n[2]*f,e}function Jce(e,t){t=t||1;var r=Ra()*2*Math.PI,i=Ra()*2-1,n=Math.sqrt(1-i*i)*t;return e[0]=Math.cos(r)*n,e[1]=Math.sin(r)*n,e[2]=i*t,e}function qce(e,t,r){var i=t[0],n=t[1],a=t[2],o=r[3]*i+r[7]*n+r[11]*a+r[15];return o=o||1,e[0]=(r[0]*i+r[4]*n+r[8]*a+r[12])/o,e[1]=(r[1]*i+r[5]*n+r[9]*a+r[13])/o,e[2]=(r[2]*i+r[6]*n+r[10]*a+r[14])/o,e}function Kce(e,t,r){var i=t[0],n=t[1],a=t[2];return e[0]=i*r[0]+n*r[3]+a*r[6],e[1]=i*r[1]+n*r[4]+a*r[7],e[2]=i*r[2]+n*r[5]+a*r[8],e}function ehe(e,t,r){var i=r[0],n=r[1],a=r[2],o=r[3],s=t[0],l=t[1],u=t[2],c=n*u-a*l,d=a*s-i*u,f=i*l-n*s,m=n*f-a*d,g=a*c-i*f,y=i*d-n*c,_=o*2;return c*=_,d*=_,f*=_,m*=2,g*=2,y*=2,e[0]=s+c+m,e[1]=l+d+g,e[2]=u+f+y,e}function the(e,t,r,i){var n=[],a=[];return n[0]=t[0]-r[0],n[1]=t[1]-r[1],n[2]=t[2]-r[2],a[0]=n[0],a[1]=n[1]*Math.cos(i)-n[2]*Math.sin(i),a[2]=n[1]*Math.sin(i)+n[2]*Math.cos(i),e[0]=a[0]+r[0],e[1]=a[1]+r[1],e[2]=a[2]+r[2],e}function rhe(e,t,r,i){var n=[],a=[];return n[0]=t[0]-r[0],n[1]=t[1]-r[1],n[2]=t[2]-r[2],a[0]=n[2]*Math.sin(i)+n[0]*Math.cos(i),a[1]=n[1],a[2]=n[2]*Math.cos(i)-n[0]*Math.sin(i),e[0]=a[0]+r[0],e[1]=a[1]+r[1],e[2]=a[2]+r[2],e}function ihe(e,t,r,i){var n=[],a=[];return n[0]=t[0]-r[0],n[1]=t[1]-r[1],n[2]=t[2]-r[2],a[0]=n[0]*Math.cos(i)-n[1]*Math.sin(i),a[1]=n[0]*Math.sin(i)+n[1]*Math.cos(i),a[2]=n[2],e[0]=a[0]+r[0],e[1]=a[1]+r[1],e[2]=a[2]+r[2],e}function nhe(e,t){var r=e[0],i=e[1],n=e[2],a=t[0],o=t[1],s=t[2],l=Math.sqrt(r*r+i*i+n*n),u=Math.sqrt(a*a+o*o+s*s),c=l*u,d=c&&EC(e,t)/c;return Math.acos(Math.min(Math.max(d,-1),1))}function ahe(e){return e[0]=0,e[1]=0,e[2]=0,e}function ohe(e){return"vec3("+e[0]+", "+e[1]+", "+e[2]+")"}function she(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]}function lhe(e,t){var r=e[0],i=e[1],n=e[2],a=t[0],o=t[1],s=t[2];return Math.abs(r-a)<=qe*Math.max(1,Math.abs(r),Math.abs(a))&&Math.abs(i-o)<=qe*Math.max(1,Math.abs(i),Math.abs(o))&&Math.abs(n-s)<=qe*Math.max(1,Math.abs(n),Math.abs(s))}function EL(){var e=new zt(4);return zt!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0,e[3]=0),e}function CL(e){var t=new zt(4);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t}function ML(e,t,r,i){var n=new zt(4);return n[0]=e,n[1]=t,n[2]=r,n[3]=i,n}function SL(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e}function IL(e,t,r,i,n){return e[0]=t,e[1]=r,e[2]=i,e[3]=n,e}function BL(e,t,r){return e[0]=t[0]+r[0],e[1]=t[1]+r[1],e[2]=t[2]+r[2],e[3]=t[3]+r[3],e}function DL(e,t,r){return e[0]=t[0]-r[0],e[1]=t[1]-r[1],e[2]=t[2]-r[2],e[3]=t[3]-r[3],e}function TL(e,t,r){return e[0]=t[0]*r[0],e[1]=t[1]*r[1],e[2]=t[2]*r[2],e[3]=t[3]*r[3],e}function PL(e,t,r){return e[0]=t[0]/r[0],e[1]=t[1]/r[1],e[2]=t[2]/r[2],e[3]=t[3]/r[3],e}function uhe(e,t){return e[0]=Math.ceil(t[0]),e[1]=Math.ceil(t[1]),e[2]=Math.ceil(t[2]),e[3]=Math.ceil(t[3]),e}function che(e,t){return e[0]=Math.floor(t[0]),e[1]=Math.floor(t[1]),e[2]=Math.floor(t[2]),e[3]=Math.floor(t[3]),e}function hhe(e,t,r){return e[0]=Math.min(t[0],r[0]),e[1]=Math.min(t[1],r[1]),e[2]=Math.min(t[2],r[2]),e[3]=Math.min(t[3],r[3]),e}function dhe(e,t,r){return e[0]=Math.max(t[0],r[0]),e[1]=Math.max(t[1],r[1]),e[2]=Math.max(t[2],r[2]),e[3]=Math.max(t[3],r[3]),e}function phe(e,t){return e[0]=Math.round(t[0]),e[1]=Math.round(t[1]),e[2]=Math.round(t[2]),e[3]=Math.round(t[3]),e}function kL(e,t,r){return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e[3]=t[3]*r,e}function fhe(e,t,r,i){return e[0]=t[0]+r[0]*i,e[1]=t[1]+r[1]*i,e[2]=t[2]+r[2]*i,e[3]=t[3]+r[3]*i,e}function FL(e,t){var r=t[0]-e[0],i=t[1]-e[1],n=t[2]-e[2],a=t[3]-e[3];return Math.hypot(r,i,n,a)}function RL(e,t){var r=t[0]-e[0],i=t[1]-e[1],n=t[2]-e[2],a=t[3]-e[3];return r*r+i*i+n*n+a*a}function rw(e){var t=e[0],r=e[1],i=e[2],n=e[3];return Math.hypot(t,r,i,n)}function iw(e){var t=e[0],r=e[1],i=e[2],n=e[3];return t*t+r*r+i*i+n*n}function mhe(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=-t[3],e}function ghe(e,t){return e[0]=1/t[0],e[1]=1/t[1],e[2]=1/t[2],e[3]=1/t[3],e}function LL(e,t){var r=t[0],i=t[1],n=t[2],a=t[3],o=r*r+i*i+n*n+a*a;return o>0&&(o=1/Math.sqrt(o)),e[0]=r*o,e[1]=i*o,e[2]=n*o,e[3]=a*o,e}function zL(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]*t[3]}function Ahe(e,t,r,i){var n=r[0]*i[1]-r[1]*i[0],a=r[0]*i[2]-r[2]*i[0],o=r[0]*i[3]-r[3]*i[0],s=r[1]*i[2]-r[2]*i[1],l=r[1]*i[3]-r[3]*i[1],u=r[2]*i[3]-r[3]*i[2],c=t[0],d=t[1],f=t[2],m=t[3];return e[0]=d*u-f*l+m*s,e[1]=-(c*u)+f*o-m*a,e[2]=c*l-d*o+m*n,e[3]=-(c*s)+d*a-f*n,e}function OL(e,t,r,i){var n=t[0],a=t[1],o=t[2],s=t[3];return e[0]=n+i*(r[0]-n),e[1]=a+i*(r[1]-a),e[2]=o+i*(r[2]-o),e[3]=s+i*(r[3]-s),e}function yhe(e,t){t=t||1;var r,i,n,a,o,s;do r=Ra()*2-1,i=Ra()*2-1,o=r*r+i*i;while(o>=1);do n=Ra()*2-1,a=Ra()*2-1,s=n*n+a*a;while(s>=1);var l=Math.sqrt((1-o)/s);return e[0]=t*r,e[1]=t*i,e[2]=t*n*l,e[3]=t*a*l,e}function vhe(e,t,r){var i=t[0],n=t[1],a=t[2],o=t[3];return e[0]=r[0]*i+r[4]*n+r[8]*a+r[12]*o,e[1]=r[1]*i+r[5]*n+r[9]*a+r[13]*o,e[2]=r[2]*i+r[6]*n+r[10]*a+r[14]*o,e[3]=r[3]*i+r[7]*n+r[11]*a+r[15]*o,e}function xhe(e,t,r){var i=t[0],n=t[1],a=t[2],o=r[0],s=r[1],l=r[2],u=r[3],c=u*i+s*a-l*n,d=u*n+l*i-o*a,f=u*a+o*n-s*i,m=-o*i-s*n-l*a;return e[0]=c*u+m*-o+d*-l-f*-s,e[1]=d*u+m*-s+f*-o-c*-l,e[2]=f*u+m*-l+c*-s-d*-o,e[3]=t[3],e}function _he(e){return e[0]=0,e[1]=0,e[2]=0,e[3]=0,e}function bhe(e){return"vec4("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+")"}function NL(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]}function UL(e,t){var r=e[0],i=e[1],n=e[2],a=e[3],o=t[0],s=t[1],l=t[2],u=t[3];return Math.abs(r-o)<=qe*Math.max(1,Math.abs(r),Math.abs(o))&&Math.abs(i-s)<=qe*Math.max(1,Math.abs(i),Math.abs(s))&&Math.abs(n-l)<=qe*Math.max(1,Math.abs(n),Math.abs(l))&&Math.abs(a-u)<=qe*Math.max(1,Math.abs(a),Math.abs(u))}function nw(){var e=new zt(4);return zt!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e[3]=1,e}function whe(e){return e[0]=0,e[1]=0,e[2]=0,e[3]=1,e}function jL(e,t,r){r=r*.5;var i=Math.sin(r);return e[0]=i*t[0],e[1]=i*t[1],e[2]=i*t[2],e[3]=Math.cos(r),e}function Ehe(e,t){var r=Math.acos(t[3])*2,i=Math.sin(r/2);return i>qe?(e[0]=t[0]/i,e[1]=t[1]/i,e[2]=t[2]/i):(e[0]=1,e[1]=0,e[2]=0),r}function Che(e,t){var r=UC(e,t);return Math.acos(2*r*r-1)}function VL(e,t,r){var i=t[0],n=t[1],a=t[2],o=t[3],s=r[0],l=r[1],u=r[2],c=r[3];return e[0]=i*c+o*s+n*u-a*l,e[1]=n*c+o*l+a*s-i*u,e[2]=a*c+o*u+i*l-n*s,e[3]=o*c-i*s-n*l-a*u,e}function Mhe(e,t,r){r*=.5;var i=t[0],n=t[1],a=t[2],o=t[3],s=Math.sin(r),l=Math.cos(r);return e[0]=i*l+o*s,e[1]=n*l+a*s,e[2]=a*l-n*s,e[3]=o*l-i*s,e}function She(e,t,r){r*=.5;var i=t[0],n=t[1],a=t[2],o=t[3],s=Math.sin(r),l=Math.cos(r);return e[0]=i*l-a*s,e[1]=n*l+o*s,e[2]=a*l+i*s,e[3]=o*l-n*s,e}function Ihe(e,t,r){r*=.5;var i=t[0],n=t[1],a=t[2],o=t[3],s=Math.sin(r),l=Math.cos(r);return e[0]=i*l+n*s,e[1]=n*l-i*s,e[2]=a*l+o*s,e[3]=o*l-a*s,e}function Bhe(e,t){var r=t[0],i=t[1],n=t[2];return e[0]=r,e[1]=i,e[2]=n,e[3]=Math.sqrt(Math.abs(1-r*r-i*i-n*n)),e}function b$(e,t){var r=t[0],i=t[1],n=t[2],a=t[3],o=Math.sqrt(r*r+i*i+n*n),s=Math.exp(a),l=o>0?s*Math.sin(o)/o:0;return e[0]=r*l,e[1]=i*l,e[2]=n*l,e[3]=s*Math.cos(o),e}function w$(e,t){var r=t[0],i=t[1],n=t[2],a=t[3],o=Math.sqrt(r*r+i*i+n*n),s=o>0?Math.atan2(o,a)/o:0;return e[0]=r*s,e[1]=i*s,e[2]=n*s,e[3]=.5*Math.log(r*r+i*i+n*n+a*a),e}function Dhe(e,t,r){return w$(e,t),NC(e,e,r),b$(e,e),e}function j0(e,t,r,i){var n=t[0],a=t[1],o=t[2],s=t[3],l=r[0],u=r[1],c=r[2],d=r[3],f,m,g,y,_;return m=n*l+a*u+o*c+s*d,m<0&&(m=-m,l=-l,u=-u,c=-c,d=-d),1-m>qe?(f=Math.acos(m),g=Math.sin(f),y=Math.sin((1-i)*f)/g,_=Math.sin(i*f)/g):(y=1-i,_=i),e[0]=y*n+_*l,e[1]=y*a+_*u,e[2]=y*o+_*c,e[3]=y*s+_*d,e}function The(e){var t=Ra(),r=Ra(),i=Ra(),n=Math.sqrt(1-t),a=Math.sqrt(t);return e[0]=n*Math.sin(2*Math.PI*r),e[1]=n*Math.cos(2*Math.PI*r),e[2]=a*Math.sin(2*Math.PI*i),e[3]=a*Math.cos(2*Math.PI*i),e}function Phe(e,t){var r=t[0],i=t[1],n=t[2],a=t[3],o=r*r+i*i+n*n+a*a,s=o?1/o:0;return e[0]=-r*s,e[1]=-i*s,e[2]=-n*s,e[3]=a*s,e}function khe(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=t[3],e}function QL(e,t){var r=t[0]+t[4]+t[8],i;if(r>0)i=Math.sqrt(r+1),e[3]=.5*i,i=.5/i,e[0]=(t[5]-t[7])*i,e[1]=(t[6]-t[2])*i,e[2]=(t[1]-t[3])*i;else{var n=0;t[4]>t[0]&&(n=1),t[8]>t[n*3+n]&&(n=2);var a=(n+1)%3,o=(n+2)%3;i=Math.sqrt(t[n*3+n]-t[a*3+a]-t[o*3+o]+1),e[n]=.5*i,i=.5/i,e[3]=(t[a*3+o]-t[o*3+a])*i,e[a]=(t[a*3+n]+t[n*3+a])*i,e[o]=(t[o*3+n]+t[n*3+o])*i}return e}function Fhe(e,t,r,i){var n=.5*Math.PI/180;t*=n,r*=n,i*=n;var a=Math.sin(t),o=Math.cos(t),s=Math.sin(r),l=Math.cos(r),u=Math.sin(i),c=Math.cos(i);return e[0]=a*l*c-o*s*u,e[1]=o*s*c+a*l*u,e[2]=o*l*u-a*s*c,e[3]=o*l*c+a*s*u,e}function Rhe(e){return"quat("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+")"}function GL(){var e=new zt(2);return zt!=Float32Array&&(e[0]=0,e[1]=0),e}function Lhe(e){var t=new zt(2);return t[0]=e[0],t[1]=e[1],t}function zhe(e,t){var r=new zt(2);return r[0]=e,r[1]=t,r}function Ohe(e,t){return e[0]=t[0],e[1]=t[1],e}function Nhe(e,t,r){return e[0]=t,e[1]=r,e}function Uhe(e,t,r){return e[0]=t[0]+r[0],e[1]=t[1]+r[1],e}function YL(e,t,r){return e[0]=t[0]-r[0],e[1]=t[1]-r[1],e}function HL(e,t,r){return e[0]=t[0]*r[0],e[1]=t[1]*r[1],e}function WL(e,t,r){return e[0]=t[0]/r[0],e[1]=t[1]/r[1],e}function jhe(e,t){return e[0]=Math.ceil(t[0]),e[1]=Math.ceil(t[1]),e}function Vhe(e,t){return e[0]=Math.floor(t[0]),e[1]=Math.floor(t[1]),e}function Qhe(e,t,r){return e[0]=Math.min(t[0],r[0]),e[1]=Math.min(t[1],r[1]),e}function Ghe(e,t,r){return e[0]=Math.max(t[0],r[0]),e[1]=Math.max(t[1],r[1]),e}function Yhe(e,t){return e[0]=Math.round(t[0]),e[1]=Math.round(t[1]),e}function Hhe(e,t,r){return e[0]=t[0]*r,e[1]=t[1]*r,e}function Whe(e,t,r,i){return e[0]=t[0]+r[0]*i,e[1]=t[1]+r[1]*i,e}function $L(e,t){var r=t[0]-e[0],i=t[1]-e[1];return Math.hypot(r,i)}function ZL(e,t){var r=t[0]-e[0],i=t[1]-e[1];return r*r+i*i}function XL(e){var t=e[0],r=e[1];return Math.hypot(t,r)}function JL(e){var t=e[0],r=e[1];return t*t+r*r}function $he(e,t){return e[0]=-t[0],e[1]=-t[1],e}function Zhe(e,t){return e[0]=1/t[0],e[1]=1/t[1],e}function Xhe(e,t){var r=t[0],i=t[1],n=r*r+i*i;return n>0&&(n=1/Math.sqrt(n)),e[0]=t[0]*n,e[1]=t[1]*n,e}function Jhe(e,t){return e[0]*t[0]+e[1]*t[1]}function qhe(e,t,r){var i=t[0]*r[1]-t[1]*r[0];return e[0]=e[1]=0,e[2]=i,e}function Khe(e,t,r,i){var n=t[0],a=t[1];return e[0]=n+i*(r[0]-n),e[1]=a+i*(r[1]-a),e}function ede(e,t){t=t||1;var r=Ra()*2*Math.PI;return e[0]=Math.cos(r)*t,e[1]=Math.sin(r)*t,e}function tde(e,t,r){var i=t[0],n=t[1];return e[0]=r[0]*i+r[2]*n,e[1]=r[1]*i+r[3]*n,e}function rde(e,t,r){var i=t[0],n=t[1];return e[0]=r[0]*i+r[2]*n+r[4],e[1]=r[1]*i+r[3]*n+r[5],e}function ide(e,t,r){var i=t[0],n=t[1];return e[0]=r[0]*i+r[3]*n+r[6],e[1]=r[1]*i+r[4]*n+r[7],e}function nde(e,t,r){var i=t[0],n=t[1];return e[0]=r[0]*i+r[4]*n+r[12],e[1]=r[1]*i+r[5]*n+r[13],e}function ade(e,t,r,i){var n=t[0]-r[0],a=t[1]-r[1],o=Math.sin(i),s=Math.cos(i);return e[0]=n*s-a*o+r[0],e[1]=n*o+a*s+r[1],e}function ode(e,t){var r=e[0],i=e[1],n=t[0],a=t[1],o=Math.sqrt(r*r+i*i)*Math.sqrt(n*n+a*a),s=o&&(r*n+i*a)/o;return Math.acos(Math.min(Math.max(s,-1),1))}function sde(e){return e[0]=0,e[1]=0,e}function lde(e){return"vec2("+e[0]+", "+e[1]+")"}function ude(e,t){return e[0]===t[0]&&e[1]===t[1]}function cde(e,t){var r=e[0],i=e[1],n=t[0],a=t[1];return Math.abs(r-n)<=qe*Math.max(1,Math.abs(r),Math.abs(n))&&Math.abs(i-a)<=qe*Math.max(1,Math.abs(i),Math.abs(a))}function hde(e){if(e<=0)return 0;if(e>=1)return 1;let t=e*e,r=t*e;return 4*(e<.5?r:3*(e-t)+r-.75)}function qL(e,t,r,i){let n=new nZ.default(e,t,r,i);return a=>n.solve(a)}function Hf(e,t,r){return Math.min(r,Math.max(t,e))}function dde(e,t,r){let i=r-t,n=((e-t)%i+i)%i+t;return n===t?r:n}function pde(e,t){let r=[];for(let i in e)i in t||r.push(i);return r}function Ct(e,...t){for(let r of t)for(let i in r)e[i]=r[i];return e}function CC(e,t){let r={};for(let i=0;i<t.length;i++){let n=t[i];n in e&&(r[n]=e[n])}return r}function fde(){return aZ++}function gh(e){return Math.log(e)/Math.LN2}function mde(e,t,r){let i={};for(let n in e)i[n]=t.call(r||this,e[n],n,e);return i}function Bp(e){VC[e]||(typeof console<"u"&&console.warn(e),VC[e]=!0)}function V0(e,t,r){return(r.y-e.y)*(t.x-e.x)>(t.y-e.y)*(r.x-e.x)}function Mc(e){return typeof WorkerGlobalScope<"u"&&typeof e<"u"&&e instanceof WorkerGlobalScope}function gde(e){let t=/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,r={};if(e.replace(t,(i,n,a,o)=>{let s=a||o;return r[n]=s?s.toLowerCase():!0,""}),r["max-age"]){let i=parseInt(r["max-age"],10);isNaN(i)?delete r["max-age"]:r["max-age"]=i}return r}function Ade(e){if(LA==null){let t=e.navigator?e.navigator.userAgent:null;LA=!!e.safari||!!(t&&(/\b(iPad|iPhone|iPod)\b/.test(t)||t.match("Safari")&&!t.match("Chrome")))}return LA}function Ah(e){return typeof ImageBitmap<"u"&&e instanceof ImageBitmap}function yde(e,t,r,i,n){let a=Math.max(-t,0)*4,o=(Math.max(0,r)-r)*i*4+a,s=i*4,l=Math.max(0,t),u=Math.max(0,r),c=Math.min(e.width,t+i),d=Math.min(e.height,r+n);return{rect:{x:l,y:u,width:c-l,height:d-u},layout:[{offset:o,stride:s}]}}async function vde(e,t,r,i,n){if(typeof VideoFrame>"u")throw new Error("VideoFrame not supported");let a=new VideoFrame(e,{timestamp:0});try{let o=a?.format;if(!o||!(o.startsWith("BGR")||o.startsWith("RGB")))throw new Error(`Unrecognized format ${o}`);let s=o.startsWith("BGR"),l=new Uint8ClampedArray(i*n*4);if(await a.copyTo(l,yde(e,t,r,i,n)),s)for(let u=0;u<l.length;u+=4){let c=l[u];l[u]=l[u+2],l[u+2]=c}return l}finally{a.close()}}function aw(e,t,r,i){return e.addEventListener(t,r,i),{unsubscribe:()=>{e.removeEventListener(t,r,i)}}}function $l(e){return e*Math.PI/180}function $y(){return new Error(oZ)}function KL(e){return tl.REGISTERED_PROTOCOLS[e.substring(0,e.indexOf("://"))]}async function xde(e,t){let r=new Request(e.url,{method:e.method||"GET",body:e.body,credentials:e.credentials,headers:e.headers,cache:e.cache,referrer:GC(),signal:t.signal});e.type==="json"&&!r.headers.has("Accept")&&r.headers.set("Accept","application/json");let i;try{i=await fetch(r)}catch(o){throw new em(0,o.message,e.url,new Blob)}if(!i.ok){let o=await i.blob();throw new em(i.status,i.statusText,e.url,o)}let n;e.type==="arrayBuffer"||e.type==="image"?n=i.arrayBuffer():e.type==="json"?n=i.json():n=i.text();let a=await n;if(t.signal.aborted)throw $y();return{data:a,cacheControl:i.headers.get("Cache-Control"),expires:i.headers.get("Expires")}}function _de(e,t){return new Promise((r,i)=>{let n=new XMLHttpRequest;n.open(e.method||"GET",e.url,!0),(e.type==="arrayBuffer"||e.type==="image")&&(n.responseType="arraybuffer");for(let a in e.headers)n.setRequestHeader(a,e.headers[a]);e.type==="json"&&(n.responseType="text",e.headers?.Accept||n.setRequestHeader("Accept","application/json")),n.withCredentials=e.credentials==="include",n.onerror=()=>{i(new Error(n.statusText))},n.onload=()=>{if(!t.signal.aborted)if((n.status>=200&&n.status<300||n.status===0)&&n.response!==null){let a=n.response;if(e.type==="json")try{a=JSON.parse(n.response)}catch(o){i(o);return}r({data:a,cacheControl:n.getResponseHeader("Cache-Control"),expires:n.getResponseHeader("Expires")})}else{let a=new Blob([n.response],{type:n.getResponseHeader("Content-Type")});i(new em(n.status,n.statusText,e.url,a))}},t.signal.addEventListener("abort",()=>{n.abort(),i($y())}),n.send(e.body)})}function ez(e){if(!e||e.indexOf("://")<=0||e.indexOf("data:image/")===0||e.indexOf("blob:")===0)return!0;let t=new URL(e),r=window.location;return t.protocol===r.protocol&&t.host===r.host}function bde(e){iv||!yh||(HC?E$(e):Pp=e)}function E$(e){let t=e.createTexture();e.bindTexture(e.TEXTURE_2D,t);try{if(e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,yh),e.isContextLost())return;YC.supported=!0}catch{}e.deleteTexture(t),iv=!0}function tz(e,t,r){r[e]&&r[e].indexOf(t)!==-1||(r[e]=r[e]||[],r[e].push(t))}function ow(e,t,r){if(r&&r[e]){let i=r[e].indexOf(t);i!==-1&&r[e].splice(i,1)}}function jh(e,...t){for(let r of t)for(let i in r)e[i]=r[i];return e}function dn(e,t){return{kind:"array",itemType:e,N:t}}function Ar(e){if(e.kind==="array"){let t=Ar(e.itemType);return typeof e.N=="number"?`array<${t}, ${e.N}>`:e.itemType.kind==="value"?"array":`array<${t}>`}else return e.kind}function Kp(e,t){if(t.kind==="error")return null;if(e.kind==="array"){if(t.kind==="array"&&(t.N===0&&t.itemType.kind==="value"||!Kp(e.itemType,t.itemType))&&(typeof e.N!="number"||e.N===t.N))return null}else{if(e.kind===t.kind)return null;if(e.kind==="value"){for(let r of uZ)if(!Kp(r,t))return null}}return`Expected ${Ar(e)} but found ${Ar(t)} instead.`}function sw(e,t){return t.some(r=>r.kind===e.kind)}function Zl(e,t){return t.some(r=>r==="null"?e===null:r==="array"?Array.isArray(e):r==="object"?e&&!Array.isArray(e)&&typeof e=="object":r===typeof e)}function Ws(e,t){return e.kind==="array"&&t.kind==="array"?e.itemType.kind===t.itemType.kind&&typeof e.N=="number":e.kind===t.kind}function C$(e){return e=e%360,e<0&&(e+=360),e}function M$([e,t,r,i]){e=lw(e),t=lw(t),r=lw(r);let n,a,o=uw((.2225045*e+.7168786*t+.0606169*r)/jB);e===t&&t===r?n=a=o:(n=uw((.4360747*e+.3850649*t+.1430804*r)/UB),a=uw((.0139322*e+.0971045*t+.7141733*r)/VB));let s=116*o-16;return[s<0?0:s,500*(n-o),200*(o-a),i]}function lw(e){return e<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)}function uw(e){return e>cZ?Math.pow(e,1/3):e/GB+QB}function S$([e,t,r,i]){let n=(e+16)/116,a=isNaN(t)?n:n+t/500,o=isNaN(r)?n:n-r/200;return n=jB*hw(n),a=UB*hw(a),o=VB*hw(o),[cw(3.1338561*a-1.6168667*n-.4906146*o),cw(-.9787684*a+1.9161415*n+.033454*o),cw(.0719453*a-.2289914*n+1.4052427*o),i]}function cw(e){return e=e<=.00304?12.92*e:1.055*Math.pow(e,1/2.4)-.055,e<0?0:e>1?1:e}function hw(e){return e>du?e*e*e:GB*(e-QB)}function wde(e){let[t,r,i,n]=M$(e),a=Math.sqrt(r*r+i*i);return[Math.round(a*1e4)?C$(Math.atan2(i,r)*dZ):NaN,a,t,n]}function Ede([e,t,r,i]){return e=isNaN(e)?0:e*hZ,S$([r,Math.cos(e)*t,Math.sin(e)*t,i])}function Cde([e,t,r,i]){e=C$(e),t/=100,r/=100;function n(a){let o=(a+e/30)%12,s=t*Math.min(r,1-r);return r-s*Math.max(-1,Math.min(o-3,9-o,1))}return[n(0),n(8),n(4),i]}function ef(e,t){return pZ(e,t)?e[t]:void 0}function Mde(e){if(e=e.toLowerCase().trim(),e==="transparent")return[0,0,0,0];let t=ef(fZ,e);if(t){let[n,a,o]=t;return[n/255,a/255,o/255,1]}if(e.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(e)){let n=e.length<6?1:2,a=1;return[Q0(e.slice(a,a+=n)),Q0(e.slice(a,a+=n)),Q0(e.slice(a,a+=n)),Q0(e.slice(a,a+n)||"ff")]}if(e.startsWith("rgb")){let n=/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/,a=e.match(n);if(a){let[o,s,l,u,c,d,f,m,g,y,_,w]=a,I=[u||" ",f||" ",y].join("");if(I===" "||I===" /"||I===",,"||I===",,,"){let k=[l,d,g].join(""),D=k==="%%%"?100:k===""?255:0;if(D){let S=[Jc(+s/D,0,1),Jc(+c/D,0,1),Jc(+m/D,0,1),_?rz(+_,w):1];if(iz(S))return S}}return}}let r=/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/,i=e.match(r);if(i){let[n,a,o,s,l,u,c,d,f]=i,m=[o||" ",l||" ",c].join("");if(m===" "||m===" /"||m===",,"||m===",,,"){let g=[+a,Jc(+s,0,100),Jc(+u,0,100),d?rz(+d,f):1];if(iz(g))return Cde(g)}}}function Q0(e){return parseInt(e.padEnd(2,e),16)/255}function rz(e,t){return Jc(t?e/100:e,0,1)}function Jc(e,t,r){return Math.min(Math.max(t,e),r)}function iz(e){return!e.some(Number.isNaN)}function el(e,t,r){return e+r*(t-e)}function Sc(e,t,r){return e.map((i,n)=>el(i,t[n],r))}function Sde(e){return e==="rgb"||e==="hcl"||e==="lab"}function I$(e,t,r,i){return typeof e=="number"&&e>=0&&e<=255&&typeof t=="number"&&t>=0&&t<=255&&typeof r=="number"&&r>=0&&r<=255?typeof i>"u"||typeof i=="number"&&i>=0&&i<=1?null:`Invalid rgba value [${[e,t,r,i].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof i=="number"?[e,t,r,i]:[e,t,r]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function tf(e){if(e===null||typeof e=="string"||typeof e=="boolean"||typeof e=="number"||e instanceof Tu||e instanceof ht||e instanceof nv||e instanceof ls||e instanceof La||e instanceof za||e instanceof mn||e instanceof hs||e instanceof Da)return!0;if(Array.isArray(e)){for(let t of e)if(!tf(t))return!1;return!0}else if(typeof e=="object"){for(let t in e)if(!tf(e[t]))return!1;return!0}else return!1}function Fr(e){if(e===null)return Kc;if(typeof e=="string")return st;if(typeof e=="boolean")return nt;if(typeof e=="number")return ye;if(e instanceof ht)return Ia;if(e instanceof Tu)return of;if(e instanceof nv)return sf;if(e instanceof ls)return lf;if(e instanceof La)return uf;if(e instanceof za)return cf;if(e instanceof mn)return vh;if(e instanceof hs)return hf;if(e instanceof Da)return xh;if(Array.isArray(e)){let t=e.length,r;for(let i of e){let n=Fr(i);if(!r)r=n;else{if(r===n)continue;r=rt;break}}return dn(r||rt,t)}else return nl}function jd(e){let t=typeof e;return e===null?"":t==="string"||t==="number"||t==="boolean"?String(e):e instanceof ht||e instanceof Tu||e instanceof ls||e instanceof La||e instanceof za||e instanceof mn||e instanceof hs||e instanceof Da?e.toString():JSON.stringify(e)}function Zy(e,t){let r=e.length-1,i=0,n=r,a=0,o,s;for(;i<=n;)if(a=Math.floor((i+n)/2),o=e[a],s=e[a+1],o<=t){if(a===r||t<s)return a;i=a+1}else if(o>t)n=a-1;else throw new gr("Input is not a number.");return 0}function Ide(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Bde(){if(q8)return Ow;q8=1,Ow=e;function e(t,r,i,n){this.cx=3*t,this.bx=3*(i-t)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*r,this.by=3*(n-r)-this.cy,this.ay=1-this.cy-this.by,this.p1x=t,this.p1y=r,this.p2x=i,this.p2y=n}return e.prototype={sampleCurveX:function(t){return((this.ax*t+this.bx)*t+this.cx)*t},sampleCurveY:function(t){return((this.ay*t+this.by)*t+this.cy)*t},sampleCurveDerivativeX:function(t){return(3*this.ax*t+2*this.bx)*t+this.cx},solveCurveX:function(t,r){if(r===void 0&&(r=1e-6),t<0)return 0;if(t>1)return 1;for(var i=t,n=0;n<8;n++){var a=this.sampleCurveX(i)-t;if(Math.abs(a)<r)return i;var o=this.sampleCurveDerivativeX(i);if(Math.abs(o)<1e-6)break;i=i-a/o}var s=0,l=1;for(i=t,n=0;n<20&&(a=this.sampleCurveX(i),!(Math.abs(a-t)<r));n++)t>a?s=i:l=i,i=(l-s)*.5+s;return i},solve:function(t,r){return this.sampleCurveY(this.solveCurveX(t,r))}},Ow}function dw(e,t,r,i){let n=i-r,a=e-r;return n===0?0:t===1?a/n:(Math.pow(t,a)-1)/(Math.pow(t,n)-1)}function nz(e,t){return e==="=="||e==="!="?t.kind==="boolean"||t.kind==="string"||t.kind==="number"||t.kind==="null"||t.kind==="value":t.kind==="string"||t.kind==="number"||t.kind==="value"}function Dde(e,t,r){return t===r}function Tde(e,t,r){return t!==r}function Pde(e,t,r){return t<r}function kde(e,t,r){return t>r}function Fde(e,t,r){return t<=r}function Rde(e,t,r){return t>=r}function B$(e,t,r,i){return i.compare(t,r)===0}function Lde(e,t,r,i){return!B$(e,t,r,i)}function zde(e,t,r,i){return i.compare(t,r)<0}function Ode(e,t,r,i){return i.compare(t,r)>0}function Nde(e,t,r,i){return i.compare(t,r)<=0}function Ude(e,t,r,i){return i.compare(t,r)>=0}function Ic(e,t,r){let i=e!=="=="&&e!=="!=";return class D${constructor(a,o,s){this.type=nt,this.lhs=a,this.rhs=o,this.collator=s,this.hasUntypedArgument=a.type.kind==="value"||o.type.kind==="value"}static parse(a,o){if(a.length!==3&&a.length!==4)return o.error("Expected two or three arguments.");let s=a[0],l=o.parse(a[1],1,rt);if(!l)return null;if(!nz(s,l.type))return o.concat(1).error(`"${s}" comparisons are not supported for type '${Ar(l.type)}'.`);let u=o.parse(a[2],2,rt);if(!u)return null;if(!nz(s,u.type))return o.concat(2).error(`"${s}" comparisons are not supported for type '${Ar(u.type)}'.`);if(l.type.kind!==u.type.kind&&l.type.kind!=="value"&&u.type.kind!=="value")return o.error(`Cannot compare types '${Ar(l.type)}' and '${Ar(u.type)}'.`);i&&(l.type.kind==="value"&&u.type.kind!=="value"?l=new _o(u.type,[l]):l.type.kind!=="value"&&u.type.kind==="value"&&(u=new _o(l.type,[u])));let c=null;if(a.length===4){if(l.type.kind!=="string"&&u.type.kind!=="string"&&l.type.kind!=="value"&&u.type.kind!=="value")return o.error("Cannot use collator to compare non-string types.");if(c=o.parse(a[3],3,sf),!c)return null}return new D$(l,u,c)}evaluate(a){let o=this.lhs.evaluate(a),s=this.rhs.evaluate(a);if(i&&this.hasUntypedArgument){let l=Fr(o),u=Fr(s);if(l.kind!==u.kind||!(l.kind==="string"||l.kind==="number"))throw new gr(`Expected arguments for "${e}" to be (string, string) or (number, number), but found (${l.kind}, ${u.kind}) instead.`)}if(this.collator&&!i&&this.hasUntypedArgument){let l=Fr(o),u=Fr(s);if(l.kind!=="string"||u.kind!=="string")return t(a,o,s)}return this.collator?r(a,o,s,this.collator.evaluate(a)):t(a,o,s)}eachChild(a){a(this.lhs),a(this.rhs),this.collator&&a(this.collator)}outputDefined(){return!0}}}function jde(e,t){let r=Vde(e[0]),i=Gde(e[1]),n=Math.pow(2,t.z);return[Math.round(r*n*Na),Math.round(i*n*Na)]}function DB(e,t){let r=Math.pow(2,t.z),i=(e[0]/Na+t.x)/r,n=(e[1]/Na+t.y)/r;return[Qde(i),Yde(n)]}function Vde(e){return(180+e)/360}function Qde(e){return e*360-180}function Gde(e){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+e*Math.PI/360)))/360}function Yde(e){return 360/Math.PI*Math.atan(Math.exp((180-e*360)*Math.PI/180))-90}function ym(e,t){e[0]=Math.min(e[0],t[0]),e[1]=Math.min(e[1],t[1]),e[2]=Math.max(e[2],t[0]),e[3]=Math.max(e[3],t[1])}function Wf(e,t){return!(e[0]<=t[0]||e[2]>=t[2]||e[1]<=t[1]||e[3]>=t[3])}function Hde(e,t,r){return t[1]>e[1]!=r[1]>e[1]&&e[0]<(r[0]-t[0])*(e[1]-t[1])/(r[1]-t[1])+t[0]}function Wde(e,t,r){let i=e[0]-t[0],n=e[1]-t[1],a=e[0]-r[0],o=e[1]-r[1];return i*o-a*n===0&&i*a<=0&&n*o<=0}function j1(e,t,r,i){let n=[t[0]-e[0],t[1]-e[1]],a=[i[0]-r[0],i[1]-r[1]];return Jde(a,n)===0?!1:!!(az(e,t,r,i)&&az(r,i,e,t))}function $de(e,t,r){for(let i of r)for(let n=0;n<i.length-1;++n)if(j1(e,t,i[n],i[n+1]))return!0;return!1}function Xh(e,t,r=!1){let i=!1;for(let n of t)for(let a=0;a<n.length-1;a++){if(Wde(e,n[a],n[a+1]))return r;Hde(e,n[a],n[a+1])&&(i=!i)}return i}function Zde(e,t){for(let r of t)if(Xh(e,r))return!0;return!1}function T$(e,t){for(let r of e)if(!Xh(r,t))return!1;for(let r=0;r<e.length-1;++r)if($de(e[r],e[r+1],t))return!1;return!0}function Xde(e,t){for(let r of t)if(T$(e,r))return!0;return!1}function Jde(e,t){return e[0]*t[1]-e[1]*t[0]}function az(e,t,r,i){let n=e[0]-r[0],a=e[1]-r[1],o=t[0]-r[0],s=t[1]-r[1],l=i[0]-r[0],u=i[1]-r[1],c=n*u-l*a,d=o*u-l*s;return c>0&&d<0||c<0&&d>0}function TB(e,t,r){let i=[];for(let n=0;n<e.length;n++){let a=[];for(let o=0;o<e[n].length;o++){let s=jde(e[n][o],r);ym(t,s),a.push(s)}i.push(a)}return i}function P$(e,t,r){let i=[];for(let n=0;n<e.length;n++){let a=TB(e[n],t,r);i.push(a)}return i}function k$(e,t,r,i){if(e[0]<r[0]||e[0]>r[2]){let n=i*.5,a=e[0]-r[0]>n?-i:r[0]-e[0]>n?i:0;a===0&&(a=e[0]-r[2]>n?-i:r[2]-e[0]>n?i:0),e[0]+=a}ym(t,e)}function qde(e){e[0]=e[1]=1/0,e[2]=e[3]=-1/0}function oz(e,t,r,i){let n=Math.pow(2,i.z)*Na,a=[i.x*Na,i.y*Na],o=[];for(let s of e)for(let l of s){let u=[l.x+a[0],l.y+a[1]];k$(u,t,r,n),o.push(u)}return o}function sz(e,t,r,i){let n=Math.pow(2,i.z)*Na,a=[i.x*Na,i.y*Na],o=[];for(let s of e){let l=[];for(let u of s){let c=[u.x+a[0],u.y+a[1]];ym(t,c),l.push(c)}o.push(l)}if(t[2]-t[0]<=n/2){qde(t);for(let s of o)for(let l of s)k$(l,t,r,n)}return o}function Kde(e,t){let r=[1/0,1/0,-1/0,-1/0],i=[1/0,1/0,-1/0,-1/0],n=e.canonicalID();if(t.type==="Polygon"){let a=TB(t.coordinates,i,n),o=oz(e.geometry(),r,i,n);if(!Wf(r,i))return!1;for(let s of o)if(!Xh(s,a))return!1}if(t.type==="MultiPolygon"){let a=P$(t.coordinates,i,n),o=oz(e.geometry(),r,i,n);if(!Wf(r,i))return!1;for(let s of o)if(!Zde(s,a))return!1}return!0}function epe(e,t){let r=[1/0,1/0,-1/0,-1/0],i=[1/0,1/0,-1/0,-1/0],n=e.canonicalID();if(t.type==="Polygon"){let a=TB(t.coordinates,i,n),o=sz(e.geometry(),r,i,n);if(!Wf(r,i))return!1;for(let s of o)if(!T$(s,a))return!1}if(t.type==="MultiPolygon"){let a=P$(t.coordinates,i,n),o=sz(e.geometry(),r,i,n);if(!Wf(r,i))return!1;for(let s of o)if(!Xde(s,a))return!1}return!0}function F$(e,t,r=0,i=e.length-1,n=tpe){for(;i>r;){if(i-r>600){let l=i-r+1,u=t-r+1,c=Math.log(l),d=.5*Math.exp(2*c/3),f=.5*Math.sqrt(c*d*(l-d)/l)*(u-l/2<0?-1:1),m=Math.max(r,Math.floor(t-u*d/l+f)),g=Math.min(i,Math.floor(t+(l-u)*d/l+f));F$(e,t,m,g,n)}let a=e[t],o=r,s=i;for(Vd(e,r,t),n(e[i],a)>0&&Vd(e,r,i);o<s;){for(Vd(e,o,s),o++,s--;n(e[o],a)<0;)o++;for(;n(e[s],a)>0;)s--}n(e[r],a)===0?Vd(e,r,s):(s++,Vd(e,s,i)),s<=t&&(r=s+1),t<=s&&(i=s-1)}}function Vd(e,t,r){let i=e[t];e[t]=e[r],e[r]=i}function tpe(e,t){return e<t?-1:e>t?1:0}function MC(e,t){if(e.length<=1)return[e];let r=[],i,n;for(let a of e){let o=ipe(a);o!==0&&(a.area=Math.abs(o),n===void 0&&(n=o<0),n===o<0?(i&&r.push(i),i=[a]):i.push(a))}if(i&&r.push(i),t>1)for(let a=0;a<r.length;a++)r[a].length<=t||(F$(r[a],t,1,r[a].length-1,rpe),r[a]=r[a].slice(0,t));return r}function rpe(e,t){return t.area-e.area}function ipe(e){let t=0;for(let r=0,i=e.length,n=i-1,a,o;r<i;n=r++)a=e[r],o=e[n],t+=(o.x-a.x)*(a.y+o.y);return t}function R$(e,t){return t[0]-e[0]}function Xy(e){return e[1]-e[0]+1}function fs(e,t){return e[1]>=e[0]&&e[1]<t}function SC(e,t){if(e[0]>e[1])return[null,null];let r=Xy(e);if(t){if(r===2)return[e,null];let n=Math.floor(r/2);return[[e[0],e[0]+n],[e[0]+n,e[1]]]}if(r===1)return[e,null];let i=Math.floor(r/2)-1;return[[e[0],e[0]+i],[e[0]+i+1,e[1]]]}function IC(e,t){if(!fs(t,e.length))return[1/0,1/0,-1/0,-1/0];let r=[1/0,1/0,-1/0,-1/0];for(let i=t[0];i<=t[1];++i)ym(r,e[i]);return r}function BC(e){let t=[1/0,1/0,-1/0,-1/0];for(let r of e)for(let i of r)ym(t,i);return t}function lz(e){return e[0]!==-1/0&&e[1]!==-1/0&&e[2]!==1/0&&e[3]!==1/0}function PB(e,t,r){if(!lz(e)||!lz(t))return NaN;let i=0,n=0;return e[2]<t[0]&&(i=t[0]-e[2]),e[0]>t[2]&&(i=e[0]-t[2]),e[1]>t[3]&&(n=e[1]-t[3]),e[3]<t[1]&&(n=t[1]-e[3]),r.distance([0,0],[i,n])}function xu(e,t,r){let i=r.pointOnLine(t,e);return r.distance(e,i.point)}function kB(e,t,r,i,n){let a=Math.min(xu(e,[r,i],n),xu(t,[r,i],n)),o=Math.min(xu(r,[e,t],n),xu(i,[e,t],n));return Math.min(a,o)}function npe(e,t,r,i,n){if(!(fs(t,e.length)&&fs(i,r.length)))return 1/0;let a=1/0;for(let o=t[0];o<t[1];++o){let s=e[o],l=e[o+1];for(let u=i[0];u<i[1];++u){let c=r[u],d=r[u+1];if(j1(s,l,c,d))return 0;a=Math.min(a,kB(s,l,c,d,n))}}return a}function ape(e,t,r,i,n){if(!(fs(t,e.length)&&fs(i,r.length)))return NaN;let a=1/0;for(let o=t[0];o<=t[1];++o)for(let s=i[0];s<=i[1];++s)if(a=Math.min(a,n.distance(e[o],r[s])),a===0)return a;return a}function ope(e,t,r){if(Xh(e,t,!0))return 0;let i=1/0;for(let n of t){let a=n[0],o=n[n.length-1];if(a!==o&&(i=Math.min(i,xu(e,[o,a],r)),i===0))return i;let s=r.pointOnLine(n,e);if(i=Math.min(i,r.distance(e,s.point)),i===0)return i}return i}function spe(e,t,r,i){if(!fs(t,e.length))return NaN;for(let a=t[0];a<=t[1];++a)if(Xh(e[a],r,!0))return 0;let n=1/0;for(let a=t[0];a<t[1];++a){let o=e[a],s=e[a+1];for(let l of r)for(let u=0,c=l.length,d=c-1;u<c;d=u++){let f=l[d],m=l[u];if(j1(o,s,f,m))return 0;n=Math.min(n,kB(o,s,f,m,i))}}return n}function uz(e,t){for(let r of e)for(let i of r)if(Xh(i,t,!0))return!0;return!1}function lpe(e,t,r,i=1/0){let n=BC(e),a=BC(t);if(i!==1/0&&PB(n,a,r)>=i)return i;if(Wf(n,a)){if(uz(e,t))return 0}else if(uz(t,e))return 0;let o=1/0;for(let s of e)for(let l=0,u=s.length,c=u-1;l<u;c=l++){let d=s[c],f=s[l];for(let m of t)for(let g=0,y=m.length,_=y-1;g<y;_=g++){let w=m[_],I=m[g];if(j1(d,f,w,I))return 0;o=Math.min(o,kB(d,f,w,I,r))}}return o}function cz(e,t,r,i,n,a){if(!a)return;let o=PB(IC(i,a),n,r);o<t&&e.push([o,a,[0,0]])}function G0(e,t,r,i,n,a,o){if(!a||!o)return;let s=PB(IC(i,a),IC(n,o),r);s<t&&e.push([s,a,o])}function Jy(e,t,r,i,n=1/0){let a=Math.min(i.distance(e[0],r[0][0]),n);if(a===0)return a;let o=new YB([[0,[0,e.length-1],[0,0]]],R$),s=BC(r);for(;o.length>0;){let l=o.pop();if(l[0]>=a)continue;let u=l[1],c=t?sv:ov;if(Xy(u)<=c){if(!fs(u,e.length))return NaN;if(t){let d=spe(e,u,r,i);if(isNaN(d)||d===0)return d;a=Math.min(a,d)}else for(let d=u[0];d<=u[1];++d){let f=ope(e[d],r,i);if(a=Math.min(a,f),a===0)return 0}}else{let d=SC(u,t);cz(o,a,i,e,s,d[0]),cz(o,a,i,e,s,d[1])}}return a}function qy(e,t,r,i,n,a=1/0){let o=Math.min(a,n.distance(e[0],r[0]));if(o===0)return o;let s=new YB([[0,[0,e.length-1],[0,r.length-1]]],R$);for(;s.length>0;){let l=s.pop();if(l[0]>=o)continue;let u=l[1],c=l[2],d=t?sv:ov,f=i?sv:ov;if(Xy(u)<=d&&Xy(c)<=f){if(!fs(u,e.length)&&fs(c,r.length))return NaN;let m;if(t&&i)m=npe(e,u,r,c,n),o=Math.min(o,m);else if(t&&!i){let g=e.slice(u[0],u[1]+1);for(let y=c[0];y<=c[1];++y)if(m=xu(r[y],g,n),o=Math.min(o,m),o===0)return o}else if(!t&&i){let g=r.slice(c[0],c[1]+1);for(let y=u[0];y<=u[1];++y)if(m=xu(e[y],g,n),o=Math.min(o,m),o===0)return o}else m=ape(e,u,r,c,n),o=Math.min(o,m)}else{let m=SC(u,t),g=SC(c,i);G0(s,o,n,e,r,m[0],g[0]),G0(s,o,n,e,r,m[0],g[1]),G0(s,o,n,e,r,m[1],g[0]),G0(s,o,n,e,r,m[1],g[1])}}return o}function upe(e,t){let r=e.geometry(),i=r.flat().map(o=>DB([o.x,o.y],e.canonical));if(r.length===0)return NaN;let n=new H1(i[0][1]),a=1/0;for(let o of t){switch(o.type){case"Point":a=Math.min(a,qy(i,!1,[o.coordinates],!1,n,a));break;case"LineString":a=Math.min(a,qy(i,!1,o.coordinates,!0,n,a));break;case"Polygon":a=Math.min(a,Jy(i,!1,o.coordinates,n,a));break}if(a===0)return a}return a}function cpe(e,t){let r=e.geometry(),i=r.flat().map(o=>DB([o.x,o.y],e.canonical));if(r.length===0)return NaN;let n=new H1(i[0][1]),a=1/0;for(let o of t){switch(o.type){case"Point":a=Math.min(a,qy(i,!0,[o.coordinates],!1,n,a));break;case"LineString":a=Math.min(a,qy(i,!0,o.coordinates,!0,n,a));break;case"Polygon":a=Math.min(a,Jy(i,!0,o.coordinates,n,a));break}if(a===0)return a}return a}function hpe(e,t){let r=e.geometry();if(r.length===0||r[0].length===0)return NaN;let i=MC(r,0).map(o=>o.map(s=>s.map(l=>DB([l.x,l.y],e.canonical)))),n=new H1(i[0][0][0][1]),a=1/0;for(let o of t)for(let s of i){switch(o.type){case"Point":a=Math.min(a,Jy([o.coordinates],!1,s,n,a));break;case"LineString":a=Math.min(a,Jy(o.coordinates,!0,s,n,a));break;case"Polygon":a=Math.min(a,lpe(s,o.coordinates,n,a));break}if(a===0)return a}return a}function pw(e){return e.type==="MultiPolygon"?e.coordinates.map(t=>({type:"Polygon",coordinates:t})):e.type==="MultiLineString"?e.coordinates.map(t=>({type:"LineString",coordinates:t})):e.type==="MultiPoint"?e.coordinates.map(t=>({type:"Point",coordinates:t})):[e]}function hz(e,[t,r,i,n]){t=t.evaluate(e),r=r.evaluate(e),i=i.evaluate(e);let a=n?n.evaluate(e):1,o=I$(t,r,i,a);if(o)throw new gr(o);return new ht(t/255,r/255,i/255,a,!1)}function dz(e,t){return e in t}function fw(e,t){let r=t[e];return typeof r>"u"?null:r}function dpe(e,t,r,i){for(;r<=i;){let n=r+i>>1;if(t[n]===e)return!0;t[n]>e?i=n-1:r=n+1}return!1}function Xl(e){return{type:e}}function ppe(e){return Array.isArray(e)?`(${e.map(Ar).join(", ")})`:`(${Ar(e.type)}...)`}function Ky(e){if(e instanceof ZC)return Ky(e.boundExpression);if(e instanceof hl&&e.name==="error"||e instanceof qC||e instanceof av||e instanceof lv||e instanceof uv)return!1;let t=e instanceof pu||e instanceof _o,r=!0;return e.eachChild(i=>{t?r=r&&Ky(i):r=r&&i instanceof kp}),r?V1(e)&&Q1(e,["zoom","heatmap-density","elevation","line-progress","accumulated","is-supported-script"]):!1}function V1(e){if(e instanceof hl&&(e.name==="get"&&e.args.length===1||e.name==="feature-state"||e.name==="has"&&e.args.length===1||e.name==="properties"||e.name==="geometry-type"||e.name==="id"||/^filter-/.test(e.name))||e instanceof av||e instanceof lv)return!1;let t=!0;return e.eachChild(r=>{t&&!V1(r)&&(t=!1)}),t}function $f(e){if(e instanceof hl&&e.name==="feature-state")return!1;let t=!0;return e.eachChild(r=>{t&&!$f(r)&&(t=!1)}),t}function Q1(e,t){if(e instanceof hl&&t.indexOf(e.name)>=0)return!1;let r=!0;return e.eachChild(i=>{r&&!Q1(i,t)&&(r=!1)}),r}function DC(e){return{result:"success",value:e}}function qc(e){return{result:"error",value:e}}function Zf(e){return e["property-type"]==="data-driven"||e["property-type"]==="cross-faded-data-driven"}function L$(e){return!!e.expression&&e.expression.parameters.indexOf("zoom")>-1}function FB(e){return!!e.expression&&e.expression.interpolated}function ut(e){return e instanceof Number?"number":e instanceof String?"string":e instanceof Boolean?"boolean":Array.isArray(e)?"array":e===null?"null":typeof e}function G1(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&Fr(e)===nl}function fpe(e){return e}function mpe(e){switch(e.type){case"color":return ht.parse;case"padding":return La.parse;case"numberArray":return za.parse;case"colorArray":return mn.parse;default:return null}}function gpe(e){switch(e){case"exponential":return O$;case"interval":return ype;case"categorical":return Ape;case"identity":return vpe;default:throw new Error(`Unknown function type "${e}"`)}}function z$(e,t){let r=e.stops&&typeof e.stops[0][0]=="object",i=r||e.property!==void 0,n=r||!i,a=e.type||(FB(t)?"exponential":"interval"),o=mpe(t);if(o&&(e=jh({},e),e.stops&&(e.stops=e.stops.map(c=>[c[0],o(c[1])])),e.default?e.default=o(e.default):e.default=o(t.default)),e.colorSpace&&!Sde(e.colorSpace))throw new Error(`Unknown color space: "${e.colorSpace}"`);let s=gpe(a),l,u;if(a==="categorical"){l=Object.create(null);for(let c of e.stops)l[c[0]]=c[1];u=typeof e.stops[0][0]}if(r){let c={},d=[];for(let g=0;g<e.stops.length;g++){let y=e.stops[g],_=y[0].zoom;c[_]===void 0&&(c[_]={zoom:_,type:e.type,property:e.property,default:e.default,stops:[]},d.push(_)),c[_].stops.push([y[0].value,y[1]])}let f=[];for(let g of d)f.push([c[g].zoom,z$(c[g],t)]);let m={name:"linear"};return{kind:"composite",interpolationType:m,interpolationFactor:wo.interpolationFactor.bind(void 0,m),zoomStops:f.map(g=>g[0]),evaluate({zoom:g},y){return O$({stops:f,base:e.base},t,g).evaluate(g,y)}}}else if(n){let c=a==="exponential"?{name:"exponential",base:e.base!==void 0?e.base:1}:null;return{kind:"camera",interpolationType:c,interpolationFactor:wo.interpolationFactor.bind(void 0,c),zoomStops:e.stops.map(d=>d[0]),evaluate:({zoom:d})=>s(e,t,d,l,u)}}else return{kind:"source",evaluate(c,d){let f=d&&d.properties?d.properties[e.property]:void 0;return f===void 0?vm(e.default,t.default):s(e,t,f,l,u)}}}function vm(e,t,r){if(e!==void 0)return e;if(t!==void 0)return t;if(r!==void 0)return r}function Ape(e,t,r,i,n){let a=typeof r===n?i[r]:void 0;return vm(a,e.default,t.default)}function ype(e,t,r){if(ut(r)!=="number")return vm(e.default,t.default);let i=e.stops.length;if(i===1||r<=e.stops[0][0])return e.stops[0][1];if(r>=e.stops[i-1][0])return e.stops[i-1][1];let n=Zy(e.stops.map(a=>a[0]),r);return e.stops[n][1]}function O$(e,t,r){let i=e.base!==void 0?e.base:1;if(ut(r)!=="number")return vm(e.default,t.default);let n=e.stops.length;if(n===1||r<=e.stops[0][0])return e.stops[0][1];if(r>=e.stops[n-1][0])return e.stops[n-1][1];let a=Zy(e.stops.map(c=>c[0]),r),o=xpe(r,i,e.stops[a][0],e.stops[a+1][0]),s=e.stops[a][1],l=e.stops[a+1][1],u=NA[t.type]||fpe;return typeof s.evaluate=="function"?{evaluate(...c){let d=s.evaluate.apply(void 0,c),f=l.evaluate.apply(void 0,c);if(!(d===void 0||f===void 0))return u(d,f,o,e.colorSpace)}}:u(s,l,o,e.colorSpace)}function vpe(e,t,r){switch(t.type){case"color":r=ht.parse(r);break;case"formatted":r=ls.fromString(r.toString());break;case"resolvedImage":r=Da.fromString(r.toString());break;case"padding":r=La.parse(r);break;case"colorArray":r=mn.parse(r);break;case"numberArray":r=za.parse(r);break;default:ut(r)!==t.type&&(t.type!=="enum"||!t.values[r])&&(r=void 0)}return vm(r,e.default,t.default)}function xpe(e,t,r,i){let n=i-r,a=e-r;return n===0?0:t===1?a/n:(Math.pow(t,a)-1)/(Math.pow(t,n)-1)}function RB(e){return Array.isArray(e)&&e.length>0&&typeof e[0]=="string"&&e[0]in mu}function LB(e,t){let r=new WC(mu,Ky,[],t?bpe(t):void 0),i=r.parse(e,void 0,void 0,void 0,t&&t.type==="string"?{typeAnnotation:"coerce"}:void 0);return i?DC(new KC(i,t)):qc(r.errors)}function N$(e,t){let r=LB(e,t);if(r.result==="error")return r;let i=r.value.expression,n=V1(i);if(!n&&!Zf(t))return qc([new ka("","data expressions not supported")]);let a=Q1(i,["zoom"]);if(!a&&!L$(t))return qc([new ka("","zoom expressions not supported")]);let o=RA(i);if(!o&&!a)return qc([new ka("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')]);if(o instanceof ka)return qc([o]);if(o instanceof wo&&!FB(t))return qc([new ka("",'"interpolate" expressions cannot be used with this property')]);if(!o)return DC(n?new cv("constant",r.value):new cv("source",r.value));let s=o instanceof wo?o.interpolation:void 0;return DC(n?new hv("camera",r.value,o.labels,s):new hv("composite",r.value,o.labels,s))}function _pe(e,t){if(G1(e))return new eM(e,t);if(RB(e)){let r=N$(e,t);if(r.result==="error")throw new Error(r.value.map(i=>`${i.key}: ${i.message}`).join(", "));return r.value}else{let r=e;return t.type==="color"&&typeof e=="string"?r=ht.parse(e):t.type==="padding"&&(typeof e=="number"||Array.isArray(e))?r=La.parse(e):t.type==="numberArray"&&(typeof e=="number"||Array.isArray(e))?r=za.parse(e):t.type==="colorArray"&&(typeof e=="string"||Array.isArray(e))?r=mn.parse(e):t.type==="variableAnchorOffsetCollection"&&Array.isArray(e)?r=hs.parse(e):t.type==="projectionDefinition"&&typeof e=="string"&&(r=Tu.parse(e)),{globalStateRefs:new Set,kind:"constant",evaluate:()=>r}}}function RA(e){let t=null;if(e instanceof $C)t=RA(e.result);else if(e instanceof JC){for(let r of e.args)if(t=RA(r),t)break}else(e instanceof XC||e instanceof wo)&&e.input instanceof hl&&e.input.name==="zoom"&&(t=e);return t instanceof ka||e.eachChild(r=>{let i=RA(r);i instanceof ka?t=i:!t&&i?t=new ka("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):t&&i&&t!==i&&(t=new ka("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),t}function ev(e,t=new Set){return e instanceof uv&&t.add(e.key),e.eachChild(r=>{ev(r,t)}),t}function bpe(e){let t={color:Ia,string:st,number:ye,enum:st,boolean:nt,formatted:lf,padding:uf,numberArray:cf,colorArray:vh,projectionDefinition:of,resolvedImage:xh,variableAnchorOffsetCollection:hf};return e.type==="array"?dn(t[e.value]||rt,e.length):t[e.type]}function wpe(e){if(e.type==="color"&&G1(e.default))return new ht(0,0,0,0);switch(e.type){case"color":return ht.parse(e.default)||null;case"padding":return La.parse(e.default)||null;case"numberArray":return za.parse(e.default)||null;case"colorArray":return mn.parse(e.default)||null;case"variableAnchorOffsetCollection":return hs.parse(e.default)||null;case"projectionDefinition":return Tu.parse(e.default)||null;default:return e.default===void 0?null:e.default}}function zB(e){if(e===!0||e===!1)return!0;if(!Array.isArray(e)||e.length===0)return!1;switch(e[0]){case"has":return e.length>=2&&e[1]!=="$id"&&e[1]!=="$type";case"in":return e.length>=3&&(typeof e[1]!="string"||Array.isArray(e[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return e.length!==3||Array.isArray(e[1])||Array.isArray(e[2]);case"any":case"all":for(let t of e.slice(1))if(!zB(t)&&typeof t!="boolean")return!1;return!0;default:return!0}}function mw(e){if(e==null)return{filter:()=>!0,needGeometry:!1,getGlobalStateRefs:()=>new Set};zB(e)||(e=tv(e));let t=LB(e,mZ);if(t.result==="error")throw new Error(t.value.map(r=>`${r.key}: ${r.message}`).join(", "));{let r=U$(e);return{filter:(i,n,a)=>t.value.evaluate(i,n,{},a),needGeometry:r,getGlobalStateRefs:()=>ev(t.value.expression)}}}function Epe(e,t){return e<t?-1:e>t?1:0}function U$(e){if(!Array.isArray(e))return!1;if(e[0]==="within"||e[0]==="distance")return!0;for(let t=1;t<e.length;t++)if(U$(e[t]))return!0;return!1}function tv(e){if(!e)return!0;let t=e[0];return e.length<=1?t!=="any":t==="=="?gw(e[1],e[2],"=="):t==="!="?Y0(gw(e[1],e[2],"==")):t==="<"||t===">"||t==="<="||t===">="?gw(e[1],e[2],t):t==="any"?Cpe(e.slice(1)):t==="all"?["all"].concat(e.slice(1).map(tv)):t==="none"?["all"].concat(e.slice(1).map(tv).map(Y0)):t==="in"?pz(e[1],e.slice(2)):t==="!in"?Y0(pz(e[1],e.slice(2))):t==="has"?fz(e[1]):t==="!has"?Y0(fz(e[1])):!0}function gw(e,t,r){switch(e){case"$type":return[`filter-type-${r}`,t];case"$id":return[`filter-id-${r}`,t];default:return[`filter-${r}`,e,t]}}function Cpe(e){return["any"].concat(e.map(tv))}function pz(e,t){if(t.length===0)return!1;switch(e){case"$type":return["filter-type-in",["literal",t]];case"$id":return["filter-id-in",["literal",t]];default:return t.length>200&&!t.some(r=>typeof r!=typeof t[0])?["filter-in-large",e,["literal",t.sort(Epe)]]:["filter-in-small",e,["literal",t]]}}function fz(e){switch(e){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",e]}}function Y0(e){return["!",e]}function Mpe(){let e={},t=fn.$version;for(let r in fn.$root){let i=fn.$root[r];if(i.required){let n=null;r==="version"?n=t:i.type==="array"?n=[]:n={},n!=null&&(e[r]=n)}}return e}function j$(e){let t=e.key,r=e.value;return r?[new pe(t,r,"constants have been deprecated as of v8")]:[]}function Ir(e){return e instanceof Number||e instanceof String||e instanceof Boolean?e.valueOf():e}function Iu(e){if(Array.isArray(e))return e.map(Iu);if(e instanceof Object&&!(e instanceof Number||e instanceof String||e instanceof Boolean)){let t={};for(let r in e)t[r]=Iu(e[r]);return t}return Ir(e)}function ta(e){let t=e.key,r=e.value,i=e.valueSpec||{},n=e.objectElementValidators||{},a=e.style,o=e.styleSpec,s=e.validateSpec,l=[],u=ut(r);if(u!=="object")return[new pe(t,r,`object expected, ${u} found`)];for(let c in r){let d=c.split(".")[0],f=ef(i,d)||i["*"],m;if(ef(n,d))m=n[d];else if(ef(i,d))m=s;else if(n["*"])m=n["*"];else if(i["*"])m=s;else{l.push(new pe(t,r[c],`unknown property "${c}"`));continue}l=l.concat(m({key:(t&&`${t}.`)+c,value:r[c],valueSpec:f,style:a,styleSpec:o,object:r,objectKey:c,validateSpec:s},r))}for(let c in i)n[c]||i[c].required&&i[c].default===void 0&&r[c]===void 0&&l.push(new pe(t,r,`missing required property "${c}"`));return l}function OB(e){let t=e.value,r=e.valueSpec,i=e.validateSpec,n=e.style,a=e.styleSpec,o=e.key,s=e.arrayElementValidator||i;if(ut(t)!=="array")return[new pe(o,t,`array expected, ${ut(t)} found`)];if(r.length&&t.length!==r.length)return[new pe(o,t,`array length ${r.length} expected, length ${t.length} found`)];if(r["min-length"]&&t.length<r["min-length"])return[new pe(o,t,`array length at least ${r["min-length"]} expected, length ${t.length} found`)];let l={type:r.value,values:r.values};a.$version<7&&(l.function=r.function),ut(r.value)==="object"&&(l=r.value);let u=[];for(let c=0;c<t.length;c++)u=u.concat(s({array:t,arrayIndex:c,value:t[c],valueSpec:l,validateSpec:e.validateSpec,style:n,styleSpec:a,key:`${o}[${c}]`}));return u}function Y1(e){let t=e.key,r=e.value,i=e.valueSpec,n=ut(r);return n==="number"&&r!==r&&(n="NaN"),n!=="number"?[new pe(t,r,`number expected, ${n} found`)]:"minimum"in i&&r<i.minimum?[new pe(t,r,`${r} is less than the minimum value ${i.minimum}`)]:"maximum"in i&&r>i.maximum?[new pe(t,r,`${r} is greater than the maximum value ${i.maximum}`)]:[]}function V$(e){let t=e.valueSpec,r=Ir(e.value.type),i,n={},a,o,s=r!=="categorical"&&e.value.property===void 0,l=!s,u=ut(e.value.stops)==="array"&&ut(e.value.stops[0])==="array"&&ut(e.value.stops[0][0])==="object",c=ta({key:e.key,value:e.value,valueSpec:e.styleSpec.function,validateSpec:e.validateSpec,style:e.style,styleSpec:e.styleSpec,objectElementValidators:{stops:d,default:g}});return r==="identity"&&s&&c.push(new pe(e.key,e.value,'missing required property "property"')),r!=="identity"&&!e.value.stops&&c.push(new pe(e.key,e.value,'missing required property "stops"')),r==="exponential"&&e.valueSpec.expression&&!FB(e.valueSpec)&&c.push(new pe(e.key,e.value,"exponential functions not supported")),e.styleSpec.$version>=8&&(l&&!Zf(e.valueSpec)?c.push(new pe(e.key,e.value,"property functions not supported")):s&&!L$(e.valueSpec)&&c.push(new pe(e.key,e.value,"zoom functions not supported"))),(r==="categorical"||u)&&e.value.property===void 0&&c.push(new pe(e.key,e.value,'"property" property is required')),c;function d(y){if(r==="identity")return[new pe(y.key,y.value,'identity function may not have a "stops" property')];let _=[],w=y.value;return _=_.concat(OB({key:y.key,value:w,valueSpec:y.valueSpec,validateSpec:y.validateSpec,style:y.style,styleSpec:y.styleSpec,arrayElementValidator:f})),ut(w)==="array"&&w.length===0&&_.push(new pe(y.key,w,"array must have at least one stop")),_}function f(y){let _=[],w=y.value,I=y.key;if(ut(w)!=="array")return[new pe(I,w,`array expected, ${ut(w)} found`)];if(w.length!==2)return[new pe(I,w,`array length 2 expected, length ${w.length} found`)];if(u){if(ut(w[0])!=="object")return[new pe(I,w,`object expected, ${ut(w[0])} found`)];if(w[0].zoom===void 0)return[new pe(I,w,"object stop key must have zoom")];if(w[0].value===void 0)return[new pe(I,w,"object stop key must have value")];if(o&&o>Ir(w[0].zoom))return[new pe(I,w[0].zoom,"stop zoom values must appear in ascending order")];Ir(w[0].zoom)!==o&&(o=Ir(w[0].zoom),a=void 0,n={}),_=_.concat(ta({key:`${I}[0]`,value:w[0],valueSpec:{zoom:{}},validateSpec:y.validateSpec,style:y.style,styleSpec:y.styleSpec,objectElementValidators:{zoom:Y1,value:m}}))}else _=_.concat(m({key:`${I}[0]`,value:w[0],validateSpec:y.validateSpec,style:y.style,styleSpec:y.styleSpec},w));return RB(Iu(w[1]))?_.concat([new pe(`${I}[1]`,w[1],"expressions are not allowed in function stops.")]):_.concat(y.validateSpec({key:`${I}[1]`,value:w[1],valueSpec:t,validateSpec:y.validateSpec,style:y.style,styleSpec:y.styleSpec}))}function m(y,_){let w=ut(y.value),I=Ir(y.value),k=y.value!==null?y.value:_;if(!i)i=w;else if(w!==i)return[new pe(y.key,k,`${w} stop domain type must match previous stop domain type ${i}`)];if(w!=="number"&&w!=="string"&&w!=="boolean")return[new pe(y.key,k,"stop domain value must be a number, string, or boolean")];if(w!=="number"&&r!=="categorical"){let D=`number expected, ${w} found`;return Zf(t)&&r===void 0&&(D+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new pe(y.key,k,D)]}return r==="categorical"&&w==="number"&&(!isFinite(I)||Math.floor(I)!==I)?[new pe(y.key,k,`integer expected, found ${I}`)]:r!=="categorical"&&w==="number"&&a!==void 0&&I<a?[new pe(y.key,k,"stop domain values must appear in ascending order")]:(a=I,r==="categorical"&&I in n?[new pe(y.key,k,"stop domain values must be unique")]:(n[I]=!0,[]))}function g(y){return y.validateSpec({key:y.key,value:y.value,valueSpec:t,validateSpec:y.validateSpec,style:y.style,styleSpec:y.styleSpec})}}function Vh(e){let t=(e.expressionContext==="property"?N$:LB)(Iu(e.value),e.valueSpec);if(t.result==="error")return t.value.map(i=>new pe(`${e.key}${i.key}`,e.value,i.message));let r=t.value.expression||t.value._styleExpression.expression;if(e.expressionContext==="property"&&e.propertyKey==="text-font"&&!r.outputDefined())return[new pe(e.key,e.value,`Invalid data expression for "${e.propertyKey}". Output values must be contained as literals within the expression.`)];if(e.expressionContext==="property"&&e.propertyType==="layout"&&!$f(r))return[new pe(e.key,e.value,'"feature-state" data expressions are not supported with layout properties.')];if(e.expressionContext==="filter"&&!$f(r))return[new pe(e.key,e.value,'"feature-state" data expressions are not supported with filters.')];if(e.expressionContext&&e.expressionContext.indexOf("cluster")===0){if(!Q1(r,["zoom","feature-state"]))return[new pe(e.key,e.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(e.expressionContext==="cluster-initial"&&!V1(r))return[new pe(e.key,e.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function Spe(e){let t=e.value,r=e.key,i=ut(t);return i!=="boolean"?[new pe(r,t,`boolean expected, ${i} found`)]:[]}function TC(e){let t=e.key,r=e.value,i=ut(r);return i!=="string"?[new pe(t,r,`color expected, ${i} found`)]:ht.parse(String(r))?[]:[new pe(t,r,`color expected, "${r}" found`)]}function Xf(e){let t=e.key,r=e.value,i=e.valueSpec,n=[];return Array.isArray(i.values)?i.values.indexOf(Ir(r))===-1&&n.push(new pe(t,r,`expected one of [${i.values.join(", ")}], ${JSON.stringify(r)} found`)):Object.keys(i.values).indexOf(Ir(r))===-1&&n.push(new pe(t,r,`expected one of [${Object.keys(i.values).join(", ")}], ${JSON.stringify(r)} found`)),n}function PC(e){return zB(Iu(e.value))?Vh(jh({},e,{expressionContext:"filter",valueSpec:{value:"boolean"}})):Q$(e)}function Q$(e){let t=e.value,r=e.key;if(ut(t)!=="array")return[new pe(r,t,`array expected, ${ut(t)} found`)];let i=e.styleSpec,n,a=[];if(t.length<1)return[new pe(r,t,"filter array must have at least 1 element")];switch(a=a.concat(Xf({key:`${r}[0]`,value:t[0],valueSpec:i.filter_operator,style:e.style,styleSpec:e.styleSpec})),Ir(t[0])){case"<":case"<=":case">":case">=":t.length>=2&&Ir(t[1])==="$type"&&a.push(new pe(r,t,`"$type" cannot be use with operator "${t[0]}"`));case"==":case"!=":t.length!==3&&a.push(new pe(r,t,`filter array for operator "${t[0]}" must have 3 elements`));case"in":case"!in":t.length>=2&&(n=ut(t[1]),n!=="string"&&a.push(new pe(`${r}[1]`,t[1],`string expected, ${n} found`)));for(let o=2;o<t.length;o++)n=ut(t[o]),Ir(t[1])==="$type"?a=a.concat(Xf({key:`${r}[${o}]`,value:t[o],valueSpec:i.geometry_type,style:e.style,styleSpec:e.styleSpec})):n!=="string"&&n!=="number"&&n!=="boolean"&&a.push(new pe(`${r}[${o}]`,t[o],`string, number, or boolean expected, ${n} found`));break;case"any":case"all":case"none":for(let o=1;o<t.length;o++)a=a.concat(Q$({key:`${r}[${o}]`,value:t[o],style:e.style,styleSpec:e.styleSpec}));break;case"has":case"!has":n=ut(t[1]),t.length!==2?a.push(new pe(r,t,`filter array for "${t[0]}" operator must have 2 elements`)):n!=="string"&&a.push(new pe(`${r}[1]`,t[1],`string expected, ${n} found`));break}return a}function G$(e,t){let r=e.key,i=e.validateSpec,n=e.style,a=e.styleSpec,o=e.value,s=e.objectKey,l=a[`${t}_${e.layerType}`];if(!l)return[];let u=s.match(/^(.*)-transition$/);if(t==="paint"&&u&&l[u[1]]&&l[u[1]].transition)return i({key:r,value:o,valueSpec:a.transition,style:n,styleSpec:a});let c=e.valueSpec||l[s];if(!c)return[new pe(r,o,`unknown property "${s}"`)];let d;if(ut(o)==="string"&&Zf(c)&&!c.tokens&&(d=/^{([^}]+)}$/.exec(o)))return[new pe(r,o,`"${s}" does not support interpolation syntax
|
|
10917
10917
|
Use an identity property function instead: \`{ "type": "identity", "property": ${JSON.stringify(d[1])} }\`.`)];let f=[];return e.layerType==="symbol"&&(s==="text-field"&&n&&!n.glyphs&&f.push(new pe(r,o,'use of "text-field" requires a style "glyphs" property')),s==="text-font"&&G1(Iu(o))&&Ir(o.type)==="identity"&&f.push(new pe(r,o,'"text-font" does not support identity functions'))),f.concat(i({key:e.key,value:o,valueSpec:c,style:n,styleSpec:a,expressionContext:"property",propertyType:t,propertyKey:s}))}function Y$(e){return G$(e,"paint")}function H$(e){return G$(e,"layout")}function mz(e){let t=[],r=e.value,i=e.key,n=e.style,a=e.styleSpec;if(ut(r)!=="object")return[new pe(i,r,`object expected, ${ut(r)} found`)];!r.type&&!r.ref&&t.push(new pe(i,r,'either "type" or "ref" is required'));let o=Ir(r.type),s=Ir(r.ref);if(r.id){let l=Ir(r.id);for(let u=0;u<e.arrayIndex;u++){let c=n.layers[u];Ir(c.id)===l&&t.push(new pe(i,r.id,`duplicate layer id "${r.id}", previously used at line ${c.id.__line__}`))}}if("ref"in r){["type","source","source-layer","filter","layout"].forEach(u=>{u in r&&t.push(new pe(i,r[u],`"${u}" is prohibited for ref layers`))});let l;n.layers.forEach(u=>{Ir(u.id)===s&&(l=u)}),l?l.ref?t.push(new pe(i,r.ref,"ref cannot reference another ref layer")):o=Ir(l.type):t.push(new pe(i,r.ref,`ref layer "${s}" not found`))}else if(o!=="background")if(!r.source)t.push(new pe(i,r,'missing required property "source"'));else{let l=n.sources&&n.sources[r.source],u=l&&Ir(l.type);l?u==="vector"&&o==="raster"?t.push(new pe(i,r.source,`layer "${r.id}" requires a raster source`)):u!=="raster-dem"&&o==="hillshade"?t.push(new pe(i,r.source,`layer "${r.id}" requires a raster-dem source`)):u!=="raster-dem"&&o==="color-relief"?t.push(new pe(i,r.source,`layer "${r.id}" requires a raster-dem source`)):u==="raster"&&o!=="raster"?t.push(new pe(i,r.source,`layer "${r.id}" requires a vector source`)):u==="vector"&&!r["source-layer"]?t.push(new pe(i,r,`layer "${r.id}" must specify a "source-layer"`)):u==="raster-dem"&&o!=="hillshade"&&o!=="color-relief"?t.push(new pe(i,r.source,"raster-dem source can only be used with layer type 'hillshade' or 'color-relief'.")):o==="line"&&r.paint&&r.paint["line-gradient"]&&(u!=="geojson"||!l.lineMetrics)&&t.push(new pe(i,r,`layer "${r.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):t.push(new pe(i,r.source,`source "${r.source}" not found`))}return t=t.concat(ta({key:i,value:r,valueSpec:a.layer,style:e.style,styleSpec:e.styleSpec,validateSpec:e.validateSpec,objectElementValidators:{"*"(){return[]},type(){return e.validateSpec({key:`${i}.type`,value:r.type,valueSpec:a.layer.type,style:e.style,styleSpec:e.styleSpec,validateSpec:e.validateSpec,object:r,objectKey:"type"})},filter:PC,layout(l){return ta({layer:r,key:l.key,value:l.value,style:l.style,styleSpec:l.styleSpec,validateSpec:l.validateSpec,objectElementValidators:{"*"(u){return H$(jh({layerType:o},u))}}})},paint(l){return ta({layer:r,key:l.key,value:l.value,style:l.style,styleSpec:l.styleSpec,validateSpec:l.validateSpec,objectElementValidators:{"*"(u){return Y$(jh({layerType:o},u))}}})}}})),t}function Bu(e){let t=e.value,r=e.key,i=ut(t);return i!=="string"?[new pe(r,t,`string expected, ${i} found`)]:[]}function Ipe(e){var t;let r=(t=e.sourceName)!==null&&t!==void 0?t:"",i=e.value,n=e.styleSpec,a=n.source_raster_dem,o=e.style,s=[],l=ut(i);if(i===void 0)return s;if(l!=="object")return s.push(new pe("source_raster_dem",i,`object expected, ${l} found`)),s;let u=Ir(i.encoding)==="custom",c=["redFactor","greenFactor","blueFactor","baseShift"],d=e.value.encoding?`"${e.value.encoding}"`:"Default";for(let f in i)!u&&c.includes(f)?s.push(new pe(f,i[f],`In "${r}": "${f}" is only valid when "encoding" is set to "custom". ${d} encoding found`)):a[f]?s=s.concat(e.validateSpec({key:f,value:i[f],valueSpec:a[f],validateSpec:e.validateSpec,style:o,styleSpec:n})):s.push(new pe(f,i[f],`unknown property "${f}"`));return s}function gz(e){let t=e.value,r=e.key,i=e.styleSpec,n=e.style,a=e.validateSpec;if(!t.type)return[new pe(r,t,'"type" is required')];let o=Ir(t.type),s;switch(o){case"vector":case"raster":return s=ta({key:r,value:t,valueSpec:i[`source_${o.replace("-","_")}`],style:e.style,styleSpec:i,objectElementValidators:tM,validateSpec:a}),s;case"raster-dem":return s=Ipe({sourceName:r,value:t,style:e.style,styleSpec:i,validateSpec:a}),s;case"geojson":if(s=ta({key:r,value:t,valueSpec:i.source_geojson,style:n,styleSpec:i,validateSpec:a,objectElementValidators:tM}),t.cluster)for(let l in t.clusterProperties){let[u,c]=t.clusterProperties[l],d=typeof u=="string"?[u,["accumulated"],["get",l]]:u;s.push(...Vh({key:`${r}.${l}.map`,value:c,expressionContext:"cluster-map"})),s.push(...Vh({key:`${r}.${l}.reduce`,value:d,expressionContext:"cluster-reduce"}))}return s;case"video":return ta({key:r,value:t,valueSpec:i.source_video,style:n,validateSpec:a,styleSpec:i});case"image":return ta({key:r,value:t,valueSpec:i.source_image,style:n,validateSpec:a,styleSpec:i});case"canvas":return[new pe(r,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return Xf({key:`${r}.type`,value:t.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]}})}}function Bpe({key:e,value:t}){if(ut(t)==="string")return Bu({key:e,value:t});{let r=[];for(let i in t)r.push(...Bu({key:`${e}.${i}`,value:t[i]}));return r}}function Az(e){let t=e.value,r=e.styleSpec,i=r.light,n=e.style,a=[],o=ut(t);if(t===void 0)return a;if(o!=="object")return a=a.concat([new pe("light",t,`object expected, ${o} found`)]),a;for(let s in t){let l=s.match(/^(.*)-transition$/);l&&i[l[1]]&&i[l[1]].transition?a=a.concat(e.validateSpec({key:s,value:t[s],valueSpec:r.transition,validateSpec:e.validateSpec,style:n,styleSpec:r})):i[s]?a=a.concat(e.validateSpec({key:s,value:t[s],valueSpec:i[s],validateSpec:e.validateSpec,style:n,styleSpec:r})):a=a.concat([new pe(s,t[s],`unknown property "${s}"`)])}return a}function yz(e){let t=e.value,r=e.styleSpec,i=r.sky,n=e.style,a=ut(t);if(t===void 0)return[];if(a!=="object")return[new pe("sky",t,`object expected, ${a} found`)];let o=[];for(let s in t)i[s]?o=o.concat(e.validateSpec({key:s,value:t[s],valueSpec:i[s],style:n,styleSpec:r})):o=o.concat([new pe(s,t[s],`unknown property "${s}"`)]);return o}function vz(e){let t=e.value,r=e.styleSpec,i=r.terrain,n=e.style,a=[],o=ut(t);if(t===void 0)return a;if(o!=="object")return a=a.concat([new pe("terrain",t,`object expected, ${o} found`)]),a;for(let s in t)i[s]?a=a.concat(e.validateSpec({key:s,value:t[s],valueSpec:i[s],validateSpec:e.validateSpec,style:n,styleSpec:r})):a=a.concat([new pe(s,t[s],`unknown property "${s}"`)]);return a}function Dpe(e){return Bu(e).length===0?[]:Vh(e)}function Tpe(e){return Bu(e).length===0?[]:Vh(e)}function Ppe(e){let t=e.key,r=e.value;if(ut(r)==="array"){if(r.length<1||r.length>4)return[new pe(t,r,`padding requires 1 to 4 values; ${r.length} values found`)];let i={type:"number"},n=[];for(let a=0;a<r.length;a++)n=n.concat(e.validateSpec({key:`${t}[${a}]`,value:r[a],validateSpec:e.validateSpec,valueSpec:i}));return n}else return Y1({key:t,value:r,valueSpec:{}})}function kpe(e){let t=e.key,r=e.value;if(ut(r)==="array"){let i={type:"number"};if(r.length<1)return[new pe(t,r,"array length at least 1 expected, length 0 found")];let n=[];for(let a=0;a<r.length;a++)n=n.concat(e.validateSpec({key:`${t}[${a}]`,value:r[a],validateSpec:e.validateSpec,valueSpec:i}));return n}else return Y1({key:t,value:r,valueSpec:{}})}function Fpe(e){let t=e.key,r=e.value;if(ut(r)==="array"){if(r.length<1)return[new pe(t,r,"array length at least 1 expected, length 0 found")];let i=[];for(let n=0;n<r.length;n++)i=i.concat(TC({key:`${t}[${n}]`,value:r[n]}));return i}else return TC({key:t,value:r})}function Rpe(e){let t=e.key,r=e.value,i=ut(r),n=e.styleSpec;if(i!=="array"||r.length<1||r.length%2!==0)return[new pe(t,r,"variableAnchorOffsetCollection requires a non-empty array of even length")];let a=[];for(let o=0;o<r.length;o+=2)a=a.concat(Xf({key:`${t}[${o}]`,value:r[o],valueSpec:n.layout_symbol["text-anchor"]})),a=a.concat(OB({key:`${t}[${o+1}]`,value:r[o+1],valueSpec:{length:2,value:"number"},validateSpec:e.validateSpec,style:e.style,styleSpec:n}));return a}function xz(e){let t=[],r=e.value,i=e.key;if(Array.isArray(r)){let n=[],a=[];for(let o in r){r[o].id&&n.includes(r[o].id)&&t.push(new pe(i,r,`all the sprites' ids must be unique, but ${r[o].id} is duplicated`)),n.push(r[o].id),r[o].url&&a.includes(r[o].url)&&t.push(new pe(i,r,`all the sprites' URLs must be unique, but ${r[o].url} is duplicated`)),a.push(r[o].url);let s={id:{type:"string",required:!0},url:{type:"string",required:!0}};t=t.concat(ta({key:`${i}[${o}]`,value:r[o],valueSpec:s,validateSpec:e.validateSpec}))}return t}else return Bu({key:i,value:r})}function Lpe(e){let t=e.value,r=e.styleSpec,i=r.projection,n=e.style,a=ut(t);if(t===void 0)return[];if(a!=="object")return[new pe("projection",t,`object expected, ${a} found`)];let o=[];for(let s in t)i[s]?o=o.concat(e.validateSpec({key:s,value:t[s],valueSpec:i[s],style:n,styleSpec:r})):o=o.concat([new pe(s,t[s],`unknown property "${s}"`)]);return o}function zpe(e){let t=e.key,r=e.value;r=r instanceof String?r.valueOf():r;let i=ut(r);return i==="array"&&!Npe(r)&&!Ope(r)?[new pe(t,r,`projection expected, invalid array ${JSON.stringify(r)} found`)]:["array","string"].includes(i)?[]:[new pe(t,r,`projection expected, invalid type "${i}" found`)]}function Ope(e){return!!["interpolate","step","literal"].includes(e[0])}function Npe(e){return Array.isArray(e)&&e.length===3&&typeof e[0]=="string"&&typeof e[1]=="string"&&typeof e[2]=="number"}function Upe(e){return!!e&&e.constructor===Object}function _z(e){return Upe(e.value)?[]:[new pe(e.key,e.value,`object expected, ${ut(e.value)} found`)]}function rv(e){let t=e.value,r=e.valueSpec,i=e.styleSpec;return e.validateSpec=rv,r.expression&&G1(Ir(t))?V$(e):r.expression&&RB(Iu(t))?Vh(e):r.type&&rM[r.type]?rM[r.type](e):ta(jh({},e,{valueSpec:r.type?i[r.type]:r}))}function W$(e){let t=e.value,r=e.key,i=Bu(e);return i.length||(t.indexOf("{fontstack}")===-1&&i.push(new pe(r,t,'"glyphs" url must include a "{fontstack}" token')),t.indexOf("{range}")===-1&&i.push(new pe(r,t,'"glyphs" url must include a "{range}" token'))),i}function On(e,t=fn){let r=[];return r=r.concat(rv({key:"",value:e,valueSpec:t.$root,styleSpec:t,style:e,validateSpec:rv,objectElementValidators:{glyphs:W$,"*"(){return[]}}})),e.constants&&(r=r.concat(j$({key:"constants",value:e.constants}))),$$(r)}function xa(e){return function(t){return e({...t,validateSpec:rv})}}function $$(e){return[].concat(e).sort((t,r)=>t.line-r.line)}function _a(e){return function(...t){return $$(e.apply(this,t))}}function be(e,t,r={}){if(Eo[e])throw new Error(`${e} is already registered.`);Object.defineProperty(t,"_classRegistryKey",{value:e,writeable:!1}),Eo[e]={klass:t,omit:r.omit||[],shallow:r.shallow||[]}}function Z$(e){return e&&typeof ArrayBuffer<"u"&&(e instanceof ArrayBuffer||e.constructor&&e.constructor.name==="ArrayBuffer")}function NB(e){let t=e.constructor;return e.$name||t._classRegistryKey}function jpe(e){if(e===null||typeof e!="object")return!1;let t=NB(e);return!!(t&&t!=="Object")}function X$(e){return!jpe(e)&&(e==null||typeof e=="boolean"||typeof e=="number"||typeof e=="string"||e instanceof Boolean||e instanceof Number||e instanceof String||e instanceof Date||e instanceof RegExp||e instanceof Blob||e instanceof Error||Z$(e)||Ah(e)||ArrayBuffer.isView(e)||e instanceof ImageData)}function rf(e,t){if(X$(e)){if((Z$(e)||Ah(e))&&t&&t.push(e),ArrayBuffer.isView(e)){let a=e;t&&t.push(a.buffer)}return e instanceof ImageData&&t&&t.push(e.data.buffer),e}if(Array.isArray(e)){let a=[];for(let o of e)a.push(rf(o,t));return a}if(typeof e!="object")throw new Error(`can't serialize object of type ${typeof e}`);let r=NB(e);if(!r)throw new Error(`can't serialize object of unregistered class ${e.constructor.name}`);if(!Eo[r])throw new Error(`${r} is not registered.`);let{klass:i}=Eo[r],n=i.serialize?i.serialize(e,t):{};if(i.serialize){if(t&&n===t[t.length-1])throw new Error("statically serialized object won't survive transfer of $name property")}else{for(let a in e){if(!e.hasOwnProperty(a)||Eo[r].omit.indexOf(a)>=0)continue;let o=e[a];n[a]=Eo[r].shallow.indexOf(a)>=0?o:rf(o,t)}e instanceof Error&&(n.message=e.message)}if(n.$name)throw new Error("$name property is reserved for worker serialization logic.");return r!=="Object"&&(n.$name=r),n}function nf(e){if(X$(e))return e;if(Array.isArray(e))return e.map(nf);if(typeof e!="object")throw new Error(`can't deserialize object of type ${typeof e}`);let t=NB(e)||"Object";if(!Eo[t])throw new Error(`can't deserialize unregistered class ${t}`);let{klass:r}=Eo[t];if(!r)throw new Error(`can't deserialize unregistered class ${t}`);if(r.deserialize)return r.deserialize(e);let i=Object.create(r.prototype);for(let n of Object.keys(e)){if(n==="$name")continue;let a=e[n];i[n]=Eo[t].shallow.indexOf(n)>=0?a:nf(a)}return i}function Vpe(e){for(let t of e)if(Qpe(t.charCodeAt(0)))return!0;return!1}function Aw(e){let t=e.map(r=>{try{return new RegExp(`\\p{sc=${r}}`,"u").source}catch{return null}}).filter(r=>r);return new RegExp(t.join("|"),"u")}function Qpe(e){return e===746||e===747?!0:e<4352?!1:!!(Rr["CJK Compatibility Forms"](e)&&!(e>=65097&&e<=65103)||Rr["CJK Compatibility"](e)||Rr["CJK Strokes"](e)||Rr["CJK Symbols and Punctuation"](e)&&!(e>=12296&&e<=12305)&&!(e>=12308&&e<=12319)&&e!==12336||Rr["Enclosed CJK Letters and Months"](e)||Rr["Ideographic Description Characters"](e)||Rr.Kanbun(e)||Rr.Katakana(e)&&e!==12540||Rr["Halfwidth and Fullwidth Forms"](e)&&e!==65288&&e!==65289&&e!==65293&&!(e>=65306&&e<=65310)&&e!==65339&&e!==65341&&e!==65343&&!(e>=65371&&e<=65503)&&e!==65507&&!(e>=65512&&e<=65519)||Rr["Small Form Variants"](e)&&!(e>=65112&&e<=65118)&&!(e>=65123&&e<=65126)||Rr["Vertical Forms"](e)||Rr["Yijing Hexagram Symbols"](e)||/\p{sc=Cans}/u.test(String.fromCodePoint(e))||/\p{sc=Hang}/u.test(String.fromCodePoint(e))||gZ.test(String.fromCodePoint(e)))}function J$(e){return AZ.test(String.fromCodePoint(e))}function Gpe(e,t){return!(!t&&J$(e)||e>=2304&&e<=3583||e>=3840&&e<=4255||Rr.Khmer(e))}function Ype(e){for(let t of e)if(J$(t.charCodeAt(0)))return!0;return!1}function Hpe(e,t){for(let r of e)if(!Gpe(r.charCodeAt(0),t))return!1;return!0}function _r(e,t=1){let r=0,i=0,n=e.map(o=>{let s=Wpe(o.type),l=r=bz(r,Math.max(t,s)),u=o.components||1;return i=Math.max(i,s),r+=s*u,{name:o.name,type:o.type,components:u,offset:l}}),a=bz(r,Math.max(i,t));return{members:n,size:a,alignment:t}}function Wpe(e){return vZ[e].BYTES_PER_ELEMENT}function bz(e,t){return Math.ceil(e/t)*t}function wz(e,t){return e=Hf(Math.floor(e),0,255),t=Hf(Math.floor(t),0,255),256*e+t}function Ez(e){let t=+e;return!isNaN(t)&&t<=Number.MAX_SAFE_INTEGER?t:(0,xZ.default)(String(e))}function kC(e,t,r,i){for(;r<i;){let n=e[r+i>>1],a=r-1,o=i+1;for(;;){do a++;while(e[a]<n);do o--;while(e[o]>n);if(a>=o)break;H0(e,a,o),H0(t,3*a,3*o),H0(t,3*a+1,3*o+1),H0(t,3*a+2,3*o+2)}o-r<i-o?(kC(e,t,r,o),r=o+1):(kC(e,t,o+1,i),i=o)}}function H0(e,t,r){let i=e[t];e[t]=e[r],e[r]=i}function yw(e){return[wz(255*e.r,255*e.g),wz(255*e.b,255*e.a)]}function $pe(e,t){return{"text-opacity":["opacity"],"icon-opacity":["opacity"],"text-color":["fill_color"],"icon-color":["fill_color"],"text-halo-color":["halo_color"],"icon-halo-color":["halo_color"],"text-halo-blur":["halo_blur"],"icon-halo-blur":["halo_blur"],"text-halo-width":["halo_width"],"icon-halo-width":["halo_width"],"line-gap-width":["gapwidth"],"line-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-extrusion-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"]}[e]||[e.replace(`${t}-`,"").replace(/-/g,"_")]}function Zpe(e){return{"line-pattern":{source:fu,composite:fu},"fill-pattern":{source:fu,composite:fu},"fill-extrusion-pattern":{source:fu,composite:fu}}[e]}function Cz(e,t,r){let i={color:{source:_h,composite:UA},number:{source:Fp,composite:_h}},n=Zpe(e);return n&&n[r]||i[t][r]}function hu(e){let t=8192/e.extent,r=e.loadGeometry();for(let i=0;i<r.length;i++){let n=r[i];for(let a=0;a<n.length;a++){let o=n[a],s=Math.round(o.x*t),l=Math.round(o.y*t);o.x=Hf(s,iM,dv),o.y=Hf(l,iM,dv),(s<o.x||s>o.x+1||l<o.y||l>o.y+1)&&Bp("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return r}function Jl(e,t){return{type:e.type,id:e.id,properties:e.properties,geometry:t?hu(e):[]}}function Xpe(e,t,r,i,n){e.emplaceBack(nM+t*8+i,nM+r*8+n)}function Jpe(e,t){let r=!1;for(let i=0,n=e.length-1;i<e.length;n=i++){let a=e[i],o=e[n];a.y>t.y!=o.y>t.y&&t.x<(o.x-a.x)*(t.y-a.y)/(o.y-a.y)+a.x&&(r=!r)}return r}function qpe(e,t,r,i,n){for(let o of e)if(t<=o.x&&r<=o.y&&i>=o.x&&n>=o.y)return!0;let a=[new Rp.default(t,r),new Rp.default(t,n),new Rp.default(i,n),new Rp.default(i,r)];if(e.length>2){for(let o of a)if(Jpe(e,o))return!0}for(let o=0;o<e.length-1;o++){let s=e[o],l=e[o+1];if(Kpe(s,l,a))return!0}return!1}function Kpe(e,t,r){let i=r[0],n=r[2];if(e.x<i.x&&t.x<i.x||e.x>n.x&&t.x>n.x||e.y<i.y&&t.y<i.y||e.y>n.y&&t.y>n.y)return!1;let a=V0(e,t,r[0]);return a!==V0(e,t,r[1])||a!==V0(e,t,r[2])||a!==V0(e,t,r[3])}function FC(e,{width:t,height:r},i,n){if(!n)n=new Uint8Array(t*r*i);else if(n instanceof Uint8ClampedArray)n=new Uint8Array(n.buffer);else if(n.length!==t*r*i)throw new RangeError(`mismatched image size. expected: ${n.length} but got: ${t*r*i}`);return e.width=t,e.height=r,e.data=n,e}function Mz(e,{width:t,height:r},i){if(t===e.width&&r===e.height)return;let n=FC({},{width:t,height:r},i);RC(e,n,{x:0,y:0},{x:0,y:0},{width:Math.min(e.width,t),height:Math.min(e.height,r)},i),e.width=t,e.height=r,e.data=n.data}function RC(e,t,r,i,n,a){if(n.width===0||n.height===0)return t;if(n.width>e.width||n.height>e.height||r.x>e.width-n.width||r.y>e.height-n.height)throw new RangeError("out of range source coordinates for image copy");if(n.width>t.width||n.height>t.height||i.x>t.width-n.width||i.y>t.height-n.height)throw new RangeError("out of range destination coordinates for image copy");let o=e.data,s=t.data;if(o===s)throw new Error("srcData equals dstData, so image is already copied");for(let l=0;l<n.height;l++){let u=((r.y+l)*e.width+r.x)*a,c=((i.y+l)*t.width+i.x)*a;for(let d=0;d<n.width*a;d++)s[c+d]=o[u+d]}return t}function efe(e,t){let r=t[0],i=t[1],n=t[2],a=t[3],o=Math.min(r,i,n),s=Math.round((e+a)/o);return{r:Math.floor(s*o/r)%256,g:Math.floor(s*o/i)%256,b:Math.floor(s*o/n)%256}}function vw(e,t,r){let i=r.patternDependencies,n=!1;for(let a of t){let o=a.paint.get(`${e}-pattern`);o.isConstant()||(n=!0);let s=o.constantOr(null);s&&(n=!0,i[s.to]=!0,i[s.from]=!0)}return n}function xw(e,t,r,i,n){let a=n.patternDependencies;for(let o of t){let s=o.paint.get(`${e}-pattern`).value;if(s.kind!=="constant"){let l=s.evaluate({zoom:i-1},r,{},n.availableImages),u=s.evaluate({zoom:i},r,{},n.availableImages),c=s.evaluate({zoom:i+1},r,{},n.availableImages);l=l&&l.name?l.name:l,u=u&&u.name?u.name:u,c=c&&c.name?c.name:c,a[l]=!0,a[u]=!0,a[c]=!0,r.patterns[o.id]={min:l,mid:u,max:c}}}return r}function tfe(e,t,r=2){let i=t&&t.length,n=i?t[0]*r:e.length,a=q$(e,0,n,r,!0),o=[];if(!a||a.next===a.prev)return o;let s,l,u;if(i&&(a=ofe(e,t,a,r)),e.length>80*r){s=e[0],l=e[1];let c=s,d=l;for(let f=r;f<n;f+=r){let m=e[f],g=e[f+1];m<s&&(s=m),g<l&&(l=g),m>c&&(c=m),g>d&&(d=g)}u=Math.max(c-s,d-l),u=u!==0?32767/u:0}return Jf(a,o,r,s,l,u,0),o}function q$(e,t,r,i,n){let a;if(n===Afe(e,t,r,i)>0)for(let o=t;o<r;o+=i)a=Sz(o/i|0,e[o],e[o+1],a);else for(let o=r-i;o>=t;o-=i)a=Sz(o/i|0,e[o],e[o+1],a);return a&&Qh(a,a.next)&&(Kf(a),a=a.next),a}function Du(e,t){if(!e)return e;t||(t=e);let r=e,i;do if(i=!1,!r.steiner&&(Qh(r,r.next)||wr(r.prev,r,r.next)===0)){if(Kf(r),r=t=r.prev,r===r.next)break;i=!0}else r=r.next;while(i||r!==t);return t}function Jf(e,t,r,i,n,a,o){if(!e)return;!o&&a&&hfe(e,i,n,a);let s=e;for(;e.prev!==e.next;){let l=e.prev,u=e.next;if(a?ife(e,i,n,a):rfe(e)){t.push(l.i,e.i,u.i),Kf(e),e=u.next,s=u.next;continue}if(e=u,e===s){o?o===1?(e=nfe(Du(e),t),Jf(e,t,r,i,n,a,2)):o===2&&afe(e,t,r,i,n,a):Jf(Du(e),t,r,i,n,a,1);break}}}function rfe(e){let t=e.prev,r=e,i=e.next;if(wr(t,r,i)>=0)return!1;let n=t.x,a=r.x,o=i.x,s=t.y,l=r.y,u=i.y,c=Math.min(n,a,o),d=Math.min(s,l,u),f=Math.max(n,a,o),m=Math.max(s,l,u),g=i.next;for(;g!==t;){if(g.x>=c&&g.x<=f&&g.y>=d&&g.y<=m&&Dp(n,s,a,l,o,u,g.x,g.y)&&wr(g.prev,g,g.next)>=0)return!1;g=g.next}return!0}function ife(e,t,r,i){let n=e.prev,a=e,o=e.next;if(wr(n,a,o)>=0)return!1;let s=n.x,l=a.x,u=o.x,c=n.y,d=a.y,f=o.y,m=Math.min(s,l,u),g=Math.min(c,d,f),y=Math.max(s,l,u),_=Math.max(c,d,f),w=LC(m,g,t,r,i),I=LC(y,_,t,r,i),k=e.prevZ,D=e.nextZ;for(;k&&k.z>=w&&D&&D.z<=I;){if(k.x>=m&&k.x<=y&&k.y>=g&&k.y<=_&&k!==n&&k!==o&&Dp(s,c,l,d,u,f,k.x,k.y)&&wr(k.prev,k,k.next)>=0||(k=k.prevZ,D.x>=m&&D.x<=y&&D.y>=g&&D.y<=_&&D!==n&&D!==o&&Dp(s,c,l,d,u,f,D.x,D.y)&&wr(D.prev,D,D.next)>=0))return!1;D=D.nextZ}for(;k&&k.z>=w;){if(k.x>=m&&k.x<=y&&k.y>=g&&k.y<=_&&k!==n&&k!==o&&Dp(s,c,l,d,u,f,k.x,k.y)&&wr(k.prev,k,k.next)>=0)return!1;k=k.prevZ}for(;D&&D.z<=I;){if(D.x>=m&&D.x<=y&&D.y>=g&&D.y<=_&&D!==n&&D!==o&&Dp(s,c,l,d,u,f,D.x,D.y)&&wr(D.prev,D,D.next)>=0)return!1;D=D.nextZ}return!0}function nfe(e,t){let r=e;do{let i=r.prev,n=r.next.next;!Qh(i,n)&&eZ(i,r,r.next,n)&&qf(i,n)&&qf(n,i)&&(t.push(i.i,r.i,n.i),Kf(r),Kf(r.next),r=e=n),r=r.next}while(r!==e);return Du(r)}function afe(e,t,r,i,n,a){let o=e;do{let s=o.next.next;for(;s!==o.prev;){if(o.i!==s.i&&ffe(o,s)){let l=tZ(o,s);o=Du(o,o.next),l=Du(l,l.next),Jf(o,t,r,i,n,a,0),Jf(l,t,r,i,n,a,0);return}s=s.next}o=o.next}while(o!==e)}function ofe(e,t,r,i){let n=[];for(let a=0,o=t.length;a<o;a++){let s=t[a]*i,l=a<o-1?t[a+1]*i:e.length,u=q$(e,s,l,i,!1);u===u.next&&(u.steiner=!0),n.push(pfe(u))}n.sort(sfe);for(let a=0;a<n.length;a++)r=lfe(n[a],r);return r}function sfe(e,t){let r=e.x-t.x;if(r===0&&(r=e.y-t.y,r===0)){let i=(e.next.y-e.y)/(e.next.x-e.x),n=(t.next.y-t.y)/(t.next.x-t.x);r=i-n}return r}function lfe(e,t){let r=ufe(e,t);if(!r)return t;let i=tZ(r,e);return Du(i,i.next),Du(r,r.next)}function ufe(e,t){let r=t,i=e.x,n=e.y,a=-1/0,o;if(Qh(e,r))return r;do{if(Qh(e,r.next))return r.next;if(n<=r.y&&n>=r.next.y&&r.next.y!==r.y){let d=r.x+(n-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(d<=i&&d>a&&(a=d,o=r.x<r.next.x?r:r.next,d===i))return o}r=r.next}while(r!==t);if(!o)return null;let s=o,l=o.x,u=o.y,c=1/0;r=o;do{if(i>=r.x&&r.x>=l&&i!==r.x&&K$(n<u?i:a,n,l,u,n<u?a:i,n,r.x,r.y)){let d=Math.abs(n-r.y)/(i-r.x);qf(r,e)&&(d<c||d===c&&(r.x>o.x||r.x===o.x&&cfe(o,r)))&&(o=r,c=d)}r=r.next}while(r!==s);return o}function cfe(e,t){return wr(e.prev,e,t.prev)<0&&wr(t.next,e,e.next)<0}function hfe(e,t,r,i){let n=e;do n.z===0&&(n.z=LC(n.x,n.y,t,r,i)),n.prevZ=n.prev,n.nextZ=n.next,n=n.next;while(n!==e);n.prevZ.nextZ=null,n.prevZ=null,dfe(n)}function dfe(e){let t,r=1;do{let i=e,n;e=null;let a=null;for(t=0;i;){t++;let o=i,s=0;for(let u=0;u<r&&(s++,o=o.nextZ,!!o);u++);let l=r;for(;s>0||l>0&&o;)s!==0&&(l===0||!o||i.z<=o.z)?(n=i,i=i.nextZ,s--):(n=o,o=o.nextZ,l--),a?a.nextZ=n:e=n,n.prevZ=a,a=n;i=o}a.nextZ=null,r*=2}while(t>1);return e}function LC(e,t,r,i,n){return e=(e-r)*n|0,t=(t-i)*n|0,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,e|t<<1}function pfe(e){let t=e,r=e;do(t.x<r.x||t.x===r.x&&t.y<r.y)&&(r=t),t=t.next;while(t!==e);return r}function K$(e,t,r,i,n,a,o,s){return(n-o)*(t-s)>=(e-o)*(a-s)&&(e-o)*(i-s)>=(r-o)*(t-s)&&(r-o)*(a-s)>=(n-o)*(i-s)}function Dp(e,t,r,i,n,a,o,s){return!(e===o&&t===s)&&K$(e,t,r,i,n,a,o,s)}function ffe(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!mfe(e,t)&&(qf(e,t)&&qf(t,e)&&gfe(e,t)&&(wr(e.prev,e,t.prev)||wr(e,t.prev,t))||Qh(e,t)&&wr(e.prev,e,e.next)>0&&wr(t.prev,t,t.next)>0)}function wr(e,t,r){return(t.y-e.y)*(r.x-t.x)-(t.x-e.x)*(r.y-t.y)}function Qh(e,t){return e.x===t.x&&e.y===t.y}function eZ(e,t,r,i){let n=$0(wr(e,t,r)),a=$0(wr(e,t,i)),o=$0(wr(r,i,e)),s=$0(wr(r,i,t));return!!(n!==a&&o!==s||n===0&&W0(e,r,t)||a===0&&W0(e,i,t)||o===0&&W0(r,e,i)||s===0&&W0(r,t,i))}function W0(e,t,r){return t.x<=Math.max(e.x,r.x)&&t.x>=Math.min(e.x,r.x)&&t.y<=Math.max(e.y,r.y)&&t.y>=Math.min(e.y,r.y)}function $0(e){return e>0?1:e<0?-1:0}function mfe(e,t){let r=e;do{if(r.i!==e.i&&r.next.i!==e.i&&r.i!==t.i&&r.next.i!==t.i&&eZ(r,r.next,e,t))return!0;r=r.next}while(r!==e);return!1}function qf(e,t){return wr(e.prev,e,e.next)<0?wr(e,t,e.next)>=0&&wr(e,e.prev,t)>=0:wr(e,t,e.prev)<0||wr(e,e.next,t)<0}function gfe(e,t){let r=e,i=!1,n=(e.x+t.x)/2,a=(e.y+t.y)/2;do r.y>a!=r.next.y>a&&r.next.y!==r.y&&n<(r.next.x-r.x)*(a-r.y)/(r.next.y-r.y)+r.x&&(i=!i),r=r.next;while(r!==e);return i}function tZ(e,t){let r=zC(e.i,e.x,e.y),i=zC(t.i,t.x,t.y),n=e.next,a=t.prev;return e.next=t,t.prev=e,r.next=n,n.prev=r,i.next=r,r.prev=i,a.next=i,i.prev=a,i}function Sz(e,t,r,i){let n=zC(e,t,r);return i?(n.next=i.next,n.prev=i,i.next.prev=n,i.next=n):(n.prev=n,n.next=n),n}function Kf(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function zC(e,t,r){return{i:e,x:t,y:r,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function Afe(e,t,r,i){let n=0;for(let a=t,o=r-i;a<r;a+=i)n+=(e[o]-e[a])*(e[a+1]+e[o+1]),o=a;return n}function Iz(e,t,r,i=!0){return new _Z(r,t).subdividePolygonInternal(e,i)}function _w(e,t,r=!1){if(!e||e.length<1)return[];if(e.length<2)return[];let i=e[0],n=e[e.length-1],a=r&&(i.x!==n.x||i.y!==n.y);if(t<2)return a?[...e,e[0]]:[...e];let o=Math.floor(8192/t),s=[];s.push(new Lp.default(e[0].x,e[0].y));let l=e.length,u=a?l:l-1;for(let c=0;c<u;c++){let d=e[c],f=c<l-1?e[c+1]:e[0],m=d.x,g=d.y,y=f.x,_=f.y,w=m!==y,I=g!==_;if(!w&&!I)continue;let k=y-m,D=_-g,S=Math.abs(k),L=Math.abs(D),z=m,N=g;for(;;){let q=k>0?(Math.floor(z/o)+1)*o:(Math.ceil(z/o)-1)*o,V=D>0?(Math.floor(N/o)+1)*o:(Math.ceil(N/o)-1)*o,Q=Math.abs(z-q),$=Math.abs(N-V),B=Math.abs(z-y),U=Math.abs(N-_),X=w?Q/S:Number.POSITIVE_INFINITY,ne=I?$/L:Number.POSITIVE_INFINITY;if((B<=Q||!w)&&(U<=$||!I))break;if(X<ne&&w||!I){z=q,N=N+D*X;let ce=new Lp.default(z,Math.round(N));(s[s.length-1].x!==ce.x||s[s.length-1].y!==ce.y)&&s.push(ce)}else{z=z+k*ne,N=V;let ce=new Lp.default(Math.round(z),N);(s[s.length-1].x!==ce.x||s[s.length-1].y!==ce.y)&&s.push(ce)}}let H=new Lp.default(y,_);(s[s.length-1].x!==H.x||s[s.length-1].y!==H.y)&&s.push(H)}return s}function yfe(e){let t=[],r=[];for(let i of e)if(i.length!==0){i!==e[0]&&t.push(r.length/2);for(let n=0;n<i.length;n++)r.push(i[n].x),r.push(i[n].y)}return{flattened:r,holeIndices:t}}function vfe(e,t){let r=[];for(let i=0;i<t.length;i+=3){let n=t[i],a=t[i+1],o=t[i+2],s=e[n*2],l=e[n*2+1],u=e[a*2],c=e[a*2+1],d=e[o*2],f=e[o*2+1],m=u-s,g=c-l,y=d-s,_=f-l;m*_-g*y>0?(r.push(n),r.push(o),r.push(a)):(r.push(n),r.push(a),r.push(o))}return r}function xfe(e,t,r){if(t.length===0)throw new Error("Subdivision vertex ring is empty.");let i=0,n=e[t[0]*2];for(let l=1;l<t.length;l++){let u=e[t[l]*2];u<n&&(n=u,i=l)}let a=t.length,o=i,s=(o+1)%a;for(;;){let l=o-1>=0?o-1:a-1,u=(s+1)%a,c=e[t[l]*2],d=e[t[l]*2+1],f=e[t[u]*2],m=e[t[u]*2+1],g=e[t[o]*2],y=e[t[o]*2+1],_=e[t[s]*2],w=e[t[s]*2+1],I=!1;if(c<f)I=!0;else if(c>f)I=!1;else{let k=_-g,D=w-y,S=-k,L=y<w?1:-1,z=((c-g)*D+(d-y)*S)*L,N=((f-g)*D+(m-y)*S)*L;z>N&&(I=!0)}if(I){let k=t[l],D=t[o],S=t[s];k!==D&&k!==S&&D!==S&&r.push(S,D,k),o--,o<0&&(o=a-1)}else{let k=t[u],D=t[o],S=t[s];k!==D&&k!==S&&D!==S&&r.push(S,D,k),s++,s>=a&&(s=0)}if(l===u)break}}function Bz(e,t,r,i,n,a,o,s,l){let u=n.length/2,c=o&&s&&l;if(u<Ji.MAX_VERTEX_ARRAY_LENGTH){let d=t.prepareSegment(u,r,i),f=d.vertexLength;for(let y=0;y<a.length;y+=3)i.emplaceBack(f+a[y],f+a[y+1],f+a[y+2]);d.vertexLength+=u,d.primitiveLength+=a.length/3;let m,g;c&&(g=o.prepareSegment(u,r,s),m=g.vertexLength,g.vertexLength+=u);for(let y=0;y<n.length;y+=2)e(n[y],n[y+1]);if(c)for(let y=0;y<l.length;y++){let _=l[y];for(let w=1;w<_.length;w+=2)s.emplaceBack(m+_[w-1],m+_[w]);g.primitiveLength+=_.length/2}}else _fe(t,r,i,n,a,e),c&&bfe(o,r,s,n,l,e),t.forceNewSegmentOnNextPrepare(),o?.forceNewSegmentOnNextPrepare()}function af(e,t,r,i,n,a,o){if(a){let s=i.count;return r(t[n*2],t[n*2+1]),e[n]=i.count,i.count++,o.vertexLength++,s}else return e[n]}function _fe(e,t,r,i,n,a){let o=[];for(let d=0;d<i.length/2;d++)o.push(-1);let s={count:0},l=0,u=e.getOrCreateLatestSegment(t,r),c=u.vertexLength;for(let d=2;d<n.length;d+=3){let f=n[d-2],m=n[d-1],g=n[d],y=o[f]<l,_=o[m]<l,w=o[g]<l,I=(y?1:0)+(_?1:0)+(w?1:0);u.vertexLength+I>Ji.MAX_VERTEX_ARRAY_LENGTH&&(u=e.createNewSegment(t,r),l=s.count,y=!0,_=!0,w=!0,c=0);let k=af(o,i,a,s,f,y,u),D=af(o,i,a,s,m,_,u),S=af(o,i,a,s,g,w,u);r.emplaceBack(c+k-l,c+D-l,c+S-l),u.primitiveLength++}}function bfe(e,t,r,i,n,a){let o=[];for(let d=0;d<i.length/2;d++)o.push(-1);let s={count:0},l=0,u=e.getOrCreateLatestSegment(t,r),c=u.vertexLength;for(let d=0;d<n.length;d++){let f=n[d];for(let m=1;m<n[d].length;m+=2){let g=f[m-1],y=f[m],_=o[g]<l,w=o[y]<l,I=(_?1:0)+(w?1:0);u.vertexLength+I>Ji.MAX_VERTEX_ARRAY_LENGTH&&(u=e.createNewSegment(t,r),l=s.count,_=!0,w=!0,c=0);let k=af(o,i,a,s,g,_,u),D=af(o,i,a,s,y,w,u);r.emplaceBack(c+k-l,c+D-l),u.primitiveLength++}}}function Qd(e,t,r,i,n,a,o,s){e.emplaceBack(t,r,Math.floor(i*VA)*2+o,n*VA*2,a*VA*2,Math.round(s))}function wfe(e,t){for(let r=0;r<t.length;r++){let i=t[r];r===t.length-1&&t[0].x===i.x&&t[0].y===i.y||(e.x+=i.x,e.y+=i.y,e.sampleCount++)}}function Efe(e,t){return e.x===t.x&&(e.x<0||e.x>8192)||e.y===t.y&&(e.y<0||e.y>8192)}function Dz(e){return e.every(t=>t.x<0)||e.every(t=>t.x>8192)||e.every(t=>t.y<0)||e.every(t=>t.y>8192)}function Cfe(e,t,r){let i=t.layout.get("text-transform").evaluate(r,{});return i==="uppercase"?e=e.toLocaleUpperCase():i==="lowercase"&&(e=e.toLocaleLowerCase()),gu.applyArabicShaping&&(e=gu.applyArabicShaping(e)),e}function Mfe(e,t,r){return e.sections.forEach(i=>{i.text=Cfe(i.text,t,r)}),e}function Sfe(e){let t={},r={},i=[],n=0;function a(u){i.push(e[u]),n++}function o(u,c,d){let f=r[u];return delete r[u],r[c]=f,i[f].geometry[0].pop(),i[f].geometry[0]=i[f].geometry[0].concat(d[0]),f}function s(u,c,d){let f=t[c];return delete t[c],t[u]=f,i[f].geometry[0].shift(),i[f].geometry[0]=d[0].concat(i[f].geometry[0]),f}function l(u,c,d){let f=d?c[0][c[0].length-1]:c[0][0];return`${u}:${f.x}:${f.y}`}for(let u=0;u<e.length;u++){let c=e[u],d=c.geometry,f=c.text?c.text.toString():null;if(!f){a(u);continue}let m=l(f,d),g=l(f,d,!0);if(m in r&&g in t&&r[m]!==t[g]){let y=s(m,g,d),_=o(m,g,i[y].geometry);delete t[m],delete r[g],r[l(f,i[_].geometry,!0)]=_,i[y].geometry=null}else m in r?o(m,g,d):g in t?s(m,g,d):(a(u),t[m]=n-1,r[g]=n-1)}return i.filter(u=>u.geometry)}function Ife(e,t,r){e===1&&r.readMessage(Bfe,t)}function Bfe(e,t,r){if(e===3){let{id:i,bitmap:n,width:a,height:o,left:s,top:l,advance:u}=r.readMessage(Dfe,{});t.push({id:i,bitmap:new jA({width:a+2*aM,height:o+2*aM},n),metrics:{width:a,height:o,left:s,top:l,advance:u}})}}function Dfe(e,t,r){e===1?t.id=r.readVarint():e===2?t.bitmap=r.readBytes():e===3?t.width=r.readVarint():e===4?t.height=r.readVarint():e===5?t.left=r.readSVarint():e===6?t.top=r.readSVarint():e===7&&(t.advance=r.readVarint())}function Tfe(e){return new bZ.default(e).readFields(Ife,[])}function Pfe(e){let t=0,r=0;for(let o of e)t+=o.w*o.h,r=Math.max(r,o.w);e.sort((o,s)=>s.h-o.h);let i=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(t/.95)),r),h:1/0}],n=0,a=0;for(let o of e)for(let s=i.length-1;s>=0;s--){let l=i[s];if(!(o.w>l.w||o.h>l.h)){if(o.x=l.x,o.y=l.y,a=Math.max(a,o.y+o.h),n=Math.max(n,o.x+o.w),o.w===l.w&&o.h===l.h){let u=i.pop();u&&s<i.length&&(i[s]=u)}else o.h===l.h?(l.x+=o.w,l.w-=o.w):o.w===l.w?(l.y+=o.h,l.h-=o.h):(i.push({x:l.x+o.w,y:l.y,w:l.w-o.w,h:o.h}),l.y+=o.h,l.h-=o.h);break}}return{w:n,h:a,fill:t/(n*a)||0}}function Tz(e,t){let{expression:r}=t;if(r.kind==="constant")return{kind:"constant",layoutSize:r.evaluate(new Ur(e+1))};if(r.kind==="source")return{kind:"source"};{let{zoomStops:i,interpolationType:n}=r,a=0;for(;a<i.length&&i[a]<=e;)a++;a=Math.max(0,a-1);let o=a;for(;o<i.length&&i[o]<e+1;)o++;o=Math.min(i.length-1,o);let s=i[a],l=i[o];if(r.kind==="composite")return{kind:"composite",minZoom:s,maxZoom:l,interpolationType:n};let u=r.evaluate(new Ur(s)),c=r.evaluate(new Ur(l));return{kind:"camera",minZoom:s,maxZoom:l,minSize:u,maxSize:c,interpolationType:n}}}function Pz(e,t,r){let i="never",n=e.get(t);return n?i=n:e.get(r)&&(i="always"),i}function Z0(e,t,r,i,n,a,o,s,l,u,c,d,f){let m=s?Math.min(oM,Math.round(s[0])):0,g=s?Math.min(oM,Math.round(s[1])):0;e.emplaceBack(t,r,Math.round(i*32),Math.round(n*32),a,o,(m<<1)+(l?1:0),g,u*16,c*16,d*256,f*256)}function kz(e,t,r){e.emplaceBack(t.x,t.y,r),e.emplaceBack(t.x,t.y,r),e.emplaceBack(t.x,t.y,r),e.emplaceBack(t.x,t.y,r)}function kfe(e){for(let t of e.sections)if(Ype(t.text))return!0;return!1}async function Ffe(e,t,r,i){let n=t*256,a=n+255,o=i.transformRequest(r.replace("{fontstack}",e).replace("{range}",`${n}-${a}`),"Glyphs"),s=await lZ(o,new AbortController);if(!s||!s.data)throw new Error(`Could not load glyph range. range: ${t}, ${n}-${a}`);let l={};for(let u of Tfe(s.data))l[u.id]=u;return l}function Fz(e,t,r,i,n,a,o,s,l){for(let u=t;u<t+i;u++)Rz(e,r*a+u,a,n,o,s,l);for(let u=r;u<r+n;u++)Rz(e,u*a+t,1,i,o,s,l)}function Rz(e,t,r,i,n,a,o){a[0]=0,o[0]=-1e20,o[1]=1e20,n[0]=e[t];for(let s=1,l=0,u=0;s<i;s++){n[s]=e[t+s*r];let c=s*s;do{let d=a[l];u=(n[s]-n[d]+c-d*d)/(s-d)/2}while(u<=o[l]&&--l>-1);l++,a[l]=s,o[l]=u,o[l+1]=1e20}for(let s=0,l=0;s<i;s++){for(;o[l+1]<s;)l++;let u=a[l],c=s-u;e[t+s*r]=n[u]+c*c}}function Rfe(){return new Worker(wZ())}function Lfe(){return xE||(xE=new sM),xE}function zfe(){return Eg||(Eg=new EZ(Lfe(),OA),Eg.registerMessageHandler("GR",(e,t,r)=>Tp(t,r))),Eg}async function Lz(e,t,r){let i=e;if(e.url?i=(await sZ(t.transformRequest(e.url,"Source"),r)).data:await Ma.frameAsync(r),!i)return null;let n=CC(Ct(i,e),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);return"vector_layers"in i&&i.vector_layers&&(n.vectorLayerIds=i.vector_layers.map(a=>a.id)),n}function rZ(e){return lM*Math.cos(e*Math.PI/180)}function bw(e){return(180+e)/360}function ww(e){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+e*Math.PI/360)))/360}function Ofe(e,t){return e/rZ(t)}function Nfe(e){return e*360-180}function OC(e){let t=180-e*360;return 360/Math.PI*Math.atan(Math.exp(t*Math.PI/180))-90}function Ufe(e,t){return e*rZ(OC(t))}function jfe(e){return 1/Math.cos(e*Math.PI/180)}function Vfe(e,t,r){t=Math.pow(2,r)-t-1;var i=zz(e*256,t*256,r),n=zz((e+1)*256,(t+1)*256,r);return i[0]+","+i[1]+","+n[0]+","+n[1]}function zz(e,t,r){var i=2*Math.PI*6378137/256/Math.pow(2,r),n=e*i-2*Math.PI*6378137/2,a=t*i-2*Math.PI*6378137/2;return[n,a]}function Qfe(e,t,r){return!(e<QC||e>zA||r<0||r>=Math.pow(2,e)||t<0||t>=Math.pow(2,e))}function Gd(e,t,r,i,n){e*=2,e<0&&(e=e*-1-1);let a=1<<r;return(a*a*e+a*n+i).toString(36)+r.toString(36)+t.toString(36)}function Gfe(e,t,r){let i="",n;for(let a=e;a>0;a--)n=1<<a-1,i+=(t&n?1:0)+(r&n?2:0);return i}function Yfe(e){let t=as.fromPoints(e),r=t.width(),i=t.height(),n=Math.max(r,i),a=Math.max(0,Math.floor(-Math.log(n)/Math.LN2)),o=Math.pow(2,a);return new QA(a,Math.floor((t.minX+t.maxX)/2*o),Math.floor((t.minY+t.maxY)/2*o))}function Hfe(e){let t=e[1].x-e[0].x,r=e[1].y-e[0].y,i=e[2].x-e[0].x,n=e[2].y-e[0].y;return t*n-r*i<0}function Wfe(e,t){let r={};if(!t)return r;for(let i of e){let n=i.layerIds.map(a=>t.getLayer(a)).filter(Boolean);if(n.length!==0){i.layers=n,i.stateDependentLayerIds&&(i.stateDependentLayers=i.stateDependentLayerIds.map(a=>n.filter(o=>o.id===a)[0]));for(let a of n)r[a.id]=i}}return r}function Oz(e,t,r,i,n){return mde(e,(a,o)=>{let s=t instanceof yZ?t.get(o):null;return s&&s.evaluate?s.evaluate(r,i,n):s})}function $fe(e,t){return t-e}function Zfe(){return GA||(GA=new CZ),GA}function Xfe(e,t,r){let i=t.intersectsFrustum(e);if(!r||i===0)return i;let n=t.intersectsPlane(r);return n===0?0:i===2&&n===2?2:1}function Nz(e,t,r){let i=0,n=(r-t)/10;for(let a=0;a<10;a++){let o=t+(a+.5)/10*(r-t);i+=n*Math.pow(Math.cos(o),e)}return i}function Jfe(e,t){return function(r,i,n,a,o){let s=2*((e-1)/gh(Math.cos($l(YA-o))/Math.cos($l(YA)))-1),l=Math.acos(n/a),u=2*Nz(s-1,0,$l(o/2)),c=Math.min($l(YA),l+$l(o/2)),d=Math.min(c,l-$l(o/2)),f=Nz(s-1,d,c),m=Math.atan(i/n),g=Math.hypot(i,n),y=r;return y=y+gh(a/g/Math.max(.5,Math.cos($l(o/2)))),y+=s*gh(Math.cos(m))/2,y-=gh(Math.max(1,f/u/t))/2,y}}function iZ(e,t){let r=(t.roundZoom?Math.round:Math.floor)(e.zoom+gh(e.tileSize/t.tileSize));return Math.max(0,r)}function qfe(e,t){let r=e.getCameraFrustum(),i=e.getClippingPlane(),n=e.screenPointToMercatorCoordinate(e.getCameraPoint()),a=eh.fromLngLat(e.center,e.elevation);n.z=a.z+Math.cos(e.pitchInRadians)*e.cameraToCenterDistance/e.worldSize;let o=e.getCoveringTilesDetailsProvider(),s=o.allowVariableZoom(e,t),l=iZ(e,t),u=t.minzoom||0,c=t.maxzoom!==void 0?t.maxzoom:e.maxZoom,d=Math.min(Math.max(0,l),c),f=Math.pow(2,d),m=[f*n.x,f*n.y,0],g=[f*a.x,f*a.y,0],y=Math.hypot(a.x-n.x,a.y-n.y),_=Math.abs(a.z-n.z),w=Math.hypot(y,_),I=S=>({zoom:0,x:0,y:0,wrap:S,fullyVisible:!1}),k=[],D=[];if(e.renderWorldCopies&&o.allowWorldCopies())for(let S=1;S<=3;S++)k.push(I(-S)),k.push(I(S));for(k.push(I(0));k.length>0;){let S=k.pop(),L=S.x,z=S.y,N=S.fullyVisible,H={x:L,y:z,z:S.zoom},q=o.getTileBoundingVolume(H,S.wrap,e.elevation,t);if(!N){let B=Xfe(r,q,i);if(B===0)continue;N=B===2}let V=o.distanceToTile2d(n.x,n.y,H,q),Q=l;s&&(Q=(t.calculateTileZoom||MZ)(e.zoom+gh(e.tileSize/t.tileSize),V,_,w,e.fov)),Q=(t.roundZoom?Math.round:Math.floor)(Q),Q=Math.max(0,Q);let $=Math.min(Q,c);if(S.wrap=o.getWrap(a,H,S.wrap),S.zoom>=$){if(S.zoom<u)continue;let B=d-S.zoom,U=m[0]-.5-(L<<B),X=m[1]-.5-(z<<B),ne=t.reparseOverscaled?Math.max(S.zoom,Q):S.zoom;D.push({tileID:new Gn(S.zoom===c?ne:S.zoom,S.wrap,S.zoom,L,z),distanceSq:jC.sqrLen([g[0]-.5-L,g[1]-.5-z]),tileDistanceToCamera:Math.sqrt(U*U+X*X)});continue}for(let B=0;B<4;B++){let U=(L<<1)+B%2,X=(z<<1)+(B>>1),ne=S.zoom+1;k.push({zoom:ne,x:U,y:X,wrap:S.wrap,fullyVisible:N})}}return D.sort((S,L)=>S.distanceSq-L.distanceSq).map(S=>S.tileID)}function Uz(e,t){let r=Math.abs(e.wrap*2)-+(e.wrap<0),i=Math.abs(t.wrap*2)-+(t.wrap<0);return e.overscaledZ-t.overscaledZ||i-r||t.canonical.y-e.canonical.y||t.canonical.x-e.canonical.x}function jz(e){return e==="raster"||e==="image"||e==="video"}function gt(e,t){let r=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,i=t.match(/in ([\w]+) ([\w]+)/g),n=e.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),a=t.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),o=a?a.concat(n):n,s={};return e=e.replace(r,(l,u,c,d,f)=>(s[f]=!0,u==="define"?`
|
|
10918
10918
|
#ifndef HAS_UNIFORM_u_${f}
|
|
10919
10919
|
in ${c} ${d} ${f};
|